diff --git a/.eslintignore b/.eslintignore index bdfdfaeab2388d..19e0fcee9e1b5a 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,5 +1,4 @@ node_modules -lib/internal/v8_prof_polyfill.js lib/punycode.js test/addons/??_* test/fixtures diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index dd3a2964c85db9..56632fda4c67eb 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,25 +1,15 @@ - -#### Related Issues - -Fixes: https://github.com/nodejs/node/issues/ +For code changes: +1. Include tests for any bug fixes or new features. +2. Update documentation if relevant. +3. Ensure that `make -j4 test` (UNIX), or `vcbuild test` (Windows) passes. -##### Checklist - - -- [ ] `make -j4 test` (UNIX), or `vcbuild test` (Windows) passes -- [ ] tests and/or benchmarks are included -- [ ] documentation is changed or added -- [ ] commit message follows [commit guidelines](https://github.com/nodejs/node/blob/master/doc/guides/contributing/pull-requests.md#commit-message-guidelines) - - Creates a new instance of `AsyncLocalStorage`. Store is only provided within a -`run` method call. +`run()` call or after an `enterWith()` call. ### `asyncLocalStorage.disable()` -This method disables the instance of `AsyncLocalStorage`. All subsequent calls +Disables the instance of `AsyncLocalStorage`. All subsequent calls to `asyncLocalStorage.getStore()` will return `undefined` until -`asyncLocalStorage.run()` is called again. +`asyncLocalStorage.run()` or `asyncLocalStorage.enterWith()` is called again. When calling `asyncLocalStorage.disable()`, all current contexts linked to the instance will be exited. @@ -1021,7 +1031,7 @@ Calling `asyncLocalStorage.disable()` is required before the provided by the `asyncLocalStorage`, as those objects are garbage collected along with the corresponding async resources. -This method is to be used when the `asyncLocalStorage` is not in use anymore +Use this method when the `asyncLocalStorage` is not in use anymore in the current process. ### `asyncLocalStorage.getStore()` @@ -1033,9 +1043,10 @@ added: * Returns: {any} -This method returns the current store. -If this method is called outside of an asynchronous context initialized by -calling `asyncLocalStorage.run`, it will return `undefined`. +Returns the current store. +If called outside of an asynchronous context initialized by +calling `asyncLocalStorage.run()` or `asyncLocalStorage.enterWith()`, it +returns `undefined`. ### `asyncLocalStorage.enterWith(store)` + +Initializes an OpenSSL secure heap of `n` bytes. When initialized, the +secure heap is used for selected types of allocations within OpenSSL +during key generation and other operations. This is useful, for instance, +to prevent sensitive information from leaking due to pointer overruns +or underruns. + +The secure heap is a fixed size and cannot be resized at runtime so, +if used, it is important to select a large enough heap to cover all +application uses. + +The heap size given must be a power of two. Any value less than 2 +will disable the secure heap. + +The secure heap is disabled by default. + +The secure heap is not available on Windows. + +See [`CRYPTO_secure_malloc_init`][] for more details. + +### `--secure-heap-min=n` + + +When using `--secure-heap`, the `--secure-heap-min` flag specifies the +minimum allocation from the secure heap. The minimum value is `2`. +The maximum value is the lesser of `--secure-heap` or `2147483647`. +The value given must be a power of two. + ### `--throw-deprecation` + +Encapsulates an X509 certificate and provides read-only access to +it's information. + +```js +const { X509Certificate } = require('crypto'); + +const x509 = new X509Certificate('{... pem encoded cert ...}'); + +console.log(x509.subject); +``` + +### `new X509Certificate(buffer)` + + +* `buffer` {string|TypedArray|Buffer|DataView} A PEM or DER encoded + X509 Certificate. + +### `x509.ca` + + +* Type: {boolean} Will be `true` if this is a Certificate Authority (ca) + certificate. + +### `x509.checkEmail(email[, options])` + + +* `email` {string} +* `options` {Object} + * `subject` {string} `'always'` or `'never'`. **Defaults**: `'always'`. + * `wildcards` {boolean} **Defaults**: `true`. + * `partialWildcards` {boolean} **Defaults**: `true`. + * `multiLabelWildcards` {boolean} **Defaults**: `false`. + * `singleLabelSubdomains` {boolean} **Defaults**: `false`. +* Returns: {string|undefined} Returns `email` if the certificate matches, + `undefined` if it does not. + +Checks whether the certificate matches the given email address. + +### `x509.checkHost(name[, options])` + + +* `name` {string} +* `options` {Object} + * `subject` {string} `'always'` or `'never'`. **Defaults**: `'always'`. + * `wildcards` {boolean} **Defaults**: `true`. + * `partialWildcards` {boolean} **Defaults**: `true`. + * `multiLabelWildcards` {boolean} **Defaults**: `false`. + * `singleLabelSubdomains` {boolean} **Defaults**: `false`. +* Returns: {string|undefined} Returns `name` if the certificate matches, + `undefined` if it does not. + +Checks whether the certificate matches the given host name. + +### `x509.checkIP(ip[, options])` + + +* `ip` {string} +* `options` {Object} + * `subject` {string} `'always'` or `'never'`. **Defaults**: `'always'`. + * `wildcards` {boolean} **Defaults**: `true`. + * `partialWildcards` {boolean} **Defaults**: `true`. + * `multiLabelWildcards` {boolean} **Defaults**: `false`. + * `singleLabelSubdomains` {boolean} **Defaults**: `false`. +* Returns: {string|undefined} Returns `ip` if the certificate matches, + `undefined` if it does not. + +Checks whether the certificate matches the given IP address (IPv4 or IPv6). + +### `x509.checkIssued(otherCert)` + + +* `otherCert` {X509Certificate} +* Returns: {boolean} + +Checks whether this certificate was issued by the given `otherCert`. + +### `x509.checkPrivateKey(privateKey)` + + +* `privateKey` {KeyObject} A private key. +* Returns: {boolean} + +Checks whether the public key for this certificate is consistent with +the given private key. + +### `x509.fingerprint` + + +* Type: {string} + +The SHA-1 fingerprint of this certificate. + +### `x509.fingerprint256` + + +* Type: {string} + +The SHA-256 fingerprint of this certificate. + +### `x509.infoAccess` + + +* Type: {string} + +The information access content of this certificate. + +### `x509.issuer` + + +* Type: {string} + +The issuer identification included in this certificate. + +### `x509.keyUsage` + + +* Type: {string[]} + +An array detailing the key usages for this certificate. + +### `x509.publicKey` + + +* Type: {KeyObject} + +The public key {KeyObject} for this certificate. + +### `x509.raw` + + +* Type: {Buffer} + +A `Buffer` containing the DER encoding of this certificate. + +### `x509.serialNumber` + + +* Type: {string} + +The serial number of this certificate. + +### `x509.subject` + + +* Type: {string} + +The complete subject of this certificate. + +### `x509.subjectAltName` + + +* Type: {string} + +The subject alternative name specified for this certificate. + +### `x509.toJSON()` + + +* Type: {string} + +There is no standard JSON encoding for X509 certificates. The +`toJSON()` method returns a string containing the PEM encoded +certificate. + +### `x509.toLegacyObject()` + + +* Type: {Object} + +Returns information about this certificate using the legacy +[certificate object][] encoding. + +### `x509.toString()` + + +* Type: {string} + +Returns the PEM-encoded certificate. + +### `x509.validFrom` + + +* Type: {string} + +The date/time from which this certificate is considered valid. + +### `x509.validTo` + + +* Type: {string} + +The date/time until which this certificate is considered valid. + +### `x509.verify(publicKey)` + + +* `publicKey` {KeyObject} A public key. +* Returns: {boolean} + +Verifies that this certificate was signed by the given public key. +Does not perform any other validation checks on the certificate. + ## `crypto` module methods and properties ### `crypto.constants` @@ -3160,6 +3413,21 @@ const n = crypto.randomInt(1, 7); console.log(`The dice rolled: ${n}`); ``` +### `crypto.randomUUID([options])` + + +* `options` {Object} + * `disableEntropyCache` {boolean} By default, to improve performance, + Node.js generates and caches enough + random data to generate up to 128 random UUIDs. To generate a UUID + without using the cache, set `disableEntropyCache` to `true`. + **Defaults**: `false`. +* Returns: {string} + +Generates a random [RFC 4122][] Version 4 UUID. + ### `crypto.scrypt(password, salt, keylen[, options], callback)` + +* Returns: {Object} + * `total` {number} The total allocated secure heap size as specified + using the `--secure-heap=n` command-line flag. + * `min` {number} The minimum allocation from the secure heap as + specified using the `--secure-heap-min` command-line flag. + * `used` {number} The total number of bytes currently allocated from + the secure heap. + * `utilization` {number} The calculated ratio of `used` to `total` + allocated bytes. + ### `crypto.setEngine(engine[, flags])` -* Type: {boolean} True for Node.js internal events, false otherwise. +* Type: {boolean} -Currently only `AbortSignal`s' `"abort"` event is fired with `isTrusted` -set to `true`. +The {AbortSignal} `"abort"` event is emitted with `isTrusted` set to `true`. The +value is `false` in all other cases. #### `event.preventDefault()` * {Object} diff --git a/doc/api/http2.md b/doc/api/http2.md index ddb5658d25367f..ec6a6381d7eb75 100644 --- a/doc/api/http2.md +++ b/doc/api/http2.md @@ -3283,6 +3283,25 @@ deprecated: v13.0.0 See [`response.socket`][]. +#### `response.createPushResponse(headers, callback)` + + +* `headers` {HTTP/2 Headers Object} An object describing the headers +* `callback` {Function} Called once `http2stream.pushStream()` is finished, + or either when the attempt to create the pushed `Http2Stream` has failed or + has been rejected, or the state of `Http2ServerRequest` is closed prior to + calling the `http2stream.pushStream()` method + * `err` {Error} + * `res` {http2.Http2ServerResponse} The newly-created `Http2ServerResponse` + object + +Call [`http2stream.pushStream()`][] with the given headers, and wrap the +given [`Http2Stream`][] on a newly created `Http2ServerResponse` as the callback +parameter if successful. When `Http2ServerRequest` is closed, the callback is +called with an error `ERR_HTTP2_INVALID_STREAM`. + #### `response.end([data[, encoding]][, callback])` - -* `headers` {HTTP/2 Headers Object} An object describing the headers -* `callback` {Function} Called once `http2stream.pushStream()` is finished, - or either when the attempt to create the pushed `Http2Stream` has failed or - has been rejected, or the state of `Http2ServerRequest` is closed prior to - calling the `http2stream.pushStream()` method - * `err` {Error} - * `stream` {ServerHttp2Stream} The newly-created `ServerHttp2Stream` object - -Call [`http2stream.pushStream()`][] with the given headers, and wrap the -given [`Http2Stream`][] on a newly created `Http2ServerResponse` as the callback -parameter if successful. When `Http2ServerRequest` is closed, the callback is -called with an error `ERR_HTTP2_INVALID_STREAM`. - ## Collecting HTTP/2 performance metrics The [Performance Observer][] API can be used to collect basic performance diff --git a/doc/api/https.md b/doc/api/https.md index b322c3ee147909..f4c1f0487a779a 100644 --- a/doc/api/https.md +++ b/doc/api/https.md @@ -275,6 +275,7 @@ changes: * `port` **Default:** `443` * `agent` **Default:** `https.globalAgent` * `callback` {Function} +* Returns: {http.ClientRequest} Makes a request to a secure web server. @@ -288,6 +289,10 @@ The following additional `options` from [`tls.connect()`][] are also accepted: string, it is automatically parsed with [`new URL()`][]. If it is a [`URL`][] object, it will be automatically converted to an ordinary `options` object. +`https.request()` returns an instance of the [`http.ClientRequest`][] +class. The `ClientRequest` instance is a writable stream. If one needs to +upload a file with a POST request, then write to the `ClientRequest` object. + ```js const https = require('https'); @@ -458,6 +463,7 @@ headers: max-age=0; pin-sha256="WoiWRyIOVNa9ihaBciRSC7XHjliYS9VwUGOIud4PB18="; p [`URL`]: url.md#url_the_whatwg_url_api [`http.Agent(options)`]: http.md#http_new_agent_options [`http.Agent`]: http.md#http_class_http_agent +[`http.ClientRequest`]: http.md#http_class_http_clientrequest [`http.Server#headersTimeout`]: http.md#http_server_headerstimeout [`http.Server#keepAliveTimeout`]: http.md#http_server_keepalivetimeout [`http.Server#maxHeadersCount`]: http.md#http_server_maxheaderscount diff --git a/doc/api/module.md b/doc/api/module.md index b78aa986da5778..637b7f3e059b0b 100644 --- a/doc/api/module.md +++ b/doc/api/module.md @@ -95,21 +95,29 @@ does not add or remove exported names from the [ES Modules][]. ```js const fs = require('fs'); +const assert = require('assert'); const { syncBuiltinESMExports } = require('module'); -fs.readFile = null; +fs.readFile = newAPI; delete fs.readFileSync; -fs.newAPI = function newAPI() { +function newAPI() { // ... -}; +} + +fs.newAPI = newAPI; syncBuiltinESMExports(); import('fs').then((esmFS) => { - assert.strictEqual(esmFS.readFile, null); - assert.strictEqual('readFileSync' in fs, true); + // It syncs the existing readFile property with the new value + assert.strictEqual(esmFS.readFile, newAPI); + // readFileSync has been deleted from the required fs + assert.strictEqual('readFileSync' in fs, false); + // syncBuiltinESMExports() does not remove readFileSync from esmFS + assert.strictEqual('readFileSync' in esmFS, true); + // syncBuiltinESMExports() does not add names assert.strictEqual(esmFS.newAPI, undefined); }); ``` diff --git a/doc/api/n-api.md b/doc/api/n-api.md index 9ad15223f11da7..82bf1897b4951d 100644 --- a/doc/api/n-api.md +++ b/doc/api/n-api.md @@ -1853,8 +1853,8 @@ napi_value Init(napi_env env, napi_value exports) { } ``` -If the module will be loaded multiple times during the lifetime of the Node.js -process, use the `NAPI_MODULE_INIT` macro to initialize the module: +You can also use the `NAPI_MODULE_INIT` macro, which acts as a shorthand +for `NAPI_MODULE` and defining an `Init` function: ```c NAPI_MODULE_INIT() { @@ -1871,13 +1871,9 @@ NAPI_MODULE_INIT() { } ``` -This macro includes `NAPI_MODULE`, and declares an `Init` function with a -special name and with visibility beyond the addon. This will allow Node.js to -initialize the module even if it is loaded multiple times. - -There are a few design considerations when declaring a module that may be loaded -multiple times. The documentation of [context-aware addons][] provides more -details. +All N-API addons are context-aware, meaning they may be loaded multiple +times. There are a few design considerations when declaring such a module. +The documentation on [context-aware addons][] provides more details. The variables `env` and `exports` will be available inside the function body following the macro invocation. diff --git a/doc/api/net.md b/doc/api/net.md index 7e3492b4b7b0b1..d489070e24018b 100644 --- a/doc/api/net.md +++ b/doc/api/net.md @@ -324,6 +324,9 @@ Listening on a file descriptor is not supported on Windows. @@ -1552,26 +1575,19 @@ changes: * `external` {integer} * `arrayBuffers` {integer} -The `process.memoryUsage()` method returns an object describing the memory usage -of the Node.js process measured in bytes. - -For example, the code: +Returns an object describing the memory usage of the Node.js process measured in +bytes. ```js console.log(process.memoryUsage()); -``` - -Will generate: - - -```js -{ - rss: 4935680, - heapTotal: 1826816, - heapUsed: 650472, - external: 49879, - arrayBuffers: 9386 -} +// Prints: +// { +// rss: 4935680, +// heapTotal: 1826816, +// heapUsed: 650472, +// external: 49879, +// arrayBuffers: 9386 +// } ``` * `heapTotal` and `heapUsed` refer to V8's memory usage. @@ -1589,6 +1605,32 @@ Will generate: When using [`Worker`][] threads, `rss` will be a value that is valid for the entire process, while the other fields will only refer to the current thread. +The `process.memoryUsage()` method iterates over each page to gather +information about memory usage which might be slow depending on the +program memory allocations. + +## `process.memoryUsage.rss()` + + +* Returns: {integer} + +The `process.memoryUsage.rss()` method returns an integer representing the +Resident Set Size (RSS) in bytes. + +The Resident Set Size, is the amount of space occupied in the main +memory device (that is a subset of the total allocated memory) for the +process, including all C++ and JavaScript objects and code. + +This is the same value as the `rss` property provided by `process.memoryUsage()` +but `process.memoryUsage.rss()` is faster. + +```js +console.log(process.memoryUsage.rss()); +// 35655680 +``` + ## `process.nextTick(callback[, ...args])` ```js @@ -2677,6 +2718,7 @@ cases: [`subprocess.kill()`]: child_process.md#child_process_subprocess_kill_signal [`v8.setFlagsFromString()`]: v8.md#v8_v8_setflagsfromstring_flags [debugger]: debugger.md +[deprecation code]: deprecations.md [note on process I/O]: process.md#process_a_note_on_process_i_o [process.cpuUsage]: #process_process_cpuusage_previousvalue [process_emit_warning]: #process_process_emitwarning_warning_type_code_ctor diff --git a/doc/api/punycode.md b/doc/api/punycode.md index 620585afa484c1..c9c20ce6350c7e 100644 --- a/doc/api/punycode.md +++ b/doc/api/punycode.md @@ -12,7 +12,9 @@ deprecated: v7.0.0 **The version of the punycode module bundled in Node.js is being deprecated**. In a future major version of Node.js this module will be removed. Users currently depending on the `punycode` module should switch to using the -userland-provided [Punycode.js][] module instead. +userland-provided [Punycode.js][] module instead. For punycode-based URL +encoding, see [`url.domainToASCII`][] or, more generally, the +[WHATWG URL API][]. The `punycode` module is a bundled version of the [Punycode.js][] module. It can be accessed using: @@ -150,3 +152,5 @@ Returns a string identifying the current [Punycode.js][] version number. [Punycode]: https://tools.ietf.org/html/rfc3492 [Punycode.js]: https://github.com/bestiejs/punycode.js +[WHATWG URL API]: url.md#url_the_whatwg_url_api +[`url.domainToASCII`]: url.md#url_url_domaintoascii_domain diff --git a/doc/api/stream.md b/doc/api/stream.md index 4b4b0b34440695..1d6b811c655fd5 100644 --- a/doc/api/stream.md +++ b/doc/api/stream.md @@ -75,8 +75,7 @@ object mode is not safe. Both [`Writable`][] and [`Readable`][] streams will store data in an internal -buffer that can be retrieved using `writable.writableBuffer` or -`readable.readableBuffer`, respectively. +buffer. The amount of data potentially buffered depends on the `highWaterMark` option passed into the stream's constructor. For normal streams, the `highWaterMark` @@ -120,6 +119,11 @@ writing data *to* the socket. Because data may be written to the socket at a faster or slower rate than data is received, each side should operate (and buffer) independently of the other. +The mechanics of the internal buffering are an internal implementation detail +and may be changed at any time. However, for certain advanced implementations, +the internal buffers can be retrieved using `writable.writableBuffer` or +`readable.readableBuffer`. Use of these undocumented properties is discouraged. + ## API for stream consumers @@ -2078,10 +2082,9 @@ class WriteStream extends Writable { constructor(filename) { super(); this.filename = filename; - this.fd = fd; } _construct(callback) { - fs.open(this.filename, (fd, err) => { + fs.open(this.filename, (err, fd) => { if (err) { callback(err); } else { @@ -2159,8 +2162,14 @@ user programs. #### `writable._writev(chunks, callback)` -* `chunks` {Object[]} The chunks to be written. Each chunk has following - format: `{ chunk: ..., encoding: ... }`. +* `chunks` {Object[]} The data to be written. The value is an array of {Object} + that each represent a discreet chunk of data to write. The properties of + these objects are: + * `chunk` {Buffer|string} A buffer instance or string containing the data to + be written. The `chunk` will be a string if the `Writable` was created with + the `decodeStrings` option set to `false` and a string was passed to `write()`. + * `encoding` {string} The character encoding of the `chunk`. If `chunk` is + a `Buffer`, the `encoding` will be `'buffer`. * `callback` {Function} A callback function (optionally with an error argument) to be invoked when processing is complete for the supplied chunks. diff --git a/doc/api/worker_threads.md b/doc/api/worker_threads.md index 2f46c6ef1a14ef..f3d8f44e4abac3 100644 --- a/doc/api/worker_threads.md +++ b/doc/api/worker_threads.md @@ -452,6 +452,12 @@ added: The `'messageerror'` event is emitted when deserializing a message failed. +Currently, this event is emitted when there is an error occurring while +instantiating the posted JS object on the receiving end. Such situations +are rare, but can happen, for instance, when certain Node.js API objects +are received in a `vm.Context` (where Node.js APIs are currently +unavailable). + ### `port.close()` - -#### Related Issues - -Fixes: https://github.com/nodejs/node/issues/ - -#### Checklist - - -- [ ] `make -j4 test` (UNIX), or `vcbuild test` (Windows) passes -- [ ] tests and/or benchmarks are included -- [ ] documentation is changed or added -- [ ] commit message follows [commit guidelines](https://github.com/nodejs/node/blob/master/doc/guides/contributing/pull-requests.md#commit-message-guidelines) -``` - -Please try to do your best at filling out the details, but feel free to skip -parts if you're not sure what to put. +From within GitHub, opening a new Pull Request will present you with a +[pull request template][]. Please try to do your best at filling out the +details, but feel free to skip parts if you're not sure what to put. Once opened, Pull Requests are usually reviewed within a few days. @@ -630,4 +605,5 @@ More than one subsystem may be valid for any particular issue or pull request. [guide for writing tests in Node.js]: ../writing-tests.md [hiding-a-comment]: https://help.github.com/articles/managing-disruptive-comments/#hiding-a-comment [https://ci.nodejs.org/]: https://ci.nodejs.org/ +[pull request template]: https://raw.githubusercontent.com/nodejs/node/master/.github/PULL_REQUEST_TEMPLATE.md [running tests]: ../../../BUILDING.md#running-tests diff --git a/doc/guides/maintaining-openssl.md b/doc/guides/maintaining-openssl.md index 1b59c24f8c32d4..1e75831482a260 100644 --- a/doc/guides/maintaining-openssl.md +++ b/doc/guides/maintaining-openssl.md @@ -2,6 +2,21 @@ This document describes how to update `deps/openssl/`. +If you need to provide updates across all active release lines you will +currently need to generate three PRs as follows: + +* a PR for master which is generated following the instructions + below which include the QUIC patch. +* a PR for 14.x following the instruction below based on the + 14,x branch but skipping the step to apply the QUICK patch. + This PR should cherry pick back to the active release lines + except for the 10.x line. +* a PR which uses the same commit from the second PR to apply the + updates to the openssl source code, with a new commit generated + by following steps 2 onwards on the 10.x line. This is + necessary because differences in 10.x requires that the + configuration files be regenerated specifically for 10.x. + ## Requirements * Linux environment. * `perl` Only Perl version 5 is tested. diff --git a/doc/guides/releases.md b/doc/guides/releases.md index 5444f2d364554e..903b31c744abc2 100644 --- a/doc/guides/releases.md +++ b/doc/guides/releases.md @@ -497,7 +497,7 @@ $ git secure-tag -sm "YYYY-MM-DD Node.js vx.y.z ( + @@ -23,7 +23,20 @@
-

Node.js __VERSION__ Documentation

+
+

Node.js __VERSION__ Documentation

+ +
  • @@ -54,4 +67,40 @@

    Table of Contents

+ diff --git a/lib/_http_agent.js b/lib/_http_agent.js index 686d561b283d89..d44e435620b942 100644 --- a/lib/_http_agent.js +++ b/lib/_http_agent.js @@ -22,10 +22,21 @@ 'use strict'; const { + ArrayPrototypeIncludes, + ArrayPrototypeIndexOf, + ArrayPrototypePop, + ArrayPrototypePush, + ArrayPrototypeShift, + ArrayPrototypeSplice, + FunctionPrototypeCall, NumberIsNaN, ObjectKeys, ObjectSetPrototypeOf, ObjectValues, + StringPrototypeIndexOf, + StringPrototypeSplit, + StringPrototypeStartsWith, + StringPrototypeSubstr, Symbol, } = primordials; @@ -78,7 +89,7 @@ function Agent(options) { if (!(this instanceof Agent)) return new Agent(options); - EventEmitter.call(this); + FunctionPrototypeCall(EventEmitter, this); this.defaultPort = 80; this.protocol = 'http:'; @@ -94,7 +105,7 @@ function Agent(options) { this.keepAlive = this.options.keepAlive || false; this.maxSockets = this.options.maxSockets || Agent.defaultMaxSockets; this.maxFreeSockets = this.options.maxFreeSockets || 256; - this.scheduling = this.options.scheduling || 'fifo'; + this.scheduling = this.options.scheduling || 'lifo'; this.maxTotalSockets = this.options.maxTotalSockets; this.totalSocketCount = 0; @@ -125,7 +136,7 @@ function Agent(options) { const requests = this.requests[name]; if (requests && requests.length) { - const req = requests.shift(); + const req = ArrayPrototypeShift(requests); const reqAsyncRes = req[kRequestAsyncResource]; if (reqAsyncRes) { // Run request within the original async context. @@ -171,7 +182,7 @@ function Agent(options) { this.removeSocket(socket, options); socket.once('error', freeSocketErrorListener); - freeSockets.push(socket); + ArrayPrototypePush(freeSockets, socket); }); // Don't emit keylog events unless there is a listener for them. @@ -249,11 +260,11 @@ Agent.prototype.addRequest = function addRequest(req, options, port/* legacy */, let socket; if (freeSockets) { while (freeSockets.length && freeSockets[0].destroyed) { - freeSockets.shift(); + ArrayPrototypeShift(freeSockets); } socket = this.scheduling === 'fifo' ? - freeSockets.shift() : - freeSockets.pop(); + ArrayPrototypeShift(freeSockets) : + ArrayPrototypePop(freeSockets); if (!freeSockets.length) delete this.freeSockets[name]; } @@ -265,7 +276,7 @@ Agent.prototype.addRequest = function addRequest(req, options, port/* legacy */, asyncResetHandle(socket); this.reuseSocket(socket, req); setRequestSocket(this, req, socket); - this.sockets[name].push(socket); + ArrayPrototypePush(this.sockets[name], socket); this.totalSocketCount++; } else if (sockLen < this.maxSockets && this.totalSocketCount < this.maxTotalSockets) { @@ -289,7 +300,7 @@ Agent.prototype.addRequest = function addRequest(req, options, port/* legacy */, // Used to capture the original async context. req[kRequestAsyncResource] = new AsyncResource('QueuedRequest'); - this.requests[name].push(req); + ArrayPrototypePush(this.requests[name], req); } }; @@ -313,7 +324,7 @@ Agent.prototype.createSocket = function createSocket(req, options, cb) { if (!this.sockets[name]) { this.sockets[name] = []; } - this.sockets[name].push(s); + ArrayPrototypePush(this.sockets[name], s); this.totalSocketCount++; debug('sockets', name, this.sockets[name].length, this.totalSocketCount); installListeners(this, s, options); @@ -338,16 +349,16 @@ function calculateServerName(options, req) { // abc:123 => abc // [::1] => ::1 // [::1]:123 => ::1 - if (hostHeader.startsWith('[')) { - const index = hostHeader.indexOf(']'); + if (StringPrototypeStartsWith(hostHeader, '[')) { + const index = StringPrototypeIndexOf(hostHeader, ']'); if (index === -1) { // Leading '[', but no ']'. Need to do something... servername = hostHeader; } else { - servername = hostHeader.substr(1, index - 1); + servername = StringPrototypeSubstr(hostHeader, 1, index - 1); } } else { - servername = hostHeader.split(':', 1)[0]; + servername = StringPrototypeSplit(hostHeader, ':', 1)[0]; } } // Don't implicitly set invalid (IP) servernames. @@ -379,7 +390,7 @@ function installListeners(agent, s, options) { // TODO(ronag): Always destroy, even if not in free list. const sockets = agent.freeSockets; for (const name of ObjectKeys(sockets)) { - if (sockets[name].includes(s)) { + if (ArrayPrototypeIncludes(sockets[name], s)) { return s.destroy(); } } @@ -411,13 +422,13 @@ Agent.prototype.removeSocket = function removeSocket(s, options) { // If the socket was destroyed, remove it from the free buffers too. if (!s.writable) - sets.push(this.freeSockets); + ArrayPrototypePush(sets, this.freeSockets); for (const sockets of sets) { if (sockets[name]) { - const index = sockets[name].indexOf(s); + const index = ArrayPrototypeIndexOf(sockets[name], s); if (index !== -1) { - sockets[name].splice(index, 1); + ArrayPrototypeSplice(sockets[name], index, 1); // Don't leak if (sockets[name].length === 0) delete sockets[name]; diff --git a/lib/_http_client.js b/lib/_http_client.js index 782b8e9714fe81..6bae982eb1c97b 100644 --- a/lib/_http_client.js +++ b/lib/_http_client.js @@ -25,12 +25,20 @@ const { ArrayIsArray, Boolean, Error, + FunctionPrototypeCall, NumberIsFinite, ObjectAssign, ObjectKeys, ObjectSetPrototypeOf, + ReflectApply, + RegExpPrototypeTest, String, - Symbol + StringPrototypeCharCodeAt, + StringPrototypeIncludes, + StringPrototypeIndexOf, + StringPrototypeToUpperCase, + Symbol, + TypedArrayPrototypeSlice, } = primordials; const net = require('net'); @@ -91,7 +99,7 @@ class HTTPClientAsyncResource { let urlWarningEmitted = false; function ClientRequest(input, options, cb) { - OutgoingMessage.call(this); + FunctionPrototypeCall(OutgoingMessage, this); if (typeof input === 'string') { const urlStr = input; @@ -151,7 +159,7 @@ function ClientRequest(input, options, cb) { if (options.path) { const path = String(options.path); - if (INVALID_PATH_REGEX.test(path)) + if (RegExpPrototypeTest(INVALID_PATH_REGEX, path)) throw new ERR_UNESCAPED_CHARACTERS('Request path'); } @@ -187,7 +195,7 @@ function ClientRequest(input, options, cb) { if (!checkIsHttpToken(method)) { throw new ERR_INVALID_HTTP_TOKEN('Method', method); } - method = this.method = method.toUpperCase(); + method = this.method = StringPrototypeToUpperCase(method); } else { method = this.method = 'GET'; } @@ -266,10 +274,10 @@ function ClientRequest(input, options, cb) { // For the Host header, ensure that IPv6 addresses are enclosed // in square brackets, as defined by URI formatting // https://tools.ietf.org/html/rfc3986#section-3.2.2 - const posColon = hostHeader.indexOf(':'); + const posColon = StringPrototypeIndexOf(hostHeader, ':'); if (posColon !== -1 && - hostHeader.includes(':', posColon + 1) && - hostHeader.charCodeAt(0) !== 91/* '[' */) { + StringPrototypeIncludes(hostHeader, ':', posColon + 1) && + StringPrototypeCharCodeAt(hostHeader, 0) !== 91/* '[' */) { hostHeader = `[${hostHeader}]`; } @@ -337,7 +345,7 @@ ObjectSetPrototypeOf(ClientRequest, OutgoingMessage); ClientRequest.prototype._finish = function _finish() { DTRACE_HTTP_CLIENT_REQUEST(this, this.socket); - OutgoingMessage.prototype._finish.call(this); + FunctionPrototypeCall(OutgoingMessage.prototype._finish, this); }; ClientRequest.prototype._implicitHeader = function _implicitHeader() { @@ -430,13 +438,25 @@ function socketCloseListener() { req.destroyed = true; if (res) { // Socket closed before we emitted 'end' below. + // TOOD(ronag): res.destroy(err) if (!res.complete) { - res.destroy(connResetException('aborted')); + res.aborted = true; + res.emit('aborted'); + if (res.listenerCount('error') > 0) { + res.emit('error', connResetException('aborted')); + } } req._closed = true; req.emit('close'); if (!res.aborted && res.readable) { + res.on('end', function() { + this.destroyed = true; + this.emit('close'); + }); res.push(null); + } else { + res.destroyed = true; + res.emit('close'); } } else { if (!req.socket._hadError) { @@ -535,7 +555,7 @@ function socketOnData(d) { parser.finish(); freeParser(parser, req, socket); - const bodyHead = d.slice(bytesParsed, d.length); + const bodyHead = TypedArrayPrototypeSlice(d, bytesParsed, d.length); const eventName = req.method === 'CONNECT' ? 'connect' : 'upgrade'; if (req.listenerCount(eventName) > 0) { @@ -685,6 +705,7 @@ function responseKeepAlive(req) { req.destroyed = true; if (req.res) { + req.res.destroyed = true; // Detach socket from IncomingMessage to avoid destroying the freed // socket in IncomingMessage.destroy(). req.res.socket = null; @@ -739,6 +760,10 @@ function requestOnPrefinish() { function emitFreeNT(req) { req._closed = true; req.emit('close'); + if (req.res) { + req.res.emit('close'); + } + if (req.socket) { req.socket.emit('free'); } @@ -831,7 +856,7 @@ function _deferToConnect(method, arguments_, cb) { const callSocketMethod = () => { if (method) - this.socket[method].apply(this.socket, arguments_); + ReflectApply(this.socket[method], this.socket, arguments_); if (typeof cb === 'function') cb(); diff --git a/lib/_http_common.js b/lib/_http_common.js index e97670f0acaf11..f249a86776b580 100644 --- a/lib/_http_common.js +++ b/lib/_http_common.js @@ -22,8 +22,11 @@ 'use strict'; const { + ArrayPrototypeConcat, MathMin, Symbol, + RegExpPrototypeTest, + TypedArrayPrototypeSlice, } = primordials; const { setImmediate } = require('timers'); @@ -63,7 +66,7 @@ function parserOnHeaders(headers, url) { // Once we exceeded headers limit - stop collecting them if (this.maxHeaderPairs <= 0 || this._headers.length < this.maxHeaderPairs) { - this._headers = this._headers.concat(headers); + this._headers = ArrayPrototypeConcat(this._headers, headers); } this._url += url; } @@ -135,7 +138,7 @@ function parserOnBody(b, start, len) { // Pretend this was the result of a stream._read call. if (len > 0 && !stream._dumped) { - const slice = b.slice(start, start + len); + const slice = TypedArrayPrototypeSlice(b, start, start + len); const ret = stream.push(slice); if (!ret) readStop(this.socket); @@ -217,7 +220,7 @@ const tokenRegExp = /^[\^_`a-zA-Z\-0-9!#$%&'*+.|~]+$/; * See https://tools.ietf.org/html/rfc7230#section-3.2.6 */ function checkIsHttpToken(val) { - return tokenRegExp.test(val); + return RegExpPrototypeTest(tokenRegExp, val); } const headerCharRegex = /[^\t\x20-\x7e\x80-\xff]/; @@ -228,7 +231,7 @@ const headerCharRegex = /[^\t\x20-\x7e\x80-\xff]/; * field-vchar = VCHAR / obs-text */ function checkInvalidHeaderChar(val) { - return headerCharRegex.test(val); + return RegExpPrototypeTest(headerCharRegex, val); } function cleanParser(parser) { diff --git a/lib/_http_incoming.js b/lib/_http_incoming.js index 22ab591b7ad78c..e166177e0d4947 100644 --- a/lib/_http_incoming.js +++ b/lib/_http_incoming.js @@ -22,12 +22,17 @@ 'use strict'; const { + ArrayPrototypePush, + FunctionPrototypeCall, ObjectDefineProperty, ObjectSetPrototypeOf, + StringPrototypeCharCodeAt, + StringPrototypeSlice, + StringPrototypeToLowerCase, Symbol } = primordials; -const { Readable, finished } = require('stream'); +const Stream = require('stream'); const kHeaders = Symbol('kHeaders'); const kHeadersCount = Symbol('kHeadersCount'); @@ -54,7 +59,8 @@ function IncomingMessage(socket) { }; } - Readable.call(this, streamOptions); + FunctionPrototypeCall(Stream.Readable, this, + { autoDestroy: false, ...streamOptions }); this._readableState.readingMore = true; @@ -89,8 +95,8 @@ function IncomingMessage(socket) { // read by the user, so there's no point continuing to handle it. this._dumped = false; } -ObjectSetPrototypeOf(IncomingMessage.prototype, Readable.prototype); -ObjectSetPrototypeOf(IncomingMessage, Readable); +ObjectSetPrototypeOf(IncomingMessage.prototype, Stream.Readable.prototype); +ObjectSetPrototypeOf(IncomingMessage, Stream.Readable); ObjectDefineProperty(IncomingMessage.prototype, 'connection', { get: function() { @@ -160,31 +166,19 @@ IncomingMessage.prototype._read = function _read(n) { readStart(this.socket); }; + // It's possible that the socket will be destroyed, and removed from // any messages, before ever calling this. In that case, just skip // it, since something else is destroying this connection anyway. -IncomingMessage.prototype._destroy = function _destroy(err, cb) { - if (!this.readableEnded || !this.complete) { - this.aborted = true; - this.emit('aborted'); - } - - // If aborted and the underlying socket is not already destroyed, - // destroy it. - // We have to check if the socket is already destroyed because finished - // does not call the callback when this methdod is invoked from `_http_client` - // in `test/parallel/test-http-client-spurious-aborted.js` - if (this.socket && !this.socket.destroyed && this.aborted) { - this.socket.destroy(err); - const cleanup = finished(this.socket, (e) => { - cleanup(); - onError(this, e || err, cb); - }); - } else { - onError(this, err, cb); - } +IncomingMessage.prototype.destroy = function destroy(error) { + // TODO(ronag): Implement in terms of _destroy + this.destroyed = true; + if (this.socket) + this.socket.destroy(error); + return this; }; + IncomingMessage.prototype._addHeaderLines = _addHeaderLines; function _addHeaderLines(headers, n) { if (headers && headers.length) { @@ -312,7 +306,7 @@ function matchKnownFields(field, lowercased) { if (lowercased) { return '\u0000' + field; } - return matchKnownFields(field.toLowerCase(), true); + return matchKnownFields(StringPrototypeToLowerCase(field), true); } // Add the given (field, value) pair to the message // @@ -326,9 +320,9 @@ function matchKnownFields(field, lowercased) { IncomingMessage.prototype._addHeaderLine = _addHeaderLine; function _addHeaderLine(field, value, dest) { field = matchKnownFields(field); - const flag = field.charCodeAt(0); + const flag = StringPrototypeCharCodeAt(field, 0); if (flag === 0 || flag === 2) { - field = field.slice(1); + field = StringPrototypeSlice(field, 1); // Make a delimited list if (typeof dest[field] === 'string') { dest[field] += (flag === 0 ? ', ' : '; ') + value; @@ -338,7 +332,7 @@ function _addHeaderLine(field, value, dest) { } else if (flag === 1) { // Array header -- only Set-Cookie at the moment if (dest['set-cookie'] !== undefined) { - dest['set-cookie'].push(value); + ArrayPrototypePush(dest['set-cookie'], value); } else { dest['set-cookie'] = [value]; } @@ -361,16 +355,6 @@ IncomingMessage.prototype._dump = function _dump() { } }; -function onError(self, error, cb) { - // This is to keep backward compatible behavior. - // An error is emitted only if there are listeners attached to the event. - if (self.listenerCount('error') === 0) { - cb(); - } else { - cb(error); - } -} - module.exports = { IncomingMessage, readStart, diff --git a/lib/_http_outgoing.js b/lib/_http_outgoing.js index 8fb64ab82efceb..872fc04edbadc8 100644 --- a/lib/_http_outgoing.js +++ b/lib/_http_outgoing.js @@ -23,12 +23,21 @@ const { ArrayIsArray, + ArrayPrototypeJoin, + ArrayPrototypePush, + ArrayPrototypeUnshift, + FunctionPrototype, + FunctionPrototypeBind, + FunctionPrototypeCall, + MathFloor, + NumberPrototypeToString, ObjectCreate, ObjectDefineProperty, ObjectKeys, ObjectPrototypeHasOwnProperty, ObjectSetPrototypeOf, - MathFloor, + RegExpPrototypeTest, + StringPrototypeToLowerCase, Symbol, } = primordials; @@ -72,7 +81,7 @@ const { CRLF, debug } = common; const kCorked = Symbol('corked'); -function nop() {} +const nop = FunctionPrototype; const RE_CONN_CLOSE = /(?:^|\W)close(?:$|\W)/i; const RE_TE_CHUNKED = common.chunkExpression; @@ -81,13 +90,11 @@ const RE_TE_CHUNKED = common.chunkExpression; // against the word "cookie." As of V8 6.6 this is faster than handrolling or // using a case-insensitive RegExp. function isCookieField(s) { - return s.length === 6 && s.toLowerCase() === 'cookie'; + return s.length === 6 && StringPrototypeToLowerCase(s) === 'cookie'; } -function noopPendingOutput(amount) {} - function OutgoingMessage() { - Stream.call(this); + FunctionPrototypeCall(Stream, this); // Queue that holds all currently pending data, until the response will be // assigned to the socket (until it will its turn in the HTTP pipeline). @@ -128,7 +135,7 @@ function OutgoingMessage() { this._keepAliveTimeout = 0; - this._onPendingData = noopPendingOutput; + this._onPendingData = nop; } ObjectSetPrototypeOf(OutgoingMessage.prototype, Stream.prototype); ObjectSetPrototypeOf(OutgoingMessage, Stream); @@ -182,7 +189,7 @@ ObjectDefineProperty(OutgoingMessage.prototype, '_headers', { // Refs: https://github.com/nodejs/node/pull/30958 for (let i = 0; i < keys.length; ++i) { const name = keys[i]; - headers[name.toLowerCase()] = [name, val[name]]; + headers[StringPrototypeToLowerCase(name)] = [name, val[name]]; } } }, 'OutgoingMessage.prototype._headers is deprecated', 'DEP0066') @@ -317,7 +324,7 @@ OutgoingMessage.prototype._send = function _send(data, encoding, callback) { data = this._header + data; } else { const header = this._header; - this.outputData.unshift({ + ArrayPrototypeUnshift(this.outputData, { data: header, encoding: 'latin1', callback: null @@ -354,7 +361,7 @@ function _writeRaw(data, encoding, callback) { return conn.write(data, encoding, callback); } // Buffer, as long as we're not destroyed. - this.outputData.push({ data, encoding, callback }); + ArrayPrototypePush(this.outputData, { data, encoding, callback }); this.outputSize += data.length; this._onPendingData(data.length); return this.outputSize < HIGH_WATER_MARK; @@ -450,7 +457,8 @@ function _storeHeader(firstLine, headers) { } if (!state.contLen && !state.te) { - if (!this._hasBody) { + if (!this._hasBody && (this.statusCode === 204 || + this.statusCode === 304)) { // Make sure we don't end the 0\r\n\r\n at the end of the message. this.chunkedEncoding = false; } else if (!this.useChunkedEncodingByDefault) { @@ -497,7 +505,7 @@ function processHeader(self, state, key, value, validate) { storeHeader(self, state, key, value[i], validate); return; } - value = value.join('; '); + value = ArrayPrototypeJoin(value, '; '); } storeHeader(self, state, key, value, validate); } @@ -512,12 +520,12 @@ function storeHeader(self, state, key, value, validate) { function matchHeader(self, state, field, value) { if (field.length < 4 || field.length > 17) return; - field = field.toLowerCase(); + field = StringPrototypeToLowerCase(field); switch (field) { case 'connection': state.connection = true; self._removedConnection = false; - if (RE_CONN_CLOSE.test(value)) + if (RegExpPrototypeTest(RE_CONN_CLOSE, value)) self._last = true; else self.shouldKeepAlive = true; @@ -525,7 +533,8 @@ function matchHeader(self, state, field, value) { case 'transfer-encoding': state.te = true; self._removedTE = false; - if (RE_TE_CHUNKED.test(value)) self.chunkedEncoding = true; + if (RegExpPrototypeTest(RE_TE_CHUNKED, value)) + self.chunkedEncoding = true; break; case 'content-length': state.contLen = true; @@ -569,7 +578,7 @@ OutgoingMessage.prototype.setHeader = function setHeader(name, value) { if (headers === null) this[kOutHeaders] = headers = ObjectCreate(null); - headers[name.toLowerCase()] = [name, value]; + headers[StringPrototypeToLowerCase(name)] = [name, value]; return this; }; @@ -581,7 +590,7 @@ OutgoingMessage.prototype.getHeader = function getHeader(name) { if (headers === null) return; - const entry = headers[name.toLowerCase()]; + const entry = headers[StringPrototypeToLowerCase(name)]; return entry && entry[1]; }; @@ -613,7 +622,7 @@ OutgoingMessage.prototype.getHeaders = function getHeaders() { OutgoingMessage.prototype.hasHeader = function hasHeader(name) { validateString(name, 'name'); return this[kOutHeaders] !== null && - !!this[kOutHeaders][name.toLowerCase()]; + !!this[kOutHeaders][StringPrototypeToLowerCase(name)]; }; @@ -624,7 +633,7 @@ OutgoingMessage.prototype.removeHeader = function removeHeader(name) { throw new ERR_HTTP_HEADERS_SENT('remove'); } - const key = name.toLowerCase(); + const key = StringPrototypeToLowerCase(name); switch (key) { case 'connection': @@ -750,7 +759,7 @@ function write_(msg, chunk, encoding, callback, fromEnd) { let ret; if (msg.chunkedEncoding && chunk.length !== 0) { - msg._send(len.toString(16), 'latin1', null); + msg._send(NumberPrototypeToString(len, 16), 'latin1', null); msg._send(crlf_buf, null, null); msg._send(chunk, encoding, null); ret = msg._send(crlf_buf, null, callback); @@ -810,10 +819,6 @@ OutgoingMessage.prototype.end = function end(chunk, encoding, callback) { encoding = null; } - if (this.socket) { - this.socket.cork(); - } - if (chunk) { if (this.finished) { onError(this, @@ -821,6 +826,11 @@ OutgoingMessage.prototype.end = function end(chunk, encoding, callback) { typeof callback !== 'function' ? nop : callback); return this; } + + if (this.socket) { + this.socket.cork(); + } + write_(this, chunk, encoding, null, true); } else if (this.finished) { if (typeof callback === 'function') { @@ -832,6 +842,10 @@ OutgoingMessage.prototype.end = function end(chunk, encoding, callback) { } return this; } else if (!this._header) { + if (this.socket) { + this.socket.cork(); + } + this._contentLength = 0; this._implicitHeader(); } @@ -839,7 +853,7 @@ OutgoingMessage.prototype.end = function end(chunk, encoding, callback) { if (typeof callback === 'function') this.once('finish', callback); - const finish = onFinish.bind(undefined, this); + const finish = FunctionPrototypeBind(onFinish, undefined, this); if (this._hasBody && this.chunkedEncoding) { this._send('0\r\n' + this._trailer + '\r\n', 'latin1', finish); diff --git a/lib/_http_server.js b/lib/_http_server.js index 8cd10bb3a00194..f1372b56dc6c1b 100644 --- a/lib/_http_server.js +++ b/lib/_http_server.js @@ -23,11 +23,19 @@ const { ArrayIsArray, + ArrayPrototypePush, + ArrayPrototypeShift, Error, + FunctionPrototype, + FunctionPrototypeBind, + FunctionPrototypeCall, ObjectKeys, ObjectSetPrototypeOf, + ReflectApply, + RegExpPrototypeTest, Symbol, SymbolFor, + TypedArrayPrototypeSlice, } = primordials; const net = require('net'); @@ -169,7 +177,7 @@ class HTTPServerAsyncResource { } function ServerResponse(req) { - OutgoingMessage.call(this); + FunctionPrototypeCall(OutgoingMessage, this); if (req.method === 'HEAD') this._hasBody = false; @@ -178,7 +186,8 @@ function ServerResponse(req) { this._expect_continue = false; if (req.httpVersionMajor < 1 || req.httpVersionMinor < 1) { - this.useChunkedEncodingByDefault = chunkExpression.test(req.headers.te); + this.useChunkedEncodingByDefault = RegExpPrototypeTest(chunkExpression, + req.headers.te); this.shouldKeepAlive = false; } @@ -197,7 +206,7 @@ ServerResponse.prototype._finish = function _finish() { if (this[kServerResponseStatistics] !== undefined) { emitStatistics(this[kServerResponseStatistics]); } - OutgoingMessage.prototype._finish.call(this); + FunctionPrototypeCall(OutgoingMessage.prototype._finish, this); }; @@ -371,7 +380,7 @@ function Server(options, requestListener) { validateBoolean(insecureHTTPParser, 'options.insecureHTTPParser'); this.insecureHTTPParser = insecureHTTPParser; - net.Server.call(this, { allowHalfOpen: true }); + FunctionPrototypeCall(net.Server, this, { allowHalfOpen: true }); if (requestListener) { this.on('request', requestListener); @@ -417,8 +426,8 @@ Server.prototype[EE.captureRejectionSymbol] = function(err, event, ...args) { } break; default: - net.Server.prototype[SymbolFor('nodejs.rejection')] - .call(this, err, event, ...args); + ReflectApply(net.Server.prototype[SymbolFor('nodejs.rejection')], + this, arguments); } }; @@ -477,16 +486,21 @@ function connectionListenerInternal(server, socket) { outgoingData: 0, keepAliveTimeoutSet: false }; - state.onData = socketOnData.bind(undefined, server, socket, parser, state); - state.onEnd = socketOnEnd.bind(undefined, server, socket, parser, state); - state.onClose = socketOnClose.bind(undefined, socket, state); - state.onDrain = socketOnDrain.bind(undefined, socket, state); + state.onData = FunctionPrototypeBind(socketOnData, undefined, + server, socket, parser, state); + state.onEnd = FunctionPrototypeBind(socketOnEnd, undefined, + server, socket, parser, state); + state.onClose = FunctionPrototypeBind(socketOnClose, undefined, + socket, state); + state.onDrain = FunctionPrototypeBind(socketOnDrain, undefined, + socket, state); socket.on('data', state.onData); socket.on('error', socketOnError); socket.on('end', state.onEnd); socket.on('close', state.onClose); socket.on('drain', state.onDrain); - parser.onIncoming = parserOnIncoming.bind(undefined, server, socket, state); + parser.onIncoming = FunctionPrototypeBind(parserOnIncoming, undefined, + server, socket, state); // We are consuming socket, so it won't get any actual data socket.on('resume', onSocketResume); @@ -506,15 +520,18 @@ function connectionListenerInternal(server, socket) { parser.consume(socket._handle); } parser[kOnExecute] = - onParserExecute.bind(undefined, server, socket, parser, state); + FunctionPrototypeBind(onParserExecute, undefined, + server, socket, parser, state); parser[kOnTimeout] = - onParserTimeout.bind(undefined, server, socket); + FunctionPrototypeBind(onParserTimeout, undefined, + server, socket); // When receiving new requests on the same socket (pipelining or keep alive) // make sure the requestTimeout is active. parser[kOnMessageBegin] = - setRequestTimeout.bind(undefined, server, socket); + FunctionPrototypeBind(setRequestTimeout, undefined, + server, socket); // This protects from DOS attack where an attacker establish the connection // without sending any data on applications where server.timeout is left to @@ -574,8 +591,15 @@ function socketOnClose(socket, state) { function abortIncoming(incoming) { while (incoming.length) { - const req = incoming.shift(); - req.destroy(connResetException('aborted')); + const req = ArrayPrototypeShift(incoming); + // TODO(ronag): req.destroy(err) + req.aborted = true; + req.destroyed = true; + req.emit('aborted'); + if (req.listenerCount('error') > 0) { + req.emit('error', connResetException('aborted')); + } + req.emit('close'); } // Abort socket._httpMessage ? } @@ -585,7 +609,7 @@ function socketOnEnd(server, socket, parser, state) { if (ret instanceof Error) { debug('parse error'); - socketOnError.call(socket, ret); + FunctionPrototypeCall(socketOnError, socket, ret); return; } @@ -611,7 +635,7 @@ function socketOnData(server, socket, parser, state, d) { function onRequestTimeout(socket) { socket[kRequestTimeout] = undefined; - socketOnError.call(socket, new ERR_HTTP_REQUEST_TIMEOUT()); + ReflectApply(socketOnError, socket, [new ERR_HTTP_REQUEST_TIMEOUT()]); } function onParserExecute(server, socket, parser, state, ret) { @@ -631,7 +655,7 @@ function onParserTimeout(server, socket) { socket.destroy(); } -const noop = () => {}; +const noop = FunctionPrototype; const badRequestResponse = Buffer.from( `HTTP/1.1 400 ${STATUS_CODES[400]}${CRLF}` + `Connection: close${CRLF}${CRLF}`, 'ascii' @@ -678,7 +702,7 @@ function onParserExecuteCommon(server, socket, parser, state, ret, d) { prepareError(ret, parser, d); ret.rawPacket = d || parser.getCurrentBuffer(); debug('parse error', ret); - socketOnError.call(socket, ret); + FunctionPrototypeCall(socketOnError, socket, ret); } else if (parser.incoming && parser.incoming.upgrade) { // Upgrade or CONNECT const req = parser.incoming; @@ -701,7 +725,7 @@ function onParserExecuteCommon(server, socket, parser, state, ret, d) { const eventName = req.method === 'CONNECT' ? 'connect' : 'upgrade'; if (eventName === 'upgrade' || server.listenerCount(eventName) > 0) { debug('SERVER have listener for %s', eventName); - const bodyHead = d.slice(ret, d.length); + const bodyHead = TypedArrayPrototypeSlice(d, ret, d.length); socket.readableFlowing = null; @@ -717,7 +741,7 @@ function onParserExecuteCommon(server, socket, parser, state, ret, d) { // When receiving new requests on the same socket (pipelining or keep alive) // make sure the requestTimeout is active. parser[kOnMessageBegin] = - setRequestTimeout.bind(undefined, server, socket); + FunctionPrototypeBind(setRequestTimeout, undefined, server, socket); } if (socket._paused && socket.parser) { @@ -734,9 +758,14 @@ function clearIncoming(req) { if (parser && parser.incoming === req) { if (req.readableEnded) { parser.incoming = null; + req.destroyed = true; + req.emit('close'); } else { req.on('end', clearIncoming); } + } else { + req.destroyed = true; + req.emit('close'); } } @@ -781,7 +810,7 @@ function resOnFinish(req, res, socket, state, server) { // array will be empty. assert(state.incoming.length === 0 || state.incoming[0] === req); - state.incoming.shift(); + ArrayPrototypeShift(state.incoming); // If the user never called req.read(), and didn't pipe() or // .resume() or .on('data'), then we call req._dump() so that the @@ -814,7 +843,7 @@ function resOnFinish(req, res, socket, state, server) { } } else { // Start sending the next message - const m = state.outgoing.shift(); + const m = ArrayPrototypeShift(state.outgoing); if (m) { m.assignSocket(socket); } @@ -840,7 +869,7 @@ function parserOnIncoming(server, socket, state, req, keepAlive) { return 2; } - state.incoming.push(req); + ArrayPrototypePush(state.incoming, req); // If the writable end isn't consuming, then stop reading // so that we don't become overwhelmed by a flood of @@ -858,7 +887,8 @@ function parserOnIncoming(server, socket, state, req, keepAlive) { const res = new server[kServerResponse](req); res._keepAliveTimeout = server.keepAliveTimeout; - res._onPendingData = updateOutgoingData.bind(undefined, socket, state); + res._onPendingData = FunctionPrototypeBind(updateOutgoingData, undefined, + socket, state); res.shouldKeepAlive = keepAlive; DTRACE_HTTP_SERVER_REQUEST(req, socket); @@ -874,7 +904,7 @@ function parserOnIncoming(server, socket, state, req, keepAlive) { if (socket._httpMessage) { // There are already pending outgoing res, append. - state.outgoing.push(res); + ArrayPrototypePush(state.outgoing, res); } else { res.assignSocket(socket); } @@ -882,11 +912,12 @@ function parserOnIncoming(server, socket, state, req, keepAlive) { // When we're finished writing the response, check if this is the last // response, if so destroy the socket. res.on('finish', - resOnFinish.bind(undefined, req, res, socket, state, server)); + FunctionPrototypeBind(resOnFinish, undefined, + req, res, socket, state, server)); if (req.headers.expect !== undefined && (req.httpVersionMajor === 1 && req.httpVersionMinor === 1)) { - if (continueExpression.test(req.headers.expect)) { + if (RegExpPrototypeTest(continueExpression, req.headers.expect)) { res._expect_continue = true; if (server.listenerCount('checkContinue') > 0) { @@ -954,7 +985,8 @@ function unconsume(parser, socket) { function generateSocketListenerWrapper(originalFnName) { return function socketListenerWrap(ev, fn) { - const res = net.Socket.prototype[originalFnName].call(this, ev, fn); + const res = ReflectApply(net.Socket.prototype[originalFnName], this, + [ev, fn]); if (!this.parser) { this.on = net.Socket.prototype.on; this.addListener = net.Socket.prototype.addListener; diff --git a/lib/_stream_duplex.js b/lib/_stream_duplex.js index 9e46d02ddcb3d3..c32d589ae196fd 100644 --- a/lib/_stream_duplex.js +++ b/lib/_stream_duplex.js @@ -1,6 +1,5 @@ 'use strict'; -// TODO(mcollina): deprecate this file +// Keep this file as an alias for the full stream module. -const Duplex = require('internal/streams/duplex'); -module.exports = Duplex; +module.exports = require('stream').Duplex; diff --git a/lib/_stream_passthrough.js b/lib/_stream_passthrough.js index dbf8646e009931..f1c775202805ef 100644 --- a/lib/_stream_passthrough.js +++ b/lib/_stream_passthrough.js @@ -1,6 +1,5 @@ 'use strict'; -// TODO(mcollina): deprecate this file +// Keep this file as an alias for the full stream module. -const PassThrough = require('internal/streams/passthrough'); -module.exports = PassThrough; +module.exports = require('stream').PassThrough; diff --git a/lib/_stream_readable.js b/lib/_stream_readable.js index c31dde30645726..4729e7fde3e393 100644 --- a/lib/_stream_readable.js +++ b/lib/_stream_readable.js @@ -1,6 +1,5 @@ 'use strict'; -// TODO(mcollina): deprecate this file +// Keep this file as an alias for the full stream module. -const Readable = require('internal/streams/readable'); -module.exports = Readable; +module.exports = require('stream').Readable; diff --git a/lib/_stream_transform.js b/lib/_stream_transform.js index 50150638d9db8c..4901f296692d11 100644 --- a/lib/_stream_transform.js +++ b/lib/_stream_transform.js @@ -1,6 +1,5 @@ 'use strict'; -// TODO(mcollina): deprecate this file +// Keep this file as an alias for the full stream module. -const Transform = require('internal/streams/transform'); -module.exports = Transform; +module.exports = require('stream').Transform; diff --git a/lib/_stream_writable.js b/lib/_stream_writable.js index e328a9434c85a9..d6f1974422d3f3 100644 --- a/lib/_stream_writable.js +++ b/lib/_stream_writable.js @@ -1,6 +1,5 @@ 'use strict'; -// TODO(mcollina): deprecate this file +// Keep this file as an alias for the full stream module. -const Writable = require('internal/streams/writable'); -module.exports = Writable; +module.exports = require('stream').Writable; diff --git a/lib/_tls_common.js b/lib/_tls_common.js index 616b7b47f46dac..7cda18be31de30 100644 --- a/lib/_tls_common.js +++ b/lib/_tls_common.js @@ -24,6 +24,7 @@ const { ArrayIsArray, ArrayPrototypeFilter, + ArrayPrototypeForEach, ArrayPrototypeJoin, ArrayPrototypePush, ObjectCreate, @@ -142,18 +143,18 @@ function processCiphers(ciphers) { return { cipherList, cipherSuites }; } -function addCACerts(context, ...certs) { - for (const cert of certs) { +function addCACerts(context, certs) { + ArrayPrototypeForEach(certs, (cert) => { validateKeyOrCertOption('ca', cert); context.addCACert(cert); - } + }); } -function setCerts(context, ...certs) { - for (const cert of certs) { +function setCerts(context, certs) { + ArrayPrototypeForEach(certs, (cert) => { validateKeyOrCertOption('cert', cert); context.setCert(cert); - } + }); } exports.createSecureContext = function createSecureContext(options) { @@ -196,18 +197,18 @@ exports.createSecureContext = function createSecureContext(options) { // change the checks to !== undefined checks. if (ca) { if (ArrayIsArray(ca)) - addCACerts(c.context, ...ca); - else addCACerts(c.context, ca); + else + addCACerts(c.context, [ca]); } else { c.context.addRootCerts(); } if (cert) { if (ArrayIsArray(cert)) - setCerts(c.context, ...cert); - else setCerts(c.context, cert); + else + setCerts(c.context, [cert]); } // Set the key after the cert. @@ -318,7 +319,7 @@ exports.createSecureContext = function createSecureContext(options) { if (pfx !== undefined) { if (ArrayIsArray(pfx)) { - for (const val of pfx) { + ArrayPrototypeForEach(pfx, (val) => { const raw = val.buf ? val.buf : val; const pass = val.passphrase || passphrase; if (pass !== undefined) { @@ -326,7 +327,7 @@ exports.createSecureContext = function createSecureContext(options) { } else { c.context.loadPKCS12(toBuf(raw)); } - } + }); } else if (passphrase) { c.context.loadPKCS12(toBuf(pfx), toBuf(passphrase)); } else { diff --git a/lib/_tls_wrap.js b/lib/_tls_wrap.js index adbefa4839826d..1447253bf73224 100644 --- a/lib/_tls_wrap.js +++ b/lib/_tls_wrap.js @@ -67,7 +67,6 @@ const { connResetException, codes } = require('internal/errors'); const { ERR_INVALID_ARG_TYPE, ERR_INVALID_ARG_VALUE, - ERR_INVALID_CALLBACK, ERR_MULTIPLE_CALLBACK, ERR_SOCKET_CLOSED, ERR_TLS_DH_PARAM_SIZE, @@ -85,6 +84,7 @@ const { getAllowUnauthorized, } = require('internal/options'); const { + validateCallback, validateString, validateBuffer, validateUint32 @@ -825,8 +825,9 @@ TLSSocket.prototype._init = function(socket, wrap) { TLSSocket.prototype.renegotiate = function(options, callback) { if (options === null || typeof options !== 'object') throw new ERR_INVALID_ARG_TYPE('options', 'Object', options); - if (callback !== undefined && typeof callback !== 'function') - throw new ERR_INVALID_CALLBACK(callback); + if (callback !== undefined) { + validateCallback(callback); + } debug('%s renegotiate()', this._tlsOptions.isServer ? 'server' : 'client', diff --git a/lib/child_process.js b/lib/child_process.js index ae5a5f6587d1af..daa1d44e8974df 100644 --- a/lib/child_process.js +++ b/lib/child_process.js @@ -140,7 +140,7 @@ function fork(modulePath /* , args, options */) { options.execPath = options.execPath || process.execPath; options.shell = false; - return spawn(options.execPath, args, options); + return spawnWithSignal(options.execPath, args, options); } function _forkChild(fd, serializationMode) { @@ -368,6 +368,12 @@ function execFile(file /* , args, options, callback */) { } } + function abortHandler() { + if (!ex) + ex = new AbortError(); + process.nextTick(() => kill()); + } + if (options.timeout > 0) { timeoutId = setTimeout(function delayedKill() { kill(); @@ -376,16 +382,12 @@ function execFile(file /* , args, options, callback */) { } if (options.signal) { if (options.signal.aborted) { - process.nextTick(() => kill()); + process.nextTick(abortHandler); } else { - options.signal.addEventListener('abort', () => { - if (!ex) { - ex = new AbortError(); - } - kill(); - }); - const remove = () => options.signal.removeEventListener('abort', kill); - child.once('close', remove); + const childController = new AbortController(); + options.signal.addEventListener('abort', abortHandler, + { signal: childController.signal }); + child.once('close', () => childController.abort()); } } @@ -759,7 +761,7 @@ function spawnWithSignal(file, args, options) { validateAbortSignal(options.signal, 'options.signal'); function kill() { if (child._handle) { - child._handle.kill('SIGTERM'); + child.kill('SIGTERM'); child.emit('error', new AbortError()); } } diff --git a/lib/crypto.js b/lib/crypto.js index 0179242e84ddb0..de21ef76f9ad94 100644 --- a/lib/crypto.js +++ b/lib/crypto.js @@ -53,7 +53,8 @@ const { randomBytes, randomFill, randomFillSync, - randomInt + randomInt, + randomUUID, } = require('internal/crypto/random'); const { pbkdf2, @@ -106,6 +107,9 @@ const { Hash, Hmac } = require('internal/crypto/hash'); +const { + X509Certificate +} = require('internal/crypto/x509'); const { getCiphers, getCurves, @@ -114,6 +118,7 @@ const { setDefaultEncoding, setEngine, lazyRequire, + secureHeapUsed, } = require('internal/crypto/util'); const Certificate = require('internal/crypto/certificate'); @@ -199,6 +204,7 @@ module.exports = { randomFill, randomFillSync, randomInt, + randomUUID, scrypt, scryptSync, sign: signOneShot, @@ -223,7 +229,9 @@ module.exports = { Hmac, KeyObject, Sign, - Verify + Verify, + X509Certificate, + secureHeapUsed, }; function setFipsDisabled() { diff --git a/lib/diagnostics_channel.js b/lib/diagnostics_channel.js index 0a3552dc975040..c29c9ff0052405 100644 --- a/lib/diagnostics_channel.js +++ b/lib/diagnostics_channel.js @@ -8,7 +8,6 @@ const { ObjectGetPrototypeOf, ObjectSetPrototypeOf, SymbolHasInstance, - WeakRefPrototypeGet } = primordials; const { @@ -107,7 +106,7 @@ function channel(name) { function hasSubscribers(name) { let channel; const ref = channels[name]; - if (ref) channel = WeakRefPrototypeGet(ref); + if (ref) channel = ref.get(); if (!channel) { return false; } diff --git a/lib/dns.js b/lib/dns.js index 0c1b259d7341ee..1116c73f670438 100644 --- a/lib/dns.js +++ b/lib/dns.js @@ -45,10 +45,10 @@ const { const { ERR_INVALID_ARG_TYPE, ERR_INVALID_ARG_VALUE, - ERR_INVALID_CALLBACK, ERR_MISSING_ARGS, } = errors.codes; const { + validateCallback, validatePort, validateString, validateOneOf, @@ -101,20 +101,24 @@ function lookup(hostname, options, callback) { // Parse arguments if (hostname && typeof hostname !== 'string') { throw new ERR_INVALID_ARG_TYPE('hostname', 'string', hostname); - } else if (typeof options === 'function') { + } + + if (typeof options === 'function') { callback = options; family = 0; - } else if (typeof callback !== 'function') { - throw new ERR_INVALID_CALLBACK(callback); - } else if (options !== null && typeof options === 'object') { - hints = options.hints >>> 0; - family = options.family >>> 0; - all = options.all === true; - verbatim = options.verbatim === true; - - validateHints(hints); } else { - family = options >>> 0; + validateCallback(callback); + + if (options !== null && typeof options === 'object') { + hints = options.hints >>> 0; + family = options.family >>> 0; + all = options.all === true; + verbatim = options.verbatim === true; + + validateHints(hints); + } else { + family = options >>> 0; + } } validateOneOf(family, 'family', [0, 4, 6]); @@ -177,8 +181,7 @@ function lookupService(address, port, callback) { validatePort(port); - if (typeof callback !== 'function') - throw new ERR_INVALID_CALLBACK(callback); + validateCallback(callback); port = +port; @@ -217,9 +220,7 @@ function resolver(bindingName) { } validateString(name, 'name'); - if (typeof callback !== 'function') { - throw new ERR_INVALID_CALLBACK(callback); - } + validateCallback(callback); const req = new QueryReqWrap(); req.bindingName = bindingName; diff --git a/lib/domain.js b/lib/domain.js index 5c96cb43790760..4a018c52f845f0 100644 --- a/lib/domain.js +++ b/lib/domain.js @@ -319,7 +319,7 @@ Domain.prototype.exit = function() { // Exit all domains until this one. ArrayPrototypeSplice(stack, index); - exports.active = stack[stack.length - 1]; + exports.active = stack.length === 0 ? undefined : stack[stack.length - 1]; process.domain = exports.active; updateExceptionCapture(); }; diff --git a/lib/events.js b/lib/events.js index dc08042578bc7a..8beb501678f647 100644 --- a/lib/events.js +++ b/lib/events.js @@ -22,10 +22,13 @@ 'use strict'; const { + ArrayPrototypeForEach, ArrayPrototypePush, + ArrayPrototypeSlice, Boolean, Error, ErrorCaptureStackTrace, + FunctionPrototypeCall, MathMin, NumberIsNaN, ObjectCreate, @@ -81,7 +84,7 @@ const lazyDOMException = hideStackFrames((message, name) => { function EventEmitter(opts) { - EventEmitter.init.call(this, opts); + FunctionPrototypeCall(EventEmitter.init, this, opts); } module.exports = EventEmitter; module.exports.once = once; @@ -173,7 +176,7 @@ EventEmitter.setMaxListeners = isEventTarget = require('internal/event_target').isEventTarget; // Performance for forEach is now comparable with regular for-loop - eventTargets.forEach((target) => { + ArrayPrototypeForEach(eventTargets, (target) => { if (isEventTarget(target)) { target[kMaxEventTargetListeners] = n; target[kMaxEventTargetListenersWarned] = false; @@ -200,7 +203,7 @@ EventEmitter.init = function(opts) { this._maxListeners = this._maxListeners || undefined; - if (opts && opts.captureRejections) { + if (opts?.captureRejections) { if (typeof opts.captureRejections !== 'boolean') { throw new ERR_INVALID_ARG_TYPE('options.captureRejections', 'boolean', opts.captureRejections); @@ -224,7 +227,7 @@ function addCatch(that, promise, type, args) { const then = promise.then; if (typeof then === 'function') { - then.call(promise, undefined, function(err) { + FunctionPrototypeCall(then, promise, undefined, function(err) { // The callback is called with nextTick to avoid a follow-up // rejection from this promise. process.nextTick(emitUnhandledRejectionOrErr, that, err, type, args); @@ -670,7 +673,7 @@ function arrayClone(arr) { case 5: return [arr[0], arr[1], arr[2], arr[3], arr[4]]; case 6: return [arr[0], arr[1], arr[2], arr[3], arr[4], arr[5]]; } - return arr.slice(); + return ArrayPrototypeSlice(arr); } function unwrapListeners(arr) { @@ -706,9 +709,9 @@ function getEventListeners(emitterOrTarget, type) { } async function once(emitter, name, options = {}) { - const signal = options ? options.signal : undefined; + const signal = options?.signal; validateAbortSignal(signal, 'options.signal'); - if (signal && signal.aborted) + if (signal?.aborted) throw lazyDOMException('The operation was aborted', 'AbortError'); return new Promise((resolve, reject) => { const errorListener = (err) => { @@ -762,7 +765,7 @@ function eventTargetAgnosticRemoveListener(emitter, name, listener, flags) { function eventTargetAgnosticAddListener(emitter, name, listener, flags) { if (typeof emitter.on === 'function') { - if (flags && flags.once) { + if (flags?.once) { emitter.once(name, listener); } else { emitter.on(name, listener); @@ -777,9 +780,9 @@ function eventTargetAgnosticAddListener(emitter, name, listener, flags) { } function on(emitter, event, options) { - const { signal } = { ...options }; + const signal = options?.signal; validateAbortSignal(signal, 'options.signal'); - if (signal && signal.aborted) { + if (signal?.aborted) { throw lazyDOMException('The operation was aborted', 'AbortError'); } @@ -813,7 +816,7 @@ function on(emitter, event, options) { // Wait until an event happens return new Promise(function(resolve, reject) { - unconsumedPromises.push({ resolve, reject }); + ArrayPrototypePush(unconsumedPromises, { resolve, reject }); }); }, @@ -877,7 +880,7 @@ function on(emitter, event, options) { if (promise) { promise.resolve(createIterResult(args, false)); } else { - unconsumedEvents.push(args); + ArrayPrototypePush(unconsumedEvents, args); } } diff --git a/lib/fs.js b/lib/fs.js index 93e875311e08a6..a4b38f10899d48 100644 --- a/lib/fs.js +++ b/lib/fs.js @@ -75,7 +75,6 @@ const { ERR_FS_FILE_TOO_LARGE, ERR_INVALID_ARG_VALUE, ERR_INVALID_ARG_TYPE, - ERR_INVALID_CALLBACK, ERR_FEATURE_UNAVAILABLE_ON_PLATFORM }, hideStackFrames, @@ -125,6 +124,7 @@ const { isUint32, parseFileMode, validateBuffer, + validateCallback, validateInteger, validateInt32 } = require('internal/validators'); @@ -170,30 +170,25 @@ function showTruncateDeprecation() { } function maybeCallback(cb) { - if (typeof cb === 'function') - return cb; + validateCallback(cb); - throw new ERR_INVALID_CALLBACK(cb); + return cb; } // Ensure that callbacks run in the global context. Only use this function // for callbacks that are passed to the binding layer, callbacks that are // invoked from JS already run in the proper scope. function makeCallback(cb) { - if (typeof cb !== 'function') { - throw new ERR_INVALID_CALLBACK(cb); - } + validateCallback(cb); - return (...args) => cb(...args); + return (...args) => ReflectApply(cb, this, args); } // Special case of `makeCallback()` that is specific to async `*stat()` calls as // an optimization, since the data passed back to the callback needs to be // transformed anyway. function makeStatsCallback(cb) { - if (typeof cb !== 'function') { - throw new ERR_INVALID_CALLBACK(cb); - } + validateCallback(cb); return (err, stats) => { if (err) return cb(err); @@ -2014,8 +2009,8 @@ function copyFile(src, dest, mode, callback) { if (typeof mode === 'function') { callback = mode; mode = 0; - } else if (typeof callback !== 'function') { - throw new ERR_INVALID_CALLBACK(callback); + } else { + validateCallback(callback); } src = getValidatedPath(src, 'src'); diff --git a/lib/http.js b/lib/http.js index 4bbe42e652c24e..491162f9c4a172 100644 --- a/lib/http.js +++ b/lib/http.js @@ -22,6 +22,8 @@ 'use strict'; const { + ArrayPrototypeSlice, + ArrayPrototypeSort, ObjectDefineProperty, } = primordials; @@ -58,7 +60,7 @@ function get(url, options, cb) { module.exports = { _connectionListener, - METHODS: methods.slice().sort(), + METHODS: ArrayPrototypeSort(ArrayPrototypeSlice(methods)), STATUS_CODES, Agent: httpAgent.Agent, ClientRequest, diff --git a/lib/https.js b/lib/https.js index e1f0936b631ade..a7fcf06a95f273 100644 --- a/lib/https.js +++ b/lib/https.js @@ -22,9 +22,16 @@ 'use strict'; const { + ArrayPrototypeIndexOf, + ArrayPrototypePush, + ArrayPrototypeShift, + ArrayPrototypeSplice, + ArrayPrototypeUnshift, + FunctionPrototypeCall, + JSONStringify, ObjectAssign, ObjectSetPrototypeOf, - JSONStringify, + ReflectConstruct, } = primordials; require('internal/util').assertCrypto(); @@ -64,7 +71,7 @@ function Server(opts, requestListener) { this[kIncomingMessage] = opts.IncomingMessage || IncomingMessage; this[kServerResponse] = opts.ServerResponse || ServerResponse; - tls.Server.call(this, opts, _connectionListener); + FunctionPrototypeCall(tls.Server, this, opts, _connectionListener); this.httpAllowHalfOpen = false; @@ -150,7 +157,7 @@ function Agent(options) { if (!(this instanceof Agent)) return new Agent(options); - HttpAgent.call(this, options); + FunctionPrototypeCall(HttpAgent, this, options); this.defaultPort = 443; this.protocol = 'https:'; this.maxCachedSessions = this.options.maxCachedSessions; @@ -167,7 +174,7 @@ ObjectSetPrototypeOf(Agent, HttpAgent); Agent.prototype.createConnection = createConnection; Agent.prototype.getName = function getName(options) { - let name = HttpAgent.prototype.getName.call(this, options); + let name = FunctionPrototypeCall(HttpAgent.prototype.getName, this, options); name += ':'; if (options.ca) @@ -269,21 +276,21 @@ Agent.prototype._cacheSession = function _cacheSession(key, session) { // Put new entry if (this._sessionCache.list.length >= this.maxCachedSessions) { - const oldKey = this._sessionCache.list.shift(); + const oldKey = ArrayPrototypeShift(this._sessionCache.list); debug('evicting %j', oldKey); delete this._sessionCache.map[oldKey]; } - this._sessionCache.list.push(key); + ArrayPrototypePush(this._sessionCache.list, key); this._sessionCache.map[key] = session; }; Agent.prototype._evictSession = function _evictSession(key) { - const index = this._sessionCache.list.indexOf(key); + const index = ArrayPrototypeIndexOf(this._sessionCache.list, key); if (index === -1) return; - this._sessionCache.list.splice(index, 1); + ArrayPrototypeSplice(this._sessionCache.list, index, 1); delete this._sessionCache.map[key]; }; @@ -294,7 +301,7 @@ function request(...args) { let options = {}; if (typeof args[0] === 'string') { - const urlStr = args.shift(); + const urlStr = ArrayPrototypeShift(args); try { options = urlToOptions(new URL(urlStr)); } catch (err) { @@ -313,17 +320,17 @@ function request(...args) { } else if (args[0] && args[0][searchParamsSymbol] && args[0][searchParamsSymbol][searchParamsSymbol]) { // url.URL instance - options = urlToOptions(args.shift()); + options = urlToOptions(ArrayPrototypeShift(args)); } if (args[0] && typeof args[0] !== 'function') { - ObjectAssign(options, args.shift()); + ObjectAssign(options, ArrayPrototypeShift(args)); } options._defaultAgent = module.exports.globalAgent; - args.unshift(options); + ArrayPrototypeUnshift(args, options); - return new ClientRequest(...args); + return ReflectConstruct(ClientRequest, args); } function get(input, options, cb) { diff --git a/lib/inspector.js b/lib/inspector.js index 007822ffa20f0d..30b2e6407ce659 100644 --- a/lib/inspector.js +++ b/lib/inspector.js @@ -17,7 +17,6 @@ const { ERR_INSPECTOR_NOT_ACTIVE, ERR_INSPECTOR_NOT_WORKER, ERR_INVALID_ARG_TYPE, - ERR_INVALID_CALLBACK } = require('internal/errors').codes; const { hasInspector } = internalBinding('config'); @@ -26,7 +25,10 @@ if (!hasInspector) const EventEmitter = require('events'); const { queueMicrotask } = require('internal/process/task_queues'); -const { validateString } = require('internal/validators'); +const { + validateCallback, + validateString, +} = require('internal/validators'); const { isMainThread } = require('worker_threads'); const { @@ -100,8 +102,8 @@ class Session extends EventEmitter { if (params && typeof params !== 'object') { throw new ERR_INVALID_ARG_TYPE('params', 'Object', params); } - if (callback && typeof callback !== 'function') { - throw new ERR_INVALID_CALLBACK(callback); + if (callback) { + validateCallback(callback); } if (!this[connectionSymbol]) { diff --git a/lib/internal/blocklist.js b/lib/internal/blocklist.js index 28a31caa165e09..ba8a9ec45081b9 100644 --- a/lib/internal/blocklist.js +++ b/lib/internal/blocklist.js @@ -22,9 +22,10 @@ const { owner_symbol } = internalBinding('symbols'); const { ERR_INVALID_ARG_TYPE, ERR_INVALID_ARG_VALUE, - ERR_OUT_OF_RANGE, } = require('internal/errors').codes; +const { validateInt32 } = require('internal/validators'); + class BlockList { constructor(handle = new BlockListHandle()) { // The handle argument is an intentionally undocumented @@ -81,8 +82,6 @@ class BlockList { addSubnet(network, prefix, family = 'ipv4') { if (typeof network !== 'string') throw new ERR_INVALID_ARG_TYPE('network', 'string', network); - if (typeof prefix !== 'number') - throw new ERR_INVALID_ARG_TYPE('prefix', 'number', prefix); if (typeof family !== 'string') throw new ERR_INVALID_ARG_TYPE('family', 'string', family); family = family.toLowerCase(); @@ -90,13 +89,11 @@ class BlockList { switch (family) { case 'ipv4': type = AF_INET; - if (prefix < 0 || prefix > 32) - throw new ERR_OUT_OF_RANGE(prefix, '>= 0 and <= 32', prefix); + validateInt32(prefix, 'prefix', 0, 32); break; case 'ipv6': type = AF_INET6; - if (prefix < 0 || prefix > 128) - throw new ERR_OUT_OF_RANGE(prefix, '>= 0 and <= 128', prefix); + validateInt32(prefix, 'prefix', 0, 128); break; default: throw new ERR_INVALID_ARG_VALUE('family', family); diff --git a/lib/internal/bootstrap/switches/does_own_process_state.js b/lib/internal/bootstrap/switches/does_own_process_state.js index 5ee7f079d10124..0d60fb1f4595d1 100644 --- a/lib/internal/bootstrap/switches/does_own_process_state.js +++ b/lib/internal/bootstrap/switches/does_own_process_state.js @@ -80,6 +80,7 @@ function wrapPosixCredentialSetters(credentials) { function wrapIdSetter(type, method) { return function(id) { validateId(id, 'id'); + if (typeof id === 'number') id |= 0; // Result is 0 on success, 1 if credential is unknown. const result = method(id); if (result === 1) { diff --git a/lib/internal/buffer.js b/lib/internal/buffer.js index 60f6cab093135d..3515626041bbad 100644 --- a/lib/internal/buffer.js +++ b/lib/internal/buffer.js @@ -949,7 +949,14 @@ function writeFloatBackwards(val, offset = 0) { return offset; } -class FastBuffer extends Uint8Array {} +class FastBuffer extends Uint8Array { + // Using an explicit constructor here is necessary to avoid relying on + // `Array.prototype[Symbol.iterator]`, which can be mutated by users. + // eslint-disable-next-line no-useless-constructor + constructor(bufferOrLength, byteOffset, length) { + super(bufferOrLength, byteOffset, length); + } +} function addBufferPrototypeMethods(proto) { proto.readBigUInt64LE = readBigUInt64LE; diff --git a/lib/internal/child_process.js b/lib/internal/child_process.js index 8dd85d287fc950..8512ae342fde65 100644 --- a/lib/internal/child_process.js +++ b/lib/internal/child_process.js @@ -231,6 +231,7 @@ function stdioStringToArray(stdio, channel) { switch (stdio) { case 'ignore': + case 'overlapped': case 'pipe': ArrayPrototypePush(options, stdio, stdio, stdio); break; case 'inherit': ArrayPrototypePush(options, 0, 1, 2); break; default: @@ -976,9 +977,10 @@ function getValidStdio(stdio, sync) { if (stdio === 'ignore') { ArrayPrototypePush(acc, { type: 'ignore' }); - } else if (stdio === 'pipe' || (typeof stdio === 'number' && stdio < 0)) { + } else if (stdio === 'pipe' || stdio === 'overlapped' || + (typeof stdio === 'number' && stdio < 0)) { const a = { - type: 'pipe', + type: stdio === 'overlapped' ? 'overlapped' : 'pipe', readable: i === 0, writable: i !== 0 }; diff --git a/lib/internal/cluster/child.js b/lib/internal/cluster/child.js index 90dce42fa6fa70..24db07f118befa 100644 --- a/lib/internal/cluster/child.js +++ b/lib/internal/cluster/child.js @@ -6,6 +6,7 @@ const { ObjectAssign, ReflectApply, SafeMap, + SafeSet, } = primordials; const assert = require('internal/assert'); @@ -73,14 +74,14 @@ cluster._getServer = function(obj, options, cb) { options.fd, ], ':'); - let index = indexes.get(indexesKey); + let indexSet = indexes.get(indexesKey); - if (index === undefined) - index = 0; - else - index++; - - indexes.set(indexesKey, index); + if (indexSet === undefined) { + indexSet = { nextIndex: 0, set: new SafeSet() }; + indexes.set(indexesKey, indexSet); + } + const index = indexSet.nextIndex++; + indexSet.set.add(index); const message = { act: 'queryServer', @@ -100,9 +101,9 @@ cluster._getServer = function(obj, options, cb) { obj._setServerData(reply.data); if (handle) - shared(reply, handle, indexesKey, cb); // Shared listen socket. + shared(reply, handle, indexesKey, index, cb); // Shared listen socket. else - rr(reply, indexesKey, cb); // Round-robin. + rr(reply, indexesKey, index, cb); // Round-robin. }); obj.once('listening', () => { @@ -114,8 +115,20 @@ cluster._getServer = function(obj, options, cb) { }); }; +function removeIndexesKey(indexesKey, index) { + const indexSet = indexes.get(indexesKey); + if (!indexSet) { + return; + } + + indexSet.set.delete(index); + if (indexSet.set.size === 0) { + indexes.delete(indexesKey); + } +} + // Shared listen socket. -function shared(message, handle, indexesKey, cb) { +function shared(message, handle, indexesKey, index, cb) { const key = message.key; // Monkey-patch the close() method so we can keep track of when it's // closed. Avoids resource leaks when the handle is short-lived. @@ -124,7 +137,7 @@ function shared(message, handle, indexesKey, cb) { handle.close = function() { send({ act: 'close', key }); handles.delete(key); - indexes.delete(indexesKey); + removeIndexesKey(indexesKey, index); return ReflectApply(close, handle, arguments); }; assert(handles.has(key) === false); @@ -132,8 +145,8 @@ function shared(message, handle, indexesKey, cb) { cb(message.errno, handle); } -// Round-robin. Master distributes handles across workers. -function rr(message, indexesKey, cb) { +// Round-robin. Primary distributes handles across workers. +function rr(message, indexesKey, index, cb) { if (message.errno) return cb(message.errno, null); @@ -157,7 +170,7 @@ function rr(message, indexesKey, cb) { send({ act: 'close', key }); handles.delete(key); - indexes.delete(indexesKey); + removeIndexesKey(indexesKey, index); key = undefined; } diff --git a/lib/internal/cluster/master.js b/lib/internal/cluster/master.js index 2ae18165695be7..79afe3e80c383b 100644 --- a/lib/internal/cluster/master.js +++ b/lib/internal/cluster/master.js @@ -248,19 +248,21 @@ cluster.disconnect = function(cb) { intercom.once('disconnect', cb); }; +const methodMessageMapping = { + close, + exitedAfterDisconnect, + listening, + online, + queryServer, +}; + function onmessage(message, handle) { const worker = this; - if (message.act === 'online') - online(worker); - else if (message.act === 'queryServer') - queryServer(worker, message); - else if (message.act === 'listening') - listening(worker, message); - else if (message.act === 'exitedAfterDisconnect') - exitedAfterDisconnect(worker, message); - else if (message.act === 'close') - close(worker, message); + const fn = methodMessageMapping[message.act]; + + if (typeof fn === 'function') + fn(worker, message); } function online(worker) { diff --git a/lib/internal/console/constructor.js b/lib/internal/console/constructor.js index dc2817ad2a54ec..2478991e5f682d 100644 --- a/lib/internal/console/constructor.js +++ b/lib/internal/console/constructor.js @@ -6,6 +6,7 @@ const { ArrayFrom, ArrayIsArray, + ArrayPrototypeForEach, ArrayPrototypePush, ArrayPrototypeUnshift, Boolean, @@ -19,7 +20,10 @@ const { ObjectKeys, ObjectPrototypeHasOwnProperty, ObjectValues, + ReflectApply, + ReflectConstruct, ReflectOwnKeys, + SafeArrayIterator, SafeMap, SafeWeakMap, StringPrototypeIncludes, @@ -97,7 +101,7 @@ function Console(options /* or: stdout, stderr, ignoreErrors = true */) { // with new, because we need to define a custom instanceof to accommodate // the global console. if (!new.target) { - return new Console(...arguments); + return ReflectConstruct(Console, arguments); } if (!options || typeof options.write === 'function') { @@ -147,8 +151,7 @@ function Console(options /* or: stdout, stderr, ignoreErrors = true */) { } // Bind the prototype functions to this Console instance - const keys = ObjectKeys(Console.prototype); - for (const key of keys) { + ArrayPrototypeForEach(ObjectKeys(Console.prototype), (key) => { // We have to bind the methods grabbed from the instance instead of from // the prototype so that users extending the Console can override them // from the prototype chain of the subclass. @@ -156,7 +159,7 @@ function Console(options /* or: stdout, stderr, ignoreErrors = true */) { ObjectDefineProperty(this[key], 'name', { value: key }); - } + }); this[kBindStreamsEager](stdout, stderr); this[kBindProperties](ignoreErrors, colorMode, groupIndentation); @@ -320,14 +323,16 @@ ObjectDefineProperties(Console.prototype, { ...consolePropAttributes, value: function(args) { const opts = this[kGetInspectOptions](this._stdout); - return formatWithOptions(opts, ...args); + ArrayPrototypeUnshift(args, opts); + return ReflectApply(formatWithOptions, null, args); } }, [kFormatForStderr]: { ...consolePropAttributes, value: function(args) { const opts = this[kGetInspectOptions](this._stderr); - return formatWithOptions(opts, ...args); + ArrayPrototypeUnshift(args, opts); + return ReflectApply(formatWithOptions, null, args); } }, }); @@ -412,7 +417,8 @@ const consoleMethods = { assert(expression, ...args) { if (!expression) { args[0] = `Assertion failed${args.length === 0 ? '' : `: ${args[0]}`}`; - this.warn(...args); // The arguments will be formatted in warn() again + // The arguments will be formatted in warn() again + ReflectApply(this.warn, this, args); } }, @@ -458,7 +464,7 @@ const consoleMethods = { group(...data) { if (data.length > 0) { - this.log(...data); + ReflectApply(this.log, this, data); } this[kGroupIndent] += StringPrototypeRepeat(' ', this[kGroupIndentationWidth]); @@ -603,7 +609,7 @@ function timeLogImpl(self, name, label, data) { if (data === undefined) { self.log('%s: %s', label, formatted); } else { - self.log('%s: %s', label, formatted, ...data); + self.log('%s: %s', label, formatted, ...new SafeArrayIterator(data)); } return true; } @@ -630,10 +636,10 @@ function formatTime(ms) { } if (hours !== 0 || minutes !== 0) { - [seconds, ms] = StringPrototypeSplit( + ({ 0: seconds, 1: ms } = StringPrototypeSplit( NumberPrototypeToFixed(seconds, 3), '.' - ); + )); const res = hours !== 0 ? `${hours}:${pad(minutes)}` : minutes; return `${res}:${pad(seconds)}.${ms} (${hours !== 0 ? 'h:m' : ''}m:ss.mmm)`; } diff --git a/lib/internal/crypto/diffiehellman.js b/lib/internal/crypto/diffiehellman.js index 2a8795e378f3e0..a28d61369b1c94 100644 --- a/lib/internal/crypto/diffiehellman.js +++ b/lib/internal/crypto/diffiehellman.js @@ -31,11 +31,11 @@ const { ERR_CRYPTO_INVALID_KEY_OBJECT_TYPE, ERR_INVALID_ARG_TYPE, ERR_INVALID_ARG_VALUE, - ERR_INVALID_CALLBACK, } } = require('internal/errors'); const { + validateCallback, validateInt32, validateObject, validateString, @@ -325,8 +325,7 @@ function deriveBitsECDH(name, publicKey, privateKey, callback) { validateString(name, 'name'); validateObject(publicKey, 'publicKey'); validateObject(privateKey, 'privateKey'); - if (typeof callback !== 'function') - throw new ERR_INVALID_CALLBACK(callback); + validateCallback(callback); const job = new ECDHBitsJob(kCryptoJobAsync, name, publicKey, privateKey); job.ondone = (error, bits) => { if (error) return FunctionPrototypeCall(callback, job, error); @@ -340,8 +339,7 @@ function deriveBitsECDH(name, publicKey, privateKey, callback) { function deriveBitsDH(publicKey, privateKey, callback) { validateObject(publicKey, 'publicKey'); validateObject(privateKey, 'privateKey'); - if (typeof callback !== 'function') - throw new ERR_INVALID_CALLBACK(callback); + validateCallback(callback); const job = new DHBitsJob(kCryptoJobAsync, publicKey, privateKey); job.ondone = (error, bits) => { if (error) return FunctionPrototypeCall(callback, job, error); diff --git a/lib/internal/crypto/hkdf.js b/lib/internal/crypto/hkdf.js index 1b013e5ff1591c..7949fa33d2e077 100644 --- a/lib/internal/crypto/hkdf.js +++ b/lib/internal/crypto/hkdf.js @@ -13,6 +13,7 @@ const { } = internalBinding('crypto'); const { + validateCallback, validateInteger, validateString, validateUint32, @@ -41,7 +42,6 @@ const { const { codes: { - ERR_INVALID_CALLBACK, ERR_INVALID_ARG_TYPE, ERR_OUT_OF_RANGE, ERR_MISSING_OPTION, @@ -112,8 +112,7 @@ function hkdf(hash, key, salt, info, length, callback) { length, } = validateParameters(hash, key, salt, info, length)); - if (typeof callback !== 'function') - throw new ERR_INVALID_CALLBACK(callback); + validateCallback(callback); const job = new HKDFJob(kCryptoJobAsync, hash, key, salt, info, length); diff --git a/lib/internal/crypto/keygen.js b/lib/internal/crypto/keygen.js index 5f29a3153b94e0..56f06f7a79fe2a 100644 --- a/lib/internal/crypto/keygen.js +++ b/lib/internal/crypto/keygen.js @@ -40,6 +40,7 @@ const { customPromisifyArgs } = require('internal/util'); const { isUint32, + validateCallback, validateString, validateInteger, validateObject, @@ -50,7 +51,6 @@ const { codes: { ERR_INCOMPATIBLE_OPTION_PAIR, ERR_INVALID_ARG_VALUE, - ERR_INVALID_CALLBACK, ERR_MISSING_OPTION, } } = require('internal/errors'); @@ -68,8 +68,7 @@ function generateKeyPair(type, options, callback) { callback = options; options = undefined; } - if (typeof callback !== 'function') - throw new ERR_INVALID_CALLBACK(callback); + validateCallback(callback); const job = createJob(kCryptoJobAsync, type, options); @@ -95,13 +94,15 @@ function generateKeyPairSync(type, options) { } function handleError(ret) { - if (ret === undefined) + if (ret == null) return; // async - const [err, [publicKey, privateKey]] = ret; + const [err, keys] = ret; if (err !== undefined) throw err; + const [publicKey, privateKey] = keys; + // If no encoding was chosen, return key objects instead. return { publicKey: wrapKey(publicKey, PublicKeyObject), @@ -353,8 +354,7 @@ function generateKey(type, options, callback) { options = undefined; } - if (typeof callback !== 'function') - throw new ERR_INVALID_CALLBACK(callback); + validateCallback(callback); const job = generateKeyJob(kCryptoJobAsync, type, options); diff --git a/lib/internal/crypto/pbkdf2.js b/lib/internal/crypto/pbkdf2.js index 868e0f7fbb214e..98f4efb4f333bf 100644 --- a/lib/internal/crypto/pbkdf2.js +++ b/lib/internal/crypto/pbkdf2.js @@ -14,13 +14,13 @@ const { } = internalBinding('crypto'); const { + validateCallback, validateInteger, validateUint32, } = require('internal/validators'); const { ERR_INVALID_ARG_TYPE, - ERR_INVALID_CALLBACK, ERR_MISSING_OPTION, } = require('internal/errors').codes; @@ -41,8 +41,7 @@ function pbkdf2(password, salt, iterations, keylen, digest, callback) { ({ password, salt, iterations, keylen, digest } = check(password, salt, iterations, keylen, digest)); - if (typeof callback !== 'function') - throw new ERR_INVALID_CALLBACK(callback); + validateCallback(callback); const job = new PBKDF2Job( kCryptoJobAsync, diff --git a/lib/internal/crypto/random.js b/lib/internal/crypto/random.js index dca43647a6635a..cbc549377b1a3d 100644 --- a/lib/internal/crypto/random.js +++ b/lib/internal/crypto/random.js @@ -12,23 +12,29 @@ const { RandomBytesJob, kCryptoJobAsync, kCryptoJobSync, + secureBuffer, } = internalBinding('crypto'); const { lazyDOMException, } = require('internal/crypto/util'); -const { kMaxLength } = require('buffer'); +const { Buffer, kMaxLength } = require('buffer'); const { codes: { ERR_INVALID_ARG_TYPE, - ERR_INVALID_CALLBACK, ERR_OUT_OF_RANGE, + ERR_OPERATION_FAILED, } } = require('internal/errors'); -const { validateNumber } = require('internal/validators'); +const { + validateNumber, + validateBoolean, + validateCallback, + validateObject, +} = require('internal/validators'); const { isArrayBufferView, @@ -73,8 +79,9 @@ function assertSize(size, elementSize, offset, length) { function randomBytes(size, callback) { size = assertSize(size, 1, 0, Infinity); - if (callback !== undefined && typeof callback !== 'function') - throw new ERR_INVALID_CALLBACK(callback); + if (callback !== undefined) { + validateCallback(callback); + } const buf = new FastBuffer(size); @@ -141,8 +148,8 @@ function randomFill(buf, offset, size, callback) { } else if (typeof size === 'function') { callback = size; size = buf.byteLength - offset; - } else if (typeof callback !== 'function') { - throw new ERR_INVALID_CALLBACK(callback); + } else { + validateCallback(callback); } offset = assertOffset(offset, elementSize, buf.byteLength); @@ -188,8 +195,8 @@ function randomInt(min, max, callback) { } const isSync = typeof callback === 'undefined'; - if (!isSync && typeof callback !== 'function') { - throw new ERR_INVALID_CALLBACK(callback); + if (!isSync) { + validateCallback(callback); } if (!NumberIsSafeInteger(min)) { throw new ERR_INVALID_ARG_TYPE('min', 'a safe integer', min); @@ -278,10 +285,114 @@ function getRandomValues(data) { return data; } +// Implements an RFC 4122 version 4 random UUID. +// To improve performance, random data is generated in batches +// large enough to cover kBatchSize UUID's at a time. The uuidData +// and uuid buffers are reused. Each call to randomUUID() consumes +// 16 bytes from the buffer. + +const kHexDigits = [ + 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, 97, 98, 99, 100, 101, 102 +]; + +const kBatchSize = 128; +let uuidData; +let uuidNotBuffered; +let uuid; +let uuidBatch = 0; + +function getBufferedUUID() { + if (uuidData === undefined) { + uuidData = secureBuffer(16 * kBatchSize); + if (uuidData === undefined) + throw new ERR_OPERATION_FAILED('Out of memory'); + } + + if (uuidBatch === 0) randomFillSync(uuidData); + uuidBatch = (uuidBatch + 1) % kBatchSize; + return uuidData.slice(uuidBatch * 16, (uuidBatch * 16) + 16); +} + +function randomUUID(options) { + if (options !== undefined) + validateObject(options, 'options'); + const { + disableEntropyCache = false, + } = { ...options }; + + validateBoolean(disableEntropyCache, 'options.disableEntropyCache'); + + if (uuid === undefined) { + uuid = Buffer.alloc(36, '-'); + uuid[14] = 52; // '4', identifies the UUID version + } + + let uuidBuf; + if (!disableEntropyCache) { + uuidBuf = getBufferedUUID(); + } else { + uuidBuf = uuidNotBuffered; + if (uuidBuf === undefined) + uuidBuf = uuidNotBuffered = secureBuffer(16); + if (uuidBuf === undefined) + throw new ERR_OPERATION_FAILED('Out of memory'); + randomFillSync(uuidBuf); + } + + // Variant byte: 10xxxxxx (variant 1) + uuidBuf[8] = (uuidBuf[8] & 0x3f) | 0x80; + + // This function is structured the way it is for performance. + // The uuid buffer stores the serialization of the random + // bytes from uuidData. + // xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx + let n = 0; + uuid[0] = kHexDigits[uuidBuf[n] >> 4]; + uuid[1] = kHexDigits[uuidBuf[n++] & 0xf]; + uuid[2] = kHexDigits[uuidBuf[n] >> 4]; + uuid[3] = kHexDigits[uuidBuf[n++] & 0xf]; + uuid[4] = kHexDigits[uuidBuf[n] >> 4]; + uuid[5] = kHexDigits[uuidBuf[n++] & 0xf]; + uuid[6] = kHexDigits[uuidBuf[n] >> 4]; + uuid[7] = kHexDigits[uuidBuf[n++] & 0xf]; + // - + uuid[9] = kHexDigits[uuidBuf[n] >> 4]; + uuid[10] = kHexDigits[uuidBuf[n++] & 0xf]; + uuid[11] = kHexDigits[uuidBuf[n] >> 4]; + uuid[12] = kHexDigits[uuidBuf[n++] & 0xf]; + // - + // 4, uuid[14] is set already... + uuid[15] = kHexDigits[uuidBuf[n++] & 0xf]; + uuid[16] = kHexDigits[uuidBuf[n] >> 4]; + uuid[17] = kHexDigits[uuidBuf[n++] & 0xf]; + // - + uuid[19] = kHexDigits[uuidBuf[n] >> 4]; + uuid[20] = kHexDigits[uuidBuf[n++] & 0xf]; + uuid[21] = kHexDigits[uuidBuf[n] >> 4]; + uuid[22] = kHexDigits[uuidBuf[n++] & 0xf]; + // - + uuid[24] = kHexDigits[uuidBuf[n] >> 4]; + uuid[25] = kHexDigits[uuidBuf[n++] & 0xf]; + uuid[26] = kHexDigits[uuidBuf[n] >> 4]; + uuid[27] = kHexDigits[uuidBuf[n++] & 0xf]; + uuid[28] = kHexDigits[uuidBuf[n] >> 4]; + uuid[29] = kHexDigits[uuidBuf[n++] & 0xf]; + uuid[30] = kHexDigits[uuidBuf[n] >> 4]; + uuid[31] = kHexDigits[uuidBuf[n++] & 0xf]; + uuid[32] = kHexDigits[uuidBuf[n] >> 4]; + uuid[33] = kHexDigits[uuidBuf[n++] & 0xf]; + uuid[34] = kHexDigits[uuidBuf[n] >> 4]; + uuid[35] = kHexDigits[uuidBuf[n] & 0xf]; + + return uuid.latin1Slice(0, 36); +} + module.exports = { randomBytes, randomFill, randomFillSync, randomInt, getRandomValues, + randomUUID, }; diff --git a/lib/internal/crypto/scrypt.js b/lib/internal/crypto/scrypt.js index 76549c88289ecc..39305c15d8a4ba 100644 --- a/lib/internal/crypto/scrypt.js +++ b/lib/internal/crypto/scrypt.js @@ -14,6 +14,7 @@ const { } = internalBinding('crypto'); const { + validateCallback, validateInteger, validateUint32, } = require('internal/validators'); @@ -22,7 +23,6 @@ const { codes: { ERR_CRYPTO_SCRYPT_INVALID_PARAMETER, ERR_CRYPTO_SCRYPT_NOT_SUPPORTED, - ERR_INVALID_CALLBACK, } } = require('internal/errors'); @@ -50,8 +50,7 @@ function scrypt(password, salt, keylen, options, callback = defaults) { const { N, r, p, maxmem } = options; ({ password, salt, keylen } = options); - if (typeof callback !== 'function') - throw new ERR_INVALID_CALLBACK(callback); + validateCallback(callback); const job = new ScryptJob( kCryptoJobAsync, password, salt, N, r, p, maxmem, keylen); diff --git a/lib/internal/crypto/util.js b/lib/internal/crypto/util.js index 20d8058e585565..67cb9841928a2d 100644 --- a/lib/internal/crypto/util.js +++ b/lib/internal/crypto/util.js @@ -4,6 +4,7 @@ const { ArrayPrototypeIncludes, ArrayPrototypePush, FunctionPrototypeBind, + Number, Promise, StringPrototypeToLowerCase, StringPrototypeToUpperCase, @@ -15,8 +16,11 @@ const { getCurves: _getCurves, getHashes: _getHashes, setEngine: _setEngine, + secureHeapUsed: _secureHeapUsed, } = internalBinding('crypto'); +const { getOptionValue } = require('internal/options'); + const { crypto: { ENGINE_METHOD_ALL @@ -371,6 +375,17 @@ function validateKeyOps(keyOps, usagesSet) { } } +function secureHeapUsed() { + const val = _secureHeapUsed(); + if (val === undefined) + return { total: 0, used: 0, utilization: 0, min: 0 }; + const used = Number(_secureHeapUsed()); + const total = Number(getOptionValue('--secure-heap')); + const min = Number(getOptionValue('--secure-heap-min')); + const utilization = used / total; + return { total, used, utilization, min }; +} + module.exports = { getArrayBufferOrView, getCiphers, @@ -402,4 +417,5 @@ module.exports = { getStringOption, getUsagesUnion, getHashLength, + secureHeapUsed, }; diff --git a/lib/internal/crypto/x509.js b/lib/internal/crypto/x509.js new file mode 100644 index 00000000000000..e925236bd7be3d --- /dev/null +++ b/lib/internal/crypto/x509.js @@ -0,0 +1,334 @@ +'use strict'; + +const { + ObjectSetPrototypeOf, + SafeMap, + Symbol, +} = primordials; + +const { + parseX509, + X509_CHECK_FLAG_ALWAYS_CHECK_SUBJECT, + X509_CHECK_FLAG_NEVER_CHECK_SUBJECT, + X509_CHECK_FLAG_NO_WILDCARDS, + X509_CHECK_FLAG_NO_PARTIAL_WILDCARDS, + X509_CHECK_FLAG_MULTI_LABEL_WILDCARDS, + X509_CHECK_FLAG_SINGLE_LABEL_SUBDOMAINS, +} = internalBinding('crypto'); + +const { + PublicKeyObject, + isKeyObject, +} = require('internal/crypto/keys'); + +const { + customInspectSymbol: kInspect, +} = require('internal/util'); + +const { + validateBoolean, + validateObject, + validateString, +} = require('internal/validators'); + +const { inspect } = require('internal/util/inspect'); + +const { Buffer } = require('buffer'); + +const { + isArrayBufferView, +} = require('internal/util/types'); + +const { + codes: { + ERR_INVALID_ARG_TYPE, + ERR_INVALID_ARG_VALUE, + } +} = require('internal/errors'); + +const { + JSTransferable, + kClone, + kDeserialize, +} = require('internal/worker/js_transferable'); + +const { + kHandle, +} = require('internal/crypto/util'); + +const kInternalState = Symbol('kInternalState'); + +function isX509Certificate(value) { + return value[kInternalState] !== undefined; +} + +function getFlags(options = {}) { + validateObject(options, 'options'); + const { + subject = 'always', // Can be 'always' or 'never' + wildcards = true, + partialWildcards = true, + multiLabelWildcards = false, + singleLabelSubdomains = false, + } = { ...options }; + let flags = 0; + validateString(subject, 'options.subject'); + validateBoolean(wildcards, 'options.wildcards'); + validateBoolean(partialWildcards, 'options.partialWildcards'); + validateBoolean(multiLabelWildcards, 'options.multiLabelWildcards'); + validateBoolean(singleLabelSubdomains, 'options.singleLabelSubdomains'); + switch (subject) { + case 'always': flags |= X509_CHECK_FLAG_ALWAYS_CHECK_SUBJECT; break; + case 'never': flags |= X509_CHECK_FLAG_NEVER_CHECK_SUBJECT; break; + default: + throw new ERR_INVALID_ARG_VALUE('options.subject', subject); + } + if (!wildcards) flags |= X509_CHECK_FLAG_NO_WILDCARDS; + if (!partialWildcards) flags |= X509_CHECK_FLAG_NO_PARTIAL_WILDCARDS; + if (multiLabelWildcards) flags |= X509_CHECK_FLAG_MULTI_LABEL_WILDCARDS; + if (singleLabelSubdomains) flags |= X509_CHECK_FLAG_SINGLE_LABEL_SUBDOMAINS; + return flags; +} + +class X509Certificate extends JSTransferable { + [kInternalState] = new SafeMap(); + + constructor(buffer) { + if (typeof buffer === 'string') + buffer = Buffer.from(buffer); + if (!isArrayBufferView(buffer)) { + throw new ERR_INVALID_ARG_TYPE( + 'buffer', + ['string', 'Buffer', 'TypedArray', 'DataView'], + buffer); + } + super(); + this[kHandle] = parseX509(buffer); + } + + [kInspect](depth, options) { + if (depth < 0) + return this; + + const opts = { + ...options, + depth: options.depth == null ? null : options.depth - 1 + }; + + return `X509Certificate ${inspect({ + subject: this.subject, + subjectAltName: this.subjectAltName, + issuer: this.issuer, + infoAccess: this.infoAccess, + validFrom: this.validFrom, + validTo: this.validTo, + fingerprint: this.fingerprint, + fingerprint256: this.fingerprint256, + keyUsage: this.keyUsage, + serialNumber: this.serialNumber, + }, opts)}`; + } + + [kClone]() { + const handle = this[kHandle]; + return { + data: { handle }, + deserializeInfo: 'internal/crypto/x509:InternalX509Certificate' + }; + } + + [kDeserialize]({ handle }) { + this[kHandle] = handle; + } + + get subject() { + let value = this[kInternalState].get('subject'); + if (value === undefined) { + value = this[kHandle].subject(); + this[kInternalState].set('subject', value); + } + return value; + } + + get subjectAltName() { + let value = this[kInternalState].get('subjectAltName'); + if (value === undefined) { + value = this[kHandle].subjectAltName(); + this[kInternalState].set('subjectAltName', value); + } + return value; + } + + get issuer() { + let value = this[kInternalState].get('issuer'); + if (value === undefined) { + value = this[kHandle].issuer(); + this[kInternalState].set('issuer', value); + } + return value; + } + + get infoAccess() { + let value = this[kInternalState].get('infoAccess'); + if (value === undefined) { + value = this[kHandle].infoAccess(); + this[kInternalState].set('infoAccess', value); + } + return value; + } + + get validFrom() { + let value = this[kInternalState].get('validFrom'); + if (value === undefined) { + value = this[kHandle].validFrom(); + this[kInternalState].set('validFrom', value); + } + return value; + } + + get validTo() { + let value = this[kInternalState].get('validTo'); + if (value === undefined) { + value = this[kHandle].validTo(); + this[kInternalState].set('validTo', value); + } + return value; + } + + get fingerprint() { + let value = this[kInternalState].get('fingerprint'); + if (value === undefined) { + value = this[kHandle].fingerprint(); + this[kInternalState].set('fingerprint', value); + } + return value; + } + + get fingerprint256() { + let value = this[kInternalState].get('fingerprint256'); + if (value === undefined) { + value = this[kHandle].fingerprint256(); + this[kInternalState].set('fingerprint256', value); + } + return value; + } + + get keyUsage() { + let value = this[kInternalState].get('keyUsage'); + if (value === undefined) { + value = this[kHandle].keyUsage(); + this[kInternalState].set('keyUsage', value); + } + return value; + } + + get serialNumber() { + let value = this[kInternalState].get('serialNumber'); + if (value === undefined) { + value = this[kHandle].serialNumber(); + this[kInternalState].set('serialNumber', value); + } + return value; + } + + get raw() { + let value = this[kInternalState].get('raw'); + if (value === undefined) { + value = this[kHandle].raw(); + this[kInternalState].set('raw', value); + } + return value; + } + + get publicKey() { + let value = this[kInternalState].get('publicKey'); + if (value === undefined) { + value = new PublicKeyObject(this[kHandle].publicKey()); + this[kInternalState].set('publicKey', value); + } + return value; + } + + toString() { + let value = this[kInternalState].get('pem'); + if (value === undefined) { + value = this[kHandle].pem(); + this[kInternalState].set('pem', value); + } + return value; + } + + // There's no standardized JSON encoding for X509 certs so we + // fallback to providing the PEM encoding as a string. + toJSON() { return this.toString(); } + + get ca() { + let value = this[kInternalState].get('ca'); + if (value === undefined) { + value = this[kHandle].checkCA(); + this[kInternalState].set('ca', value); + } + return value; + } + + checkHost(name, options) { + validateString(name, 'name'); + return this[kHandle].checkHost(name, getFlags(options)); + } + + checkEmail(email, options) { + validateString(email, 'email'); + return this[kHandle].checkEmail(email, getFlags(options)); + } + + checkIP(ip, options) { + validateString(ip, 'ip'); + return this[kHandle].checkIP(ip, getFlags(options)); + } + + checkIssued(otherCert) { + if (!isX509Certificate(otherCert)) + throw new ERR_INVALID_ARG_TYPE('otherCert', 'X509Certificate', otherCert); + return this[kHandle].checkIssued(otherCert[kHandle]); + } + + checkPrivateKey(pkey) { + if (!isKeyObject(pkey)) + throw new ERR_INVALID_ARG_TYPE('pkey', 'KeyObject', pkey); + if (pkey.type !== 'private') + throw new ERR_INVALID_ARG_VALUE('pkey', pkey); + return this[kHandle].checkPrivateKey(pkey[kHandle]); + } + + verify(pkey) { + if (!isKeyObject(pkey)) + throw new ERR_INVALID_ARG_TYPE('pkey', 'KeyObject', pkey); + if (pkey.type !== 'public') + throw new ERR_INVALID_ARG_VALUE('pkey', pkey); + return this[kHandle].verify(pkey[kHandle]); + } + + toLegacyObject() { + return this[kHandle].toLegacy(); + } +} + +class InternalX509Certificate extends JSTransferable { + [kInternalState] = new SafeMap(); + + constructor(handle) { + super(); + this[kHandle] = handle; + } +} + +InternalX509Certificate.prototype.constructor = X509Certificate; +ObjectSetPrototypeOf( + InternalX509Certificate.prototype, + X509Certificate.prototype); + +module.exports = { + X509Certificate, + InternalX509Certificate, + isX509Certificate, +}; diff --git a/lib/internal/encoding.js b/lib/internal/encoding.js index 5226bf518dac38..78ec2ca1043cf6 100644 --- a/lib/internal/encoding.js +++ b/lib/internal/encoding.js @@ -4,10 +4,11 @@ // https://encoding.spec.whatwg.org const { - Map, ObjectCreate, ObjectDefineProperties, ObjectGetOwnPropertyDescriptors, + SafeMap, + StringPrototypeSlice, Symbol, SymbolToStringTag, Uint32Array, @@ -73,7 +74,7 @@ const CONVERTER_FLAGS_IGNORE_BOM = 0x4; const empty = new Uint8Array(0); -const encodings = new Map([ +const encodings = new SafeMap([ ['unicode-1-1-utf-8', 'utf-8'], ['utf8', 'utf-8'], ['utf-8', 'utf-8'], @@ -308,7 +309,7 @@ function trimAsciiWhitespace(label) { label[e - 1] === '\u0020')) { e--; } - return label.slice(s, e); + return StringPrototypeSlice(label, s, e); } function getEncodingFromLabel(label) { @@ -503,7 +504,7 @@ function makeTextDecoderJS() { // If the very first result in the stream is a BOM, and we are not // explicitly told to ignore it, then we discard it. if (result[0] === '\ufeff') { - result = result.slice(1); + result = StringPrototypeSlice(result, 1); } this[kBOMSeen] = true; } diff --git a/lib/internal/errors.js b/lib/internal/errors.js index 8a7e744c5fe667..35b091c1853b60 100644 --- a/lib/internal/errors.js +++ b/lib/internal/errors.js @@ -26,6 +26,7 @@ const { ErrorCaptureStackTrace, ErrorPrototypeToString, JSONStringify, + MapPrototypeGet, MathAbs, MathMax, Number, @@ -75,6 +76,8 @@ const kTypes = [ const MainContextError = Error; const overrideStackTrace = new SafeWeakMap(); const kNoOverride = Symbol('kNoOverride'); +let userStackTraceLimit; +const nodeInternalPrefix = '__node_internal_'; const prepareStackTrace = (globalThis, error, trace) => { // API for node internals to override error stack formatting // without interfering with userland code. @@ -84,6 +87,21 @@ const prepareStackTrace = (globalThis, error, trace) => { return f(error, trace); } + const firstFrame = trace[0]?.getFunctionName(); + if (firstFrame && StringPrototypeStartsWith(firstFrame, nodeInternalPrefix)) { + for (let l = trace.length - 1; l >= 0; l--) { + const fn = trace[l]?.getFunctionName(); + if (fn && StringPrototypeStartsWith(fn, nodeInternalPrefix)) { + ArrayPrototypeSplice(trace, 0, l + 1); + break; + } + } + // `userStackTraceLimit` is the user value for `Error.stackTraceLimit`, + // it is updated at every new exception in `captureLargerStackTrace`. + if (trace.length > userStackTraceLimit) + ArrayPrototypeSplice(trace, userStackTraceLimit); + } + const globalOverride = maybeOverridePrepareStackTrace(globalThis, error, trace); if (globalOverride !== kNoOverride) return globalOverride; @@ -118,8 +136,6 @@ const maybeOverridePrepareStackTrace = (globalThis, error, trace) => { return kNoOverride; }; -let excludedStackFn; - // Lazily loaded let util; let assert; @@ -147,6 +163,27 @@ function lazyBuffer() { return buffer; } +const addCodeToName = hideStackFrames(function addCodeToName(err, name, code) { + // Set the stack + err = captureLargerStackTrace(err); + // Add the error code to the name to include it in the stack trace. + err.name = `${name} [${code}]`; + // Access the stack to generate the error message including the error code + // from the name. + err.stack; // eslint-disable-line no-unused-expressions + // Reset the name to the actual name. + if (name === 'SystemError') { + ObjectDefineProperty(err, 'name', { + value: name, + enumerable: false, + writable: true, + configurable: true + }); + } else { + delete err.name; + } +}); + // A specialized Error that includes an additional info property with // additional information about the error condition. // It has the properties present in a UVException but with a custom error @@ -157,15 +194,11 @@ function lazyBuffer() { // and may have .path and .dest. class SystemError extends Error { constructor(key, context) { - if (excludedStackFn === undefined) { - super(); - } else { - const limit = Error.stackTraceLimit; - Error.stackTraceLimit = 0; - super(); - // Reset the limit and setting the name property. - Error.stackTraceLimit = limit; - } + const limit = Error.stackTraceLimit; + Error.stackTraceLimit = 0; + super(); + // Reset the limit and setting the name property. + Error.stackTraceLimit = limit; const prefix = getMessage(key, [], this); let message = `${prefix}: ${context.syscall} returned ` + `${context.code} (${context.message})`; @@ -273,16 +306,11 @@ function makeSystemErrorWithCode(key) { function makeNodeErrorWithCode(Base, key) { return function NodeError(...args) { - let error; - if (excludedStackFn === undefined) { - error = new Base(); - } else { - const limit = Error.stackTraceLimit; - Error.stackTraceLimit = 0; - error = new Base(); - // Reset the limit and setting the name property. - Error.stackTraceLimit = limit; - } + const limit = Error.stackTraceLimit; + Error.stackTraceLimit = 0; + const error = new Base(); + // Reset the limit and setting the name property. + Error.stackTraceLimit = limit; const message = getMessage(key, args, error); ObjectDefineProperty(error, 'message', { value: message, @@ -306,44 +334,11 @@ function makeNodeErrorWithCode(Base, key) { // This function removes unnecessary frames from Node.js core errors. function hideStackFrames(fn) { - return function hidden(...args) { - // Make sure the most outer `hideStackFrames()` function is used. - let setStackFn = false; - if (excludedStackFn === undefined) { - excludedStackFn = hidden; - setStackFn = true; - } - try { - return fn(...args); - } finally { - if (setStackFn === true) { - excludedStackFn = undefined; - } - } - }; -} - -function addCodeToName(err, name, code) { - // Set the stack - if (excludedStackFn !== undefined) { - ErrorCaptureStackTrace(err, excludedStackFn); - } - // Add the error code to the name to include it in the stack trace. - err.name = `${name} [${code}]`; - // Access the stack to generate the error message including the error code - // from the name. - err.stack; // eslint-disable-line no-unused-expressions - // Reset the name to the actual name. - if (name === 'SystemError') { - ObjectDefineProperty(err, 'name', { - value: name, - enumerable: false, - writable: true, - configurable: true - }); - } else { - delete err.name; - } + // We rename the functions that will be hidden to cut off the stacktrace + // at the outermost one + const hidden = nodeInternalPrefix + fn.name; + ObjectDefineProperty(fn, 'name', { value: hidden }); + return fn; } // Utility function for registering the error codes. Only used here. Exported @@ -410,9 +405,19 @@ function uvErrmapGet(name) { if (!uvBinding.errmap) { uvBinding.errmap = uvBinding.getErrorMap(); } - return uvBinding.errmap.get(name); + return MapPrototypeGet(uvBinding.errmap, name); } +const captureLargerStackTrace = hideStackFrames( + function captureLargerStackTrace(err) { + userStackTraceLimit = Error.stackTraceLimit; + Error.stackTraceLimit = Infinity; + ErrorCaptureStackTrace(err); + // Reset the limit + Error.stackTraceLimit = userStackTraceLimit; + + return err; + }); /** * This creates an error compatible with errors produced in the C++ @@ -423,8 +428,8 @@ function uvErrmapGet(name) { * @param {Object} ctx * @returns {Error} */ -function uvException(ctx) { - const [ code, uvmsg ] = uvErrmapGet(ctx.errno) || uvUnmappedError; +const uvException = hideStackFrames(function uvException(ctx) { + const [code, uvmsg] = uvErrmapGet(ctx.errno) || uvUnmappedError; let message = `${code}: ${ctx.message || uvmsg}, ${ctx.syscall}`; let path; @@ -463,9 +468,9 @@ function uvException(ctx) { if (dest) { err.dest = dest; } - ErrorCaptureStackTrace(err, excludedStackFn || uvException); - return err; -} + + return captureLargerStackTrace(err); +}); /** * This creates an error compatible with errors produced in the C++ @@ -478,35 +483,36 @@ function uvException(ctx) { * @param {number} [port] * @returns {Error} */ -function uvExceptionWithHostPort(err, syscall, address, port) { - const [ code, uvmsg ] = uvErrmapGet(err) || uvUnmappedError; - const message = `${syscall} ${code}: ${uvmsg}`; - let details = ''; - - if (port && port > 0) { - details = ` ${address}:${port}`; - } else if (address) { - details = ` ${address}`; - } +const uvExceptionWithHostPort = hideStackFrames( + function uvExceptionWithHostPort(err, syscall, address, port) { + const [code, uvmsg] = uvErrmapGet(err) || uvUnmappedError; + const message = `${syscall} ${code}: ${uvmsg}`; + let details = ''; + + if (port && port > 0) { + details = ` ${address}:${port}`; + } else if (address) { + details = ` ${address}`; + } - // Reducing the limit improves the performance significantly. We do not lose - // the stack frames due to the `captureStackTrace()` function that is called - // later. - const tmpLimit = Error.stackTraceLimit; - Error.stackTraceLimit = 0; - // eslint-disable-next-line no-restricted-syntax - const ex = new Error(`${message}${details}`); - Error.stackTraceLimit = tmpLimit; - ex.code = code; - ex.errno = err; - ex.syscall = syscall; - ex.address = address; - if (port) { - ex.port = port; - } - ErrorCaptureStackTrace(ex, excludedStackFn || uvExceptionWithHostPort); - return ex; -} + // Reducing the limit improves the performance significantly. We do not + // lose the stack frames due to the `captureStackTrace()` function that + // is called later. + const tmpLimit = Error.stackTraceLimit; + Error.stackTraceLimit = 0; + // eslint-disable-next-line no-restricted-syntax + const ex = new Error(`${message}${details}`); + Error.stackTraceLimit = tmpLimit; + ex.code = code; + ex.errno = err; + ex.syscall = syscall; + ex.address = address; + if (port) { + ex.port = port; + } + + return captureLargerStackTrace(ex); + }); /** * This used to be util._errnoException(). @@ -516,24 +522,28 @@ function uvExceptionWithHostPort(err, syscall, address, port) { * @param {string} [original] * @returns {Error} */ -function errnoException(err, syscall, original) { - // TODO(joyeecheung): We have to use the type-checked - // getSystemErrorName(err) to guard against invalid arguments from users. - // This can be replaced with [ code ] = errmap.get(err) when this method - // is no longer exposed to user land. - if (util === undefined) util = require('util'); - const code = util.getSystemErrorName(err); - const message = original ? - `${syscall} ${code} ${original}` : `${syscall} ${code}`; - - // eslint-disable-next-line no-restricted-syntax - const ex = new Error(message); - ex.errno = err; - ex.code = code; - ex.syscall = syscall; - ErrorCaptureStackTrace(ex, excludedStackFn || errnoException); - return ex; -} +const errnoException = hideStackFrames( + function errnoException(err, syscall, original) { + // TODO(joyeecheung): We have to use the type-checked + // getSystemErrorName(err) to guard against invalid arguments from users. + // This can be replaced with [ code ] = errmap.get(err) when this method + // is no longer exposed to user land. + if (util === undefined) util = require('util'); + const code = util.getSystemErrorName(err); + const message = original ? + `${syscall} ${code} ${original}` : `${syscall} ${code}`; + + const tmpLimit = Error.stackTraceLimit; + Error.stackTraceLimit = 0; + // eslint-disable-next-line no-restricted-syntax + const ex = new Error(message); + Error.stackTraceLimit = tmpLimit; + ex.errno = err; + ex.code = code; + ex.syscall = syscall; + + return captureLargerStackTrace(ex); + }); /** * Deprecated, new function is `uvExceptionWithHostPort()` @@ -546,41 +556,42 @@ function errnoException(err, syscall, original) { * @param {string} [additional] * @returns {Error} */ -function exceptionWithHostPort(err, syscall, address, port, additional) { - // TODO(joyeecheung): We have to use the type-checked - // getSystemErrorName(err) to guard against invalid arguments from users. - // This can be replaced with [ code ] = errmap.get(err) when this method - // is no longer exposed to user land. - if (util === undefined) util = require('util'); - const code = util.getSystemErrorName(err); - let details = ''; - if (port && port > 0) { - details = ` ${address}:${port}`; - } else if (address) { - details = ` ${address}`; - } - if (additional) { - details += ` - Local (${additional})`; - } +const exceptionWithHostPort = hideStackFrames( + function exceptionWithHostPort(err, syscall, address, port, additional) { + // TODO(joyeecheung): We have to use the type-checked + // getSystemErrorName(err) to guard against invalid arguments from users. + // This can be replaced with [ code ] = errmap.get(err) when this method + // is no longer exposed to user land. + if (util === undefined) util = require('util'); + const code = util.getSystemErrorName(err); + let details = ''; + if (port && port > 0) { + details = ` ${address}:${port}`; + } else if (address) { + details = ` ${address}`; + } + if (additional) { + details += ` - Local (${additional})`; + } - // Reducing the limit improves the performance significantly. We do not lose - // the stack frames due to the `captureStackTrace()` function that is called - // later. - const tmpLimit = Error.stackTraceLimit; - Error.stackTraceLimit = 0; - // eslint-disable-next-line no-restricted-syntax - const ex = new Error(`${syscall} ${code}${details}`); - Error.stackTraceLimit = tmpLimit; - ex.errno = err; - ex.code = code; - ex.syscall = syscall; - ex.address = address; - if (port) { - ex.port = port; - } - ErrorCaptureStackTrace(ex, excludedStackFn || exceptionWithHostPort); - return ex; -} + // Reducing the limit improves the performance significantly. We do not + // lose the stack frames due to the `captureStackTrace()` function that + // is called later. + const tmpLimit = Error.stackTraceLimit; + Error.stackTraceLimit = 0; + // eslint-disable-next-line no-restricted-syntax + const ex = new Error(`${syscall} ${code}${details}`); + Error.stackTraceLimit = tmpLimit; + ex.errno = err; + ex.code = code; + ex.syscall = syscall; + ex.address = address; + if (port) { + ex.port = port; + } + + return captureLargerStackTrace(ex); + }); /** * @param {number|string} code - A libuv error number or a c-ares error code @@ -588,7 +599,7 @@ function exceptionWithHostPort(err, syscall, address, port, additional) { * @param {string} [hostname] * @returns {Error} */ -function dnsException(code, syscall, hostname) { +const dnsException = hideStackFrames(function(code, syscall, hostname) { let errno; // If `code` is of type number, it is a libuv error number, else it is a // c-ares error code. @@ -622,9 +633,9 @@ function dnsException(code, syscall, hostname) { if (hostname) { ex.hostname = hostname; } - ErrorCaptureStackTrace(ex, excludedStackFn || dnsException); - return ex; -} + + return captureLargerStackTrace(ex); +}); function connResetException(msg) { // eslint-disable-next-line no-restricted-syntax diff --git a/lib/internal/event_target.js b/lib/internal/event_target.js index a0efe8c18e875a..9616030d9dd5d8 100644 --- a/lib/internal/event_target.js +++ b/lib/internal/event_target.js @@ -4,6 +4,7 @@ const { ArrayFrom, Boolean, Error, + FunctionPrototypeBind, FunctionPrototypeCall, NumberIsInteger, ObjectAssign, @@ -12,6 +13,7 @@ const { ObjectGetOwnPropertyDescriptor, ObjectGetOwnPropertyDescriptors, ReflectApply, + SafeArrayIterator, SafeMap, String, Symbol, @@ -93,7 +95,7 @@ class Event { this[kDefaultPrevented] = false; this[kTimestamp] = lazyNow(); this[kPropagationStopped] = false; - if (options != null && options[kTrustEvent]) { + if (options?.[kTrustEvent]) { isTrustedSet.add(this); } @@ -183,7 +185,7 @@ ObjectDefineProperty(Event.prototype, SymbolToStringTag, { class NodeCustomEvent extends Event { constructor(type, options) { super(type, options); - if (options && options.detail) { + if (options?.detail) { this.detail = options.detail; } } @@ -212,7 +214,7 @@ class Listener { this.callback = typeof listener === 'function' ? listener : - listener.handleEvent.bind(listener); + FunctionPrototypeBind(listener.handleEvent, listener); } same(listener, capture) { @@ -338,10 +340,7 @@ class EventTarget { return; type = String(type); - // TODO(@jasnell): If it's determined this cannot be backported - // to 12.x, then this can be simplified to: - // const capture = Boolean(options?.capture); - const capture = options != null && options.capture === true; + const capture = options?.capture === true; const root = this[kEvents].get(type); if (root === undefined || root.next === undefined) @@ -419,7 +418,7 @@ class EventTarget { } else { arg = createEvent(); } - const result = handler.callback.call(this, arg); + const result = FunctionPrototypeCall(handler.callback, this, arg); if (result !== undefined && result !== null) addCatch(this, result, createEvent()); } catch (err) { @@ -553,9 +552,7 @@ ObjectDefineProperties(NodeEventTarget.prototype, { function shouldAddListener(listener) { if (typeof listener === 'function' || - (listener != null && - typeof listener === 'object' && - typeof listener.handleEvent === 'function')) { + typeof listener?.handleEvent === 'function') { return true; } @@ -584,13 +581,13 @@ function validateEventListenerOptions(options) { // It stands in its current implementation as a compromise. // Ref: https://github.com/nodejs/node/pull/33661 function isEventTarget(obj) { - return obj && obj.constructor && obj.constructor[kIsEventTarget]; + return obj?.constructor?.[kIsEventTarget]; } function addCatch(that, promise, event) { const then = promise.then; if (typeof then === 'function') { - then.call(promise, undefined, function(err) { + FunctionPrototypeCall(then, promise, undefined, function(err) { // The callback is called with nextTick to avoid a follow-up // rejection from this promise. process.nextTick(emitUnhandledRejectionOrErr, that, err, event); @@ -652,6 +649,7 @@ function defineEventHandler(emitter, name) { const EventEmitterMixin = (Superclass) => { class MixedEventEmitter extends Superclass { constructor(...args) { + args = new SafeArrayIterator(args); super(...args); FunctionPrototypeCall(EventEmitter, this); } diff --git a/lib/internal/fs/dir.js b/lib/internal/fs/dir.js index 6eeeb84bda9d70..917319661a647d 100644 --- a/lib/internal/fs/dir.js +++ b/lib/internal/fs/dir.js @@ -18,7 +18,6 @@ const { codes: { ERR_DIR_CLOSED, ERR_DIR_CONCURRENT_OPERATION, - ERR_INVALID_CALLBACK, ERR_MISSING_ARGS } } = require('internal/errors'); @@ -32,6 +31,7 @@ const { handleErrorFromBinding } = require('internal/fs/utils'); const { + validateCallback, validateUint32 } = require('internal/validators'); @@ -87,10 +87,10 @@ class Dir { if (callback === undefined) { return this[kDirReadPromisified](); - } else if (typeof callback !== 'function') { - throw new ERR_INVALID_CALLBACK(callback); } + validateCallback(callback); + if (this[kDirOperationQueue] !== null) { ArrayPrototypePush(this[kDirOperationQueue], () => { this[kDirReadImpl](maybeSync, callback); @@ -99,7 +99,7 @@ class Dir { } if (this[kDirBufferedEntries].length > 0) { - const [ name, type ] = + const { 0: name, 1: type } = ArrayPrototypeSplice(this[kDirBufferedEntries], 0, 2); if (maybeSync) process.nextTick(getDirent, this[kDirPath], name, type, callback); @@ -142,7 +142,7 @@ class Dir { } if (this[kDirBufferedEntries].length > 0) { - const [ name, type ] = + const { 0: name, 1: type } = ArrayPrototypeSplice(this[kDirBufferedEntries], 0, 2); return getDirent(this[kDirPath], name, type); } @@ -174,9 +174,7 @@ class Dir { } // callback - if (typeof callback !== 'function') { - throw new ERR_INVALID_CALLBACK(callback); - } + validateCallback(callback); if (this[kDirClosed] === true) { process.nextTick(callback, new ERR_DIR_CLOSED()); @@ -184,7 +182,7 @@ class Dir { } if (this[kDirOperationQueue] !== null) { - this[kDirOperationQueue].push(() => { + ArrayPrototypePush(this[kDirOperationQueue], () => { this.close(callback); }); return; @@ -236,9 +234,8 @@ ObjectDefineProperty(Dir.prototype, SymbolAsyncIterator, { function opendir(path, options, callback) { callback = typeof options === 'function' ? options : callback; - if (typeof callback !== 'function') { - throw new ERR_INVALID_CALLBACK(callback); - } + validateCallback(callback); + path = getValidatedPath(path); options = getOptions(options, { encoding: 'utf8' diff --git a/lib/internal/fs/promises.js b/lib/internal/fs/promises.js index 885df198a0629b..d805f5ca359d05 100644 --- a/lib/internal/fs/promises.js +++ b/lib/internal/fs/promises.js @@ -19,6 +19,7 @@ const { PromisePrototypeFinally, PromisePrototypeThen, PromiseResolve, + SafeArrayIterator, Symbol, Uint8Array, } = primordials; @@ -263,7 +264,7 @@ async function fsCall(fn, handle, ...args) { try { handle[kRef](); - return await fn(handle, ...args); + return await fn(handle, ...new SafeArrayIterator(args)); } finally { handle[kUnref](); } @@ -276,7 +277,7 @@ async function writeFileHandle(filehandle, data, signal) { if (remaining === 0) return; do { if (signal?.aborted) { - throw new lazyDOMException('The operation was aborted', 'AbortError'); + throw lazyDOMException('The operation was aborted', 'AbortError'); } const { bytesWritten } = await write(filehandle, data, 0, @@ -670,7 +671,7 @@ async function writeFile(path, data, options) { const fd = await open(path, flag, options.mode); if (options.signal?.aborted) { - throw new lazyDOMException('The operation was aborted', 'AbortError'); + throw lazyDOMException('The operation was aborted', 'AbortError'); } return PromisePrototypeFinally(writeFileHandle(fd, data), fd.close); } diff --git a/lib/internal/fs/utils.js b/lib/internal/fs/utils.js index d5f3b4c78f16a2..2353fd8c3cbcf2 100644 --- a/lib/internal/fs/utils.js +++ b/lib/internal/fs/utils.js @@ -217,7 +217,7 @@ function join(path, name) { 'path', ['string', 'Buffer'], path); } -function getDirents(path, [names, types], callback) { +function getDirents(path, { 0: names, 1: types }, callback) { let i; if (typeof callback === 'function') { const len = names.length; diff --git a/lib/internal/histogram.js b/lib/internal/histogram.js index 6deb8314a41bbb..00149db50236da 100644 --- a/lib/internal/histogram.js +++ b/lib/internal/histogram.js @@ -5,7 +5,7 @@ const { } = require('internal/util'); const { format } = require('util'); -const { Map, Symbol } = primordials; +const { SafeMap, Symbol } = primordials; const { ERR_INVALID_ARG_TYPE, @@ -19,11 +19,10 @@ const kHandle = Symbol('kHandle'); // record various metrics. This Histogram class provides a // generally read-only view of the internal histogram. class Histogram { - #handle = undefined; - #map = new Map(); + #map = new SafeMap(); constructor(internal) { - this.#handle = internal; + this[kHandle] = internal; } [kInspect]() { @@ -39,23 +38,23 @@ class Histogram { } get min() { - return this.#handle ? this.#handle.min() : undefined; + return this[kHandle]?.min(); } get max() { - return this.#handle ? this.#handle.max() : undefined; + return this[kHandle]?.max(); } get mean() { - return this.#handle ? this.#handle.mean() : undefined; + return this[kHandle]?.mean(); } get exceeds() { - return this.#handle ? this.#handle.exceeds() : undefined; + return this[kHandle]?.exceeds(); } get stddev() { - return this.#handle ? this.#handle.stddev() : undefined; + return this[kHandle]?.stddev(); } percentile(percentile) { @@ -65,26 +64,22 @@ class Histogram { if (percentile <= 0 || percentile > 100) throw new ERR_INVALID_ARG_VALUE.RangeError('percentile', percentile); - return this.#handle ? this.#handle.percentile(percentile) : undefined; + return this[kHandle]?.percentile(percentile); } get percentiles() { this.#map.clear(); - if (this.#handle) - this.#handle.percentiles(this.#map); + this[kHandle]?.percentiles(this.#map); return this.#map; } reset() { - if (this.#handle) - this.#handle.reset(); + this[kHandle]?.reset(); } [kDestroy]() { - this.#handle = undefined; + this[kHandle] = undefined; } - - get [kHandle]() { return this.#handle; } } module.exports = { diff --git a/lib/internal/http.js b/lib/internal/http.js index 1d5973593e9ada..b17687d4d81624 100644 --- a/lib/internal/http.js +++ b/lib/internal/http.js @@ -3,19 +3,15 @@ const { Symbol, Date, + DatePrototypeGetMilliseconds, + DatePrototypeToUTCString, } = primordials; const { setUnrefTimeout } = require('internal/timers'); const { PerformanceEntry, notify } = internalBinding('performance'); -let nowCache; let utcCache; -function nowDate() { - if (!nowCache) cache(); - return nowCache; -} - function utcDate() { if (!utcCache) cache(); return utcCache; @@ -23,13 +19,11 @@ function utcDate() { function cache() { const d = new Date(); - nowCache = d.valueOf(); - utcCache = d.toUTCString(); - setUnrefTimeout(resetCache, 1000 - d.getMilliseconds()); + utcCache = DatePrototypeToUTCString(d); + setUnrefTimeout(resetCache, 1000 - DatePrototypeGetMilliseconds(d)); } function resetCache() { - nowCache = undefined; utcCache = undefined; } @@ -52,7 +46,6 @@ function emitStatistics(statistics) { module.exports = { kOutHeaders: Symbol('kOutHeaders'), kNeedDrain: Symbol('kNeedDrain'), - nowDate, utcDate, emitStatistics }; diff --git a/lib/internal/http2/compat.js b/lib/internal/http2/compat.js index a0251ffbafecd2..d116cb9d5ee925 100644 --- a/lib/internal/http2/compat.js +++ b/lib/internal/http2/compat.js @@ -11,6 +11,7 @@ const { ObjectPrototypeHasOwnProperty, ReflectApply, ReflectGetPrototypeOf, + StringPrototypeIncludes, StringPrototypeToLowerCase, StringPrototypeTrim, Symbol, @@ -44,13 +45,15 @@ const { ERR_HTTP2_PSEUDOHEADER_NOT_ALLOWED, ERR_HTTP2_STATUS_INVALID, ERR_INVALID_ARG_VALUE, - ERR_INVALID_CALLBACK, ERR_INVALID_HTTP_TOKEN, ERR_STREAM_WRITE_AFTER_END }, hideStackFrames } = require('internal/errors'); -const { validateString } = require('internal/validators'); +const { + validateCallback, + validateString, +} = require('internal/validators'); const { kSocket, kRequest, @@ -79,7 +82,9 @@ let statusConnectionHeaderWarned = false; // close as possible to the current require('http') API const assertValidHeader = hideStackFrames((name, value) => { - if (name === '' || typeof name !== 'string' || name.indexOf(' ') >= 0) { + if (name === '' || + typeof name !== 'string' || + StringPrototypeIncludes(name, ' ')) { throw new ERR_INVALID_HTTP_TOKEN('Header name', name); } if (isPseudoHeader(name)) { @@ -784,8 +789,7 @@ class Http2ServerResponse extends Stream { } createPushResponse(headers, callback) { - if (typeof callback !== 'function') - throw new ERR_INVALID_CALLBACK(callback); + validateCallback(callback); if (this[kState].closed) { process.nextTick(callback, new ERR_HTTP2_INVALID_STREAM()); return; diff --git a/lib/internal/http2/core.js b/lib/internal/http2/core.js index 4fbee39c99ddf2..22ed8086dc9316 100644 --- a/lib/internal/http2/core.js +++ b/lib/internal/http2/core.js @@ -104,7 +104,6 @@ const { ERR_HTTP2_UNSUPPORTED_PROTOCOL, ERR_INVALID_ARG_TYPE, ERR_INVALID_ARG_VALUE, - ERR_INVALID_CALLBACK, ERR_INVALID_CHAR, ERR_INVALID_HTTP_TOKEN, ERR_OUT_OF_RANGE, @@ -115,12 +114,13 @@ const { } = require('internal/errors'); const { isUint32, + validateCallback, validateInt32, validateInteger, validateNumber, validateString, validateUint32, - validateAbortSignal, + validateAbortSignal } = require('internal/validators'); const fsPromisesInternal = require('internal/fs/promises'); const { utcDate } = require('internal/http'); @@ -1291,7 +1291,7 @@ class Http2Session extends EventEmitter { } // If ping is called while we are still connecting, or after close() has - // been called, the ping callback will be invoked immediately will a ping + // been called, the ping callback will be invoked immediately with a ping // cancelled error and a duration of 0.0. ping(payload, callback) { if (this.destroyed) @@ -1309,8 +1309,7 @@ class Http2Session extends EventEmitter { if (payload && payload.length !== 8) { throw new ERR_HTTP2_PING_LENGTH(); } - if (typeof callback !== 'function') - throw new ERR_INVALID_CALLBACK(callback); + validateCallback(callback); const cb = pingCallback(callback); if (this.connecting || this.closed) { @@ -1407,8 +1406,9 @@ class Http2Session extends EventEmitter { assertIsObject(settings, 'settings'); validateSettings(settings); - if (callback && typeof callback !== 'function') - throw new ERR_INVALID_CALLBACK(callback); + if (callback) { + validateCallback(callback); + } debugSessionObj(this, 'sending settings'); this[kState].pendingAck++; @@ -1422,7 +1422,7 @@ class Http2Session extends EventEmitter { settingsFn(); } - // Sumits a GOAWAY frame to be sent to the remote peer. Note that this + // Submits a GOAWAY frame to be sent to the remote peer. Note that this // is only a notification, and does not affect the usable state of the // session with the notable exception that new incoming streams will // be rejected automatically. @@ -2204,8 +2204,9 @@ class Http2Stream extends Duplex { close(code = NGHTTP2_NO_ERROR, callback) { validateInteger(code, 'code', 0, kMaxInt); - if (callback !== undefined && typeof callback !== 'function') - throw new ERR_INVALID_CALLBACK(callback); + if (callback !== undefined) { + validateCallback(callback); + } if (this.closed) return; @@ -2607,8 +2608,7 @@ class ServerHttp2Stream extends Http2Stream { options = undefined; } - if (typeof callback !== 'function') - throw new ERR_INVALID_CALLBACK(callback); + validateCallback(callback); assertIsObject(options, 'options'); options = { ...options }; @@ -3048,8 +3048,7 @@ class Http2SecureServer extends TLSServer { setTimeout(msecs, callback) { this.timeout = msecs; if (callback !== undefined) { - if (typeof callback !== 'function') - throw new ERR_INVALID_CALLBACK(callback); + validateCallback(callback); this.on('timeout', callback); } return this; @@ -3076,8 +3075,7 @@ class Http2Server extends NETServer { setTimeout(msecs, callback) { this.timeout = msecs; if (callback !== undefined) { - if (typeof callback !== 'function') - throw new ERR_INVALID_CALLBACK(callback); + validateCallback(callback); this.on('timeout', callback); } return this; diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js index 037d872e1d4fa1..b129e94d9890c0 100644 --- a/lib/internal/modules/cjs/loader.js +++ b/lib/internal/modules/cjs/loader.js @@ -462,7 +462,7 @@ function trySelf(parentPath, request) { const EXPORTS_PATTERN = /^((?:@[^/\\%]+\/)?[^./\\%][^/\\%]*)(\/.*)?$/; function resolveExports(nmPath, request) { // The implementation's behavior is meant to mirror resolution in ESM. - const [, name, expansion = ''] = + const { 1: name, 2: expansion = '' } = StringPrototypeMatch(request, EXPORTS_PATTERN) || []; if (!name) return; diff --git a/lib/internal/modules/esm/get_format.js b/lib/internal/modules/esm/get_format.js index 51b207ea75d131..b48741c422c47f 100644 --- a/lib/internal/modules/esm/get_format.js +++ b/lib/internal/modules/esm/get_format.js @@ -42,10 +42,10 @@ function defaultGetFormat(url, context, defaultGetFormatUnused) { } const parsed = new URL(url); if (parsed.protocol === 'data:') { - const [ , mime ] = RegExpPrototypeExec( + const { 1: mime } = RegExpPrototypeExec( /^([^/]+\/[^;,]+)(?:[^,]*?)(;base64)?,/, parsed.pathname, - ) || [ null, null, null ]; + ) || [ , null ]; const format = ({ '__proto__': null, 'text/javascript': 'module', diff --git a/lib/internal/modules/esm/get_source.js b/lib/internal/modules/esm/get_source.js index b2cf0c3bd28aa2..155a019802f0ba 100644 --- a/lib/internal/modules/esm/get_source.js +++ b/lib/internal/modules/esm/get_source.js @@ -31,7 +31,7 @@ async function defaultGetSource(url, { format } = {}, defaultGetSource) { if (!match) { throw new ERR_INVALID_URL(url); } - const [ , base64, body ] = match; + const { 1: base64, 2: body } = match; source = Buffer.from(body, base64 ? 'base64' : 'utf8'); } else { throw new ERR_INVALID_URL_SCHEME(['file', 'data']); diff --git a/lib/internal/modules/esm/module_job.js b/lib/internal/modules/esm/module_job.js index 549d43cc20e119..6cf968553bae6d 100644 --- a/lib/internal/modules/esm/module_job.js +++ b/lib/internal/modules/esm/module_job.js @@ -10,6 +10,7 @@ const { PromiseResolve, PromisePrototypeCatch, ReflectApply, + SafeArrayIterator, SafeSet, StringPrototypeIncludes, StringPrototypeMatch, @@ -60,9 +61,9 @@ class ModuleJob { }); if (promises !== undefined) - await PromiseAll(promises); + await PromiseAll(new SafeArrayIterator(promises)); - return PromiseAll(dependencyJobs); + return PromiseAll(new SafeArrayIterator(dependencyJobs)); }; // Promise for the list of all dependencyJobs. this.linked = link(); @@ -90,8 +91,8 @@ class ModuleJob { } jobsInGraph.add(moduleJob); const dependencyJobs = await moduleJob.linked; - return PromiseAll( - ArrayPrototypeMap(dependencyJobs, addJobsToDependencyGraph)); + return PromiseAll(new SafeArrayIterator( + ArrayPrototypeMap(dependencyJobs, addJobsToDependencyGraph))); }; await addJobsToDependencyGraph(this); @@ -109,8 +110,9 @@ class ModuleJob { ' does not provide an export named')) { const splitStack = StringPrototypeSplit(e.stack, '\n'); const parentFileUrl = splitStack[0]; - const [, childSpecifier, name] = StringPrototypeMatch(e.message, - /module '(.*)' does not provide an export named '(.+)'/); + const { 1: childSpecifier, 2: name } = StringPrototypeMatch( + e.message, + /module '(.*)' does not provide an export named '(.+)'/); const childFileURL = await this.loader.resolve(childSpecifier, parentFileUrl); const format = await this.loader.getFormat(childFileURL); diff --git a/lib/internal/modules/esm/module_map.js b/lib/internal/modules/esm/module_map.js index 9c51c7c48779f3..9e1116a5647f5f 100644 --- a/lib/internal/modules/esm/module_map.js +++ b/lib/internal/modules/esm/module_map.js @@ -12,6 +12,7 @@ const { validateString } = require('internal/validators'); // Tracks the state of the loader-level module cache class ModuleMap extends SafeMap { + constructor(i) { super(i); } // eslint-disable-line no-useless-constructor get(url) { validateString(url, 'url'); return super.get(url); diff --git a/lib/internal/modules/esm/resolve.js b/lib/internal/modules/esm/resolve.js index 8a5bc841ada22a..98683441586784 100644 --- a/lib/internal/modules/esm/resolve.js +++ b/lib/internal/modules/esm/resolve.js @@ -65,12 +65,11 @@ const emittedPackageWarnings = new SafeSet(); function emitFolderMapDeprecation(match, pjsonUrl, isExports, base) { const pjsonPath = fileURLToPath(pjsonUrl); if (!pendingDeprecation) { - const nodeModulesIndex = StringPrototypeLastIndexOf(pjsonPath, - '/node_modules/'); + const nodeModulesIndex = + StringPrototypeLastIndexOf(pjsonPath, sep + 'node_modules' + sep); if (nodeModulesIndex !== -1) { - const afterNodeModulesPath = StringPrototypeSlice(pjsonPath, - nodeModulesIndex + 14, - -13); + const afterNodeModulesPath = + StringPrototypeSlice(pjsonPath, nodeModulesIndex + 14, -13); try { const { packageSubpath } = parsePackageName(afterNodeModulesPath); if (packageSubpath === '.') diff --git a/lib/internal/modules/esm/translators.js b/lib/internal/modules/esm/translators.js index 66636d9ce092b5..b685989345b962 100644 --- a/lib/internal/modules/esm/translators.js +++ b/lib/internal/modules/esm/translators.js @@ -3,6 +3,7 @@ /* global WebAssembly */ const { + ArrayPrototypeForEach, ArrayPrototypeMap, Boolean, JSONParse, @@ -12,6 +13,7 @@ const { PromisePrototypeCatch, PromiseReject, RegExpPrototypeTest, + SafeArrayIterator, SafeMap, SafeSet, StringPrototypeReplace, @@ -246,7 +248,7 @@ function cjsPreparseModuleExports(filename) { reexports = []; } - const exportNames = new SafeSet(exports); + const exportNames = new SafeSet(new SafeArrayIterator(exports)); // Set first for cycles. cjsParseCache.set(module, { source, exportNames, loaded }); @@ -255,12 +257,12 @@ function cjsPreparseModuleExports(filename) { module.filename = filename; module.paths = CJSModule._nodeModulePaths(module.path); } - for (const reexport of reexports) { + ArrayPrototypeForEach(reexports, (reexport) => { let resolved; try { resolved = CJSModule._resolveFilename(reexport, module); } catch { - continue; + return; } const ext = extname(resolved); if ((ext === '.js' || ext === '.cjs' || !CJSModule._extensions[ext]) && @@ -269,7 +271,7 @@ function cjsPreparseModuleExports(filename) { for (const name of reexportNames) exportNames.add(name); } - } + }); return { module, exportNames }; } diff --git a/lib/internal/modules/package_json_reader.js b/lib/internal/modules/package_json_reader.js index 4a2b0e6ddb3ed8..09eb12bd1533bf 100644 --- a/lib/internal/modules/package_json_reader.js +++ b/lib/internal/modules/package_json_reader.js @@ -18,7 +18,7 @@ function read(jsonPath) { return cache.get(jsonPath); } - const [string, containsKeys] = internalModuleReadJSON( + const { 0: string, 1: containsKeys } = internalModuleReadJSON( toNamespacedPath(jsonPath) ); const result = { string, containsKeys }; diff --git a/lib/internal/per_context/primordials.js b/lib/internal/per_context/primordials.js index ad5707954738ae..2ab9550213ecca 100644 --- a/lib/internal/per_context/primordials.js +++ b/lib/internal/per_context/primordials.js @@ -13,10 +13,10 @@ // by the native module compiler. // `uncurryThis` is equivalent to `func => Function.prototype.call.bind(func)`. -// It is using `call.bind(bind, call)` to avoid using `Function.prototype.bind` -// after it may have been mutated by users. +// It is using `bind.bind(call)` to avoid using `Function.prototype.bind` +// and `Function.prototype.call` after it may have been mutated by users. const { bind, call } = Function.prototype; -const uncurryThis = call.bind(bind, call); +const uncurryThis = bind.bind(call); primordials.uncurryThis = uncurryThis; function copyProps(src, dest) { @@ -146,21 +146,31 @@ primordials.makeSafe = makeSafe; // Subclass the constructors because we need to use their prototype // methods later. +// Defining the `constructor` is necessary here to avoid the default +// constructor which uses the user-mutable `%ArrayIteratorPrototype%.next`. primordials.SafeMap = makeSafe( Map, - class SafeMap extends Map {} + class SafeMap extends Map { + constructor(i) { super(i); } // eslint-disable-line no-useless-constructor + } ); primordials.SafeWeakMap = makeSafe( WeakMap, - class SafeWeakMap extends WeakMap {} + class SafeWeakMap extends WeakMap { + constructor(i) { super(i); } // eslint-disable-line no-useless-constructor + } ); primordials.SafeSet = makeSafe( Set, - class SafeSet extends Set {} + class SafeSet extends Set { + constructor(i) { super(i); } // eslint-disable-line no-useless-constructor + } ); primordials.SafeWeakSet = makeSafe( WeakSet, - class SafeWeakSet extends WeakSet {} + class SafeWeakSet extends WeakSet { + constructor(i) { super(i); } // eslint-disable-line no-useless-constructor + } ); // Create copies of the namespace objects @@ -232,6 +242,12 @@ primordials.SafeWeakSet = makeSafe( // Refs: https://tc39.es/ecma262/#sec-%typedarray%-intrinsic-object [ { name: 'TypedArray', original: Reflect.getPrototypeOf(Uint8Array) }, + { name: 'ArrayIterator', original: { + prototype: Reflect.getPrototypeOf(Array.prototype[Symbol.iterator]()), + } }, + { name: 'StringIterator', original: { + prototype: Reflect.getPrototypeOf(String.prototype[Symbol.iterator]()), + } }, ].forEach(({ name, original }) => { primordials[name] = original; // The static %TypedArray% methods require a valid `this`, but can't be bound, @@ -240,5 +256,14 @@ primordials.SafeWeakSet = makeSafe( copyPrototype(original.prototype, primordials, `${name}Prototype`); }); +primordials.SafeArrayIterator = createSafeIterator( + primordials.ArrayPrototypeSymbolIterator, + primordials.ArrayIteratorPrototypeNext +); +primordials.SafeStringIterator = createSafeIterator( + primordials.StringPrototypeSymbolIterator, + primordials.StringIteratorPrototypeNext +); + Object.setPrototypeOf(primordials, null); Object.freeze(primordials); diff --git a/lib/internal/priority_queue.js b/lib/internal/priority_queue.js index c31c1eea385857..84db200b1cea96 100644 --- a/lib/internal/priority_queue.js +++ b/lib/internal/priority_queue.js @@ -104,17 +104,6 @@ module.exports = class PriorityQueue { } } - remove(value) { - const heap = this[kHeap]; - const pos = heap.indexOf(value); - if (pos < 1) - return false; - - this.removeAt(pos); - - return true; - } - shift() { const heap = this[kHeap]; const value = heap[1]; diff --git a/lib/internal/process/per_thread.js b/lib/internal/process/per_thread.js index b16705f9fb95b0..b3bd2de58ea3ff 100644 --- a/lib/internal/process/per_thread.js +++ b/lib/internal/process/per_thread.js @@ -93,6 +93,7 @@ function wrapProcessMethods(binding) { const { cpuUsage: _cpuUsage, memoryUsage: _memoryUsage, + rss, resourceUsage: _resourceUsage } = binding; @@ -168,6 +169,8 @@ function wrapProcessMethods(binding) { }; } + memoryUsage.rss = rss; + function exit(code) { if (code || code === 0) process.exitCode = code; diff --git a/lib/internal/process/task_queues.js b/lib/internal/process/task_queues.js index 3cf07601a23aa4..4081acae951acd 100644 --- a/lib/internal/process/task_queues.js +++ b/lib/internal/process/task_queues.js @@ -34,11 +34,12 @@ const { symbols: { async_id_symbol, trigger_async_id_symbol } } = require('internal/async_hooks'); const { - ERR_INVALID_CALLBACK, ERR_INVALID_ARG_TYPE } = require('internal/errors').codes; const FixedQueue = require('internal/fixed_queue'); +const { validateCallback } = require('internal/validators'); + // *Must* match Environment::TickInfo::Fields in src/env.h. const kHasTickScheduled = 0; @@ -99,8 +100,7 @@ function processTicksAndRejections() { // `nextTick()` will not enqueue any callback when the process is about to // exit since the callback would not have a chance to be executed. function nextTick(callback) { - if (typeof callback !== 'function') - throw new ERR_INVALID_CALLBACK(callback); + validateCallback(callback); if (process._exiting) return; diff --git a/lib/internal/quic/core.js b/lib/internal/quic/core.js index d6f94ed831a982..0c326872a7a2ea 100644 --- a/lib/internal/quic/core.js +++ b/lib/internal/quic/core.js @@ -204,6 +204,7 @@ const { } = require('internal/histogram'); const { + validateAbortSignal, validateBoolean, validateInteger, validateObject, @@ -680,8 +681,7 @@ class QuicEndpoint { return this.address; const { signal } = { ...options }; - if (signal != null && !('aborted' in signal)) - throw new ERR_INVALID_ARG_TYPE('options.signal', 'AbortSignal', signal); + validateAbortSignal(signal, 'options.signal'); // If an AbortSignal was passed in, check to make sure it is not already // aborted before we continue on to do any work. @@ -1083,8 +1083,7 @@ class QuicSocket extends EventEmitter { return; const { signal } = { ...options }; - if (signal != null && !('aborted' in signal)) - throw new ERR_INVALID_ARG_TYPE('options.signal', 'AbortSignal', signal); + validateAbortSignal(signal, 'options.signal'); // If an AbotSignal was passed in, check to make sure it is not already // aborted before we continue on to do any work. diff --git a/lib/internal/repl/utils.js b/lib/internal/repl/utils.js index e2bda7665a9138..594b6a0c4485c7 100644 --- a/lib/internal/repl/utils.js +++ b/lib/internal/repl/utils.js @@ -9,6 +9,7 @@ const { MathMin, RegExpPrototypeTest, SafeSet, + SafeStringIterator, StringPrototypeEndsWith, StringPrototypeIndexOf, StringPrototypeLastIndexOf, @@ -425,7 +426,7 @@ function setupPreview(repl, contextSymbol, bufferSymbol, active) { getStringWidth(inspected) > maxColumns) { maxColumns -= 4 + (repl.useColors ? 0 : 3); let res = ''; - for (const char of inspected) { + for (const char of new SafeStringIterator(inspected)) { maxColumns -= getStringWidth(char); if (maxColumns < 0) break; diff --git a/lib/internal/source_map/prepare_stack_trace.js b/lib/internal/source_map/prepare_stack_trace.js index 60bcb2fcadd1a1..c32f9780c2fb3f 100644 --- a/lib/internal/source_map/prepare_stack_trace.js +++ b/lib/internal/source_map/prepare_stack_trace.js @@ -9,6 +9,7 @@ const { StringPrototypeSlice, StringPrototypeSplit, StringPrototypeStartsWith, + SafeStringIterator, } = primordials; let debug = require('internal/util/debuglog').debuglog('source_map', (fn) => { @@ -144,7 +145,8 @@ function getErrorSource( // Display ^ in appropriate position, regardless of whether tabs or // spaces are used: let prefix = ''; - for (const character of StringPrototypeSlice(line, 0, originalColumn + 1)) { + for (const character of new SafeStringIterator( + StringPrototypeSlice(line, 0, originalColumn + 1))) { prefix += (character === '\t') ? '\t' : StringPrototypeRepeat(' ', getStringWidth(character)); } diff --git a/lib/internal/stream_base_commons.js b/lib/internal/stream_base_commons.js index 0dfee0c9c7b619..5254fc1553dd77 100644 --- a/lib/internal/stream_base_commons.js +++ b/lib/internal/stream_base_commons.js @@ -17,9 +17,6 @@ const { } = internalBinding('stream_wrap'); const { UV_EOF } = internalBinding('uv'); const { - codes: { - ERR_INVALID_CALLBACK - }, errnoException } = require('internal/errors'); const { owner_symbol } = require('internal/async_hooks').symbols; @@ -30,6 +27,7 @@ const { } = require('internal/timers'); const { isUint8Array } = require('internal/util/types'); const { clearTimeout } = require('timers'); +const { validateCallback } = require('internal/validators'); const kMaybeDestroy = Symbol('kMaybeDestroy'); const kUpdateTimer = Symbol('kUpdateTimer'); @@ -259,8 +257,7 @@ function setStreamTimeout(msecs, callback) { if (msecs === 0) { if (callback !== undefined) { - if (typeof callback !== 'function') - throw new ERR_INVALID_CALLBACK(callback); + validateCallback(callback); this.removeListener('timeout', callback); } } else { @@ -268,8 +265,7 @@ function setStreamTimeout(msecs, callback) { if (this[kSession]) this[kSession][kUpdateTimer](); if (callback !== undefined) { - if (typeof callback !== 'function') - throw new ERR_INVALID_CALLBACK(callback); + validateCallback(callback); this.once('timeout', callback); } } diff --git a/lib/internal/streams/add-abort-signal.js b/lib/internal/streams/add-abort-signal.js index a13dbc03db6e6c..ba0da5e8bc4ac2 100644 --- a/lib/internal/streams/add-abort-signal.js +++ b/lib/internal/streams/add-abort-signal.js @@ -9,7 +9,7 @@ const eos = require('internal/streams/end-of-stream'); const { ERR_INVALID_ARG_TYPE } = codes; // This method is inlined here for readable-stream -// It also does not allow for signal to not exist on the steam +// It also does not allow for signal to not exist on the stream // https://github.com/nodejs/node/pull/36061#discussion_r533718029 const validateAbortSignal = (signal, name) => { if (typeof signal !== 'object' || diff --git a/lib/internal/streams/end-of-stream.js b/lib/internal/streams/end-of-stream.js index 8c5cf937df335e..40a294d9af7457 100644 --- a/lib/internal/streams/end-of-stream.js +++ b/lib/internal/streams/end-of-stream.js @@ -13,6 +13,16 @@ function isRequest(stream) { return stream.setHeader && typeof stream.abort === 'function'; } +function isServerResponse(stream) { + return ( + typeof stream._sent100 === 'boolean' && + typeof stream._removedConnection === 'boolean' && + typeof stream._removedContLen === 'boolean' && + typeof stream._removedTE === 'boolean' && + typeof stream._closed === 'boolean' + ); +} + function isReadable(stream) { return typeof stream.readable === 'boolean' || typeof stream.readableEnded === 'boolean' || @@ -72,7 +82,7 @@ function eos(stream, options, callback) { // TODO (ronag): Improve soft detection to include core modules and // common ecosystem modules that do properly emit 'close' but fail // this generic check. - let willEmitClose = ( + let willEmitClose = isServerResponse(stream) || ( state && state.autoDestroy && state.emitClose && @@ -129,7 +139,9 @@ function eos(stream, options, callback) { if (isRequest(stream)) { stream.on('complete', onfinish); - stream.on('abort', onclose); + if (!willEmitClose) { + stream.on('abort', onclose); + } if (stream.req) onrequest(); else stream.on('request', onrequest); } else if (writable && !wState) { // legacy streams @@ -138,7 +150,7 @@ function eos(stream, options, callback) { } // Not all streams will emit 'close' after 'aborted'. - if (typeof stream.aborted === 'boolean') { + if (!willEmitClose && typeof stream.aborted === 'boolean') { stream.on('aborted', onclose); } diff --git a/lib/internal/streams/pipeline.js b/lib/internal/streams/pipeline.js index 89561433c8c132..900e561d32943c 100644 --- a/lib/internal/streams/pipeline.js +++ b/lib/internal/streams/pipeline.js @@ -17,11 +17,12 @@ const destroyImpl = require('internal/streams/destroy'); const { ERR_INVALID_ARG_TYPE, ERR_INVALID_RETURN_VALUE, - ERR_INVALID_CALLBACK, ERR_MISSING_ARGS, ERR_STREAM_DESTROYED } = require('internal/errors').codes; +const { validateCallback } = require('internal/validators'); + let EE; let PassThrough; let Readable; @@ -73,8 +74,7 @@ function popCallback(streams) { // Streams should never be an empty array. It should always contain at least // a single stream. Therefore optimize for the average case instead of // checking for length === 0 as well. - if (typeof streams[streams.length - 1] !== 'function') - throw new ERR_INVALID_CALLBACK(streams[streams.length - 1]); + validateCallback(streams[streams.length - 1]); return streams.pop(); } @@ -215,7 +215,7 @@ function pipeline(...streams) { } } else { if (!PassThrough) { - PassThrough = require('_stream_passthrough'); + PassThrough = require('internal/streams/passthrough'); } // If the last argument to pipeline is not a stream diff --git a/lib/internal/streams/readable.js b/lib/internal/streams/readable.js index 6fff20c94ec7f3..d0424edc1fa32b 100644 --- a/lib/internal/streams/readable.js +++ b/lib/internal/streams/readable.js @@ -203,7 +203,9 @@ function Readable(options) { Stream.call(this, options); destroyImpl.construct(this, () => { - maybeReadMore(this, this._readableState); + if (this._readableState.needReadable) { + maybeReadMore(this, this._readableState); + } }); } diff --git a/lib/internal/streams/writable.js b/lib/internal/streams/writable.js index 97fe1d28ef1f3a..2510398d999fe1 100644 --- a/lib/internal/streams/writable.js +++ b/lib/internal/streams/writable.js @@ -27,6 +27,7 @@ const { FunctionPrototype, + Error, ObjectDefineProperty, ObjectDefineProperties, ObjectSetPrototypeOf, @@ -290,8 +291,8 @@ Writable.prototype.pipe = function() { errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE()); }; -Writable.prototype.write = function(chunk, encoding, cb) { - const state = this._writableState; +function _write(stream, chunk, encoding, cb) { + const state = stream._writableState; if (typeof encoding === 'function') { cb = encoding; @@ -333,11 +334,15 @@ Writable.prototype.write = function(chunk, encoding, cb) { if (err) { process.nextTick(cb, err); - errorOrDestroy(this, err, true); - return false; + errorOrDestroy(stream, err, true); + return err; } state.pendingcb++; - return writeOrBuffer(this, state, chunk, encoding, cb); + return writeOrBuffer(stream, state, chunk, encoding, cb); +} + +Writable.prototype.write = function(chunk, encoding, cb) { + return _write(this, chunk, encoding, cb) === true; }; Writable.prototype.cork = function() { @@ -607,8 +612,14 @@ Writable.prototype.end = function(chunk, encoding, cb) { encoding = null; } - if (chunk !== null && chunk !== undefined) - this.write(chunk, encoding); + let err; + + if (chunk !== null && chunk !== undefined) { + const ret = _write(this, chunk, encoding); + if (ret instanceof Error) { + err = ret; + } + } // .end() fully uncorks. if (state.corked) { @@ -616,12 +627,15 @@ Writable.prototype.end = function(chunk, encoding, cb) { this.uncork(); } - // This is forgiving in terms of unnecessary calls to end() and can hide - // logic errors. However, usually such errors are harmless and causing a - // hard error can be disproportionately destructive. It is not always - // trivial for the user to determine whether end() needs to be called or not. - let err; - if (!state.errored && !state.ending) { + if (err) { + // Do nothing... + } else if (!state.errored && !state.ending) { + // This is forgiving in terms of unnecessary calls to end() and can hide + // logic errors. However, usually such errors are harmless and causing a + // hard error can be disproportionately destructive. It is not always + // trivial for the user to determine whether end() needs to be called + // or not. + state.ending = true; finishMaybe(this, state, true); state.ended = true; diff --git a/lib/internal/timers.js b/lib/internal/timers.js index 5009572f90f265..a5b5c10010e95b 100644 --- a/lib/internal/timers.js +++ b/lib/internal/timers.js @@ -108,10 +108,12 @@ const trigger_async_id_symbol = Symbol('triggerId'); const kHasPrimitive = Symbol('kHasPrimitive'); const { - ERR_INVALID_CALLBACK, ERR_OUT_OF_RANGE } = require('internal/errors').codes; -const { validateNumber } = require('internal/validators'); +const { + validateCallback, + validateNumber, +} = require('internal/validators'); const L = require('internal/linkedlist'); const PriorityQueue = require('internal/priority_queue'); @@ -368,9 +370,7 @@ function insert(item, msecs, start = getLibuvNow()) { function setUnrefTimeout(callback, after) { // Type checking identical to setTimeout() - if (typeof callback !== 'function') { - throw new ERR_INVALID_CALLBACK(callback); - } + validateCallback(callback); const timer = new Timeout(callback, after, undefined, false, false); insert(timer, timer._idleTimeout); diff --git a/lib/internal/tls.js b/lib/internal/tls.js index da40f635286bfe..57366839c170ae 100644 --- a/lib/internal/tls.js +++ b/lib/internal/tls.js @@ -2,6 +2,7 @@ const { ArrayIsArray, + ArrayPrototypeForEach, ArrayPrototypePush, StringPrototypeIndexOf, StringPrototypeSlice, @@ -13,7 +14,7 @@ const { // C=US\nST=CA\nL=SF\nO=Joyent\nOU=Node.js\nCN=ca1\nemailAddress=ry@clouds.org function parseCertString(s) { const out = ObjectCreate(null); - for (const part of StringPrototypeSplit(s, '\n')) { + ArrayPrototypeForEach(StringPrototypeSplit(s, '\n'), (part) => { const sepIndex = StringPrototypeIndexOf(part, '='); if (sepIndex > 0) { const key = StringPrototypeSlice(part, 0, sepIndex); @@ -27,7 +28,7 @@ function parseCertString(s) { out[key] = value; } } - } + }); return out; } diff --git a/lib/internal/tty.js b/lib/internal/tty.js index 2852cfb1bbfe29..f4f05f971c2713 100644 --- a/lib/internal/tty.js +++ b/lib/internal/tty.js @@ -23,6 +23,7 @@ 'use strict'; const { + ArrayPrototypeSome, RegExpPrototypeTest, StringPrototypeSplit, StringPrototypeToLowerCase, @@ -202,10 +203,9 @@ function getColorDepth(env = process.env) { if (TERM_ENVS[termEnv]) { return TERM_ENVS[termEnv]; } - for (const term of TERM_ENVS_REG_EXP) { - if (RegExpPrototypeTest(term, termEnv)) { - return COLORS_16; - } + if (ArrayPrototypeSome(TERM_ENVS_REG_EXP, + (term) => RegExpPrototypeTest(term, termEnv))) { + return COLORS_16; } } // Move 16 color COLORTERM below 16m and 256 diff --git a/lib/internal/url.js b/lib/internal/url.js index 9c883b6268737c..900b6b03cd9ec1 100644 --- a/lib/internal/url.js +++ b/lib/internal/url.js @@ -2,6 +2,12 @@ const { Array, + ArrayPrototypeJoin, + ArrayPrototypeMap, + ArrayPrototypePush, + ArrayPrototypeReduce, + ArrayPrototypeSlice, + FunctionPrototypeBind, Int8Array, Number, ObjectCreate, @@ -10,9 +16,17 @@ const { ObjectGetOwnPropertySymbols, ObjectGetPrototypeOf, ObjectKeys, + ReflectApply, ReflectGetOwnPropertyDescriptor, ReflectOwnKeys, + RegExpPrototypeExec, String, + StringPrototypeCharCodeAt, + StringPrototypeIncludes, + StringPrototypeReplace, + StringPrototypeSlice, + StringPrototypeSplit, + StringPrototypeStartsWith, Symbol, SymbolIterator, SymbolToStringTag, @@ -30,7 +44,6 @@ const { ERR_ARG_NOT_ITERABLE, ERR_INVALID_ARG_TYPE, ERR_INVALID_ARG_VALUE, - ERR_INVALID_CALLBACK, ERR_INVALID_FILE_URL_HOST, ERR_INVALID_FILE_URL_PATH, ERR_INVALID_THIS, @@ -51,6 +64,8 @@ const { } = require('internal/constants'); const path = require('path'); +const { validateCallback } = require('internal/validators'); + // Lazy loaded for startup performance. let querystring; @@ -101,7 +116,7 @@ function toUSVString(val) { const str = `${val}`; // As of V8 5.5, `str.search()` (and `unpairedSurrogateRe[@@search]()`) are // slower than `unpairedSurrogateRe.exec()`. - const match = unpairedSurrogateRe.exec(str); + const match = RegExpPrototypeExec(unpairedSurrogateRe, str); if (!match) return str; return _toUSVString(str, match.index); @@ -166,8 +181,8 @@ class URLSearchParams { } const convertedPair = []; for (const element of pair) - convertedPair.push(toUSVString(element)); - pairs.push(convertedPair); + ArrayPrototypePush(convertedPair, toUSVString(element)); + ArrayPrototypePush(pairs, convertedPair); } this[searchParams] = []; @@ -175,7 +190,7 @@ class URLSearchParams { if (pair.length !== 2) { throw new ERR_INVALID_TUPLE('Each query pair', '[name, value]'); } - this[searchParams].push(pair[0], pair[1]); + ArrayPrototypePush(this[searchParams], pair[0], pair[1]); } } else { // Record @@ -221,16 +236,21 @@ class URLSearchParams { const list = this[searchParams]; const output = []; for (let i = 0; i < list.length; i += 2) - output.push(`${innerInspect(list[i])} => ${innerInspect(list[i + 1])}`); + ArrayPrototypePush( + output, + `${innerInspect(list[i])} => ${innerInspect(list[i + 1])}`); - const length = output.reduce( + const length = ArrayPrototypeReduce( + output, (prev, cur) => prev + removeColors(cur).length + separator.length, -separator.length ); if (length > ctx.breakLength) { - return `${this.constructor.name} {\n ${output.join(',\n ')} }`; + return `${this.constructor.name} {\n` + + ` ${ArrayPrototypeJoin(output, ',\n ')} }`; } else if (output.length) { - return `${this.constructor.name} { ${output.join(separator)} }`; + return `${this.constructor.name} { ` + + `${ArrayPrototypeJoin(output, separator)} }`; } return `${this.constructor.name} {}`; } @@ -290,9 +310,9 @@ function onParsePortComplete(flags, protocol, username, password, function onParseHostComplete(flags, protocol, username, password, host, port, path, query, fragment) { - onParseHostnameComplete.apply(this, arguments); + ReflectApply(onParseHostnameComplete, this, arguments); if (port !== null || ((flags & URL_FLAGS_IS_DEFAULT_SCHEME_PORT) !== 0)) - onParsePortComplete.apply(this, arguments); + ReflectApply(onParsePortComplete, this, arguments); } function onParsePathComplete(flags, protocol, username, password, @@ -332,8 +352,8 @@ class URL { base_context = new URL(base)[context]; } this[context] = new URLContext(); - parse(input, -1, base_context, undefined, onParseComplete.bind(this), - onParseError); + parse(input, -1, base_context, undefined, + FunctionPrototypeBind(onParseComplete, this), onParseError); } get [special]() { @@ -427,8 +447,8 @@ ObjectDefineProperties(URL.prototype, { if (ctx.host === null && ctx.path.length > 1 && ctx.path[0] === '') { ret += '/.'; } - for (const segment of ctx.path) { - ret += '/' + segment; + if (ctx.path.length) { + ret += '/' + ArrayPrototypeJoin(ctx.path, '/'); } } if (options.search && ctx.query !== null) @@ -461,8 +481,8 @@ ObjectDefineProperties(URL.prototype, { set(input) { // toUSVString is not needed. input = `${input}`; - parse(input, -1, undefined, undefined, onParseComplete.bind(this), - onParseError); + parse(input, -1, undefined, undefined, + FunctionPrototypeBind(onParseComplete, this), onParseError); } }, origin: { // readonly @@ -504,7 +524,7 @@ ObjectDefineProperties(URL.prototype, { return; const ctx = this[context]; parse(scheme, kSchemeStart, null, ctx, - onParseProtocolComplete.bind(this)); + FunctionPrototypeBind(onParseProtocolComplete, this)); } }, username: { @@ -567,7 +587,8 @@ ObjectDefineProperties(URL.prototype, { // Cannot set the host if cannot-be-base is set return; } - parse(host, kHost, null, ctx, onParseHostComplete.bind(this)); + parse(host, kHost, null, ctx, + FunctionPrototypeBind(onParseHostComplete, this)); } }, hostname: { @@ -604,7 +625,8 @@ ObjectDefineProperties(URL.prototype, { ctx.port = null; return; } - parse(port, kPort, null, ctx, onParsePortComplete.bind(this)); + parse(port, kPort, null, ctx, + FunctionPrototypeBind(onParsePortComplete, this)); } }, pathname: { @@ -616,7 +638,7 @@ ObjectDefineProperties(URL.prototype, { return ctx.path[0]; if (ctx.path.length === 0) return ''; - return `/${ctx.path.join('/')}`; + return `/${ArrayPrototypeJoin(ctx.path, '/')}`; }, set(path) { // toUSVString is not needed. @@ -643,11 +665,12 @@ ObjectDefineProperties(URL.prototype, { ctx.query = null; ctx.flags &= ~URL_FLAGS_HAS_QUERY; } else { - if (search[0] === '?') search = search.slice(1); + if (search[0] === '?') search = StringPrototypeSlice(search, 1); ctx.query = ''; ctx.flags |= URL_FLAGS_HAS_QUERY; if (search) { - parse(search, kQuery, null, ctx, onParseSearchComplete.bind(this)); + parse(search, kQuery, null, ctx, + FunctionPrototypeBind(onParseSearchComplete, this)); } } initSearchParams(this[searchParams], search); @@ -678,10 +701,11 @@ ObjectDefineProperties(URL.prototype, { ctx.flags &= ~URL_FLAGS_HAS_FRAGMENT; return; } - if (hash[0] === '#') hash = hash.slice(1); + if (hash[0] === '#') hash = StringPrototypeSlice(hash, 1); ctx.fragment = ''; ctx.flags |= URL_FLAGS_HAS_FRAGMENT; - parse(hash, kFragment, null, ctx, onParseHashComplete.bind(this)); + parse(hash, kFragment, null, ctx, + FunctionPrototypeBind(onParseHashComplete, this)); } }, toJSON: { @@ -730,7 +754,7 @@ function parseParams(qs) { let encodeCheck = 0; let i; for (i = 0; i < qs.length; ++i) { - const code = qs.charCodeAt(i); + const code = StringPrototypeCharCodeAt(qs, i); // Try matching key/value pair separator if (code === CHAR_AMPERSAND) { @@ -778,7 +802,7 @@ function parseParams(qs) { // Handle + and percent decoding. if (code === CHAR_PLUS) { if (lastPos < i) - buf += qs.slice(lastPos, i); + buf += StringPrototypeSlice(qs, lastPos, i); buf += ' '; lastPos = i + 1; } else if (!encoded) { @@ -806,14 +830,14 @@ function parseParams(qs) { return out; if (lastPos < i) - buf += qs.slice(lastPos, i); + buf += StringPrototypeSlice(qs, lastPos, i); if (encoded) buf = querystring.unescape(buf); - out.push(buf); + ArrayPrototypePush(out, buf); // If `buf` is the key, add an empty value. if (!seenSep) - out.push(''); + ArrayPrototypePush(out, ''); return out; } @@ -927,7 +951,7 @@ defineIDLClass(URLSearchParams.prototype, 'URLSearchParams', { name = toUSVString(name); value = toUSVString(value); - this[searchParams].push(name, value); + ArrayPrototypePush(this[searchParams], name, value); update(this[context], this); }, @@ -1041,7 +1065,7 @@ defineIDLClass(URLSearchParams.prototype, 'URLSearchParams', { // Otherwise, append a new name-value pair whose name is `name` and value // is `value`, to `list`. if (!found) { - list.push(name, value); + ArrayPrototypePush(list, name, value); } update(this[context], this); @@ -1106,9 +1130,7 @@ defineIDLClass(URLSearchParams.prototype, 'URLSearchParams', { if (!this || !this[searchParams] || this[searchParams][searchParams]) { throw new ERR_INVALID_THIS('URLSearchParams'); } - if (typeof callback !== 'function') { - throw new ERR_INVALID_CALLBACK(callback); - } + validateCallback(callback); let list = this[searchParams]; @@ -1227,24 +1249,28 @@ defineIDLClass(URLSearchParamsIteratorPrototype, 'URLSearchParams Iterator', { kind, index } = this[context]; - const output = target[searchParams].slice(index).reduce((prev, cur, i) => { - const key = i % 2 === 0; - if (kind === 'key' && key) { - prev.push(cur); - } else if (kind === 'value' && !key) { - prev.push(cur); - } else if (kind === 'key+value' && !key) { - prev.push([target[searchParams][index + i - 1], cur]); - } - return prev; - }, []); + const output = ArrayPrototypeReduce( + ArrayPrototypeSlice(target[searchParams], index), + (prev, cur, i) => { + const key = i % 2 === 0; + if (kind === 'key' && key) { + ArrayPrototypePush(prev, cur); + } else if (kind === 'value' && !key) { + ArrayPrototypePush(prev, cur); + } else if (kind === 'key+value' && !key) { + ArrayPrototypePush(prev, [target[searchParams][index + i - 1], cur]); + } + return prev; + }, + [] + ); const breakLn = inspect(output, innerOpts).includes('\n'); - const outputStrs = output.map((p) => inspect(p, innerOpts)); + const outputStrs = ArrayPrototypeMap(output, (p) => inspect(p, innerOpts)); let outputStr; if (breakLn) { - outputStr = `\n ${outputStrs.join(',\n ')}`; + outputStr = `\n ${ArrayPrototypeJoin(outputStrs, ',\n ')}`; } else { - outputStr = ` ${outputStrs.join(', ')}`; + outputStr = ` ${ArrayPrototypeJoin(outputStrs, ', ')}`; } return `${this[SymbolToStringTag]} {${outputStr} }`; } @@ -1272,8 +1298,9 @@ function domainToUnicode(domain) { function urlToOptions(url) { const options = { protocol: url.protocol, - hostname: typeof url.hostname === 'string' && url.hostname.startsWith('[') ? - url.hostname.slice(1, -1) : + hostname: typeof url.hostname === 'string' && + StringPrototypeStartsWith(url.hostname, '[') ? + StringPrototypeSlice(url.hostname, 1, -1) : url.hostname, hash: url.hash, search: url.search, @@ -1373,25 +1400,25 @@ const carriageReturnRegEx = /\r/g; const tabRegEx = /\t/g; function encodePathChars(filepath) { - if (filepath.includes('%')) - filepath = filepath.replace(percentRegEx, '%25'); + if (StringPrototypeIncludes(filepath, '%')) + filepath = StringPrototypeReplace(filepath, percentRegEx, '%25'); // In posix, backslash is a valid character in paths: - if (!isWindows && filepath.includes('\\')) - filepath = filepath.replace(backslashRegEx, '%5C'); - if (filepath.includes('\n')) - filepath = filepath.replace(newlineRegEx, '%0A'); - if (filepath.includes('\r')) - filepath = filepath.replace(carriageReturnRegEx, '%0D'); - if (filepath.includes('\t')) - filepath = filepath.replace(tabRegEx, '%09'); + if (!isWindows && StringPrototypeIncludes(filepath, '\\')) + filepath = StringPrototypeReplace(filepath, backslashRegEx, '%5C'); + if (StringPrototypeIncludes(filepath, '\n')) + filepath = StringPrototypeReplace(filepath, newlineRegEx, '%0A'); + if (StringPrototypeIncludes(filepath, '\r')) + filepath = StringPrototypeReplace(filepath, carriageReturnRegEx, '%0D'); + if (StringPrototypeIncludes(filepath, '\t')) + filepath = StringPrototypeReplace(filepath, tabRegEx, '%09'); return filepath; } function pathToFileURL(filepath) { const outURL = new URL('file://'); - if (isWindows && filepath.startsWith('\\\\')) { + if (isWindows && StringPrototypeStartsWith(filepath, '\\\\')) { // UNC path format: \\server\share\resource - const paths = filepath.split('\\'); + const paths = StringPrototypeSplit(filepath, '\\'); if (paths.length <= 3) { throw new ERR_INVALID_ARG_VALUE( 'filepath', @@ -1408,11 +1435,13 @@ function pathToFileURL(filepath) { ); } outURL.hostname = domainToASCII(hostname); - outURL.pathname = encodePathChars(paths.slice(3).join('/')); + outURL.pathname = encodePathChars( + ArrayPrototypeJoin(ArrayPrototypeSlice(paths, 3), '/')); } else { let resolved = path.resolve(filepath); // path.resolve strips trailing slashes so we must add them back - const filePathLast = filepath.charCodeAt(filepath.length - 1); + const filePathLast = StringPrototypeCharCodeAt(filepath, + filepath.length - 1); if ((filePathLast === CHAR_FORWARD_SLASH || (isWindows && filePathLast === CHAR_BACKWARD_SLASH)) && resolved[resolved.length - 1] !== path.sep) diff --git a/lib/internal/util.js b/lib/internal/util.js index f26ea970e8dce0..cd0edfe44ee13f 100644 --- a/lib/internal/util.js +++ b/lib/internal/util.js @@ -3,8 +3,11 @@ const { ArrayFrom, ArrayIsArray, + ArrayPrototypePop, + ArrayPrototypePush, + ArrayPrototypeSlice, + ArrayPrototypeSort, Error, - Map, ObjectCreate, ObjectDefineProperties, ObjectDefineProperty, @@ -13,8 +16,14 @@ const { ObjectGetPrototypeOf, ObjectSetPrototypeOf, Promise, + ReflectApply, ReflectConstruct, - Set, + RegExpPrototypeTest, + SafeMap, + SafeSet, + StringPrototypeReplace, + StringPrototypeToLowerCase, + StringPrototypeToUpperCase, Symbol, SymbolFor, } = primordials; @@ -40,12 +49,12 @@ const { isNativeError } = internalBinding('types'); const noCrypto = !process.versions.openssl; -const experimentalWarnings = new Set(); +const experimentalWarnings = new SafeSet(); const colorRegExp = /\u001b\[\d\d?m/g; // eslint-disable-line no-control-regex function removeColors(str) { - return str.replace(colorRegExp, ''); + return StringPrototypeReplace(str, colorRegExp, ''); } function isError(e) { @@ -57,7 +66,7 @@ function isError(e) { // Keep a list of deprecation codes that have been warned on so we only warn on // each one once. -const codesWarned = new Set(); +const codesWarned = new SafeSet(); // Mark that a method should not be used. // Returns a modified function which warns once by default. @@ -86,7 +95,7 @@ function deprecate(fn, msg, code) { if (new.target) { return ReflectConstruct(fn, args, new.target); } - return fn.apply(this, args); + return ReflectApply(fn, this, args); } // The wrapper will keep the same prototype as fn to maintain prototype chain @@ -132,12 +141,13 @@ function slowCases(enc) { case 4: if (enc === 'UTF8') return 'utf8'; if (enc === 'ucs2' || enc === 'UCS2') return 'utf16le'; - enc = `${enc}`.toLowerCase(); + enc = StringPrototypeToLowerCase(`${enc}`); if (enc === 'utf8') return 'utf8'; if (enc === 'ucs2') return 'utf16le'; break; case 3: - if (enc === 'hex' || enc === 'HEX' || `${enc}`.toLowerCase() === 'hex') + if (enc === 'hex' || enc === 'HEX' || + StringPrototypeToLowerCase(`${enc}`) === 'hex') return 'hex'; break; case 5: @@ -146,7 +156,7 @@ function slowCases(enc) { if (enc === 'UTF-8') return 'utf8'; if (enc === 'ASCII') return 'ascii'; if (enc === 'UCS-2') return 'utf16le'; - enc = `${enc}`.toLowerCase(); + enc = StringPrototypeToLowerCase(`${enc}`); if (enc === 'utf-8') return 'utf8'; if (enc === 'ascii') return 'ascii'; if (enc === 'ucs-2') return 'utf16le'; @@ -156,18 +166,18 @@ function slowCases(enc) { if (enc === 'latin1' || enc === 'binary') return 'latin1'; if (enc === 'BASE64') return 'base64'; if (enc === 'LATIN1' || enc === 'BINARY') return 'latin1'; - enc = `${enc}`.toLowerCase(); + enc = StringPrototypeToLowerCase(`${enc}`); if (enc === 'base64') return 'base64'; if (enc === 'latin1' || enc === 'binary') return 'latin1'; break; case 7: if (enc === 'utf16le' || enc === 'UTF16LE' || - `${enc}`.toLowerCase() === 'utf16le') + StringPrototypeToLowerCase(`${enc}`) === 'utf16le') return 'utf16le'; break; case 8: if (enc === 'utf-16le' || enc === 'UTF-16LE' || - `${enc}`.toLowerCase() === 'utf-16le') + StringPrototypeToLowerCase(`${enc}`) === 'utf-16le') return 'utf16le'; break; default: @@ -184,17 +194,17 @@ function emitExperimentalWarning(feature) { } function filterDuplicateStrings(items, low) { - const map = new Map(); + const map = new SafeMap(); for (let i = 0; i < items.length; i++) { const item = items[i]; - const key = item.toLowerCase(); + const key = StringPrototypeToLowerCase(item); if (low) { map.set(key, key); } else { map.set(key, item); } } - return ArrayFrom(map.values()).sort(); + return ArrayPrototypeSort(ArrayFrom(map.values())); } function cachedResult(fn) { @@ -202,7 +212,7 @@ function cachedResult(fn) { return () => { if (result === undefined) result = fn(); - return result.slice(); + return ArrayPrototypeSlice(result); }; } @@ -244,7 +254,7 @@ function convertToValidSignal(signal) { return signal; if (typeof signal === 'string') { - const signalName = signals[signal.toUpperCase()]; + const signalName = signals[StringPrototypeToUpperCase(signal)]; if (signalName) return signalName; } @@ -294,7 +304,7 @@ function promisify(original) { function fn(...args) { return new Promise((resolve, reject) => { - original.call(this, ...args, (err, ...values) => { + ArrayPrototypePush(args, (err, ...values) => { if (err) { return reject(err); } @@ -307,6 +317,7 @@ function promisify(original) { resolve(values[0]); } }); + ReflectApply(original, this, args); }); } @@ -343,7 +354,7 @@ function join(output, separator) { function spliceOne(list, index) { for (; index + 1 < list.length; index++) list[index] = list[index + 1]; - list.pop(); + ArrayPrototypePop(list); } const kNodeModulesRE = /^(.*)[\\/]node_modules[\\/]/; @@ -376,9 +387,9 @@ function isInsideNodeModules() { const filename = frame.getFileName(); // If a filename does not start with / or contain \, // it's likely from Node.js core. - if (!/^\/|\\/.test(filename)) + if (!RegExpPrototypeTest(/^\/|\\/, filename)) continue; - return kNodeModulesRE.test(filename); + return RegExpPrototypeTest(kNodeModulesRE, filename); } } return false; @@ -389,7 +400,7 @@ function once(callback) { return function(...args) { if (called) return; called = true; - callback.apply(this, args); + ReflectApply(callback, this, args); }; } diff --git a/lib/internal/util/comparisons.js b/lib/internal/util/comparisons.js index 2c10f0c8929752..ed8ddf6ad321d8 100644 --- a/lib/internal/util/comparisons.js +++ b/lib/internal/util/comparisons.js @@ -2,11 +2,12 @@ const { ArrayIsArray, + ArrayPrototypeFilter, + ArrayPrototypePush, BigIntPrototypeValueOf, BooleanPrototypeValueOf, DatePrototypeGetTime, Error, - Map, NumberIsNaN, NumberPrototypeValueOf, ObjectGetOwnPropertySymbols, @@ -16,10 +17,11 @@ const { ObjectPrototypeHasOwnProperty, ObjectPrototypePropertyIsEnumerable, ObjectPrototypeToString, - Set, + SafeMap, + SafeSet, StringPrototypeValueOf, SymbolPrototypeValueOf, - SymbolToStringTag, + TypedArrayPrototypeGetSymbolToStringTag, Uint8Array, } = primordials; @@ -42,15 +44,6 @@ const { isSymbolObject, isFloat32Array, isFloat64Array, - isUint8Array, - isUint8ClampedArray, - isUint16Array, - isUint32Array, - isInt8Array, - isInt16Array, - isInt32Array, - isBigInt64Array, - isBigUint64Array } = types; const { getOwnNonIndexProperties, @@ -124,37 +117,6 @@ function isEqualBoxedPrimitive(val1, val2) { assert.fail(`Unknown boxed type ${val1}`); } -function isIdenticalTypedArrayType(a, b) { - // Fast path to reduce type checks in the common case. - const check = types[`is${a[SymbolToStringTag]}`]; - if (check !== undefined && check(a)) { - return check(b); - } - // Manipulated Symbol.toStringTag. - for (const check of [ - isUint16Array, - isUint32Array, - isInt8Array, - isInt16Array, - isInt32Array, - isFloat32Array, - isFloat64Array, - isBigInt64Array, - isBigUint64Array, - isUint8ClampedArray, - isUint8Array - ]) { - if (check(a)) { - return check(b); - } - } - /* c8 ignore next 4 */ - assert.fail( - `Unknown TypedArray type checking ${a[SymbolToStringTag]} ${a}\n` + - `and ${b[SymbolToStringTag]} ${b}` - ); -} - // Notes: Type tags are historical [[Class]] properties that can be set by // FunctionTemplate::SetClassName() in C++ or Symbol.toStringTag in JS // and retrieved using Object.prototype.toString.call(obj) in JS @@ -238,8 +200,10 @@ function innerDeepEqual(val1, val2, strict, memos) { return false; } } else if (isArrayBufferView(val1)) { - if (!isIdenticalTypedArrayType(val1, val2)) + if (TypedArrayPrototypeGetSymbolToStringTag(val1) !== + TypedArrayPrototypeGetSymbolToStringTag(val2)) { return false; + } if (!strict && (isFloat32Array(val1) || isFloat64Array(val1))) { if (!areSimilarFloatArrays(val1, val2)) { return false; @@ -291,7 +255,10 @@ function innerDeepEqual(val1, val2, strict, memos) { } function getEnumerables(val, keys) { - return keys.filter((k) => ObjectPrototypePropertyIsEnumerable(val, k)); + return ArrayPrototypeFilter( + keys, + (k) => ObjectPrototypePropertyIsEnumerable(val, k) + ); } function keyCheck(val1, val2, strict, memos, iterationType, aKeys) { @@ -330,7 +297,7 @@ function keyCheck(val1, val2, strict, memos, iterationType, aKeys) { if (!ObjectPrototypePropertyIsEnumerable(val2, key)) { return false; } - aKeys.push(key); + ArrayPrototypePush(aKeys, key); count++; } else if (ObjectPrototypePropertyIsEnumerable(val2, key)) { return false; @@ -360,8 +327,8 @@ function keyCheck(val1, val2, strict, memos, iterationType, aKeys) { // Use memos to handle cycles. if (memos === undefined) { memos = { - val1: new Map(), - val2: new Map(), + val1: new SafeMap(), + val2: new SafeMap(), position: 0 }; } else { @@ -458,7 +425,7 @@ function setEquiv(a, b, strict, memo) { // to check this improves the worst case scenario instead. if (typeof val === 'object' && val !== null) { if (set === null) { - set = new Set(); + set = new SafeSet(); } // If the specified value doesn't exist in the second set its an not null // object (or non strict only: a not matching primitive) we'll need to go @@ -475,7 +442,7 @@ function setEquiv(a, b, strict, memo) { } if (set === null) { - set = new Set(); + set = new SafeSet(); } set.add(val); } @@ -521,7 +488,7 @@ function mapEquiv(a, b, strict, memo) { for (const [key, item1] of a) { if (typeof key === 'object' && key !== null) { if (set === null) { - set = new Set(); + set = new SafeSet(); } set.add(key); } else { @@ -537,7 +504,7 @@ function mapEquiv(a, b, strict, memo) { if (!mapMightHaveLoosePrim(a, b, key, item1, memo)) return false; if (set === null) { - set = new Set(); + set = new SafeSet(); } set.add(key); } diff --git a/lib/internal/util/debuglog.js b/lib/internal/util/debuglog.js index a3b8a84772054e..3dc7a5157d5e65 100644 --- a/lib/internal/util/debuglog.js +++ b/lib/internal/util/debuglog.js @@ -1,12 +1,15 @@ 'use strict'; const { + FunctionPrototype, FunctionPrototypeBind, ObjectCreate, ObjectDefineProperty, RegExp, RegExpPrototypeTest, - StringPrototypeToUpperCase + SafeArrayIterator, + StringPrototypeToLowerCase, + StringPrototypeToUpperCase, } = primordials; const { inspect, format, formatWithOptions } = require('internal/util/inspect'); @@ -36,13 +39,13 @@ function initializeDebugEnv(debugEnv) { function emitWarningIfNeeded(set) { if ('HTTP' === set || 'HTTP2' === set) { process.emitWarning('Setting the NODE_DEBUG environment variable ' + - 'to \'' + set.toLowerCase() + '\' can expose sensitive ' + + 'to \'' + StringPrototypeToLowerCase(set) + '\' can expose sensitive ' + 'data (such as passwords, tokens and authentication headers) ' + 'in the resulting log.'); } } -function noop() {} +const noop = FunctionPrototype; function debuglogImpl(enabled, set) { if (debugImpls[set] === undefined) { @@ -78,7 +81,7 @@ function debuglog(set, cb) { debug = debuglogImpl(enabled, set); if (typeof cb === 'function') cb(debug); - debug(...args); + debug(...new SafeArrayIterator(args)); }; let enabled; let test = () => { @@ -86,7 +89,7 @@ function debuglog(set, cb) { test = () => enabled; return enabled; }; - const logger = (...args) => debug(...args); + const logger = (...args) => debug(...new SafeArrayIterator(args)); ObjectDefineProperty(logger, 'enabled', { get() { return test(); diff --git a/lib/internal/util/inspect.js b/lib/internal/util/inspect.js index 17ca3f3d2b39ce..b03380030a6be5 100644 --- a/lib/internal/util/inspect.js +++ b/lib/internal/util/inspect.js @@ -3,6 +3,11 @@ const { Array, ArrayIsArray, + ArrayPrototypeFilter, + ArrayPrototypeForEach, + ArrayPrototypePush, + ArrayPrototypeSort, + ArrayPrototypeUnshift, BigIntPrototypeValueOf, BooleanPrototypeValueOf, DatePrototypeGetTime, @@ -12,7 +17,6 @@ const { FunctionPrototypeCall, FunctionPrototypeToString, JSONStringify, - Map, MapPrototypeGetSize, MapPrototypeEntries, MathFloor, @@ -39,13 +43,27 @@ const { ObjectPrototypePropertyIsEnumerable, ObjectSeal, ObjectSetPrototypeOf, - ReflectApply, RegExp, + RegExpPrototypeTest, RegExpPrototypeToString, - Set, + SafeStringIterator, + SafeMap, + SafeSet, SetPrototypeGetSize, SetPrototypeValues, String, + StringPrototypeCharCodeAt, + StringPrototypeCodePointAt, + StringPrototypeIncludes, + StringPrototypeNormalize, + StringPrototypePadEnd, + StringPrototypePadStart, + StringPrototypeRepeat, + StringPrototypeReplace, + StringPrototypeSlice, + StringPrototypeSplit, + StringPrototypeToLowerCase, + StringPrototypeTrim, StringPrototypeValueOf, SymbolPrototypeToString, SymbolPrototypeValueOf, @@ -119,8 +137,11 @@ const { NativeModule } = require('internal/bootstrap/loaders'); let hexSlice; -const builtInObjects = new Set( - ObjectGetOwnPropertyNames(global).filter((e) => /^[A-Z][a-zA-Z0-9]+$/.test(e)) +const builtInObjects = new SafeSet( + ArrayPrototypeFilter( + ObjectGetOwnPropertyNames(global), + (e) => RegExpPrototypeTest(/^[A-Z][a-zA-Z0-9]+$/, e) + ) ); // https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot @@ -429,7 +450,7 @@ function addQuotes(str, quotes) { return `'${str}'`; } -const escapeFn = (str) => meta[str.charCodeAt(0)]; +const escapeFn = (str) => meta[StringPrototypeCharCodeAt(str)]; // Escape control characters, single quotes and the backslash. // This is similar to JSON stringify escaping. @@ -442,12 +463,13 @@ function strEscape(str) { // instead wrap the text in double quotes. If double quotes exist, check for // backticks. If they do not exist, use those as fallback instead of the // double quotes. - if (str.includes("'")) { + if (StringPrototypeIncludes(str, "'")) { // This invalidates the charCode and therefore can not be matched for // anymore. - if (!str.includes('"')) { + if (!StringPrototypeIncludes(str, '"')) { singleQuote = -1; - } else if (!str.includes('`') && !str.includes('${')) { + } else if (!StringPrototypeIncludes(str, '`') && + !StringPrototypeIncludes(str, '${')) { singleQuote = -2; } if (singleQuote !== 39) { @@ -457,10 +479,10 @@ function strEscape(str) { } // Some magic numbers that worked out fine while benchmarking with v8 6.0 - if (str.length < 5000 && !escapeTest.test(str)) + if (str.length < 5000 && !RegExpPrototypeTest(escapeTest, str)) return addQuotes(str, singleQuote); if (str.length > 100) { - str = str.replace(escapeReplace, escapeFn); + str = StringPrototypeReplace(str, escapeReplace, escapeFn); return addQuotes(str, singleQuote); } @@ -468,7 +490,7 @@ function strEscape(str) { let last = 0; const lastIndex = str.length; for (let i = 0; i < lastIndex; i++) { - const point = str.charCodeAt(i); + const point = StringPrototypeCharCodeAt(str, i); if (point === singleQuote || point === 92 || point < 32 || @@ -476,14 +498,14 @@ function strEscape(str) { if (last === i) { result += meta[point]; } else { - result += `${str.slice(last, i)}${meta[point]}`; + result += `${StringPrototypeSlice(str, last, i)}${meta[point]}`; } last = i + 1; } } if (last !== lastIndex) { - result += str.slice(last); + result += StringPrototypeSlice(str, last); } return addQuotes(result, singleQuote); } @@ -587,15 +609,15 @@ function addPrototypeProperties(ctx, main, obj, recurseTimes, output) { } if (depth === 0) { - keySet = new Set(); + keySet = new SafeSet(); } else { - keys.forEach((key) => keySet.add(key)); + ArrayPrototypeForEach(keys, (key) => keySet.add(key)); } // Get all own property names and symbols. keys = ObjectGetOwnPropertyNames(obj); const symbols = ObjectGetOwnPropertySymbols(obj); if (symbols.length !== 0) { - keys.push(...symbols); + ArrayPrototypePush(keys, ...symbols); } for (const key of keys) { // Ignore the `constructor` property and keys that exist on layers above. @@ -612,9 +634,9 @@ function addPrototypeProperties(ctx, main, obj, recurseTimes, output) { ctx, obj, recurseTimes, key, kObjectType, desc, main); if (ctx.colors) { // Faint! - output.push(`\u001b[2m${value}\u001b[22m`); + ArrayPrototypePush(output, `\u001b[2m${value}\u001b[22m`); } else { - output.push(value); + ArrayPrototypePush(output, value); } } // Limit the inspection to up to three prototype layers. Using `recurseTimes` @@ -660,7 +682,7 @@ function getKeys(value, showHidden) { } if (symbols.length !== 0) { const filter = (key) => ObjectPrototypePropertyIsEnumerable(value, key); - keys.push(...symbols.filter(filter)); + ArrayPrototypePush(keys, ...ArrayPrototypeFilter(symbols, filter)); } } return keys; @@ -750,7 +772,8 @@ function formatValue(ctx, value, recurseTimes, typedArray) { if (ctx.seen.includes(value)) { let index = 1; if (ctx.circular === undefined) { - ctx.circular = new Map([[value, index]]); + ctx.circular = new SafeMap(); + ctx.circular.set(value, index); } else { index = ctx.circular.get(value); if (index === undefined) { @@ -923,11 +946,11 @@ function formatRaw(ctx, value, recurseTimes, typedArray) { `{ byteLength: ${formatNumber(ctx.stylize, value.byteLength)} }`; } braces[0] = `${prefix}{`; - keys.unshift('byteLength'); + ArrayPrototypeUnshift(keys, 'byteLength'); } else if (isDataView(value)) { braces[0] = `${getPrefix(constructor, tag, 'DataView')}{`; // .buffer goes last, it's not a primitive like the others. - keys.unshift('byteLength', 'byteOffset', 'buffer'); + ArrayPrototypeUnshift(keys, 'byteLength', 'byteOffset', 'buffer'); } else if (isPromise(value)) { braces[0] = `${getPrefix(constructor, tag, 'Promise')}{`; formatter = formatPromise; @@ -1071,7 +1094,7 @@ function getBoxedBase(value, ctx, keys, constructor, tag) { } if (keys.length !== 0 || ctx.stylize === stylizeNoColor) return base; - return ctx.stylize(base, type.toLowerCase()); + return ctx.stylize(base, StringPrototypeToLowerCase(type)); } function getClassBase(value, constructor, tag) { @@ -1286,11 +1309,11 @@ function groupArrayElements(ctx, output, value) { lineMaxLength += separatorSpace; maxLineLength[i] = lineMaxLength; } - let order = 'padStart'; + let order = StringPrototypePadStart; if (value !== undefined) { for (let i = 0; i < output.length; i++) { if (typeof value[i] !== 'number' && typeof value[i] !== 'bigint') { - order = 'padEnd'; + order = StringPrototypePadEnd; break; } } @@ -1306,21 +1329,21 @@ function groupArrayElements(ctx, output, value) { // done line by line as some lines might contain more colors than // others. const padding = maxLineLength[j - i] + output[j].length - dataLen[j]; - str += `${output[j]}, `[order](padding, ' '); + str += order(`${output[j]}, `, padding, ' '); } - if (order === 'padStart') { + if (order === StringPrototypePadStart) { const padding = maxLineLength[j - i] + output[j].length - dataLen[j] - separatorSpace; - str += output[j].padStart(padding, ' '); + str += StringPrototypePadStart(output[j], padding, ' '); } else { str += output[j]; } - tmp.push(str); + ArrayPrototypePush(tmp, str); } if (ctx.maxArrayLength < output.length) { - tmp.push(output[outputLength]); + ArrayPrototypePush(tmp, output[outputLength]); } output = tmp; } @@ -1457,8 +1480,9 @@ function formatArrayBuffer(ctx, value) { } if (hexSlice === undefined) hexSlice = uncurryThis(require('buffer').Buffer.prototype.hexSlice); - let str = hexSlice(buffer, 0, MathMin(ctx.maxArrayLength, buffer.length)) - .replace(/(.{2})/g, '$1 ').trim(); + let str = StringPrototypeTrim(StringPrototypeReplace( + hexSlice(buffer, 0, MathMin(ctx.maxArrayLength, buffer.length)), + /(.{2})/g, '$1 ')); const remaining = buffer.length - ctx.maxArrayLength; if (remaining > 0) str += ` ... ${remaining} more byte${remaining > 1 ? 's' : ''}`; @@ -1507,7 +1531,7 @@ function formatTypedArray(value, length, ctx, ignored, recurseTimes) { 'buffer' ]) { const str = formatValue(ctx, value[key], recurseTimes, true); - output.push(`[${key}]: ${str}`); + ArrayPrototypePush(output, `[${key}]: ${str}`); } ctx.indentationLvl -= 2; } @@ -1518,7 +1542,7 @@ function formatSet(value, ctx, ignored, recurseTimes) { const output = []; ctx.indentationLvl += 2; for (const v of value) { - output.push(formatValue(ctx, v, recurseTimes)); + ArrayPrototypePush(output, formatValue(ctx, v, recurseTimes)); } ctx.indentationLvl -= 2; return output; @@ -1538,7 +1562,7 @@ function formatMap(value, ctx, ignored, recurseTimes) { function formatSetIterInner(ctx, recurseTimes, entries, state) { const maxArrayLength = MathMax(ctx.maxArrayLength, 0); const maxLength = MathMin(maxArrayLength, entries.length); - let output = new Array(maxLength); + const output = new Array(maxLength); ctx.indentationLvl += 2; for (let i = 0; i < maxLength; i++) { output[i] = formatValue(ctx, entries[i], recurseTimes); @@ -1548,11 +1572,12 @@ function formatSetIterInner(ctx, recurseTimes, entries, state) { // Sort all entries to have a halfway reliable output (if more entries than // retrieved ones exist, we can not reliably return the same output) if the // output is not sorted anyway. - output = output.sort(); + ArrayPrototypeSort(output); } const remaining = entries.length - maxLength; if (remaining > 0) { - output.push(`... ${remaining} more item${remaining > 1 ? 's' : ''}`); + ArrayPrototypePush(output, + `... ${remaining} more item${remaining > 1 ? 's' : ''}`); } return output; } @@ -1660,7 +1685,7 @@ function formatProperty(ctx, value, recurseTimes, key, type, desc, (ctx.getters === 'get' && desc.set === undefined) || (ctx.getters === 'set' && desc.set !== undefined))) { try { - const tmp = ReflectApply(desc.get, original, []); + const tmp = FunctionPrototypeCall(desc.get, original); ctx.indentationLvl += 2; if (tmp === null) { str = `${s(`[${label}:`, sp)} ${s('null', 'null')}${s(']', sp)}`; @@ -1687,11 +1712,16 @@ function formatProperty(ctx, value, recurseTimes, key, type, desc, return str; } if (typeof key === 'symbol') { - const tmp = key.toString().replace(strEscapeSequencesReplacer, escapeFn); + const tmp = StringPrototypeReplace( + SymbolPrototypeToString(key), + strEscapeSequencesReplacer, escapeFn + ); name = `[${ctx.stylize(tmp, 'symbol')}]`; } else if (desc.enumerable === false) { - name = `[${key.replace(strEscapeSequencesReplacer, escapeFn)}]`; - } else if (keyStrRegExp.test(key)) { + const tmp = StringPrototypeReplace(key, + strEscapeSequencesReplacer, escapeFn); + name = `[${tmp}]`; + } else if (RegExpPrototypeTest(keyStrRegExp, key)) { name = ctx.stylize(key, 'name'); } else { name = ctx.stylize(strEscape(key), 'string'); @@ -1720,7 +1750,7 @@ function isBelowBreakLength(ctx, output, start, base) { } } // Do not line up properties on the same line if `base` contains line breaks. - return base === '' || !base.includes('\n'); + return base === '' || !StringPrototypeIncludes(base, '\n'); } function reduceToSingleString( @@ -1763,7 +1793,7 @@ function reduceToSingleString( } } // Line up each entry on an individual line. - const indentation = `\n${' '.repeat(ctx.indentationLvl)}`; + const indentation = `\n${StringPrototypeRepeat(' ', ctx.indentationLvl)}`; return `${base ? `${base} ` : ''}${braces[0]}${indentation} ` + `${join(output, `,${indentation} `)}${indentation}${braces[1]}`; } @@ -1773,7 +1803,7 @@ function reduceToSingleString( return `${braces[0]}${base ? ` ${base}` : ''} ${join(output, ', ')} ` + braces[1]; } - const indentation = ' '.repeat(ctx.indentationLvl); + const indentation = StringPrototypeRepeat(' ', ctx.indentationLvl); // If the opening "brace" is too large, like in the case of "Set {", // we need to force the first item to be on the next line or the // items will not line up correctly. @@ -1815,7 +1845,8 @@ function hasBuiltInToString(value) { builtInObjects.has(descriptor.value.name); } -const firstErrorLine = (error) => error.message.split('\n')[0]; +const firstErrorLine = (error) => + StringPrototypeSplit(error.message, '\n', 1)[0]; let CIRCULAR_ERROR_MESSAGE; function tryStringify(arg) { try { @@ -1863,8 +1894,8 @@ function formatWithOptionsInternal(inspectOptions, ...args) { let lastPos = 0; for (let i = 0; i < first.length - 1; i++) { - if (first.charCodeAt(i) === 37) { // '%' - const nextChar = first.charCodeAt(++i); + if (StringPrototypeCharCodeAt(first, i) === 37) { // '%' + const nextChar = StringPrototypeCharCodeAt(first, ++i); if (a + 1 !== args.length) { switch (nextChar) { case 115: // 's' @@ -1935,19 +1966,19 @@ function formatWithOptionsInternal(inspectOptions, ...args) { tempStr = ''; break; case 37: // '%' - str += first.slice(lastPos, i); + str += StringPrototypeSlice(first, lastPos, i); lastPos = i + 1; continue; default: // Any other character is not a correct placeholder continue; } if (lastPos !== i - 1) { - str += first.slice(lastPos, i - 1); + str += StringPrototypeSlice(first, lastPos, i - 1); } str += tempStr; lastPos = i + 1; } else if (nextChar === 37) { - str += first.slice(lastPos, i); + str += StringPrototypeSlice(first, lastPos, i); lastPos = i + 1; } } @@ -1956,7 +1987,7 @@ function formatWithOptionsInternal(inspectOptions, ...args) { a++; join = ' '; if (lastPos < first.length) { - str += first.slice(lastPos); + str += StringPrototypeSlice(first, lastPos); } } } @@ -2004,9 +2035,9 @@ if (internalBinding('config').hasIntl) { if (removeControlChars) str = stripVTControlCharacters(str); - str = str.normalize('NFC'); - for (const char of str) { - const code = char.codePointAt(0); + str = StringPrototypeNormalize(str, 'NFC'); + for (const char of new SafeStringIterator(str)) { + const code = StringPrototypeCodePointAt(char, 0); if (isFullWidthCodePoint(code)) { width += 2; } else if (!isZeroWidthCodePoint(code)) { diff --git a/lib/internal/util/inspector.js b/lib/internal/util/inspector.js index 8d413b116fd0f2..cf8651c33ad6d0 100644 --- a/lib/internal/util/inspector.js +++ b/lib/internal/util/inspector.js @@ -1,6 +1,8 @@ 'use strict'; const { + ArrayPrototypeConcat, + FunctionPrototypeBind, ObjectDefineProperty, ObjectKeys, } = primordials; @@ -27,8 +29,10 @@ function installConsoleExtensions(commandLineApi) { const { makeRequireFunction } = require('internal/modules/cjs/helpers'); const consoleAPIModule = new CJSModule(''); const cwd = tryGetCwd(); - consoleAPIModule.paths = - CJSModule._nodeModulePaths(cwd).concat(CJSModule.globalPaths); + consoleAPIModule.paths = ArrayPrototypeConcat( + CJSModule._nodeModulePaths(cwd), + CJSModule.globalPaths + ); commandLineApi.require = makeRequireFunction(consoleAPIModule); } @@ -40,9 +44,12 @@ function wrapConsole(consoleFromNode, consoleFromVM) { // then wrap these two methods into one. Native wrapper will preserve // the original stack. if (consoleFromNode.hasOwnProperty(key)) { - consoleFromNode[key] = consoleCall.bind(consoleFromNode, - consoleFromVM[key], - consoleFromNode[key]); + consoleFromNode[key] = FunctionPrototypeBind( + consoleCall, + consoleFromNode, + consoleFromVM[key], + consoleFromNode[key] + ); ObjectDefineProperty(consoleFromNode[key], 'name', { value: key }); diff --git a/lib/internal/v8_prof_polyfill.js b/lib/internal/v8_prof_polyfill.js index 5f5922c5386543..ae98a03ab206d8 100644 --- a/lib/internal/v8_prof_polyfill.js +++ b/lib/internal/v8_prof_polyfill.js @@ -25,7 +25,10 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -/* eslint-disable no-restricted-globals */ +'use strict'; + +/* eslint-disable node-core/prefer-primordials */ +/* global Buffer, console */ module.exports = { versionCheck }; @@ -37,7 +40,7 @@ if (module.id === 'internal/v8_prof_polyfill') return; // Node polyfill const fs = require('fs'); const cp = require('child_process'); -const os = { +const os = { // eslint-disable-line no-unused-vars system: function(name, args) { if (process.platform === 'linux' && name === 'nm') { // Filter out vdso and vsyscall entries. @@ -51,28 +54,29 @@ const os = { let out = cp.spawnSync(name, args).stdout.toString(); // Auto c++filt names, but not [iItT] if (process.platform === 'darwin' && name === 'nm') { - // nm prints an error along the lines of "Run xcodebuild -license" and + // `nm` prints an error along the lines of "Run xcodebuild -license" and // exits when Xcode hasn't been properly installed or when its license // hasn't been accepted yet. Basically any mention of xcodebuild in // the output means the nm command is non-functional. const match = out.match(/(?:^|\n)([^\n]*xcodebuild[^\n]*)(?:\n|$)/); + // eslint-disable-next-line no-restricted-syntax if (match) throw new Error(match[1]); out = macCppfiltNm(out); } return out; } }; -const print = console.log; -function read(fileName) { +const print = console.log; // eslint-disable-line no-unused-vars +function read(fileName) { // eslint-disable-line no-unused-vars return fs.readFileSync(fileName, 'utf8'); } -const quit = process.exit; +const quit = process.exit; // eslint-disable-line no-unused-vars // Polyfill "readline()". -const logFile = arguments[arguments.length - 1]; +const logFile = arguments[arguments.length - 1]; // eslint-disable-line no-undef try { fs.accessSync(logFile); -} catch(e) { +} catch { console.error('Please provide a valid isolate file as the final argument.'); process.exit(1); } @@ -121,8 +125,8 @@ function versionCheck(firstLine, expected) { // whereas process.versions.v8 is either "$major.$minor.$build-$embedder" or // "$major.$minor.$build.$patch-$embedder". firstLine = firstLine.split(','); - const curVer = expected.split(/[.\-]/); - if (firstLine.length !== 6 && firstLine.length !== 7 || + const curVer = expected.split(/[.-]/); + if ((firstLine.length !== 6 && firstLine.length !== 7) || firstLine[0] !== 'v8-version') { return 'Unable to read v8-version from log file.'; } @@ -140,13 +144,11 @@ function macCppfiltNm(out) { if (entries === null) return out; - entries = entries.map((entry) => { - return entry.replace(CLEAN_RE, '') - }); + entries = entries.map((entry) => entry.replace(CLEAN_RE, '')); let filtered; try { - filtered = cp.spawnSync('c++filt', [ '-p' , '-i' ], { + filtered = cp.spawnSync('c++filt', [ '-p', '-i' ], { input: entries.join('\n') }).stdout.toString(); } catch { diff --git a/lib/internal/validators.js b/lib/internal/validators.js index 2439342ae8a78b..192c21b52c83e8 100644 --- a/lib/internal/validators.js +++ b/lib/internal/validators.js @@ -2,11 +2,17 @@ const { ArrayIsArray, + ArrayPrototypeIncludes, + ArrayPrototypeJoin, + ArrayPrototypeMap, NumberIsInteger, NumberMAX_SAFE_INTEGER, NumberMIN_SAFE_INTEGER, NumberParseInt, + RegExpPrototypeTest, String, + StringPrototypeToUpperCase, + StringPrototypeTrim, } = primordials; const { @@ -63,7 +69,7 @@ function parseFileMode(value, name, def) { } if (typeof value === 'string') { - if (!octalReg.test(value)) { + if (!RegExpPrototypeTest(octalReg, value)) { throw new ERR_INVALID_ARG_VALUE(name, value, modeDesc); } return NumberParseInt(value, 8); @@ -129,10 +135,11 @@ function validateNumber(value, name) { } const validateOneOf = hideStackFrames((value, name, oneOf) => { - if (!oneOf.includes(value)) { - const allowed = oneOf - .map((v) => (typeof v === 'string' ? `'${v}'` : String(v))) - .join(', '); + if (!ArrayPrototypeIncludes(oneOf, value)) { + const allowed = ArrayPrototypeJoin( + ArrayPrototypeMap(oneOf, (v) => + (typeof v === 'string' ? `'${v}'` : String(v))), + ', '); const reason = 'must be one of: ' + allowed; throw new ERR_INVALID_ARG_VALUE(name, value, reason); } @@ -167,7 +174,7 @@ function validateSignalName(signal, name = 'signal') { throw new ERR_INVALID_ARG_TYPE(name, 'string', signal); if (signals[signal] === undefined) { - if (signals[signal.toUpperCase()] !== undefined) { + if (signals[StringPrototypeToUpperCase(signal)] !== undefined) { throw new ERR_UNKNOWN_SIGNAL(signal + ' (signals must use all capital letters)'); } @@ -198,7 +205,7 @@ function validateEncoding(data, encoding) { // is an integer and that it falls within the legal range of port numbers. function validatePort(port, name = 'Port', { allowZero = true } = {}) { if ((typeof port !== 'number' && typeof port !== 'string') || - (typeof port === 'string' && port.trim().length === 0) || + (typeof port === 'string' && StringPrototypeTrim(port).length === 0) || +port !== (+port >>> 0) || port > 0xFFFF || (port === 0 && !allowZero)) { diff --git a/lib/net.js b/lib/net.js index 149e4df20f2717..911b654e5cbcc2 100644 --- a/lib/net.js +++ b/lib/net.js @@ -109,6 +109,7 @@ const { } = require('internal/errors'); const { isUint8Array } = require('internal/util/types'); const { + validateAbortSignal, validateInt32, validatePort, validateString @@ -1148,6 +1149,22 @@ function afterConnect(status, handle, req, readable, writable) { } } +function addAbortSignalOption(self, options) { + if (options?.signal === undefined) { + return; + } + validateAbortSignal(options.signal, 'options.signal'); + const { signal } = options; + const onAborted = () => { + self.close(); + }; + if (signal.aborted) { + process.nextTick(onAborted); + } else { + signal.addEventListener('abort', onAborted); + self.once('close', () => signal.removeEventListener('abort', onAborted)); + } +} function Server(options, connectionListener) { if (!(this instanceof Server)) @@ -1398,6 +1415,7 @@ Server.prototype.listen = function(...args) { listenInCluster(this, null, -1, -1, backlogFromArgs); return this; } + addAbortSignalOption(this, options); // (handle[, backlog][, cb]) where handle is an object with a fd if (typeof options.fd === 'number' && options.fd >= 0) { listenInCluster(this, null, null, null, backlogFromArgs, options.fd); diff --git a/lib/perf_hooks.js b/lib/perf_hooks.js index 7429db38fd77ef..5cbf018ff8efae 100644 --- a/lib/perf_hooks.js +++ b/lib/perf_hooks.js @@ -3,6 +3,7 @@ const { ArrayIsArray, ArrayPrototypeFilter, + ArrayPrototypeForEach, ArrayPrototypeIncludes, ArrayPrototypeMap, ArrayPrototypePush, @@ -56,7 +57,6 @@ const L = require('internal/linkedlist'); const kInspect = require('internal/util').customInspectSymbol; const { - ERR_INVALID_CALLBACK, ERR_INVALID_ARG_TYPE, ERR_INVALID_ARG_VALUE, ERR_VALID_PERFORMANCE_ENTRY_TYPE, @@ -68,6 +68,8 @@ const { kHandle, } = require('internal/histogram'); +const { validateCallback } = require('internal/validators'); + const { setImmediate } = require('timers'); const kCallback = Symbol('callback'); const kTypes = Symbol('types'); @@ -341,9 +343,7 @@ class PerformanceObserverEntryList { class PerformanceObserver { constructor(callback) { - if (typeof callback !== 'function') { - throw new ERR_INVALID_CALLBACK(callback); - } + validateCallback(callback); ObjectDefineProperties(this, { [kTypes]: { enumerable: false, @@ -376,13 +376,13 @@ class PerformanceObserver { disconnect() { const observerCountsGC = observerCounts[NODE_PERFORMANCE_ENTRY_TYPE_GC]; const types = this[kTypes]; - for (const key of ObjectKeys(types)) { + ArrayPrototypeForEach(ObjectKeys(types), (key) => { const item = types[key]; if (item) { L.remove(item); observerCounts[key]--; } - } + }); this[kTypes] = {}; if (observerCountsGC === 1 && observerCounts[NODE_PERFORMANCE_ENTRY_TYPE_GC] === 0) { @@ -409,14 +409,14 @@ class PerformanceObserver { this[kBuffer][kEntries] = []; L.init(this[kBuffer][kEntries]); this[kBuffering] = Boolean(options.buffered); - for (const entryType of filteredEntryTypes) { + ArrayPrototypeForEach(filteredEntryTypes, (entryType) => { const list = getObserversList(entryType); - if (this[kTypes][entryType]) continue; + if (this[kTypes][entryType]) return; const item = { obs: this }; this[kTypes][entryType] = item; L.append(list, item); observerCounts[entryType]++; - } + }); if (observerCountsGC === 0 && observerCounts[NODE_PERFORMANCE_ENTRY_TYPE_GC] === 1) { installGarbageCollectionTracking(); @@ -641,6 +641,7 @@ function sortedInsert(list, entry) { } class ELDHistogram extends Histogram { + constructor(i) { super(i); } // eslint-disable-line no-useless-constructor enable() { return this[kHandle].enable(); } disable() { return this[kHandle].disable(); } } diff --git a/lib/readline.js b/lib/readline.js index 03e8b27db7ac75..0067965caa68b9 100644 --- a/lib/readline.js +++ b/lib/readline.js @@ -59,14 +59,15 @@ const { StringPrototypeTrim, Symbol, SymbolAsyncIterator, + SafeStringIterator, } = primordials; const { ERR_INVALID_ARG_VALUE, - ERR_INVALID_CALLBACK, ERR_INVALID_CURSOR_POS, } = require('internal/errors').codes; const { + validateCallback, validateString, validateUint32, } = require('internal/validators'); @@ -273,9 +274,6 @@ function Interface(input, output, completer, terminal) { input.on('keypress', onkeypress); input.on('end', ontermend); - // Current line - this.line = ''; - this._setRawMode(true); this.terminal = true; @@ -291,6 +289,9 @@ function Interface(input, output, completer, terminal) { self.once('close', onSelfCloseWithTerminal); } + // Current line + this.line = ''; + input.resume(); } @@ -752,7 +753,7 @@ Interface.prototype._getDisplayPos = function(str) { const col = this.columns; let rows = 0; str = stripVTControlCharacters(str); - for (const char of str) { + for (const char of new SafeStringIterator(str)) { if (char === '\n') { // Rows must be incremented by 1 even if offset = 0 or col = +Infinity. rows += MathCeil(offset / col) || 1; @@ -1168,7 +1169,7 @@ function emitKeypressEvents(stream, iface = {}) { iface.isCompletionEnabled = false; let length = 0; - for (const character of string) { + for (const character of new SafeStringIterator(string)) { length += character.length; if (length === string.length) { iface.isCompletionEnabled = true; @@ -1215,8 +1216,9 @@ function emitKeypressEvents(stream, iface = {}) { */ function cursorTo(stream, x, y, callback) { - if (callback !== undefined && typeof callback !== 'function') - throw new ERR_INVALID_CALLBACK(callback); + if (callback !== undefined) { + validateCallback(callback); + } if (typeof y === 'function') { callback = y; @@ -1241,8 +1243,9 @@ function cursorTo(stream, x, y, callback) { */ function moveCursor(stream, dx, dy, callback) { - if (callback !== undefined && typeof callback !== 'function') - throw new ERR_INVALID_CALLBACK(callback); + if (callback !== undefined) { + validateCallback(callback); + } if (stream == null || !(dx || dy)) { if (typeof callback === 'function') @@ -1275,8 +1278,9 @@ function moveCursor(stream, dx, dy, callback) { */ function clearLine(stream, dir, callback) { - if (callback !== undefined && typeof callback !== 'function') - throw new ERR_INVALID_CALLBACK(callback); + if (callback !== undefined) { + validateCallback(callback); + } if (stream === null || stream === undefined) { if (typeof callback === 'function') @@ -1297,8 +1301,9 @@ function clearLine(stream, dir, callback) { */ function clearScreenDown(stream, callback) { - if (callback !== undefined && typeof callback !== 'function') - throw new ERR_INVALID_CALLBACK(callback); + if (callback !== undefined) { + validateCallback(callback); + } if (stream === null || stream === undefined) { if (typeof callback === 'function') diff --git a/lib/timers.js b/lib/timers.js index 6cb64b98b5cdc0..3cce2e37b007e8 100644 --- a/lib/timers.js +++ b/lib/timers.js @@ -171,7 +171,7 @@ ObjectDefineProperty(setTimeout, customPromisify, { }); function clearTimeout(timer) { - if (timer && timer._onTimeout) { + if (timer?._onTimeout) { timer._onTimeout = null; unenroll(timer); return; diff --git a/lib/timers/promises.js b/lib/timers/promises.js index 76713bcf603342..c46b98f798ccaf 100644 --- a/lib/timers/promises.js +++ b/lib/timers/promises.js @@ -18,6 +18,8 @@ const { codes: { ERR_INVALID_ARG_TYPE } } = require('internal/errors'); +const { validateAbortSignal } = require('internal/validators'); + function cancelListenerHandler(clear, reject) { if (!this._destroyed) { clear(this); @@ -35,15 +37,10 @@ function setTimeout(after, value, options = {}) { options)); } const { signal, ref = true } = options; - if (signal !== undefined && - (signal === null || - typeof signal !== 'object' || - !('aborted' in signal))) { - return PromiseReject( - new ERR_INVALID_ARG_TYPE( - 'options.signal', - 'AbortSignal', - signal)); + try { + validateAbortSignal(signal, 'options.signal'); + } catch (err) { + return PromiseReject(err); } if (typeof ref !== 'boolean') { return PromiseReject( @@ -52,10 +49,7 @@ function setTimeout(after, value, options = {}) { 'boolean', ref)); } - // TODO(@jasnell): If a decision is made that this cannot be backported - // to 12.x, then this can be converted to use optional chaining to - // simplify the check. - if (signal && signal.aborted) { + if (signal?.aborted) { return PromiseReject(new AbortError()); } let oncancel; @@ -85,15 +79,10 @@ function setImmediate(value, options = {}) { options)); } const { signal, ref = true } = options; - if (signal !== undefined && - (signal === null || - typeof signal !== 'object' || - !('aborted' in signal))) { - return PromiseReject( - new ERR_INVALID_ARG_TYPE( - 'options.signal', - 'AbortSignal', - signal)); + try { + validateAbortSignal(signal, 'options.signal'); + } catch (err) { + return PromiseReject(err); } if (typeof ref !== 'boolean') { return PromiseReject( @@ -102,10 +91,7 @@ function setImmediate(value, options = {}) { 'boolean', ref)); } - // TODO(@jasnell): If a decision is made that this cannot be backported - // to 12.x, then this can be converted to use optional chaining to - // simplify the check. - if (signal && signal.aborted) { + if (signal?.aborted) { return PromiseReject(new AbortError()); } let oncancel; diff --git a/lib/tls.js b/lib/tls.js index 7ee9ae49f03a68..49c7d245171b10 100644 --- a/lib/tls.js +++ b/lib/tls.js @@ -24,6 +24,7 @@ const { Array, ArrayIsArray, + ArrayPrototypeForEach, ArrayPrototypeIncludes, ArrayPrototypeJoin, ArrayPrototypePush, @@ -31,6 +32,7 @@ const { ArrayPrototypeSome, ObjectDefineProperty, ObjectFreeze, + ReflectConstruct, RegExpPrototypeTest, StringFromCharCode, StringPrototypeCharCodeAt, @@ -214,7 +216,7 @@ function check(hostParts, pattern, wildcards) { if (patternParts.length <= 2) return false; - const [prefix, suffix] = patternSubdomainParts; + const { 0: prefix, 1: suffix } = patternSubdomainParts; if (prefix.length + suffix.length > hostSubdomain.length) return false; @@ -239,7 +241,8 @@ exports.checkServerIdentity = function checkServerIdentity(hostname, cert) { hostname = '' + hostname; if (altNames) { - for (const name of StringPrototypeSplit(altNames, ', ')) { + const splitAltNames = StringPrototypeSplit(altNames, ', '); + ArrayPrototypeForEach(splitAltNames, (name) => { if (StringPrototypeStartsWith(name, 'DNS:')) { ArrayPrototypePush(dnsNames, StringPrototypeSlice(name, 4)); } else if (StringPrototypeStartsWith(name, 'URI:')) { @@ -264,7 +267,7 @@ exports.checkServerIdentity = function checkServerIdentity(hostname, cert) { } else if (StringPrototypeStartsWith(name, 'IP Address:')) { ArrayPrototypePush(ips, canonicalizeIP(StringPrototypeSlice(name, 11))); } - } + }); } let valid = false; @@ -359,7 +362,7 @@ exports.connect = _tls_wrap.connect; exports.createSecurePair = internalUtil.deprecate( function createSecurePair(...args) { - return new SecurePair(...args); + return ReflectConstruct(SecurePair, args); }, 'tls.createSecurePair() is deprecated. Please use ' + 'tls.TLSSocket instead.', 'DEP0064'); diff --git a/lib/trace_events.js b/lib/trace_events.js index 35f776ad53c310..85101e7930d977 100644 --- a/lib/trace_events.js +++ b/lib/trace_events.js @@ -2,7 +2,8 @@ const { ArrayIsArray, - Set, + ArrayPrototypeJoin, + SafeSet, Symbol, } = primordials; @@ -27,7 +28,7 @@ const { CategorySet, getEnabledCategories } = internalBinding('trace_events'); const { customInspectSymbol } = require('internal/util'); const { format } = require('internal/util/inspect'); -const enabledTracingObjects = new Set(); +const enabledTracingObjects = new SafeSet(); class Tracing { constructor(categories) { @@ -63,7 +64,7 @@ class Tracing { } get categories() { - return this[kCategories].join(','); + return ArrayPrototypeJoin(this[kCategories], ','); } [customInspectSymbol](depth, opts) { diff --git a/lib/tty.js b/lib/tty.js index 583cc1329830c9..106f8cc423ddf6 100644 --- a/lib/tty.js +++ b/lib/tty.js @@ -132,7 +132,7 @@ WriteStream.prototype._refreshSize = function() { this.emit('error', errors.errnoException(err, 'getWindowSize')); return; } - const [newCols, newRows] = winSize; + const { 0: newCols, 1: newRows } = winSize; if (oldCols !== newCols || oldRows !== newRows) { this.columns = newCols; this.rows = newRows; diff --git a/lib/url.js b/lib/url.js index cc36216f9eb916..49f99a8b5fa621 100644 --- a/lib/url.js +++ b/lib/url.js @@ -26,6 +26,7 @@ const { ObjectCreate, ObjectKeys, SafeSet, + StringPrototypeCharCodeAt, } = primordials; const { toASCII } = require('internal/idna'); @@ -156,6 +157,14 @@ function urlParse(url, parseQueryString, slashesDenoteHost) { return urlObject; } +function isIpv6Hostname(hostname) { + return ( + StringPrototypeCharCodeAt(hostname, 0) === CHAR_LEFT_SQUARE_BRACKET && + StringPrototypeCharCodeAt(hostname, hostname.length - 1) === + CHAR_RIGHT_SQUARE_BRACKET + ); +} + Url.prototype.parse = function parse(url, parseQueryString, slashesDenoteHost) { validateString(url, 'url'); @@ -364,8 +373,7 @@ Url.prototype.parse = function parse(url, parseQueryString, slashesDenoteHost) { // If hostname begins with [ and ends with ] // assume that it's an IPv6 address. - const ipv6Hostname = hostname.charCodeAt(0) === CHAR_LEFT_SQUARE_BRACKET && - hostname.charCodeAt(hostname.length - 1) === CHAR_RIGHT_SQUARE_BRACKET; + const ipv6Hostname = isIpv6Hostname(hostname); // validate a little. if (!ipv6Hostname) { @@ -590,7 +598,7 @@ Url.prototype.format = function format() { host = auth + this.host; } else if (this.hostname) { host = auth + ( - this.hostname.includes(':') ? + this.hostname.includes(':') && !isIpv6Hostname(this.hostname) ? '[' + this.hostname + ']' : this.hostname ); diff --git a/lib/util.js b/lib/util.js index 2d8687ac9c569a..abd1f6e663610e 100644 --- a/lib/util.js +++ b/lib/util.js @@ -23,8 +23,16 @@ const { ArrayIsArray, + ArrayPrototypeJoin, + ArrayPrototypePop, Date, + DatePrototypeGetDate, + DatePrototypeGetHours, + DatePrototypeGetMinutes, + DatePrototypeGetMonth, + DatePrototypeGetSeconds, Error, + FunctionPrototypeBind, NumberIsSafeInteger, ObjectDefineProperties, ObjectDefineProperty, @@ -33,6 +41,7 @@ const { ObjectPrototypeToString, ObjectSetPrototypeOf, ReflectApply, + StringPrototypePadStart, } = primordials; const { @@ -110,7 +119,7 @@ function isPrimitive(arg) { } function pad(n) { - return n.toString().padStart(2, '0'); + return StringPrototypePadStart(n.toString(), 2, '0'); } const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', @@ -119,10 +128,12 @@ const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', // 26 Feb 16:19:34 function timestamp() { const d = new Date(); - const time = [pad(d.getHours()), - pad(d.getMinutes()), - pad(d.getSeconds())].join(':'); - return [d.getDate(), months[d.getMonth()], time].join(' '); + const t = ArrayPrototypeJoin([ + pad(DatePrototypeGetHours(d)), + pad(DatePrototypeGetMinutes(d)), + pad(DatePrototypeGetSeconds(d)), + ], ':'); + return `${DatePrototypeGetDate(d)} ${months[DatePrototypeGetMonth(d)]} ${t}`; } let console; @@ -201,11 +212,11 @@ function callbackify(original) { // the promise is actually somehow related to the callback's execution // and that the callback throwing will reject the promise. function callbackified(...args) { - const maybeCb = args.pop(); + const maybeCb = ArrayPrototypePop(args); if (typeof maybeCb !== 'function') { throw new ERR_INVALID_ARG_TYPE('last argument', 'Function', maybeCb); } - const cb = (...args) => { ReflectApply(maybeCb, this, args); }; + const cb = FunctionPrototypeBind(maybeCb, this); // In true node style we process the callback on `nextTick` with all the // implications (stack, `uncaughtException`, `async_hooks`) ReflectApply(original, this, args) diff --git a/lib/v8.js b/lib/v8.js index 2ecb4c06a1931e..f1c624bc10add0 100644 --- a/lib/v8.js +++ b/lib/v8.js @@ -17,6 +17,8 @@ const { Array, ArrayBuffer, + ArrayPrototypeForEach, + ArrayPrototypePush, DataView, Error, Float32Array, @@ -35,8 +37,8 @@ const { const { Buffer } = require('buffer'); const { validateString } = require('internal/validators'); const { - Serializer: _Serializer, - Deserializer: _Deserializer + Serializer, + Deserializer } = internalBinding('serdes'); let profiler = {}; @@ -70,13 +72,6 @@ function getHeapSnapshot() { return new HeapSnapshotStream(handle); } -// Calling exposed c++ functions directly throws exception as it expected to be -// called with new operator and caused an assert to fire. -// Creating JS wrapper so that it gets caught at JS layer. -class Serializer extends _Serializer { } - -class Deserializer extends _Deserializer { } - const { cachedDataVersionTag, setFlagsFromString: _setFlagsFromString, @@ -198,13 +193,14 @@ const arrayBufferViewTypeToIndex = new SafeMap(); { const dummy = new ArrayBuffer(); - for (const [i, ctor] of arrayBufferViewTypes.entries()) { + ArrayPrototypeForEach(arrayBufferViewTypes, (ctor, i) => { const tag = ObjectPrototypeToString(new ctor(dummy)); arrayBufferViewTypeToIndex.set(tag, i); - } + }); } -const bufferConstructorIndex = arrayBufferViewTypes.push(FastBuffer) - 1; +const bufferConstructorIndex = + ArrayPrototypePush(arrayBufferViewTypes, FastBuffer) - 1; class DefaultSerializer extends Serializer { constructor() { diff --git a/lib/wasi.js b/lib/wasi.js index 072f19be9235ae..b3c14fc2f14840 100644 --- a/lib/wasi.js +++ b/lib/wasi.js @@ -1,5 +1,6 @@ 'use strict'; const { + ArrayPrototypeForEach, ArrayPrototypeMap, ArrayPrototypePush, FunctionPrototypeBind, @@ -62,18 +63,22 @@ class WASI { const env = []; if (options.env !== undefined) { validateObject(options.env, 'options.env'); - for (const [key, value] of ObjectEntries(options.env)) { - if (value !== undefined) - ArrayPrototypePush(env, `${key}=${value}`); - } + ArrayPrototypeForEach( + ObjectEntries(options.env), + ({ 0: key, 1: value }) => { + if (value !== undefined) + ArrayPrototypePush(env, `${key}=${value}`); + }); } const preopens = []; if (options.preopens !== undefined) { validateObject(options.preopens, 'options.preopens'); - for (const [key, value] of ObjectEntries(options.preopens)) { - ArrayPrototypePush(preopens, String(key), String(value)); - } + ArrayPrototypeForEach( + ObjectEntries(options.preopens), + ({ 0: key, 1: value }) => + ArrayPrototypePush(preopens, String(key), String(value)) + ); } const { stdin = 0, stdout = 1, stderr = 2 } = options; diff --git a/lib/zlib.js b/lib/zlib.js index 91eabbefa3576e..1d1426635ca99b 100644 --- a/lib/zlib.js +++ b/lib/zlib.js @@ -37,6 +37,7 @@ const { ObjectKeys, ObjectSetPrototypeOf, ReflectApply, + StringPrototypeStartsWith, Symbol, TypedArrayPrototypeFill, Uint32Array, @@ -52,7 +53,7 @@ const { }, hideStackFrames } = require('internal/errors'); -const Transform = require('_stream_transform'); +const { Transform, finished } = require('stream'); const { deprecate } = require('internal/util'); @@ -62,7 +63,6 @@ const { } = require('internal/util/types'); const binding = internalBinding('zlib'); const assert = require('internal/assert'); -const finished = require('internal/streams/end-of-stream'); const { Buffer, kMaxLength @@ -787,7 +787,9 @@ function createConvenienceMethod(ctor, sync) { const kMaxBrotliParam = MathMax(...ArrayPrototypeMap( ObjectKeys(constants), - (key) => (key.startsWith('BROTLI_PARAM_') ? constants[key] : 0) + (key) => (StringPrototypeStartsWith(key, 'BROTLI_PARAM_') ? + constants[key] : + 0) )); const brotliInitParamsArray = new Uint32Array(kMaxBrotliParam + 1); @@ -928,7 +930,7 @@ ObjectDefineProperties(module.exports, { // These should be considered deprecated // expose all the zlib constants for (const bkey of ObjectKeys(constants)) { - if (bkey.startsWith('BROTLI')) continue; + if (StringPrototypeStartsWith(bkey, 'BROTLI')) continue; ObjectDefineProperty(module.exports, bkey, { enumerable: false, value: constants[bkey], writable: false }); diff --git a/node.gyp b/node.gyp index 865a7de93176e5..9294442e9097ce 100644 --- a/node.gyp +++ b/node.gyp @@ -143,6 +143,7 @@ 'lib/internal/crypto/sig.js', 'lib/internal/crypto/util.js', 'lib/internal/crypto/webcrypto.js', + 'lib/internal/crypto/x509.js', 'lib/internal/constants.js', 'lib/internal/dgram.js', 'lib/internal/dns/promises.js', @@ -941,6 +942,7 @@ 'src/crypto/crypto_scrypt.cc', 'src/crypto/crypto_tls.cc', 'src/crypto/crypto_aes.cc', + 'src/crypto/crypto_x509.cc', 'src/crypto/crypto_bio.h', 'src/crypto/crypto_clienthello-inl.h', 'src/crypto/crypto_dh.h', @@ -965,6 +967,7 @@ 'src/crypto/crypto_sig.h', 'src/crypto/crypto_random.h', 'src/crypto/crypto_timing.h', + 'src/crypto/crypto_x509.h', 'src/node_crypto.cc', 'src/node_crypto.h' ], @@ -1469,6 +1472,24 @@ ], }, # embedtest + { + 'target_name': 'overlapped-checker', + 'type': 'executable', + + 'conditions': [ + ['OS=="win"', { + 'sources': [ + 'test/overlapped-checker/main_win.c' + ], + }], + ['OS!="win"', { + 'sources': [ + 'test/overlapped-checker/main_unix.c' + ], + }], + ] + }, # overlapped-checker + # TODO(joyeecheung): do not depend on node_lib, # instead create a smaller static library node_lib_base that does # just enough for node_native_module.cc and the cache builder to diff --git a/src/README.md b/src/README.md index 2be97e28b8fbea..aec56e7a7ba05a 100644 --- a/src/README.md +++ b/src/README.md @@ -405,11 +405,7 @@ void Initialize(Local target, env->SetProtoMethodNoSideEffect(channel_wrap, "getServers", GetServers); - Local channel_wrap_string = - FIXED_ONE_BYTE_STRING(env->isolate(), "ChannelWrap"); - channel_wrap->SetClassName(channel_wrap_string); - target->Set(env->context(), channel_wrap_string, - channel_wrap->GetFunction(context).ToLocalChecked()).Check(); + env->SetConstructorFunction(target, "ChannelWrap", channel_wrap); } // Run the `Initialize` function when loading this module through diff --git a/src/cares_wrap.cc b/src/cares_wrap.cc index 71766fa39171af..2bf4211b118602 100644 --- a/src/cares_wrap.cc +++ b/src/cares_wrap.cc @@ -2345,32 +2345,17 @@ void Initialize(Local target, Local aiw = BaseObject::MakeLazilyInitializedJSTemplate(env); aiw->Inherit(AsyncWrap::GetConstructorTemplate(env)); - Local addrInfoWrapString = - FIXED_ONE_BYTE_STRING(env->isolate(), "GetAddrInfoReqWrap"); - aiw->SetClassName(addrInfoWrapString); - target->Set(env->context(), - addrInfoWrapString, - aiw->GetFunction(context).ToLocalChecked()).Check(); + env->SetConstructorFunction(target, "GetAddrInfoReqWrap", aiw); Local niw = BaseObject::MakeLazilyInitializedJSTemplate(env); niw->Inherit(AsyncWrap::GetConstructorTemplate(env)); - Local nameInfoWrapString = - FIXED_ONE_BYTE_STRING(env->isolate(), "GetNameInfoReqWrap"); - niw->SetClassName(nameInfoWrapString); - target->Set(env->context(), - nameInfoWrapString, - niw->GetFunction(context).ToLocalChecked()).Check(); + env->SetConstructorFunction(target, "GetNameInfoReqWrap", niw); Local qrw = BaseObject::MakeLazilyInitializedJSTemplate(env); qrw->Inherit(AsyncWrap::GetConstructorTemplate(env)); - Local queryWrapString = - FIXED_ONE_BYTE_STRING(env->isolate(), "QueryReqWrap"); - qrw->SetClassName(queryWrapString); - target->Set(env->context(), - queryWrapString, - qrw->GetFunction(context).ToLocalChecked()).Check(); + env->SetConstructorFunction(target, "QueryReqWrap", qrw); Local channel_wrap = env->NewFunctionTemplate(ChannelWrap::New); @@ -2397,11 +2382,7 @@ void Initialize(Local target, env->SetProtoMethod(channel_wrap, "setLocalAddress", SetLocalAddress); env->SetProtoMethod(channel_wrap, "cancel", Cancel); - Local channelWrapString = - FIXED_ONE_BYTE_STRING(env->isolate(), "ChannelWrap"); - channel_wrap->SetClassName(channelWrapString); - target->Set(env->context(), channelWrapString, - channel_wrap->GetFunction(context).ToLocalChecked()).Check(); + env->SetConstructorFunction(target, "ChannelWrap", channel_wrap); } } // anonymous namespace diff --git a/src/crypto/crypto_aes.cc b/src/crypto/crypto_aes.cc index 584839e813e570..edca8fbd0dcb5c 100644 --- a/src/crypto/crypto_aes.cc +++ b/src/crypto/crypto_aes.cc @@ -102,7 +102,7 @@ WebCryptoCipherStatus AES_Cipher( // In decrypt mode, we grab the tag length here. We'll use it to // ensure that that allocated buffer has enough room for both the // final block and the auth tag. Unlike our other AES-GCM implementation - // in CipherBase, in WebCrypto, the auth tag is concatentated to the end + // in CipherBase, in WebCrypto, the auth tag is concatenated to the end // of the generated ciphertext and returned in the same ArrayBuffer. tag_len = params.length; break; diff --git a/src/crypto/crypto_cipher.cc b/src/crypto/crypto_cipher.cc index f3939d3477c6ca..ddbf7114b673cd 100644 --- a/src/crypto/crypto_cipher.cc +++ b/src/crypto/crypto_cipher.cc @@ -265,10 +265,7 @@ void CipherBase::Initialize(Environment* env, Local target) { env->SetProtoMethodNoSideEffect(t, "getAuthTag", GetAuthTag); env->SetProtoMethod(t, "setAuthTag", SetAuthTag); env->SetProtoMethod(t, "setAAD", SetAAD); - - target->Set(env->context(), - FIXED_ONE_BYTE_STRING(env->isolate(), "CipherBase"), - t->GetFunction(env->context()).ToLocalChecked()).Check(); + env->SetConstructorFunction(target, "CipherBase", t); env->SetMethodNoSideEffect(target, "getSSLCiphers", GetSSLCiphers); env->SetMethodNoSideEffect(target, "getCiphers", GetCiphers); diff --git a/src/crypto/crypto_common.cc b/src/crypto/crypto_common.cc index 84894cab0b7111..abf4600f9f1707 100644 --- a/src/crypto/crypto_common.cc +++ b/src/crypto/crypto_common.cc @@ -33,7 +33,6 @@ using v8::Integer; using v8::Local; using v8::MaybeLocal; using v8::NewStringType; -using v8::Null; using v8::Object; using v8::String; using v8::Undefined; @@ -354,6 +353,19 @@ MaybeLocal GetCert(Environment* env, const SSLPointer& ssl) { return maybe_cert.FromMaybe(Local()); } +Local ToV8Value(Environment* env, const BIOPointer& bio) { + BUF_MEM* mem; + BIO_get_mem_ptr(bio.get(), &mem); + MaybeLocal ret = + String::NewFromUtf8( + env->isolate(), + mem->data, + NewStringType::kNormal, + mem->length); + USE(BIO_reset(bio.get())); + return ret.FromMaybe(Local()); +} + namespace { template bool Set( @@ -372,19 +384,6 @@ bool Set( return !target->Set(context, name, value).IsNothing(); } -Local ToV8Value(Environment* env, const BIOPointer& bio) { - BUF_MEM* mem; - BIO_get_mem_ptr(bio.get(), &mem); - MaybeLocal ret = - String::NewFromUtf8( - env->isolate(), - mem->data, - NewStringType::kNormal, - mem->length); - USE(BIO_reset(bio.get())); - return ret.FromMaybe(Local()); -} - MaybeLocal GetCipherValue(Environment* env, const SSL_CIPHER* cipher, const char* (*getstr)(const SSL_CIPHER* cipher)) { @@ -485,53 +484,6 @@ MaybeLocal GetLastIssuedCert( return MaybeLocal(issuer_chain); } -MaybeLocal GetRawDERCertificate(Environment* env, X509* cert) { - int size = i2d_X509(cert, nullptr); - - AllocatedBuffer buffer = AllocatedBuffer::AllocateManaged(env, size); - unsigned char* serialized = - reinterpret_cast(buffer.data()); - i2d_X509(cert, &serialized); - return buffer.ToBuffer(); -} - -MaybeLocal GetSerialNumber(Environment* env, X509* cert) { - if (ASN1_INTEGER* serial_number = X509_get_serialNumber(cert)) { - BignumPointer bn(ASN1_INTEGER_to_BN(serial_number, nullptr)); - if (bn) { - char* data = BN_bn2hex(bn.get()); - ByteSource buf = ByteSource::Allocated(data, strlen(data)); - if (buf) - return OneByteString(env->isolate(), buf.get()); - } - } - - return Undefined(env->isolate()); -} - -MaybeLocal GetKeyUsage(Environment* env, X509* cert) { - StackOfASN1 eku(static_cast( - X509_get_ext_d2i(cert, NID_ext_key_usage, nullptr, nullptr))); - if (eku) { - const int count = sk_ASN1_OBJECT_num(eku.get()); - MaybeStackBuffer, 16> ext_key_usage(count); - char buf[256]; - - int j = 0; - for (int i = 0; i < count; i++) { - if (OBJ_obj2txt(buf, - sizeof(buf), - sk_ASN1_OBJECT_value(eku.get(), i), 1) >= 0) { - ext_key_usage[j++] = OneByteString(env->isolate(), buf); - } - } - - return Array::New(env->isolate(), ext_key_usage.out(), count); - } - - return Undefined(env->isolate()); -} - void AddFingerprintDigest( const unsigned char* md, unsigned int md_size, @@ -552,72 +504,6 @@ void AddFingerprintDigest( } } -bool SafeX509ExtPrint(const BIOPointer& out, X509_EXTENSION* ext) { - const X509V3_EXT_METHOD* method = X509V3_EXT_get(ext); - - if (method != X509V3_EXT_get_nid(NID_subject_alt_name)) - return false; - - GENERAL_NAMES* names = static_cast(X509V3_EXT_d2i(ext)); - if (names == nullptr) - return false; - - for (int i = 0; i < sk_GENERAL_NAME_num(names); i++) { - GENERAL_NAME* gen = sk_GENERAL_NAME_value(names, i); - - if (i != 0) - BIO_write(out.get(), ", ", 2); - - if (gen->type == GEN_DNS) { - ASN1_IA5STRING* name = gen->d.dNSName; - - BIO_write(out.get(), "DNS:", 4); - BIO_write(out.get(), name->data, name->length); - } else { - STACK_OF(CONF_VALUE)* nval = i2v_GENERAL_NAME( - const_cast(method), gen, nullptr); - if (nval == nullptr) - return false; - X509V3_EXT_val_prn(out.get(), nval, 0, 0); - sk_CONF_VALUE_pop_free(nval, X509V3_conf_free); - } - } - sk_GENERAL_NAME_pop_free(names, GENERAL_NAME_free); - - return true; -} - -MaybeLocal GetFingerprintDigest( - Environment* env, - const EVP_MD* method, - X509* cert) { - unsigned char md[EVP_MAX_MD_SIZE]; - unsigned int md_size; - char fingerprint[EVP_MAX_MD_SIZE * 3 + 1]; - - if (X509_digest(cert, method, md, &md_size)) { - AddFingerprintDigest(md, md_size, &fingerprint); - return OneByteString(env->isolate(), fingerprint); - } - return Undefined(env->isolate()); -} - -MaybeLocal GetValidTo( - Environment* env, - X509* cert, - const BIOPointer& bio) { - ASN1_TIME_print(bio.get(), X509_get0_notAfter(cert)); - return ToV8Value(env, bio); -} - -MaybeLocal GetValidFrom( - Environment* env, - X509* cert, - const BIOPointer& bio) { - ASN1_TIME_print(bio.get(), X509_get0_notBefore(cert)); - return ToV8Value(env, bio); -} - MaybeLocal GetCurveASN1Name(Environment* env, const int nid) { const char* nist = OBJ_nid2sn(nid); return nist != nullptr ? @@ -699,28 +585,121 @@ MaybeLocal GetModulusString( BN_print(bio.get(), n); return ToV8Value(env, bio); } +} // namespace + +MaybeLocal GetRawDERCertificate(Environment* env, X509* cert) { + int size = i2d_X509(cert, nullptr); + + AllocatedBuffer buffer = AllocatedBuffer::AllocateManaged(env, size); + unsigned char* serialized = + reinterpret_cast(buffer.data()); + i2d_X509(cert, &serialized); + return buffer.ToBuffer(); +} -template -MaybeLocal GetInfoString( +MaybeLocal GetSerialNumber(Environment* env, X509* cert) { + if (ASN1_INTEGER* serial_number = X509_get_serialNumber(cert)) { + BignumPointer bn(ASN1_INTEGER_to_BN(serial_number, nullptr)); + if (bn) { + char* data = BN_bn2hex(bn.get()); + ByteSource buf = ByteSource::Allocated(data, strlen(data)); + if (buf) + return OneByteString(env->isolate(), buf.get()); + } + } + + return Undefined(env->isolate()); +} + +MaybeLocal GetKeyUsage(Environment* env, X509* cert) { + StackOfASN1 eku(static_cast( + X509_get_ext_d2i(cert, NID_ext_key_usage, nullptr, nullptr))); + if (eku) { + const int count = sk_ASN1_OBJECT_num(eku.get()); + MaybeStackBuffer, 16> ext_key_usage(count); + char buf[256]; + + int j = 0; + for (int i = 0; i < count; i++) { + if (OBJ_obj2txt(buf, + sizeof(buf), + sk_ASN1_OBJECT_value(eku.get(), i), 1) >= 0) { + ext_key_usage[j++] = OneByteString(env->isolate(), buf); + } + } + + return Array::New(env->isolate(), ext_key_usage.out(), count); + } + + return Undefined(env->isolate()); +} + +MaybeLocal GetFingerprintDigest( Environment* env, - const BIOPointer& bio, + const EVP_MD* method, X509* cert) { - int index = X509_get_ext_by_NID(cert, nid, -1); - if (index < 0) - return Undefined(env->isolate()); - - X509_EXTENSION* ext = X509_get_ext(cert, index); - CHECK_NOT_NULL(ext); + unsigned char md[EVP_MAX_MD_SIZE]; + unsigned int md_size; + char fingerprint[EVP_MAX_MD_SIZE * 3 + 1]; - if (!SafeX509ExtPrint(bio, ext) && - X509V3_EXT_print(bio.get(), ext, 0, 0) != 1) { - USE(BIO_reset(bio.get())); - return Null(env->isolate()); + if (X509_digest(cert, method, md, &md_size)) { + AddFingerprintDigest(md, md_size, &fingerprint); + return OneByteString(env->isolate(), fingerprint); } + return Undefined(env->isolate()); +} +MaybeLocal GetValidTo( + Environment* env, + X509* cert, + const BIOPointer& bio) { + ASN1_TIME_print(bio.get(), X509_get0_notAfter(cert)); return ToV8Value(env, bio); } +MaybeLocal GetValidFrom( + Environment* env, + X509* cert, + const BIOPointer& bio) { + ASN1_TIME_print(bio.get(), X509_get0_notBefore(cert)); + return ToV8Value(env, bio); +} + +bool SafeX509ExtPrint(const BIOPointer& out, X509_EXTENSION* ext) { + const X509V3_EXT_METHOD* method = X509V3_EXT_get(ext); + + if (method != X509V3_EXT_get_nid(NID_subject_alt_name)) + return false; + + GENERAL_NAMES* names = static_cast(X509V3_EXT_d2i(ext)); + if (names == nullptr) + return false; + + for (int i = 0; i < sk_GENERAL_NAME_num(names); i++) { + GENERAL_NAME* gen = sk_GENERAL_NAME_value(names, i); + + if (i != 0) + BIO_write(out.get(), ", ", 2); + + if (gen->type == GEN_DNS) { + ASN1_IA5STRING* name = gen->d.dNSName; + + BIO_write(out.get(), "DNS:", 4); + BIO_write(out.get(), name->data, name->length); + } else { + STACK_OF(CONF_VALUE)* nval = i2v_GENERAL_NAME( + const_cast(method), gen, nullptr); + if (nval == nullptr) + return false; + X509V3_EXT_val_prn(out.get(), nval, 0, 0); + sk_CONF_VALUE_pop_free(nval, X509V3_conf_free); + } + } + sk_GENERAL_NAME_pop_free(names, GENERAL_NAME_free); + + return true; +} + MaybeLocal GetIssuerString( Environment* env, const BIOPointer& bio, @@ -749,7 +728,6 @@ MaybeLocal GetSubject( return ToV8Value(env, bio); } -} // namespace MaybeLocal GetCipherName(Environment* env, const SSLPointer& ssl) { return GetCipherName(env, SSL_get_current_cipher(ssl.get())); diff --git a/src/crypto/crypto_common.h b/src/crypto/crypto_common.h index afee38b5992d23..8b83d9fc2a7b17 100644 --- a/src/crypto/crypto_common.h +++ b/src/crypto/crypto_common.h @@ -124,6 +124,61 @@ v8::MaybeLocal X509ToObject( Environment* env, X509* cert); +v8::MaybeLocal GetValidTo( + Environment* env, + X509* cert, + const BIOPointer& bio); + +v8::MaybeLocal GetValidFrom( + Environment* env, + X509* cert, + const BIOPointer& bio); + +v8::MaybeLocal GetFingerprintDigest( + Environment* env, + const EVP_MD* method, + X509* cert); + +v8::MaybeLocal GetKeyUsage(Environment* env, X509* cert); + +v8::MaybeLocal GetSerialNumber(Environment* env, X509* cert); + +v8::MaybeLocal GetRawDERCertificate(Environment* env, X509* cert); + +v8::Local ToV8Value(Environment* env, const BIOPointer& bio); +bool SafeX509ExtPrint(const BIOPointer& out, X509_EXTENSION* ext); + +v8::MaybeLocal GetSubject( + Environment* env, + const BIOPointer& bio, + X509* cert); + +v8::MaybeLocal GetIssuerString( + Environment* env, + const BIOPointer& bio, + X509* cert); + +template +v8::MaybeLocal GetInfoString( + Environment* env, + const BIOPointer& bio, + X509* cert) { + int index = X509_get_ext_by_NID(cert, nid, -1); + if (index < 0) + return Undefined(env->isolate()); + + X509_EXTENSION* ext = X509_get_ext(cert, index); + CHECK_NOT_NULL(ext); + + if (!SafeX509ExtPrint(bio, ext) && + X509V3_EXT_print(bio.get(), ext, 0, 0) != 1) { + USE(BIO_reset(bio.get())); + return v8::Null(env->isolate()); + } + + return ToV8Value(env, bio); +} + } // namespace crypto } // namespace node diff --git a/src/crypto/crypto_context.cc b/src/crypto/crypto_context.cc index 612d21948495d4..b63ae15ab4577f 100644 --- a/src/crypto/crypto_context.cc +++ b/src/crypto/crypto_context.cc @@ -49,7 +49,6 @@ static X509_STORE* root_cert_store; static bool extra_root_certs_loaded = false; -namespace { // Takes a string or buffer and loads it into a BIO. // Caller responsible for BIO_free_all-ing the returned object. BIOPointer LoadBIO(Environment* env, Local v) { @@ -68,6 +67,7 @@ BIOPointer LoadBIO(Environment* env, Local v) { return nullptr; } +namespace { int SSL_CTX_use_certificate_chain(SSL_CTX* ctx, X509Pointer&& x, STACK_OF(X509)* extra_certs, @@ -252,9 +252,6 @@ void SecureContext::Initialize(Environment* env, Local target) { t->InstanceTemplate()->SetInternalFieldCount( SecureContext::kInternalFieldCount); t->Inherit(BaseObject::GetConstructorTemplate(env)); - Local secureContextString = - FIXED_ONE_BYTE_STRING(env->isolate(), "SecureContext"); - t->SetClassName(secureContextString); env->SetProtoMethod(t, "init", Init); env->SetProtoMethod(t, "setKey", SetKey); @@ -313,8 +310,8 @@ void SecureContext::Initialize(Environment* env, Local target) { Local(), static_cast(ReadOnly | DontDelete)); - target->Set(env->context(), secureContextString, - t->GetFunction(env->context()).ToLocalChecked()).Check(); + env->SetConstructorFunction(target, "SecureContext", t); + env->set_secure_context_constructor_template(t); env->SetMethodNoSideEffect(target, "getRootCertificates", diff --git a/src/crypto/crypto_context.h b/src/crypto/crypto_context.h index 5a2126c2ea3b1f..bea75f31d4a44e 100644 --- a/src/crypto/crypto_context.h +++ b/src/crypto/crypto_context.h @@ -23,6 +23,8 @@ void IsExtraRootCertsFileLoaded( X509_STORE* NewRootCertStore(); +BIOPointer LoadBIO(Environment* env, v8::Local v); + class SecureContext final : public BaseObject { public: using GetSessionCb = SSL_SESSION* (*)(SSL*, const unsigned char*, int, int*); diff --git a/src/crypto/crypto_dh.cc b/src/crypto/crypto_dh.cc index a2720301cab356..b40f06f4500cd8 100644 --- a/src/crypto/crypto_dh.cc +++ b/src/crypto/crypto_dh.cc @@ -93,9 +93,7 @@ void DiffieHellman::Initialize(Environment* env, Local target) { Local(), attributes); - target->Set(env->context(), - name, - t->GetFunction(env->context()).ToLocalChecked()).Check(); + env->SetConstructorFunction(target, name, t); }; make(FIXED_ONE_BYTE_STRING(env->isolate(), "DiffieHellman"), New); diff --git a/src/crypto/crypto_ecdh.cc b/src/crypto/crypto_ecdh.cc index 277a5a731d37ae..efeb08b908e427 100644 --- a/src/crypto/crypto_ecdh.cc +++ b/src/crypto/crypto_ecdh.cc @@ -52,9 +52,7 @@ void ECDH::Initialize(Environment* env, Local target) { env->SetProtoMethod(t, "setPublicKey", SetPublicKey); env->SetProtoMethod(t, "setPrivateKey", SetPrivateKey); - target->Set(env->context(), - FIXED_ONE_BYTE_STRING(env->isolate(), "ECDH"), - t->GetFunction(env->context()).ToLocalChecked()).Check(); + env->SetConstructorFunction(target, "ECDH", t); env->SetMethodNoSideEffect(target, "ECDHConvertKey", ECDH::ConvertKey); env->SetMethodNoSideEffect(target, "getCurves", ECDH::GetCurves); diff --git a/src/crypto/crypto_hash.cc b/src/crypto/crypto_hash.cc index d49a7c5d022f0b..664ffb847215af 100644 --- a/src/crypto/crypto_hash.cc +++ b/src/crypto/crypto_hash.cc @@ -50,9 +50,7 @@ void Hash::Initialize(Environment* env, Local target) { env->SetProtoMethod(t, "update", HashUpdate); env->SetProtoMethod(t, "digest", HashDigest); - target->Set(env->context(), - FIXED_ONE_BYTE_STRING(env->isolate(), "Hash"), - t->GetFunction(env->context()).ToLocalChecked()).Check(); + env->SetConstructorFunction(target, "Hash", t); env->SetMethodNoSideEffect(target, "getHashes", GetHashes); diff --git a/src/crypto/crypto_hmac.cc b/src/crypto/crypto_hmac.cc index ff7c1603020b50..055541196d26e1 100644 --- a/src/crypto/crypto_hmac.cc +++ b/src/crypto/crypto_hmac.cc @@ -48,9 +48,7 @@ void Hmac::Initialize(Environment* env, Local target) { env->SetProtoMethod(t, "update", HmacUpdate); env->SetProtoMethod(t, "digest", HmacDigest); - target->Set(env->context(), - FIXED_ONE_BYTE_STRING(env->isolate(), "Hmac"), - t->GetFunction(env->context()).ToLocalChecked()).Check(); + env->SetConstructorFunction(target, "Hmac", t); HmacJob::Initialize(env, target); } diff --git a/src/crypto/crypto_sig.cc b/src/crypto/crypto_sig.cc index 59a9569ce8143c..a5a95878a9eeec 100644 --- a/src/crypto/crypto_sig.cc +++ b/src/crypto/crypto_sig.cc @@ -276,9 +276,7 @@ void Sign::Initialize(Environment* env, Local target) { env->SetProtoMethod(t, "update", SignUpdate); env->SetProtoMethod(t, "sign", SignFinal); - target->Set(env->context(), - FIXED_ONE_BYTE_STRING(env->isolate(), "Sign"), - t->GetFunction(env->context()).ToLocalChecked()).Check(); + env->SetConstructorFunction(target, "Sign", t); env->SetMethod(target, "signOneShot", Sign::SignSync); @@ -396,9 +394,7 @@ void Verify::Initialize(Environment* env, Local target) { env->SetProtoMethod(t, "update", VerifyUpdate); env->SetProtoMethod(t, "verify", VerifyFinal); - target->Set(env->context(), - FIXED_ONE_BYTE_STRING(env->isolate(), "Verify"), - t->GetFunction(env->context()).ToLocalChecked()).Check(); + env->SetConstructorFunction(target, "Verify", t); env->SetMethod(target, "verifyOneShot", Verify::VerifySync); } diff --git a/src/crypto/crypto_util.cc b/src/crypto/crypto_util.cc index 30cafa62a51704..0a40b1f7bb4c2e 100644 --- a/src/crypto/crypto_util.cc +++ b/src/crypto/crypto_util.cc @@ -18,6 +18,7 @@ namespace node { using v8::ArrayBuffer; using v8::BackingStore; +using v8::BigInt; using v8::Context; using v8::Exception; using v8::FunctionCallbackInfo; @@ -31,6 +32,8 @@ using v8::NewStringType; using v8::Nothing; using v8::Object; using v8::String; +using v8::Uint32; +using v8::Uint8Array; using v8::Value; namespace crypto { @@ -111,6 +114,25 @@ void InitCryptoOnce() { settings = nullptr; #endif +#ifndef _WIN32 + if (per_process::cli_options->secure_heap != 0) { + switch (CRYPTO_secure_malloc_init( + per_process::cli_options->secure_heap, + static_cast(per_process::cli_options->secure_heap_min))) { + case 0: + fprintf(stderr, "Unable to initialize openssl secure heap.\n"); + break; + case 2: + // Not a fatal error but worthy of a warning. + fprintf(stderr, "Unable to memory map openssl secure heap.\n"); + break; + case 1: + // OK! + break; + } + } +#endif + #ifdef NODE_FIPS_MODE /* Override FIPS settings in cnf file, if needed. */ unsigned long err = 0; // NOLINT(runtime/int) @@ -587,6 +609,43 @@ CryptoJobMode GetCryptoJobMode(v8::Local args) { return static_cast(mode); } +namespace { +// SecureBuffer uses openssl to allocate a Uint8Array using +// OPENSSL_secure_malloc. Because we do not yet actually +// make use of secure heap, this has the same semantics as +// using OPENSSL_malloc. However, if the secure heap is +// initialized, SecureBuffer will automatically use it. +void SecureBuffer(const FunctionCallbackInfo& args) { + CHECK(args[0]->IsUint32()); + Environment* env = Environment::GetCurrent(args); + uint32_t len = args[0].As()->Value(); + char* data = static_cast(OPENSSL_secure_malloc(len)); + if (data == nullptr) { + // There's no memory available for the allocation. + // Return nothing. + return; + } + memset(data, 0, len); + std::shared_ptr store = + ArrayBuffer::NewBackingStore( + data, + len, + [](void* data, size_t len, void* deleter_data) { + OPENSSL_secure_clear_free(data, len); + }, + data); + Local buffer = ArrayBuffer::New(env->isolate(), store); + args.GetReturnValue().Set(Uint8Array::New(buffer, 0, len)); +} + +void SecureHeapUsed(const FunctionCallbackInfo& args) { + Environment* env = Environment::GetCurrent(args); + if (CRYPTO_secure_malloc_initialized()) + args.GetReturnValue().Set( + BigInt::New(env->isolate(), CRYPTO_secure_used())); +} +} // namespace + namespace Util { void Initialize(Environment* env, Local target) { #ifndef OPENSSL_NO_ENGINE @@ -600,6 +659,9 @@ void Initialize(Environment* env, Local target) { NODE_DEFINE_CONSTANT(target, kCryptoJobAsync); NODE_DEFINE_CONSTANT(target, kCryptoJobSync); + + env->SetMethod(target, "secureBuffer", SecureBuffer); + env->SetMethod(target, "secureHeapUsed", SecureHeapUsed); } } // namespace Util diff --git a/src/crypto/crypto_util.h b/src/crypto/crypto_util.h index a8aa4a707f423a..3f245910ed83d1 100644 --- a/src/crypto/crypto_util.h +++ b/src/crypto/crypto_util.h @@ -349,17 +349,11 @@ class CryptoJob : public AsyncWrap, public ThreadPoolWork { Environment* env, v8::Local target) { v8::Local job = env->NewFunctionTemplate(new_fn); - v8::Local class_name = - OneByteString(env->isolate(), CryptoJobTraits::JobName); - job->SetClassName(class_name); job->Inherit(AsyncWrap::GetConstructorTemplate(env)); job->InstanceTemplate()->SetInternalFieldCount( AsyncWrap::kInternalFieldCount); env->SetProtoMethod(job, "run", Run); - target->Set( - env->context(), - class_name, - job->GetFunction(env->context()).ToLocalChecked()).Check(); + env->SetConstructorFunction(target, CryptoJobTraits::JobName, job); } private: diff --git a/src/crypto/crypto_x509.cc b/src/crypto/crypto_x509.cc new file mode 100644 index 00000000000000..9c85f035d2ad82 --- /dev/null +++ b/src/crypto/crypto_x509.cc @@ -0,0 +1,531 @@ +#include "base_object-inl.h" +#include "crypto_x509.h" +#include "crypto_common.h" +#include "crypto_context.h" +#include "crypto_keys.h" +#include "crypto_bio.h" +#include "env-inl.h" +#include "memory_tracker-inl.h" +#include "node_errors.h" +#include "util-inl.h" +#include "v8.h" + +#include +#include + +namespace node { + +using v8::Array; +using v8::ArrayBufferView; +using v8::Context; +using v8::EscapableHandleScope; +using v8::Function; +using v8::FunctionCallbackInfo; +using v8::FunctionTemplate; +using v8::Local; +using v8::MaybeLocal; +using v8::Object; +using v8::Uint32; +using v8::Value; + +namespace crypto { + +ManagedX509::ManagedX509(X509Pointer&& cert) : cert_(std::move(cert)) {} + +ManagedX509::ManagedX509(const ManagedX509& that) { + *this = that; +} + +ManagedX509& ManagedX509::operator=(const ManagedX509& that) { + cert_.reset(that.get()); + + if (cert_) + X509_up_ref(cert_.get()); + + return *this; +} + +void ManagedX509::MemoryInfo(MemoryTracker* tracker) const { + // This is an approximation based on the der encoding size. + int size = i2d_X509(cert_.get(), nullptr); + tracker->TrackFieldWithSize("cert", size); +} + +Local X509Certificate::GetConstructorTemplate( + Environment* env) { + Local tmpl = env->x509_constructor_template(); + if (tmpl.IsEmpty()) { + tmpl = FunctionTemplate::New(env->isolate()); + tmpl->InstanceTemplate()->SetInternalFieldCount(1); + tmpl->Inherit(BaseObject::GetConstructorTemplate(env)); + tmpl->SetClassName( + FIXED_ONE_BYTE_STRING(env->isolate(), "X509Certificate")); + env->SetProtoMethod(tmpl, "subject", Subject); + env->SetProtoMethod(tmpl, "subjectAltName", SubjectAltName); + env->SetProtoMethod(tmpl, "infoAccess", InfoAccess); + env->SetProtoMethod(tmpl, "issuer", Issuer); + env->SetProtoMethod(tmpl, "validTo", ValidTo); + env->SetProtoMethod(tmpl, "validFrom", ValidFrom); + env->SetProtoMethod(tmpl, "fingerprint", Fingerprint); + env->SetProtoMethod(tmpl, "fingerprint256", Fingerprint256); + env->SetProtoMethod(tmpl, "keyUsage", KeyUsage); + env->SetProtoMethod(tmpl, "serialNumber", SerialNumber); + env->SetProtoMethod(tmpl, "pem", Pem); + env->SetProtoMethod(tmpl, "raw", Raw); + env->SetProtoMethod(tmpl, "publicKey", PublicKey); + env->SetProtoMethod(tmpl, "checkCA", CheckCA); + env->SetProtoMethod(tmpl, "checkHost", CheckHost); + env->SetProtoMethod(tmpl, "checkEmail", CheckEmail); + env->SetProtoMethod(tmpl, "checkIP", CheckIP); + env->SetProtoMethod(tmpl, "checkIssued", CheckIssued); + env->SetProtoMethod(tmpl, "checkPrivateKey", CheckPrivateKey); + env->SetProtoMethod(tmpl, "verify", Verify); + env->SetProtoMethod(tmpl, "toLegacy", ToLegacy); + env->set_x509_constructor_template(tmpl); + } + return tmpl; +} + +bool X509Certificate::HasInstance(Environment* env, Local object) { + return GetConstructorTemplate(env)->HasInstance(object); +} + +MaybeLocal X509Certificate::New( + Environment* env, + X509Pointer cert) { + std::shared_ptr mcert(new ManagedX509(std::move(cert))); + return New(env, std::move(mcert)); +} + +MaybeLocal X509Certificate::New( + Environment* env, + std::shared_ptr cert) { + EscapableHandleScope scope(env->isolate()); + Local ctor; + if (!GetConstructorTemplate(env)->GetFunction(env->context()).ToLocal(&ctor)) + return MaybeLocal(); + + Local obj; + if (!ctor->NewInstance(env->context()).ToLocal(&obj)) + return MaybeLocal(); + + new X509Certificate(env, obj, std::move(cert)); + return scope.Escape(obj); +} + +MaybeLocal X509Certificate::GetCert( + Environment* env, + const SSLPointer& ssl) { + ClearErrorOnReturn clear_error_on_return; + X509* cert = SSL_get_certificate(ssl.get()); + if (cert == nullptr) + return MaybeLocal(); + + X509Pointer ptr(cert); + return New(env, std::move(ptr)); +} + +MaybeLocal X509Certificate::GetPeerCert( + Environment* env, + const SSLPointer& ssl, + GetPeerCertificateFlag flag) { + EscapableHandleScope scope(env->isolate()); + ClearErrorOnReturn clear_error_on_return; + Local obj; + MaybeLocal maybe_cert; + + bool is_server = + static_cast(flag) & static_cast(GetPeerCertificateFlag::SERVER); + bool abbreviated = + static_cast(flag) + & static_cast(GetPeerCertificateFlag::ABBREVIATED); + + X509Pointer cert(is_server ? SSL_get_peer_certificate(ssl.get()) : nullptr); + STACK_OF(X509)* ssl_certs = SSL_get_peer_cert_chain(ssl.get()); + if (!cert && (ssl_certs == nullptr || sk_X509_num(ssl_certs) == 0)) + return MaybeLocal(); + + std::vector> certs; + + if (!cert) cert.reset(sk_X509_value(ssl_certs, 0)); + if (!X509Certificate::New(env, std::move(cert)).ToLocal(&obj)) + return MaybeLocal(); + + certs.push_back(obj); + + int count = sk_X509_num(ssl_certs); + if (!abbreviated) { + for (int i = 0; i < count; i++) { + cert.reset(X509_dup(sk_X509_value(ssl_certs, i))); + if (!cert || !X509Certificate::New(env, std::move(cert)).ToLocal(&obj)) + return MaybeLocal(); + certs.push_back(obj); + } + } + + return scope.Escape(Array::New(env->isolate(), certs.data(), certs.size())); +} + +void X509Certificate::Parse(const FunctionCallbackInfo& args) { + Environment* env = Environment::GetCurrent(args); + + CHECK(args[0]->IsArrayBufferView()); + ArrayBufferViewContents buf(args[0].As()); + const unsigned char* data = buf.data(); + unsigned data_len = buf.length(); + + ClearErrorOnReturn clear_error_on_return; + BIOPointer bio(LoadBIO(env, args[0])); + if (!bio) + return ThrowCryptoError(env, ERR_get_error()); + + Local cert; + + X509Pointer pem(PEM_read_bio_X509_AUX( + bio.get(), nullptr, NoPasswordCallback, nullptr)); + if (!pem) { + // Try as DER, but return the original PEM failure if it isn't DER. + MarkPopErrorOnReturn mark_here; + + X509Pointer der(d2i_X509(nullptr, &data, data_len)); + if (!der) + return ThrowCryptoError(env, ERR_get_error()); + + if (!X509Certificate::New(env, std::move(der)).ToLocal(&cert)) + return; + } else if (!X509Certificate::New(env, std::move(pem)).ToLocal(&cert)) { + return; + } + + args.GetReturnValue().Set(cert); +} + +void X509Certificate::Subject(const FunctionCallbackInfo& args) { + Environment* env = Environment::GetCurrent(args); + X509Certificate* cert; + ASSIGN_OR_RETURN_UNWRAP(&cert, args.Holder()); + BIOPointer bio(BIO_new(BIO_s_mem())); + Local ret; + if (GetSubject(env, bio, cert->get()).ToLocal(&ret)) + args.GetReturnValue().Set(ret); +} + +void X509Certificate::Issuer(const FunctionCallbackInfo& args) { + Environment* env = Environment::GetCurrent(args); + X509Certificate* cert; + ASSIGN_OR_RETURN_UNWRAP(&cert, args.Holder()); + BIOPointer bio(BIO_new(BIO_s_mem())); + Local ret; + if (GetIssuerString(env, bio, cert->get()).ToLocal(&ret)) + args.GetReturnValue().Set(ret); +} + +void X509Certificate::SubjectAltName(const FunctionCallbackInfo& args) { + Environment* env = Environment::GetCurrent(args); + X509Certificate* cert; + ASSIGN_OR_RETURN_UNWRAP(&cert, args.Holder()); + BIOPointer bio(BIO_new(BIO_s_mem())); + Local ret; + if (GetInfoString(env, bio, cert->get()).ToLocal(&ret)) + args.GetReturnValue().Set(ret); +} + +void X509Certificate::InfoAccess(const FunctionCallbackInfo& args) { + Environment* env = Environment::GetCurrent(args); + X509Certificate* cert; + ASSIGN_OR_RETURN_UNWRAP(&cert, args.Holder()); + BIOPointer bio(BIO_new(BIO_s_mem())); + Local ret; + if (GetInfoString(env, bio, cert->get()).ToLocal(&ret)) + args.GetReturnValue().Set(ret); +} + +void X509Certificate::ValidFrom(const FunctionCallbackInfo& args) { + Environment* env = Environment::GetCurrent(args); + X509Certificate* cert; + ASSIGN_OR_RETURN_UNWRAP(&cert, args.Holder()); + BIOPointer bio(BIO_new(BIO_s_mem())); + Local ret; + if (GetValidFrom(env, cert->get(), bio).ToLocal(&ret)) + args.GetReturnValue().Set(ret); +} + +void X509Certificate::ValidTo(const FunctionCallbackInfo& args) { + Environment* env = Environment::GetCurrent(args); + X509Certificate* cert; + ASSIGN_OR_RETURN_UNWRAP(&cert, args.Holder()); + BIOPointer bio(BIO_new(BIO_s_mem())); + Local ret; + if (GetValidTo(env, cert->get(), bio).ToLocal(&ret)) + args.GetReturnValue().Set(ret); +} + +void X509Certificate::Fingerprint(const FunctionCallbackInfo& args) { + Environment* env = Environment::GetCurrent(args); + X509Certificate* cert; + ASSIGN_OR_RETURN_UNWRAP(&cert, args.Holder()); + Local ret; + if (GetFingerprintDigest(env, EVP_sha1(), cert->get()).ToLocal(&ret)) + args.GetReturnValue().Set(ret); +} + +void X509Certificate::Fingerprint256(const FunctionCallbackInfo& args) { + Environment* env = Environment::GetCurrent(args); + X509Certificate* cert; + ASSIGN_OR_RETURN_UNWRAP(&cert, args.Holder()); + Local ret; + if (GetFingerprintDigest(env, EVP_sha256(), cert->get()).ToLocal(&ret)) + args.GetReturnValue().Set(ret); +} + +void X509Certificate::KeyUsage(const FunctionCallbackInfo& args) { + Environment* env = Environment::GetCurrent(args); + X509Certificate* cert; + ASSIGN_OR_RETURN_UNWRAP(&cert, args.Holder()); + Local ret; + if (GetKeyUsage(env, cert->get()).ToLocal(&ret)) + args.GetReturnValue().Set(ret); +} + +void X509Certificate::SerialNumber(const FunctionCallbackInfo& args) { + Environment* env = Environment::GetCurrent(args); + X509Certificate* cert; + ASSIGN_OR_RETURN_UNWRAP(&cert, args.Holder()); + Local ret; + if (GetSerialNumber(env, cert->get()).ToLocal(&ret)) + args.GetReturnValue().Set(ret); +} + +void X509Certificate::Raw(const FunctionCallbackInfo& args) { + Environment* env = Environment::GetCurrent(args); + X509Certificate* cert; + ASSIGN_OR_RETURN_UNWRAP(&cert, args.Holder()); + Local ret; + if (GetRawDERCertificate(env, cert->get()).ToLocal(&ret)) + args.GetReturnValue().Set(ret); +} + +void X509Certificate::PublicKey(const FunctionCallbackInfo& args) { + Environment* env = Environment::GetCurrent(args); + X509Certificate* cert; + ASSIGN_OR_RETURN_UNWRAP(&cert, args.Holder()); + + EVPKeyPointer pkey(X509_get_pubkey(cert->get())); + ManagedEVPPKey epkey(std::move(pkey)); + std::shared_ptr key_data = + KeyObjectData::CreateAsymmetric(kKeyTypePublic, epkey); + + Local ret; + if (KeyObjectHandle::Create(env, key_data).ToLocal(&ret)) + args.GetReturnValue().Set(ret); +} + +void X509Certificate::Pem(const FunctionCallbackInfo& args) { + Environment* env = Environment::GetCurrent(args); + X509Certificate* cert; + ASSIGN_OR_RETURN_UNWRAP(&cert, args.Holder()); + BIOPointer bio(BIO_new(BIO_s_mem())); + if (PEM_write_bio_X509(bio.get(), cert->get())) + args.GetReturnValue().Set(ToV8Value(env, bio)); +} + +void X509Certificate::CheckCA(const FunctionCallbackInfo& args) { + X509Certificate* cert; + ASSIGN_OR_RETURN_UNWRAP(&cert, args.Holder()); + args.GetReturnValue().Set(X509_check_ca(cert->get()) == 1); +} + +void X509Certificate::CheckHost(const FunctionCallbackInfo& args) { + Environment* env = Environment::GetCurrent(args); + X509Certificate* cert; + ASSIGN_OR_RETURN_UNWRAP(&cert, args.Holder()); + + CHECK(args[0]->IsString()); // name + CHECK(args[1]->IsUint32()); // flags + + Utf8Value name(env->isolate(), args[0]); + uint32_t flags = args[1].As()->Value(); + char* peername; + + switch (X509_check_host( + cert->get(), + *name, + name.length(), + flags, + &peername)) { + case 1: { // Match! + Local ret = args[0]; + if (peername != nullptr) { + ret = OneByteString(env->isolate(), peername); + OPENSSL_free(peername); + } + return args.GetReturnValue().Set(ret); + } + case 0: // No Match! + return; // No return value is set + case -2: // Error! + return THROW_ERR_INVALID_ARG_VALUE(env, "Invalid name"); + default: // Error! + return THROW_ERR_CRYPTO_OPERATION_FAILED(env); + } +} + +void X509Certificate::CheckEmail(const FunctionCallbackInfo& args) { + Environment* env = Environment::GetCurrent(args); + X509Certificate* cert; + ASSIGN_OR_RETURN_UNWRAP(&cert, args.Holder()); + + CHECK(args[0]->IsString()); // name + CHECK(args[1]->IsUint32()); // flags + + Utf8Value name(env->isolate(), args[0]); + uint32_t flags = args[1].As()->Value(); + + switch (X509_check_email( + cert->get(), + *name, + name.length(), + flags)) { + case 1: // Match! + return args.GetReturnValue().Set(args[0]); + case 0: // No Match! + return; // No return value is set + case -2: // Error! + return THROW_ERR_INVALID_ARG_VALUE(env, "Invalid name"); + default: // Error! + return THROW_ERR_CRYPTO_OPERATION_FAILED(env); + } +} + +void X509Certificate::CheckIP(const FunctionCallbackInfo& args) { + Environment* env = Environment::GetCurrent(args); + X509Certificate* cert; + ASSIGN_OR_RETURN_UNWRAP(&cert, args.Holder()); + + CHECK(args[0]->IsString()); // IP + CHECK(args[1]->IsUint32()); // flags + + Utf8Value name(env->isolate(), args[0]); + uint32_t flags = args[1].As()->Value(); + + switch (X509_check_ip_asc(cert->get(), *name, flags)) { + case 1: // Match! + return args.GetReturnValue().Set(args[0]); + case 0: // No Match! + return; // No return value is set + case -2: // Error! + return THROW_ERR_INVALID_ARG_VALUE(env, "Invalid IP"); + default: // Error! + return THROW_ERR_CRYPTO_OPERATION_FAILED(env); + } +} + +void X509Certificate::CheckIssued(const FunctionCallbackInfo& args) { + Environment* env = Environment::GetCurrent(args); + X509Certificate* cert; + ASSIGN_OR_RETURN_UNWRAP(&cert, args.Holder()); + + CHECK(args[0]->IsObject()); + CHECK(X509Certificate::HasInstance(env, args[0].As())); + + X509Certificate* issuer; + ASSIGN_OR_RETURN_UNWRAP(&issuer, args[0]); + + args.GetReturnValue().Set( + X509_check_issued(issuer->get(), cert->get()) == X509_V_OK); +} + +void X509Certificate::CheckPrivateKey(const FunctionCallbackInfo& args) { + X509Certificate* cert; + ASSIGN_OR_RETURN_UNWRAP(&cert, args.Holder()); + + CHECK(args[0]->IsObject()); + KeyObjectHandle* key; + ASSIGN_OR_RETURN_UNWRAP(&key, args[0]); + CHECK_EQ(key->Data()->GetKeyType(), kKeyTypePrivate); + + args.GetReturnValue().Set( + X509_check_private_key( + cert->get(), + key->Data()->GetAsymmetricKey().get()) == 1); +} + +void X509Certificate::Verify(const FunctionCallbackInfo& args) { + X509Certificate* cert; + ASSIGN_OR_RETURN_UNWRAP(&cert, args.Holder()); + + CHECK(args[0]->IsObject()); + KeyObjectHandle* key; + ASSIGN_OR_RETURN_UNWRAP(&key, args[0]); + CHECK_EQ(key->Data()->GetKeyType(), kKeyTypePublic); + + args.GetReturnValue().Set( + X509_verify( + cert->get(), + key->Data()->GetAsymmetricKey().get()) > 0); +} + +void X509Certificate::ToLegacy(const FunctionCallbackInfo& args) { + Environment* env = Environment::GetCurrent(args); + X509Certificate* cert; + ASSIGN_OR_RETURN_UNWRAP(&cert, args.Holder()); + Local ret; + if (X509ToObject(env, cert->get()).ToLocal(&ret)) + args.GetReturnValue().Set(ret); +} + +X509Certificate::X509Certificate( + Environment* env, + Local object, + std::shared_ptr cert) + : BaseObject(env, object), + cert_(std::move(cert)) { + MakeWeak(); +} + +void X509Certificate::MemoryInfo(MemoryTracker* tracker) const { + tracker->TrackField("cert", cert_); +} + +BaseObjectPtr +X509Certificate::X509CertificateTransferData::Deserialize( + Environment* env, + Local context, + std::unique_ptr self) { + if (context != env->context()) { + THROW_ERR_MESSAGE_TARGET_CONTEXT_UNAVAILABLE(env); + return {}; + } + + Local handle; + if (!X509Certificate::New(env, data_).ToLocal(&handle)) + return {}; + + return BaseObjectPtr( + Unwrap(handle.As())); +} + + +BaseObject::TransferMode X509Certificate::GetTransferMode() const { + return BaseObject::TransferMode::kCloneable; +} + +std::unique_ptr X509Certificate::CloneForMessaging() + const { + return std::make_unique(cert_); +} + + +void X509Certificate::Initialize(Environment* env, Local target) { + env->SetMethod(target, "parseX509", X509Certificate::Parse); + + NODE_DEFINE_CONSTANT(target, X509_CHECK_FLAG_ALWAYS_CHECK_SUBJECT); + NODE_DEFINE_CONSTANT(target, X509_CHECK_FLAG_NEVER_CHECK_SUBJECT); + NODE_DEFINE_CONSTANT(target, X509_CHECK_FLAG_NO_WILDCARDS); + NODE_DEFINE_CONSTANT(target, X509_CHECK_FLAG_NO_PARTIAL_WILDCARDS); + NODE_DEFINE_CONSTANT(target, X509_CHECK_FLAG_MULTI_LABEL_WILDCARDS); + NODE_DEFINE_CONSTANT(target, X509_CHECK_FLAG_SINGLE_LABEL_SUBDOMAINS); +} + +} // namespace crypto +} // namespace node diff --git a/src/crypto/crypto_x509.h b/src/crypto/crypto_x509.h new file mode 100644 index 00000000000000..4d46e43889b3a6 --- /dev/null +++ b/src/crypto/crypto_x509.h @@ -0,0 +1,136 @@ +#ifndef SRC_CRYPTO_CRYPTO_X509_H_ +#define SRC_CRYPTO_CRYPTO_X509_H_ + +#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + +#include "base_object.h" +#include "crypto/crypto_util.h" +#include "env.h" +#include "memory_tracker.h" +#include "node_worker.h" +#include "v8.h" + +namespace node { +namespace crypto { + +// The ManagedX509 class is essentially a smart pointer for +// X509 objects that allows an X509Certificate instance to +// be cloned at the JS level while pointing at the same +// underlying X509 instance. +class ManagedX509 : public MemoryRetainer { + public: + ManagedX509() = default; + explicit ManagedX509(X509Pointer&& cert); + ManagedX509(const ManagedX509& that); + ManagedX509& operator=(const ManagedX509& that); + + operator bool() const { return !!cert_; } + X509* get() const { return cert_.get(); } + + void MemoryInfo(MemoryTracker* tracker) const override; + SET_MEMORY_INFO_NAME(ManagedX509) + SET_SELF_SIZE(ManagedX509) + + private: + X509Pointer cert_; +}; + +class X509Certificate : public BaseObject { + public: + enum class GetPeerCertificateFlag { + ABBREVIATED, + SERVER + }; + + static void Initialize(Environment* env, v8::Local target); + static v8::Local GetConstructorTemplate( + Environment* env); + static bool HasInstance(Environment* env, v8::Local object); + + static v8::MaybeLocal New( + Environment* env, + X509Pointer cert); + + static v8::MaybeLocal New( + Environment* env, + std::shared_ptr cert); + + static v8::MaybeLocal GetCert( + Environment* env, + const SSLPointer& ssl); + + static v8::MaybeLocal GetPeerCert( + Environment* env, + const SSLPointer& ssl, + GetPeerCertificateFlag flag); + + static v8::Local Wrap( + Environment* env, + v8::Local object, + X509Pointer cert); + + static void Parse(const v8::FunctionCallbackInfo& args); + static void Subject(const v8::FunctionCallbackInfo& args); + static void SubjectAltName(const v8::FunctionCallbackInfo& args); + static void Issuer(const v8::FunctionCallbackInfo& args); + static void InfoAccess(const v8::FunctionCallbackInfo& args); + static void ValidFrom(const v8::FunctionCallbackInfo& args); + static void ValidTo(const v8::FunctionCallbackInfo& args); + static void Fingerprint(const v8::FunctionCallbackInfo& args); + static void Fingerprint256(const v8::FunctionCallbackInfo& args); + static void KeyUsage(const v8::FunctionCallbackInfo& args); + static void SerialNumber(const v8::FunctionCallbackInfo& args); + static void Raw(const v8::FunctionCallbackInfo& args); + static void PublicKey(const v8::FunctionCallbackInfo& args); + static void Pem(const v8::FunctionCallbackInfo& args); + static void CheckCA(const v8::FunctionCallbackInfo& args); + static void CheckHost(const v8::FunctionCallbackInfo& args); + static void CheckEmail(const v8::FunctionCallbackInfo& args); + static void CheckIP(const v8::FunctionCallbackInfo& args); + static void CheckIssued(const v8::FunctionCallbackInfo& args); + static void CheckPrivateKey(const v8::FunctionCallbackInfo& args); + static void Verify(const v8::FunctionCallbackInfo& args); + static void ToLegacy(const v8::FunctionCallbackInfo& args); + + X509* get() { return cert_->get(); } + + void MemoryInfo(MemoryTracker* tracker) const override; + SET_MEMORY_INFO_NAME(X509Certificate); + SET_SELF_SIZE(X509Certificate); + + class X509CertificateTransferData : public worker::TransferData { + public: + explicit X509CertificateTransferData( + const std::shared_ptr& data) + : data_(data) {} + + BaseObjectPtr Deserialize( + Environment* env, + v8::Local context, + std::unique_ptr self) override; + + SET_MEMORY_INFO_NAME(X509CertificateTransferData) + SET_SELF_SIZE(X509CertificateTransferData) + SET_NO_MEMORY_INFO() + + private: + std::shared_ptr data_; + }; + + BaseObject::TransferMode GetTransferMode() const override; + std::unique_ptr CloneForMessaging() const override; + + private: + X509Certificate( + Environment* env, + v8::Local object, + std::shared_ptr cert); + + std::shared_ptr cert_; +}; + +} // namespace crypto +} // namespace node + +#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS +#endif // SRC_CRYPTO_CRYPTO_X509_H_ diff --git a/src/env-inl.h b/src/env-inl.h index e6a4067cd2547c..98badcd0362627 100644 --- a/src/env-inl.h +++ b/src/env-inl.h @@ -1028,6 +1028,24 @@ inline void Environment::SetInstanceMethod(v8::Local that, t->SetClassName(name_string); } +inline void Environment::SetConstructorFunction( + v8::Local that, + const char* name, + v8::Local tmpl) { + SetConstructorFunction(that, OneByteString(isolate(), name), tmpl); +} + +inline void Environment::SetConstructorFunction( + v8::Local that, + v8::Local name, + v8::Local tmpl) { + tmpl->SetClassName(name); + that->Set( + context(), + name, + tmpl->GetFunction(context()).ToLocalChecked()).Check(); +} + void Environment::AddCleanupHook(CleanupCallback fn, void* arg) { auto insertion_info = cleanup_hooks_.emplace(CleanupHookCallback { fn, arg, cleanup_hook_counter_++ diff --git a/src/env.h b/src/env.h index 8dc624b06fedfe..7724e97ea58bb4 100644 --- a/src/env.h +++ b/src/env.h @@ -343,6 +343,7 @@ constexpr size_t kFsStatsBufferLength = V(options_string, "options") \ V(order_string, "order") \ V(output_string, "output") \ + V(overlapped_string, "overlapped") \ V(parse_error_string, "Parse Error") \ V(password_string, "password") \ V(path_string, "path") \ @@ -475,6 +476,7 @@ constexpr size_t kFsStatsBufferLength = V(tty_constructor_template, v8::FunctionTemplate) \ V(write_wrap_template, v8::ObjectTemplate) \ V(worker_heap_snapshot_taker_template, v8::ObjectTemplate) \ + V(x509_constructor_template, v8::FunctionTemplate) \ QUIC_ENVIRONMENT_STRONG_PERSISTENT_TEMPLATES(V) #if defined(NODE_EXPERIMENTAL_QUIC) && NODE_EXPERIMENTAL_QUIC @@ -1236,6 +1238,14 @@ class Environment : public MemoryRetainer { const char* name, v8::FunctionCallback callback); + inline void SetConstructorFunction(v8::Local that, + const char* name, + v8::Local tmpl); + + inline void SetConstructorFunction(v8::Local that, + v8::Local name, + v8::Local tmpl); + void AtExit(void (*cb)(void* arg), void* arg); void RunAtExitCallbacks(); diff --git a/src/fs_event_wrap.cc b/src/fs_event_wrap.cc index faa650b7a10cf9..b79da7e83622c9 100644 --- a/src/fs_event_wrap.cc +++ b/src/fs_event_wrap.cc @@ -95,11 +95,9 @@ void FSEventWrap::Initialize(Local target, void* priv) { Environment* env = Environment::GetCurrent(context); - auto fsevent_string = FIXED_ONE_BYTE_STRING(env->isolate(), "FSEvent"); Local t = env->NewFunctionTemplate(New); t->InstanceTemplate()->SetInternalFieldCount( FSEventWrap::kInternalFieldCount); - t->SetClassName(fsevent_string); t->Inherit(HandleWrap::GetConstructorTemplate(env)); env->SetProtoMethod(t, "start", Start); @@ -116,9 +114,7 @@ void FSEventWrap::Initialize(Local target, Local(), static_cast(ReadOnly | DontDelete | DontEnum)); - target->Set(env->context(), - fsevent_string, - t->GetFunction(context).ToLocalChecked()).Check(); + env->SetConstructorFunction(target, "FSEvent", t); } diff --git a/src/inspector_js_api.cc b/src/inspector_js_api.cc index c0791ce3194ca4..8de1f8e7b0a88d 100644 --- a/src/inspector_js_api.cc +++ b/src/inspector_js_api.cc @@ -102,19 +102,17 @@ class JSBindingsConnection : public AsyncWrap { } static void Bind(Environment* env, Local target) { - Local class_name = ConnectionType::GetClassName(env); Local tmpl = env->NewFunctionTemplate(JSBindingsConnection::New); tmpl->InstanceTemplate()->SetInternalFieldCount( JSBindingsConnection::kInternalFieldCount); - tmpl->SetClassName(class_name); tmpl->Inherit(AsyncWrap::GetConstructorTemplate(env)); env->SetProtoMethod(tmpl, "dispatch", JSBindingsConnection::Dispatch); env->SetProtoMethod(tmpl, "disconnect", JSBindingsConnection::Disconnect); - target->Set(env->context(), - class_name, - tmpl->GetFunction(env->context()).ToLocalChecked()) - .ToChecked(); + env->SetConstructorFunction( + target, + ConnectionType::GetClassName(env), + tmpl); } static void New(const FunctionCallbackInfo& info) { diff --git a/src/js_stream.cc b/src/js_stream.cc index e4da0ce747e3a0..399e073efba697 100644 --- a/src/js_stream.cc +++ b/src/js_stream.cc @@ -19,7 +19,6 @@ using v8::HandleScope; using v8::Int32; using v8::Local; using v8::Object; -using v8::String; using v8::Value; @@ -200,9 +199,6 @@ void JSStream::Initialize(Local target, Environment* env = Environment::GetCurrent(context); Local t = env->NewFunctionTemplate(New); - Local jsStreamString = - FIXED_ONE_BYTE_STRING(env->isolate(), "JSStream"); - t->SetClassName(jsStreamString); t->InstanceTemplate() ->SetInternalFieldCount(StreamBase::kInternalFieldCount); t->Inherit(AsyncWrap::GetConstructorTemplate(env)); @@ -213,9 +209,7 @@ void JSStream::Initialize(Local target, env->SetProtoMethod(t, "emitEOF", EmitEOF); StreamBase::AddMethods(env, t); - target->Set(env->context(), - jsStreamString, - t->GetFunction(context).ToLocalChecked()).Check(); + env->SetConstructorFunction(target, "JSStream", t); } } // namespace node diff --git a/src/js_udp_wrap.cc b/src/js_udp_wrap.cc index c51683141186f0..6a9bda5cad1ecb 100644 --- a/src/js_udp_wrap.cc +++ b/src/js_udp_wrap.cc @@ -16,7 +16,6 @@ using v8::HandleScope; using v8::Int32; using v8::Local; using v8::Object; -using v8::String; using v8::Value; // JSUDPWrap is a testing utility used by test/common/udppair.js @@ -195,9 +194,6 @@ void JSUDPWrap::Initialize(Local target, Environment* env = Environment::GetCurrent(context); Local t = env->NewFunctionTemplate(New); - Local js_udp_wrap_string = - FIXED_ONE_BYTE_STRING(env->isolate(), "JSUDPWrap"); - t->SetClassName(js_udp_wrap_string); t->InstanceTemplate() ->SetInternalFieldCount(UDPWrapBase::kUDPWrapBaseField + 1); t->Inherit(AsyncWrap::GetConstructorTemplate(env)); @@ -207,9 +203,7 @@ void JSUDPWrap::Initialize(Local target, env->SetProtoMethod(t, "onSendDone", OnSendDone); env->SetProtoMethod(t, "onAfterBind", OnAfterBind); - target->Set(env->context(), - js_udp_wrap_string, - t->GetFunction(context).ToLocalChecked()).Check(); + env->SetConstructorFunction(target, "JSUDPWrap", t); } diff --git a/src/module_wrap.cc b/src/module_wrap.cc index 9302fa6f68d837..0ac36d4aa6373f 100644 --- a/src/module_wrap.cc +++ b/src/module_wrap.cc @@ -722,10 +722,8 @@ void ModuleWrap::Initialize(Local target, Local context, void* priv) { Environment* env = Environment::GetCurrent(context); - Isolate* isolate = env->isolate(); Local tpl = env->NewFunctionTemplate(New); - tpl->SetClassName(FIXED_ONE_BYTE_STRING(isolate, "ModuleWrap")); tpl->InstanceTemplate()->SetInternalFieldCount( ModuleWrap::kInternalFieldCount); tpl->Inherit(BaseObject::GetConstructorTemplate(env)); @@ -741,8 +739,8 @@ void ModuleWrap::Initialize(Local target, env->SetProtoMethodNoSideEffect(tpl, "getStaticDependencySpecifiers", GetStaticDependencySpecifiers); - target->Set(env->context(), FIXED_ONE_BYTE_STRING(isolate, "ModuleWrap"), - tpl->GetFunction(context).ToLocalChecked()).Check(); + env->SetConstructorFunction(target, "ModuleWrap", tpl); + env->SetMethod(target, "setImportModuleDynamicallyCallback", SetImportModuleDynamicallyCallback); diff --git a/src/node_contextify.cc b/src/node_contextify.cc index 0accd99c0c4c5e..a0acdb75eede98 100644 --- a/src/node_contextify.cc +++ b/src/node_contextify.cc @@ -1282,21 +1282,11 @@ void MicrotaskQueueWrap::New(const FunctionCallbackInfo& args) { void MicrotaskQueueWrap::Init(Environment* env, Local target) { HandleScope scope(env->isolate()); - Local class_name = - FIXED_ONE_BYTE_STRING(env->isolate(), "MicrotaskQueue"); - Local tmpl = env->NewFunctionTemplate(New); tmpl->InstanceTemplate()->SetInternalFieldCount( ContextifyScript::kInternalFieldCount); - tmpl->SetClassName(class_name); - - if (target->Set(env->context(), - class_name, - tmpl->GetFunction(env->context()).ToLocalChecked()) - .IsNothing()) { - return; - } env->set_microtask_queue_ctor_template(tmpl); + env->SetConstructorFunction(target, "MicrotaskQueue", tmpl); } diff --git a/src/node_crypto.cc b/src/node_crypto.cc index d25387f1425daa..861125111bec48 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -64,6 +64,7 @@ void Initialize(Local target, Timing::Initialize(env, target); Util::Initialize(env, target); Verify::Initialize(env, target); + X509Certificate::Initialize(env, target); #ifndef OPENSSL_NO_SCRYPT ScryptJob::Initialize(env, target); diff --git a/src/node_crypto.h b/src/node_crypto.h index 2d7837c049ca32..21364ac987ab2a 100644 --- a/src/node_crypto.h +++ b/src/node_crypto.h @@ -50,6 +50,7 @@ #include "crypto/crypto_tls.h" #include "crypto/crypto_timing.h" #include "crypto/crypto_util.h" +#include "crypto/crypto_x509.h" #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS diff --git a/src/node_dir.cc b/src/node_dir.cc index ac5739b99325c5..a8bb2a7083c4fc 100644 --- a/src/node_dir.cc +++ b/src/node_dir.cc @@ -39,7 +39,6 @@ using v8::Null; using v8::Number; using v8::Object; using v8::ObjectTemplate; -using v8::String; using v8::Value; #define TRACE_NAME(name) "fs_dir.sync." #name @@ -349,7 +348,6 @@ void Initialize(Local target, Local context, void* priv) { Environment* env = Environment::GetCurrent(context); - Isolate* isolate = env->isolate(); env->SetMethod(target, "opendir", OpenDir); @@ -360,13 +358,7 @@ void Initialize(Local target, env->SetProtoMethod(dir, "close", DirHandle::Close); Local dirt = dir->InstanceTemplate(); dirt->SetInternalFieldCount(DirHandle::kInternalFieldCount); - Local handleString = - FIXED_ONE_BYTE_STRING(isolate, "DirHandle"); - dir->SetClassName(handleString); - target - ->Set(context, handleString, - dir->GetFunction(env->context()).ToLocalChecked()) - .FromJust(); + env->SetConstructorFunction(target, "DirHandle", dir); env->set_dir_instance_template(dirt); } diff --git a/src/node_file.cc b/src/node_file.cc index 4e975530b2c63c..ac1d6aa74aa0b5 100644 --- a/src/node_file.cc +++ b/src/node_file.cc @@ -1832,8 +1832,8 @@ static void WriteBuffer(const FunctionCallbackInfo& args) { CHECK_LE(static_cast(off_64), buffer_length); const size_t off = static_cast(off_64); - CHECK(args[3]->IsInt32()); - const size_t len = static_cast(args[3].As()->Value()); + CHECK(IsSafeJsInt(args[3])); + const size_t len = static_cast(args[3].As()->Value()); CHECK(Buffer::IsWithinBounds(off, len, buffer_length)); CHECK_LE(len, buffer_length); CHECK_GE(off + len, off); @@ -2471,13 +2471,7 @@ void Initialize(Local target, fst->InstanceTemplate()->SetInternalFieldCount( FSReqBase::kInternalFieldCount); fst->Inherit(AsyncWrap::GetConstructorTemplate(env)); - Local wrapString = - FIXED_ONE_BYTE_STRING(isolate, "FSReqCallback"); - fst->SetClassName(wrapString); - target - ->Set(context, wrapString, - fst->GetFunction(env->context()).ToLocalChecked()) - .Check(); + env->SetConstructorFunction(target, "FSReqCallback", fst); // Create FunctionTemplate for FileHandleReadWrap. Thereā€™s no need // to do anything in the constructor, so we only store the instance template. @@ -2508,14 +2502,8 @@ void Initialize(Local target, env->SetProtoMethod(fd, "releaseFD", FileHandle::ReleaseFD); Local fdt = fd->InstanceTemplate(); fdt->SetInternalFieldCount(StreamBase::kInternalFieldCount); - Local handleString = - FIXED_ONE_BYTE_STRING(isolate, "FileHandle"); - fd->SetClassName(handleString); StreamBase::AddMethods(env, fd); - target - ->Set(context, handleString, - fd->GetFunction(env->context()).ToLocalChecked()) - .Check(); + env->SetConstructorFunction(target, "FileHandle", fd); env->set_fd_constructor_template(fdt); // Create FunctionTemplate for FileHandle::CloseReq diff --git a/src/node_http2.cc b/src/node_http2.cc index 1e2da918bf5b69..930167418e18db 100644 --- a/src/node_http2.cc +++ b/src/node_http2.cc @@ -3054,9 +3054,6 @@ void Initialize(Local target, env->SetMethod(target, "packSettings", PackSettings); env->SetMethod(target, "setCallbackFunctions", SetCallbackFunctions); - Local http2SessionClassName = - FIXED_ONE_BYTE_STRING(isolate, "Http2Session"); - Local ping = FunctionTemplate::New(env->isolate()); ping->SetClassName(FIXED_ONE_BYTE_STRING(env->isolate(), "Http2Ping")); ping->Inherit(AsyncWrap::GetConstructorTemplate(env)); @@ -3065,14 +3062,12 @@ void Initialize(Local target, env->set_http2ping_constructor_template(pingt); Local setting = FunctionTemplate::New(env->isolate()); - setting->SetClassName(FIXED_ONE_BYTE_STRING(env->isolate(), "Http2Setting")); setting->Inherit(AsyncWrap::GetConstructorTemplate(env)); Local settingt = setting->InstanceTemplate(); settingt->SetInternalFieldCount(AsyncWrap::kInternalFieldCount); env->set_http2settings_constructor_template(settingt); Local stream = FunctionTemplate::New(env->isolate()); - stream->SetClassName(FIXED_ONE_BYTE_STRING(env->isolate(), "Http2Stream")); env->SetProtoMethod(stream, "id", Http2Stream::GetID); env->SetProtoMethod(stream, "destroy", Http2Stream::Destroy); env->SetProtoMethod(stream, "priority", Http2Stream::Priority); @@ -3087,13 +3082,10 @@ void Initialize(Local target, Local streamt = stream->InstanceTemplate(); streamt->SetInternalFieldCount(StreamBase::kInternalFieldCount); env->set_http2stream_constructor_template(streamt); - target->Set(context, - FIXED_ONE_BYTE_STRING(env->isolate(), "Http2Stream"), - stream->GetFunction(env->context()).ToLocalChecked()).Check(); + env->SetConstructorFunction(target, "Http2Stream", stream); Local session = env->NewFunctionTemplate(Http2Session::New); - session->SetClassName(http2SessionClassName); session->InstanceTemplate()->SetInternalFieldCount( Http2Session::kInternalFieldCount); session->Inherit(AsyncWrap::GetConstructorTemplate(env)); @@ -3119,9 +3111,7 @@ void Initialize(Local target, env->SetProtoMethod( session, "remoteSettings", Http2Session::RefreshSettings); - target->Set(context, - http2SessionClassName, - session->GetFunction(env->context()).ToLocalChecked()).Check(); + env->SetConstructorFunction(target, "Http2Session", session); Local constants = Object::New(isolate); diff --git a/src/node_http_parser.cc b/src/node_http_parser.cc index 706e6132db6212..affc66585ed89a 100644 --- a/src/node_http_parser.cc +++ b/src/node_http_parser.cc @@ -956,7 +956,6 @@ void InitializeHttpParser(Local target, Local t = env->NewFunctionTemplate(Parser::New); t->InstanceTemplate()->SetInternalFieldCount(Parser::kInternalFieldCount); - t->SetClassName(FIXED_ONE_BYTE_STRING(env->isolate(), "HTTPParser")); t->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "REQUEST"), Integer::New(env->isolate(), HTTP_REQUEST)); @@ -999,9 +998,7 @@ void InitializeHttpParser(Local target, env->SetProtoMethod(t, "unconsume", Parser::Unconsume); env->SetProtoMethod(t, "getCurrentBuffer", Parser::GetCurrentBuffer); - target->Set(env->context(), - FIXED_ONE_BYTE_STRING(env->isolate(), "HTTPParser"), - t->GetFunction(env->context()).ToLocalChecked()).Check(); + env->SetConstructorFunction(target, "HTTPParser", t); } } // anonymous namespace diff --git a/src/node_messaging.cc b/src/node_messaging.cc index 5f054c41c8eb04..78fb46ab6f2803 100644 --- a/src/node_messaging.cc +++ b/src/node_messaging.cc @@ -1415,32 +1415,24 @@ static void InitMessaging(Local target, Environment* env = Environment::GetCurrent(context); { - Local message_channel_string = - FIXED_ONE_BYTE_STRING(env->isolate(), "MessageChannel"); - Local templ = env->NewFunctionTemplate(MessageChannel); - templ->SetClassName(message_channel_string); - target->Set(context, - message_channel_string, - templ->GetFunction(context).ToLocalChecked()).Check(); + env->SetConstructorFunction( + target, + "MessageChannel", + env->NewFunctionTemplate(MessageChannel)); } { - Local js_transferable_string = - FIXED_ONE_BYTE_STRING(env->isolate(), "JSTransferable"); Local t = env->NewFunctionTemplate(JSTransferable::New); t->Inherit(BaseObject::GetConstructorTemplate(env)); - t->SetClassName(js_transferable_string); t->InstanceTemplate()->SetInternalFieldCount( JSTransferable::kInternalFieldCount); - target->Set(context, - js_transferable_string, - t->GetFunction(context).ToLocalChecked()).Check(); + env->SetConstructorFunction(target, "JSTransferable", t); } - target->Set(context, - env->message_port_constructor_string(), - GetMessagePortConstructorTemplate(env) - ->GetFunction(context).ToLocalChecked()).Check(); + env->SetConstructorFunction( + target, + env->message_port_constructor_string(), + GetMessagePortConstructorTemplate(env)); // These are not methods on the MessagePort prototype, because // the browser equivalents do not provide them. diff --git a/src/node_options.cc b/src/node_options.cc index e90dcd93231fca..9f59e7ee4f8aa8 100644 --- a/src/node_options.cc +++ b/src/node_options.cc @@ -7,6 +7,8 @@ #include #include +#include +#include #include // strtoul, errno using v8::Boolean; @@ -64,6 +66,20 @@ void PerProcessOptions::CheckOptions(std::vector* errors) { errors->push_back("either --use-openssl-ca or --use-bundled-ca can be " "used, not both"); } + + // Any value less than 2 disables use of the secure heap. + if (secure_heap >= 2) { + if ((secure_heap & (secure_heap - 1)) != 0) + errors->push_back("--secure-heap must be a power of 2"); + secure_heap_min = + std::min({ + secure_heap, + secure_heap_min, + static_cast(std::numeric_limits::max())}); + secure_heap_min = std::max(static_cast(2), secure_heap_min); + if ((secure_heap_min & (secure_heap_min - 1)) != 0) + errors->push_back("--secure-heap-min must be a power of 2"); + } #endif if (use_largepages != "off" && use_largepages != "on" && @@ -760,6 +776,14 @@ PerProcessOptionsParser::PerProcessOptionsParser( &PerProcessOptions::force_fips_crypto, kAllowedInEnvironment); #endif + AddOption("--secure-heap", + "total size of the OpenSSL secure heap", + &PerProcessOptions::secure_heap, + kAllowedInEnvironment); + AddOption("--secure-heap-min", + "minimum allocation size from the OpenSSL secure heap", + &PerProcessOptions::secure_heap_min, + kAllowedInEnvironment); #endif AddOption("--use-largepages", "Map the Node.js static code to large pages. Options are " diff --git a/src/node_options.h b/src/node_options.h index 84ee8e34bcafcf..555adb246a4b1c 100644 --- a/src/node_options.h +++ b/src/node_options.h @@ -236,6 +236,8 @@ class PerProcessOptions : public Options { #if HAVE_OPENSSL std::string openssl_config; std::string tls_cipher_list = DEFAULT_CIPHER_LIST_CORE; + int64_t secure_heap = 0; + int64_t secure_heap_min = 2; #ifdef NODE_OPENSSL_CERT_STORE bool ssl_openssl_cert_store = true; #else diff --git a/src/node_perf.cc b/src/node_perf.cc index 1eddb00f48a6d2..4d977d4ba61789 100644 --- a/src/node_perf.cc +++ b/src/node_perf.cc @@ -705,8 +705,7 @@ void Initialize(Local target, env->SetProtoMethod(eldh, "enable", ELDHistogramEnable); env->SetProtoMethod(eldh, "disable", ELDHistogramDisable); env->SetProtoMethod(eldh, "reset", ELDHistogramReset); - target->Set(context, eldh_classname, - eldh->GetFunction(env->context()).ToLocalChecked()).Check(); + env->SetConstructorFunction(target, eldh_classname, eldh); } } // namespace performance diff --git a/src/node_process_methods.cc b/src/node_process_methods.cc index 40164fc990ebfb..2c303a7693b774 100644 --- a/src/node_process_methods.cc +++ b/src/node_process_methods.cc @@ -172,7 +172,7 @@ static void Kill(const FunctionCallbackInfo& args) { args.GetReturnValue().Set(err); } -static void MemoryUsage(const FunctionCallbackInfo& args) { +static void Rss(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); size_t rss; @@ -180,6 +180,12 @@ static void MemoryUsage(const FunctionCallbackInfo& args) { if (err) return env->ThrowUVException(err, "uv_resident_set_memory"); + args.GetReturnValue().Set(static_cast(rss)); +} + +static void MemoryUsage(const FunctionCallbackInfo& args) { + Environment* env = Environment::GetCurrent(args); + Isolate* isolate = env->isolate(); // V8 memory usage HeapStatistics v8_heap_stats; @@ -192,6 +198,11 @@ static void MemoryUsage(const FunctionCallbackInfo& args) { Local ab = get_fields_array_buffer(args, 0, 5); double* fields = static_cast(ab->GetBackingStore()->Data()); + size_t rss; + int err = uv_resident_set_memory(&rss); + if (err) + return env->ThrowUVException(err, "uv_resident_set_memory"); + fields[0] = rss; fields[1] = v8_heap_stats.total_heap_size(); fields[2] = v8_heap_stats.used_heap_size(); @@ -542,6 +553,7 @@ static void InitializeProcessMethods(Local target, env->SetMethod(target, "umask", Umask); env->SetMethod(target, "_rawDebug", RawDebug); env->SetMethod(target, "memoryUsage", MemoryUsage); + env->SetMethod(target, "rss", Rss); env->SetMethod(target, "cpuUsage", CPUUsage); env->SetMethod(target, "resourceUsage", ResourceUsage); @@ -568,6 +580,7 @@ void RegisterProcessMethodsExternalReferences( registry->Register(Umask); registry->Register(RawDebug); registry->Register(MemoryUsage); + registry->Register(Rss); registry->Register(CPUUsage); registry->Register(ResourceUsage); diff --git a/src/node_serdes.cc b/src/node_serdes.cc index 28844f1858ff3d..879253f9bc2ebc 100644 --- a/src/node_serdes.cc +++ b/src/node_serdes.cc @@ -169,6 +169,10 @@ Maybe SerializerContext::WriteHostObject(Isolate* isolate, void SerializerContext::New(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); + if (!args.IsConstructCall()) { + return THROW_ERR_CONSTRUCT_CALL_REQUIRED( + env, "Class constructor Serializer cannot be invoked without 'new'"); + } new SerializerContext(env, args.This()); } @@ -319,6 +323,10 @@ MaybeLocal DeserializerContext::ReadHostObject(Isolate* isolate) { void DeserializerContext::New(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); + if (!args.IsConstructCall()) { + return THROW_ERR_CONSTRUCT_CALL_REQUIRED( + env, "Class constructor Deserializer cannot be invoked without 'new'"); + } if (!args[0]->IsArrayBufferView()) { return node::THROW_ERR_INVALID_ARG_TYPE( @@ -467,12 +475,8 @@ void Initialize(Local target, "_setTreatArrayBufferViewsAsHostObjects", SerializerContext::SetTreatArrayBufferViewsAsHostObjects); - Local serializerString = - FIXED_ONE_BYTE_STRING(env->isolate(), "Serializer"); - ser->SetClassName(serializerString); - target->Set(env->context(), - serializerString, - ser->GetFunction(env->context()).ToLocalChecked()).Check(); + ser->ReadOnlyPrototype(); + env->SetConstructorFunction(target, "Serializer", ser); Local des = env->NewFunctionTemplate(DeserializerContext::New); @@ -494,12 +498,9 @@ void Initialize(Local target, env->SetProtoMethod(des, "readDouble", DeserializerContext::ReadDouble); env->SetProtoMethod(des, "_readRawBytes", DeserializerContext::ReadRawBytes); - Local deserializerString = - FIXED_ONE_BYTE_STRING(env->isolate(), "Deserializer"); - des->SetClassName(deserializerString); - target->Set(env->context(), - deserializerString, - des->GetFunction(env->context()).ToLocalChecked()).Check(); + des->SetLength(1); + des->ReadOnlyPrototype(); + env->SetConstructorFunction(target, "Deserializer", des); } } // anonymous namespace diff --git a/src/node_sockaddr.cc b/src/node_sockaddr.cc index 8d7c93255b0d81..3734453314a087 100644 --- a/src/node_sockaddr.cc +++ b/src/node_sockaddr.cc @@ -18,7 +18,6 @@ using v8::FunctionTemplate; using v8::Local; using v8::MaybeLocal; using v8::Object; -using v8::String; using v8::Value; namespace { @@ -675,11 +674,9 @@ void SocketAddressBlockListWrap::Initialize( void* priv) { Environment* env = Environment::GetCurrent(context); - Local name = FIXED_ONE_BYTE_STRING(env->isolate(), "BlockList"); Local t = env->NewFunctionTemplate(SocketAddressBlockListWrap::New); t->InstanceTemplate()->SetInternalFieldCount(BaseObject::kInternalFieldCount); - t->SetClassName(name); env->SetProtoMethod(t, "addAddress", SocketAddressBlockListWrap::AddAddress); env->SetProtoMethod(t, "addRange", SocketAddressBlockListWrap::AddRange); @@ -688,8 +685,7 @@ void SocketAddressBlockListWrap::Initialize( env->SetProtoMethod(t, "getRules", SocketAddressBlockListWrap::GetRules); env->set_blocklist_instance_template(t->InstanceTemplate()); - target->Set(env->context(), name, - t->GetFunction(env->context()).ToLocalChecked()).FromJust(); + env->SetConstructorFunction(target, "BlockList", t); NODE_DEFINE_CONSTANT(target, AF_INET); NODE_DEFINE_CONSTANT(target, AF_INET6); diff --git a/src/node_stat_watcher.cc b/src/node_stat_watcher.cc index 70903525baa735..344ea6bb7ea2e6 100644 --- a/src/node_stat_watcher.cc +++ b/src/node_stat_watcher.cc @@ -38,7 +38,6 @@ using v8::HandleScope; using v8::Integer; using v8::Local; using v8::Object; -using v8::String; using v8::Uint32; using v8::Value; @@ -49,15 +48,11 @@ void StatWatcher::Initialize(Environment* env, Local target) { Local t = env->NewFunctionTemplate(StatWatcher::New); t->InstanceTemplate()->SetInternalFieldCount( StatWatcher::kInternalFieldCount); - Local statWatcherString = - FIXED_ONE_BYTE_STRING(env->isolate(), "StatWatcher"); - t->SetClassName(statWatcherString); t->Inherit(HandleWrap::GetConstructorTemplate(env)); env->SetProtoMethod(t, "start", StatWatcher::Start); - target->Set(env->context(), statWatcherString, - t->GetFunction(env->context()).ToLocalChecked()).Check(); + env->SetConstructorFunction(target, "StatWatcher", t); } diff --git a/src/node_trace_events.cc b/src/node_trace_events.cc index 9cefaa9227031d..af60aff4ab7bbe 100644 --- a/src/node_trace_events.cc +++ b/src/node_trace_events.cc @@ -138,10 +138,7 @@ void NodeCategorySet::Initialize(Local target, env->SetProtoMethod(category_set, "enable", NodeCategorySet::Enable); env->SetProtoMethod(category_set, "disable", NodeCategorySet::Disable); - target->Set(env->context(), - FIXED_ONE_BYTE_STRING(env->isolate(), "CategorySet"), - category_set->GetFunction(env->context()).ToLocalChecked()) - .Check(); + env->SetConstructorFunction(target, "CategorySet", category_set); Local isTraceCategoryEnabled = FIXED_ONE_BYTE_STRING(env->isolate(), "isTraceCategoryEnabled"); diff --git a/src/node_url.cc b/src/node_url.cc index e3f860ef311677..82fe8078a8db0a 100644 --- a/src/node_url.cc +++ b/src/node_url.cc @@ -1429,7 +1429,7 @@ void URL::Parse(const char* input, const char ch = p < end ? p[0] : kEOL; bool special = (url->flags & URL_FLAGS_SPECIAL); bool cannot_be_base; - const bool special_back_slash = (special && ch == '\\'); + bool special_back_slash = (special && ch == '\\'); switch (state) { case kSchemeStart: @@ -1477,6 +1477,7 @@ void URL::Parse(const char* input, url->flags &= ~URL_FLAGS_SPECIAL; special = false; } + special_back_slash = (special && ch == '\\'); buffer.clear(); if (has_state_override) return; @@ -1521,6 +1522,7 @@ void URL::Parse(const char* input, url->flags &= ~URL_FLAGS_SPECIAL; special = false; } + special_back_slash = (special && ch == '\\'); if (base->flags & URL_FLAGS_HAS_PATH) { url->flags |= URL_FLAGS_HAS_PATH; url->path = base->path; @@ -1544,6 +1546,7 @@ void URL::Parse(const char* input, url->flags |= URL_FLAGS_SPECIAL; special = true; state = kFile; + special_back_slash = (special && ch == '\\'); continue; } break; @@ -1573,6 +1576,7 @@ void URL::Parse(const char* input, url->flags &= ~URL_FLAGS_SPECIAL; special = false; } + special_back_slash = (special && ch == '\\'); switch (ch) { case kEOL: if (base->flags & URL_FLAGS_HAS_USERNAME) { diff --git a/src/node_util.cc b/src/node_util.cc index 3eefa73739aa3c..3f829081cb37ff 100644 --- a/src/node_util.cc +++ b/src/node_util.cc @@ -352,19 +352,15 @@ void Initialize(Local target, env->should_abort_on_uncaught_toggle().GetJSArray()) .FromJust()); - Local weak_ref_string = - FIXED_ONE_BYTE_STRING(env->isolate(), "WeakReference"); Local weak_ref = env->NewFunctionTemplate(WeakReference::New); weak_ref->InstanceTemplate()->SetInternalFieldCount( WeakReference::kInternalFieldCount); - weak_ref->SetClassName(weak_ref_string); weak_ref->Inherit(BaseObject::GetConstructorTemplate(env)); env->SetProtoMethod(weak_ref, "get", WeakReference::Get); env->SetProtoMethod(weak_ref, "incRef", WeakReference::IncRef); env->SetProtoMethod(weak_ref, "decRef", WeakReference::DecRef); - target->Set(context, weak_ref_string, - weak_ref->GetFunction(context).ToLocalChecked()).Check(); + env->SetConstructorFunction(target, "WeakReference", weak_ref); env->SetMethod(target, "guessHandleType", GuessHandleType); } diff --git a/src/node_version.h b/src/node_version.h index a5e3c205694807..e541df40b73e05 100644 --- a/src/node_version.h +++ b/src/node_version.h @@ -23,13 +23,13 @@ #define SRC_NODE_VERSION_H_ #define NODE_MAJOR_VERSION 15 -#define NODE_MINOR_VERSION 5 -#define NODE_PATCH_VERSION 2 +#define NODE_MINOR_VERSION 6 +#define NODE_PATCH_VERSION 0 #define NODE_VERSION_IS_LTS 0 #define NODE_VERSION_LTS_CODENAME "" -#define NODE_VERSION_IS_RELEASE 0 +#define NODE_VERSION_IS_RELEASE 1 #ifndef NODE_STRINGIFY #define NODE_STRINGIFY(n) NODE_STRINGIFY_HELPER(n) diff --git a/src/node_wasi.cc b/src/node_wasi.cc index 4dd534af4167ee..67d3966e2013a1 100644 --- a/src/node_wasi.cc +++ b/src/node_wasi.cc @@ -1676,9 +1676,7 @@ static void Initialize(Local target, Environment* env = Environment::GetCurrent(context); Local tmpl = env->NewFunctionTemplate(WASI::New); - auto wasi_wrap_string = FIXED_ONE_BYTE_STRING(env->isolate(), "WASI"); tmpl->InstanceTemplate()->SetInternalFieldCount(WASI::kInternalFieldCount); - tmpl->SetClassName(wasi_wrap_string); tmpl->Inherit(BaseObject::GetConstructorTemplate(env)); env->SetProtoMethod(tmpl, "args_get", WASI::ArgsGet); @@ -1731,9 +1729,7 @@ static void Initialize(Local target, env->SetInstanceMethod(tmpl, "_setMemory", WASI::_SetMemory); - target->Set(env->context(), - wasi_wrap_string, - tmpl->GetFunction(context).ToLocalChecked()).ToChecked(); + env->SetConstructorFunction(target, "WASI", tmpl); } diff --git a/src/node_watchdog.cc b/src/node_watchdog.cc index 8bd3b283b5329d..ff2a0229087138 100644 --- a/src/node_watchdog.cc +++ b/src/node_watchdog.cc @@ -124,19 +124,12 @@ void TraceSigintWatchdog::Init(Environment* env, Local target) { Local constructor = env->NewFunctionTemplate(New); constructor->InstanceTemplate()->SetInternalFieldCount( TraceSigintWatchdog::kInternalFieldCount); - Local js_sigint_watch_dog = - FIXED_ONE_BYTE_STRING(env->isolate(), "TraceSigintWatchdog"); - constructor->SetClassName(js_sigint_watch_dog); constructor->Inherit(HandleWrap::GetConstructorTemplate(env)); env->SetProtoMethod(constructor, "start", Start); env->SetProtoMethod(constructor, "stop", Stop); - target - ->Set(env->context(), - js_sigint_watch_dog, - constructor->GetFunction(env->context()).ToLocalChecked()) - .Check(); + env->SetConstructorFunction(target, "TraceSigintWatchdog", constructor); } void TraceSigintWatchdog::New(const FunctionCallbackInfo& args) { diff --git a/src/node_worker.cc b/src/node_worker.cc index 7369e13768e2d9..d163ec2461da07 100644 --- a/src/node_worker.cc +++ b/src/node_worker.cc @@ -815,12 +815,7 @@ void InitWorker(Local target, env->SetProtoMethod(w, "loopIdleTime", Worker::LoopIdleTime); env->SetProtoMethod(w, "loopStartTime", Worker::LoopStartTime); - Local workerString = - FIXED_ONE_BYTE_STRING(env->isolate(), "Worker"); - w->SetClassName(workerString); - target->Set(env->context(), - workerString, - w->GetFunction(env->context()).ToLocalChecked()).Check(); + env->SetConstructorFunction(target, "Worker", w); } { diff --git a/src/node_zlib.cc b/src/node_zlib.cc index efb11debf8f40d..2a2466052c92a5 100644 --- a/src/node_zlib.cc +++ b/src/node_zlib.cc @@ -54,7 +54,6 @@ using v8::Int32; using v8::Integer; using v8::Local; using v8::Object; -using v8::String; using v8::Uint32Array; using v8::Value; @@ -1262,11 +1261,7 @@ struct MakeClass { env->SetProtoMethod(z, "params", Stream::Params); env->SetProtoMethod(z, "reset", Stream::Reset); - Local zlibString = OneByteString(env->isolate(), name); - z->SetClassName(zlibString); - target->Set(env->context(), - zlibString, - z->GetFunction(env->context()).ToLocalChecked()).Check(); + env->SetConstructorFunction(target, name, z); } }; diff --git a/src/pipe_wrap.cc b/src/pipe_wrap.cc index 1396395463dfed..7ec3c66a78bb95 100644 --- a/src/pipe_wrap.cc +++ b/src/pipe_wrap.cc @@ -43,7 +43,6 @@ using v8::Int32; using v8::Local; using v8::MaybeLocal; using v8::Object; -using v8::String; using v8::Value; MaybeLocal PipeWrap::Instantiate(Environment* env, @@ -69,8 +68,6 @@ void PipeWrap::Initialize(Local target, Environment* env = Environment::GetCurrent(context); Local t = env->NewFunctionTemplate(New); - Local pipeString = FIXED_ONE_BYTE_STRING(env->isolate(), "Pipe"); - t->SetClassName(pipeString); t->InstanceTemplate() ->SetInternalFieldCount(StreamBase::kInternalFieldCount); @@ -87,20 +84,13 @@ void PipeWrap::Initialize(Local target, env->SetProtoMethod(t, "fchmod", Fchmod); - target->Set(env->context(), - pipeString, - t->GetFunction(env->context()).ToLocalChecked()).Check(); + env->SetConstructorFunction(target, "Pipe", t); env->set_pipe_constructor_template(t); // Create FunctionTemplate for PipeConnectWrap. auto cwt = BaseObject::MakeLazilyInitializedJSTemplate(env); cwt->Inherit(AsyncWrap::GetConstructorTemplate(env)); - Local wrapString = - FIXED_ONE_BYTE_STRING(env->isolate(), "PipeConnectWrap"); - cwt->SetClassName(wrapString); - target->Set(env->context(), - wrapString, - cwt->GetFunction(env->context()).ToLocalChecked()).Check(); + env->SetConstructorFunction(target, "PipeConnectWrap", cwt); // Define constants Local constants = Object::New(env->isolate()); diff --git a/src/process_wrap.cc b/src/process_wrap.cc index 3d1065c9922183..45920c2603b179 100644 --- a/src/process_wrap.cc +++ b/src/process_wrap.cc @@ -54,18 +54,13 @@ class ProcessWrap : public HandleWrap { Local constructor = env->NewFunctionTemplate(New); constructor->InstanceTemplate()->SetInternalFieldCount( ProcessWrap::kInternalFieldCount); - Local processString = - FIXED_ONE_BYTE_STRING(env->isolate(), "Process"); - constructor->SetClassName(processString); constructor->Inherit(HandleWrap::GetConstructorTemplate(env)); env->SetProtoMethod(constructor, "spawn", Spawn); env->SetProtoMethod(constructor, "kill", Kill); - target->Set(env->context(), - processString, - constructor->GetFunction(context).ToLocalChecked()).Check(); + env->SetConstructorFunction(target, "Process", constructor); } SET_NO_MEMORY_INFO() @@ -125,6 +120,11 @@ class ProcessWrap : public HandleWrap { options->stdio[i].flags = static_cast( UV_CREATE_PIPE | UV_READABLE_PIPE | UV_WRITABLE_PIPE); options->stdio[i].data.stream = StreamForWrap(env, stdio); + } else if (type->StrictEquals(env->overlapped_string())) { + options->stdio[i].flags = static_cast( + UV_CREATE_PIPE | UV_READABLE_PIPE | UV_WRITABLE_PIPE | + UV_OVERLAPPED_PIPE); + options->stdio[i].data.stream = StreamForWrap(env, stdio); } else if (type->StrictEquals(env->wrap_string())) { options->stdio[i].flags = UV_INHERIT_STREAM; options->stdio[i].data.stream = StreamForWrap(env, stdio); diff --git a/src/quic/node_quic_socket.cc b/src/quic/node_quic_socket.cc index abbdd50e47040b..810705014ca94d 100644 --- a/src/quic/node_quic_socket.cc +++ b/src/quic/node_quic_socket.cc @@ -39,7 +39,6 @@ using v8::Number; using v8::Object; using v8::ObjectTemplate; using v8::PropertyAttribute; -using v8::String; using v8::Value; namespace quic { @@ -1154,10 +1153,8 @@ void QuicEndpoint::Initialize( Local target, Local context) { Isolate* isolate = env->isolate(); - Local class_name = FIXED_ONE_BYTE_STRING(isolate, "QuicEndpoint"); Local endpoint = env->NewFunctionTemplate(NewQuicEndpoint); endpoint->Inherit(BaseObject::GetConstructorTemplate(env)); - endpoint->SetClassName(class_name); endpoint->InstanceTemplate()->SetInternalFieldCount( QuicEndpoint::kInternalFieldCount); env->SetProtoMethod(endpoint, @@ -1165,11 +1162,7 @@ void QuicEndpoint::Initialize( QuicEndpointWaitForPendingCallbacks); endpoint->InstanceTemplate()->Set(env->owner_symbol(), Null(isolate)); - target->Set( - context, - class_name, - endpoint->GetFunction(context).ToLocalChecked()) - .FromJust(); + env->SetConstructorFunction(target, "QuicEndpoint", endpoint); } void QuicSocket::Initialize( @@ -1177,10 +1170,8 @@ void QuicSocket::Initialize( Local target, Local context) { Isolate* isolate = env->isolate(); - Local class_name = FIXED_ONE_BYTE_STRING(isolate, "QuicSocket"); Local socket = env->NewFunctionTemplate(NewQuicSocket); socket->Inherit(AsyncWrap::GetConstructorTemplate(env)); - socket->SetClassName(class_name); socket->InstanceTemplate()->SetInternalFieldCount( QuicSocket::kInternalFieldCount); socket->InstanceTemplate()->Set(env->owner_symbol(), Null(isolate)); @@ -1197,8 +1188,7 @@ void QuicSocket::Initialize( "setDiagnosticPacketLoss", QuicSocketSetDiagnosticPacketLoss); socket->Inherit(HandleWrap::GetConstructorTemplate(env)); - target->Set(context, class_name, - socket->GetFunction(env->context()).ToLocalChecked()).FromJust(); + env->SetConstructorFunction(target, "QuicSocket", socket); Local sendwrap_ctor = FunctionTemplate::New(isolate); sendwrap_ctor->Inherit(AsyncWrap::GetConstructorTemplate(env)); diff --git a/src/quic/node_quic_stream.cc b/src/quic/node_quic_stream.cc index d63e66988ac2ac..57976ae50d9898 100644 --- a/src/quic/node_quic_stream.cc +++ b/src/quic/node_quic_stream.cc @@ -26,12 +26,10 @@ using v8::Array; using v8::Context; using v8::FunctionCallbackInfo; using v8::FunctionTemplate; -using v8::Isolate; using v8::Local; using v8::Object; using v8::ObjectTemplate; using v8::PropertyAttribute; -using v8::String; using v8::Value; namespace quic { @@ -525,10 +523,7 @@ void QuicStream::Initialize( Environment* env, Local target, Local context) { - Isolate* isolate = env->isolate(); - Local class_name = FIXED_ONE_BYTE_STRING(isolate, "QuicStream"); Local stream = FunctionTemplate::New(env->isolate()); - stream->SetClassName(class_name); stream->Inherit(AsyncWrap::GetConstructorTemplate(env)); StreamBase::AddMethods(env, stream); Local streamt = stream->InstanceTemplate(); @@ -543,9 +538,7 @@ void QuicStream::Initialize( env->SetProtoMethod(stream, "submitTrailers", QuicStreamSubmitTrailers); env->SetProtoMethod(stream, "submitPush", QuicStreamSubmitPush); env->set_quicserverstream_instance_template(streamt); - target->Set(env->context(), - class_name, - stream->GetFunction(env->context()).ToLocalChecked()).Check(); + env->SetConstructorFunction(target, "QuicStream", stream); env->SetMethod(target, "openBidirectionalStream", OpenBidirectionalStream); env->SetMethod(target, "openUnidirectionalStream", OpenUnidirectionalStream); diff --git a/src/signal_wrap.cc b/src/signal_wrap.cc index 2be7ac9834100b..49ea849f637cf7 100644 --- a/src/signal_wrap.cc +++ b/src/signal_wrap.cc @@ -35,7 +35,6 @@ using v8::HandleScope; using v8::Integer; using v8::Local; using v8::Object; -using v8::String; using v8::Value; void DecreaseSignalHandlerCount(int signum); @@ -55,17 +54,12 @@ class SignalWrap : public HandleWrap { Local constructor = env->NewFunctionTemplate(New); constructor->InstanceTemplate()->SetInternalFieldCount( SignalWrap::kInternalFieldCount); - Local signalString = - FIXED_ONE_BYTE_STRING(env->isolate(), "Signal"); - constructor->SetClassName(signalString); constructor->Inherit(HandleWrap::GetConstructorTemplate(env)); env->SetProtoMethod(constructor, "start", Start); env->SetProtoMethod(constructor, "stop", Stop); - target->Set(env->context(), signalString, - constructor->GetFunction(env->context()).ToLocalChecked()) - .Check(); + env->SetConstructorFunction(target, "Signal", constructor); } SET_NO_MEMORY_INFO() diff --git a/src/stream_pipe.cc b/src/stream_pipe.cc index 1422f9e0ea548e..afd7ec36eef294 100644 --- a/src/stream_pipe.cc +++ b/src/stream_pipe.cc @@ -13,7 +13,6 @@ using v8::FunctionTemplate; using v8::HandleScope; using v8::Local; using v8::Object; -using v8::String; using v8::Value; StreamPipe::StreamPipe(StreamBase* source, @@ -293,20 +292,14 @@ void InitializeStreamPipe(Local target, // Create FunctionTemplate for FileHandle::CloseReq Local pipe = env->NewFunctionTemplate(StreamPipe::New); - Local stream_pipe_string = - FIXED_ONE_BYTE_STRING(env->isolate(), "StreamPipe"); env->SetProtoMethod(pipe, "unpipe", StreamPipe::Unpipe); env->SetProtoMethod(pipe, "start", StreamPipe::Start); env->SetProtoMethod(pipe, "isClosed", StreamPipe::IsClosed); env->SetProtoMethod(pipe, "pendingWrites", StreamPipe::PendingWrites); pipe->Inherit(AsyncWrap::GetConstructorTemplate(env)); - pipe->SetClassName(stream_pipe_string); pipe->InstanceTemplate()->SetInternalFieldCount( StreamPipe::kInternalFieldCount); - target - ->Set(context, stream_pipe_string, - pipe->GetFunction(context).ToLocalChecked()) - .Check(); + env->SetConstructorFunction(target, "StreamPipe", pipe); } } // anonymous namespace diff --git a/src/stream_wrap.cc b/src/stream_wrap.cc index bd396110fccade..a1fa5e94b73711 100644 --- a/src/stream_wrap.cc +++ b/src/stream_wrap.cc @@ -49,7 +49,6 @@ using v8::Object; using v8::PropertyAttribute; using v8::ReadOnly; using v8::Signature; -using v8::String; using v8::Value; @@ -67,9 +66,6 @@ void LibuvStreamWrap::Initialize(Local target, Local sw = FunctionTemplate::New(env->isolate(), is_construct_call_callback); sw->InstanceTemplate()->SetInternalFieldCount(StreamReq::kInternalFieldCount); - Local wrapString = - FIXED_ONE_BYTE_STRING(env->isolate(), "ShutdownWrap"); - sw->SetClassName(wrapString); // we need to set handle and callback to null, // so that those fields are created and functions @@ -88,22 +84,15 @@ void LibuvStreamWrap::Initialize(Local target, sw->Inherit(AsyncWrap::GetConstructorTemplate(env)); - target->Set(env->context(), - wrapString, - sw->GetFunction(env->context()).ToLocalChecked()).Check(); + env->SetConstructorFunction(target, "ShutdownWrap", sw); env->set_shutdown_wrap_template(sw->InstanceTemplate()); Local ww = FunctionTemplate::New(env->isolate(), is_construct_call_callback); ww->InstanceTemplate()->SetInternalFieldCount( StreamReq::kInternalFieldCount); - Local writeWrapString = - FIXED_ONE_BYTE_STRING(env->isolate(), "WriteWrap"); - ww->SetClassName(writeWrapString); ww->Inherit(AsyncWrap::GetConstructorTemplate(env)); - target->Set(env->context(), - writeWrapString, - ww->GetFunction(env->context()).ToLocalChecked()).Check(); + env->SetConstructorFunction(target, "WriteWrap", ww); env->set_write_wrap_template(ww->InstanceTemplate()); NODE_DEFINE_CONSTANT(target, kReadBytesOrError); diff --git a/src/string_decoder.cc b/src/string_decoder.cc index a25c903987016f..0f9e6faaab162e 100644 --- a/src/string_decoder.cc +++ b/src/string_decoder.cc @@ -3,6 +3,7 @@ #include "env-inl.h" #include "node_buffer.h" +#include "node_errors.h" #include "node_external_reference.h" #include "string_bytes.h" #include "util.h" @@ -30,11 +31,17 @@ MaybeLocal MakeString(Isolate* isolate, Local error; MaybeLocal ret; if (encoding == UTF8) { - return String::NewFromUtf8( + MaybeLocal utf8_string = String::NewFromUtf8( isolate, data, v8::NewStringType::kNormal, length); + if (utf8_string.IsEmpty()) { + isolate->ThrowException(node::ERR_STRING_TOO_LONG(isolate)); + return MaybeLocal(); + } else { + return utf8_string; + } } else { ret = StringBytes::Encode( isolate, diff --git a/src/tcp_wrap.cc b/src/tcp_wrap.cc index fa45bd118d4724..cd7174984e2e36 100644 --- a/src/tcp_wrap.cc +++ b/src/tcp_wrap.cc @@ -74,8 +74,6 @@ void TCPWrap::Initialize(Local target, Environment* env = Environment::GetCurrent(context); Local t = env->NewFunctionTemplate(New); - Local tcpString = FIXED_ONE_BYTE_STRING(env->isolate(), "TCP"); - t->SetClassName(tcpString); t->InstanceTemplate()->SetInternalFieldCount(StreamBase::kInternalFieldCount); // Init properties @@ -103,21 +101,14 @@ void TCPWrap::Initialize(Local target, env->SetProtoMethod(t, "setSimultaneousAccepts", SetSimultaneousAccepts); #endif - target->Set(env->context(), - tcpString, - t->GetFunction(env->context()).ToLocalChecked()).Check(); + env->SetConstructorFunction(target, "TCP", t); env->set_tcp_constructor_template(t); // Create FunctionTemplate for TCPConnectWrap. Local cwt = BaseObject::MakeLazilyInitializedJSTemplate(env); cwt->Inherit(AsyncWrap::GetConstructorTemplate(env)); - Local wrapString = - FIXED_ONE_BYTE_STRING(env->isolate(), "TCPConnectWrap"); - cwt->SetClassName(wrapString); - target->Set(env->context(), - wrapString, - cwt->GetFunction(env->context()).ToLocalChecked()).Check(); + env->SetConstructorFunction(target, "TCPConnectWrap", cwt); // Define constants Local constants = Object::New(env->isolate()); diff --git a/src/udp_wrap.cc b/src/udp_wrap.cc index 26bafebcb22c14..e746f62c5edd81 100644 --- a/src/udp_wrap.cc +++ b/src/udp_wrap.cc @@ -43,7 +43,6 @@ using v8::Object; using v8::PropertyAttribute; using v8::ReadOnly; using v8::Signature; -using v8::String; using v8::Uint32; using v8::Undefined; using v8::Value; @@ -134,9 +133,6 @@ void UDPWrap::Initialize(Local target, Local t = env->NewFunctionTemplate(New); t->InstanceTemplate()->SetInternalFieldCount( UDPWrapBase::kInternalFieldCount); - Local udpString = - FIXED_ONE_BYTE_STRING(env->isolate(), "UDP"); - t->SetClassName(udpString); enum PropertyAttribute attributes = static_cast(ReadOnly | DontDelete); @@ -182,9 +178,7 @@ void UDPWrap::Initialize(Local target, t->Inherit(HandleWrap::GetConstructorTemplate(env)); - target->Set(env->context(), - udpString, - t->GetFunction(env->context()).ToLocalChecked()).Check(); + env->SetConstructorFunction(target, "UDP", t); env->set_udp_constructor_function( t->GetFunction(env->context()).ToLocalChecked()); @@ -192,12 +186,7 @@ void UDPWrap::Initialize(Local target, Local swt = BaseObject::MakeLazilyInitializedJSTemplate(env); swt->Inherit(AsyncWrap::GetConstructorTemplate(env)); - Local sendWrapString = - FIXED_ONE_BYTE_STRING(env->isolate(), "SendWrap"); - swt->SetClassName(sendWrapString); - target->Set(env->context(), - sendWrapString, - swt->GetFunction(env->context()).ToLocalChecked()).Check(); + env->SetConstructorFunction(target, "SendWrap", swt); Local constants = Object::New(env->isolate()); NODE_DEFINE_CONSTANT(constants, UV_UDP_IPV6ONLY); diff --git a/src/uv.cc b/src/uv.cc index bf50c88111fa90..e4b428f339b578 100644 --- a/src/uv.cc +++ b/src/uv.cc @@ -106,11 +106,10 @@ void Initialize(Local target, void* priv) { Environment* env = Environment::GetCurrent(context); Isolate* isolate = env->isolate(); - target->Set(env->context(), - FIXED_ONE_BYTE_STRING(isolate, "errname"), - env->NewFunctionTemplate(ErrName) - ->GetFunction(env->context()) - .ToLocalChecked()).Check(); + env->SetConstructorFunction( + target, + "errname", + env->NewFunctionTemplate(ErrName)); // TODO(joyeecheung): This should be deprecated in user land in favor of // `util.getSystemErrorName(err)`. diff --git a/test/cctest/test_environment.cc b/test/cctest/test_environment.cc index a2066121cd964f..862dfd5780868a 100644 --- a/test/cctest/test_environment.cc +++ b/test/cctest/test_environment.cc @@ -5,6 +5,8 @@ #include #include "gtest/gtest.h" #include "node_test_fixture.h" +#include +#include using node::AtExit; using node::RunAtExit; @@ -66,7 +68,34 @@ TEST_F(EnvironmentTest, EnvironmentWithESMLoader) { "})()"); } +class RedirectStdErr { + public: + explicit RedirectStdErr(const char* filename) : filename_(filename) { + fflush(stderr); + fgetpos(stderr, &pos_); + fd_ = dup(fileno(stderr)); + freopen(filename_, "w", stderr); + } + + ~RedirectStdErr() { + fflush(stderr); + dup2(fd_, fileno(stderr)); + close(fd_); + remove(filename_); + clearerr(stderr); + fsetpos(stderr, &pos_); + } + + private: + int fd_; + fpos_t pos_; + const char* filename_; +}; + TEST_F(EnvironmentTest, EnvironmentWithNoESMLoader) { + // The following line will cause stderr to get redirected to avoid the + // error that would otherwise be printed to the console by this test. + RedirectStdErr redirect_scope("environment_test.log"); const v8::HandleScope handle_scope(isolate_); Argv argv; Env env {handle_scope, argv, node::EnvironmentFlags::kNoRegisterESMLoader}; diff --git a/test/cctest/test_url.cc b/test/cctest/test_url.cc index 686ebcd11b301e..aa2b380dd11eda 100644 --- a/test/cctest/test_url.cc +++ b/test/cctest/test_url.cc @@ -81,6 +81,52 @@ TEST_F(URLTest, Base3) { EXPECT_EQ(simple.path(), "/baz"); } +TEST_F(URLTest, Base4) { + const char* input = "\\x"; + const char* base = "http://example.org/foo/bar"; + + URL simple(input, strlen(input), base, strlen(base)); + + EXPECT_FALSE(simple.flags() & URL_FLAGS_FAILED); + EXPECT_EQ(simple.protocol(), "http:"); + EXPECT_EQ(simple.host(), "example.org"); + EXPECT_EQ(simple.path(), "/x"); +} + +TEST_F(URLTest, Base5) { + const char* input = "/x"; + const char* base = "http://example.org/foo/bar"; + + URL simple(input, strlen(input), base, strlen(base)); + + EXPECT_FALSE(simple.flags() & URL_FLAGS_FAILED); + EXPECT_EQ(simple.protocol(), "http:"); + EXPECT_EQ(simple.host(), "example.org"); + EXPECT_EQ(simple.path(), "/x"); +} + +TEST_F(URLTest, Base6) { + const char* input = "\\\\x"; + const char* base = "http://example.org/foo/bar"; + + URL simple(input, strlen(input), base, strlen(base)); + + EXPECT_FALSE(simple.flags() & URL_FLAGS_FAILED); + EXPECT_EQ(simple.protocol(), "http:"); + EXPECT_EQ(simple.host(), "x"); +} + +TEST_F(URLTest, Base7) { + const char* input = "//x"; + const char* base = "http://example.org/foo/bar"; + + URL simple(input, strlen(input), base, strlen(base)); + + EXPECT_FALSE(simple.flags() & URL_FLAGS_FAILED); + EXPECT_EQ(simple.protocol(), "http:"); + EXPECT_EQ(simple.host(), "x"); +} + TEST_F(URLTest, TruncatedAfterProtocol) { char input[2] = { 'q', ':' }; URL simple(input, sizeof(input)); diff --git a/test/es-module/test-esm-local-deprecations.mjs b/test/es-module/test-esm-local-deprecations.mjs index 96d8cd1c8af735..5a6638d1d90e5a 100644 --- a/test/es-module/test-esm-local-deprecations.mjs +++ b/test/es-module/test-esm-local-deprecations.mjs @@ -6,6 +6,9 @@ import { pathToFileURL } from 'url'; const selfDeprecatedFolders = fixtures.path('/es-modules/self-deprecated-folders/main.js'); +const deprecatedFoldersIgnore = + fixtures.path('/es-modules/deprecated-folders-ignore/main.js'); + let curWarning = 0; const expectedWarnings = [ '"./" in the "exports" field', @@ -18,5 +21,6 @@ process.addListener('warning', mustCall((warning) => { (async () => { await import(pathToFileURL(selfDeprecatedFolders)); + await import(pathToFileURL(deprecatedFoldersIgnore)); })() .catch((err) => console.error(err)); diff --git a/test/fixtures/child-process-stay-alive-forever.js b/test/fixtures/child-process-stay-alive-forever.js new file mode 100644 index 00000000000000..fda313eba074c1 --- /dev/null +++ b/test/fixtures/child-process-stay-alive-forever.js @@ -0,0 +1,3 @@ +setInterval(() => { + // Starting an interval to stay alive. +}, 1000); diff --git a/test/fixtures/es-modules/deprecated-folders-ignore/main.js b/test/fixtures/es-modules/deprecated-folders-ignore/main.js new file mode 100644 index 00000000000000..88ffe3fe34a5a0 --- /dev/null +++ b/test/fixtures/es-modules/deprecated-folders-ignore/main.js @@ -0,0 +1 @@ +import 'pkg/folder/m.js'; diff --git a/test/fixtures/es-modules/deprecated-folders-ignore/node_modules/pkg/m.js b/test/fixtures/es-modules/deprecated-folders-ignore/node_modules/pkg/m.js new file mode 100644 index 00000000000000..7646bbd17d04a0 --- /dev/null +++ b/test/fixtures/es-modules/deprecated-folders-ignore/node_modules/pkg/m.js @@ -0,0 +1 @@ +export default null; diff --git a/test/fixtures/es-modules/deprecated-folders-ignore/node_modules/pkg/package.json b/test/fixtures/es-modules/deprecated-folders-ignore/node_modules/pkg/package.json new file mode 100644 index 00000000000000..c3baf35ea96736 --- /dev/null +++ b/test/fixtures/es-modules/deprecated-folders-ignore/node_modules/pkg/package.json @@ -0,0 +1,7 @@ +{ + "exports": { + "./folder/": "./" + }, + "type": "module" +} + diff --git a/test/fixtures/es-modules/deprecated-folders-ignore/package.json b/test/fixtures/es-modules/deprecated-folders-ignore/package.json new file mode 100644 index 00000000000000..52a3a1e8a8b787 --- /dev/null +++ b/test/fixtures/es-modules/deprecated-folders-ignore/package.json @@ -0,0 +1,4 @@ +{ + "type": "module" +} + diff --git a/test/fixtures/wpt/README.md b/test/fixtures/wpt/README.md index 855fca6d179ff6..fc609bfca90b5a 100644 --- a/test/fixtures/wpt/README.md +++ b/test/fixtures/wpt/README.md @@ -11,10 +11,10 @@ See [test/wpt](../../wpt/README.md) for information on how these tests are run. Last update: - console: https://github.com/web-platform-tests/wpt/tree/3b1f72e99a/console -- encoding: https://github.com/web-platform-tests/wpt/tree/1821fb5f77/encoding -- url: https://github.com/web-platform-tests/wpt/tree/09d8830be1/url -- resources: https://github.com/web-platform-tests/wpt/tree/001e50de41/resources -- interfaces: https://github.com/web-platform-tests/wpt/tree/8719553b2d/interfaces +- encoding: https://github.com/web-platform-tests/wpt/tree/3c9820d1cc/encoding +- url: https://github.com/web-platform-tests/wpt/tree/1783c9bccf/url +- resources: https://github.com/web-platform-tests/wpt/tree/351a99782b/resources +- interfaces: https://github.com/web-platform-tests/wpt/tree/b4be9a3fdf/interfaces - html/webappapis/microtask-queuing: https://github.com/web-platform-tests/wpt/tree/2c5c3c4c27/html/webappapis/microtask-queuing - html/webappapis/timers: https://github.com/web-platform-tests/wpt/tree/264f12bc7b/html/webappapis/timers - hr-time: https://github.com/web-platform-tests/wpt/tree/a5d1774ecf/hr-time diff --git a/test/fixtures/wpt/encoding/legacy-mb-schinese/gb18030/gb18030-decoder.html b/test/fixtures/wpt/encoding/legacy-mb-schinese/gb18030/gb18030-decoder.html new file mode 100644 index 00000000000000..b8fb0d04c44ee7 --- /dev/null +++ b/test/fixtures/wpt/encoding/legacy-mb-schinese/gb18030/gb18030-decoder.html @@ -0,0 +1,55 @@ + + + + + diff --git a/test/fixtures/wpt/encoding/legacy-mb-schinese/gb18030/gb18030-encoder.html b/test/fixtures/wpt/encoding/legacy-mb-schinese/gb18030/gb18030-encoder.html new file mode 100644 index 00000000000000..a6570c8d2b8001 --- /dev/null +++ b/test/fixtures/wpt/encoding/legacy-mb-schinese/gb18030/gb18030-encoder.html @@ -0,0 +1,48 @@ + + + + + + diff --git a/test/fixtures/wpt/encoding/legacy-mb-schinese/gb18030/resources/ranges.js b/test/fixtures/wpt/encoding/legacy-mb-schinese/gb18030/resources/ranges.js new file mode 100644 index 00000000000000..5bbd553dc01b53 --- /dev/null +++ b/test/fixtures/wpt/encoding/legacy-mb-schinese/gb18030/resources/ranges.js @@ -0,0 +1,210 @@ +// Based on https://encoding.spec.whatwg.org/index-gb18030-ranges.txt +const ranges = [ + [0, "\u0080"], + [36, "\u00A5"], + [38, "\u00A9"], + [45, "\u00B2"], + [50, "\u00B8"], + [81, "\u00D8"], + [89, "\u00E2"], + [95, "\u00EB"], + [96, "\u00EE"], + [100, "\u00F4"], + [103, "\u00F8"], + [104, "\u00FB"], + [105, "\u00FD"], + [109, "\u0102"], + [126, "\u0114"], + [133, "\u011C"], + [148, "\u012C"], + [172, "\u0145"], + [175, "\u0149"], + [179, "\u014E"], + [208, "\u016C"], + [306, "\u01CF"], + [307, "\u01D1"], + [308, "\u01D3"], + [309, "\u01D5"], + [310, "\u01D7"], + [311, "\u01D9"], + [312, "\u01DB"], + [313, "\u01DD"], + [341, "\u01FA"], + [428, "\u0252"], + [443, "\u0262"], + [544, "\u02C8"], + [545, "\u02CC"], + [558, "\u02DA"], + [741, "\u03A2"], + [742, "\u03AA"], + [749, "\u03C2"], + [750, "\u03CA"], + [805, "\u0402"], + [819, "\u0450"], + [820, "\u0452"], + [7922, "\u2011"], + [7924, "\u2017"], + [7925, "\u201A"], + [7927, "\u201E"], + [7934, "\u2027"], + [7943, "\u2031"], + [7944, "\u2034"], + [7945, "\u2036"], + [7950, "\u203C"], + [8062, "\u20AD"], + [8148, "\u2104"], + [8149, "\u2106"], + [8152, "\u210A"], + [8164, "\u2117"], + [8174, "\u2122"], + [8236, "\u216C"], + [8240, "\u217A"], + [8262, "\u2194"], + [8264, "\u219A"], + [8374, "\u2209"], + [8380, "\u2210"], + [8381, "\u2212"], + [8384, "\u2216"], + [8388, "\u221B"], + [8390, "\u2221"], + [8392, "\u2224"], + [8393, "\u2226"], + [8394, "\u222C"], + [8396, "\u222F"], + [8401, "\u2238"], + [8406, "\u223E"], + [8416, "\u2249"], + [8419, "\u224D"], + [8424, "\u2253"], + [8437, "\u2262"], + [8439, "\u2268"], + [8445, "\u2270"], + [8482, "\u2296"], + [8485, "\u229A"], + [8496, "\u22A6"], + [8521, "\u22C0"], + [8603, "\u2313"], + [8936, "\u246A"], + [8946, "\u249C"], + [9046, "\u254C"], + [9050, "\u2574"], + [9063, "\u2590"], + [9066, "\u2596"], + [9076, "\u25A2"], + [9092, "\u25B4"], + [9100, "\u25BE"], + [9108, "\u25C8"], + [9111, "\u25CC"], + [9113, "\u25D0"], + [9131, "\u25E6"], + [9162, "\u2607"], + [9164, "\u260A"], + [9218, "\u2641"], + [9219, "\u2643"], + [11329, "\u2E82"], + [11331, "\u2E85"], + [11334, "\u2E89"], + [11336, "\u2E8D"], + [11346, "\u2E98"], + [11361, "\u2EA8"], + [11363, "\u2EAB"], + [11366, "\u2EAF"], + [11370, "\u2EB4"], + [11372, "\u2EB8"], + [11375, "\u2EBC"], + [11389, "\u2ECB"], + [11682, "\u2FFC"], + [11686, "\u3004"], + [11687, "\u3018"], + [11692, "\u301F"], + [11694, "\u302A"], + [11714, "\u303F"], + [11716, "\u3094"], + [11723, "\u309F"], + [11725, "\u30F7"], + [11730, "\u30FF"], + [11736, "\u312A"], + [11982, "\u322A"], + [11989, "\u3232"], + [12102, "\u32A4"], + [12336, "\u3390"], + [12348, "\u339F"], + [12350, "\u33A2"], + [12384, "\u33C5"], + [12393, "\u33CF"], + [12395, "\u33D3"], + [12397, "\u33D6"], + [12510, "\u3448"], + [12553, "\u3474"], + [12851, "\u359F"], + [12962, "\u360F"], + [12973, "\u361B"], + [13738, "\u3919"], + [13823, "\u396F"], + [13919, "\u39D1"], + [13933, "\u39E0"], + [14080, "\u3A74"], + [14298, "\u3B4F"], + [14585, "\u3C6F"], + [14698, "\u3CE1"], + [15583, "\u4057"], + [15847, "\u4160"], + [16318, "\u4338"], + [16434, "\u43AD"], + [16438, "\u43B2"], + [16481, "\u43DE"], + [16729, "\u44D7"], + [17102, "\u464D"], + [17122, "\u4662"], + [17315, "\u4724"], + [17320, "\u472A"], + [17402, "\u477D"], + [17418, "\u478E"], + [17859, "\u4948"], + [17909, "\u497B"], + [17911, "\u497E"], + [17915, "\u4984"], + [17916, "\u4987"], + [17936, "\u499C"], + [17939, "\u49A0"], + [17961, "\u49B8"], + [18664, "\u4C78"], + [18703, "\u4CA4"], + [18814, "\u4D1A"], + [18962, "\u4DAF"], + [19043, "\u9FA6"], + [33469, "\uE76C"], + [33470, "\uE7C8"], + [33471, "\uE7E7"], + [33484, "\uE815"], + [33485, "\uE819"], + [33490, "\uE81F"], + [33497, "\uE827"], + [33501, "\uE82D"], + [33505, "\uE833"], + [33513, "\uE83C"], + [33520, "\uE844"], + [33536, "\uE856"], + [33550, "\uE865"], + [37845, "\uF92D"], + [37921, "\uF97A"], + [37948, "\uF996"], + [38029, "\uF9E8"], + [38038, "\uF9F2"], + [38064, "\uFA10"], + [38065, "\uFA12"], + [38066, "\uFA15"], + [38069, "\uFA19"], + [38075, "\uFA22"], + [38076, "\uFA25"], + [38078, "\uFA2A"], + [39108, "\uFE32"], + [39109, "\uFE45"], + [39113, "\uFE53"], + [39114, "\uFE58"], + [39115, "\uFE67"], + [39116, "\uFE6C"], + [39265, "\uFF5F"], + [39394, "\uFFE6"], + [189000, "\u{10000}"] +]; diff --git a/test/fixtures/wpt/encoding/legacy-mb-schinese/gbk/gbk-decoder.html b/test/fixtures/wpt/encoding/legacy-mb-schinese/gbk/gbk-decoder.html new file mode 100644 index 00000000000000..8c45683180070e --- /dev/null +++ b/test/fixtures/wpt/encoding/legacy-mb-schinese/gbk/gbk-decoder.html @@ -0,0 +1,33 @@ + + + + diff --git a/test/fixtures/wpt/encoding/legacy-mb-schinese/gbk/gbk-encoder.html b/test/fixtures/wpt/encoding/legacy-mb-schinese/gbk/gbk-encoder.html new file mode 100644 index 00000000000000..e43cb73fea72e5 --- /dev/null +++ b/test/fixtures/wpt/encoding/legacy-mb-schinese/gbk/gbk-encoder.html @@ -0,0 +1,26 @@ + + + + + diff --git a/test/fixtures/wpt/interfaces/dom.idl b/test/fixtures/wpt/interfaces/dom.idl index ffc5b063219d4d..bd8a17a379311b 100644 --- a/test/fixtures/wpt/interfaces/dom.idl +++ b/test/fixtures/wpt/interfaces/dom.idl @@ -9,7 +9,7 @@ interface Event { readonly attribute DOMString type; readonly attribute EventTarget? target; - readonly attribute EventTarget? srcElement; // historical + readonly attribute EventTarget? srcElement; // legacy readonly attribute EventTarget? currentTarget; sequence composedPath(); @@ -20,12 +20,12 @@ interface Event { readonly attribute unsigned short eventPhase; undefined stopPropagation(); - attribute boolean cancelBubble; // historical alias of .stopPropagation + attribute boolean cancelBubble; // legacy alias of .stopPropagation() undefined stopImmediatePropagation(); readonly attribute boolean bubbles; readonly attribute boolean cancelable; - attribute boolean returnValue; // historical + attribute boolean returnValue; // legacy undefined preventDefault(); readonly attribute boolean defaultPrevented; readonly attribute boolean composed; @@ -33,7 +33,7 @@ interface Event { [LegacyUnforgeable] readonly attribute boolean isTrusted; readonly attribute DOMHighResTimeStamp timeStamp; - undefined initEvent(DOMString type, optional boolean bubbles = false, optional boolean cancelable = false); // historical + undefined initEvent(DOMString type, optional boolean bubbles = false, optional boolean cancelable = false); // legacy }; dictionary EventInit { @@ -43,7 +43,7 @@ dictionary EventInit { }; partial interface Window { - [Replaceable] readonly attribute any event; // historical + [Replaceable] readonly attribute (Event or undefined) event; // legacy }; [Exposed=(Window,Worker)] @@ -52,7 +52,7 @@ interface CustomEvent : Event { readonly attribute any detail; - undefined initCustomEvent(DOMString type, optional boolean bubbles = false, optional boolean cancelable = false, optional any detail = null); // historical + undefined initCustomEvent(DOMString type, optional boolean bubbles = false, optional boolean cancelable = false, optional any detail = null); // legacy }; dictionary CustomEventInit : EventInit { @@ -79,6 +79,7 @@ dictionary EventListenerOptions { dictionary AddEventListenerOptions : EventListenerOptions { boolean passive = false; boolean once = false; + AbortSignal signal; }; [Exposed=(Window,Worker)] @@ -201,14 +202,14 @@ interface Node : EventTarget { const unsigned short ATTRIBUTE_NODE = 2; const unsigned short TEXT_NODE = 3; const unsigned short CDATA_SECTION_NODE = 4; - const unsigned short ENTITY_REFERENCE_NODE = 5; // historical - const unsigned short ENTITY_NODE = 6; // historical + const unsigned short ENTITY_REFERENCE_NODE = 5; // legacy + const unsigned short ENTITY_NODE = 6; // legacy const unsigned short PROCESSING_INSTRUCTION_NODE = 7; const unsigned short COMMENT_NODE = 8; const unsigned short DOCUMENT_NODE = 9; const unsigned short DOCUMENT_TYPE_NODE = 10; const unsigned short DOCUMENT_FRAGMENT_NODE = 11; - const unsigned short NOTATION_NODE = 12; // historical + const unsigned short NOTATION_NODE = 12; // legacy readonly attribute unsigned short nodeType; readonly attribute DOMString nodeName; @@ -232,7 +233,7 @@ interface Node : EventTarget { [CEReactions, NewObject] Node cloneNode(optional boolean deep = false); boolean isEqualNode(Node? otherNode); - boolean isSameNode(Node? otherNode); // historical alias of === + boolean isSameNode(Node? otherNode); // legacy alias of === const unsigned short DOCUMENT_POSITION_DISCONNECTED = 0x01; const unsigned short DOCUMENT_POSITION_PRECEDING = 0x02; @@ -266,8 +267,8 @@ interface Document : Node { readonly attribute USVString documentURI; readonly attribute DOMString compatMode; readonly attribute DOMString characterSet; - readonly attribute DOMString charset; // historical alias of .characterSet - readonly attribute DOMString inputEncoding; // historical alias of .characterSet + readonly attribute DOMString charset; // legacy alias of .characterSet + readonly attribute DOMString inputEncoding; // legacy alias of .characterSet readonly attribute DOMString contentType; readonly attribute DocumentType? doctype; @@ -290,7 +291,7 @@ interface Document : Node { [NewObject] Attr createAttribute(DOMString localName); [NewObject] Attr createAttributeNS(DOMString? namespace, DOMString qualifiedName); - [NewObject] Event createEvent(DOMString interface); // historical + [NewObject] Event createEvent(DOMString interface); // legacy [NewObject] Range createRange(); @@ -372,14 +373,14 @@ interface Element : Node { Element? closest(DOMString selectors); boolean matches(DOMString selectors); - boolean webkitMatchesSelector(DOMString selectors); // historical alias of .matches + boolean webkitMatchesSelector(DOMString selectors); // legacy alias of .matches HTMLCollection getElementsByTagName(DOMString qualifiedName); HTMLCollection getElementsByTagNameNS(DOMString? namespace, DOMString localName); HTMLCollection getElementsByClassName(DOMString classNames); - [CEReactions] Element? insertAdjacentElement(DOMString where, Element element); // historical - undefined insertAdjacentText(DOMString where, DOMString data); // historical + [CEReactions] Element? insertAdjacentElement(DOMString where, Element element); // legacy + undefined insertAdjacentText(DOMString where, DOMString data); // legacy }; dictionary ShadowRootInit { @@ -545,14 +546,14 @@ callback interface NodeFilter { const unsigned long SHOW_ATTRIBUTE = 0x2; const unsigned long SHOW_TEXT = 0x4; const unsigned long SHOW_CDATA_SECTION = 0x8; - const unsigned long SHOW_ENTITY_REFERENCE = 0x10; // historical - const unsigned long SHOW_ENTITY = 0x20; // historical + const unsigned long SHOW_ENTITY_REFERENCE = 0x10; // legacy + const unsigned long SHOW_ENTITY = 0x20; // legacy const unsigned long SHOW_PROCESSING_INSTRUCTION = 0x40; const unsigned long SHOW_COMMENT = 0x80; const unsigned long SHOW_DOCUMENT = 0x100; const unsigned long SHOW_DOCUMENT_TYPE = 0x200; const unsigned long SHOW_DOCUMENT_FRAGMENT = 0x400; - const unsigned long SHOW_NOTATION = 0x800; // historical + const unsigned long SHOW_NOTATION = 0x800; // legacy unsigned short acceptNode(Node node); }; diff --git a/test/fixtures/wpt/interfaces/html.idl b/test/fixtures/wpt/interfaces/html.idl index bf8da3733ec26f..dfe4e1e586b5a2 100644 --- a/test/fixtures/wpt/interfaces/html.idl +++ b/test/fixtures/wpt/interfaces/html.idl @@ -1701,8 +1701,7 @@ interface Window : EventTarget { // the user agent readonly attribute Navigator navigator; - [SecureContext] readonly attribute ApplicationCache applicationCache; - readonly attribute boolean originIsolated; + readonly attribute boolean originAgentCluster; // user prompts undefined alert(); @@ -1801,39 +1800,6 @@ interface BeforeUnloadEvent : Event { attribute DOMString returnValue; }; -[SecureContext, - Exposed=Window] -interface ApplicationCache : EventTarget { - - // update status - const unsigned short UNCACHED = 0; - const unsigned short IDLE = 1; - const unsigned short CHECKING = 2; - const unsigned short DOWNLOADING = 3; - const unsigned short UPDATEREADY = 4; - const unsigned short OBSOLETE = 5; - readonly attribute unsigned short status; - - // updates - undefined update(); - undefined abort(); - undefined swapCache(); - - // events - attribute EventHandler onchecking; - attribute EventHandler onerror; - attribute EventHandler onnoupdate; - attribute EventHandler ondownloading; - attribute EventHandler onprogress; - attribute EventHandler onupdateready; - attribute EventHandler oncached; - attribute EventHandler onobsolete; -}; - -interface mixin NavigatorOnLine { - readonly attribute boolean onLine; -}; - [Exposed=(Window,Worker)] interface ErrorEvent : Event { constructor(DOMString type, optional ErrorEventInit eventInitDict = {}); @@ -2048,6 +2014,10 @@ interface mixin NavigatorLanguage { readonly attribute FrozenArray languages; }; +interface mixin NavigatorOnLine { + readonly attribute boolean onLine; +}; + interface mixin NavigatorContentUtils { [SecureContext] undefined registerProtocolHandler(DOMString scheme, USVString url); [SecureContext] undefined unregisterProtocolHandler(DOMString scheme, USVString url); diff --git a/test/fixtures/wpt/resources/testdriver-actions.js b/test/fixtures/wpt/resources/testdriver-actions.js index f3e6388e8acd19..4dafa0c018b101 100644 --- a/test/fixtures/wpt/resources/testdriver-actions.js +++ b/test/fixtures/wpt/resources/testdriver-actions.js @@ -281,9 +281,12 @@ * pointer source * @returns {Actions} */ - pointerDown: function({button=this.ButtonType.LEFT, sourceName=null}={}) { + pointerDown: function({button=this.ButtonType.LEFT, sourceName=null, + width, height, pressure, tangentialPressure, + tiltX, tiltY, twist, altitudeAngle, azimuthAngle}={}) { let source = this.getSource("pointer", sourceName); - source.pointerDown(this, button); + source.pointerDown(this, button, width, height, pressure, tangentialPressure, + tiltX, tiltY, twist, altitudeAngle, azimuthAngle); return this; }, @@ -314,9 +317,13 @@ * @returns {Actions} */ pointerMove: function(x, y, - {origin="viewport", duration, sourceName=null}={}) { + {origin="viewport", duration, sourceName=null, + width, height, pressure, tangentialPressure, + tiltX, tiltY, twist, altitudeAngle, azimuthAngle}={}) { let source = this.getSource("pointer", sourceName); - source.pointerMove(this, x, y, duration, origin); + source.pointerMove(this, x, y, duration, origin, width, height, pressure, + tangentialPressure, tiltX, tiltY, twist, altitudeAngle, + azimuthAngle); return this; }, @@ -424,6 +431,38 @@ this.actions = new Map(); } + function setPointerProperties(action, width, height, pressure, tangentialPressure, + tiltX, tiltY, twist, altitudeAngle, azimuthAngle) { + if (width) { + action.width = width; + } + if (height) { + action.height = height; + } + if (pressure) { + action.pressure = pressure; + } + if (tangentialPressure) { + action.tangentialPressure = tangentialPressure; + } + if (tiltX) { + action.tiltX = tiltX; + } + if (tiltY) { + action.tiltY = tiltY; + } + if (twist) { + action.twist = twist; + } + if (altitudeAngle) { + action.altitudeAngle = altitudeAngle; + } + if (azimuthAngle) { + action.azimuthAngle = azimuthAngle; + } + return action; + } + PointerSource.prototype = { serialize: function(tickCount) { if (!this.actions.size) { @@ -441,12 +480,16 @@ return data; }, - pointerDown: function(actions, button) { + pointerDown: function(actions, button, width, height, pressure, tangentialPressure, + tiltX, tiltY, twist, altitudeAngle, azimuthAngle) { let tick = actions.tickIdx; if (this.actions.has(tick)) { tick = actions.addTick().tickIdx; } - this.actions.set(tick, {type: "pointerDown", button}); + let actionProperties = setPointerProperties({type: "pointerDown", button}, width, height, + pressure, tangentialPressure, tiltX, tiltY, + twist, altitudeAngle, azimuthAngle); + this.actions.set(tick, actionProperties); }, pointerUp: function(actions, button) { @@ -457,15 +500,20 @@ this.actions.set(tick, {type: "pointerUp", button}); }, - pointerMove: function(actions, x, y, duration, origin) { + pointerMove: function(actions, x, y, duration, origin, width, height, pressure, + tangentialPressure, tiltX, tiltY, twist, altitudeAngle, azimuthAngle) { let tick = actions.tickIdx; if (this.actions.has(tick)) { tick = actions.addTick().tickIdx; } - this.actions.set(tick, {type: "pointerMove", x, y, origin}); + let moveAction = {type: "pointerMove", x, y, origin}; if (duration) { - this.actions.get(tick).duration = duration; + moveAction.duration = duration; } + let actionProperties = setPointerProperties(moveAction, width, height, pressure, + tangentialPressure, tiltX, tiltY, twist, + altitudeAngle, azimuthAngle); + this.actions.set(tick, actionProperties); }, addPause: function(actions, duration) { diff --git a/test/fixtures/wpt/resources/testdriver.js b/test/fixtures/wpt/resources/testdriver.js index c53b24136c091f..f3cee9821e13f9 100644 --- a/test/fixtures/wpt/resources/testdriver.js +++ b/test/fixtures/wpt/resources/testdriver.js @@ -146,6 +146,24 @@ y: centerPoint[1]}); }, + /** + * Deletes all cookies. + * + * This matches the behaviour of the {@link + * https://w3c.github.io/webdriver/#delete-all-cookies|WebDriver + * Delete All Cookies command}. + * + * @param {WindowProxy} context - Browsing context in which + * to run the call, or null for the current + * browsing context. + * + * @returns {Promise} fulfilled after cookies are deleted, or rejected in + * the cases the WebDriver command errors + */ + delete_all_cookies: function(context=null) { + return window.test_driver_internal.delete_all_cookies(context); + }, + /** * Send keys to an element * @@ -458,6 +476,10 @@ }); }, + delete_all_cookies: function(context=null) { + return Promise.reject(new Error("unimplemented")); + }, + send_keys: function(element, keys) { if (this.in_automation) { return Promise.reject(new Error('Not implemented')); diff --git a/test/fixtures/wpt/resources/testharness.js b/test/fixtures/wpt/resources/testharness.js index d50e094117df56..f7fe7531710d23 100644 --- a/test/fixtures/wpt/resources/testharness.js +++ b/test/fixtures/wpt/resources/testharness.js @@ -2956,22 +2956,16 @@ policies and contribution forms [3]. } function sanitize_unpaired_surrogates(str) { - return str.replace(/([\ud800-\udbff])(?![\udc00-\udfff])/g, - function(_, unpaired) - { - return code_unit_str(unpaired); - }) - // This replacement is intentionally implemented without an - // ES2018 negative lookbehind assertion to support runtimes - // which do not yet implement that language feature. - .replace(/(^|[^\ud800-\udbff])([\udc00-\udfff])/g, - function(_, previous, unpaired) { - if (/[\udc00-\udfff]/.test(previous)) { - previous = code_unit_str(previous); - } - - return previous + code_unit_str(unpaired); - }); + return str.replace( + /([\ud800-\udbff]+)(?![\udc00-\udfff])|(^|[^\ud800-\udbff])([\udc00-\udfff]+)/g, + function(_, low, prefix, high) { + var output = prefix || ""; // prefix may be undefined + var string = low || high; // only one of these alternates can match + for (var i = 0; i < string.length; i++) { + output += code_unit_str(string[i]); + } + return output; + }); } function sanitize_all_unpaired_surrogates(tests) { @@ -3612,6 +3606,9 @@ policies and contribution forms [3]. function AssertionError(message) { + if (typeof message == "string") { + message = sanitize_unpaired_surrogates(message); + } this.message = message; this.stack = this.get_stack(); } diff --git a/test/fixtures/wpt/versions.json b/test/fixtures/wpt/versions.json index f1e9b8304d5fda..3cbb5f8f99bbdb 100644 --- a/test/fixtures/wpt/versions.json +++ b/test/fixtures/wpt/versions.json @@ -4,19 +4,19 @@ "path": "console" }, "encoding": { - "commit": "1821fb5f77723b5361058c6a8ed0b71f9d2d6b8d", + "commit": "3c9820d1cc5d9d2627c26ef1268b6d54a35adf22", "path": "encoding" }, "url": { - "commit": "09d8830be15da7e3a44f32a934609c25357d6ef3", + "commit": "1783c9bccf48c426ec1017f36e1ccfcf90a8af47", "path": "url" }, "resources": { - "commit": "001e50de41dc35820774b27e31f77a165f4c0b9b", + "commit": "351a99782b9677706b5dc0dd78e85978fa4ab130", "path": "resources" }, "interfaces": { - "commit": "8719553b2dd8f0f39d38253ccac2ee9ab4d6c87b", + "commit": "b4be9a3fdf18459a924f88e49bc55d8b30faa93a", "path": "interfaces" }, "html/webappapis/microtask-queuing": { diff --git a/test/overlapped-checker/main_unix.c b/test/overlapped-checker/main_unix.c new file mode 100644 index 00000000000000..9d3d83af0f1068 --- /dev/null +++ b/test/overlapped-checker/main_unix.c @@ -0,0 +1,51 @@ +#include +#include +#include + +#include +#include + +static size_t r(char* buf, size_t buf_size) { + ssize_t read_count; + do + read_count = read(0, buf, buf_size); + while (read_count < 0 && errno == EINTR); + if (read_count <= 0) + abort(); + return (size_t)read_count; +} + +static void w(const char* buf, size_t count) { + const char* end = buf + count; + + while (buf < end) { + ssize_t write_count; + do + write_count = write(1, buf, count); + while (write_count < 0 && errno == EINTR); + if (write_count <= 0) + abort(); + buf += write_count; + } + + fprintf(stderr, "%zu", count); + fflush(stderr); +} + +int main(void) { + w("0", 1); + + while (1) { + char buf[256]; + size_t read_count = r(buf, sizeof(buf)); + // The JS part (test-child-process-stdio-overlapped.js) only writes the + // "exit" string when the buffer is empty, so the read is guaranteed to be + // atomic due to it being less than PIPE_BUF. + if (!strncmp(buf, "exit", read_count)) { + break; + } + w(buf, read_count); + } + + return 0; +} diff --git a/test/overlapped-checker/main_win.c b/test/overlapped-checker/main_win.c new file mode 100644 index 00000000000000..c38b7febe6ddc5 --- /dev/null +++ b/test/overlapped-checker/main_win.c @@ -0,0 +1,85 @@ +#include +#include +#include + +#include + +static char buf[256]; +static DWORD read_count; +static DWORD write_count; +static HANDLE stdin_h; +static OVERLAPPED stdin_o; + +static void die(const char* buf) { + fprintf(stderr, "%s\n", buf); + fflush(stderr); + exit(100); +} + +static void overlapped_read(void) { + if (ReadFile(stdin_h, buf, sizeof(buf), NULL, &stdin_o)) { + // Since we start the read operation immediately before requesting a write, + // it should never complete synchronously since no data would be available + die("read completed synchronously"); + } + if (GetLastError() != ERROR_IO_PENDING) { + die("overlapped read failed"); + } +} + +static void write(const char* buf, size_t buf_size) { + overlapped_read(); + DWORD write_count; + HANDLE stdout_h = GetStdHandle(STD_OUTPUT_HANDLE); + if (!WriteFile(stdout_h, buf, buf_size, &write_count, NULL)) { + die("overlapped write failed"); + } + fprintf(stderr, "%d", write_count); + fflush(stderr); +} + +int main(void) { + HANDLE event = CreateEvent(NULL, FALSE, FALSE, NULL); + if (event == NULL) { + die("failed to create event handle"); + } + + stdin_h = GetStdHandle(STD_INPUT_HANDLE); + stdin_o.hEvent = event; + + write("0", 1); + + while (1) { + DWORD result = WaitForSingleObject(event, INFINITE); + if (result == WAIT_OBJECT_0) { + if (!GetOverlappedResult(stdin_h, &stdin_o, &read_count, FALSE)) { + die("failed to get overlapped read result"); + } + if (strncmp(buf, "exit", read_count) == 0) { + break; + } + write(buf, read_count); + } else { + char emsg[0xfff]; + int ecode = GetLastError(); + DWORD rv = FormatMessage( + FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, + ecode, + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), + (LPSTR)emsg, + sizeof(emsg), + NULL); + if (rv > 0) { + snprintf(emsg, sizeof(emsg), + "WaitForSingleObject failed. Error %d (%s)", ecode, emsg); + } else { + snprintf(emsg, sizeof(emsg), + "WaitForSingleObject failed. Error %d", ecode); + } + die(emsg); + } + } + + return 0; +} diff --git a/test/parallel/parallel.status b/test/parallel/parallel.status index 6639b5ca1a23d8..ff714c7cabfd04 100644 --- a/test/parallel/parallel.status +++ b/test/parallel/parallel.status @@ -36,6 +36,9 @@ test-async-hooks-http-parser-destroy: PASS,FLAKY # https://github.com/nodejs/node/pull/31178 test-crypto-dh-stateless: SKIP test-crypto-keygen: SKIP +# https://github.com/nodejs/node/issues/36847 +test-cluster-bind-privileged-port: PASS,FLAKY +test-cluster-shared-handle-bind-privileged-port: PASS,FLAKY [$system==solaris] # Also applies to SmartOS diff --git a/test/parallel/test-async-hooks-run-in-async-scope-this-arg.js b/test/parallel/test-async-hooks-run-in-async-scope-this-arg.js new file mode 100644 index 00000000000000..a5016da9d5fcd3 --- /dev/null +++ b/test/parallel/test-async-hooks-run-in-async-scope-this-arg.js @@ -0,0 +1,17 @@ +'use strict'; + +// Test that passing thisArg to runInAsyncScope() works. + +const common = require('../common'); +const assert = require('assert'); +const { AsyncResource } = require('async_hooks'); + +const thisArg = {}; + +const res = new AsyncResource('fhqwhgads'); + +function callback() { + assert.strictEqual(this, thisArg); +} + +res.runInAsyncScope(common.mustCall(callback), thisArg); diff --git a/test/parallel/test-blocklist.js b/test/parallel/test-blocklist.js index 953b26eec46ade..0d537574c72e11 100644 --- a/test/parallel/test-blocklist.js +++ b/test/parallel/test-blocklist.js @@ -150,6 +150,7 @@ const util = require('util'); const blockList = new BlockList(); assert.throws(() => blockList.addSubnet(1), /ERR_INVALID_ARG_TYPE/); assert.throws(() => blockList.addSubnet('', ''), /ERR_INVALID_ARG_TYPE/); + assert.throws(() => blockList.addSubnet('', NaN), /ERR_OUT_OF_RANGE/); assert.throws(() => blockList.addSubnet('', 1, 1), /ERR_INVALID_ARG_TYPE/); assert.throws(() => blockList.addSubnet('', 1, ''), /ERR_INVALID_ARG_VALUE/); diff --git a/test/parallel/test-child-process-execfile.js b/test/parallel/test-child-process-execfile.js index a6345a7e5f6890..49a4bdbda29957 100644 --- a/test/parallel/test-child-process-execfile.js +++ b/test/parallel/test-child-process-execfile.js @@ -3,6 +3,7 @@ const common = require('../common'); const assert = require('assert'); const execFile = require('child_process').execFile; +const { getEventListeners } = require('events'); const { getSystemErrorName } = require('util'); const fixtures = require('../common/fixtures'); @@ -52,12 +53,19 @@ const execOpts = { encoding: 'utf8', shell: true }; const ac = new AbortController(); const { signal } = ac; - const callback = common.mustCall((err) => { - assert.strictEqual(err.code, 'ABORT_ERR'); - assert.strictEqual(err.name, 'AbortError'); - }); - execFile(process.execPath, [echoFixture, 0], { signal }, callback); + const test = () => { + const check = common.mustCall((err) => { + assert.strictEqual(err.code, 'ABORT_ERR'); + assert.strictEqual(err.name, 'AbortError'); + assert.strictEqual(err.signal, undefined); + }); + execFile(process.execPath, [echoFixture, 0], { signal }, check); + }; + + test(); ac.abort(); + // Verify that it still works the same way now that the signal is aborted. + test(); } { @@ -68,5 +76,15 @@ const execOpts = { encoding: 'utf8', shell: true }; execFile(process.execPath, [echoFixture, 0], { signal: 'hello' }, callback); }, { code: 'ERR_INVALID_ARG_TYPE', name: 'TypeError' }); +} +{ + // Verify that the process completing removes the abort listener + const ac = new AbortController(); + const { signal } = ac; + const callback = common.mustCall((err) => { + assert.strictEqual(getEventListeners(ac.signal).length, 0); + assert.strictEqual(err, null); + }); + execFile(process.execPath, [fixture, 0], { signal }, callback); } diff --git a/test/parallel/test-child-process-fork-abort-signal.js b/test/parallel/test-child-process-fork-abort-signal.js new file mode 100644 index 00000000000000..63367479234d7f --- /dev/null +++ b/test/parallel/test-child-process-fork-abort-signal.js @@ -0,0 +1,33 @@ +'use strict'; + +const { mustCall } = require('../common'); +const { strictEqual } = require('assert'); +const fixtures = require('../common/fixtures'); +const { fork } = require('child_process'); + +{ + // Test aborting a forked child_process after calling fork + const ac = new AbortController(); + const { signal } = ac; + const cp = fork(fixtures.path('child-process-stay-alive-forever.js'), { + signal + }); + cp.on('exit', mustCall()); + cp.on('error', mustCall((err) => { + strictEqual(err.name, 'AbortError'); + })); + process.nextTick(() => ac.abort()); +} +{ + // Test passing an already aborted signal to a forked child_process + const ac = new AbortController(); + const { signal } = ac; + ac.abort(); + const cp = fork(fixtures.path('child-process-stay-alive-forever.js'), { + signal + }); + cp.on('exit', mustCall()); + cp.on('error', mustCall((err) => { + strictEqual(err.name, 'AbortError'); + })); +} diff --git a/test/parallel/test-child-process-spawn-controller.js b/test/parallel/test-child-process-spawn-controller.js index 399558569cc1ec..c25307907c1b26 100644 --- a/test/parallel/test-child-process-spawn-controller.js +++ b/test/parallel/test-child-process-spawn-controller.js @@ -4,18 +4,38 @@ const common = require('../common'); const assert = require('assert'); const cp = require('child_process'); -// Verify that passing an AbortSignal works -const controller = new AbortController(); -const { signal } = controller; +{ + // Verify that passing an AbortSignal works + const controller = new AbortController(); + const { signal } = controller; -const echo = cp.spawn('echo', ['fun'], { - encoding: 'utf8', - shell: true, - signal -}); + const echo = cp.spawn('echo', ['fun'], { + encoding: 'utf8', + shell: true, + signal + }); -echo.on('error', common.mustCall((e) => { - assert.strictEqual(e.name, 'AbortError'); -})); + echo.on('error', common.mustCall((e) => { + assert.strictEqual(e.name, 'AbortError'); + })); -controller.abort(); + controller.abort(); +} + +{ + // Verify that passing an already-aborted signal works. + const controller = new AbortController(); + const { signal } = controller; + + controller.abort(); + + const echo = cp.spawn('echo', ['fun'], { + encoding: 'utf8', + shell: true, + signal + }); + + echo.on('error', common.mustCall((e) => { + assert.strictEqual(e.name, 'AbortError'); + })); +} diff --git a/test/parallel/test-child-process-stdio-overlapped.js b/test/parallel/test-child-process-stdio-overlapped.js new file mode 100644 index 00000000000000..70a6454ff8fc9a --- /dev/null +++ b/test/parallel/test-child-process-stdio-overlapped.js @@ -0,0 +1,75 @@ +// Test for "overlapped" stdio option. This test uses the "overlapped-checker" +// helper program which basically a specialized echo program. +// +// The test has two goals: +// +// - Verify that overlapped I/O works on windows. The test program will deadlock +// if stdin doesn't have the FILE_FLAG_OVERLAPPED flag set on startup (see +// test/overlapped-checker/main_win.c for more details). +// - Verify that "overlapped" stdio option works transparently as a pipe (on +// unix/windows) +// +// This is how the test works: +// +// - This script assumes only numeric strings are written to the test program +// stdout. +// - The test program will be spawned with "overlapped" set on stdin and "pipe" +// set on stdout/stderr and at startup writes a number to its stdout +// - When this script receives some data, it will parse the number, add 50 and +// write to the test program's stdin. +// - The test program will then echo the number back to us which will repeat the +// cycle until the number reaches 200, at which point we send the "exit" +// string, which causes the test program to exit. +// - Extra assertion: Every time the test program writes a string to its stdout, +// it will write the number of bytes written to stderr. +// - If overlapped I/O is not setup correctly, this test is going to hang. +'use strict'; +const common = require('../common'); +const assert = require('assert'); +const path = require('path'); +const child_process = require('child_process'); + +const exeExtension = process.platform === 'win32' ? '.exe' : ''; +const exe = 'overlapped-checker' + exeExtension; +const exePath = path.join(path.dirname(process.execPath), exe); + +const child = child_process.spawn(exePath, [], { + stdio: ['overlapped', 'pipe', 'pipe'] +}); + +child.stdin.setEncoding('utf8'); +child.stdout.setEncoding('utf8'); +child.stderr.setEncoding('utf8'); + +function writeNext(n) { + child.stdin.write((n + 50).toString()); +} + +child.stdout.on('data', (s) => { + const n = Number(s); + if (n >= 200) { + child.stdin.write('exit'); + return; + } + writeNext(n); +}); + +let stderr = ''; +child.stderr.on('data', (s) => { + stderr += s; +}); + +child.stderr.on('end', common.mustCall(() => { + // This is the sequence of numbers sent to us: + // - 0 (1 byte written) + // - 50 (2 bytes written) + // - 100 (3 bytes written) + // - 150 (3 bytes written) + // - 200 (3 bytes written) + assert.strictEqual(stderr, '12333'); +})); + +child.on('exit', common.mustCall((status) => { + // The test program will return the number of writes as status code. + assert.strictEqual(status, 0); +})); diff --git a/test/parallel/test-cluster-child-index-dgram.js b/test/parallel/test-cluster-child-index-dgram.js new file mode 100644 index 00000000000000..0df7bc175b87f0 --- /dev/null +++ b/test/parallel/test-cluster-child-index-dgram.js @@ -0,0 +1,40 @@ +'use strict'; +const common = require('../common'); +const Countdown = require('../common/countdown'); +if (common.isWindows) + common.skip('dgram clustering is currently not supported on Windows.'); + +const cluster = require('cluster'); +const dgram = require('dgram'); + +// Test an edge case when using `cluster` and `dgram.Socket.bind()` +// the port of `0`. +const kPort = 0; + +function child() { + const kTime = 2; + const countdown = new Countdown(kTime * 2, () => { + process.exit(0); + }); + for (let i = 0; i < kTime; i += 1) { + const socket = new dgram.Socket('udp4'); + socket.bind(kPort, common.mustCall(() => { + // `process.nextTick()` or `socket2.close()` would throw + // ERR_SOCKET_DGRAM_NOT_RUNNING + process.nextTick(() => { + socket.close(countdown.dec()); + const socket2 = new dgram.Socket('udp4'); + socket2.bind(kPort, common.mustCall(() => { + process.nextTick(() => { + socket2.close(countdown.dec()); + }); + })); + }); + })); + } +} + +if (cluster.isMaster) + cluster.fork(__filename); +else + child(); diff --git a/test/parallel/test-cluster-child-index-net.js b/test/parallel/test-cluster-child-index-net.js new file mode 100644 index 00000000000000..d8c3166d1bae3c --- /dev/null +++ b/test/parallel/test-cluster-child-index-net.js @@ -0,0 +1,31 @@ +'use strict'; +const common = require('../common'); +const Countdown = require('../common/countdown'); +const cluster = require('cluster'); +const net = require('net'); + +// Test an edge case when using `cluster` and `net.Server.listen()` to +// the port of `0`. +const kPort = 0; + +function child() { + const kTime = 2; + const countdown = new Countdown(kTime * 2, () => { + process.exit(0); + }); + for (let i = 0; i < kTime; i += 1) { + const server = net.createServer(); + server.listen(kPort, common.mustCall(() => { + server.close(countdown.dec()); + const server2 = net.createServer(); + server2.listen(kPort, common.mustCall(() => { + server2.close(countdown.dec()); + })); + })); + } +} + +if (cluster.isMaster) + cluster.fork(__filename); +else + child(); diff --git a/test/parallel/test-crypto-dh-leak.js b/test/parallel/test-crypto-dh-leak.js index 65486dbd80cb64..5c4c0c61d4f41c 100644 --- a/test/parallel/test-crypto-dh-leak.js +++ b/test/parallel/test-crypto-dh-leak.js @@ -10,7 +10,7 @@ if (process.config.variables.asan) const assert = require('assert'); const crypto = require('crypto'); -const before = process.memoryUsage().rss; +const before = process.memoryUsage.rss(); { const dh = crypto.createDiffieHellman(common.hasFipsCrypto ? 1024 : 256); const publicKey = dh.generateKeys(); @@ -21,7 +21,7 @@ const before = process.memoryUsage().rss; } } global.gc(); -const after = process.memoryUsage().rss; +const after = process.memoryUsage.rss(); // RSS should stay the same, ceteris paribus, but allow for // some slop because V8 mallocs memory during execution. diff --git a/test/parallel/test-crypto-randomuuid.js b/test/parallel/test-crypto-randomuuid.js new file mode 100644 index 00000000000000..232dcec62c8f2e --- /dev/null +++ b/test/parallel/test-crypto-randomuuid.js @@ -0,0 +1,58 @@ +'use strict'; + +const common = require('../common'); + +if (!common.hasCrypto) + common.skip('missing crypto'); + +const assert = require('assert'); +const { + randomUUID, +} = require('crypto'); + +const last = new Set([ + '00000000-0000-0000-0000-000000000000' +]); + +function testMatch(uuid) { + assert.match( + uuid, + /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/); +} + +// Generate a number of UUID's to make sure we're +// not just generating the same value over and over +// and to make sure the batching changes the random +// bytes. +for (let n = 0; n < 130; n++) { + const uuid = randomUUID(); + assert(!last.has(uuid)); + last.add(uuid); + assert.strictEqual(typeof uuid, 'string'); + assert.strictEqual(uuid.length, 36); + testMatch(uuid); + + // Check that version 4 identifier was populated. + assert.strictEqual( + Buffer.from(uuid.substr(14, 2), 'hex')[0] & 0x40, 0x40); + + // Check that clock_seq_hi_and_reserved was populated with reserved bits. + assert.strictEqual( + Buffer.from(uuid.substr(19, 2), 'hex')[0] & 0b1100_0000, 0b1000_0000); +} + +// Test non-buffered UUID's +{ + testMatch(randomUUID({ disableEntropyCache: true })); + testMatch(randomUUID({ disableEntropyCache: true })); + testMatch(randomUUID({ disableEntropyCache: true })); + testMatch(randomUUID({ disableEntropyCache: true })); + + assert.throws(() => randomUUID(1), { + code: 'ERR_INVALID_ARG_TYPE' + }); + + assert.throws(() => randomUUID({ disableEntropyCache: '' }), { + code: 'ERR_INVALID_ARG_TYPE' + }); +} diff --git a/test/parallel/test-crypto-secure-heap.js b/test/parallel/test-crypto-secure-heap.js new file mode 100644 index 00000000000000..f6bdc3a2d8a05c --- /dev/null +++ b/test/parallel/test-crypto-secure-heap.js @@ -0,0 +1,75 @@ +'use strict'; + +const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); + +if (common.isWindows) + common.skip('Not supported on Windows'); + +if (process.config.variables.asan) + common.skip('ASAN does not play well with secure heap allocations'); + +const assert = require('assert'); +const { fork } = require('child_process'); +const fixtures = require('../common/fixtures'); +const { + secureHeapUsed, + createDiffieHellman, +} = require('crypto'); + +if (process.argv[2] === 'child') { + + const a = secureHeapUsed(); + + assert(a); + assert.strictEqual(typeof a, 'object'); + assert.strictEqual(a.total, 65536); + assert.strictEqual(a.min, 4); + assert.strictEqual(a.used, 0); + + { + const dh1 = createDiffieHellman(common.hasFipsCrypto ? 1024 : 256); + const p1 = dh1.getPrime('buffer'); + const dh2 = createDiffieHellman(p1, 'buffer'); + const key1 = dh1.generateKeys(); + const key2 = dh2.generateKeys('hex'); + dh1.computeSecret(key2, 'hex', 'base64'); + dh2.computeSecret(key1, 'latin1', 'buffer'); + + const b = secureHeapUsed(); + assert(b); + assert.strictEqual(typeof b, 'object'); + assert.strictEqual(b.total, 65536); + assert.strictEqual(b.min, 4); + // The amount used can vary on a number of factors + assert(b.used > 0); + assert(b.utilization > 0.0); + } + + return; +} + +const child = fork( + process.argv[1], + ['child'], + { execArgv: ['--secure-heap=65536', '--secure-heap-min=4'] }); + +child.on('exit', common.mustCall((code) => { + assert.strictEqual(code, 0); +})); + +{ + const child = fork(fixtures.path('a.js'), { + execArgv: ['--secure-heap=3', '--secure-heap-min=3'], + stdio: 'pipe' + }); + let res = ''; + child.on('exit', common.mustCall((code) => { + assert.notStrictEqual(code, 0); + assert.match(res, /--secure-heap must be a power of 2/); + assert.match(res, /--secure-heap-min must be a power of 2/); + })); + child.stderr.setEncoding('utf8'); + child.stderr.on('data', (chunk) => res += chunk); +} diff --git a/test/parallel/test-crypto-x509.js b/test/parallel/test-crypto-x509.js new file mode 100644 index 00000000000000..b97d53be799515 --- /dev/null +++ b/test/parallel/test-crypto-x509.js @@ -0,0 +1,245 @@ +// Flags: --expose-internals +'use strict'; +const common = require('../common'); + +if (!common.hasCrypto) + common.skip('missing crypto'); + +const { + X509Certificate, + createPrivateKey, +} = require('crypto'); + +const { + isX509Certificate +} = require('internal/crypto/x509'); + +const assert = require('assert'); +const fixtures = require('../common/fixtures'); +const { readFileSync } = require('fs'); + +const cert = readFileSync(fixtures.path('keys', 'agent1-cert.pem')); +const key = readFileSync(fixtures.path('keys', 'agent1-key.pem')); +const ca = readFileSync(fixtures.path('keys', 'ca1-cert.pem')); + +const privateKey = createPrivateKey(key); + +[1, {}, false, null].forEach((i) => { + assert.throws(() => new X509Certificate(i), { + code: 'ERR_INVALID_ARG_TYPE' + }); +}); + +const subjectCheck = `C=US +ST=CA +L=SF +O=Joyent +OU=Node.js +CN=agent1 +emailAddress=ry@tinyclouds.org`; + +const issuerCheck = `C=US +ST=CA +L=SF +O=Joyent +OU=Node.js +CN=ca1 +emailAddress=ry@tinyclouds.org`; + +const infoAccessCheck = `OCSP - URI:http://ocsp.nodejs.org/ +CA Issuers - URI:http://ca.nodejs.org/ca.cert +`; + +const der = Buffer.from( + '308202d830820241a003020102020900ecc9b856270da9a830' + + '0d06092a864886f70d01010b0500307a310b30090603550406' + + '13025553310b300906035504080c024341310b300906035504' + + '070c025346310f300d060355040a0c064a6f79656e74311030' + + '0e060355040b0c074e6f64652e6a73310c300a06035504030c' + + '036361313120301e06092a864886f70d010901161172794074' + + '696e79636c6f7564732e6f72673020170d3138313131363138' + + '343232315a180f32323932303833303138343232315a307d31' + + '0b3009060355040613025553310b300906035504080c024341' + + '310b300906035504070c025346310f300d060355040a0c064a' + + '6f79656e743110300e060355040b0c074e6f64652e6a73310f' + + '300d06035504030c066167656e74313120301e06092a864886' + + 'f70d010901161172794074696e79636c6f7564732e6f726730' + + '819f300d06092a864886f70d010101050003818d0030818902' + + '818100ef5440701637e28abb038e5641f828d834c342a9d25e' + + 'dbb86a2bf6fbd809cb8e037a98b71708e001242e4deb54c616' + + '4885f599dd87a23215745955be20417e33c4d0d1b80c9da3de' + + '419a2607195d2fb75657b0bbfb5eb7d0bba5122d1b6964c7b5' + + '70d50b8ec001eeb68dfb584437508f3129928d673b30a3e0bf' + + '4f50609e63710203010001a361305f305d06082b0601050507' + + '01010451304f302306082b060105050730018617687474703a' + + '2f2f6f6373702e6e6f64656a732e6f72672f302806082b0601' + + '0505073002861c687474703a2f2f63612e6e6f64656a732e6f' + + '72672f63612e63657274300d06092a864886f70d01010b0500' + + '038181007acabf1d99e1fb05edbdd54608886dd6c509fc5820' + + '2be8274f8139b60f8ea219666f7eff9737e92a732b318ef423' + + '7da94123dcac4f9a28e76fe663b26d42482ac6d66d380bbdfe' + + '0230083e743e7966671752b82f692e1034e9bfc9d0cd829888' + + '6c6c996e7c3d231e02ad5399a170b525b74f11d7ed13a7a815' + + 'f4b974253a8d66', 'hex'); + +{ + const x509 = new X509Certificate(cert); + + assert(isX509Certificate(x509)); + + assert(!x509.ca); + assert.strictEqual(x509.subject, subjectCheck); + assert.strictEqual(x509.subjectAltName, undefined); + assert.strictEqual(x509.issuer, issuerCheck); + assert.strictEqual(x509.infoAccess, infoAccessCheck); + assert.strictEqual(x509.validFrom, 'Nov 16 18:42:21 2018 GMT'); + assert.strictEqual(x509.validTo, 'Aug 30 18:42:21 2292 GMT'); + assert.strictEqual( + x509.fingerprint, + 'D7:FD:F6:42:92:A8:83:51:8E:80:48:62:66:DA:85:C2:EE:A6:A1:CD'); + assert.strictEqual( + x509.fingerprint256, + 'B0:BE:46:49:B8:29:63:E0:6F:63:C8:8A:57:9C:3F:9B:72:C6:F5:89:E3:0D:' + + '84:AC:5B:08:9A:20:89:B6:8F:D6' + ); + assert.strictEqual(x509.keyUsage, undefined); + assert.strictEqual(x509.serialNumber, 'ECC9B856270DA9A8'); + + assert.deepStrictEqual(x509.raw, der); + + assert(x509.publicKey); + assert.strictEqual(x509.publicKey.type, 'public'); + + assert.strictEqual(x509.toString(), cert.toString()); + assert.strictEqual(x509.toJSON(), x509.toString()); + + assert(x509.checkPrivateKey(privateKey)); + assert.throws(() => x509.checkPrivateKey(x509.publicKey), { + code: 'ERR_INVALID_ARG_VALUE' + }); + + assert.strictEqual(x509.checkIP('127.0.0.1'), undefined); + assert.strictEqual(x509.checkIP('::'), undefined); + assert.strictEqual(x509.checkHost('agent1'), 'agent1'); + assert.strictEqual(x509.checkHost('agent2'), undefined); + assert.strictEqual(x509.checkEmail('ry@tinyclouds.org'), 'ry@tinyclouds.org'); + assert.strictEqual(x509.checkEmail('sally@example.com'), undefined); + assert.throws(() => x509.checkHost('agent\x001'), { + code: 'ERR_INVALID_ARG_VALUE' + }); + assert.throws(() => x509.checkIP('[::]'), { + code: 'ERR_INVALID_ARG_VALUE' + }); + assert.throws(() => x509.checkEmail('not\x00hing'), { + code: 'ERR_INVALID_ARG_VALUE' + }); + + [1, false, null].forEach((i) => { + assert.throws(() => x509.checkHost('agent1', i), { + code: 'ERR_INVALID_ARG_TYPE' + }); + assert.throws(() => x509.checkHost('agent1', { subject: i }), { + code: 'ERR_INVALID_ARG_TYPE' + }); + }); + + [ + 'wildcards', + 'partialWildcards', + 'multiLabelWildcards', + 'singleLabelSubdomains' + ].forEach((key) => { + [1, '', null, {}].forEach((i) => { + assert.throws(() => x509.checkHost('agent1', { [key]: i }), { + code: 'ERR_INVALID_ARG_TYPE' + }); + }); + }); + + const ca_cert = new X509Certificate(ca); + + assert(x509.checkIssued(ca_cert)); + assert(!x509.checkIssued(x509)); + assert(x509.verify(ca_cert.publicKey)); + assert(!x509.verify(x509.publicKey)); + + assert.throws(() => x509.checkIssued({}), { + code: 'ERR_INVALID_ARG_TYPE' + }); + assert.throws(() => x509.checkIssued(''), { + code: 'ERR_INVALID_ARG_TYPE' + }); + assert.throws(() => x509.verify({}), { + code: 'ERR_INVALID_ARG_TYPE' + }); + assert.throws(() => x509.verify(''), { + code: 'ERR_INVALID_ARG_TYPE' + }); + assert.throws(() => x509.verify(privateKey), { + code: 'ERR_INVALID_ARG_VALUE' + }); + + // X509Certificate can be cloned via MessageChannel/MessagePort + const mc = new MessageChannel(); + mc.port1.onmessage = common.mustCall(({ data }) => { + assert(isX509Certificate(data)); + assert.deepStrictEqual(data.raw, x509.raw); + mc.port1.close(); + }); + mc.port2.postMessage(x509); + + // Verify that legacy encoding works + const legacyObjectCheck = { + subject: 'C=US\n' + + 'ST=CA\n' + + 'L=SF\n' + + 'O=Joyent\n' + + 'OU=Node.js\n' + + 'CN=agent1\n' + + 'emailAddress=ry@tinyclouds.org', + issuer: + 'C=US\n' + + 'ST=CA\n' + + 'L=SF\n' + + 'O=Joyent\n' + + 'OU=Node.js\n' + + 'CN=ca1\n' + + 'emailAddress=ry@tinyclouds.org', + infoAccess: + 'OCSP - URI:http://ocsp.nodejs.org/\n' + + 'CA Issuers - URI:http://ca.nodejs.org/ca.cert\n', + modulus: 'EF5440701637E28ABB038E5641F828D834C342A9D25EDBB86A2BF' + + '6FBD809CB8E037A98B71708E001242E4DEB54C6164885F599DD87' + + 'A23215745955BE20417E33C4D0D1B80C9DA3DE419A2607195D2FB' + + '75657B0BBFB5EB7D0BBA5122D1B6964C7B570D50B8EC001EEB68D' + + 'FB584437508F3129928D673B30A3E0BF4F50609E6371', + bits: 1024, + exponent: '0x10001', + valid_from: 'Nov 16 18:42:21 2018 GMT', + valid_to: 'Aug 30 18:42:21 2292 GMT', + fingerprint: 'D7:FD:F6:42:92:A8:83:51:8E:80:48:62:66:DA:85:C2:EE:A6:A1:CD', + fingerprint256: + 'B0:BE:46:49:B8:29:63:E0:6F:63:C8:8A:57:9C:3F:9B:72:' + + 'C6:F5:89:E3:0D:84:AC:5B:08:9A:20:89:B6:8F:D6', + serialNumber: 'ECC9B856270DA9A8' + }; + + const legacyObject = x509.toLegacyObject(); + + assert.deepStrictEqual(legacyObject.raw, x509.raw); + assert.strictEqual(legacyObject.subject, legacyObjectCheck.subject); + assert.strictEqual(legacyObject.issuer, legacyObjectCheck.issuer); + assert.strictEqual(legacyObject.infoAccess, legacyObjectCheck.infoAccess); + assert.strictEqual(legacyObject.modulus, legacyObjectCheck.modulus); + assert.strictEqual(legacyObject.bits, legacyObjectCheck.bits); + assert.strictEqual(legacyObject.exponent, legacyObjectCheck.exponent); + assert.strictEqual(legacyObject.valid_from, legacyObjectCheck.valid_from); + assert.strictEqual(legacyObject.valid_to, legacyObjectCheck.valid_to); + assert.strictEqual(legacyObject.fingerprint, legacyObjectCheck.fingerprint); + assert.strictEqual( + legacyObject.fingerprint256, + legacyObjectCheck.fingerprint256); + assert.strictEqual( + legacyObject.serialNumber, + legacyObjectCheck.serialNumber); +} diff --git a/test/parallel/test-diagnostics-channel-has-subscribers.js b/test/parallel/test-diagnostics-channel-has-subscribers.js new file mode 100644 index 00000000000000..de37267555089e --- /dev/null +++ b/test/parallel/test-diagnostics-channel-has-subscribers.js @@ -0,0 +1,10 @@ +'use strict'; +require('../common'); +const assert = require('assert'); +const { channel, hasSubscribers } = require('diagnostics_channel'); + +const dc = channel('test'); +assert.ok(!hasSubscribers('test')); + +dc.subscribe(() => {}); +assert.ok(hasSubscribers('test')); diff --git a/test/parallel/test-diagnostics-channel-object-channel-pub-sub.js b/test/parallel/test-diagnostics-channel-object-channel-pub-sub.js index bae69b02415785..cbc5b4d2e9a953 100644 --- a/test/parallel/test-diagnostics-channel-object-channel-pub-sub.js +++ b/test/parallel/test-diagnostics-channel-object-channel-pub-sub.js @@ -37,3 +37,7 @@ channel.publish(input); // Should not publish after subscriber is unsubscribed channel.unsubscribe(subscriber); assert.ok(!channel.hasSubscribers); + +assert.throws(() => { + channel.subscribe(null); +}, { code: 'ERR_INVALID_ARG_TYPE' }); diff --git a/test/parallel/test-diagnostics-channel-symbol-named.js b/test/parallel/test-diagnostics-channel-symbol-named.js index b98c2a1ef3ec6c..96fe0fa53596e2 100644 --- a/test/parallel/test-diagnostics-channel-symbol-named.js +++ b/test/parallel/test-diagnostics-channel-symbol-named.js @@ -20,3 +20,9 @@ channel.subscribe(common.mustCall((message, name) => { })); channel.publish(input); + +{ + assert.throws(() => { + dc.channel(null); + }, /ERR_INVALID_ARG_TYPE/); +} diff --git a/test/parallel/test-error-serdes.js b/test/parallel/test-error-serdes.js index f01dc0d6a8a81d..a65781c25eb261 100644 --- a/test/parallel/test-error-serdes.js +++ b/test/parallel/test-error-serdes.js @@ -49,3 +49,20 @@ assert.strictEqual(cycle(Function), '[Function: Function]'); assert.strictEqual(err.name, 'TypeError'); assert.strictEqual(err.code, 'ERR_INVALID_ARG_TYPE'); } + +{ + let called = false; + class DynamicError extends Error { + get type() { + called = true; + return 'dynamic'; + } + + get shouldIgnoreError() { + throw new Error(); + } + } + + serializeError(new DynamicError()); + assert.deepStrictEqual(called, true); +} diff --git a/test/parallel/test-event-emitter-max-listeners.js b/test/parallel/test-event-emitter-max-listeners.js index d1ac013bfb239f..a881bf86497f16 100644 --- a/test/parallel/test-event-emitter-max-listeners.js +++ b/test/parallel/test-event-emitter-max-listeners.js @@ -56,3 +56,17 @@ for (const obj of throwsObjs) { } e.emit('maxListeners'); + +{ + const { EventEmitter, defaultMaxListeners } = events; + for (const obj of throwsObjs) { + assert.throws(() => EventEmitter.setMaxListeners(obj), { + code: 'ERR_OUT_OF_RANGE', + }); + } + + assert.throws( + () => EventEmitter.setMaxListeners(defaultMaxListeners, 'INVALID_EMITTER'), + { code: 'ERR_INVALID_ARG_TYPE' } + ); +} diff --git a/test/parallel/test-events-once.js b/test/parallel/test-events-once.js index ea1963f0e58c1b..7c37f576c29fd3 100644 --- a/test/parallel/test-events-once.js +++ b/test/parallel/test-events-once.js @@ -23,6 +23,18 @@ async function onceAnEvent() { strictEqual(ee.listenerCount('myevent'), 0); } +async function onceAnEventWithNullOptions() { + const ee = new EventEmitter(); + + process.nextTick(() => { + ee.emit('myevent', 42); + }); + + const [value] = await once(ee, 'myevent', null); + strictEqual(value, 42); +} + + async function onceAnEventWithTwoArgs() { const ee = new EventEmitter(); @@ -195,6 +207,7 @@ async function eventTargetAbortSignalAfterEvent() { Promise.all([ onceAnEvent(), + onceAnEventWithNullOptions(), onceAnEventWithTwoArgs(), catchesErrors(), stopListeningAfterCatchingError(), diff --git a/test/parallel/test-events-static-geteventlisteners.js b/test/parallel/test-events-static-geteventlisteners.js index d717ff74242f90..71d9b0a28ddc75 100644 --- a/test/parallel/test-events-static-geteventlisteners.js +++ b/test/parallel/test-events-static-geteventlisteners.js @@ -4,6 +4,7 @@ const common = require('../common'); const { deepStrictEqual, + throws } = require('assert'); const { getEventListeners, EventEmitter } = require('events'); @@ -34,3 +35,9 @@ const { getEventListeners, EventEmitter } = require('events'); deepStrictEqual(getEventListeners(target, 'bar'), []); deepStrictEqual(getEventListeners(target, 'baz'), [fn1]); } + +{ + throws(() => { + getEventListeners('INVALID_EMITTER'); + }, /ERR_INVALID_ARG_TYPE/); +} diff --git a/test/parallel/test-eventtarget.js b/test/parallel/test-eventtarget.js index 45c63e0dd18be3..dd3a5a106b5a01 100644 --- a/test/parallel/test-eventtarget.js +++ b/test/parallel/test-eventtarget.js @@ -13,7 +13,7 @@ const { const { once } = require('events'); -const { promisify } = require('util'); +const { promisify, inspect } = require('util'); const delay = promisify(setTimeout); // The globals are defined. @@ -541,3 +541,32 @@ let asyncTest = Promise.resolve(); et.addEventListener('foo', listener); et.dispatchEvent(new Event('foo')); } + +{ + const ev = new Event('test'); + const evConstructorName = inspect(ev, { + depth: -1 + }); + strictEqual(evConstructorName, 'Event'); + + const inspectResult = inspect(ev, { + depth: 1 + }); + ok(inspectResult.includes('Event')); +} + +{ + const et = new EventTarget(); + const inspectResult = inspect(et, { + depth: 1 + }); + ok(inspectResult.includes('EventTarget')); +} + +{ + const ev = new Event('test'); + strictEqual(ev.constructor.name, 'Event'); + + const et = new EventTarget(); + strictEqual(et.constructor.name, 'EventTarget'); +} diff --git a/test/parallel/test-http-agent-scheduling.js b/test/parallel/test-http-agent-scheduling.js index b5ed2df4363a55..768519d5977831 100644 --- a/test/parallel/test-http-agent-scheduling.js +++ b/test/parallel/test-http-agent-scheduling.js @@ -56,11 +56,11 @@ function defaultTest() { bulkRequest(url, agent, (ports) => { makeRequest(url, agent, (port) => { - assert.strictEqual(ports[0], port); + assert.strictEqual(ports[ports.length - 1], port); makeRequest(url, agent, (port) => { - assert.strictEqual(ports[1], port); + assert.strictEqual(ports[ports.length - 1], port); makeRequest(url, agent, (port) => { - assert.strictEqual(ports[2], port); + assert.strictEqual(ports[ports.length - 1], port); server.close(); agent.destroy(); }); diff --git a/test/parallel/test-http-client-incomingmessage-destroy.js b/test/parallel/test-http-client-incomingmessage-destroy.js deleted file mode 100644 index a0823d37786365..00000000000000 --- a/test/parallel/test-http-client-incomingmessage-destroy.js +++ /dev/null @@ -1,25 +0,0 @@ -'use strict'; - -const common = require('../common'); -const { createServer, get } = require('http'); -const assert = require('assert'); - -const server = createServer(common.mustCall((req, res) => { - res.writeHead(200); - res.write('Part of res.'); -})); - -function onUncaught(error) { - assert.strictEqual(error.message, 'Destroy test'); - server.close(); -} - -process.on('uncaughtException', common.mustCall(onUncaught)); - -server.listen(0, () => { - get({ - port: server.address().port - }, common.mustCall((res) => { - res.destroy(new Error('Destroy test')); - })); -}); diff --git a/test/parallel/test-http-outgoing-end-cork.js b/test/parallel/test-http-outgoing-end-cork.js new file mode 100644 index 00000000000000..6a217238c447c4 --- /dev/null +++ b/test/parallel/test-http-outgoing-end-cork.js @@ -0,0 +1,95 @@ +'use strict'; +const common = require('../common'); +const assert = require('assert'); +const http = require('http'); + +const REQ_TIMEOUT = 500; // Set max ms of request time before abort + +// Set total allowed test timeout to avoid infinite loop +// that will hang test suite +const TOTAL_TEST_TIMEOUT = 1000; + +// Placeholder for sockets handled, to make sure that we +// will reach a socket re-use case. +const handledSockets = new Set(); + +let metReusedSocket = false; // Flag for request loop termination. + +const doubleEndResponse = (res) => { + // First end the request while sending some normal data + res.end('regular end of request', 'utf8', common.mustCall()); + // Make sure the response socket is uncorked after first call of end + assert.strictEqual(res.writableCorked, 0); + res.end(); // Double end the response to prep for next socket re-use. +}; + +const sendDrainNeedingData = (res) => { + // Send data to socket more than the high watermark so that + // it definitely needs drain + const highWaterMark = res.socket.writableHighWaterMark; + const bufferToSend = Buffer.alloc(highWaterMark + 100); + const ret = res.write(bufferToSend); // Write the request data. + // Make sure that we had back pressure on response stream. + assert.strictEqual(ret, false); + res.once('drain', () => res.end()); // End on drain. +}; + +const server = http.createServer((req, res) => { + const { socket: responseSocket } = res; + if (handledSockets.has(responseSocket)) { // re-used socket, send big data! + metReusedSocket = true; // stop request loop + console.debug('FOUND REUSED SOCKET!'); + sendDrainNeedingData(res); + } else { // not used again + // add to make sure we recognise it when we meet socket again + handledSockets.add(responseSocket); + doubleEndResponse(res); + } +}); + +server.listen(0); // Start the server on a random port. + +const sendRequest = (agent) => new Promise((resolve, reject) => { + const timeout = setTimeout(common.mustNotCall(() => { + reject(new Error('Request timed out')); + }), REQ_TIMEOUT); + http.get({ + port: server.address().port, + path: '/', + agent + }, common.mustCall((res) => { + const resData = []; + res.on('data', (data) => resData.push(data)); + res.on('end', common.mustCall(() => { + const totalData = resData.reduce((total, elem) => total + elem.length, 0); + clearTimeout(timeout); // Cancel rejection timeout. + resolve(totalData); // fulfill promise + })); + })); +}); + +server.once('listening', async () => { + const testTimeout = setTimeout(common.mustNotCall(() => { + console.error('Test running for a while but could not met re-used socket'); + process.exit(1); + }), TOTAL_TEST_TIMEOUT); + // Explicitly start agent to force socket reuse. + const agent = new http.Agent({ keepAlive: true }); + // Start the request loop + let reqNo = 0; + while (!metReusedSocket) { + try { + console.log(`Sending req no ${++reqNo}`); + const totalData = await sendRequest(agent); + console.log(`${totalData} bytes were received for request ${reqNo}`); + } catch (err) { + console.error(err); + process.exit(1); + } + } + // Successfully tested conditions and ended loop + clearTimeout(testTimeout); + console.log('Closing server'); + agent.destroy(); + server.close(); +}); diff --git a/test/parallel/test-http-outgoing-end-multiple.js b/test/parallel/test-http-outgoing-end-multiple.js index ed42c913375e84..696443f9390cd0 100644 --- a/test/parallel/test-http-outgoing-end-multiple.js +++ b/test/parallel/test-http-outgoing-end-multiple.js @@ -9,10 +9,13 @@ const onWriteAfterEndError = common.mustCall((err) => { const server = http.createServer(common.mustCall(function(req, res) { res.end('testing ended state', common.mustCall()); + assert.strictEqual(res.writableCorked, 0); res.end(common.mustCall((err) => { assert.strictEqual(err.code, 'ERR_STREAM_ALREADY_FINISHED'); })); + assert.strictEqual(res.writableCorked, 0); res.end('end', onWriteAfterEndError); + assert.strictEqual(res.writableCorked, 0); res.on('error', onWriteAfterEndError); res.on('finish', common.mustCall(() => { res.end(common.mustCall((err) => { diff --git a/test/parallel/test-http-outgoing-finished.js b/test/parallel/test-http-outgoing-finished.js new file mode 100644 index 00000000000000..7da1b7429ae946 --- /dev/null +++ b/test/parallel/test-http-outgoing-finished.js @@ -0,0 +1,32 @@ +'use strict'; +const common = require('../common'); +const { finished } = require('stream'); + +const http = require('http'); +const assert = require('assert'); + +const server = http.createServer(function(req, res) { + let closed = false; + res + .on('close', common.mustCall(() => { + closed = true; + finished(res, common.mustCall(() => { + server.close(); + })); + })) + .end(); + finished(res, common.mustCall(() => { + assert.strictEqual(closed, true); + })); + +}).listen(0, function() { + http + .request({ + port: this.address().port, + method: 'GET' + }) + .on('response', function(res) { + res.resume(); + }) + .end(); +}); diff --git a/test/parallel/test-http-req-res-close.js b/test/parallel/test-http-req-res-close.js index 329515ccd76ffb..8a0a9e5ab3fc96 100644 --- a/test/parallel/test-http-req-res-close.js +++ b/test/parallel/test-http-req-res-close.js @@ -4,34 +4,128 @@ const common = require('../common'); const http = require('http'); const assert = require('assert'); -const server = http.Server(common.mustCall((req, res) => { - let resClosed = false; - - res.end(); - let resFinished = false; - res.on('finish', common.mustCall(() => { - resFinished = true; - assert.strictEqual(resClosed, false); - assert.strictEqual(res.destroyed, false); - assert.strictEqual(resClosed, false); +// When the response is ended immediately, `req` should emit `close` +// after `res` +{ + const server = http.Server(common.mustCall((req, res) => { + let resClosed = false; + let reqClosed = false; + + res.end(); + let resFinished = false; + res.on('finish', common.mustCall(() => { + resFinished = true; + assert.strictEqual(resClosed, false); + assert.strictEqual(res.destroyed, false); + assert.strictEqual(resClosed, false); + })); + assert.strictEqual(req.destroyed, false); + res.on('close', common.mustCall(() => { + resClosed = true; + assert.strictEqual(resFinished, true); + assert.strictEqual(reqClosed, false); + assert.strictEqual(res.destroyed, true); + })); + assert.strictEqual(req.destroyed, false); + req.on('end', common.mustCall(() => { + assert.strictEqual(req.destroyed, false); + })); + req.on('close', common.mustCall(() => { + reqClosed = true; + assert.strictEqual(resClosed, true); + assert.strictEqual(req.destroyed, true); + assert.strictEqual(req._readableState.ended, true); + })); + res.socket.on('close', () => server.close()); })); - assert.strictEqual(req.destroyed, false); - res.on('close', common.mustCall(() => { - resClosed = true; - assert.strictEqual(resFinished, true); - assert.strictEqual(res.destroyed, true); + + server.listen(0, common.mustCall(() => { + http.get({ port: server.address().port }, common.mustCall()); })); - assert.strictEqual(req.destroyed, false); - req.on('end', common.mustCall(() => { +} + +// When there's no `data` handler attached to `req`, +// `req` should emit `close` after `res`. +{ + const server = http.Server(common.mustCall((req, res) => { + let resClosed = false; + let reqClosed = false; + + // This time, don't end the response immediately + setTimeout(() => res.end(), 100); + let resFinished = false; + res.on('finish', common.mustCall(() => { + resFinished = true; + assert.strictEqual(resClosed, false); + assert.strictEqual(res.destroyed, false); + assert.strictEqual(resClosed, false); + })); + assert.strictEqual(req.destroyed, false); + res.on('close', common.mustCall(() => { + resClosed = true; + assert.strictEqual(resFinished, true); + assert.strictEqual(reqClosed, false); + assert.strictEqual(res.destroyed, true); + })); assert.strictEqual(req.destroyed, false); + req.on('end', common.mustCall(() => { + assert.strictEqual(req.destroyed, false); + })); + req.on('close', common.mustCall(() => { + reqClosed = true; + assert.strictEqual(resClosed, true); + assert.strictEqual(req.destroyed, true); + assert.strictEqual(req._readableState.ended, true); + })); + res.socket.on('close', () => server.close()); })); - req.on('close', common.mustCall(() => { - assert.strictEqual(req.destroyed, true); - assert.strictEqual(req._readableState.ended, true); + + server.listen(0, common.mustCall(() => { + http.get({ port: server.address().port }, common.mustCall()); })); - res.socket.on('close', () => server.close()); -})); +} + +// When a `data` handler is `attached` to `req` +// (i.e. the server is consuming data from it), `req` should emit `close` +// before `res`. +// https://github.com/nodejs/node/pull/33035 introduced this change in behavior. +// See https://github.com/nodejs/node/pull/33035#issuecomment-751482764 +{ + const server = http.Server(common.mustCall((req, res) => { + let resClosed = false; + let reqClosed = false; -server.listen(0, common.mustCall(() => { - http.get({ port: server.address().port }, common.mustCall()); -})); + // Don't end the response immediately + setTimeout(() => res.end(), 100); + let resFinished = false; + req.on('data', () => {}); + res.on('finish', common.mustCall(() => { + resFinished = true; + assert.strictEqual(resClosed, false); + assert.strictEqual(res.destroyed, false); + assert.strictEqual(resClosed, false); + })); + assert.strictEqual(req.destroyed, false); + res.on('close', common.mustCall(() => { + resClosed = true; + assert.strictEqual(resFinished, true); + assert.strictEqual(reqClosed, true); + assert.strictEqual(res.destroyed, true); + })); + assert.strictEqual(req.destroyed, false); + req.on('end', common.mustCall(() => { + assert.strictEqual(req.destroyed, false); + })); + req.on('close', common.mustCall(() => { + reqClosed = true; + assert.strictEqual(resClosed, false); + assert.strictEqual(req.destroyed, true); + assert.strictEqual(req._readableState.ended, true); + })); + res.socket.on('close', () => server.close()); + })); + + server.listen(0, common.mustCall(() => { + http.get({ port: server.address().port }, common.mustCall()); + })); +} diff --git a/test/parallel/test-http-reuse-socket.js b/test/parallel/test-http-reuse-socket.js new file mode 100644 index 00000000000000..f5cd002fdbf519 --- /dev/null +++ b/test/parallel/test-http-reuse-socket.js @@ -0,0 +1,51 @@ +'use strict'; +const common = require('../common'); +const http = require('http'); +const assert = require('assert'); +const Countdown = require('../common/countdown'); + +// The HEAD:204, GET:200 is the most pathological test case. +// GETs following a 204 response with a content-encoding header failed. +// Responses without bodies and without content-length or encoding caused +// the socket to be closed. +const codes = [204, 200, 200, 304, 200]; +const methods = ['HEAD', 'HEAD', 'GET', 'HEAD', 'GET']; + +const sockets = []; +const agent = new http.Agent(); +agent.maxSockets = 1; + +const countdown = new Countdown(codes.length, () => server.close()); + +const server = http.createServer(common.mustCall((req, res) => { + const code = codes.shift(); + assert.strictEqual(typeof code, 'number'); + assert.ok(code > 0); + res.writeHead(code, {}); + res.end(); +}, codes.length)); + +function nextRequest() { + const request = http.request({ + port: server.address().port, + path: '/', + agent: agent, + method: methods.shift() + }, common.mustCall((response) => { + response.on('end', common.mustCall(() => { + if (countdown.dec()) { + nextRequest(); + } + assert.strictEqual(sockets.length, 1); + })); + response.resume(); + })); + request.on('socket', common.mustCall((socket) => { + if (!sockets.includes(socket)) { + sockets.push(socket); + } + })); + request.end(); +} + +server.listen(0, common.mustCall(nextRequest)); diff --git a/test/parallel/test-http-server-incomingmessage-destroy.js b/test/parallel/test-http-server-incomingmessage-destroy.js deleted file mode 100644 index cfe7e4feecba45..00000000000000 --- a/test/parallel/test-http-server-incomingmessage-destroy.js +++ /dev/null @@ -1,25 +0,0 @@ -'use strict'; - -const common = require('../common'); -const { createServer, get } = require('http'); -const assert = require('assert'); - -const server = createServer(common.mustCall((req, res) => { - req.destroy(new Error('Destroy test')); -})); - -function onUncaught(error) {} - -process.on('uncaughtException', common.mustNotCall(onUncaught)); - -server.listen(0, common.mustCall(() => { - get({ - port: server.address().port - }, (res) => { - res.resume(); - }).on('error', (error) => { - assert.strictEqual(error.message, 'socket hang up'); - assert.strictEqual(error.code, 'ECONNRESET'); - server.close(); - }); -})); diff --git a/test/parallel/test-memory-usage-emfile.js b/test/parallel/test-memory-usage-emfile.js index 8dc1360d985bde..05b112e91803d1 100644 --- a/test/parallel/test-memory-usage-emfile.js +++ b/test/parallel/test-memory-usage-emfile.js @@ -14,5 +14,5 @@ const files = []; while (files.length < 256) files.push(fs.openSync(__filename, 'r')); -const r = process.memoryUsage(); -assert.strictEqual(r.rss > 0, true); +const r = process.memoryUsage.rss(); +assert.strictEqual(r > 0, true); diff --git a/test/parallel/test-memory-usage.js b/test/parallel/test-memory-usage.js index e8743c47d235c0..8e5ea4de5bf587 100644 --- a/test/parallel/test-memory-usage.js +++ b/test/parallel/test-memory-usage.js @@ -26,8 +26,11 @@ const assert = require('assert'); const r = process.memoryUsage(); // On IBMi, the rss memory always returns zero -if (!common.isIBMi) +if (!common.isIBMi) { assert.ok(r.rss > 0); + assert.ok(process.memoryUsage.rss() > 0); +} + assert.ok(r.heapTotal > 0); assert.ok(r.heapUsed > 0); assert.ok(r.external > 0); @@ -39,8 +42,8 @@ if (r.arrayBuffers > 0) { const ab = new ArrayBuffer(size); const after = process.memoryUsage(); - assert(after.external - r.external >= size, - `${after.external} - ${r.external} >= ${size}`); + assert.ok(after.external - r.external >= size, + `${after.external} - ${r.external} >= ${size}`); assert.strictEqual(after.arrayBuffers - r.arrayBuffers, size, `${after.arrayBuffers} - ${r.arrayBuffers} === ${size}`); } diff --git a/test/parallel/test-net-server-listen-options-signal.js b/test/parallel/test-net-server-listen-options-signal.js new file mode 100644 index 00000000000000..80efaf1700cd75 --- /dev/null +++ b/test/parallel/test-net-server-listen-options-signal.js @@ -0,0 +1,33 @@ +'use strict'; +const common = require('../common'); +const assert = require('assert'); +const net = require('net'); + +{ + // Test bad signal. + const server = net.createServer(); + assert.throws( + () => server.listen({ port: 0, signal: 'INVALID_SIGNAL' }), + { + code: 'ERR_INVALID_ARG_TYPE', + name: 'TypeError' + }); +} + +{ + // Test close. + const server = net.createServer(); + const controller = new AbortController(); + server.on('close', common.mustCall()); + server.listen({ port: 0, signal: controller.signal }); + controller.abort(); +} + +{ + // Test close with pre-aborted signal. + const server = net.createServer(); + const controller = new AbortController(); + controller.abort(); + server.on('close', common.mustCall()); + server.listen({ port: 0, signal: controller.signal }); +} diff --git a/test/parallel/test-priority-queue.js b/test/parallel/test-priority-queue.js index f6318ede7ffbca..b98d228b08763b 100644 --- a/test/parallel/test-priority-queue.js +++ b/test/parallel/test-priority-queue.js @@ -43,27 +43,6 @@ const PriorityQueue = require('internal/priority_queue'); assert.strictEqual(queue.shift(), undefined); } -{ - // Checks that remove works as expected. - const queue = new PriorityQueue(); - for (let i = 16; i > 0; i--) - queue.insert(i); - - const removed = [5, 10, 15]; - for (const id of removed) - assert(queue.remove(id)); - - assert(!queue.remove(100)); - assert(!queue.remove(-100)); - - for (let i = 1; i < 17; i++) { - if (removed.indexOf(i) < 0) - assert.strictEqual(queue.shift(), i); - } - - assert.strictEqual(queue.shift(), undefined); -} - { // Make a max heap with a custom sort function. const queue = new PriorityQueue((a, b) => b - a); diff --git a/test/parallel/test-process-env-allowed-flags-are-documented.js b/test/parallel/test-process-env-allowed-flags-are-documented.js index 6f4537bd3e88fa..d830abb7ce4d51 100644 --- a/test/parallel/test-process-env-allowed-flags-are-documented.js +++ b/test/parallel/test-process-env-allowed-flags-are-documented.js @@ -43,8 +43,14 @@ for (const line of [...nodeOptionsLines, ...v8OptionsLines]) { const conditionalOpts = [ { include: common.hasCrypto, filter: (opt) => { - return ['--openssl-config', '--tls-cipher-list', '--use-bundled-ca', - '--use-openssl-ca' ].includes(opt); + return [ + '--openssl-config', + '--tls-cipher-list', + '--use-bundled-ca', + '--use-openssl-ca', + '--secure-heap', + '--secure-heap-min', + ].includes(opt); } }, { // We are using openssl_is_fips from the configuration because it could be diff --git a/test/parallel/test-process-uid-gid.js b/test/parallel/test-process-uid-gid.js index 6ca2e009571ef0..0e170620b7f237 100644 --- a/test/parallel/test-process-uid-gid.js +++ b/test/parallel/test-process-uid-gid.js @@ -51,6 +51,13 @@ assert.throws(() => { message: 'User identifier does not exist: fhqwhgadshgnsdhjsdbkhsdabkfabkveyb' }); +// Passing -0 shouldn't crash the process +// Refs: https://github.com/nodejs/node/issues/32750 +try { process.setuid(-0); } catch {} +try { process.seteuid(-0); } catch {} +try { process.setgid(-0); } catch {} +try { process.setegid(-0); } catch {} + // If we're not running as super user... if (process.getuid() !== 0) { // Should not throw. @@ -79,6 +86,7 @@ try { } process.setgid('nogroup'); } + const newgid = process.getgid(); assert.notStrictEqual(newgid, oldgid); diff --git a/test/parallel/test-repl-array-prototype-tempering.js b/test/parallel/test-repl-array-prototype-tempering.js new file mode 100644 index 00000000000000..907a6396ebeaef --- /dev/null +++ b/test/parallel/test-repl-array-prototype-tempering.js @@ -0,0 +1,66 @@ +'use strict'; +const common = require('../common'); +const assert = require('assert'); +const { spawn } = require('child_process'); + +const replProcess = spawn(process.argv0, ['--interactive'], { + stdio: ['pipe', 'pipe', 'inherit'], + windowsHide: true, +}); + +replProcess.on('error', common.mustNotCall()); + +const replReadyState = (async function* () { + let ready; + const SPACE = ' '.charCodeAt(); + const BRACKET = '>'.charCodeAt(); + const DOT = '.'.charCodeAt(); + replProcess.stdout.on('data', (data) => { + ready = data[data.length - 1] === SPACE && ( + data[data.length - 2] === BRACKET || ( + data[data.length - 2] === DOT && + data[data.length - 3] === DOT && + data[data.length - 4] === DOT + )); + }); + + const processCrashed = new Promise((resolve, reject) => + replProcess.on('exit', reject) + ); + while (true) { + await Promise.race([new Promise(setImmediate), processCrashed]); + if (ready) { + ready = false; + yield; + } + } +})(); +async function writeLn(data, expectedOutput) { + await replReadyState.next(); + if (expectedOutput) { + replProcess.stdout.once('data', common.mustCall((data) => + assert.match(data.toString('utf8'), expectedOutput) + )); + } + await new Promise((resolve, reject) => replProcess.stdin.write( + `${data}\n`, + (err) => (err ? reject(err) : resolve()) + )); +} + +async function main() { + await writeLn( + 'Object.defineProperty(Array.prototype, "-1", ' + + '{ get() { return this[this.length - 1]; } });' + ); + + await writeLn( + '[3, 2, 1][-1];', + /^1\n(>\s)?$/ + ); + await writeLn('.exit'); + + assert(!replProcess.connected); +} + +main().then(common.mustCall()); diff --git a/test/parallel/test-repl-no-terminal.js b/test/parallel/test-repl-no-terminal.js new file mode 100644 index 00000000000000..60f97b52e26942 --- /dev/null +++ b/test/parallel/test-repl-no-terminal.js @@ -0,0 +1,7 @@ +'use strict'; +const common = require('../common'); + +const repl = require('repl'); +const r = repl.start({ terminal: false }); +r.setupHistory('/nonexistent/file', common.mustSucceed()); +process.stdin.unref?.(); diff --git a/test/parallel/test-require-delete-array-iterator.js b/test/parallel/test-require-delete-array-iterator.js new file mode 100644 index 00000000000000..5424ef8b75da9d --- /dev/null +++ b/test/parallel/test-require-delete-array-iterator.js @@ -0,0 +1,13 @@ +'use strict'; + +const common = require('../common'); + + +const ArrayIteratorPrototype = + Object.getPrototypeOf(Array.prototype[Symbol.iterator]()); + +delete Array.prototype[Symbol.iterator]; +delete ArrayIteratorPrototype.next; + +require('../common/fixtures'); +import('../fixtures/es-modules/test-esm-ok.mjs').then(common.mustCall()); diff --git a/test/parallel/test-stdin-from-file-spawn.js b/test/parallel/test-stdin-from-file-spawn.js new file mode 100644 index 00000000000000..12c235fcfeb081 --- /dev/null +++ b/test/parallel/test-stdin-from-file-spawn.js @@ -0,0 +1,42 @@ +'use strict'; +const common = require('../common'); +const process = require('process'); + +let defaultShell; +if (process.platform === 'linux' || process.platform === 'darwin') { + defaultShell = '/bin/sh'; +} else if (process.platform === 'win32') { + defaultShell = 'cmd.exe'; +} else { + common.skip('This is test exists only on Linux/Win32/OSX'); +} + +const { execSync } = require('child_process'); +const fs = require('fs'); +const path = require('path'); +const tmpdir = require('../common/tmpdir'); + +const tmpDir = tmpdir.path; +tmpdir.refresh(); +const tmpCmdFile = path.join(tmpDir, 'test-stdin-from-file-spawn-cmd'); +const tmpJsFile = path.join(tmpDir, 'test-stdin-from-file-spawn.js'); +fs.writeFileSync(tmpCmdFile, 'echo hello'); +fs.writeFileSync(tmpJsFile, ` +'use strict'; +const { spawn } = require('child_process'); +// Reference the object to invoke the getter +process.stdin; +setTimeout(() => { + let ok = false; + const child = spawn(process.env.SHELL || '${defaultShell}', + [], { stdio: ['inherit', 'pipe'] }); + child.stdout.on('data', () => { + ok = true; + }); + child.on('close', () => { + process.exit(ok ? 0 : -1); + }); +}, 100); +`); + +execSync(`${process.argv[0]} ${tmpJsFile} < ${tmpCmdFile}`); diff --git a/test/parallel/test-stream-aliases-legacy.js b/test/parallel/test-stream-aliases-legacy.js new file mode 100644 index 00000000000000..2c87f0ad0fa4a4 --- /dev/null +++ b/test/parallel/test-stream-aliases-legacy.js @@ -0,0 +1,14 @@ +'use strict'; + +require('../common'); + +const assert = require('assert'); +const stream = require('stream'); + +// Verify that all individual aliases are left in place. + +assert.strictEqual(stream.Readable, require('_stream_readable')); +assert.strictEqual(stream.Writable, require('_stream_writable')); +assert.strictEqual(stream.Duplex, require('_stream_duplex')); +assert.strictEqual(stream.Transform, require('_stream_transform')); +assert.strictEqual(stream.PassThrough, require('_stream_passthrough')); diff --git a/test/parallel/test-stream-construct.js b/test/parallel/test-stream-construct.js index 9b38f30a01f8c2..907b9aa0e3e296 100644 --- a/test/parallel/test-stream-construct.js +++ b/test/parallel/test-stream-construct.js @@ -268,3 +268,13 @@ testDestroy((opts) => new Writable({ assert.strictEqual(constructed, true); })); } + +{ + // Construct should not cause stream to read. + new Readable({ + construct: common.mustCall((callback) => { + callback(); + }), + read: common.mustNotCall() + }); +} diff --git a/test/parallel/test-stream-finished.js b/test/parallel/test-stream-finished.js index 7dc26dcbeb6afa..a495bbe2861170 100644 --- a/test/parallel/test-stream-finished.js +++ b/test/parallel/test-stream-finished.js @@ -492,3 +492,26 @@ testClosed((opts) => new Writable({ write() {}, ...opts })); .on('response', common.mustCall()); }); } + + +{ + const w = new Writable({ + write(chunk, encoding, callback) { + process.nextTick(callback); + } + }); + w.aborted = false; + w.end(); + let closed = false; + w.on('finish', () => { + assert.strictEqual(closed, false); + w.emit('aborted'); + }); + w.on('close', common.mustCall(() => { + closed = true; + })); + + finished(w, common.mustCall(() => { + assert.strictEqual(closed, true); + })); +} diff --git a/test/parallel/test-stream-pipe-after-end.js b/test/parallel/test-stream-pipe-after-end.js index 2eb714b2ca7d3e..045d27e0855374 100644 --- a/test/parallel/test-stream-pipe-after-end.js +++ b/test/parallel/test-stream-pipe-after-end.js @@ -22,8 +22,7 @@ 'use strict'; const common = require('../common'); const assert = require('assert'); -const Readable = require('_stream_readable'); -const Writable = require('_stream_writable'); +const { Readable, Writable } = require('stream'); class TestReadable extends Readable { constructor(opt) { diff --git a/test/parallel/test-stream-pipe-needDrain.js b/test/parallel/test-stream-pipe-needDrain.js index 0836c81da22438..7faf45417a5f4a 100644 --- a/test/parallel/test-stream-pipe-needDrain.js +++ b/test/parallel/test-stream-pipe-needDrain.js @@ -2,8 +2,7 @@ const common = require('../common'); const assert = require('assert'); -const Readable = require('_stream_readable'); -const Writable = require('_stream_writable'); +const { Readable, Writable } = require('stream'); // Pipe should pause temporarily if writable needs drain. { diff --git a/test/parallel/test-stream-writable-end-cb-error.js b/test/parallel/test-stream-writable-end-cb-error.js index 8f6d209954436f..20428f1777fd17 100644 --- a/test/parallel/test-stream-writable-end-cb-error.js +++ b/test/parallel/test-stream-writable-end-cb-error.js @@ -46,3 +46,38 @@ const stream = require('stream'); writable.emit('error', new Error('kaboom')); })); } + +{ + const w = new stream.Writable({ + write(chunk, encoding, callback) { + setImmediate(callback); + }, + finish(callback) { + setImmediate(callback); + } + }); + w.end('testing ended state', common.mustCall((err) => { + // This errors since .destroy(err), which is invoked by errors + // in same tick below, will error all pending callbacks. + // Does this make sense? Not sure. + assert.strictEqual(err.code, 'ERR_STREAM_DESTROYED'); + })); + assert.strictEqual(w.destroyed, false); + assert.strictEqual(w.writableEnded, true); + w.end(common.mustCall((err) => { + // This errors since .destroy(err), which is invoked by errors + // in same tick below, will error all pending callbacks. + // Does this make sense? Not sure. + assert.strictEqual(err.code, 'ERR_STREAM_DESTROYED'); + })); + assert.strictEqual(w.destroyed, false); + assert.strictEqual(w.writableEnded, true); + w.end('end', common.mustCall((err) => { + assert.strictEqual(err.code, 'ERR_STREAM_WRITE_AFTER_END'); + })); + assert.strictEqual(w.destroyed, true); + w.on('error', common.mustCall((err) => { + assert.strictEqual(err.code, 'ERR_STREAM_WRITE_AFTER_END'); + })); + w.on('finish', common.mustNotCall()); +} diff --git a/test/parallel/test-stream2-base64-single-char-read-end.js b/test/parallel/test-stream2-base64-single-char-read-end.js index 10259e280454c0..2e1eb15f9fd010 100644 --- a/test/parallel/test-stream2-base64-single-char-read-end.js +++ b/test/parallel/test-stream2-base64-single-char-read-end.js @@ -21,8 +21,7 @@ 'use strict'; require('../common'); -const R = require('_stream_readable'); -const W = require('_stream_writable'); +const { Readable: R, Writable: W } = require('stream'); const assert = require('assert'); const src = new R({ encoding: 'base64' }); diff --git a/test/parallel/test-stream2-basic.js b/test/parallel/test-stream2-basic.js index 7121f7bda75b02..862e45417626c8 100644 --- a/test/parallel/test-stream2-basic.js +++ b/test/parallel/test-stream2-basic.js @@ -22,8 +22,7 @@ 'use strict'; const common = require('../common'); -const R = require('_stream_readable'); -const W = require('_stream_writable'); +const { Readable: R, Writable: W } = require('stream'); const assert = require('assert'); const EE = require('events').EventEmitter; diff --git a/test/parallel/test-stream2-compatibility.js b/test/parallel/test-stream2-compatibility.js index bd0314ec1a9918..d760db8b32271c 100644 --- a/test/parallel/test-stream2-compatibility.js +++ b/test/parallel/test-stream2-compatibility.js @@ -21,8 +21,7 @@ 'use strict'; require('../common'); -const R = require('_stream_readable'); -const W = require('_stream_writable'); +const { Readable: R, Writable: W } = require('stream'); const assert = require('assert'); let ondataCalled = 0; diff --git a/test/parallel/test-stream2-decode-partial.js b/test/parallel/test-stream2-decode-partial.js index 9b1baf7fd677f4..9d9ae21bfec7ae 100644 --- a/test/parallel/test-stream2-decode-partial.js +++ b/test/parallel/test-stream2-decode-partial.js @@ -1,6 +1,6 @@ 'use strict'; require('../common'); -const Readable = require('_stream_readable'); +const { Readable } = require('stream'); const assert = require('assert'); let buf = ''; diff --git a/test/parallel/test-stream2-objects.js b/test/parallel/test-stream2-objects.js index f58ea4a32a1e7d..a6723daca6c761 100644 --- a/test/parallel/test-stream2-objects.js +++ b/test/parallel/test-stream2-objects.js @@ -22,8 +22,7 @@ 'use strict'; const common = require('../common'); -const Readable = require('_stream_readable'); -const Writable = require('_stream_writable'); +const { Readable, Writable } = require('stream'); const assert = require('assert'); function toArray(callback) { diff --git a/test/parallel/test-stream2-readable-from-list.js b/test/parallel/test-stream2-readable-from-list.js index 6564a01691f09e..d5d113304e4925 100644 --- a/test/parallel/test-stream2-readable-from-list.js +++ b/test/parallel/test-stream2-readable-from-list.js @@ -23,7 +23,7 @@ 'use strict'; require('../common'); const assert = require('assert'); -const fromList = require('_stream_readable')._fromList; +const fromList = require('stream').Readable._fromList; const BufferList = require('internal/streams/buffer_list'); const util = require('util'); diff --git a/test/parallel/test-stream2-readable-non-empty-end.js b/test/parallel/test-stream2-readable-non-empty-end.js index ba289fb91275e3..417f2c3b0e92e3 100644 --- a/test/parallel/test-stream2-readable-non-empty-end.js +++ b/test/parallel/test-stream2-readable-non-empty-end.js @@ -22,7 +22,7 @@ 'use strict'; const common = require('../common'); const assert = require('assert'); -const Readable = require('_stream_readable'); +const { Readable } = require('stream'); let len = 0; const chunks = new Array(10); diff --git a/test/parallel/test-stream2-readable-wrap-destroy.js b/test/parallel/test-stream2-readable-wrap-destroy.js index b0f4714c741202..e310ae09e6ff53 100644 --- a/test/parallel/test-stream2-readable-wrap-destroy.js +++ b/test/parallel/test-stream2-readable-wrap-destroy.js @@ -1,7 +1,7 @@ 'use strict'; const common = require('../common'); -const Readable = require('_stream_readable'); +const { Readable } = require('stream'); const EE = require('events').EventEmitter; const oldStream = new EE(); diff --git a/test/parallel/test-stream2-readable-wrap-empty.js b/test/parallel/test-stream2-readable-wrap-empty.js index 1489717f3e49c3..3dbbdaa9b5afbf 100644 --- a/test/parallel/test-stream2-readable-wrap-empty.js +++ b/test/parallel/test-stream2-readable-wrap-empty.js @@ -22,7 +22,7 @@ 'use strict'; const common = require('../common'); -const Readable = require('_stream_readable'); +const { Readable } = require('stream'); const EE = require('events').EventEmitter; const oldStream = new EE(); diff --git a/test/parallel/test-stream2-readable-wrap-error.js b/test/parallel/test-stream2-readable-wrap-error.js index a05ae8179b06ef..2d2c26e2cadc46 100644 --- a/test/parallel/test-stream2-readable-wrap-error.js +++ b/test/parallel/test-stream2-readable-wrap-error.js @@ -2,7 +2,7 @@ const common = require('../common'); const assert = require('assert'); -const Readable = require('_stream_readable'); +const { Readable } = require('stream'); const EE = require('events').EventEmitter; class LegacyStream extends EE { diff --git a/test/parallel/test-stream2-readable-wrap.js b/test/parallel/test-stream2-readable-wrap.js index 69f055fd7e535e..eebe72bc0dd8ad 100644 --- a/test/parallel/test-stream2-readable-wrap.js +++ b/test/parallel/test-stream2-readable-wrap.js @@ -22,8 +22,7 @@ 'use strict'; const common = require('../common'); const assert = require('assert'); -const Readable = require('_stream_readable'); -const Writable = require('_stream_writable'); +const { Readable, Writable } = require('stream'); const EE = require('events').EventEmitter; function runTest(highWaterMark, objectMode, produce) { diff --git a/test/parallel/test-stream2-set-encoding.js b/test/parallel/test-stream2-set-encoding.js index 0095fa544db114..2d35b161bf0143 100644 --- a/test/parallel/test-stream2-set-encoding.js +++ b/test/parallel/test-stream2-set-encoding.js @@ -22,7 +22,7 @@ 'use strict'; const common = require('../common'); const assert = require('assert'); -const R = require('_stream_readable'); +const { Readable: R } = require('stream'); class TestReader extends R { constructor(n, opts) { diff --git a/test/parallel/test-stream2-transform.js b/test/parallel/test-stream2-transform.js index ad9e1a2237bd72..fe27c1c1b6ddcf 100644 --- a/test/parallel/test-stream2-transform.js +++ b/test/parallel/test-stream2-transform.js @@ -22,8 +22,7 @@ 'use strict'; const common = require('../common'); const assert = require('assert'); -const PassThrough = require('_stream_passthrough'); -const Transform = require('_stream_transform'); +const { PassThrough, Transform } = require('stream'); { // Verify writable side consumption diff --git a/test/parallel/test-stream2-writable.js b/test/parallel/test-stream2-writable.js index 03835bb1bd0465..3d16fb62df3313 100644 --- a/test/parallel/test-stream2-writable.js +++ b/test/parallel/test-stream2-writable.js @@ -22,8 +22,7 @@ 'use strict'; const common = require('../common'); -const W = require('_stream_writable'); -const D = require('_stream_duplex'); +const { Writable: W, Duplex: D } = require('stream'); const assert = require('assert'); class TestWriter extends W { diff --git a/test/parallel/test-string-decoder.js b/test/parallel/test-string-decoder.js index 1fbf9b572cc2f8..be876f46e5af02 100644 --- a/test/parallel/test-string-decoder.js +++ b/test/parallel/test-string-decoder.js @@ -201,6 +201,15 @@ assert.throws( } ); +if (common.enoughTestMem) { + assert.throws( + () => new StringDecoder().write(Buffer.alloc(0x1fffffe8 + 1).fill('a')), + { + code: 'ERR_STRING_TOO_LONG', + } + ); +} + // Test verifies that StringDecoder will correctly decode the given input // buffer with the given encoding to the expected output. It will attempt all // possible ways to write() the input buffer, see writeSequences(). The diff --git a/test/parallel/test-url-format.js b/test/parallel/test-url-format.js index 2d0132eb38a0bb..720a10a97a979b 100644 --- a/test/parallel/test-url-format.js +++ b/test/parallel/test-url-format.js @@ -148,6 +148,12 @@ const formatTests = { host: '[fedc:ba98:7654:3210:fedc:ba98:7654:3210]:61616', pathname: '/s/stopButton' }, + 'http://[::]/': { + href: 'http://[::]/', + protocol: 'http:', + hostname: '[::]', + pathname: '/' + }, // Encode context-specific delimiters in path and query, but do not touch // other non-delimiter chars like `%`. diff --git a/test/parallel/test-util-inspect.js b/test/parallel/test-util-inspect.js index b14cab3d13358a..4e4ef3f30df952 100644 --- a/test/parallel/test-util-inspect.js +++ b/test/parallel/test-util-inspect.js @@ -2011,6 +2011,11 @@ assert.strictEqual(util.inspect('"\'${a}'), "'\"\\'${a}'"); rest[rest.length - 1] = rest[rest.length - 1].slice(0, -1); rest.length = 1; } + Object.setPrototypeOf(clazz, Map.prototype); + assert.strictEqual( + util.inspect(clazz), + ['[class', name, '[Map]', ...rest].join(' ') + ']' + ); Object.setPrototypeOf(clazz, null); assert.strictEqual( util.inspect(clazz), @@ -3054,3 +3059,22 @@ assert.strictEqual( Object.setPrototypeOf(generatorPrototype, originalProtoOfProto); assert.strictEqual(getProtoOfProto(), originalProtoOfProto); } + +{ + // Test for when breakLength results in a single column. + const obj = Array(9).fill('fhqwhgadshgnsdhjsdbkhsdabkfabkveybvf'); + assert.strictEqual( + util.inspect(obj, { breakLength: 256 }), + '[\n' + + " 'fhqwhgadshgnsdhjsdbkhsdabkfabkveybvf',\n" + + " 'fhqwhgadshgnsdhjsdbkhsdabkfabkveybvf',\n" + + " 'fhqwhgadshgnsdhjsdbkhsdabkfabkveybvf',\n" + + " 'fhqwhgadshgnsdhjsdbkhsdabkfabkveybvf',\n" + + " 'fhqwhgadshgnsdhjsdbkhsdabkfabkveybvf',\n" + + " 'fhqwhgadshgnsdhjsdbkhsdabkfabkveybvf',\n" + + " 'fhqwhgadshgnsdhjsdbkhsdabkfabkveybvf',\n" + + " 'fhqwhgadshgnsdhjsdbkhsdabkfabkveybvf',\n" + + " 'fhqwhgadshgnsdhjsdbkhsdabkfabkveybvf'\n" + + ']' + ); +} diff --git a/test/parallel/test-v8-serdes.js b/test/parallel/test-v8-serdes.js index 593fb34ad73594..7485aa19a7d3d9 100644 --- a/test/parallel/test-v8-serdes.js +++ b/test/parallel/test-v8-serdes.js @@ -25,11 +25,6 @@ const objects = [ const hostObject = new (internalBinding('js_stream').JSStream)(); -const serializerTypeError = - /^TypeError: Class constructor Serializer cannot be invoked without 'new'$/; -const deserializerTypeError = - /^TypeError: Class constructor Deserializer cannot be invoked without 'new'$/; - { const ser = new v8.DefaultSerializer(); ser.writeHeader(); @@ -186,8 +181,16 @@ const deserializerTypeError = } { - assert.throws(v8.Serializer, serializerTypeError); - assert.throws(v8.Deserializer, deserializerTypeError); + assert.throws(() => v8.Serializer(), { + constructor: TypeError, + message: "Class constructor Serializer cannot be invoked without 'new'", + code: 'ERR_CONSTRUCT_CALL_REQUIRED' + }); + assert.throws(() => v8.Deserializer(), { + constructor: TypeError, + message: "Class constructor Deserializer cannot be invoked without 'new'", + code: 'ERR_CONSTRUCT_CALL_REQUIRED' + }); } diff --git a/test/parallel/test-zlib-no-stream.js b/test/parallel/test-zlib-no-stream.js new file mode 100644 index 00000000000000..68da269ab8f57e --- /dev/null +++ b/test/parallel/test-zlib-no-stream.js @@ -0,0 +1,14 @@ +/* eslint-disable node-core/required-modules */ +/* eslint-disable node-core/require-common-first */ + +'use strict'; + +// We are not loading common because it will load the stream module, +// defeating the purpose of this test. + +const { gzipSync } = require('zlib'); + +// Avoid regressions such as https://github.com/nodejs/node/issues/36615 + +// This must not throw +gzipSync('fooobar'); diff --git a/test/pummel/test-vm-memleak.js b/test/pummel/test-vm-memleak.js index a433ab6565e147..568b37d8f6850f 100644 --- a/test/pummel/test-vm-memleak.js +++ b/test/pummel/test-vm-memleak.js @@ -34,7 +34,7 @@ const interval = setInterval(function() { } catch { } - const rss = process.memoryUsage().rss; + const rss = process.memoryUsage.rss(); assert.ok(rss < 64 * 1024 * 1024, `memory usage: ${Math.round(rss / (1024 * 1024))}Mb`); diff --git a/tools/doc/common.js b/tools/doc/common.js index 11e4ad6e2c99aa..ae8a392f010d17 100644 --- a/tools/doc/common.js +++ b/tools/doc/common.js @@ -1,7 +1,6 @@ 'use strict'; -const yaml = - require(`${__dirname}/../node_modules/eslint/node_modules/js-yaml`); +const yaml = require('js-yaml'); function isYAMLBlock(text) { return /^$/, ''); - // js-yaml.safeLoad() throws on error. - const meta = yaml.safeLoad(text); + // js-yaml.load() throws on error. + const meta = yaml.load(text); if (meta.added) { // Since semver-minors can trickle down to previous major versions, diff --git a/tools/doc/package-lock.json b/tools/doc/package-lock.json index 40c07c350b3e24..e93d935aece6c1 100644 --- a/tools/doc/package-lock.json +++ b/tools/doc/package-lock.json @@ -11,8 +11,8 @@ "node-doc-generator": "generate.js" }, "devDependencies": { - "highlight.js": "10.4.1", - "js-yaml": "3.14.0", + "highlight.js": "10.5.0", + "js-yaml": "4.0.0", "rehype-raw": "5.0.0", "rehype-stringify": "8.0.0", "remark-gfm": "^1.0.0", @@ -22,7 +22,7 @@ "to-vfile": "6.1.0", "unified": "9.2.0", "unist-util-find": "^1.0.2", - "unist-util-select": "3.0.3", + "unist-util-select": "3.0.4", "unist-util-visit": "2.0.3" }, "engines": { @@ -60,13 +60,10 @@ "dev": true }, "node_modules/argparse": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "dev": true, - "dependencies": { - "sprintf-js": "~1.0.2" - } + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true }, "node_modules/bail": { "version": "1.0.5", @@ -167,19 +164,6 @@ } } }, - "node_modules/esprima": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", - "dev": true, - "bin": { - "esparse": "bin/esparse.js", - "esvalidate": "bin/esvalidate.js" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/extend": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", @@ -345,9 +329,9 @@ } }, "node_modules/highlight.js": { - "version": "10.4.1", - "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-10.4.1.tgz", - "integrity": "sha512-yR5lWvNz7c85OhVAEAeFhVCc/GV4C30Fjzc/rCP0aCWzc1UUOPUk55dK/qdwTZHBvMZo+eZ2jpk62ndX/xMFlg==", + "version": "10.5.0", + "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-10.5.0.tgz", + "integrity": "sha512-xTmvd9HiIHR6L53TMC7TKolEj65zG1XU+Onr8oi86mYa+nLcIbxTTWkpW7CsEwv/vK7u1zb8alZIMLDqqN6KTw==", "dev": true, "engines": { "node": "*" @@ -446,13 +430,12 @@ } }, "node_modules/js-yaml": { - "version": "3.14.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.0.tgz", - "integrity": "sha512-/4IbIeHcD9VMHFqDR/gQ7EdZdLimOvW2DdcxFjdyyZ9NsbS+ccrXqVWDtab/lRl5AlUqmpBx8EhPaWR+OtY17A==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.0.0.tgz", + "integrity": "sha512-pqon0s+4ScYUvX30wxQi3PogGFAlUyH0awepWvwkj4jD4v+ova3RiYw8bmA6x2rDrEaj8i/oWKoRxpVNW+Re8Q==", "dev": true, "dependencies": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" + "argparse": "^2.0.1" }, "bin": { "js-yaml": "bin/js-yaml.js" @@ -501,41 +484,33 @@ } }, "node_modules/mdast-util-from-markdown": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/mdast-util-from-markdown/-/mdast-util-from-markdown-0.8.1.tgz", - "integrity": "sha512-qJXNcFcuCSPqUF0Tb0uYcFDIq67qwB3sxo9RPdf9vG8T90ViKnksFqdB/Coq2a7sTnxL/Ify2y7aIQXDkQFH0w==", + "version": "0.8.4", + "resolved": "https://registry.npmjs.org/mdast-util-from-markdown/-/mdast-util-from-markdown-0.8.4.tgz", + "integrity": "sha512-jj891B5pV2r63n2kBTFh8cRI2uR9LQHsXG1zSDqfhXkIlDzrTcIlbB5+5aaYEkl8vOPIOPLf8VT7Ere1wWTMdw==", "dev": true, "dependencies": { "@types/mdast": "^3.0.0", - "mdast-util-to-string": "^1.0.0", - "micromark": "~2.10.0", - "parse-entities": "^2.0.0" + "mdast-util-to-string": "^2.0.0", + "micromark": "~2.11.0", + "parse-entities": "^2.0.0", + "unist-util-stringify-position": "^2.0.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/unified" } }, - "node_modules/mdast-util-from-markdown/node_modules/mdast-util-to-string": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/mdast-util-to-string/-/mdast-util-to-string-1.1.0.tgz", - "integrity": "sha512-jVU0Nr2B9X3MU4tSK7JP1CMkSvOj7X5l/GboG1tKRw52lLF1x2Ju92Ms9tNetCcbfX3hzlM73zYo2NKkWSfF/A==", - "dev": true, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, "node_modules/mdast-util-gfm": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/mdast-util-gfm/-/mdast-util-gfm-0.1.0.tgz", - "integrity": "sha512-HLfygQL6HdhJhFbLta4Ki9hClrzyAxRjyRvpm5caN65QZL+NyHPmqFlnF9vm1Rn58JT2+AbLwNcEDY4MEvkk8Q==", + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/mdast-util-gfm/-/mdast-util-gfm-0.1.1.tgz", + "integrity": "sha512-oE1W1zSXU2L2LHg91V22HC3Z1fbsOZTBYUQq+kpM29f9297TbRm0C1l3bQ88RREl0WaUQaB49G7trvwy5utUKQ==", "dev": true, "dependencies": { "mdast-util-gfm-autolink-literal": "^0.1.0", "mdast-util-gfm-strikethrough": "^0.2.0", "mdast-util-gfm-table": "^0.1.0", - "mdast-util-gfm-task-list-item": "^0.1.0" + "mdast-util-gfm-task-list-item": "^0.1.0", + "mdast-util-to-markdown": "^0.6.1" }, "funding": { "type": "opencollective", @@ -543,9 +518,9 @@ } }, "node_modules/mdast-util-gfm-autolink-literal": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/mdast-util-gfm-autolink-literal/-/mdast-util-gfm-autolink-literal-0.1.1.tgz", - "integrity": "sha512-gJ2xSpqKCetSr22GEWpZH3f5ffb4pPn/72m4piY0v7T/S+O7n7rw+sfoPLhb2b4O7WdnERoYdALRcmD68FMtlw==", + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-autolink-literal/-/mdast-util-gfm-autolink-literal-0.1.2.tgz", + "integrity": "sha512-WFeIrcNNsfBety0gyWuiBIPing9UkVcl/m2iZOyW1uHEH2evjFocet2h77M24ub0WyZ4ucnQn/jWhO5Ozl6j4g==", "dev": true, "funding": { "type": "opencollective", @@ -553,12 +528,12 @@ } }, "node_modules/mdast-util-gfm-strikethrough": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/mdast-util-gfm-strikethrough/-/mdast-util-gfm-strikethrough-0.2.2.tgz", - "integrity": "sha512-T37ZbaokJcRbHROXmoVAieWnesPD5N21tv2ifYzaGRLbkh1gknItUGhZzHefUn5Zc/eaO/iTDSAFOBrn/E8kWw==", + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-strikethrough/-/mdast-util-gfm-strikethrough-0.2.3.tgz", + "integrity": "sha512-5OQLXpt6qdbttcDG/UxYY7Yjj3e8P7X16LzvpX8pIQPYJ/C2Z1qFGMmcw+1PZMUM3Z8wt8NRfYTvCni93mgsgA==", "dev": true, "dependencies": { - "mdast-util-to-markdown": "^0.5.0" + "mdast-util-to-markdown": "^0.6.0" }, "funding": { "type": "opencollective", @@ -566,13 +541,13 @@ } }, "node_modules/mdast-util-gfm-table": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/mdast-util-gfm-table/-/mdast-util-gfm-table-0.1.4.tgz", - "integrity": "sha512-T4xFSON9kUb/IpYA5N+KGWcsdGczAvILvKiXQwUGind6V9fvjPCR9yhZnIeaLdBWXaz3m/Gq77ZtuLMjtFR4IQ==", + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-table/-/mdast-util-gfm-table-0.1.6.tgz", + "integrity": "sha512-j4yDxQ66AJSBwGkbpFEp9uG/LS1tZV3P33fN1gkyRB2LoRL+RR3f76m0HPHaby6F4Z5xr9Fv1URmATlRRUIpRQ==", "dev": true, "dependencies": { "markdown-table": "^2.0.0", - "mdast-util-to-markdown": "^0.5.0" + "mdast-util-to-markdown": "~0.6.0" }, "funding": { "type": "opencollective", @@ -580,12 +555,12 @@ } }, "node_modules/mdast-util-gfm-task-list-item": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/mdast-util-gfm-task-list-item/-/mdast-util-gfm-task-list-item-0.1.5.tgz", - "integrity": "sha512-6O0bt34r+e7kYjeSwedhjDPYraspKIYKbhvhQEEioL7gSmXDxhN7WQW2KoxhVMpNzjNc03yC7K5KH6NHlz2jOA==", + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-task-list-item/-/mdast-util-gfm-task-list-item-0.1.6.tgz", + "integrity": "sha512-/d51FFIfPsSmCIRNp7E6pozM9z1GYPIkSy1urQ8s/o4TC22BZ7DqfHFWiqBD23bc7J3vV1Fc9O4QIHBlfuit8A==", "dev": true, "dependencies": { - "mdast-util-to-markdown": "^0.5.0" + "mdast-util-to-markdown": "~0.6.0" }, "funding": { "type": "opencollective", @@ -593,9 +568,9 @@ } }, "node_modules/mdast-util-to-hast": { - "version": "10.0.1", - "resolved": "https://registry.npmjs.org/mdast-util-to-hast/-/mdast-util-to-hast-10.0.1.tgz", - "integrity": "sha512-BW3LM9SEMnjf4HXXVApZMt8gLQWVNXc3jryK0nJu/rOXPOnlkUjmdkDlmxMirpbU9ILncGFIwLH/ubnWBbcdgA==", + "version": "10.1.1", + "resolved": "https://registry.npmjs.org/mdast-util-to-hast/-/mdast-util-to-hast-10.1.1.tgz", + "integrity": "sha512-+hvJrYiUgK2aY0Q1h1LaHQ4h0P7VVumWdAcUuG9k49lYglyU9GtTrA4O8hMh5gRnyT22wC15takM2qrrlpvNxQ==", "dev": true, "dependencies": { "@types/mdast": "^3.0.0", @@ -613,9 +588,9 @@ } }, "node_modules/mdast-util-to-markdown": { - "version": "0.5.4", - "resolved": "https://registry.npmjs.org/mdast-util-to-markdown/-/mdast-util-to-markdown-0.5.4.tgz", - "integrity": "sha512-0jQTkbWYx0HdEA/h++7faebJWr5JyBoBeiRf0u3F4F3QtnyyGaWIsOwo749kRb1ttKrLLr+wRtOkfou9yB0p6A==", + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/mdast-util-to-markdown/-/mdast-util-to-markdown-0.6.2.tgz", + "integrity": "sha512-iRczns6WMvu0hUw02LXsPDJshBIwtUPbvHBWo19IQeU0YqmzlA8Pd30U8V7uiI0VPkxzS7A/NXBXH6u+HS87Zg==", "dev": true, "dependencies": { "@types/unist": "^2.0.0", @@ -647,9 +622,9 @@ "dev": true }, "node_modules/micromark": { - "version": "2.10.1", - "resolved": "https://registry.npmjs.org/micromark/-/micromark-2.10.1.tgz", - "integrity": "sha512-fUuVF8sC1X7wsCS29SYQ2ZfIZYbTymp0EYr6sab3idFjigFFjGa5UwoniPlV9tAgntjuapW1t9U+S0yDYeGKHQ==", + "version": "2.11.2", + "resolved": "https://registry.npmjs.org/micromark/-/micromark-2.11.2.tgz", + "integrity": "sha512-IXuP76p2uj8uMg4FQc1cRE7lPCLsfAXuEfdjtdO55VRiFO1asrCSQ5g43NmPqFtRwzEnEhafRVzn2jg0UiKArQ==", "dev": true, "funding": [ { @@ -667,12 +642,12 @@ } }, "node_modules/micromark-extension-gfm": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/micromark-extension-gfm/-/micromark-extension-gfm-0.3.1.tgz", - "integrity": "sha512-lJlhcOqzoJdjQg+LMumVHdUQ61LjtqGdmZtrAdfvatRUnJTqZlRwXXHdLQgNDYlFw4mycZ4NSTKlya5QcQXl1A==", + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm/-/micromark-extension-gfm-0.3.2.tgz", + "integrity": "sha512-ToQEpLkRgg7Tp8D3GM/SjZFPV0cCwWNxZmoEVIOQivOswRtPg7gg2WlCrtHhUWFNX+DgDjbq0iLOPGp4Y15oug==", "dev": true, "dependencies": { - "micromark": "~2.10.0", + "micromark": "~2.11.0", "micromark-extension-gfm-autolink-literal": "~0.5.0", "micromark-extension-gfm-strikethrough": "~0.6.0", "micromark-extension-gfm-table": "~0.4.0", @@ -685,12 +660,12 @@ } }, "node_modules/micromark-extension-gfm-autolink-literal": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/micromark-extension-gfm-autolink-literal/-/micromark-extension-gfm-autolink-literal-0.5.1.tgz", - "integrity": "sha512-j30923tDp0faCNDjwqe4cMi+slegbGfc3VEAExEU8d54Q/F6pR6YxCVH+6xV0ItRoj3lCn1XkUWcy6FC3S9BOw==", + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-autolink-literal/-/micromark-extension-gfm-autolink-literal-0.5.4.tgz", + "integrity": "sha512-471VKd4k3SiX7vx9fC+IYeGQL0RnxwBBXeEc5WConb7naJDG5m16guA+VoFzyXchrvmU08t0dUWWPZ0mkJSXVw==", "dev": true, "dependencies": { - "micromark": "~2.10.0" + "micromark": "~2.11.0" }, "funding": { "type": "opencollective", @@ -698,12 +673,12 @@ } }, "node_modules/micromark-extension-gfm-strikethrough": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/micromark-extension-gfm-strikethrough/-/micromark-extension-gfm-strikethrough-0.6.2.tgz", - "integrity": "sha512-aehEEqtTn3JekJNwZZxa7ZJVfzmuaWp4ew6x6sl3VAKIwdDZdqYeYSQIrNKwNgH7hX0g56fAwnSDLusJggjlCQ==", + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-strikethrough/-/micromark-extension-gfm-strikethrough-0.6.3.tgz", + "integrity": "sha512-MKMoP9x2dsr1aeX46ibBwVf4Q6nJsi5aaUFTOMOID5VOLSxwl4CrqUV4OGFQd6AqhtzBJAxaV+N2trlTBtZDNQ==", "dev": true, "dependencies": { - "micromark": "~2.10.0" + "micromark": "~2.11.0" }, "funding": { "type": "opencollective", @@ -711,12 +686,12 @@ } }, "node_modules/micromark-extension-gfm-table": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/micromark-extension-gfm-table/-/micromark-extension-gfm-table-0.4.1.tgz", - "integrity": "sha512-xVpqOnfFaa2OtC/Y7rlt4tdVFlUHdoLH3RXAZgb/KP3DDyKsAOx6BRS3UxiiyvmD/p2l6VUpD4bMIniuP4o4JA==", + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-table/-/micromark-extension-gfm-table-0.4.2.tgz", + "integrity": "sha512-AAzmj85XO1ydHYX0Lz52HGhcH2sZLm2AVvkwzELXWgZF6vGdq5yZ3CTByFRsqNUPyQBSIYFKLDAtc6KlnO42aw==", "dev": true, "dependencies": { - "micromark": "~2.10.0" + "micromark": "~2.11.0" }, "funding": { "type": "opencollective", @@ -734,12 +709,12 @@ } }, "node_modules/micromark-extension-gfm-task-list-item": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/micromark-extension-gfm-task-list-item/-/micromark-extension-gfm-task-list-item-0.3.2.tgz", - "integrity": "sha512-cm8lYS10YAqeXE9B27TK3u1Ihumo3H9p/3XumT+jp8vSuSbSpFIJe0bDi2kq4YAAIxtcTzUOxhEH4ko2/NYDkQ==", + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-task-list-item/-/micromark-extension-gfm-task-list-item-0.3.3.tgz", + "integrity": "sha512-0zvM5iSLKrc/NQl84pZSjGo66aTGd57C1idmlWmE87lkMcXrTxg1uXa/nXomxJytoje9trP0NDLvw4bZ/Z/XCQ==", "dev": true, "dependencies": { - "micromark": "~2.10.0" + "micromark": "~2.11.0" }, "funding": { "type": "opencollective", @@ -907,12 +882,6 @@ "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/sprintf-js": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", - "dev": true - }, "node_modules/stringify-entities": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/stringify-entities/-/stringify-entities-3.1.0.tgz", @@ -1054,9 +1023,9 @@ } }, "node_modules/unist-util-select": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/unist-util-select/-/unist-util-select-3.0.3.tgz", - "integrity": "sha512-DnbjRvotPiDGsUaw9knEvprwD6conwGtaArUn5niG9yBQvWQyHMmUJ4p/vXXzLBm+8XyiTr3pcuw9n3TlF6SYg==", + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/unist-util-select/-/unist-util-select-3.0.4.tgz", + "integrity": "sha512-xf1zCu4okgPqGLdhCDpRnjwBNyv3EqjiXRUbz2SdK1+qnLMB7uXXajfzuBvvbHoQ+JLyp4AEbFCGndmc6S72sw==", "dev": true, "dependencies": { "css-selector-parser": "^1.0.0", @@ -1214,13 +1183,10 @@ "dev": true }, "argparse": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "dev": true, - "requires": { - "sprintf-js": "~1.0.2" - } + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true }, "bail": { "version": "1.0.5", @@ -1285,12 +1251,6 @@ "ms": "2.1.2" } }, - "esprima": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", - "dev": true - }, "extend": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", @@ -1416,9 +1376,9 @@ } }, "highlight.js": { - "version": "10.4.1", - "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-10.4.1.tgz", - "integrity": "sha512-yR5lWvNz7c85OhVAEAeFhVCc/GV4C30Fjzc/rCP0aCWzc1UUOPUk55dK/qdwTZHBvMZo+eZ2jpk62ndX/xMFlg==", + "version": "10.5.0", + "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-10.5.0.tgz", + "integrity": "sha512-xTmvd9HiIHR6L53TMC7TKolEj65zG1XU+Onr8oi86mYa+nLcIbxTTWkpW7CsEwv/vK7u1zb8alZIMLDqqN6KTw==", "dev": true }, "html-void-elements": { @@ -1474,13 +1434,12 @@ "dev": true }, "js-yaml": { - "version": "3.14.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.0.tgz", - "integrity": "sha512-/4IbIeHcD9VMHFqDR/gQ7EdZdLimOvW2DdcxFjdyyZ9NsbS+ccrXqVWDtab/lRl5AlUqmpBx8EhPaWR+OtY17A==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.0.0.tgz", + "integrity": "sha512-pqon0s+4ScYUvX30wxQi3PogGFAlUyH0awepWvwkj4jD4v+ova3RiYw8bmA6x2rDrEaj8i/oWKoRxpVNW+Re8Q==", "dev": true, "requires": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" + "argparse": "^2.0.1" } }, "lodash.iteratee": { @@ -1514,75 +1473,69 @@ } }, "mdast-util-from-markdown": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/mdast-util-from-markdown/-/mdast-util-from-markdown-0.8.1.tgz", - "integrity": "sha512-qJXNcFcuCSPqUF0Tb0uYcFDIq67qwB3sxo9RPdf9vG8T90ViKnksFqdB/Coq2a7sTnxL/Ify2y7aIQXDkQFH0w==", + "version": "0.8.4", + "resolved": "https://registry.npmjs.org/mdast-util-from-markdown/-/mdast-util-from-markdown-0.8.4.tgz", + "integrity": "sha512-jj891B5pV2r63n2kBTFh8cRI2uR9LQHsXG1zSDqfhXkIlDzrTcIlbB5+5aaYEkl8vOPIOPLf8VT7Ere1wWTMdw==", "dev": true, "requires": { "@types/mdast": "^3.0.0", - "mdast-util-to-string": "^1.0.0", - "micromark": "~2.10.0", - "parse-entities": "^2.0.0" - }, - "dependencies": { - "mdast-util-to-string": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/mdast-util-to-string/-/mdast-util-to-string-1.1.0.tgz", - "integrity": "sha512-jVU0Nr2B9X3MU4tSK7JP1CMkSvOj7X5l/GboG1tKRw52lLF1x2Ju92Ms9tNetCcbfX3hzlM73zYo2NKkWSfF/A==", - "dev": true - } + "mdast-util-to-string": "^2.0.0", + "micromark": "~2.11.0", + "parse-entities": "^2.0.0", + "unist-util-stringify-position": "^2.0.0" } }, "mdast-util-gfm": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/mdast-util-gfm/-/mdast-util-gfm-0.1.0.tgz", - "integrity": "sha512-HLfygQL6HdhJhFbLta4Ki9hClrzyAxRjyRvpm5caN65QZL+NyHPmqFlnF9vm1Rn58JT2+AbLwNcEDY4MEvkk8Q==", + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/mdast-util-gfm/-/mdast-util-gfm-0.1.1.tgz", + "integrity": "sha512-oE1W1zSXU2L2LHg91V22HC3Z1fbsOZTBYUQq+kpM29f9297TbRm0C1l3bQ88RREl0WaUQaB49G7trvwy5utUKQ==", "dev": true, "requires": { "mdast-util-gfm-autolink-literal": "^0.1.0", "mdast-util-gfm-strikethrough": "^0.2.0", "mdast-util-gfm-table": "^0.1.0", - "mdast-util-gfm-task-list-item": "^0.1.0" + "mdast-util-gfm-task-list-item": "^0.1.0", + "mdast-util-to-markdown": "^0.6.1" } }, "mdast-util-gfm-autolink-literal": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/mdast-util-gfm-autolink-literal/-/mdast-util-gfm-autolink-literal-0.1.1.tgz", - "integrity": "sha512-gJ2xSpqKCetSr22GEWpZH3f5ffb4pPn/72m4piY0v7T/S+O7n7rw+sfoPLhb2b4O7WdnERoYdALRcmD68FMtlw==", + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-autolink-literal/-/mdast-util-gfm-autolink-literal-0.1.2.tgz", + "integrity": "sha512-WFeIrcNNsfBety0gyWuiBIPing9UkVcl/m2iZOyW1uHEH2evjFocet2h77M24ub0WyZ4ucnQn/jWhO5Ozl6j4g==", "dev": true }, "mdast-util-gfm-strikethrough": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/mdast-util-gfm-strikethrough/-/mdast-util-gfm-strikethrough-0.2.2.tgz", - "integrity": "sha512-T37ZbaokJcRbHROXmoVAieWnesPD5N21tv2ifYzaGRLbkh1gknItUGhZzHefUn5Zc/eaO/iTDSAFOBrn/E8kWw==", + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-strikethrough/-/mdast-util-gfm-strikethrough-0.2.3.tgz", + "integrity": "sha512-5OQLXpt6qdbttcDG/UxYY7Yjj3e8P7X16LzvpX8pIQPYJ/C2Z1qFGMmcw+1PZMUM3Z8wt8NRfYTvCni93mgsgA==", "dev": true, "requires": { - "mdast-util-to-markdown": "^0.5.0" + "mdast-util-to-markdown": "^0.6.0" } }, "mdast-util-gfm-table": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/mdast-util-gfm-table/-/mdast-util-gfm-table-0.1.4.tgz", - "integrity": "sha512-T4xFSON9kUb/IpYA5N+KGWcsdGczAvILvKiXQwUGind6V9fvjPCR9yhZnIeaLdBWXaz3m/Gq77ZtuLMjtFR4IQ==", + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-table/-/mdast-util-gfm-table-0.1.6.tgz", + "integrity": "sha512-j4yDxQ66AJSBwGkbpFEp9uG/LS1tZV3P33fN1gkyRB2LoRL+RR3f76m0HPHaby6F4Z5xr9Fv1URmATlRRUIpRQ==", "dev": true, "requires": { "markdown-table": "^2.0.0", - "mdast-util-to-markdown": "^0.5.0" + "mdast-util-to-markdown": "~0.6.0" } }, "mdast-util-gfm-task-list-item": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/mdast-util-gfm-task-list-item/-/mdast-util-gfm-task-list-item-0.1.5.tgz", - "integrity": "sha512-6O0bt34r+e7kYjeSwedhjDPYraspKIYKbhvhQEEioL7gSmXDxhN7WQW2KoxhVMpNzjNc03yC7K5KH6NHlz2jOA==", + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-task-list-item/-/mdast-util-gfm-task-list-item-0.1.6.tgz", + "integrity": "sha512-/d51FFIfPsSmCIRNp7E6pozM9z1GYPIkSy1urQ8s/o4TC22BZ7DqfHFWiqBD23bc7J3vV1Fc9O4QIHBlfuit8A==", "dev": true, "requires": { - "mdast-util-to-markdown": "^0.5.0" + "mdast-util-to-markdown": "~0.6.0" } }, "mdast-util-to-hast": { - "version": "10.0.1", - "resolved": "https://registry.npmjs.org/mdast-util-to-hast/-/mdast-util-to-hast-10.0.1.tgz", - "integrity": "sha512-BW3LM9SEMnjf4HXXVApZMt8gLQWVNXc3jryK0nJu/rOXPOnlkUjmdkDlmxMirpbU9ILncGFIwLH/ubnWBbcdgA==", + "version": "10.1.1", + "resolved": "https://registry.npmjs.org/mdast-util-to-hast/-/mdast-util-to-hast-10.1.1.tgz", + "integrity": "sha512-+hvJrYiUgK2aY0Q1h1LaHQ4h0P7VVumWdAcUuG9k49lYglyU9GtTrA4O8hMh5gRnyT22wC15takM2qrrlpvNxQ==", "dev": true, "requires": { "@types/mdast": "^3.0.0", @@ -1596,9 +1549,9 @@ } }, "mdast-util-to-markdown": { - "version": "0.5.4", - "resolved": "https://registry.npmjs.org/mdast-util-to-markdown/-/mdast-util-to-markdown-0.5.4.tgz", - "integrity": "sha512-0jQTkbWYx0HdEA/h++7faebJWr5JyBoBeiRf0u3F4F3QtnyyGaWIsOwo749kRb1ttKrLLr+wRtOkfou9yB0p6A==", + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/mdast-util-to-markdown/-/mdast-util-to-markdown-0.6.2.tgz", + "integrity": "sha512-iRczns6WMvu0hUw02LXsPDJshBIwtUPbvHBWo19IQeU0YqmzlA8Pd30U8V7uiI0VPkxzS7A/NXBXH6u+HS87Zg==", "dev": true, "requires": { "@types/unist": "^2.0.0", @@ -1622,9 +1575,9 @@ "dev": true }, "micromark": { - "version": "2.10.1", - "resolved": "https://registry.npmjs.org/micromark/-/micromark-2.10.1.tgz", - "integrity": "sha512-fUuVF8sC1X7wsCS29SYQ2ZfIZYbTymp0EYr6sab3idFjigFFjGa5UwoniPlV9tAgntjuapW1t9U+S0yDYeGKHQ==", + "version": "2.11.2", + "resolved": "https://registry.npmjs.org/micromark/-/micromark-2.11.2.tgz", + "integrity": "sha512-IXuP76p2uj8uMg4FQc1cRE7lPCLsfAXuEfdjtdO55VRiFO1asrCSQ5g43NmPqFtRwzEnEhafRVzn2jg0UiKArQ==", "dev": true, "requires": { "debug": "^4.0.0", @@ -1632,12 +1585,12 @@ } }, "micromark-extension-gfm": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/micromark-extension-gfm/-/micromark-extension-gfm-0.3.1.tgz", - "integrity": "sha512-lJlhcOqzoJdjQg+LMumVHdUQ61LjtqGdmZtrAdfvatRUnJTqZlRwXXHdLQgNDYlFw4mycZ4NSTKlya5QcQXl1A==", + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm/-/micromark-extension-gfm-0.3.2.tgz", + "integrity": "sha512-ToQEpLkRgg7Tp8D3GM/SjZFPV0cCwWNxZmoEVIOQivOswRtPg7gg2WlCrtHhUWFNX+DgDjbq0iLOPGp4Y15oug==", "dev": true, "requires": { - "micromark": "~2.10.0", + "micromark": "~2.11.0", "micromark-extension-gfm-autolink-literal": "~0.5.0", "micromark-extension-gfm-strikethrough": "~0.6.0", "micromark-extension-gfm-table": "~0.4.0", @@ -1646,30 +1599,30 @@ } }, "micromark-extension-gfm-autolink-literal": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/micromark-extension-gfm-autolink-literal/-/micromark-extension-gfm-autolink-literal-0.5.1.tgz", - "integrity": "sha512-j30923tDp0faCNDjwqe4cMi+slegbGfc3VEAExEU8d54Q/F6pR6YxCVH+6xV0ItRoj3lCn1XkUWcy6FC3S9BOw==", + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-autolink-literal/-/micromark-extension-gfm-autolink-literal-0.5.4.tgz", + "integrity": "sha512-471VKd4k3SiX7vx9fC+IYeGQL0RnxwBBXeEc5WConb7naJDG5m16guA+VoFzyXchrvmU08t0dUWWPZ0mkJSXVw==", "dev": true, "requires": { - "micromark": "~2.10.0" + "micromark": "~2.11.0" } }, "micromark-extension-gfm-strikethrough": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/micromark-extension-gfm-strikethrough/-/micromark-extension-gfm-strikethrough-0.6.2.tgz", - "integrity": "sha512-aehEEqtTn3JekJNwZZxa7ZJVfzmuaWp4ew6x6sl3VAKIwdDZdqYeYSQIrNKwNgH7hX0g56fAwnSDLusJggjlCQ==", + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-strikethrough/-/micromark-extension-gfm-strikethrough-0.6.3.tgz", + "integrity": "sha512-MKMoP9x2dsr1aeX46ibBwVf4Q6nJsi5aaUFTOMOID5VOLSxwl4CrqUV4OGFQd6AqhtzBJAxaV+N2trlTBtZDNQ==", "dev": true, "requires": { - "micromark": "~2.10.0" + "micromark": "~2.11.0" } }, "micromark-extension-gfm-table": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/micromark-extension-gfm-table/-/micromark-extension-gfm-table-0.4.1.tgz", - "integrity": "sha512-xVpqOnfFaa2OtC/Y7rlt4tdVFlUHdoLH3RXAZgb/KP3DDyKsAOx6BRS3UxiiyvmD/p2l6VUpD4bMIniuP4o4JA==", + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-table/-/micromark-extension-gfm-table-0.4.2.tgz", + "integrity": "sha512-AAzmj85XO1ydHYX0Lz52HGhcH2sZLm2AVvkwzELXWgZF6vGdq5yZ3CTByFRsqNUPyQBSIYFKLDAtc6KlnO42aw==", "dev": true, "requires": { - "micromark": "~2.10.0" + "micromark": "~2.11.0" } }, "micromark-extension-gfm-tagfilter": { @@ -1679,12 +1632,12 @@ "dev": true }, "micromark-extension-gfm-task-list-item": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/micromark-extension-gfm-task-list-item/-/micromark-extension-gfm-task-list-item-0.3.2.tgz", - "integrity": "sha512-cm8lYS10YAqeXE9B27TK3u1Ihumo3H9p/3XumT+jp8vSuSbSpFIJe0bDi2kq4YAAIxtcTzUOxhEH4ko2/NYDkQ==", + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-task-list-item/-/micromark-extension-gfm-task-list-item-0.3.3.tgz", + "integrity": "sha512-0zvM5iSLKrc/NQl84pZSjGo66aTGd57C1idmlWmE87lkMcXrTxg1uXa/nXomxJytoje9trP0NDLvw4bZ/Z/XCQ==", "dev": true, "requires": { - "micromark": "~2.10.0" + "micromark": "~2.11.0" } }, "ms": { @@ -1806,12 +1759,6 @@ "integrity": "sha512-q/JSVd1Lptzhf5bkYm4ob4iWPjx0KiRe3sRFBNrVqbJkFaBm5vbbowy1mymoPNLRa52+oadOhJ+K49wsSeSjTA==", "dev": true }, - "sprintf-js": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", - "dev": true - }, "stringify-entities": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/stringify-entities/-/stringify-entities-3.1.0.tgz", @@ -1923,9 +1870,9 @@ "dev": true }, "unist-util-select": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/unist-util-select/-/unist-util-select-3.0.3.tgz", - "integrity": "sha512-DnbjRvotPiDGsUaw9knEvprwD6conwGtaArUn5niG9yBQvWQyHMmUJ4p/vXXzLBm+8XyiTr3pcuw9n3TlF6SYg==", + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/unist-util-select/-/unist-util-select-3.0.4.tgz", + "integrity": "sha512-xf1zCu4okgPqGLdhCDpRnjwBNyv3EqjiXRUbz2SdK1+qnLMB7uXXajfzuBvvbHoQ+JLyp4AEbFCGndmc6S72sw==", "dev": true, "requires": { "css-selector-parser": "^1.0.0", diff --git a/tools/doc/package.json b/tools/doc/package.json index dec820f60886ae..d13ac4f30e8feb 100644 --- a/tools/doc/package.json +++ b/tools/doc/package.json @@ -7,8 +7,8 @@ "node": ">=12.10.0" }, "devDependencies": { - "highlight.js": "10.4.1", - "js-yaml": "3.14.0", + "highlight.js": "10.5.0", + "js-yaml": "4.0.0", "rehype-raw": "5.0.0", "rehype-stringify": "8.0.0", "remark-gfm": "^1.0.0", @@ -18,7 +18,7 @@ "to-vfile": "6.1.0", "unified": "9.2.0", "unist-util-find": "^1.0.2", - "unist-util-select": "3.0.3", + "unist-util-select": "3.0.4", "unist-util-visit": "2.0.3" }, "bin": { diff --git a/tools/doc/type-parser.js b/tools/doc/type-parser.js index 72a2ec419940de..624ff0974d9cb5 100644 --- a/tools/doc/type-parser.js +++ b/tools/doc/type-parser.js @@ -217,6 +217,8 @@ const customTypesMap = { 'MessagePort': 'worker_threads.html#worker_threads_class_messageport', + 'X509Certificate': 'crypto.html#crypto_class_x509certificate', + 'zlib options': 'zlib.html#zlib_class_options', }; diff --git a/tools/genv8constants.py b/tools/genv8constants.py index 8ab2ed8bae50c0..f750ca4de7523f 100755 --- a/tools/genv8constants.py +++ b/tools/genv8constants.py @@ -14,7 +14,7 @@ import errno if len(sys.argv) != 3: - print("usage: objsym.py outfile libv8_base.a") + print("Usage: genv8constants.py outfile libv8_base.a") sys.exit(2) outfile = open(sys.argv[1], 'w') @@ -95,7 +95,7 @@ def out_define(): curr_octet += 1 match = pattern.match(line) - if match == None: + if match is None: continue # Print previous symbol @@ -113,3 +113,5 @@ def out_define(): #endif /* V8_CONSTANTS_H */ """) + +outfile.close() diff --git a/tools/gyp/CHANGELOG.md b/tools/gyp/CHANGELOG.md index 53c922b6c903f8..79403676950671 100644 --- a/tools/gyp/CHANGELOG.md +++ b/tools/gyp/CHANGELOG.md @@ -1,5 +1,24 @@ # Changelog +## [0.7.0](https://www.github.com/nodejs/gyp-next/compare/v0.6.2...v0.7.0) (2020-12-17) + + +### āš  BREAKING CHANGES + +* **msvs:** On Windows, arguments passed to the "action" commands are no longer transformed to replace slashes with backslashes. + +### Features + +* **xcode:** --cross-compiling overrides arch-specific settings ([973bae0](https://www.github.com/nodejs/gyp-next/commit/973bae0b7b08be7b680ecae9565fbd04b3e0787d)) + + +### Bug Fixes + +* **msvs:** do not fix paths in action command arguments ([fc22f83](https://www.github.com/nodejs/gyp-next/commit/fc22f8335e2016da4aae4f4233074bd651d2faea)) +* cmake on python 3 ([fd61f5f](https://www.github.com/nodejs/gyp-next/commit/fd61f5faa5275ec8fc98e3c7868c0dd46f109540)) +* ValueError: invalid mode: 'rU' while trying to load binding.gyp ([d0504e6](https://www.github.com/nodejs/gyp-next/commit/d0504e6700ce48f44957a4d5891b142a60be946f)) +* xcode cmake parsing ([eefe8d1](https://www.github.com/nodejs/gyp-next/commit/eefe8d10e99863bc4ac7e2ed32facd608d400d4b)) + ### [0.6.2](https://www.github.com/nodejs/gyp-next/compare/v0.6.1...v0.6.2) (2020-10-16) diff --git a/tools/gyp/pylib/gyp/generator/cmake.py b/tools/gyp/pylib/gyp/generator/cmake.py index f5ceacfca364ce..75f5822369735a 100644 --- a/tools/gyp/pylib/gyp/generator/cmake.py +++ b/tools/gyp/pylib/gyp/generator/cmake.py @@ -41,7 +41,7 @@ try: # maketrans moved to str in python3. _maketrans = string.maketrans -except NameError: +except (NameError, AttributeError): _maketrans = str.maketrans generator_default_variables = { @@ -1047,7 +1047,7 @@ def WriteTarget( # XCode settings xcode_settings = config.get("xcode_settings", {}) - for xcode_setting, xcode_value in xcode_settings.viewitems(): + for xcode_setting, xcode_value in xcode_settings.items(): SetTargetProperty( output, cmake_target_name, diff --git a/tools/gyp/pylib/gyp/generator/msvs.py b/tools/gyp/pylib/gyp/generator/msvs.py index 32bf4746a179cb..96283b275756e5 100644 --- a/tools/gyp/pylib/gyp/generator/msvs.py +++ b/tools/gyp/pylib/gyp/generator/msvs.py @@ -423,13 +423,7 @@ def _BuildCommandLineForRuleRaw( # file out of the raw command string, and some commands (like python) are # actually batch files themselves. command.insert(0, "call") - # Fix the paths - # TODO(quote): This is a really ugly heuristic, and will miss path fixing - # for arguments like "--arg=path" or "/opt:path". - # If the argument starts with a slash or dash, it's probably a command line - # switch - arguments = [i if (i[:1] in "/-") else _FixPath(i) for i in cmd[1:]] - arguments = [i.replace("$(InputDir)", "%INPUTDIR%") for i in arguments] + arguments = [i.replace("$(InputDir)", "%INPUTDIR%") for i in cmd[1:]] arguments = [MSVSSettings.FixVCMacroSlashes(i) for i in arguments] if quote_cmd: # Support a mode for using cmd directly. diff --git a/tools/gyp/pylib/gyp/input.py b/tools/gyp/pylib/gyp/input.py index 5504390c0bb33f..90397762404a7c 100644 --- a/tools/gyp/pylib/gyp/input.py +++ b/tools/gyp/pylib/gyp/input.py @@ -231,7 +231,7 @@ def LoadOneBuildFile(build_file_path, data, aux_data, includes, is_target, check # Open the build file for read ('r') with universal-newlines mode ('U') # to make sure platform specific newlines ('\r\n' or '\r') are converted to '\n' # which otherwise will fail eval() - if sys.platform == "zos": + if PY3 or sys.platform == "zos": # On z/OS, universal-newlines mode treats the file as an ascii file. # But since node-gyp produces ebcdic files, do not use that mode. build_file_contents = open(build_file_path, "r").read() diff --git a/tools/gyp/pylib/gyp/xcode_emulation.py b/tools/gyp/pylib/gyp/xcode_emulation.py index 8af2b39f9a1479..a79aaa41fbcee8 100644 --- a/tools/gyp/pylib/gyp/xcode_emulation.py +++ b/tools/gyp/pylib/gyp/xcode_emulation.py @@ -654,28 +654,32 @@ def GetCflags(self, configname, arch=None): self._WarnUnimplemented("MACH_O_TYPE") self._WarnUnimplemented("PRODUCT_TYPE") - if arch is not None: - archs = [arch] - else: - assert self.configname - archs = self.GetActiveArchs(self.configname) - if len(archs) != 1: - # TODO: Supporting fat binaries will be annoying. - self._WarnUnimplemented("ARCHS") - archs = ["i386"] - cflags.append("-arch " + archs[0]) - - if archs[0] in ("i386", "x86_64"): - if self._Test("GCC_ENABLE_SSE3_EXTENSIONS", "YES", default="NO"): - cflags.append("-msse3") - if self._Test( - "GCC_ENABLE_SUPPLEMENTAL_SSE3_INSTRUCTIONS", "YES", default="NO" - ): - cflags.append("-mssse3") # Note 3rd 's'. - if self._Test("GCC_ENABLE_SSE41_EXTENSIONS", "YES", default="NO"): - cflags.append("-msse4.1") - if self._Test("GCC_ENABLE_SSE42_EXTENSIONS", "YES", default="NO"): - cflags.append("-msse4.2") + # If GYP_CROSSCOMPILE (--cross-compiling), disable architecture-specific + # additions and assume these will be provided as required via CC_host, + # CXX_host, CC_target and CXX_target. + if not gyp.common.CrossCompileRequested(): + if arch is not None: + archs = [arch] + else: + assert self.configname + archs = self.GetActiveArchs(self.configname) + if len(archs) != 1: + # TODO: Supporting fat binaries will be annoying. + self._WarnUnimplemented("ARCHS") + archs = ["i386"] + cflags.append("-arch " + archs[0]) + + if archs[0] in ("i386", "x86_64"): + if self._Test("GCC_ENABLE_SSE3_EXTENSIONS", "YES", default="NO"): + cflags.append("-msse3") + if self._Test( + "GCC_ENABLE_SUPPLEMENTAL_SSE3_INSTRUCTIONS", "YES", default="NO" + ): + cflags.append("-mssse3") # Note 3rd 's'. + if self._Test("GCC_ENABLE_SSE41_EXTENSIONS", "YES", default="NO"): + cflags.append("-msse4.1") + if self._Test("GCC_ENABLE_SSE42_EXTENSIONS", "YES", default="NO"): + cflags.append("-msse4.2") cflags += self._Settings().get("WARNING_CFLAGS", []) @@ -938,16 +942,17 @@ def GetLdflags(self, configname, product_dir, gyp_to_build_path, arch=None): + gyp_to_build_path(self._Settings()["ORDER_FILE"]) ) - if arch is not None: - archs = [arch] - else: - assert self.configname - archs = self.GetActiveArchs(self.configname) - if len(archs) != 1: - # TODO: Supporting fat binaries will be annoying. - self._WarnUnimplemented("ARCHS") - archs = ["i386"] - ldflags.append("-arch " + archs[0]) + if not gyp.common.CrossCompileRequested(): + if arch is not None: + archs = [arch] + else: + assert self.configname + archs = self.GetActiveArchs(self.configname) + if len(archs) != 1: + # TODO: Supporting fat binaries will be annoying. + self._WarnUnimplemented("ARCHS") + archs = ["i386"] + ldflags.append("-arch " + archs[0]) # Xcode adds the product directory by default. # Rewrite -L. to -L./ to work around http://www.openradar.me/25313838 diff --git a/tools/gyp/setup.py b/tools/gyp/setup.py old mode 100755 new mode 100644 index d1869c1b52055f..766a7651ba09f5 --- a/tools/gyp/setup.py +++ b/tools/gyp/setup.py @@ -15,7 +15,7 @@ setup( name="gyp-next", - version="0.6.2", + version="0.7.0", description="A fork of the GYP build system for use in the Node.js projects", long_description=long_description, long_description_content_type="text/markdown", diff --git a/tools/icu/current_ver.dep b/tools/icu/current_ver.dep index a73a4b1117ede6..b4caab129071e1 100644 --- a/tools/icu/current_ver.dep +++ b/tools/icu/current_ver.dep @@ -1,6 +1,6 @@ [ { "url": "https://github.com/unicode-org/icu/releases/download/release-68-1/icu4c-68_1-src.tgz", - "md5": "fd03b2d916dcadd3711b4c4a100a1713" + "md5": "6a99b541ea01f271257b121a4433c7c0" } ] diff --git a/tools/install.py b/tools/install.py index 729b416fc47d3f..693faff4c37ac4 100755 --- a/tools/install.py +++ b/tools/install.py @@ -19,8 +19,8 @@ def abspath(*args): return os.path.abspath(path) def load_config(): - s = open('config.gypi').read() - return ast.literal_eval(s) + with open('config.gypi') as f: + return ast.literal_eval(f.read()) def try_unlink(path): try: @@ -223,11 +223,19 @@ def run(args): cmd = args[1] if len(args) > 1 else 'install' if os.environ.get('HEADERS_ONLY'): - if cmd == 'install': return headers(install) - if cmd == 'uninstall': return headers(uninstall) + if cmd == 'install': + headers(install) + return + if cmd == 'uninstall': + headers(uninstall) + return else: - if cmd == 'install': return files(install) - if cmd == 'uninstall': return files(uninstall) + if cmd == 'install': + files(install) + return + if cmd == 'uninstall': + files(uninstall) + return raise RuntimeError('Bad command: %s\n' % cmd) diff --git a/tools/js2c.py b/tools/js2c.py index 0f073e182bdb28..dd3ff9d5ca9f98 100755 --- a/tools/js2c.py +++ b/tools/js2c.py @@ -123,7 +123,7 @@ def AddModule(filename, definitions, initializers): initializers.append(initializer) def NormalizeFileName(filename): - split = filename.split(os.path.sep) + split = filename.split('/') if split[0] == 'deps': split = ['internal'] + split else: # `lib/**/*.js` so drop the 'lib' part diff --git a/tools/lint-md.js b/tools/lint-md.js index 7d88451c9224ce..332fdd63ed44e1 100644 --- a/tools/lint-md.js +++ b/tools/lint-md.js @@ -3,9 +3,9 @@ // Don't change this file manually, // it is generated from tools/node-lint-md-cli-rollup -var stream = require('stream'); +var require$$0$3 = require('stream'); var path$2 = require('path'); -var module$1 = require('module'); +var Module = require('module'); var util$2 = require('util'); var os = require('os'); var tty = require('tty'); @@ -15,9 +15,9 @@ var assert = require('assert'); function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } -var stream__default = /*#__PURE__*/_interopDefaultLegacy(stream); +var require$$0__default = /*#__PURE__*/_interopDefaultLegacy(require$$0$3); var path__default = /*#__PURE__*/_interopDefaultLegacy(path$2); -var module__default = /*#__PURE__*/_interopDefaultLegacy(module$1); +var Module__default = /*#__PURE__*/_interopDefaultLegacy(Module); var util__default = /*#__PURE__*/_interopDefaultLegacy(util$2); var os__default = /*#__PURE__*/_interopDefaultLegacy(os); var tty__default = /*#__PURE__*/_interopDefaultLegacy(tty); @@ -210,20 +210,28 @@ function trough() { var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; -function unwrapExports (x) { - return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; -} - -function createCommonjsModule(fn, module) { - return module = { exports: {} }, fn(module, module.exports), module.exports; +function getAugmentedNamespace(n) { + if (n.__esModule) return n; + var a = Object.defineProperty({}, '__esModule', {value: true}); + Object.keys(n).forEach(function (k) { + var d = Object.getOwnPropertyDescriptor(n, k); + Object.defineProperty(a, k, d.get ? d : { + enumerable: true, + get: function () { + return n[k]; + } + }); + }); + return a; } -function getCjsExportFromNamespace (n) { - return n && n['default'] || n; +function createCommonjsModule(fn) { + var module = { exports: {} }; + return fn(module, module.exports), module.exports; } -function commonjsRequire () { - throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs'); +function commonjsRequire (target) { + throw new Error('Could not dynamically require "' + target + '". Please configure the dynamicRequireTargets option of @rollup/plugin-commonjs appropriately for this require call to behave properly.'); } function isNothing(subject) { @@ -804,7 +812,7 @@ function isInteger(object) { (object % 1 === 0 && !common.isNegativeZero(object)); } -var int_1 = new type('tag:yaml.org,2002:int', { +var int = new type('tag:yaml.org,2002:int', { kind: 'scalar', resolve: resolveYamlInteger, construct: constructYamlInteger, @@ -928,7 +936,7 @@ function isFloat(object) { (object % 1 !== 0 || common.isNegativeZero(object)); } -var float_1 = new type('tag:yaml.org,2002:float', { +var float = new type('tag:yaml.org,2002:float', { kind: 'scalar', resolve: resolveYamlFloat, construct: constructYamlFloat, @@ -944,8 +952,8 @@ var json = new schema({ implicit: [ _null, bool, - int_1, - float_1 + int, + float ] }); @@ -2776,7 +2784,7 @@ function readAlias(state) { alias = state.input.slice(_position, state.position); - if (!state.anchorMap.hasOwnProperty(alias)) { + if (!_hasOwnProperty$2.call(state.anchorMap, alias)) { throwError(state, 'unidentified alias "' + alias + '"'); } @@ -4394,19 +4402,16 @@ var dist = /*#__PURE__*/Object.freeze({ 'default': LinesAndColumns }); -var jsTokens = createCommonjsModule(function (module, exports) { // Copyright 2014, 2015, 2016, 2017, 2018 Simon Lydell // License: MIT. (See LICENSE.) -Object.defineProperty(exports, "__esModule", { - value: true -}); + // This regex comes from regex.coffee, and is inserted here by generate-index.js // (run `npm run build`). -exports.default = /((['"])(?:(?!\2|\\).|\\(?:\r\n|[\s\S]))*(\2)?|`(?:[^`\\$]|\\[\s\S]|\$(?!\{)|\$\{(?:[^{}]|\{[^}]*\}?)*\}?)*(`)?)|(\/\/.*)|(\/\*(?:[^*]|\*(?!\/))*(\*\/)?)|(\/(?!\*)(?:\[(?:(?![\]\\]).|\\.)*\]|(?![\/\]\\]).|\\.)+\/(?:(?!\s*(?:\b|[\u0080-\uFFFF$\\'"~({]|[+\-!](?!=)|\.?\d))|[gmiyus]{1,6}\b(?![\u0080-\uFFFF$\\]|\s*(?:[+\-*%&|^<>!=?({]|\/(?![\/*])))))|(0[xX][\da-fA-F]+|0[oO][0-7]+|0[bB][01]+|(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?)|((?!\d)(?:(?!\s)[$\w\u0080-\uFFFF]|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]+\})+)|(--|\+\+|&&|\|\||=>|\.{3}|(?:[+\-\/%&|^]|\*{1,2}|<{1,2}|>{1,3}|!=?|={1,2})=?|[?~.,:;[\](){}])|(\s+)|(^$|[\s\S])/g; +var _default = /((['"])(?:(?!\2|\\).|\\(?:\r\n|[\s\S]))*(\2)?|`(?:[^`\\$]|\\[\s\S]|\$(?!\{)|\$\{(?:[^{}]|\{[^}]*\}?)*\}?)*(`)?)|(\/\/.*)|(\/\*(?:[^*]|\*(?!\/))*(\*\/)?)|(\/(?!\*)(?:\[(?:(?![\]\\]).|\\.)*\]|(?![\/\]\\]).|\\.)+\/(?:(?!\s*(?:\b|[\u0080-\uFFFF$\\'"~({]|[+\-!](?!=)|\.?\d))|[gmiyus]{1,6}\b(?![\u0080-\uFFFF$\\]|\s*(?:[+\-*%&|^<>!=?({]|\/(?![\/*])))))|(0[xX][\da-fA-F]+|0[oO][0-7]+|0[bB][01]+|(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?)|((?!\d)(?:(?!\s)[$\w\u0080-\uFFFF]|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]+\})+)|(--|\+\+|&&|\|\||=>|\.{3}|(?:[+\-\/%&|^]|\*{1,2}|<{1,2}|>{1,3}|!=?|={1,2})=?|[?~.,:;[\](){}])|(\s+)|(^$|[\s\S])/g; -exports.matchToToken = function(match) { +var matchToToken = function(match) { var token = {type: "invalid", value: match[0], closed: undefined}; if (match[ 1]) token.type = "string" , token.closed = !!(match[3] || match[4]); else if (match[ 5]) token.type = "comment"; @@ -4418,19 +4423,15 @@ exports.matchToToken = function(match) { else if (match[12]) token.type = "whitespace"; return token }; -}); -unwrapExports(jsTokens); -var jsTokens_1 = jsTokens.matchToToken; +var jsTokens = /*#__PURE__*/Object.defineProperty({ + default: _default, + matchToToken: matchToToken +}, '__esModule', {value: true}); -var identifier = createCommonjsModule(function (module, exports) { - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.isIdentifierStart = isIdentifierStart; -exports.isIdentifierChar = isIdentifierChar; -exports.isIdentifierName = isIdentifierName; +var isIdentifierStart_1 = isIdentifierStart; +var isIdentifierChar_1 = isIdentifierChar; +var isIdentifierName_1 = isIdentifierName; let nonASCIIidentifierStartChars = "\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0560-\u0588\u05d0-\u05ea\u05ef-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u0860-\u086a\u08a0-\u08b4\u08b6-\u08c7\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u09fc\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0af9\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d\u0c58-\u0c5a\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d04-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d54-\u0d56\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e86-\u0e8a\u0e8c-\u0ea3\u0ea5\u0ea7-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f8\u1700-\u170c\u170e-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1878\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4b\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1c80-\u1c88\u1c90-\u1cba\u1cbd-\u1cbf\u1ce9-\u1cec\u1cee-\u1cf3\u1cf5\u1cf6\u1cfa\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2118-\u211d\u2124\u2126\u2128\u212a-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309b-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312f\u3131-\u318e\u31a0-\u31bf\u31f0-\u31ff\u3400-\u4dbf\u4e00-\u9ffc\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7bf\ua7c2-\ua7ca\ua7f5-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\ua8fe\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\ua9e0-\ua9e4\ua9e6-\ua9ef\ua9fa-\ua9fe\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa7e-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab69\uab70-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc"; let nonASCIIidentifierChars = "\u200c\u200d\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u07fd\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u08d3-\u08e1\u08e3-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u09fe\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0afa-\u0aff\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b55-\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c04\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0d00-\u0d03\u0d3b\u0d3c\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d81-\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0ebc\u0ec8-\u0ecd\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u1810-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1abf\u1ac0\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf4\u1cf7-\u1cf9\u1dc0-\u1df9\u1dfb-\u1dff\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua620-\ua629\ua66f\ua674-\ua67d\ua69e\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua82c\ua880\ua881\ua8b4-\ua8c5\ua8d0-\ua8d9\ua8e0-\ua8f1\ua8ff-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\ua9e5\ua9f0-\ua9f9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b-\uaa7d\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f"; const nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]"); @@ -4500,23 +4501,18 @@ function isIdentifierName(name) { return !isFirst; } -}); - -unwrapExports(identifier); -var identifier_1 = identifier.isIdentifierStart; -var identifier_2 = identifier.isIdentifierChar; -var identifier_3 = identifier.isIdentifierName; -var keyword = createCommonjsModule(function (module, exports) { +var identifier = /*#__PURE__*/Object.defineProperty({ + isIdentifierStart: isIdentifierStart_1, + isIdentifierChar: isIdentifierChar_1, + isIdentifierName: isIdentifierName_1 +}, '__esModule', {value: true}); -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.isReservedWord = isReservedWord; -exports.isStrictReservedWord = isStrictReservedWord; -exports.isStrictBindOnlyReservedWord = isStrictBindOnlyReservedWord; -exports.isStrictBindReservedWord = isStrictBindReservedWord; -exports.isKeyword = isKeyword; +var isReservedWord_1 = isReservedWord; +var isStrictReservedWord_1 = isStrictReservedWord; +var isStrictBindOnlyReservedWord_1 = isStrictBindOnlyReservedWord; +var isStrictBindReservedWord_1 = isStrictBindReservedWord; +var isKeyword_1 = isKeyword; const reservedWords = { keyword: ["break", "case", "catch", "continue", "debugger", "default", "do", "else", "finally", "for", "function", "if", "return", "switch", "throw", "try", "var", "const", "while", "with", "new", "this", "super", "class", "extends", "export", "import", "null", "true", "false", "in", "instanceof", "typeof", "void", "delete"], strict: ["implements", "interface", "let", "package", "private", "protected", "public", "static", "yield"], @@ -4545,14 +4541,14 @@ function isStrictBindReservedWord(word, inModule) { function isKeyword(word) { return keywords.has(word); } -}); -unwrapExports(keyword); -var keyword_1 = keyword.isReservedWord; -var keyword_2 = keyword.isStrictReservedWord; -var keyword_3 = keyword.isStrictBindOnlyReservedWord; -var keyword_4 = keyword.isStrictBindReservedWord; -var keyword_5 = keyword.isKeyword; +var keyword = /*#__PURE__*/Object.defineProperty({ + isReservedWord: isReservedWord_1, + isStrictReservedWord: isStrictReservedWord_1, + isStrictBindOnlyReservedWord: isStrictBindOnlyReservedWord_1, + isStrictBindReservedWord: isStrictBindReservedWord_1, + isKeyword: isKeyword_1 +}, '__esModule', {value: true}); var lib = createCommonjsModule(function (module, exports) { @@ -4609,16 +4605,6 @@ Object.defineProperty(exports, "isKeyword", { }); }); -unwrapExports(lib); -var lib_1 = lib.isIdentifierName; -var lib_2 = lib.isIdentifierChar; -var lib_3 = lib.isIdentifierStart; -var lib_4 = lib.isReservedWord; -var lib_5 = lib.isStrictBindOnlyReservedWord; -var lib_6 = lib.isStrictBindReservedWord; -var lib_7 = lib.isStrictReservedWord; -var lib_8 = lib.isKeyword; - var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g; var escapeStringRegexp = function (str) { @@ -4780,10 +4766,9 @@ var colorName = { "yellowgreen": [154, 205, 50] }; -var conversions = createCommonjsModule(function (module) { /* MIT license */ - +var conversions = createCommonjsModule(function (module) { // 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.) @@ -5650,21 +5635,6 @@ convert.rgb.gray = function (rgb) { 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. @@ -6497,16 +6467,10 @@ module.exports = Chalk(); // eslint-disable-line new-cap module.exports.supportsColor = stdoutColor; module.exports.default = module.exports; // For TypeScript }); -var chalk_1 = chalk.supportsColor; -var lib$1 = createCommonjsModule(function (module, exports) { - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.shouldHighlight = shouldHighlight; -exports.getChalk = getChalk; -exports.default = highlight; +var shouldHighlight_1 = shouldHighlight; +var getChalk_1 = getChalk; +var _default$1 = highlight; var _jsTokens = _interopRequireWildcard(jsTokens); @@ -6606,29 +6570,25 @@ function highlight(code, options = {}) { return code; } } -}); - -unwrapExports(lib$1); -var lib_1$1 = lib$1.shouldHighlight; -var lib_2$1 = lib$1.getChalk; -var lib$2 = createCommonjsModule(function (module, exports) { +var lib$1 = /*#__PURE__*/Object.defineProperty({ + shouldHighlight: shouldHighlight_1, + getChalk: getChalk_1, + default: _default$1 +}, '__esModule', {value: true}); -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.codeFrameColumns = codeFrameColumns; -exports.default = _default; +var codeFrameColumns_1 = codeFrameColumns; +var default_1 = _default$2; -var _highlight = _interopRequireWildcard(lib$1); +var _highlight = _interopRequireWildcard$1(lib$1); -function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; } +function _getRequireWildcardCache$1() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache$1 = function () { return cache; }; return cache; } -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } +function _interopRequireWildcard$1(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache$1(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } let deprecationWarningShown = false; -function getDefs(chalk) { +function getDefs$1(chalk) { return { gutter: chalk.grey, marker: chalk.red.bold, @@ -6636,7 +6596,7 @@ function getDefs(chalk) { }; } -const NEWLINE = /\r\n|[\n\r\u2028\u2029]/; +const NEWLINE$1 = /\r\n|[\n\r\u2028\u2029]/; function getMarkerLines(loc, source, opts) { const startLoc = Object.assign({ @@ -6704,13 +6664,13 @@ function getMarkerLines(loc, source, opts) { function codeFrameColumns(rawLines, loc, opts = {}) { const highlighted = (opts.highlightCode || opts.forceColor) && (0, _highlight.shouldHighlight)(opts); const chalk = (0, _highlight.getChalk)(opts); - const defs = getDefs(chalk); + const defs = getDefs$1(chalk); const maybeHighlight = (chalkFn, string) => { return highlighted ? chalkFn(string) : string; }; - const lines = rawLines.split(NEWLINE); + const lines = rawLines.split(NEWLINE$1); const { start, end, @@ -6719,7 +6679,7 @@ function codeFrameColumns(rawLines, loc, opts = {}) { const hasColumns = loc.start && typeof loc.start.column === "number"; const numberMaxWidth = String(end).length; const highlightedLines = highlighted ? (0, _highlight.default)(rawLines, opts) : rawLines; - let frame = highlightedLines.split(NEWLINE).slice(start, end).map((line, index) => { + let frame = highlightedLines.split(NEWLINE$1).slice(start, end).map((line, index) => { const number = start + 1 + index; const paddedNumber = ` ${number}`.slice(-numberMaxWidth); const gutter = ` ${paddedNumber} | `; @@ -6756,7 +6716,7 @@ function codeFrameColumns(rawLines, loc, opts = {}) { } } -function _default(rawLines, lineNumber, colNumber, opts = {}) { +function _default$2(rawLines, lineNumber, colNumber, opts = {}) { if (!deprecationWarningShown) { deprecationWarningShown = true; const message = "Passing lineNumber and colNumber is deprecated to @babel/code-frame. Please use `codeFrameColumns`."; @@ -6779,15 +6739,16 @@ function _default(rawLines, lineNumber, colNumber, opts = {}) { }; return codeFrameColumns(rawLines, location, opts); } -}); -unwrapExports(lib$2); -var lib_1$2 = lib$2.codeFrameColumns; +var lib$2 = /*#__PURE__*/Object.defineProperty({ + codeFrameColumns: codeFrameColumns_1, + default: default_1 +}, '__esModule', {value: true}); -var require$$0 = getCjsExportFromNamespace(dist); +var require$$0 = /*@__PURE__*/getAugmentedNamespace(dist); const {default: LinesAndColumns$1} = require$$0; -const {codeFrameColumns} = lib$2; +const {codeFrameColumns: codeFrameColumns$1} = lib$2; const JSONError = errorEx_1('JSONError', { fileName: errorEx_1.append('in %s'), @@ -6821,7 +6782,7 @@ var parseJson$1 = (string, reviver, filename) => { const index = Number(indexMatch[1]); const location = lines.locationForIndex(index); - const codeFrame = codeFrameColumns( + const codeFrame = codeFrameColumns$1( string, {start: {line: location.line + 1, column: location.column + 1}}, {highlightCode: true} @@ -6837,7 +6798,6 @@ var parseJson$1 = (string, reviver, filename) => { /** * Helpers. */ - var s = 1000; var m = s * 60; var h = m * 60; @@ -7010,16 +6970,12 @@ function setup(env) { createDebug.enable = enable; createDebug.enabled = enabled; createDebug.humanize = ms; + createDebug.destroy = destroy; Object.keys(env).forEach(key => { createDebug[key] = env[key]; }); - /** - * Active `debug` instances. - */ - createDebug.instances = []; - /** * The currently active debug mode names, and names to skip. */ @@ -7061,6 +7017,7 @@ function setup(env) { */ function createDebug(namespace) { let prevTime; + let enableOverride = null; function debug(...args) { // Disabled? @@ -7090,7 +7047,7 @@ function setup(env) { args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => { // If we encounter an escaped % then don't increase the array index if (match === '%%') { - return match; + return '%'; } index++; const formatter = createDebug.formatters[format]; @@ -7113,31 +7070,28 @@ function setup(env) { } debug.namespace = namespace; - debug.enabled = createDebug.enabled(namespace); debug.useColors = createDebug.useColors(); debug.color = createDebug.selectColor(namespace); - debug.destroy = destroy; debug.extend = extend; + debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release. + + Object.defineProperty(debug, 'enabled', { + enumerable: true, + configurable: false, + get: () => enableOverride === null ? createDebug.enabled(namespace) : enableOverride, + set: v => { + enableOverride = v; + } + }); // Env-specific initialization logic for debug instances if (typeof createDebug.init === 'function') { createDebug.init(debug); } - createDebug.instances.push(debug); - return debug; } - function destroy() { - const index = createDebug.instances.indexOf(this); - if (index !== -1) { - createDebug.instances.splice(index, 1); - return true; - } - return false; - } - function extend(namespace, delimiter) { const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace); newDebug.log = this.log; @@ -7175,11 +7129,6 @@ function setup(env) { createDebug.names.push(new RegExp('^' + namespaces + '$')); } } - - for (i = 0; i < createDebug.instances.length; i++) { - const instance = createDebug.instances[i]; - instance.enabled = createDebug.enabled(instance.namespace); - } } /** @@ -7254,6 +7203,14 @@ function setup(env) { return val; } + /** + * XXX DO NOT USE. This is a temporary stub function. + * XXX It WILL be removed in the next major release. + */ + function destroy() { + console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'); + } + createDebug.enable(createDebug.load()); return createDebug; @@ -7261,9 +7218,9 @@ function setup(env) { var common$1 = setup; -var browser = createCommonjsModule(function (module, exports) { /* eslint-env browser */ +var browser = createCommonjsModule(function (module, exports) { /** * This is the web browser implementation of `debug()`. */ @@ -7273,6 +7230,16 @@ exports.save = save; exports.load = load; exports.useColors = useColors; exports.storage = localstorage(); +exports.destroy = (() => { + let warned = false; + + return () => { + if (!warned) { + warned = true; + console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'); + } + }; +})(); /** * Colors. @@ -7522,13 +7489,6 @@ formatters.j = function (v) { } }; }); -var browser_1 = browser.formatArgs; -var browser_2 = browser.save; -var browser_3 = browser.load; -var browser_4 = browser.useColors; -var browser_5 = browser.storage; -var browser_6 = browser.colors; -var browser_7 = browser.log; var hasFlag$1 = (flag, argv = process.argv) => { const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--'); @@ -7668,14 +7628,11 @@ var supportsColor_1$1 = { stderr: translateLevel$1(supportsColor$1(true, tty__default['default'].isatty(2))) }; -var node = createCommonjsModule(function (module, exports) { /** * Module dependencies. */ - - - +var node = createCommonjsModule(function (module, exports) { /** * This is the Node.js implementation of `debug()`. */ @@ -7686,6 +7643,10 @@ exports.formatArgs = formatArgs; exports.save = save; exports.load = load; exports.useColors = useColors; +exports.destroy = util__default['default'].deprecate( + () => {}, + 'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.' +); /** * Colors. @@ -7915,7 +7876,9 @@ const {formatters} = module.exports; formatters.o = function (v) { this.inspectOpts.colors = this.useColors; return util__default['default'].inspect(v, this.inspectOpts) - .replace(/\s*\n\s*/g, ' '); + .split('\n') + .map(str => str.trim()) + .join(' '); }; /** @@ -7927,21 +7890,13 @@ formatters.O = function (v) { return util__default['default'].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 src = createCommonjsModule(function (module) { /** * Detect Electron renderer / nwjs process, which is node, but we should * treat as a browser. */ +var src = createCommonjsModule(function (module) { if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) { module.exports = browser; } else { @@ -7972,10 +7927,10 @@ const resolveFrom = (fromDirectory, moduleId, silent) => { const fromFile = path__default['default'].join(fromDirectory, 'noop.js'); - const resolveFileName = () => module__default['default']._resolveFilename(moduleId, { + const resolveFileName = () => Module__default['default']._resolveFilename(moduleId, { id: fromFile, filename: fromFile, - paths: module__default['default']._nodeModulePaths(fromDirectory) + paths: Module__default['default']._nodeModulePaths(fromDirectory) }); if (silent) { @@ -8211,8 +8166,8 @@ const pTry = (fn, ...arguments_) => new Promise(resolve => { var pTry_1 = pTry; // TODO: remove this in the next major version -var _default = pTry; -pTry_1.default = _default; +var _default$3 = pTry; +pTry_1.default = _default$3; const pLimit = concurrency => { if (!((Number.isInteger(concurrency) || concurrency === Infinity) && concurrency > 0)) { @@ -8267,8 +8222,8 @@ const pLimit = concurrency => { }; var pLimit_1 = pLimit; -var _default$1 = pLimit; -pLimit_1.default = _default$1; +var _default$4 = pLimit; +pLimit_1.default = _default$4; class EndError extends Error { constructor(value) { @@ -8388,7 +8343,7 @@ function encode (obj, opt) { whitespace: false, }; } else { - opt = opt || Object.create(null); + opt = opt || {}; opt.whitespace = opt.whitespace === true; } @@ -8435,7 +8390,7 @@ function dotSplit (str) { } function decode (str) { - var out = Object.create(null); + var out = {}; var p = out; var section = null; // section |key = value @@ -8453,10 +8408,10 @@ function decode (str) { if (section === '__proto__') { // not allowed // keep parsing the section, but don't attach it. - p = Object.create(null); + p = {}; return } - p = out[section] = out[section] || Object.create(null); + p = out[section] = out[section] || {}; return } var key = unsafe(match[2]); @@ -8506,7 +8461,7 @@ function decode (str) { if (part === '__proto__') return if (!p[part] || typeof p[part] !== 'object') - p[part] = Object.create(null); + p[part] = {}; p = p[part]; }); if (p === out && nl === l) @@ -8575,12 +8530,6 @@ function unsafe (val, doUnesc) { 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. @@ -9282,15 +9231,15 @@ function create(buf, filePath) { // Basically `Module.prototype.load`, but for a buffer instead of a file path. function loadScript(buf, filePath) { - var submodule = module__default['default']._cache[filePath]; + var submodule = Module__default['default']._cache[filePath]; if (!submodule) { - submodule = new module__default['default'](filePath, module); + submodule = new Module__default['default'](filePath, module); submodule.filename = filePath; - submodule.paths = module__default['default']._nodeModulePaths(dirname(filePath)); + submodule.paths = Module__default['default']._nodeModulePaths(dirname(filePath)); submodule._compile(String(buf), filePath); submodule.loaded = true; - module__default['default']._cache[filePath] = submodule; + Module__default['default']._cache[filePath] = submodule; } return submodule.exports @@ -13386,7 +13335,6 @@ Glob.prototype._stat2 = function (f, abs, er, stat, cb) { * @author Feross Aboukhadijeh * @license MIT */ - var isBuffer = function isBuffer (obj) { return obj != null && obj.constructor != null && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj) @@ -13532,53 +13480,49 @@ function parseOrigin(origin) { return result } -function replaceExt(npath, ext) { - if (typeof npath !== 'string') { - return npath; - } - - if (npath.length === 0) { - return npath; - } - - var nFileName = path__default['default'].basename(npath, path__default['default'].extname(npath)) + ext; - return path__default['default'].join(path__default['default'].dirname(npath), nFileName); -} +var minpath = path__default['default']; -var replaceExt_1 = replaceExt; +var minproc = process; var core$1 = VFile; var own$1 = {}.hasOwnProperty; -var proto$1 = VFile.prototype; // Order of setting (least specific to most), we need this because otherwise // `{stem: 'a', path: '~/b.js'}` would throw, as a path is needed before a // stem can be set. var order = ['history', 'path', 'basename', 'stem', 'extname', 'dirname']; -proto$1.toString = toString; +VFile.prototype.toString = toString; // Access full path (`~/index.min.js`). -Object.defineProperty(proto$1, 'path', {get: getPath, set: setPath}); +Object.defineProperty(VFile.prototype, 'path', {get: getPath, set: setPath}); // Access parent path (`~`). -Object.defineProperty(proto$1, 'dirname', {get: getDirname, set: setDirname}); +Object.defineProperty(VFile.prototype, 'dirname', { + get: getDirname, + set: setDirname +}); // Access basename (`index.min.js`). -Object.defineProperty(proto$1, 'basename', {get: getBasename, set: setBasename}); +Object.defineProperty(VFile.prototype, 'basename', { + get: getBasename, + set: setBasename +}); // Access extname (`.js`). -Object.defineProperty(proto$1, 'extname', {get: getExtname, set: setExtname}); +Object.defineProperty(VFile.prototype, 'extname', { + get: getExtname, + set: setExtname +}); // Access stem (`index.min`). -Object.defineProperty(proto$1, 'stem', {get: getStem, set: setStem}); +Object.defineProperty(VFile.prototype, 'stem', {get: getStem, set: setStem}); // Construct a new file. function VFile(options) { var prop; var index; - var length; if (!options) { options = {}; @@ -13595,13 +13539,12 @@ function VFile(options) { this.data = {}; this.messages = []; this.history = []; - this.cwd = process.cwd(); + this.cwd = minproc.cwd(); // Set path related properties in the correct order. index = -1; - length = order.length; - while (++index < length) { + while (++index < order.length) { prop = order[index]; if (own$1.call(options, prop)) { @@ -13611,7 +13554,7 @@ function VFile(options) { // Set non-path related properties. for (prop in options) { - if (order.indexOf(prop) === -1) { + if (order.indexOf(prop) < 0) { this[prop] = options[prop]; } } @@ -13624,76 +13567,73 @@ function getPath() { function setPath(path) { assertNonEmpty(path, 'path'); - if (path !== this.path) { + if (this.path !== path) { this.history.push(path); } } function getDirname() { - return typeof this.path === 'string' ? path__default['default'].dirname(this.path) : undefined + return typeof this.path === 'string' ? minpath.dirname(this.path) : undefined } function setDirname(dirname) { assertPath(this.path, 'dirname'); - this.path = path__default['default'].join(dirname || '', this.basename); + this.path = minpath.join(dirname || '', this.basename); } function getBasename() { - return typeof this.path === 'string' ? path__default['default'].basename(this.path) : undefined + return typeof this.path === 'string' ? minpath.basename(this.path) : undefined } function setBasename(basename) { assertNonEmpty(basename, 'basename'); assertPart(basename, 'basename'); - this.path = path__default['default'].join(this.dirname || '', basename); + this.path = minpath.join(this.dirname || '', basename); } function getExtname() { - return typeof this.path === 'string' ? path__default['default'].extname(this.path) : undefined + return typeof this.path === 'string' ? minpath.extname(this.path) : undefined } function setExtname(extname) { - var ext = extname || ''; - - assertPart(ext, 'extname'); + assertPart(extname, 'extname'); assertPath(this.path, 'extname'); - if (ext) { - if (ext.charAt(0) !== '.') { + if (extname) { + if (extname.charCodeAt(0) !== 46 /* `.` */) { throw new Error('`extname` must start with `.`') } - if (ext.indexOf('.', 1) !== -1) { + if (extname.indexOf('.', 1) > -1) { throw new Error('`extname` cannot contain multiple dots') } } - this.path = replaceExt_1(this.path, ext); + this.path = minpath.join(this.dirname, this.stem + (extname || '')); } function getStem() { return typeof this.path === 'string' - ? path__default['default'].basename(this.path, this.extname) + ? minpath.basename(this.path, this.extname) : undefined } function setStem(stem) { assertNonEmpty(stem, 'stem'); assertPart(stem, 'stem'); - this.path = path__default['default'].join(this.dirname || '', stem + (this.extname || '')); + this.path = minpath.join(this.dirname || '', stem + (this.extname || '')); } // Get the value of the file. function toString(encoding) { - var value = this.contents || ''; - return isBuffer(value) ? value.toString(encoding) : String(value) + return (this.contents || '').toString(encoding) } -// Assert that `part` is not a path (i.e., does not contain `path.sep`). +// Assert that `part` is not a path (i.e., does not contain `p.sep`). function assertPart(part, name) { - if (part.indexOf(path__default['default'].sep) !== -1) { + if (part && part.indexOf(minpath.sep) > -1) { throw new Error( - '`' + name + '` cannot be a path: did not expect `' + path__default['default'].sep + '`' + '`' + name + '` cannot be a path: did not expect `' + minpath.sep + '`' ) } } @@ -13712,23 +13652,20 @@ function assertPath(path, name) { } } -var vfile = core$1; - -var proto$2 = core$1.prototype; +var lib$3 = core$1; -proto$2.message = message; -proto$2.info = info; -proto$2.fail = fail; +core$1.prototype.message = message; +core$1.prototype.info = info; +core$1.prototype.fail = fail; // Create a message with `reason` at `position`. // When an error is passed in as `reason`, copies the stack. function message(reason, position, origin) { - var filePath = this.path; var message = new vfileMessage(reason, position, origin); - if (filePath) { - message.name = filePath + ':' + message.name; - message.file = filePath; + if (this.path) { + message.name = this.path + ':' + message.name; + message.file = this.path; } message.fatal = false; @@ -13757,6 +13694,8 @@ function info() { return message } +var vfile = lib$3; + var core$2 = toVFile; // Create a virtual file from a description. If `options` is a string or a @@ -14938,19 +14877,8 @@ function packF32(v) { return packIEEE754(v, 8, 23); } }()); }); -var typedarray_1 = typedarray.ArrayBuffer; -var typedarray_2 = typedarray.Int8Array; -var typedarray_3 = typedarray.Uint8Array; -var typedarray_4 = typedarray.Uint8ClampedArray; -var typedarray_5 = typedarray.Int16Array; -var typedarray_6 = typedarray.Uint16Array; -var typedarray_7 = typedarray.Int32Array; -var typedarray_8 = typedarray.Uint32Array; -var typedarray_9 = typedarray.Float32Array; -var typedarray_10 = typedarray.Float64Array; -var typedarray_11 = typedarray.DataView; -var Writable = stream__default['default'].Writable; +var Writable = require$$0__default['default'].Writable; @@ -15367,7 +15295,7 @@ function isEmpty(val) { * @type {Function} */ -var lib$3 = isEmpty; +var lib$4 = isEmpty; var debug$3 = src('unified-engine:file-pipeline:configure'); @@ -15417,7 +15345,7 @@ function configure$1(context, file, fileSet, next) { } // Allow for default arguments in es2020. - if (options === null || (typeof options === 'object' && lib$3(options))) { + if (options === null || (typeof options === 'object' && lib$4(options))) { options = undefined; } @@ -15732,7 +15660,7 @@ function formatNode(node) { ignore$2.indexOf(key) !== -1 || value === null || value === undefined || - (typeof value === 'object' && lib$3(value)) + (typeof value === 'object' && lib$4(value)) ) { continue } @@ -16240,8 +16168,8 @@ const isFullwidthCodePoint = codePoint => { }; var isFullwidthCodePoint_1 = isFullwidthCodePoint; -var _default$2 = isFullwidthCodePoint; -isFullwidthCodePoint_1.default = _default$2; +var _default$5 = isFullwidthCodePoint; +isFullwidthCodePoint_1.default = _default$5; var emojiRegex = function () { // https://mths.be/emoji @@ -16285,8 +16213,8 @@ const stringWidth = string => { var stringWidth_1 = stringWidth; // TODO: remove this in the next major version -var _default$3 = stringWidth; -stringWidth_1.default = _default$3; +var _default$6 = stringWidth; +stringWidth_1.default = _default$6; /*! * repeat-string @@ -16400,33 +16328,14 @@ var supported = supportsColor_1$2.stderr.hasBasic; var vfileReporter = reporter; -// Check which characters should be used. -var windows$1 = process.platform === 'win32'; +var push = [].push; + // `log-symbols` without chalk: /* istanbul ignore next - Windows. */ -var chars = windows$1 ? {error: 'Ɨ', warning: 'ā€¼'} : {error: 'āœ–', warning: 'āš '}; - -// Match trailing white-space. -var trailing = /\s*$/; - -// Default filename. -var defaultName = ''; - -var noop = {open: '', close: ''}; - -var colors = { - underline: {open: '\u001B[4m', close: '\u001B[24m'}, - red: {open: '\u001B[31m', close: '\u001B[39m'}, - yellow: {open: '\u001B[33m', close: '\u001B[39m'}, - green: {open: '\u001B[32m', close: '\u001B[39m'} -}; - -var noops = { - underline: noop, - red: noop, - yellow: noop, - green: noop -}; +var chars = + process.platform === 'win32' + ? {error: 'Ɨ', warning: 'ā€¼'} + : {error: 'āœ–', warning: 'āš '}; var labels = { true: 'error', @@ -16455,223 +16364,183 @@ function reporter(files, options) { files = [files]; } - return compile$1(parse$4(filter$1(files, settings), settings), one, settings) -} - -function filter$1(files, options) { - var result = []; - var length = files.length; - var index = -1; - var file; - - if (!options.quiet && !options.silent) { - return files.concat() - } - - while (++index < length) { - file = files[index]; - - if (applicable(file, options).length !== 0) { - result.push(file); - } - } - - return result + return format$1(transform$2(files, settings), one, settings) } -function parse$4(files, options) { - var length = files.length; +function transform$2(files, options) { var index = -1; var rows = []; var all = []; - var locationSize = 0; - var labelSize = 0; - var reasonSize = 0; - var ruleIdSize = 0; - var file; - var destination; - var origin; + var sizes = {}; var messages; var offset; - var count; var message; - var loc; - var reason; - var label; - var id; - - while (++index < length) { - file = files[index]; - destination = file.path; - origin = file.history[0] || destination; - messages = vfileSort({messages: applicable(file, options)}).messages; - - if (rows.length !== 0 && rows[rows.length - 1].type !== 'header') { - rows.push({type: 'separator'}); - } - - rows.push({ - type: 'header', - origin: origin, - destination: destination, - name: origin || options.defaultName || defaultName, - stored: Boolean(file.stored), - moved: Boolean(file.stored && destination !== origin), - stats: vfileStatistics(messages) - }); + var messageRows; + var row; + var key; + while (++index < files.length) { + messages = vfileSort({messages: files[index].messages.concat()}).messages; + messageRows = []; offset = -1; - count = messages.length; - while (++offset < count) { + while (++offset < messages.length) { message = messages[offset]; - id = message.ruleId || ''; - reason = message.stack || message.message; - loc = message.location; - loc = unistUtilStringifyPosition(loc.end.line && loc.end.column ? loc : loc.start); - - if (options.verbose && message.note) { - reason += '\n' + message.note; - } - label = labels[message.fatal]; + if (!options.silent || message.fatal) { + all.push(message); + + row = { + location: unistUtilStringifyPosition( + message.location.end.line && message.location.end.column + ? message.location + : message.location.start + ), + label: labels[message.fatal], + reason: + (message.stack || message.message) + + (options.verbose && message.note ? '\n' + message.note : ''), + ruleId: message.ruleId || '', + source: message.source || '' + }; - rows.push({ - location: loc, - label: label, - reason: reason, - ruleId: id, - source: message.source - }); + for (key in row) { + sizes[key] = Math.max(size(row[key]), sizes[key] || 0); + } - locationSize = Math.max(realLength(loc), locationSize); - labelSize = Math.max(realLength(label), labelSize); - reasonSize = Math.max(realLength(reason), reasonSize); - ruleIdSize = Math.max(realLength(id), ruleIdSize); + messageRows.push(row); + } } - all = all.concat(messages); + if ((!options.quiet && !options.silent) || messageRows.length) { + rows.push({type: 'file', file: files[index], stats: vfileStatistics(messages)}); + push.apply(rows, messageRows); + } } - return { - rows: rows, - statistics: vfileStatistics(all), - location: locationSize, - label: labelSize, - reason: reasonSize, - ruleId: ruleIdSize - } + return {rows: rows, stats: vfileStatistics(all), sizes: sizes} } -// eslint-disable-next-line complexity -function compile$1(map, one, options) { - var enabled = options.color; - var all = map.statistics; - var rows = map.rows; - var length = rows.length; - var index = -1; +function format$1(map, one, options) { + var enabled = options.color == null ? supported : options.color; var lines = []; + var index = -1; + var stats; var row; var line; - var style; - var color; var reason; var rest; - var position; - - if (enabled === null || enabled === undefined) { - enabled = supported; - } - - style = enabled ? colors : noops; - - while (++index < length) { - row = rows[index]; + var match; - if (row.type === 'separator') { - lines.push(''); - } else if (row.type === 'header') { - if (one && !options.defaultName && !row.origin) { - line = ''; - } else { - color = - style[row.stats.fatal ? 'red' : row.stats.total ? 'yellow' : 'green']; + while (++index < map.rows.length) { + row = map.rows[index]; + + if (row.type === 'file') { + stats = row.stats; + line = row.file.history[0] || options.defaultName || ''; + + line = + one && !options.defaultName && !row.file.history[0] + ? '' + : (enabled + ? '\x1b[4m' /* Underline. */ + + (stats.fatal + ? '\x1b[31m' /* Red. */ + : stats.total + ? '\x1b[33m' /* Yellow. */ + : '\x1b[32m') /* Green. */ + + line + + '\x1b[39m\x1b[24m' + : line) + + (row.file.stored && row.file.path !== row.file.history[0] + ? ' > ' + row.file.path + : ''); + + if (!stats.total) { line = - style.underline.open + - color.open + - row.name + - color.close + - style.underline.close; - line += row.moved ? ' > ' + row.destination : ''; + (line ? line + ': ' : '') + + (row.file.stored + ? enabled + ? '\x1b[33mwritten\x1b[39m' /* Yellow. */ + : 'written' + : 'no issues found'); } - if (!row.stats.total) { - line += line ? ': ' : ''; - - if (row.stored) { - line += style.yellow.open + 'written' + style.yellow.close; - } else { - line += 'no issues found'; + if (line) { + if (index && map.rows[index - 1].type !== 'file') { + lines.push(''); } - } - if (line) { lines.push(line); } } else { - color = style[row.label === 'error' ? 'red' : 'yellow']; - reason = row.reason; - rest = ''; - position = reason.indexOf('\n'); + match = /\r?\n|\r/.exec(reason); - if (position !== -1) { - rest = reason.slice(position); - reason = reason.slice(0, position); + if (match) { + rest = reason.slice(match.index); + reason = reason.slice(0, match.index); + } else { + rest = ''; } lines.push( - [ - '', - padLeft(row.location, map.location), - padRight(color.open + row.label + color.close, map.label), - padRight(reason, map.reason), - padRight(row.ruleId, map.ruleId), - row.source || '' - ] - .join(' ') - .replace(trailing, '') + rest + ( + ' ' + + repeatString(' ', map.sizes.location - size(row.location)) + + row.location + + ' ' + + (enabled + ? (row.label === 'error' + ? '\x1b[31m' /* Red. */ + : '\x1b[33m') /* Yellow. */ + + row.label + + '\x1b[39m' + : row.label) + + repeatString(' ', map.sizes.label - size(row.label)) + + ' ' + + reason + + repeatString(' ', map.sizes.reason - size(reason)) + + ' ' + + row.ruleId + + repeatString(' ', map.sizes.ruleId - size(row.ruleId)) + + ' ' + + (row.source || '') + ).replace(/ +$/, '') + rest ); } } - if (all.fatal || all.warn) { - line = []; + stats = map.stats; - if (all.fatal) { - line.push( - [ - style.red.open + chars.error + style.red.close, - all.fatal, - plural$1(labels.true, all.fatal) - ].join(' ') - ); - } + if (stats.fatal || stats.warn) { + line = ''; - if (all.warn) { - line.push( - [ - style.yellow.open + chars.warning + style.yellow.close, - all.warn, - plural$1(labels.false, all.warn) - ].join(' ') - ); + if (stats.fatal) { + line = + (enabled + ? '\x1b[31m' /* Red. */ + chars.error + '\x1b[39m' + : chars.error) + + ' ' + + stats.fatal + + ' ' + + (labels.true + (stats.fatal === 1 ? '' : 's')); } - line = line.join(', '); + if (stats.warn) { + line = + (line ? line + ', ' : '') + + (enabled + ? '\x1b[33m' /* Yellow. */ + chars.warning + '\x1b[39m' + : chars.warning) + + ' ' + + stats.warn + + ' ' + + (labels.false + (stats.warn === 1 ? '' : 's')); + } - if (all.total !== all.fatal && all.total !== all.warn) { - line = all.total + ' messages (' + line + ')'; + if (stats.total !== stats.fatal && stats.total !== stats.warn) { + line = stats.total + ' messages (' + line + ')'; } lines.push('', line); @@ -16680,43 +16549,10 @@ function compile$1(map, one, options) { return lines.join('\n') } -function applicable(file, options) { - var messages = file.messages; - var length = messages.length; - var index = -1; - var result = []; - - if (options.silent) { - while (++index < length) { - if (messages[index].fatal) { - result.push(messages[index]); - } - } - } else { - result = messages.concat(); - } - - return result -} - // Get the length of `value`, ignoring ANSI sequences. -function realLength(value) { - var length = value.indexOf('\n'); - return stringWidth_1(length === -1 ? value : value.slice(0, length)) -} - -// Pad `value` on the left. -function padLeft(value, minimum) { - return repeatString(' ', minimum - realLength(value)) + value -} - -// Pad `value` on the right. -function padRight(value, minimum) { - return value + repeatString(' ', minimum - realLength(value)) -} - -function plural$1(value, count) { - return count === 1 ? value : value + 's' +function size(value) { + var match = /\r?\n|\r/.exec(value); + return stringWidth_1(match ? value.slice(0, match.index) : value) } var log_1 = log; @@ -16767,11 +16603,11 @@ var fileSetPipeline = trough_1() .use(transform_1$1) .use(log_1); -var PassThrough = stream__default['default'].PassThrough; +var PassThrough = require$$0__default['default'].PassThrough; -var lib$4 = run; +var lib$5 = run; // Run the file set pipeline once. // `callback` is invoked with a fatal error, or with a status code (`0` on @@ -17069,6 +16905,7 @@ var colorName$1 = { }; /* MIT license */ + /* eslint-disable no-mixed-operators */ @@ -18518,7 +18355,7 @@ for (const model of usedModels) { }; } -const proto$3 = Object.defineProperties(() => {}, { +const proto$1 = Object.defineProperties(() => {}, { ...styles, level: { enumerable: true, @@ -18560,7 +18397,7 @@ const createBuilder = (self, _styler, _isEmpty) => { // `__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$3; // eslint-disable-line no-proto + builder.__proto__ = proto$1; // eslint-disable-line no-proto builder._generator = self; builder._styler = _styler; @@ -18893,17 +18730,6 @@ exports.wrapOutput = (input, state = {}, options = {}) => { return output; }; }); -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, /* * */ @@ -19335,7 +19161,7 @@ const syntaxError = (type, char) => { * @return {Object} */ -const parse$5 = (input, options) => { +const parse$4 = (input, options) => { if (typeof input !== 'string') { throw new TypeError('Expected a string'); } @@ -20271,7 +20097,7 @@ const parse$5 = (input, options) => { * impact when none of the fast paths match. */ -parse$5.fastpaths = (input, options) => { +parse$4.fastpaths = (input, options) => { const opts = { ...options }; const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH; const len = input.length; @@ -20358,7 +20184,7 @@ parse$5.fastpaths = (input, options) => { return source; }; -var parse_1$1 = parse$5; +var parse_1$1 = parse$4; const isObject$1 = val => val && typeof val === 'object' && !Array.isArray(val); @@ -20695,7 +20521,7 @@ var picomatch_1 = picomatch; var picomatch$1 = picomatch_1; -const { Readable } = stream__default['default']; +const { Readable } = require$$0__default['default']; const { promisify } = util__default['default']; @@ -20981,7 +20807,6 @@ var readdirp_1 = readdirp; * Copyright (c) 2014-2018, Jon Schlinkert. * Released under the MIT License. */ - var normalizePath = function(path, stripTrailing) { if (typeof path !== 'string') { throw new TypeError('expected path to be a string'); @@ -21011,19 +20836,12 @@ var normalizePath = function(path, stripTrailing) { return prefix + segs.join('/'); }; -var anymatch_1 = createCommonjsModule(function (module, exports) { - -Object.defineProperty(exports, "__esModule", { value: true }); - - - - /** * @typedef {(testString: string) => boolean} AnymatchFn * @typedef {string|RegExp|AnymatchFn} AnymatchPattern * @typedef {AnymatchPattern|AnymatchPattern[]} AnymatchMatcher */ -const BANG = '!'; +const BANG$1 = '!'; const DEFAULT_OPTIONS = {returnIndex: false}; const arrify = (item) => Array.isArray(item) ? item : [item]; @@ -21096,7 +20914,7 @@ const anymatch = (matchers, testString, options = DEFAULT_OPTIONS) => { // Early cache for matchers. const mtchers = arrify(matchers); const negatedGlobs = mtchers - .filter(item => typeof item === 'string' && item.charAt(0) === BANG) + .filter(item => typeof item === 'string' && item.charAt(0) === BANG$1) .map(item => item.slice(1)) .map(item => picomatch$1(item, opts)); const patterns = mtchers.map(matcher => createPattern(matcher, opts)); @@ -21112,10 +20930,7 @@ const anymatch = (matchers, testString, options = DEFAULT_OPTIONS) => { }; anymatch.default = anymatch; -module.exports = anymatch; -}); - -unwrapExports(anymatch_1); +var anymatch_1 = anymatch; /*! * is-extglob @@ -21123,7 +20938,6 @@ unwrapExports(anymatch_1); * Copyright (c) 2014-2016, Jon Schlinkert. * Licensed under the MIT License. */ - var isExtglob = function isExtglob(str) { if (typeof str !== 'string' || str === '') { return false; @@ -21145,7 +20959,6 @@ var isExtglob = function isExtglob(str) { * Released under the MIT License. */ - var chars$1 = { '{': '}', '(': ')', '[': ']'}; var strictRegex = /\\(.)|(^!|\*|[\].+)]\?|\[[^\\\]]+\]|\{[^\\}]+\}|\(\?[:!=][^\\)]+\)|\([^|]+\|[^\\)]+\))/; var relaxedRegex = /\\(.)|(^!|[*?{}()[\]]|\(\?)/; @@ -21339,15 +21152,6 @@ exports.flatten = (...args) => { return result; }; }); -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 = {}) => { @@ -21394,6 +21198,15 @@ var isNumber = function(num) { return false; }; +/*! + * to-regex-range + * + * Copyright (c) 2015-present, Jon Schlinkert. + * Released under the MIT License. + */ + + + const toRegexRange = (min, max, options) => { if (isNumber(min) === false) { throw new TypeError('toRegexRange: expected the first argument to be a number'); @@ -21672,9 +21485,19 @@ toRegexRange.clearCache = () => (toRegexRange.cache = {}); var toRegexRange_1 = toRegexRange; +/*! + * fill-range + * + * Copyright (c) 2014-present, Jon Schlinkert. + * Licensed under the MIT License. + */ + + + + const isObject$2 = val => val !== null && typeof val === 'object' && !Array.isArray(val); -const transform$2 = toNumber => { +const transform$3 = toNumber => { return value => toNumber === true ? Number(value) : String(value); }; @@ -21811,7 +21634,7 @@ const fillNumbers = (start, end, step = 1, options = {}) => { let padded = zeros(startString) || zeros(endString) || zeros(stepString); let maxLen = padded ? Math.max(startString.length, endString.length, stepString.length) : 0; let toNumber = padded === false && stringify$4(start, end, options) === false; - let format = options.transform || transform$2(toNumber); + let format = options.transform || transform$3(toNumber); if (options.toRegex && step === 1) { return toRange(toMaxLen(start, maxLen), toMaxLen(end, maxLen), true, options); @@ -21910,7 +21733,7 @@ const fill = (start, end, step, options = {}) => { var fillRange = fill; -const compile$2 = (ast, options = {}) => { +const compile$1 = (ast, options = {}) => { let walk = (node, parent = {}) => { let invalidBlock = utils$1.isInvalidBrace(parent); let invalidNode = node.invalid === true && options.escapeInvalid === true; @@ -21961,7 +21784,7 @@ const compile$2 = (ast, options = {}) => { return walk(ast); }; -var compile_1 = compile$2; +var compile_1 = compile$1; const append = (queue = '', stash = '', enclose = false) => { let result = []; @@ -22153,7 +21976,7 @@ const { * parse */ -const parse$6 = (input, options = {}) => { +const parse$5 = (input, options = {}) => { if (typeof input !== 'string') { throw new TypeError('Expected a string'); } @@ -22452,7 +22275,7 @@ const parse$6 = (input, options = {}) => { return ast; }; -var parse_1$2 = parse$6; +var parse_1$2 = parse$5; /** * Expand the given pattern or create a regex-compatible string. @@ -22618,7 +22441,7 @@ braces.create = (input, options = {}) => { var braces_1 = braces; -var binaryExtensions = [ +var require$$0$1 = [ "3dm", "3ds", "3g2", @@ -22875,16 +22698,9 @@ var binaryExtensions = [ "zipx" ]; -var binaryExtensions$1 = /*#__PURE__*/Object.freeze({ - __proto__: null, - 'default': binaryExtensions -}); - -var require$$0$1 = getCjsExportFromNamespace(binaryExtensions$1); +var binaryExtensions = require$$0$1; -var binaryExtensions$2 = require$$0$1; - -const extensions = new Set(binaryExtensions$2); +const extensions = new Set(binaryExtensions); var isBinaryPath = filePath => extensions.has(path__default['default'].extname(filePath).slice(1).toLowerCase()); @@ -22952,57 +22768,6 @@ exports.isWindows = platform === 'win32'; exports.isMacos = platform === 'darwin'; exports.isLinux = platform === 'linux'; }); -var constants_1 = constants$2.EV_ALL; -var constants_2 = constants$2.EV_READY; -var constants_3 = constants$2.EV_ADD; -var constants_4 = constants$2.EV_CHANGE; -var constants_5 = constants$2.EV_ADD_DIR; -var constants_6 = constants$2.EV_UNLINK; -var constants_7 = constants$2.EV_UNLINK_DIR; -var constants_8 = constants$2.EV_RAW; -var constants_9 = constants$2.EV_ERROR; -var constants_10 = constants$2.STR_DATA; -var constants_11 = constants$2.STR_END; -var constants_12 = constants$2.STR_CLOSE; -var constants_13 = constants$2.FSEVENT_CREATED; -var constants_14 = constants$2.FSEVENT_MODIFIED; -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_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.SLASH_SLASH; -var constants_34 = constants$2.BRACE_START; -var constants_35 = constants$2.BANG; -var constants_36 = constants$2.ONE_DOT; -var constants_37 = constants$2.TWO_DOTS; -var constants_38 = constants$2.STAR; -var constants_39 = constants$2.GLOBSTAR; -var constants_40 = constants$2.ROOT_GLOBSTAR; -var constants_41 = constants$2.SLASH_GLOBSTAR; -var constants_42 = constants$2.DIR_SUFFIX; -var constants_43 = constants$2.ANYMATCH_OPTS; -var constants_44 = constants$2.STRING_TYPE; -var constants_45 = constants$2.FUNCTION_TYPE; -var constants_46 = constants$2.EMPTY_STR; -var constants_47 = constants$2.EMPTY_FN; -var constants_48 = constants$2.IDENTITY_FN; -var constants_49 = constants$2.isWindows; -var constants_50 = constants$2.isMacos; -var constants_51 = constants$2.isLinux; const { promisify: promisify$1 } = util__default['default']; @@ -23235,18 +23000,14 @@ const setFsWatchFileListener = (path, fullPath, options, handlers) => { const {listener, rawEmitter} = handlers; let cont = FsWatchFileInstances.get(fullPath); - /* eslint-disable no-unused-vars, prefer-destructuring */ - let listeners = new Set(); - let rawEmitters = new Set(); - const copts = cont && cont.options; if (copts && (copts.persistent < options.persistent || copts.interval > options.interval)) { // "Upgrade" the watcher to persistence or a quicker interval. // This creates some unlikely edge case issues if the user mixes // settings in a very weird way, but solving for those cases // doesn't seem worthwhile for the added complexity. - listeners = cont.listeners; - rawEmitters = cont.rawEmitters; + cont.listeners; + cont.rawEmitters; fs__default['default'].unwatchFile(fullPath); cont = undefined; } @@ -23943,8 +23704,7 @@ handleEvent(event, path, fullPath, realPath, parent, watchedDir, item, info, opt * @returns {Function} closer for the watcher instance */ _watchWithFsEvents(watchPath, realPath, transform, globFilter) { - if (this.fsw.closed) return; - if (this.fsw._isIgnored(watchPath)) return; + if (this.fsw.closed || this.fsw._isIgnored(watchPath)) return; const opts = this.fsw.options; const watchCallback = async (fullPath, flags, info) => { if (this.fsw.closed) return; @@ -24173,7 +23933,7 @@ const { EventEmitter } = events__default['default']; const { promisify: promisify$3 } = util__default['default']; -const anymatch = anymatch_1.default; +const anymatch$1 = anymatch_1.default; @@ -24204,7 +23964,7 @@ const { SLASH: SLASH$1, SLASH_SLASH, BRACE_START: BRACE_START$1, - BANG: BANG$1, + BANG: BANG$2, ONE_DOT, TWO_DOTS, GLOBSTAR: GLOBSTAR$1, @@ -24242,7 +24002,7 @@ const readdir$2 = promisify$3(fs__default['default'].readdir); * @property {Function} filterDir */ -const arrify = (value = []) => Array.isArray(value) ? value : [value]; +const arrify$1 = (value = []) => Array.isArray(value) ? value : [value]; const flatten = (list, result = []) => { list.forEach(item => { if (Array.isArray(item)) { @@ -24258,7 +24018,7 @@ const unifyPaths = (paths_) => { /** * @type {Array} */ - const paths = flatten(arrify(paths_)); + const paths = flatten(arrify$1(paths_)); if (!paths.every(p => typeof p === STRING_TYPE)) { throw new TypeError(`Non-string provided as watch path: ${paths}`); } @@ -24295,8 +24055,8 @@ const getAbsolutePath = (path, cwd) => { if (path__default['default'].isAbsolute(path)) { return path; } - if (path.startsWith(BANG$1)) { - return BANG$1 + path__default['default'].join(cwd, path.slice(1)); + if (path.startsWith(BANG$2)) { + return BANG$2 + path__default['default'].join(cwd, path.slice(1)); } return path__default['default'].join(cwd, path); }; @@ -24378,7 +24138,7 @@ class WatchHelper { /** @type {object|boolean} */ if (path === EMPTY_STR$1) this.hasGlob = false; this.globSymlink = this.hasGlob && follow ? undefined : false; - this.globFilter = this.hasGlob ? anymatch(path, undefined, ANYMATCH_OPTS) : false; + this.globFilter = this.hasGlob ? anymatch$1(path, undefined, ANYMATCH_OPTS) : false; this.dirParts = this.getDirParts(path); this.dirParts.forEach((parts) => { if (parts.length > 1) parts.pop(); @@ -24436,7 +24196,7 @@ class WatchHelper { this.unmatchedGlob = !this.dirParts.some((parts) => { return parts.every((part, i) => { if (part === GLOBSTAR$1) globstar = true; - return globstar || !entryParts[0][i] || anymatch(part, entryParts[0][i], ANYMATCH_OPTS); + return globstar || !entryParts[0][i] || anymatch$1(part, entryParts[0][i], ANYMATCH_OPTS); }); }); } @@ -24531,7 +24291,7 @@ constructor(_opts) { if (!awf.pollInterval) awf.pollInterval = 100; this._pendingWrites = new Map(); } - if (opts.ignored) opts.ignored = arrify(opts.ignored); + if (opts.ignored) opts.ignored = arrify$1(opts.ignored); let readyCalls = 0; this._emitReady = () => { @@ -24585,7 +24345,7 @@ add(paths_, _origAdd, _internal) { // set aside negated glob strings paths = paths.filter((path) => { - if (path.startsWith(BANG$1)) { + if (path.startsWith(BANG$2)) { this._ignoredPaths.add(path.slice(1)); return false; } @@ -24931,11 +24691,11 @@ _isIgnored(path, stats) { const ign = this.options.ignored; const ignored = ign && ign.map(normalizeIgnored(cwd)); - const paths = arrify(ignored) + const paths = arrify$1(ignored) .filter((path) => typeof path === STRING_TYPE && !isGlob(path)) .map((path) => path + SLASH_GLOBSTAR); const list = this._getGlobIgnored().map(normalizeIgnored(cwd)).concat(ignored, paths); - this._userIgnored = anymatch(list, undefined, ANYMATCH_OPTS); + this._userIgnored = anymatch$1(list, undefined, ANYMATCH_OPTS); } return this._userIgnored([path, stats]); @@ -25032,6 +24792,15 @@ _remove(directory, item, isDirectory) { const wasTracked = parent.has(item); parent.remove(item); + // Fixes issue #1042 -> Relative paths were detected and added as symlinks + // (https://github.com/paulmillr/chokidar/blob/e1753ddbc9571bdc33b4a4af172d52cb6e611c10/lib/nodefs-handler.js#L612), + // but never removed from the map in case the path was deleted. + // This leads to an incorrect state if the path was recreated: + // https://github.com/paulmillr/chokidar/blob/e1753ddbc9571bdc33b4a4af172d52cb6e611c10/lib/nodefs-handler.js#L553 + if (this._symlinkPaths.has(fullPath)) { + this._symlinkPaths.delete(fullPath); + } + // If we wait for this file to be fully written, cancel the wait. let relPath = path; if (this.options.cwd) relPath = path__default['default'].relative(this.options.cwd, path); @@ -25290,8 +25059,8 @@ const camelCase = (input, options) => { var camelcase = camelCase; // TODO: Remove this for the next major release -var _default$4 = camelCase; -camelcase.default = _default$4; +var _default$7 = camelCase; +camelcase.default = _default$7; var minimist = function (args, opts) { if (!opts) opts = {}; @@ -25593,7 +25362,7 @@ let token; let key; let root; -var parse$7 = function parse (text, reviver) { +var parse$6 = function parse (text, reviver) { source$1 = String(text); parseState = 'start'; stack = []; @@ -26404,7 +26173,7 @@ const parseStates = { throw invalidEOF() } - push(); + push$1(); }, beforePropertyName () { @@ -26450,7 +26219,7 @@ const parseStates = { throw invalidEOF() } - push(); + push$1(); }, beforeArrayValue () { @@ -26463,7 +26232,7 @@ const parseStates = { return } - push(); + push$1(); }, afterPropertyValue () { @@ -26520,7 +26289,7 @@ const parseStates = { }, }; -function push () { +function push$1 () { let value; switch (token.type) { @@ -26930,15 +26699,15 @@ var stringify$5 = function stringify (value, replacer, space) { }; const JSON5 = { - parse: parse$7, + parse: parse$6, stringify: stringify$5, }; -var lib$5 = JSON5; +var lib$6 = JSON5; var dist$1 = /*#__PURE__*/Object.freeze({ __proto__: null, - 'default': lib$5 + 'default': lib$6 }); var schema$1 = [ @@ -27103,14 +26872,7 @@ var schema$1 = [ } ]; -var schema$2 = /*#__PURE__*/Object.freeze({ - __proto__: null, - 'default': schema$1 -}); - -var json5 = getCjsExportFromNamespace(dist$1); - -var schema$3 = getCjsExportFromNamespace(schema$2); +var json5 = /*@__PURE__*/getAugmentedNamespace(dist$1); var options_1 = options; @@ -27123,7 +26885,7 @@ var minischema = { boolean: [] }; -schema$3.forEach(addEach); +schema$1.forEach(addEach); // Parse CLI options. function options(flags, configuration) { @@ -27134,7 +26896,7 @@ function options(flags, configuration) { var ext; var report; - schema$3.forEach(function (option) { + schema$1.forEach(function (option) { if (option.type === 'string' && config[option.long] === '') { throw fault_1('Missing value:%s', inspect$1(option).join(' ')) } @@ -27144,7 +26906,7 @@ function options(flags, configuration) { report = reporter$1(config.report); help = [ - inspectAll(schema$3), + inspectAll(schema$1), '', 'Examples:', '', @@ -27281,19 +27043,19 @@ function handleUnknownArgument(flag) { // Long options, always unknown. if (flag.charAt(1) === '-') { - throw fault_1('Unknown option `%s`, expected:\n%s', flag, inspectAll(schema$3)) + throw fault_1('Unknown option `%s`, expected:\n%s', flag, inspectAll(schema$1)) } // Short options, can be grouped. flag.slice(1).split('').forEach(each); function each(key) { - var length = schema$3.length; + var length = schema$1.length; var index = -1; var option; while (++index < length) { - option = schema$3[index]; + option = schema$1[index]; if (option.short === key) { return @@ -27303,7 +27065,7 @@ function handleUnknownArgument(flag) { throw fault_1( 'Unknown short option `-%s`, expected:\n%s', key, - inspectAll(schema$3.filter(short)) + inspectAll(schema$1.filter(short)) ) } @@ -27385,12 +27147,12 @@ function parseJSON(value) { return json5.parse('{' + value + '}') } -var lib$6 = start; +var lib$7 = start; -var noop$1 = Function.prototype; +var noop = Function.prototype; // Fake TTY stream. -var ttyStream = new stream__default['default'].Readable(); +var ttyStream = new require$$0__default['default'].Readable(); ttyStream.isTTY = true; // Exit, lazily, with the correct exit status code. @@ -27425,14 +27187,14 @@ function start(cliConfig) { config.helpMessage, '' ].join('\n'), - noop$1 + noop ); return } if (config.version) { - process.stdout.write(cliConfig.version + '\n', noop$1); + process.stdout.write(cliConfig.version + '\n', noop); return } @@ -27449,7 +27211,7 @@ function start(cliConfig) { process.stderr.write( source.bold('Watching...') + ' (press CTRL+C to exit)\n', - noop$1 + noop ); // Prevent infinite loop if set to regeneration. @@ -27458,13 +27220,13 @@ function start(cliConfig) { process.stderr.write( source.yellow('Note') + ': Ignoring `--output` until exit.\n', - noop$1 + noop ); } } // Initial run. - lib$4(config, done); + lib$5(config, done); // Handle complete run. function done(err, code, context) { @@ -27500,12 +27262,12 @@ function start(cliConfig) { function onchange(filePath) { config.files = [filePath]; - lib$4(config, done); + lib$5(config, done); } function onsigint() { // Hide the `^C` in terminal. - process.stderr.write('\n', noop$1); + process.stderr.write('\n', noop); clean(); @@ -27513,7 +27275,7 @@ function start(cliConfig) { if (output === true) { config.output = output; config.watch = false; - lib$4(config, done); + lib$5(config, done); } } } @@ -27527,7 +27289,7 @@ function fail$1(err, pretty) { exitStatus = 1; - process.stderr.write(message.trim() + '\n', noop$1); + process.stderr.write(message.trim() + '\n', noop); } function onexit() { @@ -27536,9 +27298,9 @@ function onexit() { /* eslint-enable unicorn/no-process-exit */ } -var unifiedArgs = lib$6; +var unifiedArgs = lib$7; -var markdownExtensions = [ +var require$$0$2 = [ "md", "markdown", "mdown", @@ -27549,14 +27311,7 @@ var markdownExtensions = [ "ron" ]; -var markdownExtensions$1 = /*#__PURE__*/Object.freeze({ - __proto__: null, - 'default': markdownExtensions -}); - -var require$$0$2 = getCjsExportFromNamespace(markdownExtensions$1); - -var markdownExtensions$2 = require$$0$2; +var markdownExtensions = require$$0$2; var bail_1 = bail; @@ -28141,6688 +27896,6 @@ function assertDone(name, asyncName, complete) { } } -const AEli = "Ɔ"; -const AElig = "Ɔ"; -const AM = "&"; -const AMP = "&"; -const Aacut = "Ɓ"; -const Aacute = "Ɓ"; -const Abreve = "Ă"; -const Acir = "Ƃ"; -const Acirc = "Ƃ"; -const Acy = "Š"; -const Afr = "š”„"; -const Agrav = "ƀ"; -const Agrave = "ƀ"; -const Alpha = "Ī‘"; -const Amacr = "Ā"; -const And = "ā©“"; -const Aogon = "Ą"; -const Aopf = "š”ø"; -const ApplyFunction = "ā”"; -const Arin = "ƅ"; -const Aring = "ƅ"; -const Ascr = "š’œ"; -const Assign = "ā‰”"; -const Atild = "ƃ"; -const Atilde = "ƃ"; -const Aum = "Ƅ"; -const Auml = "Ƅ"; -const Backslash = "āˆ–"; -const Barv = "ā«§"; -const Barwed = "āŒ†"; -const Bcy = "Š‘"; -const Because = "āˆµ"; -const Bernoullis = "ā„¬"; -const Beta = "Ī’"; -const Bfr = "š”…"; -const Bopf = "š”¹"; -const Breve = "Ė˜"; -const Bscr = "ā„¬"; -const Bumpeq = "ā‰Ž"; -const CHcy = "Š§"; -const COP = "Ā©"; -const COPY = "Ā©"; -const Cacute = "Ć"; -const Cap = "ā‹’"; -const CapitalDifferentialD = "ā……"; -const Cayleys = "ā„­"; -const Ccaron = "Č"; -const Ccedi = "Ƈ"; -const Ccedil = "Ƈ"; -const Ccirc = "Ĉ"; -const Cconint = "āˆ°"; -const Cdot = "Ċ"; -const Cedilla = "Āø"; -const CenterDot = "Ā·"; -const Cfr = "ā„­"; -const Chi = "Ī§"; -const CircleDot = "āŠ™"; -const CircleMinus = "āŠ–"; -const CirclePlus = "āŠ•"; -const CircleTimes = "āŠ—"; -const ClockwiseContourIntegral = "āˆ²"; -const CloseCurlyDoubleQuote = "ā€"; -const CloseCurlyQuote = "ā€™"; -const Colon = "āˆ·"; -const Colone = "ā©“"; -const Congruent = "ā‰”"; -const Conint = "āˆÆ"; -const ContourIntegral = "āˆ®"; -const Copf = "ā„‚"; -const Coproduct = "āˆ"; -const CounterClockwiseContourIntegral = "āˆ³"; -const Cross = "āØÆ"; -const Cscr = "š’ž"; -const Cup = "ā‹“"; -const CupCap = "ā‰"; -const DD = "ā……"; -const DDotrahd = "ā¤‘"; -const DJcy = "Š‚"; -const DScy = "Š…"; -const DZcy = "Š"; -const Dagger = "ā€”"; -const Darr = "ā†”"; -const Dashv = "ā«¤"; -const Dcaron = "Ď"; -const Dcy = "Š”"; -const Del = "āˆ‡"; -const Delta = "Ī”"; -const Dfr = "š”‡"; -const DiacriticalAcute = "Ā“"; -const DiacriticalDot = "Ė™"; -const DiacriticalDoubleAcute = "Ė"; -const DiacriticalGrave = "`"; -const DiacriticalTilde = "Ėœ"; -const Diamond = "ā‹„"; -const DifferentialD = "ā…†"; -const Dopf = "š”»"; -const Dot = "ĀØ"; -const DotDot = "āƒœ"; -const DotEqual = "ā‰"; -const DoubleContourIntegral = "āˆÆ"; -const DoubleDot = "ĀØ"; -const DoubleDownArrow = "ā‡“"; -const DoubleLeftArrow = "ā‡"; -const DoubleLeftRightArrow = "ā‡”"; -const DoubleLeftTee = "ā«¤"; -const DoubleLongLeftArrow = "āŸø"; -const DoubleLongLeftRightArrow = "āŸŗ"; -const DoubleLongRightArrow = "āŸ¹"; -const DoubleRightArrow = "ā‡’"; -const DoubleRightTee = "āŠØ"; -const DoubleUpArrow = "ā‡‘"; -const DoubleUpDownArrow = "ā‡•"; -const DoubleVerticalBar = "āˆ„"; -const DownArrow = "ā†“"; -const DownArrowBar = "ā¤“"; -const DownArrowUpArrow = "ā‡µ"; -const DownBreve = "Ģ‘"; -const DownLeftRightVector = "ā„"; -const DownLeftTeeVector = "ā„ž"; -const DownLeftVector = "ā†½"; -const DownLeftVectorBar = "ā„–"; -const DownRightTeeVector = "ā„Ÿ"; -const DownRightVector = "ā‡"; -const DownRightVectorBar = "ā„—"; -const DownTee = "āŠ¤"; -const DownTeeArrow = "ā†§"; -const Downarrow = "ā‡“"; -const Dscr = "š’Ÿ"; -const Dstrok = "Đ"; -const ENG = "Ŋ"; -const ET = "Ɛ"; -const ETH = "Ɛ"; -const Eacut = "Ɖ"; -const Eacute = "Ɖ"; -const Ecaron = "Ě"; -const Ecir = "Ɗ"; -const Ecirc = "Ɗ"; -const Ecy = "Š­"; -const Edot = "Ė"; -const Efr = "š”ˆ"; -const Egrav = "ƈ"; -const Egrave = "ƈ"; -const Element = "āˆˆ"; -const Emacr = "Ē"; -const EmptySmallSquare = "ā—»"; -const EmptyVerySmallSquare = "ā–«"; -const Eogon = "Ę"; -const Eopf = "š”¼"; -const Epsilon = "Ī•"; -const Equal = "ā©µ"; -const EqualTilde = "ā‰‚"; -const Equilibrium = "ā‡Œ"; -const Escr = "ā„°"; -const Esim = "ā©³"; -const Eta = "Ī—"; -const Eum = "Ƌ"; -const Euml = "Ƌ"; -const Exists = "āˆƒ"; -const ExponentialE = "ā…‡"; -const Fcy = "Š¤"; -const Ffr = "š”‰"; -const FilledSmallSquare = "ā—¼"; -const FilledVerySmallSquare = "ā–Ŗ"; -const Fopf = "š”½"; -const ForAll = "āˆ€"; -const Fouriertrf = "ā„±"; -const Fscr = "ā„±"; -const GJcy = "Šƒ"; -const G = ">"; -const GT = ">"; -const Gamma = "Ī“"; -const Gammad = "Ļœ"; -const Gbreve = "Ğ"; -const Gcedil = "Ä¢"; -const Gcirc = "Ĝ"; -const Gcy = "Š“"; -const Gdot = "Ä "; -const Gfr = "š”Š"; -const Gg = "ā‹™"; -const Gopf = "š”¾"; -const GreaterEqual = "ā‰„"; -const GreaterEqualLess = "ā‹›"; -const GreaterFullEqual = "ā‰§"; -const GreaterGreater = "āŖ¢"; -const GreaterLess = "ā‰·"; -const GreaterSlantEqual = "ā©¾"; -const GreaterTilde = "ā‰³"; -const Gscr = "š’¢"; -const Gt = "ā‰«"; -const HARDcy = "ŠŖ"; -const Hacek = "Ė‡"; -const Hat = "^"; -const Hcirc = "Ĥ"; -const Hfr = "ā„Œ"; -const HilbertSpace = "ā„‹"; -const Hopf = "ā„"; -const HorizontalLine = "ā”€"; -const Hscr = "ā„‹"; -const Hstrok = "Ħ"; -const HumpDownHump = "ā‰Ž"; -const HumpEqual = "ā‰"; -const IEcy = "Š•"; -const IJlig = "IJ"; -const IOcy = "Š"; -const Iacut = "ƍ"; -const Iacute = "ƍ"; -const Icir = "Ǝ"; -const Icirc = "Ǝ"; -const Icy = "Š˜"; -const Idot = "Ä°"; -const Ifr = "ā„‘"; -const Igrav = "ƌ"; -const Igrave = "ƌ"; -const Im = "ā„‘"; -const Imacr = "ÄŖ"; -const ImaginaryI = "ā…ˆ"; -const Implies = "ā‡’"; -const Int = "āˆ¬"; -const Integral = "āˆ«"; -const Intersection = "ā‹‚"; -const InvisibleComma = "ā£"; -const InvisibleTimes = "ā¢"; -const Iogon = "Ä®"; -const Iopf = "š•€"; -const Iota = "Ī™"; -const Iscr = "ā„"; -const Itilde = "ÄØ"; -const Iukcy = "Š†"; -const Ium = "Ə"; -const Iuml = "Ə"; -const Jcirc = "Ä“"; -const Jcy = "Š™"; -const Jfr = "š”"; -const Jopf = "š•"; -const Jscr = "š’„"; -const Jsercy = "Šˆ"; -const Jukcy = "Š„"; -const KHcy = "Š„"; -const KJcy = "ŠŒ"; -const Kappa = "Īš"; -const Kcedil = "Ķ"; -const Kcy = "Šš"; -const Kfr = "š”Ž"; -const Kopf = "š•‚"; -const Kscr = "š’¦"; -const LJcy = "Š‰"; -const L = "<"; -const LT = "<"; -const Lacute = "Ĺ"; -const Lambda = "Ī›"; -const Lang = "āŸŖ"; -const Laplacetrf = "ā„’"; -const Larr = "ā†ž"; -const Lcaron = "Ľ"; -const Lcedil = "Ä»"; -const Lcy = "Š›"; -const LeftAngleBracket = "āŸØ"; -const LeftArrow = "ā†"; -const LeftArrowBar = "ā‡¤"; -const LeftArrowRightArrow = "ā‡†"; -const LeftCeiling = "āŒˆ"; -const LeftDoubleBracket = "āŸ¦"; -const LeftDownTeeVector = "ā„”"; -const LeftDownVector = "ā‡ƒ"; -const LeftDownVectorBar = "ā„™"; -const LeftFloor = "āŒŠ"; -const LeftRightArrow = "ā†”"; -const LeftRightVector = "ā„Ž"; -const LeftTee = "āŠ£"; -const LeftTeeArrow = "ā†¤"; -const LeftTeeVector = "ā„š"; -const LeftTriangle = "āŠ²"; -const LeftTriangleBar = "ā§"; -const LeftTriangleEqual = "āŠ“"; -const LeftUpDownVector = "ā„‘"; -const LeftUpTeeVector = "ā„ "; -const LeftUpVector = "ā†æ"; -const LeftUpVectorBar = "ā„˜"; -const LeftVector = "ā†¼"; -const LeftVectorBar = "ā„’"; -const Leftarrow = "ā‡"; -const Leftrightarrow = "ā‡”"; -const LessEqualGreater = "ā‹š"; -const LessFullEqual = "ā‰¦"; -const LessGreater = "ā‰¶"; -const LessLess = "āŖ”"; -const LessSlantEqual = "ā©½"; -const LessTilde = "ā‰²"; -const Lfr = "š”"; -const Ll = "ā‹˜"; -const Lleftarrow = "ā‡š"; -const Lmidot = "Äæ"; -const LongLeftArrow = "āŸµ"; -const LongLeftRightArrow = "āŸ·"; -const LongRightArrow = "āŸ¶"; -const Longleftarrow = "āŸø"; -const Longleftrightarrow = "āŸŗ"; -const Longrightarrow = "āŸ¹"; -const Lopf = "š•ƒ"; -const LowerLeftArrow = "ā†™"; -const LowerRightArrow = "ā†˜"; -const Lscr = "ā„’"; -const Lsh = "ā†°"; -const Lstrok = "Ł"; -const Lt = "ā‰Ŗ"; -const Mcy = "Šœ"; -const MediumSpace = "āŸ"; -const Mellintrf = "ā„³"; -const Mfr = "š”"; -const MinusPlus = "āˆ“"; -const Mopf = "š•„"; -const Mscr = "ā„³"; -const Mu = "Īœ"; -const NJcy = "ŠŠ"; -const Nacute = "Ń"; -const Ncaron = "Ň"; -const Ncedil = "Ņ"; -const Ncy = "Š"; -const NegativeMediumSpace = "ā€‹"; -const NegativeThickSpace = "ā€‹"; -const NegativeThinSpace = "ā€‹"; -const NegativeVeryThinSpace = "ā€‹"; -const NestedGreaterGreater = "ā‰«"; -const NestedLessLess = "ā‰Ŗ"; -const NewLine = "\n"; -const Nfr = "š”‘"; -const NoBreak = "ā "; -const NonBreakingSpace = "Ā "; -const Nopf = "ā„•"; -const Not = "ā«¬"; -const NotCongruent = "ā‰¢"; -const NotCupCap = "ā‰­"; -const NotDoubleVerticalBar = "āˆ¦"; -const NotElement = "āˆ‰"; -const NotEqual = "ā‰ "; -const NotEqualTilde = "ā‰‚Ģø"; -const NotExists = "āˆ„"; -const NotGreater = "ā‰Æ"; -const NotGreaterEqual = "ā‰±"; -const NotGreaterFullEqual = "ā‰§Ģø"; -const NotGreaterGreater = "ā‰«Ģø"; -const NotGreaterLess = "ā‰¹"; -const NotGreaterSlantEqual = "ā©¾Ģø"; -const NotGreaterTilde = "ā‰µ"; -const NotHumpDownHump = "ā‰ŽĢø"; -const NotHumpEqual = "ā‰Ģø"; -const NotLeftTriangle = "ā‹Ŗ"; -const NotLeftTriangleBar = "ā§Ģø"; -const NotLeftTriangleEqual = "ā‹¬"; -const NotLess = "ā‰®"; -const NotLessEqual = "ā‰°"; -const NotLessGreater = "ā‰ø"; -const NotLessLess = "ā‰ŖĢø"; -const NotLessSlantEqual = "ā©½Ģø"; -const NotLessTilde = "ā‰“"; -const NotNestedGreaterGreater = "āŖ¢Ģø"; -const NotNestedLessLess = "āŖ”Ģø"; -const NotPrecedes = "āŠ€"; -const NotPrecedesEqual = "āŖÆĢø"; -const NotPrecedesSlantEqual = "ā‹ "; -const NotReverseElement = "āˆŒ"; -const NotRightTriangle = "ā‹«"; -const NotRightTriangleBar = "ā§Ģø"; -const NotRightTriangleEqual = "ā‹­"; -const NotSquareSubset = "āŠĢø"; -const NotSquareSubsetEqual = "ā‹¢"; -const NotSquareSuperset = "āŠĢø"; -const NotSquareSupersetEqual = "ā‹£"; -const NotSubset = "āŠ‚āƒ’"; -const NotSubsetEqual = "āŠˆ"; -const NotSucceeds = "āŠ"; -const NotSucceedsEqual = "āŖ°Ģø"; -const NotSucceedsSlantEqual = "ā‹”"; -const NotSucceedsTilde = "ā‰æĢø"; -const NotSuperset = "āŠƒāƒ’"; -const NotSupersetEqual = "āŠ‰"; -const NotTilde = "ā‰"; -const NotTildeEqual = "ā‰„"; -const NotTildeFullEqual = "ā‰‡"; -const NotTildeTilde = "ā‰‰"; -const NotVerticalBar = "āˆ¤"; -const Nscr = "š’©"; -const Ntild = "Ƒ"; -const Ntilde = "Ƒ"; -const Nu = "Ī"; -const OElig = "Œ"; -const Oacut = "Ɠ"; -const Oacute = "Ɠ"; -const Ocir = "Ɣ"; -const Ocirc = "Ɣ"; -const Ocy = "Šž"; -const Odblac = "Ő"; -const Ofr = "š”’"; -const Ograv = "ƒ"; -const Ograve = "ƒ"; -const Omacr = "Ō"; -const Omega = "Ī©"; -const Omicron = "ĪŸ"; -const Oopf = "š•†"; -const OpenCurlyDoubleQuote = "ā€œ"; -const OpenCurlyQuote = "ā€˜"; -const Or = "ā©”"; -const Oscr = "š’Ŗ"; -const Oslas = "Ƙ"; -const Oslash = "Ƙ"; -const Otild = "ƕ"; -const Otilde = "ƕ"; -const Otimes = "āØ·"; -const Oum = "Ɩ"; -const Ouml = "Ɩ"; -const OverBar = "ā€¾"; -const OverBrace = "āž"; -const OverBracket = "āŽ“"; -const OverParenthesis = "āœ"; -const PartialD = "āˆ‚"; -const Pcy = "ŠŸ"; -const Pfr = "š”“"; -const Phi = "Ī¦"; -const Pi = "Ī "; -const PlusMinus = "Ā±"; -const Poincareplane = "ā„Œ"; -const Popf = "ā„™"; -const Pr = "āŖ»"; -const Precedes = "ā‰ŗ"; -const PrecedesEqual = "āŖÆ"; -const PrecedesSlantEqual = "ā‰¼"; -const PrecedesTilde = "ā‰¾"; -const Prime = "ā€³"; -const Product = "āˆ"; -const Proportion = "āˆ·"; -const Proportional = "āˆ"; -const Pscr = "š’«"; -const Psi = "ĪØ"; -const QUO = "\""; -const QUOT = "\""; -const Qfr = "š””"; -const Qopf = "ā„š"; -const Qscr = "š’¬"; -const RBarr = "ā¤"; -const RE = "Ā®"; -const REG = "Ā®"; -const Racute = "Ŕ"; -const Rang = "āŸ«"; -const Rarr = "ā† "; -const Rarrtl = "ā¤–"; -const Rcaron = "Ř"; -const Rcedil = "Ŗ"; -const Rcy = "Š "; -const Re = "ā„œ"; -const ReverseElement = "āˆ‹"; -const ReverseEquilibrium = "ā‡‹"; -const ReverseUpEquilibrium = "ā„Æ"; -const Rfr = "ā„œ"; -const Rho = "Ī”"; -const RightAngleBracket = "āŸ©"; -const RightArrow = "ā†’"; -const RightArrowBar = "ā‡„"; -const RightArrowLeftArrow = "ā‡„"; -const RightCeiling = "āŒ‰"; -const RightDoubleBracket = "āŸ§"; -const RightDownTeeVector = "ā„"; -const RightDownVector = "ā‡‚"; -const RightDownVectorBar = "ā„•"; -const RightFloor = "āŒ‹"; -const RightTee = "āŠ¢"; -const RightTeeArrow = "ā†¦"; -const RightTeeVector = "ā„›"; -const RightTriangle = "āŠ³"; -const RightTriangleBar = "ā§"; -const RightTriangleEqual = "āŠµ"; -const RightUpDownVector = "ā„"; -const RightUpTeeVector = "ā„œ"; -const RightUpVector = "ā†¾"; -const RightUpVectorBar = "ā„”"; -const RightVector = "ā‡€"; -const RightVectorBar = "ā„“"; -const Rightarrow = "ā‡’"; -const Ropf = "ā„"; -const RoundImplies = "ā„°"; -const Rrightarrow = "ā‡›"; -const Rscr = "ā„›"; -const Rsh = "ā†±"; -const RuleDelayed = "ā§“"; -const SHCHcy = "Š©"; -const SHcy = "ŠØ"; -const SOFTcy = "Š¬"; -const Sacute = "Ś"; -const Sc = "āŖ¼"; -const Scaron = "Å "; -const Scedil = "Ş"; -const Scirc = "Ŝ"; -const Scy = "Š”"; -const Sfr = "š”–"; -const ShortDownArrow = "ā†“"; -const ShortLeftArrow = "ā†"; -const ShortRightArrow = "ā†’"; -const ShortUpArrow = "ā†‘"; -const Sigma = "Ī£"; -const SmallCircle = "āˆ˜"; -const Sopf = "š•Š"; -const Sqrt = "āˆš"; -const Square = "ā–”"; -const SquareIntersection = "āŠ“"; -const SquareSubset = "āŠ"; -const SquareSubsetEqual = "āŠ‘"; -const SquareSuperset = "āŠ"; -const SquareSupersetEqual = "āŠ’"; -const SquareUnion = "āŠ”"; -const Sscr = "š’®"; -const Star = "ā‹†"; -const Sub = "ā‹"; -const Subset = "ā‹"; -const SubsetEqual = "āŠ†"; -const Succeeds = "ā‰»"; -const SucceedsEqual = "āŖ°"; -const SucceedsSlantEqual = "ā‰½"; -const SucceedsTilde = "ā‰æ"; -const SuchThat = "āˆ‹"; -const Sum = "āˆ‘"; -const Sup = "ā‹‘"; -const Superset = "āŠƒ"; -const SupersetEqual = "āŠ‡"; -const Supset = "ā‹‘"; -const THOR = "ƞ"; -const THORN = "ƞ"; -const TRADE = "ā„¢"; -const TSHcy = "Š‹"; -const TScy = "Š¦"; -const Tab = "\t"; -const Tau = "Ī¤"; -const Tcaron = "Ť"; -const Tcedil = "Å¢"; -const Tcy = "Š¢"; -const Tfr = "š”—"; -const Therefore = "āˆ“"; -const Theta = "Ī˜"; -const ThickSpace = "āŸā€Š"; -const ThinSpace = "ā€‰"; -const Tilde = "āˆ¼"; -const TildeEqual = "ā‰ƒ"; -const TildeFullEqual = "ā‰…"; -const TildeTilde = "ā‰ˆ"; -const Topf = "š•‹"; -const TripleDot = "āƒ›"; -const Tscr = "š’Æ"; -const Tstrok = "Ŧ"; -const Uacut = "ƚ"; -const Uacute = "ƚ"; -const Uarr = "ā†Ÿ"; -const Uarrocir = "ā„‰"; -const Ubrcy = "ŠŽ"; -const Ubreve = "Ŭ"; -const Ucir = "ƛ"; -const Ucirc = "ƛ"; -const Ucy = "Š£"; -const Udblac = "Å°"; -const Ufr = "š”˜"; -const Ugrav = "ƙ"; -const Ugrave = "ƙ"; -const Umacr = "ÅŖ"; -const UnderBar = "_"; -const UnderBrace = "āŸ"; -const UnderBracket = "āŽµ"; -const UnderParenthesis = "ā"; -const Union = "ā‹ƒ"; -const UnionPlus = "āŠŽ"; -const Uogon = "Ų"; -const Uopf = "š•Œ"; -const UpArrow = "ā†‘"; -const UpArrowBar = "ā¤’"; -const UpArrowDownArrow = "ā‡…"; -const UpDownArrow = "ā†•"; -const UpEquilibrium = "ā„®"; -const UpTee = "āŠ„"; -const UpTeeArrow = "ā†„"; -const Uparrow = "ā‡‘"; -const Updownarrow = "ā‡•"; -const UpperLeftArrow = "ā†–"; -const UpperRightArrow = "ā†—"; -const Upsi = "Ļ’"; -const Upsilon = "Ī„"; -const Uring = "Å®"; -const Uscr = "š’°"; -const Utilde = "ÅØ"; -const Uum = "Ɯ"; -const Uuml = "Ɯ"; -const VDash = "āŠ«"; -const Vbar = "ā««"; -const Vcy = "Š’"; -const Vdash = "āŠ©"; -const Vdashl = "ā«¦"; -const Vee = "ā‹"; -const Verbar = "ā€–"; -const Vert = "ā€–"; -const VerticalBar = "āˆ£"; -const VerticalLine = "|"; -const VerticalSeparator = "ā˜"; -const VerticalTilde = "ā‰€"; -const VeryThinSpace = "ā€Š"; -const Vfr = "š”™"; -const Vopf = "š•"; -const Vscr = "š’±"; -const Vvdash = "āŠŖ"; -const Wcirc = "Å“"; -const Wedge = "ā‹€"; -const Wfr = "š”š"; -const Wopf = "š•Ž"; -const Wscr = "š’²"; -const Xfr = "š”›"; -const Xi = "Īž"; -const Xopf = "š•"; -const Xscr = "š’³"; -const YAcy = "ŠÆ"; -const YIcy = "Š‡"; -const YUcy = "Š®"; -const Yacut = "Ɲ"; -const Yacute = "Ɲ"; -const Ycirc = "Ŷ"; -const Ycy = "Š«"; -const Yfr = "š”œ"; -const Yopf = "š•"; -const Yscr = "š’“"; -const Yuml = "Åø"; -const ZHcy = "Š–"; -const Zacute = "Ź"; -const Zcaron = "Ž"; -const Zcy = "Š—"; -const Zdot = "Å»"; -const ZeroWidthSpace = "ā€‹"; -const Zeta = "Ī–"; -const Zfr = "ā„Ø"; -const Zopf = "ā„¤"; -const Zscr = "š’µ"; -const aacut = "Ć”"; -const aacute = "Ć”"; -const abreve = "ă"; -const ac = "āˆ¾"; -const acE = "āˆ¾Ģ³"; -const acd = "āˆæ"; -const acir = "Ć¢"; -const acirc = "Ć¢"; -const acut = "Ā“"; -const acute = "Ā“"; -const acy = "Š°"; -const aeli = "Ʀ"; -const aelig = "Ʀ"; -const af = "ā”"; -const afr = "š”ž"; -const agrav = "Ć "; -const agrave = "Ć "; -const alefsym = "ā„µ"; -const aleph = "ā„µ"; -const alpha = "Ī±"; -const amacr = "ā"; -const amalg = "āØæ"; -const am = "&"; -const amp = "&"; -const and = "āˆ§"; -const andand = "ā©•"; -const andd = "ā©œ"; -const andslope = "ā©˜"; -const andv = "ā©š"; -const ang = "āˆ "; -const ange = "ā¦¤"; -const angle = "āˆ "; -const angmsd = "āˆ”"; -const angmsdaa = "ā¦Ø"; -const angmsdab = "ā¦©"; -const angmsdac = "ā¦Ŗ"; -const angmsdad = "ā¦«"; -const angmsdae = "ā¦¬"; -const angmsdaf = "ā¦­"; -const angmsdag = "ā¦®"; -const angmsdah = "ā¦Æ"; -const angrt = "āˆŸ"; -const angrtvb = "āŠ¾"; -const angrtvbd = "ā¦"; -const angsph = "āˆ¢"; -const angst = "ƅ"; -const angzarr = "ā¼"; -const aogon = "ą"; -const aopf = "š•’"; -const ap = "ā‰ˆ"; -const apE = "ā©°"; -const apacir = "ā©Æ"; -const ape = "ā‰Š"; -const apid = "ā‰‹"; -const apos = "'"; -const approx = "ā‰ˆ"; -const approxeq = "ā‰Š"; -const arin = "Ć„"; -const aring = "Ć„"; -const ascr = "š’¶"; -const ast = "*"; -const asymp = "ā‰ˆ"; -const asympeq = "ā‰"; -const atild = "Ć£"; -const atilde = "Ć£"; -const aum = "Ƥ"; -const auml = "Ƥ"; -const awconint = "āˆ³"; -const awint = "āؑ"; -const bNot = "ā«­"; -const backcong = "ā‰Œ"; -const backepsilon = "Ļ¶"; -const backprime = "ā€µ"; -const backsim = "āˆ½"; -const backsimeq = "ā‹"; -const barvee = "āŠ½"; -const barwed = "āŒ…"; -const barwedge = "āŒ…"; -const bbrk = "āŽµ"; -const bbrktbrk = "āŽ¶"; -const bcong = "ā‰Œ"; -const bcy = "Š±"; -const bdquo = "ā€ž"; -const becaus = "āˆµ"; -const because = "āˆµ"; -const bemptyv = "ā¦°"; -const bepsi = "Ļ¶"; -const bernou = "ā„¬"; -const beta = "Ī²"; -const beth = "ā„¶"; -const between = "ā‰¬"; -const bfr = "š”Ÿ"; -const bigcap = "ā‹‚"; -const bigcirc = "ā—Æ"; -const bigcup = "ā‹ƒ"; -const bigodot = "ā؀"; -const bigoplus = "ā؁"; -const bigotimes = "ā؂"; -const bigsqcup = "ā؆"; -const bigstar = "ā˜…"; -const bigtriangledown = "ā–½"; -const bigtriangleup = "ā–³"; -const biguplus = "ā؄"; -const bigvee = "ā‹"; -const bigwedge = "ā‹€"; -const bkarow = "ā¤"; -const blacklozenge = "ā§«"; -const blacksquare = "ā–Ŗ"; -const blacktriangle = "ā–“"; -const blacktriangledown = "ā–¾"; -const blacktriangleleft = "ā—‚"; -const blacktriangleright = "ā–ø"; -const blank = "ā£"; -const blk12 = "ā–’"; -const blk14 = "ā–‘"; -const blk34 = "ā–“"; -const block = "ā–ˆ"; -const bne = "=āƒ„"; -const bnequiv = "ā‰”āƒ„"; -const bnot = "āŒ"; -const bopf = "š•“"; -const bot = "āŠ„"; -const bottom = "āŠ„"; -const bowtie = "ā‹ˆ"; -const boxDL = "ā•—"; -const boxDR = "ā•”"; -const boxDl = "ā•–"; -const boxDr = "ā•“"; -const boxH = "ā•"; -const boxHD = "ā•¦"; -const boxHU = "ā•©"; -const boxHd = "ā•¤"; -const boxHu = "ā•§"; -const boxUL = "ā•"; -const boxUR = "ā•š"; -const boxUl = "ā•œ"; -const boxUr = "ā•™"; -const boxV = "ā•‘"; -const boxVH = "ā•¬"; -const boxVL = "ā•£"; -const boxVR = "ā• "; -const boxVh = "ā•«"; -const boxVl = "ā•¢"; -const boxVr = "ā•Ÿ"; -const boxbox = "ā§‰"; -const boxdL = "ā••"; -const boxdR = "ā•’"; -const boxdl = "ā”"; -const boxdr = "ā”Œ"; -const boxh = "ā”€"; -const boxhD = "ā•„"; -const boxhU = "ā•Ø"; -const boxhd = "ā”¬"; -const boxhu = "ā”“"; -const boxminus = "āŠŸ"; -const boxplus = "āŠž"; -const boxtimes = "āŠ "; -const boxuL = "ā•›"; -const boxuR = "ā•˜"; -const boxul = "ā”˜"; -const boxur = "ā””"; -const boxv = "ā”‚"; -const boxvH = "ā•Ŗ"; -const boxvL = "ā•”"; -const boxvR = "ā•ž"; -const boxvh = "ā”¼"; -const boxvl = "ā”¤"; -const boxvr = "ā”œ"; -const bprime = "ā€µ"; -const breve = "Ė˜"; -const brvba = "Ā¦"; -const brvbar = "Ā¦"; -const bscr = "š’·"; -const bsemi = "ā"; -const bsim = "āˆ½"; -const bsime = "ā‹"; -const bsol = "\\"; -const bsolb = "ā§…"; -const bsolhsub = "āŸˆ"; -const bull = "ā€¢"; -const bullet = "ā€¢"; -const bump = "ā‰Ž"; -const bumpE = "āŖ®"; -const bumpe = "ā‰"; -const bumpeq = "ā‰"; -const cacute = "ć"; -const cap = "āˆ©"; -const capand = "ā©„"; -const capbrcup = "ā©‰"; -const capcap = "ā©‹"; -const capcup = "ā©‡"; -const capdot = "ā©€"; -const caps = "āˆ©ļø€"; -const caret = "ā"; -const caron = "Ė‡"; -const ccaps = "ā©"; -const ccaron = "č"; -const ccedi = "Ƨ"; -const ccedil = "Ƨ"; -const ccirc = "ĉ"; -const ccups = "ā©Œ"; -const ccupssm = "ā©"; -const cdot = "ċ"; -const cedi = "Āø"; -const cedil = "Āø"; -const cemptyv = "ā¦²"; -const cen = "Ā¢"; -const cent = "Ā¢"; -const centerdot = "Ā·"; -const cfr = "š” "; -const chcy = "ч"; -const check$2 = "āœ“"; -const checkmark = "āœ“"; -const chi = "Ļ‡"; -const cir = "ā—‹"; -const cirE = "ā§ƒ"; -const circ = "Ė†"; -const circeq = "ā‰—"; -const circlearrowleft = "ā†ŗ"; -const circlearrowright = "ā†»"; -const circledR = "Ā®"; -const circledS = "ā“ˆ"; -const circledast = "āŠ›"; -const circledcirc = "āŠš"; -const circleddash = "āŠ"; -const cire = "ā‰—"; -const cirfnint = "āؐ"; -const cirmid = "ā«Æ"; -const cirscir = "ā§‚"; -const clubs = "ā™£"; -const clubsuit = "ā™£"; -const colon = ":"; -const colone = "ā‰”"; -const coloneq = "ā‰”"; -const comma = ","; -const commat = "@"; -const comp = "āˆ"; -const compfn = "āˆ˜"; -const complement = "āˆ"; -const complexes = "ā„‚"; -const cong = "ā‰…"; -const congdot = "ā©­"; -const conint = "āˆ®"; -const copf = "š•”"; -const coprod = "āˆ"; -const cop = "Ā©"; -const copy$1 = "Ā©"; -const copysr = "ā„—"; -const crarr = "ā†µ"; -const cross = "āœ—"; -const cscr = "š’ø"; -const csub = "ā«"; -const csube = "ā«‘"; -const csup = "ā«"; -const csupe = "ā«’"; -const ctdot = "ā‹Æ"; -const cudarrl = "ā¤ø"; -const cudarrr = "ā¤µ"; -const cuepr = "ā‹ž"; -const cuesc = "ā‹Ÿ"; -const cularr = "ā†¶"; -const cularrp = "ā¤½"; -const cup = "āˆŖ"; -const cupbrcap = "ā©ˆ"; -const cupcap = "ā©†"; -const cupcup = "ā©Š"; -const cupdot = "āŠ"; -const cupor = "ā©…"; -const cups = "āˆŖļø€"; -const curarr = "ā†·"; -const curarrm = "ā¤¼"; -const curlyeqprec = "ā‹ž"; -const curlyeqsucc = "ā‹Ÿ"; -const curlyvee = "ā‹Ž"; -const curlywedge = "ā‹"; -const curre = "Ā¤"; -const curren = "Ā¤"; -const curvearrowleft = "ā†¶"; -const curvearrowright = "ā†·"; -const cuvee = "ā‹Ž"; -const cuwed = "ā‹"; -const cwconint = "āˆ²"; -const cwint = "āˆ±"; -const cylcty = "āŒ­"; -const dArr = "ā‡“"; -const dHar = "ā„„"; -const dagger = "ā€ "; -const daleth = "ā„ø"; -const darr = "ā†“"; -const dash = "ā€"; -const dashv = "āŠ£"; -const dbkarow = "ā¤"; -const dblac = "Ė"; -const dcaron = "ď"; -const dcy = "Š“"; -const dd = "ā…†"; -const ddagger = "ā€”"; -const ddarr = "ā‡Š"; -const ddotseq = "ā©·"; -const de = "Ā°"; -const deg = "Ā°"; -const delta = "Ī“"; -const demptyv = "ā¦±"; -const dfisht = "ā„æ"; -const dfr = "š””"; -const dharl = "ā‡ƒ"; -const dharr = "ā‡‚"; -const diam = "ā‹„"; -const diamond = "ā‹„"; -const diamondsuit = "ā™¦"; -const diams = "ā™¦"; -const die = "ĀØ"; -const digamma = "Ļ"; -const disin = "ā‹²"; -const div = "Ć·"; -const divid = "Ć·"; -const divide = "Ć·"; -const divideontimes = "ā‹‡"; -const divonx = "ā‹‡"; -const djcy = "ђ"; -const dlcorn = "āŒž"; -const dlcrop = "āŒ"; -const dollar = "$"; -const dopf = "š••"; -const dot = "Ė™"; -const doteq = "ā‰"; -const doteqdot = "ā‰‘"; -const dotminus = "āˆø"; -const dotplus = "āˆ”"; -const dotsquare = "āŠ”"; -const doublebarwedge = "āŒ†"; -const downarrow = "ā†“"; -const downdownarrows = "ā‡Š"; -const downharpoonleft = "ā‡ƒ"; -const downharpoonright = "ā‡‚"; -const drbkarow = "ā¤"; -const drcorn = "āŒŸ"; -const drcrop = "āŒŒ"; -const dscr = "š’¹"; -const dscy = "ѕ"; -const dsol = "ā§¶"; -const dstrok = "đ"; -const dtdot = "ā‹±"; -const dtri = "ā–æ"; -const dtrif = "ā–¾"; -const duarr = "ā‡µ"; -const duhar = "ā„Æ"; -const dwangle = "ā¦¦"; -const dzcy = "џ"; -const dzigrarr = "āŸæ"; -const eDDot = "ā©·"; -const eDot = "ā‰‘"; -const eacut = "Ć©"; -const eacute = "Ć©"; -const easter = "ā©®"; -const ecaron = "ě"; -const ecir = "ĆŖ"; -const ecirc = "ĆŖ"; -const ecolon = "ā‰•"; -const ecy = "э"; -const edot = "ė"; -const ee = "ā…‡"; -const efDot = "ā‰’"; -const efr = "š”¢"; -const eg = "āŖš"; -const egrav = "ĆØ"; -const egrave = "ĆØ"; -const egs = "āŖ–"; -const egsdot = "āŖ˜"; -const el = "āŖ™"; -const elinters = "ā§"; -const ell = "ā„“"; -const els = "āŖ•"; -const elsdot = "āŖ—"; -const emacr = "ē"; -const empty = "āˆ…"; -const emptyset = "āˆ…"; -const emptyv = "āˆ…"; -const emsp13 = "ā€„"; -const emsp14 = "ā€…"; -const emsp = "ā€ƒ"; -const eng = "ŋ"; -const ensp = "ā€‚"; -const eogon = "ę"; -const eopf = "š•–"; -const epar = "ā‹•"; -const eparsl = "ā§£"; -const eplus = "ā©±"; -const epsi = "Īµ"; -const epsilon = "Īµ"; -const epsiv = "Ļµ"; -const eqcirc = "ā‰–"; -const eqcolon = "ā‰•"; -const eqsim = "ā‰‚"; -const eqslantgtr = "āŖ–"; -const eqslantless = "āŖ•"; -const equals = "="; -const equest = "ā‰Ÿ"; -const equiv = "ā‰”"; -const equivDD = "ā©ø"; -const eqvparsl = "ā§„"; -const erDot = "ā‰“"; -const erarr = "ā„±"; -const escr = "ā„Æ"; -const esdot = "ā‰"; -const esim = "ā‰‚"; -const eta = "Ī·"; -const et = "Ć°"; -const eth = "Ć°"; -const eum = "Ć«"; -const euml = "Ć«"; -const euro = "ā‚¬"; -const excl = "!"; -const exist = "āˆƒ"; -const expectation = "ā„°"; -const exponentiale = "ā…‡"; -const fallingdotseq = "ā‰’"; -const fcy = "ф"; -const female = "ā™€"; -const ffilig = "ļ¬ƒ"; -const fflig = "ļ¬€"; -const ffllig = "ļ¬„"; -const ffr = "š”£"; -const filig = "ļ¬"; -const fjlig = "fj"; -const flat = "ā™­"; -const fllig = "ļ¬‚"; -const fltns = "ā–±"; -const fnof = "ʒ"; -const fopf = "š•—"; -const forall = "āˆ€"; -const fork = "ā‹”"; -const forkv = "ā«™"; -const fpartint = "ā؍"; -const frac1 = "Ā¼"; -const frac12 = "Ā½"; -const frac13 = "ā…“"; -const frac14 = "Ā¼"; -const frac15 = "ā…•"; -const frac16 = "ā…™"; -const frac18 = "ā…›"; -const frac23 = "ā…”"; -const frac25 = "ā…–"; -const frac3 = "Ā¾"; -const frac34 = "Ā¾"; -const frac35 = "ā…—"; -const frac38 = "ā…œ"; -const frac45 = "ā…˜"; -const frac56 = "ā…š"; -const frac58 = "ā…"; -const frac78 = "ā…ž"; -const frasl = "ā„"; -const frown = "āŒ¢"; -const fscr = "š’»"; -const gE = "ā‰§"; -const gEl = "āŖŒ"; -const gacute = "Ēµ"; -const gamma = "Ī³"; -const gammad = "Ļ"; -const gap = "āŖ†"; -const gbreve = "ğ"; -const gcirc = "ĝ"; -const gcy = "Š³"; -const gdot = "Ä”"; -const ge = "ā‰„"; -const gel = "ā‹›"; -const geq = "ā‰„"; -const geqq = "ā‰§"; -const geqslant = "ā©¾"; -const ges = "ā©¾"; -const gescc = "āŖ©"; -const gesdot = "āŖ€"; -const gesdoto = "āŖ‚"; -const gesdotol = "āŖ„"; -const gesl = "ā‹›ļø€"; -const gesles = "āŖ”"; -const gfr = "š”¤"; -const gg = "ā‰«"; -const ggg = "ā‹™"; -const gimel = "ā„·"; -const gjcy = "ѓ"; -const gl = "ā‰·"; -const glE = "āŖ’"; -const gla = "āŖ„"; -const glj = "āŖ¤"; -const gnE = "ā‰©"; -const gnap = "āŖŠ"; -const gnapprox = "āŖŠ"; -const gne = "āŖˆ"; -const gneq = "āŖˆ"; -const gneqq = "ā‰©"; -const gnsim = "ā‹§"; -const gopf = "š•˜"; -const grave = "`"; -const gscr = "ā„Š"; -const gsim = "ā‰³"; -const gsime = "āŖŽ"; -const gsiml = "āŖ"; -const g = ">"; -const gt = ">"; -const gtcc = "āŖ§"; -const gtcir = "ā©ŗ"; -const gtdot = "ā‹—"; -const gtlPar = "ā¦•"; -const gtquest = "ā©¼"; -const gtrapprox = "āŖ†"; -const gtrarr = "ā„ø"; -const gtrdot = "ā‹—"; -const gtreqless = "ā‹›"; -const gtreqqless = "āŖŒ"; -const gtrless = "ā‰·"; -const gtrsim = "ā‰³"; -const gvertneqq = "ā‰©ļø€"; -const gvnE = "ā‰©ļø€"; -const hArr = "ā‡”"; -const hairsp = "ā€Š"; -const half = "Ā½"; -const hamilt = "ā„‹"; -const hardcy = "ъ"; -const harr = "ā†”"; -const harrcir = "ā„ˆ"; -const harrw = "ā†­"; -const hbar = "ā„"; -const hcirc = "Ä„"; -const hearts = "ā™„"; -const heartsuit = "ā™„"; -const hellip = "ā€¦"; -const hercon = "āŠ¹"; -const hfr = "š”„"; -const hksearow = "ā¤„"; -const hkswarow = "ā¤¦"; -const hoarr = "ā‡æ"; -const homtht = "āˆ»"; -const hookleftarrow = "ā†©"; -const hookrightarrow = "ā†Ŗ"; -const hopf = "š•™"; -const horbar = "ā€•"; -const hscr = "š’½"; -const hslash = "ā„"; -const hstrok = "ħ"; -const hybull = "āƒ"; -const hyphen = "ā€"; -const iacut = "Ć­"; -const iacute = "Ć­"; -const ic = "ā£"; -const icir = "Ć®"; -const icirc = "Ć®"; -const icy = "Šø"; -const iecy = "Šµ"; -const iexc = "Ā”"; -const iexcl = "Ā”"; -const iff = "ā‡”"; -const ifr = "š”¦"; -const igrav = "Ƭ"; -const igrave = "Ƭ"; -const ii = "ā…ˆ"; -const iiiint = "ā،"; -const iiint = "āˆ­"; -const iinfin = "ā§œ"; -const iiota = "ā„©"; -const ijlig = "ij"; -const imacr = "Ä«"; -const image = "ā„‘"; -const imagline = "ā„"; -const imagpart = "ā„‘"; -const imath = "ı"; -const imof = "āŠ·"; -const imped = "ʵ"; -const incare = "ā„…"; -const infin = "āˆž"; -const infintie = "ā§"; -const inodot = "ı"; -const int = "āˆ«"; -const intcal = "āŠŗ"; -const integers = "ā„¤"; -const intercal = "āŠŗ"; -const intlarhk = "āؗ"; -const intprod = "āؼ"; -const iocy = "ё"; -const iogon = "ÄÆ"; -const iopf = "š•š"; -const iota = "Ī¹"; -const iprod = "āؼ"; -const iques = "Āæ"; -const iquest = "Āæ"; -const iscr = "š’¾"; -const isin = "āˆˆ"; -const isinE = "ā‹¹"; -const isindot = "ā‹µ"; -const isins = "ā‹“"; -const isinsv = "ā‹³"; -const isinv = "āˆˆ"; -const it = "ā¢"; -const itilde = "Ä©"; -const iukcy = "і"; -const ium = "ĆÆ"; -const iuml = "ĆÆ"; -const jcirc = "ĵ"; -const jcy = "Š¹"; -const jfr = "š”§"; -const jmath = "Č·"; -const jopf = "š•›"; -const jscr = "š’æ"; -const jsercy = "ј"; -const jukcy = "є"; -const kappa = "Īŗ"; -const kappav = "Ļ°"; -const kcedil = "Ä·"; -const kcy = "Šŗ"; -const kfr = "š”Ø"; -const kgreen = "Äø"; -const khcy = "х"; -const kjcy = "ќ"; -const kopf = "š•œ"; -const kscr = "š“€"; -const lAarr = "ā‡š"; -const lArr = "ā‡"; -const lAtail = "ā¤›"; -const lBarr = "ā¤Ž"; -const lE = "ā‰¦"; -const lEg = "āŖ‹"; -const lHar = "ā„¢"; -const lacute = "Äŗ"; -const laemptyv = "ā¦“"; -const lagran = "ā„’"; -const lambda = "Ī»"; -const lang = "āŸØ"; -const langd = "ā¦‘"; -const langle = "āŸØ"; -const lap = "āŖ…"; -const laqu = "Ā«"; -const laquo = "Ā«"; -const larr = "ā†"; -const larrb = "ā‡¤"; -const larrbfs = "ā¤Ÿ"; -const larrfs = "ā¤"; -const larrhk = "ā†©"; -const larrlp = "ā†«"; -const larrpl = "ā¤¹"; -const larrsim = "ā„³"; -const larrtl = "ā†¢"; -const lat = "āŖ«"; -const latail = "ā¤™"; -const late = "āŖ­"; -const lates = "āŖ­ļø€"; -const lbarr = "ā¤Œ"; -const lbbrk = "ā²"; -const lbrace = "{"; -const lbrack = "["; -const lbrke = "ā¦‹"; -const lbrksld = "ā¦"; -const lbrkslu = "ā¦"; -const lcaron = "ľ"; -const lcedil = "ļ"; -const lceil = "āŒˆ"; -const lcub = "{"; -const lcy = "Š»"; -const ldca = "ā¤¶"; -const ldquo = "ā€œ"; -const ldquor = "ā€ž"; -const ldrdhar = "ā„§"; -const ldrushar = "ā„‹"; -const ldsh = "ā†²"; -const le = "ā‰¤"; -const leftarrow = "ā†"; -const leftarrowtail = "ā†¢"; -const leftharpoondown = "ā†½"; -const leftharpoonup = "ā†¼"; -const leftleftarrows = "ā‡‡"; -const leftrightarrow = "ā†”"; -const leftrightarrows = "ā‡†"; -const leftrightharpoons = "ā‡‹"; -const leftrightsquigarrow = "ā†­"; -const leftthreetimes = "ā‹‹"; -const leg = "ā‹š"; -const leq = "ā‰¤"; -const leqq = "ā‰¦"; -const leqslant = "ā©½"; -const les = "ā©½"; -const lescc = "āŖØ"; -const lesdot = "ā©æ"; -const lesdoto = "āŖ"; -const lesdotor = "āŖƒ"; -const lesg = "ā‹šļø€"; -const lesges = "āŖ“"; -const lessapprox = "āŖ…"; -const lessdot = "ā‹–"; -const lesseqgtr = "ā‹š"; -const lesseqqgtr = "āŖ‹"; -const lessgtr = "ā‰¶"; -const lesssim = "ā‰²"; -const lfisht = "ā„¼"; -const lfloor = "āŒŠ"; -const lfr = "š”©"; -const lg = "ā‰¶"; -const lgE = "āŖ‘"; -const lhard = "ā†½"; -const lharu = "ā†¼"; -const lharul = "ā„Ŗ"; -const lhblk = "ā–„"; -const ljcy = "љ"; -const ll = "ā‰Ŗ"; -const llarr = "ā‡‡"; -const llcorner = "āŒž"; -const llhard = "ā„«"; -const lltri = "ā—ŗ"; -const lmidot = "ŀ"; -const lmoust = "āŽ°"; -const lmoustache = "āŽ°"; -const lnE = "ā‰Ø"; -const lnap = "āŖ‰"; -const lnapprox = "āŖ‰"; -const lne = "āŖ‡"; -const lneq = "āŖ‡"; -const lneqq = "ā‰Ø"; -const lnsim = "ā‹¦"; -const loang = "āŸ¬"; -const loarr = "ā‡½"; -const lobrk = "āŸ¦"; -const longleftarrow = "āŸµ"; -const longleftrightarrow = "āŸ·"; -const longmapsto = "āŸ¼"; -const longrightarrow = "āŸ¶"; -const looparrowleft = "ā†«"; -const looparrowright = "ā†¬"; -const lopar = "ā¦…"; -const lopf = "š•"; -const loplus = "āØ­"; -const lotimes = "āØ“"; -const lowast = "āˆ—"; -const lowbar = "_"; -const loz = "ā—Š"; -const lozenge = "ā—Š"; -const lozf = "ā§«"; -const lpar = "("; -const lparlt = "ā¦“"; -const lrarr = "ā‡†"; -const lrcorner = "āŒŸ"; -const lrhar = "ā‡‹"; -const lrhard = "ā„­"; -const lrm = "ā€Ž"; -const lrtri = "āŠæ"; -const lsaquo = "ā€¹"; -const lscr = "š“"; -const lsh = "ā†°"; -const lsim = "ā‰²"; -const lsime = "āŖ"; -const lsimg = "āŖ"; -const lsqb = "["; -const lsquo = "ā€˜"; -const lsquor = "ā€š"; -const lstrok = "ł"; -const l = "<"; -const lt = "<"; -const ltcc = "āŖ¦"; -const ltcir = "ā©¹"; -const ltdot = "ā‹–"; -const lthree = "ā‹‹"; -const ltimes = "ā‹‰"; -const ltlarr = "ā„¶"; -const ltquest = "ā©»"; -const ltrPar = "ā¦–"; -const ltri = "ā—ƒ"; -const ltrie = "āŠ“"; -const ltrif = "ā—‚"; -const lurdshar = "ā„Š"; -const luruhar = "ā„¦"; -const lvertneqq = "ā‰Øļø€"; -const lvnE = "ā‰Øļø€"; -const mDDot = "āˆŗ"; -const mac = "ĀÆ"; -const macr = "ĀÆ"; -const male = "ā™‚"; -const malt = "āœ "; -const maltese = "āœ "; -const map$2 = "ā†¦"; -const mapsto = "ā†¦"; -const mapstodown = "ā†§"; -const mapstoleft = "ā†¤"; -const mapstoup = "ā†„"; -const marker = "ā–®"; -const mcomma = "āØ©"; -const mcy = "Š¼"; -const mdash = "ā€”"; -const measuredangle = "āˆ”"; -const mfr = "š”Ŗ"; -const mho = "ā„§"; -const micr = "Āµ"; -const micro = "Āµ"; -const mid = "āˆ£"; -const midast = "*"; -const midcir = "ā«°"; -const middo = "Ā·"; -const middot = "Ā·"; -const minus = "āˆ’"; -const minusb = "āŠŸ"; -const minusd = "āˆø"; -const minusdu = "āØŖ"; -const mlcp = "ā«›"; -const mldr = "ā€¦"; -const mnplus = "āˆ“"; -const models$2 = "āŠ§"; -const mopf = "š•ž"; -const mp = "āˆ“"; -const mscr = "š“‚"; -const mstpos = "āˆ¾"; -const mu = "Ī¼"; -const multimap = "āŠø"; -const mumap = "āŠø"; -const nGg = "ā‹™Ģø"; -const nGt = "ā‰«āƒ’"; -const nGtv = "ā‰«Ģø"; -const nLeftarrow = "ā‡"; -const nLeftrightarrow = "ā‡Ž"; -const nLl = "ā‹˜Ģø"; -const nLt = "ā‰Ŗāƒ’"; -const nLtv = "ā‰ŖĢø"; -const nRightarrow = "ā‡"; -const nVDash = "āŠÆ"; -const nVdash = "āŠ®"; -const nabla = "āˆ‡"; -const nacute = "ń"; -const nang = "āˆ āƒ’"; -const nap = "ā‰‰"; -const napE = "ā©°Ģø"; -const napid = "ā‰‹Ģø"; -const napos = "ʼn"; -const napprox = "ā‰‰"; -const natur = "ā™®"; -const natural = "ā™®"; -const naturals = "ā„•"; -const nbs = "Ā "; -const nbsp = "Ā "; -const nbump = "ā‰ŽĢø"; -const nbumpe = "ā‰Ģø"; -const ncap = "ā©ƒ"; -const ncaron = "ň"; -const ncedil = "ņ"; -const ncong = "ā‰‡"; -const ncongdot = "ā©­Ģø"; -const ncup = "ā©‚"; -const ncy = "Š½"; -const ndash = "ā€“"; -const ne = "ā‰ "; -const neArr = "ā‡—"; -const nearhk = "ā¤¤"; -const nearr = "ā†—"; -const nearrow = "ā†—"; -const nedot = "ā‰Ģø"; -const nequiv = "ā‰¢"; -const nesear = "ā¤Ø"; -const nesim = "ā‰‚Ģø"; -const nexist = "āˆ„"; -const nexists = "āˆ„"; -const nfr = "š”«"; -const ngE = "ā‰§Ģø"; -const nge = "ā‰±"; -const ngeq = "ā‰±"; -const ngeqq = "ā‰§Ģø"; -const ngeqslant = "ā©¾Ģø"; -const nges = "ā©¾Ģø"; -const ngsim = "ā‰µ"; -const ngt = "ā‰Æ"; -const ngtr = "ā‰Æ"; -const nhArr = "ā‡Ž"; -const nharr = "ā†®"; -const nhpar = "ā«²"; -const ni = "āˆ‹"; -const nis = "ā‹¼"; -const nisd = "ā‹ŗ"; -const niv = "āˆ‹"; -const njcy = "њ"; -const nlArr = "ā‡"; -const nlE = "ā‰¦Ģø"; -const nlarr = "ā†š"; -const nldr = "ā€„"; -const nle = "ā‰°"; -const nleftarrow = "ā†š"; -const nleftrightarrow = "ā†®"; -const nleq = "ā‰°"; -const nleqq = "ā‰¦Ģø"; -const nleqslant = "ā©½Ģø"; -const nles = "ā©½Ģø"; -const nless = "ā‰®"; -const nlsim = "ā‰“"; -const nlt = "ā‰®"; -const nltri = "ā‹Ŗ"; -const nltrie = "ā‹¬"; -const nmid = "āˆ¤"; -const nopf = "š•Ÿ"; -const no = "Ā¬"; -const not = "Ā¬"; -const notin = "āˆ‰"; -const notinE = "ā‹¹Ģø"; -const notindot = "ā‹µĢø"; -const notinva = "āˆ‰"; -const notinvb = "ā‹·"; -const notinvc = "ā‹¶"; -const notni = "āˆŒ"; -const notniva = "āˆŒ"; -const notnivb = "ā‹¾"; -const notnivc = "ā‹½"; -const npar = "āˆ¦"; -const nparallel = "āˆ¦"; -const nparsl = "ā«½āƒ„"; -const npart = "āˆ‚Ģø"; -const npolint = "āؔ"; -const npr = "āŠ€"; -const nprcue = "ā‹ "; -const npre = "āŖÆĢø"; -const nprec = "āŠ€"; -const npreceq = "āŖÆĢø"; -const nrArr = "ā‡"; -const nrarr = "ā†›"; -const nrarrc = "ā¤³Ģø"; -const nrarrw = "ā†Ģø"; -const nrightarrow = "ā†›"; -const nrtri = "ā‹«"; -const nrtrie = "ā‹­"; -const nsc = "āŠ"; -const nsccue = "ā‹”"; -const nsce = "āŖ°Ģø"; -const nscr = "š“ƒ"; -const nshortmid = "āˆ¤"; -const nshortparallel = "āˆ¦"; -const nsim = "ā‰"; -const nsime = "ā‰„"; -const nsimeq = "ā‰„"; -const nsmid = "āˆ¤"; -const nspar = "āˆ¦"; -const nsqsube = "ā‹¢"; -const nsqsupe = "ā‹£"; -const nsub = "āŠ„"; -const nsubE = "ā«…Ģø"; -const nsube = "āŠˆ"; -const nsubset = "āŠ‚āƒ’"; -const nsubseteq = "āŠˆ"; -const nsubseteqq = "ā«…Ģø"; -const nsucc = "āŠ"; -const nsucceq = "āŖ°Ģø"; -const nsup = "āŠ…"; -const nsupE = "ā«†Ģø"; -const nsupe = "āŠ‰"; -const nsupset = "āŠƒāƒ’"; -const nsupseteq = "āŠ‰"; -const nsupseteqq = "ā«†Ģø"; -const ntgl = "ā‰¹"; -const ntild = "Ʊ"; -const ntilde = "Ʊ"; -const ntlg = "ā‰ø"; -const ntriangleleft = "ā‹Ŗ"; -const ntrianglelefteq = "ā‹¬"; -const ntriangleright = "ā‹«"; -const ntrianglerighteq = "ā‹­"; -const nu = "Ī½"; -const num = "#"; -const numero = "ā„–"; -const numsp = "ā€‡"; -const nvDash = "āŠ­"; -const nvHarr = "ā¤„"; -const nvap = "ā‰āƒ’"; -const nvdash = "āŠ¬"; -const nvge = "ā‰„āƒ’"; -const nvgt = ">āƒ’"; -const nvinfin = "ā§ž"; -const nvlArr = "ā¤‚"; -const nvle = "ā‰¤āƒ’"; -const nvlt = "<āƒ’"; -const nvltrie = "āŠ“āƒ’"; -const nvrArr = "ā¤ƒ"; -const nvrtrie = "āŠµāƒ’"; -const nvsim = "āˆ¼āƒ’"; -const nwArr = "ā‡–"; -const nwarhk = "ā¤£"; -const nwarr = "ā†–"; -const nwarrow = "ā†–"; -const nwnear = "ā¤§"; -const oS = "ā“ˆ"; -const oacut = "Ć³"; -const oacute = "Ć³"; -const oast = "āŠ›"; -const ocir = "Ć“"; -const ocirc = "Ć“"; -const ocy = "Š¾"; -const odash = "āŠ"; -const odblac = "ő"; -const odiv = "āØø"; -const odot = "āŠ™"; -const odsold = "ā¦¼"; -const oelig = "œ"; -const ofcir = "ā¦æ"; -const ofr = "š”¬"; -const ogon = "Ė›"; -const ograv = "Ć²"; -const ograve = "Ć²"; -const ogt = "ā§"; -const ohbar = "ā¦µ"; -const ohm = "Ī©"; -const oint = "āˆ®"; -const olarr = "ā†ŗ"; -const olcir = "ā¦¾"; -const olcross = "ā¦»"; -const oline = "ā€¾"; -const olt = "ā§€"; -const omacr = "ō"; -const omega = "Ļ‰"; -const omicron = "Īæ"; -const omid = "ā¦¶"; -const ominus = "āŠ–"; -const oopf = "š• "; -const opar = "ā¦·"; -const operp = "ā¦¹"; -const oplus = "āŠ•"; -const or = "āˆØ"; -const orarr = "ā†»"; -const ord = "Āŗ"; -const order$1 = "ā„“"; -const orderof = "ā„“"; -const ordf = "ĀŖ"; -const ordm = "Āŗ"; -const origof = "āŠ¶"; -const oror = "ā©–"; -const orslope = "ā©—"; -const orv = "ā©›"; -const oscr = "ā„“"; -const oslas = "Ćø"; -const oslash = "Ćø"; -const osol = "āŠ˜"; -const otild = "Ƶ"; -const otilde = "Ƶ"; -const otimes = "āŠ—"; -const otimesas = "āض"; -const oum = "ƶ"; -const ouml = "ƶ"; -const ovbar = "āŒ½"; -const par = "Ā¶"; -const para = "Ā¶"; -const parallel = "āˆ„"; -const parsim = "ā«³"; -const parsl = "ā«½"; -const part = "āˆ‚"; -const pcy = "Šæ"; -const percnt = "%"; -const period = "."; -const permil = "ā€°"; -const perp = "āŠ„"; -const pertenk = "ā€±"; -const pfr = "š”­"; -const phi = "Ļ†"; -const phiv = "Ļ•"; -const phmmat = "ā„³"; -const phone = "ā˜Ž"; -const pi = "Ļ€"; -const pitchfork = "ā‹”"; -const piv = "Ļ–"; -const planck = "ā„"; -const planckh = "ā„Ž"; -const plankv = "ā„"; -const plus = "+"; -const plusacir = "āØ£"; -const plusb = "āŠž"; -const pluscir = "āØ¢"; -const plusdo = "āˆ”"; -const plusdu = "āØ„"; -const pluse = "ā©²"; -const plusm = "Ā±"; -const plusmn = "Ā±"; -const plussim = "āئ"; -const plustwo = "āا"; -const pm = "Ā±"; -const pointint = "āؕ"; -const popf = "š•”"; -const poun = "Ā£"; -const pound = "Ā£"; -const pr = "ā‰ŗ"; -const prE = "āŖ³"; -const prap = "āŖ·"; -const prcue = "ā‰¼"; -const pre = "āŖÆ"; -const prec = "ā‰ŗ"; -const precapprox = "āŖ·"; -const preccurlyeq = "ā‰¼"; -const preceq = "āŖÆ"; -const precnapprox = "āŖ¹"; -const precneqq = "āŖµ"; -const precnsim = "ā‹Ø"; -const precsim = "ā‰¾"; -const prime = "ā€²"; -const primes = "ā„™"; -const prnE = "āŖµ"; -const prnap = "āŖ¹"; -const prnsim = "ā‹Ø"; -const prod = "āˆ"; -const profalar = "āŒ®"; -const profline = "āŒ’"; -const profsurf = "āŒ“"; -const prop = "āˆ"; -const propto = "āˆ"; -const prsim = "ā‰¾"; -const prurel = "āŠ°"; -const pscr = "š“…"; -const psi = "Ļˆ"; -const puncsp = "ā€ˆ"; -const qfr = "š”®"; -const qint = "ā،"; -const qopf = "š•¢"; -const qprime = "ā—"; -const qscr = "š“†"; -const quaternions = "ā„"; -const quatint = "āؖ"; -const quest = "?"; -const questeq = "ā‰Ÿ"; -const quo = "\""; -const quot = "\""; -const rAarr = "ā‡›"; -const rArr = "ā‡’"; -const rAtail = "ā¤œ"; -const rBarr = "ā¤"; -const rHar = "ā„¤"; -const race = "āˆ½Ģ±"; -const racute = "ŕ"; -const radic = "āˆš"; -const raemptyv = "ā¦³"; -const rang = "āŸ©"; -const rangd = "ā¦’"; -const range$1 = "ā¦„"; -const rangle = "āŸ©"; -const raqu = "Ā»"; -const raquo = "Ā»"; -const rarr = "ā†’"; -const rarrap = "ā„µ"; -const rarrb = "ā‡„"; -const rarrbfs = "ā¤ "; -const rarrc = "ā¤³"; -const rarrfs = "ā¤ž"; -const rarrhk = "ā†Ŗ"; -const rarrlp = "ā†¬"; -const rarrpl = "ā„…"; -const rarrsim = "ā„“"; -const rarrtl = "ā†£"; -const rarrw = "ā†"; -const ratail = "ā¤š"; -const ratio = "āˆ¶"; -const rationals = "ā„š"; -const rbarr = "ā¤"; -const rbbrk = "ā³"; -const rbrace = "}"; -const rbrack = "]"; -const rbrke = "ā¦Œ"; -const rbrksld = "ā¦Ž"; -const rbrkslu = "ā¦"; -const rcaron = "ř"; -const rcedil = "ŗ"; -const rceil = "āŒ‰"; -const rcub = "}"; -const rcy = "р"; -const rdca = "ā¤·"; -const rdldhar = "ā„©"; -const rdquo = "ā€"; -const rdquor = "ā€"; -const rdsh = "ā†³"; -const real = "ā„œ"; -const realine = "ā„›"; -const realpart = "ā„œ"; -const reals = "ā„"; -const rect = "ā–­"; -const re = "Ā®"; -const reg = "Ā®"; -const rfisht = "ā„½"; -const rfloor = "āŒ‹"; -const rfr = "š”Æ"; -const rhard = "ā‡"; -const rharu = "ā‡€"; -const rharul = "ā„¬"; -const rho = "Ļ"; -const rhov = "Ļ±"; -const rightarrow = "ā†’"; -const rightarrowtail = "ā†£"; -const rightharpoondown = "ā‡"; -const rightharpoonup = "ā‡€"; -const rightleftarrows = "ā‡„"; -const rightleftharpoons = "ā‡Œ"; -const rightrightarrows = "ā‡‰"; -const rightsquigarrow = "ā†"; -const rightthreetimes = "ā‹Œ"; -const ring = "Ėš"; -const risingdotseq = "ā‰“"; -const rlarr = "ā‡„"; -const rlhar = "ā‡Œ"; -const rlm = "ā€"; -const rmoust = "āŽ±"; -const rmoustache = "āŽ±"; -const rnmid = "ā«®"; -const roang = "āŸ­"; -const roarr = "ā‡¾"; -const robrk = "āŸ§"; -const ropar = "ā¦†"; -const ropf = "š•£"; -const roplus = "āØ®"; -const rotimes = "āص"; -const rpar = ")"; -const rpargt = "ā¦”"; -const rppolint = "āؒ"; -const rrarr = "ā‡‰"; -const rsaquo = "ā€ŗ"; -const rscr = "š“‡"; -const rsh = "ā†±"; -const rsqb = "]"; -const rsquo = "ā€™"; -const rsquor = "ā€™"; -const rthree = "ā‹Œ"; -const rtimes = "ā‹Š"; -const rtri = "ā–¹"; -const rtrie = "āŠµ"; -const rtrif = "ā–ø"; -const rtriltri = "ā§Ž"; -const ruluhar = "ā„Ø"; -const rx = "ā„ž"; -const sacute = "ś"; -const sbquo = "ā€š"; -const sc = "ā‰»"; -const scE = "āŖ“"; -const scap = "āŖø"; -const scaron = "Å”"; -const sccue = "ā‰½"; -const sce = "āŖ°"; -const scedil = "ş"; -const scirc = "ŝ"; -const scnE = "āŖ¶"; -const scnap = "āŖŗ"; -const scnsim = "ā‹©"; -const scpolint = "āؓ"; -const scsim = "ā‰æ"; -const scy = "с"; -const sdot = "ā‹…"; -const sdotb = "āŠ”"; -const sdote = "ā©¦"; -const seArr = "ā‡˜"; -const searhk = "ā¤„"; -const searr = "ā†˜"; -const searrow = "ā†˜"; -const sec = "Ā§"; -const sect = "Ā§"; -const semi = ";"; -const seswar = "ā¤©"; -const setminus = "āˆ–"; -const setmn = "āˆ–"; -const sext = "āœ¶"; -const sfr = "š”°"; -const sfrown = "āŒ¢"; -const sharp = "ā™Æ"; -const shchcy = "щ"; -const shcy = "ш"; -const shortmid = "āˆ£"; -const shortparallel = "āˆ„"; -const sh = "Ā­"; -const shy = "Ā­"; -const sigma = "Ļƒ"; -const sigmaf = "Ļ‚"; -const sigmav = "Ļ‚"; -const sim = "āˆ¼"; -const simdot = "ā©Ŗ"; -const sime = "ā‰ƒ"; -const simeq = "ā‰ƒ"; -const simg = "āŖž"; -const simgE = "āŖ "; -const siml = "āŖ"; -const simlE = "āŖŸ"; -const simne = "ā‰†"; -const simplus = "āؤ"; -const simrarr = "ā„²"; -const slarr = "ā†"; -const smallsetminus = "āˆ–"; -const smashp = "āس"; -const smeparsl = "ā§¤"; -const smid = "āˆ£"; -const smile = "āŒ£"; -const smt = "āŖŖ"; -const smte = "āŖ¬"; -const smtes = "āŖ¬ļø€"; -const softcy = "ь"; -const sol = "/"; -const solb = "ā§„"; -const solbar = "āŒæ"; -const sopf = "š•¤"; -const spades = "ā™ "; -const spadesuit = "ā™ "; -const spar = "āˆ„"; -const sqcap = "āŠ“"; -const sqcaps = "āŠ“ļø€"; -const sqcup = "āŠ”"; -const sqcups = "āŠ”ļø€"; -const sqsub = "āŠ"; -const sqsube = "āŠ‘"; -const sqsubset = "āŠ"; -const sqsubseteq = "āŠ‘"; -const sqsup = "āŠ"; -const sqsupe = "āŠ’"; -const sqsupset = "āŠ"; -const sqsupseteq = "āŠ’"; -const squ = "ā–”"; -const square = "ā–”"; -const squarf = "ā–Ŗ"; -const squf = "ā–Ŗ"; -const srarr = "ā†’"; -const sscr = "š“ˆ"; -const ssetmn = "āˆ–"; -const ssmile = "āŒ£"; -const sstarf = "ā‹†"; -const star$1 = "ā˜†"; -const starf = "ā˜…"; -const straightepsilon = "Ļµ"; -const straightphi = "Ļ•"; -const strns = "ĀÆ"; -const sub = "āŠ‚"; -const subE = "ā«…"; -const subdot = "āŖ½"; -const sube = "āŠ†"; -const subedot = "ā«ƒ"; -const submult = "ā«"; -const subnE = "ā«‹"; -const subne = "āŠŠ"; -const subplus = "āŖæ"; -const subrarr = "ā„¹"; -const subset = "āŠ‚"; -const subseteq = "āŠ†"; -const subseteqq = "ā«…"; -const subsetneq = "āŠŠ"; -const subsetneqq = "ā«‹"; -const subsim = "ā«‡"; -const subsub = "ā«•"; -const subsup = "ā«“"; -const succ = "ā‰»"; -const succapprox = "āŖø"; -const succcurlyeq = "ā‰½"; -const succeq = "āŖ°"; -const succnapprox = "āŖŗ"; -const succneqq = "āŖ¶"; -const succnsim = "ā‹©"; -const succsim = "ā‰æ"; -const sum = "āˆ‘"; -const sung = "ā™Ŗ"; -const sup = "āŠƒ"; -const sup1 = "Ā¹"; -const sup2 = "Ā²"; -const sup3 = "Ā³"; -const supE = "ā«†"; -const supdot = "āŖ¾"; -const supdsub = "ā«˜"; -const supe = "āŠ‡"; -const supedot = "ā«„"; -const suphsol = "āŸ‰"; -const suphsub = "ā«—"; -const suplarr = "ā„»"; -const supmult = "ā«‚"; -const supnE = "ā«Œ"; -const supne = "āŠ‹"; -const supplus = "ā«€"; -const supset = "āŠƒ"; -const supseteq = "āŠ‡"; -const supseteqq = "ā«†"; -const supsetneq = "āŠ‹"; -const supsetneqq = "ā«Œ"; -const supsim = "ā«ˆ"; -const supsub = "ā«”"; -const supsup = "ā«–"; -const swArr = "ā‡™"; -const swarhk = "ā¤¦"; -const swarr = "ā†™"; -const swarrow = "ā†™"; -const swnwar = "ā¤Ŗ"; -const szli = "Ɵ"; -const szlig = "Ɵ"; -const target = "āŒ–"; -const tau = "Ļ„"; -const tbrk = "āŽ“"; -const tcaron = "Å„"; -const tcedil = "Å£"; -const tcy = "т"; -const tdot = "āƒ›"; -const telrec = "āŒ•"; -const tfr = "š”±"; -const there4 = "āˆ“"; -const therefore = "āˆ“"; -const theta = "Īø"; -const thetasym = "Ļ‘"; -const thetav = "Ļ‘"; -const thickapprox = "ā‰ˆ"; -const thicksim = "āˆ¼"; -const thinsp = "ā€‰"; -const thkap = "ā‰ˆ"; -const thksim = "āˆ¼"; -const thor = "Ć¾"; -const thorn = "Ć¾"; -const tilde = "Ėœ"; -const time = "Ɨ"; -const times = "Ɨ"; -const timesb = "āŠ "; -const timesbar = "āر"; -const timesd = "āØ°"; -const tint = "āˆ­"; -const toea = "ā¤Ø"; -const top = "āŠ¤"; -const topbot = "āŒ¶"; -const topcir = "ā«±"; -const topf = "š•„"; -const topfork = "ā«š"; -const tosa = "ā¤©"; -const tprime = "ā€“"; -const trade = "ā„¢"; -const triangle = "ā–µ"; -const triangledown = "ā–æ"; -const triangleleft = "ā—ƒ"; -const trianglelefteq = "āŠ“"; -const triangleq = "ā‰œ"; -const triangleright = "ā–¹"; -const trianglerighteq = "āŠµ"; -const tridot = "ā—¬"; -const trie = "ā‰œ"; -const triminus = "āØŗ"; -const triplus = "āع"; -const trisb = "ā§"; -const tritime = "āØ»"; -const trpezium = "ā¢"; -const tscr = "š“‰"; -const tscy = "ц"; -const tshcy = "ћ"; -const tstrok = "ŧ"; -const twixt = "ā‰¬"; -const twoheadleftarrow = "ā†ž"; -const twoheadrightarrow = "ā† "; -const uArr = "ā‡‘"; -const uHar = "ā„£"; -const uacut = "Ćŗ"; -const uacute = "Ćŗ"; -const uarr = "ā†‘"; -const ubrcy = "ў"; -const ubreve = "Å­"; -const ucir = "Ć»"; -const ucirc = "Ć»"; -const ucy = "у"; -const udarr = "ā‡…"; -const udblac = "ű"; -const udhar = "ā„®"; -const ufisht = "ā„¾"; -const ufr = "š”²"; -const ugrav = "Ć¹"; -const ugrave = "Ć¹"; -const uharl = "ā†æ"; -const uharr = "ā†¾"; -const uhblk = "ā–€"; -const ulcorn = "āŒœ"; -const ulcorner = "āŒœ"; -const ulcrop = "āŒ"; -const ultri = "ā—ø"; -const umacr = "Å«"; -const um = "ĀØ"; -const uml = "ĀØ"; -const uogon = "ų"; -const uopf = "š•¦"; -const uparrow = "ā†‘"; -const updownarrow = "ā†•"; -const upharpoonleft = "ā†æ"; -const upharpoonright = "ā†¾"; -const uplus = "āŠŽ"; -const upsi = "Ļ…"; -const upsih = "Ļ’"; -const upsilon = "Ļ…"; -const upuparrows = "ā‡ˆ"; -const urcorn = "āŒ"; -const urcorner = "āŒ"; -const urcrop = "āŒŽ"; -const uring = "ÅÆ"; -const urtri = "ā—¹"; -const uscr = "š“Š"; -const utdot = "ā‹°"; -const utilde = "Å©"; -const utri = "ā–µ"; -const utrif = "ā–“"; -const uuarr = "ā‡ˆ"; -const uum = "Ć¼"; -const uuml = "Ć¼"; -const uwangle = "ā¦§"; -const vArr = "ā‡•"; -const vBar = "ā«Ø"; -const vBarv = "ā«©"; -const vDash = "āŠØ"; -const vangrt = "ā¦œ"; -const varepsilon = "Ļµ"; -const varkappa = "Ļ°"; -const varnothing = "āˆ…"; -const varphi = "Ļ•"; -const varpi = "Ļ–"; -const varpropto = "āˆ"; -const varr = "ā†•"; -const varrho = "Ļ±"; -const varsigma = "Ļ‚"; -const varsubsetneq = "āŠŠļø€"; -const varsubsetneqq = "ā«‹ļø€"; -const varsupsetneq = "āŠ‹ļø€"; -const varsupsetneqq = "ā«Œļø€"; -const vartheta = "Ļ‘"; -const vartriangleleft = "āŠ²"; -const vartriangleright = "āŠ³"; -const vcy = "Š²"; -const vdash = "āŠ¢"; -const vee = "āˆØ"; -const veebar = "āŠ»"; -const veeeq = "ā‰š"; -const vellip = "ā‹®"; -const verbar = "|"; -const vert = "|"; -const vfr = "š”³"; -const vltri = "āŠ²"; -const vnsub = "āŠ‚āƒ’"; -const vnsup = "āŠƒāƒ’"; -const vopf = "š•§"; -const vprop = "āˆ"; -const vrtri = "āŠ³"; -const vscr = "š“‹"; -const vsubnE = "ā«‹ļø€"; -const vsubne = "āŠŠļø€"; -const vsupnE = "ā«Œļø€"; -const vsupne = "āŠ‹ļø€"; -const vzigzag = "ā¦š"; -const wcirc = "ŵ"; -const wedbar = "ā©Ÿ"; -const wedge = "āˆ§"; -const wedgeq = "ā‰™"; -const weierp = "ā„˜"; -const wfr = "š”“"; -const wopf = "š•Ø"; -const wp = "ā„˜"; -const wr = "ā‰€"; -const wreath = "ā‰€"; -const wscr = "š“Œ"; -const xcap = "ā‹‚"; -const xcirc = "ā—Æ"; -const xcup = "ā‹ƒ"; -const xdtri = "ā–½"; -const xfr = "š”µ"; -const xhArr = "āŸŗ"; -const xharr = "āŸ·"; -const xi = "Ī¾"; -const xlArr = "āŸø"; -const xlarr = "āŸµ"; -const xmap = "āŸ¼"; -const xnis = "ā‹»"; -const xodot = "ā؀"; -const xopf = "š•©"; -const xoplus = "ā؁"; -const xotime = "ā؂"; -const xrArr = "āŸ¹"; -const xrarr = "āŸ¶"; -const xscr = "š“"; -const xsqcup = "ā؆"; -const xuplus = "ā؄"; -const xutri = "ā–³"; -const xvee = "ā‹"; -const xwedge = "ā‹€"; -const yacut = "Ć½"; -const yacute = "Ć½"; -const yacy = "я"; -const ycirc = "Å·"; -const ycy = "ы"; -const ye = "Ā„"; -const yen = "Ā„"; -const yfr = "š”¶"; -const yicy = "ї"; -const yopf = "š•Ŗ"; -const yscr = "š“Ž"; -const yucy = "ю"; -const yum = "Ćæ"; -const yuml = "Ćæ"; -const zacute = "Åŗ"; -const zcaron = "ž"; -const zcy = "Š·"; -const zdot = "ż"; -const zeetrf = "ā„Ø"; -const zeta = "Ī¶"; -const zfr = "š”·"; -const zhcy = "Š¶"; -const zigrarr = "ā‡"; -const zopf = "š•«"; -const zscr = "š“"; -const zwj = "ā€"; -const zwnj = "ā€Œ"; -var index$1 = { - AEli: AEli, - AElig: AElig, - AM: AM, - AMP: AMP, - Aacut: Aacut, - Aacute: Aacute, - Abreve: Abreve, - Acir: Acir, - Acirc: Acirc, - Acy: Acy, - Afr: Afr, - Agrav: Agrav, - Agrave: Agrave, - Alpha: Alpha, - Amacr: Amacr, - And: And, - Aogon: Aogon, - Aopf: Aopf, - ApplyFunction: ApplyFunction, - Arin: Arin, - Aring: Aring, - Ascr: Ascr, - Assign: Assign, - Atild: Atild, - Atilde: Atilde, - Aum: Aum, - Auml: Auml, - Backslash: Backslash, - Barv: Barv, - Barwed: Barwed, - Bcy: Bcy, - Because: Because, - Bernoullis: Bernoullis, - Beta: Beta, - Bfr: Bfr, - Bopf: Bopf, - Breve: Breve, - Bscr: Bscr, - Bumpeq: Bumpeq, - CHcy: CHcy, - COP: COP, - COPY: COPY, - Cacute: Cacute, - Cap: Cap, - CapitalDifferentialD: CapitalDifferentialD, - Cayleys: Cayleys, - Ccaron: Ccaron, - Ccedi: Ccedi, - Ccedil: Ccedil, - Ccirc: Ccirc, - Cconint: Cconint, - Cdot: Cdot, - Cedilla: Cedilla, - CenterDot: CenterDot, - Cfr: Cfr, - Chi: Chi, - CircleDot: CircleDot, - CircleMinus: CircleMinus, - CirclePlus: CirclePlus, - CircleTimes: CircleTimes, - ClockwiseContourIntegral: ClockwiseContourIntegral, - CloseCurlyDoubleQuote: CloseCurlyDoubleQuote, - CloseCurlyQuote: CloseCurlyQuote, - Colon: Colon, - Colone: Colone, - Congruent: Congruent, - Conint: Conint, - ContourIntegral: ContourIntegral, - Copf: Copf, - Coproduct: Coproduct, - CounterClockwiseContourIntegral: CounterClockwiseContourIntegral, - Cross: Cross, - Cscr: Cscr, - Cup: Cup, - CupCap: CupCap, - DD: DD, - DDotrahd: DDotrahd, - DJcy: DJcy, - DScy: DScy, - DZcy: DZcy, - Dagger: Dagger, - Darr: Darr, - Dashv: Dashv, - Dcaron: Dcaron, - Dcy: Dcy, - Del: Del, - Delta: Delta, - Dfr: Dfr, - DiacriticalAcute: DiacriticalAcute, - DiacriticalDot: DiacriticalDot, - DiacriticalDoubleAcute: DiacriticalDoubleAcute, - DiacriticalGrave: DiacriticalGrave, - DiacriticalTilde: DiacriticalTilde, - Diamond: Diamond, - DifferentialD: DifferentialD, - Dopf: Dopf, - Dot: Dot, - DotDot: DotDot, - DotEqual: DotEqual, - DoubleContourIntegral: DoubleContourIntegral, - DoubleDot: DoubleDot, - DoubleDownArrow: DoubleDownArrow, - DoubleLeftArrow: DoubleLeftArrow, - DoubleLeftRightArrow: DoubleLeftRightArrow, - DoubleLeftTee: DoubleLeftTee, - DoubleLongLeftArrow: DoubleLongLeftArrow, - DoubleLongLeftRightArrow: DoubleLongLeftRightArrow, - DoubleLongRightArrow: DoubleLongRightArrow, - DoubleRightArrow: DoubleRightArrow, - DoubleRightTee: DoubleRightTee, - DoubleUpArrow: DoubleUpArrow, - DoubleUpDownArrow: DoubleUpDownArrow, - DoubleVerticalBar: DoubleVerticalBar, - DownArrow: DownArrow, - DownArrowBar: DownArrowBar, - DownArrowUpArrow: DownArrowUpArrow, - DownBreve: DownBreve, - DownLeftRightVector: DownLeftRightVector, - DownLeftTeeVector: DownLeftTeeVector, - DownLeftVector: DownLeftVector, - DownLeftVectorBar: DownLeftVectorBar, - DownRightTeeVector: DownRightTeeVector, - DownRightVector: DownRightVector, - DownRightVectorBar: DownRightVectorBar, - DownTee: DownTee, - DownTeeArrow: DownTeeArrow, - Downarrow: Downarrow, - Dscr: Dscr, - Dstrok: Dstrok, - ENG: ENG, - ET: ET, - ETH: ETH, - Eacut: Eacut, - Eacute: Eacute, - Ecaron: Ecaron, - Ecir: Ecir, - Ecirc: Ecirc, - Ecy: Ecy, - Edot: Edot, - Efr: Efr, - Egrav: Egrav, - Egrave: Egrave, - Element: Element, - Emacr: Emacr, - EmptySmallSquare: EmptySmallSquare, - EmptyVerySmallSquare: EmptyVerySmallSquare, - Eogon: Eogon, - Eopf: Eopf, - Epsilon: Epsilon, - Equal: Equal, - EqualTilde: EqualTilde, - Equilibrium: Equilibrium, - Escr: Escr, - Esim: Esim, - Eta: Eta, - Eum: Eum, - Euml: Euml, - Exists: Exists, - ExponentialE: ExponentialE, - Fcy: Fcy, - Ffr: Ffr, - FilledSmallSquare: FilledSmallSquare, - FilledVerySmallSquare: FilledVerySmallSquare, - Fopf: Fopf, - ForAll: ForAll, - Fouriertrf: Fouriertrf, - Fscr: Fscr, - GJcy: GJcy, - G: G, - GT: GT, - Gamma: Gamma, - Gammad: Gammad, - Gbreve: Gbreve, - Gcedil: Gcedil, - Gcirc: Gcirc, - Gcy: Gcy, - Gdot: Gdot, - Gfr: Gfr, - Gg: Gg, - Gopf: Gopf, - GreaterEqual: GreaterEqual, - GreaterEqualLess: GreaterEqualLess, - GreaterFullEqual: GreaterFullEqual, - GreaterGreater: GreaterGreater, - GreaterLess: GreaterLess, - GreaterSlantEqual: GreaterSlantEqual, - GreaterTilde: GreaterTilde, - Gscr: Gscr, - Gt: Gt, - HARDcy: HARDcy, - Hacek: Hacek, - Hat: Hat, - Hcirc: Hcirc, - Hfr: Hfr, - HilbertSpace: HilbertSpace, - Hopf: Hopf, - HorizontalLine: HorizontalLine, - Hscr: Hscr, - Hstrok: Hstrok, - HumpDownHump: HumpDownHump, - HumpEqual: HumpEqual, - IEcy: IEcy, - IJlig: IJlig, - IOcy: IOcy, - Iacut: Iacut, - Iacute: Iacute, - Icir: Icir, - Icirc: Icirc, - Icy: Icy, - Idot: Idot, - Ifr: Ifr, - Igrav: Igrav, - Igrave: Igrave, - Im: Im, - Imacr: Imacr, - ImaginaryI: ImaginaryI, - Implies: Implies, - Int: Int, - Integral: Integral, - Intersection: Intersection, - InvisibleComma: InvisibleComma, - InvisibleTimes: InvisibleTimes, - Iogon: Iogon, - Iopf: Iopf, - Iota: Iota, - Iscr: Iscr, - Itilde: Itilde, - Iukcy: Iukcy, - Ium: Ium, - Iuml: Iuml, - Jcirc: Jcirc, - Jcy: Jcy, - Jfr: Jfr, - Jopf: Jopf, - Jscr: Jscr, - Jsercy: Jsercy, - Jukcy: Jukcy, - KHcy: KHcy, - KJcy: KJcy, - Kappa: Kappa, - Kcedil: Kcedil, - Kcy: Kcy, - Kfr: Kfr, - Kopf: Kopf, - Kscr: Kscr, - LJcy: LJcy, - L: L, - LT: LT, - Lacute: Lacute, - Lambda: Lambda, - Lang: Lang, - Laplacetrf: Laplacetrf, - Larr: Larr, - Lcaron: Lcaron, - Lcedil: Lcedil, - Lcy: Lcy, - LeftAngleBracket: LeftAngleBracket, - LeftArrow: LeftArrow, - LeftArrowBar: LeftArrowBar, - LeftArrowRightArrow: LeftArrowRightArrow, - LeftCeiling: LeftCeiling, - LeftDoubleBracket: LeftDoubleBracket, - LeftDownTeeVector: LeftDownTeeVector, - LeftDownVector: LeftDownVector, - LeftDownVectorBar: LeftDownVectorBar, - LeftFloor: LeftFloor, - LeftRightArrow: LeftRightArrow, - LeftRightVector: LeftRightVector, - LeftTee: LeftTee, - LeftTeeArrow: LeftTeeArrow, - LeftTeeVector: LeftTeeVector, - LeftTriangle: LeftTriangle, - LeftTriangleBar: LeftTriangleBar, - LeftTriangleEqual: LeftTriangleEqual, - LeftUpDownVector: LeftUpDownVector, - LeftUpTeeVector: LeftUpTeeVector, - LeftUpVector: LeftUpVector, - LeftUpVectorBar: LeftUpVectorBar, - LeftVector: LeftVector, - LeftVectorBar: LeftVectorBar, - Leftarrow: Leftarrow, - Leftrightarrow: Leftrightarrow, - LessEqualGreater: LessEqualGreater, - LessFullEqual: LessFullEqual, - LessGreater: LessGreater, - LessLess: LessLess, - LessSlantEqual: LessSlantEqual, - LessTilde: LessTilde, - Lfr: Lfr, - Ll: Ll, - Lleftarrow: Lleftarrow, - Lmidot: Lmidot, - LongLeftArrow: LongLeftArrow, - LongLeftRightArrow: LongLeftRightArrow, - LongRightArrow: LongRightArrow, - Longleftarrow: Longleftarrow, - Longleftrightarrow: Longleftrightarrow, - Longrightarrow: Longrightarrow, - Lopf: Lopf, - LowerLeftArrow: LowerLeftArrow, - LowerRightArrow: LowerRightArrow, - Lscr: Lscr, - Lsh: Lsh, - Lstrok: Lstrok, - Lt: Lt, - "Map": "ā¤…", - Mcy: Mcy, - MediumSpace: MediumSpace, - Mellintrf: Mellintrf, - Mfr: Mfr, - MinusPlus: MinusPlus, - Mopf: Mopf, - Mscr: Mscr, - Mu: Mu, - NJcy: NJcy, - Nacute: Nacute, - Ncaron: Ncaron, - Ncedil: Ncedil, - Ncy: Ncy, - NegativeMediumSpace: NegativeMediumSpace, - NegativeThickSpace: NegativeThickSpace, - NegativeThinSpace: NegativeThinSpace, - NegativeVeryThinSpace: NegativeVeryThinSpace, - NestedGreaterGreater: NestedGreaterGreater, - NestedLessLess: NestedLessLess, - NewLine: NewLine, - Nfr: Nfr, - NoBreak: NoBreak, - NonBreakingSpace: NonBreakingSpace, - Nopf: Nopf, - Not: Not, - NotCongruent: NotCongruent, - NotCupCap: NotCupCap, - NotDoubleVerticalBar: NotDoubleVerticalBar, - NotElement: NotElement, - NotEqual: NotEqual, - NotEqualTilde: NotEqualTilde, - NotExists: NotExists, - NotGreater: NotGreater, - NotGreaterEqual: NotGreaterEqual, - NotGreaterFullEqual: NotGreaterFullEqual, - NotGreaterGreater: NotGreaterGreater, - NotGreaterLess: NotGreaterLess, - NotGreaterSlantEqual: NotGreaterSlantEqual, - NotGreaterTilde: NotGreaterTilde, - NotHumpDownHump: NotHumpDownHump, - NotHumpEqual: NotHumpEqual, - NotLeftTriangle: NotLeftTriangle, - NotLeftTriangleBar: NotLeftTriangleBar, - NotLeftTriangleEqual: NotLeftTriangleEqual, - NotLess: NotLess, - NotLessEqual: NotLessEqual, - NotLessGreater: NotLessGreater, - NotLessLess: NotLessLess, - NotLessSlantEqual: NotLessSlantEqual, - NotLessTilde: NotLessTilde, - NotNestedGreaterGreater: NotNestedGreaterGreater, - NotNestedLessLess: NotNestedLessLess, - NotPrecedes: NotPrecedes, - NotPrecedesEqual: NotPrecedesEqual, - NotPrecedesSlantEqual: NotPrecedesSlantEqual, - NotReverseElement: NotReverseElement, - NotRightTriangle: NotRightTriangle, - NotRightTriangleBar: NotRightTriangleBar, - NotRightTriangleEqual: NotRightTriangleEqual, - NotSquareSubset: NotSquareSubset, - NotSquareSubsetEqual: NotSquareSubsetEqual, - NotSquareSuperset: NotSquareSuperset, - NotSquareSupersetEqual: NotSquareSupersetEqual, - NotSubset: NotSubset, - NotSubsetEqual: NotSubsetEqual, - NotSucceeds: NotSucceeds, - NotSucceedsEqual: NotSucceedsEqual, - NotSucceedsSlantEqual: NotSucceedsSlantEqual, - NotSucceedsTilde: NotSucceedsTilde, - NotSuperset: NotSuperset, - NotSupersetEqual: NotSupersetEqual, - NotTilde: NotTilde, - NotTildeEqual: NotTildeEqual, - NotTildeFullEqual: NotTildeFullEqual, - NotTildeTilde: NotTildeTilde, - NotVerticalBar: NotVerticalBar, - Nscr: Nscr, - Ntild: Ntild, - Ntilde: Ntilde, - Nu: Nu, - OElig: OElig, - Oacut: Oacut, - Oacute: Oacute, - Ocir: Ocir, - Ocirc: Ocirc, - Ocy: Ocy, - Odblac: Odblac, - Ofr: Ofr, - Ograv: Ograv, - Ograve: Ograve, - Omacr: Omacr, - Omega: Omega, - Omicron: Omicron, - Oopf: Oopf, - OpenCurlyDoubleQuote: OpenCurlyDoubleQuote, - OpenCurlyQuote: OpenCurlyQuote, - Or: Or, - Oscr: Oscr, - Oslas: Oslas, - Oslash: Oslash, - Otild: Otild, - Otilde: Otilde, - Otimes: Otimes, - Oum: Oum, - Ouml: Ouml, - OverBar: OverBar, - OverBrace: OverBrace, - OverBracket: OverBracket, - OverParenthesis: OverParenthesis, - PartialD: PartialD, - Pcy: Pcy, - Pfr: Pfr, - Phi: Phi, - Pi: Pi, - PlusMinus: PlusMinus, - Poincareplane: Poincareplane, - Popf: Popf, - Pr: Pr, - Precedes: Precedes, - PrecedesEqual: PrecedesEqual, - PrecedesSlantEqual: PrecedesSlantEqual, - PrecedesTilde: PrecedesTilde, - Prime: Prime, - Product: Product, - Proportion: Proportion, - Proportional: Proportional, - Pscr: Pscr, - Psi: Psi, - QUO: QUO, - QUOT: QUOT, - Qfr: Qfr, - Qopf: Qopf, - Qscr: Qscr, - RBarr: RBarr, - RE: RE, - REG: REG, - Racute: Racute, - Rang: Rang, - Rarr: Rarr, - Rarrtl: Rarrtl, - Rcaron: Rcaron, - Rcedil: Rcedil, - Rcy: Rcy, - Re: Re, - ReverseElement: ReverseElement, - ReverseEquilibrium: ReverseEquilibrium, - ReverseUpEquilibrium: ReverseUpEquilibrium, - Rfr: Rfr, - Rho: Rho, - RightAngleBracket: RightAngleBracket, - RightArrow: RightArrow, - RightArrowBar: RightArrowBar, - RightArrowLeftArrow: RightArrowLeftArrow, - RightCeiling: RightCeiling, - RightDoubleBracket: RightDoubleBracket, - RightDownTeeVector: RightDownTeeVector, - RightDownVector: RightDownVector, - RightDownVectorBar: RightDownVectorBar, - RightFloor: RightFloor, - RightTee: RightTee, - RightTeeArrow: RightTeeArrow, - RightTeeVector: RightTeeVector, - RightTriangle: RightTriangle, - RightTriangleBar: RightTriangleBar, - RightTriangleEqual: RightTriangleEqual, - RightUpDownVector: RightUpDownVector, - RightUpTeeVector: RightUpTeeVector, - RightUpVector: RightUpVector, - RightUpVectorBar: RightUpVectorBar, - RightVector: RightVector, - RightVectorBar: RightVectorBar, - Rightarrow: Rightarrow, - Ropf: Ropf, - RoundImplies: RoundImplies, - Rrightarrow: Rrightarrow, - Rscr: Rscr, - Rsh: Rsh, - RuleDelayed: RuleDelayed, - SHCHcy: SHCHcy, - SHcy: SHcy, - SOFTcy: SOFTcy, - Sacute: Sacute, - Sc: Sc, - Scaron: Scaron, - Scedil: Scedil, - Scirc: Scirc, - Scy: Scy, - Sfr: Sfr, - ShortDownArrow: ShortDownArrow, - ShortLeftArrow: ShortLeftArrow, - ShortRightArrow: ShortRightArrow, - ShortUpArrow: ShortUpArrow, - Sigma: Sigma, - SmallCircle: SmallCircle, - Sopf: Sopf, - Sqrt: Sqrt, - Square: Square, - SquareIntersection: SquareIntersection, - SquareSubset: SquareSubset, - SquareSubsetEqual: SquareSubsetEqual, - SquareSuperset: SquareSuperset, - SquareSupersetEqual: SquareSupersetEqual, - SquareUnion: SquareUnion, - Sscr: Sscr, - Star: Star, - Sub: Sub, - Subset: Subset, - SubsetEqual: SubsetEqual, - Succeeds: Succeeds, - SucceedsEqual: SucceedsEqual, - SucceedsSlantEqual: SucceedsSlantEqual, - SucceedsTilde: SucceedsTilde, - SuchThat: SuchThat, - Sum: Sum, - Sup: Sup, - Superset: Superset, - SupersetEqual: SupersetEqual, - Supset: Supset, - THOR: THOR, - THORN: THORN, - TRADE: TRADE, - TSHcy: TSHcy, - TScy: TScy, - Tab: Tab, - Tau: Tau, - Tcaron: Tcaron, - Tcedil: Tcedil, - Tcy: Tcy, - Tfr: Tfr, - Therefore: Therefore, - Theta: Theta, - ThickSpace: ThickSpace, - ThinSpace: ThinSpace, - Tilde: Tilde, - TildeEqual: TildeEqual, - TildeFullEqual: TildeFullEqual, - TildeTilde: TildeTilde, - Topf: Topf, - TripleDot: TripleDot, - Tscr: Tscr, - Tstrok: Tstrok, - Uacut: Uacut, - Uacute: Uacute, - Uarr: Uarr, - Uarrocir: Uarrocir, - Ubrcy: Ubrcy, - Ubreve: Ubreve, - Ucir: Ucir, - Ucirc: Ucirc, - Ucy: Ucy, - Udblac: Udblac, - Ufr: Ufr, - Ugrav: Ugrav, - Ugrave: Ugrave, - Umacr: Umacr, - UnderBar: UnderBar, - UnderBrace: UnderBrace, - UnderBracket: UnderBracket, - UnderParenthesis: UnderParenthesis, - Union: Union, - UnionPlus: UnionPlus, - Uogon: Uogon, - Uopf: Uopf, - UpArrow: UpArrow, - UpArrowBar: UpArrowBar, - UpArrowDownArrow: UpArrowDownArrow, - UpDownArrow: UpDownArrow, - UpEquilibrium: UpEquilibrium, - UpTee: UpTee, - UpTeeArrow: UpTeeArrow, - Uparrow: Uparrow, - Updownarrow: Updownarrow, - UpperLeftArrow: UpperLeftArrow, - UpperRightArrow: UpperRightArrow, - Upsi: Upsi, - Upsilon: Upsilon, - Uring: Uring, - Uscr: Uscr, - Utilde: Utilde, - Uum: Uum, - Uuml: Uuml, - VDash: VDash, - Vbar: Vbar, - Vcy: Vcy, - Vdash: Vdash, - Vdashl: Vdashl, - Vee: Vee, - Verbar: Verbar, - Vert: Vert, - VerticalBar: VerticalBar, - VerticalLine: VerticalLine, - VerticalSeparator: VerticalSeparator, - VerticalTilde: VerticalTilde, - VeryThinSpace: VeryThinSpace, - Vfr: Vfr, - Vopf: Vopf, - Vscr: Vscr, - Vvdash: Vvdash, - Wcirc: Wcirc, - Wedge: Wedge, - Wfr: Wfr, - Wopf: Wopf, - Wscr: Wscr, - Xfr: Xfr, - Xi: Xi, - Xopf: Xopf, - Xscr: Xscr, - YAcy: YAcy, - YIcy: YIcy, - YUcy: YUcy, - Yacut: Yacut, - Yacute: Yacute, - Ycirc: Ycirc, - Ycy: Ycy, - Yfr: Yfr, - Yopf: Yopf, - Yscr: Yscr, - Yuml: Yuml, - ZHcy: ZHcy, - Zacute: Zacute, - Zcaron: Zcaron, - Zcy: Zcy, - Zdot: Zdot, - ZeroWidthSpace: ZeroWidthSpace, - Zeta: Zeta, - Zfr: Zfr, - Zopf: Zopf, - Zscr: Zscr, - aacut: aacut, - aacute: aacute, - abreve: abreve, - ac: ac, - acE: acE, - acd: acd, - acir: acir, - acirc: acirc, - acut: acut, - acute: acute, - acy: acy, - aeli: aeli, - aelig: aelig, - af: af, - afr: afr, - agrav: agrav, - agrave: agrave, - alefsym: alefsym, - aleph: aleph, - alpha: alpha, - amacr: amacr, - amalg: amalg, - am: am, - amp: amp, - and: and, - andand: andand, - andd: andd, - andslope: andslope, - andv: andv, - ang: ang, - ange: ange, - angle: angle, - angmsd: angmsd, - angmsdaa: angmsdaa, - angmsdab: angmsdab, - angmsdac: angmsdac, - angmsdad: angmsdad, - angmsdae: angmsdae, - angmsdaf: angmsdaf, - angmsdag: angmsdag, - angmsdah: angmsdah, - angrt: angrt, - angrtvb: angrtvb, - angrtvbd: angrtvbd, - angsph: angsph, - angst: angst, - angzarr: angzarr, - aogon: aogon, - aopf: aopf, - ap: ap, - apE: apE, - apacir: apacir, - ape: ape, - apid: apid, - apos: apos, - approx: approx, - approxeq: approxeq, - arin: arin, - aring: aring, - ascr: ascr, - ast: ast, - asymp: asymp, - asympeq: asympeq, - atild: atild, - atilde: atilde, - aum: aum, - auml: auml, - awconint: awconint, - awint: awint, - bNot: bNot, - backcong: backcong, - backepsilon: backepsilon, - backprime: backprime, - backsim: backsim, - backsimeq: backsimeq, - barvee: barvee, - barwed: barwed, - barwedge: barwedge, - bbrk: bbrk, - bbrktbrk: bbrktbrk, - bcong: bcong, - bcy: bcy, - bdquo: bdquo, - becaus: becaus, - because: because, - bemptyv: bemptyv, - bepsi: bepsi, - bernou: bernou, - beta: beta, - beth: beth, - between: between, - bfr: bfr, - bigcap: bigcap, - bigcirc: bigcirc, - bigcup: bigcup, - bigodot: bigodot, - bigoplus: bigoplus, - bigotimes: bigotimes, - bigsqcup: bigsqcup, - bigstar: bigstar, - bigtriangledown: bigtriangledown, - bigtriangleup: bigtriangleup, - biguplus: biguplus, - bigvee: bigvee, - bigwedge: bigwedge, - bkarow: bkarow, - blacklozenge: blacklozenge, - blacksquare: blacksquare, - blacktriangle: blacktriangle, - blacktriangledown: blacktriangledown, - blacktriangleleft: blacktriangleleft, - blacktriangleright: blacktriangleright, - blank: blank, - blk12: blk12, - blk14: blk14, - blk34: blk34, - block: block, - bne: bne, - bnequiv: bnequiv, - bnot: bnot, - bopf: bopf, - bot: bot, - bottom: bottom, - bowtie: bowtie, - boxDL: boxDL, - boxDR: boxDR, - boxDl: boxDl, - boxDr: boxDr, - boxH: boxH, - boxHD: boxHD, - boxHU: boxHU, - boxHd: boxHd, - boxHu: boxHu, - boxUL: boxUL, - boxUR: boxUR, - boxUl: boxUl, - boxUr: boxUr, - boxV: boxV, - boxVH: boxVH, - boxVL: boxVL, - boxVR: boxVR, - boxVh: boxVh, - boxVl: boxVl, - boxVr: boxVr, - boxbox: boxbox, - boxdL: boxdL, - boxdR: boxdR, - boxdl: boxdl, - boxdr: boxdr, - boxh: boxh, - boxhD: boxhD, - boxhU: boxhU, - boxhd: boxhd, - boxhu: boxhu, - boxminus: boxminus, - boxplus: boxplus, - boxtimes: boxtimes, - boxuL: boxuL, - boxuR: boxuR, - boxul: boxul, - boxur: boxur, - boxv: boxv, - boxvH: boxvH, - boxvL: boxvL, - boxvR: boxvR, - boxvh: boxvh, - boxvl: boxvl, - boxvr: boxvr, - bprime: bprime, - breve: breve, - brvba: brvba, - brvbar: brvbar, - bscr: bscr, - bsemi: bsemi, - bsim: bsim, - bsime: bsime, - bsol: bsol, - bsolb: bsolb, - bsolhsub: bsolhsub, - bull: bull, - bullet: bullet, - bump: bump, - bumpE: bumpE, - bumpe: bumpe, - bumpeq: bumpeq, - cacute: cacute, - cap: cap, - capand: capand, - capbrcup: capbrcup, - capcap: capcap, - capcup: capcup, - capdot: capdot, - caps: caps, - caret: caret, - caron: caron, - ccaps: ccaps, - ccaron: ccaron, - ccedi: ccedi, - ccedil: ccedil, - ccirc: ccirc, - ccups: ccups, - ccupssm: ccupssm, - cdot: cdot, - cedi: cedi, - cedil: cedil, - cemptyv: cemptyv, - cen: cen, - cent: cent, - centerdot: centerdot, - cfr: cfr, - chcy: chcy, - check: check$2, - checkmark: checkmark, - chi: chi, - cir: cir, - cirE: cirE, - circ: circ, - circeq: circeq, - circlearrowleft: circlearrowleft, - circlearrowright: circlearrowright, - circledR: circledR, - circledS: circledS, - circledast: circledast, - circledcirc: circledcirc, - circleddash: circleddash, - cire: cire, - cirfnint: cirfnint, - cirmid: cirmid, - cirscir: cirscir, - clubs: clubs, - clubsuit: clubsuit, - colon: colon, - colone: colone, - coloneq: coloneq, - comma: comma, - commat: commat, - comp: comp, - compfn: compfn, - complement: complement, - complexes: complexes, - cong: cong, - congdot: congdot, - conint: conint, - copf: copf, - coprod: coprod, - cop: cop, - copy: copy$1, - copysr: copysr, - crarr: crarr, - cross: cross, - cscr: cscr, - csub: csub, - csube: csube, - csup: csup, - csupe: csupe, - ctdot: ctdot, - cudarrl: cudarrl, - cudarrr: cudarrr, - cuepr: cuepr, - cuesc: cuesc, - cularr: cularr, - cularrp: cularrp, - cup: cup, - cupbrcap: cupbrcap, - cupcap: cupcap, - cupcup: cupcup, - cupdot: cupdot, - cupor: cupor, - cups: cups, - curarr: curarr, - curarrm: curarrm, - curlyeqprec: curlyeqprec, - curlyeqsucc: curlyeqsucc, - curlyvee: curlyvee, - curlywedge: curlywedge, - curre: curre, - curren: curren, - curvearrowleft: curvearrowleft, - curvearrowright: curvearrowright, - cuvee: cuvee, - cuwed: cuwed, - cwconint: cwconint, - cwint: cwint, - cylcty: cylcty, - dArr: dArr, - dHar: dHar, - dagger: dagger, - daleth: daleth, - darr: darr, - dash: dash, - dashv: dashv, - dbkarow: dbkarow, - dblac: dblac, - dcaron: dcaron, - dcy: dcy, - dd: dd, - ddagger: ddagger, - ddarr: ddarr, - ddotseq: ddotseq, - de: de, - deg: deg, - delta: delta, - demptyv: demptyv, - dfisht: dfisht, - dfr: dfr, - dharl: dharl, - dharr: dharr, - diam: diam, - diamond: diamond, - diamondsuit: diamondsuit, - diams: diams, - die: die, - digamma: digamma, - disin: disin, - div: div, - divid: divid, - divide: divide, - divideontimes: divideontimes, - divonx: divonx, - djcy: djcy, - dlcorn: dlcorn, - dlcrop: dlcrop, - dollar: dollar, - dopf: dopf, - dot: dot, - doteq: doteq, - doteqdot: doteqdot, - dotminus: dotminus, - dotplus: dotplus, - dotsquare: dotsquare, - doublebarwedge: doublebarwedge, - downarrow: downarrow, - downdownarrows: downdownarrows, - downharpoonleft: downharpoonleft, - downharpoonright: downharpoonright, - drbkarow: drbkarow, - drcorn: drcorn, - drcrop: drcrop, - dscr: dscr, - dscy: dscy, - dsol: dsol, - dstrok: dstrok, - dtdot: dtdot, - dtri: dtri, - dtrif: dtrif, - duarr: duarr, - duhar: duhar, - dwangle: dwangle, - dzcy: dzcy, - dzigrarr: dzigrarr, - eDDot: eDDot, - eDot: eDot, - eacut: eacut, - eacute: eacute, - easter: easter, - ecaron: ecaron, - ecir: ecir, - ecirc: ecirc, - ecolon: ecolon, - ecy: ecy, - edot: edot, - ee: ee, - efDot: efDot, - efr: efr, - eg: eg, - egrav: egrav, - egrave: egrave, - egs: egs, - egsdot: egsdot, - el: el, - elinters: elinters, - ell: ell, - els: els, - elsdot: elsdot, - emacr: emacr, - empty: empty, - emptyset: emptyset, - emptyv: emptyv, - emsp13: emsp13, - emsp14: emsp14, - emsp: emsp, - eng: eng, - ensp: ensp, - eogon: eogon, - eopf: eopf, - epar: epar, - eparsl: eparsl, - eplus: eplus, - epsi: epsi, - epsilon: epsilon, - epsiv: epsiv, - eqcirc: eqcirc, - eqcolon: eqcolon, - eqsim: eqsim, - eqslantgtr: eqslantgtr, - eqslantless: eqslantless, - equals: equals, - equest: equest, - equiv: equiv, - equivDD: equivDD, - eqvparsl: eqvparsl, - erDot: erDot, - erarr: erarr, - escr: escr, - esdot: esdot, - esim: esim, - eta: eta, - et: et, - eth: eth, - eum: eum, - euml: euml, - euro: euro, - excl: excl, - exist: exist, - expectation: expectation, - exponentiale: exponentiale, - fallingdotseq: fallingdotseq, - fcy: fcy, - female: female, - ffilig: ffilig, - fflig: fflig, - ffllig: ffllig, - ffr: ffr, - filig: filig, - fjlig: fjlig, - flat: flat, - fllig: fllig, - fltns: fltns, - fnof: fnof, - fopf: fopf, - forall: forall, - fork: fork, - forkv: forkv, - fpartint: fpartint, - frac1: frac1, - frac12: frac12, - frac13: frac13, - frac14: frac14, - frac15: frac15, - frac16: frac16, - frac18: frac18, - frac23: frac23, - frac25: frac25, - frac3: frac3, - frac34: frac34, - frac35: frac35, - frac38: frac38, - frac45: frac45, - frac56: frac56, - frac58: frac58, - frac78: frac78, - frasl: frasl, - frown: frown, - fscr: fscr, - gE: gE, - gEl: gEl, - gacute: gacute, - gamma: gamma, - gammad: gammad, - gap: gap, - gbreve: gbreve, - gcirc: gcirc, - gcy: gcy, - gdot: gdot, - ge: ge, - gel: gel, - geq: geq, - geqq: geqq, - geqslant: geqslant, - ges: ges, - gescc: gescc, - gesdot: gesdot, - gesdoto: gesdoto, - gesdotol: gesdotol, - gesl: gesl, - gesles: gesles, - gfr: gfr, - gg: gg, - ggg: ggg, - gimel: gimel, - gjcy: gjcy, - gl: gl, - glE: glE, - gla: gla, - glj: glj, - gnE: gnE, - gnap: gnap, - gnapprox: gnapprox, - gne: gne, - gneq: gneq, - gneqq: gneqq, - gnsim: gnsim, - gopf: gopf, - grave: grave, - gscr: gscr, - gsim: gsim, - gsime: gsime, - gsiml: gsiml, - g: g, - gt: gt, - gtcc: gtcc, - gtcir: gtcir, - gtdot: gtdot, - gtlPar: gtlPar, - gtquest: gtquest, - gtrapprox: gtrapprox, - gtrarr: gtrarr, - gtrdot: gtrdot, - gtreqless: gtreqless, - gtreqqless: gtreqqless, - gtrless: gtrless, - gtrsim: gtrsim, - gvertneqq: gvertneqq, - gvnE: gvnE, - hArr: hArr, - hairsp: hairsp, - half: half, - hamilt: hamilt, - hardcy: hardcy, - harr: harr, - harrcir: harrcir, - harrw: harrw, - hbar: hbar, - hcirc: hcirc, - hearts: hearts, - heartsuit: heartsuit, - hellip: hellip, - hercon: hercon, - hfr: hfr, - hksearow: hksearow, - hkswarow: hkswarow, - hoarr: hoarr, - homtht: homtht, - hookleftarrow: hookleftarrow, - hookrightarrow: hookrightarrow, - hopf: hopf, - horbar: horbar, - hscr: hscr, - hslash: hslash, - hstrok: hstrok, - hybull: hybull, - hyphen: hyphen, - iacut: iacut, - iacute: iacute, - ic: ic, - icir: icir, - icirc: icirc, - icy: icy, - iecy: iecy, - iexc: iexc, - iexcl: iexcl, - iff: iff, - ifr: ifr, - igrav: igrav, - igrave: igrave, - ii: ii, - iiiint: iiiint, - iiint: iiint, - iinfin: iinfin, - iiota: iiota, - ijlig: ijlig, - imacr: imacr, - image: image, - imagline: imagline, - imagpart: imagpart, - imath: imath, - imof: imof, - imped: imped, - "in": "āˆˆ", - incare: incare, - infin: infin, - infintie: infintie, - inodot: inodot, - int: int, - intcal: intcal, - integers: integers, - intercal: intercal, - intlarhk: intlarhk, - intprod: intprod, - iocy: iocy, - iogon: iogon, - iopf: iopf, - iota: iota, - iprod: iprod, - iques: iques, - iquest: iquest, - iscr: iscr, - isin: isin, - isinE: isinE, - isindot: isindot, - isins: isins, - isinsv: isinsv, - isinv: isinv, - it: it, - itilde: itilde, - iukcy: iukcy, - ium: ium, - iuml: iuml, - jcirc: jcirc, - jcy: jcy, - jfr: jfr, - jmath: jmath, - jopf: jopf, - jscr: jscr, - jsercy: jsercy, - jukcy: jukcy, - kappa: kappa, - kappav: kappav, - kcedil: kcedil, - kcy: kcy, - kfr: kfr, - kgreen: kgreen, - khcy: khcy, - kjcy: kjcy, - kopf: kopf, - kscr: kscr, - lAarr: lAarr, - lArr: lArr, - lAtail: lAtail, - lBarr: lBarr, - lE: lE, - lEg: lEg, - lHar: lHar, - lacute: lacute, - laemptyv: laemptyv, - lagran: lagran, - lambda: lambda, - lang: lang, - langd: langd, - langle: langle, - lap: lap, - laqu: laqu, - laquo: laquo, - larr: larr, - larrb: larrb, - larrbfs: larrbfs, - larrfs: larrfs, - larrhk: larrhk, - larrlp: larrlp, - larrpl: larrpl, - larrsim: larrsim, - larrtl: larrtl, - lat: lat, - latail: latail, - late: late, - lates: lates, - lbarr: lbarr, - lbbrk: lbbrk, - lbrace: lbrace, - lbrack: lbrack, - lbrke: lbrke, - lbrksld: lbrksld, - lbrkslu: lbrkslu, - lcaron: lcaron, - lcedil: lcedil, - lceil: lceil, - lcub: lcub, - lcy: lcy, - ldca: ldca, - ldquo: ldquo, - ldquor: ldquor, - ldrdhar: ldrdhar, - ldrushar: ldrushar, - ldsh: ldsh, - le: le, - leftarrow: leftarrow, - leftarrowtail: leftarrowtail, - leftharpoondown: leftharpoondown, - leftharpoonup: leftharpoonup, - leftleftarrows: leftleftarrows, - leftrightarrow: leftrightarrow, - leftrightarrows: leftrightarrows, - leftrightharpoons: leftrightharpoons, - leftrightsquigarrow: leftrightsquigarrow, - leftthreetimes: leftthreetimes, - leg: leg, - leq: leq, - leqq: leqq, - leqslant: leqslant, - les: les, - lescc: lescc, - lesdot: lesdot, - lesdoto: lesdoto, - lesdotor: lesdotor, - lesg: lesg, - lesges: lesges, - lessapprox: lessapprox, - lessdot: lessdot, - lesseqgtr: lesseqgtr, - lesseqqgtr: lesseqqgtr, - lessgtr: lessgtr, - lesssim: lesssim, - lfisht: lfisht, - lfloor: lfloor, - lfr: lfr, - lg: lg, - lgE: lgE, - lhard: lhard, - lharu: lharu, - lharul: lharul, - lhblk: lhblk, - ljcy: ljcy, - ll: ll, - llarr: llarr, - llcorner: llcorner, - llhard: llhard, - lltri: lltri, - lmidot: lmidot, - lmoust: lmoust, - lmoustache: lmoustache, - lnE: lnE, - lnap: lnap, - lnapprox: lnapprox, - lne: lne, - lneq: lneq, - lneqq: lneqq, - lnsim: lnsim, - loang: loang, - loarr: loarr, - lobrk: lobrk, - longleftarrow: longleftarrow, - longleftrightarrow: longleftrightarrow, - longmapsto: longmapsto, - longrightarrow: longrightarrow, - looparrowleft: looparrowleft, - looparrowright: looparrowright, - lopar: lopar, - lopf: lopf, - loplus: loplus, - lotimes: lotimes, - lowast: lowast, - lowbar: lowbar, - loz: loz, - lozenge: lozenge, - lozf: lozf, - lpar: lpar, - lparlt: lparlt, - lrarr: lrarr, - lrcorner: lrcorner, - lrhar: lrhar, - lrhard: lrhard, - lrm: lrm, - lrtri: lrtri, - lsaquo: lsaquo, - lscr: lscr, - lsh: lsh, - lsim: lsim, - lsime: lsime, - lsimg: lsimg, - lsqb: lsqb, - lsquo: lsquo, - lsquor: lsquor, - lstrok: lstrok, - l: l, - lt: lt, - ltcc: ltcc, - ltcir: ltcir, - ltdot: ltdot, - lthree: lthree, - ltimes: ltimes, - ltlarr: ltlarr, - ltquest: ltquest, - ltrPar: ltrPar, - ltri: ltri, - ltrie: ltrie, - ltrif: ltrif, - lurdshar: lurdshar, - luruhar: luruhar, - lvertneqq: lvertneqq, - lvnE: lvnE, - mDDot: mDDot, - mac: mac, - macr: macr, - male: male, - malt: malt, - maltese: maltese, - map: map$2, - mapsto: mapsto, - mapstodown: mapstodown, - mapstoleft: mapstoleft, - mapstoup: mapstoup, - marker: marker, - mcomma: mcomma, - mcy: mcy, - mdash: mdash, - measuredangle: measuredangle, - mfr: mfr, - mho: mho, - micr: micr, - micro: micro, - mid: mid, - midast: midast, - midcir: midcir, - middo: middo, - middot: middot, - minus: minus, - minusb: minusb, - minusd: minusd, - minusdu: minusdu, - mlcp: mlcp, - mldr: mldr, - mnplus: mnplus, - models: models$2, - mopf: mopf, - mp: mp, - mscr: mscr, - mstpos: mstpos, - mu: mu, - multimap: multimap, - mumap: mumap, - nGg: nGg, - nGt: nGt, - nGtv: nGtv, - nLeftarrow: nLeftarrow, - nLeftrightarrow: nLeftrightarrow, - nLl: nLl, - nLt: nLt, - nLtv: nLtv, - nRightarrow: nRightarrow, - nVDash: nVDash, - nVdash: nVdash, - nabla: nabla, - nacute: nacute, - nang: nang, - nap: nap, - napE: napE, - napid: napid, - napos: napos, - napprox: napprox, - natur: natur, - natural: natural, - naturals: naturals, - nbs: nbs, - nbsp: nbsp, - nbump: nbump, - nbumpe: nbumpe, - ncap: ncap, - ncaron: ncaron, - ncedil: ncedil, - ncong: ncong, - ncongdot: ncongdot, - ncup: ncup, - ncy: ncy, - ndash: ndash, - ne: ne, - neArr: neArr, - nearhk: nearhk, - nearr: nearr, - nearrow: nearrow, - nedot: nedot, - nequiv: nequiv, - nesear: nesear, - nesim: nesim, - nexist: nexist, - nexists: nexists, - nfr: nfr, - ngE: ngE, - nge: nge, - ngeq: ngeq, - ngeqq: ngeqq, - ngeqslant: ngeqslant, - nges: nges, - ngsim: ngsim, - ngt: ngt, - ngtr: ngtr, - nhArr: nhArr, - nharr: nharr, - nhpar: nhpar, - ni: ni, - nis: nis, - nisd: nisd, - niv: niv, - njcy: njcy, - nlArr: nlArr, - nlE: nlE, - nlarr: nlarr, - nldr: nldr, - nle: nle, - nleftarrow: nleftarrow, - nleftrightarrow: nleftrightarrow, - nleq: nleq, - nleqq: nleqq, - nleqslant: nleqslant, - nles: nles, - nless: nless, - nlsim: nlsim, - nlt: nlt, - nltri: nltri, - nltrie: nltrie, - nmid: nmid, - nopf: nopf, - no: no, - not: not, - notin: notin, - notinE: notinE, - notindot: notindot, - notinva: notinva, - notinvb: notinvb, - notinvc: notinvc, - notni: notni, - notniva: notniva, - notnivb: notnivb, - notnivc: notnivc, - npar: npar, - nparallel: nparallel, - nparsl: nparsl, - npart: npart, - npolint: npolint, - npr: npr, - nprcue: nprcue, - npre: npre, - nprec: nprec, - npreceq: npreceq, - nrArr: nrArr, - nrarr: nrarr, - nrarrc: nrarrc, - nrarrw: nrarrw, - nrightarrow: nrightarrow, - nrtri: nrtri, - nrtrie: nrtrie, - nsc: nsc, - nsccue: nsccue, - nsce: nsce, - nscr: nscr, - nshortmid: nshortmid, - nshortparallel: nshortparallel, - nsim: nsim, - nsime: nsime, - nsimeq: nsimeq, - nsmid: nsmid, - nspar: nspar, - nsqsube: nsqsube, - nsqsupe: nsqsupe, - nsub: nsub, - nsubE: nsubE, - nsube: nsube, - nsubset: nsubset, - nsubseteq: nsubseteq, - nsubseteqq: nsubseteqq, - nsucc: nsucc, - nsucceq: nsucceq, - nsup: nsup, - nsupE: nsupE, - nsupe: nsupe, - nsupset: nsupset, - nsupseteq: nsupseteq, - nsupseteqq: nsupseteqq, - ntgl: ntgl, - ntild: ntild, - ntilde: ntilde, - ntlg: ntlg, - ntriangleleft: ntriangleleft, - ntrianglelefteq: ntrianglelefteq, - ntriangleright: ntriangleright, - ntrianglerighteq: ntrianglerighteq, - nu: nu, - num: num, - numero: numero, - numsp: numsp, - nvDash: nvDash, - nvHarr: nvHarr, - nvap: nvap, - nvdash: nvdash, - nvge: nvge, - nvgt: nvgt, - nvinfin: nvinfin, - nvlArr: nvlArr, - nvle: nvle, - nvlt: nvlt, - nvltrie: nvltrie, - nvrArr: nvrArr, - nvrtrie: nvrtrie, - nvsim: nvsim, - nwArr: nwArr, - nwarhk: nwarhk, - nwarr: nwarr, - nwarrow: nwarrow, - nwnear: nwnear, - oS: oS, - oacut: oacut, - oacute: oacute, - oast: oast, - ocir: ocir, - ocirc: ocirc, - ocy: ocy, - odash: odash, - odblac: odblac, - odiv: odiv, - odot: odot, - odsold: odsold, - oelig: oelig, - ofcir: ofcir, - ofr: ofr, - ogon: ogon, - ograv: ograv, - ograve: ograve, - ogt: ogt, - ohbar: ohbar, - ohm: ohm, - oint: oint, - olarr: olarr, - olcir: olcir, - olcross: olcross, - oline: oline, - olt: olt, - omacr: omacr, - omega: omega, - omicron: omicron, - omid: omid, - ominus: ominus, - oopf: oopf, - opar: opar, - operp: operp, - oplus: oplus, - or: or, - orarr: orarr, - ord: ord, - order: order$1, - orderof: orderof, - ordf: ordf, - ordm: ordm, - origof: origof, - oror: oror, - orslope: orslope, - orv: orv, - oscr: oscr, - oslas: oslas, - oslash: oslash, - osol: osol, - otild: otild, - otilde: otilde, - otimes: otimes, - otimesas: otimesas, - oum: oum, - ouml: ouml, - ovbar: ovbar, - par: par, - para: para, - parallel: parallel, - parsim: parsim, - parsl: parsl, - part: part, - pcy: pcy, - percnt: percnt, - period: period, - permil: permil, - perp: perp, - pertenk: pertenk, - pfr: pfr, - phi: phi, - phiv: phiv, - phmmat: phmmat, - phone: phone, - pi: pi, - pitchfork: pitchfork, - piv: piv, - planck: planck, - planckh: planckh, - plankv: plankv, - plus: plus, - plusacir: plusacir, - plusb: plusb, - pluscir: pluscir, - plusdo: plusdo, - plusdu: plusdu, - pluse: pluse, - plusm: plusm, - plusmn: plusmn, - plussim: plussim, - plustwo: plustwo, - pm: pm, - pointint: pointint, - popf: popf, - poun: poun, - pound: pound, - pr: pr, - prE: prE, - prap: prap, - prcue: prcue, - pre: pre, - prec: prec, - precapprox: precapprox, - preccurlyeq: preccurlyeq, - preceq: preceq, - precnapprox: precnapprox, - precneqq: precneqq, - precnsim: precnsim, - precsim: precsim, - prime: prime, - primes: primes, - prnE: prnE, - prnap: prnap, - prnsim: prnsim, - prod: prod, - profalar: profalar, - profline: profline, - profsurf: profsurf, - prop: prop, - propto: propto, - prsim: prsim, - prurel: prurel, - pscr: pscr, - psi: psi, - puncsp: puncsp, - qfr: qfr, - qint: qint, - qopf: qopf, - qprime: qprime, - qscr: qscr, - quaternions: quaternions, - quatint: quatint, - quest: quest, - questeq: questeq, - quo: quo, - quot: quot, - rAarr: rAarr, - rArr: rArr, - rAtail: rAtail, - rBarr: rBarr, - rHar: rHar, - race: race, - racute: racute, - radic: radic, - raemptyv: raemptyv, - rang: rang, - rangd: rangd, - range: range$1, - rangle: rangle, - raqu: raqu, - raquo: raquo, - rarr: rarr, - rarrap: rarrap, - rarrb: rarrb, - rarrbfs: rarrbfs, - rarrc: rarrc, - rarrfs: rarrfs, - rarrhk: rarrhk, - rarrlp: rarrlp, - rarrpl: rarrpl, - rarrsim: rarrsim, - rarrtl: rarrtl, - rarrw: rarrw, - ratail: ratail, - ratio: ratio, - rationals: rationals, - rbarr: rbarr, - rbbrk: rbbrk, - rbrace: rbrace, - rbrack: rbrack, - rbrke: rbrke, - rbrksld: rbrksld, - rbrkslu: rbrkslu, - rcaron: rcaron, - rcedil: rcedil, - rceil: rceil, - rcub: rcub, - rcy: rcy, - rdca: rdca, - rdldhar: rdldhar, - rdquo: rdquo, - rdquor: rdquor, - rdsh: rdsh, - real: real, - realine: realine, - realpart: realpart, - reals: reals, - rect: rect, - re: re, - reg: reg, - rfisht: rfisht, - rfloor: rfloor, - rfr: rfr, - rhard: rhard, - rharu: rharu, - rharul: rharul, - rho: rho, - rhov: rhov, - rightarrow: rightarrow, - rightarrowtail: rightarrowtail, - rightharpoondown: rightharpoondown, - rightharpoonup: rightharpoonup, - rightleftarrows: rightleftarrows, - rightleftharpoons: rightleftharpoons, - rightrightarrows: rightrightarrows, - rightsquigarrow: rightsquigarrow, - rightthreetimes: rightthreetimes, - ring: ring, - risingdotseq: risingdotseq, - rlarr: rlarr, - rlhar: rlhar, - rlm: rlm, - rmoust: rmoust, - rmoustache: rmoustache, - rnmid: rnmid, - roang: roang, - roarr: roarr, - robrk: robrk, - ropar: ropar, - ropf: ropf, - roplus: roplus, - rotimes: rotimes, - rpar: rpar, - rpargt: rpargt, - rppolint: rppolint, - rrarr: rrarr, - rsaquo: rsaquo, - rscr: rscr, - rsh: rsh, - rsqb: rsqb, - rsquo: rsquo, - rsquor: rsquor, - rthree: rthree, - rtimes: rtimes, - rtri: rtri, - rtrie: rtrie, - rtrif: rtrif, - rtriltri: rtriltri, - ruluhar: ruluhar, - rx: rx, - sacute: sacute, - sbquo: sbquo, - sc: sc, - scE: scE, - scap: scap, - scaron: scaron, - sccue: sccue, - sce: sce, - scedil: scedil, - scirc: scirc, - scnE: scnE, - scnap: scnap, - scnsim: scnsim, - scpolint: scpolint, - scsim: scsim, - scy: scy, - sdot: sdot, - sdotb: sdotb, - sdote: sdote, - seArr: seArr, - searhk: searhk, - searr: searr, - searrow: searrow, - sec: sec, - sect: sect, - semi: semi, - seswar: seswar, - setminus: setminus, - setmn: setmn, - sext: sext, - sfr: sfr, - sfrown: sfrown, - sharp: sharp, - shchcy: shchcy, - shcy: shcy, - shortmid: shortmid, - shortparallel: shortparallel, - sh: sh, - shy: shy, - sigma: sigma, - sigmaf: sigmaf, - sigmav: sigmav, - sim: sim, - simdot: simdot, - sime: sime, - simeq: simeq, - simg: simg, - simgE: simgE, - siml: siml, - simlE: simlE, - simne: simne, - simplus: simplus, - simrarr: simrarr, - slarr: slarr, - smallsetminus: smallsetminus, - smashp: smashp, - smeparsl: smeparsl, - smid: smid, - smile: smile, - smt: smt, - smte: smte, - smtes: smtes, - softcy: softcy, - sol: sol, - solb: solb, - solbar: solbar, - sopf: sopf, - spades: spades, - spadesuit: spadesuit, - spar: spar, - sqcap: sqcap, - sqcaps: sqcaps, - sqcup: sqcup, - sqcups: sqcups, - sqsub: sqsub, - sqsube: sqsube, - sqsubset: sqsubset, - sqsubseteq: sqsubseteq, - sqsup: sqsup, - sqsupe: sqsupe, - sqsupset: sqsupset, - sqsupseteq: sqsupseteq, - squ: squ, - square: square, - squarf: squarf, - squf: squf, - srarr: srarr, - sscr: sscr, - ssetmn: ssetmn, - ssmile: ssmile, - sstarf: sstarf, - star: star$1, - starf: starf, - straightepsilon: straightepsilon, - straightphi: straightphi, - strns: strns, - sub: sub, - subE: subE, - subdot: subdot, - sube: sube, - subedot: subedot, - submult: submult, - subnE: subnE, - subne: subne, - subplus: subplus, - subrarr: subrarr, - subset: subset, - subseteq: subseteq, - subseteqq: subseteqq, - subsetneq: subsetneq, - subsetneqq: subsetneqq, - subsim: subsim, - subsub: subsub, - subsup: subsup, - succ: succ, - succapprox: succapprox, - succcurlyeq: succcurlyeq, - succeq: succeq, - succnapprox: succnapprox, - succneqq: succneqq, - succnsim: succnsim, - succsim: succsim, - sum: sum, - sung: sung, - sup: sup, - sup1: sup1, - sup2: sup2, - sup3: sup3, - supE: supE, - supdot: supdot, - supdsub: supdsub, - supe: supe, - supedot: supedot, - suphsol: suphsol, - suphsub: suphsub, - suplarr: suplarr, - supmult: supmult, - supnE: supnE, - supne: supne, - supplus: supplus, - supset: supset, - supseteq: supseteq, - supseteqq: supseteqq, - supsetneq: supsetneq, - supsetneqq: supsetneqq, - supsim: supsim, - supsub: supsub, - supsup: supsup, - swArr: swArr, - swarhk: swarhk, - swarr: swarr, - swarrow: swarrow, - swnwar: swnwar, - szli: szli, - szlig: szlig, - target: target, - tau: tau, - tbrk: tbrk, - tcaron: tcaron, - tcedil: tcedil, - tcy: tcy, - tdot: tdot, - telrec: telrec, - tfr: tfr, - there4: there4, - therefore: therefore, - theta: theta, - thetasym: thetasym, - thetav: thetav, - thickapprox: thickapprox, - thicksim: thicksim, - thinsp: thinsp, - thkap: thkap, - thksim: thksim, - thor: thor, - thorn: thorn, - tilde: tilde, - time: time, - times: times, - timesb: timesb, - timesbar: timesbar, - timesd: timesd, - tint: tint, - toea: toea, - top: top, - topbot: topbot, - topcir: topcir, - topf: topf, - topfork: topfork, - tosa: tosa, - tprime: tprime, - trade: trade, - triangle: triangle, - triangledown: triangledown, - triangleleft: triangleleft, - trianglelefteq: trianglelefteq, - triangleq: triangleq, - triangleright: triangleright, - trianglerighteq: trianglerighteq, - tridot: tridot, - trie: trie, - triminus: triminus, - triplus: triplus, - trisb: trisb, - tritime: tritime, - trpezium: trpezium, - tscr: tscr, - tscy: tscy, - tshcy: tshcy, - tstrok: tstrok, - twixt: twixt, - twoheadleftarrow: twoheadleftarrow, - twoheadrightarrow: twoheadrightarrow, - uArr: uArr, - uHar: uHar, - uacut: uacut, - uacute: uacute, - uarr: uarr, - ubrcy: ubrcy, - ubreve: ubreve, - ucir: ucir, - ucirc: ucirc, - ucy: ucy, - udarr: udarr, - udblac: udblac, - udhar: udhar, - ufisht: ufisht, - ufr: ufr, - ugrav: ugrav, - ugrave: ugrave, - uharl: uharl, - uharr: uharr, - uhblk: uhblk, - ulcorn: ulcorn, - ulcorner: ulcorner, - ulcrop: ulcrop, - ultri: ultri, - umacr: umacr, - um: um, - uml: uml, - uogon: uogon, - uopf: uopf, - uparrow: uparrow, - updownarrow: updownarrow, - upharpoonleft: upharpoonleft, - upharpoonright: upharpoonright, - uplus: uplus, - upsi: upsi, - upsih: upsih, - upsilon: upsilon, - upuparrows: upuparrows, - urcorn: urcorn, - urcorner: urcorner, - urcrop: urcrop, - uring: uring, - urtri: urtri, - uscr: uscr, - utdot: utdot, - utilde: utilde, - utri: utri, - utrif: utrif, - uuarr: uuarr, - uum: uum, - uuml: uuml, - uwangle: uwangle, - vArr: vArr, - vBar: vBar, - vBarv: vBarv, - vDash: vDash, - vangrt: vangrt, - varepsilon: varepsilon, - varkappa: varkappa, - varnothing: varnothing, - varphi: varphi, - varpi: varpi, - varpropto: varpropto, - varr: varr, - varrho: varrho, - varsigma: varsigma, - varsubsetneq: varsubsetneq, - varsubsetneqq: varsubsetneqq, - varsupsetneq: varsupsetneq, - varsupsetneqq: varsupsetneqq, - vartheta: vartheta, - vartriangleleft: vartriangleleft, - vartriangleright: vartriangleright, - vcy: vcy, - vdash: vdash, - vee: vee, - veebar: veebar, - veeeq: veeeq, - vellip: vellip, - verbar: verbar, - vert: vert, - vfr: vfr, - vltri: vltri, - vnsub: vnsub, - vnsup: vnsup, - vopf: vopf, - vprop: vprop, - vrtri: vrtri, - vscr: vscr, - vsubnE: vsubnE, - vsubne: vsubne, - vsupnE: vsupnE, - vsupne: vsupne, - vzigzag: vzigzag, - wcirc: wcirc, - wedbar: wedbar, - wedge: wedge, - wedgeq: wedgeq, - weierp: weierp, - wfr: wfr, - wopf: wopf, - wp: wp, - wr: wr, - wreath: wreath, - wscr: wscr, - xcap: xcap, - xcirc: xcirc, - xcup: xcup, - xdtri: xdtri, - xfr: xfr, - xhArr: xhArr, - xharr: xharr, - xi: xi, - xlArr: xlArr, - xlarr: xlarr, - xmap: xmap, - xnis: xnis, - xodot: xodot, - xopf: xopf, - xoplus: xoplus, - xotime: xotime, - xrArr: xrArr, - xrarr: xrarr, - xscr: xscr, - xsqcup: xsqcup, - xuplus: xuplus, - xutri: xutri, - xvee: xvee, - xwedge: xwedge, - yacut: yacut, - yacute: yacute, - yacy: yacy, - ycirc: ycirc, - ycy: ycy, - ye: ye, - yen: yen, - yfr: yfr, - yicy: yicy, - yopf: yopf, - yscr: yscr, - yucy: yucy, - yum: yum, - yuml: yuml, - zacute: zacute, - zcaron: zcaron, - zcy: zcy, - zdot: zdot, - zeetrf: zeetrf, - zeta: zeta, - zfr: zfr, - zhcy: zhcy, - zigrarr: zigrarr, - zopf: zopf, - zscr: zscr, - zwj: zwj, - zwnj: zwnj -}; - -var characterEntities = /*#__PURE__*/Object.freeze({ - __proto__: null, - AEli: AEli, - AElig: AElig, - AM: AM, - AMP: AMP, - Aacut: Aacut, - Aacute: Aacute, - Abreve: Abreve, - Acir: Acir, - Acirc: Acirc, - Acy: Acy, - Afr: Afr, - Agrav: Agrav, - Agrave: Agrave, - Alpha: Alpha, - Amacr: Amacr, - And: And, - Aogon: Aogon, - Aopf: Aopf, - ApplyFunction: ApplyFunction, - Arin: Arin, - Aring: Aring, - Ascr: Ascr, - Assign: Assign, - Atild: Atild, - Atilde: Atilde, - Aum: Aum, - Auml: Auml, - Backslash: Backslash, - Barv: Barv, - Barwed: Barwed, - Bcy: Bcy, - Because: Because, - Bernoullis: Bernoullis, - Beta: Beta, - Bfr: Bfr, - Bopf: Bopf, - Breve: Breve, - Bscr: Bscr, - Bumpeq: Bumpeq, - CHcy: CHcy, - COP: COP, - COPY: COPY, - Cacute: Cacute, - Cap: Cap, - CapitalDifferentialD: CapitalDifferentialD, - Cayleys: Cayleys, - Ccaron: Ccaron, - Ccedi: Ccedi, - Ccedil: Ccedil, - Ccirc: Ccirc, - Cconint: Cconint, - Cdot: Cdot, - Cedilla: Cedilla, - CenterDot: CenterDot, - Cfr: Cfr, - Chi: Chi, - CircleDot: CircleDot, - CircleMinus: CircleMinus, - CirclePlus: CirclePlus, - CircleTimes: CircleTimes, - ClockwiseContourIntegral: ClockwiseContourIntegral, - CloseCurlyDoubleQuote: CloseCurlyDoubleQuote, - CloseCurlyQuote: CloseCurlyQuote, - Colon: Colon, - Colone: Colone, - Congruent: Congruent, - Conint: Conint, - ContourIntegral: ContourIntegral, - Copf: Copf, - Coproduct: Coproduct, - CounterClockwiseContourIntegral: CounterClockwiseContourIntegral, - Cross: Cross, - Cscr: Cscr, - Cup: Cup, - CupCap: CupCap, - DD: DD, - DDotrahd: DDotrahd, - DJcy: DJcy, - DScy: DScy, - DZcy: DZcy, - Dagger: Dagger, - Darr: Darr, - Dashv: Dashv, - Dcaron: Dcaron, - Dcy: Dcy, - Del: Del, - Delta: Delta, - Dfr: Dfr, - DiacriticalAcute: DiacriticalAcute, - DiacriticalDot: DiacriticalDot, - DiacriticalDoubleAcute: DiacriticalDoubleAcute, - DiacriticalGrave: DiacriticalGrave, - DiacriticalTilde: DiacriticalTilde, - Diamond: Diamond, - DifferentialD: DifferentialD, - Dopf: Dopf, - Dot: Dot, - DotDot: DotDot, - DotEqual: DotEqual, - DoubleContourIntegral: DoubleContourIntegral, - DoubleDot: DoubleDot, - DoubleDownArrow: DoubleDownArrow, - DoubleLeftArrow: DoubleLeftArrow, - DoubleLeftRightArrow: DoubleLeftRightArrow, - DoubleLeftTee: DoubleLeftTee, - DoubleLongLeftArrow: DoubleLongLeftArrow, - DoubleLongLeftRightArrow: DoubleLongLeftRightArrow, - DoubleLongRightArrow: DoubleLongRightArrow, - DoubleRightArrow: DoubleRightArrow, - DoubleRightTee: DoubleRightTee, - DoubleUpArrow: DoubleUpArrow, - DoubleUpDownArrow: DoubleUpDownArrow, - DoubleVerticalBar: DoubleVerticalBar, - DownArrow: DownArrow, - DownArrowBar: DownArrowBar, - DownArrowUpArrow: DownArrowUpArrow, - DownBreve: DownBreve, - DownLeftRightVector: DownLeftRightVector, - DownLeftTeeVector: DownLeftTeeVector, - DownLeftVector: DownLeftVector, - DownLeftVectorBar: DownLeftVectorBar, - DownRightTeeVector: DownRightTeeVector, - DownRightVector: DownRightVector, - DownRightVectorBar: DownRightVectorBar, - DownTee: DownTee, - DownTeeArrow: DownTeeArrow, - Downarrow: Downarrow, - Dscr: Dscr, - Dstrok: Dstrok, - ENG: ENG, - ET: ET, - ETH: ETH, - Eacut: Eacut, - Eacute: Eacute, - Ecaron: Ecaron, - Ecir: Ecir, - Ecirc: Ecirc, - Ecy: Ecy, - Edot: Edot, - Efr: Efr, - Egrav: Egrav, - Egrave: Egrave, - Element: Element, - Emacr: Emacr, - EmptySmallSquare: EmptySmallSquare, - EmptyVerySmallSquare: EmptyVerySmallSquare, - Eogon: Eogon, - Eopf: Eopf, - Epsilon: Epsilon, - Equal: Equal, - EqualTilde: EqualTilde, - Equilibrium: Equilibrium, - Escr: Escr, - Esim: Esim, - Eta: Eta, - Eum: Eum, - Euml: Euml, - Exists: Exists, - ExponentialE: ExponentialE, - Fcy: Fcy, - Ffr: Ffr, - FilledSmallSquare: FilledSmallSquare, - FilledVerySmallSquare: FilledVerySmallSquare, - Fopf: Fopf, - ForAll: ForAll, - Fouriertrf: Fouriertrf, - Fscr: Fscr, - GJcy: GJcy, - G: G, - GT: GT, - Gamma: Gamma, - Gammad: Gammad, - Gbreve: Gbreve, - Gcedil: Gcedil, - Gcirc: Gcirc, - Gcy: Gcy, - Gdot: Gdot, - Gfr: Gfr, - Gg: Gg, - Gopf: Gopf, - GreaterEqual: GreaterEqual, - GreaterEqualLess: GreaterEqualLess, - GreaterFullEqual: GreaterFullEqual, - GreaterGreater: GreaterGreater, - GreaterLess: GreaterLess, - GreaterSlantEqual: GreaterSlantEqual, - GreaterTilde: GreaterTilde, - Gscr: Gscr, - Gt: Gt, - HARDcy: HARDcy, - Hacek: Hacek, - Hat: Hat, - Hcirc: Hcirc, - Hfr: Hfr, - HilbertSpace: HilbertSpace, - Hopf: Hopf, - HorizontalLine: HorizontalLine, - Hscr: Hscr, - Hstrok: Hstrok, - HumpDownHump: HumpDownHump, - HumpEqual: HumpEqual, - IEcy: IEcy, - IJlig: IJlig, - IOcy: IOcy, - Iacut: Iacut, - Iacute: Iacute, - Icir: Icir, - Icirc: Icirc, - Icy: Icy, - Idot: Idot, - Ifr: Ifr, - Igrav: Igrav, - Igrave: Igrave, - Im: Im, - Imacr: Imacr, - ImaginaryI: ImaginaryI, - Implies: Implies, - Int: Int, - Integral: Integral, - Intersection: Intersection, - InvisibleComma: InvisibleComma, - InvisibleTimes: InvisibleTimes, - Iogon: Iogon, - Iopf: Iopf, - Iota: Iota, - Iscr: Iscr, - Itilde: Itilde, - Iukcy: Iukcy, - Ium: Ium, - Iuml: Iuml, - Jcirc: Jcirc, - Jcy: Jcy, - Jfr: Jfr, - Jopf: Jopf, - Jscr: Jscr, - Jsercy: Jsercy, - Jukcy: Jukcy, - KHcy: KHcy, - KJcy: KJcy, - Kappa: Kappa, - Kcedil: Kcedil, - Kcy: Kcy, - Kfr: Kfr, - Kopf: Kopf, - Kscr: Kscr, - LJcy: LJcy, - L: L, - LT: LT, - Lacute: Lacute, - Lambda: Lambda, - Lang: Lang, - Laplacetrf: Laplacetrf, - Larr: Larr, - Lcaron: Lcaron, - Lcedil: Lcedil, - Lcy: Lcy, - LeftAngleBracket: LeftAngleBracket, - LeftArrow: LeftArrow, - LeftArrowBar: LeftArrowBar, - LeftArrowRightArrow: LeftArrowRightArrow, - LeftCeiling: LeftCeiling, - LeftDoubleBracket: LeftDoubleBracket, - LeftDownTeeVector: LeftDownTeeVector, - LeftDownVector: LeftDownVector, - LeftDownVectorBar: LeftDownVectorBar, - LeftFloor: LeftFloor, - LeftRightArrow: LeftRightArrow, - LeftRightVector: LeftRightVector, - LeftTee: LeftTee, - LeftTeeArrow: LeftTeeArrow, - LeftTeeVector: LeftTeeVector, - LeftTriangle: LeftTriangle, - LeftTriangleBar: LeftTriangleBar, - LeftTriangleEqual: LeftTriangleEqual, - LeftUpDownVector: LeftUpDownVector, - LeftUpTeeVector: LeftUpTeeVector, - LeftUpVector: LeftUpVector, - LeftUpVectorBar: LeftUpVectorBar, - LeftVector: LeftVector, - LeftVectorBar: LeftVectorBar, - Leftarrow: Leftarrow, - Leftrightarrow: Leftrightarrow, - LessEqualGreater: LessEqualGreater, - LessFullEqual: LessFullEqual, - LessGreater: LessGreater, - LessLess: LessLess, - LessSlantEqual: LessSlantEqual, - LessTilde: LessTilde, - Lfr: Lfr, - Ll: Ll, - Lleftarrow: Lleftarrow, - Lmidot: Lmidot, - LongLeftArrow: LongLeftArrow, - LongLeftRightArrow: LongLeftRightArrow, - LongRightArrow: LongRightArrow, - Longleftarrow: Longleftarrow, - Longleftrightarrow: Longleftrightarrow, - Longrightarrow: Longrightarrow, - Lopf: Lopf, - LowerLeftArrow: LowerLeftArrow, - LowerRightArrow: LowerRightArrow, - Lscr: Lscr, - Lsh: Lsh, - Lstrok: Lstrok, - Lt: Lt, - Mcy: Mcy, - MediumSpace: MediumSpace, - Mellintrf: Mellintrf, - Mfr: Mfr, - MinusPlus: MinusPlus, - Mopf: Mopf, - Mscr: Mscr, - Mu: Mu, - NJcy: NJcy, - Nacute: Nacute, - Ncaron: Ncaron, - Ncedil: Ncedil, - Ncy: Ncy, - NegativeMediumSpace: NegativeMediumSpace, - NegativeThickSpace: NegativeThickSpace, - NegativeThinSpace: NegativeThinSpace, - NegativeVeryThinSpace: NegativeVeryThinSpace, - NestedGreaterGreater: NestedGreaterGreater, - NestedLessLess: NestedLessLess, - NewLine: NewLine, - Nfr: Nfr, - NoBreak: NoBreak, - NonBreakingSpace: NonBreakingSpace, - Nopf: Nopf, - Not: Not, - NotCongruent: NotCongruent, - NotCupCap: NotCupCap, - NotDoubleVerticalBar: NotDoubleVerticalBar, - NotElement: NotElement, - NotEqual: NotEqual, - NotEqualTilde: NotEqualTilde, - NotExists: NotExists, - NotGreater: NotGreater, - NotGreaterEqual: NotGreaterEqual, - NotGreaterFullEqual: NotGreaterFullEqual, - NotGreaterGreater: NotGreaterGreater, - NotGreaterLess: NotGreaterLess, - NotGreaterSlantEqual: NotGreaterSlantEqual, - NotGreaterTilde: NotGreaterTilde, - NotHumpDownHump: NotHumpDownHump, - NotHumpEqual: NotHumpEqual, - NotLeftTriangle: NotLeftTriangle, - NotLeftTriangleBar: NotLeftTriangleBar, - NotLeftTriangleEqual: NotLeftTriangleEqual, - NotLess: NotLess, - NotLessEqual: NotLessEqual, - NotLessGreater: NotLessGreater, - NotLessLess: NotLessLess, - NotLessSlantEqual: NotLessSlantEqual, - NotLessTilde: NotLessTilde, - NotNestedGreaterGreater: NotNestedGreaterGreater, - NotNestedLessLess: NotNestedLessLess, - NotPrecedes: NotPrecedes, - NotPrecedesEqual: NotPrecedesEqual, - NotPrecedesSlantEqual: NotPrecedesSlantEqual, - NotReverseElement: NotReverseElement, - NotRightTriangle: NotRightTriangle, - NotRightTriangleBar: NotRightTriangleBar, - NotRightTriangleEqual: NotRightTriangleEqual, - NotSquareSubset: NotSquareSubset, - NotSquareSubsetEqual: NotSquareSubsetEqual, - NotSquareSuperset: NotSquareSuperset, - NotSquareSupersetEqual: NotSquareSupersetEqual, - NotSubset: NotSubset, - NotSubsetEqual: NotSubsetEqual, - NotSucceeds: NotSucceeds, - NotSucceedsEqual: NotSucceedsEqual, - NotSucceedsSlantEqual: NotSucceedsSlantEqual, - NotSucceedsTilde: NotSucceedsTilde, - NotSuperset: NotSuperset, - NotSupersetEqual: NotSupersetEqual, - NotTilde: NotTilde, - NotTildeEqual: NotTildeEqual, - NotTildeFullEqual: NotTildeFullEqual, - NotTildeTilde: NotTildeTilde, - NotVerticalBar: NotVerticalBar, - Nscr: Nscr, - Ntild: Ntild, - Ntilde: Ntilde, - Nu: Nu, - OElig: OElig, - Oacut: Oacut, - Oacute: Oacute, - Ocir: Ocir, - Ocirc: Ocirc, - Ocy: Ocy, - Odblac: Odblac, - Ofr: Ofr, - Ograv: Ograv, - Ograve: Ograve, - Omacr: Omacr, - Omega: Omega, - Omicron: Omicron, - Oopf: Oopf, - OpenCurlyDoubleQuote: OpenCurlyDoubleQuote, - OpenCurlyQuote: OpenCurlyQuote, - Or: Or, - Oscr: Oscr, - Oslas: Oslas, - Oslash: Oslash, - Otild: Otild, - Otilde: Otilde, - Otimes: Otimes, - Oum: Oum, - Ouml: Ouml, - OverBar: OverBar, - OverBrace: OverBrace, - OverBracket: OverBracket, - OverParenthesis: OverParenthesis, - PartialD: PartialD, - Pcy: Pcy, - Pfr: Pfr, - Phi: Phi, - Pi: Pi, - PlusMinus: PlusMinus, - Poincareplane: Poincareplane, - Popf: Popf, - Pr: Pr, - Precedes: Precedes, - PrecedesEqual: PrecedesEqual, - PrecedesSlantEqual: PrecedesSlantEqual, - PrecedesTilde: PrecedesTilde, - Prime: Prime, - Product: Product, - Proportion: Proportion, - Proportional: Proportional, - Pscr: Pscr, - Psi: Psi, - QUO: QUO, - QUOT: QUOT, - Qfr: Qfr, - Qopf: Qopf, - Qscr: Qscr, - RBarr: RBarr, - RE: RE, - REG: REG, - Racute: Racute, - Rang: Rang, - Rarr: Rarr, - Rarrtl: Rarrtl, - Rcaron: Rcaron, - Rcedil: Rcedil, - Rcy: Rcy, - Re: Re, - ReverseElement: ReverseElement, - ReverseEquilibrium: ReverseEquilibrium, - ReverseUpEquilibrium: ReverseUpEquilibrium, - Rfr: Rfr, - Rho: Rho, - RightAngleBracket: RightAngleBracket, - RightArrow: RightArrow, - RightArrowBar: RightArrowBar, - RightArrowLeftArrow: RightArrowLeftArrow, - RightCeiling: RightCeiling, - RightDoubleBracket: RightDoubleBracket, - RightDownTeeVector: RightDownTeeVector, - RightDownVector: RightDownVector, - RightDownVectorBar: RightDownVectorBar, - RightFloor: RightFloor, - RightTee: RightTee, - RightTeeArrow: RightTeeArrow, - RightTeeVector: RightTeeVector, - RightTriangle: RightTriangle, - RightTriangleBar: RightTriangleBar, - RightTriangleEqual: RightTriangleEqual, - RightUpDownVector: RightUpDownVector, - RightUpTeeVector: RightUpTeeVector, - RightUpVector: RightUpVector, - RightUpVectorBar: RightUpVectorBar, - RightVector: RightVector, - RightVectorBar: RightVectorBar, - Rightarrow: Rightarrow, - Ropf: Ropf, - RoundImplies: RoundImplies, - Rrightarrow: Rrightarrow, - Rscr: Rscr, - Rsh: Rsh, - RuleDelayed: RuleDelayed, - SHCHcy: SHCHcy, - SHcy: SHcy, - SOFTcy: SOFTcy, - Sacute: Sacute, - Sc: Sc, - Scaron: Scaron, - Scedil: Scedil, - Scirc: Scirc, - Scy: Scy, - Sfr: Sfr, - ShortDownArrow: ShortDownArrow, - ShortLeftArrow: ShortLeftArrow, - ShortRightArrow: ShortRightArrow, - ShortUpArrow: ShortUpArrow, - Sigma: Sigma, - SmallCircle: SmallCircle, - Sopf: Sopf, - Sqrt: Sqrt, - Square: Square, - SquareIntersection: SquareIntersection, - SquareSubset: SquareSubset, - SquareSubsetEqual: SquareSubsetEqual, - SquareSuperset: SquareSuperset, - SquareSupersetEqual: SquareSupersetEqual, - SquareUnion: SquareUnion, - Sscr: Sscr, - Star: Star, - Sub: Sub, - Subset: Subset, - SubsetEqual: SubsetEqual, - Succeeds: Succeeds, - SucceedsEqual: SucceedsEqual, - SucceedsSlantEqual: SucceedsSlantEqual, - SucceedsTilde: SucceedsTilde, - SuchThat: SuchThat, - Sum: Sum, - Sup: Sup, - Superset: Superset, - SupersetEqual: SupersetEqual, - Supset: Supset, - THOR: THOR, - THORN: THORN, - TRADE: TRADE, - TSHcy: TSHcy, - TScy: TScy, - Tab: Tab, - Tau: Tau, - Tcaron: Tcaron, - Tcedil: Tcedil, - Tcy: Tcy, - Tfr: Tfr, - Therefore: Therefore, - Theta: Theta, - ThickSpace: ThickSpace, - ThinSpace: ThinSpace, - Tilde: Tilde, - TildeEqual: TildeEqual, - TildeFullEqual: TildeFullEqual, - TildeTilde: TildeTilde, - Topf: Topf, - TripleDot: TripleDot, - Tscr: Tscr, - Tstrok: Tstrok, - Uacut: Uacut, - Uacute: Uacute, - Uarr: Uarr, - Uarrocir: Uarrocir, - Ubrcy: Ubrcy, - Ubreve: Ubreve, - Ucir: Ucir, - Ucirc: Ucirc, - Ucy: Ucy, - Udblac: Udblac, - Ufr: Ufr, - Ugrav: Ugrav, - Ugrave: Ugrave, - Umacr: Umacr, - UnderBar: UnderBar, - UnderBrace: UnderBrace, - UnderBracket: UnderBracket, - UnderParenthesis: UnderParenthesis, - Union: Union, - UnionPlus: UnionPlus, - Uogon: Uogon, - Uopf: Uopf, - UpArrow: UpArrow, - UpArrowBar: UpArrowBar, - UpArrowDownArrow: UpArrowDownArrow, - UpDownArrow: UpDownArrow, - UpEquilibrium: UpEquilibrium, - UpTee: UpTee, - UpTeeArrow: UpTeeArrow, - Uparrow: Uparrow, - Updownarrow: Updownarrow, - UpperLeftArrow: UpperLeftArrow, - UpperRightArrow: UpperRightArrow, - Upsi: Upsi, - Upsilon: Upsilon, - Uring: Uring, - Uscr: Uscr, - Utilde: Utilde, - Uum: Uum, - Uuml: Uuml, - VDash: VDash, - Vbar: Vbar, - Vcy: Vcy, - Vdash: Vdash, - Vdashl: Vdashl, - Vee: Vee, - Verbar: Verbar, - Vert: Vert, - VerticalBar: VerticalBar, - VerticalLine: VerticalLine, - VerticalSeparator: VerticalSeparator, - VerticalTilde: VerticalTilde, - VeryThinSpace: VeryThinSpace, - Vfr: Vfr, - Vopf: Vopf, - Vscr: Vscr, - Vvdash: Vvdash, - Wcirc: Wcirc, - Wedge: Wedge, - Wfr: Wfr, - Wopf: Wopf, - Wscr: Wscr, - Xfr: Xfr, - Xi: Xi, - Xopf: Xopf, - Xscr: Xscr, - YAcy: YAcy, - YIcy: YIcy, - YUcy: YUcy, - Yacut: Yacut, - Yacute: Yacute, - Ycirc: Ycirc, - Ycy: Ycy, - Yfr: Yfr, - Yopf: Yopf, - Yscr: Yscr, - Yuml: Yuml, - ZHcy: ZHcy, - Zacute: Zacute, - Zcaron: Zcaron, - Zcy: Zcy, - Zdot: Zdot, - ZeroWidthSpace: ZeroWidthSpace, - Zeta: Zeta, - Zfr: Zfr, - Zopf: Zopf, - Zscr: Zscr, - aacut: aacut, - aacute: aacute, - abreve: abreve, - ac: ac, - acE: acE, - acd: acd, - acir: acir, - acirc: acirc, - acut: acut, - acute: acute, - acy: acy, - aeli: aeli, - aelig: aelig, - af: af, - afr: afr, - agrav: agrav, - agrave: agrave, - alefsym: alefsym, - aleph: aleph, - alpha: alpha, - amacr: amacr, - amalg: amalg, - am: am, - amp: amp, - and: and, - andand: andand, - andd: andd, - andslope: andslope, - andv: andv, - ang: ang, - ange: ange, - angle: angle, - angmsd: angmsd, - angmsdaa: angmsdaa, - angmsdab: angmsdab, - angmsdac: angmsdac, - angmsdad: angmsdad, - angmsdae: angmsdae, - angmsdaf: angmsdaf, - angmsdag: angmsdag, - angmsdah: angmsdah, - angrt: angrt, - angrtvb: angrtvb, - angrtvbd: angrtvbd, - angsph: angsph, - angst: angst, - angzarr: angzarr, - aogon: aogon, - aopf: aopf, - ap: ap, - apE: apE, - apacir: apacir, - ape: ape, - apid: apid, - apos: apos, - approx: approx, - approxeq: approxeq, - arin: arin, - aring: aring, - ascr: ascr, - ast: ast, - asymp: asymp, - asympeq: asympeq, - atild: atild, - atilde: atilde, - aum: aum, - auml: auml, - awconint: awconint, - awint: awint, - bNot: bNot, - backcong: backcong, - backepsilon: backepsilon, - backprime: backprime, - backsim: backsim, - backsimeq: backsimeq, - barvee: barvee, - barwed: barwed, - barwedge: barwedge, - bbrk: bbrk, - bbrktbrk: bbrktbrk, - bcong: bcong, - bcy: bcy, - bdquo: bdquo, - becaus: becaus, - because: because, - bemptyv: bemptyv, - bepsi: bepsi, - bernou: bernou, - beta: beta, - beth: beth, - between: between, - bfr: bfr, - bigcap: bigcap, - bigcirc: bigcirc, - bigcup: bigcup, - bigodot: bigodot, - bigoplus: bigoplus, - bigotimes: bigotimes, - bigsqcup: bigsqcup, - bigstar: bigstar, - bigtriangledown: bigtriangledown, - bigtriangleup: bigtriangleup, - biguplus: biguplus, - bigvee: bigvee, - bigwedge: bigwedge, - bkarow: bkarow, - blacklozenge: blacklozenge, - blacksquare: blacksquare, - blacktriangle: blacktriangle, - blacktriangledown: blacktriangledown, - blacktriangleleft: blacktriangleleft, - blacktriangleright: blacktriangleright, - blank: blank, - blk12: blk12, - blk14: blk14, - blk34: blk34, - block: block, - bne: bne, - bnequiv: bnequiv, - bnot: bnot, - bopf: bopf, - bot: bot, - bottom: bottom, - bowtie: bowtie, - boxDL: boxDL, - boxDR: boxDR, - boxDl: boxDl, - boxDr: boxDr, - boxH: boxH, - boxHD: boxHD, - boxHU: boxHU, - boxHd: boxHd, - boxHu: boxHu, - boxUL: boxUL, - boxUR: boxUR, - boxUl: boxUl, - boxUr: boxUr, - boxV: boxV, - boxVH: boxVH, - boxVL: boxVL, - boxVR: boxVR, - boxVh: boxVh, - boxVl: boxVl, - boxVr: boxVr, - boxbox: boxbox, - boxdL: boxdL, - boxdR: boxdR, - boxdl: boxdl, - boxdr: boxdr, - boxh: boxh, - boxhD: boxhD, - boxhU: boxhU, - boxhd: boxhd, - boxhu: boxhu, - boxminus: boxminus, - boxplus: boxplus, - boxtimes: boxtimes, - boxuL: boxuL, - boxuR: boxuR, - boxul: boxul, - boxur: boxur, - boxv: boxv, - boxvH: boxvH, - boxvL: boxvL, - boxvR: boxvR, - boxvh: boxvh, - boxvl: boxvl, - boxvr: boxvr, - bprime: bprime, - breve: breve, - brvba: brvba, - brvbar: brvbar, - bscr: bscr, - bsemi: bsemi, - bsim: bsim, - bsime: bsime, - bsol: bsol, - bsolb: bsolb, - bsolhsub: bsolhsub, - bull: bull, - bullet: bullet, - bump: bump, - bumpE: bumpE, - bumpe: bumpe, - bumpeq: bumpeq, - cacute: cacute, - cap: cap, - capand: capand, - capbrcup: capbrcup, - capcap: capcap, - capcup: capcup, - capdot: capdot, - caps: caps, - caret: caret, - caron: caron, - ccaps: ccaps, - ccaron: ccaron, - ccedi: ccedi, - ccedil: ccedil, - ccirc: ccirc, - ccups: ccups, - ccupssm: ccupssm, - cdot: cdot, - cedi: cedi, - cedil: cedil, - cemptyv: cemptyv, - cen: cen, - cent: cent, - centerdot: centerdot, - cfr: cfr, - chcy: chcy, - check: check$2, - checkmark: checkmark, - chi: chi, - cir: cir, - cirE: cirE, - circ: circ, - circeq: circeq, - circlearrowleft: circlearrowleft, - circlearrowright: circlearrowright, - circledR: circledR, - circledS: circledS, - circledast: circledast, - circledcirc: circledcirc, - circleddash: circleddash, - cire: cire, - cirfnint: cirfnint, - cirmid: cirmid, - cirscir: cirscir, - clubs: clubs, - clubsuit: clubsuit, - colon: colon, - colone: colone, - coloneq: coloneq, - comma: comma, - commat: commat, - comp: comp, - compfn: compfn, - complement: complement, - complexes: complexes, - cong: cong, - congdot: congdot, - conint: conint, - copf: copf, - coprod: coprod, - cop: cop, - copy: copy$1, - copysr: copysr, - crarr: crarr, - cross: cross, - cscr: cscr, - csub: csub, - csube: csube, - csup: csup, - csupe: csupe, - ctdot: ctdot, - cudarrl: cudarrl, - cudarrr: cudarrr, - cuepr: cuepr, - cuesc: cuesc, - cularr: cularr, - cularrp: cularrp, - cup: cup, - cupbrcap: cupbrcap, - cupcap: cupcap, - cupcup: cupcup, - cupdot: cupdot, - cupor: cupor, - cups: cups, - curarr: curarr, - curarrm: curarrm, - curlyeqprec: curlyeqprec, - curlyeqsucc: curlyeqsucc, - curlyvee: curlyvee, - curlywedge: curlywedge, - curre: curre, - curren: curren, - curvearrowleft: curvearrowleft, - curvearrowright: curvearrowright, - cuvee: cuvee, - cuwed: cuwed, - cwconint: cwconint, - cwint: cwint, - cylcty: cylcty, - dArr: dArr, - dHar: dHar, - dagger: dagger, - daleth: daleth, - darr: darr, - dash: dash, - dashv: dashv, - dbkarow: dbkarow, - dblac: dblac, - dcaron: dcaron, - dcy: dcy, - dd: dd, - ddagger: ddagger, - ddarr: ddarr, - ddotseq: ddotseq, - de: de, - deg: deg, - delta: delta, - demptyv: demptyv, - dfisht: dfisht, - dfr: dfr, - dharl: dharl, - dharr: dharr, - diam: diam, - diamond: diamond, - diamondsuit: diamondsuit, - diams: diams, - die: die, - digamma: digamma, - disin: disin, - div: div, - divid: divid, - divide: divide, - divideontimes: divideontimes, - divonx: divonx, - djcy: djcy, - dlcorn: dlcorn, - dlcrop: dlcrop, - dollar: dollar, - dopf: dopf, - dot: dot, - doteq: doteq, - doteqdot: doteqdot, - dotminus: dotminus, - dotplus: dotplus, - dotsquare: dotsquare, - doublebarwedge: doublebarwedge, - downarrow: downarrow, - downdownarrows: downdownarrows, - downharpoonleft: downharpoonleft, - downharpoonright: downharpoonright, - drbkarow: drbkarow, - drcorn: drcorn, - drcrop: drcrop, - dscr: dscr, - dscy: dscy, - dsol: dsol, - dstrok: dstrok, - dtdot: dtdot, - dtri: dtri, - dtrif: dtrif, - duarr: duarr, - duhar: duhar, - dwangle: dwangle, - dzcy: dzcy, - dzigrarr: dzigrarr, - eDDot: eDDot, - eDot: eDot, - eacut: eacut, - eacute: eacute, - easter: easter, - ecaron: ecaron, - ecir: ecir, - ecirc: ecirc, - ecolon: ecolon, - ecy: ecy, - edot: edot, - ee: ee, - efDot: efDot, - efr: efr, - eg: eg, - egrav: egrav, - egrave: egrave, - egs: egs, - egsdot: egsdot, - el: el, - elinters: elinters, - ell: ell, - els: els, - elsdot: elsdot, - emacr: emacr, - empty: empty, - emptyset: emptyset, - emptyv: emptyv, - emsp13: emsp13, - emsp14: emsp14, - emsp: emsp, - eng: eng, - ensp: ensp, - eogon: eogon, - eopf: eopf, - epar: epar, - eparsl: eparsl, - eplus: eplus, - epsi: epsi, - epsilon: epsilon, - epsiv: epsiv, - eqcirc: eqcirc, - eqcolon: eqcolon, - eqsim: eqsim, - eqslantgtr: eqslantgtr, - eqslantless: eqslantless, - equals: equals, - equest: equest, - equiv: equiv, - equivDD: equivDD, - eqvparsl: eqvparsl, - erDot: erDot, - erarr: erarr, - escr: escr, - esdot: esdot, - esim: esim, - eta: eta, - et: et, - eth: eth, - eum: eum, - euml: euml, - euro: euro, - excl: excl, - exist: exist, - expectation: expectation, - exponentiale: exponentiale, - fallingdotseq: fallingdotseq, - fcy: fcy, - female: female, - ffilig: ffilig, - fflig: fflig, - ffllig: ffllig, - ffr: ffr, - filig: filig, - fjlig: fjlig, - flat: flat, - fllig: fllig, - fltns: fltns, - fnof: fnof, - fopf: fopf, - forall: forall, - fork: fork, - forkv: forkv, - fpartint: fpartint, - frac1: frac1, - frac12: frac12, - frac13: frac13, - frac14: frac14, - frac15: frac15, - frac16: frac16, - frac18: frac18, - frac23: frac23, - frac25: frac25, - frac3: frac3, - frac34: frac34, - frac35: frac35, - frac38: frac38, - frac45: frac45, - frac56: frac56, - frac58: frac58, - frac78: frac78, - frasl: frasl, - frown: frown, - fscr: fscr, - gE: gE, - gEl: gEl, - gacute: gacute, - gamma: gamma, - gammad: gammad, - gap: gap, - gbreve: gbreve, - gcirc: gcirc, - gcy: gcy, - gdot: gdot, - ge: ge, - gel: gel, - geq: geq, - geqq: geqq, - geqslant: geqslant, - ges: ges, - gescc: gescc, - gesdot: gesdot, - gesdoto: gesdoto, - gesdotol: gesdotol, - gesl: gesl, - gesles: gesles, - gfr: gfr, - gg: gg, - ggg: ggg, - gimel: gimel, - gjcy: gjcy, - gl: gl, - glE: glE, - gla: gla, - glj: glj, - gnE: gnE, - gnap: gnap, - gnapprox: gnapprox, - gne: gne, - gneq: gneq, - gneqq: gneqq, - gnsim: gnsim, - gopf: gopf, - grave: grave, - gscr: gscr, - gsim: gsim, - gsime: gsime, - gsiml: gsiml, - g: g, - gt: gt, - gtcc: gtcc, - gtcir: gtcir, - gtdot: gtdot, - gtlPar: gtlPar, - gtquest: gtquest, - gtrapprox: gtrapprox, - gtrarr: gtrarr, - gtrdot: gtrdot, - gtreqless: gtreqless, - gtreqqless: gtreqqless, - gtrless: gtrless, - gtrsim: gtrsim, - gvertneqq: gvertneqq, - gvnE: gvnE, - hArr: hArr, - hairsp: hairsp, - half: half, - hamilt: hamilt, - hardcy: hardcy, - harr: harr, - harrcir: harrcir, - harrw: harrw, - hbar: hbar, - hcirc: hcirc, - hearts: hearts, - heartsuit: heartsuit, - hellip: hellip, - hercon: hercon, - hfr: hfr, - hksearow: hksearow, - hkswarow: hkswarow, - hoarr: hoarr, - homtht: homtht, - hookleftarrow: hookleftarrow, - hookrightarrow: hookrightarrow, - hopf: hopf, - horbar: horbar, - hscr: hscr, - hslash: hslash, - hstrok: hstrok, - hybull: hybull, - hyphen: hyphen, - iacut: iacut, - iacute: iacute, - ic: ic, - icir: icir, - icirc: icirc, - icy: icy, - iecy: iecy, - iexc: iexc, - iexcl: iexcl, - iff: iff, - ifr: ifr, - igrav: igrav, - igrave: igrave, - ii: ii, - iiiint: iiiint, - iiint: iiint, - iinfin: iinfin, - iiota: iiota, - ijlig: ijlig, - imacr: imacr, - image: image, - imagline: imagline, - imagpart: imagpart, - imath: imath, - imof: imof, - imped: imped, - incare: incare, - infin: infin, - infintie: infintie, - inodot: inodot, - int: int, - intcal: intcal, - integers: integers, - intercal: intercal, - intlarhk: intlarhk, - intprod: intprod, - iocy: iocy, - iogon: iogon, - iopf: iopf, - iota: iota, - iprod: iprod, - iques: iques, - iquest: iquest, - iscr: iscr, - isin: isin, - isinE: isinE, - isindot: isindot, - isins: isins, - isinsv: isinsv, - isinv: isinv, - it: it, - itilde: itilde, - iukcy: iukcy, - ium: ium, - iuml: iuml, - jcirc: jcirc, - jcy: jcy, - jfr: jfr, - jmath: jmath, - jopf: jopf, - jscr: jscr, - jsercy: jsercy, - jukcy: jukcy, - kappa: kappa, - kappav: kappav, - kcedil: kcedil, - kcy: kcy, - kfr: kfr, - kgreen: kgreen, - khcy: khcy, - kjcy: kjcy, - kopf: kopf, - kscr: kscr, - lAarr: lAarr, - lArr: lArr, - lAtail: lAtail, - lBarr: lBarr, - lE: lE, - lEg: lEg, - lHar: lHar, - lacute: lacute, - laemptyv: laemptyv, - lagran: lagran, - lambda: lambda, - lang: lang, - langd: langd, - langle: langle, - lap: lap, - laqu: laqu, - laquo: laquo, - larr: larr, - larrb: larrb, - larrbfs: larrbfs, - larrfs: larrfs, - larrhk: larrhk, - larrlp: larrlp, - larrpl: larrpl, - larrsim: larrsim, - larrtl: larrtl, - lat: lat, - latail: latail, - late: late, - lates: lates, - lbarr: lbarr, - lbbrk: lbbrk, - lbrace: lbrace, - lbrack: lbrack, - lbrke: lbrke, - lbrksld: lbrksld, - lbrkslu: lbrkslu, - lcaron: lcaron, - lcedil: lcedil, - lceil: lceil, - lcub: lcub, - lcy: lcy, - ldca: ldca, - ldquo: ldquo, - ldquor: ldquor, - ldrdhar: ldrdhar, - ldrushar: ldrushar, - ldsh: ldsh, - le: le, - leftarrow: leftarrow, - leftarrowtail: leftarrowtail, - leftharpoondown: leftharpoondown, - leftharpoonup: leftharpoonup, - leftleftarrows: leftleftarrows, - leftrightarrow: leftrightarrow, - leftrightarrows: leftrightarrows, - leftrightharpoons: leftrightharpoons, - leftrightsquigarrow: leftrightsquigarrow, - leftthreetimes: leftthreetimes, - leg: leg, - leq: leq, - leqq: leqq, - leqslant: leqslant, - les: les, - lescc: lescc, - lesdot: lesdot, - lesdoto: lesdoto, - lesdotor: lesdotor, - lesg: lesg, - lesges: lesges, - lessapprox: lessapprox, - lessdot: lessdot, - lesseqgtr: lesseqgtr, - lesseqqgtr: lesseqqgtr, - lessgtr: lessgtr, - lesssim: lesssim, - lfisht: lfisht, - lfloor: lfloor, - lfr: lfr, - lg: lg, - lgE: lgE, - lhard: lhard, - lharu: lharu, - lharul: lharul, - lhblk: lhblk, - ljcy: ljcy, - ll: ll, - llarr: llarr, - llcorner: llcorner, - llhard: llhard, - lltri: lltri, - lmidot: lmidot, - lmoust: lmoust, - lmoustache: lmoustache, - lnE: lnE, - lnap: lnap, - lnapprox: lnapprox, - lne: lne, - lneq: lneq, - lneqq: lneqq, - lnsim: lnsim, - loang: loang, - loarr: loarr, - lobrk: lobrk, - longleftarrow: longleftarrow, - longleftrightarrow: longleftrightarrow, - longmapsto: longmapsto, - longrightarrow: longrightarrow, - looparrowleft: looparrowleft, - looparrowright: looparrowright, - lopar: lopar, - lopf: lopf, - loplus: loplus, - lotimes: lotimes, - lowast: lowast, - lowbar: lowbar, - loz: loz, - lozenge: lozenge, - lozf: lozf, - lpar: lpar, - lparlt: lparlt, - lrarr: lrarr, - lrcorner: lrcorner, - lrhar: lrhar, - lrhard: lrhard, - lrm: lrm, - lrtri: lrtri, - lsaquo: lsaquo, - lscr: lscr, - lsh: lsh, - lsim: lsim, - lsime: lsime, - lsimg: lsimg, - lsqb: lsqb, - lsquo: lsquo, - lsquor: lsquor, - lstrok: lstrok, - l: l, - lt: lt, - ltcc: ltcc, - ltcir: ltcir, - ltdot: ltdot, - lthree: lthree, - ltimes: ltimes, - ltlarr: ltlarr, - ltquest: ltquest, - ltrPar: ltrPar, - ltri: ltri, - ltrie: ltrie, - ltrif: ltrif, - lurdshar: lurdshar, - luruhar: luruhar, - lvertneqq: lvertneqq, - lvnE: lvnE, - mDDot: mDDot, - mac: mac, - macr: macr, - male: male, - malt: malt, - maltese: maltese, - map: map$2, - mapsto: mapsto, - mapstodown: mapstodown, - mapstoleft: mapstoleft, - mapstoup: mapstoup, - marker: marker, - mcomma: mcomma, - mcy: mcy, - mdash: mdash, - measuredangle: measuredangle, - mfr: mfr, - mho: mho, - micr: micr, - micro: micro, - mid: mid, - midast: midast, - midcir: midcir, - middo: middo, - middot: middot, - minus: minus, - minusb: minusb, - minusd: minusd, - minusdu: minusdu, - mlcp: mlcp, - mldr: mldr, - mnplus: mnplus, - models: models$2, - mopf: mopf, - mp: mp, - mscr: mscr, - mstpos: mstpos, - mu: mu, - multimap: multimap, - mumap: mumap, - nGg: nGg, - nGt: nGt, - nGtv: nGtv, - nLeftarrow: nLeftarrow, - nLeftrightarrow: nLeftrightarrow, - nLl: nLl, - nLt: nLt, - nLtv: nLtv, - nRightarrow: nRightarrow, - nVDash: nVDash, - nVdash: nVdash, - nabla: nabla, - nacute: nacute, - nang: nang, - nap: nap, - napE: napE, - napid: napid, - napos: napos, - napprox: napprox, - natur: natur, - natural: natural, - naturals: naturals, - nbs: nbs, - nbsp: nbsp, - nbump: nbump, - nbumpe: nbumpe, - ncap: ncap, - ncaron: ncaron, - ncedil: ncedil, - ncong: ncong, - ncongdot: ncongdot, - ncup: ncup, - ncy: ncy, - ndash: ndash, - ne: ne, - neArr: neArr, - nearhk: nearhk, - nearr: nearr, - nearrow: nearrow, - nedot: nedot, - nequiv: nequiv, - nesear: nesear, - nesim: nesim, - nexist: nexist, - nexists: nexists, - nfr: nfr, - ngE: ngE, - nge: nge, - ngeq: ngeq, - ngeqq: ngeqq, - ngeqslant: ngeqslant, - nges: nges, - ngsim: ngsim, - ngt: ngt, - ngtr: ngtr, - nhArr: nhArr, - nharr: nharr, - nhpar: nhpar, - ni: ni, - nis: nis, - nisd: nisd, - niv: niv, - njcy: njcy, - nlArr: nlArr, - nlE: nlE, - nlarr: nlarr, - nldr: nldr, - nle: nle, - nleftarrow: nleftarrow, - nleftrightarrow: nleftrightarrow, - nleq: nleq, - nleqq: nleqq, - nleqslant: nleqslant, - nles: nles, - nless: nless, - nlsim: nlsim, - nlt: nlt, - nltri: nltri, - nltrie: nltrie, - nmid: nmid, - nopf: nopf, - no: no, - not: not, - notin: notin, - notinE: notinE, - notindot: notindot, - notinva: notinva, - notinvb: notinvb, - notinvc: notinvc, - notni: notni, - notniva: notniva, - notnivb: notnivb, - notnivc: notnivc, - npar: npar, - nparallel: nparallel, - nparsl: nparsl, - npart: npart, - npolint: npolint, - npr: npr, - nprcue: nprcue, - npre: npre, - nprec: nprec, - npreceq: npreceq, - nrArr: nrArr, - nrarr: nrarr, - nrarrc: nrarrc, - nrarrw: nrarrw, - nrightarrow: nrightarrow, - nrtri: nrtri, - nrtrie: nrtrie, - nsc: nsc, - nsccue: nsccue, - nsce: nsce, - nscr: nscr, - nshortmid: nshortmid, - nshortparallel: nshortparallel, - nsim: nsim, - nsime: nsime, - nsimeq: nsimeq, - nsmid: nsmid, - nspar: nspar, - nsqsube: nsqsube, - nsqsupe: nsqsupe, - nsub: nsub, - nsubE: nsubE, - nsube: nsube, - nsubset: nsubset, - nsubseteq: nsubseteq, - nsubseteqq: nsubseteqq, - nsucc: nsucc, - nsucceq: nsucceq, - nsup: nsup, - nsupE: nsupE, - nsupe: nsupe, - nsupset: nsupset, - nsupseteq: nsupseteq, - nsupseteqq: nsupseteqq, - ntgl: ntgl, - ntild: ntild, - ntilde: ntilde, - ntlg: ntlg, - ntriangleleft: ntriangleleft, - ntrianglelefteq: ntrianglelefteq, - ntriangleright: ntriangleright, - ntrianglerighteq: ntrianglerighteq, - nu: nu, - num: num, - numero: numero, - numsp: numsp, - nvDash: nvDash, - nvHarr: nvHarr, - nvap: nvap, - nvdash: nvdash, - nvge: nvge, - nvgt: nvgt, - nvinfin: nvinfin, - nvlArr: nvlArr, - nvle: nvle, - nvlt: nvlt, - nvltrie: nvltrie, - nvrArr: nvrArr, - nvrtrie: nvrtrie, - nvsim: nvsim, - nwArr: nwArr, - nwarhk: nwarhk, - nwarr: nwarr, - nwarrow: nwarrow, - nwnear: nwnear, - oS: oS, - oacut: oacut, - oacute: oacute, - oast: oast, - ocir: ocir, - ocirc: ocirc, - ocy: ocy, - odash: odash, - odblac: odblac, - odiv: odiv, - odot: odot, - odsold: odsold, - oelig: oelig, - ofcir: ofcir, - ofr: ofr, - ogon: ogon, - ograv: ograv, - ograve: ograve, - ogt: ogt, - ohbar: ohbar, - ohm: ohm, - oint: oint, - olarr: olarr, - olcir: olcir, - olcross: olcross, - oline: oline, - olt: olt, - omacr: omacr, - omega: omega, - omicron: omicron, - omid: omid, - ominus: ominus, - oopf: oopf, - opar: opar, - operp: operp, - oplus: oplus, - or: or, - orarr: orarr, - ord: ord, - order: order$1, - orderof: orderof, - ordf: ordf, - ordm: ordm, - origof: origof, - oror: oror, - orslope: orslope, - orv: orv, - oscr: oscr, - oslas: oslas, - oslash: oslash, - osol: osol, - otild: otild, - otilde: otilde, - otimes: otimes, - otimesas: otimesas, - oum: oum, - ouml: ouml, - ovbar: ovbar, - par: par, - para: para, - parallel: parallel, - parsim: parsim, - parsl: parsl, - part: part, - pcy: pcy, - percnt: percnt, - period: period, - permil: permil, - perp: perp, - pertenk: pertenk, - pfr: pfr, - phi: phi, - phiv: phiv, - phmmat: phmmat, - phone: phone, - pi: pi, - pitchfork: pitchfork, - piv: piv, - planck: planck, - planckh: planckh, - plankv: plankv, - plus: plus, - plusacir: plusacir, - plusb: plusb, - pluscir: pluscir, - plusdo: plusdo, - plusdu: plusdu, - pluse: pluse, - plusm: plusm, - plusmn: plusmn, - plussim: plussim, - plustwo: plustwo, - pm: pm, - pointint: pointint, - popf: popf, - poun: poun, - pound: pound, - pr: pr, - prE: prE, - prap: prap, - prcue: prcue, - pre: pre, - prec: prec, - precapprox: precapprox, - preccurlyeq: preccurlyeq, - preceq: preceq, - precnapprox: precnapprox, - precneqq: precneqq, - precnsim: precnsim, - precsim: precsim, - prime: prime, - primes: primes, - prnE: prnE, - prnap: prnap, - prnsim: prnsim, - prod: prod, - profalar: profalar, - profline: profline, - profsurf: profsurf, - prop: prop, - propto: propto, - prsim: prsim, - prurel: prurel, - pscr: pscr, - psi: psi, - puncsp: puncsp, - qfr: qfr, - qint: qint, - qopf: qopf, - qprime: qprime, - qscr: qscr, - quaternions: quaternions, - quatint: quatint, - quest: quest, - questeq: questeq, - quo: quo, - quot: quot, - rAarr: rAarr, - rArr: rArr, - rAtail: rAtail, - rBarr: rBarr, - rHar: rHar, - race: race, - racute: racute, - radic: radic, - raemptyv: raemptyv, - rang: rang, - rangd: rangd, - range: range$1, - rangle: rangle, - raqu: raqu, - raquo: raquo, - rarr: rarr, - rarrap: rarrap, - rarrb: rarrb, - rarrbfs: rarrbfs, - rarrc: rarrc, - rarrfs: rarrfs, - rarrhk: rarrhk, - rarrlp: rarrlp, - rarrpl: rarrpl, - rarrsim: rarrsim, - rarrtl: rarrtl, - rarrw: rarrw, - ratail: ratail, - ratio: ratio, - rationals: rationals, - rbarr: rbarr, - rbbrk: rbbrk, - rbrace: rbrace, - rbrack: rbrack, - rbrke: rbrke, - rbrksld: rbrksld, - rbrkslu: rbrkslu, - rcaron: rcaron, - rcedil: rcedil, - rceil: rceil, - rcub: rcub, - rcy: rcy, - rdca: rdca, - rdldhar: rdldhar, - rdquo: rdquo, - rdquor: rdquor, - rdsh: rdsh, - real: real, - realine: realine, - realpart: realpart, - reals: reals, - rect: rect, - re: re, - reg: reg, - rfisht: rfisht, - rfloor: rfloor, - rfr: rfr, - rhard: rhard, - rharu: rharu, - rharul: rharul, - rho: rho, - rhov: rhov, - rightarrow: rightarrow, - rightarrowtail: rightarrowtail, - rightharpoondown: rightharpoondown, - rightharpoonup: rightharpoonup, - rightleftarrows: rightleftarrows, - rightleftharpoons: rightleftharpoons, - rightrightarrows: rightrightarrows, - rightsquigarrow: rightsquigarrow, - rightthreetimes: rightthreetimes, - ring: ring, - risingdotseq: risingdotseq, - rlarr: rlarr, - rlhar: rlhar, - rlm: rlm, - rmoust: rmoust, - rmoustache: rmoustache, - rnmid: rnmid, - roang: roang, - roarr: roarr, - robrk: robrk, - ropar: ropar, - ropf: ropf, - roplus: roplus, - rotimes: rotimes, - rpar: rpar, - rpargt: rpargt, - rppolint: rppolint, - rrarr: rrarr, - rsaquo: rsaquo, - rscr: rscr, - rsh: rsh, - rsqb: rsqb, - rsquo: rsquo, - rsquor: rsquor, - rthree: rthree, - rtimes: rtimes, - rtri: rtri, - rtrie: rtrie, - rtrif: rtrif, - rtriltri: rtriltri, - ruluhar: ruluhar, - rx: rx, - sacute: sacute, - sbquo: sbquo, - sc: sc, - scE: scE, - scap: scap, - scaron: scaron, - sccue: sccue, - sce: sce, - scedil: scedil, - scirc: scirc, - scnE: scnE, - scnap: scnap, - scnsim: scnsim, - scpolint: scpolint, - scsim: scsim, - scy: scy, - sdot: sdot, - sdotb: sdotb, - sdote: sdote, - seArr: seArr, - searhk: searhk, - searr: searr, - searrow: searrow, - sec: sec, - sect: sect, - semi: semi, - seswar: seswar, - setminus: setminus, - setmn: setmn, - sext: sext, - sfr: sfr, - sfrown: sfrown, - sharp: sharp, - shchcy: shchcy, - shcy: shcy, - shortmid: shortmid, - shortparallel: shortparallel, - sh: sh, - shy: shy, - sigma: sigma, - sigmaf: sigmaf, - sigmav: sigmav, - sim: sim, - simdot: simdot, - sime: sime, - simeq: simeq, - simg: simg, - simgE: simgE, - siml: siml, - simlE: simlE, - simne: simne, - simplus: simplus, - simrarr: simrarr, - slarr: slarr, - smallsetminus: smallsetminus, - smashp: smashp, - smeparsl: smeparsl, - smid: smid, - smile: smile, - smt: smt, - smte: smte, - smtes: smtes, - softcy: softcy, - sol: sol, - solb: solb, - solbar: solbar, - sopf: sopf, - spades: spades, - spadesuit: spadesuit, - spar: spar, - sqcap: sqcap, - sqcaps: sqcaps, - sqcup: sqcup, - sqcups: sqcups, - sqsub: sqsub, - sqsube: sqsube, - sqsubset: sqsubset, - sqsubseteq: sqsubseteq, - sqsup: sqsup, - sqsupe: sqsupe, - sqsupset: sqsupset, - sqsupseteq: sqsupseteq, - squ: squ, - square: square, - squarf: squarf, - squf: squf, - srarr: srarr, - sscr: sscr, - ssetmn: ssetmn, - ssmile: ssmile, - sstarf: sstarf, - star: star$1, - starf: starf, - straightepsilon: straightepsilon, - straightphi: straightphi, - strns: strns, - sub: sub, - subE: subE, - subdot: subdot, - sube: sube, - subedot: subedot, - submult: submult, - subnE: subnE, - subne: subne, - subplus: subplus, - subrarr: subrarr, - subset: subset, - subseteq: subseteq, - subseteqq: subseteqq, - subsetneq: subsetneq, - subsetneqq: subsetneqq, - subsim: subsim, - subsub: subsub, - subsup: subsup, - succ: succ, - succapprox: succapprox, - succcurlyeq: succcurlyeq, - succeq: succeq, - succnapprox: succnapprox, - succneqq: succneqq, - succnsim: succnsim, - succsim: succsim, - sum: sum, - sung: sung, - sup: sup, - sup1: sup1, - sup2: sup2, - sup3: sup3, - supE: supE, - supdot: supdot, - supdsub: supdsub, - supe: supe, - supedot: supedot, - suphsol: suphsol, - suphsub: suphsub, - suplarr: suplarr, - supmult: supmult, - supnE: supnE, - supne: supne, - supplus: supplus, - supset: supset, - supseteq: supseteq, - supseteqq: supseteqq, - supsetneq: supsetneq, - supsetneqq: supsetneqq, - supsim: supsim, - supsub: supsub, - supsup: supsup, - swArr: swArr, - swarhk: swarhk, - swarr: swarr, - swarrow: swarrow, - swnwar: swnwar, - szli: szli, - szlig: szlig, - target: target, - tau: tau, - tbrk: tbrk, - tcaron: tcaron, - tcedil: tcedil, - tcy: tcy, - tdot: tdot, - telrec: telrec, - tfr: tfr, - there4: there4, - therefore: therefore, - theta: theta, - thetasym: thetasym, - thetav: thetav, - thickapprox: thickapprox, - thicksim: thicksim, - thinsp: thinsp, - thkap: thkap, - thksim: thksim, - thor: thor, - thorn: thorn, - tilde: tilde, - time: time, - times: times, - timesb: timesb, - timesbar: timesbar, - timesd: timesd, - tint: tint, - toea: toea, - top: top, - topbot: topbot, - topcir: topcir, - topf: topf, - topfork: topfork, - tosa: tosa, - tprime: tprime, - trade: trade, - triangle: triangle, - triangledown: triangledown, - triangleleft: triangleleft, - trianglelefteq: trianglelefteq, - triangleq: triangleq, - triangleright: triangleright, - trianglerighteq: trianglerighteq, - tridot: tridot, - trie: trie, - triminus: triminus, - triplus: triplus, - trisb: trisb, - tritime: tritime, - trpezium: trpezium, - tscr: tscr, - tscy: tscy, - tshcy: tshcy, - tstrok: tstrok, - twixt: twixt, - twoheadleftarrow: twoheadleftarrow, - twoheadrightarrow: twoheadrightarrow, - uArr: uArr, - uHar: uHar, - uacut: uacut, - uacute: uacute, - uarr: uarr, - ubrcy: ubrcy, - ubreve: ubreve, - ucir: ucir, - ucirc: ucirc, - ucy: ucy, - udarr: udarr, - udblac: udblac, - udhar: udhar, - ufisht: ufisht, - ufr: ufr, - ugrav: ugrav, - ugrave: ugrave, - uharl: uharl, - uharr: uharr, - uhblk: uhblk, - ulcorn: ulcorn, - ulcorner: ulcorner, - ulcrop: ulcrop, - ultri: ultri, - umacr: umacr, - um: um, - uml: uml, - uogon: uogon, - uopf: uopf, - uparrow: uparrow, - updownarrow: updownarrow, - upharpoonleft: upharpoonleft, - upharpoonright: upharpoonright, - uplus: uplus, - upsi: upsi, - upsih: upsih, - upsilon: upsilon, - upuparrows: upuparrows, - urcorn: urcorn, - urcorner: urcorner, - urcrop: urcrop, - uring: uring, - urtri: urtri, - uscr: uscr, - utdot: utdot, - utilde: utilde, - utri: utri, - utrif: utrif, - uuarr: uuarr, - uum: uum, - uuml: uuml, - uwangle: uwangle, - vArr: vArr, - vBar: vBar, - vBarv: vBarv, - vDash: vDash, - vangrt: vangrt, - varepsilon: varepsilon, - varkappa: varkappa, - varnothing: varnothing, - varphi: varphi, - varpi: varpi, - varpropto: varpropto, - varr: varr, - varrho: varrho, - varsigma: varsigma, - varsubsetneq: varsubsetneq, - varsubsetneqq: varsubsetneqq, - varsupsetneq: varsupsetneq, - varsupsetneqq: varsupsetneqq, - vartheta: vartheta, - vartriangleleft: vartriangleleft, - vartriangleright: vartriangleright, - vcy: vcy, - vdash: vdash, - vee: vee, - veebar: veebar, - veeeq: veeeq, - vellip: vellip, - verbar: verbar, - vert: vert, - vfr: vfr, - vltri: vltri, - vnsub: vnsub, - vnsup: vnsup, - vopf: vopf, - vprop: vprop, - vrtri: vrtri, - vscr: vscr, - vsubnE: vsubnE, - vsubne: vsubne, - vsupnE: vsupnE, - vsupne: vsupne, - vzigzag: vzigzag, - wcirc: wcirc, - wedbar: wedbar, - wedge: wedge, - wedgeq: wedgeq, - weierp: weierp, - wfr: wfr, - wopf: wopf, - wp: wp, - wr: wr, - wreath: wreath, - wscr: wscr, - xcap: xcap, - xcirc: xcirc, - xcup: xcup, - xdtri: xdtri, - xfr: xfr, - xhArr: xhArr, - xharr: xharr, - xi: xi, - xlArr: xlArr, - xlarr: xlarr, - xmap: xmap, - xnis: xnis, - xodot: xodot, - xopf: xopf, - xoplus: xoplus, - xotime: xotime, - xrArr: xrArr, - xrarr: xrarr, - xscr: xscr, - xsqcup: xsqcup, - xuplus: xuplus, - xutri: xutri, - xvee: xvee, - xwedge: xwedge, - yacut: yacut, - yacute: yacute, - yacy: yacy, - ycirc: ycirc, - ycy: ycy, - ye: ye, - yen: yen, - yfr: yfr, - yicy: yicy, - yopf: yopf, - yscr: yscr, - yucy: yucy, - yum: yum, - yuml: yuml, - zacute: zacute, - zcaron: zcaron, - zcy: zcy, - zdot: zdot, - zeetrf: zeetrf, - zeta: zeta, - zfr: zfr, - zhcy: zhcy, - zigrarr: zigrarr, - zopf: zopf, - zscr: zscr, - zwj: zwj, - zwnj: zwnj, - 'default': index$1 -}); - -var characterEntities$1 = getCjsExportFromNamespace(characterEntities); - -var decodeEntity_1 = decodeEntity; - -var own$3 = {}.hasOwnProperty; - -function decodeEntity(characters) { - return own$3.call(characterEntities$1, characters) - ? characterEntities$1[characters] - : false -} - var mdastUtilToString = toString$3; // Get the text content of a node. @@ -34842,28 +27915,28 @@ function toString$3(node) { function all(values) { var result = []; - var length = values.length; var index = -1; - while (++index < length) { + while (++index < values.length) { result[index] = toString$3(values[index]); } return result.join('') } -var hasOwnProperty_1 = {}.hasOwnProperty; +var assign = Object.assign; + +var assign_1 = assign; -var normalizeIdentifier_1 = normalizeIdentifier; +var own$3 = {}.hasOwnProperty; + +var hasOwnProperty = own$3; function normalizeIdentifier(value) { return ( - value - // Collapse Markdown whitespace. - .replace(/[\t\n\r ]+/g, ' ') - // Trim. - .replace(/^ | $/g, '') - // Some characters are considered ā€œuppercaseā€, but if their lowercase + value // Collapse Markdown whitespace. + .replace(/[\t\n\r ]+/g, ' ') // Trim. + .replace(/^ | $/g, '') // Some characters are considered ā€œuppercaseā€, but if their lowercase // counterpart is uppercased will result in a different uppercase // character. // Hence, to get that form, we perform both lower- and uppercase. @@ -34874,11 +27947,11 @@ function normalizeIdentifier(value) { ) } -var fromCharCode = String.fromCharCode; - -var safeFromInt_1 = safeFromInt; +var normalizeIdentifier_1 = normalizeIdentifier; +var fromCharCode = String.fromCharCode; +var fromCharCode_1 = fromCharCode; function safeFromInt(value, base) { var code = parseInt(value, base); @@ -34887,50 +27960,52 @@ function safeFromInt(value, base) { // C0 except for HT, LF, FF, CR, space code < 9 || code === 11 || - (code > 13 && code < 32) || - // Control character (DEL) of the basic block and C1 controls. - (code > 126 && code < 160) || - // Lone high surrogates and low surrogates. - (code > 55295 && code < 57344) || - // Noncharacters. + (code > 13 && code < 32) || // Control character (DEL) of the basic block and C1 controls. + (code > 126 && code < 160) || // Lone high surrogates and low surrogates. + (code > 55295 && code < 57344) || // Noncharacters. (code > 64975 && code < 65008) || (code & 65535) === 65535 || - (code & 65535) === 65534 || - // Out of range + (code & 65535) === 65534 || // Out of range code > 1114111 ) { return '\uFFFD' } - return fromCharCode(code) + return fromCharCode_1(code) } -var markdownLineEnding_1 = markdownLineEnding; +var safeFromInt_1 = safeFromInt; + +function miniflat(value) { + return value === null || value === undefined + ? [] + : 'length' in value + ? value + : [value] +} + +var miniflat_1 = miniflat; function markdownLineEnding(code) { return code < -2 } -var markdownSpace_1 = markdownSpace; +var markdownLineEnding_1 = markdownLineEnding; function markdownSpace(code) { return code === -2 || code === -1 || code === 32 } -var factorySpace = createSpace; - - +var markdownSpace_1 = markdownSpace; -function createSpace(effects, ok, type, max) { +function spaceFactory(effects, ok, type, max) { var limit = max ? max - 1 : Infinity; - var size; - + var size = 0; return start function start(code) { if (markdownSpace_1(code)) { effects.enter(type); - size = 0; return prefix(code) } @@ -34948,11 +28023,9 @@ function createSpace(effects, ok, type, max) { } } -var tokenize = initializeContent; - - - +var factorySpace = spaceFactory; +var tokenize = initializeContent; function initializeContent(effects) { var contentStart = effects.attempt( @@ -34960,9 +28033,7 @@ function initializeContent(effects) { afterContentStartConstruct, paragraphInitial ); - var previous; - return contentStart function afterContentStartConstruct(code) { @@ -34993,7 +28064,6 @@ function initializeContent(effects) { } previous = token; - return data(code) } @@ -35009,26 +28079,25 @@ function initializeContent(effects) { effects.consume(code); effects.exit('chunkText'); return lineStart - } + } // Data. - // Data. effects.consume(code); return data } } -var content = { - tokenize: tokenize -}; - -var tokenize$1 = tokenizeBlankLine; -var partial = true; - - +var tokenize_1 = tokenize; +var content = /*#__PURE__*/Object.defineProperty({ + tokenize: tokenize_1 +}, '__esModule', {value: true}); +var partialBlankLine = { + tokenize: tokenizePartialBlankLine, + partial: true +}; -function tokenizeBlankLine(effects, ok, nok) { +function tokenizePartialBlankLine(effects, ok, nok) { return factorySpace(effects, afterWhitespace, 'linePrefix') function afterWhitespace(code) { @@ -35036,29 +28105,27 @@ function tokenizeBlankLine(effects, ok, nok) { } } -var partialBlankLine = { - tokenize: tokenize$1, - partial: partial -}; - -var tokenize$2 = initializeDocument; - - +var partialBlankLine_1 = partialBlankLine; - - - -var container = {tokenize: tokenizeContainer}; -var lazyFlow = {tokenize: tokenizeLazyFlow}; +var tokenize$1 = initializeDocument; +var containerConstruct = { + tokenize: tokenizeContainer +}; +var lazyFlowConstruct = { + tokenize: tokenizeLazyFlow +}; function initializeDocument(effects) { var self = this; var stack = []; var continued = 0; + var inspectConstruct = { + tokenize: tokenizeInspect, + partial: true + }; var inspectResult; var childFlow; var childToken; - return start function start(code) { @@ -35091,7 +28158,11 @@ function initializeDocument(effects) { childFlow.currentConstruct && childFlow.currentConstruct.interruptible; self.containerState = {}; - return effects.attempt(container, containerContinue, flowStart)(code) + return effects.attempt( + containerConstruct, + containerContinue, + flowStart + )(code) } function containerContinue(code) { @@ -35108,13 +28179,11 @@ function initializeDocument(effects) { } childFlow = childFlow || self.parser.flow(self.now()); - effects.enter('chunkFlow', { contentType: 'flow', previous: childToken, _tokenizer: childFlow }); - return flowContinue(code) } @@ -35127,10 +28196,7 @@ function initializeDocument(effects) { if (markdownLineEnding_1(code)) { effects.consume(code); continueFlow(effects.exit('chunkFlow')); - return effects.check( - {tokenize: tokenizeInspect, partial: true}, - documentAfterPeek - ) + return effects.check(inspectConstruct, documentAfterPeek) } effects.consume(code); @@ -35142,7 +28208,6 @@ function initializeDocument(effects) { inspectResult.continued, inspectResult && inspectResult.flowEnd ); - continued = 0; return start(code) } @@ -35156,15 +28221,13 @@ function initializeDocument(effects) { } function exitContainers(size, end) { - var index = stack.length; + var index = stack.length; // Close the flow. - // Close the flow. if (childFlow && end) { childFlow.write([null]); childToken = childFlow = undefined; - } + } // Exit open containers. - // Exit open containers. while (index-- > size) { self.containerState = stack[index][1]; stack[index][0].exit.call(self, effects); @@ -35175,9 +28238,7 @@ function initializeDocument(effects) { function tokenizeInspect(effects, ok) { var subcontinued = 0; - inspectResult = {}; - return inspectStart function inspectStart(code) { @@ -35188,10 +28249,9 @@ function initializeDocument(effects) { inspectContinue, inspectLess )(code) - } - - // If weā€™re continued but in a concrete flow, we canā€™t have more + } // If weā€™re continued but in a concrete flow, we canā€™t have more // containers. + if (childFlow.currentConstruct && childFlow.currentConstruct.concrete) { inspectResult.flowContinue = true; return inspectDone(code) @@ -35200,7 +28260,11 @@ function initializeDocument(effects) { self.interrupt = childFlow.currentConstruct && childFlow.currentConstruct.interruptible; self.containerState = {}; - return effects.attempt(container, inspectFlowEnd, inspectDone)(code) + return effects.attempt( + containerConstruct, + inspectFlowEnd, + inspectDone + )(code) } function inspectContinue(code) { @@ -35215,18 +28279,16 @@ function initializeDocument(effects) { // Maybe another container? self.containerState = {}; return effects.attempt( - container, - inspectFlowEnd, - // Maybe flow, or a blank line? + containerConstruct, + inspectFlowEnd, // Maybe flow, or a blank line? effects.attempt( - lazyFlow, + lazyFlowConstruct, inspectFlowEnd, - effects.check(partialBlankLine, inspectFlowEnd, inspectLazy) + effects.check(partialBlankLine_1, inspectFlowEnd, inspectLazy) ) )(code) - } + } // Otherwise weā€™re interrupting. - // Otherwise weā€™re interrupting. return inspectFlowEnd(code) } @@ -35236,9 +28298,8 @@ function initializeDocument(effects) { inspectResult.lazy = true; inspectResult.flowContinue = true; return inspectDone(code) - } + } // Weā€™re done with flow if we have more containers, or an interruption. - // Weā€™re done with flow if we have more containers, or an interruption. function inspectFlowEnd(code) { inspectResult.flowEnd = true; return inspectDone(code) @@ -35257,7 +28318,9 @@ function tokenizeContainer(effects, ok, nok) { effects, effects.attempt(this.parser.constructs.document, ok, nok), 'linePrefix', - 4 + this.parser.constructs.disable.null.indexOf('codeIndented') > -1 + ? undefined + : 4 ) } @@ -35266,74 +28329,85 @@ function tokenizeLazyFlow(effects, ok, nok) { effects, effects.lazy(this.parser.constructs.flow, ok, nok), 'linePrefix', - 4 + this.parser.constructs.disable.null.indexOf('codeIndented') > -1 + ? undefined + : 4 ) } -var document$1 = { - tokenize: tokenize$2 -}; +var tokenize_1$1 = tokenize$1; -var assign = Object.assign; +var document$1 = /*#__PURE__*/Object.defineProperty({ + tokenize: tokenize_1$1 +}, '__esModule', {value: true}); -var chunkedSplice_1 = chunkedSplice; +// Counts tabs based on their expanded size, and CR+LF as one character. + +function sizeChunks(chunks) { + var index = -1; + var size = 0; + + while (++index < chunks.length) { + size += typeof chunks[index] === 'string' ? chunks[index].length : 1; + } + + return size +} + +var sizeChunks_1 = sizeChunks; + +function prefixSize(events, type) { + var tail = events[events.length - 1]; + if (!tail || tail[1].type !== type) return 0 + return sizeChunks_1(tail[2].sliceStream(tail[1])) +} + +var prefixSize_1 = prefixSize; + +var splice = [].splice; -var v8MaxSafeChunkSize = 10000; +var splice_1 = splice; -// `Array#splice` takes all items to be inserted as individual argument which // causes a stack overflow in V8 when trying to insert 100k items for instance. + function chunkedSplice(list, start, remove, items) { var end = list.length; var chunkStart = 0; - var result; - var parameters; + var parameters; // Make start between zero and `end` (included). - // Make start between zero and `end` (included). if (start < 0) { start = -start > end ? 0 : end + start; } else { start = start > end ? end : start; } - remove = remove > 0 ? remove : 0; + remove = remove > 0 ? remove : 0; // No need to chunk the items if thereā€™s only a couple (10k) items. - // No need to chunk the items if thereā€™s only a couple (10k) items. - if (items.length < v8MaxSafeChunkSize) { + if (items.length < 10000) { parameters = Array.from(items); parameters.unshift(start, remove); - return [].splice.apply(list, parameters) - } - - // Delete `remove` items starting from `start` - result = [].splice.apply(list, [start, remove]); - - // Insert the items in chunks to not cause stack overflows. - while (chunkStart < items.length) { - parameters = items.slice(chunkStart, chunkStart + v8MaxSafeChunkSize); - parameters.unshift(start, 0) - ;[].splice.apply(list, parameters); + splice_1.apply(list, parameters); + } else { + // Delete `remove` items starting from `start` + if (remove) splice_1.apply(list, [start, remove]); // Insert the items in chunks to not cause stack overflows. - chunkStart += v8MaxSafeChunkSize; - start += v8MaxSafeChunkSize; + while (chunkStart < items.length) { + parameters = items.slice(chunkStart, chunkStart + 10000); + parameters.unshift(start, 0); + splice_1.apply(list, parameters); + chunkStart += 10000; + start += 10000; + } } - - return result } -var shallow_1 = shallow; - - +var chunkedSplice_1 = chunkedSplice; function shallow(object) { - return assign({}, object) + return assign_1({}, object) } -var subtokenize_1 = subtokenize; - - - - - +var shallow_1 = shallow; function subtokenize(events) { var jumps = {}; @@ -35351,10 +28425,9 @@ function subtokenize(events) { index = jumps[index]; } - event = events[index]; - - // Add a hook for the GFM tasklist extension, which needs to know if text + event = events[index]; // Add a hook for the GFM tasklist extension, which needs to know if text // is in the first content of a list item. + if ( index && event[1].type === 'chunkFlow' && @@ -35385,17 +28458,15 @@ function subtokenize(events) { } } } - } + } // Enter. - // Enter. if (event[0] === 'enter') { if (event[1].contentType) { - assign(jumps, subcontent(events, index)); + assign_1(jumps, subcontent(events, index)); index = jumps[index]; more = true; } - } - // Exit. + } // Exit. else if (event[1]._container || event[1]._movePreviousLineEndings) { otherIndex = index; lineIndex = undefined; @@ -35422,9 +28493,8 @@ function subtokenize(events) { if (lineIndex) { // Fix position. - event[1].end = shallow_1(events[lineIndex][1].start); + event[1].end = shallow_1(events[lineIndex][1].start); // Switch container exit w/ line endings. - // Switch container exit w/ line endings. parameters = events.slice(lineIndex, index); parameters.unshift(event); chunkedSplice_1(events, lineIndex, index - lineIndex + 1, parameters); @@ -35450,10 +28520,9 @@ function subcontent(events, eventIndex) { var index; var entered; var end; - var adjust; - - // Loop forward through the linked tokens to pass them in order to the + var adjust; // Loop forward through the linked tokens to pass them in order to the // subtokenizer. + while (token) { // Find the position of the event for this token. while (events[++startPosition][1] !== token) { @@ -35482,15 +28551,13 @@ function subcontent(events, eventIndex) { if (token.isInFirstContentOfListItem) { tokenizer._gfmTasklistFirstContentOfListItem = undefined; } - } + } // Unravel the next token. - // Unravel the next token. previous = token; token = token.next; - } - - // Now, loop back through all events (and linked tokens), to figure out which + } // Now, loop back through all events (and linked tokens), to figure out which // parts belong where. + token = previous; index = childEvents.length; @@ -35505,78 +28572,50 @@ function subcontent(events, eventIndex) { childEvents[index][1].type === childEvents[index - 1][1].type && childEvents[index][1].start.line !== childEvents[index][1].end.line ) { - add(childEvents.slice(index + 1, end)); - - // Help GC. - token._tokenizer = token.next = undefined; - token = token.previous; - end = index + 1; - } - } - - // Help GC. - tokenizer.events = token._tokenizer = token.next = undefined; - - // Do head: - add(childEvents.slice(0, end)); - - index = -1; - adjust = 0; - - while (++index < jumps.length) { - gaps[adjust + jumps[index][0]] = adjust + jumps[index][1]; - adjust += jumps[index][1] - jumps[index][0] - 1; - } - - return gaps - - function add(slice) { - var start = startPositions.pop(); - jumps.unshift([start, start + slice.length - 1]); - chunkedSplice_1(events, start, 2, slice); - } -} - -var sizeChunks_1 = sizeChunks; - -// Measure the number of character codes in chunks. -// Counts tabs based on their expanded size, and CR+LF as one character. -function sizeChunks(chunks) { - var index = -1; - var size = 0; - - while (++index < chunks.length) { - size += typeof chunks[index] === 'string' ? chunks[index].length : 1; - } - - return size -} - -var prefixSize_1 = prefixSize; - - - -function prefixSize(events, type) { - var tail = events[events.length - 1]; - if (!tail || tail[1].type !== type) return 0 - return sizeChunks_1(tail[2].sliceStream(tail[1])) -} - -var tokenize$3 = tokenizeContent; -var resolve$7 = resolveContent; -var interruptible = true; -var lazy = true; - + add(childEvents.slice(index + 1, end)); + // Help GC. + token._tokenizer = token.next = undefined; + token = token.previous; + end = index + 1; + } + } + // Help GC. + tokenizer.events = token._tokenizer = token.next = undefined; // Do head: + add(childEvents.slice(0, end)); + index = -1; + adjust = 0; + while (++index < jumps.length) { + gaps[adjust + jumps[index][0]] = adjust + jumps[index][1]; + adjust += jumps[index][1] - jumps[index][0] - 1; + } + return gaps + function add(slice) { + var start = startPositions.pop(); + jumps.unshift([start, start + slice.length - 1]); + chunkedSplice_1(events, start, 2, slice); + } +} -var lookaheadConstruct = {tokenize: tokenizeLookaheadConstruct, partial: true}; +var subtokenize_1 = subtokenize; -// Content is transparent: itā€™s parsed right now. That way, definitions are also +// No name because it must not be turned off. +var content$1 = { + tokenize: tokenizeContent, + resolve: resolveContent, + interruptible: true, + lazy: true +}; +var continuationConstruct = { + tokenize: tokenizeContinuation, + partial: true +}; // Content is transparent: itā€™s parsed right now. That way, definitions are also // parsed right now: before text in paragraphs (specifically, media) are parsed. + function resolveContent(events) { subtokenize_1(events); return events @@ -35584,7 +28623,6 @@ function resolveContent(events) { function tokenizeContent(effects, ok) { var previous; - return start function start(code) { @@ -35592,7 +28630,6 @@ function tokenizeContent(effects, ok) { previous = effects.enter('chunkContent', { contentType: 'content' }); - return data(code) } @@ -35603,13 +28640,12 @@ function tokenizeContent(effects, ok) { if (markdownLineEnding_1(code)) { return effects.check( - lookaheadConstruct, + continuationConstruct, contentContinue, contentEnd )(code) - } + } // Data. - // Data. effects.consume(code); return data } @@ -35627,14 +28663,12 @@ function tokenizeContent(effects, ok) { contentType: 'content', previous: previous }); - return data } } -function tokenizeLookaheadConstruct(effects, ok, nok) { +function tokenizeContinuation(effects, ok, nok) { var self = this; - return startLookahead function startLookahead(code) { @@ -35649,7 +28683,10 @@ function tokenizeLookaheadConstruct(effects, ok, nok) { return nok(code) } - if (prefixSize_1(self.events, 'linePrefix') < 4) { + if ( + self.parser.constructs.disable.null.indexOf('codeIndented') > -1 || + prefixSize_1(self.events, 'linePrefix') < 4 + ) { return effects.interrupt(self.parser.constructs.flow, nok, ok)(code) } @@ -35657,28 +28694,16 @@ function tokenizeLookaheadConstruct(effects, ok, nok) { } } -var content$1 = { - tokenize: tokenize$3, - resolve: resolve$7, - interruptible: interruptible, - lazy: lazy -}; - -var tokenize$4 = initializeFlow; - - - - - +var content_1 = content$1; +var tokenize$2 = initializeFlow; function initializeFlow(effects) { var self = this; var initial = effects.attempt( // Try to parse a blank line. - partialBlankLine, - atBlankEnding, - // Try to parse initial flow (essentially, only code). + partialBlankLine_1, + atBlankEnding, // Try to parse initial flow (essentially, only code). effects.attempt( this.parser.constructs.flowInitial, afterConstruct, @@ -35687,13 +28712,12 @@ function initializeFlow(effects) { effects.attempt( this.parser.constructs.flow, afterConstruct, - effects.attempt(content$1, afterConstruct) + effects.attempt(content_1, afterConstruct) ), 'linePrefix' ) ) ); - return initial function atBlankEnding(code) { @@ -35723,29 +28747,30 @@ function initializeFlow(effects) { } } -var flow = { - tokenize: tokenize$4 -}; - -var text_1 = initializeFactory('text'); -var string = initializeFactory('string'); -var resolver_1 = {resolveAll: resolver()}; - - +var tokenize_1$2 = tokenize$2; +var flow = /*#__PURE__*/Object.defineProperty({ + tokenize: tokenize_1$2 +}, '__esModule', {value: true}); +var text = initializeFactory('text'); +var string = initializeFactory('string'); +var resolver = { + resolveAll: createResolver() +}; function initializeFactory(field) { return { tokenize: initializeText, - resolveAll: resolver(field === 'text' ? resolveAllLineSuffixes : undefined) + resolveAll: createResolver( + field === 'text' ? resolveAllLineSuffixes : undefined + ) } function initializeText(effects) { var self = this; var constructs = this.parser.constructs[field]; var text = effects.attempt(constructs, start, notText); - return start function start(code) { @@ -35767,9 +28792,8 @@ function initializeFactory(field) { if (atBreak(code)) { effects.exit('data'); return text(code) - } + } // Data. - // Data. effects.consume(code); return data } @@ -35796,15 +28820,14 @@ function initializeFactory(field) { } } -function resolver(extraResolver) { +function createResolver(extraResolver) { return resolveAllText function resolveAllText(events, context) { var index = -1; - var enter; - - // A rather boring computation (to merge adjacent `data` events) which + var enter; // A rather boring computation (to merge adjacent `data` events) which // improves mm performance by 29%. + while (++index <= events.length) { if (enter === undefined) { if (events[index] && events[index][1].type === 'data') { @@ -35825,15 +28848,14 @@ function resolver(extraResolver) { return extraResolver ? extraResolver(events, context) : events } -} - -// A rather ugly set of instructions which again looks at chunks in the input +} // A rather ugly set of instructions which again looks at chunks in the input // stream. // The reason to do this here is that it is *much* faster to parse in reverse. // And that we canā€™t hook into `null` to split the line suffix before an EOF. // To do: figure out if we can make this into a clean utility, or even in core. // As it will be useful for GFMs literal autolink extension (and maybe even // tables?) + function resolveAllLineSuffixes(events, context) { var eventIndex = -1; var chunks; @@ -35871,12 +28893,12 @@ function resolveAllLineSuffixes(events, context) { if (bufferIndex) break bufferIndex = -1; - } - // Number + } // Number else if (chunk === -2) { tabs = true; size++; - } else if (chunk === -1) ; else { + } else if (chunk === -1); + else { // Replacement character, exit. index++; break @@ -35889,7 +28911,6 @@ function resolveAllLineSuffixes(events, context) { eventIndex === events.length || tabs || size < 2 ? 'lineSuffix' : 'hardBreakTrailing', - start: { line: data.end.line, column: data.end.column - size, @@ -35899,14 +28920,12 @@ function resolveAllLineSuffixes(events, context) { ? bufferIndex : data.start._bufferIndex + bufferIndex }, - end: shallow_1(data.end) }; - data.end = shallow_1(token.start); if (data.start.offset === data.end.offset) { - assign(data, token); + assign_1(data, token); } else { events.splice( eventIndex, @@ -35914,7 +28933,6 @@ function resolveAllLineSuffixes(events, context) { ['enter', token, context], ['exit', token, context] ); - eventIndex += 2; } } @@ -35926,48 +28944,493 @@ function resolveAllLineSuffixes(events, context) { return events } -var text = { - text: text_1, - string: string, - resolver: resolver_1 -}; +var resolver_1 = resolver; +var string_1 = string; +var text_2 = text; -var markdownLineEndingOrSpace_1 = markdownLineEndingOrSpace; +var text_1 = /*#__PURE__*/Object.defineProperty({ + resolver: resolver_1, + string: string_1, + text: text_2 +}, '__esModule', {value: true}); -function markdownLineEndingOrSpace(code) { - return code < 0 || code === 32 +function combineExtensions(extensions) { + var all = {}; + var index = -1; + + while (++index < extensions.length) { + extension$1(all, extensions[index]); + } + + return all } -// This module is generated by `script/`. -// -// CommonMark handles attention (emphasis, strong) markers based on what comes -// before or after them. -// One such difference is if those characters are Unicode punctuation. -// This script is generated from the Unicode data. -var unicodePunctuationRegex = /[!-\/:-@\[-`\{-~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]/; +function extension$1(all, extension) { + var hook; + var left; + var right; + var code; -var regexCheck_1 = regexCheck; + for (hook in extension) { + left = hasOwnProperty.call(all, hook) ? all[hook] : (all[hook] = {}); + right = extension[hook]; + + for (code in right) { + left[code] = constructs( + miniflat_1(right[code]), + hasOwnProperty.call(left, code) ? left[code] : [] + ); + } + } +} + +function constructs(list, existing) { + var index = -1; + var before = []; + + while (++index < list.length) { +(list[index].add === 'after' ? existing : before).push(list[index]); + } + + chunkedSplice_1(existing, 0, 0, before); + return existing +} + +var combineExtensions_1 = combineExtensions; + +function chunkedPush(list, items) { + if (list.length) { + chunkedSplice_1(list, list.length, 0, items); + return list + } + + return items +} + +var chunkedPush_1 = chunkedPush; + +function resolveAll(constructs, events, context) { + var called = []; + var index = -1; + var resolve; + + while (++index < constructs.length) { + resolve = constructs[index].resolveAll; + + if (resolve && called.indexOf(resolve) < 0) { + events = resolve(events, context); + called.push(resolve); + } + } + + return events +} + +var resolveAll_1 = resolveAll; + +function serializeChunks(chunks) { + var index = -1; + var result = []; + var chunk; + var value; + var atTab; + + while (++index < chunks.length) { + chunk = chunks[index]; + + if (typeof chunk === 'string') { + value = chunk; + } else if (chunk === -5) { + value = '\r'; + } else if (chunk === -4) { + value = '\n'; + } else if (chunk === -3) { + value = '\r' + '\n'; + } else if (chunk === -2) { + value = '\t'; + } else if (chunk === -1) { + if (atTab) continue + value = ' '; + } else { + // Currently only replacement character. + value = fromCharCode_1(chunk); + } + + atTab = chunk === -2; + result.push(value); + } + + return result.join('') +} + +var serializeChunks_1 = serializeChunks; + +function sliceChunks(chunks, token) { + var startIndex = token.start._index; + var startBufferIndex = token.start._bufferIndex; + var endIndex = token.end._index; + var endBufferIndex = token.end._bufferIndex; + var view; + + if (startIndex === endIndex) { + view = [chunks[startIndex].slice(startBufferIndex, endBufferIndex)]; + } else { + view = chunks.slice(startIndex, endIndex); + + if (startBufferIndex > -1) { + view[0] = view[0].slice(startBufferIndex); + } + + if (endBufferIndex > 0) { + view.push(chunks[endIndex].slice(0, endBufferIndex)); + } + } + + return view +} + +var sliceChunks_1 = sliceChunks; + +// Create a tokenizer. +// Tokenizers deal with one type of data (e.g., containers, flow, text). +// The parser is the object dealing with it all. +// `initialize` works like other constructs, except that only its `tokenize` +// function is used, in which case it doesnā€™t receive an `ok` or `nok`. +// `from` can be given to set the point before the first character, although +// when further lines are indented, they must be set with `defineSkip`. +function createTokenizer(parser, initialize, from) { + var point = from + ? shallow_1(from) + : { + line: 1, + column: 1, + offset: 0 + }; + var columnStart = {}; + var resolveAllConstructs = []; + var chunks = []; + var stack = []; + + var effects = { + consume: consume, + enter: enter, + exit: exit, + attempt: constructFactory(onsuccessfulconstruct), + check: constructFactory(onsuccessfulcheck), + interrupt: constructFactory(onsuccessfulcheck, { + interrupt: true + }), + lazy: constructFactory(onsuccessfulcheck, { + lazy: true + }) + }; // State and tools for resolving and serializing. + + var context = { + previous: null, + events: [], + parser: parser, + sliceStream: sliceStream, + sliceSerialize: sliceSerialize, + now: now, + defineSkip: skip, + write: write + }; // The state function. + + var state = initialize.tokenize.call(context, effects); // Track which character we expect to be consumed, to catch bugs. + + if (initialize.resolveAll) { + resolveAllConstructs.push(initialize); + } // Store where we are in the input stream. + + point._index = 0; + point._bufferIndex = -1; + return context + + function write(slice) { + chunks = chunkedPush_1(chunks, slice); + main(); // Exit if weā€™re not done, resolve might change stuff. + + if (chunks[chunks.length - 1] !== null) { + return [] + } + + addResult(initialize, 0); // Otherwise, resolve, and exit. + + context.events = resolveAll_1(resolveAllConstructs, context.events, context); + return context.events + } // + // Tools. + // + + function sliceSerialize(token) { + return serializeChunks_1(sliceStream(token)) + } + + function sliceStream(token) { + return sliceChunks_1(chunks, token) + } + + function now() { + return shallow_1(point) + } + + function skip(value) { + columnStart[value.line] = value.column; + accountForPotentialSkip(); + } // + // State management. + // + // Main loop (note that `_index` and `_bufferIndex` in `point` are modified by + // `consume`). + // Here is where we walk through the chunks, which either include strings of + // several characters, or numerical character codes. + // The reason to do this in a loop instead of a call is so the stack can + // drain. + + function main() { + var chunkIndex; + var chunk; + + while (point._index < chunks.length) { + chunk = chunks[point._index]; // If weā€™re in a buffer chunk, loop through it. + + if (typeof chunk === 'string') { + chunkIndex = point._index; + + if (point._bufferIndex < 0) { + point._bufferIndex = 0; + } + + while ( + point._index === chunkIndex && + point._bufferIndex < chunk.length + ) { + go(chunk.charCodeAt(point._bufferIndex)); + } + } else { + go(chunk); + } + } + } // Deal with one code. + + function go(code) { + state = state(code); + } // Move a character forward. + + function consume(code) { + if (markdownLineEnding_1(code)) { + point.line++; + point.column = 1; + point.offset += code === -3 ? 2 : 1; + accountForPotentialSkip(); + } else if (code !== -1) { + point.column++; + point.offset++; + } // Not in a string chunk. + + if (point._bufferIndex < 0) { + point._index++; + } else { + point._bufferIndex++; // At end of string chunk. + + if (point._bufferIndex === chunks[point._index].length) { + point._bufferIndex = -1; + point._index++; + } + } // Expose the previous character. + + context.previous = code; // Mark as consumed. + } // Start a token. + + function enter(type, fields) { + var token = fields || {}; + token.type = type; + token.start = now(); + context.events.push(['enter', token, context]); + stack.push(token); + return token + } // Stop a token. + + function exit(type) { + var token = stack.pop(); + token.end = now(); + context.events.push(['exit', token, context]); + return token + } // Use results. + + function onsuccessfulconstruct(construct, info) { + addResult(construct, info.from); + } // Discard results. + + function onsuccessfulcheck(construct, info) { + info.restore(); + } // Factory to attempt/check/interrupt. + + function constructFactory(onreturn, fields) { + return hook // Handle either an object mapping codes to constructs, a list of + // constructs, or a single construct. + + function hook(constructs, returnState, bogusState) { + var listOfConstructs; + var constructIndex; + var currentConstruct; + var info; + return constructs.tokenize || 'length' in constructs + ? handleListOfConstructs(miniflat_1(constructs)) + : handleMapOfConstructs + + function handleMapOfConstructs(code) { + if (code in constructs || null in constructs) { + return handleListOfConstructs( + constructs.null + ? /* c8 ignore next */ + miniflat_1(constructs[code]).concat(miniflat_1(constructs.null)) + : constructs[code] + )(code) + } + + return bogusState(code) + } + + function handleListOfConstructs(list) { + listOfConstructs = list; + constructIndex = 0; + return handleConstruct(list[constructIndex]) + } + + function handleConstruct(construct) { + return start + + function start(code) { + // To do: not nede to store if there is no bogus state, probably? + // Currently doesnā€™t work because `inspect` in document does a check + // w/o a bogus, which doesnā€™t make sense. But it does seem to help perf + // by not storing. + info = store(); + currentConstruct = construct; + + if (!construct.partial) { + context.currentConstruct = construct; + } + + if ( + construct.name && + context.parser.constructs.disable.null.indexOf(construct.name) > -1 + ) { + return nok() + } + + return construct.tokenize.call( + fields ? assign_1({}, context, fields) : context, + effects, + ok, + nok + )(code) + } + } + + function ok(code) { + onreturn(currentConstruct, info); + return returnState + } + + function nok(code) { + info.restore(); + + if (++constructIndex < listOfConstructs.length) { + return handleConstruct(listOfConstructs[constructIndex]) + } + + return bogusState + } + } + } + + function addResult(construct, from) { + if (construct.resolveAll && resolveAllConstructs.indexOf(construct) < 0) { + resolveAllConstructs.push(construct); + } + + if (construct.resolve) { + chunkedSplice_1( + context.events, + from, + context.events.length - from, + construct.resolve(context.events.slice(from), context) + ); + } + + if (construct.resolveTo) { + context.events = construct.resolveTo(context.events, context); + } + } + + function store() { + var startPoint = now(); + var startPrevious = context.previous; + var startCurrentConstruct = context.currentConstruct; + var startEventsIndex = context.events.length; + var startStack = Array.from(stack); + return { + restore: restore, + from: startEventsIndex + } + + function restore() { + point = startPoint; + context.previous = startPrevious; + context.currentConstruct = startCurrentConstruct; + context.events.length = startEventsIndex; + stack = startStack; + accountForPotentialSkip(); + } + } + + function accountForPotentialSkip() { + if (point.line in columnStart && point.column < 2) { + point.column = columnStart[point.line]; + point.offset += columnStart[point.line] - 1; + } + } +} + +var createTokenizer_1 = createTokenizer; +function markdownLineEndingOrSpace(code) { + return code < 0 || code === 32 +} +var markdownLineEndingOrSpace_1 = markdownLineEndingOrSpace; function regexCheck(regex) { return check + function check(code) { - return regex.test(fromCharCode(code)) + return regex.test(fromCharCode_1(code)) } } -// Size note: removing ASCII from the regex and using `ascii-punctuation` here -// In fact adds to the bundle size. -var unicodePunctuation_1 = regexCheck_1(unicodePunctuationRegex); +var regexCheck_1 = regexCheck; -var unicodeWhitespace = regexCheck_1(/\s/); +// This module is generated by `script/`. +// +// CommonMark handles attention (emphasis, strong) markers based on what comes +// before or after them. +// One such difference is if those characters are Unicode punctuation. +// This script is generated from the Unicode data. +var unicodePunctuation = /[!-\/:-@\[-`\{-~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]/; -var classifyCharacter_1 = classifyCharacter; +var unicodePunctuationRegex = unicodePunctuation; + +// In fact adds to the bundle size. +var unicodePunctuation$1 = regexCheck_1(unicodePunctuationRegex); +var unicodePunctuation_1 = unicodePunctuation$1; +var unicodeWhitespace = regexCheck_1(/\s/); +var unicodeWhitespace_1 = unicodeWhitespace; // Classify whether a character is unicode whitespace, unicode punctuation, or // anything else. @@ -35977,7 +29440,7 @@ function classifyCharacter(code) { if ( code === null || markdownLineEndingOrSpace_1(code) || - unicodeWhitespace(code) + unicodeWhitespace_1(code) ) { return 1 } @@ -35987,10 +29450,10 @@ function classifyCharacter(code) { } } -var movePoint_1 = movePoint; +var classifyCharacter_1 = classifyCharacter; -// Note! `move` only works inside lines! Itā€™s not possible to move past other // chunks (replacement characters, tabs, or line endings). + function movePoint(point, offset) { point.column += offset; point.offset += offset; @@ -35998,35 +29461,14 @@ function movePoint(point, offset) { return point } -var resolveAll_1 = resolveAll; - -function resolveAll(constructs, events, context) { - var called = []; - var index = -1; - var resolve; - - while (++index < constructs.length) { - resolve = constructs[index].resolveAll; - - if (resolve && called.indexOf(resolve) < 0) { - events = resolve(events, context); - called.push(resolve); - } - } - - return events -} - -var tokenize$5 = tokenizeAttention; -var resolveAll_1$1 = resolveAllAttention; - - - - - +var movePoint_1 = movePoint; +var attention = { + name: 'attention', + tokenize: tokenizeAttention, + resolveAll: resolveAllAttention +}; -// Take all events and resolve attention to emphasis or strong. function resolveAllAttention(events, context) { var index = -1; var open; @@ -36036,12 +29478,11 @@ function resolveAllAttention(events, context) { var closingSequence; var use; var nextEvents; - var offset; - - // Walk through all events. + var offset; // Walk through all events. // // Note: performance of this is fine on an mb of normal markdown, but itā€™s // a bottleneck for malicious stuff. + while (++index < events.length) { // Find a token that can close. if ( @@ -36049,16 +29490,14 @@ function resolveAllAttention(events, context) { events[index][1].type === 'attentionSequence' && events[index][1]._close ) { - open = index; + open = index; // Now walk back to find an opener. - // Now walk back to find an opener. while (open--) { // Find a token that can open the closer. if ( events[open][0] === 'exit' && events[open][1].type === 'attentionSequence' && - events[open][1]._open && - // If the markers are the same: + events[open][1]._open && // If the markers are the same: context.sliceSerialize(events[open][1]).charCodeAt(0) === context.sliceSerialize(events[index][1]).charCodeAt(0) ) { @@ -36078,84 +29517,70 @@ function resolveAllAttention(events, context) { ) ) { continue - } + } // Number of markers to use from the sequence. - // Number of markers to use from the sequence. use = events[open][1].end.offset - events[open][1].start.offset > 1 && events[index][1].end.offset - events[index][1].start.offset > 1 ? 2 : 1; - openingSequence = { type: use > 1 ? 'strongSequence' : 'emphasisSequence', start: movePoint_1(shallow_1(events[open][1].end), -use), end: shallow_1(events[open][1].end) }; - closingSequence = { type: use > 1 ? 'strongSequence' : 'emphasisSequence', start: shallow_1(events[index][1].start), end: movePoint_1(shallow_1(events[index][1].start), use) }; - text = { type: use > 1 ? 'strongText' : 'emphasisText', start: shallow_1(events[open][1].end), end: shallow_1(events[index][1].start) }; - group = { type: use > 1 ? 'strong' : 'emphasis', start: shallow_1(openingSequence.start), end: shallow_1(closingSequence.end) }; - events[open][1].end = shallow_1(openingSequence.start); events[index][1].start = shallow_1(closingSequence.end); + nextEvents = []; // If there are more markers in the opening, add them before. - nextEvents = []; - - // If there are more markers in the opening, add them before. if (events[open][1].end.offset - events[open][1].start.offset) { - chunkedSplice_1(nextEvents, nextEvents.length, 0, [ + nextEvents = chunkedPush_1(nextEvents, [ ['enter', events[open][1], context], ['exit', events[open][1], context] ]); - } + } // Opening. - // Opening. - chunkedSplice_1(nextEvents, nextEvents.length, 0, [ + nextEvents = chunkedPush_1(nextEvents, [ ['enter', group, context], ['enter', openingSequence, context], ['exit', openingSequence, context], ['enter', text, context] - ]); + ]); // Between. - // Between. - chunkedSplice_1( + nextEvents = chunkedPush_1( nextEvents, - nextEvents.length, - 0, resolveAll_1( context.parser.constructs.insideSpan.null, events.slice(open + 1, index), context ) - ); + ); // Closing. - // Closing. - chunkedSplice_1(nextEvents, nextEvents.length, 0, [ + nextEvents = chunkedPush_1(nextEvents, [ ['exit', text, context], ['enter', closingSequence, context], ['exit', closingSequence, context], ['exit', group, context] - ]); + ]); // If there are more markers in the closing, add them after. - // If there are more markers in the closing, add them after. if (events[index][1].end.offset - events[index][1].start.offset) { offset = 2; - chunkedSplice_1(nextEvents, nextEvents.length, 0, [ + nextEvents = chunkedPush_1(nextEvents, [ ['enter', events[index][1], context], ['exit', events[index][1], context] ]); @@ -36164,15 +29589,13 @@ function resolveAllAttention(events, context) { } chunkedSplice_1(events, open - 1, index - open + 3, nextEvents); - index = open + nextEvents.length - offset - 2; break } } } - } + } // Remove remaining sequences. - // Remove remaining sequences. index = -1; while (++index < events.length) { @@ -36187,7 +29610,6 @@ function resolveAllAttention(events, context) { function tokenizeAttention(effects, ok) { var before = classifyCharacter_1(this.previous); var marker; - return start function start(code) { @@ -36217,670 +29639,4727 @@ function tokenizeAttention(effects, ok) { } } -var attention = { - tokenize: tokenize$5, - resolveAll: resolveAll_1$1 -}; +var attention_1 = attention; -var tokenize$6 = tokenizeAtxHeading; -var resolve$8 = resolveAtxHeading; +var asciiAlphanumeric = regexCheck_1(/[\dA-Za-z]/); +var asciiAlphanumeric_1 = asciiAlphanumeric; +var asciiAlpha = regexCheck_1(/[A-Za-z]/); +var asciiAlpha_1 = asciiAlpha; +var asciiAtext = regexCheck_1(/[#-'*+\--9=?A-Z^-~]/); +var asciiAtext_1 = asciiAtext; +// Note: EOF is seen as ASCII control here, because `null < 32 == true`. +function asciiControl(code) { + return ( + // Special whitespace codes (which have negative values), C0 and Control + // character DEL + code < 32 || code === 127 + ) +} +var asciiControl_1 = asciiControl; -function resolveAtxHeading(events, context) { - var contentEnd = events.length - 2; - var contentStart = 3; - var content; - var text; +var autolink = { + name: 'autolink', + tokenize: tokenizeAutolink +}; - // Prefix whitespace, part of the opening. - if (events[contentStart][1].type === 'whitespace') { - contentStart += 2; +function tokenizeAutolink(effects, ok, nok) { + var size = 1; + return start + + function start(code) { + effects.enter('autolink'); + effects.enter('autolinkMarker'); + effects.consume(code); + effects.exit('autolinkMarker'); + effects.enter('autolinkProtocol'); + return open } - // Suffix whitespace, part of the closing. - if ( - contentEnd - 2 > contentStart && - events[contentEnd][1].type === 'whitespace' - ) { - contentEnd -= 2; + function open(code) { + if (asciiAlpha_1(code)) { + effects.consume(code); + return schemeOrEmailAtext + } + + return asciiAtext_1(code) ? emailAtext(code) : nok(code) } - if ( - events[contentEnd][1].type === 'atxHeadingSequence' && - (contentStart === contentEnd - 1 || - (contentEnd - 4 > contentStart && - events[contentEnd - 2][1].type === 'whitespace')) - ) { - contentEnd -= contentStart + 1 === contentEnd ? 2 : 4; + function schemeOrEmailAtext(code) { + return code === 43 || code === 45 || code === 46 || asciiAlphanumeric_1(code) + ? schemeInsideOrEmailAtext(code) + : emailAtext(code) } - if (contentEnd > contentStart) { - content = { - type: 'atxHeadingText', - start: events[contentStart][1].start, - end: events[contentEnd][1].end - }; + function schemeInsideOrEmailAtext(code) { + if (code === 58) { + effects.consume(code); + return urlInside + } - text = { - type: 'chunkText', - start: events[contentStart][1].start, - end: events[contentEnd][1].end, - contentType: 'text' - }; + if ( + (code === 43 || code === 45 || code === 46 || asciiAlphanumeric_1(code)) && + size++ < 32 + ) { + effects.consume(code); + return schemeInsideOrEmailAtext + } - chunkedSplice_1(events, contentStart, contentEnd - contentStart + 1, [ - ['enter', content, context], - ['enter', text, context], - ['exit', text, context], - ['exit', content, context] - ]); + return emailAtext(code) } - return events -} - -function tokenizeAtxHeading(effects, ok, nok) { - var self = this; - var size = 0; + function urlInside(code) { + if (code === 62) { + effects.exit('autolinkProtocol'); + return end(code) + } - return start + if (code === 32 || code === 60 || asciiControl_1(code)) { + return nok(code) + } - function start(code) { - effects.enter('atxHeading'); - effects.enter('atxHeadingSequence'); - return fenceOpenInside(code) + effects.consume(code); + return urlInside } - function fenceOpenInside(code) { - if (code === 35 && size++ < 6) { + function emailAtext(code) { + if (code === 64) { effects.consume(code); - return fenceOpenInside + size = 0; + return emailAtSignOrDot } - if (code === null || markdownLineEndingOrSpace_1(code)) { - effects.exit('atxHeadingSequence'); - return self.interrupt ? ok(code) : headingBreak(code) + if (asciiAtext_1(code)) { + effects.consume(code); + return emailAtext } return nok(code) } - function headingBreak(code) { - if (code === 35) { - effects.enter('atxHeadingSequence'); - return sequence(code) + function emailAtSignOrDot(code) { + return asciiAlphanumeric_1(code) ? emailLabel(code) : nok(code) + } + + function emailLabel(code) { + if (code === 46) { + effects.consume(code); + size = 0; + return emailAtSignOrDot } - if (code === null || markdownLineEnding_1(code)) { - effects.exit('atxHeading'); - return ok(code) + if (code === 62) { + // Exit, then change the type. + effects.exit('autolinkProtocol').type = 'autolinkEmail'; + return end(code) } - if (markdownSpace_1(code)) { - return factorySpace(effects, headingBreak, 'whitespace')(code) + return emailValue(code) + } + + function emailValue(code) { + if ((code === 45 || asciiAlphanumeric_1(code)) && size++ < 63) { + effects.consume(code); + return code === 45 ? emailValue : emailLabel } - effects.enter('atxHeadingText'); - return data(code) + return nok(code) } - function sequence(code) { - if (code === 35) { + function end(code) { + effects.enter('autolinkMarker'); + effects.consume(code); + effects.exit('autolinkMarker'); + effects.exit('autolink'); + return ok + } +} + +var autolink_1 = autolink; + +var blockQuote = { + name: 'blockQuote', + tokenize: tokenizeBlockQuoteStart, + continuation: { + tokenize: tokenizeBlockQuoteContinuation + }, + exit: exit +}; + +function tokenizeBlockQuoteStart(effects, ok, nok) { + var self = this; + return start + + function start(code) { + if (code === 62) { + if (!self.containerState.open) { + effects.enter('blockQuote', { + _container: true + }); + self.containerState.open = true; + } + + effects.enter('blockQuotePrefix'); + effects.enter('blockQuoteMarker'); effects.consume(code); - return sequence + effects.exit('blockQuoteMarker'); + return after } - effects.exit('atxHeadingSequence'); - return headingBreak(code) + return nok(code) } - function data(code) { - if (code === null || code === 35 || markdownLineEndingOrSpace_1(code)) { - effects.exit('atxHeadingText'); - return headingBreak(code) + function after(code) { + if (markdownSpace_1(code)) { + effects.enter('blockQuotePrefixWhitespace'); + effects.consume(code); + effects.exit('blockQuotePrefixWhitespace'); + effects.exit('blockQuotePrefix'); + return ok } + effects.exit('blockQuotePrefix'); + return ok(code) + } +} + +function tokenizeBlockQuoteContinuation(effects, ok, nok) { + return factorySpace( + effects, + effects.attempt(blockQuote, ok, nok), + 'linePrefix', + this.parser.constructs.disable.null.indexOf('codeIndented') > -1 + ? undefined + : 4 + ) +} + +function exit(effects) { + effects.exit('blockQuote'); +} + +var blockQuote_1 = blockQuote; + +var asciiPunctuation = regexCheck_1(/[!-/:-@[-`{-~]/); + +var asciiPunctuation_1 = asciiPunctuation; + +var characterEscape = { + name: 'characterEscape', + tokenize: tokenizeCharacterEscape +}; + +function tokenizeCharacterEscape(effects, ok, nok) { + return start + + function start(code) { + effects.enter('characterEscape'); + effects.enter('escapeMarker'); effects.consume(code); - return data + effects.exit('escapeMarker'); + return open + } + + function open(code) { + if (asciiPunctuation_1(code)) { + effects.enter('characterEscapeValue'); + effects.consume(code); + effects.exit('characterEscapeValue'); + effects.exit('characterEscape'); + return ok + } + + return nok(code) } } -var headingAtx = { - tokenize: tokenize$6, - resolve: resolve$8 +var characterEscape_1 = characterEscape; + +const AEli = "Ɔ"; +const AElig = "Ɔ"; +const AM = "&"; +const AMP = "&"; +const Aacut = "Ɓ"; +const Aacute = "Ɓ"; +const Abreve = "Ă"; +const Acir = "Ƃ"; +const Acirc = "Ƃ"; +const Acy = "Š"; +const Afr = "š”„"; +const Agrav = "ƀ"; +const Agrave = "ƀ"; +const Alpha = "Ī‘"; +const Amacr = "Ā"; +const And = "ā©“"; +const Aogon = "Ą"; +const Aopf = "š”ø"; +const ApplyFunction = "ā”"; +const Arin = "ƅ"; +const Aring = "ƅ"; +const Ascr = "š’œ"; +const Assign = "ā‰”"; +const Atild = "ƃ"; +const Atilde = "ƃ"; +const Aum = "Ƅ"; +const Auml = "Ƅ"; +const Backslash = "āˆ–"; +const Barv = "ā«§"; +const Barwed = "āŒ†"; +const Bcy = "Š‘"; +const Because = "āˆµ"; +const Bernoullis = "ā„¬"; +const Beta = "Ī’"; +const Bfr = "š”…"; +const Bopf = "š”¹"; +const Breve = "Ė˜"; +const Bscr = "ā„¬"; +const Bumpeq = "ā‰Ž"; +const CHcy = "Š§"; +const COP = "Ā©"; +const COPY = "Ā©"; +const Cacute = "Ć"; +const Cap = "ā‹’"; +const CapitalDifferentialD = "ā……"; +const Cayleys = "ā„­"; +const Ccaron = "Č"; +const Ccedi = "Ƈ"; +const Ccedil = "Ƈ"; +const Ccirc = "Ĉ"; +const Cconint = "āˆ°"; +const Cdot = "Ċ"; +const Cedilla = "Āø"; +const CenterDot = "Ā·"; +const Cfr = "ā„­"; +const Chi = "Ī§"; +const CircleDot = "āŠ™"; +const CircleMinus = "āŠ–"; +const CirclePlus = "āŠ•"; +const CircleTimes = "āŠ—"; +const ClockwiseContourIntegral = "āˆ²"; +const CloseCurlyDoubleQuote = "ā€"; +const CloseCurlyQuote = "ā€™"; +const Colon = "āˆ·"; +const Colone = "ā©“"; +const Congruent = "ā‰”"; +const Conint = "āˆÆ"; +const ContourIntegral = "āˆ®"; +const Copf = "ā„‚"; +const Coproduct = "āˆ"; +const CounterClockwiseContourIntegral = "āˆ³"; +const Cross = "āØÆ"; +const Cscr = "š’ž"; +const Cup = "ā‹“"; +const CupCap = "ā‰"; +const DD = "ā……"; +const DDotrahd = "ā¤‘"; +const DJcy = "Š‚"; +const DScy = "Š…"; +const DZcy = "Š"; +const Dagger = "ā€”"; +const Darr = "ā†”"; +const Dashv = "ā«¤"; +const Dcaron = "Ď"; +const Dcy = "Š”"; +const Del = "āˆ‡"; +const Delta = "Ī”"; +const Dfr = "š”‡"; +const DiacriticalAcute = "Ā“"; +const DiacriticalDot = "Ė™"; +const DiacriticalDoubleAcute = "Ė"; +const DiacriticalGrave = "`"; +const DiacriticalTilde = "Ėœ"; +const Diamond = "ā‹„"; +const DifferentialD = "ā…†"; +const Dopf = "š”»"; +const Dot = "ĀØ"; +const DotDot = "āƒœ"; +const DotEqual = "ā‰"; +const DoubleContourIntegral = "āˆÆ"; +const DoubleDot = "ĀØ"; +const DoubleDownArrow = "ā‡“"; +const DoubleLeftArrow = "ā‡"; +const DoubleLeftRightArrow = "ā‡”"; +const DoubleLeftTee = "ā«¤"; +const DoubleLongLeftArrow = "āŸø"; +const DoubleLongLeftRightArrow = "āŸŗ"; +const DoubleLongRightArrow = "āŸ¹"; +const DoubleRightArrow = "ā‡’"; +const DoubleRightTee = "āŠØ"; +const DoubleUpArrow = "ā‡‘"; +const DoubleUpDownArrow = "ā‡•"; +const DoubleVerticalBar = "āˆ„"; +const DownArrow = "ā†“"; +const DownArrowBar = "ā¤“"; +const DownArrowUpArrow = "ā‡µ"; +const DownBreve = "Ģ‘"; +const DownLeftRightVector = "ā„"; +const DownLeftTeeVector = "ā„ž"; +const DownLeftVector = "ā†½"; +const DownLeftVectorBar = "ā„–"; +const DownRightTeeVector = "ā„Ÿ"; +const DownRightVector = "ā‡"; +const DownRightVectorBar = "ā„—"; +const DownTee = "āŠ¤"; +const DownTeeArrow = "ā†§"; +const Downarrow = "ā‡“"; +const Dscr = "š’Ÿ"; +const Dstrok = "Đ"; +const ENG = "Ŋ"; +const ET = "Ɛ"; +const ETH = "Ɛ"; +const Eacut = "Ɖ"; +const Eacute = "Ɖ"; +const Ecaron = "Ě"; +const Ecir = "Ɗ"; +const Ecirc = "Ɗ"; +const Ecy = "Š­"; +const Edot = "Ė"; +const Efr = "š”ˆ"; +const Egrav = "ƈ"; +const Egrave = "ƈ"; +const Element = "āˆˆ"; +const Emacr = "Ē"; +const EmptySmallSquare = "ā—»"; +const EmptyVerySmallSquare = "ā–«"; +const Eogon = "Ę"; +const Eopf = "š”¼"; +const Epsilon = "Ī•"; +const Equal = "ā©µ"; +const EqualTilde = "ā‰‚"; +const Equilibrium = "ā‡Œ"; +const Escr = "ā„°"; +const Esim = "ā©³"; +const Eta = "Ī—"; +const Eum = "Ƌ"; +const Euml = "Ƌ"; +const Exists = "āˆƒ"; +const ExponentialE = "ā…‡"; +const Fcy = "Š¤"; +const Ffr = "š”‰"; +const FilledSmallSquare = "ā—¼"; +const FilledVerySmallSquare = "ā–Ŗ"; +const Fopf = "š”½"; +const ForAll = "āˆ€"; +const Fouriertrf = "ā„±"; +const Fscr = "ā„±"; +const GJcy = "Šƒ"; +const G = ">"; +const GT = ">"; +const Gamma = "Ī“"; +const Gammad = "Ļœ"; +const Gbreve = "Ğ"; +const Gcedil = "Ä¢"; +const Gcirc = "Ĝ"; +const Gcy = "Š“"; +const Gdot = "Ä "; +const Gfr = "š”Š"; +const Gg = "ā‹™"; +const Gopf = "š”¾"; +const GreaterEqual = "ā‰„"; +const GreaterEqualLess = "ā‹›"; +const GreaterFullEqual = "ā‰§"; +const GreaterGreater = "āŖ¢"; +const GreaterLess = "ā‰·"; +const GreaterSlantEqual = "ā©¾"; +const GreaterTilde = "ā‰³"; +const Gscr = "š’¢"; +const Gt = "ā‰«"; +const HARDcy = "ŠŖ"; +const Hacek = "Ė‡"; +const Hat = "^"; +const Hcirc = "Ĥ"; +const Hfr = "ā„Œ"; +const HilbertSpace = "ā„‹"; +const Hopf = "ā„"; +const HorizontalLine = "ā”€"; +const Hscr = "ā„‹"; +const Hstrok = "Ħ"; +const HumpDownHump = "ā‰Ž"; +const HumpEqual = "ā‰"; +const IEcy = "Š•"; +const IJlig = "IJ"; +const IOcy = "Š"; +const Iacut = "ƍ"; +const Iacute = "ƍ"; +const Icir = "Ǝ"; +const Icirc = "Ǝ"; +const Icy = "Š˜"; +const Idot = "Ä°"; +const Ifr = "ā„‘"; +const Igrav = "ƌ"; +const Igrave = "ƌ"; +const Im = "ā„‘"; +const Imacr = "ÄŖ"; +const ImaginaryI = "ā…ˆ"; +const Implies = "ā‡’"; +const Int = "āˆ¬"; +const Integral = "āˆ«"; +const Intersection = "ā‹‚"; +const InvisibleComma = "ā£"; +const InvisibleTimes = "ā¢"; +const Iogon = "Ä®"; +const Iopf = "š•€"; +const Iota = "Ī™"; +const Iscr = "ā„"; +const Itilde = "ÄØ"; +const Iukcy = "Š†"; +const Ium = "Ə"; +const Iuml = "Ə"; +const Jcirc = "Ä“"; +const Jcy = "Š™"; +const Jfr = "š”"; +const Jopf = "š•"; +const Jscr = "š’„"; +const Jsercy = "Šˆ"; +const Jukcy = "Š„"; +const KHcy = "Š„"; +const KJcy = "ŠŒ"; +const Kappa = "Īš"; +const Kcedil = "Ķ"; +const Kcy = "Šš"; +const Kfr = "š”Ž"; +const Kopf = "š•‚"; +const Kscr = "š’¦"; +const LJcy = "Š‰"; +const L = "<"; +const LT = "<"; +const Lacute = "Ĺ"; +const Lambda = "Ī›"; +const Lang = "āŸŖ"; +const Laplacetrf = "ā„’"; +const Larr = "ā†ž"; +const Lcaron = "Ľ"; +const Lcedil = "Ä»"; +const Lcy = "Š›"; +const LeftAngleBracket = "āŸØ"; +const LeftArrow = "ā†"; +const LeftArrowBar = "ā‡¤"; +const LeftArrowRightArrow = "ā‡†"; +const LeftCeiling = "āŒˆ"; +const LeftDoubleBracket = "āŸ¦"; +const LeftDownTeeVector = "ā„”"; +const LeftDownVector = "ā‡ƒ"; +const LeftDownVectorBar = "ā„™"; +const LeftFloor = "āŒŠ"; +const LeftRightArrow = "ā†”"; +const LeftRightVector = "ā„Ž"; +const LeftTee = "āŠ£"; +const LeftTeeArrow = "ā†¤"; +const LeftTeeVector = "ā„š"; +const LeftTriangle = "āŠ²"; +const LeftTriangleBar = "ā§"; +const LeftTriangleEqual = "āŠ“"; +const LeftUpDownVector = "ā„‘"; +const LeftUpTeeVector = "ā„ "; +const LeftUpVector = "ā†æ"; +const LeftUpVectorBar = "ā„˜"; +const LeftVector = "ā†¼"; +const LeftVectorBar = "ā„’"; +const Leftarrow = "ā‡"; +const Leftrightarrow = "ā‡”"; +const LessEqualGreater = "ā‹š"; +const LessFullEqual = "ā‰¦"; +const LessGreater = "ā‰¶"; +const LessLess = "āŖ”"; +const LessSlantEqual = "ā©½"; +const LessTilde = "ā‰²"; +const Lfr = "š”"; +const Ll = "ā‹˜"; +const Lleftarrow = "ā‡š"; +const Lmidot = "Äæ"; +const LongLeftArrow = "āŸµ"; +const LongLeftRightArrow = "āŸ·"; +const LongRightArrow = "āŸ¶"; +const Longleftarrow = "āŸø"; +const Longleftrightarrow = "āŸŗ"; +const Longrightarrow = "āŸ¹"; +const Lopf = "š•ƒ"; +const LowerLeftArrow = "ā†™"; +const LowerRightArrow = "ā†˜"; +const Lscr = "ā„’"; +const Lsh = "ā†°"; +const Lstrok = "Ł"; +const Lt = "ā‰Ŗ"; +const Mcy = "Šœ"; +const MediumSpace = "āŸ"; +const Mellintrf = "ā„³"; +const Mfr = "š”"; +const MinusPlus = "āˆ“"; +const Mopf = "š•„"; +const Mscr = "ā„³"; +const Mu = "Īœ"; +const NJcy = "ŠŠ"; +const Nacute = "Ń"; +const Ncaron = "Ň"; +const Ncedil = "Ņ"; +const Ncy = "Š"; +const NegativeMediumSpace = "ā€‹"; +const NegativeThickSpace = "ā€‹"; +const NegativeThinSpace = "ā€‹"; +const NegativeVeryThinSpace = "ā€‹"; +const NestedGreaterGreater = "ā‰«"; +const NestedLessLess = "ā‰Ŗ"; +const NewLine = "\n"; +const Nfr = "š”‘"; +const NoBreak = "ā "; +const NonBreakingSpace = "Ā "; +const Nopf = "ā„•"; +const Not = "ā«¬"; +const NotCongruent = "ā‰¢"; +const NotCupCap = "ā‰­"; +const NotDoubleVerticalBar = "āˆ¦"; +const NotElement = "āˆ‰"; +const NotEqual = "ā‰ "; +const NotEqualTilde = "ā‰‚Ģø"; +const NotExists = "āˆ„"; +const NotGreater = "ā‰Æ"; +const NotGreaterEqual = "ā‰±"; +const NotGreaterFullEqual = "ā‰§Ģø"; +const NotGreaterGreater = "ā‰«Ģø"; +const NotGreaterLess = "ā‰¹"; +const NotGreaterSlantEqual = "ā©¾Ģø"; +const NotGreaterTilde = "ā‰µ"; +const NotHumpDownHump = "ā‰ŽĢø"; +const NotHumpEqual = "ā‰Ģø"; +const NotLeftTriangle = "ā‹Ŗ"; +const NotLeftTriangleBar = "ā§Ģø"; +const NotLeftTriangleEqual = "ā‹¬"; +const NotLess = "ā‰®"; +const NotLessEqual = "ā‰°"; +const NotLessGreater = "ā‰ø"; +const NotLessLess = "ā‰ŖĢø"; +const NotLessSlantEqual = "ā©½Ģø"; +const NotLessTilde = "ā‰“"; +const NotNestedGreaterGreater = "āŖ¢Ģø"; +const NotNestedLessLess = "āŖ”Ģø"; +const NotPrecedes = "āŠ€"; +const NotPrecedesEqual = "āŖÆĢø"; +const NotPrecedesSlantEqual = "ā‹ "; +const NotReverseElement = "āˆŒ"; +const NotRightTriangle = "ā‹«"; +const NotRightTriangleBar = "ā§Ģø"; +const NotRightTriangleEqual = "ā‹­"; +const NotSquareSubset = "āŠĢø"; +const NotSquareSubsetEqual = "ā‹¢"; +const NotSquareSuperset = "āŠĢø"; +const NotSquareSupersetEqual = "ā‹£"; +const NotSubset = "āŠ‚āƒ’"; +const NotSubsetEqual = "āŠˆ"; +const NotSucceeds = "āŠ"; +const NotSucceedsEqual = "āŖ°Ģø"; +const NotSucceedsSlantEqual = "ā‹”"; +const NotSucceedsTilde = "ā‰æĢø"; +const NotSuperset = "āŠƒāƒ’"; +const NotSupersetEqual = "āŠ‰"; +const NotTilde = "ā‰"; +const NotTildeEqual = "ā‰„"; +const NotTildeFullEqual = "ā‰‡"; +const NotTildeTilde = "ā‰‰"; +const NotVerticalBar = "āˆ¤"; +const Nscr = "š’©"; +const Ntild = "Ƒ"; +const Ntilde = "Ƒ"; +const Nu = "Ī"; +const OElig = "Œ"; +const Oacut = "Ɠ"; +const Oacute = "Ɠ"; +const Ocir = "Ɣ"; +const Ocirc = "Ɣ"; +const Ocy = "Šž"; +const Odblac = "Ő"; +const Ofr = "š”’"; +const Ograv = "ƒ"; +const Ograve = "ƒ"; +const Omacr = "Ō"; +const Omega = "Ī©"; +const Omicron = "ĪŸ"; +const Oopf = "š•†"; +const OpenCurlyDoubleQuote = "ā€œ"; +const OpenCurlyQuote = "ā€˜"; +const Or = "ā©”"; +const Oscr = "š’Ŗ"; +const Oslas = "Ƙ"; +const Oslash = "Ƙ"; +const Otild = "ƕ"; +const Otilde = "ƕ"; +const Otimes = "āØ·"; +const Oum = "Ɩ"; +const Ouml = "Ɩ"; +const OverBar = "ā€¾"; +const OverBrace = "āž"; +const OverBracket = "āŽ“"; +const OverParenthesis = "āœ"; +const PartialD = "āˆ‚"; +const Pcy = "ŠŸ"; +const Pfr = "š”“"; +const Phi = "Ī¦"; +const Pi = "Ī "; +const PlusMinus = "Ā±"; +const Poincareplane = "ā„Œ"; +const Popf = "ā„™"; +const Pr = "āŖ»"; +const Precedes = "ā‰ŗ"; +const PrecedesEqual = "āŖÆ"; +const PrecedesSlantEqual = "ā‰¼"; +const PrecedesTilde = "ā‰¾"; +const Prime = "ā€³"; +const Product = "āˆ"; +const Proportion = "āˆ·"; +const Proportional = "āˆ"; +const Pscr = "š’«"; +const Psi = "ĪØ"; +const QUO = "\""; +const QUOT = "\""; +const Qfr = "š””"; +const Qopf = "ā„š"; +const Qscr = "š’¬"; +const RBarr = "ā¤"; +const RE = "Ā®"; +const REG = "Ā®"; +const Racute = "Ŕ"; +const Rang = "āŸ«"; +const Rarr = "ā† "; +const Rarrtl = "ā¤–"; +const Rcaron = "Ř"; +const Rcedil = "Ŗ"; +const Rcy = "Š "; +const Re = "ā„œ"; +const ReverseElement = "āˆ‹"; +const ReverseEquilibrium = "ā‡‹"; +const ReverseUpEquilibrium = "ā„Æ"; +const Rfr = "ā„œ"; +const Rho = "Ī”"; +const RightAngleBracket = "āŸ©"; +const RightArrow = "ā†’"; +const RightArrowBar = "ā‡„"; +const RightArrowLeftArrow = "ā‡„"; +const RightCeiling = "āŒ‰"; +const RightDoubleBracket = "āŸ§"; +const RightDownTeeVector = "ā„"; +const RightDownVector = "ā‡‚"; +const RightDownVectorBar = "ā„•"; +const RightFloor = "āŒ‹"; +const RightTee = "āŠ¢"; +const RightTeeArrow = "ā†¦"; +const RightTeeVector = "ā„›"; +const RightTriangle = "āŠ³"; +const RightTriangleBar = "ā§"; +const RightTriangleEqual = "āŠµ"; +const RightUpDownVector = "ā„"; +const RightUpTeeVector = "ā„œ"; +const RightUpVector = "ā†¾"; +const RightUpVectorBar = "ā„”"; +const RightVector = "ā‡€"; +const RightVectorBar = "ā„“"; +const Rightarrow = "ā‡’"; +const Ropf = "ā„"; +const RoundImplies = "ā„°"; +const Rrightarrow = "ā‡›"; +const Rscr = "ā„›"; +const Rsh = "ā†±"; +const RuleDelayed = "ā§“"; +const SHCHcy = "Š©"; +const SHcy = "ŠØ"; +const SOFTcy = "Š¬"; +const Sacute = "Ś"; +const Sc = "āŖ¼"; +const Scaron = "Å "; +const Scedil = "Ş"; +const Scirc = "Ŝ"; +const Scy = "Š”"; +const Sfr = "š”–"; +const ShortDownArrow = "ā†“"; +const ShortLeftArrow = "ā†"; +const ShortRightArrow = "ā†’"; +const ShortUpArrow = "ā†‘"; +const Sigma = "Ī£"; +const SmallCircle = "āˆ˜"; +const Sopf = "š•Š"; +const Sqrt = "āˆš"; +const Square = "ā–”"; +const SquareIntersection = "āŠ“"; +const SquareSubset = "āŠ"; +const SquareSubsetEqual = "āŠ‘"; +const SquareSuperset = "āŠ"; +const SquareSupersetEqual = "āŠ’"; +const SquareUnion = "āŠ”"; +const Sscr = "š’®"; +const Star = "ā‹†"; +const Sub = "ā‹"; +const Subset = "ā‹"; +const SubsetEqual = "āŠ†"; +const Succeeds = "ā‰»"; +const SucceedsEqual = "āŖ°"; +const SucceedsSlantEqual = "ā‰½"; +const SucceedsTilde = "ā‰æ"; +const SuchThat = "āˆ‹"; +const Sum = "āˆ‘"; +const Sup = "ā‹‘"; +const Superset = "āŠƒ"; +const SupersetEqual = "āŠ‡"; +const Supset = "ā‹‘"; +const THOR = "ƞ"; +const THORN = "ƞ"; +const TRADE = "ā„¢"; +const TSHcy = "Š‹"; +const TScy = "Š¦"; +const Tab = "\t"; +const Tau = "Ī¤"; +const Tcaron = "Ť"; +const Tcedil = "Å¢"; +const Tcy = "Š¢"; +const Tfr = "š”—"; +const Therefore = "āˆ“"; +const Theta = "Ī˜"; +const ThickSpace = "āŸā€Š"; +const ThinSpace = "ā€‰"; +const Tilde = "āˆ¼"; +const TildeEqual = "ā‰ƒ"; +const TildeFullEqual = "ā‰…"; +const TildeTilde = "ā‰ˆ"; +const Topf = "š•‹"; +const TripleDot = "āƒ›"; +const Tscr = "š’Æ"; +const Tstrok = "Ŧ"; +const Uacut = "ƚ"; +const Uacute = "ƚ"; +const Uarr = "ā†Ÿ"; +const Uarrocir = "ā„‰"; +const Ubrcy = "ŠŽ"; +const Ubreve = "Ŭ"; +const Ucir = "ƛ"; +const Ucirc = "ƛ"; +const Ucy = "Š£"; +const Udblac = "Å°"; +const Ufr = "š”˜"; +const Ugrav = "ƙ"; +const Ugrave = "ƙ"; +const Umacr = "ÅŖ"; +const UnderBar = "_"; +const UnderBrace = "āŸ"; +const UnderBracket = "āŽµ"; +const UnderParenthesis = "ā"; +const Union = "ā‹ƒ"; +const UnionPlus = "āŠŽ"; +const Uogon = "Ų"; +const Uopf = "š•Œ"; +const UpArrow = "ā†‘"; +const UpArrowBar = "ā¤’"; +const UpArrowDownArrow = "ā‡…"; +const UpDownArrow = "ā†•"; +const UpEquilibrium = "ā„®"; +const UpTee = "āŠ„"; +const UpTeeArrow = "ā†„"; +const Uparrow = "ā‡‘"; +const Updownarrow = "ā‡•"; +const UpperLeftArrow = "ā†–"; +const UpperRightArrow = "ā†—"; +const Upsi = "Ļ’"; +const Upsilon = "Ī„"; +const Uring = "Å®"; +const Uscr = "š’°"; +const Utilde = "ÅØ"; +const Uum = "Ɯ"; +const Uuml = "Ɯ"; +const VDash = "āŠ«"; +const Vbar = "ā««"; +const Vcy = "Š’"; +const Vdash = "āŠ©"; +const Vdashl = "ā«¦"; +const Vee = "ā‹"; +const Verbar = "ā€–"; +const Vert = "ā€–"; +const VerticalBar = "āˆ£"; +const VerticalLine = "|"; +const VerticalSeparator = "ā˜"; +const VerticalTilde = "ā‰€"; +const VeryThinSpace = "ā€Š"; +const Vfr = "š”™"; +const Vopf = "š•"; +const Vscr = "š’±"; +const Vvdash = "āŠŖ"; +const Wcirc = "Å“"; +const Wedge = "ā‹€"; +const Wfr = "š”š"; +const Wopf = "š•Ž"; +const Wscr = "š’²"; +const Xfr = "š”›"; +const Xi = "Īž"; +const Xopf = "š•"; +const Xscr = "š’³"; +const YAcy = "ŠÆ"; +const YIcy = "Š‡"; +const YUcy = "Š®"; +const Yacut = "Ɲ"; +const Yacute = "Ɲ"; +const Ycirc = "Ŷ"; +const Ycy = "Š«"; +const Yfr = "š”œ"; +const Yopf = "š•"; +const Yscr = "š’“"; +const Yuml = "Åø"; +const ZHcy = "Š–"; +const Zacute = "Ź"; +const Zcaron = "Ž"; +const Zcy = "Š—"; +const Zdot = "Å»"; +const ZeroWidthSpace = "ā€‹"; +const Zeta = "Ī–"; +const Zfr = "ā„Ø"; +const Zopf = "ā„¤"; +const Zscr = "š’µ"; +const aacut = "Ć”"; +const aacute = "Ć”"; +const abreve = "ă"; +const ac = "āˆ¾"; +const acE = "āˆ¾Ģ³"; +const acd = "āˆæ"; +const acir = "Ć¢"; +const acirc = "Ć¢"; +const acut = "Ā“"; +const acute = "Ā“"; +const acy = "Š°"; +const aeli = "Ʀ"; +const aelig = "Ʀ"; +const af = "ā”"; +const afr = "š”ž"; +const agrav = "Ć "; +const agrave = "Ć "; +const alefsym = "ā„µ"; +const aleph = "ā„µ"; +const alpha = "Ī±"; +const amacr = "ā"; +const amalg = "āØæ"; +const am = "&"; +const amp = "&"; +const and = "āˆ§"; +const andand = "ā©•"; +const andd = "ā©œ"; +const andslope = "ā©˜"; +const andv = "ā©š"; +const ang = "āˆ "; +const ange = "ā¦¤"; +const angle = "āˆ "; +const angmsd = "āˆ”"; +const angmsdaa = "ā¦Ø"; +const angmsdab = "ā¦©"; +const angmsdac = "ā¦Ŗ"; +const angmsdad = "ā¦«"; +const angmsdae = "ā¦¬"; +const angmsdaf = "ā¦­"; +const angmsdag = "ā¦®"; +const angmsdah = "ā¦Æ"; +const angrt = "āˆŸ"; +const angrtvb = "āŠ¾"; +const angrtvbd = "ā¦"; +const angsph = "āˆ¢"; +const angst = "ƅ"; +const angzarr = "ā¼"; +const aogon = "ą"; +const aopf = "š•’"; +const ap = "ā‰ˆ"; +const apE = "ā©°"; +const apacir = "ā©Æ"; +const ape = "ā‰Š"; +const apid = "ā‰‹"; +const apos = "'"; +const approx = "ā‰ˆ"; +const approxeq = "ā‰Š"; +const arin = "Ć„"; +const aring = "Ć„"; +const ascr = "š’¶"; +const ast = "*"; +const asymp = "ā‰ˆ"; +const asympeq = "ā‰"; +const atild = "Ć£"; +const atilde = "Ć£"; +const aum = "Ƥ"; +const auml = "Ƥ"; +const awconint = "āˆ³"; +const awint = "āؑ"; +const bNot = "ā«­"; +const backcong = "ā‰Œ"; +const backepsilon = "Ļ¶"; +const backprime = "ā€µ"; +const backsim = "āˆ½"; +const backsimeq = "ā‹"; +const barvee = "āŠ½"; +const barwed = "āŒ…"; +const barwedge = "āŒ…"; +const bbrk = "āŽµ"; +const bbrktbrk = "āŽ¶"; +const bcong = "ā‰Œ"; +const bcy = "Š±"; +const bdquo = "ā€ž"; +const becaus = "āˆµ"; +const because = "āˆµ"; +const bemptyv = "ā¦°"; +const bepsi = "Ļ¶"; +const bernou = "ā„¬"; +const beta = "Ī²"; +const beth = "ā„¶"; +const between = "ā‰¬"; +const bfr = "š”Ÿ"; +const bigcap = "ā‹‚"; +const bigcirc = "ā—Æ"; +const bigcup = "ā‹ƒ"; +const bigodot = "ā؀"; +const bigoplus = "ā؁"; +const bigotimes = "ā؂"; +const bigsqcup = "ā؆"; +const bigstar = "ā˜…"; +const bigtriangledown = "ā–½"; +const bigtriangleup = "ā–³"; +const biguplus = "ā؄"; +const bigvee = "ā‹"; +const bigwedge = "ā‹€"; +const bkarow = "ā¤"; +const blacklozenge = "ā§«"; +const blacksquare = "ā–Ŗ"; +const blacktriangle = "ā–“"; +const blacktriangledown = "ā–¾"; +const blacktriangleleft = "ā—‚"; +const blacktriangleright = "ā–ø"; +const blank = "ā£"; +const blk12 = "ā–’"; +const blk14 = "ā–‘"; +const blk34 = "ā–“"; +const block = "ā–ˆ"; +const bne = "=āƒ„"; +const bnequiv = "ā‰”āƒ„"; +const bnot = "āŒ"; +const bopf = "š•“"; +const bot = "āŠ„"; +const bottom = "āŠ„"; +const bowtie = "ā‹ˆ"; +const boxDL = "ā•—"; +const boxDR = "ā•”"; +const boxDl = "ā•–"; +const boxDr = "ā•“"; +const boxH = "ā•"; +const boxHD = "ā•¦"; +const boxHU = "ā•©"; +const boxHd = "ā•¤"; +const boxHu = "ā•§"; +const boxUL = "ā•"; +const boxUR = "ā•š"; +const boxUl = "ā•œ"; +const boxUr = "ā•™"; +const boxV = "ā•‘"; +const boxVH = "ā•¬"; +const boxVL = "ā•£"; +const boxVR = "ā• "; +const boxVh = "ā•«"; +const boxVl = "ā•¢"; +const boxVr = "ā•Ÿ"; +const boxbox = "ā§‰"; +const boxdL = "ā••"; +const boxdR = "ā•’"; +const boxdl = "ā”"; +const boxdr = "ā”Œ"; +const boxh = "ā”€"; +const boxhD = "ā•„"; +const boxhU = "ā•Ø"; +const boxhd = "ā”¬"; +const boxhu = "ā”“"; +const boxminus = "āŠŸ"; +const boxplus = "āŠž"; +const boxtimes = "āŠ "; +const boxuL = "ā•›"; +const boxuR = "ā•˜"; +const boxul = "ā”˜"; +const boxur = "ā””"; +const boxv = "ā”‚"; +const boxvH = "ā•Ŗ"; +const boxvL = "ā•”"; +const boxvR = "ā•ž"; +const boxvh = "ā”¼"; +const boxvl = "ā”¤"; +const boxvr = "ā”œ"; +const bprime = "ā€µ"; +const breve = "Ė˜"; +const brvba = "Ā¦"; +const brvbar = "Ā¦"; +const bscr = "š’·"; +const bsemi = "ā"; +const bsim = "āˆ½"; +const bsime = "ā‹"; +const bsol = "\\"; +const bsolb = "ā§…"; +const bsolhsub = "āŸˆ"; +const bull = "ā€¢"; +const bullet = "ā€¢"; +const bump = "ā‰Ž"; +const bumpE = "āŖ®"; +const bumpe = "ā‰"; +const bumpeq = "ā‰"; +const cacute = "ć"; +const cap = "āˆ©"; +const capand = "ā©„"; +const capbrcup = "ā©‰"; +const capcap = "ā©‹"; +const capcup = "ā©‡"; +const capdot = "ā©€"; +const caps = "āˆ©ļø€"; +const caret = "ā"; +const caron = "Ė‡"; +const ccaps = "ā©"; +const ccaron = "č"; +const ccedi = "Ƨ"; +const ccedil = "Ƨ"; +const ccirc = "ĉ"; +const ccups = "ā©Œ"; +const ccupssm = "ā©"; +const cdot = "ċ"; +const cedi = "Āø"; +const cedil = "Āø"; +const cemptyv = "ā¦²"; +const cen = "Ā¢"; +const cent = "Ā¢"; +const centerdot = "Ā·"; +const cfr = "š” "; +const chcy = "ч"; +const check$2 = "āœ“"; +const checkmark = "āœ“"; +const chi = "Ļ‡"; +const cir = "ā—‹"; +const cirE = "ā§ƒ"; +const circ = "Ė†"; +const circeq = "ā‰—"; +const circlearrowleft = "ā†ŗ"; +const circlearrowright = "ā†»"; +const circledR = "Ā®"; +const circledS = "ā“ˆ"; +const circledast = "āŠ›"; +const circledcirc = "āŠš"; +const circleddash = "āŠ"; +const cire = "ā‰—"; +const cirfnint = "āؐ"; +const cirmid = "ā«Æ"; +const cirscir = "ā§‚"; +const clubs = "ā™£"; +const clubsuit = "ā™£"; +const colon = ":"; +const colone = "ā‰”"; +const coloneq = "ā‰”"; +const comma = ","; +const commat = "@"; +const comp = "āˆ"; +const compfn = "āˆ˜"; +const complement = "āˆ"; +const complexes = "ā„‚"; +const cong = "ā‰…"; +const congdot = "ā©­"; +const conint = "āˆ®"; +const copf = "š•”"; +const coprod = "āˆ"; +const cop = "Ā©"; +const copy$1 = "Ā©"; +const copysr = "ā„—"; +const crarr = "ā†µ"; +const cross = "āœ—"; +const cscr = "š’ø"; +const csub = "ā«"; +const csube = "ā«‘"; +const csup = "ā«"; +const csupe = "ā«’"; +const ctdot = "ā‹Æ"; +const cudarrl = "ā¤ø"; +const cudarrr = "ā¤µ"; +const cuepr = "ā‹ž"; +const cuesc = "ā‹Ÿ"; +const cularr = "ā†¶"; +const cularrp = "ā¤½"; +const cup = "āˆŖ"; +const cupbrcap = "ā©ˆ"; +const cupcap = "ā©†"; +const cupcup = "ā©Š"; +const cupdot = "āŠ"; +const cupor = "ā©…"; +const cups = "āˆŖļø€"; +const curarr = "ā†·"; +const curarrm = "ā¤¼"; +const curlyeqprec = "ā‹ž"; +const curlyeqsucc = "ā‹Ÿ"; +const curlyvee = "ā‹Ž"; +const curlywedge = "ā‹"; +const curre = "Ā¤"; +const curren = "Ā¤"; +const curvearrowleft = "ā†¶"; +const curvearrowright = "ā†·"; +const cuvee = "ā‹Ž"; +const cuwed = "ā‹"; +const cwconint = "āˆ²"; +const cwint = "āˆ±"; +const cylcty = "āŒ­"; +const dArr = "ā‡“"; +const dHar = "ā„„"; +const dagger = "ā€ "; +const daleth = "ā„ø"; +const darr = "ā†“"; +const dash = "ā€"; +const dashv = "āŠ£"; +const dbkarow = "ā¤"; +const dblac = "Ė"; +const dcaron = "ď"; +const dcy = "Š“"; +const dd = "ā…†"; +const ddagger = "ā€”"; +const ddarr = "ā‡Š"; +const ddotseq = "ā©·"; +const de = "Ā°"; +const deg = "Ā°"; +const delta = "Ī“"; +const demptyv = "ā¦±"; +const dfisht = "ā„æ"; +const dfr = "š””"; +const dharl = "ā‡ƒ"; +const dharr = "ā‡‚"; +const diam = "ā‹„"; +const diamond = "ā‹„"; +const diamondsuit = "ā™¦"; +const diams = "ā™¦"; +const die = "ĀØ"; +const digamma = "Ļ"; +const disin = "ā‹²"; +const div = "Ć·"; +const divid = "Ć·"; +const divide = "Ć·"; +const divideontimes = "ā‹‡"; +const divonx = "ā‹‡"; +const djcy = "ђ"; +const dlcorn = "āŒž"; +const dlcrop = "āŒ"; +const dollar = "$"; +const dopf = "š••"; +const dot = "Ė™"; +const doteq = "ā‰"; +const doteqdot = "ā‰‘"; +const dotminus = "āˆø"; +const dotplus = "āˆ”"; +const dotsquare = "āŠ”"; +const doublebarwedge = "āŒ†"; +const downarrow = "ā†“"; +const downdownarrows = "ā‡Š"; +const downharpoonleft = "ā‡ƒ"; +const downharpoonright = "ā‡‚"; +const drbkarow = "ā¤"; +const drcorn = "āŒŸ"; +const drcrop = "āŒŒ"; +const dscr = "š’¹"; +const dscy = "ѕ"; +const dsol = "ā§¶"; +const dstrok = "đ"; +const dtdot = "ā‹±"; +const dtri = "ā–æ"; +const dtrif = "ā–¾"; +const duarr = "ā‡µ"; +const duhar = "ā„Æ"; +const dwangle = "ā¦¦"; +const dzcy = "џ"; +const dzigrarr = "āŸæ"; +const eDDot = "ā©·"; +const eDot = "ā‰‘"; +const eacut = "Ć©"; +const eacute = "Ć©"; +const easter = "ā©®"; +const ecaron = "ě"; +const ecir = "ĆŖ"; +const ecirc = "ĆŖ"; +const ecolon = "ā‰•"; +const ecy = "э"; +const edot = "ė"; +const ee = "ā…‡"; +const efDot = "ā‰’"; +const efr = "š”¢"; +const eg = "āŖš"; +const egrav = "ĆØ"; +const egrave = "ĆØ"; +const egs = "āŖ–"; +const egsdot = "āŖ˜"; +const el = "āŖ™"; +const elinters = "ā§"; +const ell = "ā„“"; +const els = "āŖ•"; +const elsdot = "āŖ—"; +const emacr = "ē"; +const empty = "āˆ…"; +const emptyset = "āˆ…"; +const emptyv = "āˆ…"; +const emsp13 = "ā€„"; +const emsp14 = "ā€…"; +const emsp = "ā€ƒ"; +const eng = "ŋ"; +const ensp = "ā€‚"; +const eogon = "ę"; +const eopf = "š•–"; +const epar = "ā‹•"; +const eparsl = "ā§£"; +const eplus = "ā©±"; +const epsi = "Īµ"; +const epsilon = "Īµ"; +const epsiv = "Ļµ"; +const eqcirc = "ā‰–"; +const eqcolon = "ā‰•"; +const eqsim = "ā‰‚"; +const eqslantgtr = "āŖ–"; +const eqslantless = "āŖ•"; +const equals = "="; +const equest = "ā‰Ÿ"; +const equiv = "ā‰”"; +const equivDD = "ā©ø"; +const eqvparsl = "ā§„"; +const erDot = "ā‰“"; +const erarr = "ā„±"; +const escr = "ā„Æ"; +const esdot = "ā‰"; +const esim = "ā‰‚"; +const eta = "Ī·"; +const et = "Ć°"; +const eth = "Ć°"; +const eum = "Ć«"; +const euml = "Ć«"; +const euro = "ā‚¬"; +const excl = "!"; +const exist = "āˆƒ"; +const expectation = "ā„°"; +const exponentiale = "ā…‡"; +const fallingdotseq = "ā‰’"; +const fcy = "ф"; +const female = "ā™€"; +const ffilig = "ļ¬ƒ"; +const fflig = "ļ¬€"; +const ffllig = "ļ¬„"; +const ffr = "š”£"; +const filig = "ļ¬"; +const fjlig = "fj"; +const flat = "ā™­"; +const fllig = "ļ¬‚"; +const fltns = "ā–±"; +const fnof = "ʒ"; +const fopf = "š•—"; +const forall = "āˆ€"; +const fork = "ā‹”"; +const forkv = "ā«™"; +const fpartint = "ā؍"; +const frac1 = "Ā¼"; +const frac12 = "Ā½"; +const frac13 = "ā…“"; +const frac14 = "Ā¼"; +const frac15 = "ā…•"; +const frac16 = "ā…™"; +const frac18 = "ā…›"; +const frac23 = "ā…”"; +const frac25 = "ā…–"; +const frac3 = "Ā¾"; +const frac34 = "Ā¾"; +const frac35 = "ā…—"; +const frac38 = "ā…œ"; +const frac45 = "ā…˜"; +const frac56 = "ā…š"; +const frac58 = "ā…"; +const frac78 = "ā…ž"; +const frasl = "ā„"; +const frown = "āŒ¢"; +const fscr = "š’»"; +const gE = "ā‰§"; +const gEl = "āŖŒ"; +const gacute = "Ēµ"; +const gamma = "Ī³"; +const gammad = "Ļ"; +const gap = "āŖ†"; +const gbreve = "ğ"; +const gcirc = "ĝ"; +const gcy = "Š³"; +const gdot = "Ä”"; +const ge = "ā‰„"; +const gel = "ā‹›"; +const geq = "ā‰„"; +const geqq = "ā‰§"; +const geqslant = "ā©¾"; +const ges = "ā©¾"; +const gescc = "āŖ©"; +const gesdot = "āŖ€"; +const gesdoto = "āŖ‚"; +const gesdotol = "āŖ„"; +const gesl = "ā‹›ļø€"; +const gesles = "āŖ”"; +const gfr = "š”¤"; +const gg = "ā‰«"; +const ggg = "ā‹™"; +const gimel = "ā„·"; +const gjcy = "ѓ"; +const gl = "ā‰·"; +const glE = "āŖ’"; +const gla = "āŖ„"; +const glj = "āŖ¤"; +const gnE = "ā‰©"; +const gnap = "āŖŠ"; +const gnapprox = "āŖŠ"; +const gne = "āŖˆ"; +const gneq = "āŖˆ"; +const gneqq = "ā‰©"; +const gnsim = "ā‹§"; +const gopf = "š•˜"; +const grave = "`"; +const gscr = "ā„Š"; +const gsim = "ā‰³"; +const gsime = "āŖŽ"; +const gsiml = "āŖ"; +const g = ">"; +const gt = ">"; +const gtcc = "āŖ§"; +const gtcir = "ā©ŗ"; +const gtdot = "ā‹—"; +const gtlPar = "ā¦•"; +const gtquest = "ā©¼"; +const gtrapprox = "āŖ†"; +const gtrarr = "ā„ø"; +const gtrdot = "ā‹—"; +const gtreqless = "ā‹›"; +const gtreqqless = "āŖŒ"; +const gtrless = "ā‰·"; +const gtrsim = "ā‰³"; +const gvertneqq = "ā‰©ļø€"; +const gvnE = "ā‰©ļø€"; +const hArr = "ā‡”"; +const hairsp = "ā€Š"; +const half = "Ā½"; +const hamilt = "ā„‹"; +const hardcy = "ъ"; +const harr = "ā†”"; +const harrcir = "ā„ˆ"; +const harrw = "ā†­"; +const hbar = "ā„"; +const hcirc = "Ä„"; +const hearts = "ā™„"; +const heartsuit = "ā™„"; +const hellip = "ā€¦"; +const hercon = "āŠ¹"; +const hfr = "š”„"; +const hksearow = "ā¤„"; +const hkswarow = "ā¤¦"; +const hoarr = "ā‡æ"; +const homtht = "āˆ»"; +const hookleftarrow = "ā†©"; +const hookrightarrow = "ā†Ŗ"; +const hopf = "š•™"; +const horbar = "ā€•"; +const hscr = "š’½"; +const hslash = "ā„"; +const hstrok = "ħ"; +const hybull = "āƒ"; +const hyphen = "ā€"; +const iacut = "Ć­"; +const iacute = "Ć­"; +const ic = "ā£"; +const icir = "Ć®"; +const icirc = "Ć®"; +const icy = "Šø"; +const iecy = "Šµ"; +const iexc = "Ā”"; +const iexcl = "Ā”"; +const iff = "ā‡”"; +const ifr = "š”¦"; +const igrav = "Ƭ"; +const igrave = "Ƭ"; +const ii = "ā…ˆ"; +const iiiint = "ā،"; +const iiint = "āˆ­"; +const iinfin = "ā§œ"; +const iiota = "ā„©"; +const ijlig = "ij"; +const imacr = "Ä«"; +const image = "ā„‘"; +const imagline = "ā„"; +const imagpart = "ā„‘"; +const imath = "ı"; +const imof = "āŠ·"; +const imped = "ʵ"; +const incare = "ā„…"; +const infin = "āˆž"; +const infintie = "ā§"; +const inodot = "ı"; +const int$1 = "āˆ«"; +const intcal = "āŠŗ"; +const integers = "ā„¤"; +const intercal = "āŠŗ"; +const intlarhk = "āؗ"; +const intprod = "āؼ"; +const iocy = "ё"; +const iogon = "ÄÆ"; +const iopf = "š•š"; +const iota = "Ī¹"; +const iprod = "āؼ"; +const iques = "Āæ"; +const iquest = "Āæ"; +const iscr = "š’¾"; +const isin = "āˆˆ"; +const isinE = "ā‹¹"; +const isindot = "ā‹µ"; +const isins = "ā‹“"; +const isinsv = "ā‹³"; +const isinv = "āˆˆ"; +const it = "ā¢"; +const itilde = "Ä©"; +const iukcy = "і"; +const ium = "ĆÆ"; +const iuml = "ĆÆ"; +const jcirc = "ĵ"; +const jcy = "Š¹"; +const jfr = "š”§"; +const jmath = "Č·"; +const jopf = "š•›"; +const jscr = "š’æ"; +const jsercy = "ј"; +const jukcy = "є"; +const kappa = "Īŗ"; +const kappav = "Ļ°"; +const kcedil = "Ä·"; +const kcy = "Šŗ"; +const kfr = "š”Ø"; +const kgreen = "Äø"; +const khcy = "х"; +const kjcy = "ќ"; +const kopf = "š•œ"; +const kscr = "š“€"; +const lAarr = "ā‡š"; +const lArr = "ā‡"; +const lAtail = "ā¤›"; +const lBarr = "ā¤Ž"; +const lE = "ā‰¦"; +const lEg = "āŖ‹"; +const lHar = "ā„¢"; +const lacute = "Äŗ"; +const laemptyv = "ā¦“"; +const lagran = "ā„’"; +const lambda = "Ī»"; +const lang = "āŸØ"; +const langd = "ā¦‘"; +const langle = "āŸØ"; +const lap = "āŖ…"; +const laqu = "Ā«"; +const laquo = "Ā«"; +const larr = "ā†"; +const larrb = "ā‡¤"; +const larrbfs = "ā¤Ÿ"; +const larrfs = "ā¤"; +const larrhk = "ā†©"; +const larrlp = "ā†«"; +const larrpl = "ā¤¹"; +const larrsim = "ā„³"; +const larrtl = "ā†¢"; +const lat = "āŖ«"; +const latail = "ā¤™"; +const late = "āŖ­"; +const lates = "āŖ­ļø€"; +const lbarr = "ā¤Œ"; +const lbbrk = "ā²"; +const lbrace = "{"; +const lbrack = "["; +const lbrke = "ā¦‹"; +const lbrksld = "ā¦"; +const lbrkslu = "ā¦"; +const lcaron = "ľ"; +const lcedil = "ļ"; +const lceil = "āŒˆ"; +const lcub = "{"; +const lcy = "Š»"; +const ldca = "ā¤¶"; +const ldquo = "ā€œ"; +const ldquor = "ā€ž"; +const ldrdhar = "ā„§"; +const ldrushar = "ā„‹"; +const ldsh = "ā†²"; +const le = "ā‰¤"; +const leftarrow = "ā†"; +const leftarrowtail = "ā†¢"; +const leftharpoondown = "ā†½"; +const leftharpoonup = "ā†¼"; +const leftleftarrows = "ā‡‡"; +const leftrightarrow = "ā†”"; +const leftrightarrows = "ā‡†"; +const leftrightharpoons = "ā‡‹"; +const leftrightsquigarrow = "ā†­"; +const leftthreetimes = "ā‹‹"; +const leg = "ā‹š"; +const leq = "ā‰¤"; +const leqq = "ā‰¦"; +const leqslant = "ā©½"; +const les = "ā©½"; +const lescc = "āŖØ"; +const lesdot = "ā©æ"; +const lesdoto = "āŖ"; +const lesdotor = "āŖƒ"; +const lesg = "ā‹šļø€"; +const lesges = "āŖ“"; +const lessapprox = "āŖ…"; +const lessdot = "ā‹–"; +const lesseqgtr = "ā‹š"; +const lesseqqgtr = "āŖ‹"; +const lessgtr = "ā‰¶"; +const lesssim = "ā‰²"; +const lfisht = "ā„¼"; +const lfloor = "āŒŠ"; +const lfr = "š”©"; +const lg = "ā‰¶"; +const lgE = "āŖ‘"; +const lhard = "ā†½"; +const lharu = "ā†¼"; +const lharul = "ā„Ŗ"; +const lhblk = "ā–„"; +const ljcy = "љ"; +const ll = "ā‰Ŗ"; +const llarr = "ā‡‡"; +const llcorner = "āŒž"; +const llhard = "ā„«"; +const lltri = "ā—ŗ"; +const lmidot = "ŀ"; +const lmoust = "āŽ°"; +const lmoustache = "āŽ°"; +const lnE = "ā‰Ø"; +const lnap = "āŖ‰"; +const lnapprox = "āŖ‰"; +const lne = "āŖ‡"; +const lneq = "āŖ‡"; +const lneqq = "ā‰Ø"; +const lnsim = "ā‹¦"; +const loang = "āŸ¬"; +const loarr = "ā‡½"; +const lobrk = "āŸ¦"; +const longleftarrow = "āŸµ"; +const longleftrightarrow = "āŸ·"; +const longmapsto = "āŸ¼"; +const longrightarrow = "āŸ¶"; +const looparrowleft = "ā†«"; +const looparrowright = "ā†¬"; +const lopar = "ā¦…"; +const lopf = "š•"; +const loplus = "āØ­"; +const lotimes = "āØ“"; +const lowast = "āˆ—"; +const lowbar = "_"; +const loz = "ā—Š"; +const lozenge = "ā—Š"; +const lozf = "ā§«"; +const lpar = "("; +const lparlt = "ā¦“"; +const lrarr = "ā‡†"; +const lrcorner = "āŒŸ"; +const lrhar = "ā‡‹"; +const lrhard = "ā„­"; +const lrm = "ā€Ž"; +const lrtri = "āŠæ"; +const lsaquo = "ā€¹"; +const lscr = "š“"; +const lsh = "ā†°"; +const lsim = "ā‰²"; +const lsime = "āŖ"; +const lsimg = "āŖ"; +const lsqb = "["; +const lsquo = "ā€˜"; +const lsquor = "ā€š"; +const lstrok = "ł"; +const l = "<"; +const lt = "<"; +const ltcc = "āŖ¦"; +const ltcir = "ā©¹"; +const ltdot = "ā‹–"; +const lthree = "ā‹‹"; +const ltimes = "ā‹‰"; +const ltlarr = "ā„¶"; +const ltquest = "ā©»"; +const ltrPar = "ā¦–"; +const ltri = "ā—ƒ"; +const ltrie = "āŠ“"; +const ltrif = "ā—‚"; +const lurdshar = "ā„Š"; +const luruhar = "ā„¦"; +const lvertneqq = "ā‰Øļø€"; +const lvnE = "ā‰Øļø€"; +const mDDot = "āˆŗ"; +const mac = "ĀÆ"; +const macr = "ĀÆ"; +const male = "ā™‚"; +const malt = "āœ "; +const maltese = "āœ "; +const map$2 = "ā†¦"; +const mapsto = "ā†¦"; +const mapstodown = "ā†§"; +const mapstoleft = "ā†¤"; +const mapstoup = "ā†„"; +const marker = "ā–®"; +const mcomma = "āØ©"; +const mcy = "Š¼"; +const mdash = "ā€”"; +const measuredangle = "āˆ”"; +const mfr = "š”Ŗ"; +const mho = "ā„§"; +const micr = "Āµ"; +const micro = "Āµ"; +const mid = "āˆ£"; +const midast = "*"; +const midcir = "ā«°"; +const middo = "Ā·"; +const middot = "Ā·"; +const minus = "āˆ’"; +const minusb = "āŠŸ"; +const minusd = "āˆø"; +const minusdu = "āØŖ"; +const mlcp = "ā«›"; +const mldr = "ā€¦"; +const mnplus = "āˆ“"; +const models$2 = "āŠ§"; +const mopf = "š•ž"; +const mp = "āˆ“"; +const mscr = "š“‚"; +const mstpos = "āˆ¾"; +const mu = "Ī¼"; +const multimap = "āŠø"; +const mumap = "āŠø"; +const nGg = "ā‹™Ģø"; +const nGt = "ā‰«āƒ’"; +const nGtv = "ā‰«Ģø"; +const nLeftarrow = "ā‡"; +const nLeftrightarrow = "ā‡Ž"; +const nLl = "ā‹˜Ģø"; +const nLt = "ā‰Ŗāƒ’"; +const nLtv = "ā‰ŖĢø"; +const nRightarrow = "ā‡"; +const nVDash = "āŠÆ"; +const nVdash = "āŠ®"; +const nabla = "āˆ‡"; +const nacute = "ń"; +const nang = "āˆ āƒ’"; +const nap = "ā‰‰"; +const napE = "ā©°Ģø"; +const napid = "ā‰‹Ģø"; +const napos = "ʼn"; +const napprox = "ā‰‰"; +const natur = "ā™®"; +const natural = "ā™®"; +const naturals = "ā„•"; +const nbs = "Ā "; +const nbsp = "Ā "; +const nbump = "ā‰ŽĢø"; +const nbumpe = "ā‰Ģø"; +const ncap = "ā©ƒ"; +const ncaron = "ň"; +const ncedil = "ņ"; +const ncong = "ā‰‡"; +const ncongdot = "ā©­Ģø"; +const ncup = "ā©‚"; +const ncy = "Š½"; +const ndash = "ā€“"; +const ne = "ā‰ "; +const neArr = "ā‡—"; +const nearhk = "ā¤¤"; +const nearr = "ā†—"; +const nearrow = "ā†—"; +const nedot = "ā‰Ģø"; +const nequiv = "ā‰¢"; +const nesear = "ā¤Ø"; +const nesim = "ā‰‚Ģø"; +const nexist = "āˆ„"; +const nexists = "āˆ„"; +const nfr = "š”«"; +const ngE = "ā‰§Ģø"; +const nge = "ā‰±"; +const ngeq = "ā‰±"; +const ngeqq = "ā‰§Ģø"; +const ngeqslant = "ā©¾Ģø"; +const nges = "ā©¾Ģø"; +const ngsim = "ā‰µ"; +const ngt = "ā‰Æ"; +const ngtr = "ā‰Æ"; +const nhArr = "ā‡Ž"; +const nharr = "ā†®"; +const nhpar = "ā«²"; +const ni = "āˆ‹"; +const nis = "ā‹¼"; +const nisd = "ā‹ŗ"; +const niv = "āˆ‹"; +const njcy = "њ"; +const nlArr = "ā‡"; +const nlE = "ā‰¦Ģø"; +const nlarr = "ā†š"; +const nldr = "ā€„"; +const nle = "ā‰°"; +const nleftarrow = "ā†š"; +const nleftrightarrow = "ā†®"; +const nleq = "ā‰°"; +const nleqq = "ā‰¦Ģø"; +const nleqslant = "ā©½Ģø"; +const nles = "ā©½Ģø"; +const nless = "ā‰®"; +const nlsim = "ā‰“"; +const nlt = "ā‰®"; +const nltri = "ā‹Ŗ"; +const nltrie = "ā‹¬"; +const nmid = "āˆ¤"; +const nopf = "š•Ÿ"; +const no = "Ā¬"; +const not = "Ā¬"; +const notin = "āˆ‰"; +const notinE = "ā‹¹Ģø"; +const notindot = "ā‹µĢø"; +const notinva = "āˆ‰"; +const notinvb = "ā‹·"; +const notinvc = "ā‹¶"; +const notni = "āˆŒ"; +const notniva = "āˆŒ"; +const notnivb = "ā‹¾"; +const notnivc = "ā‹½"; +const npar = "āˆ¦"; +const nparallel = "āˆ¦"; +const nparsl = "ā«½āƒ„"; +const npart = "āˆ‚Ģø"; +const npolint = "āؔ"; +const npr = "āŠ€"; +const nprcue = "ā‹ "; +const npre = "āŖÆĢø"; +const nprec = "āŠ€"; +const npreceq = "āŖÆĢø"; +const nrArr = "ā‡"; +const nrarr = "ā†›"; +const nrarrc = "ā¤³Ģø"; +const nrarrw = "ā†Ģø"; +const nrightarrow = "ā†›"; +const nrtri = "ā‹«"; +const nrtrie = "ā‹­"; +const nsc = "āŠ"; +const nsccue = "ā‹”"; +const nsce = "āŖ°Ģø"; +const nscr = "š“ƒ"; +const nshortmid = "āˆ¤"; +const nshortparallel = "āˆ¦"; +const nsim = "ā‰"; +const nsime = "ā‰„"; +const nsimeq = "ā‰„"; +const nsmid = "āˆ¤"; +const nspar = "āˆ¦"; +const nsqsube = "ā‹¢"; +const nsqsupe = "ā‹£"; +const nsub = "āŠ„"; +const nsubE = "ā«…Ģø"; +const nsube = "āŠˆ"; +const nsubset = "āŠ‚āƒ’"; +const nsubseteq = "āŠˆ"; +const nsubseteqq = "ā«…Ģø"; +const nsucc = "āŠ"; +const nsucceq = "āŖ°Ģø"; +const nsup = "āŠ…"; +const nsupE = "ā«†Ģø"; +const nsupe = "āŠ‰"; +const nsupset = "āŠƒāƒ’"; +const nsupseteq = "āŠ‰"; +const nsupseteqq = "ā«†Ģø"; +const ntgl = "ā‰¹"; +const ntild = "Ʊ"; +const ntilde = "Ʊ"; +const ntlg = "ā‰ø"; +const ntriangleleft = "ā‹Ŗ"; +const ntrianglelefteq = "ā‹¬"; +const ntriangleright = "ā‹«"; +const ntrianglerighteq = "ā‹­"; +const nu = "Ī½"; +const num = "#"; +const numero = "ā„–"; +const numsp = "ā€‡"; +const nvDash = "āŠ­"; +const nvHarr = "ā¤„"; +const nvap = "ā‰āƒ’"; +const nvdash = "āŠ¬"; +const nvge = "ā‰„āƒ’"; +const nvgt = ">āƒ’"; +const nvinfin = "ā§ž"; +const nvlArr = "ā¤‚"; +const nvle = "ā‰¤āƒ’"; +const nvlt = "<āƒ’"; +const nvltrie = "āŠ“āƒ’"; +const nvrArr = "ā¤ƒ"; +const nvrtrie = "āŠµāƒ’"; +const nvsim = "āˆ¼āƒ’"; +const nwArr = "ā‡–"; +const nwarhk = "ā¤£"; +const nwarr = "ā†–"; +const nwarrow = "ā†–"; +const nwnear = "ā¤§"; +const oS = "ā“ˆ"; +const oacut = "Ć³"; +const oacute = "Ć³"; +const oast = "āŠ›"; +const ocir = "Ć“"; +const ocirc = "Ć“"; +const ocy = "Š¾"; +const odash = "āŠ"; +const odblac = "ő"; +const odiv = "āØø"; +const odot = "āŠ™"; +const odsold = "ā¦¼"; +const oelig = "œ"; +const ofcir = "ā¦æ"; +const ofr = "š”¬"; +const ogon = "Ė›"; +const ograv = "Ć²"; +const ograve = "Ć²"; +const ogt = "ā§"; +const ohbar = "ā¦µ"; +const ohm = "Ī©"; +const oint = "āˆ®"; +const olarr = "ā†ŗ"; +const olcir = "ā¦¾"; +const olcross = "ā¦»"; +const oline = "ā€¾"; +const olt = "ā§€"; +const omacr = "ō"; +const omega = "Ļ‰"; +const omicron = "Īæ"; +const omid = "ā¦¶"; +const ominus = "āŠ–"; +const oopf = "š• "; +const opar = "ā¦·"; +const operp = "ā¦¹"; +const oplus = "āŠ•"; +const or = "āˆØ"; +const orarr = "ā†»"; +const ord = "Āŗ"; +const order$1 = "ā„“"; +const orderof = "ā„“"; +const ordf = "ĀŖ"; +const ordm = "Āŗ"; +const origof = "āŠ¶"; +const oror = "ā©–"; +const orslope = "ā©—"; +const orv = "ā©›"; +const oscr = "ā„“"; +const oslas = "Ćø"; +const oslash = "Ćø"; +const osol = "āŠ˜"; +const otild = "Ƶ"; +const otilde = "Ƶ"; +const otimes = "āŠ—"; +const otimesas = "āض"; +const oum = "ƶ"; +const ouml = "ƶ"; +const ovbar = "āŒ½"; +const par = "Ā¶"; +const para = "Ā¶"; +const parallel = "āˆ„"; +const parsim = "ā«³"; +const parsl = "ā«½"; +const part = "āˆ‚"; +const pcy = "Šæ"; +const percnt = "%"; +const period = "."; +const permil = "ā€°"; +const perp = "āŠ„"; +const pertenk = "ā€±"; +const pfr = "š”­"; +const phi = "Ļ†"; +const phiv = "Ļ•"; +const phmmat = "ā„³"; +const phone = "ā˜Ž"; +const pi = "Ļ€"; +const pitchfork = "ā‹”"; +const piv = "Ļ–"; +const planck = "ā„"; +const planckh = "ā„Ž"; +const plankv = "ā„"; +const plus = "+"; +const plusacir = "āØ£"; +const plusb = "āŠž"; +const pluscir = "āØ¢"; +const plusdo = "āˆ”"; +const plusdu = "āØ„"; +const pluse = "ā©²"; +const plusm = "Ā±"; +const plusmn = "Ā±"; +const plussim = "āئ"; +const plustwo = "āا"; +const pm = "Ā±"; +const pointint = "āؕ"; +const popf = "š•”"; +const poun = "Ā£"; +const pound = "Ā£"; +const pr = "ā‰ŗ"; +const prE = "āŖ³"; +const prap = "āŖ·"; +const prcue = "ā‰¼"; +const pre = "āŖÆ"; +const prec = "ā‰ŗ"; +const precapprox = "āŖ·"; +const preccurlyeq = "ā‰¼"; +const preceq = "āŖÆ"; +const precnapprox = "āŖ¹"; +const precneqq = "āŖµ"; +const precnsim = "ā‹Ø"; +const precsim = "ā‰¾"; +const prime = "ā€²"; +const primes = "ā„™"; +const prnE = "āŖµ"; +const prnap = "āŖ¹"; +const prnsim = "ā‹Ø"; +const prod = "āˆ"; +const profalar = "āŒ®"; +const profline = "āŒ’"; +const profsurf = "āŒ“"; +const prop = "āˆ"; +const propto = "āˆ"; +const prsim = "ā‰¾"; +const prurel = "āŠ°"; +const pscr = "š“…"; +const psi = "Ļˆ"; +const puncsp = "ā€ˆ"; +const qfr = "š”®"; +const qint = "ā،"; +const qopf = "š•¢"; +const qprime = "ā—"; +const qscr = "š“†"; +const quaternions = "ā„"; +const quatint = "āؖ"; +const quest = "?"; +const questeq = "ā‰Ÿ"; +const quo = "\""; +const quot = "\""; +const rAarr = "ā‡›"; +const rArr = "ā‡’"; +const rAtail = "ā¤œ"; +const rBarr = "ā¤"; +const rHar = "ā„¤"; +const race = "āˆ½Ģ±"; +const racute = "ŕ"; +const radic = "āˆš"; +const raemptyv = "ā¦³"; +const rang = "āŸ©"; +const rangd = "ā¦’"; +const range$1 = "ā¦„"; +const rangle = "āŸ©"; +const raqu = "Ā»"; +const raquo = "Ā»"; +const rarr = "ā†’"; +const rarrap = "ā„µ"; +const rarrb = "ā‡„"; +const rarrbfs = "ā¤ "; +const rarrc = "ā¤³"; +const rarrfs = "ā¤ž"; +const rarrhk = "ā†Ŗ"; +const rarrlp = "ā†¬"; +const rarrpl = "ā„…"; +const rarrsim = "ā„“"; +const rarrtl = "ā†£"; +const rarrw = "ā†"; +const ratail = "ā¤š"; +const ratio = "āˆ¶"; +const rationals = "ā„š"; +const rbarr = "ā¤"; +const rbbrk = "ā³"; +const rbrace = "}"; +const rbrack = "]"; +const rbrke = "ā¦Œ"; +const rbrksld = "ā¦Ž"; +const rbrkslu = "ā¦"; +const rcaron = "ř"; +const rcedil = "ŗ"; +const rceil = "āŒ‰"; +const rcub = "}"; +const rcy = "р"; +const rdca = "ā¤·"; +const rdldhar = "ā„©"; +const rdquo = "ā€"; +const rdquor = "ā€"; +const rdsh = "ā†³"; +const real = "ā„œ"; +const realine = "ā„›"; +const realpart = "ā„œ"; +const reals = "ā„"; +const rect = "ā–­"; +const re = "Ā®"; +const reg = "Ā®"; +const rfisht = "ā„½"; +const rfloor = "āŒ‹"; +const rfr = "š”Æ"; +const rhard = "ā‡"; +const rharu = "ā‡€"; +const rharul = "ā„¬"; +const rho = "Ļ"; +const rhov = "Ļ±"; +const rightarrow = "ā†’"; +const rightarrowtail = "ā†£"; +const rightharpoondown = "ā‡"; +const rightharpoonup = "ā‡€"; +const rightleftarrows = "ā‡„"; +const rightleftharpoons = "ā‡Œ"; +const rightrightarrows = "ā‡‰"; +const rightsquigarrow = "ā†"; +const rightthreetimes = "ā‹Œ"; +const ring = "Ėš"; +const risingdotseq = "ā‰“"; +const rlarr = "ā‡„"; +const rlhar = "ā‡Œ"; +const rlm = "ā€"; +const rmoust = "āŽ±"; +const rmoustache = "āŽ±"; +const rnmid = "ā«®"; +const roang = "āŸ­"; +const roarr = "ā‡¾"; +const robrk = "āŸ§"; +const ropar = "ā¦†"; +const ropf = "š•£"; +const roplus = "āØ®"; +const rotimes = "āص"; +const rpar = ")"; +const rpargt = "ā¦”"; +const rppolint = "āؒ"; +const rrarr = "ā‡‰"; +const rsaquo = "ā€ŗ"; +const rscr = "š“‡"; +const rsh = "ā†±"; +const rsqb = "]"; +const rsquo = "ā€™"; +const rsquor = "ā€™"; +const rthree = "ā‹Œ"; +const rtimes = "ā‹Š"; +const rtri = "ā–¹"; +const rtrie = "āŠµ"; +const rtrif = "ā–ø"; +const rtriltri = "ā§Ž"; +const ruluhar = "ā„Ø"; +const rx = "ā„ž"; +const sacute = "ś"; +const sbquo = "ā€š"; +const sc = "ā‰»"; +const scE = "āŖ“"; +const scap = "āŖø"; +const scaron = "Å”"; +const sccue = "ā‰½"; +const sce = "āŖ°"; +const scedil = "ş"; +const scirc = "ŝ"; +const scnE = "āŖ¶"; +const scnap = "āŖŗ"; +const scnsim = "ā‹©"; +const scpolint = "āؓ"; +const scsim = "ā‰æ"; +const scy = "с"; +const sdot = "ā‹…"; +const sdotb = "āŠ”"; +const sdote = "ā©¦"; +const seArr = "ā‡˜"; +const searhk = "ā¤„"; +const searr = "ā†˜"; +const searrow = "ā†˜"; +const sec = "Ā§"; +const sect = "Ā§"; +const semi = ";"; +const seswar = "ā¤©"; +const setminus = "āˆ–"; +const setmn = "āˆ–"; +const sext = "āœ¶"; +const sfr = "š”°"; +const sfrown = "āŒ¢"; +const sharp = "ā™Æ"; +const shchcy = "щ"; +const shcy = "ш"; +const shortmid = "āˆ£"; +const shortparallel = "āˆ„"; +const sh = "Ā­"; +const shy = "Ā­"; +const sigma = "Ļƒ"; +const sigmaf = "Ļ‚"; +const sigmav = "Ļ‚"; +const sim = "āˆ¼"; +const simdot = "ā©Ŗ"; +const sime = "ā‰ƒ"; +const simeq = "ā‰ƒ"; +const simg = "āŖž"; +const simgE = "āŖ "; +const siml = "āŖ"; +const simlE = "āŖŸ"; +const simne = "ā‰†"; +const simplus = "āؤ"; +const simrarr = "ā„²"; +const slarr = "ā†"; +const smallsetminus = "āˆ–"; +const smashp = "āس"; +const smeparsl = "ā§¤"; +const smid = "āˆ£"; +const smile = "āŒ£"; +const smt = "āŖŖ"; +const smte = "āŖ¬"; +const smtes = "āŖ¬ļø€"; +const softcy = "ь"; +const sol = "/"; +const solb = "ā§„"; +const solbar = "āŒæ"; +const sopf = "š•¤"; +const spades = "ā™ "; +const spadesuit = "ā™ "; +const spar = "āˆ„"; +const sqcap = "āŠ“"; +const sqcaps = "āŠ“ļø€"; +const sqcup = "āŠ”"; +const sqcups = "āŠ”ļø€"; +const sqsub = "āŠ"; +const sqsube = "āŠ‘"; +const sqsubset = "āŠ"; +const sqsubseteq = "āŠ‘"; +const sqsup = "āŠ"; +const sqsupe = "āŠ’"; +const sqsupset = "āŠ"; +const sqsupseteq = "āŠ’"; +const squ = "ā–”"; +const square = "ā–”"; +const squarf = "ā–Ŗ"; +const squf = "ā–Ŗ"; +const srarr = "ā†’"; +const sscr = "š“ˆ"; +const ssetmn = "āˆ–"; +const ssmile = "āŒ£"; +const sstarf = "ā‹†"; +const star$1 = "ā˜†"; +const starf = "ā˜…"; +const straightepsilon = "Ļµ"; +const straightphi = "Ļ•"; +const strns = "ĀÆ"; +const sub = "āŠ‚"; +const subE = "ā«…"; +const subdot = "āŖ½"; +const sube = "āŠ†"; +const subedot = "ā«ƒ"; +const submult = "ā«"; +const subnE = "ā«‹"; +const subne = "āŠŠ"; +const subplus = "āŖæ"; +const subrarr = "ā„¹"; +const subset = "āŠ‚"; +const subseteq = "āŠ†"; +const subseteqq = "ā«…"; +const subsetneq = "āŠŠ"; +const subsetneqq = "ā«‹"; +const subsim = "ā«‡"; +const subsub = "ā«•"; +const subsup = "ā«“"; +const succ = "ā‰»"; +const succapprox = "āŖø"; +const succcurlyeq = "ā‰½"; +const succeq = "āŖ°"; +const succnapprox = "āŖŗ"; +const succneqq = "āŖ¶"; +const succnsim = "ā‹©"; +const succsim = "ā‰æ"; +const sum = "āˆ‘"; +const sung = "ā™Ŗ"; +const sup = "āŠƒ"; +const sup1 = "Ā¹"; +const sup2 = "Ā²"; +const sup3 = "Ā³"; +const supE = "ā«†"; +const supdot = "āŖ¾"; +const supdsub = "ā«˜"; +const supe = "āŠ‡"; +const supedot = "ā«„"; +const suphsol = "āŸ‰"; +const suphsub = "ā«—"; +const suplarr = "ā„»"; +const supmult = "ā«‚"; +const supnE = "ā«Œ"; +const supne = "āŠ‹"; +const supplus = "ā«€"; +const supset = "āŠƒ"; +const supseteq = "āŠ‡"; +const supseteqq = "ā«†"; +const supsetneq = "āŠ‹"; +const supsetneqq = "ā«Œ"; +const supsim = "ā«ˆ"; +const supsub = "ā«”"; +const supsup = "ā«–"; +const swArr = "ā‡™"; +const swarhk = "ā¤¦"; +const swarr = "ā†™"; +const swarrow = "ā†™"; +const swnwar = "ā¤Ŗ"; +const szli = "Ɵ"; +const szlig = "Ɵ"; +const target = "āŒ–"; +const tau = "Ļ„"; +const tbrk = "āŽ“"; +const tcaron = "Å„"; +const tcedil = "Å£"; +const tcy = "т"; +const tdot = "āƒ›"; +const telrec = "āŒ•"; +const tfr = "š”±"; +const there4 = "āˆ“"; +const therefore = "āˆ“"; +const theta = "Īø"; +const thetasym = "Ļ‘"; +const thetav = "Ļ‘"; +const thickapprox = "ā‰ˆ"; +const thicksim = "āˆ¼"; +const thinsp = "ā€‰"; +const thkap = "ā‰ˆ"; +const thksim = "āˆ¼"; +const thor = "Ć¾"; +const thorn = "Ć¾"; +const tilde = "Ėœ"; +const time = "Ɨ"; +const times = "Ɨ"; +const timesb = "āŠ "; +const timesbar = "āر"; +const timesd = "āØ°"; +const tint = "āˆ­"; +const toea = "ā¤Ø"; +const top = "āŠ¤"; +const topbot = "āŒ¶"; +const topcir = "ā«±"; +const topf = "š•„"; +const topfork = "ā«š"; +const tosa = "ā¤©"; +const tprime = "ā€“"; +const trade = "ā„¢"; +const triangle = "ā–µ"; +const triangledown = "ā–æ"; +const triangleleft = "ā—ƒ"; +const trianglelefteq = "āŠ“"; +const triangleq = "ā‰œ"; +const triangleright = "ā–¹"; +const trianglerighteq = "āŠµ"; +const tridot = "ā—¬"; +const trie = "ā‰œ"; +const triminus = "āØŗ"; +const triplus = "āع"; +const trisb = "ā§"; +const tritime = "āØ»"; +const trpezium = "ā¢"; +const tscr = "š“‰"; +const tscy = "ц"; +const tshcy = "ћ"; +const tstrok = "ŧ"; +const twixt = "ā‰¬"; +const twoheadleftarrow = "ā†ž"; +const twoheadrightarrow = "ā† "; +const uArr = "ā‡‘"; +const uHar = "ā„£"; +const uacut = "Ćŗ"; +const uacute = "Ćŗ"; +const uarr = "ā†‘"; +const ubrcy = "ў"; +const ubreve = "Å­"; +const ucir = "Ć»"; +const ucirc = "Ć»"; +const ucy = "у"; +const udarr = "ā‡…"; +const udblac = "ű"; +const udhar = "ā„®"; +const ufisht = "ā„¾"; +const ufr = "š”²"; +const ugrav = "Ć¹"; +const ugrave = "Ć¹"; +const uharl = "ā†æ"; +const uharr = "ā†¾"; +const uhblk = "ā–€"; +const ulcorn = "āŒœ"; +const ulcorner = "āŒœ"; +const ulcrop = "āŒ"; +const ultri = "ā—ø"; +const umacr = "Å«"; +const um = "ĀØ"; +const uml = "ĀØ"; +const uogon = "ų"; +const uopf = "š•¦"; +const uparrow = "ā†‘"; +const updownarrow = "ā†•"; +const upharpoonleft = "ā†æ"; +const upharpoonright = "ā†¾"; +const uplus = "āŠŽ"; +const upsi = "Ļ…"; +const upsih = "Ļ’"; +const upsilon = "Ļ…"; +const upuparrows = "ā‡ˆ"; +const urcorn = "āŒ"; +const urcorner = "āŒ"; +const urcrop = "āŒŽ"; +const uring = "ÅÆ"; +const urtri = "ā—¹"; +const uscr = "š“Š"; +const utdot = "ā‹°"; +const utilde = "Å©"; +const utri = "ā–µ"; +const utrif = "ā–“"; +const uuarr = "ā‡ˆ"; +const uum = "Ć¼"; +const uuml = "Ć¼"; +const uwangle = "ā¦§"; +const vArr = "ā‡•"; +const vBar = "ā«Ø"; +const vBarv = "ā«©"; +const vDash = "āŠØ"; +const vangrt = "ā¦œ"; +const varepsilon = "Ļµ"; +const varkappa = "Ļ°"; +const varnothing = "āˆ…"; +const varphi = "Ļ•"; +const varpi = "Ļ–"; +const varpropto = "āˆ"; +const varr = "ā†•"; +const varrho = "Ļ±"; +const varsigma = "Ļ‚"; +const varsubsetneq = "āŠŠļø€"; +const varsubsetneqq = "ā«‹ļø€"; +const varsupsetneq = "āŠ‹ļø€"; +const varsupsetneqq = "ā«Œļø€"; +const vartheta = "Ļ‘"; +const vartriangleleft = "āŠ²"; +const vartriangleright = "āŠ³"; +const vcy = "Š²"; +const vdash = "āŠ¢"; +const vee = "āˆØ"; +const veebar = "āŠ»"; +const veeeq = "ā‰š"; +const vellip = "ā‹®"; +const verbar = "|"; +const vert = "|"; +const vfr = "š”³"; +const vltri = "āŠ²"; +const vnsub = "āŠ‚āƒ’"; +const vnsup = "āŠƒāƒ’"; +const vopf = "š•§"; +const vprop = "āˆ"; +const vrtri = "āŠ³"; +const vscr = "š“‹"; +const vsubnE = "ā«‹ļø€"; +const vsubne = "āŠŠļø€"; +const vsupnE = "ā«Œļø€"; +const vsupne = "āŠ‹ļø€"; +const vzigzag = "ā¦š"; +const wcirc = "ŵ"; +const wedbar = "ā©Ÿ"; +const wedge = "āˆ§"; +const wedgeq = "ā‰™"; +const weierp = "ā„˜"; +const wfr = "š”“"; +const wopf = "š•Ø"; +const wp = "ā„˜"; +const wr = "ā‰€"; +const wreath = "ā‰€"; +const wscr = "š“Œ"; +const xcap = "ā‹‚"; +const xcirc = "ā—Æ"; +const xcup = "ā‹ƒ"; +const xdtri = "ā–½"; +const xfr = "š”µ"; +const xhArr = "āŸŗ"; +const xharr = "āŸ·"; +const xi = "Ī¾"; +const xlArr = "āŸø"; +const xlarr = "āŸµ"; +const xmap = "āŸ¼"; +const xnis = "ā‹»"; +const xodot = "ā؀"; +const xopf = "š•©"; +const xoplus = "ā؁"; +const xotime = "ā؂"; +const xrArr = "āŸ¹"; +const xrarr = "āŸ¶"; +const xscr = "š“"; +const xsqcup = "ā؆"; +const xuplus = "ā؄"; +const xutri = "ā–³"; +const xvee = "ā‹"; +const xwedge = "ā‹€"; +const yacut = "Ć½"; +const yacute = "Ć½"; +const yacy = "я"; +const ycirc = "Å·"; +const ycy = "ы"; +const ye = "Ā„"; +const yen = "Ā„"; +const yfr = "š”¶"; +const yicy = "ї"; +const yopf = "š•Ŗ"; +const yscr = "š“Ž"; +const yucy = "ю"; +const yum = "Ćæ"; +const yuml = "Ćæ"; +const zacute = "Åŗ"; +const zcaron = "ž"; +const zcy = "Š·"; +const zdot = "ż"; +const zeetrf = "ā„Ø"; +const zeta = "Ī¶"; +const zfr = "š”·"; +const zhcy = "Š¶"; +const zigrarr = "ā‡"; +const zopf = "š•«"; +const zscr = "š“"; +const zwj = "ā€"; +const zwnj = "ā€Œ"; +var characterEntities = { + AEli: AEli, + AElig: AElig, + AM: AM, + AMP: AMP, + Aacut: Aacut, + Aacute: Aacute, + Abreve: Abreve, + Acir: Acir, + Acirc: Acirc, + Acy: Acy, + Afr: Afr, + Agrav: Agrav, + Agrave: Agrave, + Alpha: Alpha, + Amacr: Amacr, + And: And, + Aogon: Aogon, + Aopf: Aopf, + ApplyFunction: ApplyFunction, + Arin: Arin, + Aring: Aring, + Ascr: Ascr, + Assign: Assign, + Atild: Atild, + Atilde: Atilde, + Aum: Aum, + Auml: Auml, + Backslash: Backslash, + Barv: Barv, + Barwed: Barwed, + Bcy: Bcy, + Because: Because, + Bernoullis: Bernoullis, + Beta: Beta, + Bfr: Bfr, + Bopf: Bopf, + Breve: Breve, + Bscr: Bscr, + Bumpeq: Bumpeq, + CHcy: CHcy, + COP: COP, + COPY: COPY, + Cacute: Cacute, + Cap: Cap, + CapitalDifferentialD: CapitalDifferentialD, + Cayleys: Cayleys, + Ccaron: Ccaron, + Ccedi: Ccedi, + Ccedil: Ccedil, + Ccirc: Ccirc, + Cconint: Cconint, + Cdot: Cdot, + Cedilla: Cedilla, + CenterDot: CenterDot, + Cfr: Cfr, + Chi: Chi, + CircleDot: CircleDot, + CircleMinus: CircleMinus, + CirclePlus: CirclePlus, + CircleTimes: CircleTimes, + ClockwiseContourIntegral: ClockwiseContourIntegral, + CloseCurlyDoubleQuote: CloseCurlyDoubleQuote, + CloseCurlyQuote: CloseCurlyQuote, + Colon: Colon, + Colone: Colone, + Congruent: Congruent, + Conint: Conint, + ContourIntegral: ContourIntegral, + Copf: Copf, + Coproduct: Coproduct, + CounterClockwiseContourIntegral: CounterClockwiseContourIntegral, + Cross: Cross, + Cscr: Cscr, + Cup: Cup, + CupCap: CupCap, + DD: DD, + DDotrahd: DDotrahd, + DJcy: DJcy, + DScy: DScy, + DZcy: DZcy, + Dagger: Dagger, + Darr: Darr, + Dashv: Dashv, + Dcaron: Dcaron, + Dcy: Dcy, + Del: Del, + Delta: Delta, + Dfr: Dfr, + DiacriticalAcute: DiacriticalAcute, + DiacriticalDot: DiacriticalDot, + DiacriticalDoubleAcute: DiacriticalDoubleAcute, + DiacriticalGrave: DiacriticalGrave, + DiacriticalTilde: DiacriticalTilde, + Diamond: Diamond, + DifferentialD: DifferentialD, + Dopf: Dopf, + Dot: Dot, + DotDot: DotDot, + DotEqual: DotEqual, + DoubleContourIntegral: DoubleContourIntegral, + DoubleDot: DoubleDot, + DoubleDownArrow: DoubleDownArrow, + DoubleLeftArrow: DoubleLeftArrow, + DoubleLeftRightArrow: DoubleLeftRightArrow, + DoubleLeftTee: DoubleLeftTee, + DoubleLongLeftArrow: DoubleLongLeftArrow, + DoubleLongLeftRightArrow: DoubleLongLeftRightArrow, + DoubleLongRightArrow: DoubleLongRightArrow, + DoubleRightArrow: DoubleRightArrow, + DoubleRightTee: DoubleRightTee, + DoubleUpArrow: DoubleUpArrow, + DoubleUpDownArrow: DoubleUpDownArrow, + DoubleVerticalBar: DoubleVerticalBar, + DownArrow: DownArrow, + DownArrowBar: DownArrowBar, + DownArrowUpArrow: DownArrowUpArrow, + DownBreve: DownBreve, + DownLeftRightVector: DownLeftRightVector, + DownLeftTeeVector: DownLeftTeeVector, + DownLeftVector: DownLeftVector, + DownLeftVectorBar: DownLeftVectorBar, + DownRightTeeVector: DownRightTeeVector, + DownRightVector: DownRightVector, + DownRightVectorBar: DownRightVectorBar, + DownTee: DownTee, + DownTeeArrow: DownTeeArrow, + Downarrow: Downarrow, + Dscr: Dscr, + Dstrok: Dstrok, + ENG: ENG, + ET: ET, + ETH: ETH, + Eacut: Eacut, + Eacute: Eacute, + Ecaron: Ecaron, + Ecir: Ecir, + Ecirc: Ecirc, + Ecy: Ecy, + Edot: Edot, + Efr: Efr, + Egrav: Egrav, + Egrave: Egrave, + Element: Element, + Emacr: Emacr, + EmptySmallSquare: EmptySmallSquare, + EmptyVerySmallSquare: EmptyVerySmallSquare, + Eogon: Eogon, + Eopf: Eopf, + Epsilon: Epsilon, + Equal: Equal, + EqualTilde: EqualTilde, + Equilibrium: Equilibrium, + Escr: Escr, + Esim: Esim, + Eta: Eta, + Eum: Eum, + Euml: Euml, + Exists: Exists, + ExponentialE: ExponentialE, + Fcy: Fcy, + Ffr: Ffr, + FilledSmallSquare: FilledSmallSquare, + FilledVerySmallSquare: FilledVerySmallSquare, + Fopf: Fopf, + ForAll: ForAll, + Fouriertrf: Fouriertrf, + Fscr: Fscr, + GJcy: GJcy, + G: G, + GT: GT, + Gamma: Gamma, + Gammad: Gammad, + Gbreve: Gbreve, + Gcedil: Gcedil, + Gcirc: Gcirc, + Gcy: Gcy, + Gdot: Gdot, + Gfr: Gfr, + Gg: Gg, + Gopf: Gopf, + GreaterEqual: GreaterEqual, + GreaterEqualLess: GreaterEqualLess, + GreaterFullEqual: GreaterFullEqual, + GreaterGreater: GreaterGreater, + GreaterLess: GreaterLess, + GreaterSlantEqual: GreaterSlantEqual, + GreaterTilde: GreaterTilde, + Gscr: Gscr, + Gt: Gt, + HARDcy: HARDcy, + Hacek: Hacek, + Hat: Hat, + Hcirc: Hcirc, + Hfr: Hfr, + HilbertSpace: HilbertSpace, + Hopf: Hopf, + HorizontalLine: HorizontalLine, + Hscr: Hscr, + Hstrok: Hstrok, + HumpDownHump: HumpDownHump, + HumpEqual: HumpEqual, + IEcy: IEcy, + IJlig: IJlig, + IOcy: IOcy, + Iacut: Iacut, + Iacute: Iacute, + Icir: Icir, + Icirc: Icirc, + Icy: Icy, + Idot: Idot, + Ifr: Ifr, + Igrav: Igrav, + Igrave: Igrave, + Im: Im, + Imacr: Imacr, + ImaginaryI: ImaginaryI, + Implies: Implies, + Int: Int, + Integral: Integral, + Intersection: Intersection, + InvisibleComma: InvisibleComma, + InvisibleTimes: InvisibleTimes, + Iogon: Iogon, + Iopf: Iopf, + Iota: Iota, + Iscr: Iscr, + Itilde: Itilde, + Iukcy: Iukcy, + Ium: Ium, + Iuml: Iuml, + Jcirc: Jcirc, + Jcy: Jcy, + Jfr: Jfr, + Jopf: Jopf, + Jscr: Jscr, + Jsercy: Jsercy, + Jukcy: Jukcy, + KHcy: KHcy, + KJcy: KJcy, + Kappa: Kappa, + Kcedil: Kcedil, + Kcy: Kcy, + Kfr: Kfr, + Kopf: Kopf, + Kscr: Kscr, + LJcy: LJcy, + L: L, + LT: LT, + Lacute: Lacute, + Lambda: Lambda, + Lang: Lang, + Laplacetrf: Laplacetrf, + Larr: Larr, + Lcaron: Lcaron, + Lcedil: Lcedil, + Lcy: Lcy, + LeftAngleBracket: LeftAngleBracket, + LeftArrow: LeftArrow, + LeftArrowBar: LeftArrowBar, + LeftArrowRightArrow: LeftArrowRightArrow, + LeftCeiling: LeftCeiling, + LeftDoubleBracket: LeftDoubleBracket, + LeftDownTeeVector: LeftDownTeeVector, + LeftDownVector: LeftDownVector, + LeftDownVectorBar: LeftDownVectorBar, + LeftFloor: LeftFloor, + LeftRightArrow: LeftRightArrow, + LeftRightVector: LeftRightVector, + LeftTee: LeftTee, + LeftTeeArrow: LeftTeeArrow, + LeftTeeVector: LeftTeeVector, + LeftTriangle: LeftTriangle, + LeftTriangleBar: LeftTriangleBar, + LeftTriangleEqual: LeftTriangleEqual, + LeftUpDownVector: LeftUpDownVector, + LeftUpTeeVector: LeftUpTeeVector, + LeftUpVector: LeftUpVector, + LeftUpVectorBar: LeftUpVectorBar, + LeftVector: LeftVector, + LeftVectorBar: LeftVectorBar, + Leftarrow: Leftarrow, + Leftrightarrow: Leftrightarrow, + LessEqualGreater: LessEqualGreater, + LessFullEqual: LessFullEqual, + LessGreater: LessGreater, + LessLess: LessLess, + LessSlantEqual: LessSlantEqual, + LessTilde: LessTilde, + Lfr: Lfr, + Ll: Ll, + Lleftarrow: Lleftarrow, + Lmidot: Lmidot, + LongLeftArrow: LongLeftArrow, + LongLeftRightArrow: LongLeftRightArrow, + LongRightArrow: LongRightArrow, + Longleftarrow: Longleftarrow, + Longleftrightarrow: Longleftrightarrow, + Longrightarrow: Longrightarrow, + Lopf: Lopf, + LowerLeftArrow: LowerLeftArrow, + LowerRightArrow: LowerRightArrow, + Lscr: Lscr, + Lsh: Lsh, + Lstrok: Lstrok, + Lt: Lt, + "Map": "ā¤…", + Mcy: Mcy, + MediumSpace: MediumSpace, + Mellintrf: Mellintrf, + Mfr: Mfr, + MinusPlus: MinusPlus, + Mopf: Mopf, + Mscr: Mscr, + Mu: Mu, + NJcy: NJcy, + Nacute: Nacute, + Ncaron: Ncaron, + Ncedil: Ncedil, + Ncy: Ncy, + NegativeMediumSpace: NegativeMediumSpace, + NegativeThickSpace: NegativeThickSpace, + NegativeThinSpace: NegativeThinSpace, + NegativeVeryThinSpace: NegativeVeryThinSpace, + NestedGreaterGreater: NestedGreaterGreater, + NestedLessLess: NestedLessLess, + NewLine: NewLine, + Nfr: Nfr, + NoBreak: NoBreak, + NonBreakingSpace: NonBreakingSpace, + Nopf: Nopf, + Not: Not, + NotCongruent: NotCongruent, + NotCupCap: NotCupCap, + NotDoubleVerticalBar: NotDoubleVerticalBar, + NotElement: NotElement, + NotEqual: NotEqual, + NotEqualTilde: NotEqualTilde, + NotExists: NotExists, + NotGreater: NotGreater, + NotGreaterEqual: NotGreaterEqual, + NotGreaterFullEqual: NotGreaterFullEqual, + NotGreaterGreater: NotGreaterGreater, + NotGreaterLess: NotGreaterLess, + NotGreaterSlantEqual: NotGreaterSlantEqual, + NotGreaterTilde: NotGreaterTilde, + NotHumpDownHump: NotHumpDownHump, + NotHumpEqual: NotHumpEqual, + NotLeftTriangle: NotLeftTriangle, + NotLeftTriangleBar: NotLeftTriangleBar, + NotLeftTriangleEqual: NotLeftTriangleEqual, + NotLess: NotLess, + NotLessEqual: NotLessEqual, + NotLessGreater: NotLessGreater, + NotLessLess: NotLessLess, + NotLessSlantEqual: NotLessSlantEqual, + NotLessTilde: NotLessTilde, + NotNestedGreaterGreater: NotNestedGreaterGreater, + NotNestedLessLess: NotNestedLessLess, + NotPrecedes: NotPrecedes, + NotPrecedesEqual: NotPrecedesEqual, + NotPrecedesSlantEqual: NotPrecedesSlantEqual, + NotReverseElement: NotReverseElement, + NotRightTriangle: NotRightTriangle, + NotRightTriangleBar: NotRightTriangleBar, + NotRightTriangleEqual: NotRightTriangleEqual, + NotSquareSubset: NotSquareSubset, + NotSquareSubsetEqual: NotSquareSubsetEqual, + NotSquareSuperset: NotSquareSuperset, + NotSquareSupersetEqual: NotSquareSupersetEqual, + NotSubset: NotSubset, + NotSubsetEqual: NotSubsetEqual, + NotSucceeds: NotSucceeds, + NotSucceedsEqual: NotSucceedsEqual, + NotSucceedsSlantEqual: NotSucceedsSlantEqual, + NotSucceedsTilde: NotSucceedsTilde, + NotSuperset: NotSuperset, + NotSupersetEqual: NotSupersetEqual, + NotTilde: NotTilde, + NotTildeEqual: NotTildeEqual, + NotTildeFullEqual: NotTildeFullEqual, + NotTildeTilde: NotTildeTilde, + NotVerticalBar: NotVerticalBar, + Nscr: Nscr, + Ntild: Ntild, + Ntilde: Ntilde, + Nu: Nu, + OElig: OElig, + Oacut: Oacut, + Oacute: Oacute, + Ocir: Ocir, + Ocirc: Ocirc, + Ocy: Ocy, + Odblac: Odblac, + Ofr: Ofr, + Ograv: Ograv, + Ograve: Ograve, + Omacr: Omacr, + Omega: Omega, + Omicron: Omicron, + Oopf: Oopf, + OpenCurlyDoubleQuote: OpenCurlyDoubleQuote, + OpenCurlyQuote: OpenCurlyQuote, + Or: Or, + Oscr: Oscr, + Oslas: Oslas, + Oslash: Oslash, + Otild: Otild, + Otilde: Otilde, + Otimes: Otimes, + Oum: Oum, + Ouml: Ouml, + OverBar: OverBar, + OverBrace: OverBrace, + OverBracket: OverBracket, + OverParenthesis: OverParenthesis, + PartialD: PartialD, + Pcy: Pcy, + Pfr: Pfr, + Phi: Phi, + Pi: Pi, + PlusMinus: PlusMinus, + Poincareplane: Poincareplane, + Popf: Popf, + Pr: Pr, + Precedes: Precedes, + PrecedesEqual: PrecedesEqual, + PrecedesSlantEqual: PrecedesSlantEqual, + PrecedesTilde: PrecedesTilde, + Prime: Prime, + Product: Product, + Proportion: Proportion, + Proportional: Proportional, + Pscr: Pscr, + Psi: Psi, + QUO: QUO, + QUOT: QUOT, + Qfr: Qfr, + Qopf: Qopf, + Qscr: Qscr, + RBarr: RBarr, + RE: RE, + REG: REG, + Racute: Racute, + Rang: Rang, + Rarr: Rarr, + Rarrtl: Rarrtl, + Rcaron: Rcaron, + Rcedil: Rcedil, + Rcy: Rcy, + Re: Re, + ReverseElement: ReverseElement, + ReverseEquilibrium: ReverseEquilibrium, + ReverseUpEquilibrium: ReverseUpEquilibrium, + Rfr: Rfr, + Rho: Rho, + RightAngleBracket: RightAngleBracket, + RightArrow: RightArrow, + RightArrowBar: RightArrowBar, + RightArrowLeftArrow: RightArrowLeftArrow, + RightCeiling: RightCeiling, + RightDoubleBracket: RightDoubleBracket, + RightDownTeeVector: RightDownTeeVector, + RightDownVector: RightDownVector, + RightDownVectorBar: RightDownVectorBar, + RightFloor: RightFloor, + RightTee: RightTee, + RightTeeArrow: RightTeeArrow, + RightTeeVector: RightTeeVector, + RightTriangle: RightTriangle, + RightTriangleBar: RightTriangleBar, + RightTriangleEqual: RightTriangleEqual, + RightUpDownVector: RightUpDownVector, + RightUpTeeVector: RightUpTeeVector, + RightUpVector: RightUpVector, + RightUpVectorBar: RightUpVectorBar, + RightVector: RightVector, + RightVectorBar: RightVectorBar, + Rightarrow: Rightarrow, + Ropf: Ropf, + RoundImplies: RoundImplies, + Rrightarrow: Rrightarrow, + Rscr: Rscr, + Rsh: Rsh, + RuleDelayed: RuleDelayed, + SHCHcy: SHCHcy, + SHcy: SHcy, + SOFTcy: SOFTcy, + Sacute: Sacute, + Sc: Sc, + Scaron: Scaron, + Scedil: Scedil, + Scirc: Scirc, + Scy: Scy, + Sfr: Sfr, + ShortDownArrow: ShortDownArrow, + ShortLeftArrow: ShortLeftArrow, + ShortRightArrow: ShortRightArrow, + ShortUpArrow: ShortUpArrow, + Sigma: Sigma, + SmallCircle: SmallCircle, + Sopf: Sopf, + Sqrt: Sqrt, + Square: Square, + SquareIntersection: SquareIntersection, + SquareSubset: SquareSubset, + SquareSubsetEqual: SquareSubsetEqual, + SquareSuperset: SquareSuperset, + SquareSupersetEqual: SquareSupersetEqual, + SquareUnion: SquareUnion, + Sscr: Sscr, + Star: Star, + Sub: Sub, + Subset: Subset, + SubsetEqual: SubsetEqual, + Succeeds: Succeeds, + SucceedsEqual: SucceedsEqual, + SucceedsSlantEqual: SucceedsSlantEqual, + SucceedsTilde: SucceedsTilde, + SuchThat: SuchThat, + Sum: Sum, + Sup: Sup, + Superset: Superset, + SupersetEqual: SupersetEqual, + Supset: Supset, + THOR: THOR, + THORN: THORN, + TRADE: TRADE, + TSHcy: TSHcy, + TScy: TScy, + Tab: Tab, + Tau: Tau, + Tcaron: Tcaron, + Tcedil: Tcedil, + Tcy: Tcy, + Tfr: Tfr, + Therefore: Therefore, + Theta: Theta, + ThickSpace: ThickSpace, + ThinSpace: ThinSpace, + Tilde: Tilde, + TildeEqual: TildeEqual, + TildeFullEqual: TildeFullEqual, + TildeTilde: TildeTilde, + Topf: Topf, + TripleDot: TripleDot, + Tscr: Tscr, + Tstrok: Tstrok, + Uacut: Uacut, + Uacute: Uacute, + Uarr: Uarr, + Uarrocir: Uarrocir, + Ubrcy: Ubrcy, + Ubreve: Ubreve, + Ucir: Ucir, + Ucirc: Ucirc, + Ucy: Ucy, + Udblac: Udblac, + Ufr: Ufr, + Ugrav: Ugrav, + Ugrave: Ugrave, + Umacr: Umacr, + UnderBar: UnderBar, + UnderBrace: UnderBrace, + UnderBracket: UnderBracket, + UnderParenthesis: UnderParenthesis, + Union: Union, + UnionPlus: UnionPlus, + Uogon: Uogon, + Uopf: Uopf, + UpArrow: UpArrow, + UpArrowBar: UpArrowBar, + UpArrowDownArrow: UpArrowDownArrow, + UpDownArrow: UpDownArrow, + UpEquilibrium: UpEquilibrium, + UpTee: UpTee, + UpTeeArrow: UpTeeArrow, + Uparrow: Uparrow, + Updownarrow: Updownarrow, + UpperLeftArrow: UpperLeftArrow, + UpperRightArrow: UpperRightArrow, + Upsi: Upsi, + Upsilon: Upsilon, + Uring: Uring, + Uscr: Uscr, + Utilde: Utilde, + Uum: Uum, + Uuml: Uuml, + VDash: VDash, + Vbar: Vbar, + Vcy: Vcy, + Vdash: Vdash, + Vdashl: Vdashl, + Vee: Vee, + Verbar: Verbar, + Vert: Vert, + VerticalBar: VerticalBar, + VerticalLine: VerticalLine, + VerticalSeparator: VerticalSeparator, + VerticalTilde: VerticalTilde, + VeryThinSpace: VeryThinSpace, + Vfr: Vfr, + Vopf: Vopf, + Vscr: Vscr, + Vvdash: Vvdash, + Wcirc: Wcirc, + Wedge: Wedge, + Wfr: Wfr, + Wopf: Wopf, + Wscr: Wscr, + Xfr: Xfr, + Xi: Xi, + Xopf: Xopf, + Xscr: Xscr, + YAcy: YAcy, + YIcy: YIcy, + YUcy: YUcy, + Yacut: Yacut, + Yacute: Yacute, + Ycirc: Ycirc, + Ycy: Ycy, + Yfr: Yfr, + Yopf: Yopf, + Yscr: Yscr, + Yuml: Yuml, + ZHcy: ZHcy, + Zacute: Zacute, + Zcaron: Zcaron, + Zcy: Zcy, + Zdot: Zdot, + ZeroWidthSpace: ZeroWidthSpace, + Zeta: Zeta, + Zfr: Zfr, + Zopf: Zopf, + Zscr: Zscr, + aacut: aacut, + aacute: aacute, + abreve: abreve, + ac: ac, + acE: acE, + acd: acd, + acir: acir, + acirc: acirc, + acut: acut, + acute: acute, + acy: acy, + aeli: aeli, + aelig: aelig, + af: af, + afr: afr, + agrav: agrav, + agrave: agrave, + alefsym: alefsym, + aleph: aleph, + alpha: alpha, + amacr: amacr, + amalg: amalg, + am: am, + amp: amp, + and: and, + andand: andand, + andd: andd, + andslope: andslope, + andv: andv, + ang: ang, + ange: ange, + angle: angle, + angmsd: angmsd, + angmsdaa: angmsdaa, + angmsdab: angmsdab, + angmsdac: angmsdac, + angmsdad: angmsdad, + angmsdae: angmsdae, + angmsdaf: angmsdaf, + angmsdag: angmsdag, + angmsdah: angmsdah, + angrt: angrt, + angrtvb: angrtvb, + angrtvbd: angrtvbd, + angsph: angsph, + angst: angst, + angzarr: angzarr, + aogon: aogon, + aopf: aopf, + ap: ap, + apE: apE, + apacir: apacir, + ape: ape, + apid: apid, + apos: apos, + approx: approx, + approxeq: approxeq, + arin: arin, + aring: aring, + ascr: ascr, + ast: ast, + asymp: asymp, + asympeq: asympeq, + atild: atild, + atilde: atilde, + aum: aum, + auml: auml, + awconint: awconint, + awint: awint, + bNot: bNot, + backcong: backcong, + backepsilon: backepsilon, + backprime: backprime, + backsim: backsim, + backsimeq: backsimeq, + barvee: barvee, + barwed: barwed, + barwedge: barwedge, + bbrk: bbrk, + bbrktbrk: bbrktbrk, + bcong: bcong, + bcy: bcy, + bdquo: bdquo, + becaus: becaus, + because: because, + bemptyv: bemptyv, + bepsi: bepsi, + bernou: bernou, + beta: beta, + beth: beth, + between: between, + bfr: bfr, + bigcap: bigcap, + bigcirc: bigcirc, + bigcup: bigcup, + bigodot: bigodot, + bigoplus: bigoplus, + bigotimes: bigotimes, + bigsqcup: bigsqcup, + bigstar: bigstar, + bigtriangledown: bigtriangledown, + bigtriangleup: bigtriangleup, + biguplus: biguplus, + bigvee: bigvee, + bigwedge: bigwedge, + bkarow: bkarow, + blacklozenge: blacklozenge, + blacksquare: blacksquare, + blacktriangle: blacktriangle, + blacktriangledown: blacktriangledown, + blacktriangleleft: blacktriangleleft, + blacktriangleright: blacktriangleright, + blank: blank, + blk12: blk12, + blk14: blk14, + blk34: blk34, + block: block, + bne: bne, + bnequiv: bnequiv, + bnot: bnot, + bopf: bopf, + bot: bot, + bottom: bottom, + bowtie: bowtie, + boxDL: boxDL, + boxDR: boxDR, + boxDl: boxDl, + boxDr: boxDr, + boxH: boxH, + boxHD: boxHD, + boxHU: boxHU, + boxHd: boxHd, + boxHu: boxHu, + boxUL: boxUL, + boxUR: boxUR, + boxUl: boxUl, + boxUr: boxUr, + boxV: boxV, + boxVH: boxVH, + boxVL: boxVL, + boxVR: boxVR, + boxVh: boxVh, + boxVl: boxVl, + boxVr: boxVr, + boxbox: boxbox, + boxdL: boxdL, + boxdR: boxdR, + boxdl: boxdl, + boxdr: boxdr, + boxh: boxh, + boxhD: boxhD, + boxhU: boxhU, + boxhd: boxhd, + boxhu: boxhu, + boxminus: boxminus, + boxplus: boxplus, + boxtimes: boxtimes, + boxuL: boxuL, + boxuR: boxuR, + boxul: boxul, + boxur: boxur, + boxv: boxv, + boxvH: boxvH, + boxvL: boxvL, + boxvR: boxvR, + boxvh: boxvh, + boxvl: boxvl, + boxvr: boxvr, + bprime: bprime, + breve: breve, + brvba: brvba, + brvbar: brvbar, + bscr: bscr, + bsemi: bsemi, + bsim: bsim, + bsime: bsime, + bsol: bsol, + bsolb: bsolb, + bsolhsub: bsolhsub, + bull: bull, + bullet: bullet, + bump: bump, + bumpE: bumpE, + bumpe: bumpe, + bumpeq: bumpeq, + cacute: cacute, + cap: cap, + capand: capand, + capbrcup: capbrcup, + capcap: capcap, + capcup: capcup, + capdot: capdot, + caps: caps, + caret: caret, + caron: caron, + ccaps: ccaps, + ccaron: ccaron, + ccedi: ccedi, + ccedil: ccedil, + ccirc: ccirc, + ccups: ccups, + ccupssm: ccupssm, + cdot: cdot, + cedi: cedi, + cedil: cedil, + cemptyv: cemptyv, + cen: cen, + cent: cent, + centerdot: centerdot, + cfr: cfr, + chcy: chcy, + check: check$2, + checkmark: checkmark, + chi: chi, + cir: cir, + cirE: cirE, + circ: circ, + circeq: circeq, + circlearrowleft: circlearrowleft, + circlearrowright: circlearrowright, + circledR: circledR, + circledS: circledS, + circledast: circledast, + circledcirc: circledcirc, + circleddash: circleddash, + cire: cire, + cirfnint: cirfnint, + cirmid: cirmid, + cirscir: cirscir, + clubs: clubs, + clubsuit: clubsuit, + colon: colon, + colone: colone, + coloneq: coloneq, + comma: comma, + commat: commat, + comp: comp, + compfn: compfn, + complement: complement, + complexes: complexes, + cong: cong, + congdot: congdot, + conint: conint, + copf: copf, + coprod: coprod, + cop: cop, + copy: copy$1, + copysr: copysr, + crarr: crarr, + cross: cross, + cscr: cscr, + csub: csub, + csube: csube, + csup: csup, + csupe: csupe, + ctdot: ctdot, + cudarrl: cudarrl, + cudarrr: cudarrr, + cuepr: cuepr, + cuesc: cuesc, + cularr: cularr, + cularrp: cularrp, + cup: cup, + cupbrcap: cupbrcap, + cupcap: cupcap, + cupcup: cupcup, + cupdot: cupdot, + cupor: cupor, + cups: cups, + curarr: curarr, + curarrm: curarrm, + curlyeqprec: curlyeqprec, + curlyeqsucc: curlyeqsucc, + curlyvee: curlyvee, + curlywedge: curlywedge, + curre: curre, + curren: curren, + curvearrowleft: curvearrowleft, + curvearrowright: curvearrowright, + cuvee: cuvee, + cuwed: cuwed, + cwconint: cwconint, + cwint: cwint, + cylcty: cylcty, + dArr: dArr, + dHar: dHar, + dagger: dagger, + daleth: daleth, + darr: darr, + dash: dash, + dashv: dashv, + dbkarow: dbkarow, + dblac: dblac, + dcaron: dcaron, + dcy: dcy, + dd: dd, + ddagger: ddagger, + ddarr: ddarr, + ddotseq: ddotseq, + de: de, + deg: deg, + delta: delta, + demptyv: demptyv, + dfisht: dfisht, + dfr: dfr, + dharl: dharl, + dharr: dharr, + diam: diam, + diamond: diamond, + diamondsuit: diamondsuit, + diams: diams, + die: die, + digamma: digamma, + disin: disin, + div: div, + divid: divid, + divide: divide, + divideontimes: divideontimes, + divonx: divonx, + djcy: djcy, + dlcorn: dlcorn, + dlcrop: dlcrop, + dollar: dollar, + dopf: dopf, + dot: dot, + doteq: doteq, + doteqdot: doteqdot, + dotminus: dotminus, + dotplus: dotplus, + dotsquare: dotsquare, + doublebarwedge: doublebarwedge, + downarrow: downarrow, + downdownarrows: downdownarrows, + downharpoonleft: downharpoonleft, + downharpoonright: downharpoonright, + drbkarow: drbkarow, + drcorn: drcorn, + drcrop: drcrop, + dscr: dscr, + dscy: dscy, + dsol: dsol, + dstrok: dstrok, + dtdot: dtdot, + dtri: dtri, + dtrif: dtrif, + duarr: duarr, + duhar: duhar, + dwangle: dwangle, + dzcy: dzcy, + dzigrarr: dzigrarr, + eDDot: eDDot, + eDot: eDot, + eacut: eacut, + eacute: eacute, + easter: easter, + ecaron: ecaron, + ecir: ecir, + ecirc: ecirc, + ecolon: ecolon, + ecy: ecy, + edot: edot, + ee: ee, + efDot: efDot, + efr: efr, + eg: eg, + egrav: egrav, + egrave: egrave, + egs: egs, + egsdot: egsdot, + el: el, + elinters: elinters, + ell: ell, + els: els, + elsdot: elsdot, + emacr: emacr, + empty: empty, + emptyset: emptyset, + emptyv: emptyv, + emsp13: emsp13, + emsp14: emsp14, + emsp: emsp, + eng: eng, + ensp: ensp, + eogon: eogon, + eopf: eopf, + epar: epar, + eparsl: eparsl, + eplus: eplus, + epsi: epsi, + epsilon: epsilon, + epsiv: epsiv, + eqcirc: eqcirc, + eqcolon: eqcolon, + eqsim: eqsim, + eqslantgtr: eqslantgtr, + eqslantless: eqslantless, + equals: equals, + equest: equest, + equiv: equiv, + equivDD: equivDD, + eqvparsl: eqvparsl, + erDot: erDot, + erarr: erarr, + escr: escr, + esdot: esdot, + esim: esim, + eta: eta, + et: et, + eth: eth, + eum: eum, + euml: euml, + euro: euro, + excl: excl, + exist: exist, + expectation: expectation, + exponentiale: exponentiale, + fallingdotseq: fallingdotseq, + fcy: fcy, + female: female, + ffilig: ffilig, + fflig: fflig, + ffllig: ffllig, + ffr: ffr, + filig: filig, + fjlig: fjlig, + flat: flat, + fllig: fllig, + fltns: fltns, + fnof: fnof, + fopf: fopf, + forall: forall, + fork: fork, + forkv: forkv, + fpartint: fpartint, + frac1: frac1, + frac12: frac12, + frac13: frac13, + frac14: frac14, + frac15: frac15, + frac16: frac16, + frac18: frac18, + frac23: frac23, + frac25: frac25, + frac3: frac3, + frac34: frac34, + frac35: frac35, + frac38: frac38, + frac45: frac45, + frac56: frac56, + frac58: frac58, + frac78: frac78, + frasl: frasl, + frown: frown, + fscr: fscr, + gE: gE, + gEl: gEl, + gacute: gacute, + gamma: gamma, + gammad: gammad, + gap: gap, + gbreve: gbreve, + gcirc: gcirc, + gcy: gcy, + gdot: gdot, + ge: ge, + gel: gel, + geq: geq, + geqq: geqq, + geqslant: geqslant, + ges: ges, + gescc: gescc, + gesdot: gesdot, + gesdoto: gesdoto, + gesdotol: gesdotol, + gesl: gesl, + gesles: gesles, + gfr: gfr, + gg: gg, + ggg: ggg, + gimel: gimel, + gjcy: gjcy, + gl: gl, + glE: glE, + gla: gla, + glj: glj, + gnE: gnE, + gnap: gnap, + gnapprox: gnapprox, + gne: gne, + gneq: gneq, + gneqq: gneqq, + gnsim: gnsim, + gopf: gopf, + grave: grave, + gscr: gscr, + gsim: gsim, + gsime: gsime, + gsiml: gsiml, + g: g, + gt: gt, + gtcc: gtcc, + gtcir: gtcir, + gtdot: gtdot, + gtlPar: gtlPar, + gtquest: gtquest, + gtrapprox: gtrapprox, + gtrarr: gtrarr, + gtrdot: gtrdot, + gtreqless: gtreqless, + gtreqqless: gtreqqless, + gtrless: gtrless, + gtrsim: gtrsim, + gvertneqq: gvertneqq, + gvnE: gvnE, + hArr: hArr, + hairsp: hairsp, + half: half, + hamilt: hamilt, + hardcy: hardcy, + harr: harr, + harrcir: harrcir, + harrw: harrw, + hbar: hbar, + hcirc: hcirc, + hearts: hearts, + heartsuit: heartsuit, + hellip: hellip, + hercon: hercon, + hfr: hfr, + hksearow: hksearow, + hkswarow: hkswarow, + hoarr: hoarr, + homtht: homtht, + hookleftarrow: hookleftarrow, + hookrightarrow: hookrightarrow, + hopf: hopf, + horbar: horbar, + hscr: hscr, + hslash: hslash, + hstrok: hstrok, + hybull: hybull, + hyphen: hyphen, + iacut: iacut, + iacute: iacute, + ic: ic, + icir: icir, + icirc: icirc, + icy: icy, + iecy: iecy, + iexc: iexc, + iexcl: iexcl, + iff: iff, + ifr: ifr, + igrav: igrav, + igrave: igrave, + ii: ii, + iiiint: iiiint, + iiint: iiint, + iinfin: iinfin, + iiota: iiota, + ijlig: ijlig, + imacr: imacr, + image: image, + imagline: imagline, + imagpart: imagpart, + imath: imath, + imof: imof, + imped: imped, + "in": "āˆˆ", + incare: incare, + infin: infin, + infintie: infintie, + inodot: inodot, + int: int$1, + intcal: intcal, + integers: integers, + intercal: intercal, + intlarhk: intlarhk, + intprod: intprod, + iocy: iocy, + iogon: iogon, + iopf: iopf, + iota: iota, + iprod: iprod, + iques: iques, + iquest: iquest, + iscr: iscr, + isin: isin, + isinE: isinE, + isindot: isindot, + isins: isins, + isinsv: isinsv, + isinv: isinv, + it: it, + itilde: itilde, + iukcy: iukcy, + ium: ium, + iuml: iuml, + jcirc: jcirc, + jcy: jcy, + jfr: jfr, + jmath: jmath, + jopf: jopf, + jscr: jscr, + jsercy: jsercy, + jukcy: jukcy, + kappa: kappa, + kappav: kappav, + kcedil: kcedil, + kcy: kcy, + kfr: kfr, + kgreen: kgreen, + khcy: khcy, + kjcy: kjcy, + kopf: kopf, + kscr: kscr, + lAarr: lAarr, + lArr: lArr, + lAtail: lAtail, + lBarr: lBarr, + lE: lE, + lEg: lEg, + lHar: lHar, + lacute: lacute, + laemptyv: laemptyv, + lagran: lagran, + lambda: lambda, + lang: lang, + langd: langd, + langle: langle, + lap: lap, + laqu: laqu, + laquo: laquo, + larr: larr, + larrb: larrb, + larrbfs: larrbfs, + larrfs: larrfs, + larrhk: larrhk, + larrlp: larrlp, + larrpl: larrpl, + larrsim: larrsim, + larrtl: larrtl, + lat: lat, + latail: latail, + late: late, + lates: lates, + lbarr: lbarr, + lbbrk: lbbrk, + lbrace: lbrace, + lbrack: lbrack, + lbrke: lbrke, + lbrksld: lbrksld, + lbrkslu: lbrkslu, + lcaron: lcaron, + lcedil: lcedil, + lceil: lceil, + lcub: lcub, + lcy: lcy, + ldca: ldca, + ldquo: ldquo, + ldquor: ldquor, + ldrdhar: ldrdhar, + ldrushar: ldrushar, + ldsh: ldsh, + le: le, + leftarrow: leftarrow, + leftarrowtail: leftarrowtail, + leftharpoondown: leftharpoondown, + leftharpoonup: leftharpoonup, + leftleftarrows: leftleftarrows, + leftrightarrow: leftrightarrow, + leftrightarrows: leftrightarrows, + leftrightharpoons: leftrightharpoons, + leftrightsquigarrow: leftrightsquigarrow, + leftthreetimes: leftthreetimes, + leg: leg, + leq: leq, + leqq: leqq, + leqslant: leqslant, + les: les, + lescc: lescc, + lesdot: lesdot, + lesdoto: lesdoto, + lesdotor: lesdotor, + lesg: lesg, + lesges: lesges, + lessapprox: lessapprox, + lessdot: lessdot, + lesseqgtr: lesseqgtr, + lesseqqgtr: lesseqqgtr, + lessgtr: lessgtr, + lesssim: lesssim, + lfisht: lfisht, + lfloor: lfloor, + lfr: lfr, + lg: lg, + lgE: lgE, + lhard: lhard, + lharu: lharu, + lharul: lharul, + lhblk: lhblk, + ljcy: ljcy, + ll: ll, + llarr: llarr, + llcorner: llcorner, + llhard: llhard, + lltri: lltri, + lmidot: lmidot, + lmoust: lmoust, + lmoustache: lmoustache, + lnE: lnE, + lnap: lnap, + lnapprox: lnapprox, + lne: lne, + lneq: lneq, + lneqq: lneqq, + lnsim: lnsim, + loang: loang, + loarr: loarr, + lobrk: lobrk, + longleftarrow: longleftarrow, + longleftrightarrow: longleftrightarrow, + longmapsto: longmapsto, + longrightarrow: longrightarrow, + looparrowleft: looparrowleft, + looparrowright: looparrowright, + lopar: lopar, + lopf: lopf, + loplus: loplus, + lotimes: lotimes, + lowast: lowast, + lowbar: lowbar, + loz: loz, + lozenge: lozenge, + lozf: lozf, + lpar: lpar, + lparlt: lparlt, + lrarr: lrarr, + lrcorner: lrcorner, + lrhar: lrhar, + lrhard: lrhard, + lrm: lrm, + lrtri: lrtri, + lsaquo: lsaquo, + lscr: lscr, + lsh: lsh, + lsim: lsim, + lsime: lsime, + lsimg: lsimg, + lsqb: lsqb, + lsquo: lsquo, + lsquor: lsquor, + lstrok: lstrok, + l: l, + lt: lt, + ltcc: ltcc, + ltcir: ltcir, + ltdot: ltdot, + lthree: lthree, + ltimes: ltimes, + ltlarr: ltlarr, + ltquest: ltquest, + ltrPar: ltrPar, + ltri: ltri, + ltrie: ltrie, + ltrif: ltrif, + lurdshar: lurdshar, + luruhar: luruhar, + lvertneqq: lvertneqq, + lvnE: lvnE, + mDDot: mDDot, + mac: mac, + macr: macr, + male: male, + malt: malt, + maltese: maltese, + map: map$2, + mapsto: mapsto, + mapstodown: mapstodown, + mapstoleft: mapstoleft, + mapstoup: mapstoup, + marker: marker, + mcomma: mcomma, + mcy: mcy, + mdash: mdash, + measuredangle: measuredangle, + mfr: mfr, + mho: mho, + micr: micr, + micro: micro, + mid: mid, + midast: midast, + midcir: midcir, + middo: middo, + middot: middot, + minus: minus, + minusb: minusb, + minusd: minusd, + minusdu: minusdu, + mlcp: mlcp, + mldr: mldr, + mnplus: mnplus, + models: models$2, + mopf: mopf, + mp: mp, + mscr: mscr, + mstpos: mstpos, + mu: mu, + multimap: multimap, + mumap: mumap, + nGg: nGg, + nGt: nGt, + nGtv: nGtv, + nLeftarrow: nLeftarrow, + nLeftrightarrow: nLeftrightarrow, + nLl: nLl, + nLt: nLt, + nLtv: nLtv, + nRightarrow: nRightarrow, + nVDash: nVDash, + nVdash: nVdash, + nabla: nabla, + nacute: nacute, + nang: nang, + nap: nap, + napE: napE, + napid: napid, + napos: napos, + napprox: napprox, + natur: natur, + natural: natural, + naturals: naturals, + nbs: nbs, + nbsp: nbsp, + nbump: nbump, + nbumpe: nbumpe, + ncap: ncap, + ncaron: ncaron, + ncedil: ncedil, + ncong: ncong, + ncongdot: ncongdot, + ncup: ncup, + ncy: ncy, + ndash: ndash, + ne: ne, + neArr: neArr, + nearhk: nearhk, + nearr: nearr, + nearrow: nearrow, + nedot: nedot, + nequiv: nequiv, + nesear: nesear, + nesim: nesim, + nexist: nexist, + nexists: nexists, + nfr: nfr, + ngE: ngE, + nge: nge, + ngeq: ngeq, + ngeqq: ngeqq, + ngeqslant: ngeqslant, + nges: nges, + ngsim: ngsim, + ngt: ngt, + ngtr: ngtr, + nhArr: nhArr, + nharr: nharr, + nhpar: nhpar, + ni: ni, + nis: nis, + nisd: nisd, + niv: niv, + njcy: njcy, + nlArr: nlArr, + nlE: nlE, + nlarr: nlarr, + nldr: nldr, + nle: nle, + nleftarrow: nleftarrow, + nleftrightarrow: nleftrightarrow, + nleq: nleq, + nleqq: nleqq, + nleqslant: nleqslant, + nles: nles, + nless: nless, + nlsim: nlsim, + nlt: nlt, + nltri: nltri, + nltrie: nltrie, + nmid: nmid, + nopf: nopf, + no: no, + not: not, + notin: notin, + notinE: notinE, + notindot: notindot, + notinva: notinva, + notinvb: notinvb, + notinvc: notinvc, + notni: notni, + notniva: notniva, + notnivb: notnivb, + notnivc: notnivc, + npar: npar, + nparallel: nparallel, + nparsl: nparsl, + npart: npart, + npolint: npolint, + npr: npr, + nprcue: nprcue, + npre: npre, + nprec: nprec, + npreceq: npreceq, + nrArr: nrArr, + nrarr: nrarr, + nrarrc: nrarrc, + nrarrw: nrarrw, + nrightarrow: nrightarrow, + nrtri: nrtri, + nrtrie: nrtrie, + nsc: nsc, + nsccue: nsccue, + nsce: nsce, + nscr: nscr, + nshortmid: nshortmid, + nshortparallel: nshortparallel, + nsim: nsim, + nsime: nsime, + nsimeq: nsimeq, + nsmid: nsmid, + nspar: nspar, + nsqsube: nsqsube, + nsqsupe: nsqsupe, + nsub: nsub, + nsubE: nsubE, + nsube: nsube, + nsubset: nsubset, + nsubseteq: nsubseteq, + nsubseteqq: nsubseteqq, + nsucc: nsucc, + nsucceq: nsucceq, + nsup: nsup, + nsupE: nsupE, + nsupe: nsupe, + nsupset: nsupset, + nsupseteq: nsupseteq, + nsupseteqq: nsupseteqq, + ntgl: ntgl, + ntild: ntild, + ntilde: ntilde, + ntlg: ntlg, + ntriangleleft: ntriangleleft, + ntrianglelefteq: ntrianglelefteq, + ntriangleright: ntriangleright, + ntrianglerighteq: ntrianglerighteq, + nu: nu, + num: num, + numero: numero, + numsp: numsp, + nvDash: nvDash, + nvHarr: nvHarr, + nvap: nvap, + nvdash: nvdash, + nvge: nvge, + nvgt: nvgt, + nvinfin: nvinfin, + nvlArr: nvlArr, + nvle: nvle, + nvlt: nvlt, + nvltrie: nvltrie, + nvrArr: nvrArr, + nvrtrie: nvrtrie, + nvsim: nvsim, + nwArr: nwArr, + nwarhk: nwarhk, + nwarr: nwarr, + nwarrow: nwarrow, + nwnear: nwnear, + oS: oS, + oacut: oacut, + oacute: oacute, + oast: oast, + ocir: ocir, + ocirc: ocirc, + ocy: ocy, + odash: odash, + odblac: odblac, + odiv: odiv, + odot: odot, + odsold: odsold, + oelig: oelig, + ofcir: ofcir, + ofr: ofr, + ogon: ogon, + ograv: ograv, + ograve: ograve, + ogt: ogt, + ohbar: ohbar, + ohm: ohm, + oint: oint, + olarr: olarr, + olcir: olcir, + olcross: olcross, + oline: oline, + olt: olt, + omacr: omacr, + omega: omega, + omicron: omicron, + omid: omid, + ominus: ominus, + oopf: oopf, + opar: opar, + operp: operp, + oplus: oplus, + or: or, + orarr: orarr, + ord: ord, + order: order$1, + orderof: orderof, + ordf: ordf, + ordm: ordm, + origof: origof, + oror: oror, + orslope: orslope, + orv: orv, + oscr: oscr, + oslas: oslas, + oslash: oslash, + osol: osol, + otild: otild, + otilde: otilde, + otimes: otimes, + otimesas: otimesas, + oum: oum, + ouml: ouml, + ovbar: ovbar, + par: par, + para: para, + parallel: parallel, + parsim: parsim, + parsl: parsl, + part: part, + pcy: pcy, + percnt: percnt, + period: period, + permil: permil, + perp: perp, + pertenk: pertenk, + pfr: pfr, + phi: phi, + phiv: phiv, + phmmat: phmmat, + phone: phone, + pi: pi, + pitchfork: pitchfork, + piv: piv, + planck: planck, + planckh: planckh, + plankv: plankv, + plus: plus, + plusacir: plusacir, + plusb: plusb, + pluscir: pluscir, + plusdo: plusdo, + plusdu: plusdu, + pluse: pluse, + plusm: plusm, + plusmn: plusmn, + plussim: plussim, + plustwo: plustwo, + pm: pm, + pointint: pointint, + popf: popf, + poun: poun, + pound: pound, + pr: pr, + prE: prE, + prap: prap, + prcue: prcue, + pre: pre, + prec: prec, + precapprox: precapprox, + preccurlyeq: preccurlyeq, + preceq: preceq, + precnapprox: precnapprox, + precneqq: precneqq, + precnsim: precnsim, + precsim: precsim, + prime: prime, + primes: primes, + prnE: prnE, + prnap: prnap, + prnsim: prnsim, + prod: prod, + profalar: profalar, + profline: profline, + profsurf: profsurf, + prop: prop, + propto: propto, + prsim: prsim, + prurel: prurel, + pscr: pscr, + psi: psi, + puncsp: puncsp, + qfr: qfr, + qint: qint, + qopf: qopf, + qprime: qprime, + qscr: qscr, + quaternions: quaternions, + quatint: quatint, + quest: quest, + questeq: questeq, + quo: quo, + quot: quot, + rAarr: rAarr, + rArr: rArr, + rAtail: rAtail, + rBarr: rBarr, + rHar: rHar, + race: race, + racute: racute, + radic: radic, + raemptyv: raemptyv, + rang: rang, + rangd: rangd, + range: range$1, + rangle: rangle, + raqu: raqu, + raquo: raquo, + rarr: rarr, + rarrap: rarrap, + rarrb: rarrb, + rarrbfs: rarrbfs, + rarrc: rarrc, + rarrfs: rarrfs, + rarrhk: rarrhk, + rarrlp: rarrlp, + rarrpl: rarrpl, + rarrsim: rarrsim, + rarrtl: rarrtl, + rarrw: rarrw, + ratail: ratail, + ratio: ratio, + rationals: rationals, + rbarr: rbarr, + rbbrk: rbbrk, + rbrace: rbrace, + rbrack: rbrack, + rbrke: rbrke, + rbrksld: rbrksld, + rbrkslu: rbrkslu, + rcaron: rcaron, + rcedil: rcedil, + rceil: rceil, + rcub: rcub, + rcy: rcy, + rdca: rdca, + rdldhar: rdldhar, + rdquo: rdquo, + rdquor: rdquor, + rdsh: rdsh, + real: real, + realine: realine, + realpart: realpart, + reals: reals, + rect: rect, + re: re, + reg: reg, + rfisht: rfisht, + rfloor: rfloor, + rfr: rfr, + rhard: rhard, + rharu: rharu, + rharul: rharul, + rho: rho, + rhov: rhov, + rightarrow: rightarrow, + rightarrowtail: rightarrowtail, + rightharpoondown: rightharpoondown, + rightharpoonup: rightharpoonup, + rightleftarrows: rightleftarrows, + rightleftharpoons: rightleftharpoons, + rightrightarrows: rightrightarrows, + rightsquigarrow: rightsquigarrow, + rightthreetimes: rightthreetimes, + ring: ring, + risingdotseq: risingdotseq, + rlarr: rlarr, + rlhar: rlhar, + rlm: rlm, + rmoust: rmoust, + rmoustache: rmoustache, + rnmid: rnmid, + roang: roang, + roarr: roarr, + robrk: robrk, + ropar: ropar, + ropf: ropf, + roplus: roplus, + rotimes: rotimes, + rpar: rpar, + rpargt: rpargt, + rppolint: rppolint, + rrarr: rrarr, + rsaquo: rsaquo, + rscr: rscr, + rsh: rsh, + rsqb: rsqb, + rsquo: rsquo, + rsquor: rsquor, + rthree: rthree, + rtimes: rtimes, + rtri: rtri, + rtrie: rtrie, + rtrif: rtrif, + rtriltri: rtriltri, + ruluhar: ruluhar, + rx: rx, + sacute: sacute, + sbquo: sbquo, + sc: sc, + scE: scE, + scap: scap, + scaron: scaron, + sccue: sccue, + sce: sce, + scedil: scedil, + scirc: scirc, + scnE: scnE, + scnap: scnap, + scnsim: scnsim, + scpolint: scpolint, + scsim: scsim, + scy: scy, + sdot: sdot, + sdotb: sdotb, + sdote: sdote, + seArr: seArr, + searhk: searhk, + searr: searr, + searrow: searrow, + sec: sec, + sect: sect, + semi: semi, + seswar: seswar, + setminus: setminus, + setmn: setmn, + sext: sext, + sfr: sfr, + sfrown: sfrown, + sharp: sharp, + shchcy: shchcy, + shcy: shcy, + shortmid: shortmid, + shortparallel: shortparallel, + sh: sh, + shy: shy, + sigma: sigma, + sigmaf: sigmaf, + sigmav: sigmav, + sim: sim, + simdot: simdot, + sime: sime, + simeq: simeq, + simg: simg, + simgE: simgE, + siml: siml, + simlE: simlE, + simne: simne, + simplus: simplus, + simrarr: simrarr, + slarr: slarr, + smallsetminus: smallsetminus, + smashp: smashp, + smeparsl: smeparsl, + smid: smid, + smile: smile, + smt: smt, + smte: smte, + smtes: smtes, + softcy: softcy, + sol: sol, + solb: solb, + solbar: solbar, + sopf: sopf, + spades: spades, + spadesuit: spadesuit, + spar: spar, + sqcap: sqcap, + sqcaps: sqcaps, + sqcup: sqcup, + sqcups: sqcups, + sqsub: sqsub, + sqsube: sqsube, + sqsubset: sqsubset, + sqsubseteq: sqsubseteq, + sqsup: sqsup, + sqsupe: sqsupe, + sqsupset: sqsupset, + sqsupseteq: sqsupseteq, + squ: squ, + square: square, + squarf: squarf, + squf: squf, + srarr: srarr, + sscr: sscr, + ssetmn: ssetmn, + ssmile: ssmile, + sstarf: sstarf, + star: star$1, + starf: starf, + straightepsilon: straightepsilon, + straightphi: straightphi, + strns: strns, + sub: sub, + subE: subE, + subdot: subdot, + sube: sube, + subedot: subedot, + submult: submult, + subnE: subnE, + subne: subne, + subplus: subplus, + subrarr: subrarr, + subset: subset, + subseteq: subseteq, + subseteqq: subseteqq, + subsetneq: subsetneq, + subsetneqq: subsetneqq, + subsim: subsim, + subsub: subsub, + subsup: subsup, + succ: succ, + succapprox: succapprox, + succcurlyeq: succcurlyeq, + succeq: succeq, + succnapprox: succnapprox, + succneqq: succneqq, + succnsim: succnsim, + succsim: succsim, + sum: sum, + sung: sung, + sup: sup, + sup1: sup1, + sup2: sup2, + sup3: sup3, + supE: supE, + supdot: supdot, + supdsub: supdsub, + supe: supe, + supedot: supedot, + suphsol: suphsol, + suphsub: suphsub, + suplarr: suplarr, + supmult: supmult, + supnE: supnE, + supne: supne, + supplus: supplus, + supset: supset, + supseteq: supseteq, + supseteqq: supseteqq, + supsetneq: supsetneq, + supsetneqq: supsetneqq, + supsim: supsim, + supsub: supsub, + supsup: supsup, + swArr: swArr, + swarhk: swarhk, + swarr: swarr, + swarrow: swarrow, + swnwar: swnwar, + szli: szli, + szlig: szlig, + target: target, + tau: tau, + tbrk: tbrk, + tcaron: tcaron, + tcedil: tcedil, + tcy: tcy, + tdot: tdot, + telrec: telrec, + tfr: tfr, + there4: there4, + therefore: therefore, + theta: theta, + thetasym: thetasym, + thetav: thetav, + thickapprox: thickapprox, + thicksim: thicksim, + thinsp: thinsp, + thkap: thkap, + thksim: thksim, + thor: thor, + thorn: thorn, + tilde: tilde, + time: time, + times: times, + timesb: timesb, + timesbar: timesbar, + timesd: timesd, + tint: tint, + toea: toea, + top: top, + topbot: topbot, + topcir: topcir, + topf: topf, + topfork: topfork, + tosa: tosa, + tprime: tprime, + trade: trade, + triangle: triangle, + triangledown: triangledown, + triangleleft: triangleleft, + trianglelefteq: trianglelefteq, + triangleq: triangleq, + triangleright: triangleright, + trianglerighteq: trianglerighteq, + tridot: tridot, + trie: trie, + triminus: triminus, + triplus: triplus, + trisb: trisb, + tritime: tritime, + trpezium: trpezium, + tscr: tscr, + tscy: tscy, + tshcy: tshcy, + tstrok: tstrok, + twixt: twixt, + twoheadleftarrow: twoheadleftarrow, + twoheadrightarrow: twoheadrightarrow, + uArr: uArr, + uHar: uHar, + uacut: uacut, + uacute: uacute, + uarr: uarr, + ubrcy: ubrcy, + ubreve: ubreve, + ucir: ucir, + ucirc: ucirc, + ucy: ucy, + udarr: udarr, + udblac: udblac, + udhar: udhar, + ufisht: ufisht, + ufr: ufr, + ugrav: ugrav, + ugrave: ugrave, + uharl: uharl, + uharr: uharr, + uhblk: uhblk, + ulcorn: ulcorn, + ulcorner: ulcorner, + ulcrop: ulcrop, + ultri: ultri, + umacr: umacr, + um: um, + uml: uml, + uogon: uogon, + uopf: uopf, + uparrow: uparrow, + updownarrow: updownarrow, + upharpoonleft: upharpoonleft, + upharpoonright: upharpoonright, + uplus: uplus, + upsi: upsi, + upsih: upsih, + upsilon: upsilon, + upuparrows: upuparrows, + urcorn: urcorn, + urcorner: urcorner, + urcrop: urcrop, + uring: uring, + urtri: urtri, + uscr: uscr, + utdot: utdot, + utilde: utilde, + utri: utri, + utrif: utrif, + uuarr: uuarr, + uum: uum, + uuml: uuml, + uwangle: uwangle, + vArr: vArr, + vBar: vBar, + vBarv: vBarv, + vDash: vDash, + vangrt: vangrt, + varepsilon: varepsilon, + varkappa: varkappa, + varnothing: varnothing, + varphi: varphi, + varpi: varpi, + varpropto: varpropto, + varr: varr, + varrho: varrho, + varsigma: varsigma, + varsubsetneq: varsubsetneq, + varsubsetneqq: varsubsetneqq, + varsupsetneq: varsupsetneq, + varsupsetneqq: varsupsetneqq, + vartheta: vartheta, + vartriangleleft: vartriangleleft, + vartriangleright: vartriangleright, + vcy: vcy, + vdash: vdash, + vee: vee, + veebar: veebar, + veeeq: veeeq, + vellip: vellip, + verbar: verbar, + vert: vert, + vfr: vfr, + vltri: vltri, + vnsub: vnsub, + vnsup: vnsup, + vopf: vopf, + vprop: vprop, + vrtri: vrtri, + vscr: vscr, + vsubnE: vsubnE, + vsubne: vsubne, + vsupnE: vsupnE, + vsupne: vsupne, + vzigzag: vzigzag, + wcirc: wcirc, + wedbar: wedbar, + wedge: wedge, + wedgeq: wedgeq, + weierp: weierp, + wfr: wfr, + wopf: wopf, + wp: wp, + wr: wr, + wreath: wreath, + wscr: wscr, + xcap: xcap, + xcirc: xcirc, + xcup: xcup, + xdtri: xdtri, + xfr: xfr, + xhArr: xhArr, + xharr: xharr, + xi: xi, + xlArr: xlArr, + xlarr: xlarr, + xmap: xmap, + xnis: xnis, + xodot: xodot, + xopf: xopf, + xoplus: xoplus, + xotime: xotime, + xrArr: xrArr, + xrarr: xrarr, + xscr: xscr, + xsqcup: xsqcup, + xuplus: xuplus, + xutri: xutri, + xvee: xvee, + xwedge: xwedge, + yacut: yacut, + yacute: yacute, + yacy: yacy, + ycirc: ycirc, + ycy: ycy, + ye: ye, + yen: yen, + yfr: yfr, + yicy: yicy, + yopf: yopf, + yscr: yscr, + yucy: yucy, + yum: yum, + yuml: yuml, + zacute: zacute, + zcaron: zcaron, + zcy: zcy, + zdot: zdot, + zeetrf: zeetrf, + zeta: zeta, + zfr: zfr, + zhcy: zhcy, + zigrarr: zigrarr, + zopf: zopf, + zscr: zscr, + zwj: zwj, + zwnj: zwnj }; -var asciiAlpha = regexCheck_1(/[A-Za-z]/); - -var asciiAlphanumeric = regexCheck_1(/[\dA-Za-z]/); - -var asciiAtext = regexCheck_1(/[#-'*+\--9=?A-Z^-~]/); - -var asciiControl_1 = asciiControl; - -// Note: EOF is seen as ASCII control here, because `null < 32 == true`. -function asciiControl(code) { - return ( - // Special whitespace codes (which have negative values), C0 and Control - // character DEL - code < 32 || code === 127 - ) -} - -var tokenize$7 = tokenizeAutolink; - - - - - - -function tokenizeAutolink(effects, ok, nok) { - var size; - - return start - - function start(code) { - effects.enter('autolink'); - effects.enter('autolinkMarker'); - effects.consume(code); - effects.exit('autolinkMarker'); - effects.enter('autolinkProtocol'); - return open - } - - function open(code) { - if (asciiAlpha(code)) { - effects.consume(code); - size = 1; - return schemeOrEmailAtext - } - - return asciiAtext(code) ? emailAtext(code) : nok(code) - } - - function schemeOrEmailAtext(code) { - return code === 43 || code === 45 || code === 46 || asciiAlphanumeric(code) - ? schemeInsideOrEmailAtext(code) - : emailAtext(code) - } - - function schemeInsideOrEmailAtext(code) { - if (code === 58) { - effects.consume(code); - return urlInside - } - - if ( - (code === 43 || code === 45 || code === 46 || asciiAlphanumeric(code)) && - size++ < 32 - ) { - effects.consume(code); - return schemeInsideOrEmailAtext - } - - return emailAtext(code) - } - - function urlInside(code) { - if (code === 62) { - effects.exit('autolinkProtocol'); - return end(code) - } - - if (code === 32 || code === 60 || asciiControl_1(code)) { - return nok(code) - } - - effects.consume(code); - return urlInside - } - - function emailAtext(code) { - if (code === 64) { - effects.consume(code); - size = 0; - return emailAtSignOrDot - } - - if (asciiAtext(code)) { - effects.consume(code); - return emailAtext - } - - return nok(code) - } - - function emailAtSignOrDot(code) { - return asciiAlphanumeric(code) ? emailLabel(code) : nok(code) - } - - function emailLabel(code) { - if (code === 46) { - effects.consume(code); - size = 0; - return emailAtSignOrDot - } - - if (code === 62) { - // Exit, then change the type. - effects.exit('autolinkProtocol').type = 'autolinkEmail'; - return end(code) - } - - return emailValue(code) - } - - function emailValue(code) { - if ((code === 45 || asciiAlphanumeric(code)) && size++ < 63) { - effects.consume(code); - return code === 45 ? emailValue : emailLabel - } +var decodeEntity_1 = decodeEntity; - return nok(code) - } +var own$4 = {}.hasOwnProperty; - function end(code) { - effects.enter('autolinkMarker'); - effects.consume(code); - effects.exit('autolinkMarker'); - effects.exit('autolink'); - return ok - } +function decodeEntity(characters) { + return own$4.call(characterEntities, characters) + ? characterEntities[characters] + : false } -var autolink = { - tokenize: tokenize$7 -}; - var asciiDigit = regexCheck_1(/\d/); -var tokenize$8 = tokenizeThematicBreak; - - - - - - -function tokenizeThematicBreak(effects, ok, nok) { - var size = 0; - var marker; - - return start - - function start(code) { - effects.enter('thematicBreak'); - marker = code; - return atBreak(code) - } - - function atBreak(code) { - if (code === marker) { - effects.enter('thematicBreakSequence'); - return sequence(code) - } - - if (markdownSpace_1(code)) { - return factorySpace(effects, atBreak, 'whitespace')(code) - } - - if (size < 3 || (code !== null && !markdownLineEnding_1(code))) { - return nok(code) - } - - effects.exit('thematicBreak'); - return ok(code) - } - - function sequence(code) { - if (code === marker) { - effects.consume(code); - size++; - return sequence - } - - effects.exit('thematicBreakSequence'); - return atBreak(code) - } -} - -var thematicBreak = { - tokenize: tokenize$8 -}; - -var list = createCommonjsModule(function (module, exports) { -exports.tokenize = tokenizeListStart; -exports.continuation = {tokenize: tokenizeListContinuation}; -exports.exit = tokenizeListEnd; - - - - - - - - - - -function tokenizeListStart(effects, ok, nok) { - var self = this; - var initialSize = prefixSize_1(self.events, 'linePrefix'); - var valueSize; - - return start - - function start(code) { - if ( - (code === 42 || code === 43 || code === 45) && - (!self.containerState.marker || code === self.containerState.marker) - ) { - return code === 42 || code === 45 - ? effects.check(thematicBreak, nok, unordered)(code) - : unordered(code) - } - - if ( - asciiDigit(code) && - (!self.containerState.type || self.containerState.type === 'listOrdered') - ) { - return ordered(code) - } - - return nok(code) - } - - function unordered(code) { - if (!self.containerState.type) { - self.containerState.type = 'listUnordered'; - effects.enter(self.containerState.type, {_container: true}); - } - - effects.enter('listItemPrefix'); - return atMarker(code) - } - - function ordered(code) { - if (self.containerState.type || !self.interrupt || code === 49) { - if (!self.containerState.type) { - self.containerState.type = 'listOrdered'; - effects.enter(self.containerState.type, {_container: true}); - } - - effects.enter('listItemPrefix'); - effects.enter('listItemValue'); - effects.consume(code); - valueSize = 1; - return self.interrupt ? afterValue : inside - } - - return nok(code) - } - - function inside(code) { - if (asciiDigit(code) && ++valueSize < 10) { - effects.consume(code); - return inside - } - - return afterValue(code) - } - - function afterValue(code) { - effects.exit('listItemValue'); - - return code === 41 || code === 46 ? atMarker(code) : nok(code) - } - - function atMarker(code) { - self.containerState.marker = self.containerState.marker || code; - - if (code === self.containerState.marker) { - effects.enter('listItemMarker'); - effects.consume(code); - effects.exit('listItemMarker'); - return effects.check( - partialBlankLine, - // Canā€™t be empty when interrupting. - self.interrupt ? nok : onBlank, - effects.attempt( - {tokenize: tokenizeListItemPrefixWhitespace, partial: true}, - endOfPrefix, - otherPrefix - ) - ) - } - - return nok(code) - } - - function onBlank(code) { - self.containerState.initialBlankLine = true; - initialSize++; - return endOfPrefix(code) - } - - function otherPrefix(code) { - if (markdownSpace_1(code)) { - effects.enter('listItemPrefixWhitespace'); - effects.consume(code); - effects.exit('listItemPrefixWhitespace'); - return endOfPrefix - } - - return nok(code) - } - - function endOfPrefix(code) { - self.containerState.size = - initialSize + sizeChunks_1(self.sliceStream(effects.exit('listItemPrefix'))); - return ok(code) - } -} - -function tokenizeListContinuation(effects, ok, nok) { - var self = this; - - self.containerState._closeFlow = undefined; - - return effects.check(partialBlankLine, onBlank, notBlank) - - function onBlank(code) { - self.containerState.furtherBlankLines = - self.containerState.furtherBlankLines || - self.containerState.initialBlankLine; - return ok(code) - } - - function notBlank(code) { - if (self.containerState.furtherBlankLines || !markdownSpace_1(code)) { - self.containerState.furtherBlankLines = self.containerState.initialBlankLine = undefined; - return notInCurrentItem(code) - } - - self.containerState.furtherBlankLines = self.containerState.initialBlankLine = undefined; - return effects.attempt( - {tokenize: tokenizeIndent, partial: true}, - ok, - notInCurrentItem - )(code) - } - - function notInCurrentItem(code) { - // While we do continue, we signal that the flow should be closed. - self.containerState._closeFlow = true; - // As weā€™re closing flow, weā€™re no longer interrupting - self.interrupt = undefined; - return factorySpace( - effects, - effects.attempt(exports, ok, nok), - 'linePrefix', - 4 - )(code) - } -} - -function tokenizeIndent(effects, ok, nok) { - var self = this; - - return factorySpace( - effects, - afterPrefix, - 'listItemIndent', - - self.containerState.size + 1 - ) - - function afterPrefix(code) { - return prefixSize_1(self.events, 'listItemIndent') === - self.containerState.size - ? ok(code) - : nok(code) - } -} - -function tokenizeListEnd(effects) { - effects.exit(this.containerState.type); -} - -function tokenizeListItemPrefixWhitespace(effects, ok, nok) { - var self = this; - - return factorySpace( - effects, - afterPrefix, - 'listItemPrefixWhitespace', - - 4 + 1 - ) - - function afterPrefix(code) { - return markdownSpace_1(code) || - !prefixSize_1(self.events, 'listItemPrefixWhitespace') - ? nok(code) - : ok(code) - } -} -}); -var list_1 = list.tokenize; -var list_2 = list.continuation; -var list_3 = list.exit; - -var blockQuote = createCommonjsModule(function (module, exports) { -exports.tokenize = tokenizeBlockQuoteStart; -exports.continuation = {tokenize: tokenizeBlockQuoteContinuation}; -exports.exit = exit; - - - - - -function tokenizeBlockQuoteStart(effects, ok, nok) { - var self = this; - - return start - - function start(code) { - if (code === 62) { - if (!self.containerState.open) { - effects.enter('blockQuote', {_container: true}); - self.containerState.open = true; - } - - effects.enter('blockQuotePrefix'); - effects.enter('blockQuoteMarker'); - effects.consume(code); - effects.exit('blockQuoteMarker'); - return after - } +var asciiDigit_1 = asciiDigit; - return nok(code) - } - - function after(code) { - if (markdownSpace_1(code)) { - effects.enter('blockQuotePrefixWhitespace'); - effects.consume(code); - effects.exit('blockQuotePrefixWhitespace'); - effects.exit('blockQuotePrefix'); - return ok - } - - effects.exit('blockQuotePrefix'); - return ok(code) - } -} +var asciiHexDigit = regexCheck_1(/[\dA-Fa-f]/); -function tokenizeBlockQuoteContinuation(effects, ok, nok) { - return factorySpace( - effects, - effects.attempt(exports, ok, nok), - 'linePrefix', - 4 - ) -} +var asciiHexDigit_1 = asciiHexDigit; -function exit(effects) { - effects.exit('blockQuote'); +function _interopDefaultLegacy$1(e) { + return e && typeof e === 'object' && 'default' in e ? e : {default: e} } -}); -var blockQuote_1 = blockQuote.tokenize; -var blockQuote_2 = blockQuote.continuation; -var blockQuote_3 = blockQuote.exit; - -var asciiPunctuation = regexCheck_1(/[!-/:-@[-`{-~]/); - -var tokenize$9 = tokenizeCharacterEscape; - - - -function tokenizeCharacterEscape(effects, ok, nok) { - return start - - function start(code) { - effects.enter('characterEscape'); - effects.enter('escapeMarker'); - effects.consume(code); - effects.exit('escapeMarker'); - return open - } - - function open(code) { - if (asciiPunctuation(code)) { - effects.enter('characterEscapeValue'); - effects.consume(code); - effects.exit('characterEscapeValue'); - effects.exit('characterEscape'); - return ok - } - return nok(code) - } -} +var decodeEntity__default = /*#__PURE__*/ _interopDefaultLegacy$1(decodeEntity_1); -var characterEscape = { - tokenize: tokenize$9 +var characterReference = { + name: 'characterReference', + tokenize: tokenizeCharacterReference }; -var asciiHexDigit = regexCheck_1(/[\dA-Fa-f]/); - -var tokenize$a = tokenizeCharacterReference; - - - - - - function tokenizeCharacterReference(effects, ok, nok) { var self = this; var size = 0; var max; var test; - return start function start(code) { @@ -36901,7 +34380,7 @@ function tokenizeCharacterReference(effects, ok, nok) { effects.enter('characterReferenceValue'); max = 31; - test = asciiAlphanumeric; + test = asciiAlphanumeric_1; return value(code) } @@ -36912,13 +34391,13 @@ function tokenizeCharacterReference(effects, ok, nok) { effects.exit('characterReferenceMarkerHexadecimal'); effects.enter('characterReferenceValue'); max = 6; - test = asciiHexDigit; + test = asciiHexDigit_1; return value } effects.enter('characterReferenceValue'); max = 7; - test = asciiDigit; + test = asciiDigit_1; return value(code) } @@ -36928,7 +34407,10 @@ function tokenizeCharacterReference(effects, ok, nok) { if (code === 59 && size) { token = effects.exit('characterReferenceValue'); - if (test === asciiAlphanumeric && !decodeEntity_1(self.sliceSerialize(token))) { + if ( + test === asciiAlphanumeric_1 && + !decodeEntity__default['default'](self.sliceSerialize(token)) + ) { return nok(code) } @@ -36948,25 +34430,23 @@ function tokenizeCharacterReference(effects, ok, nok) { } } -var characterReference = { - tokenize: tokenize$a -}; - -var tokenize$b = tokenizeCodeFenced; -var concrete = true; - - - - - +var characterReference_1 = characterReference; +var codeFenced = { + name: 'codeFenced', + tokenize: tokenizeCodeFenced, + concrete: true +}; function tokenizeCodeFenced(effects, ok, nok) { var self = this; + var closingFenceConstruct = { + tokenize: tokenizeClosingFence, + partial: true + }; var initialPrefix = prefixSize_1(this.events, 'linePrefix'); var sizeOpen = 0; var marker; - return start function start(code) { @@ -36996,7 +34476,9 @@ function tokenizeCodeFenced(effects, ok, nok) { } effects.enter('codeFencedFenceInfo'); - effects.enter('chunkString', {contentType: 'string'}); + effects.enter('chunkString', { + contentType: 'string' + }); return info(code) } @@ -37018,7 +34500,9 @@ function tokenizeCodeFenced(effects, ok, nok) { } effects.enter('codeFencedFenceMeta'); - effects.enter('chunkString', {contentType: 'string'}); + effects.enter('chunkString', { + contentType: 'string' + }); return meta(code) } @@ -37049,7 +34533,7 @@ function tokenizeCodeFenced(effects, ok, nok) { effects.consume(code); effects.exit('lineEnding'); return effects.attempt( - {tokenize: tokenizeClosingFence, partial: true}, + closingFenceConstruct, after, initialPrefix ? factorySpace(effects, content, 'linePrefix', initialPrefix + 1) @@ -37078,10 +34562,16 @@ function tokenizeCodeFenced(effects, ok, nok) { function tokenizeClosingFence(effects, ok, nok) { var size = 0; + return factorySpace( + effects, + closingSequenceStart, + 'linePrefix', + this.parser.constructs.disable.null.indexOf('codeIndented') > -1 + ? undefined + : 4 + ) - return factorySpace(effects, closingPrefixAfter, 'linePrefix', 4) - - function closingPrefixAfter(code) { + function closingSequenceStart(code) { effects.enter('codeFencedFence'); effects.enter('codeFencedFenceSequence'); return closingSequence(code) @@ -37110,21 +34600,17 @@ function tokenizeCodeFenced(effects, ok, nok) { } } -var codeFenced = { - tokenize: tokenize$b, - concrete: concrete -}; - -var tokenize$c = tokenizeCodeIndented; -var resolve$9 = resolveCodeIndented; - - +var codeFenced_1 = codeFenced; - - - - -var continuedIndent = {tokenize: tokenizeContinuedIndent, partial: true}; +var codeIndented = { + name: 'codeIndented', + tokenize: tokenizeCodeIndented, + resolve: resolveCodeIndented +}; +var indentedContentConstruct = { + tokenize: tokenizeIndentedContent, + partial: true +}; function resolveCodeIndented(events, context) { var code = { @@ -37132,34 +34618,13 @@ function resolveCodeIndented(events, context) { start: events[0][1].start, end: events[events.length - 1][1].end }; - chunkedSplice_1(events, 0, 0, [['enter', code, context]]); chunkedSplice_1(events, events.length, 0, [['exit', code, context]]); - return events } function tokenizeCodeIndented(effects, ok, nok) { - var self = this; - - return factorySpace( - effects, - afterInitial, - 'linePrefix', - - 4 + 1 - ) - - function afterInitial(code) { - // Flow checks blank lines first, so we donā€™t have EOL/EOF. - - if (prefixSize_1(self.events, 'linePrefix') < 4) { - return nok(code) - } - - effects.enter('codeFlowValue'); - return content(code) - } + return effects.attempt(indentedContentConstruct, afterPrefix, nok) function afterPrefix(code) { if (code === null) { @@ -37167,7 +34632,7 @@ function tokenizeCodeIndented(effects, ok, nok) { } if (markdownLineEnding_1(code)) { - return effects.attempt(continuedIndent, afterPrefix, ok)(code) + return effects.attempt(indentedContentConstruct, afterPrefix, ok)(code) } effects.enter('codeFlowValue'); @@ -37185,77 +34650,57 @@ function tokenizeCodeIndented(effects, ok, nok) { } } -function tokenizeContinuedIndent(effects, ok, nok) { +function tokenizeIndentedContent(effects, ok, nok) { var self = this; - - return factorySpace( - effects, - afterPrefix, - 'linePrefix', - - 4 + 1 - ) + return factorySpace(effects, afterPrefix, 'linePrefix', 4 + 1) function afterPrefix(code) { if (markdownLineEnding_1(code)) { effects.enter('lineEnding'); effects.consume(code); effects.exit('lineEnding'); - - return factorySpace( - effects, - afterPrefix, - 'linePrefix', - - 4 + 1 - ) + return factorySpace(effects, afterPrefix, 'linePrefix', 4 + 1) } return prefixSize_1(self.events, 'linePrefix') < 4 ? nok(code) : ok(code) } } -var codeIndented = { - tokenize: tokenize$c, - resolve: resolve$9 -}; - -var tokenize$d = tokenizeCodeText; -var resolve$a = resolveCodeText; -var previous_1 = previous; - +var codeIndented_1 = codeIndented; +var codeText = { + name: 'codeText', + tokenize: tokenizeCodeText, + resolve: resolveCodeText, + previous: previous +}; function resolveCodeText(events) { var tailExitIndex = events.length - 4; var headEnterIndex = 3; var index; - var enter; + var enter; // If we start and end with an EOL or a space. - // If we start and end with an EOL or a space. if ( (events[headEnterIndex][1].type === 'lineEnding' || events[headEnterIndex][1].type === 'space') && (events[tailExitIndex][1].type === 'lineEnding' || events[tailExitIndex][1].type === 'space') ) { - index = headEnterIndex; + index = headEnterIndex; // And we have data. - // And we have data. while (++index < tailExitIndex) { if (events[index][1].type === 'codeTextData') { // Then we have padding. events[tailExitIndex][1].type = events[headEnterIndex][1].type = 'codeTextPadding'; - headEnterIndex += 2; tailExitIndex -= 2; break } } - } + } // Merge adjacent spaces and data. - // Merge adjacent spaces and data. index = headEnterIndex - 1; tailExitIndex++; @@ -37296,7 +34741,6 @@ function tokenizeCodeText(effects, ok, nok) { var sizeOpen = 0; var size; var token; - return start function start(code) { @@ -37320,17 +34764,15 @@ function tokenizeCodeText(effects, ok, nok) { // EOF. if (code === null) { return nok(code) - } - - // Closing fence? + } // Closing fence? // Could also be data. + if (code === 96) { token = effects.enter('codeTextSequence'); size = 0; return closingSequence(code) - } + } // Tabs donā€™t work, and virtual spaces donā€™t make sense. - // Tabs donā€™t work, and virtual spaces donā€™t make sense. if (code === 32) { effects.enter('space'); effects.consume(code); @@ -37343,14 +34785,12 @@ function tokenizeCodeText(effects, ok, nok) { effects.consume(code); effects.exit('lineEnding'); return gap - } + } // Data. - // Data. effects.enter('codeTextData'); return data(code) - } + } // In code. - // In code. function data(code) { if ( code === null || @@ -37364,44 +34804,31 @@ function tokenizeCodeText(effects, ok, nok) { effects.consume(code); return data - } + } // Closing fence. - // Closing fence. function closingSequence(code) { // More. if (code === 96) { effects.consume(code); size++; return closingSequence - } + } // Done! - // Done! if (size === sizeOpen) { effects.exit('codeTextSequence'); effects.exit('codeText'); return ok(code) - } + } // More or less accents: mark as data. - // More or less accents: mark as data. token.type = 'codeTextData'; return data(code) } } -var codeText = { - tokenize: tokenize$d, - resolve: resolve$a, - previous: previous_1 -}; - -var factoryDestination = createDestination; - - - - +var codeText_1 = codeText; // eslint-disable-next-line max-params -function createDestination( +function destinationFactory( effects, ok, nok, @@ -37414,7 +34841,6 @@ function createDestination( ) { var limit = max || Infinity; var balance = 0; - return start function start(code) { @@ -37434,7 +34860,9 @@ function createDestination( effects.enter(type); effects.enter(rawType); effects.enter(stringType); - effects.enter('chunkString', {contentType: 'string'}); + effects.enter('chunkString', { + contentType: 'string' + }); return destinationRaw(code) } @@ -37449,7 +34877,9 @@ function createDestination( } effects.enter(stringType); - effects.enter('chunkString', {contentType: 'string'}); + effects.enter('chunkString', { + contentType: 'string' + }); return destinationEnclosed(code) } @@ -37521,17 +34951,13 @@ function createDestination( } } -var factoryLabel = createLabel; - - - +var factoryDestination = destinationFactory; // eslint-disable-next-line max-params -function createLabel(effects, ok, nok, type, markerType, stringType) { +function labelFactory(effects, ok, nok, type, markerType, stringType) { var self = this; var size = 0; var data; - return start function start(code) { @@ -37548,9 +34974,11 @@ function createLabel(effects, ok, nok, type, markerType, stringType) { code === null || code === 91 || (code === 93 && !data) || - /* istanbul ignore next - footnotes. */ + /* c8 ignore next */ (code === 94 && + /* c8 ignore next */ !size && + /* c8 ignore next */ '_hiddenFootnoteSupport' in self.parser.constructs) || size > 999 ) { @@ -37573,7 +35001,9 @@ function createLabel(effects, ok, nok, type, markerType, stringType) { return atBreak } - effects.enter('chunkString', {contentType: 'string'}); + effects.enter('chunkString', { + contentType: 'string' + }); return label(code) } @@ -37605,14 +35035,9 @@ function createLabel(effects, ok, nok, type, markerType, stringType) { } } -var factoryWhitespace = createWhitespace; - - +var factoryLabel = labelFactory; - - - -function createWhitespace(effects, ok) { +function whitespaceFactory(effects, ok) { var seen; return start @@ -37637,16 +35062,10 @@ function createWhitespace(effects, ok) { } } -var factoryTitle = createTitle; - +var factoryWhitespace = whitespaceFactory; - - - -// eslint-disable-next-line max-params -function createTitle(effects, ok, nok, type, markerType, stringType) { +function titleFactory(effects, ok, nok, type, markerType, stringType) { var marker; - return start function start(code) { @@ -37679,9 +35098,8 @@ function createTitle(effects, ok, nok, type, markerType, stringType) { if (code === null) { return nok(code) - } + } // Note: blank lines canā€™t exist in content. - // Note: blank lines canā€™t exist in content. if (markdownLineEnding_1(code)) { effects.enter('lineEnding'); effects.consume(code); @@ -37689,7 +35107,9 @@ function createTitle(effects, ok, nok, type, markerType, stringType) { return factorySpace(effects, atTitleBreak, 'linePrefix') } - effects.enter('chunkString', {contentType: 'string'}); + effects.enter('chunkString', { + contentType: 'string' + }); return title(code) } @@ -37713,28 +35133,20 @@ function createTitle(effects, ok, nok, type, markerType, stringType) { } } -var tokenize$e = tokenizeDefinition; - - - - - - - - - +var factoryTitle = titleFactory; +var definition = { + name: 'definition', + tokenize: tokenizeDefinition +}; +var titleConstruct = { + tokenize: tokenizeTitle, + partial: true +}; function tokenizeDefinition(effects, ok, nok) { var self = this; - var destinationAfter = effects.attempt( - {tokenize: tokenizeTitle, partial: true}, - factorySpace(effects, after, 'whitespace'), - factorySpace(effects, after, 'whitespace') - ); - var identifier; - return start function start(code) { @@ -37758,14 +35170,17 @@ function tokenizeDefinition(effects, ok, nok) { if (code === 58) { effects.enter('definitionMarker'); effects.consume(code); - effects.exit('definitionMarker'); + effects.exit('definitionMarker'); // Note: blank lines canā€™t exist in content. - // Note: blank lines canā€™t exist in content. return factoryWhitespace( effects, factoryDestination( effects, - destinationAfter, + effects.attempt( + titleConstruct, + factorySpace(effects, after, 'whitespace'), + factorySpace(effects, after, 'whitespace') + ), nok, 'definitionDestination', 'definitionDestinationLiteral', @@ -37823,13 +35238,12 @@ function tokenizeTitle(effects, ok, nok) { } } -var definition = { - tokenize: tokenize$e -}; - -var tokenize$f = tokenizeHardBreakEscape; - +var definition_1 = definition; +var hardBreakEscape = { + name: 'hardBreakEscape', + tokenize: tokenizeHardBreakEscape +}; function tokenizeHardBreakEscape(effects, ok, nok) { return start @@ -37852,12 +35266,132 @@ function tokenizeHardBreakEscape(effects, ok, nok) { } } -var hardBreakEscape = { - tokenize: tokenize$f +var hardBreakEscape_1 = hardBreakEscape; + +var headingAtx = { + name: 'headingAtx', + tokenize: tokenizeHeadingAtx, + resolve: resolveHeadingAtx }; +function resolveHeadingAtx(events, context) { + var contentEnd = events.length - 2; + var contentStart = 3; + var content; + var text; // Prefix whitespace, part of the opening. + + if (events[contentStart][1].type === 'whitespace') { + contentStart += 2; + } // Suffix whitespace, part of the closing. + + if ( + contentEnd - 2 > contentStart && + events[contentEnd][1].type === 'whitespace' + ) { + contentEnd -= 2; + } + + if ( + events[contentEnd][1].type === 'atxHeadingSequence' && + (contentStart === contentEnd - 1 || + (contentEnd - 4 > contentStart && + events[contentEnd - 2][1].type === 'whitespace')) + ) { + contentEnd -= contentStart + 1 === contentEnd ? 2 : 4; + } + + if (contentEnd > contentStart) { + content = { + type: 'atxHeadingText', + start: events[contentStart][1].start, + end: events[contentEnd][1].end + }; + text = { + type: 'chunkText', + start: events[contentStart][1].start, + end: events[contentEnd][1].end, + contentType: 'text' + }; + chunkedSplice_1(events, contentStart, contentEnd - contentStart + 1, [ + ['enter', content, context], + ['enter', text, context], + ['exit', text, context], + ['exit', content, context] + ]); + } + + return events +} + +function tokenizeHeadingAtx(effects, ok, nok) { + var self = this; + var size = 0; + return start + + function start(code) { + effects.enter('atxHeading'); + effects.enter('atxHeadingSequence'); + return fenceOpenInside(code) + } + + function fenceOpenInside(code) { + if (code === 35 && size++ < 6) { + effects.consume(code); + return fenceOpenInside + } + + if (code === null || markdownLineEndingOrSpace_1(code)) { + effects.exit('atxHeadingSequence'); + return self.interrupt ? ok(code) : headingBreak(code) + } + + return nok(code) + } + + function headingBreak(code) { + if (code === 35) { + effects.enter('atxHeadingSequence'); + return sequence(code) + } + + if (code === null || markdownLineEnding_1(code)) { + effects.exit('atxHeading'); + return ok(code) + } + + if (markdownSpace_1(code)) { + return factorySpace(effects, headingBreak, 'whitespace')(code) + } + + effects.enter('atxHeadingText'); + return data(code) + } + + function sequence(code) { + if (code === 35) { + effects.consume(code); + return sequence + } + + effects.exit('atxHeadingSequence'); + return headingBreak(code) + } + + function data(code) { + if (code === null || code === 35 || markdownLineEndingOrSpace_1(code)) { + effects.exit('atxHeadingText'); + return headingBreak(code) + } + + effects.consume(code); + return data + } +} + +var headingAtx_1 = headingAtx; + // This module is copied from . -var htmlBlockNames = [ +var basics = [ 'address', 'article', 'aside', @@ -37922,29 +35456,25 @@ var htmlBlockNames = [ 'ul' ]; -// This module is copied from . -var htmlRawNames = ['pre', 'script', 'style']; - -var tokenize$g = tokenizeHtml; -var resolveTo = resolveToHtml; -var concrete$1 = true; - - - - - - - - - - - +var htmlBlockNames = basics; +// This module is copied from . +var raws = ['pre', 'script', 'style', 'textarea']; +var htmlRawNames = raws; -var nextBlank = {tokenize: tokenizeNextBlank, partial: true}; +var htmlFlow = { + name: 'htmlFlow', + tokenize: tokenizeHtmlFlow, + resolveTo: resolveToHtmlFlow, + concrete: true +}; +var nextBlankConstruct = { + tokenize: tokenizeNextBlank, + partial: true +}; -function resolveToHtml(events) { +function resolveToHtmlFlow(events) { var index = events.length; while (index--) { @@ -37955,24 +35485,23 @@ function resolveToHtml(events) { if (index > 1 && events[index - 2][1].type === 'linePrefix') { // Add the prefix start to the HTML token. - events[index][1].start = events[index - 2][1].start; - // Add the prefix start to the HTML line token. - events[index + 1][1].start = events[index - 2][1].start; - // Remove the line prefix. + events[index][1].start = events[index - 2][1].start; // Add the prefix start to the HTML line token. + + events[index + 1][1].start = events[index - 2][1].start; // Remove the line prefix. + events.splice(index - 2, 2); } return events } -function tokenizeHtml(effects, ok, nok) { +function tokenizeHtmlFlow(effects, ok, nok) { var self = this; var kind; var startTag; var buffer; var index; var marker; - return start function start(code) { @@ -37995,15 +35524,15 @@ function tokenizeHtml(effects, ok, nok) { if (code === 63) { effects.consume(code); - kind = 3; - // While weā€™re in an instruction instead of a declaration, weā€™re on a `?` + kind = 3; // While weā€™re in an instruction instead of a declaration, weā€™re on a `?` // right now, so we do need to search for `>`, similar to declarations. + return self.interrupt ? ok : continuationDeclarationInside } - if (asciiAlpha(code)) { + if (asciiAlpha_1(code)) { effects.consume(code); - buffer = fromCharCode(code); + buffer = fromCharCode_1(code); startTag = true; return tagName } @@ -38026,7 +35555,7 @@ function tokenizeHtml(effects, ok, nok) { return cdataOpenInside } - if (asciiAlpha(code)) { + if (asciiAlpha_1(code)) { effects.consume(code); kind = 4; return self.interrupt ? ok : continuationDeclarationInside @@ -38058,9 +35587,9 @@ function tokenizeHtml(effects, ok, nok) { } function tagCloseStart(code) { - if (asciiAlpha(code)) { + if (asciiAlpha_1(code)) { effects.consume(code); - buffer = fromCharCode(code); + buffer = fromCharCode_1(code); return tagName } @@ -38074,7 +35603,11 @@ function tokenizeHtml(effects, ok, nok) { code === 62 || markdownLineEndingOrSpace_1(code) ) { - if (code !== 47 && startTag && htmlRawNames.indexOf(buffer.toLowerCase()) > -1) { + if ( + code !== 47 && + startTag && + htmlRawNames.indexOf(buffer.toLowerCase()) > -1 + ) { kind = 1; return self.interrupt ? ok(code) : continuation(code) } @@ -38090,8 +35623,8 @@ function tokenizeHtml(effects, ok, nok) { return self.interrupt ? ok(code) : continuation(code) } - kind = 7; - // Do not support complete HTML when interrupting. + kind = 7; // Do not support complete HTML when interrupting. + return self.interrupt ? nok(code) : startTag @@ -38099,9 +35632,9 @@ function tokenizeHtml(effects, ok, nok) { : completeClosingTagAfter(code) } - if (code === 45 || asciiAlphanumeric(code)) { + if (code === 45 || asciiAlphanumeric_1(code)) { effects.consume(code); - buffer += fromCharCode(code); + buffer += fromCharCode_1(code); return tagName } @@ -38132,7 +35665,7 @@ function tokenizeHtml(effects, ok, nok) { return completeEnd } - if (code === 58 || code === 95 || asciiAlpha(code)) { + if (code === 58 || code === 95 || asciiAlpha_1(code)) { effects.consume(code); return completeAttributeName } @@ -38151,7 +35684,7 @@ function tokenizeHtml(effects, ok, nok) { code === 46 || code === 58 || code === 95 || - asciiAlphanumeric(code) + asciiAlphanumeric_1(code) ) { effects.consume(code); return completeAttributeName @@ -38288,7 +35821,7 @@ function tokenizeHtml(effects, ok, nok) { if (markdownLineEnding_1(code) && (kind === 6 || kind === 7)) { return effects.check( - nextBlank, + nextBlankConstruct, continuationClose, continuationAtLineEnding )(code) @@ -38348,9 +35881,9 @@ function tokenizeHtml(effects, ok, nok) { return continuationClose } - if (asciiAlpha(code) && buffer.length < 6) { + if (asciiAlpha_1(code) && buffer.length < 8) { effects.consume(code); - buffer += fromCharCode(code); + buffer += fromCharCode_1(code); return continuationRawEndTag } @@ -38399,32 +35932,23 @@ function tokenizeNextBlank(effects, ok, nok) { effects.enter('lineEndingBlank'); effects.consume(code); effects.exit('lineEndingBlank'); - return effects.attempt(partialBlankLine, ok, nok) + return effects.attempt(partialBlankLine_1, ok, nok) } } -var htmlFlow = { - tokenize: tokenize$g, - resolveTo: resolveTo, - concrete: concrete$1 -}; - -var tokenize$h = tokenizeHtml$1; - - - - - - - +var htmlFlow_1 = htmlFlow; +var htmlText = { + name: 'htmlText', + tokenize: tokenizeHtmlText +}; -function tokenizeHtml$1(effects, ok, nok) { +function tokenizeHtmlText(effects, ok, nok) { + var self = this; var marker; var buffer; var index; var returnState; - return start function start(code) { @@ -38450,7 +35974,7 @@ function tokenizeHtml$1(effects, ok, nok) { return instruction } - if (asciiAlpha(code)) { + if (asciiAlpha_1(code)) { effects.consume(code); return tagOpen } @@ -38471,7 +35995,7 @@ function tokenizeHtml$1(effects, ok, nok) { return cdataOpen } - if (asciiAlpha(code)) { + if (asciiAlpha_1(code)) { effects.consume(code); return declaration } @@ -38556,6 +36080,11 @@ function tokenizeHtml$1(effects, ok, nok) { return cdataClose } + if (markdownLineEnding_1(code)) { + returnState = cdata; + return atLineEnding(code) + } + effects.consume(code); return cdata } @@ -38620,7 +36149,7 @@ function tokenizeHtml$1(effects, ok, nok) { } function tagCloseStart(code) { - if (asciiAlpha(code)) { + if (asciiAlpha_1(code)) { effects.consume(code); return tagClose } @@ -38629,7 +36158,7 @@ function tokenizeHtml$1(effects, ok, nok) { } function tagClose(code) { - if (code === 45 || asciiAlphanumeric(code)) { + if (code === 45 || asciiAlphanumeric_1(code)) { effects.consume(code); return tagClose } @@ -38652,7 +36181,7 @@ function tokenizeHtml$1(effects, ok, nok) { } function tagOpen(code) { - if (code === 45 || asciiAlphanumeric(code)) { + if (code === 45 || asciiAlphanumeric_1(code)) { effects.consume(code); return tagOpen } @@ -38670,7 +36199,7 @@ function tokenizeHtml$1(effects, ok, nok) { return end } - if (code === 58 || code === 95 || asciiAlpha(code)) { + if (code === 58 || code === 95 || asciiAlpha_1(code)) { effects.consume(code); return tagOpenAttributeName } @@ -38694,7 +36223,7 @@ function tokenizeHtml$1(effects, ok, nok) { code === 46 || code === 58 || code === 95 || - asciiAlphanumeric(code) + asciiAlphanumeric_1(code) ) { effects.consume(code); return tagOpenAttributeName @@ -38799,16 +36328,22 @@ function tokenizeHtml$1(effects, ok, nok) { effects.consume(code); return tagOpenAttributeValueUnquoted - } - - // We canā€™t have blank lines in content, so no need to worry about empty + } // We canā€™t have blank lines in content, so no need to worry about empty // tokens. + function atLineEnding(code) { effects.exit('htmlTextData'); effects.enter('lineEnding'); effects.consume(code); effects.exit('lineEnding'); - return factorySpace(effects, afterPrefix, 'linePrefix', 4) + return factorySpace( + effects, + afterPrefix, + 'linePrefix', + self.parser.constructs.disable.null.indexOf('codeIndented') > -1 + ? undefined + : 4 + ) } function afterPrefix(code) { @@ -38828,28 +36363,23 @@ function tokenizeHtml$1(effects, ok, nok) { } } -var htmlText = { - tokenize: tokenize$h -}; - -var tokenize$i = tokenizeLabelEnd; -var resolveTo$1 = resolveToLabelEnd; -var resolveAll_1$2 = resolveAllLabelEnd; - - - - - - +var htmlText_1 = htmlText; - - - - - -var resource = {tokenize: tokenizeResource}; -var fullReference = {tokenize: tokenizeFullReference}; -var collapsedReference = {tokenize: tokenizeCollapsedReference}; +var labelEnd = { + name: 'labelEnd', + tokenize: tokenizeLabelEnd, + resolveTo: resolveToLabelEnd, + resolveAll: resolveAllLabelEnd +}; +var resourceConstruct = { + tokenize: tokenizeResource +}; +var fullReferenceConstruct = { + tokenize: tokenizeFullReference +}; +var collapsedReferenceConstruct = { + tokenize: tokenizeCollapsedReference +}; function resolveAllLabelEnd(events) { var index = -1; @@ -38883,9 +36413,8 @@ function resolveToLabelEnd(events, context) { var token; var open; var close; - var media; + var media; // Find an opening. - // Find an opening. while (index--) { token = events[index][1]; @@ -38896,10 +36425,9 @@ function resolveToLabelEnd(events, context) { (token.type === 'labelLink' && token._inactive) ) { break - } - - // Mark other link openings as inactive, as we canā€™t have links in + } // Mark other link openings as inactive, as we canā€™t have links in // links. + if (events[index][0] === 'enter' && token.type === 'labelLink') { token._inactive = true; } @@ -38926,63 +36454,45 @@ function resolveToLabelEnd(events, context) { start: shallow_1(events[open][1].start), end: shallow_1(events[events.length - 1][1].end) }; - label = { type: 'label', start: shallow_1(events[open][1].start), end: shallow_1(events[close][1].end) }; - text = { type: 'labelText', start: shallow_1(events[open + offset + 2][1].end), end: shallow_1(events[close - 2][1].start) }; - media = [ ['enter', group, context], ['enter', label, context] - ]; + ]; // Opening marker. - // Opening marker. - chunkedSplice_1( - media, - media.length, - 0, - events.slice(open + 1, open + offset + 3) - ); + media = chunkedPush_1(media, events.slice(open + 1, open + offset + 3)); // Text open. - // Text open. - chunkedSplice_1(media, media.length, 0, [['enter', text, context]]); + media = chunkedPush_1(media, [['enter', text, context]]); // Between. - // Between. - chunkedSplice_1( + media = chunkedPush_1( media, - media.length, - 0, resolveAll_1( context.parser.constructs.insideSpan.null, events.slice(open + offset + 4, close - 3), context ) - ); + ); // Text close, marker close, label close. - // Text close, marker close, label close. - chunkedSplice_1(media, media.length, 0, [ + media = chunkedPush_1(media, [ ['exit', text, context], events[close - 2], events[close - 1], ['exit', label, context] - ]); + ]); // Reference, resource, or so. - // Reference, resource, or so. - chunkedSplice_1(media, media.length, 0, events.slice(close + 1)); - - // Media close. - chunkedSplice_1(media, media.length, 0, [['exit', group, context]]); + media = chunkedPush_1(media, events.slice(close + 1)); // Media close. + media = chunkedPush_1(media, [['exit', group, context]]); chunkedSplice_1(events, open, events.length, media); - return events } @@ -38990,9 +36500,8 @@ function tokenizeLabelEnd(effects, ok, nok) { var self = this; var index = self.events.length; var labelStart; - var defined; + var defined; // Find an opening. - // Find an opening. while (index--) { if ( (self.events[index][1].type === 'labelImage' || @@ -39009,14 +36518,16 @@ function tokenizeLabelEnd(effects, ok, nok) { function start(code) { if (!labelStart) { return nok(code) - } + } // Itā€™s a balanced bracket, but contains a link. - // Itā€™s a balanced bracket, but contains a link. if (labelStart._inactive) return balanced(code) defined = self.parser.defined.indexOf( normalizeIdentifier_1( - self.sliceSerialize({start: labelStart.end, end: self.now()}) + self.sliceSerialize({ + start: labelStart.end, + end: self.now() + }) ) ) > -1; effects.enter('labelEnd'); @@ -39030,19 +36541,23 @@ function tokenizeLabelEnd(effects, ok, nok) { function afterLabelEnd(code) { // Resource: `[asd](fgh)`. if (code === 40) { - return effects.attempt(resource, ok, defined ? ok : balanced)(code) - } + return effects.attempt( + resourceConstruct, + ok, + defined ? ok : balanced + )(code) + } // Collapsed (`[asd][]`) or full (`[asd][fgh]`) reference? - // Collapsed (`[asd][]`) or full (`[asd][fgh]`) reference? if (code === 91) { return effects.attempt( - fullReference, + fullReferenceConstruct, ok, - defined ? effects.attempt(collapsedReference, ok, balanced) : balanced + defined + ? effects.attempt(collapsedReferenceConstruct, ok, balanced) + : balanced )(code) - } + } // Shortcut reference: `[asd]`? - // Shortcut reference: `[asd]`? return defined ? ok(code) : balanced(code) } @@ -39117,7 +36632,6 @@ function tokenizeResource(effects, ok, nok) { function tokenizeFullReference(effects, ok, nok) { var self = this; - return start function start(code) { @@ -39167,18 +36681,16 @@ function tokenizeCollapsedReference(effects, ok, nok) { } } -var labelEnd = { - tokenize: tokenize$i, - resolveTo: resolveTo$1, - resolveAll: resolveAll_1$2 -}; +var labelEnd_1 = labelEnd; -var tokenize$j = tokenizelabelImage; -var resolveAll$1 = labelEnd.resolveAll; +var labelStartImage = { + name: 'labelStartImage', + tokenize: tokenizeLabelStartImage, + resolveAll: labelEnd_1.resolveAll +}; -function tokenizelabelImage(effects, ok, nok) { +function tokenizeLabelStartImage(effects, ok, nok) { var self = this; - return start function start(code) { @@ -39202,65 +36714,328 @@ function tokenizelabelImage(effects, ok, nok) { } function after(code) { - /* istanbul ignore next - footnotes. */ - return code === 94 && '_hiddenFootnoteSupport' in self.parser.constructs - ? nok(code) + /* c8 ignore next */ + return code === 94 && + /* c8 ignore next */ + '_hiddenFootnoteSupport' in self.parser.constructs + ? /* c8 ignore next */ + nok(code) + : ok(code) + } +} + +var labelStartImage_1 = labelStartImage; + +var labelStartLink = { + name: 'labelStartLink', + tokenize: tokenizeLabelStartLink, + resolveAll: labelEnd_1.resolveAll +}; + +function tokenizeLabelStartLink(effects, ok, nok) { + var self = this; + return start + + function start(code) { + effects.enter('labelLink'); + effects.enter('labelMarker'); + effects.consume(code); + effects.exit('labelMarker'); + effects.exit('labelLink'); + return after + } + + function after(code) { + /* c8 ignore next */ + return code === 94 && + /* c8 ignore next */ + '_hiddenFootnoteSupport' in self.parser.constructs + ? /* c8 ignore next */ + nok(code) : ok(code) } } -var labelStartImage = { - tokenize: tokenize$j, - resolveAll: resolveAll$1 -}; - -var tokenize$k = tokenizelabelLink; -var resolveAll$2 = labelEnd.resolveAll; +var labelStartLink_1 = labelStartLink; + +var lineEnding = { + name: 'lineEnding', + tokenize: tokenizeLineEnding +}; + +function tokenizeLineEnding(effects, ok) { + return start + + function start(code) { + effects.enter('lineEnding'); + effects.consume(code); + effects.exit('lineEnding'); + return factorySpace(effects, ok, 'linePrefix') + } +} + +var lineEnding_1 = lineEnding; + +var thematicBreak = { + name: 'thematicBreak', + tokenize: tokenizeThematicBreak +}; + +function tokenizeThematicBreak(effects, ok, nok) { + var size = 0; + var marker; + return start + + function start(code) { + effects.enter('thematicBreak'); + marker = code; + return atBreak(code) + } + + function atBreak(code) { + if (code === marker) { + effects.enter('thematicBreakSequence'); + return sequence(code) + } + + if (markdownSpace_1(code)) { + return factorySpace(effects, atBreak, 'whitespace')(code) + } + + if (size < 3 || (code !== null && !markdownLineEnding_1(code))) { + return nok(code) + } + + effects.exit('thematicBreak'); + return ok(code) + } + + function sequence(code) { + if (code === marker) { + effects.consume(code); + size++; + return sequence + } + + effects.exit('thematicBreakSequence'); + return atBreak(code) + } +} + +var thematicBreak_1 = thematicBreak; + +var list = { + name: 'list', + tokenize: tokenizeListStart, + continuation: { + tokenize: tokenizeListContinuation + }, + exit: tokenizeListEnd +}; +var listItemPrefixWhitespaceConstruct = { + tokenize: tokenizeListItemPrefixWhitespace, + partial: true +}; +var indentConstruct = { + tokenize: tokenizeIndent, + partial: true +}; + +function tokenizeListStart(effects, ok, nok) { + var self = this; + var initialSize = prefixSize_1(self.events, 'linePrefix'); + var size = 0; + return start + + function start(code) { + var kind = + self.containerState.type || + (code === 42 || code === 43 || code === 45 + ? 'listUnordered' + : 'listOrdered'); + + if ( + kind === 'listUnordered' + ? !self.containerState.marker || code === self.containerState.marker + : asciiDigit_1(code) + ) { + if (!self.containerState.type) { + self.containerState.type = kind; + effects.enter(kind, { + _container: true + }); + } + + if (kind === 'listUnordered') { + effects.enter('listItemPrefix'); + return code === 42 || code === 45 + ? effects.check(thematicBreak_1, nok, atMarker)(code) + : atMarker(code) + } + + if (!self.interrupt || code === 49) { + effects.enter('listItemPrefix'); + effects.enter('listItemValue'); + return inside(code) + } + } + + return nok(code) + } + + function inside(code) { + if (asciiDigit_1(code) && ++size < 10) { + effects.consume(code); + return inside + } + + if ( + (!self.interrupt || size < 2) && + (self.containerState.marker + ? code === self.containerState.marker + : code === 41 || code === 46) + ) { + effects.exit('listItemValue'); + return atMarker(code) + } + + return nok(code) + } + + function atMarker(code) { + effects.enter('listItemMarker'); + effects.consume(code); + effects.exit('listItemMarker'); + self.containerState.marker = self.containerState.marker || code; + return effects.check( + partialBlankLine_1, // Canā€™t be empty when interrupting. + self.interrupt ? nok : onBlank, + effects.attempt( + listItemPrefixWhitespaceConstruct, + endOfPrefix, + otherPrefix + ) + ) + } + + function onBlank(code) { + self.containerState.initialBlankLine = true; + initialSize++; + return endOfPrefix(code) + } + + function otherPrefix(code) { + if (markdownSpace_1(code)) { + effects.enter('listItemPrefixWhitespace'); + effects.consume(code); + effects.exit('listItemPrefixWhitespace'); + return endOfPrefix + } + + return nok(code) + } + + function endOfPrefix(code) { + self.containerState.size = + initialSize + sizeChunks_1(self.sliceStream(effects.exit('listItemPrefix'))); + return ok(code) + } +} + +function tokenizeListContinuation(effects, ok, nok) { + var self = this; + self.containerState._closeFlow = undefined; + return effects.check(partialBlankLine_1, onBlank, notBlank) + + function onBlank(code) { + self.containerState.furtherBlankLines = + self.containerState.furtherBlankLines || + self.containerState.initialBlankLine; + return ok(code) + } + + function notBlank(code) { + if (self.containerState.furtherBlankLines || !markdownSpace_1(code)) { + self.containerState.furtherBlankLines = self.containerState.initialBlankLine = undefined; + return notInCurrentItem(code) + } + + self.containerState.furtherBlankLines = self.containerState.initialBlankLine = undefined; + return effects.attempt(indentConstruct, ok, notInCurrentItem)(code) + } + + function notInCurrentItem(code) { + // While we do continue, we signal that the flow should be closed. + self.containerState._closeFlow = true; // As weā€™re closing flow, weā€™re no longer interrupting. + + self.interrupt = undefined; + return factorySpace( + effects, + effects.attempt(list, ok, nok), + 'linePrefix', + self.parser.constructs.disable.null.indexOf('codeIndented') > -1 + ? undefined + : 4 + )(code) + } +} + +function tokenizeIndent(effects, ok, nok) { + var self = this; + return factorySpace( + effects, + afterPrefix, + 'listItemIndent', + self.containerState.size + 1 + ) + + function afterPrefix(code) { + return prefixSize_1(self.events, 'listItemIndent') === + self.containerState.size + ? ok(code) + : nok(code) + } +} + +function tokenizeListEnd(effects) { + effects.exit(this.containerState.type); +} -function tokenizelabelLink(effects, ok, nok) { +function tokenizeListItemPrefixWhitespace(effects, ok, nok) { var self = this; + return factorySpace( + effects, + afterPrefix, + 'listItemPrefixWhitespace', + self.parser.constructs.disable.null.indexOf('codeIndented') > -1 + ? undefined + : 4 + 1 + ) - return start - - function start(code) { - effects.enter('labelLink'); - effects.enter('labelMarker'); - effects.consume(code); - effects.exit('labelMarker'); - effects.exit('labelLink'); - return after - } - - function after(code) { - /* istanbul ignore next - footnotes. */ - return code === 94 && '_hiddenFootnoteSupport' in self.parser.constructs + function afterPrefix(code) { + return markdownSpace_1(code) || + !prefixSize_1(self.events, 'listItemPrefixWhitespace') ? nok(code) : ok(code) } } -var labelStartLink = { - tokenize: tokenize$k, - resolveAll: resolveAll$2 -}; - -var tokenize$l = tokenizeSetextUnderline; -var resolveTo$2 = resolveToSetextUnderline; - - - - +var list_1 = list; +var setextUnderline = { + name: 'setextUnderline', + tokenize: tokenizeSetextUnderline, + resolveTo: resolveToSetextUnderline +}; function resolveToSetextUnderline(events, context) { var index = events.length; var content; var text; var definition; - var heading; - - // Find the opening of the content. + var heading; // Find the opening of the content. // Itā€™ll always exist: we donā€™t tokenize if it isnā€™t there. + while (index--) { if (events[index][0] === 'enter') { if (events[index][1].type === 'content') { @@ -39271,8 +37046,7 @@ function resolveToSetextUnderline(events, context) { if (events[index][1].type === 'paragraph') { text = index; } - } - // Exit + } // Exit else { if (events[index][1].type === 'content') { // Remove the content end (if needed weā€™ll add it later) @@ -39289,24 +37063,20 @@ function resolveToSetextUnderline(events, context) { type: 'setextHeading', start: shallow_1(events[text][1].start), end: shallow_1(events[events.length - 1][1].end) - }; - - // Change the paragraph to setext heading text. - events[text][1].type = 'setextHeadingText'; + }; // Change the paragraph to setext heading text. - // If we have definitions in the content, weā€™ll keep on having content, + events[text][1].type = 'setextHeadingText'; // If we have definitions in the content, weā€™ll keep on having content, // but we need move it. + if (definition) { events.splice(text, 0, ['enter', heading, context]); events.splice(definition + 1, 0, ['exit', events[content][1], context]); events[content][1].end = shallow_1(events[definition][1].end); } else { events[content][1] = heading; - } + } // Add the heading exit at the end. - // Add the heading exit at the end. events.push(['exit', heading, context]); - return events } @@ -39314,9 +37084,8 @@ function tokenizeSetextUnderline(effects, ok, nok) { var self = this; var index = self.events.length; var marker; - var paragraph; + var paragraph; // Find an opening. - // Find an opening. while (index--) { // Skip enter/exit of line ending, line prefix, and content. // We can now either have a definition or a paragraph. @@ -39363,613 +37132,163 @@ function tokenizeSetextUnderline(effects, ok, nok) { } } -var setextUnderline = { - tokenize: tokenize$l, - resolveTo: resolveTo$2 -}; - -var tokenize$m = tokenizeWhitespace; - - - - - -function tokenizeWhitespace(effects, ok) { - return start - - function start(code) { - effects.enter('lineEnding'); - effects.consume(code); - effects.exit('lineEnding'); - return factorySpace(effects, ok, 'linePrefix') - } -} - -var lineEnding = { - tokenize: tokenize$m -}; - -var resolveText = text.resolver; +var setextUnderline_1 = setextUnderline; var document$2 = { - 42: list, // Asterisk - 43: list, // Plus sign - 45: list, // Dash - 48: list, // 0 - 49: list, // 1 - 50: list, // 2 - 51: list, // 3 - 52: list, // 4 - 53: list, // 5 - 54: list, // 6 - 55: list, // 7 - 56: list, // 8 - 57: list, // 9 - 62: blockQuote // Greater than + 42: list_1, + // Asterisk + 43: list_1, + // Plus sign + 45: list_1, + // Dash + 48: list_1, + // 0 + 49: list_1, + // 1 + 50: list_1, + // 2 + 51: list_1, + // 3 + 52: list_1, + // 4 + 53: list_1, + // 5 + 54: list_1, + // 6 + 55: list_1, + // 7 + 56: list_1, + // 8 + 57: list_1, + // 9 + 62: blockQuote_1 // Greater than }; - var contentInitial = { - 91: definition // Left square bracket + 91: definition_1 // Left square bracket }; - var flowInitial = { - '-2': codeIndented, // Horizontal tab - '-1': codeIndented, // Virtual space - 32: codeIndented // Space + '-2': codeIndented_1, + // Horizontal tab + '-1': codeIndented_1, + // Virtual space + 32: codeIndented_1 // Space }; - var flow$1 = { - 35: headingAtx, // Number sign - 42: thematicBreak, // Asterisk - 45: [setextUnderline, thematicBreak], // Dash - 60: htmlFlow, // Less than - 61: setextUnderline, // Equals to - 95: thematicBreak, // Underscore - 96: codeFenced, // Grave accent - 126: codeFenced // Tilde + 35: headingAtx_1, + // Number sign + 42: thematicBreak_1, + // Asterisk + 45: [setextUnderline_1, thematicBreak_1], + // Dash + 60: htmlFlow_1, + // Less than + 61: setextUnderline_1, + // Equals to + 95: thematicBreak_1, + // Underscore + 96: codeFenced_1, + // Grave accent + 126: codeFenced_1 // Tilde }; - var string$1 = { - 38: characterReference, // Ampersand - 92: characterEscape // Backslash + 38: characterReference_1, + // Ampersand + 92: characterEscape_1 // Backslash }; - var text$1 = { - '-5': lineEnding, // Carriage return - '-4': lineEnding, // Line feed - '-3': lineEnding, // Carriage return + line feed - 33: labelStartImage, // Exclamation mark - 38: characterReference, // Ampersand - 42: attention, // Asterisk - 60: [autolink, htmlText], // Less than - 91: labelStartLink, // Left square bracket - 92: [hardBreakEscape, characterEscape], // Backslash - 93: labelEnd, // Right square bracket - 95: attention, // Underscore - 96: codeText // Grave accent + '-5': lineEnding_1, + // Carriage return + '-4': lineEnding_1, + // Line feed + '-3': lineEnding_1, + // Carriage return + line feed + 33: labelStartImage_1, + // Exclamation mark + 38: characterReference_1, + // Ampersand + 42: attention_1, + // Asterisk + 60: [autolink_1, htmlText_1], + // Less than + 91: labelStartLink_1, + // Left square bracket + 92: [hardBreakEscape_1, characterEscape_1], + // Backslash + 93: labelEnd_1, + // Right square bracket + 95: attention_1, + // Underscore + 96: codeText_1 // Grave accent }; - var insideSpan = { - null: [attention, resolveText] -}; - -var constructs = { - document: document$2, - contentInitial: contentInitial, - flowInitial: flowInitial, - flow: flow$1, - string: string$1, - text: text$1, - insideSpan: insideSpan -}; - -var serializeChunks_1 = serializeChunks; - - - -function serializeChunks(chunks) { - var index = -1; - var result = []; - var chunk; - var value; - var atTab; - - while (++index < chunks.length) { - chunk = chunks[index]; - - if (typeof chunk === 'string') { - value = chunk; - } else if (chunk === -5) { - value = '\r'; - } else if (chunk === -4) { - value = '\n'; - } else if (chunk === -3) { - value = '\r' + '\n'; - } else if (chunk === -2) { - value = '\t'; - } else if (chunk === -1) { - if (atTab) continue - value = ' '; - } else { - // Currently only replacement character. - value = fromCharCode(chunk); - } - - atTab = chunk === -2; - result.push(value); - } - - return result.join('') -} - -var sliceChunks_1 = sliceChunks; - -function sliceChunks(chunks, token) { - var startIndex = token.start._index; - var startBufferIndex = token.start._bufferIndex; - var endIndex = token.end._index; - var endBufferIndex = token.end._bufferIndex; - var view; - - if (startIndex === endIndex) { - view = [chunks[startIndex].slice(startBufferIndex, endBufferIndex)]; - } else { - view = chunks.slice(startIndex, endIndex); - - if (startBufferIndex > -1) { - view[0] = view[0].slice(startBufferIndex); - } - - if (endBufferIndex > 0) { - view.push(chunks[endIndex].slice(0, endBufferIndex)); - } - } - - return view -} - -var miniflat_1 = miniflat; - -function miniflat(value) { - return value === null || value === undefined - ? [] - : 'length' in value - ? value - : [value] -} - -var createTokenizer_1 = createTokenizer; - - - - - - - - - - - -// Create a tokenizer. -// Tokenizers deal with one type of data (e.g., containers, flow, text). -// The parser is the object dealing with it all. -// `initialize` works like other constructs, except that only its `tokenize` -// function is used, in which case it doesnā€™t receive an `ok` or `nok`. -// `from` can be given to set the point before the first character, although -// when further lines are indented, they must be set with `defineSkip`. -function createTokenizer(parser, initialize, from) { - var point = from ? shallow_1(from) : {line: 1, column: 1, offset: 0}; - var columnStart = {}; - var resolveAllConstructs = []; - var chunks = []; - var stack = []; - - // Tools used for tokenizing. - var effects = { - consume: consume, - enter: enter, - exit: exit, - attempt: constructFactory(onsuccessfulconstruct), - check: constructFactory(onsuccessfulcheck), - interrupt: constructFactory(onsuccessfulcheck, {interrupt: true}), - lazy: constructFactory(onsuccessfulcheck, {lazy: true}) - }; - - // State and tools for resolving and serializing. - var context = { - previous: null, - events: [], - parser: parser, - sliceStream: sliceStream, - sliceSerialize: sliceSerialize, - now: now, - defineSkip: skip, - write: write - }; - - // The state function. - var state = initialize.tokenize.call(context, effects); - - if (initialize.resolveAll) { - resolveAllConstructs.push(initialize); - } - - // Store where we are in the input stream. - point._index = 0; - point._bufferIndex = -1; - - return context - - function write(slice) { - chunkedSplice_1(chunks, chunks.length, 0, slice); - - main(); - - // Exit if weā€™re not done, resolve might change stuff. - if (chunks[chunks.length - 1] !== null) { - return [] - } - - addResult(initialize, 0); - - // Otherwise, resolve, and exit. - context.events = resolveAll_1(resolveAllConstructs, context.events, context); - - return context.events - } - - // - // Tools. - // - - function sliceSerialize(token) { - return serializeChunks_1(sliceStream(token)) - } - - function sliceStream(token) { - return sliceChunks_1(chunks, token) - } - - function now() { - return shallow_1(point) - } - - function skip(value) { - columnStart[value.line] = value.column; - accountForPotentialSkip(); - } - - // - // State management. - // - - // Main loop (note that `_index` and `_bufferIndex` in `point` are modified by - // `consume`). - // Here is where we walk through the chunks, which either include strings of - // several characters, or numerical character codes. - // The reason to do this in a loop instead of a call is so the stack can - // drain. - function main() { - var chunkIndex; - var chunk; - - while (point._index < chunks.length) { - chunk = chunks[point._index]; - - // If weā€™re in a buffer chunk, loop through it. - if (typeof chunk === 'string') { - chunkIndex = point._index; - - if (point._bufferIndex < 0) { - point._bufferIndex = 0; - } - - while ( - point._index === chunkIndex && - point._bufferIndex < chunk.length - ) { - go(chunk.charCodeAt(point._bufferIndex)); - } - } else { - go(chunk); - } - } - } - - // Deal with one code. - function go(code) { - state = state(code); - } - - // Move a character forward. - function consume(code) { - if (markdownLineEnding_1(code)) { - point.line++; - point.column = 1; - point.offset += code === -3 ? 2 : 1; - accountForPotentialSkip(); - } else if (code !== -1) { - point.column++; - point.offset++; - } - - // Not in a string chunk. - if (point._bufferIndex < 0) { - point._index++; - } else { - point._bufferIndex++; - - // At end of string chunk. - if (point._bufferIndex === chunks[point._index].length) { - point._bufferIndex = -1; - point._index++; - } - } - - // Expose the previous character. - context.previous = code; - } - - // Start a token. - function enter(type, fields) { - var token = fields || {}; - token.type = type; - token.start = now(); - - context.events.push(['enter', token, context]); - - stack.push(token); - - return token - } - - // Stop a token. - function exit(type) { - var token = stack.pop(); - token.end = now(); - - context.events.push(['exit', token, context]); - - return token - } - - // Use results. - function onsuccessfulconstruct(construct, info) { - addResult(construct, info.from); - } - - // Discard results. - function onsuccessfulcheck(construct, info) { - info.restore(); - } - - // Factory to attempt/check/interrupt. - function constructFactory(onreturn, fields) { - return hook - - // Handle either an object mapping codes to constructs, a list of - // constructs, or a single construct. - function hook(constructs, returnState, bogusState) { - var listOfConstructs; - var constructIndex; - var currentConstruct; - var info; - - return constructs.tokenize || 'length' in constructs - ? handleListOfConstructs(miniflat_1(constructs)) - : handleMapOfConstructs - - function handleMapOfConstructs(code) { - if (code in constructs || null in constructs) { - return handleListOfConstructs( - /* istanbul ignore next - `null` is used by some extensions */ - constructs.null - ? miniflat_1(constructs[code]).concat(miniflat_1(constructs.null)) - : constructs[code] - )(code) - } - - return bogusState(code) - } - - function handleListOfConstructs(list) { - listOfConstructs = list; - constructIndex = 0; - return handleConstruct(list[constructIndex]) - } - - function handleConstruct(construct) { - return start - - function start(code) { - // To do: not nede to store if there is no bogus state, probably? - // Currently doesnā€™t work because `inspect` in document does a check - // w/o a bogus, which doesnā€™t make sense. But it does seem to help perf - // by not storing. - info = store(); - currentConstruct = construct; - - if (!construct.partial) { - context.currentConstruct = construct; - } - - return construct.tokenize.call( - fields ? assign({}, context, fields) : context, - effects, - ok, - nok - )(code) - } - } - - function ok(code) { - onreturn(currentConstruct, info); - return returnState - } - - function nok(code) { - info.restore(); - - if (++constructIndex < listOfConstructs.length) { - return handleConstruct(listOfConstructs[constructIndex]) - } - - return bogusState - } - } - } - - function addResult(construct, from) { - if (construct.resolveAll && resolveAllConstructs.indexOf(construct) < 0) { - resolveAllConstructs.push(construct); - } - - if (construct.resolve) { - chunkedSplice_1( - context.events, - from, - context.events.length - from, - construct.resolve(context.events.slice(from), context) - ); - } - - if (construct.resolveTo) { - context.events = construct.resolveTo(context.events, context); - } - } - - function store() { - var startPoint = now(); - var startPrevious = context.previous; - var startCurrentConstruct = context.currentConstruct; - var startEventsIndex = context.events.length; - var startStack = Array.from(stack); - - return {restore: restore, from: startEventsIndex} - - function restore() { - point = startPoint; - context.previous = startPrevious; - context.currentConstruct = startCurrentConstruct; - context.events.length = startEventsIndex; - stack = startStack; - accountForPotentialSkip(); - } - } - - function accountForPotentialSkip() { - if (point.line in columnStart && point.column < 2) { - point.column = columnStart[point.line]; - point.offset += columnStart[point.line] - 1; - } - } -} - -var combineExtensions_1 = combineExtensions; - - - - - -// Combine several syntax extensions into one. -function combineExtensions(extensions) { - var all = {}; - var index = -1; - - while (++index < extensions.length) { - extension$1(all, extensions[index]); - } - - return all -} - -function extension$1(all, extension) { - var hook; - var left; - var right; - var code; - - for (hook in extension) { - left = hasOwnProperty_1.call(all, hook) ? all[hook] : (all[hook] = {}); - right = extension[hook]; - - for (code in right) { - left[code] = constructs$1( - miniflat_1(right[code]), - hasOwnProperty_1.call(left, code) ? left[code] : [] - ); - } - } -} - -function constructs$1(list, existing) { - var index = -1; - var before = []; - - while (++index < list.length) { -(list[index].add === 'after' ? existing : before).push(list[index]); - } - - chunkedSplice_1(existing, 0, 0, before); - return existing -} - -var parse$8 = createParser; - - - - - - - - - - -function createParser(options) { + null: [attention_1, text_1.resolver] +}; +var disable = { + null: [] +}; + +var contentInitial_1 = contentInitial; +var disable_1 = disable; +var document_1 = document$2; +var flow_1 = flow$1; +var flowInitial_1 = flowInitial; +var insideSpan_1 = insideSpan; +var string_1$1 = string$1; +var text_1$1 = text$1; + +var constructs$1 = /*#__PURE__*/Object.defineProperty({ + contentInitial: contentInitial_1, + disable: disable_1, + document: document_1, + flow: flow_1, + flowInitial: flowInitial_1, + insideSpan: insideSpan_1, + string: string_1$1, + text: text_1$1 +}, '__esModule', {value: true}); + +function parse$7(options) { var settings = options || {}; var parser = { defined: [], constructs: combineExtensions_1( - [constructs].concat(miniflat_1(settings.extensions)) + [constructs$1].concat(miniflat_1(settings.extensions)) ), - content: create(content), document: create(document$1), flow: create(flow), - string: create(text.string), - text: create(text.text) + string: create(text_1.string), + text: create(text_1.text) }; - return parser function create(initializer) { return creator + function creator(from) { return createTokenizer_1(parser, initializer, from) } } } -var preprocess = preprocessor; +var parse_1$3 = parse$7; var search$1 = /[\0\t\n\r]/g; -function preprocessor() { +function preprocess() { var start = true; var column = 1; var buffer = ''; var atCarriageReturn; + return preprocessor - return preprocess - - function preprocess(value, encoding, end) { + function preprocessor(value, encoding, end) { var chunks = []; var match; var next; var startPosition; var endPosition; var code; - value = buffer + value.toString(encoding); startPosition = 0; buffer = ''; @@ -40013,12 +37332,12 @@ function preprocessor() { } else if (code === 9) { next = Math.ceil(column / 4) * 4; chunks.push(-2); + while (column++ < next) chunks.push(-1); } else if (code === 10) { chunks.push(-4); column = 1; - } - // Must be carriage return. + } // Must be carriage return. else { atCarriageReturn = true; column = 1; @@ -40038,9 +37357,7 @@ function preprocessor() { } } -var postprocess_1 = postprocess; - - +var preprocess_1 = preprocess; function postprocess(events) { while (!subtokenize_1(events)) { @@ -40050,6 +37367,8 @@ function postprocess(events) { return events } +var postprocess_1 = postprocess; + var dist$2 = fromMarkdown; // These three are compiled away in the `dist/` @@ -40063,6 +37382,8 @@ var dist$2 = fromMarkdown; + + function fromMarkdown(value, encoding, options) { if (typeof encoding !== 'string') { options = encoding; @@ -40071,7 +37392,7 @@ function fromMarkdown(value, encoding, options) { return compiler(options)( postprocess_1( - parse$8(options).document().write(preprocess()(value, encoding, true)) + parse_1$3(options).document().write(preprocess_1()(value, encoding, true)) ) ) } @@ -40143,7 +37464,7 @@ function compiler(options) { characterEscapeValue: onexitdata, characterReferenceMarkerHexadecimal: onexitcharacterreferencemarker, characterReferenceMarkerNumeric: onexitcharacterreferencemarker, - characterReferenceValue: closer(onexitcharacterreferencevalue), + characterReferenceValue: onexitcharacterreferencevalue, codeFenced: closer(onexitcodefenced), codeFencedFence: onexitcodefencedfence, codeFencedFenceInfo: onexitcodefencedfenceinfo, @@ -40194,23 +37515,32 @@ function compiler(options) { function compile(events) { var stack = [{type: 'root', children: []}]; - var index = -1; + var tokenStack = []; var listStack = []; - var length; + var index = -1; var handler; var listStart; - var event; - while (++index < events.length) { - event = events[index]; + var context = { + stack: stack, + tokenStack: tokenStack, + config: config, + enter: enter, + exit: exit, + buffer: buffer, + resume: resume, + setData: setData, + getData: getData + }; + while (++index < events.length) { // We preprocess lists to add `listItem` tokens, and to infer whether // items the list itself are spread out. if ( - event[1].type === 'listOrdered' || - event[1].type === 'listUnordered' + events[index][1].type === 'listOrdered' || + events[index][1].type === 'listUnordered' ) { - if (event[0] === 'enter') { + if (events[index][0] === 'enter') { listStack.push(index); } else { listStart = listStack.pop(index); @@ -40220,38 +37550,39 @@ function compiler(options) { } index = -1; - length = events.length; - while (++index < length) { + while (++index < events.length) { handler = config[events[index][0]]; - if (hasOwnProperty_1.call(handler, events[index][1].type)) { + if (hasOwnProperty.call(handler, events[index][1].type)) { handler[events[index][1].type].call( - { - stack: stack, - config: config, - enter: enter, - exit: exit, - buffer: buffer, - resume: resume, - sliceSerialize: events[index][2].sliceSerialize, - setData: setData, - getData: getData - }, - + assign_1({sliceSerialize: events[index][2].sliceSerialize}, context), events[index][1] ); } } + if (tokenStack.length) { + throw new Error( + 'Cannot close document, a token (`' + + tokenStack[tokenStack.length - 1].type + + '`, ' + + unistUtilStringifyPosition({ + start: tokenStack[tokenStack.length - 1].start, + end: tokenStack[tokenStack.length - 1].end + }) + + ') is still open' + ) + } + // Figure out `root` position. stack[0].position = { start: point( - length ? events[0][1].start : {line: 1, column: 1, offset: 0} + events.length ? events[0][1].start : {line: 1, column: 1, offset: 0} ), end: point( - length + events.length ? events[events.length - 2][1].end : {line: 1, column: 1, offset: 0} ) @@ -40416,6 +37747,7 @@ function compiler(options) { function enter(node, token) { this.stack[this.stack.length - 1].children.push(node); this.stack.push(node); + this.tokenStack.push(token); node.position = {start: point(token.start)}; return node } @@ -40431,13 +37763,36 @@ function compiler(options) { function exit(token) { var node = this.stack.pop(); + var open = this.tokenStack.pop(); + + if (!open) { + throw new Error( + 'Cannot close `' + + token.type + + '` (' + + unistUtilStringifyPosition({start: token.start, end: token.end}) + + '): itā€™s not open' + ) + } else if (open.type !== token.type) { + throw new Error( + 'Cannot close `' + + token.type + + '` (' + + unistUtilStringifyPosition({start: token.start, end: token.end}) + + '): a different token (`' + + open.type + + '`, ' + + unistUtilStringifyPosition({start: open.start, end: open.end}) + + ') is open' + ) + } + node.position.end = point(token.end); return node } function resume() { - var value = mdastUtilToString(this.stack.pop()); - return value + return mdastUtilToString(this.stack.pop()) } // @@ -40564,11 +37919,10 @@ function compiler(options) { return } - if (getData('setextHeadingSlurpLineEnding')) { - return - } - - if (config.canContainEols.indexOf(context.type) !== -1) { + if ( + !getData('setextHeadingSlurpLineEnding') && + config.canContainEols.indexOf(context.type) > -1 + ) { onenterdata.call(this, token); onexitdata.call(this, token); } @@ -40686,6 +38040,7 @@ function compiler(options) { var data = this.sliceSerialize(token); var type = getData('characterReferenceType'); var value; + var tail; if (type) { value = safeFromInt_1( @@ -40698,7 +38053,9 @@ function compiler(options) { value = decodeEntity_1(data); } - this.stack[this.stack.length - 1].value += value; + tail = this.stack.pop(); + tail.value += value; + tail.position.end = point(token.end); } function onexitautolinkprotocol(token) { @@ -40799,10 +38156,9 @@ function compiler(options) { } function configure$2(config, extensions) { - var length = extensions.length; var index = -1; - while (++index < length) { + while (++index < extensions.length) { extension$2(config, extensions[index]); } @@ -40812,27 +38168,25 @@ function configure$2(config, extensions) { function extension$2(config, extension) { var key; var left; - var right; for (key in extension) { - left = hasOwnProperty_1.call(config, key) ? config[key] : (config[key] = {}); - right = extension[key]; + left = hasOwnProperty.call(config, key) ? config[key] : (config[key] = {}); if (key === 'canContainEols') { - config[key] = [].concat(left, right); + config[key] = [].concat(left, extension[key]); } else { - Object.assign(left, right); + Object.assign(left, extension[key]); } } } var mdastUtilFromMarkdown = dist$2; -var remarkParse = parse$9; +var remarkParse = parse$8; -function parse$9(options) { +function parse$8(options) { var self = this; this.Parser = parse; @@ -40853,8 +38207,8 @@ function parse$9(options) { var zwitch = factory$1; -var noop$2 = Function.prototype; -var own$4 = {}.hasOwnProperty; +var noop$1 = Function.prototype; +var own$5 = {}.hasOwnProperty; // Handle values based on a property. function factory$1(key, options) { @@ -40864,11 +38218,11 @@ function factory$1(key, options) { var fn = one.invalid; var handlers = one.handlers; - if (value && own$4.call(value, key)) { - fn = own$4.call(handlers, value[key]) ? handlers[value[key]] : one.unknown; + if (value && own$5.call(value, key)) { + fn = own$5.call(handlers, value[key]) ? handlers[value[key]] : one.unknown; } - return (fn || noop$2).apply(this, arguments) + return (fn || noop$1).apply(this, arguments) } one.handlers = settings.handlers || {}; @@ -40878,6 +38232,32 @@ function factory$1(key, options) { return one } +var configure_1$2 = configure$3; + +function configure$3(base, extension) { + var index = -1; + var key; + + // First do subextensions. + if (extension.extensions) { + while (++index < extension.extensions.length) { + configure$3(base, extension.extensions[index]); + } + } + + for (key in extension) { + if (key === 'extensions') ; else if (key === 'unsafe' || key === 'join') { + base[key] = base[key].concat(extension[key] || []); + } else if (key === 'handlers') { + base[key] = Object.assign(base[key], extension[key] || {}); + } else { + base.options[key] = extension[key]; + } + } + + return base +} + var containerFlow = flow$2; @@ -41013,8 +38393,8 @@ var formatCodeAsIndented_1 = formatCodeAsIndented; function formatCodeAsIndented(node, context) { return ( - node.value && !context.options.fences && + node.value && // If thereā€™s no infoā€¦ !node.lang && // And thereā€™s a non-whitespace characterā€¦ @@ -41057,8 +38437,8 @@ function safe(context, input, config) { var start; var end; - while (++index < context.unsafePatterns.length) { - pattern = context.unsafePatterns[index]; + while (++index < context.unsafe.length) { + pattern = context.unsafe[index]; if ( !inScope(context.stack, pattern.inConstruct, true) || @@ -41301,7 +38681,7 @@ function checkQuote(context) { return marker } -var definition_1 = definition$1; +var definition_1$1 = definition$1; @@ -41618,14 +38998,19 @@ var formatLinkAsAutolink_1 = formatLinkAsAutolink; -function formatLinkAsAutolink(node) { +function formatLinkAsAutolink(node, context) { var raw = mdastUtilToString(node); return ( + !context.options.resourceLink && // If thereā€™s a urlā€¦ node.url && // And thereā€™s a no titleā€¦ !node.title && + // And the content of `node` is a single text nodeā€¦ + node.children && + node.children.length === 1 && + node.children[0].type === 'text' && // And if the url is the same as the contentā€¦ (raw === node.url || 'mailto:' + raw === node.url) && // And that starts w/ a protocolā€¦ @@ -41652,7 +39037,7 @@ function link$2(node, _, context) { var value; var stack; - if (formatLinkAsAutolink_1(node)) { + if (formatLinkAsAutolink_1(node, context)) { // Hide the fact that weā€™re in phrasing, because escapes donā€™t work. stack = context.stack; context.stack = []; @@ -41703,8 +39088,8 @@ function link$2(node, _, context) { return value } -function linkPeek(node) { - return formatLinkAsAutolink_1(node) ? '<' : '[' +function linkPeek(node, _, context) { + return formatLinkAsAutolink_1(node, context) ? '<' : '[' } var linkReference_1 = linkReference; @@ -41900,7 +39285,7 @@ function strongPeek(node, _, context) { return context.options.strong || '*' } -var text_1$1 = text$2; +var text_1$2 = text$2; @@ -41940,7 +39325,7 @@ function checkRule$1(context) { return marker } -var thematicBreak_1 = thematicBreak$1; +var thematicBreak_1$1 = thematicBreak$1; @@ -41958,7 +39343,7 @@ function thematicBreak$1(node, parent, context) { var blockquote$1 = blockquote_1; var _break$1 = _break; var code$1 = code_1; -var definition$2 = definition_1; +var definition$2 = definition_1$1; var emphasis$1 = emphasis_1; var hardBreak$1 = _break; var heading$1 = heading_1; @@ -41973,8 +39358,8 @@ var listItem$1 = listItem_1; var paragraph$1 = paragraph_1; var root$2 = root_1; var strong$1 = strong_1; -var text$3 = text_1$1; -var thematicBreak$2 = thematicBreak_1; +var text$3 = text_1$2; +var thematicBreak$2 = thematicBreak_1$1; var handle = { blockquote: blockquote$1, @@ -41999,6 +39384,44 @@ var handle = { thematicBreak: thematicBreak$2 }; +var join$2 = [joinDefaults]; + + + + +function joinDefaults(left, right, parent, context) { + if ( + // Two lists with the same marker. + (right.type === 'list' && + right.type === left.type && + Boolean(left.ordered) === Boolean(right.ordered)) || + // Indented code after list or another indented code. + (right.type === 'code' && + formatCodeAsIndented_1(right, context) && + (left.type === 'list' || + (left.type === right.type && formatCodeAsIndented_1(left, context)))) + ) { + return false + } + + // Join children of a list or an item. + // In which case, `parent` has a `spread` field. + if (typeof parent.spread === 'boolean') { + if ( + left.type === 'paragraph' && + // Two paragraphs. + (left.type === right.type || + right.type === 'definition' || + // Paragraph followed by a setext heading. + (right.type === 'heading' && formatHeadingAsSetext_1(right, context))) + ) { + return + } + + return parent.spread ? 1 : 0 + } +} + var unsafe = [ { character: '\t', @@ -42112,69 +39535,44 @@ var unsafe = [ {atBreak: true, character: '~'} ]; -var join$2 = [joinDefaults]; - +var lib$8 = toMarkdown; -function joinDefaults(left, right, parent, context) { - if ( - // Two lists with the same marker. - (right.type === 'list' && - right.type === left.type && - Boolean(left.ordered) === Boolean(right.ordered)) || - // Indented code after list or another indented code. - (right.type === 'code' && - formatCodeAsIndented_1(right, context) && - (left.type === 'list' || - (left.type === right.type && formatCodeAsIndented_1(left, context)))) - ) { - return false - } - - // Join children of a list or an item. - // In which case, `parent` has a `spread` field. - if (typeof parent.spread === 'boolean') { - if ( - left.type === 'paragraph' && - // Two paragraphs. - (left.type === right.type || - right.type === 'definition' || - // Paragraph followed by a setext heading. - (right.type === 'heading' && formatHeadingAsSetext_1(right, context))) - ) { - return - } - - return parent.spread ? 1 : 0 - } -} -var lib$7 = toMarkdown; +function toMarkdown(tree, options) { + var settings = options || {}; + var context = { + enter: enter, + stack: [], + unsafe: [], + join: [], + handlers: {}, + options: {} + }; + var result; + configure_1$2(context, { + unsafe: unsafe, + join: join$2, + handlers: handle + }); + configure_1$2(context, settings); + if (context.options.tightDefinitions) { + context.join = [joinDefinition].concat(context.join); + } -function toMarkdown(tree, options) { - var settings = options || {}; - var extensions = configure$3(settings); - var stack = []; - var handle = zwitch('type', { + context.handle = zwitch('type', { invalid: invalid, unknown: unknown, - handlers: extensions.handlers + handlers: context.handlers }); - var context = { - handle: handle, - stack: stack, - enter: enter, - options: settings, - unsafePatterns: extensions.unsafe, - join: extensions.join - }; - var result = handle(tree, null, context, {before: '\n', after: '\n'}); + + result = context.handle(tree, null, context, {before: '\n', after: '\n'}); if ( result && @@ -42187,11 +39585,11 @@ function toMarkdown(tree, options) { return result function enter(name) { - stack.push(name); + context.stack.push(name); return exit function exit() { - stack.pop(); + context.stack.pop(); } } } @@ -42204,28 +39602,6 @@ function unknown(node) { throw new Error('Cannot handle unknown node `' + node.type + '`') } -function configure$3(settings) { - var extensions = [ - {unsafe: settings.unsafe, handlers: settings.handlers, join: settings.join} - ].concat(settings.extensions || []); - var unsafe$1 = unsafe; - var join = join$2; - var handlers = Object.assign({}, handle); - var index = -1; - - if (settings.tightDefinitions) { - join = [joinDefinition].concat(join); - } - - while (++index < extensions.length) { - unsafe$1 = unsafe$1.concat(extensions[index].unsafe || []); - join = join.concat(extensions[index].join || []); - Object.assign(handlers, extensions[index].handlers || {}); - } - - return {unsafe: unsafe$1, join: join, handlers: handlers} -} - function joinDefinition(left, right) { // No blank line between adjacent definitions. if (left.type === 'definition' && left.type === right.type) { @@ -42233,7 +39609,7 @@ function joinDefinition(left, right) { } } -var mdastUtilToMarkdown = lib$7; +var mdastUtilToMarkdown = lib$8; var remarkStringify = stringify$6; @@ -42263,7 +39639,7 @@ const name = "remark"; const version$1 = "13.0.0"; const description = "Markdown processor powered by plugins part of the unified collective"; const license = "MIT"; -const keywords = [ +const keywords$1 = [ "unified", "remark", "markdown", @@ -42303,12 +39679,12 @@ const scripts = { test: "tape test.js" }; const xo = false; -var _package = { +var proc = { name: name, version: version$1, description: description, license: license, - keywords: keywords, + keywords: keywords$1, homepage: homepage, repository: repository, bugs: bugs, @@ -42322,51 +39698,30 @@ var _package = { xo: xo }; -var _package$1 = /*#__PURE__*/Object.freeze({ - __proto__: null, - name: name, - version: version$1, - description: description, - license: license, - keywords: keywords, - homepage: homepage, - repository: repository, - bugs: bugs, - funding: funding, - author: author, - contributors: contributors, - files: files, - types: types, - dependencies: dependencies, - scripts: scripts, - xo: xo, - 'default': _package -}); - const name$1 = "node-lint-md-cli-rollup"; const description$1 = "remark packaged for Node.js Markdown linting"; const version$2 = "2.0.2"; const devDependencies = { - "@rollup/plugin-commonjs": "^11.0.1", - "@rollup/plugin-json": "^4.0.1", - "@rollup/plugin-node-resolve": "^7.0.0", - rollup: "^2.32.1", + "@rollup/plugin-commonjs": "^17.0.0", + "@rollup/plugin-json": "^4.1.0", + "@rollup/plugin-node-resolve": "^11.0.1", + rollup: "^2.36.1", shx: "^0.3.3" }; const dependencies$1 = { "markdown-extensions": "^1.1.1", remark: "^13.0.0", "remark-gfm": "^1.0.0", - "remark-lint": "^7.0.0", + "remark-lint": "^8.0.0", "remark-preset-lint-node": "^2.0.0", - "unified-args": "^8.0.0" + "unified-args": "^8.1.0" }; const main = "dist/index.js"; const scripts$1 = { build: "npx rollup -c", "build-node": "npm run build && npx shx cp dist/index.js ../lint-md.js" }; -var _package$2 = { +var cli = { name: name$1, description: description$1, version: version$2, @@ -42376,106 +39731,72 @@ var _package$2 = { scripts: scripts$1 }; -var _package$3 = /*#__PURE__*/Object.freeze({ - __proto__: null, - name: name$1, - description: description$1, - version: version$2, - devDependencies: devDependencies, - dependencies: dependencies$1, - main: main, - scripts: scripts$1, - 'default': _package$2 -}); - var vfileLocation = factory$2; function factory$2(file) { - var contents = indices(String(file)); - var toPoint = offsetToPointFactory(contents); + var value = String(file); + var indices = []; + var search = /\r?\n|\r/g; - return { - toPoint: toPoint, - toPosition: toPoint, - toOffset: pointToOffsetFactory(contents) + while (search.exec(value)) { + indices.push(search.lastIndex); } -} -// Factory to get the line and column-based `point` for `offset` in the bound -// indices. -function offsetToPointFactory(indices) { - return offsetToPoint + indices.push(value.length + 1); + + return { + toPoint: offsetToPoint, + toPosition: offsetToPoint, + toOffset: pointToOffset + } // Get the line and column-based `point` for `offset` in the bound indices. function offsetToPoint(offset) { var index = -1; - var length = indices.length; - if (offset < 0) { - return {} - } - - while (++index < length) { - if (indices[index] > offset) { - return { - line: index + 1, - column: offset - (indices[index - 1] || 0) + 1, - offset: offset + if (offset > -1 && offset < indices[indices.length - 1]) { + while (++index < indices.length) { + if (indices[index] > offset) { + return { + line: index + 1, + column: offset - (indices[index - 1] || 0) + 1, + offset: offset + } } } } return {} } -} - -// Factory to get the `offset` for a line and column-based `point` in the -// bound indices. -function pointToOffsetFactory(indices) { - return pointToOffset // Get the `offset` for a line and column-based `point` in the bound // indices. function pointToOffset(point) { var line = point && point.line; var column = point && point.column; + var offset; if (!isNaN(line) && !isNaN(column) && line - 1 in indices) { - return (indices[line - 2] || 0) + column - 1 || 0 + offset = (indices[line - 2] || 0) + column - 1 || 0; } - return -1 + return offset > -1 && offset < indices[indices.length - 1] ? offset : -1 } } -// Get indices of line-breaks in `value`. -function indices(value) { - var result = []; - var index = value.indexOf('\n'); - - while (index !== -1) { - result.push(index + 1); - index = value.indexOf('\n', index + 1); - } - - result.push(value.length + 1); - - return result -} - var convert_1 = convert$3; function convert$3(test) { - if (typeof test === 'string') { - return typeFactory(test) + if (test == null) { + return ok$1 } - if (test === null || test === undefined) { - return ok$1 + if (typeof test === 'string') { + return typeFactory(test) } if (typeof test === 'object') { - return ('length' in test ? anyFactory : matchesFactory)(test) + return 'length' in test ? anyFactory(test) : allFactory(test) } if (typeof test === 'function') { @@ -42485,30 +39806,16 @@ function convert$3(test) { throw new Error('Expected function, string, or object as test') } -function convertAll(tests) { - var results = []; - var length = tests.length; - var index = -1; - - while (++index < length) { - results[index] = convert$3(tests[index]); - } - - return results -} - // Utility assert each property in `test` is represented in `node`, and each // values are strictly equal. -function matchesFactory(test) { - return matches +function allFactory(test) { + return all - function matches(node) { + function all(node) { var key; for (key in test) { - if (node[key] !== test[key]) { - return false - } + if (node[key] !== test[key]) return false } return true @@ -42516,15 +39823,19 @@ function matchesFactory(test) { } function anyFactory(tests) { - var checks = convertAll(tests); - var length = checks.length; + var checks = []; + var index = -1; - return matches + while (++index < tests.length) { + checks[index] = convert$3(tests[index]); + } - function matches() { + return any + + function any() { var index = -1; - while (++index < length) { + while (++index < checks.length) { if (checks[index].apply(this, arguments)) { return true } @@ -42568,79 +39879,74 @@ visitParents.SKIP = SKIP; visitParents.EXIT = EXIT; function visitParents(tree, test, visitor, reverse) { + var step; var is; - if (func(test) && !func(visitor)) { + if (typeof test === 'function' && typeof visitor !== 'function') { reverse = visitor; visitor = test; test = null; } is = convert_1(test); + step = reverse ? -1 : 1; - one(tree, null, [])(); + factory(tree, null, [])(); - function one(child, index, parents) { - var value = object(child) ? child : {}; + function factory(node, index, parents) { + var value = typeof node === 'object' && node !== null ? node : {}; var name; - if (string$2(value.type)) { - name = string$2(value.tagName) - ? value.tagName - : string$2(value.name) - ? value.name - : undefined; + if (typeof value.type === 'string') { + name = + typeof value.tagName === 'string' + ? value.tagName + : typeof value.name === 'string' + ? value.name + : undefined; - node.displayName = + visit.displayName = 'node (' + color_1(value.type + (name ? '<' + name + '>' : '')) + ')'; } - return node + return visit - function node() { + function visit() { + var grandparents = parents.concat(node); var result = []; var subresult; + var offset; - if (!test || is(child, index, parents[parents.length - 1] || null)) { - result = toResult(visitor(child, parents)); + if (!test || is(node, index, parents[parents.length - 1] || null)) { + result = toResult(visitor(node, parents)); if (result[0] === EXIT) { return result } } - if (!child.children || result[0] === SKIP) { - return result - } - - subresult = toResult(children(child.children, parents.concat(child))); - return subresult[0] === EXIT ? subresult : result - } - } + if (node.children && result[0] !== SKIP) { + offset = (reverse ? node.children.length : -1) + step; - // Visit children in `parent`. - function children(children, parents) { - var min = -1; - var step = reverse ? -1 : 1; - var index = (reverse ? children.length : min) + step; - var child; - var result; + while (offset > -1 && offset < node.children.length) { + subresult = factory(node.children[offset], offset, grandparents)(); - while (index > min && index < children.length) { - child = children[index]; - result = one(child, index, parents)(); + if (subresult[0] === EXIT) { + return subresult + } - if (result[0] === EXIT) { - return result + offset = + typeof subresult[1] === 'number' ? subresult[1] : offset + step; + } } - index = typeof result[1] === 'number' ? result[1] : index + step; + return result } } } function toResult(value) { - if (object(value) && 'length' in value) { + if (value !== null && typeof value === 'object' && 'length' in value) { return value } @@ -42651,18 +39957,6 @@ function toResult(value) { return [value] } -function func(d) { - return typeof d === 'function' -} - -function string$2(d) { - return typeof d === 'string' -} - -function object(d) { - return typeof d === 'object' && d !== null -} - var unistUtilVisit = visit; @@ -42695,25 +39989,23 @@ var unifiedMessageControl = messageControl; function messageControl(options) { var settings = options || {}; - var name = settings.name; - var marker = settings.marker; - var test = settings.test; - var sources = settings.source; - var known = settings.known; - var reset = settings.reset; var enable = settings.enable || []; var disable = settings.disable || []; + var sources = settings.source; + var reset = settings.reset; - if (!name) { - throw new Error('Expected `name` in `options`, got `' + name + '`') + if (!settings.name) { + throw new Error('Expected `name` in `options`, got `' + settings.name + '`') } - if (!marker) { - throw new Error('Expected `marker` in `options`, got `' + marker + '`') + if (!settings.marker) { + throw new Error( + 'Expected `marker` in `options`, got `' + settings.marker + '`' + ) } if (!sources) { - sources = [name]; + sources = [settings.name]; } else if (typeof sources === 'string') { sources = [sources]; } @@ -42727,30 +40019,31 @@ function messageControl(options) { var scope = {}; var globals = []; - unistUtilVisit(tree, test, visitor); + unistUtilVisit(tree, settings.test, visitor); file.messages = file.messages.filter(filter); function visitor(node, position, parent) { - var mark = marker(node); + var mark = settings.marker(node); var ruleIds; - var ruleId; var verb; - var index; - var length; - var next; var pos; var tail; + var index; + var ruleId; - if (!mark || mark.name !== name) { + if (!mark || mark.name !== settings.name) { return } ruleIds = mark.attributes.split(/\s/g); verb = ruleIds.shift(); - next = parent.children[position + 1]; pos = mark.node.position && mark.node.position.start; - tail = next && next.position && next.position.end; + tail = + parent.children[position + 1] && + parent.children[position + 1].position && + parent.children[position + 1].position.end; + index = -1; if (verb !== 'enable' && verb !== 'disable' && verb !== 'ignore') { file.fail( @@ -42762,20 +40055,9 @@ function messageControl(options) { ); } - length = ruleIds.length; - index = -1; - // Apply to all rules. - if (length === 0) { - if (verb === 'ignore') { - toggle(pos, false); - toggle(tail, true); - } else { - toggle(pos, verb === 'enable'); - reset = verb !== 'enable'; - } - } else { - while (++index < length) { + if (ruleIds.length) { + while (++index < ruleIds.length) { ruleId = ruleIds[index]; if (isKnown(ruleId, verb, mark.node)) { @@ -42786,13 +40068,17 @@ function messageControl(options) { } } } + } else if (verb === 'ignore') { + toggle(pos, false); + toggle(tail, true); + } else { + toggle(pos, verb === 'enable'); + reset = verb !== 'enable'; } } function filter(message) { var gapIndex = gaps.length; - var ruleId = message.ruleId; - var ranges = scope[ruleId]; var pos; // Keep messages from a different source. @@ -42820,12 +40106,15 @@ function messageControl(options) { } // Check whether allowed by specific and global states. - return check(message, ranges, ruleId) && check(message, globals) + return ( + check(message, scope[message.ruleId], message.ruleId) && + check(message, globals) + ) } // Helper to check (and possibly warn) if a `ruleId` is unknown. function isKnown(ruleId, verb, pos) { - var result = known ? known.indexOf(ruleId) !== -1 : true; + var result = settings.known ? settings.known.indexOf(ruleId) !== -1 : true; if (!result) { file.message( @@ -42842,7 +40131,7 @@ function messageControl(options) { function getState(ruleId) { var ranges = ruleId ? scope[ruleId] : globals; - if (ranges && ranges.length !== 0) { + if (ranges && ranges.length) { return ranges[ranges.length - 1].state } @@ -42850,11 +40139,7 @@ function messageControl(options) { return !reset } - if (reset) { - return enable.indexOf(ruleId) !== -1 - } - - return disable.indexOf(ruleId) === -1 + return reset ? enable.indexOf(ruleId) > -1 : disable.indexOf(ruleId) < 0 } // Handle a rule. @@ -42882,36 +40167,30 @@ function messageControl(options) { } // Check all `ranges` for `message`. - function check(message, ranges, id) { + function check(message, ranges, ruleId) { // Check the state at the messageā€™s position. var index = ranges && ranges.length; - var length = -1; - var range; - - while (--index > length) { - range = ranges[index]; - - /* istanbul ignore if - Generated marker. */ - if (!range.position || !range.position.line || !range.position.column) { - continue - } + while (index--) { if ( - range.position.line < message.line || - (range.position.line === message.line && - range.position.column <= message.column) + ranges[index].position && + ranges[index].position.line && + ranges[index].position.column && + (ranges[index].position.line < message.line || + (ranges[index].position.line === message.line && + ranges[index].position.column <= message.column)) ) { - return range.state === true + return ranges[index].state === true } } // The first marker ocurred after the first message, so we check the // initial state. - if (!id) { + if (!ruleId) { return initial || reset } - return reset ? enable.indexOf(id) !== -1 : disable.indexOf(id) === -1 + return reset ? enable.indexOf(ruleId) > -1 : disable.indexOf(ruleId) < 0 } } } @@ -42920,8 +40199,8 @@ function messageControl(options) { function detectGaps(tree, file) { var lastNode = tree.children[tree.children.length - 1]; var offset = 0; - var isGap = false; var gaps = []; + var gap; // Find all gaps. unistUtilVisit(tree, one); @@ -42947,37 +40226,30 @@ function detectGaps(tree, file) { return gaps function one(node) { - var pos = node.position; - - update(pos && pos.start && pos.start.offset); + update(node.position && node.position.start && node.position.start.offset); if (!node.children) { - update(pos && pos.end && pos.end.offset); + update(node.position && node.position.end && node.position.end.offset); } } // Detect a new position. function update(latest) { if (latest === null || latest === undefined) { - isGap = true; - return - } - - if (offset >= latest) { - return - } + gap = true; + } else if (offset < latest) { + if (gap) { + gaps.push({start: offset, end: latest}); + gap = null; + } - if (isGap) { - gaps.push({start: offset, end: latest}); - isGap = false; + offset = latest; } - - offset = latest; } } function trim(value) { - return value.replace(/^\s*|\s*$/g, '') + return value.replace(/^\s+|\s+$/g, '') } var mdastCommentMarker = marker$1; @@ -43081,19 +40353,6 @@ function lintMessageControl() { return remarkMessageControl({name: 'lint', source: 'remark-lint'}) } -var remarkLint$1 = lint$1; - -// `remark-lint`. -// This adds support for ignoring stuff from messages (``). -// All rules are in their own packages and presets. -function lint$1() { - this.use(lintMessageControl$1); -} - -function lintMessageControl$1() { - return remarkMessageControl({name: 'lint', source: 'remark-lint'}) -} - /** * An Array.prototype.slice.call(arguments) alternative * @@ -43424,8 +40683,7 @@ function error(err) { * Module Dependencies */ - -var noop$3 = function(){}; +var noop$2 = function(){}; /** @@ -43450,7 +40708,7 @@ function wrapped(fn) { var ctx = this; // done - var done = typeof last == 'function' ? args.pop() : noop$3; + var done = typeof last == 'function' ? args.pop() : noop$2; // nothing if (!fn) { @@ -43646,6 +40904,60 @@ function coerce(name, value) { return result } +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module final-newline + * @fileoverview + * Warn when a line feed at the end of a file is missing. + * Empty files are allowed. + * + * See [StackExchange](https://unix.stackexchange.com/questions/18743) for why. + * + * ## Fix + * + * [`remark-stringify`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify) + * always adds a final line feed to files. + * + * See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) + * on how to automatically fix warnings for this rule. + * + * ## Example + * + * ##### `ok.md` + * + * ###### In + * + * Note: `āŠ` represents LF. + * + * ```markdown + * AlphaāŠ + * ``` + * + * ###### Out + * + * No messages. + * + * ##### `not-ok.md` + * + * ###### In + * + * Note: The below file does not have a final newline. + * + * ```markdown + * Bravo + * ``` + * + * ###### Out + * + * ```text + * 1:1: Missing newline character at end of file + * ``` + */ + + + var remarkLintFinalNewline = unifiedLintRule('remark-lint:final-newline', finalNewline); function finalNewline(tree, file) { @@ -43657,9 +40969,9 @@ function finalNewline(tree, file) { } } -var pluralize = createCommonjsModule(function (module, exports) { /* global define */ +var pluralize = createCommonjsModule(function (module, exports) { (function (root, pluralize) { /* istanbul ignore else */ if (typeof commonjsRequire === 'function' && 'object' === 'object' && 'object' === 'object') { @@ -44173,6 +41485,47 @@ function generated(node) { ) } +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module list-item-bullet-indent + * @fileoverview + * Warn when list item bullets are indented. + * + * ## Fix + * + * [`remark-stringify`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify) + * removes all indentation before bullets. + * + * See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) + * on how to automatically fix warnings for this rule. + * + * @example {"name": "ok.md"} + * + * Paragraph. + * + * * List item + * * List item + * + * @example {"name": "not-ok.md", "label": "input"} + * + * Paragraph. + * + * Ā·* List item + * Ā·* List item + * + * @example {"name": "not-ok.md", "label": "output"} + * + * 3:2: Incorrect indentation before bullet: remove 1 space + * 4:2: Incorrect indentation before bullet: remove 1 space + */ + + + + + + var remarkLintListItemBulletIndent = unifiedLintRule( 'remark-lint:list-item-bullet-indent', listItemBulletIndent @@ -44238,6 +41591,117 @@ function factory$4(type) { } } +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module list-item-indent + * @fileoverview + * Warn when the spacing between a list itemā€™s bullet and its content violates + * a given style. + * + * Options: `'tab-size'`, `'mixed'`, or `'space'`, default: `'tab-size'`. + * + * ## Fix + * + * [`remark-stringify`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify) + * uses `'tab-size'` (named `'tab'` there) by default to ensure Markdown is + * seen the same way across vendors. + * This can be configured with the + * [`listItemIndent`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify#optionslistitemindent) + * option. + * This ruleā€™s `'space'` option is named `'1'` there. + * + * See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) + * on how to automatically fix warnings for this rule. + * + * @example {"name": "ok.md"} + * + * *Ā·Ā·Ā·List + * Ā·Ā·Ā·Ā·item. + * + * Paragraph. + * + * 11.Ā·List + * Ā·Ā·Ā·Ā·item. + * + * Paragraph. + * + * *Ā·Ā·Ā·List + * Ā·Ā·Ā·Ā·item. + * + * *Ā·Ā·Ā·List + * Ā·Ā·Ā·Ā·item. + * + * @example {"name": "ok.md", "setting": "mixed"} + * + * *Ā·List item. + * + * Paragraph. + * + * 11.Ā·List item + * + * Paragraph. + * + * *Ā·Ā·Ā·List + * Ā·Ā·Ā·Ā·item. + * + * *Ā·Ā·Ā·List + * Ā·Ā·Ā·Ā·item. + * + * @example {"name": "ok.md", "setting": "space"} + * + * *Ā·List item. + * + * Paragraph. + * + * 11.Ā·List item + * + * Paragraph. + * + * *Ā·List + * Ā·Ā·item. + * + * *Ā·List + * Ā·Ā·item. + * + * @example {"name": "not-ok.md", "setting": "space", "label": "input"} + * + * *Ā·Ā·Ā·List + * Ā·Ā·Ā·Ā·item. + * + * @example {"name": "not-ok.md", "setting": "space", "label": "output"} + * + * 1:5: Incorrect list-item indent: remove 2 spaces + * + * @example {"name": "not-ok.md", "setting": "tab-size", "label": "input"} + * + * *Ā·List + * Ā·Ā·item. + * + * @example {"name": "not-ok.md", "setting": "tab-size", "label": "output"} + * + * 1:3: Incorrect list-item indent: add 2 spaces + * + * @example {"name": "not-ok.md", "setting": "mixed", "label": "input"} + * + * *Ā·Ā·Ā·List item. + * + * @example {"name": "not-ok.md", "setting": "mixed", "label": "output"} + * + * 1:5: Incorrect list-item indent: remove 2 spaces + * + * @example {"name": "not-ok.md", "setting": "šŸ’©", "label": "output", "config": {"positionless": true}} + * + * 1:1: Incorrect list-item indent style `šŸ’©`: use either `'tab-size'`, `'space'`, or `'mixed'` + */ + + + + + + + var remarkLintListItemIndent = unifiedLintRule('remark-lint:list-item-indent', listItemIndent); var start$2 = unistUtilPosition.start; @@ -44304,6 +41768,76 @@ function listItemIndent(tree, file, option) { } } +var mdastUtilToString$1 = toString$4; + +// 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) { + return ( + (node && + (node.value || + node.alt || + node.title || + ('children' in node && all$1(node.children)) || + ('length' in node && all$1(node)))) || + '' + ) +} + +function all$1(values) { + var result = []; + var length = values.length; + var index = -1; + + while (++index < length) { + result[index] = toString$4(values[index]); + } + + return result.join('') +} + +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module no-auto-link-without-protocol + * @fileoverview + * Warn for autolinks without protocol. + * Autolinks are URLs enclosed in `<` (less than) and `>` (greater than) + * characters. + * + * ## Fix + * + * [`remark-stringify`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify) + * adds a protocol where needed. + * + * See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) + * on how to automatically fix warnings for this rule. + * + * @example {"name": "ok.md"} + * + * + * + * + * Most Markdown vendors donā€™t recognize the following as a link: + * + * + * @example {"name": "not-ok.md", "label": "input"} + * + * + * + * @example {"name": "not-ok.md", "label": "output"} + * + * 1:1-1:14: All automatic links must start with a protocol + */ + + + + + + + var remarkLintNoAutoLinkWithoutProtocol = unifiedLintRule( 'remark-lint:no-auto-link-without-protocol', noAutoLinkWithoutProtocol @@ -44330,7 +41864,7 @@ function noAutoLinkWithoutProtocol(tree, file) { if ( start$3(node).column === start$3(children[0]).column - 1 && end$1(node).column === end$1(children[children.length - 1]).column + 1 && - !protocol.test(mdastUtilToString(node)) + !protocol.test(mdastUtilToString$1(node)) ) { file.message(reason, node); } @@ -44338,6 +41872,63 @@ function noAutoLinkWithoutProtocol(tree, file) { } } +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module no-blockquote-without-marker + * @fileoverview + * Warn when blank lines without `>` (greater than) markers are found in a + * block quote. + * + * ## Fix + * + * [`remark-stringify`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify) + * adds markers to every line in a block quote. + * + * See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) + * on how to automatically fix warnings for this rule. + * + * @example {"name": "ok.md"} + * + * > Fooā€¦ + * > ā€¦barā€¦ + * > ā€¦baz. + * + * @example {"name": "ok-tabs.md"} + * + * >Ā»Fooā€¦ + * >Ā»ā€¦barā€¦ + * >Ā»ā€¦baz. + * + * @example {"name": "not-ok.md", "label": "input"} + * + * > Fooā€¦ + * ā€¦barā€¦ + * > ā€¦baz. + * + * @example {"name": "not-ok.md", "label": "output"} + * + * 2:1: Missing marker in block quote + * + * @example {"name": "not-ok-tabs.md", "label": "input"} + * + * >Ā»Fooā€¦ + * Ā»ā€¦barā€¦ + * ā€¦baz. + * + * @example {"name": "not-ok-tabs.md", "label": "output"} + * + * 2:1: Missing marker in block quote + * 3:1: Missing marker in block quote + */ + + + + + + + var remarkLintNoBlockquoteWithoutMarker = unifiedLintRule( 'remark-lint:no-blockquote-without-marker', noBlockquoteWithoutMarker @@ -44381,6 +41972,74 @@ function noBlockquoteWithoutMarker(tree, file) { } } +var mdastUtilToString$2 = toString$5; + +// 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$5(node) { + return ( + (node && + (node.value || + node.alt || + node.title || + ('children' in node && all$2(node.children)) || + ('length' in node && all$2(node)))) || + '' + ) +} + +function all$2(values) { + var result = []; + var length = values.length; + var index = -1; + + while (++index < length) { + result[index] = toString$5(values[index]); + } + + return result.join('') +} + +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module no-literal-urls + * @fileoverview + * Warn for literal URLs in text. + * URLs are treated as links in some Markdown vendors, but not in others. + * To make sure they are always linked, wrap them in `<` (less than) and `>` + * (greater than). + * + * ## Fix + * + * [`remark-stringify`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify) + * never creates literal URLs and always uses `<` (less than) and `>` + * (greater than). + * + * See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) + * on how to automatically fix warnings for this rule. + * + * @example {"name": "ok.md"} + * + * + * + * @example {"name": "not-ok.md", "label": "input"} + * + * http://foo.bar/baz + * + * @example {"name": "not-ok.md", "label": "output"} + * + * 1:1-1:19: Donā€™t use literal URLs without angle brackets + */ + + + + + + + var remarkLintNoLiteralUrls = unifiedLintRule('remark-lint:no-literal-urls', noLiteralURLs); var start$4 = unistUtilPosition.start; @@ -44393,7 +42052,7 @@ function noLiteralURLs(tree, file) { function visitor(node) { var children = node.children; - var value = mdastUtilToString(node); + var value = mdastUtilToString$2(node); if ( !unistUtilGenerated(node) && @@ -44406,6 +42065,66 @@ function noLiteralURLs(tree, file) { } } +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module ordered-list-marker-style + * @fileoverview + * Warn when the list item marker style of ordered lists violate a given style. + * + * Options: `'consistent'`, `'.'`, or `')'`, default: `'consistent'`. + * + * `'consistent'` detects the first used list style and warns when subsequent + * lists use different styles. + * + * Note: `)` is only supported in CommonMark. + * + * @example {"name": "ok.md"} + * + * 1. Foo + * + * + * 1. Bar + * + * Unordered lists are not affected by this rule. + * + * * Foo + * + * @example {"name": "ok.md", "setting": "."} + * + * 1. Foo + * + * 2. Bar + * + * @example {"name": "ok.md", "setting": ")", "config": {"commonmark": true}} + * + * + * + * 1) Foo + * + * 2) Bar + * + * @example {"name": "not-ok.md", "label": "input", "config": {"commonmark": true}} + * + * 1. Foo + * + * 2) Bar + * + * @example {"name": "not-ok.md", "label": "output"} + * + * 3:1-3:8: Marker style should be `.` + * + * @example {"name": "not-ok.md", "label": "output", "setting": "šŸ’©", "config": {"positionless": true}} + * + * 1:1: Incorrect ordered list item marker style `šŸ’©`: use either `'.'` or `')'` + */ + + + + + + var remarkLintOrderedListMarkerStyle = unifiedLintRule( 'remark-lint:ordered-list-marker-style', orderedListMarkerStyle @@ -44462,6 +42181,34 @@ function orderedListMarkerStyle(tree, file, option) { } } +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module hard-break-spaces + * @fileoverview + * Warn when too many spaces are used to create a hard break. + * + * @example {"name": "ok.md"} + * + * Lorem ipsumĀ·Ā· + * dolor sit amet + * + * @example {"name": "not-ok.md", "label": "input"} + * + * Lorem ipsumĀ·Ā·Ā· + * dolor sit amet. + * + * @example {"name": "not-ok.md", "label": "output"} + * + * 1:12-2:1: Use two spaces for hard line breaks + */ + + + + + + var remarkLintHardBreakSpaces = unifiedLintRule('remark-lint:hard-break-spaces', hardBreakSpaces); var reason$3 = 'Use two spaces for hard line breaks'; @@ -44487,6 +42234,35 @@ function hardBreakSpaces(tree, file) { } } +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module no-duplicate-definitions + * @fileoverview + * Warn when duplicate definitions are found. + * + * @example {"name": "ok.md"} + * + * [foo]: bar + * [baz]: qux + * + * @example {"name": "not-ok.md", "label": "input"} + * + * [foo]: bar + * [foo]: qux + * + * @example {"name": "not-ok.md", "label": "output"} + * + * 2:1-2:11: Do not use definitions with the same identifier (1:1) + */ + + + + + + + var remarkLintNoDuplicateDefinitions = unifiedLintRule( 'remark-lint:no-duplicate-definitions', noDuplicateDefinitions @@ -44562,6 +42338,61 @@ function consolidate(depth, relative) { : null } +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module no-heading-content-indent + * @fileoverview + * Warn when content of headings is indented. + * + * ## Fix + * + * [`remark-stringify`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify) + * removes all unneeded padding around content in headings. + * + * See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) + * on how to automatically fix warnings for this rule. + * + * @example {"name": "ok.md"} + * + * #Ā·Foo + * + * ## BarĀ·## + * + * ##Ā·Baz + * + * Setext headings are not affected. + * + * Baz + * === + * + * @example {"name": "not-ok.md", "label": "input"} + * + * #Ā·Ā·Foo + * + * ## BarĀ·Ā·## + * + * ##Ā·Ā·Baz + * + * @example {"name": "not-ok.md", "label": "output"} + * + * 1:4: Remove 1 space before this headingā€™s content + * 3:7: Remove 1 space after this headingā€™s content + * 5:7: Remove 1 space before this headingā€™s content + * + * @example {"name": "empty-heading.md"} + * + * #Ā·Ā· + */ + + + + + + + + var remarkLintNoHeadingContentIndent = unifiedLintRule( 'remark-lint:no-heading-content-indent', noHeadingContentIndent @@ -44635,6 +42466,64 @@ function noHeadingContentIndent(tree, file) { } } +var mdastUtilToString$3 = toString$6; + +// 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$6(node) { + return ( + (node && + (node.value || + node.alt || + node.title || + ('children' in node && all$3(node.children)) || + ('length' in node && all$3(node)))) || + '' + ) +} + +function all$3(values) { + var result = []; + var length = values.length; + var index = -1; + + while (++index < length) { + result[index] = toString$6(values[index]); + } + + return result.join('') +} + +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module no-inline-padding + * @fileoverview + * Warn when phrasing content is padded with spaces between their markers and + * content. + * + * Warns for emphasis, strong, delete, image, and link. + * + * @example {"name": "ok.md"} + * + * Alpha [bravo](http://echo.fox/trot) + * + * @example {"name": "not-ok.md", "label": "input"} + * + * Alpha [ bravo ](http://echo.fox/trot) + * + * @example {"name": "not-ok.md", "label": "output"} + * + * 1:7-1:38: Donā€™t pad `link` with inner spaces + */ + + + + + + var remarkLintNoInlinePadding = unifiedLintRule('remark-lint:no-inline-padding', noInlinePadding); function noInlinePadding(tree, file) { @@ -44646,7 +42535,7 @@ function noInlinePadding(tree, file) { var contents; if (!unistUtilGenerated(node)) { - contents = mdastUtilToString(node); + contents = mdastUtilToString$3(node); if ( contents.charAt(0) === ' ' || @@ -44658,6 +42547,41 @@ function noInlinePadding(tree, file) { } } +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module no-shortcut-reference-image + * @fileoverview + * Warn when shortcut reference images are used. + * + * Shortcut references render as images when a definition is found, and as + * plain text without definition. + * Sometimes, you donā€™t intend to create an image from the reference, but this + * rule still warns anyway. + * In that case, you can escape the reference like so: `!\[foo]`. + * + * @example {"name": "ok.md"} + * + * ![foo][] + * + * [foo]: http://foo.bar/baz.png + * + * @example {"name": "not-ok.md", "label": "input"} + * + * ![foo] + * + * [foo]: http://foo.bar/baz.png + * + * @example {"name": "not-ok.md", "label": "output"} + * + * 1:1-1:7: Use the trailing [] on reference images + */ + + + + + var remarkLintNoShortcutReferenceImage = unifiedLintRule( 'remark-lint:no-shortcut-reference-image', noShortcutReferenceImage @@ -44675,6 +42599,41 @@ function noShortcutReferenceImage(tree, file) { } } +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module no-shortcut-reference-link + * @fileoverview + * Warn when shortcut reference links are used. + * + * Shortcut references render as links when a definition is found, and as + * plain text without definition. + * Sometimes, you donā€™t intend to create a link from the reference, but this + * rule still warns anyway. + * In that case, you can escape the reference like so: `\[foo]`. + * + * @example {"name": "ok.md"} + * + * [foo][] + * + * [foo]: http://foo.bar/baz + * + * @example {"name": "not-ok.md", "label": "input"} + * + * [foo] + * + * [foo]: http://foo.bar/baz + * + * @example {"name": "not-ok.md", "label": "output"} + * + * 1:1-1:6: Use the trailing `[]` on reference links + */ + + + + + var remarkLintNoShortcutReferenceLink = unifiedLintRule( 'remark-lint:no-shortcut-reference-link', noShortcutReferenceLink @@ -44699,6 +42658,77 @@ function collapse(value) { return String(value).replace(/\s+/g, ' ') } +/** + * @author Titus Wormer + * @copyright 2016 Titus Wormer + * @license MIT + * @module no-undefined-references + * @fileoverview + * Warn when references to undefined definitions are found. + * + * Options: `Object`, optional. + * + * The object can have an `allow` field, set to an array of strings that may + * appear between `[` and `]`, but that should not be treated as link + * identifiers. + * + * @example {"name": "ok.md"} + * + * [foo][] + * + * Just a [ bracket. + * + * Typically, youā€™d want to use escapes (with a backslash: \\) to escape what + * could turn into a \[reference otherwise]. + * + * Just two braces canā€™t link: []. + * + * [foo]: https://example.com + * + * @example {"name": "ok-allow.md", "setting": {"allow": ["...", "ā€¦"]}} + * + * > Eliding a portion of a quoted passage [ā€¦] is acceptable. + * + * @example {"name": "not-ok.md", "label": "input"} + * + * [bar] + * + * [baz][] + * + * [text][qux] + * + * Spread [over + * lines][] + * + * > in [a + * > block quote][] + * + * [asd][a + * + * Can include [*emphasis*]. + * + * Multiple pairs: [a][b][c]. + * + * @example {"name": "not-ok.md", "label": "output"} + * + * 1:1-1:6: Found reference to undefined definition + * 3:1-3:8: Found reference to undefined definition + * 5:1-5:12: Found reference to undefined definition + * 7:8-8:9: Found reference to undefined definition + * 10:6-11:17: Found reference to undefined definition + * 13:1-13:6: Found reference to undefined definition + * 15:13-15:25: Found reference to undefined definition + * 17:17-17:23: Found reference to undefined definition + * 17:23-17:26: Found reference to undefined definition + */ + + + + + + + + var remarkLintNoUndefinedReferences = unifiedLintRule( 'remark-lint:no-undefined-references', noUndefinedReferences @@ -44883,6 +42913,33 @@ function noUndefinedReferences(tree, file, option) { } } +/** + * @author Titus Wormer + * @copyright 2016 Titus Wormer + * @license MIT + * @module no-unused-definitions + * @fileoverview + * Warn when unused definitions are found. + * + * @example {"name": "ok.md"} + * + * [foo][] + * + * [foo]: https://example.com + * + * @example {"name": "not-ok.md", "label": "input"} + * + * [bar]: https://example.com + * + * @example {"name": "not-ok.md", "label": "output"} + * + * 1:1-1:27: Found unused definition + */ + + + + + var remarkLintNoUnusedDefinitions = unifiedLintRule('remark-lint:no-unused-definitions', noUnusedDefinitions); var reason$8 = 'Found unused definition'; @@ -44918,8 +42975,14 @@ function noUnusedDefinitions(tree, file) { } } +/** + * @fileoverview + * remark preset to configure `remark-lint` with settings that prevent + * mistakes or syntaxes that do not work correctly across vendors. + */ + var plugins$1 = [ - remarkLint$1, + remarkLint, // Unix compatibility. remarkLintFinalNewline, // Rendering across vendors differs greatly if using other styles. @@ -44945,6 +43008,89 @@ var remarkPresetLintRecommended = { plugins: plugins$1 }; +var mdastUtilToString$4 = toString$7; + +// 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$7(node) { + return ( + (node && + (node.value || + node.alt || + node.title || + ('children' in node && all$4(node.children)) || + ('length' in node && all$4(node)))) || + '' + ) +} + +function all$4(values) { + var result = []; + var length = values.length; + var index = -1; + + while (++index < length) { + result[index] = toString$7(values[index]); + } + + return result.join('') +} + +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module blockquote-indentation + * @fileoverview + * Warn when block quotes are indented too much or too little. + * + * Options: `number` or `'consistent'`, default: `'consistent'`. + * + * `'consistent'` detects the first used indentation and will warn when + * other block quotes use a different indentation. + * + * @example {"name": "ok.md", "setting": 4} + * + * > Hello + * + * Paragraph. + * + * > World + * + * @example {"name": "ok.md", "setting": 2} + * + * > Hello + * + * Paragraph. + * + * > World + * + * @example {"name": "not-ok.md", "label": "input"} + * + * > Hello + * + * Paragraph. + * + * > World + * + * Paragraph. + * + * > World + * + * @example {"name": "not-ok.md", "label": "output"} + * + * 5:3: Remove 1 space between block quote and content + * 9:3: Add 1 space between block quote and content + */ + + + + + + + + var remarkLintBlockquoteIndentation = unifiedLintRule( 'remark-lint:blockquote-indentation', blockquoteIndentation @@ -44988,7 +43134,7 @@ function blockquoteIndentation(tree, file, option) { function check$3(node) { var head = node.children[0]; var indentation = unistUtilPosition.start(head).column - unistUtilPosition.start(node).column; - var padding = mdastUtilToString(head).match(/^ +/); + var padding = mdastUtilToString$4(head).match(/^ +/); if (padding) { indentation += padding[0].length; @@ -44997,6 +43143,82 @@ function check$3(node) { return indentation } +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module checkbox-character-style + * @fileoverview + * Warn when list item checkboxes violate a given style. + * + * Options: `Object` or `'consistent'`, default: `'consistent'`. + * + * `'consistent'` detects the first used checked and unchecked checkbox + * styles and warns when subsequent checkboxes use different styles. + * + * Styles can also be passed in like so: + * + * ```js + * {checked: 'x', unchecked: ' '} + * ``` + * + * ## Fix + * + * [`remark-stringify`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify) + * formats checked checkboxes using `x` (lowercase X) and unchecked checkboxes + * as `Ā·` (a single space). + * + * See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) + * on how to automatically fix warnings for this rule. + * + * @example {"name": "ok.md", "setting": {"checked": "x"}, "gfm": true} + * + * - [x] List item + * - [x] List item + * + * @example {"name": "ok.md", "setting": {"checked": "X"}, "gfm": true} + * + * - [X] List item + * - [X] List item + * + * @example {"name": "ok.md", "setting": {"unchecked": " "}, "gfm": true} + * + * - [ ] List item + * - [ ] List item + * - [ ]Ā·Ā· + * - [ ] + * + * @example {"name": "ok.md", "setting": {"unchecked": "\t"}, "gfm": true} + * + * - [Ā»] List item + * - [Ā»] List item + * + * @example {"name": "not-ok.md", "label": "input", "gfm": true} + * + * - [x] List item + * - [X] List item + * - [ ] List item + * - [Ā»] List item + * + * @example {"name": "not-ok.md", "label": "output", "gfm": true} + * + * 2:5: Checked checkboxes should use `x` as a marker + * 4:5: Unchecked checkboxes should use ` ` as a marker + * + * @example {"setting": {"unchecked": "šŸ’©"}, "name": "not-ok.md", "label": "output", "positionless": true, "gfm": true} + * + * 1:1: Incorrect unchecked checkbox marker `šŸ’©`: use either `'\t'`, or `' '` + * + * @example {"setting": {"checked": "šŸ’©"}, "name": "not-ok.md", "label": "output", "positionless": true, "gfm": true} + * + * 1:1: Incorrect checked checkbox marker `šŸ’©`: use either `'x'`, or `'X'` + */ + + + + + + var remarkLintCheckboxCharacterStyle = unifiedLintRule( 'remark-lint:checkbox-character-style', checkboxCharacterStyle @@ -45081,6 +43303,41 @@ function checkboxCharacterStyle(tree, file, option) { } } +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module checkbox-content-indent + * @fileoverview + * Warn when list item checkboxes are followed by too much whitespace. + * + * @example {"name": "ok.md", "gfm": true} + * + * - [ ] List item + * + [x] List Item + * * [X] List item + * - [ ] List item + * + * @example {"name": "not-ok.md", "label": "input", "gfm": true} + * + * - [ ] List item + * + [x] List item + * * [X] List item + * - [ ] List item + * + * @example {"name": "not-ok.md", "label": "output", "gfm": true} + * + * 2:7-2:8: Checkboxes should be followed by a single character + * 3:7-3:9: Checkboxes should be followed by a single character + * 4:7-4:10: Checkboxes should be followed by a single character + */ + + + + + + + var remarkLintCheckboxContentIndent = unifiedLintRule( 'remark-lint:checkbox-content-indent', checkboxContentIndent @@ -45137,6 +43394,105 @@ function checkboxContentIndent(tree, file) { } } +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module code-block-style + * @fileoverview + * Warn when code blocks do not adhere to a given style. + * + * Options: `'consistent'`, `'fenced'`, or `'indented'`, default: `'consistent'`. + * + * `'consistent'` detects the first used code block style and warns when + * subsequent code blocks uses different styles. + * + * ## Fix + * + * [`remark-stringify`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify) + * formats code blocks using a fence if they have a language flag and + * indentation if not. + * Pass + * [`fences: true`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify#optionsfences) + * to always use fences for code blocks. + * + * See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) + * on how to automatically fix warnings for this rule. + * + * @example {"setting": "indented", "name": "ok.md"} + * + * alpha(); + * + * Paragraph. + * + * bravo(); + * + * @example {"setting": "indented", "name": "not-ok.md", "label": "input"} + * + * ``` + * alpha(); + * ``` + * + * Paragraph. + * + * ``` + * bravo(); + * ``` + * + * @example {"setting": "indented", "name": "not-ok.md", "label": "output"} + * + * 1:1-3:4: Code blocks should be indented + * 7:1-9:4: Code blocks should be indented + * + * @example {"setting": "fenced", "name": "ok.md"} + * + * ``` + * alpha(); + * ``` + * + * Paragraph. + * + * ``` + * bravo(); + * ``` + * + * @example {"setting": "fenced", "name": "not-ok-fenced.md", "label": "input"} + * + * alpha(); + * + * Paragraph. + * + * bravo(); + * + * @example {"setting": "fenced", "name": "not-ok-fenced.md", "label": "output"} + * + * 1:1-1:13: Code blocks should be fenced + * 5:1-5:13: Code blocks should be fenced + * + * @example {"name": "not-ok-consistent.md", "label": "input"} + * + * alpha(); + * + * Paragraph. + * + * ``` + * bravo(); + * ``` + * + * @example {"name": "not-ok-consistent.md", "label": "output"} + * + * 5:1-7:4: Code blocks should be indented + * + * @example {"setting": "šŸ’©", "name": "not-ok-incorrect.md", "label": "output", "config": {"positionless": true}} + * + * 1:1: Incorrect code block style `šŸ’©`: use either `'consistent'`, `'fenced'`, or `'indented'` + */ + + + + + + var remarkLintCodeBlockStyle = unifiedLintRule('remark-lint:code-block-style', codeBlockStyle); var start$9 = unistUtilPosition.start; @@ -45186,6 +43542,32 @@ function codeBlockStyle(tree, file, option) { } } +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module definition-spacing + * @fileoverview + * Warn when consecutive whitespace is used in a definition. + * + * @example {"name": "ok.md"} + * + * [example domain]: http://example.com "Example Domain" + * + * @example {"name": "not-ok.md", "label": "input"} + * + * [exampleĀ·Ā·Ā·Ā·domain]: http://example.com "Example Domain" + * + * @example {"name": "not-ok.md", "label": "output"} + * + * 1:1-1:57: Do not use consecutive whitespace in definition labels + */ + + + + + + var remarkLintDefinitionSpacing = unifiedLintRule('remark-lint:definition-spacing', definitionSpacing); var label = /^\s*\[((?:\\[\s\S]|[^[\]])+)]/; @@ -45209,6 +43591,77 @@ function definitionSpacing(tree, file) { } } +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module fenced-code-flag + * @fileoverview + * Check fenced code block flags. + * + * Options: `Array.` or `Object`, optional. + * + * Providing an array is as passing `{flags: Array}`. + * + * The object can have an array of `'flags'` which are allowed: other flags + * will not be allowed. + * An `allowEmpty` field (`boolean`, default: `false`) can be set to allow + * code blocks without language flags. + * + * @example {"name": "ok.md"} + * + * ```alpha + * bravo(); + * ``` + * + * @example {"name": "not-ok.md", "label": "input"} + * + * ``` + * alpha(); + * ``` + * + * @example {"name": "not-ok.md", "label": "output"} + * + * 1:1-3:4: Missing code language flag + * + * @example {"name": "ok.md", "setting": {"allowEmpty": true}} + * + * ``` + * alpha(); + * ``` + * + * @example {"name": "not-ok.md", "setting": {"allowEmpty": false}, "label": "input"} + * + * ``` + * alpha(); + * ``` + * + * @example {"name": "not-ok.md", "setting": {"allowEmpty": false}, "label": "output"} + * + * 1:1-3:4: Missing code language flag + * + * @example {"name": "ok.md", "setting": ["alpha"]} + * + * ```alpha + * bravo(); + * ``` + * + * @example {"name": "not-ok.md", "setting": ["charlie"], "label": "input"} + * + * ```alpha + * bravo(); + * ``` + * + * @example {"name": "not-ok.md", "setting": ["charlie"], "label": "output"} + * + * 1:1-3:4: Incorrect code language flag + */ + + + + + + var remarkLintFencedCodeFlag = unifiedLintRule('remark-lint:fenced-code-flag', fencedCodeFlag); var start$a = unistUtilPosition.start; @@ -45254,6 +43707,94 @@ function fencedCodeFlag(tree, file, option) { } } +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module fenced-code-marker + * @fileoverview + * Warn for violating fenced code markers. + * + * Options: `` '`' ``, `'~'`, or `'consistent'`, default: `'consistent'`. + * + * `'consistent'` detects the first used fenced code marker style and warns + * when subsequent fenced code blocks use different styles. + * + * ## Fix + * + * [`remark-stringify`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify) + * formats fences using ``'`'`` (grave accent) by default. + * Pass + * [`fence: '~'`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify#optionsfence) + * to use `~` (tilde) instead. + * + * See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) + * on how to automatically fix warnings for this rule. + * + * @example {"name": "ok.md"} + * + * Indented code blocks are not affected by this rule: + * + * bravo(); + * + * @example {"name": "ok.md", "setting": "`"} + * + * ```alpha + * bravo(); + * ``` + * + * ``` + * charlie(); + * ``` + * + * @example {"name": "ok.md", "setting": "~"} + * + * ~~~alpha + * bravo(); + * ~~~ + * + * ~~~ + * charlie(); + * ~~~ + * + * @example {"name": "not-ok-consistent-tick.md", "label": "input"} + * + * ```alpha + * bravo(); + * ``` + * + * ~~~ + * charlie(); + * ~~~ + * + * @example {"name": "not-ok-consistent-tick.md", "label": "output"} + * + * 5:1-7:4: Fenced code should use `` ` `` as a marker + * + * @example {"name": "not-ok-consistent-tilde.md", "label": "input"} + * + * ~~~alpha + * bravo(); + * ~~~ + * + * ``` + * charlie(); + * ``` + * + * @example {"name": "not-ok-consistent-tilde.md", "label": "output"} + * + * 5:1-7:4: Fenced code should use `~` as a marker + * + * @example {"name": "not-ok-incorrect.md", "setting": "šŸ’©", "label": "output", "config": {"positionless": true}} + * + * 1:1: Incorrect fenced code marker `šŸ’©`: use either `'consistent'`, `` '`' ``, or `'~'` + */ + + + + + + var remarkLintFencedCodeMarker = unifiedLintRule('remark-lint:fenced-code-marker', fencedCodeMarker); var markers = { @@ -45307,6 +43848,32 @@ function fencedCodeMarker(tree, file, option) { } } +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module file-extension + * @fileoverview + * Warn when the file extension differ from the preferred extension. + * + * Does not warn when given documents have no file extensions (such as + * `AUTHORS` or `LICENSE`). + * + * Options: `string`, default: `'md'` ā€” Expected file extension. + * + * @example {"name": "readme.md"} + * + * @example {"name": "readme"} + * + * @example {"name": "readme.mkd", "label": "output", "config": {"positionless": true}} + * + * 1:1: Incorrect extension: use `md` + * + * @example {"name": "readme.mkd", "setting": "mkd"} + */ + + + var remarkLintFileExtension = unifiedLintRule('remark-lint:file-extension', fileExtension); function fileExtension(tree, file, option) { @@ -45318,6 +43885,49 @@ function fileExtension(tree, file, option) { } } +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module final-definition + * @fileoverview + * Warn when definitions are placed somewhere other than at the end of + * the file. + * + * @example {"name": "ok.md"} + * + * Paragraph. + * + * [example]: http://example.com "Example Domain" + * + * @example {"name": "not-ok.md", "label": "input"} + * + * Paragraph. + * + * [example]: http://example.com "Example Domain" + * + * Another paragraph. + * + * @example {"name": "not-ok.md", "label": "output"} + * + * 3:1-3:47: Move definitions to the end of the file (after the node at line `5`) + * + * @example {"name": "ok-comments.md"} + * + * Paragraph. + * + * [example-1]: http://example.com/one/ + * + * + * + * [example-2]: http://example.com/two/ + */ + + + + + + var remarkLintFinalDefinition = unifiedLintRule('remark-lint:final-definition', finalDefinition); var start$b = unistUtilPosition.start; @@ -45350,6 +43960,89 @@ function finalDefinition(tree, file) { } } +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module first-heading-level + * @fileoverview + * Warn when the first heading has a level other than a specified value. + * + * Options: `number`, default: `1`. + * + * @example {"name": "ok.md"} + * + * # The default is to expect a level one heading + * + * @example {"name": "ok-html.md"} + * + *

An HTML heading is also seen by this rule.

+ * + * @example {"name": "ok-delayed.md"} + * + * You can use markdown content before the heading. + * + *
Or non-heading HTML
+ * + *

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

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

Charlie

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

Echo

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

Golf

+ * + * Paragraph. + * + * @example {"name": "not-ok-html.md", "setting": 2, "label": "output"} + * + * 1:1-1:14: First heading level should be `2` + */ + + + + + var remarkLintFirstHeadingLevel = unifiedLintRule('remark-lint:first-heading-level', firstHeadingLevel); var re$1 = / + * + * + * + * `alphaBravoCharlieDeltaEchoFoxtrotGolfHotelIndiaJuliettKiloLimaMikeNovemberOscarPapaQuebec.romeo()` + * + * [foo](http://this-long-url-with-a-long-domain-is-ok.co.uk/a-long-path?query=variables) + * + * + * + * ![foo](http://this-long-url-with-a-long-domain-is-ok.co.uk/a-long-path?query=variables) + * + * | An | exception | is | line | length | in | long | tables | because | those | canā€™t | just | + * | -- | --------- | -- | ---- | ------ | -- | ---- | ------ | ------- | ----- | ----- | ---- | + * | be | helped | | | | | | | | | | . | + * + *

alpha bravo charlie delta echo foxtrot golf

+ * + * The following is also fine, because there is no whitespace. + * + * . + * + * In addition, definitions are also fine: + * + * [foo]: + * + * @example {"name": "not-ok.md", "setting": 80, "label": "input", "config": {"positionless": true}} + * + * This line is simply not tooooooooooooooooooooooooooooooooooooooooooooooooooooooo + * long. + * + * Just like thiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiis one. + * + * And this one is also very wrong: because the link starts aaaaaaafter the column: + * + * and such. + * + * And this one is also very wrong: because the code starts aaaaaaafter the column: `alpha.bravo()` + * + * `alphaBravoCharlieDeltaEchoFoxtrotGolfHotelIndiaJuliettKiloLimaMikeNovemberOscar.papa()` and such. + * + * @example {"name": "not-ok.md", "setting": 80, "label": "output", "config": {"positionless": true}} + * + * 4:86: Line must be at most 80 characters + * 6:99: Line must be at most 80 characters + * 8:96: Line must be at most 80 characters + * 10:97: Line must be at most 80 characters + * 12:99: Line must be at most 80 characters + * + * @example {"name": "ok-mixed-line-endings.md", "setting": 10, "config": {"positionless": true}} + * + * 0123456789āāŠ + * 0123456789āŠ + * 01234āāŠ + * 01234āŠ + * + * @example {"name": "not-ok-mixed-line-endings.md", "setting": 10, "label": "input", "config": {"positionless": true}} + * + * 012345678901āāŠ + * 012345678901āŠ + * 01234567890āāŠ + * 01234567890āŠ + * + * @example {"name": "not-ok-mixed-line-endings.md", "setting": 10, "label": "output", "config": {"positionless": true}} + * + * 1:13: Line must be at most 10 characters + * 2:13: Line must be at most 10 characters + * 3:12: Line must be at most 10 characters + * 4:12: Line must be at most 10 characters + */ + + + + + + var remarkLintMaximumLineLength = unifiedLintRule('remark-lint:maximum-line-length', maximumLineLength); var start$c = unistUtilPosition.start; @@ -45492,6 +44355,54 @@ function maximumLineLength(tree, file, option) { } } +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module no-consecutive-blank-lines + * @fileoverview + * Warn for too many consecutive blank lines. + * Knows about the extra line needed between a list and indented code, and two + * lists. + * + * ## Fix + * + * [`remark-stringify`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify) + * always uses one blank line between blocks if possible, or two lines when + * needed. + * + * See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) + * on how to automatically fix warnings for this rule. + * + * @example {"name": "ok.md"} + * + * Fooā€¦ + * āŠ + * ā€¦Bar. + * + * @example {"name": "empty-document.md"} + * + * @example {"name": "not-ok.md", "label": "input"} + * + * Fooā€¦ + * āŠ + * āŠ + * ā€¦Bar + * āŠ + * āŠ + * + * @example {"name": "not-ok.md", "label": "output"} + * + * 4:1: Remove 1 line before node + * 4:5: Remove 2 lines after node + */ + + + + + + + var remarkLintNoConsecutiveBlankLines = unifiedLintRule( 'remark-lint:no-consecutive-blank-lines', noConsecutiveBlankLines @@ -45555,6 +44466,35 @@ function noConsecutiveBlankLines(tree, file) { } } +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module no-file-name-articles + * @fileoverview + * Warn when file names start with an article. + * + * @example {"name": "title.md"} + * + * @example {"name": "a-title.md", "label": "output", "config": {"positionless": true}} + * + * 1:1: Do not start file names with `a` + * + * @example {"name": "the-title.md", "label": "output", "config": {"positionless": true}} + * + * 1:1: Do not start file names with `the` + * + * @example {"name": "teh-title.md", "label": "output", "config": {"positionless": true}} + * + * 1:1: Do not start file names with `teh` + * + * @example {"name": "an-article.md", "label": "output", "config": {"positionless": true}} + * + * 1:1: Do not start file names with `an` + */ + + + var remarkLintNoFileNameArticles = unifiedLintRule('remark-lint:no-file-name-articles', noFileNameArticles); function noFileNameArticles(tree, file) { @@ -45565,6 +44505,23 @@ function noFileNameArticles(tree, file) { } } +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module no-file-name-consecutive-dashes + * @fileoverview + * Warn when file names contain consecutive dashes. + * + * @example {"name": "plug-ins.md"} + * + * @example {"name": "plug--ins.md", "label": "output", "config": {"positionless": true}} + * + * 1:1: Do not use consecutive dashes in a file name + */ + + + var remarkLintNoFileNameConsecutiveDashes = unifiedLintRule( 'remark-lint:no-file-name-consecutive-dashes', noFileNameConsecutiveDashes @@ -45578,6 +44535,27 @@ function noFileNameConsecutiveDashes(tree, file) { } } +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module no-file-name-outer-dashes + * @fileoverview + * Warn when file names contain initial or final dashes (hyphen-minus, `-`). + * + * @example {"name": "readme.md"} + * + * @example {"name": "-readme.md", "label": "output", "config": {"positionless": true}} + * + * 1:1: Do not use initial or final dashes in a file name + * + * @example {"name": "readme-.md", "label": "output", "config": {"positionless": true}} + * + * 1:1: Do not use initial or final dashes in a file name + */ + + + var remarkLintNoFileNameOuterDashes = unifiedLintRule( 'remark-lint:no-file-name-outer-dashes', noFileNameOuterDashes @@ -45591,6 +44569,60 @@ function noFileNameOuterDashes(tree, file) { } } +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module no-heading-indent + * @fileoverview + * Warn when a heading is indented. + * + * ## Fix + * + * [`remark-stringify`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify) + * removes all unneeded indentation before headings. + * + * See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) + * on how to automatically fix warnings for this rule. + * + * @example {"name": "ok.md"} + * + * #Ā·Hello world + * + * Foo + * ----- + * + * #Ā·Hello worldĀ·# + * + * Bar + * ===== + * + * @example {"name": "not-ok.md", "label": "input"} + * + * Ā·Ā·Ā·# Hello world + * + * Ā·Foo + * ----- + * + * Ā·# Hello world # + * + * Ā·Ā·Ā·Bar + * ===== + * + * @example {"name": "not-ok.md", "label": "output"} + * + * 1:4: Remove 3 spaces before this heading + * 3:2: Remove 1 space before this heading + * 6:2: Remove 1 space before this heading + * 8:4: Remove 3 spaces before this heading + */ + + + + + + + var remarkLintNoHeadingIndent = unifiedLintRule('remark-lint:no-heading-indent', noHeadingIndent); var start$d = unistUtilPosition.start; @@ -45618,6 +44650,35 @@ function noHeadingIndent(tree, file) { } } +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module no-multiple-toplevel-headings + * @fileoverview + * Warn when multiple top level headings are used. + * + * Options: `number`, default: `1`. + * + * @example {"name": "ok.md", "setting": 1} + * + * # Foo + * + * ## Bar + * + * @example {"name": "not-ok.md", "setting": 1, "label": "input"} + * + * # Foo + * + * # Bar + * + * @example {"name": "not-ok.md", "setting": 1, "label": "output"} + * + * 3:1-3:6: Donā€™t use multiple top level headings (1:1) + */ + + + var start$e = unistUtilPosition.start; @@ -45647,6 +44708,65 @@ function noMultipleToplevelHeadings(tree, file, option) { } } +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module no-shell-dollars + * @fileoverview + * Warn when shell code is prefixed by `$` (dollar sign) characters. + * + * Ignores indented code blocks and fenced code blocks without language flag. + * + * @example {"name": "ok.md"} + * + * ```bash + * echo a + * ``` + * + * ```sh + * echo a + * echo a > file + * ``` + * + * ```zsh + * $ echo a + * a + * $ echo a > file + * ``` + * + * Some empty code: + * + * ```command + * ``` + * + * Itā€™s fine to use dollars in non-shell code. + * + * ```js + * $('div').remove(); + * ``` + * + * @example {"name": "not-ok.md", "label": "input"} + * + * ```sh + * $ echo a + * ``` + * + * ```bash + * $ echo a + * $ echo a > file + * ``` + * + * @example {"name": "not-ok.md", "label": "output"} + * + * 1:1-3:4: Do not use dollar signs before shell commands + * 5:1-8:4: Do not use dollar signs before shell commands + */ + + + + + var remarkLintNoShellDollars = unifiedLintRule('remark-lint:no-shell-dollars', noShellDollars); var reason$d = 'Do not use dollar signs before shell commands'; @@ -45703,6 +44823,70 @@ function noShellDollars(tree, file) { } } +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module no-table-indentation + * @fileoverview + * Warn when tables are indented. + * + * ## Fix + * + * [`remark-stringify`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify) + * removes all unneeded indentation before tables. + * + * See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) + * on how to automatically fix warnings for this rule. + * + * @example {"name": "ok.md", "gfm": true} + * + * Paragraph. + * + * | A | B | + * | ----- | ----- | + * | Alpha | Bravo | + * + * @example {"name": "not-ok.md", "label": "input", "gfm": true} + * + * Paragraph. + * + * Ā·Ā·Ā·| A | B | + * Ā·Ā·Ā·| ----- | ----- | + * Ā·Ā·Ā·| Alpha | Bravo | + * + * @example {"name": "not-ok.md", "label": "output", "gfm": true} + * + * 3:4: Do not indent table rows + * 4:4: Do not indent table rows + * 5:4: Do not indent table rows + * + * @example {"name": "not-ok-blockquote.md", "label": "input", "gfm": true} + * + * >Ā·Ā·| A | + * >Ā·| - | + * + * @example {"name": "not-ok-blockquote.md", "label": "output", "gfm": true} + * + * 1:4: Do not indent table rows + * + * @example {"name": "not-ok-list.md", "label": "input", "gfm": true} + * + * -Ā·Ā·Ā·paragraph + * + * Ā·Ā·Ā·Ā·Ā·| A | + * Ā·Ā·Ā·Ā·| - | + * + * @example {"name": "not-ok-list.md", "label": "output", "gfm": true} + * + * 3:6: Do not indent table rows + */ + + + + + + var remarkLintNoTableIndentation = unifiedLintRule('remark-lint:no-table-indentation', noTableIndentation); var reason$e = 'Do not indent table rows'; @@ -45770,6 +44954,61 @@ function noTableIndentation(tree, file) { } } +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module no-tabs + * @fileoverview + * Warn when hard tabs (`\t`) are used instead of spaces. + * + * ## Fix + * + * [`remark-stringify`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify) + * uses spaces where tabs are used for indentation, but retains tabs used in + * content. + * + * See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) + * on how to automatically fix warnings for this rule. + * + * @example {"name": "ok.md"} + * + * Foo Bar + * + * Ā·Ā·Ā·Ā·Foo + * + * @example {"name": "not-ok.md", "label": "input", "config": {"positionless": true}} + * + * Ā»Here's one before a code block. + * + * Here's a tab:Ā», and here is another:Ā». + * + * And this is in `inlineĀ»code`. + * + * >Ā»This is in a block quote. + * + * *Ā»Andā€¦ + * + * Ā»1.Ā»in a list. + * + * And this is a tab as the last character.Ā» + * + * @example {"name": "not-ok.md", "label": "output"} + * + * 1:1: Use spaces instead of tabs + * 3:14: Use spaces instead of tabs + * 3:37: Use spaces instead of tabs + * 5:23: Use spaces instead of tabs + * 7:2: Use spaces instead of tabs + * 9:2: Use spaces instead of tabs + * 11:1: Use spaces instead of tabs + * 11:4: Use spaces instead of tabs + * 13:41: Use spaces instead of tabs + */ + + + + var remarkLintNoTabs = unifiedLintRule('remark-lint:no-tabs', noTabs); var reason$f = 'Use spaces instead of tabs'; @@ -46020,12 +45259,18 @@ createToken('STAR', '(<|>)?=?\\s*\\*'); createToken('GTE0', '^\\s*>=\\s*0\.0\.0\\s*$'); createToken('GTE0PRE', '^\\s*>=\\s*0\.0\.0-0\\s*$'); }); -var re_2 = re_1.re; -var re_3 = re_1.src; -var re_4 = re_1.t; -var re_5 = re_1.tildeTrimReplace; -var re_6 = re_1.caretTrimReplace; -var re_7 = re_1.comparatorTrimReplace; + +// parse out just the options we care about so we always get a consistent +// obj with keys in a consistent order. +const opts = ['includePrerelease', 'loose', 'rtl']; +const parseOptions = options => + !options ? {} + : typeof options !== 'object' ? { loose: true } + : opts.filter(k => options[k]).reduce((options, k) => { + options[k] = true; + return options + }, {}); +var parseOptions_1 = parseOptions; const numeric$1 = /^[0-9]+$/; const compareIdentifiers = (a, b) => { @@ -46054,15 +45299,12 @@ var identifiers = { const { MAX_LENGTH: MAX_LENGTH$3, MAX_SAFE_INTEGER: MAX_SAFE_INTEGER$1 } = constants$3; const { re: re$2, t } = re_1; + const { compareIdentifiers: compareIdentifiers$1 } = identifiers; class SemVer { constructor (version, options) { - if (!options || typeof options !== 'object') { - options = { - loose: !!options, - includePrerelease: false - }; - } + options = parseOptions_1(options); + if (version instanceof SemVer) { if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) { @@ -46345,13 +45587,9 @@ const {MAX_LENGTH: MAX_LENGTH$4} = constants$3; const { re: re$3, t: t$1 } = re_1; -const parse$a = (version, options) => { - if (!options || typeof options !== 'object') { - options = { - loose: !!options, - includePrerelease: false - }; - } + +const parse$9 = (version, options) => { + options = parseOptions_1(options); if (version instanceof semver) { return version @@ -46377,7 +45615,7 @@ const parse$a = (version, options) => { } }; -var parse_1$3 = parse$a; +var parse_1$4 = parse$9; const compare$2 = (a, b, loose) => new semver(a, loose).compare(new semver(b, loose)); @@ -46396,7 +45634,7 @@ const allowedKeys = [ ]; const changesExpectedKeys = ["version", "pr-url", "description"]; const VERSION_PLACEHOLDER = "REPLACEME"; -const MAX_SAFE_SEMVER_VERSION = parse_1$3( +const MAX_SAFE_SEMVER_VERSION = parse_1$4( Array.from({ length: 3 }, () => Number.MAX_SAFE_INTEGER).join(".") ); const validVersionNumberRegex = /^v\d+\.\d+\.\d+$/; @@ -46696,6 +45934,63 @@ function prohibitedStrings (ast, file, strings) { } } +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module rule-style + * @fileoverview + * Warn when the thematic breaks (horizontal rules) violate a given or + * detected style. + * + * Options: `string`, either a corect thematic breaks such as `***`, or + * `'consistent'`, default: `'consistent'`. + * + * `'consistent'` detects the first used thematic break style and warns when + * subsequent rules use different styles. + * + * ## Fix + * + * [`remark-stringify`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify) + * has three settings that define how rules are created: + * + * * [`rule`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify#optionsrule) + * (default: `*`) ā€” Marker to use + * * [`ruleRepetition`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify#optionsrulerepetition) + * (default: `3`) ā€” Number of markers to use + * * [`ruleSpaces`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify#optionsrulespaces) + * (default: `true`) ā€” Whether to pad markers with spaces + * + * See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) + * on how to automatically fix warnings for this rule. + * + * @example {"name": "ok.md", "setting": "* * *"} + * + * * * * + * + * * * * + * + * @example {"name": "ok.md", "setting": "_______"} + * + * _______ + * + * _______ + * + * @example {"name": "not-ok.md", "label": "input"} + * + * *** + * + * * * * + * + * @example {"name": "not-ok.md", "label": "output"} + * + * 3:1-3:6: Rules should use `***` + * + * @example {"name": "not-ok.md", "label": "output", "setting": "šŸ’©", "config": {"positionless": true}} + * + * 1:1: Incorrect preferred rule style: provide a correct markdown rule or `'consistent'` + */ + var rule = unifiedLintRule; @@ -46738,6 +46033,64 @@ function ruleStyle(tree, file, option) { } } +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module strong-marker + * @fileoverview + * Warn for violating importance (strong) markers. + * + * Options: `'consistent'`, `'*'`, or `'_'`, default: `'consistent'`. + * + * `'consistent'` detects the first used importance style and warns when + * subsequent importance sequences use different styles. + * + * ## Fix + * + * [`remark-stringify`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify) + * formats importance using an `*` (asterisk) by default. + * Pass + * [`strong: '_'`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify#optionsstrong) + * to use `_` (underscore) instead. + * + * See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) + * on how to automatically fix warnings for this rule. + * + * @example {"name": "ok.md"} + * + * **foo** and **bar**. + * + * @example {"name": "also-ok.md"} + * + * __foo__ and __bar__. + * + * @example {"name": "ok.md", "setting": "*"} + * + * **foo**. + * + * @example {"name": "ok.md", "setting": "_"} + * + * __foo__. + * + * @example {"name": "not-ok.md", "label": "input"} + * + * **foo** and __bar__. + * + * @example {"name": "not-ok.md", "label": "output"} + * + * 1:13-1:20: Strong should use `*` as a marker + * + * @example {"name": "not-ok.md", "label": "output", "setting": "šŸ’©", "config": {"positionless": true}} + * + * 1:1: Incorrect strong marker `šŸ’©`: use either `'consistent'`, `'*'`, or `'_'` + */ + + + + + + var remarkLintStrongMarker = unifiedLintRule('remark-lint:strong-marker', strongMarker); var markers$1 = {'*': true, _: true, null: true}; @@ -46775,6 +46128,167 @@ function strongMarker(tree, file, option) { } } +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module table-cell-padding + * @fileoverview + * Warn when table cells are incorrectly padded. + * + * Options: `'consistent'`, `'padded'`, or `'compact'`, default: `'consistent'`. + * + * `'consistent'` detects the first used cell padding style and warns when + * subsequent cells use different styles. + * + * ## Fix + * + * [`remark-stringify`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify) + * formats tables with padding by default. + * Pass + * [`spacedTable: false`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify#optionsspacedtable) + * to not use padding. + * + * See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) + * on how to automatically fix warnings for this rule. + * + * @example {"name": "ok.md", "setting": "padded", "gfm": true} + * + * | A | B | + * | ----- | ----- | + * | Alpha | Bravo | + * + * @example {"name": "not-ok.md", "label": "input", "setting": "padded", "gfm": true} + * + * | A | B | + * | :----|----: | + * | Alpha|Bravo | + * + * | C | D | + * | :----- | ---: | + * |Charlie | Delta| + * + * Too much padding isnā€™t good either: + * + * | E | F | G | H | + * | :---- | -------- | :----: | -----: | + * | Echo | Foxtrot | Golf | Hotel | + * + * @example {"name": "not-ok.md", "label": "output", "setting": "padded", "gfm": true} + * + * 3:8: Cell should be padded + * 3:9: Cell should be padded + * 7:2: Cell should be padded + * 7:17: Cell should be padded + * 13:9: Cell should be padded with 1 space, not 2 + * 13:20: Cell should be padded with 1 space, not 2 + * 13:21: Cell should be padded with 1 space, not 2 + * 13:29: Cell should be padded with 1 space, not 2 + * 13:30: Cell should be padded with 1 space, not 2 + * + * @example {"name": "ok.md", "setting": "compact", "gfm": true} + * + * |A |B | + * |-----|-----| + * |Alpha|Bravo| + * + * @example {"name": "not-ok.md", "label": "input", "setting": "compact", "gfm": true} + * + * | A | B | + * | -----| -----| + * | Alpha| Bravo| + * + * |C | D| + * |:------|-----:| + * |Charlie|Delta | + * + * @example {"name": "not-ok.md", "label": "output", "setting": "compact", "gfm": true} + * + * 3:2: Cell should be compact + * 3:11: Cell should be compact + * 7:16: Cell should be compact + * + * @example {"name": "ok-padded.md", "setting": "consistent", "gfm": true} + * + * | A | B | + * | ----- | ----- | + * | Alpha | Bravo | + * + * | C | D | + * | ------- | ----- | + * | Charlie | Delta | + * + * @example {"name": "not-ok-padded.md", "label": "input", "setting": "consistent", "gfm": true} + * + * | A | B | + * | ----- | ----- | + * | Alpha | Bravo | + * + * | C | D | + * | :----- | ----: | + * |Charlie | Delta | + * + * @example {"name": "not-ok-padded.md", "label": "output", "setting": "consistent", "gfm": true} + * + * 7:2: Cell should be padded + * + * @example {"name": "ok-compact.md", "setting": "consistent", "gfm": true} + * + * |A |B | + * |-----|-----| + * |Alpha|Bravo| + * + * |C |D | + * |-------|-----| + * |Charlie|Delta| + * + * @example {"name": "not-ok-compact.md", "label": "input", "setting": "consistent", "gfm": true} + * + * |A |B | + * |-----|-----| + * |Alpha|Bravo| + * + * |C | D| + * |:------|-----:| + * |Charlie|Delta | + * + * @example {"name": "not-ok-compact.md", "label": "output", "setting": "consistent", "gfm": true} + * + * 7:16: Cell should be compact + * + * @example {"name": "not-ok.md", "label": "output", "setting": "šŸ’©", "positionless": true, "gfm": true} + * + * 1:1: Incorrect table cell padding style `šŸ’©`, expected `'padded'`, `'compact'`, or `'consistent'` + * + * @example {"name": "empty.md", "label": "input", "setting": "padded", "gfm": true} + * + * + * + * | | Alpha | Bravo| + * | ------ | ----- | ---: | + * | Charlie| | Echo| + * + * @example {"name": "empty.md", "label": "output", "setting": "padded", "gfm": true} + * + * 3:25: Cell should be padded + * 5:10: Cell should be padded + * 5:25: Cell should be padded + * + * @example {"name": "missing-body.md", "setting": "padded", "gfm": true} + * + * + * + * | Alpha | Bravo | Charlie | + * | ----- | ------- | ------- | + * | Delta | + * | Echo | Foxtrot | + */ + + + + + + var remarkLintTableCellPadding = unifiedLintRule('remark-lint:table-cell-padding', tableCellPadding); var start$h = unistUtilPosition.start; @@ -46876,7 +46390,7 @@ function tableCellPadding(tree, file, option) { if (style === 0) { // Ignore every cell except the biggest in the column. - if (size(cell) < sizes[column]) { + if (size$1(cell) < sizes[column]) { return } @@ -46886,7 +46400,7 @@ function tableCellPadding(tree, file, option) { if (spacing > style) { // May be right or center aligned. - if (size(cell) < sizes[column]) { + if (size$1(cell) < sizes[column]) { return } @@ -46910,13 +46424,57 @@ function tableCellPadding(tree, file, option) { } } -function size(node) { +function size$1(node) { return ( end$a(node.children[node.children.length - 1]).offset - start$h(node.children[0]).offset ) } +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module table-pipes + * @fileoverview + * Warn when table rows are not fenced with pipes. + * + * ## Fix + * + * [`remark-stringify`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify) + * creates fenced rows with initial and final pipes by default. + * Pass + * [`looseTable: true`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify#optionsloosetable) + * to not use row fences. + * + * See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) + * on how to automatically fix warnings for this rule. + * + * @example {"name": "ok.md", "gfm": true} + * + * | A | B | + * | ----- | ----- | + * | Alpha | Bravo | + * + * @example {"name": "not-ok.md", "label": "input", "gfm": true} + * + * A | B + * ----- | ----- + * Alpha | Bravo + * + * @example {"name": "not-ok.md", "label": "output", "gfm": true} + * + * 1:1: Missing initial pipe in table fence + * 1:10: Missing final pipe in table fence + * 3:1: Missing initial pipe in table fence + * 3:14: Missing final pipe in table fence + */ + + + + + + var remarkLintTablePipes = unifiedLintRule('remark-lint:table-pipes', tablePipes); var start$i = unistUtilPosition.start; @@ -46952,6 +46510,79 @@ function tablePipes(tree, file) { } } +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module unordered-list-marker-style + * @fileoverview + * Warn when the list item marker style of unordered lists violate a given + * style. + * + * Options: `'consistent'`, `'-'`, `'*'`, or `'+'`, default: `'consistent'`. + * + * `'consistent'` detects the first used list style and warns when subsequent + * lists use different styles. + * + * ## Fix + * + * [`remark-stringify`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify) + * formats unordered lists using `-` (hyphen-minus) by default. + * Pass + * [`bullet: '*'` or `bullet: '+'`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify#optionsbullet) + * to use `*` (asterisk) or `+` (plus sign) instead. + * + * See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) + * on how to automatically fix warnings for this rule. + * + * @example {"name": "ok.md"} + * + * By default (`'consistent'`), if the file uses only one marker, + * thatā€™s OK. + * + * * Foo + * * Bar + * * Baz + * + * Ordered lists are not affected. + * + * 1. Foo + * 2. Bar + * 3. Baz + * + * @example {"name": "ok.md", "setting": "*"} + * + * * Foo + * + * @example {"name": "ok.md", "setting": "-"} + * + * - Foo + * + * @example {"name": "ok.md", "setting": "+"} + * + * + Foo + * + * @example {"name": "not-ok.md", "label": "input"} + * + * * Foo + * - Bar + * + Baz + * + * @example {"name": "not-ok.md", "label": "output"} + * + * 2:1-2:6: Marker style should be `*` + * 3:1-3:6: Marker style should be `*` + * + * @example {"name": "not-ok.md", "label": "output", "setting": "šŸ’©", "config": {"positionless": true}} + * + * 1:1: Incorrect unordered list item marker style `šŸ’©`: use either `'-'`, `'*'`, or `'+'` + */ + + + + + + var remarkLintUnorderedListMarkerStyle = unifiedLintRule( 'remark-lint:unordered-list-marker-style', unorderedListMarkerStyle @@ -47092,9 +46723,12 @@ var remarkPresetLintNode = { plugins: plugins$2 }; +var www = {tokenize: tokenizeWww}; +var http = {tokenize: tokenizeHttp}; var domain = {tokenize: tokenizeDomain}; var path$1 = {tokenize: tokenizePath}; var punctuation = {tokenize: tokenizePunctuation}; +var domainPunctuation = {tokenize: tokenizeDomainPunctuation}; var paren = {tokenize: tokenizeParen}; var namedCharacterReference = {tokenize: tokenizeNamedCharacterReference}; @@ -47105,7 +46739,7 @@ var emailAutolink = {tokenize: tokenizeEmailAutolink, previous: previous$1}; var text$4 = {}; // Export hooked constructs. -var text_1$2 = text$4; +var text_1$3 = text$4; // `0` var code$2 = 48; @@ -47182,7 +46816,7 @@ function tokenizeEmailAutolink(effects, ok, nok) { return effects.check(punctuation, nok, dashOrUnderscoreContinuation)(code) } - if (asciiAlphanumeric(code)) { + if (asciiAlphanumeric_1(code)) { effects.consume(code); return label } @@ -47234,38 +46868,11 @@ function tokenizeWwwAutolink(effects, ok, nok) { effects.enter('literalAutolink'); effects.enter('literalAutolinkWww'); - effects.consume(code); - return w2 - } - - function w2(code) { - // `w` - if (code === 87 || code - 32 === 87) { - effects.consume(code); - return w3 - } - - return nok(code) - } - - function w3(code) { - // `w` - if (code === 87 || code - 32 === 87) { - effects.consume(code); - return dot - } - - return nok(code) - } - - function dot(code) { - // `.` - if (code === 46) { - effects.consume(code); - return effects.attempt(domain, effects.attempt(path$1, done), nok) - } - - return nok(code) + return effects.check( + www, + effects.attempt(domain, effects.attempt(path$1, done), nok), + nok + )(code) } function done(code) { @@ -47288,6 +46895,25 @@ function tokenizeHttpAutolink(effects, ok, nok) { effects.enter('literalAutolink'); effects.enter('literalAutolinkHttp'); + return effects.check( + http, + effects.attempt(domain, effects.attempt(path$1, done), nok), + nok + )(code) + } + + function done(code) { + effects.exit('literalAutolinkHttp'); + effects.exit('literalAutolink'); + return ok(code) + } +} + +function tokenizeHttp(effects, ok, nok) { + return start + + function start(code) { + // Assume a `h`. effects.consume(code); return t1 } @@ -47356,66 +46982,136 @@ function tokenizeHttpAutolink(effects, ok, nok) { // `/` if (code === 47) { effects.consume(code); - return effects.attempt(domain, effects.attempt(path$1, done), nok) + return after } return nok(code) } - function done(code) { - effects.exit('literalAutolinkHttp'); - effects.exit('literalAutolink'); - return ok(code) + function after(code) { + return asciiControl_1(code) || + unicodeWhitespace_1(code) || + unicodePunctuation_1(code) + ? nok(code) + : ok(code) } } -function tokenizeDomain(effects, ok, nok) { - var hasUnderscoreInLastSegment; - var hasUnderscoreInLastLastSegment; - var hasDot; - +function tokenizeWww(effects, ok, nok) { return start function start(code) { - effects.enter('literalAutolinkDomain'); - return domain(code) + // Assume a `w`. + effects.consume(code); + return w2 + } + + function w2(code) { + // `w` + if (code === 87 || code - 32 === 87) { + effects.consume(code); + return w3 + } + + return nok(code) + } + + function w3(code) { + // `w` + if (code === 87 || code - 32 === 87) { + effects.consume(code); + return dot + } + + return nok(code) + } + + function dot(code) { + // `.` + if (code === 46) { + effects.consume(code); + return after + } + + return nok(code) } + function after(code) { + return code === null || markdownLineEnding_1(code) ? nok(code) : ok(code) + } +} + +function tokenizeDomain(effects, ok, nok) { + var opened; + var hasUnderscoreInLastSegment; + var hasUnderscoreInLastLastSegment; + + return domain + function domain(code) { if ( - // `-` - code === 45 || - // `_` - code === 95 || - asciiAlphanumeric(code) + // `/` + code === 47 || + asciiControl_1(code) || + unicodeWhitespace_1(code) ) { - if (code === 95) { - hasUnderscoreInLastSegment = true; - } + return done(code) + } - effects.consume(code); - return domain + // `&` + if (code === 38) { + return effects.check( + namedCharacterReference, + done, + punctuationContinuation + )(code) + } + + if ( + // `.` + code === 46 || + trailingPunctuation(code) + ) { + return effects.check( + domainPunctuation, + done, + punctuationContinuation + )(code) } + open(); + effects.consume(code); + return domain + } + + function punctuationContinuation(code) { // `.` if (code === 46) { - return effects.check(punctuation, done, dotContinuation)(code) + hasUnderscoreInLastLastSegment = hasUnderscoreInLastSegment; + hasUnderscoreInLastSegment = undefined; + open(); + effects.consume(code); + return domain } - return done(code) - } + // `_` + if (code === 95) hasUnderscoreInLastSegment = true; - function dotContinuation(code) { + open(); effects.consume(code); - hasDot = true; - hasUnderscoreInLastLastSegment = hasUnderscoreInLastSegment; - hasUnderscoreInLastSegment = undefined; return domain } + function open() { + if (!opened) { + effects.enter('literalAutolinkDomain'); + opened = true; + } + } + function done(code) { if ( - hasDot && + opened && !hasUnderscoreInLastLastSegment && !hasUnderscoreInLastSegment ) { @@ -47433,19 +47129,12 @@ function tokenizePath(effects, ok) { return start function start(code) { - if (pathEnd(code)) { - return ok(code) - } - - if (trailingPunctuation(code)) { - return effects.check(punctuation, ok, atPathStart)(code) - } - - return atPathStart(code) + // `/` + return code === 47 ? atPathStart(code) : ok(code) } function atPathStart(code) { - effects.enter('literalAutolinkWwwPath'); + effects.enter('literalAutolinkPath'); return inPath(code) } @@ -47492,7 +47181,7 @@ function tokenizePath(effects, ok) { } function atPathEnd(code) { - effects.exit('literalAutolinkWwwPath'); + effects.exit('literalAutolinkPath'); return ok(code) } } @@ -47508,7 +47197,7 @@ function tokenizeNamedCharacterReference(effects, ok, nok) { } function inside(code) { - if (asciiAlpha(code)) { + if (asciiAlpha_1(code)) { effects.consume(code); return inside } @@ -47570,23 +47259,57 @@ function tokenizePunctuation(effects, ok, nok) { } } +function tokenizeDomainPunctuation(effects, ok, nok) { + return start + + function start(code) { + effects.enter('literalAutolinkPunctuation'); + // Always a valid trailing punctuation marker. + effects.consume(code); + return after + } + + function after(code) { + // Check the next. + if (trailingPunctuation(code)) { + effects.consume(code); + return after + } + + // If the punctuation marker is followed by the end of the path, itā€™s not + // continued punctuation. + effects.exit('literalAutolinkPunctuation'); + return pathEnd(code) ? ok(code) : nok(code) + } +} + function trailingPunctuation(code) { return ( - // Exclamation mark. + // `!` code === 33 || - // Asterisk. + // `"` + code === 34 || + // `'` + code === 39 || + // `)` + code === 41 || + // `*` code === 42 || - // Comma. + // `,` code === 44 || - // Dot. + // `.` code === 46 || - // Colon. + // `:` code === 58 || - // Question mark. + // `;` + code === 59 || + // `<` + code === 60 || + // `?` code === 63 || - // Underscore. + // `_`. code === 95 || - // Tilde. + // `~` code === 126 ) } @@ -47599,7 +47322,7 @@ function pathEnd(code) { code < 0 || // Space. code === 32 || - // Less than. + // `<` code === 60 ) } @@ -47614,7 +47337,7 @@ function gfmAtext(code) { code === 46 || // `_` code === 95 || - asciiAlphanumeric(code) + asciiAlphanumeric_1(code) ) } @@ -47626,19 +47349,19 @@ function previous$1(code) { code < 0 || // Space. code === 32 || - // Left paren. + // `(` code === 40 || - // Asterisk. + // `*` code === 42 || - // Underscore. + // `_`. code === 95 || - // Tilde. + // `~` code === 126 ) } var syntax = { - text: text_1$2 + text: text_1$3 }; var micromarkExtensionGfmAutolinkLiteral = syntax; @@ -48440,19 +48163,24 @@ function tokenizeTasklistCheck(effects, ok, nok) { effects.consume(code); effects.exit('taskListCheckMarker'); effects.exit('taskListCheck'); - return after + return effects.check({tokenize: spaceThenNonSpace}, ok, nok) } return nok(code) } +} - function after(code) { - // Tab or space. - if (code === -2 || code === 32) { - return ok(code) - } +function spaceThenNonSpace(effects, ok, nok) { + var self = this; - return nok(code) + return factorySpace(effects, after, 'whitespace') + + function after(code) { + return prefixSize_1(self.events, 'whitespace') && + code !== null && + !markdownLineEndingOrSpace_1(code) + ? ok(code) + : nok(code) } } @@ -48476,7 +48204,7 @@ var enter = { literalAutolinkHttp: enterLiteralAutolinkValue, literalAutolinkWww: enterLiteralAutolinkValue }; -var exit = { +var exit$1 = { literalAutolink: exitLiteralAutolink, literalAutolinkEmail: exitLiteralAutolinkEmail, literalAutolinkHttp: exitLiteralAutolinkHttp, @@ -48510,12 +48238,12 @@ function exitLiteralAutolink(token) { var fromMarkdown$1 = { enter: enter, - exit: exit + exit: exit$1 }; var canContainEols = ['delete']; var enter$1 = {strikethrough: enterStrikethrough}; -var exit$1 = {strikethrough: exitStrikethrough}; +var exit$2 = {strikethrough: exitStrikethrough}; function enterStrikethrough(token) { this.enter({type: 'delete', children: []}, token); @@ -48528,7 +48256,7 @@ function exitStrikethrough(token) { var fromMarkdown$2 = { canContainEols: canContainEols, enter: enter$1, - exit: exit$1 + exit: exit$2 }; var enter$2 = { @@ -48540,9 +48268,9 @@ var enter$2 = { var exit_1 = { codeText: exitCodeText, table: exitTable, - tableData: exit$2, - tableHeader: exit$2, - tableRow: exit$2 + tableData: exit$3, + tableHeader: exit$3, + tableRow: exit$3 }; function enterTable(token) { @@ -48559,7 +48287,7 @@ function enterRow(token) { this.enter({type: 'tableRow', children: []}, token); } -function exit$2(token) { +function exit$3(token) { this.exit(token); } @@ -48590,7 +48318,7 @@ var fromMarkdown$3 = { exit: exit_1 }; -var exit$3 = { +var exit$4 = { taskListCheckValueChecked: exitCheck, taskListCheckValueUnchecked: exitCheck, paragraph: exitParagraphWithTaskListItem @@ -48603,24 +48331,38 @@ function exitCheck(token) { } function exitParagraphWithTaskListItem(token) { - var node = this.stack[this.stack.length - 1]; var parent = this.stack[this.stack.length - 2]; + var node = this.stack[this.stack.length - 1]; + var siblings = parent.children; var head = node.children[0]; + var index = -1; + var firstParaghraph; if ( + parent && parent.type === 'listItem' && typeof parent.checked === 'boolean' && head && head.type === 'text' ) { - // Must start with a space or a tab. - head.value = head.value.slice(1); - if (head.value.length === 0) { - node.children.shift(); - } else { - head.position.start.column++; - head.position.start.offset++; - node.position.start = Object.assign({}, head.position.start); + while (++index < siblings.length) { + if (siblings[index].type === 'paragraph') { + firstParaghraph = siblings[index]; + break + } + } + + if (firstParaghraph === node) { + // Must start with a space or a tab. + head.value = head.value.slice(1); + + if (head.value.length === 0) { + node.children.shift(); + } else { + head.position.start.column++; + head.position.start.offset++; + node.position.start = Object.assign({}, head.position.start); + } } } @@ -48628,10 +48370,10 @@ function exitParagraphWithTaskListItem(token) { } var fromMarkdown$4 = { - exit: exit$3 + exit: exit$4 }; -var own$5 = {}.hasOwnProperty; +var own$6 = {}.hasOwnProperty; var fromMarkdown$5 = configure$4([ fromMarkdown$1, @@ -48658,7 +48400,7 @@ function extension$3(config, extension) { var right; for (key in extension) { - left = own$5.call(config, key) ? config[key] : (config[key] = {}); + left = own$6.call(config, key) ? config[key] : (config[key] = {}); right = extension[key]; if (key === 'canContainEols') { @@ -48670,7 +48412,7 @@ function extension$3(config, extension) { } var inConstruct = 'phrasing'; -var notInConstruct = ['autolink', 'link', 'image']; +var notInConstruct = ['autolink', 'link', 'image', 'label']; var unsafe$1 = [ { @@ -49069,7 +48811,7 @@ function toMarkdown$3(options) { var value = inlineCode_1(node); if (context.stack.indexOf('tableCell') !== -1) { - value = value.replace(/\|/, '\\$&'); + value = value.replace(/\|/g, '\\$&'); } return value @@ -49105,26 +48847,18 @@ var toMarkdown$4 = { var toMarkdown_1$1 = toMarkdown$5; function toMarkdown$5(options) { - var extensions = [ - toMarkdown$1, - toMarkdown$2, - toMarkdown_1(options), - toMarkdown$4 - ]; - var length = extensions.length; - var index = -1; - var extension; - var unsafe = []; - var handlers = {}; - - while (++index < length) { - extension = extensions[index]; - // istanbul ignore next - unsafe always exists, for now. - unsafe = unsafe.concat(extension.unsafe || []); - handlers = Object.assign(handlers, extension.handlers || {}); - } + var config = configure_1$2( + {handlers: {}, join: [], unsafe: [], options: {}}, + { + extensions: [toMarkdown$1, toMarkdown$2, toMarkdown_1(options), toMarkdown$4] + } + ); - return {unsafe: unsafe, handlers: handlers} + return Object.assign(config.options, { + handlers: config.handlers, + join: config.join, + unsafe: config.unsafe + }) } var warningIssued; @@ -49161,10 +48895,6 @@ function gfm(options) { } } -var proc = getCjsExportFromNamespace(_package$1); - -var cli = getCjsExportFromNamespace(_package$3); - // To aid in future maintenance, this layout closely matches remark-cli/cli.js. // https://github.com/remarkjs/remark/blob/master/packages/remark-cli/cli.js @@ -49189,6 +48919,12 @@ unifiedArgs({ packageField: proc.name + 'Config', rcName: '.' + proc.name + 'rc', ignoreName: '.' + proc.name + 'ignore', - extensions: markdownExtensions$2, + extensions: markdownExtensions, detectConfig: false, }); + +var cliEntry = { + +}; + +module.exports = cliEntry; diff --git a/tools/node-lint-md-cli-rollup/package-lock.json b/tools/node-lint-md-cli-rollup/package-lock.json index ed6381ae379b9b..7abb785af84d2c 100644 --- a/tools/node-lint-md-cli-rollup/package-lock.json +++ b/tools/node-lint-md-cli-rollup/package-lock.json @@ -10,30 +10,30 @@ "markdown-extensions": "^1.1.1", "remark": "^13.0.0", "remark-gfm": "^1.0.0", - "remark-lint": "^7.0.0", + "remark-lint": "^8.0.0", "remark-preset-lint-node": "^2.0.0", - "unified-args": "^8.0.0" + "unified-args": "^8.1.0" }, "devDependencies": { - "@rollup/plugin-commonjs": "^11.0.1", - "@rollup/plugin-json": "^4.0.1", - "@rollup/plugin-node-resolve": "^7.0.0", - "rollup": "^2.32.1", + "@rollup/plugin-commonjs": "^17.0.0", + "@rollup/plugin-json": "^4.1.0", + "@rollup/plugin-node-resolve": "^11.0.1", + "rollup": "^2.36.1", "shx": "^0.3.3" } }, "node_modules/@babel/code-frame": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.10.4.tgz", - "integrity": "sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg==", + "version": "7.12.11", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.12.11.tgz", + "integrity": "sha512-Zt1yodBx1UcyiePMSkWnU4hPqhwq7hGi2nFL1LeA3EUl+q2LQx16MISgJ0+z7dnmgvP9QtIleuETGOiOH1RcIw==", "dependencies": { "@babel/highlight": "^7.10.4" } }, "node_modules/@babel/helper-validator-identifier": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz", - "integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw==" + "version": "7.12.11", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.12.11.tgz", + "integrity": "sha512-np/lG3uARFybkoHokJUmf1QfEvRVCPbmQeUQpKow5cQ3xWrV9i3rUHodKDJPQfTVX61qKi+UdYk8kik84n7XOw==" }, "node_modules/@babel/highlight": { "version": "7.10.4", @@ -51,6 +51,9 @@ "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", "dependencies": { "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" } }, "node_modules/@babel/highlight/node_modules/chalk": { @@ -61,6 +64,9 @@ "ansi-styles": "^3.2.1", "escape-string-regexp": "^1.0.5", "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" } }, "node_modules/@babel/highlight/node_modules/color-convert": { @@ -79,12 +85,18 @@ "node_modules/@babel/highlight/node_modules/escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "engines": { + "node": ">=0.8.0" + } }, "node_modules/@babel/highlight/node_modules/has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=" + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "engines": { + "node": ">=4" + } }, "node_modules/@babel/highlight/node_modules/supports-color": { "version": "5.5.0", @@ -92,21 +104,30 @@ "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", "dependencies": { "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" } }, "node_modules/@rollup/plugin-commonjs": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-11.1.0.tgz", - "integrity": "sha512-Ycr12N3ZPN96Fw2STurD21jMqzKwL9QuFhms3SD7KKRK7oaXUsBU9Zt0jL/rOPHiPYisI21/rXGO3jr9BnLHUA==", + "version": "17.0.0", + "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-17.0.0.tgz", + "integrity": "sha512-/omBIJG1nHQc+bgkYDuLpb/V08QyutP9amOrJRUSlYJZP+b/68gM//D8sxJe3Yry2QnYIr3QjR3x4AlxJEN3GA==", "dev": true, "dependencies": { - "@rollup/pluginutils": "^3.0.8", + "@rollup/pluginutils": "^3.1.0", "commondir": "^1.0.1", - "estree-walker": "^1.0.1", - "glob": "^7.1.2", - "is-reference": "^1.1.2", - "magic-string": "^0.25.2", - "resolve": "^1.11.0" + "estree-walker": "^2.0.1", + "glob": "^7.1.6", + "is-reference": "^1.2.1", + "magic-string": "^0.25.7", + "resolve": "^1.17.0" + }, + "engines": { + "node": ">= 8.0.0" + }, + "peerDependencies": { + "rollup": "^2.30.0" } }, "node_modules/@rollup/plugin-json": { @@ -116,19 +137,29 @@ "dev": true, "dependencies": { "@rollup/pluginutils": "^3.0.8" + }, + "peerDependencies": { + "rollup": "^1.20.0 || ^2.0.0" } }, "node_modules/@rollup/plugin-node-resolve": { - "version": "7.1.3", - "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-7.1.3.tgz", - "integrity": "sha512-RxtSL3XmdTAE2byxekYLnx+98kEUOrPHF/KRVjLH+DEIHy6kjIw7YINQzn+NXiH/NTrQLAwYs0GWB+csWygA9Q==", + "version": "11.0.1", + "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-11.0.1.tgz", + "integrity": "sha512-ltlsj/4Bhwwhb+Nb5xCz/6vieuEj2/BAkkqVIKmZwC7pIdl8srmgmglE4S0jFlZa32K4qvdQ6NHdmpRKD/LwoQ==", "dev": true, "dependencies": { - "@rollup/pluginutils": "^3.0.8", - "@types/resolve": "0.0.8", + "@rollup/pluginutils": "^3.1.0", + "@types/resolve": "1.17.1", "builtin-modules": "^3.1.0", + "deepmerge": "^4.2.2", "is-module": "^1.0.0", - "resolve": "^1.14.2" + "resolve": "^1.19.0" + }, + "engines": { + "node": ">= 10.0.0" + }, + "peerDependencies": { + "rollup": "^1.20.0||^2.0.0" } }, "node_modules/@rollup/pluginutils": { @@ -140,8 +171,20 @@ "@types/estree": "0.0.39", "estree-walker": "^1.0.1", "picomatch": "^2.2.2" + }, + "engines": { + "node": ">= 8.0.0" + }, + "peerDependencies": { + "rollup": "^1.20.0||^2.0.0" } }, + "node_modules/@rollup/pluginutils/node_modules/estree-walker": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-1.0.1.tgz", + "integrity": "sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg==", + "dev": true + }, "node_modules/@types/estree": { "version": "0.0.39", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.39.tgz", @@ -157,15 +200,15 @@ } }, "node_modules/@types/node": { - "version": "14.11.8", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.11.8.tgz", - "integrity": "sha512-KPcKqKm5UKDkaYPTuXSx8wEP7vE9GnuaXIZKijwRYcePpZFDVuy2a57LarFKiORbHOuTOOwYzxVxcUzsh2P2Pw==", + "version": "14.14.20", + "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.20.tgz", + "integrity": "sha512-Y93R97Ouif9JEOWPIUyU+eyIdyRqQR0I8Ez1dzku4hDx34NWh4HbtIc3WNzwB1Y9ULvNGeu5B8h8bVL5cAk4/A==", "dev": true }, "node_modules/@types/resolve": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-0.0.8.tgz", - "integrity": "sha512-auApPaJf3NPfe18hSoJkp8EbZzer2ISk7o8mCC3M9he/a04+gbMF97NkpD2S8riMGvm4BMRI59/SZQSaLTKpsQ==", + "version": "1.17.1", + "resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-1.17.1.tgz", + "integrity": "sha512-yy7HuzQhj0dhGpD8RLXSZWEkLsV9ibvxvi6EiJ3bkqLAO1RGo0WbkWQiwpRlSFymTJRz0d3k5LM3kkx8ArDbLw==", "dev": true, "dependencies": { "@types/node": "*" @@ -179,7 +222,10 @@ "node_modules/ansi-regex": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", - "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==" + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "engines": { + "node": ">=8" + } }, "node_modules/ansi-styles": { "version": "4.3.0", @@ -187,6 +233,12 @@ "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dependencies": { "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, "node_modules/anymatch": { @@ -196,6 +248,9 @@ "dependencies": { "normalize-path": "^3.0.0", "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" } }, "node_modules/argparse": { @@ -223,7 +278,10 @@ "node_modules/binary-extensions": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.1.0.tgz", - "integrity": "sha512-1Yj8h9Q+QDF5FzhMs/c9+6UntbD5MkRfRwac8DoEm9ZfUBZ7tZ55YcGVAzEe4bXsdQHEk+s9S5wsOKVdZrw0tQ==" + "integrity": "sha512-1Yj8h9Q+QDF5FzhMs/c9+6UntbD5MkRfRwac8DoEm9ZfUBZ7tZ55YcGVAzEe4bXsdQHEk+s9S5wsOKVdZrw0tQ==", + "engines": { + "node": ">=8" + } }, "node_modules/brace-expansion": { "version": "1.1.11", @@ -240,6 +298,9 @@ "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", "dependencies": { "fill-range": "^7.0.1" + }, + "engines": { + "node": ">=8" } }, "node_modules/buffer-from": { @@ -248,15 +309,24 @@ "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==" }, "node_modules/builtin-modules": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.1.0.tgz", - "integrity": "sha512-k0KL0aWZuBt2lrxrcASWDfwOLMnodeQjodT/1SxEQAXsHANgo6ZC/VEaSEHCXt7aSTZ4/4H5LKa+tBXmW7Vtvw==", - "dev": true + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.2.0.tgz", + "integrity": "sha512-lGzLKcioL90C7wMczpkY0n/oART3MbBa8R9OFGE1rJxoVI86u4WAGfEk8Wjv10eKSyTHVGkSo3bvBylCEtk7LA==", + "dev": true, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } }, "node_modules/camelcase": { "version": "5.3.1", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", - "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==" + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "engines": { + "node": ">=6" + } }, "node_modules/chalk": { "version": "3.0.0", @@ -265,6 +335,9 @@ "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=8" } }, "node_modules/character-entities": { @@ -295,21 +368,37 @@ } }, "node_modules/chokidar": { - "version": "3.4.3", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.4.3.tgz", - "integrity": "sha512-DtM3g7juCXQxFVSNPNByEC2+NImtBuxQQvWlHunpJIS5Ocr0lG306cC7FCi7cEA0fzmybPUIl4txBIobk1gGOQ==", + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.0.tgz", + "integrity": "sha512-JgQM9JS92ZbFR4P90EvmzNpSGhpPBGBSj10PILeDyYFwp4h2/D9OM03wsJ4zW1fEp4ka2DGrnUeD7FuvQ2aZ2Q==", "dependencies": { "anymatch": "~3.1.1", "braces": "~3.0.2", - "fsevents": "~2.1.2", + "fsevents": "~2.3.1", "glob-parent": "~5.1.0", "is-binary-path": "~2.1.0", "is-glob": "~4.0.1", "normalize-path": "~3.0.0", "readdirp": "~3.5.0" }, + "engines": { + "node": ">= 8.10.0" + }, "optionalDependencies": { - "fsevents": "~2.1.2" + "fsevents": "~2.3.1" + } + }, + "node_modules/chokidar/node_modules/fsevents": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.1.tgz", + "integrity": "sha512-YR47Eg4hChJGAB1O3yEAOkGO+rlzutoICGqGo9EZ4lKWokzZRSyIW1QmTzqjtw8MJdj9srP869CuWw/hyzSiBw==", + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" } }, "node_modules/co": { @@ -332,6 +421,9 @@ "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "dependencies": { "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" } }, "node_modules/color-name": { @@ -354,6 +446,9 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-2.0.0.tgz", "integrity": "sha512-MWufYdFw53ccGjCA+Ol7XJYpAlW6/prSMzuPOTRnJGcGzuhLn4Scrz7qf6o8bROZ514ltazcIFJZevcfbo0x7A==", + "engines": [ + "node >= 6.0" + ], "dependencies": { "buffer-from": "^1.0.0", "inherits": "^2.0.3", @@ -362,11 +457,28 @@ } }, "node_modules/debug": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.2.0.tgz", - "integrity": "sha512-IX2ncY78vDTjZMFUdmsvIRFY2Cf4FnD0wRs+nQwJU8Lu99/tPFdb0VybiiMTPe3I6rQmwsqQqRBvxU+bZ/I8sg==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", "dependencies": { "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/deepmerge": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.2.2.tgz", + "integrity": "sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg==", + "dev": true, + "engines": { + "node": ">=0.10.0" } }, "node_modules/emoji-regex": { @@ -396,12 +508,19 @@ "node_modules/esprima": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==" + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" + }, + "engines": { + "node": ">=4" + } }, "node_modules/estree-walker": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-1.0.1.tgz", - "integrity": "sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", + "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", "dev": true }, "node_modules/extend": { @@ -415,6 +534,10 @@ "integrity": "sha512-CJ0HCB5tL5fYTEA7ToAq5+kTwd++Borf1/bifxd9iT70QcXr4MRrO3Llf8Ifs70q+SJcGHFtnIE/Nw6giCtECA==", "dependencies": { "format": "^0.2.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" } }, "node_modules/figgy-pudding": { @@ -428,12 +551,21 @@ "integrity": "sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==", "dependencies": { "escape-string-regexp": "^1.0.5" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/figures/node_modules/escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "engines": { + "node": ">=0.8.0" + } }, "node_modules/fill-range": { "version": "7.0.1", @@ -441,6 +573,9 @@ "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", "dependencies": { "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" } }, "node_modules/find-up": { @@ -449,12 +584,18 @@ "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", "dependencies": { "locate-path": "^3.0.0" + }, + "engines": { + "node": ">=6" } }, "node_modules/format": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/format/-/format-0.2.2.tgz", - "integrity": "sha1-1hcBB+nv3E7TDJ3DkBbflCtctYs=" + "integrity": "sha1-1hcBB+nv3E7TDJ3DkBbflCtctYs=", + "engines": { + "node": ">=0.4.x" + } }, "node_modules/fs.realpath": { "version": "1.0.0", @@ -465,7 +606,22 @@ "version": "2.1.3", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.3.tgz", "integrity": "sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ==", - "optional": true + "deprecated": "\"Please update to latest v2.3 or v2.2\"", + "dev": true, + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true }, "node_modules/glob": { "version": "7.1.6", @@ -478,6 +634,12 @@ "minimatch": "^3.0.4", "once": "^1.3.0", "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, "node_modules/glob-parent": { @@ -486,17 +648,38 @@ "integrity": "sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ==", "dependencies": { "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.1" + }, + "engines": { + "node": ">= 0.4.0" } }, "node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==" + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "engines": { + "node": ">=8" + } }, "node_modules/ignore": { "version": "5.1.8", "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.8.tgz", - "integrity": "sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw==" + "integrity": "sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw==", + "engines": { + "node": ">= 4" + } }, "node_modules/inflight": { "version": "1.0.6", @@ -513,9 +696,9 @@ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, "node_modules/ini": { - "version": "1.3.7", - "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.7.tgz", - "integrity": "sha512-iKpRpXP+CrP2jyrxvg1kMUpXDyRUFDWurxbnVT1vQPx+Wz9uCYsMIqYuSBLV+PAaZG/d7kRLKRFc9oDMsH+mFQ==" + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==" }, "node_modules/interpret": { "version": "1.4.0", @@ -559,12 +742,44 @@ "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", "dependencies": { "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" } }, "node_modules/is-buffer": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.4.tgz", - "integrity": "sha512-Kq1rokWXOPXWuaMAqZiJW4XxsmD9zGx9q4aePabbn3qCRGedtH7Cm+zV8WETitMfu1wdh+Rvd6w5egwSngUX2A==" + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.5.tgz", + "integrity": "sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "engines": { + "node": ">=4" + } + }, + "node_modules/is-core-module": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.2.0.tgz", + "integrity": "sha512-XRAfAdyyY5F5cOXn7hYQDqh2Xmii+DEfIcQGxK/uNwMHhIkPWO0g8msXcbzLe+MpGoR951MlqM/2iIlU4vKDdQ==", + "dev": true, + "dependencies": { + "has": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, "node_modules/is-decimal": { "version": "1.0.4", @@ -583,12 +798,18 @@ "node_modules/is-extglob": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=" + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "engines": { + "node": ">=0.10.0" + } }, "node_modules/is-fullwidth-code-point": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==" + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "engines": { + "node": ">=8" + } }, "node_modules/is-glob": { "version": "4.0.1", @@ -596,6 +817,9 @@ "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", "dependencies": { "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" } }, "node_modules/is-hexadecimal": { @@ -616,12 +840,18 @@ "node_modules/is-number": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==" + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "engines": { + "node": ">=0.12.0" + } }, "node_modules/is-plain-obj": { "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==" + "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", + "engines": { + "node": ">=8" + } }, "node_modules/is-reference": { "version": "1.2.1", @@ -638,12 +868,15 @@ "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" }, "node_modules/js-yaml": { - "version": "3.14.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.0.tgz", - "integrity": "sha512-/4IbIeHcD9VMHFqDR/gQ7EdZdLimOvW2DdcxFjdyyZ9NsbS+ccrXqVWDtab/lRl5AlUqmpBx8EhPaWR+OtY17A==", + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", "dependencies": { "argparse": "^1.0.7", "esprima": "^4.0.0" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" } }, "node_modules/json-parse-even-better-errors": { @@ -657,6 +890,12 @@ "integrity": "sha512-KXPvOm8K9IJKFM0bmdn8QXh7udDh1g/giieX0NLCaMnb4hEiVFqnop2ImTXCc5e0/oHz3LTqmHGtExn5hfMkOA==", "dependencies": { "minimist": "^1.2.5" + }, + "bin": { + "json5": "lib/cli.js" + }, + "engines": { + "node": ">=6" } }, "node_modules/libnpmconfig": { @@ -681,6 +920,10 @@ "dependencies": { "libnpmconfig": "^1.0.0", "resolve-from": "^5.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" } }, "node_modules/locate-path": { @@ -690,6 +933,9 @@ "dependencies": { "p-locate": "^3.0.0", "path-exists": "^3.0.0" + }, + "engines": { + "node": ">=6" } }, "node_modules/longest-streak": { @@ -701,6 +947,17 @@ "url": "https://github.com/sponsors/wooorm" } }, + "node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/magic-string": { "version": "0.25.7", "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.7.tgz", @@ -713,7 +970,10 @@ "node_modules/markdown-extensions": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/markdown-extensions/-/markdown-extensions-1.1.1.tgz", - "integrity": "sha512-WWC0ZuMzCyDHYCasEGs4IPvLyTGftYwh6wIEOULOF0HXcqZlhwRzrK0w2VUlxWA98xnvb/jszw4ZSkJ6ADpM6Q==" + "integrity": "sha512-WWC0ZuMzCyDHYCasEGs4IPvLyTGftYwh6wIEOULOF0HXcqZlhwRzrK0w2VUlxWA98xnvb/jszw4ZSkJ6ADpM6Q==", + "engines": { + "node": ">=0.10.0" + } }, "node_modules/markdown-table": { "version": "2.0.0", @@ -730,17 +990,22 @@ "node_modules/mdast-comment-marker": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/mdast-comment-marker/-/mdast-comment-marker-1.1.2.tgz", - "integrity": "sha512-vTFXtmbbF3rgnTh3Zl3irso4LtvwUq/jaDvT2D1JqTGAwaipcS7RpTxzi6KjoRqI9n2yuAhzLDAC8xVTF3XYVQ==" + "integrity": "sha512-vTFXtmbbF3rgnTh3Zl3irso4LtvwUq/jaDvT2D1JqTGAwaipcS7RpTxzi6KjoRqI9n2yuAhzLDAC8xVTF3XYVQ==", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } }, "node_modules/mdast-util-from-markdown": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/mdast-util-from-markdown/-/mdast-util-from-markdown-0.8.1.tgz", - "integrity": "sha512-qJXNcFcuCSPqUF0Tb0uYcFDIq67qwB3sxo9RPdf9vG8T90ViKnksFqdB/Coq2a7sTnxL/Ify2y7aIQXDkQFH0w==", + "version": "0.8.4", + "resolved": "https://registry.npmjs.org/mdast-util-from-markdown/-/mdast-util-from-markdown-0.8.4.tgz", + "integrity": "sha512-jj891B5pV2r63n2kBTFh8cRI2uR9LQHsXG1zSDqfhXkIlDzrTcIlbB5+5aaYEkl8vOPIOPLf8VT7Ere1wWTMdw==", "dependencies": { "@types/mdast": "^3.0.0", - "mdast-util-to-string": "^1.0.0", - "micromark": "~2.10.0", - "parse-entities": "^2.0.0" + "mdast-util-to-string": "^2.0.0", + "micromark": "~2.11.0", + "parse-entities": "^2.0.0", + "unist-util-stringify-position": "^2.0.0" }, "funding": { "type": "opencollective", @@ -748,14 +1013,15 @@ } }, "node_modules/mdast-util-gfm": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/mdast-util-gfm/-/mdast-util-gfm-0.1.0.tgz", - "integrity": "sha512-HLfygQL6HdhJhFbLta4Ki9hClrzyAxRjyRvpm5caN65QZL+NyHPmqFlnF9vm1Rn58JT2+AbLwNcEDY4MEvkk8Q==", + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/mdast-util-gfm/-/mdast-util-gfm-0.1.1.tgz", + "integrity": "sha512-oE1W1zSXU2L2LHg91V22HC3Z1fbsOZTBYUQq+kpM29f9297TbRm0C1l3bQ88RREl0WaUQaB49G7trvwy5utUKQ==", "dependencies": { "mdast-util-gfm-autolink-literal": "^0.1.0", "mdast-util-gfm-strikethrough": "^0.2.0", "mdast-util-gfm-table": "^0.1.0", - "mdast-util-gfm-task-list-item": "^0.1.0" + "mdast-util-gfm-task-list-item": "^0.1.0", + "mdast-util-to-markdown": "^0.6.1" }, "funding": { "type": "opencollective", @@ -763,20 +1029,20 @@ } }, "node_modules/mdast-util-gfm-autolink-literal": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/mdast-util-gfm-autolink-literal/-/mdast-util-gfm-autolink-literal-0.1.1.tgz", - "integrity": "sha512-gJ2xSpqKCetSr22GEWpZH3f5ffb4pPn/72m4piY0v7T/S+O7n7rw+sfoPLhb2b4O7WdnERoYdALRcmD68FMtlw==", + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-autolink-literal/-/mdast-util-gfm-autolink-literal-0.1.2.tgz", + "integrity": "sha512-WFeIrcNNsfBety0gyWuiBIPing9UkVcl/m2iZOyW1uHEH2evjFocet2h77M24ub0WyZ4ucnQn/jWhO5Ozl6j4g==", "funding": { "type": "opencollective", "url": "https://opencollective.com/unified" } }, "node_modules/mdast-util-gfm-strikethrough": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/mdast-util-gfm-strikethrough/-/mdast-util-gfm-strikethrough-0.2.2.tgz", - "integrity": "sha512-T37ZbaokJcRbHROXmoVAieWnesPD5N21tv2ifYzaGRLbkh1gknItUGhZzHefUn5Zc/eaO/iTDSAFOBrn/E8kWw==", + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-strikethrough/-/mdast-util-gfm-strikethrough-0.2.3.tgz", + "integrity": "sha512-5OQLXpt6qdbttcDG/UxYY7Yjj3e8P7X16LzvpX8pIQPYJ/C2Z1qFGMmcw+1PZMUM3Z8wt8NRfYTvCni93mgsgA==", "dependencies": { - "mdast-util-to-markdown": "^0.5.0" + "mdast-util-to-markdown": "^0.6.0" }, "funding": { "type": "opencollective", @@ -784,12 +1050,12 @@ } }, "node_modules/mdast-util-gfm-table": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/mdast-util-gfm-table/-/mdast-util-gfm-table-0.1.4.tgz", - "integrity": "sha512-T4xFSON9kUb/IpYA5N+KGWcsdGczAvILvKiXQwUGind6V9fvjPCR9yhZnIeaLdBWXaz3m/Gq77ZtuLMjtFR4IQ==", + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-table/-/mdast-util-gfm-table-0.1.6.tgz", + "integrity": "sha512-j4yDxQ66AJSBwGkbpFEp9uG/LS1tZV3P33fN1gkyRB2LoRL+RR3f76m0HPHaby6F4Z5xr9Fv1URmATlRRUIpRQ==", "dependencies": { "markdown-table": "^2.0.0", - "mdast-util-to-markdown": "^0.5.0" + "mdast-util-to-markdown": "~0.6.0" }, "funding": { "type": "opencollective", @@ -797,11 +1063,11 @@ } }, "node_modules/mdast-util-gfm-task-list-item": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/mdast-util-gfm-task-list-item/-/mdast-util-gfm-task-list-item-0.1.4.tgz", - "integrity": "sha512-AMiHyBHvaYN2p3ztFv7gDgTF7keZDaA9plTixRXWT0aqL0QdN43QaG5+hzcRNbjCsEWBxWhpcNk1Diq0TiIEvw==", + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-task-list-item/-/mdast-util-gfm-task-list-item-0.1.6.tgz", + "integrity": "sha512-/d51FFIfPsSmCIRNp7E6pozM9z1GYPIkSy1urQ8s/o4TC22BZ7DqfHFWiqBD23bc7J3vV1Fc9O4QIHBlfuit8A==", "dependencies": { - "mdast-util-to-markdown": "^0.5.0" + "mdast-util-to-markdown": "~0.6.0" }, "funding": { "type": "opencollective", @@ -818,13 +1084,13 @@ } }, "node_modules/mdast-util-to-markdown": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/mdast-util-to-markdown/-/mdast-util-to-markdown-0.5.3.tgz", - "integrity": "sha512-sr8q7fQJ1xoCqZSXW6dO/MYu2Md+a4Hfk9uO+XHCfiBhVM0EgWtfAV7BuN+ff6otUeu2xDyt1o7vhZGwOG3+BA==", + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/mdast-util-to-markdown/-/mdast-util-to-markdown-0.6.2.tgz", + "integrity": "sha512-iRczns6WMvu0hUw02LXsPDJshBIwtUPbvHBWo19IQeU0YqmzlA8Pd30U8V7uiI0VPkxzS7A/NXBXH6u+HS87Zg==", "dependencies": { "@types/unist": "^2.0.0", "longest-streak": "^2.0.0", - "mdast-util-to-string": "^1.0.0", + "mdast-util-to-string": "^2.0.0", "parse-entities": "^2.0.0", "repeat-string": "^1.0.0", "zwitch": "^1.0.0" @@ -835,14 +1101,18 @@ } }, "node_modules/mdast-util-to-string": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/mdast-util-to-string/-/mdast-util-to-string-1.1.0.tgz", - "integrity": "sha512-jVU0Nr2B9X3MU4tSK7JP1CMkSvOj7X5l/GboG1tKRw52lLF1x2Ju92Ms9tNetCcbfX3hzlM73zYo2NKkWSfF/A==" + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mdast-util-to-string/-/mdast-util-to-string-2.0.0.tgz", + "integrity": "sha512-AW4DRS3QbBayY/jJmD8437V1Gombjf8RSOUCMFBuo5iHi58AGEgVCKQ+ezHkZZDpAQS75hcBMpLqjpJTjtUL7w==", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } }, "node_modules/micromark": { - "version": "2.10.1", - "resolved": "https://registry.npmjs.org/micromark/-/micromark-2.10.1.tgz", - "integrity": "sha512-fUuVF8sC1X7wsCS29SYQ2ZfIZYbTymp0EYr6sab3idFjigFFjGa5UwoniPlV9tAgntjuapW1t9U+S0yDYeGKHQ==", + "version": "2.11.2", + "resolved": "https://registry.npmjs.org/micromark/-/micromark-2.11.2.tgz", + "integrity": "sha512-IXuP76p2uj8uMg4FQc1cRE7lPCLsfAXuEfdjtdO55VRiFO1asrCSQ5g43NmPqFtRwzEnEhafRVzn2jg0UiKArQ==", "funding": [ { "type": "GitHub Sponsors", @@ -859,11 +1129,11 @@ } }, "node_modules/micromark-extension-gfm": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/micromark-extension-gfm/-/micromark-extension-gfm-0.3.1.tgz", - "integrity": "sha512-lJlhcOqzoJdjQg+LMumVHdUQ61LjtqGdmZtrAdfvatRUnJTqZlRwXXHdLQgNDYlFw4mycZ4NSTKlya5QcQXl1A==", + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm/-/micromark-extension-gfm-0.3.2.tgz", + "integrity": "sha512-ToQEpLkRgg7Tp8D3GM/SjZFPV0cCwWNxZmoEVIOQivOswRtPg7gg2WlCrtHhUWFNX+DgDjbq0iLOPGp4Y15oug==", "dependencies": { - "micromark": "~2.10.0", + "micromark": "~2.11.0", "micromark-extension-gfm-autolink-literal": "~0.5.0", "micromark-extension-gfm-strikethrough": "~0.6.0", "micromark-extension-gfm-table": "~0.4.0", @@ -876,11 +1146,11 @@ } }, "node_modules/micromark-extension-gfm-autolink-literal": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/micromark-extension-gfm-autolink-literal/-/micromark-extension-gfm-autolink-literal-0.5.1.tgz", - "integrity": "sha512-j30923tDp0faCNDjwqe4cMi+slegbGfc3VEAExEU8d54Q/F6pR6YxCVH+6xV0ItRoj3lCn1XkUWcy6FC3S9BOw==", + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-autolink-literal/-/micromark-extension-gfm-autolink-literal-0.5.4.tgz", + "integrity": "sha512-471VKd4k3SiX7vx9fC+IYeGQL0RnxwBBXeEc5WConb7naJDG5m16guA+VoFzyXchrvmU08t0dUWWPZ0mkJSXVw==", "dependencies": { - "micromark": "~2.10.0" + "micromark": "~2.11.0" }, "funding": { "type": "opencollective", @@ -888,11 +1158,11 @@ } }, "node_modules/micromark-extension-gfm-strikethrough": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/micromark-extension-gfm-strikethrough/-/micromark-extension-gfm-strikethrough-0.6.2.tgz", - "integrity": "sha512-aehEEqtTn3JekJNwZZxa7ZJVfzmuaWp4ew6x6sl3VAKIwdDZdqYeYSQIrNKwNgH7hX0g56fAwnSDLusJggjlCQ==", + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-strikethrough/-/micromark-extension-gfm-strikethrough-0.6.3.tgz", + "integrity": "sha512-MKMoP9x2dsr1aeX46ibBwVf4Q6nJsi5aaUFTOMOID5VOLSxwl4CrqUV4OGFQd6AqhtzBJAxaV+N2trlTBtZDNQ==", "dependencies": { - "micromark": "~2.10.0" + "micromark": "~2.11.0" }, "funding": { "type": "opencollective", @@ -900,11 +1170,11 @@ } }, "node_modules/micromark-extension-gfm-table": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/micromark-extension-gfm-table/-/micromark-extension-gfm-table-0.4.1.tgz", - "integrity": "sha512-xVpqOnfFaa2OtC/Y7rlt4tdVFlUHdoLH3RXAZgb/KP3DDyKsAOx6BRS3UxiiyvmD/p2l6VUpD4bMIniuP4o4JA==", + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-table/-/micromark-extension-gfm-table-0.4.2.tgz", + "integrity": "sha512-AAzmj85XO1ydHYX0Lz52HGhcH2sZLm2AVvkwzELXWgZF6vGdq5yZ3CTByFRsqNUPyQBSIYFKLDAtc6KlnO42aw==", "dependencies": { - "micromark": "~2.10.0" + "micromark": "~2.11.0" }, "funding": { "type": "opencollective", @@ -921,9 +1191,12 @@ } }, "node_modules/micromark-extension-gfm-task-list-item": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/micromark-extension-gfm-task-list-item/-/micromark-extension-gfm-task-list-item-0.3.1.tgz", - "integrity": "sha512-3ZiolwyLEF+t2KvGqKdBNEybiacQCsBgDx4PRZz/dttwo0PkcVKh7jpxc6UdHQuNMJ/YRUNuCSal0WuoAlefAA==", + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-task-list-item/-/micromark-extension-gfm-task-list-item-0.3.3.tgz", + "integrity": "sha512-0zvM5iSLKrc/NQl84pZSjGo66aTGd57C1idmlWmE87lkMcXrTxg1uXa/nXomxJytoje9trP0NDLvw4bZ/Z/XCQ==", + "dependencies": { + "micromark": "~2.11.0" + }, "funding": { "type": "opencollective", "url": "https://opencollective.com/unified" @@ -935,6 +1208,9 @@ "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "dependencies": { "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" } }, "node_modules/minimist": { @@ -950,7 +1226,10 @@ "node_modules/normalize-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==" + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "engines": { + "node": ">=0.10.0" + } }, "node_modules/once": { "version": "1.4.0", @@ -966,6 +1245,12 @@ "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", "dependencies": { "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/p-locate": { @@ -974,12 +1259,18 @@ "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", "dependencies": { "p-limit": "^2.0.0" + }, + "engines": { + "node": ">=6" } }, "node_modules/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==" + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "engines": { + "node": ">=6" + } }, "node_modules/parse-entities": { "version": "2.0.0", @@ -1007,17 +1298,29 @@ "error-ex": "^1.3.1", "json-parse-even-better-errors": "^2.3.0", "lines-and-columns": "^1.1.6" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/path-exists": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=" + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "engines": { + "node": ">=4" + } }, "node_modules/path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "engines": { + "node": ">=0.10.0" + } }, "node_modules/path-parse": { "version": "1.0.6", @@ -1028,7 +1331,13 @@ "node_modules/picomatch": { "version": "2.2.2", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz", - "integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==" + "integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } }, "node_modules/pluralize": { "version": "8.0.0", @@ -1046,6 +1355,9 @@ "inherits": "^2.0.3", "string_decoder": "^1.1.1", "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" } }, "node_modules/readdirp": { @@ -1054,6 +1366,9 @@ "integrity": "sha512-cMhu7c/8rdhkHXWsY+osBhfSy0JikwpHK/5+imo+LpeasTF8ouErHrlYkwT0++njiyuDvc7OFY5T3ukvZ8qmFQ==", "dependencies": { "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" } }, "node_modules/rechoir": { @@ -1096,11 +1411,15 @@ } }, "node_modules/remark-lint": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/remark-lint/-/remark-lint-7.0.1.tgz", - "integrity": "sha512-caZXo3qhuBxzvq9JSJFVQ/ERDq/6TJVgWn0KDwKOIJCGOuLXfQhby5XttUq+Rn7kLbNMtvwfWHJlte14LpaeXQ==", + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/remark-lint/-/remark-lint-8.0.0.tgz", + "integrity": "sha512-ESI8qJQ/TIRjABDnqoFsTiZntu+FRifZ5fJ77yX63eIDijl/arvmDvT+tAf75/Nm5BFL4R2JFUtkHRGVjzYUsg==", "dependencies": { "remark-message-control": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" } }, "node_modules/remark-lint-blockquote-indentation": { @@ -1120,6 +1439,15 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/remark-lint-blockquote-indentation/node_modules/mdast-util-to-string": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/mdast-util-to-string/-/mdast-util-to-string-1.1.0.tgz", + "integrity": "sha512-jVU0Nr2B9X3MU4tSK7JP1CMkSvOj7X5l/GboG1tKRw52lLF1x2Ju92Ms9tNetCcbfX3hzlM73zYo2NKkWSfF/A==", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/remark-lint-checkbox-character-style": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/remark-lint-checkbox-character-style/-/remark-lint-checkbox-character-style-3.0.0.tgz", @@ -1356,6 +1684,15 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/remark-lint-no-auto-link-without-protocol/node_modules/mdast-util-to-string": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/mdast-util-to-string/-/mdast-util-to-string-1.1.0.tgz", + "integrity": "sha512-jVU0Nr2B9X3MU4tSK7JP1CMkSvOj7X5l/GboG1tKRw52lLF1x2Ju92Ms9tNetCcbfX3hzlM73zYo2NKkWSfF/A==", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/remark-lint-no-blockquote-without-marker": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/remark-lint-no-blockquote-without-marker/-/remark-lint-no-blockquote-without-marker-4.0.0.tgz", @@ -1488,6 +1825,15 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/remark-lint-no-inline-padding/node_modules/mdast-util-to-string": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/mdast-util-to-string/-/mdast-util-to-string-1.1.0.tgz", + "integrity": "sha512-jVU0Nr2B9X3MU4tSK7JP1CMkSvOj7X5l/GboG1tKRw52lLF1x2Ju92Ms9tNetCcbfX3hzlM73zYo2NKkWSfF/A==", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/remark-lint-no-literal-urls": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/remark-lint-no-literal-urls/-/remark-lint-no-literal-urls-2.0.1.tgz", @@ -1504,6 +1850,15 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/remark-lint-no-literal-urls/node_modules/mdast-util-to-string": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/mdast-util-to-string/-/mdast-util-to-string-1.1.0.tgz", + "integrity": "sha512-jVU0Nr2B9X3MU4tSK7JP1CMkSvOj7X5l/GboG1tKRw52lLF1x2Ju92Ms9tNetCcbfX3hzlM73zYo2NKkWSfF/A==", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/remark-lint-no-multiple-toplevel-headings": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/remark-lint-no-multiple-toplevel-headings/-/remark-lint-no-multiple-toplevel-headings-2.0.1.tgz", @@ -1738,6 +2093,10 @@ "dependencies": { "mdast-comment-marker": "^1.0.0", "unified-message-control": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" } }, "node_modules/remark-parse": { @@ -1756,7 +2115,6 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/remark-preset-lint-node/-/remark-preset-lint-node-2.0.0.tgz", "integrity": "sha512-gjJlRK+ed3rW/k+YFENGyDDfzMS2iUyuo+MQR3pQWUl7L6Yawg6OYGKjO9eVBN/1jaourq0N515O1nXq64Qm1Q==", - "license": "MIT", "dependencies": { "js-yaml": "^3.14.0", "remark-lint": "^8.0.0", @@ -1793,18 +2151,6 @@ "semver": "^7.3.2" } }, - "node_modules/remark-preset-lint-node/node_modules/remark-lint": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/remark-lint/-/remark-lint-8.0.0.tgz", - "integrity": "sha512-ESI8qJQ/TIRjABDnqoFsTiZntu+FRifZ5fJ77yX63eIDijl/arvmDvT+tAf75/Nm5BFL4R2JFUtkHRGVjzYUsg==", - "dependencies": { - "remark-message-control": "^6.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, "node_modules/remark-preset-lint-recommended": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/remark-preset-lint-recommended/-/remark-preset-lint-recommended-5.0.0.tgz", @@ -1832,24 +2178,12 @@ "url": "https://opencollective.com/unified" } }, - "node_modules/remark-preset-lint-recommended/node_modules/remark-lint": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/remark-lint/-/remark-lint-8.0.0.tgz", - "integrity": "sha512-ESI8qJQ/TIRjABDnqoFsTiZntu+FRifZ5fJ77yX63eIDijl/arvmDvT+tAf75/Nm5BFL4R2JFUtkHRGVjzYUsg==", - "dependencies": { - "remark-message-control": "^6.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, "node_modules/remark-stringify": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/remark-stringify/-/remark-stringify-9.0.0.tgz", - "integrity": "sha512-8x29DpTbVzEc6Dwb90qhxCtbZ6hmj3BxWWDpMhA+1WM4dOEGH5U5/GFe3Be5Hns5MvPSFAr1e2KSVtKZkK5nUw==", + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/remark-stringify/-/remark-stringify-9.0.1.tgz", + "integrity": "sha512-mWmNg3ZtESvZS8fv5PTvaPckdL4iNlCHTt8/e/8oN08nArHRHjNZMKzA/YW3+p7/lYqIw4nx1XsjCBo/AxNChg==", "dependencies": { - "mdast-util-to-markdown": "^0.5.0" + "mdast-util-to-markdown": "^0.6.0" }, "funding": { "type": "opencollective", @@ -1859,31 +2193,36 @@ "node_modules/repeat-string": { "version": "1.6.1", "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", - "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=" - }, - "node_modules/replace-ext": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/replace-ext/-/replace-ext-1.0.0.tgz", - "integrity": "sha1-3mMSg3P8v3w8z6TeWkgMRaZ5WOs=" + "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", + "engines": { + "node": ">=0.10" + } }, "node_modules/resolve": { - "version": "1.17.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz", - "integrity": "sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==", + "version": "1.19.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.19.0.tgz", + "integrity": "sha512-rArEXAgsBG4UgRGcynxWIWKFvh/XZCcS8UJdHhwy91zwAvCZIbcs+vAbflgBnNjYMs/i/i+/Ux6IZhML1yPvxg==", "dev": true, "dependencies": { + "is-core-module": "^2.1.0", "path-parse": "^1.0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/resolve-from": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", - "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==" + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "engines": { + "node": ">=8" + } }, "node_modules/rollup": { - "version": "2.32.1", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.32.1.tgz", - "integrity": "sha512-Op2vWTpvK7t6/Qnm1TTh7VjEZZkN8RWgf0DHbkKzQBwNf748YhXbozHVefqpPp/Fuyk/PQPAnYsBxAEtlMvpUw==", + "version": "2.36.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.36.1.tgz", + "integrity": "sha512-eAfqho8dyzuVvrGqpR0ITgEdq0zG2QJeWYh+HeuTbpcaXk8vNFc48B7bJa1xYosTCKx0CuW+447oQOW8HgBIZQ==", "dev": true, "dependencies": { "fsevents": "~2.1.2" @@ -1901,12 +2240,29 @@ "node_modules/safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] }, "node_modules/semver": { - "version": "7.3.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz", - "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==", + "version": "7.3.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.4.tgz", + "integrity": "sha512-tCfb2WLjqFAtXn4KEdxIhalnRtoKFN7nAwj0B3ZXCbQloV2tq5eDbcTmT68JJD3nRJq24/XgxtQKFIpQdtvmVw==", + "dependencies": { + "lru-cache": "^6.0.0" + }, "bin": { "semver": "bin/semver.js" }, @@ -1979,6 +2335,9 @@ "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=8" } }, "node_modules/strip-ansi": { @@ -1987,6 +2346,9 @@ "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", "dependencies": { "ansi-regex": "^5.0.0" + }, + "engines": { + "node": ">=8" } }, "node_modules/supports-color": { @@ -1995,6 +2357,9 @@ "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "dependencies": { "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" } }, "node_modules/text-table": { @@ -2008,6 +2373,9 @@ "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", "dependencies": { "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" } }, "node_modules/to-vfile": { @@ -2017,12 +2385,20 @@ "dependencies": { "is-buffer": "^2.0.0", "vfile": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" } }, "node_modules/trough": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/trough/-/trough-1.0.5.tgz", - "integrity": "sha512-rvuRbTarPXmMb79SmzEp8aqXNKcK+y0XaB298IXueQ8I2PsrATcPBCSPyK/dDNa2iWOhKlfNnOjdAOTBU/nkFA==" + "integrity": "sha512-rvuRbTarPXmMb79SmzEp8aqXNKcK+y0XaB298IXueQ8I2PsrATcPBCSPyK/dDNa2iWOhKlfNnOjdAOTBU/nkFA==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } }, "node_modules/typedarray": { "version": "0.0.6", @@ -2059,6 +2435,10 @@ "minimist": "^1.2.0", "text-table": "^0.2.0", "unified-engine": "^8.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" } }, "node_modules/unified-engine": { @@ -2083,6 +2463,10 @@ "unist-util-inspect": "^5.0.0", "vfile-reporter": "^6.0.0", "vfile-statistics": "^1.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" } }, "node_modules/unified-lint-rule": { @@ -2098,12 +2482,16 @@ } }, "node_modules/unified-message-control": { - "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==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/unified-message-control/-/unified-message-control-3.0.2.tgz", + "integrity": "sha512-lhF8fKjDo2cIPx1re5X1QinqUonl+AN6F0XfEaab8w/hjqX7FZAhzu4P8g6pmYp09ld+HSWFwdRJj+Y8xD0q7Q==", "dependencies": { "unist-util-visit": "^2.0.0", "vfile-location": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" } }, "node_modules/unist-util-generated": { @@ -2121,12 +2509,20 @@ "integrity": "sha512-fPNWewS593JSmg49HbnE86BJKuBi1/nMWhDSccBvbARfxezEuJV85EaARR9/VplveiwCoLm2kWq+DhP8TBaDpw==", "dependencies": { "is-empty": "^1.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" } }, "node_modules/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==" + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-4.0.4.tgz", + "integrity": "sha512-3dF39j/u423v4BBQrk1AQ2Ve1FxY5W3JKwXxVFzBODQ6WEvccguhgp802qQLKSnxPODE6WuRZtV+ohlUg4meBA==", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } }, "node_modules/unist-util-position": { "version": "3.1.0", @@ -2143,6 +2539,10 @@ "integrity": "sha512-3faScn5I+hy9VleOq/qNbAd6pAx7iH5jYBMS9I1HgQVijz/4mv5Bvw5iw1sC/90CODiKo81G/ps8AJrISn687g==", "dependencies": { "@types/unist": "^2.0.2" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" } }, "node_modules/unist-util-visit": { @@ -2153,15 +2553,23 @@ "@types/unist": "^2.0.0", "unist-util-is": "^4.0.0", "unist-util-visit-parents": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" } }, "node_modules/unist-util-visit-parents": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-3.1.0.tgz", - "integrity": "sha512-0g4wbluTF93npyPrp/ymd3tCDTMnP0yo2akFD2FIBAYXq/Sga3lwaU1D8OYKbtpioaI6CkDcQ6fsMnmtzt7htw==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-3.1.1.tgz", + "integrity": "sha512-1KROIZWo6bcMrZEwiH2UrXDyalAa0uqzWCxCJj6lPOvTve2WkfgCytoDTPaMnodXh1WrXOq0haVYHj99ynJlsg==", "dependencies": { "@types/unist": "^2.0.0", "unist-util-is": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" } }, "node_modules/util-deprecate": { @@ -2170,21 +2578,28 @@ "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" }, "node_modules/vfile": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/vfile/-/vfile-4.2.0.tgz", - "integrity": "sha512-a/alcwCvtuc8OX92rqqo7PflxiCgXRFjdyoGVuYV+qbgCb0GgZJRvIgCD4+U/Kl1yhaRsaTwksF88xbPyGsgpw==", + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/vfile/-/vfile-4.2.1.tgz", + "integrity": "sha512-O6AE4OskCG5S1emQ/4gl8zK586RqA3srz3nfK/Viy0UPToBc5Trp9BVFb1u0CjsKrAWwnpr4ifM/KBXPWwJbCA==", "dependencies": { "@types/unist": "^2.0.0", "is-buffer": "^2.0.0", - "replace-ext": "1.0.0", "unist-util-stringify-position": "^2.0.0", "vfile-message": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" } }, "node_modules/vfile-location": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/vfile-location/-/vfile-location-3.1.0.tgz", - "integrity": "sha512-FCZ4AN9xMcjFIG1oGmZKo61PjwJHRVA+0/tPUP2ul4uIwjGGndIxavEMRpWn5p4xwm/ZsdXp9YNygf1ZyE4x8g==" + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/vfile-location/-/vfile-location-3.2.0.tgz", + "integrity": "sha512-aLEIZKv/oxuCDZ8lkJGhuhztf/BW4M+iHdCwglA/eWc+vtuRFJj8EtgceYFX4LRjOhCAAiNHsKGssC6onJ+jbA==", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } }, "node_modules/vfile-message": { "version": "2.0.4", @@ -2193,12 +2608,16 @@ "dependencies": { "@types/unist": "^2.0.0", "unist-util-stringify-position": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" } }, "node_modules/vfile-reporter": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/vfile-reporter/-/vfile-reporter-6.0.1.tgz", - "integrity": "sha512-0OppK9mo8G2XUpv+hIKLVSDsoxJrXnOy73+vIm0jQUOUFYRduqpFHX+QqAQfvRHyX9B0UFiRuNJnBOjQCIsw1g==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/vfile-reporter/-/vfile-reporter-6.0.2.tgz", + "integrity": "sha512-GN2bH2gs4eLnw/4jPSgfBjo+XCuvnX9elHICJZjVD4+NM0nsUrMTvdjGY5Sc/XG69XVTgLwj7hknQVc6M9FukA==", "dependencies": { "repeat-string": "^1.5.0", "string-width": "^4.0.0", @@ -2206,12 +2625,19 @@ "unist-util-stringify-position": "^2.0.0", "vfile-sort": "^2.1.2", "vfile-statistics": "^1.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" } }, "node_modules/vfile-reporter/node_modules/has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=" + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "engines": { + "node": ">=4" + } }, "node_modules/vfile-reporter/node_modules/supports-color": { "version": "6.1.0", @@ -2219,17 +2645,28 @@ "integrity": "sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==", "dependencies": { "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=6" } }, "node_modules/vfile-sort": { "version": "2.2.2", "resolved": "https://registry.npmjs.org/vfile-sort/-/vfile-sort-2.2.2.tgz", - "integrity": "sha512-tAyUqD2R1l/7Rn7ixdGkhXLD3zsg+XLAeUDUhXearjfIcpL1Hcsj5hHpCoy/gvfK/Ws61+e972fm0F7up7hfYA==" + "integrity": "sha512-tAyUqD2R1l/7Rn7ixdGkhXLD3zsg+XLAeUDUhXearjfIcpL1Hcsj5hHpCoy/gvfK/Ws61+e972fm0F7up7hfYA==", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } }, "node_modules/vfile-statistics": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/vfile-statistics/-/vfile-statistics-1.1.4.tgz", - "integrity": "sha512-lXhElVO0Rq3frgPvFBwahmed3X03vjPF8OcjKMy8+F1xU/3Q3QU3tKEDp743SFtb74PdF0UWpxPvtOP0GCLheA==" + "integrity": "sha512-lXhElVO0Rq3frgPvFBwahmed3X03vjPF8OcjKMy8+F1xU/3Q3QU3tKEDp743SFtb74PdF0UWpxPvtOP0GCLheA==", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } }, "node_modules/wrapped": { "version": "1.0.1", @@ -2245,6 +2682,11 @@ "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" }, + "node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + }, "node_modules/zwitch": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/zwitch/-/zwitch-1.0.5.tgz", @@ -2257,17 +2699,17 @@ }, "dependencies": { "@babel/code-frame": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.10.4.tgz", - "integrity": "sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg==", + "version": "7.12.11", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.12.11.tgz", + "integrity": "sha512-Zt1yodBx1UcyiePMSkWnU4hPqhwq7hGi2nFL1LeA3EUl+q2LQx16MISgJ0+z7dnmgvP9QtIleuETGOiOH1RcIw==", "requires": { "@babel/highlight": "^7.10.4" } }, "@babel/helper-validator-identifier": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz", - "integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw==" + "version": "7.12.11", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.12.11.tgz", + "integrity": "sha512-np/lG3uARFybkoHokJUmf1QfEvRVCPbmQeUQpKow5cQ3xWrV9i3rUHodKDJPQfTVX61qKi+UdYk8kik84n7XOw==" }, "@babel/highlight": { "version": "7.10.4", @@ -2331,18 +2773,18 @@ } }, "@rollup/plugin-commonjs": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-11.1.0.tgz", - "integrity": "sha512-Ycr12N3ZPN96Fw2STurD21jMqzKwL9QuFhms3SD7KKRK7oaXUsBU9Zt0jL/rOPHiPYisI21/rXGO3jr9BnLHUA==", + "version": "17.0.0", + "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-17.0.0.tgz", + "integrity": "sha512-/omBIJG1nHQc+bgkYDuLpb/V08QyutP9amOrJRUSlYJZP+b/68gM//D8sxJe3Yry2QnYIr3QjR3x4AlxJEN3GA==", "dev": true, "requires": { - "@rollup/pluginutils": "^3.0.8", + "@rollup/pluginutils": "^3.1.0", "commondir": "^1.0.1", - "estree-walker": "^1.0.1", - "glob": "^7.1.2", - "is-reference": "^1.1.2", - "magic-string": "^0.25.2", - "resolve": "^1.11.0" + "estree-walker": "^2.0.1", + "glob": "^7.1.6", + "is-reference": "^1.2.1", + "magic-string": "^0.25.7", + "resolve": "^1.17.0" } }, "@rollup/plugin-json": { @@ -2355,16 +2797,17 @@ } }, "@rollup/plugin-node-resolve": { - "version": "7.1.3", - "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-7.1.3.tgz", - "integrity": "sha512-RxtSL3XmdTAE2byxekYLnx+98kEUOrPHF/KRVjLH+DEIHy6kjIw7YINQzn+NXiH/NTrQLAwYs0GWB+csWygA9Q==", + "version": "11.0.1", + "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-11.0.1.tgz", + "integrity": "sha512-ltlsj/4Bhwwhb+Nb5xCz/6vieuEj2/BAkkqVIKmZwC7pIdl8srmgmglE4S0jFlZa32K4qvdQ6NHdmpRKD/LwoQ==", "dev": true, "requires": { - "@rollup/pluginutils": "^3.0.8", - "@types/resolve": "0.0.8", + "@rollup/pluginutils": "^3.1.0", + "@types/resolve": "1.17.1", "builtin-modules": "^3.1.0", + "deepmerge": "^4.2.2", "is-module": "^1.0.0", - "resolve": "^1.14.2" + "resolve": "^1.19.0" } }, "@rollup/pluginutils": { @@ -2376,6 +2819,14 @@ "@types/estree": "0.0.39", "estree-walker": "^1.0.1", "picomatch": "^2.2.2" + }, + "dependencies": { + "estree-walker": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-1.0.1.tgz", + "integrity": "sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg==", + "dev": true + } } }, "@types/estree": { @@ -2393,15 +2844,15 @@ } }, "@types/node": { - "version": "14.11.8", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.11.8.tgz", - "integrity": "sha512-KPcKqKm5UKDkaYPTuXSx8wEP7vE9GnuaXIZKijwRYcePpZFDVuy2a57LarFKiORbHOuTOOwYzxVxcUzsh2P2Pw==", + "version": "14.14.20", + "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.20.tgz", + "integrity": "sha512-Y93R97Ouif9JEOWPIUyU+eyIdyRqQR0I8Ez1dzku4hDx34NWh4HbtIc3WNzwB1Y9ULvNGeu5B8h8bVL5cAk4/A==", "dev": true }, "@types/resolve": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-0.0.8.tgz", - "integrity": "sha512-auApPaJf3NPfe18hSoJkp8EbZzer2ISk7o8mCC3M9he/a04+gbMF97NkpD2S8riMGvm4BMRI59/SZQSaLTKpsQ==", + "version": "1.17.1", + "resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-1.17.1.tgz", + "integrity": "sha512-yy7HuzQhj0dhGpD8RLXSZWEkLsV9ibvxvi6EiJ3bkqLAO1RGo0WbkWQiwpRlSFymTJRz0d3k5LM3kkx8ArDbLw==", "dev": true, "requires": { "@types/node": "*" @@ -2480,9 +2931,9 @@ "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==" }, "builtin-modules": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.1.0.tgz", - "integrity": "sha512-k0KL0aWZuBt2lrxrcASWDfwOLMnodeQjodT/1SxEQAXsHANgo6ZC/VEaSEHCXt7aSTZ4/4H5LKa+tBXmW7Vtvw==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.2.0.tgz", + "integrity": "sha512-lGzLKcioL90C7wMczpkY0n/oART3MbBa8R9OFGE1rJxoVI86u4WAGfEk8Wjv10eKSyTHVGkSo3bvBylCEtk7LA==", "dev": true }, "camelcase": { @@ -2515,18 +2966,26 @@ "integrity": "sha512-mKKUkUbhPpQlCOfIuZkvSEgktjPFIsZKRRbC6KWVEMvlzblj3i3asQv5ODsrwt0N3pHAEvjP8KTQPHkp0+6jOg==" }, "chokidar": { - "version": "3.4.3", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.4.3.tgz", - "integrity": "sha512-DtM3g7juCXQxFVSNPNByEC2+NImtBuxQQvWlHunpJIS5Ocr0lG306cC7FCi7cEA0fzmybPUIl4txBIobk1gGOQ==", + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.0.tgz", + "integrity": "sha512-JgQM9JS92ZbFR4P90EvmzNpSGhpPBGBSj10PILeDyYFwp4h2/D9OM03wsJ4zW1fEp4ka2DGrnUeD7FuvQ2aZ2Q==", "requires": { "anymatch": "~3.1.1", "braces": "~3.0.2", - "fsevents": "~2.1.2", + "fsevents": "~2.3.1", "glob-parent": "~5.1.0", "is-binary-path": "~2.1.0", "is-glob": "~4.0.1", "normalize-path": "~3.0.0", "readdirp": "~3.5.0" + }, + "dependencies": { + "fsevents": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.1.tgz", + "integrity": "sha512-YR47Eg4hChJGAB1O3yEAOkGO+rlzutoICGqGo9EZ4lKWokzZRSyIW1QmTzqjtw8MJdj9srP869CuWw/hyzSiBw==", + "optional": true + } } }, "co": { @@ -2575,13 +3034,19 @@ } }, "debug": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.2.0.tgz", - "integrity": "sha512-IX2ncY78vDTjZMFUdmsvIRFY2Cf4FnD0wRs+nQwJU8Lu99/tPFdb0VybiiMTPe3I6rQmwsqQqRBvxU+bZ/I8sg==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", "requires": { "ms": "2.1.2" } }, + "deepmerge": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.2.2.tgz", + "integrity": "sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg==", + "dev": true + }, "emoji-regex": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", @@ -2606,9 +3071,9 @@ "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==" }, "estree-walker": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-1.0.1.tgz", - "integrity": "sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", + "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", "dev": true }, "extend": { @@ -2674,8 +3139,15 @@ "version": "2.1.3", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.3.tgz", "integrity": "sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ==", + "dev": true, "optional": true }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, "glob": { "version": "7.1.6", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", @@ -2697,6 +3169,15 @@ "is-glob": "^4.0.1" } }, + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "requires": { + "function-bind": "^1.1.1" + } + }, "has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -2722,9 +3203,9 @@ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, "ini": { - "version": "1.3.7", - "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.7.tgz", - "integrity": "sha512-iKpRpXP+CrP2jyrxvg1kMUpXDyRUFDWurxbnVT1vQPx+Wz9uCYsMIqYuSBLV+PAaZG/d7kRLKRFc9oDMsH+mFQ==" + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==" }, "interpret": { "version": "1.4.0", @@ -2760,9 +3241,18 @@ } }, "is-buffer": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.4.tgz", - "integrity": "sha512-Kq1rokWXOPXWuaMAqZiJW4XxsmD9zGx9q4aePabbn3qCRGedtH7Cm+zV8WETitMfu1wdh+Rvd6w5egwSngUX2A==" + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.5.tgz", + "integrity": "sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ==" + }, + "is-core-module": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.2.0.tgz", + "integrity": "sha512-XRAfAdyyY5F5cOXn7hYQDqh2Xmii+DEfIcQGxK/uNwMHhIkPWO0g8msXcbzLe+MpGoR951MlqM/2iIlU4vKDdQ==", + "dev": true, + "requires": { + "has": "^1.0.3" + } }, "is-decimal": { "version": "1.0.4", @@ -2828,9 +3318,9 @@ "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" }, "js-yaml": { - "version": "3.14.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.0.tgz", - "integrity": "sha512-/4IbIeHcD9VMHFqDR/gQ7EdZdLimOvW2DdcxFjdyyZ9NsbS+ccrXqVWDtab/lRl5AlUqmpBx8EhPaWR+OtY17A==", + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", "requires": { "argparse": "^1.0.7", "esprima": "^4.0.0" @@ -2887,6 +3377,14 @@ "resolved": "https://registry.npmjs.org/longest-streak/-/longest-streak-2.0.4.tgz", "integrity": "sha512-vM6rUVCVUJJt33bnmHiZEvr7wPT78ztX7rojL+LW51bHtLh6HTjx84LA5W4+oa6aKEJA7jJu5LR6vQRBpA5DVg==" }, + "lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "requires": { + "yallist": "^4.0.0" + } + }, "magic-string": { "version": "0.25.7", "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.7.tgz", @@ -2915,55 +3413,57 @@ "integrity": "sha512-vTFXtmbbF3rgnTh3Zl3irso4LtvwUq/jaDvT2D1JqTGAwaipcS7RpTxzi6KjoRqI9n2yuAhzLDAC8xVTF3XYVQ==" }, "mdast-util-from-markdown": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/mdast-util-from-markdown/-/mdast-util-from-markdown-0.8.1.tgz", - "integrity": "sha512-qJXNcFcuCSPqUF0Tb0uYcFDIq67qwB3sxo9RPdf9vG8T90ViKnksFqdB/Coq2a7sTnxL/Ify2y7aIQXDkQFH0w==", + "version": "0.8.4", + "resolved": "https://registry.npmjs.org/mdast-util-from-markdown/-/mdast-util-from-markdown-0.8.4.tgz", + "integrity": "sha512-jj891B5pV2r63n2kBTFh8cRI2uR9LQHsXG1zSDqfhXkIlDzrTcIlbB5+5aaYEkl8vOPIOPLf8VT7Ere1wWTMdw==", "requires": { "@types/mdast": "^3.0.0", - "mdast-util-to-string": "^1.0.0", - "micromark": "~2.10.0", - "parse-entities": "^2.0.0" + "mdast-util-to-string": "^2.0.0", + "micromark": "~2.11.0", + "parse-entities": "^2.0.0", + "unist-util-stringify-position": "^2.0.0" } }, "mdast-util-gfm": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/mdast-util-gfm/-/mdast-util-gfm-0.1.0.tgz", - "integrity": "sha512-HLfygQL6HdhJhFbLta4Ki9hClrzyAxRjyRvpm5caN65QZL+NyHPmqFlnF9vm1Rn58JT2+AbLwNcEDY4MEvkk8Q==", + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/mdast-util-gfm/-/mdast-util-gfm-0.1.1.tgz", + "integrity": "sha512-oE1W1zSXU2L2LHg91V22HC3Z1fbsOZTBYUQq+kpM29f9297TbRm0C1l3bQ88RREl0WaUQaB49G7trvwy5utUKQ==", "requires": { "mdast-util-gfm-autolink-literal": "^0.1.0", "mdast-util-gfm-strikethrough": "^0.2.0", "mdast-util-gfm-table": "^0.1.0", - "mdast-util-gfm-task-list-item": "^0.1.0" + "mdast-util-gfm-task-list-item": "^0.1.0", + "mdast-util-to-markdown": "^0.6.1" } }, "mdast-util-gfm-autolink-literal": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/mdast-util-gfm-autolink-literal/-/mdast-util-gfm-autolink-literal-0.1.1.tgz", - "integrity": "sha512-gJ2xSpqKCetSr22GEWpZH3f5ffb4pPn/72m4piY0v7T/S+O7n7rw+sfoPLhb2b4O7WdnERoYdALRcmD68FMtlw==" + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-autolink-literal/-/mdast-util-gfm-autolink-literal-0.1.2.tgz", + "integrity": "sha512-WFeIrcNNsfBety0gyWuiBIPing9UkVcl/m2iZOyW1uHEH2evjFocet2h77M24ub0WyZ4ucnQn/jWhO5Ozl6j4g==" }, "mdast-util-gfm-strikethrough": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/mdast-util-gfm-strikethrough/-/mdast-util-gfm-strikethrough-0.2.2.tgz", - "integrity": "sha512-T37ZbaokJcRbHROXmoVAieWnesPD5N21tv2ifYzaGRLbkh1gknItUGhZzHefUn5Zc/eaO/iTDSAFOBrn/E8kWw==", + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-strikethrough/-/mdast-util-gfm-strikethrough-0.2.3.tgz", + "integrity": "sha512-5OQLXpt6qdbttcDG/UxYY7Yjj3e8P7X16LzvpX8pIQPYJ/C2Z1qFGMmcw+1PZMUM3Z8wt8NRfYTvCni93mgsgA==", "requires": { - "mdast-util-to-markdown": "^0.5.0" + "mdast-util-to-markdown": "^0.6.0" } }, "mdast-util-gfm-table": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/mdast-util-gfm-table/-/mdast-util-gfm-table-0.1.4.tgz", - "integrity": "sha512-T4xFSON9kUb/IpYA5N+KGWcsdGczAvILvKiXQwUGind6V9fvjPCR9yhZnIeaLdBWXaz3m/Gq77ZtuLMjtFR4IQ==", + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-table/-/mdast-util-gfm-table-0.1.6.tgz", + "integrity": "sha512-j4yDxQ66AJSBwGkbpFEp9uG/LS1tZV3P33fN1gkyRB2LoRL+RR3f76m0HPHaby6F4Z5xr9Fv1URmATlRRUIpRQ==", "requires": { "markdown-table": "^2.0.0", - "mdast-util-to-markdown": "^0.5.0" + "mdast-util-to-markdown": "~0.6.0" } }, "mdast-util-gfm-task-list-item": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/mdast-util-gfm-task-list-item/-/mdast-util-gfm-task-list-item-0.1.4.tgz", - "integrity": "sha512-AMiHyBHvaYN2p3ztFv7gDgTF7keZDaA9plTixRXWT0aqL0QdN43QaG5+hzcRNbjCsEWBxWhpcNk1Diq0TiIEvw==", + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-task-list-item/-/mdast-util-gfm-task-list-item-0.1.6.tgz", + "integrity": "sha512-/d51FFIfPsSmCIRNp7E6pozM9z1GYPIkSy1urQ8s/o4TC22BZ7DqfHFWiqBD23bc7J3vV1Fc9O4QIHBlfuit8A==", "requires": { - "mdast-util-to-markdown": "^0.5.0" + "mdast-util-to-markdown": "~0.6.0" } }, "mdast-util-heading-style": { @@ -2972,38 +3472,38 @@ "integrity": "sha512-8ZuuegRqS0KESgjAGW8zTx4tJ3VNIiIaGFNEzFpRSAQBavVc7AvOo9I4g3crcZBfYisHs4seYh0rAVimO6HyOw==" }, "mdast-util-to-markdown": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/mdast-util-to-markdown/-/mdast-util-to-markdown-0.5.3.tgz", - "integrity": "sha512-sr8q7fQJ1xoCqZSXW6dO/MYu2Md+a4Hfk9uO+XHCfiBhVM0EgWtfAV7BuN+ff6otUeu2xDyt1o7vhZGwOG3+BA==", + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/mdast-util-to-markdown/-/mdast-util-to-markdown-0.6.2.tgz", + "integrity": "sha512-iRczns6WMvu0hUw02LXsPDJshBIwtUPbvHBWo19IQeU0YqmzlA8Pd30U8V7uiI0VPkxzS7A/NXBXH6u+HS87Zg==", "requires": { "@types/unist": "^2.0.0", "longest-streak": "^2.0.0", - "mdast-util-to-string": "^1.0.0", + "mdast-util-to-string": "^2.0.0", "parse-entities": "^2.0.0", "repeat-string": "^1.0.0", "zwitch": "^1.0.0" } }, "mdast-util-to-string": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/mdast-util-to-string/-/mdast-util-to-string-1.1.0.tgz", - "integrity": "sha512-jVU0Nr2B9X3MU4tSK7JP1CMkSvOj7X5l/GboG1tKRw52lLF1x2Ju92Ms9tNetCcbfX3hzlM73zYo2NKkWSfF/A==" + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mdast-util-to-string/-/mdast-util-to-string-2.0.0.tgz", + "integrity": "sha512-AW4DRS3QbBayY/jJmD8437V1Gombjf8RSOUCMFBuo5iHi58AGEgVCKQ+ezHkZZDpAQS75hcBMpLqjpJTjtUL7w==" }, "micromark": { - "version": "2.10.1", - "resolved": "https://registry.npmjs.org/micromark/-/micromark-2.10.1.tgz", - "integrity": "sha512-fUuVF8sC1X7wsCS29SYQ2ZfIZYbTymp0EYr6sab3idFjigFFjGa5UwoniPlV9tAgntjuapW1t9U+S0yDYeGKHQ==", + "version": "2.11.2", + "resolved": "https://registry.npmjs.org/micromark/-/micromark-2.11.2.tgz", + "integrity": "sha512-IXuP76p2uj8uMg4FQc1cRE7lPCLsfAXuEfdjtdO55VRiFO1asrCSQ5g43NmPqFtRwzEnEhafRVzn2jg0UiKArQ==", "requires": { "debug": "^4.0.0", "parse-entities": "^2.0.0" } }, "micromark-extension-gfm": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/micromark-extension-gfm/-/micromark-extension-gfm-0.3.1.tgz", - "integrity": "sha512-lJlhcOqzoJdjQg+LMumVHdUQ61LjtqGdmZtrAdfvatRUnJTqZlRwXXHdLQgNDYlFw4mycZ4NSTKlya5QcQXl1A==", + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm/-/micromark-extension-gfm-0.3.2.tgz", + "integrity": "sha512-ToQEpLkRgg7Tp8D3GM/SjZFPV0cCwWNxZmoEVIOQivOswRtPg7gg2WlCrtHhUWFNX+DgDjbq0iLOPGp4Y15oug==", "requires": { - "micromark": "~2.10.0", + "micromark": "~2.11.0", "micromark-extension-gfm-autolink-literal": "~0.5.0", "micromark-extension-gfm-strikethrough": "~0.6.0", "micromark-extension-gfm-table": "~0.4.0", @@ -3012,27 +3512,27 @@ } }, "micromark-extension-gfm-autolink-literal": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/micromark-extension-gfm-autolink-literal/-/micromark-extension-gfm-autolink-literal-0.5.1.tgz", - "integrity": "sha512-j30923tDp0faCNDjwqe4cMi+slegbGfc3VEAExEU8d54Q/F6pR6YxCVH+6xV0ItRoj3lCn1XkUWcy6FC3S9BOw==", + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-autolink-literal/-/micromark-extension-gfm-autolink-literal-0.5.4.tgz", + "integrity": "sha512-471VKd4k3SiX7vx9fC+IYeGQL0RnxwBBXeEc5WConb7naJDG5m16guA+VoFzyXchrvmU08t0dUWWPZ0mkJSXVw==", "requires": { - "micromark": "~2.10.0" + "micromark": "~2.11.0" } }, "micromark-extension-gfm-strikethrough": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/micromark-extension-gfm-strikethrough/-/micromark-extension-gfm-strikethrough-0.6.2.tgz", - "integrity": "sha512-aehEEqtTn3JekJNwZZxa7ZJVfzmuaWp4ew6x6sl3VAKIwdDZdqYeYSQIrNKwNgH7hX0g56fAwnSDLusJggjlCQ==", + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-strikethrough/-/micromark-extension-gfm-strikethrough-0.6.3.tgz", + "integrity": "sha512-MKMoP9x2dsr1aeX46ibBwVf4Q6nJsi5aaUFTOMOID5VOLSxwl4CrqUV4OGFQd6AqhtzBJAxaV+N2trlTBtZDNQ==", "requires": { - "micromark": "~2.10.0" + "micromark": "~2.11.0" } }, "micromark-extension-gfm-table": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/micromark-extension-gfm-table/-/micromark-extension-gfm-table-0.4.1.tgz", - "integrity": "sha512-xVpqOnfFaa2OtC/Y7rlt4tdVFlUHdoLH3RXAZgb/KP3DDyKsAOx6BRS3UxiiyvmD/p2l6VUpD4bMIniuP4o4JA==", + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-table/-/micromark-extension-gfm-table-0.4.2.tgz", + "integrity": "sha512-AAzmj85XO1ydHYX0Lz52HGhcH2sZLm2AVvkwzELXWgZF6vGdq5yZ3CTByFRsqNUPyQBSIYFKLDAtc6KlnO42aw==", "requires": { - "micromark": "~2.10.0" + "micromark": "~2.11.0" } }, "micromark-extension-gfm-tagfilter": { @@ -3041,9 +3541,12 @@ "integrity": "sha512-9GU0xBatryXifL//FJH+tAZ6i240xQuFrSL7mYi8f4oZSbc+NvXjkrHemeYP0+L4ZUT+Ptz3b95zhUZnMtoi/Q==" }, "micromark-extension-gfm-task-list-item": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/micromark-extension-gfm-task-list-item/-/micromark-extension-gfm-task-list-item-0.3.1.tgz", - "integrity": "sha512-3ZiolwyLEF+t2KvGqKdBNEybiacQCsBgDx4PRZz/dttwo0PkcVKh7jpxc6UdHQuNMJ/YRUNuCSal0WuoAlefAA==" + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-task-list-item/-/micromark-extension-gfm-task-list-item-0.3.3.tgz", + "integrity": "sha512-0zvM5iSLKrc/NQl84pZSjGo66aTGd57C1idmlWmE87lkMcXrTxg1uXa/nXomxJytoje9trP0NDLvw4bZ/Z/XCQ==", + "requires": { + "micromark": "~2.11.0" + } }, "minimatch": { "version": "3.0.4", @@ -3194,9 +3697,9 @@ } }, "remark-lint": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/remark-lint/-/remark-lint-7.0.1.tgz", - "integrity": "sha512-caZXo3qhuBxzvq9JSJFVQ/ERDq/6TJVgWn0KDwKOIJCGOuLXfQhby5XttUq+Rn7kLbNMtvwfWHJlte14LpaeXQ==", + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/remark-lint/-/remark-lint-8.0.0.tgz", + "integrity": "sha512-ESI8qJQ/TIRjABDnqoFsTiZntu+FRifZ5fJ77yX63eIDijl/arvmDvT+tAf75/Nm5BFL4R2JFUtkHRGVjzYUsg==", "requires": { "remark-message-control": "^6.0.0" } @@ -3212,6 +3715,13 @@ "unist-util-generated": "^1.1.0", "unist-util-position": "^3.0.0", "unist-util-visit": "^2.0.0" + }, + "dependencies": { + "mdast-util-to-string": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/mdast-util-to-string/-/mdast-util-to-string-1.1.0.tgz", + "integrity": "sha512-jVU0Nr2B9X3MU4tSK7JP1CMkSvOj7X5l/GboG1tKRw52lLF1x2Ju92Ms9tNetCcbfX3hzlM73zYo2NKkWSfF/A==" + } } }, "remark-lint-checkbox-character-style": { @@ -3384,6 +3894,13 @@ "unist-util-generated": "^1.1.0", "unist-util-position": "^3.0.0", "unist-util-visit": "^2.0.0" + }, + "dependencies": { + "mdast-util-to-string": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/mdast-util-to-string/-/mdast-util-to-string-1.1.0.tgz", + "integrity": "sha512-jVU0Nr2B9X3MU4tSK7JP1CMkSvOj7X5l/GboG1tKRw52lLF1x2Ju92Ms9tNetCcbfX3hzlM73zYo2NKkWSfF/A==" + } } }, "remark-lint-no-blockquote-without-marker": { @@ -3480,6 +3997,13 @@ "unified-lint-rule": "^1.0.0", "unist-util-generated": "^1.1.0", "unist-util-visit": "^2.0.0" + }, + "dependencies": { + "mdast-util-to-string": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/mdast-util-to-string/-/mdast-util-to-string-1.1.0.tgz", + "integrity": "sha512-jVU0Nr2B9X3MU4tSK7JP1CMkSvOj7X5l/GboG1tKRw52lLF1x2Ju92Ms9tNetCcbfX3hzlM73zYo2NKkWSfF/A==" + } } }, "remark-lint-no-literal-urls": { @@ -3492,6 +4016,13 @@ "unist-util-generated": "^1.1.0", "unist-util-position": "^3.0.0", "unist-util-visit": "^2.0.0" + }, + "dependencies": { + "mdast-util-to-string": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/mdast-util-to-string/-/mdast-util-to-string-1.1.0.tgz", + "integrity": "sha512-jVU0Nr2B9X3MU4tSK7JP1CMkSvOj7X5l/GboG1tKRw52lLF1x2Ju92Ms9tNetCcbfX3hzlM73zYo2NKkWSfF/A==" + } } }, "remark-lint-no-multiple-toplevel-headings": { @@ -3720,16 +4251,6 @@ "remark-lint-unordered-list-marker-style": "^2.0.0", "remark-preset-lint-recommended": "^5.0.0", "semver": "^7.3.2" - }, - "dependencies": { - "remark-lint": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/remark-lint/-/remark-lint-8.0.0.tgz", - "integrity": "sha512-ESI8qJQ/TIRjABDnqoFsTiZntu+FRifZ5fJ77yX63eIDijl/arvmDvT+tAf75/Nm5BFL4R2JFUtkHRGVjzYUsg==", - "requires": { - "remark-message-control": "^6.0.0" - } - } } }, "remark-preset-lint-recommended": { @@ -3753,24 +4274,14 @@ "remark-lint-no-undefined-references": "^3.0.0", "remark-lint-no-unused-definitions": "^2.0.0", "remark-lint-ordered-list-marker-style": "^2.0.0" - }, - "dependencies": { - "remark-lint": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/remark-lint/-/remark-lint-8.0.0.tgz", - "integrity": "sha512-ESI8qJQ/TIRjABDnqoFsTiZntu+FRifZ5fJ77yX63eIDijl/arvmDvT+tAf75/Nm5BFL4R2JFUtkHRGVjzYUsg==", - "requires": { - "remark-message-control": "^6.0.0" - } - } } }, "remark-stringify": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/remark-stringify/-/remark-stringify-9.0.0.tgz", - "integrity": "sha512-8x29DpTbVzEc6Dwb90qhxCtbZ6hmj3BxWWDpMhA+1WM4dOEGH5U5/GFe3Be5Hns5MvPSFAr1e2KSVtKZkK5nUw==", + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/remark-stringify/-/remark-stringify-9.0.1.tgz", + "integrity": "sha512-mWmNg3ZtESvZS8fv5PTvaPckdL4iNlCHTt8/e/8oN08nArHRHjNZMKzA/YW3+p7/lYqIw4nx1XsjCBo/AxNChg==", "requires": { - "mdast-util-to-markdown": "^0.5.0" + "mdast-util-to-markdown": "^0.6.0" } }, "repeat-string": { @@ -3778,17 +4289,13 @@ "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=" }, - "replace-ext": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/replace-ext/-/replace-ext-1.0.0.tgz", - "integrity": "sha1-3mMSg3P8v3w8z6TeWkgMRaZ5WOs=" - }, "resolve": { - "version": "1.17.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz", - "integrity": "sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==", + "version": "1.19.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.19.0.tgz", + "integrity": "sha512-rArEXAgsBG4UgRGcynxWIWKFvh/XZCcS8UJdHhwy91zwAvCZIbcs+vAbflgBnNjYMs/i/i+/Ux6IZhML1yPvxg==", "dev": true, "requires": { + "is-core-module": "^2.1.0", "path-parse": "^1.0.6" } }, @@ -3798,9 +4305,9 @@ "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==" }, "rollup": { - "version": "2.32.1", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.32.1.tgz", - "integrity": "sha512-Op2vWTpvK7t6/Qnm1TTh7VjEZZkN8RWgf0DHbkKzQBwNf748YhXbozHVefqpPp/Fuyk/PQPAnYsBxAEtlMvpUw==", + "version": "2.36.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.36.1.tgz", + "integrity": "sha512-eAfqho8dyzuVvrGqpR0ITgEdq0zG2QJeWYh+HeuTbpcaXk8vNFc48B7bJa1xYosTCKx0CuW+447oQOW8HgBIZQ==", "dev": true, "requires": { "fsevents": "~2.1.2" @@ -3812,9 +4319,12 @@ "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" }, "semver": { - "version": "7.3.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz", - "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==" + "version": "7.3.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.4.tgz", + "integrity": "sha512-tCfb2WLjqFAtXn4KEdxIhalnRtoKFN7nAwj0B3ZXCbQloV2tq5eDbcTmT68JJD3nRJq24/XgxtQKFIpQdtvmVw==", + "requires": { + "lru-cache": "^6.0.0" + } }, "shelljs": { "version": "0.8.4", @@ -3980,9 +4490,9 @@ } }, "unified-message-control": { - "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==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/unified-message-control/-/unified-message-control-3.0.2.tgz", + "integrity": "sha512-lhF8fKjDo2cIPx1re5X1QinqUonl+AN6F0XfEaab8w/hjqX7FZAhzu4P8g6pmYp09ld+HSWFwdRJj+Y8xD0q7Q==", "requires": { "unist-util-visit": "^2.0.0", "vfile-location": "^3.0.0" @@ -4002,9 +4512,9 @@ } }, "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==" + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-4.0.4.tgz", + "integrity": "sha512-3dF39j/u423v4BBQrk1AQ2Ve1FxY5W3JKwXxVFzBODQ6WEvccguhgp802qQLKSnxPODE6WuRZtV+ohlUg4meBA==" }, "unist-util-position": { "version": "3.1.0", @@ -4030,9 +4540,9 @@ } }, "unist-util-visit-parents": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-3.1.0.tgz", - "integrity": "sha512-0g4wbluTF93npyPrp/ymd3tCDTMnP0yo2akFD2FIBAYXq/Sga3lwaU1D8OYKbtpioaI6CkDcQ6fsMnmtzt7htw==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-3.1.1.tgz", + "integrity": "sha512-1KROIZWo6bcMrZEwiH2UrXDyalAa0uqzWCxCJj6lPOvTve2WkfgCytoDTPaMnodXh1WrXOq0haVYHj99ynJlsg==", "requires": { "@types/unist": "^2.0.0", "unist-util-is": "^4.0.0" @@ -4044,21 +4554,20 @@ "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" }, "vfile": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/vfile/-/vfile-4.2.0.tgz", - "integrity": "sha512-a/alcwCvtuc8OX92rqqo7PflxiCgXRFjdyoGVuYV+qbgCb0GgZJRvIgCD4+U/Kl1yhaRsaTwksF88xbPyGsgpw==", + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/vfile/-/vfile-4.2.1.tgz", + "integrity": "sha512-O6AE4OskCG5S1emQ/4gl8zK586RqA3srz3nfK/Viy0UPToBc5Trp9BVFb1u0CjsKrAWwnpr4ifM/KBXPWwJbCA==", "requires": { "@types/unist": "^2.0.0", "is-buffer": "^2.0.0", - "replace-ext": "1.0.0", "unist-util-stringify-position": "^2.0.0", "vfile-message": "^2.0.0" } }, "vfile-location": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/vfile-location/-/vfile-location-3.1.0.tgz", - "integrity": "sha512-FCZ4AN9xMcjFIG1oGmZKo61PjwJHRVA+0/tPUP2ul4uIwjGGndIxavEMRpWn5p4xwm/ZsdXp9YNygf1ZyE4x8g==" + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/vfile-location/-/vfile-location-3.2.0.tgz", + "integrity": "sha512-aLEIZKv/oxuCDZ8lkJGhuhztf/BW4M+iHdCwglA/eWc+vtuRFJj8EtgceYFX4LRjOhCAAiNHsKGssC6onJ+jbA==" }, "vfile-message": { "version": "2.0.4", @@ -4070,9 +4579,9 @@ } }, "vfile-reporter": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/vfile-reporter/-/vfile-reporter-6.0.1.tgz", - "integrity": "sha512-0OppK9mo8G2XUpv+hIKLVSDsoxJrXnOy73+vIm0jQUOUFYRduqpFHX+QqAQfvRHyX9B0UFiRuNJnBOjQCIsw1g==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/vfile-reporter/-/vfile-reporter-6.0.2.tgz", + "integrity": "sha512-GN2bH2gs4eLnw/4jPSgfBjo+XCuvnX9elHICJZjVD4+NM0nsUrMTvdjGY5Sc/XG69XVTgLwj7hknQVc6M9FukA==", "requires": { "repeat-string": "^1.5.0", "string-width": "^4.0.0", @@ -4121,6 +4630,11 @@ "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" }, + "yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + }, "zwitch": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/zwitch/-/zwitch-1.0.5.tgz", diff --git a/tools/node-lint-md-cli-rollup/package.json b/tools/node-lint-md-cli-rollup/package.json index e55115fa1f6cb6..7776ad0d5dcc5b 100644 --- a/tools/node-lint-md-cli-rollup/package.json +++ b/tools/node-lint-md-cli-rollup/package.json @@ -3,19 +3,19 @@ "description": "remark packaged for Node.js Markdown linting", "version": "2.0.2", "devDependencies": { - "@rollup/plugin-commonjs": "^11.0.1", - "@rollup/plugin-json": "^4.0.1", - "@rollup/plugin-node-resolve": "^7.0.0", - "rollup": "^2.32.1", + "@rollup/plugin-commonjs": "^17.0.0", + "@rollup/plugin-json": "^4.1.0", + "@rollup/plugin-node-resolve": "^11.0.1", + "rollup": "^2.36.1", "shx": "^0.3.3" }, "dependencies": { "markdown-extensions": "^1.1.1", "remark": "^13.0.0", "remark-gfm": "^1.0.0", - "remark-lint": "^7.0.0", + "remark-lint": "^8.0.0", "remark-preset-lint-node": "^2.0.0", - "unified-args": "^8.0.0" + "unified-args": "^8.1.0" }, "main": "dist/index.js", "scripts": { diff --git a/tools/node-lint-md-cli-rollup/rollup.config.js b/tools/node-lint-md-cli-rollup/rollup.config.js index 967f81865c6d3a..654f033cf65b8d 100644 --- a/tools/node-lint-md-cli-rollup/rollup.config.js +++ b/tools/node-lint-md-cli-rollup/rollup.config.js @@ -1,6 +1,6 @@ 'use strict'; -const resolve = require('@rollup/plugin-node-resolve'); +const { nodeResolve } = require('@rollup/plugin-node-resolve'); const commonjs = require('@rollup/plugin-commonjs'); const json = require('@rollup/plugin-json'); @@ -10,6 +10,7 @@ module.exports = { file: 'dist/index.js', format: 'cjs', sourcemap: false, + exports: 'default', }, external: [ 'stream', @@ -44,7 +45,7 @@ module.exports = { json({ preferConst: true }), - resolve(), // tells Rollup how to find date-fns in node_modules + nodeResolve(), // tells Rollup how to find date-fns in node_modules commonjs(), // Converts date-fns to ES modules { name: 'banner', diff --git a/tools/node_modules/eslint/README.md b/tools/node_modules/eslint/README.md index 2fbe7ae7b38192..f80edf7191fa68 100644 --- a/tools/node_modules/eslint/README.md +++ b/tools/node_modules/eslint/README.md @@ -262,7 +262,7 @@ The following companies, organizations, and individuals support ESLint's ongoing

Automattic

Gold Sponsors

Chrome's Web Framework & Tools Performance Fund Shopify Salesforce Airbnb Microsoft FOSS Fund Sponsorships

Silver Sponsors

Liftoff AMP Project

Bronze Sponsors

-

Writers Per Hour 2021 calendar Buy.Fineproxy.Org Veikkaajat.com Anagram Solver Bugsnag Stability Monitoring Mixpanel VPS Server Icons8: free icons, photos, illustrations, and music Discord ThemeIsle Fire Stick Tricks

+

The Standard Daily Writers Per Hour 2021 calendar Buy.Fineproxy.Org Veikkaajat.com Anagram Solver Bugsnag Stability Monitoring Mixpanel VPS Server Icons8: free icons, photos, illustrations, and music Discord ThemeIsle Fire Stick Tricks

## Technology Sponsors diff --git a/tools/node_modules/eslint/lib/eslint/eslint.js b/tools/node_modules/eslint/lib/eslint/eslint.js index a51ffbfe41a637..0bd7a41c6fd2bc 100644 --- a/tools/node_modules/eslint/lib/eslint/eslint.js +++ b/tools/node_modules/eslint/lib/eslint/eslint.js @@ -272,7 +272,7 @@ function processOptions({ errors.push("'rulePaths' must be an array of non-empty strings."); } if (typeof useEslintrc !== "boolean") { - errors.push("'useElintrc' must be a boolean."); + errors.push("'useEslintrc' must be a boolean."); } if (errors.length > 0) { @@ -563,7 +563,7 @@ class ESLint { /** * Returns the formatter representing the given formatter name. - * @param {string} [name] The name of the formattter to load. + * @param {string} [name] The name of the formatter to load. * The following values are allowed: * - `undefined` ... Load `stylish` builtin formatter. * - A builtin formatter name ... Load the builtin formatter. diff --git a/tools/node_modules/eslint/lib/rules/arrow-body-style.js b/tools/node_modules/eslint/lib/rules/arrow-body-style.js index 7b318ea8b3a165..b2167fde77bc7e 100644 --- a/tools/node_modules/eslint/lib/rules/arrow-body-style.js +++ b/tools/node_modules/eslint/lib/rules/arrow-body-style.js @@ -191,7 +191,7 @@ module.exports = { } /* - * If the first token of the reutrn value is `{` or the return value is a sequence expression, + * If the first token of the return value is `{` or the return value is a sequence expression, * enclose the return value by parentheses to avoid syntax error. */ if (astUtils.isOpeningBraceToken(firstValueToken) || blockBody[0].argument.type === "SequenceExpression" || (funcInfo.hasInOperator && isInsideForLoopInitializer(node))) { diff --git a/tools/node_modules/eslint/lib/rules/callback-return.js b/tools/node_modules/eslint/lib/rules/callback-return.js index ba13c9a6481768..fa66e6383b7cc7 100644 --- a/tools/node_modules/eslint/lib/rules/callback-return.js +++ b/tools/node_modules/eslint/lib/rules/callback-return.js @@ -59,9 +59,9 @@ module.exports = { } /** - * Check to see if a node contains only identifers + * Check to see if a node contains only identifiers * @param {ASTNode} node The node to check - * @returns {boolean} Whether or not the node contains only identifers + * @returns {boolean} Whether or not the node contains only identifiers */ function containsOnlyIdentifiers(node) { if (node.type === "Identifier") { diff --git a/tools/node_modules/eslint/lib/rules/dot-location.js b/tools/node_modules/eslint/lib/rules/dot-location.js index 0a739b1712b902..a8d5a760562d3e 100644 --- a/tools/node_modules/eslint/lib/rules/dot-location.js +++ b/tools/node_modules/eslint/lib/rules/dot-location.js @@ -46,7 +46,7 @@ module.exports = { const sourceCode = context.getSourceCode(); /** - * Reports if the dot between object and property is on the correct loccation. + * Reports if the dot between object and property is on the correct location. * @param {ASTNode} node The `MemberExpression` node. * @returns {void} */ diff --git a/tools/node_modules/eslint/lib/rules/func-call-spacing.js b/tools/node_modules/eslint/lib/rules/func-call-spacing.js index 8fe690d4a6ba21..132a5833143844 100644 --- a/tools/node_modules/eslint/lib/rules/func-call-spacing.js +++ b/tools/node_modules/eslint/lib/rules/func-call-spacing.js @@ -131,7 +131,7 @@ module.exports = { return null; } - // If `?.` exsits, it doesn't hide no-undexpected-multiline errors + // If `?.` exists, it doesn't hide no-unexpected-multiline errors if (node.optional) { return fixer.replaceTextRange([leftToken.range[1], rightToken.range[0]], "?."); } @@ -177,7 +177,7 @@ module.exports = { /* * Only autofix if there is no newline * https://github.com/eslint/eslint/issues/7787 - * But if `?.` exsits, it doesn't hide no-undexpected-multiline errors + * But if `?.` exists, it doesn't hide no-unexpected-multiline errors */ if (!node.optional) { return null; diff --git a/tools/node_modules/eslint/lib/rules/multiline-ternary.js b/tools/node_modules/eslint/lib/rules/multiline-ternary.js index 6668bff4824842..98360b9cad4676 100644 --- a/tools/node_modules/eslint/lib/rules/multiline-ternary.js +++ b/tools/node_modules/eslint/lib/rules/multiline-ternary.js @@ -27,19 +27,22 @@ module.exports = { enum: ["always", "always-multiline", "never"] } ], + messages: { expectedTestCons: "Expected newline between test and consequent of ternary expression.", expectedConsAlt: "Expected newline between consequent and alternate of ternary expression.", unexpectedTestCons: "Unexpected newline between test and consequent of ternary expression.", unexpectedConsAlt: "Unexpected newline between consequent and alternate of ternary expression." - } + }, + + fixable: "whitespace" }, create(context) { + const sourceCode = context.getSourceCode(); const option = context.options[0]; const multiline = option !== "never"; const allowSingleLine = option === "always-multiline"; - const sourceCode = context.getSourceCode(); //-------------------------------------------------------------------------- // Public @@ -59,6 +62,8 @@ module.exports = { const areTestAndConsequentOnSameLine = astUtils.isTokenOnSameLine(lastTokenOfTest, firstTokenOfConsequent); const areConsequentAndAlternateOnSameLine = astUtils.isTokenOnSameLine(lastTokenOfConsequent, firstTokenOfAlternate); + const hasComments = !!sourceCode.getCommentsInside(node).length; + if (!multiline) { if (!areTestAndConsequentOnSameLine) { context.report({ @@ -67,7 +72,24 @@ module.exports = { start: firstTokenOfTest.loc.start, end: lastTokenOfTest.loc.end }, - messageId: "unexpectedTestCons" + messageId: "unexpectedTestCons", + fix: fixer => { + if (hasComments) { + return null; + } + const fixers = []; + const areTestAndQuestionOnSameLine = astUtils.isTokenOnSameLine(lastTokenOfTest, questionToken); + const areQuestionAndConsOnSameLine = astUtils.isTokenOnSameLine(questionToken, firstTokenOfConsequent); + + if (!areTestAndQuestionOnSameLine) { + fixers.push(fixer.removeRange([lastTokenOfTest.range[1], questionToken.range[0]])); + } + if (!areQuestionAndConsOnSameLine) { + fixers.push(fixer.removeRange([questionToken.range[1], firstTokenOfConsequent.range[0]])); + } + + return fixers; + } }); } @@ -78,7 +100,24 @@ module.exports = { start: firstTokenOfConsequent.loc.start, end: lastTokenOfConsequent.loc.end }, - messageId: "unexpectedConsAlt" + messageId: "unexpectedConsAlt", + fix: fixer => { + if (hasComments) { + return null; + } + const fixers = []; + const areConsAndColonOnSameLine = astUtils.isTokenOnSameLine(lastTokenOfConsequent, colonToken); + const areColonAndAltOnSameLine = astUtils.isTokenOnSameLine(colonToken, firstTokenOfAlternate); + + if (!areConsAndColonOnSameLine) { + fixers.push(fixer.removeRange([lastTokenOfConsequent.range[1], colonToken.range[0]])); + } + if (!areColonAndAltOnSameLine) { + fixers.push(fixer.removeRange([colonToken.range[1], firstTokenOfAlternate.range[0]])); + } + + return fixers; + } }); } } else { @@ -93,7 +132,16 @@ module.exports = { start: firstTokenOfTest.loc.start, end: lastTokenOfTest.loc.end }, - messageId: "expectedTestCons" + messageId: "expectedTestCons", + fix: fixer => (hasComments ? null : ( + fixer.replaceTextRange( + [ + lastTokenOfTest.range[1], + questionToken.range[0] + ], + "\n" + ) + )) }); } @@ -104,7 +152,16 @@ module.exports = { start: firstTokenOfConsequent.loc.start, end: lastTokenOfConsequent.loc.end }, - messageId: "expectedConsAlt" + messageId: "expectedConsAlt", + fix: (fixer => (hasComments ? null : ( + fixer.replaceTextRange( + [ + lastTokenOfConsequent.range[1], + colonToken.range[0] + ], + "\n" + ) + ))) }); } } diff --git a/tools/node_modules/eslint/lib/rules/no-constant-condition.js b/tools/node_modules/eslint/lib/rules/no-constant-condition.js index 7d324634244cb9..3c2d68cbf6caf1 100644 --- a/tools/node_modules/eslint/lib/rules/no-constant-condition.js +++ b/tools/node_modules/eslint/lib/rules/no-constant-condition.js @@ -106,10 +106,15 @@ module.exports = { */ return operator === node.operator && ( - isLogicalIdentity(node.left, node.operator) || - isLogicalIdentity(node.right, node.operator) + isLogicalIdentity(node.left, operator) || + isLogicalIdentity(node.right, operator) ); + case "AssignmentExpression": + return ["||=", "&&="].includes(node.operator) && + operator === node.operator.slice(0, -1) && + isLogicalIdentity(node.right, operator); + // no default } return false; @@ -177,7 +182,15 @@ module.exports = { } case "AssignmentExpression": - return (node.operator === "=") && isConstant(node.right, inBooleanPosition); + if (node.operator === "=") { + return isConstant(node.right, inBooleanPosition); + } + + if (["||=", "&&="].includes(node.operator) && inBooleanPosition) { + return isLogicalIdentity(node.right, node.operator.slice(0, -1)); + } + + return false; case "SequenceExpression": return isConstant(node.expressions[node.expressions.length - 1], inBooleanPosition); diff --git a/tools/node_modules/eslint/lib/rules/no-control-regex.js b/tools/node_modules/eslint/lib/rules/no-control-regex.js index 146c4f22d01257..6feeb6419d566d 100644 --- a/tools/node_modules/eslint/lib/rules/no-control-regex.js +++ b/tools/node_modules/eslint/lib/rules/no-control-regex.js @@ -8,7 +8,6 @@ const RegExpValidator = require("regexpp").RegExpValidator; const collector = new (class { constructor() { - this.ecmaVersion = 2018; this._source = ""; this._controlChars = []; this._validator = new RegExpValidator(this); diff --git a/tools/node_modules/eslint/lib/rules/no-extend-native.js b/tools/node_modules/eslint/lib/rules/no-extend-native.js index db365b50924d7a..2a804b563980be 100644 --- a/tools/node_modules/eslint/lib/rules/no-extend-native.js +++ b/tools/node_modules/eslint/lib/rules/no-extend-native.js @@ -138,7 +138,7 @@ module.exports = { } /* - * `identifierNode.parent` is a MamberExpression `*.prototype`. + * `identifierNode.parent` is a MemberExpression `*.prototype`. * If it's an optional member access, it may be wrapped by a `ChainExpression` node. */ const prototypeNode = diff --git a/tools/node_modules/eslint/lib/rules/no-import-assign.js b/tools/node_modules/eslint/lib/rules/no-import-assign.js index 7a349bb730bdcd..41060d8ac9e0b2 100644 --- a/tools/node_modules/eslint/lib/rules/no-import-assign.js +++ b/tools/node_modules/eslint/lib/rules/no-import-assign.js @@ -97,10 +97,10 @@ function isIterationVariable(node) { * - `Object.defineProperties` * - `Object.freeze` * - `Object.setPrototypeOf` - * - `Refrect.defineProperty` - * - `Refrect.deleteProperty` - * - `Refrect.set` - * - `Refrect.setPrototypeOf` + * - `Reflect.defineProperty` + * - `Reflect.deleteProperty` + * - `Reflect.set` + * - `Reflect.setPrototypeOf` * @param {ASTNode} node The node to check. * @param {Scope} scope A `escope.Scope` object to find variable (whichever). * @returns {boolean} `true` if the node is at the first argument of a well-known mutation function. diff --git a/tools/node_modules/eslint/lib/rules/no-invalid-regexp.js b/tools/node_modules/eslint/lib/rules/no-invalid-regexp.js index 48b7188d49f9c5..6136ebb9e0be11 100644 --- a/tools/node_modules/eslint/lib/rules/no-invalid-regexp.js +++ b/tools/node_modules/eslint/lib/rules/no-invalid-regexp.js @@ -9,7 +9,7 @@ //------------------------------------------------------------------------------ const RegExpValidator = require("regexpp").RegExpValidator; -const validator = new RegExpValidator({ ecmaVersion: 2018 }); +const validator = new RegExpValidator(); const validFlags = /[gimuys]/gu; const undefined1 = void 0; diff --git a/tools/node_modules/eslint/lib/rules/no-restricted-exports.js b/tools/node_modules/eslint/lib/rules/no-restricted-exports.js index 6031e26de2c7e8..f0df0ffaedb649 100644 --- a/tools/node_modules/eslint/lib/rules/no-restricted-exports.js +++ b/tools/node_modules/eslint/lib/rules/no-restricted-exports.js @@ -45,7 +45,7 @@ module.exports = { /** * Checks and reports given exported identifier. - * @param {ASTNode} node exported `Identifer` node to check. + * @param {ASTNode} node exported `Identifier` node to check. * @returns {void} */ function checkExportedName(node) { diff --git a/tools/node_modules/eslint/lib/rules/no-this-before-super.js b/tools/node_modules/eslint/lib/rules/no-this-before-super.js index 44288c0c97136e..5bfba66fc65c32 100644 --- a/tools/node_modules/eslint/lib/rules/no-this-before-super.js +++ b/tools/node_modules/eslint/lib/rules/no-this-before-super.js @@ -171,7 +171,7 @@ module.exports = { /** * Removes the top of stack item. * - * And this treverses all segments of this code path then reports every + * And this traverses all segments of this code path then reports every * invalid node. * @param {CodePath} codePath A code path which was ended. * @returns {void} diff --git a/tools/node_modules/eslint/lib/rules/no-useless-escape.js b/tools/node_modules/eslint/lib/rules/no-useless-escape.js index 8057e44ddab463..512c93a8bc0820 100644 --- a/tools/node_modules/eslint/lib/rules/no-useless-escape.js +++ b/tools/node_modules/eslint/lib/rules/no-useless-escape.js @@ -109,9 +109,9 @@ module.exports = { * @returns {void} */ function report(node, startOffset, character) { - const start = sourceCode.getLocFromIndex(sourceCode.getIndexFromLoc(node.loc.start) + startOffset); - const rangeStart = sourceCode.getIndexFromLoc(node.loc.start) + startOffset; + const rangeStart = node.range[0] + startOffset; const range = [rangeStart, rangeStart + 1]; + const start = sourceCode.getLocFromIndex(rangeStart); context.report({ node, @@ -172,7 +172,7 @@ module.exports = { } if (isUnnecessaryEscape && !isQuoteEscape) { - report(node, match.index + 1, match[0].slice(1)); + report(node, match.index, match[0].slice(1)); } } @@ -206,7 +206,7 @@ module.exports = { return; } - const value = isTemplateElement ? node.value.raw : node.raw.slice(1, -1); + const value = isTemplateElement ? sourceCode.getText(node) : node.raw; const pattern = /\\[^\d]/gu; let match; diff --git a/tools/node_modules/eslint/lib/rules/one-var.js b/tools/node_modules/eslint/lib/rules/one-var.js index b370c6d5e19858..e3df8320f8b130 100644 --- a/tools/node_modules/eslint/lib/rules/one-var.js +++ b/tools/node_modules/eslint/lib/rules/one-var.js @@ -5,6 +5,25 @@ "use strict"; +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Determines whether the given node is in a statement list. + * @param {ASTNode} node node to check + * @returns {boolean} `true` if the given node is in a statement list + */ +function isInStatementList(node) { + return astUtils.STATEMENT_LIST_PARENTS.has(node.parent.type); +} + //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -268,8 +287,8 @@ module.exports = { /** * Fixer to join VariableDeclaration's into a single declaration - * @param {VariableDeclarator[]} declarations The `VariableDeclaration` to join - * @returns {Function} The fixer function + * @param {VariableDeclarator[]} declarations The `VariableDeclaration` to join + * @returns {Function} The fixer function */ function joinDeclarations(declarations) { const declaration = declarations[0]; @@ -297,10 +316,17 @@ module.exports = { /** * Fixer to split a VariableDeclaration into individual declarations - * @param {VariableDeclaration} declaration The `VariableDeclaration` to split - * @returns {Function} The fixer function + * @param {VariableDeclaration} declaration The `VariableDeclaration` to split + * @returns {Function|null} The fixer function */ function splitDeclarations(declaration) { + const { parent } = declaration; + + // don't autofix code such as: if (foo) var x, y; + if (!isInStatementList(parent.type === "ExportNamedDeclaration" ? parent : declaration)) { + return null; + } + return fixer => declaration.declarations.map(declarator => { const tokenAfterDeclarator = sourceCode.getTokenAfter(declarator); diff --git a/tools/node_modules/eslint/lib/rules/prefer-destructuring.js b/tools/node_modules/eslint/lib/rules/prefer-destructuring.js index b2d3c8a0b0193e..413f7272cc15f2 100644 --- a/tools/node_modules/eslint/lib/rules/prefer-destructuring.js +++ b/tools/node_modules/eslint/lib/rules/prefer-destructuring.js @@ -279,7 +279,7 @@ module.exports = { * @param {ASTNode} node the AssignmentExpression node * @returns {void} */ - function checkAssigmentExpression(node) { + function checkAssignmentExpression(node) { if (node.operator === "=") { performCheck(node.left, node.right, node); } @@ -291,7 +291,7 @@ module.exports = { return { VariableDeclarator: checkVariableDeclarator, - AssignmentExpression: checkAssigmentExpression + AssignmentExpression: checkAssignmentExpression }; } }; diff --git a/tools/node_modules/eslint/lib/rules/prefer-reflect.js b/tools/node_modules/eslint/lib/rules/prefer-reflect.js index fb2de923bea379..156d61251c4877 100644 --- a/tools/node_modules/eslint/lib/rules/prefer-reflect.js +++ b/tools/node_modules/eslint/lib/rules/prefer-reflect.js @@ -105,10 +105,10 @@ module.exports = { CallExpression(node) { const methodName = (node.callee.property || {}).name; const isReflectCall = (node.callee.object || {}).name === "Reflect"; - const hasReflectSubsitute = Object.prototype.hasOwnProperty.call(reflectSubstitutes, methodName); + const hasReflectSubstitute = Object.prototype.hasOwnProperty.call(reflectSubstitutes, methodName); const userConfiguredException = exceptions.indexOf(methodName) !== -1; - if (hasReflectSubsitute && !isReflectCall && !userConfiguredException) { + if (hasReflectSubstitute && !isReflectCall && !userConfiguredException) { report(node, existingNames[methodName], reflectSubstitutes[methodName]); } }, diff --git a/tools/node_modules/eslint/lib/rules/space-unary-ops.js b/tools/node_modules/eslint/lib/rules/space-unary-ops.js index f417eea58d8eb6..57f6e784501d2d 100644 --- a/tools/node_modules/eslint/lib/rules/space-unary-ops.js +++ b/tools/node_modules/eslint/lib/rules/space-unary-ops.js @@ -1,5 +1,5 @@ /** - * @fileoverview This rule shoud require or disallow spaces before or after unary operations. + * @fileoverview This rule should require or disallow spaces before or after unary operations. * @author Marcin Kumorek */ "use strict"; diff --git a/tools/node_modules/eslint/lib/rules/utils/ast-utils.js b/tools/node_modules/eslint/lib/rules/utils/ast-utils.js index 1fd6340df7c7e4..679eebb4c458d7 100644 --- a/tools/node_modules/eslint/lib/rules/utils/ast-utils.js +++ b/tools/node_modules/eslint/lib/rules/utils/ast-utils.js @@ -82,7 +82,7 @@ function startsWithUpperCase(s) { /** * Checks whether or not a node is a constructor. * @param {ASTNode} node A function node to check. - * @returns {boolean} Wehether or not a node is a constructor. + * @returns {boolean} Whether or not a node is a constructor. */ function isES5Constructor(node) { return (node.id && startsWithUpperCase(node.id.name)); @@ -1574,7 +1574,7 @@ module.exports = { }, /* - * Determine if a node has a possiblity to be an Error object + * Determine if a node has a possibility to be an Error object * @param {ASTNode} node ASTNode to check * @returns {boolean} True if there is a chance it contains an Error obj */ diff --git a/tools/node_modules/eslint/lib/shared/deprecation-warnings.js b/tools/node_modules/eslint/lib/shared/deprecation-warnings.js index e1481a2e9aa0b8..1438eaa69bff86 100644 --- a/tools/node_modules/eslint/lib/shared/deprecation-warnings.js +++ b/tools/node_modules/eslint/lib/shared/deprecation-warnings.js @@ -15,7 +15,7 @@ const lodash = require("lodash"); // Private //------------------------------------------------------------------------------ -// Defitions for deprecation warnings. +// Definitions for deprecation warnings. const deprecationWarningMessages = { ESLINT_LEGACY_ECMAFEATURES: "The 'ecmaFeatures' config file property is deprecated and has no effect.", diff --git a/tools/node_modules/eslint/lib/shared/types.js b/tools/node_modules/eslint/lib/shared/types.js index 8ad3b1b64ce1e3..c3b76e42d5f075 100644 --- a/tools/node_modules/eslint/lib/shared/types.js +++ b/tools/node_modules/eslint/lib/shared/types.js @@ -46,9 +46,9 @@ module.exports = {}; /** * @typedef {Object} OverrideConfigData * @property {Record} [env] The environment settings. - * @property {string | string[]} [excludedFiles] The glob pattarns for excluded files. + * @property {string | string[]} [excludedFiles] The glob patterns for excluded files. * @property {string | string[]} [extends] The path to other config files or the package name of shareable configs. - * @property {string | string[]} files The glob pattarns for target files. + * @property {string | string[]} files The glob patterns for target files. * @property {Record} [globals] The global variable settings. * @property {boolean} [noInlineConfig] The flag that disables directive comments. * @property {OverrideConfigData[]} [overrides] The override settings per kind of files. diff --git a/tools/node_modules/eslint/node_modules/import-fresh/license b/tools/node_modules/eslint/node_modules/import-fresh/license index e7af2f77107d73..fa7ceba3eb4a96 100644 --- a/tools/node_modules/eslint/node_modules/import-fresh/license +++ b/tools/node_modules/eslint/node_modules/import-fresh/license @@ -1,6 +1,6 @@ MIT License -Copyright (c) Sindre Sorhus (sindresorhus.com) +Copyright (c) Sindre Sorhus (https://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: diff --git a/tools/node_modules/eslint/node_modules/import-fresh/package.json b/tools/node_modules/eslint/node_modules/import-fresh/package.json index 893bb4a523fbca..5a30f8061505fc 100644 --- a/tools/node_modules/eslint/node_modules/import-fresh/package.json +++ b/tools/node_modules/eslint/node_modules/import-fresh/package.json @@ -2,7 +2,7 @@ "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" + "url": "https://sindresorhus.com" }, "bugs": { "url": "https://github.com/sindresorhus/import-fresh/issues" @@ -27,6 +27,7 @@ "index.js", "index.d.ts" ], + "funding": "https://github.com/sponsors/sindresorhus", "homepage": "https://github.com/sindresorhus/import-fresh#readme", "keywords": [ "require", @@ -47,5 +48,5 @@ "heapdump": "node heapdump.js", "test": "xo && ava && tsd" }, - "version": "3.2.2" + "version": "3.3.0" } \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/import-fresh/readme.md b/tools/node_modules/eslint/node_modules/import-fresh/readme.md index 0bfa1c90443e83..bd14c79c632336 100644 --- a/tools/node_modules/eslint/node_modules/import-fresh/readme.md +++ b/tools/node_modules/eslint/node_modules/import-fresh/readme.md @@ -1,17 +1,15 @@ -# import-fresh [![Build Status](https://travis-ci.org/sindresorhus/import-fresh.svg?branch=master)](https://travis-ci.org/sindresorhus/import-fresh) +# import-fresh > Import a module while bypassing the [cache](https://nodejs.org/api/modules.html#modules_caching) Useful for testing purposes when you need to freshly import a module. - ## Install ``` $ npm install import-fresh ``` - ## Usage ```js @@ -36,14 +34,12 @@ importFresh('./foo')(); //=> 1 ``` - ## import-fresh for enterprise Available as part of the Tidelift Subscription. The maintainers of import-fresh and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-import-fresh?utm_source=npm-import-fresh&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) - ## Related - [clear-module](https://github.com/sindresorhus/clear-module) - Clear a module from the import cache diff --git a/tools/node_modules/eslint/node_modules/require-from-string/index.js b/tools/node_modules/eslint/node_modules/require-from-string/index.js new file mode 100644 index 00000000000000..cb5595fde96fbb --- /dev/null +++ b/tools/node_modules/eslint/node_modules/require-from-string/index.js @@ -0,0 +1,34 @@ +'use strict'; + +var Module = require('module'); +var path = require('path'); + +module.exports = function requireFromString(code, filename, opts) { + if (typeof filename === 'object') { + opts = filename; + filename = undefined; + } + + opts = opts || {}; + filename = filename || ''; + + opts.appendPaths = opts.appendPaths || []; + opts.prependPaths = opts.prependPaths || []; + + if (typeof code !== 'string') { + throw new Error('code must be a string, not ' + typeof code); + } + + var paths = Module._nodeModulePaths(path.dirname(filename)); + + var parent = module.parent; + var m = new Module(filename, parent); + m.filename = filename; + m.paths = [].concat(opts.prependPaths).concat(paths).concat(opts.appendPaths); + m._compile(code, filename); + + var exports = m.exports; + parent && parent.children && parent.children.splice(parent.children.indexOf(m), 1); + + return exports; +}; diff --git a/tools/node_modules/eslint/node_modules/require-from-string/license b/tools/node_modules/eslint/node_modules/require-from-string/license new file mode 100644 index 00000000000000..1aeb74fd25e171 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/require-from-string/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Vsevolod Strukchinsky (github.com/floatdrop) + +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/require-from-string/package.json b/tools/node_modules/eslint/node_modules/require-from-string/package.json new file mode 100644 index 00000000000000..4ca96a63470da5 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/require-from-string/package.json @@ -0,0 +1,35 @@ +{ + "author": { + "name": "Vsevolod Strukchinsky", + "email": "floatdrop@gmail.com", + "url": "github.com/floatdrop" + }, + "bugs": { + "url": "https://github.com/floatdrop/require-from-string/issues" + }, + "bundleDependencies": false, + "dependencies": {}, + "deprecated": false, + "description": "Require module from string", + "devDependencies": { + "mocha": "*" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/floatdrop/require-from-string#readme", + "keywords": [], + "license": "MIT", + "name": "require-from-string", + "repository": { + "type": "git", + "url": "git+https://github.com/floatdrop/require-from-string.git" + }, + "scripts": { + "test": "mocha" + }, + "version": "2.0.2" +} \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/require-from-string/readme.md b/tools/node_modules/eslint/node_modules/require-from-string/readme.md new file mode 100644 index 00000000000000..88b3236f895d36 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/require-from-string/readme.md @@ -0,0 +1,56 @@ +# require-from-string [![Build Status](https://travis-ci.org/floatdrop/require-from-string.svg?branch=master)](https://travis-ci.org/floatdrop/require-from-string) + +Load module from string in Node. + +## Install + +``` +$ npm install --save require-from-string +``` + + +## Usage + +```js +var requireFromString = require('require-from-string'); + +requireFromString('module.exports = 1'); +//=> 1 +``` + + +## API + +### requireFromString(code, [filename], [options]) + +#### code + +*Required* +Type: `string` + +Module code. + +#### filename +Type: `string` +Default: `''` + +Optional filename. + + +#### options +Type: `object` + +##### appendPaths +Type: `Array` + +List of `paths`, that will be appended to module `paths`. Useful, when you want +to be able require modules from these paths. + +##### prependPaths +Type: `Array` + +Same as `appendPaths`, but paths will be prepended. + +## License + +MIT Ā© [Vsevolod Strukchinsky](http://github.com/floatdrop) diff --git a/tools/node_modules/eslint/node_modules/table/README.md b/tools/node_modules/eslint/node_modules/table/README.md index a0ec411a6deefc..b3942042c18cef 100644 --- a/tools/node_modules/eslint/node_modules/table/README.md +++ b/tools/node_modules/eslint/node_modules/table/README.md @@ -56,8 +56,9 @@ npm install table Table data is described using an array (rows) of array (cells). ```js -import tableImport from 'table'; -const { table } = tableImport; +import { + table +} from 'table'; // Using commonjs? // const {table} = require('table'); @@ -487,7 +488,7 @@ table(data, config); | 2A | 2B | 2C | +----+----+----+ -# void (no borders; see "borderless table" section of the documentation) +# void (no borders; see "bordless table" section of the documentation) 0A 0B 0C diff --git a/tools/node_modules/eslint/node_modules/table/dist/makeConfig.js b/tools/node_modules/eslint/node_modules/table/dist/makeConfig.js index e5f4f3eec7932e..8f77c6304a4e55 100644 --- a/tools/node_modules/eslint/node_modules/table/dist/makeConfig.js +++ b/tools/node_modules/eslint/node_modules/table/dist/makeConfig.js @@ -50,7 +50,7 @@ const makeColumns = (rows, columns = {}, columnDefault = {}) => { alignment: 'left', paddingLeft: 1, paddingRight: 1, - truncate: Infinity, + truncate: Number.POSITIVE_INFINITY, width: maximumColumnWidthIndex[index], wrapWord: false }, columnDefault, columns[index]); diff --git a/tools/node_modules/eslint/node_modules/table/dist/makeConfig.js.flow b/tools/node_modules/eslint/node_modules/table/dist/makeConfig.js.flow index 9a27375cb0df60..f661220cc43592 100644 --- a/tools/node_modules/eslint/node_modules/table/dist/makeConfig.js.flow +++ b/tools/node_modules/eslint/node_modules/table/dist/makeConfig.js.flow @@ -34,7 +34,7 @@ const makeColumns = (rows, columns = {}, columnDefault = {}) => { alignment: 'left', paddingLeft: 1, paddingRight: 1, - truncate: Infinity, + truncate: Number.POSITIVE_INFINITY, width: maximumColumnWidthIndex[index], wrapWord: false, }, columnDefault, columns[index]); diff --git a/tools/node_modules/eslint/node_modules/table/dist/makeStreamConfig.js b/tools/node_modules/eslint/node_modules/table/dist/makeStreamConfig.js index 600aa66de280fe..f36fdf3ba384f0 100644 --- a/tools/node_modules/eslint/node_modules/table/dist/makeStreamConfig.js +++ b/tools/node_modules/eslint/node_modules/table/dist/makeStreamConfig.js @@ -47,7 +47,7 @@ const makeColumns = (columnCount, columns = {}, columnDefault = {}) => { alignment: 'left', paddingLeft: 1, paddingRight: 1, - truncate: Infinity, + truncate: Number.POSITIVE_INFINITY, wrapWord: false }, columnDefault, columns[index]); }); diff --git a/tools/node_modules/eslint/node_modules/table/dist/makeStreamConfig.js.flow b/tools/node_modules/eslint/node_modules/table/dist/makeStreamConfig.js.flow index 7c3ae068bb24ba..5f361c3919757b 100644 --- a/tools/node_modules/eslint/node_modules/table/dist/makeStreamConfig.js.flow +++ b/tools/node_modules/eslint/node_modules/table/dist/makeStreamConfig.js.flow @@ -31,7 +31,7 @@ const makeColumns = (columnCount, columns = {}, columnDefault = {}) => { alignment: 'left', paddingLeft: 1, paddingRight: 1, - truncate: Infinity, + truncate: Number.POSITIVE_INFINITY, wrapWord: false, }, columnDefault, columns[index]); }); diff --git a/tools/node_modules/eslint/node_modules/table/dist/schemas/config.json b/tools/node_modules/eslint/node_modules/table/dist/schemas/config.json index 1a4a9981833029..0918dcc7648812 100644 --- a/tools/node_modules/eslint/node_modules/table/dist/schemas/config.json +++ b/tools/node_modules/eslint/node_modules/table/dist/schemas/config.json @@ -4,111 +4,17 @@ "type": "object", "properties": { "border": { - "$ref": "#/definitions/borders" + "$ref": "shared.json#/definitions/borders" }, "columns": { - "$ref": "#/definitions/columns" + "$ref": "shared.json#/definitions/columns" }, "columnDefault": { - "$ref": "#/definitions/column" + "$ref": "shared.json#/definitions/column" }, "drawHorizontalLine": { "typeof": "function" } }, - "additionalProperties": false, - "definitions": { - "columns": { - "type": "object", - "patternProperties": { - "^[0-9]+$": { - "$ref": "#/definitions/column" - } - }, - "additionalProperties": false - }, - "column": { - "type": "object", - "properties": { - "alignment": { - "type": "string", - "enum": [ - "left", - "right", - "center" - ] - }, - "width": { - "type": "number" - }, - "wrapWord": { - "type": "boolean" - }, - "truncate": { - "type": "number" - }, - "paddingLeft": { - "type": "number" - }, - "paddingRight": { - "type": "number" - } - }, - "additionalProperties": false - }, - "borders": { - "type": "object", - "properties": { - "topBody": { - "$ref": "#/definitions/border" - }, - "topJoin": { - "$ref": "#/definitions/border" - }, - "topLeft": { - "$ref": "#/definitions/border" - }, - "topRight": { - "$ref": "#/definitions/border" - }, - "bottomBody": { - "$ref": "#/definitions/border" - }, - "bottomJoin": { - "$ref": "#/definitions/border" - }, - "bottomLeft": { - "$ref": "#/definitions/border" - }, - "bottomRight": { - "$ref": "#/definitions/border" - }, - "bodyLeft": { - "$ref": "#/definitions/border" - }, - "bodyRight": { - "$ref": "#/definitions/border" - }, - "bodyJoin": { - "$ref": "#/definitions/border" - }, - "joinBody": { - "$ref": "#/definitions/border" - }, - "joinLeft": { - "$ref": "#/definitions/border" - }, - "joinRight": { - "$ref": "#/definitions/border" - }, - "joinJoin": { - "$ref": "#/definitions/border" - } - }, - "additionalProperties": false - }, - "border": { - "type": "string" - } - } + "additionalProperties": false } diff --git a/tools/node_modules/eslint/node_modules/table/dist/schemas/shared.json b/tools/node_modules/eslint/node_modules/table/dist/schemas/shared.json new file mode 100644 index 00000000000000..7d03f9269455a5 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/dist/schemas/shared.json @@ -0,0 +1,98 @@ +{ + "$id": "shared.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "definitions": { + "columns": { + "type": "object", + "patternProperties": { + "^[0-9]+$": { + "$ref": "#/definitions/column" + } + }, + "additionalProperties": false + }, + "column": { + "type": "object", + "properties": { + "alignment": { + "type": "string", + "enum": [ + "left", + "right", + "center" + ] + }, + "width": { + "type": "number" + }, + "wrapWord": { + "type": "boolean" + }, + "truncate": { + "type": "number" + }, + "paddingLeft": { + "type": "number" + }, + "paddingRight": { + "type": "number" + } + }, + "additionalProperties": false + }, + "borders": { + "type": "object", + "properties": { + "topBody": { + "$ref": "#/definitions/border" + }, + "topJoin": { + "$ref": "#/definitions/border" + }, + "topLeft": { + "$ref": "#/definitions/border" + }, + "topRight": { + "$ref": "#/definitions/border" + }, + "bottomBody": { + "$ref": "#/definitions/border" + }, + "bottomJoin": { + "$ref": "#/definitions/border" + }, + "bottomLeft": { + "$ref": "#/definitions/border" + }, + "bottomRight": { + "$ref": "#/definitions/border" + }, + "bodyLeft": { + "$ref": "#/definitions/border" + }, + "bodyRight": { + "$ref": "#/definitions/border" + }, + "bodyJoin": { + "$ref": "#/definitions/border" + }, + "joinBody": { + "$ref": "#/definitions/border" + }, + "joinLeft": { + "$ref": "#/definitions/border" + }, + "joinRight": { + "$ref": "#/definitions/border" + }, + "joinJoin": { + "$ref": "#/definitions/border" + } + }, + "additionalProperties": false + }, + "border": { + "type": "string" + } + } +} diff --git a/tools/node_modules/eslint/node_modules/table/dist/schemas/streamConfig.json b/tools/node_modules/eslint/node_modules/table/dist/schemas/streamConfig.json index 35199844fd433e..24dfa56282541a 100644 --- a/tools/node_modules/eslint/node_modules/table/dist/schemas/streamConfig.json +++ b/tools/node_modules/eslint/node_modules/table/dist/schemas/streamConfig.json @@ -4,111 +4,17 @@ "type": "object", "properties": { "border": { - "$ref": "#/definitions/borders" + "$ref": "shared.json#/definitions/borders" }, "columns": { - "$ref": "#/definitions/columns" + "$ref": "shared.json#/definitions/columns" }, "columnDefault": { - "$ref": "#/definitions/column" + "$ref": "shared.json#/definitions/column" }, "columnCount": { "type": "number" } }, - "additionalProperties": false, - "definitions": { - "columns": { - "type": "object", - "patternProperties": { - "^[0-9]+$": { - "$ref": "#/definitions/column" - } - }, - "additionalProperties": false - }, - "column": { - "type": "object", - "properties": { - "alignment": { - "type": "string", - "enum": [ - "left", - "right", - "center" - ] - }, - "width": { - "type": "number" - }, - "wrapWord": { - "type": "boolean" - }, - "truncate": { - "type": "number" - }, - "paddingLeft": { - "type": "number" - }, - "paddingRight": { - "type": "number" - } - }, - "additionalProperties": false - }, - "borders": { - "type": "object", - "properties": { - "topBody": { - "$ref": "#/definitions/border" - }, - "topJoin": { - "$ref": "#/definitions/border" - }, - "topLeft": { - "$ref": "#/definitions/border" - }, - "topRight": { - "$ref": "#/definitions/border" - }, - "bottomBody": { - "$ref": "#/definitions/border" - }, - "bottomJoin": { - "$ref": "#/definitions/border" - }, - "bottomLeft": { - "$ref": "#/definitions/border" - }, - "bottomRight": { - "$ref": "#/definitions/border" - }, - "bodyLeft": { - "$ref": "#/definitions/border" - }, - "bodyRight": { - "$ref": "#/definitions/border" - }, - "bodyJoin": { - "$ref": "#/definitions/border" - }, - "joinBody": { - "$ref": "#/definitions/border" - }, - "joinLeft": { - "$ref": "#/definitions/border" - }, - "joinRight": { - "$ref": "#/definitions/border" - }, - "joinJoin": { - "$ref": "#/definitions/border" - } - }, - "additionalProperties": false - }, - "border": { - "type": "string" - } - } + "additionalProperties": false } diff --git a/tools/node_modules/eslint/node_modules/table/dist/validateConfig.js b/tools/node_modules/eslint/node_modules/table/dist/validateConfig.js index fb58f344a45d9a..cdf7530d2231ee 100644 --- a/tools/node_modules/eslint/node_modules/table/dist/validateConfig.js +++ b/tools/node_modules/eslint/node_modules/table/dist/validateConfig.js @@ -1,754 +1,43 @@ -'use strict'; -var equal = require('ajv/lib/compile/equal'); -var validate = (function() { - var pattern0 = new RegExp('^[0-9]+$'); - var refVal = []; - var refVal1 = (function() { - var pattern0 = new RegExp('^[0-9]+$'); - return function validate(data, dataPath, parentData, parentDataProperty, rootData) { - 'use strict'; - var vErrors = null; - var errors = 0; - if (rootData === undefined) rootData = data; - if ((data && typeof data === "object" && !Array.isArray(data))) { - var errs__0 = errors; - var valid1 = true; - for (var key0 in data) { - var isAdditional0 = !(false || validate.schema.properties.hasOwnProperty(key0)); - if (isAdditional0) { - valid1 = false; - var err = { - keyword: 'additionalProperties', - dataPath: (dataPath || '') + "", - schemaPath: '#/additionalProperties', - params: { - additionalProperty: '' + key0 + '' - }, - message: 'should NOT have additional properties' - }; - if (vErrors === null) vErrors = [err]; - else vErrors.push(err); - errors++; - } - } - if (data.topBody !== undefined) { - var errs_1 = errors; - if (!refVal2(data.topBody, (dataPath || '') + '.topBody', data, 'topBody', rootData)) { - if (vErrors === null) vErrors = refVal2.errors; - else vErrors = vErrors.concat(refVal2.errors); - errors = vErrors.length; - } - var valid1 = errors === errs_1; - } - if (data.topJoin !== undefined) { - var errs_1 = errors; - if (!refVal[2](data.topJoin, (dataPath || '') + '.topJoin', data, 'topJoin', rootData)) { - if (vErrors === null) vErrors = refVal[2].errors; - else vErrors = vErrors.concat(refVal[2].errors); - errors = vErrors.length; - } - var valid1 = errors === errs_1; - } - if (data.topLeft !== undefined) { - var errs_1 = errors; - if (!refVal[2](data.topLeft, (dataPath || '') + '.topLeft', data, 'topLeft', rootData)) { - if (vErrors === null) vErrors = refVal[2].errors; - else vErrors = vErrors.concat(refVal[2].errors); - errors = vErrors.length; - } - var valid1 = errors === errs_1; - } - if (data.topRight !== undefined) { - var errs_1 = errors; - if (!refVal[2](data.topRight, (dataPath || '') + '.topRight', data, 'topRight', rootData)) { - if (vErrors === null) vErrors = refVal[2].errors; - else vErrors = vErrors.concat(refVal[2].errors); - errors = vErrors.length; - } - var valid1 = errors === errs_1; - } - if (data.bottomBody !== undefined) { - var errs_1 = errors; - if (!refVal[2](data.bottomBody, (dataPath || '') + '.bottomBody', data, 'bottomBody', rootData)) { - if (vErrors === null) vErrors = refVal[2].errors; - else vErrors = vErrors.concat(refVal[2].errors); - errors = vErrors.length; - } - var valid1 = errors === errs_1; - } - if (data.bottomJoin !== undefined) { - var errs_1 = errors; - if (!refVal[2](data.bottomJoin, (dataPath || '') + '.bottomJoin', data, 'bottomJoin', rootData)) { - if (vErrors === null) vErrors = refVal[2].errors; - else vErrors = vErrors.concat(refVal[2].errors); - errors = vErrors.length; - } - var valid1 = errors === errs_1; - } - if (data.bottomLeft !== undefined) { - var errs_1 = errors; - if (!refVal[2](data.bottomLeft, (dataPath || '') + '.bottomLeft', data, 'bottomLeft', rootData)) { - if (vErrors === null) vErrors = refVal[2].errors; - else vErrors = vErrors.concat(refVal[2].errors); - errors = vErrors.length; - } - var valid1 = errors === errs_1; - } - if (data.bottomRight !== undefined) { - var errs_1 = errors; - if (!refVal[2](data.bottomRight, (dataPath || '') + '.bottomRight', data, 'bottomRight', rootData)) { - if (vErrors === null) vErrors = refVal[2].errors; - else vErrors = vErrors.concat(refVal[2].errors); - errors = vErrors.length; - } - var valid1 = errors === errs_1; - } - if (data.bodyLeft !== undefined) { - var errs_1 = errors; - if (!refVal[2](data.bodyLeft, (dataPath || '') + '.bodyLeft', data, 'bodyLeft', rootData)) { - if (vErrors === null) vErrors = refVal[2].errors; - else vErrors = vErrors.concat(refVal[2].errors); - errors = vErrors.length; - } - var valid1 = errors === errs_1; - } - if (data.bodyRight !== undefined) { - var errs_1 = errors; - if (!refVal[2](data.bodyRight, (dataPath || '') + '.bodyRight', data, 'bodyRight', rootData)) { - if (vErrors === null) vErrors = refVal[2].errors; - else vErrors = vErrors.concat(refVal[2].errors); - errors = vErrors.length; - } - var valid1 = errors === errs_1; - } - if (data.bodyJoin !== undefined) { - var errs_1 = errors; - if (!refVal[2](data.bodyJoin, (dataPath || '') + '.bodyJoin', data, 'bodyJoin', rootData)) { - if (vErrors === null) vErrors = refVal[2].errors; - else vErrors = vErrors.concat(refVal[2].errors); - errors = vErrors.length; - } - var valid1 = errors === errs_1; - } - if (data.joinBody !== undefined) { - var errs_1 = errors; - if (!refVal[2](data.joinBody, (dataPath || '') + '.joinBody', data, 'joinBody', rootData)) { - if (vErrors === null) vErrors = refVal[2].errors; - else vErrors = vErrors.concat(refVal[2].errors); - errors = vErrors.length; - } - var valid1 = errors === errs_1; - } - if (data.joinLeft !== undefined) { - var errs_1 = errors; - if (!refVal[2](data.joinLeft, (dataPath || '') + '.joinLeft', data, 'joinLeft', rootData)) { - if (vErrors === null) vErrors = refVal[2].errors; - else vErrors = vErrors.concat(refVal[2].errors); - errors = vErrors.length; - } - var valid1 = errors === errs_1; - } - if (data.joinRight !== undefined) { - var errs_1 = errors; - if (!refVal[2](data.joinRight, (dataPath || '') + '.joinRight', data, 'joinRight', rootData)) { - if (vErrors === null) vErrors = refVal[2].errors; - else vErrors = vErrors.concat(refVal[2].errors); - errors = vErrors.length; - } - var valid1 = errors === errs_1; - } - if (data.joinJoin !== undefined) { - var errs_1 = errors; - if (!refVal[2](data.joinJoin, (dataPath || '') + '.joinJoin', data, 'joinJoin', rootData)) { - if (vErrors === null) vErrors = refVal[2].errors; - else vErrors = vErrors.concat(refVal[2].errors); - errors = vErrors.length; - } - var valid1 = errors === errs_1; - } - } else { - var err = { - keyword: 'type', - dataPath: (dataPath || '') + "", - schemaPath: '#/type', - params: { - type: 'object' - }, - message: 'should be object' - }; - if (vErrors === null) vErrors = [err]; - else vErrors.push(err); - errors++; - } - validate.errors = vErrors; - return errors === 0; - }; - })(); - refVal1.schema = { - "type": "object", - "properties": { - "topBody": { - "$ref": "#/definitions/border" - }, - "topJoin": { - "$ref": "#/definitions/border" - }, - "topLeft": { - "$ref": "#/definitions/border" - }, - "topRight": { - "$ref": "#/definitions/border" - }, - "bottomBody": { - "$ref": "#/definitions/border" - }, - "bottomJoin": { - "$ref": "#/definitions/border" - }, - "bottomLeft": { - "$ref": "#/definitions/border" - }, - "bottomRight": { - "$ref": "#/definitions/border" - }, - "bodyLeft": { - "$ref": "#/definitions/border" - }, - "bodyRight": { - "$ref": "#/definitions/border" - }, - "bodyJoin": { - "$ref": "#/definitions/border" - }, - "joinBody": { - "$ref": "#/definitions/border" - }, - "joinLeft": { - "$ref": "#/definitions/border" - }, - "joinRight": { - "$ref": "#/definitions/border" - }, - "joinJoin": { - "$ref": "#/definitions/border" - } - }, - "additionalProperties": false - }; - refVal1.errors = null; - refVal[1] = refVal1; - var refVal2 = (function() { - var pattern0 = new RegExp('^[0-9]+$'); - return function validate(data, dataPath, parentData, parentDataProperty, rootData) { - 'use strict'; - var vErrors = null; - var errors = 0; - if (rootData === undefined) rootData = data; - if (typeof data !== "string") { - var err = { - keyword: 'type', - dataPath: (dataPath || '') + "", - schemaPath: '#/type', - params: { - type: 'string' - }, - message: 'should be string' - }; - if (vErrors === null) vErrors = [err]; - else vErrors.push(err); - errors++; - } - validate.errors = vErrors; - return errors === 0; - }; - })(); - refVal2.schema = { - "type": "string" - }; - refVal2.errors = null; - refVal[2] = refVal2; - var refVal3 = (function() { - var pattern0 = new RegExp('^[0-9]+$'); - return function validate(data, dataPath, parentData, parentDataProperty, rootData) { - 'use strict'; - var vErrors = null; - var errors = 0; - if (rootData === undefined) rootData = data; - if ((data && typeof data === "object" && !Array.isArray(data))) { - var errs__0 = errors; - var valid1 = true; - for (var key0 in data) { - var isAdditional0 = !(false || pattern0.test(key0)); - if (isAdditional0) { - valid1 = false; - var err = { - keyword: 'additionalProperties', - dataPath: (dataPath || '') + "", - schemaPath: '#/additionalProperties', - params: { - additionalProperty: '' + key0 + '' - }, - message: 'should NOT have additional properties' - }; - if (vErrors === null) vErrors = [err]; - else vErrors.push(err); - errors++; - } - } - for (var key0 in data) { - if (pattern0.test(key0)) { - var errs_1 = errors; - if (!refVal4(data[key0], (dataPath || '') + '[\'' + key0 + '\']', data, key0, rootData)) { - if (vErrors === null) vErrors = refVal4.errors; - else vErrors = vErrors.concat(refVal4.errors); - errors = vErrors.length; - } - var valid1 = errors === errs_1; - } - } - } else { - var err = { - keyword: 'type', - dataPath: (dataPath || '') + "", - schemaPath: '#/type', - params: { - type: 'object' - }, - message: 'should be object' - }; - if (vErrors === null) vErrors = [err]; - else vErrors.push(err); - errors++; - } - validate.errors = vErrors; - return errors === 0; - }; - })(); - refVal3.schema = { - "type": "object", - "patternProperties": { - "^[0-9]+$": { - "$ref": "#/definitions/column" - } - }, - "additionalProperties": false - }; - refVal3.errors = null; - refVal[3] = refVal3; - var refVal4 = (function() { - var pattern0 = new RegExp('^[0-9]+$'); - return function validate(data, dataPath, parentData, parentDataProperty, rootData) { - 'use strict'; - var vErrors = null; - var errors = 0; - if (rootData === undefined) rootData = data; - if ((data && typeof data === "object" && !Array.isArray(data))) { - var errs__0 = errors; - var valid1 = true; - for (var key0 in data) { - var isAdditional0 = !(false || key0 == 'alignment' || key0 == 'width' || key0 == 'wrapWord' || key0 == 'truncate' || key0 == 'paddingLeft' || key0 == 'paddingRight'); - if (isAdditional0) { - valid1 = false; - var err = { - keyword: 'additionalProperties', - dataPath: (dataPath || '') + "", - schemaPath: '#/additionalProperties', - params: { - additionalProperty: '' + key0 + '' - }, - message: 'should NOT have additional properties' - }; - if (vErrors === null) vErrors = [err]; - else vErrors.push(err); - errors++; - } - } - var data1 = data.alignment; - if (data1 !== undefined) { - var errs_1 = errors; - if (typeof data1 !== "string") { - var err = { - keyword: 'type', - dataPath: (dataPath || '') + '.alignment', - schemaPath: '#/properties/alignment/type', - params: { - type: 'string' - }, - message: 'should be string' - }; - if (vErrors === null) vErrors = [err]; - else vErrors.push(err); - errors++; - } - var schema1 = validate.schema.properties.alignment.enum; - var valid1; - valid1 = false; - for (var i1 = 0; i1 < schema1.length; i1++) - if (equal(data1, schema1[i1])) { - valid1 = true; - break; - } if (!valid1) { - var err = { - keyword: 'enum', - dataPath: (dataPath || '') + '.alignment', - schemaPath: '#/properties/alignment/enum', - params: { - allowedValues: schema1 - }, - message: 'should be equal to one of the allowed values' - }; - if (vErrors === null) vErrors = [err]; - else vErrors.push(err); - errors++; - } - var valid1 = errors === errs_1; - } - if (data.width !== undefined) { - var errs_1 = errors; - if ((typeof data.width !== "number")) { - var err = { - keyword: 'type', - dataPath: (dataPath || '') + '.width', - schemaPath: '#/properties/width/type', - params: { - type: 'number' - }, - message: 'should be number' - }; - if (vErrors === null) vErrors = [err]; - else vErrors.push(err); - errors++; - } - var valid1 = errors === errs_1; - } - if (data.wrapWord !== undefined) { - var errs_1 = errors; - if (typeof data.wrapWord !== "boolean") { - var err = { - keyword: 'type', - dataPath: (dataPath || '') + '.wrapWord', - schemaPath: '#/properties/wrapWord/type', - params: { - type: 'boolean' - }, - message: 'should be boolean' - }; - if (vErrors === null) vErrors = [err]; - else vErrors.push(err); - errors++; - } - var valid1 = errors === errs_1; - } - if (data.truncate !== undefined) { - var errs_1 = errors; - if ((typeof data.truncate !== "number")) { - var err = { - keyword: 'type', - dataPath: (dataPath || '') + '.truncate', - schemaPath: '#/properties/truncate/type', - params: { - type: 'number' - }, - message: 'should be number' - }; - if (vErrors === null) vErrors = [err]; - else vErrors.push(err); - errors++; - } - var valid1 = errors === errs_1; - } - if (data.paddingLeft !== undefined) { - var errs_1 = errors; - if ((typeof data.paddingLeft !== "number")) { - var err = { - keyword: 'type', - dataPath: (dataPath || '') + '.paddingLeft', - schemaPath: '#/properties/paddingLeft/type', - params: { - type: 'number' - }, - message: 'should be number' - }; - if (vErrors === null) vErrors = [err]; - else vErrors.push(err); - errors++; - } - var valid1 = errors === errs_1; - } - if (data.paddingRight !== undefined) { - var errs_1 = errors; - if ((typeof data.paddingRight !== "number")) { - var err = { - keyword: 'type', - dataPath: (dataPath || '') + '.paddingRight', - schemaPath: '#/properties/paddingRight/type', - params: { - type: 'number' - }, - message: 'should be number' - }; - if (vErrors === null) vErrors = [err]; - else vErrors.push(err); - errors++; - } - var valid1 = errors === errs_1; - } - } else { - var err = { - keyword: 'type', - dataPath: (dataPath || '') + "", - schemaPath: '#/type', - params: { - type: 'object' - }, - message: 'should be object' - }; - if (vErrors === null) vErrors = [err]; - else vErrors.push(err); - errors++; - } - validate.errors = vErrors; - return errors === 0; - }; - })(); - refVal4.schema = { - "type": "object", - "properties": { - "alignment": { - "type": "string", - "enum": ["left", "right", "center"] - }, - "width": { - "type": "number" - }, - "wrapWord": { - "type": "boolean" - }, - "truncate": { - "type": "number" - }, - "paddingLeft": { - "type": "number" - }, - "paddingRight": { - "type": "number" - } - }, - "additionalProperties": false - }; - refVal4.errors = null; - refVal[4] = refVal4; - return function validate(data, dataPath, parentData, parentDataProperty, rootData) { - 'use strict'; /*# sourceURL=config.json */ - var vErrors = null; - var errors = 0; - if (rootData === undefined) rootData = data; - if ((data && typeof data === "object" && !Array.isArray(data))) { - var errs__0 = errors; - var valid1 = true; - for (var key0 in data) { - var isAdditional0 = !(false || key0 == 'border' || key0 == 'columns' || key0 == 'columnDefault' || key0 == 'drawHorizontalLine'); - if (isAdditional0) { - valid1 = false; - var err = { - keyword: 'additionalProperties', - dataPath: (dataPath || '') + "", - schemaPath: '#/additionalProperties', - params: { - additionalProperty: '' + key0 + '' - }, - message: 'should NOT have additional properties' - }; - if (vErrors === null) vErrors = [err]; - else vErrors.push(err); - errors++; - } - } - if (data.border !== undefined) { - var errs_1 = errors; - if (!refVal1(data.border, (dataPath || '') + '.border', data, 'border', rootData)) { - if (vErrors === null) vErrors = refVal1.errors; - else vErrors = vErrors.concat(refVal1.errors); - errors = vErrors.length; - } - var valid1 = errors === errs_1; - } - if (data.columns !== undefined) { - var errs_1 = errors; - if (!refVal3(data.columns, (dataPath || '') + '.columns', data, 'columns', rootData)) { - if (vErrors === null) vErrors = refVal3.errors; - else vErrors = vErrors.concat(refVal3.errors); - errors = vErrors.length; - } - var valid1 = errors === errs_1; - } - if (data.columnDefault !== undefined) { - var errs_1 = errors; - if (!refVal[4](data.columnDefault, (dataPath || '') + '.columnDefault', data, 'columnDefault', rootData)) { - if (vErrors === null) vErrors = refVal[4].errors; - else vErrors = vErrors.concat(refVal[4].errors); - errors = vErrors.length; - } - var valid1 = errors === errs_1; - } - if (data.drawHorizontalLine !== undefined) { - var errs_1 = errors; - var errs__1 = errors; - var valid1; - valid1 = typeof data.drawHorizontalLine == "function"; - if (!valid1) { - if (errs__1 == errors) { - var err = { - keyword: 'typeof', - dataPath: (dataPath || '') + '.drawHorizontalLine', - schemaPath: '#/properties/drawHorizontalLine/typeof', - params: { - keyword: 'typeof' - }, - message: 'should pass "typeof" keyword validation' - }; - if (vErrors === null) vErrors = [err]; - else vErrors.push(err); - errors++; - } else { - for (var i1 = errs__1; i1 < errors; i1++) { - var ruleErr1 = vErrors[i1]; - if (ruleErr1.dataPath === undefined) ruleErr1.dataPath = (dataPath || '') + '.drawHorizontalLine'; - if (ruleErr1.schemaPath === undefined) { - ruleErr1.schemaPath = "#/properties/drawHorizontalLine/typeof"; - } - } - } - } - var valid1 = errors === errs_1; - } - } else { - var err = { - keyword: 'type', - dataPath: (dataPath || '') + "", - schemaPath: '#/type', - params: { - type: 'object' - }, - message: 'should be object' +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _validators = _interopRequireDefault(require("../dist/validators")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +// eslint-disable-next-line import/default + +/** + * @param {string} schemaId + * @param {formatData~config} config + * @returns {undefined} + */ +const validateConfig = (schemaId, config = {}) => { + const validate = _validators.default[schemaId]; + + if (!validate(config)) { + const errors = validate.errors.map(error => { + return { + dataPath: error.dataPath, + message: error.message, + params: error.params, + schemaPath: error.schemaPath }; - if (vErrors === null) vErrors = [err]; - else vErrors.push(err); - errors++; - } - validate.errors = vErrors; - return errors === 0; - }; -})(); -validate.schema = { - "$id": "config.json", - "$schema": "http://json-schema.org/draft-07/schema#", - "type": "object", - "properties": { - "border": { - "$ref": "#/definitions/borders" - }, - "columns": { - "$ref": "#/definitions/columns" - }, - "columnDefault": { - "$ref": "#/definitions/column" - }, - "drawHorizontalLine": { - "typeof": "function" - } - }, - "additionalProperties": false, - "definitions": { - "columns": { - "type": "object", - "patternProperties": { - "^[0-9]+$": { - "$ref": "#/definitions/column" - } - }, - "additionalProperties": false - }, - "column": { - "type": "object", - "properties": { - "alignment": { - "type": "string", - "enum": ["left", "right", "center"] - }, - "width": { - "type": "number" - }, - "wrapWord": { - "type": "boolean" - }, - "truncate": { - "type": "number" - }, - "paddingLeft": { - "type": "number" - }, - "paddingRight": { - "type": "number" - } - }, - "additionalProperties": false - }, - "borders": { - "type": "object", - "properties": { - "topBody": { - "$ref": "#/definitions/border" - }, - "topJoin": { - "$ref": "#/definitions/border" - }, - "topLeft": { - "$ref": "#/definitions/border" - }, - "topRight": { - "$ref": "#/definitions/border" - }, - "bottomBody": { - "$ref": "#/definitions/border" - }, - "bottomJoin": { - "$ref": "#/definitions/border" - }, - "bottomLeft": { - "$ref": "#/definitions/border" - }, - "bottomRight": { - "$ref": "#/definitions/border" - }, - "bodyLeft": { - "$ref": "#/definitions/border" - }, - "bodyRight": { - "$ref": "#/definitions/border" - }, - "bodyJoin": { - "$ref": "#/definitions/border" - }, - "joinBody": { - "$ref": "#/definitions/border" - }, - "joinLeft": { - "$ref": "#/definitions/border" - }, - "joinRight": { - "$ref": "#/definitions/border" - }, - "joinJoin": { - "$ref": "#/definitions/border" - } - }, - "additionalProperties": false - }, - "border": { - "type": "string" - } + }); + /* eslint-disable no-console */ + + console.log('config', config); + console.log('errors', errors); + /* eslint-enable no-console */ + + throw new Error('Invalid config.'); } }; -validate.errors = null; -module.exports = validate; \ No newline at end of file + +var _default = validateConfig; +exports.default = _default; +//# sourceMappingURL=validateConfig.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/dist/validateConfig.js.flow b/tools/node_modules/eslint/node_modules/table/dist/validateConfig.js.flow index f0966bd7e797d0..a8eb2e2ed91fdc 100644 --- a/tools/node_modules/eslint/node_modules/table/dist/validateConfig.js.flow +++ b/tools/node_modules/eslint/node_modules/table/dist/validateConfig.js.flow @@ -1,12 +1,5 @@ // eslint-disable-next-line import/default -import validateConfig from '../dist/validateConfig'; -// eslint-disable-next-line import/default -import validateStreamConfig from '../dist/validateStreamConfig'; - -const validate = { - 'config.json': validateConfig, - 'streamConfig.json': validateStreamConfig, -}; +import validators from '../dist/validators'; /** * @param {string} schemaId @@ -14,8 +7,9 @@ const validate = { * @returns {undefined} */ export default (schemaId, config = {}) => { - if (!validate[schemaId](config)) { - const errors = validate[schemaId].errors.map((error) => { + const validate = validators[schemaId]; + if (!validate(config)) { + const errors = validate.errors.map((error) => { return { dataPath: error.dataPath, message: error.message, diff --git a/tools/node_modules/eslint/node_modules/table/dist/validateStreamConfig.js b/tools/node_modules/eslint/node_modules/table/dist/validateStreamConfig.js deleted file mode 100644 index 2c81a1636df753..00000000000000 --- a/tools/node_modules/eslint/node_modules/table/dist/validateStreamConfig.js +++ /dev/null @@ -1,741 +0,0 @@ -'use strict'; -var equal = require('ajv/lib/compile/equal'); -var validate = (function() { - var pattern0 = new RegExp('^[0-9]+$'); - var refVal = []; - var refVal1 = (function() { - var pattern0 = new RegExp('^[0-9]+$'); - return function validate(data, dataPath, parentData, parentDataProperty, rootData) { - 'use strict'; - var vErrors = null; - var errors = 0; - if (rootData === undefined) rootData = data; - if ((data && typeof data === "object" && !Array.isArray(data))) { - var errs__0 = errors; - var valid1 = true; - for (var key0 in data) { - var isAdditional0 = !(false || validate.schema.properties.hasOwnProperty(key0)); - if (isAdditional0) { - valid1 = false; - var err = { - keyword: 'additionalProperties', - dataPath: (dataPath || '') + "", - schemaPath: '#/additionalProperties', - params: { - additionalProperty: '' + key0 + '' - }, - message: 'should NOT have additional properties' - }; - if (vErrors === null) vErrors = [err]; - else vErrors.push(err); - errors++; - } - } - if (data.topBody !== undefined) { - var errs_1 = errors; - if (!refVal2(data.topBody, (dataPath || '') + '.topBody', data, 'topBody', rootData)) { - if (vErrors === null) vErrors = refVal2.errors; - else vErrors = vErrors.concat(refVal2.errors); - errors = vErrors.length; - } - var valid1 = errors === errs_1; - } - if (data.topJoin !== undefined) { - var errs_1 = errors; - if (!refVal[2](data.topJoin, (dataPath || '') + '.topJoin', data, 'topJoin', rootData)) { - if (vErrors === null) vErrors = refVal[2].errors; - else vErrors = vErrors.concat(refVal[2].errors); - errors = vErrors.length; - } - var valid1 = errors === errs_1; - } - if (data.topLeft !== undefined) { - var errs_1 = errors; - if (!refVal[2](data.topLeft, (dataPath || '') + '.topLeft', data, 'topLeft', rootData)) { - if (vErrors === null) vErrors = refVal[2].errors; - else vErrors = vErrors.concat(refVal[2].errors); - errors = vErrors.length; - } - var valid1 = errors === errs_1; - } - if (data.topRight !== undefined) { - var errs_1 = errors; - if (!refVal[2](data.topRight, (dataPath || '') + '.topRight', data, 'topRight', rootData)) { - if (vErrors === null) vErrors = refVal[2].errors; - else vErrors = vErrors.concat(refVal[2].errors); - errors = vErrors.length; - } - var valid1 = errors === errs_1; - } - if (data.bottomBody !== undefined) { - var errs_1 = errors; - if (!refVal[2](data.bottomBody, (dataPath || '') + '.bottomBody', data, 'bottomBody', rootData)) { - if (vErrors === null) vErrors = refVal[2].errors; - else vErrors = vErrors.concat(refVal[2].errors); - errors = vErrors.length; - } - var valid1 = errors === errs_1; - } - if (data.bottomJoin !== undefined) { - var errs_1 = errors; - if (!refVal[2](data.bottomJoin, (dataPath || '') + '.bottomJoin', data, 'bottomJoin', rootData)) { - if (vErrors === null) vErrors = refVal[2].errors; - else vErrors = vErrors.concat(refVal[2].errors); - errors = vErrors.length; - } - var valid1 = errors === errs_1; - } - if (data.bottomLeft !== undefined) { - var errs_1 = errors; - if (!refVal[2](data.bottomLeft, (dataPath || '') + '.bottomLeft', data, 'bottomLeft', rootData)) { - if (vErrors === null) vErrors = refVal[2].errors; - else vErrors = vErrors.concat(refVal[2].errors); - errors = vErrors.length; - } - var valid1 = errors === errs_1; - } - if (data.bottomRight !== undefined) { - var errs_1 = errors; - if (!refVal[2](data.bottomRight, (dataPath || '') + '.bottomRight', data, 'bottomRight', rootData)) { - if (vErrors === null) vErrors = refVal[2].errors; - else vErrors = vErrors.concat(refVal[2].errors); - errors = vErrors.length; - } - var valid1 = errors === errs_1; - } - if (data.bodyLeft !== undefined) { - var errs_1 = errors; - if (!refVal[2](data.bodyLeft, (dataPath || '') + '.bodyLeft', data, 'bodyLeft', rootData)) { - if (vErrors === null) vErrors = refVal[2].errors; - else vErrors = vErrors.concat(refVal[2].errors); - errors = vErrors.length; - } - var valid1 = errors === errs_1; - } - if (data.bodyRight !== undefined) { - var errs_1 = errors; - if (!refVal[2](data.bodyRight, (dataPath || '') + '.bodyRight', data, 'bodyRight', rootData)) { - if (vErrors === null) vErrors = refVal[2].errors; - else vErrors = vErrors.concat(refVal[2].errors); - errors = vErrors.length; - } - var valid1 = errors === errs_1; - } - if (data.bodyJoin !== undefined) { - var errs_1 = errors; - if (!refVal[2](data.bodyJoin, (dataPath || '') + '.bodyJoin', data, 'bodyJoin', rootData)) { - if (vErrors === null) vErrors = refVal[2].errors; - else vErrors = vErrors.concat(refVal[2].errors); - errors = vErrors.length; - } - var valid1 = errors === errs_1; - } - if (data.joinBody !== undefined) { - var errs_1 = errors; - if (!refVal[2](data.joinBody, (dataPath || '') + '.joinBody', data, 'joinBody', rootData)) { - if (vErrors === null) vErrors = refVal[2].errors; - else vErrors = vErrors.concat(refVal[2].errors); - errors = vErrors.length; - } - var valid1 = errors === errs_1; - } - if (data.joinLeft !== undefined) { - var errs_1 = errors; - if (!refVal[2](data.joinLeft, (dataPath || '') + '.joinLeft', data, 'joinLeft', rootData)) { - if (vErrors === null) vErrors = refVal[2].errors; - else vErrors = vErrors.concat(refVal[2].errors); - errors = vErrors.length; - } - var valid1 = errors === errs_1; - } - if (data.joinRight !== undefined) { - var errs_1 = errors; - if (!refVal[2](data.joinRight, (dataPath || '') + '.joinRight', data, 'joinRight', rootData)) { - if (vErrors === null) vErrors = refVal[2].errors; - else vErrors = vErrors.concat(refVal[2].errors); - errors = vErrors.length; - } - var valid1 = errors === errs_1; - } - if (data.joinJoin !== undefined) { - var errs_1 = errors; - if (!refVal[2](data.joinJoin, (dataPath || '') + '.joinJoin', data, 'joinJoin', rootData)) { - if (vErrors === null) vErrors = refVal[2].errors; - else vErrors = vErrors.concat(refVal[2].errors); - errors = vErrors.length; - } - var valid1 = errors === errs_1; - } - } else { - var err = { - keyword: 'type', - dataPath: (dataPath || '') + "", - schemaPath: '#/type', - params: { - type: 'object' - }, - message: 'should be object' - }; - if (vErrors === null) vErrors = [err]; - else vErrors.push(err); - errors++; - } - validate.errors = vErrors; - return errors === 0; - }; - })(); - refVal1.schema = { - "type": "object", - "properties": { - "topBody": { - "$ref": "#/definitions/border" - }, - "topJoin": { - "$ref": "#/definitions/border" - }, - "topLeft": { - "$ref": "#/definitions/border" - }, - "topRight": { - "$ref": "#/definitions/border" - }, - "bottomBody": { - "$ref": "#/definitions/border" - }, - "bottomJoin": { - "$ref": "#/definitions/border" - }, - "bottomLeft": { - "$ref": "#/definitions/border" - }, - "bottomRight": { - "$ref": "#/definitions/border" - }, - "bodyLeft": { - "$ref": "#/definitions/border" - }, - "bodyRight": { - "$ref": "#/definitions/border" - }, - "bodyJoin": { - "$ref": "#/definitions/border" - }, - "joinBody": { - "$ref": "#/definitions/border" - }, - "joinLeft": { - "$ref": "#/definitions/border" - }, - "joinRight": { - "$ref": "#/definitions/border" - }, - "joinJoin": { - "$ref": "#/definitions/border" - } - }, - "additionalProperties": false - }; - refVal1.errors = null; - refVal[1] = refVal1; - var refVal2 = (function() { - var pattern0 = new RegExp('^[0-9]+$'); - return function validate(data, dataPath, parentData, parentDataProperty, rootData) { - 'use strict'; - var vErrors = null; - var errors = 0; - if (rootData === undefined) rootData = data; - if (typeof data !== "string") { - var err = { - keyword: 'type', - dataPath: (dataPath || '') + "", - schemaPath: '#/type', - params: { - type: 'string' - }, - message: 'should be string' - }; - if (vErrors === null) vErrors = [err]; - else vErrors.push(err); - errors++; - } - validate.errors = vErrors; - return errors === 0; - }; - })(); - refVal2.schema = { - "type": "string" - }; - refVal2.errors = null; - refVal[2] = refVal2; - var refVal3 = (function() { - var pattern0 = new RegExp('^[0-9]+$'); - return function validate(data, dataPath, parentData, parentDataProperty, rootData) { - 'use strict'; - var vErrors = null; - var errors = 0; - if (rootData === undefined) rootData = data; - if ((data && typeof data === "object" && !Array.isArray(data))) { - var errs__0 = errors; - var valid1 = true; - for (var key0 in data) { - var isAdditional0 = !(false || pattern0.test(key0)); - if (isAdditional0) { - valid1 = false; - var err = { - keyword: 'additionalProperties', - dataPath: (dataPath || '') + "", - schemaPath: '#/additionalProperties', - params: { - additionalProperty: '' + key0 + '' - }, - message: 'should NOT have additional properties' - }; - if (vErrors === null) vErrors = [err]; - else vErrors.push(err); - errors++; - } - } - for (var key0 in data) { - if (pattern0.test(key0)) { - var errs_1 = errors; - if (!refVal4(data[key0], (dataPath || '') + '[\'' + key0 + '\']', data, key0, rootData)) { - if (vErrors === null) vErrors = refVal4.errors; - else vErrors = vErrors.concat(refVal4.errors); - errors = vErrors.length; - } - var valid1 = errors === errs_1; - } - } - } else { - var err = { - keyword: 'type', - dataPath: (dataPath || '') + "", - schemaPath: '#/type', - params: { - type: 'object' - }, - message: 'should be object' - }; - if (vErrors === null) vErrors = [err]; - else vErrors.push(err); - errors++; - } - validate.errors = vErrors; - return errors === 0; - }; - })(); - refVal3.schema = { - "type": "object", - "patternProperties": { - "^[0-9]+$": { - "$ref": "#/definitions/column" - } - }, - "additionalProperties": false - }; - refVal3.errors = null; - refVal[3] = refVal3; - var refVal4 = (function() { - var pattern0 = new RegExp('^[0-9]+$'); - return function validate(data, dataPath, parentData, parentDataProperty, rootData) { - 'use strict'; - var vErrors = null; - var errors = 0; - if (rootData === undefined) rootData = data; - if ((data && typeof data === "object" && !Array.isArray(data))) { - var errs__0 = errors; - var valid1 = true; - for (var key0 in data) { - var isAdditional0 = !(false || key0 == 'alignment' || key0 == 'width' || key0 == 'wrapWord' || key0 == 'truncate' || key0 == 'paddingLeft' || key0 == 'paddingRight'); - if (isAdditional0) { - valid1 = false; - var err = { - keyword: 'additionalProperties', - dataPath: (dataPath || '') + "", - schemaPath: '#/additionalProperties', - params: { - additionalProperty: '' + key0 + '' - }, - message: 'should NOT have additional properties' - }; - if (vErrors === null) vErrors = [err]; - else vErrors.push(err); - errors++; - } - } - var data1 = data.alignment; - if (data1 !== undefined) { - var errs_1 = errors; - if (typeof data1 !== "string") { - var err = { - keyword: 'type', - dataPath: (dataPath || '') + '.alignment', - schemaPath: '#/properties/alignment/type', - params: { - type: 'string' - }, - message: 'should be string' - }; - if (vErrors === null) vErrors = [err]; - else vErrors.push(err); - errors++; - } - var schema1 = validate.schema.properties.alignment.enum; - var valid1; - valid1 = false; - for (var i1 = 0; i1 < schema1.length; i1++) - if (equal(data1, schema1[i1])) { - valid1 = true; - break; - } if (!valid1) { - var err = { - keyword: 'enum', - dataPath: (dataPath || '') + '.alignment', - schemaPath: '#/properties/alignment/enum', - params: { - allowedValues: schema1 - }, - message: 'should be equal to one of the allowed values' - }; - if (vErrors === null) vErrors = [err]; - else vErrors.push(err); - errors++; - } - var valid1 = errors === errs_1; - } - if (data.width !== undefined) { - var errs_1 = errors; - if ((typeof data.width !== "number")) { - var err = { - keyword: 'type', - dataPath: (dataPath || '') + '.width', - schemaPath: '#/properties/width/type', - params: { - type: 'number' - }, - message: 'should be number' - }; - if (vErrors === null) vErrors = [err]; - else vErrors.push(err); - errors++; - } - var valid1 = errors === errs_1; - } - if (data.wrapWord !== undefined) { - var errs_1 = errors; - if (typeof data.wrapWord !== "boolean") { - var err = { - keyword: 'type', - dataPath: (dataPath || '') + '.wrapWord', - schemaPath: '#/properties/wrapWord/type', - params: { - type: 'boolean' - }, - message: 'should be boolean' - }; - if (vErrors === null) vErrors = [err]; - else vErrors.push(err); - errors++; - } - var valid1 = errors === errs_1; - } - if (data.truncate !== undefined) { - var errs_1 = errors; - if ((typeof data.truncate !== "number")) { - var err = { - keyword: 'type', - dataPath: (dataPath || '') + '.truncate', - schemaPath: '#/properties/truncate/type', - params: { - type: 'number' - }, - message: 'should be number' - }; - if (vErrors === null) vErrors = [err]; - else vErrors.push(err); - errors++; - } - var valid1 = errors === errs_1; - } - if (data.paddingLeft !== undefined) { - var errs_1 = errors; - if ((typeof data.paddingLeft !== "number")) { - var err = { - keyword: 'type', - dataPath: (dataPath || '') + '.paddingLeft', - schemaPath: '#/properties/paddingLeft/type', - params: { - type: 'number' - }, - message: 'should be number' - }; - if (vErrors === null) vErrors = [err]; - else vErrors.push(err); - errors++; - } - var valid1 = errors === errs_1; - } - if (data.paddingRight !== undefined) { - var errs_1 = errors; - if ((typeof data.paddingRight !== "number")) { - var err = { - keyword: 'type', - dataPath: (dataPath || '') + '.paddingRight', - schemaPath: '#/properties/paddingRight/type', - params: { - type: 'number' - }, - message: 'should be number' - }; - if (vErrors === null) vErrors = [err]; - else vErrors.push(err); - errors++; - } - var valid1 = errors === errs_1; - } - } else { - var err = { - keyword: 'type', - dataPath: (dataPath || '') + "", - schemaPath: '#/type', - params: { - type: 'object' - }, - message: 'should be object' - }; - if (vErrors === null) vErrors = [err]; - else vErrors.push(err); - errors++; - } - validate.errors = vErrors; - return errors === 0; - }; - })(); - refVal4.schema = { - "type": "object", - "properties": { - "alignment": { - "type": "string", - "enum": ["left", "right", "center"] - }, - "width": { - "type": "number" - }, - "wrapWord": { - "type": "boolean" - }, - "truncate": { - "type": "number" - }, - "paddingLeft": { - "type": "number" - }, - "paddingRight": { - "type": "number" - } - }, - "additionalProperties": false - }; - refVal4.errors = null; - refVal[4] = refVal4; - return function validate(data, dataPath, parentData, parentDataProperty, rootData) { - 'use strict'; /*# sourceURL=streamConfig.json */ - var vErrors = null; - var errors = 0; - if (rootData === undefined) rootData = data; - if ((data && typeof data === "object" && !Array.isArray(data))) { - var errs__0 = errors; - var valid1 = true; - for (var key0 in data) { - var isAdditional0 = !(false || key0 == 'border' || key0 == 'columns' || key0 == 'columnDefault' || key0 == 'columnCount'); - if (isAdditional0) { - valid1 = false; - var err = { - keyword: 'additionalProperties', - dataPath: (dataPath || '') + "", - schemaPath: '#/additionalProperties', - params: { - additionalProperty: '' + key0 + '' - }, - message: 'should NOT have additional properties' - }; - if (vErrors === null) vErrors = [err]; - else vErrors.push(err); - errors++; - } - } - if (data.border !== undefined) { - var errs_1 = errors; - if (!refVal1(data.border, (dataPath || '') + '.border', data, 'border', rootData)) { - if (vErrors === null) vErrors = refVal1.errors; - else vErrors = vErrors.concat(refVal1.errors); - errors = vErrors.length; - } - var valid1 = errors === errs_1; - } - if (data.columns !== undefined) { - var errs_1 = errors; - if (!refVal3(data.columns, (dataPath || '') + '.columns', data, 'columns', rootData)) { - if (vErrors === null) vErrors = refVal3.errors; - else vErrors = vErrors.concat(refVal3.errors); - errors = vErrors.length; - } - var valid1 = errors === errs_1; - } - if (data.columnDefault !== undefined) { - var errs_1 = errors; - if (!refVal[4](data.columnDefault, (dataPath || '') + '.columnDefault', data, 'columnDefault', rootData)) { - if (vErrors === null) vErrors = refVal[4].errors; - else vErrors = vErrors.concat(refVal[4].errors); - errors = vErrors.length; - } - var valid1 = errors === errs_1; - } - if (data.columnCount !== undefined) { - var errs_1 = errors; - if ((typeof data.columnCount !== "number")) { - var err = { - keyword: 'type', - dataPath: (dataPath || '') + '.columnCount', - schemaPath: '#/properties/columnCount/type', - params: { - type: 'number' - }, - message: 'should be number' - }; - if (vErrors === null) vErrors = [err]; - else vErrors.push(err); - errors++; - } - var valid1 = errors === errs_1; - } - } else { - var err = { - keyword: 'type', - dataPath: (dataPath || '') + "", - schemaPath: '#/type', - params: { - type: 'object' - }, - message: 'should be object' - }; - if (vErrors === null) vErrors = [err]; - else vErrors.push(err); - errors++; - } - validate.errors = vErrors; - return errors === 0; - }; -})(); -validate.schema = { - "$id": "streamConfig.json", - "$schema": "http://json-schema.org/draft-07/schema#", - "type": "object", - "properties": { - "border": { - "$ref": "#/definitions/borders" - }, - "columns": { - "$ref": "#/definitions/columns" - }, - "columnDefault": { - "$ref": "#/definitions/column" - }, - "columnCount": { - "type": "number" - } - }, - "additionalProperties": false, - "definitions": { - "columns": { - "type": "object", - "patternProperties": { - "^[0-9]+$": { - "$ref": "#/definitions/column" - } - }, - "additionalProperties": false - }, - "column": { - "type": "object", - "properties": { - "alignment": { - "type": "string", - "enum": ["left", "right", "center"] - }, - "width": { - "type": "number" - }, - "wrapWord": { - "type": "boolean" - }, - "truncate": { - "type": "number" - }, - "paddingLeft": { - "type": "number" - }, - "paddingRight": { - "type": "number" - } - }, - "additionalProperties": false - }, - "borders": { - "type": "object", - "properties": { - "topBody": { - "$ref": "#/definitions/border" - }, - "topJoin": { - "$ref": "#/definitions/border" - }, - "topLeft": { - "$ref": "#/definitions/border" - }, - "topRight": { - "$ref": "#/definitions/border" - }, - "bottomBody": { - "$ref": "#/definitions/border" - }, - "bottomJoin": { - "$ref": "#/definitions/border" - }, - "bottomLeft": { - "$ref": "#/definitions/border" - }, - "bottomRight": { - "$ref": "#/definitions/border" - }, - "bodyLeft": { - "$ref": "#/definitions/border" - }, - "bodyRight": { - "$ref": "#/definitions/border" - }, - "bodyJoin": { - "$ref": "#/definitions/border" - }, - "joinBody": { - "$ref": "#/definitions/border" - }, - "joinLeft": { - "$ref": "#/definitions/border" - }, - "joinRight": { - "$ref": "#/definitions/border" - }, - "joinJoin": { - "$ref": "#/definitions/border" - } - }, - "additionalProperties": false - }, - "border": { - "type": "string" - } - } -}; -validate.errors = null; -module.exports = validate; \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/dist/validators.js b/tools/node_modules/eslint/node_modules/table/dist/validators.js new file mode 100644 index 00000000000000..c03925ab5d323d --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/dist/validators.js @@ -0,0 +1,1472 @@ +"use strict"; +exports["config.json"] = validate43; +const schema13 = { + "$id": "config.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "border": { + "$ref": "shared.json#/definitions/borders" + }, + "columns": { + "$ref": "shared.json#/definitions/columns" + }, + "columnDefault": { + "$ref": "shared.json#/definitions/column" + }, + "drawHorizontalLine": { + "typeof": "function" + } + }, + "additionalProperties": false +}; +const schema15 = { + "type": "object", + "properties": { + "topBody": { + "$ref": "#/definitions/border" + }, + "topJoin": { + "$ref": "#/definitions/border" + }, + "topLeft": { + "$ref": "#/definitions/border" + }, + "topRight": { + "$ref": "#/definitions/border" + }, + "bottomBody": { + "$ref": "#/definitions/border" + }, + "bottomJoin": { + "$ref": "#/definitions/border" + }, + "bottomLeft": { + "$ref": "#/definitions/border" + }, + "bottomRight": { + "$ref": "#/definitions/border" + }, + "bodyLeft": { + "$ref": "#/definitions/border" + }, + "bodyRight": { + "$ref": "#/definitions/border" + }, + "bodyJoin": { + "$ref": "#/definitions/border" + }, + "joinBody": { + "$ref": "#/definitions/border" + }, + "joinLeft": { + "$ref": "#/definitions/border" + }, + "joinRight": { + "$ref": "#/definitions/border" + }, + "joinJoin": { + "$ref": "#/definitions/border" + } + }, + "additionalProperties": false +}; +const schema16 = { + "type": "string" +}; + +function validate46(data, { + dataPath = "", + parentData, + parentDataProperty, + rootData = data +} = {}) { + let vErrors = null; + let errors = 0; + if (typeof data !== "string") { + const err0 = { + keyword: "type", + dataPath, + schemaPath: "#/type", + params: { + type: "string" + }, + message: "should be string" + }; + if (vErrors === null) { + vErrors = [err0]; + } else { + vErrors.push(err0); + } + errors++; + } + validate46.errors = vErrors; + return errors === 0; +} + +function validate45(data, { + dataPath = "", + parentData, + parentDataProperty, + rootData = data +} = {}) { + let vErrors = null; + let errors = 0; + if (data && typeof data == "object" && !Array.isArray(data)) { + for (const key0 in data) { + if (!(schema15.properties.hasOwnProperty(key0))) { + const err0 = { + keyword: "additionalProperties", + dataPath, + schemaPath: "#/additionalProperties", + params: { + additionalProperty: key0 + }, + message: "should NOT have additional properties" + }; + if (vErrors === null) { + vErrors = [err0]; + } else { + vErrors.push(err0); + } + errors++; + } + } + if (data.topBody !== undefined) { + if (!(validate46(data.topBody, { + dataPath: dataPath + "/topBody", + parentData: data, + parentDataProperty: "topBody", + rootData + }))) { + vErrors = vErrors === null ? validate46.errors : vErrors.concat(validate46.errors); + errors = vErrors.length; + } + } + if (data.topJoin !== undefined) { + if (!(validate46(data.topJoin, { + dataPath: dataPath + "/topJoin", + parentData: data, + parentDataProperty: "topJoin", + rootData + }))) { + vErrors = vErrors === null ? validate46.errors : vErrors.concat(validate46.errors); + errors = vErrors.length; + } + } + if (data.topLeft !== undefined) { + if (!(validate46(data.topLeft, { + dataPath: dataPath + "/topLeft", + parentData: data, + parentDataProperty: "topLeft", + rootData + }))) { + vErrors = vErrors === null ? validate46.errors : vErrors.concat(validate46.errors); + errors = vErrors.length; + } + } + if (data.topRight !== undefined) { + if (!(validate46(data.topRight, { + dataPath: dataPath + "/topRight", + parentData: data, + parentDataProperty: "topRight", + rootData + }))) { + vErrors = vErrors === null ? validate46.errors : vErrors.concat(validate46.errors); + errors = vErrors.length; + } + } + if (data.bottomBody !== undefined) { + if (!(validate46(data.bottomBody, { + dataPath: dataPath + "/bottomBody", + parentData: data, + parentDataProperty: "bottomBody", + rootData + }))) { + vErrors = vErrors === null ? validate46.errors : vErrors.concat(validate46.errors); + errors = vErrors.length; + } + } + if (data.bottomJoin !== undefined) { + if (!(validate46(data.bottomJoin, { + dataPath: dataPath + "/bottomJoin", + parentData: data, + parentDataProperty: "bottomJoin", + rootData + }))) { + vErrors = vErrors === null ? validate46.errors : vErrors.concat(validate46.errors); + errors = vErrors.length; + } + } + if (data.bottomLeft !== undefined) { + if (!(validate46(data.bottomLeft, { + dataPath: dataPath + "/bottomLeft", + parentData: data, + parentDataProperty: "bottomLeft", + rootData + }))) { + vErrors = vErrors === null ? validate46.errors : vErrors.concat(validate46.errors); + errors = vErrors.length; + } + } + if (data.bottomRight !== undefined) { + if (!(validate46(data.bottomRight, { + dataPath: dataPath + "/bottomRight", + parentData: data, + parentDataProperty: "bottomRight", + rootData + }))) { + vErrors = vErrors === null ? validate46.errors : vErrors.concat(validate46.errors); + errors = vErrors.length; + } + } + if (data.bodyLeft !== undefined) { + if (!(validate46(data.bodyLeft, { + dataPath: dataPath + "/bodyLeft", + parentData: data, + parentDataProperty: "bodyLeft", + rootData + }))) { + vErrors = vErrors === null ? validate46.errors : vErrors.concat(validate46.errors); + errors = vErrors.length; + } + } + if (data.bodyRight !== undefined) { + if (!(validate46(data.bodyRight, { + dataPath: dataPath + "/bodyRight", + parentData: data, + parentDataProperty: "bodyRight", + rootData + }))) { + vErrors = vErrors === null ? validate46.errors : vErrors.concat(validate46.errors); + errors = vErrors.length; + } + } + if (data.bodyJoin !== undefined) { + if (!(validate46(data.bodyJoin, { + dataPath: dataPath + "/bodyJoin", + parentData: data, + parentDataProperty: "bodyJoin", + rootData + }))) { + vErrors = vErrors === null ? validate46.errors : vErrors.concat(validate46.errors); + errors = vErrors.length; + } + } + if (data.joinBody !== undefined) { + if (!(validate46(data.joinBody, { + dataPath: dataPath + "/joinBody", + parentData: data, + parentDataProperty: "joinBody", + rootData + }))) { + vErrors = vErrors === null ? validate46.errors : vErrors.concat(validate46.errors); + errors = vErrors.length; + } + } + if (data.joinLeft !== undefined) { + if (!(validate46(data.joinLeft, { + dataPath: dataPath + "/joinLeft", + parentData: data, + parentDataProperty: "joinLeft", + rootData + }))) { + vErrors = vErrors === null ? validate46.errors : vErrors.concat(validate46.errors); + errors = vErrors.length; + } + } + if (data.joinRight !== undefined) { + if (!(validate46(data.joinRight, { + dataPath: dataPath + "/joinRight", + parentData: data, + parentDataProperty: "joinRight", + rootData + }))) { + vErrors = vErrors === null ? validate46.errors : vErrors.concat(validate46.errors); + errors = vErrors.length; + } + } + if (data.joinJoin !== undefined) { + if (!(validate46(data.joinJoin, { + dataPath: dataPath + "/joinJoin", + parentData: data, + parentDataProperty: "joinJoin", + rootData + }))) { + vErrors = vErrors === null ? validate46.errors : vErrors.concat(validate46.errors); + errors = vErrors.length; + } + } + } else { + const err1 = { + keyword: "type", + dataPath, + schemaPath: "#/type", + params: { + type: "object" + }, + message: "should be object" + }; + if (vErrors === null) { + vErrors = [err1]; + } else { + vErrors.push(err1); + } + errors++; + } + validate45.errors = vErrors; + return errors === 0; +} +const schema17 = { + "type": "object", + "patternProperties": { + "^[0-9]+$": { + "$ref": "#/definitions/column" + } + }, + "additionalProperties": false +}; +const pattern0 = new RegExp("^[0-9]+$", "u"); +const schema18 = { + "type": "object", + "properties": { + "alignment": { + "type": "string", + "enum": ["left", "right", "center"] + }, + "width": { + "type": "number" + }, + "wrapWord": { + "type": "boolean" + }, + "truncate": { + "type": "number" + }, + "paddingLeft": { + "type": "number" + }, + "paddingRight": { + "type": "number" + } + }, + "additionalProperties": false +}; +const func0 = require("ajv/dist/compile/equal"); + +function validate64(data, { + dataPath = "", + parentData, + parentDataProperty, + rootData = data +} = {}) { + let vErrors = null; + let errors = 0; + if (data && typeof data == "object" && !Array.isArray(data)) { + for (const key0 in data) { + if (!((((((key0 === "alignment") || (key0 === "width")) || (key0 === "wrapWord")) || (key0 === "truncate")) || (key0 === "paddingLeft")) || (key0 === "paddingRight"))) { + const err0 = { + keyword: "additionalProperties", + dataPath, + schemaPath: "#/additionalProperties", + params: { + additionalProperty: key0 + }, + message: "should NOT have additional properties" + }; + if (vErrors === null) { + vErrors = [err0]; + } else { + vErrors.push(err0); + } + errors++; + } + } + if (data.alignment !== undefined) { + let data0 = data.alignment; + if (typeof data0 !== "string") { + const err1 = { + keyword: "type", + dataPath: dataPath + "/alignment", + schemaPath: "#/properties/alignment/type", + params: { + type: "string" + }, + message: "should be string" + }; + if (vErrors === null) { + vErrors = [err1]; + } else { + vErrors.push(err1); + } + errors++; + } + if (!(((data0 === "left") || (data0 === "right")) || (data0 === "center"))) { + const err2 = { + keyword: "enum", + dataPath: dataPath + "/alignment", + schemaPath: "#/properties/alignment/enum", + params: { + allowedValues: schema18.properties.alignment.enum + }, + message: "should be equal to one of the allowed values" + }; + if (vErrors === null) { + vErrors = [err2]; + } else { + vErrors.push(err2); + } + errors++; + } + } + if (data.width !== undefined) { + let data1 = data.width; + if (!((typeof data1 == "number") && (isFinite(data1)))) { + const err3 = { + keyword: "type", + dataPath: dataPath + "/width", + schemaPath: "#/properties/width/type", + params: { + type: "number" + }, + message: "should be number" + }; + if (vErrors === null) { + vErrors = [err3]; + } else { + vErrors.push(err3); + } + errors++; + } + } + if (data.wrapWord !== undefined) { + if (typeof data.wrapWord !== "boolean") { + const err4 = { + keyword: "type", + dataPath: dataPath + "/wrapWord", + schemaPath: "#/properties/wrapWord/type", + params: { + type: "boolean" + }, + message: "should be boolean" + }; + if (vErrors === null) { + vErrors = [err4]; + } else { + vErrors.push(err4); + } + errors++; + } + } + if (data.truncate !== undefined) { + let data3 = data.truncate; + if (!((typeof data3 == "number") && (isFinite(data3)))) { + const err5 = { + keyword: "type", + dataPath: dataPath + "/truncate", + schemaPath: "#/properties/truncate/type", + params: { + type: "number" + }, + message: "should be number" + }; + if (vErrors === null) { + vErrors = [err5]; + } else { + vErrors.push(err5); + } + errors++; + } + } + if (data.paddingLeft !== undefined) { + let data4 = data.paddingLeft; + if (!((typeof data4 == "number") && (isFinite(data4)))) { + const err6 = { + keyword: "type", + dataPath: dataPath + "/paddingLeft", + schemaPath: "#/properties/paddingLeft/type", + params: { + type: "number" + }, + message: "should be number" + }; + if (vErrors === null) { + vErrors = [err6]; + } else { + vErrors.push(err6); + } + errors++; + } + } + if (data.paddingRight !== undefined) { + let data5 = data.paddingRight; + if (!((typeof data5 == "number") && (isFinite(data5)))) { + const err7 = { + keyword: "type", + dataPath: dataPath + "/paddingRight", + schemaPath: "#/properties/paddingRight/type", + params: { + type: "number" + }, + message: "should be number" + }; + if (vErrors === null) { + vErrors = [err7]; + } else { + vErrors.push(err7); + } + errors++; + } + } + } else { + const err8 = { + keyword: "type", + dataPath, + schemaPath: "#/type", + params: { + type: "object" + }, + message: "should be object" + }; + if (vErrors === null) { + vErrors = [err8]; + } else { + vErrors.push(err8); + } + errors++; + } + validate64.errors = vErrors; + return errors === 0; +} + +function validate63(data, { + dataPath = "", + parentData, + parentDataProperty, + rootData = data +} = {}) { + let vErrors = null; + let errors = 0; + if (data && typeof data == "object" && !Array.isArray(data)) { + for (const key0 in data) { + if (!(pattern0.test(key0))) { + const err0 = { + keyword: "additionalProperties", + dataPath, + schemaPath: "#/additionalProperties", + params: { + additionalProperty: key0 + }, + message: "should NOT have additional properties" + }; + if (vErrors === null) { + vErrors = [err0]; + } else { + vErrors.push(err0); + } + errors++; + } + } + for (const key1 in data) { + if (pattern0.test(key1)) { + if (!(validate64(data[key1], { + dataPath: dataPath + "/" + key1.replace(/~/g, "~0").replace(/\//g, "~1"), + parentData: data, + parentDataProperty: key1, + rootData + }))) { + vErrors = vErrors === null ? validate64.errors : vErrors.concat(validate64.errors); + errors = vErrors.length; + } + } + } + } else { + const err1 = { + keyword: "type", + dataPath, + schemaPath: "#/type", + params: { + type: "object" + }, + message: "should be object" + }; + if (vErrors === null) { + vErrors = [err1]; + } else { + vErrors.push(err1); + } + errors++; + } + validate63.errors = vErrors; + return errors === 0; +} + +function validate67(data, { + dataPath = "", + parentData, + parentDataProperty, + rootData = data +} = {}) { + let vErrors = null; + let errors = 0; + if (data && typeof data == "object" && !Array.isArray(data)) { + for (const key0 in data) { + if (!((((((key0 === "alignment") || (key0 === "width")) || (key0 === "wrapWord")) || (key0 === "truncate")) || (key0 === "paddingLeft")) || (key0 === "paddingRight"))) { + const err0 = { + keyword: "additionalProperties", + dataPath, + schemaPath: "#/additionalProperties", + params: { + additionalProperty: key0 + }, + message: "should NOT have additional properties" + }; + if (vErrors === null) { + vErrors = [err0]; + } else { + vErrors.push(err0); + } + errors++; + } + } + if (data.alignment !== undefined) { + let data0 = data.alignment; + if (typeof data0 !== "string") { + const err1 = { + keyword: "type", + dataPath: dataPath + "/alignment", + schemaPath: "#/properties/alignment/type", + params: { + type: "string" + }, + message: "should be string" + }; + if (vErrors === null) { + vErrors = [err1]; + } else { + vErrors.push(err1); + } + errors++; + } + if (!(((data0 === "left") || (data0 === "right")) || (data0 === "center"))) { + const err2 = { + keyword: "enum", + dataPath: dataPath + "/alignment", + schemaPath: "#/properties/alignment/enum", + params: { + allowedValues: schema18.properties.alignment.enum + }, + message: "should be equal to one of the allowed values" + }; + if (vErrors === null) { + vErrors = [err2]; + } else { + vErrors.push(err2); + } + errors++; + } + } + if (data.width !== undefined) { + let data1 = data.width; + if (!((typeof data1 == "number") && (isFinite(data1)))) { + const err3 = { + keyword: "type", + dataPath: dataPath + "/width", + schemaPath: "#/properties/width/type", + params: { + type: "number" + }, + message: "should be number" + }; + if (vErrors === null) { + vErrors = [err3]; + } else { + vErrors.push(err3); + } + errors++; + } + } + if (data.wrapWord !== undefined) { + if (typeof data.wrapWord !== "boolean") { + const err4 = { + keyword: "type", + dataPath: dataPath + "/wrapWord", + schemaPath: "#/properties/wrapWord/type", + params: { + type: "boolean" + }, + message: "should be boolean" + }; + if (vErrors === null) { + vErrors = [err4]; + } else { + vErrors.push(err4); + } + errors++; + } + } + if (data.truncate !== undefined) { + let data3 = data.truncate; + if (!((typeof data3 == "number") && (isFinite(data3)))) { + const err5 = { + keyword: "type", + dataPath: dataPath + "/truncate", + schemaPath: "#/properties/truncate/type", + params: { + type: "number" + }, + message: "should be number" + }; + if (vErrors === null) { + vErrors = [err5]; + } else { + vErrors.push(err5); + } + errors++; + } + } + if (data.paddingLeft !== undefined) { + let data4 = data.paddingLeft; + if (!((typeof data4 == "number") && (isFinite(data4)))) { + const err6 = { + keyword: "type", + dataPath: dataPath + "/paddingLeft", + schemaPath: "#/properties/paddingLeft/type", + params: { + type: "number" + }, + message: "should be number" + }; + if (vErrors === null) { + vErrors = [err6]; + } else { + vErrors.push(err6); + } + errors++; + } + } + if (data.paddingRight !== undefined) { + let data5 = data.paddingRight; + if (!((typeof data5 == "number") && (isFinite(data5)))) { + const err7 = { + keyword: "type", + dataPath: dataPath + "/paddingRight", + schemaPath: "#/properties/paddingRight/type", + params: { + type: "number" + }, + message: "should be number" + }; + if (vErrors === null) { + vErrors = [err7]; + } else { + vErrors.push(err7); + } + errors++; + } + } + } else { + const err8 = { + keyword: "type", + dataPath, + schemaPath: "#/type", + params: { + type: "object" + }, + message: "should be object" + }; + if (vErrors === null) { + vErrors = [err8]; + } else { + vErrors.push(err8); + } + errors++; + } + validate67.errors = vErrors; + return errors === 0; +} + +function validate43(data, { + dataPath = "", + parentData, + parentDataProperty, + rootData = data +} = {}) { + /*# sourceURL="config.json" */ ; + let vErrors = null; + let errors = 0; + if (data && typeof data == "object" && !Array.isArray(data)) { + for (const key0 in data) { + if (!((((key0 === "border") || (key0 === "columns")) || (key0 === "columnDefault")) || (key0 === "drawHorizontalLine"))) { + const err0 = { + keyword: "additionalProperties", + dataPath, + schemaPath: "#/additionalProperties", + params: { + additionalProperty: key0 + }, + message: "should NOT have additional properties" + }; + if (vErrors === null) { + vErrors = [err0]; + } else { + vErrors.push(err0); + } + errors++; + } + } + if (data.border !== undefined) { + if (!(validate45(data.border, { + dataPath: dataPath + "/border", + parentData: data, + parentDataProperty: "border", + rootData + }))) { + vErrors = vErrors === null ? validate45.errors : vErrors.concat(validate45.errors); + errors = vErrors.length; + } + } + if (data.columns !== undefined) { + if (!(validate63(data.columns, { + dataPath: dataPath + "/columns", + parentData: data, + parentDataProperty: "columns", + rootData + }))) { + vErrors = vErrors === null ? validate63.errors : vErrors.concat(validate63.errors); + errors = vErrors.length; + } + } + if (data.columnDefault !== undefined) { + if (!(validate67(data.columnDefault, { + dataPath: dataPath + "/columnDefault", + parentData: data, + parentDataProperty: "columnDefault", + rootData + }))) { + vErrors = vErrors === null ? validate67.errors : vErrors.concat(validate67.errors); + errors = vErrors.length; + } + } + if (data.drawHorizontalLine !== undefined) { + if (typeof data.drawHorizontalLine != "function") { + const err1 = { + keyword: "typeof", + dataPath: dataPath + "/drawHorizontalLine", + schemaPath: "#/properties/drawHorizontalLine/typeof", + params: {}, + message: "should pass \"typeof\" keyword validation" + }; + if (vErrors === null) { + vErrors = [err1]; + } else { + vErrors.push(err1); + } + errors++; + } + } + } else { + const err2 = { + keyword: "type", + dataPath, + schemaPath: "#/type", + params: { + type: "object" + }, + message: "should be object" + }; + if (vErrors === null) { + vErrors = [err2]; + } else { + vErrors.push(err2); + } + errors++; + } + validate43.errors = vErrors; + return errors === 0; +} +exports["streamConfig.json"] = validate69; +const schema20 = { + "$id": "streamConfig.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "border": { + "$ref": "shared.json#/definitions/borders" + }, + "columns": { + "$ref": "shared.json#/definitions/columns" + }, + "columnDefault": { + "$ref": "shared.json#/definitions/column" + }, + "columnCount": { + "type": "number" + } + }, + "additionalProperties": false +}; + +function validate70(data, { + dataPath = "", + parentData, + parentDataProperty, + rootData = data +} = {}) { + let vErrors = null; + let errors = 0; + if (data && typeof data == "object" && !Array.isArray(data)) { + for (const key0 in data) { + if (!(schema15.properties.hasOwnProperty(key0))) { + const err0 = { + keyword: "additionalProperties", + dataPath, + schemaPath: "#/additionalProperties", + params: { + additionalProperty: key0 + }, + message: "should NOT have additional properties" + }; + if (vErrors === null) { + vErrors = [err0]; + } else { + vErrors.push(err0); + } + errors++; + } + } + if (data.topBody !== undefined) { + if (!(validate46(data.topBody, { + dataPath: dataPath + "/topBody", + parentData: data, + parentDataProperty: "topBody", + rootData + }))) { + vErrors = vErrors === null ? validate46.errors : vErrors.concat(validate46.errors); + errors = vErrors.length; + } + } + if (data.topJoin !== undefined) { + if (!(validate46(data.topJoin, { + dataPath: dataPath + "/topJoin", + parentData: data, + parentDataProperty: "topJoin", + rootData + }))) { + vErrors = vErrors === null ? validate46.errors : vErrors.concat(validate46.errors); + errors = vErrors.length; + } + } + if (data.topLeft !== undefined) { + if (!(validate46(data.topLeft, { + dataPath: dataPath + "/topLeft", + parentData: data, + parentDataProperty: "topLeft", + rootData + }))) { + vErrors = vErrors === null ? validate46.errors : vErrors.concat(validate46.errors); + errors = vErrors.length; + } + } + if (data.topRight !== undefined) { + if (!(validate46(data.topRight, { + dataPath: dataPath + "/topRight", + parentData: data, + parentDataProperty: "topRight", + rootData + }))) { + vErrors = vErrors === null ? validate46.errors : vErrors.concat(validate46.errors); + errors = vErrors.length; + } + } + if (data.bottomBody !== undefined) { + if (!(validate46(data.bottomBody, { + dataPath: dataPath + "/bottomBody", + parentData: data, + parentDataProperty: "bottomBody", + rootData + }))) { + vErrors = vErrors === null ? validate46.errors : vErrors.concat(validate46.errors); + errors = vErrors.length; + } + } + if (data.bottomJoin !== undefined) { + if (!(validate46(data.bottomJoin, { + dataPath: dataPath + "/bottomJoin", + parentData: data, + parentDataProperty: "bottomJoin", + rootData + }))) { + vErrors = vErrors === null ? validate46.errors : vErrors.concat(validate46.errors); + errors = vErrors.length; + } + } + if (data.bottomLeft !== undefined) { + if (!(validate46(data.bottomLeft, { + dataPath: dataPath + "/bottomLeft", + parentData: data, + parentDataProperty: "bottomLeft", + rootData + }))) { + vErrors = vErrors === null ? validate46.errors : vErrors.concat(validate46.errors); + errors = vErrors.length; + } + } + if (data.bottomRight !== undefined) { + if (!(validate46(data.bottomRight, { + dataPath: dataPath + "/bottomRight", + parentData: data, + parentDataProperty: "bottomRight", + rootData + }))) { + vErrors = vErrors === null ? validate46.errors : vErrors.concat(validate46.errors); + errors = vErrors.length; + } + } + if (data.bodyLeft !== undefined) { + if (!(validate46(data.bodyLeft, { + dataPath: dataPath + "/bodyLeft", + parentData: data, + parentDataProperty: "bodyLeft", + rootData + }))) { + vErrors = vErrors === null ? validate46.errors : vErrors.concat(validate46.errors); + errors = vErrors.length; + } + } + if (data.bodyRight !== undefined) { + if (!(validate46(data.bodyRight, { + dataPath: dataPath + "/bodyRight", + parentData: data, + parentDataProperty: "bodyRight", + rootData + }))) { + vErrors = vErrors === null ? validate46.errors : vErrors.concat(validate46.errors); + errors = vErrors.length; + } + } + if (data.bodyJoin !== undefined) { + if (!(validate46(data.bodyJoin, { + dataPath: dataPath + "/bodyJoin", + parentData: data, + parentDataProperty: "bodyJoin", + rootData + }))) { + vErrors = vErrors === null ? validate46.errors : vErrors.concat(validate46.errors); + errors = vErrors.length; + } + } + if (data.joinBody !== undefined) { + if (!(validate46(data.joinBody, { + dataPath: dataPath + "/joinBody", + parentData: data, + parentDataProperty: "joinBody", + rootData + }))) { + vErrors = vErrors === null ? validate46.errors : vErrors.concat(validate46.errors); + errors = vErrors.length; + } + } + if (data.joinLeft !== undefined) { + if (!(validate46(data.joinLeft, { + dataPath: dataPath + "/joinLeft", + parentData: data, + parentDataProperty: "joinLeft", + rootData + }))) { + vErrors = vErrors === null ? validate46.errors : vErrors.concat(validate46.errors); + errors = vErrors.length; + } + } + if (data.joinRight !== undefined) { + if (!(validate46(data.joinRight, { + dataPath: dataPath + "/joinRight", + parentData: data, + parentDataProperty: "joinRight", + rootData + }))) { + vErrors = vErrors === null ? validate46.errors : vErrors.concat(validate46.errors); + errors = vErrors.length; + } + } + if (data.joinJoin !== undefined) { + if (!(validate46(data.joinJoin, { + dataPath: dataPath + "/joinJoin", + parentData: data, + parentDataProperty: "joinJoin", + rootData + }))) { + vErrors = vErrors === null ? validate46.errors : vErrors.concat(validate46.errors); + errors = vErrors.length; + } + } + } else { + const err1 = { + keyword: "type", + dataPath, + schemaPath: "#/type", + params: { + type: "object" + }, + message: "should be object" + }; + if (vErrors === null) { + vErrors = [err1]; + } else { + vErrors.push(err1); + } + errors++; + } + validate70.errors = vErrors; + return errors === 0; +} + +function validate87(data, { + dataPath = "", + parentData, + parentDataProperty, + rootData = data +} = {}) { + let vErrors = null; + let errors = 0; + if (data && typeof data == "object" && !Array.isArray(data)) { + for (const key0 in data) { + if (!(pattern0.test(key0))) { + const err0 = { + keyword: "additionalProperties", + dataPath, + schemaPath: "#/additionalProperties", + params: { + additionalProperty: key0 + }, + message: "should NOT have additional properties" + }; + if (vErrors === null) { + vErrors = [err0]; + } else { + vErrors.push(err0); + } + errors++; + } + } + for (const key1 in data) { + if (pattern0.test(key1)) { + if (!(validate64(data[key1], { + dataPath: dataPath + "/" + key1.replace(/~/g, "~0").replace(/\//g, "~1"), + parentData: data, + parentDataProperty: key1, + rootData + }))) { + vErrors = vErrors === null ? validate64.errors : vErrors.concat(validate64.errors); + errors = vErrors.length; + } + } + } + } else { + const err1 = { + keyword: "type", + dataPath, + schemaPath: "#/type", + params: { + type: "object" + }, + message: "should be object" + }; + if (vErrors === null) { + vErrors = [err1]; + } else { + vErrors.push(err1); + } + errors++; + } + validate87.errors = vErrors; + return errors === 0; +} + +function validate90(data, { + dataPath = "", + parentData, + parentDataProperty, + rootData = data +} = {}) { + let vErrors = null; + let errors = 0; + if (data && typeof data == "object" && !Array.isArray(data)) { + for (const key0 in data) { + if (!((((((key0 === "alignment") || (key0 === "width")) || (key0 === "wrapWord")) || (key0 === "truncate")) || (key0 === "paddingLeft")) || (key0 === "paddingRight"))) { + const err0 = { + keyword: "additionalProperties", + dataPath, + schemaPath: "#/additionalProperties", + params: { + additionalProperty: key0 + }, + message: "should NOT have additional properties" + }; + if (vErrors === null) { + vErrors = [err0]; + } else { + vErrors.push(err0); + } + errors++; + } + } + if (data.alignment !== undefined) { + let data0 = data.alignment; + if (typeof data0 !== "string") { + const err1 = { + keyword: "type", + dataPath: dataPath + "/alignment", + schemaPath: "#/properties/alignment/type", + params: { + type: "string" + }, + message: "should be string" + }; + if (vErrors === null) { + vErrors = [err1]; + } else { + vErrors.push(err1); + } + errors++; + } + if (!(((data0 === "left") || (data0 === "right")) || (data0 === "center"))) { + const err2 = { + keyword: "enum", + dataPath: dataPath + "/alignment", + schemaPath: "#/properties/alignment/enum", + params: { + allowedValues: schema18.properties.alignment.enum + }, + message: "should be equal to one of the allowed values" + }; + if (vErrors === null) { + vErrors = [err2]; + } else { + vErrors.push(err2); + } + errors++; + } + } + if (data.width !== undefined) { + let data1 = data.width; + if (!((typeof data1 == "number") && (isFinite(data1)))) { + const err3 = { + keyword: "type", + dataPath: dataPath + "/width", + schemaPath: "#/properties/width/type", + params: { + type: "number" + }, + message: "should be number" + }; + if (vErrors === null) { + vErrors = [err3]; + } else { + vErrors.push(err3); + } + errors++; + } + } + if (data.wrapWord !== undefined) { + if (typeof data.wrapWord !== "boolean") { + const err4 = { + keyword: "type", + dataPath: dataPath + "/wrapWord", + schemaPath: "#/properties/wrapWord/type", + params: { + type: "boolean" + }, + message: "should be boolean" + }; + if (vErrors === null) { + vErrors = [err4]; + } else { + vErrors.push(err4); + } + errors++; + } + } + if (data.truncate !== undefined) { + let data3 = data.truncate; + if (!((typeof data3 == "number") && (isFinite(data3)))) { + const err5 = { + keyword: "type", + dataPath: dataPath + "/truncate", + schemaPath: "#/properties/truncate/type", + params: { + type: "number" + }, + message: "should be number" + }; + if (vErrors === null) { + vErrors = [err5]; + } else { + vErrors.push(err5); + } + errors++; + } + } + if (data.paddingLeft !== undefined) { + let data4 = data.paddingLeft; + if (!((typeof data4 == "number") && (isFinite(data4)))) { + const err6 = { + keyword: "type", + dataPath: dataPath + "/paddingLeft", + schemaPath: "#/properties/paddingLeft/type", + params: { + type: "number" + }, + message: "should be number" + }; + if (vErrors === null) { + vErrors = [err6]; + } else { + vErrors.push(err6); + } + errors++; + } + } + if (data.paddingRight !== undefined) { + let data5 = data.paddingRight; + if (!((typeof data5 == "number") && (isFinite(data5)))) { + const err7 = { + keyword: "type", + dataPath: dataPath + "/paddingRight", + schemaPath: "#/properties/paddingRight/type", + params: { + type: "number" + }, + message: "should be number" + }; + if (vErrors === null) { + vErrors = [err7]; + } else { + vErrors.push(err7); + } + errors++; + } + } + } else { + const err8 = { + keyword: "type", + dataPath, + schemaPath: "#/type", + params: { + type: "object" + }, + message: "should be object" + }; + if (vErrors === null) { + vErrors = [err8]; + } else { + vErrors.push(err8); + } + errors++; + } + validate90.errors = vErrors; + return errors === 0; +} + +function validate69(data, { + dataPath = "", + parentData, + parentDataProperty, + rootData = data +} = {}) { + /*# sourceURL="streamConfig.json" */ ; + let vErrors = null; + let errors = 0; + if (data && typeof data == "object" && !Array.isArray(data)) { + for (const key0 in data) { + if (!((((key0 === "border") || (key0 === "columns")) || (key0 === "columnDefault")) || (key0 === "columnCount"))) { + const err0 = { + keyword: "additionalProperties", + dataPath, + schemaPath: "#/additionalProperties", + params: { + additionalProperty: key0 + }, + message: "should NOT have additional properties" + }; + if (vErrors === null) { + vErrors = [err0]; + } else { + vErrors.push(err0); + } + errors++; + } + } + if (data.border !== undefined) { + if (!(validate70(data.border, { + dataPath: dataPath + "/border", + parentData: data, + parentDataProperty: "border", + rootData + }))) { + vErrors = vErrors === null ? validate70.errors : vErrors.concat(validate70.errors); + errors = vErrors.length; + } + } + if (data.columns !== undefined) { + if (!(validate87(data.columns, { + dataPath: dataPath + "/columns", + parentData: data, + parentDataProperty: "columns", + rootData + }))) { + vErrors = vErrors === null ? validate87.errors : vErrors.concat(validate87.errors); + errors = vErrors.length; + } + } + if (data.columnDefault !== undefined) { + if (!(validate90(data.columnDefault, { + dataPath: dataPath + "/columnDefault", + parentData: data, + parentDataProperty: "columnDefault", + rootData + }))) { + vErrors = vErrors === null ? validate90.errors : vErrors.concat(validate90.errors); + errors = vErrors.length; + } + } + if (data.columnCount !== undefined) { + let data3 = data.columnCount; + if (!((typeof data3 == "number") && (isFinite(data3)))) { + const err1 = { + keyword: "type", + dataPath: dataPath + "/columnCount", + schemaPath: "#/properties/columnCount/type", + params: { + type: "number" + }, + message: "should be number" + }; + if (vErrors === null) { + vErrors = [err1]; + } else { + vErrors.push(err1); + } + errors++; + } + } + } else { + const err2 = { + keyword: "type", + dataPath, + schemaPath: "#/type", + params: { + type: "object" + }, + message: "should be object" + }; + if (vErrors === null) { + vErrors = [err2]; + } else { + vErrors.push(err2); + } + errors++; + } + validate69.errors = vErrors; + return errors === 0; +} \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/.tonic_example.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/.tonic_example.js new file mode 100644 index 00000000000000..2b0d6683eefe29 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/.tonic_example.js @@ -0,0 +1,20 @@ +var Ajv = require("ajv") +var ajv = new Ajv({allErrors: true}) + +var schema = { + properties: { + foo: {type: "string"}, + bar: {type: "number", maximum: 3}, + }, +} + +var validate = ajv.compile(schema) + +test({foo: "abc", bar: 2}) +test({foo: 2, bar: 4}) + +function test(data) { + var valid = validate(data) + if (valid) console.log("Valid!") + else console.log("Invalid: " + ajv.errorsText(validate.errors)) +} diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/LICENSE b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/LICENSE new file mode 100644 index 00000000000000..96ee719987f778 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015-2017 Evgeny Poberezkin + +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/table/node_modules/ajv/README.md b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/README.md new file mode 100644 index 00000000000000..ee3c1ab7da9997 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/README.md @@ -0,0 +1,406 @@ +Ajv logo + +# Ajv: Another JSON Schema Validator + +The fastest JSON Schema validator for Node.js and browser. Supports draft-06/07/2019-09 (draft-04 is supported in [version 6](https://github.com/ajv-validator/ajv/tree/v6)). + +[![build](https://github.com/ajv-validator/ajv/workflows/build/badge.svg)](https://github.com/ajv-validator/ajv/actions?query=workflow%3Abuild) +[![npm](https://img.shields.io/npm/v/ajv.svg)](https://www.npmjs.com/package/ajv) +[![npm downloads](https://img.shields.io/npm/dm/ajv.svg)](https://www.npmjs.com/package/ajv) +[![Coverage Status](https://coveralls.io/repos/github/ajv-validator/ajv/badge.svg?branch=master)](https://coveralls.io/github/ajv-validator/ajv?branch=master) +[![Gitter](https://img.shields.io/gitter/room/ajv-validator/ajv.svg)](https://gitter.im/ajv-validator/ajv) +[![GitHub Sponsors](https://img.shields.io/badge/$-sponsors-brightgreen)](https://github.com/sponsors/epoberezkin) + +## Platinum sponsors + +[](https://www.mozilla.org)[](https://opencollective.com/ajv)[](https://opencollective.com/ajv) + +## Using version 7 + +Ajv version 7 is released with these changes: + +- support of JSON Schema draft-2019-09 features: [`unevaluatedProperties`](./docs/json-schema.md#unevaluatedproperties) and [`unevaluatedItems`](./docs/json-schema.md#unevaluateditems), [dynamic recursive references](./docs/validation.md#extending-recursive-schemas) and other [additional keywords](./docs/json-schema.md#json-schema-draft-2019-09). +- to reduce the mistakes in JSON schemas and unexpected validation results, [strict mode](./docs/strict-mode.md) is added - it prohibits ignored or ambiguous JSON Schema elements. +- to make code injection from untrusted schemas impossible, [code generation](./docs/codegen.md) is fully re-written to be safe and to allow code optimization (compiled schema code size is reduced by more than 10%). +- to simplify Ajv extensions, the new keyword API that is used by pre-defined keywords is available to user-defined keywords - it is much easier to define any keywords now, especially with subschemas. [ajv-keywords](https://github.com/ajv-validator/ajv-keywords) package was updated to use the new API (in [v4.0.0](https://github.com/ajv-validator/ajv-keywords/releases/tag/v4.0.0)) +- schemas are compiled to ES6 code (ES5 code generation is also supported with an option). +- to improve reliability and maintainability the code is migrated to TypeScript. + +**Please note**: + +- the support for JSON-Schema draft-04 is removed - if you have schemas using "id" attributes you have to replace them with "\$id" (or continue using [Ajv v6](https://github.com/ajv-validator/ajv/tree/v6) that will be supported until 02/28/2021). +- all formats are separated to ajv-formats package - they have to be explicitly added if you use them. + +See [release notes](https://github.com/ajv-validator/ajv/releases/tag/v7.0.0) for the details. + +To install the new version: + +```bash +npm install ajv +``` + +See [Getting started](#usage) for code example. + +## Contributing + +100+ people contributed to Ajv. You are very welcome to join by implementing new features that are valuable to many users and by improving documentation. + +Please do not be disappointed if your suggestion is not accepted - it is important to maintain the balance between the library size, performance and functionality. If it seems that a feature would benefit only a small number of users, its addition may be delayed until there is more support from the users community - so please submit the issue first to explain why this feature is important. + +Please include documentation and test coverage with any new feature implementations. + +To run tests: + +```bash +npm install +git submodule update --init +npm test +``` + +`npm run build` - compiles typescript to `dist` folder. + +Please review [Contributing guidelines](./CONTRIBUTING.md) and [Code components](./docs/components.md). + +## Contents + +- [Platinum sponsors](#platinum-sponsors) +- [Using version 7](#using-version-7) +- [Contributing](#contributing) +- [Mozilla MOSS grant and OpenJS Foundation](#mozilla-moss-grant-and-openjs-foundation) +- [Sponsors](#sponsors) +- [Performance](#performance) +- [Features](#features) +- [Getting started](#usage) +- [Frequently Asked Questions](./docs/faq.md) +- [Using in browser](#using-in-browser) + - [Content Security Policy](./docs/security.md#content-security-policy) +- [Command line interface](#command-line-interface) +- [API reference](./docs/api.md) + - [Methods](./docs/api.md#ajv-constructor-and-methods) + - [Options](./docs/api.md#options) + - [Validation errors](./docs/api.md#validation-errors) +- NEW: [Strict mode](./docs/strict-mode.md#strict-mode) + - [Prohibit ignored keywords](./docs/strict-mode.md#prohibit-ignored-keywords) + - [Prevent unexpected validation](./docs/strict-mode.md#prevent-unexpected-validation) + - [Strict types](./docs/strict-mode.md#strict-types) + - [Strict number validation](./docs/strict-mode.md#strict-number-validation) +- [Data validation](./docs/validation.md) + - [Validation basics](./docs/validation.md#validation-basics): [JSON Schema keywords](./docs/validation.md#validation-keywords), [annotations](./docs/validation.md#annotation-keywords), [formats](./docs/validation.md#formats) + - [Modular schemas](./docs/validation.md#modular-schemas): [combining with \$ref](./docs/validation.md#ref), [\$data reference](./docs/validation.md#data-reference), [$merge and $patch](./docs/validation.md#merge-and-patch-keywords) + - [Asynchronous schema compilation](./docs/validation.md#asynchronous-schema-compilation) + - [Standalone validation code](./docs/standalone.md) + - [Asynchronous validation](./docs/validation.md#asynchronous-validation) + - [Modifying data](./docs/validation.md#modifying-data-during-validation): [additional properties](./docs/validation.md#removing-additional-properties), [defaults](./docs/validation.md#assigning-defaults), [type coercion](./docs/validation.md#coercing-data-types) +- [Extending Ajv](#extending-ajv) + - User-defined keywords: + - [basics](./docs/validation.md#user-defined-keywords) + - [guide](./docs/keywords.md) + - [Plugins](#plugins) + - [Related packages](#related-packages) +- [Security considerations](./docs/security.md) + - [Security contact](./docs/security.md#security-contact) + - [Untrusted schemas](./docs/security.md#untrusted-schemas) + - [Circular references in objects](./docs/security.md#circular-references-in-javascript-objects) + - [Trusted schemas](./docs/security.md#security-risks-of-trusted-schemas) + - [ReDoS attack](./docs/security.md#redos-attack) + - [Content Security Policy](./docs/security.md#content-security-policy) +- [Some packages using Ajv](#some-packages-using-ajv) +- [Changes history](#changes-history) +- [Support, Code of conduct, Contacts, License](#open-source-software-support) + +## Mozilla MOSS grant and OpenJS Foundation + +[](https://www.mozilla.org/en-US/moss/)     [](https://openjsf.org/blog/2020/08/14/ajv-joins-openjs-foundation-as-an-incubation-project/) + +Ajv has been awarded a grant from Mozillaā€™s [Open Source Support (MOSS) program](https://www.mozilla.org/en-US/moss/) in the ā€œFoundational Technologyā€ track! It will sponsor the development of Ajv support of [JSON Schema version 2019-09](https://tools.ietf.org/html/draft-handrews-json-schema-02) and of [JSON Type Definition (RFC8927)](https://datatracker.ietf.org/doc/rfc8927/). + +Ajv also joined [OpenJS Foundation](https://openjsf.org/) ā€“ having this support will help ensure the longevity and stability of Ajv for all its users. + +This [blog post](https://www.poberezkin.com/posts/2020-08-14-ajv-json-validator-mozilla-open-source-grant-openjs-foundation.html) has more details. + +I am looking for the long term maintainers of Ajv ā€“ working with [ReadySet](https://www.thereadyset.co/), also sponsored by Mozilla, to establish clear guidelines for the role of a "maintainer" and the contribution standards, and to encourage a wider, more inclusive, contribution from the community. + +## Please [sponsor Ajv development](https://github.com/sponsors/epoberezkin) + +Since I asked to support Ajv development 40 people and 6 organizations contributed via GitHub and OpenCollective - this support helped receiving the MOSS grant! + +Your continuing support is very important - the funds will be used to develop and maintain Ajv once the next major version is released. + +Please sponsor Ajv via: + +- [GitHub sponsors page](https://github.com/sponsors/epoberezkin) (GitHub will match it) +- [Ajv Open Collectiveļø](https://opencollective.com/ajv) + +Thank you. + +#### Open Collective sponsors + + + + + + + + + + + + + + +## Performance + +Ajv generates code to turn JSON Schemas into super-fast validation functions that are efficient for v8 optimization. + +Currently Ajv is the fastest and the most standard compliant validator according to these benchmarks: + +- [json-schema-benchmark](https://github.com/ebdrup/json-schema-benchmark) - 50% faster than the second place +- [jsck benchmark](https://github.com/pandastrike/jsck#benchmarks) - 20-190% faster +- [z-schema benchmark](https://rawgit.com/zaggino/z-schema/master/benchmark/results.html) +- [themis benchmark](https://cdn.rawgit.com/playlyfe/themis/master/benchmark/results.html) + +Performance of different validators by [json-schema-benchmark](https://github.com/ebdrup/json-schema-benchmark): + +[![performance](https://chart.googleapis.com/chart?chxt=x,y&cht=bhs&chco=76A4FB&chls=2.0&chbh=32,4,1&chs=600x416&chxl=-1:|djv|ajv|json-schema-validator-generator|jsen|is-my-json-valid|themis|z-schema|jsck|skeemas|json-schema-library|tv4&chd=t:100,98,72.1,66.8,50.1,15.1,6.1,3.8,1.2,0.7,0.2)](https://github.com/ebdrup/json-schema-benchmark/blob/master/README.md#performance) + +## Features + +- Ajv implements full JSON Schema [draft-06/07](http://json-schema.org/) standards (draft-04 is supported in v6): + - all validation keywords (see [JSON Schema validation keywords](./docs/json-schema.md)) + - keyword "nullable" from [Open API 3 specification](https://swagger.io/docs/specification/data-models/data-types/). + - full support of remote references (remote schemas have to be added with `addSchema` or compiled to be available) + - support of circular references between schemas + - correct string lengths for strings with unicode pairs + - [formats](#formats) defined by JSON Schema draft-07 standard (with [ajv-formats](https://github.com/ajv-validator/ajv-formats) plugin) and additional formats (can be turned off) + - [validates schemas against meta-schema](./docs/api.md#api-validateschema) +- supports [browsers](#using-in-browser) and Node.js 0.10-14.x +- [asynchronous loading](./docs/validation.md#asynchronous-schema-compilation) of referenced schemas during compilation +- "All errors" validation mode with [option allErrors](./docs/api.md#options) +- [error messages with parameters](./docs/api.md#validation-errors) describing error reasons to allow error message generation +- i18n error messages support with [ajv-i18n](https://github.com/ajv-validator/ajv-i18n) package +- [removing-additional-properties](./docs/validation.md#removing-additional-properties) +- [assigning defaults](./docs/validation.md#assigning-defaults) to missing properties and items +- [coercing data](./docs/validation.md#coercing-data-types) to the types specified in `type` keywords +- [user-defined keywords](#user-defined-keywords) +- draft-06/07 keywords `const`, `contains`, `propertyNames` and `if/then/else` +- draft-06 boolean schemas (`true`/`false` as a schema to always pass/fail). +- additional extension keywords with [ajv-keywords](https://github.com/ajv-validator/ajv-keywords) package +- [\$data reference](./docs/validation.md#data-reference) to use values from the validated data as values for the schema keywords +- [asynchronous validation](./docs/api.md#asynchronous-validation) of user-defined formats and keywords + +## Install + +To install version 7: + +``` +npm install ajv +``` + +## Getting started + +Try it in the Node.js REPL: https://runkit.com/npm/ajv + +In JavaScript: + +```javascript +// or ESM/TypeScript import +import Ajv from "ajv" +// Node.js require: +const Ajv = require("ajv").default + +const ajv = new Ajv() // options can be passed, e.g. {allErrors: true} +const validate = ajv.compile(schema) +const valid = validate(data) +if (!valid) console.log(validate.errors) +``` + +In TypeScript: + +```typescript +import Ajv, {JSONSchemaType, DefinedError} from "ajv" + +const ajv = new Ajv() + +type MyData = {foo: number} + +// Optional schema type annotation for schema to match MyData type. +// To use JSONSchemaType set `strictNullChecks: true` in tsconfig `compilerOptions`. +const schema: JSONSchemaType = { + type: "object", + properties: { + foo: {type: "number", minimum: 0}, + }, + required: ["foo"], + additionalProperties: false, +} + +// validate is a type guard for MyData - type is inferred from schema type +const validate = ajv.compile(schema) + +// or, if you did not use type annotation for the schema, +// type parameter can be used to make it type guard: +// const validate = ajv.compile(schema) + +const data: any = {foo: 1} + +if (validate(data)) { + // data is MyData here + console.log(data.foo) +} else { + // The type cast is needed to allow user-defined keywords and errors + // You can extend this type to include your error types as needed. + for (const err of validate.errors as DefinedError[]) { + switch (err.keyword) { + case "minimum": + // err type is narrowed here to have "minimum" error params properties + console.log(err.params.limit) + break + // ... + } + } +} +``` + +See [this test](./spec/types/json-schema.spec.ts) for an advanced example, [API reference](./docs/api.md) and [Options](./docs/api.md#options) for more details. + +Ajv compiles schemas to functions and caches them in all cases (using schema itself as a key for Map) or another function passed via options), so that the next time the same schema is used (not necessarily the same object instance) it won't be compiled again. + +The best performance is achieved when using compiled functions returned by `compile` or `getSchema` methods (there is no additional function call). + +**Please note**: every time a validation function or `ajv.validate` are called `errors` property is overwritten. You need to copy `errors` array reference to another variable if you want to use it later (e.g., in the callback). See [Validation errors](./docs/api.md#validation-errors) + +## Using in browser + +See [Content Security Policy](./docs/security.md#content-security-policy) to decide the best approach how to use Ajv in the browser. + +Whether you use Ajv or compiled schemas, it is recommended that you bundle them together with your code. + +If you need to use Ajv in several bundles you can create a separate UMD bundles using `npm run bundle` script. + +Then you need to load Ajv with support of JSON Schema draft-07 in the browser: + +```html + + +``` + +or to load the bundle that supports JSONSchema draft-2019-09: + +```html + + +``` + +This bundle can be used with different module systems; it creates global `ajv` (or `ajv2019`) if no module system is found. + +The browser bundle is available on [cdnjs](https://cdnjs.com/libraries/ajv). + +**Please note**: some frameworks, e.g. Dojo, may redefine global require in a way that is not compatible with CommonJS module format. In this case Ajv bundle has to be loaded before the framework and then you can use global `ajv` (see issue [#234](https://github.com/ajv-validator/ajv/issues/234)). + +## Command line interface + +CLI is available as a separate npm package [ajv-cli](https://github.com/ajv-validator/ajv-cli). It supports: + +- compiling JSON Schemas to test their validity +- generating [standalone validation code](./docs/standalone.md) that exports validation function(s) to be used without Ajv +- migrating schemas to draft-07 and draft-2019-09 (using [json-schema-migrate](https://github.com/epoberezkin/json-schema-migrate)) +- validating data file(s) against JSON Schema +- testing expected validity of data against JSON Schema +- referenced schemas +- user-defined meta-schemas, validation keywords and formats +- files in JSON, JSON5, YAML, and JavaScript format +- all Ajv options +- reporting changes in data after validation in [JSON-patch](https://tools.ietf.org/html/rfc6902) format + +## Extending Ajv + +### User defined keywords + +See section in [data validation](./docs/validation.md#user-defined-keywords) and the [detailed guide](./docs/keywords.md). + +### Plugins + +Ajv can be extended with plugins that add keywords, formats or functions to process generated code. When such plugin is published as npm package it is recommended that it follows these conventions: + +- it exports a function that accepts ajv instance as the first parameter - it allows using plugins with [ajv-cli](#command-line-interface). +- this function returns the same instance to allow chaining. +- this function can accept an optional configuration as the second parameter. + +You can import `Plugin` interface from ajv if you use Typescript. + +If you have published a useful plugin please submit a PR to add it to the next section. + +### Related packages + +- [ajv-bsontype](https://github.com/BoLaMN/ajv-bsontype) - plugin to validate mongodb's bsonType formats +- [ajv-cli](https://github.com/jessedc/ajv-cli) - command line interface +- [ajv-formats](https://github.com/ajv-validator/ajv-formats) - formats defined in JSON Schema specification +- [ajv-errors](https://github.com/ajv-validator/ajv-errors) - plugin for defining error messages in the schema +- [ajv-i18n](https://github.com/ajv-validator/ajv-i18n) - internationalised error messages +- [ajv-istanbul](https://github.com/ajv-validator/ajv-istanbul) - plugin to instrument generated validation code to measure test coverage of your schemas +- [ajv-keywords](https://github.com/ajv-validator/ajv-keywords) - plugin with additional validation keywords (select, typeof, etc.) +- [ajv-merge-patch](https://github.com/ajv-validator/ajv-merge-patch) - plugin with keywordsĀ $merge and $patch +- [ajv-formats-draft2019](https://github.com/luzlab/ajv-formats-draft2019) - format validators for draft2019 that aren't included in [ajv-formats](https://github.com/ajv-validator/ajv-formats) (ie. `idn-hostname`, `idn-email`, `iri`, `iri-reference` and `duration`) + +## Some packages using Ajv + +- [webpack](https://github.com/webpack/webpack) - a module bundler. Its main purpose is to bundle JavaScript files for usage in a browser +- [jsonscript-js](https://github.com/JSONScript/jsonscript-js) - the interpreter for [JSONScript](http://www.jsonscript.org) - scripted processing of existing endpoints and services +- [osprey-method-handler](https://github.com/mulesoft-labs/osprey-method-handler) - Express middleware for validating requests and responses based on a RAML method object, used in [osprey](https://github.com/mulesoft/osprey) - validating API proxy generated from a RAML definition +- [har-validator](https://github.com/ahmadnassri/har-validator) - HTTP Archive (HAR) validator +- [jsoneditor](https://github.com/josdejong/jsoneditor) - a web-based tool to view, edit, format, and validate JSON http://jsoneditoronline.org +- [JSON Schema Lint](https://github.com/nickcmaynard/jsonschemalint) - a web tool to validate JSON/YAML document against a single JSON Schema http://jsonschemalint.com +- [objection](https://github.com/vincit/objection.js) - SQL-friendly ORM for Node.js +- [table](https://github.com/gajus/table) - formats data into a string table +- [ripple-lib](https://github.com/ripple/ripple-lib) - a JavaScript API for interacting with [Ripple](https://ripple.com) in Node.js and the browser +- [restbase](https://github.com/wikimedia/restbase) - distributed storage with REST API & dispatcher for backend services built to provide a low-latency & high-throughput API for Wikipedia / Wikimedia content +- [hippie-swagger](https://github.com/CacheControl/hippie-swagger) - [Hippie](https://github.com/vesln/hippie) wrapper that provides end to end API testing with swagger validation +- [react-form-controlled](https://github.com/seeden/react-form-controlled) - React controlled form components with validation +- [rabbitmq-schema](https://github.com/tjmehta/rabbitmq-schema) - a schema definition module for RabbitMQ graphs and messages +- [@query/schema](https://www.npmjs.com/package/@query/schema) - stream filtering with a URI-safe query syntax parsing to JSON Schema +- [chai-ajv-json-schema](https://github.com/peon374/chai-ajv-json-schema) - chai plugin to us JSON Schema with expect in mocha tests +- [grunt-jsonschema-ajv](https://github.com/SignpostMarv/grunt-jsonschema-ajv) - Grunt plugin for validating files against JSON Schema +- [extract-text-webpack-plugin](https://github.com/webpack-contrib/extract-text-webpack-plugin) - extract text from bundle into a file +- [electron-builder](https://github.com/electron-userland/electron-builder) - a solution to package and build a ready for distribution Electron app +- [addons-linter](https://github.com/mozilla/addons-linter) - Mozilla Add-ons Linter +- [gh-pages-generator](https://github.com/epoberezkin/gh-pages-generator) - multi-page site generator converting markdown files to GitHub pages +- [ESLint](https://github.com/eslint/eslint) - the pluggable linting utility for JavaScript and JSX +- [Spectral](https://github.com/stoplightio/spectral) - the customizable linting utility for JSON/YAML, OpenAPI, AsyncAPI, and JSON Schema + +## Changes history + +See https://github.com/ajv-validator/ajv/releases + +**Please note**: [Changes in version 7.0.0](https://github.com/ajv-validator/ajv/releases/tag/v7.0.0) + +[Version 6.0.0](https://github.com/ajv-validator/ajv/releases/tag/v6.0.0). + +## Code of conduct + +Please review and follow the [Code of conduct](./CODE_OF_CONDUCT.md). + +Please report any unacceptable behaviour to ajv.validator@gmail.com - it will be reviewed by the project team. + +## Security contact + +To report a security vulnerability, please use the +[Tidelift security contact](https://tidelift.com/security). +Tidelift will coordinate the fix and disclosure. Please do NOT report security vulnerabilities via GitHub issues. + +## Open-source software support + +Ajv is a part of [Tidelift subscription](https://tidelift.com/subscription/pkg/npm-ajv?utm_source=npm-ajv&utm_medium=referral&utm_campaign=readme) - it provides a centralised support to open-source software users, in addition to the support provided by software maintainers. + +## License + +[MIT](./LICENSE) diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/2019.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/2019.js new file mode 100644 index 00000000000000..afb7be6c262230 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/2019.js @@ -0,0 +1,50 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = void 0; +const context_1 = require("./compile/context"); +exports.KeywordCxt = context_1.default; +var codegen_1 = require("./compile/codegen"); +Object.defineProperty(exports, "_", { enumerable: true, get: function () { return codegen_1._; } }); +Object.defineProperty(exports, "str", { enumerable: true, get: function () { return codegen_1.str; } }); +Object.defineProperty(exports, "stringify", { enumerable: true, get: function () { return codegen_1.stringify; } }); +Object.defineProperty(exports, "nil", { enumerable: true, get: function () { return codegen_1.nil; } }); +Object.defineProperty(exports, "Name", { enumerable: true, get: function () { return codegen_1.Name; } }); +Object.defineProperty(exports, "CodeGen", { enumerable: true, get: function () { return codegen_1.CodeGen; } }); +const core_1 = require("./core"); +const draft7_1 = require("./vocabularies/draft7"); +const dynamic_1 = require("./vocabularies/dynamic"); +const next_1 = require("./vocabularies/next"); +const unevaluated_1 = require("./vocabularies/unevaluated"); +const json_schema_2019_09_1 = require("./refs/json-schema-2019-09"); +const META_SCHEMA_ID = "https://json-schema.org/draft/2019-09/schema"; +class Ajv2019 extends core_1.default { + constructor(opts = {}) { + super({ + ...opts, + dynamicRef: true, + next: true, + unevaluated: true, + }); + } + _addVocabularies() { + super._addVocabularies(); + this.addVocabulary(dynamic_1.default); + draft7_1.default.forEach((v) => this.addVocabulary(v)); + this.addVocabulary(next_1.default); + this.addVocabulary(unevaluated_1.default); + } + _addDefaultMetaSchema() { + super._addDefaultMetaSchema(); + const { $data, meta } = this.opts; + if (!meta) + return; + json_schema_2019_09_1.default.call(this, $data); + this.refs["http://json-schema.org/schema"] = META_SCHEMA_ID; + } + defaultMeta() { + return (this.opts.defaultMeta = + super.defaultMeta() || (this.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : undefined)); + } +} +exports.default = Ajv2019; +//# sourceMappingURL=2019.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/ajv.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/ajv.js new file mode 100644 index 00000000000000..be8275b51a8082 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/ajv.js @@ -0,0 +1,40 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = void 0; +const context_1 = require("./compile/context"); +exports.KeywordCxt = context_1.default; +var codegen_1 = require("./compile/codegen"); +Object.defineProperty(exports, "_", { enumerable: true, get: function () { return codegen_1._; } }); +Object.defineProperty(exports, "str", { enumerable: true, get: function () { return codegen_1.str; } }); +Object.defineProperty(exports, "stringify", { enumerable: true, get: function () { return codegen_1.stringify; } }); +Object.defineProperty(exports, "nil", { enumerable: true, get: function () { return codegen_1.nil; } }); +Object.defineProperty(exports, "Name", { enumerable: true, get: function () { return codegen_1.Name; } }); +Object.defineProperty(exports, "CodeGen", { enumerable: true, get: function () { return codegen_1.CodeGen; } }); +const core_1 = require("./core"); +const draft7_1 = require("./vocabularies/draft7"); +const draft7MetaSchema = require("./refs/json-schema-draft-07.json"); +const META_SUPPORT_DATA = ["/properties"]; +const META_SCHEMA_ID = "http://json-schema.org/draft-07/schema"; +class Ajv extends core_1.default { + _addVocabularies() { + super._addVocabularies(); + draft7_1.default.forEach((v) => this.addVocabulary(v)); + } + _addDefaultMetaSchema() { + super._addDefaultMetaSchema(); + const { $data, meta } = this.opts; + if (!meta) + return; + const metaSchema = $data + ? this.$dataMetaSchema(draft7MetaSchema, META_SUPPORT_DATA) + : draft7MetaSchema; + this.addMetaSchema(metaSchema, META_SCHEMA_ID, false); + this.refs["http://json-schema.org/schema"] = META_SCHEMA_ID; + } + defaultMeta() { + return (this.opts.defaultMeta = + super.defaultMeta() || (this.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : undefined)); + } +} +exports.default = Ajv; +//# sourceMappingURL=ajv.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/codegen/code.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/codegen/code.js new file mode 100644 index 00000000000000..24ad5c1fe3861a --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/codegen/code.js @@ -0,0 +1,143 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getProperty = exports.safeStringify = exports.stringify = exports.strConcat = exports.addCodeArg = exports.str = exports._ = exports.nil = exports._Code = exports.Name = exports.IDENTIFIER = exports._CodeOrName = void 0; +class _CodeOrName { +} +exports._CodeOrName = _CodeOrName; +exports.IDENTIFIER = /^[a-z$_][a-z$_0-9]*$/i; +class Name extends _CodeOrName { + constructor(s) { + super(); + if (!exports.IDENTIFIER.test(s)) + throw new Error("CodeGen: name must be a valid identifier"); + this.str = s; + } + toString() { + return this.str; + } + emptyStr() { + return false; + } + get names() { + return { [this.str]: 1 }; + } +} +exports.Name = Name; +class _Code extends _CodeOrName { + constructor(code) { + super(); + this._items = typeof code === "string" ? [code] : code; + } + toString() { + return this.str; + } + emptyStr() { + if (this._items.length > 1) + return false; + const item = this._items[0]; + return item === "" || item === '""'; + } + get str() { + var _a; + return ((_a = this._str) !== null && _a !== void 0 ? _a : (this._str = this._items.reduce((s, c) => `${s}${c}`, ""))); + } + get names() { + var _a; + return ((_a = this._names) !== null && _a !== void 0 ? _a : (this._names = this._items.reduce((names, c) => { + if (c instanceof Name) + names[c.str] = (names[c.str] || 0) + 1; + return names; + }, {}))); + } +} +exports._Code = _Code; +exports.nil = new _Code(""); +function _(strs, ...args) { + const code = [strs[0]]; + let i = 0; + while (i < args.length) { + addCodeArg(code, args[i]); + code.push(strs[++i]); + } + return new _Code(code); +} +exports._ = _; +const plus = new _Code("+"); +function str(strs, ...args) { + const expr = [safeStringify(strs[0])]; + let i = 0; + while (i < args.length) { + expr.push(plus); + addCodeArg(expr, args[i]); + expr.push(plus, safeStringify(strs[++i])); + } + optimize(expr); + return new _Code(expr); +} +exports.str = str; +function addCodeArg(code, arg) { + if (arg instanceof _Code) + code.push(...arg._items); + else if (arg instanceof Name) + code.push(arg); + else + code.push(interpolate(arg)); +} +exports.addCodeArg = addCodeArg; +function optimize(expr) { + let i = 1; + while (i < expr.length - 1) { + if (expr[i] === plus) { + const res = mergeExprItems(expr[i - 1], expr[i + 1]); + if (res !== undefined) { + expr.splice(i - 1, 3, res); + continue; + } + expr[i++] = "+"; + } + i++; + } +} +function mergeExprItems(a, b) { + if (b === '""') + return a; + if (a === '""') + return b; + if (typeof a == "string") { + if (b instanceof Name || a[a.length - 1] !== '"') + return; + if (typeof b != "string") + return `${a.slice(0, -1)}${b}"`; + if (b[0] === '"') + return a.slice(0, -1) + b.slice(1); + return; + } + if (typeof b == "string" && b[0] === '"' && !(a instanceof Name)) + return `"${a}${b.slice(1)}`; + return; +} +function strConcat(c1, c2) { + return c2.emptyStr() ? c1 : c1.emptyStr() ? c2 : str `${c1}${c2}`; +} +exports.strConcat = strConcat; +// TODO do not allow arrays here +function interpolate(x) { + return typeof x == "number" || typeof x == "boolean" || x === null + ? x + : safeStringify(Array.isArray(x) ? x.join(",") : x); +} +function stringify(x) { + return new _Code(safeStringify(x)); +} +exports.stringify = stringify; +function safeStringify(x) { + return JSON.stringify(x) + .replace(/\u2028/g, "\\u2028") + .replace(/\u2029/g, "\\u2029"); +} +exports.safeStringify = safeStringify; +function getProperty(key) { + return typeof key == "string" && exports.IDENTIFIER.test(key) ? new _Code(`.${key}`) : _ `[${key}]`; +} +exports.getProperty = getProperty; +//# sourceMappingURL=code.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/codegen/index.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/codegen/index.js new file mode 100644 index 00000000000000..6695ba041c45d6 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/codegen/index.js @@ -0,0 +1,682 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.or = exports.and = exports.not = exports.CodeGen = exports.operators = exports.varKinds = exports.ValueScopeName = exports.ValueScope = exports.Scope = exports.Name = exports.stringify = exports.getProperty = exports.nil = exports.strConcat = exports.str = exports._ = void 0; +const code_1 = require("./code"); +const scope_1 = require("./scope"); +var code_2 = require("./code"); +Object.defineProperty(exports, "_", { enumerable: true, get: function () { return code_2._; } }); +Object.defineProperty(exports, "str", { enumerable: true, get: function () { return code_2.str; } }); +Object.defineProperty(exports, "strConcat", { enumerable: true, get: function () { return code_2.strConcat; } }); +Object.defineProperty(exports, "nil", { enumerable: true, get: function () { return code_2.nil; } }); +Object.defineProperty(exports, "getProperty", { enumerable: true, get: function () { return code_2.getProperty; } }); +Object.defineProperty(exports, "stringify", { enumerable: true, get: function () { return code_2.stringify; } }); +Object.defineProperty(exports, "Name", { enumerable: true, get: function () { return code_2.Name; } }); +var scope_2 = require("./scope"); +Object.defineProperty(exports, "Scope", { enumerable: true, get: function () { return scope_2.Scope; } }); +Object.defineProperty(exports, "ValueScope", { enumerable: true, get: function () { return scope_2.ValueScope; } }); +Object.defineProperty(exports, "ValueScopeName", { enumerable: true, get: function () { return scope_2.ValueScopeName; } }); +Object.defineProperty(exports, "varKinds", { enumerable: true, get: function () { return scope_2.varKinds; } }); +exports.operators = { + GT: new code_1._Code(">"), + GTE: new code_1._Code(">="), + LT: new code_1._Code("<"), + LTE: new code_1._Code("<="), + EQ: new code_1._Code("==="), + NEQ: new code_1._Code("!=="), + NOT: new code_1._Code("!"), + OR: new code_1._Code("||"), + AND: new code_1._Code("&&"), +}; +class Node { + optimizeNodes() { + return this; + } + optimizeNames(_names, _constants) { + return this; + } +} +class Def extends Node { + constructor(varKind, name, rhs) { + super(); + this.varKind = varKind; + this.name = name; + this.rhs = rhs; + } + render({ es5, _n }) { + const varKind = es5 ? scope_1.varKinds.var : this.varKind; + const rhs = this.rhs === undefined ? "" : ` = ${this.rhs}`; + return `${varKind} ${this.name}${rhs};` + _n; + } + optimizeNames(names, constants) { + if (!names[this.name.str]) + return; + if (this.rhs) + this.rhs = optimizeExpr(this.rhs, names, constants); + return this; + } + get names() { + return this.rhs instanceof code_1._CodeOrName ? this.rhs.names : {}; + } +} +class Assign extends Node { + constructor(lhs, rhs, sideEffects) { + super(); + this.lhs = lhs; + this.rhs = rhs; + this.sideEffects = sideEffects; + } + render({ _n }) { + return `${this.lhs} = ${this.rhs};` + _n; + } + optimizeNames(names, constants) { + if (this.lhs instanceof code_1.Name && !names[this.lhs.str] && !this.sideEffects) + return; + this.rhs = optimizeExpr(this.rhs, names, constants); + return this; + } + get names() { + const names = this.lhs instanceof code_1.Name ? {} : { ...this.lhs.names }; + return addExprNames(names, this.rhs); + } +} +class Label extends Node { + constructor(label) { + super(); + this.label = label; + this.names = {}; + } + render({ _n }) { + return `${this.label}:` + _n; + } +} +class Break extends Node { + constructor(label) { + super(); + this.label = label; + this.names = {}; + } + render({ _n }) { + const label = this.label ? ` ${this.label}` : ""; + return `break${label};` + _n; + } +} +class Throw extends Node { + constructor(error) { + super(); + this.error = error; + } + render({ _n }) { + return `throw ${this.error};` + _n; + } + get names() { + return this.error.names; + } +} +class AnyCode extends Node { + constructor(code) { + super(); + this.code = code; + } + render({ _n }) { + return `${this.code};` + _n; + } + optimizeNodes() { + return `${this.code}` ? this : undefined; + } + optimizeNames(names, constants) { + this.code = optimizeExpr(this.code, names, constants); + return this; + } + get names() { + return this.code instanceof code_1._CodeOrName ? this.code.names : {}; + } +} +class ParentNode extends Node { + constructor(nodes = []) { + super(); + this.nodes = nodes; + } + render(opts) { + return this.nodes.reduce((code, n) => code + n.render(opts), ""); + } + optimizeNodes() { + const { nodes } = this; + let i = nodes.length; + while (i--) { + const n = nodes[i].optimizeNodes(); + if (Array.isArray(n)) + nodes.splice(i, 1, ...n); + else if (n) + nodes[i] = n; + else + nodes.splice(i, 1); + } + return nodes.length > 0 ? this : undefined; + } + optimizeNames(names, constants) { + const { nodes } = this; + let i = nodes.length; + while (i--) { + // iterating backwards improves 1-pass optimization + const n = nodes[i]; + if (n.optimizeNames(names, constants)) + continue; + subtractNames(names, n.names); + nodes.splice(i, 1); + } + return nodes.length > 0 ? this : undefined; + } + get names() { + return this.nodes.reduce((names, n) => addNames(names, n.names), {}); + } +} +class BlockNode extends ParentNode { + render(opts) { + return "{" + opts._n + super.render(opts) + "}" + opts._n; + } +} +class Root extends ParentNode { +} +class Else extends BlockNode { +} +Else.kind = "else"; +class If extends BlockNode { + constructor(condition, nodes) { + super(nodes); + this.condition = condition; + } + render(opts) { + let code = `if(${this.condition})` + super.render(opts); + if (this.else) + code += "else " + this.else.render(opts); + return code; + } + optimizeNodes() { + super.optimizeNodes(); + const cond = this.condition; + if (cond === true) + return this.nodes; // else is ignored here + let e = this.else; + if (e) { + const ns = e.optimizeNodes(); + e = this.else = Array.isArray(ns) ? new Else(ns) : ns; + } + if (e) { + if (cond === false) + return e instanceof If ? e : e.nodes; + if (this.nodes.length) + return this; + return new If(not(cond), e instanceof If ? [e] : e.nodes); + } + if (cond === false || !this.nodes.length) + return undefined; + return this; + } + optimizeNames(names, constants) { + var _a; + this.else = (_a = this.else) === null || _a === void 0 ? void 0 : _a.optimizeNames(names, constants); + if (!(super.optimizeNames(names, constants) || this.else)) + return; + this.condition = optimizeExpr(this.condition, names, constants); + return this; + } + get names() { + const names = super.names; + addExprNames(names, this.condition); + if (this.else) + addNames(names, this.else.names); + return names; + } +} +If.kind = "if"; +class For extends BlockNode { +} +For.kind = "for"; +class ForLoop extends For { + constructor(iteration) { + super(); + this.iteration = iteration; + } + render(opts) { + return `for(${this.iteration})` + super.render(opts); + } + optimizeNames(names, constants) { + if (!super.optimizeNames(names, constants)) + return; + this.iteration = optimizeExpr(this.iteration, names, constants); + return this; + } + get names() { + return addNames(super.names, this.iteration.names); + } +} +class ForRange extends For { + constructor(varKind, name, from, to) { + super(); + this.varKind = varKind; + this.name = name; + this.from = from; + this.to = to; + } + render(opts) { + const varKind = opts.es5 ? scope_1.varKinds.var : this.varKind; + const { name, from, to } = this; + return `for(${varKind} ${name}=${from}; ${name}<${to}; ${name}++)` + super.render(opts); + } + get names() { + const names = addExprNames(super.names, this.from); + return addExprNames(names, this.to); + } +} +class ForIter extends For { + constructor(loop, varKind, name, iterable) { + super(); + this.loop = loop; + this.varKind = varKind; + this.name = name; + this.iterable = iterable; + } + render(opts) { + return `for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})` + super.render(opts); + } + optimizeNames(names, constants) { + if (!super.optimizeNames(names, constants)) + return; + this.iterable = optimizeExpr(this.iterable, names, constants); + return this; + } + get names() { + return addNames(super.names, this.iterable.names); + } +} +class Func extends BlockNode { + constructor(name, args, async) { + super(); + this.name = name; + this.args = args; + this.async = async; + } + render(opts) { + const _async = this.async ? "async " : ""; + return `${_async}function ${this.name}(${this.args})` + super.render(opts); + } +} +Func.kind = "func"; +class Return extends ParentNode { + render(opts) { + return "return " + super.render(opts); + } +} +Return.kind = "return"; +class Try extends BlockNode { + render(opts) { + let code = "try" + super.render(opts); + if (this.catch) + code += this.catch.render(opts); + if (this.finally) + code += this.finally.render(opts); + return code; + } + optimizeNodes() { + var _a, _b; + super.optimizeNodes(); + (_a = this.catch) === null || _a === void 0 ? void 0 : _a.optimizeNodes(); + (_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNodes(); + return this; + } + optimizeNames(names, constants) { + var _a, _b; + super.optimizeNames(names, constants); + (_a = this.catch) === null || _a === void 0 ? void 0 : _a.optimizeNames(names, constants); + (_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNames(names, constants); + return this; + } + get names() { + const names = super.names; + if (this.catch) + addNames(names, this.catch.names); + if (this.finally) + addNames(names, this.finally.names); + return names; + } +} +class Catch extends BlockNode { + constructor(error) { + super(); + this.error = error; + } + render(opts) { + return `catch(${this.error})` + super.render(opts); + } +} +Catch.kind = "catch"; +class Finally extends BlockNode { + render(opts) { + return "finally" + super.render(opts); + } +} +Finally.kind = "finally"; +class CodeGen { + constructor(extScope, opts = {}) { + this._values = {}; + this._blockStarts = []; + this._constants = {}; + this.opts = { ...opts, _n: opts.lines ? "\n" : "" }; + this._extScope = extScope; + this._scope = new scope_1.Scope({ parent: extScope }); + this._nodes = [new Root()]; + } + toString() { + return this._root.render(this.opts); + } + // returns unique name in the internal scope + name(prefix) { + return this._scope.name(prefix); + } + // reserves unique name in the external scope + scopeName(prefix) { + return this._extScope.name(prefix); + } + // reserves unique name in the external scope and assigns value to it + scopeValue(prefixOrName, value) { + const name = this._extScope.value(prefixOrName, value); + const vs = this._values[name.prefix] || (this._values[name.prefix] = new Set()); + vs.add(name); + return name; + } + getScopeValue(prefix, keyOrRef) { + return this._extScope.getValue(prefix, keyOrRef); + } + // return code that assigns values in the external scope to the names that are used internally + // (same names that were returned by gen.scopeName or gen.scopeValue) + scopeRefs(scopeName) { + return this._extScope.scopeRefs(scopeName, this._values); + } + scopeCode() { + return this._extScope.scopeCode(this._values); + } + _def(varKind, nameOrPrefix, rhs, constant) { + const name = this._scope.toName(nameOrPrefix); + if (rhs !== undefined && constant) + this._constants[name.str] = rhs; + this._leafNode(new Def(varKind, name, rhs)); + return name; + } + // `const` declaration (`var` in es5 mode) + const(nameOrPrefix, rhs, _constant) { + return this._def(scope_1.varKinds.const, nameOrPrefix, rhs, _constant); + } + // `let` declaration with optional assignment (`var` in es5 mode) + let(nameOrPrefix, rhs, _constant) { + return this._def(scope_1.varKinds.let, nameOrPrefix, rhs, _constant); + } + // `var` declaration with optional assignment + var(nameOrPrefix, rhs, _constant) { + return this._def(scope_1.varKinds.var, nameOrPrefix, rhs, _constant); + } + // assignment code + assign(lhs, rhs, sideEffects) { + return this._leafNode(new Assign(lhs, rhs, sideEffects)); + } + // appends passed SafeExpr to code or executes Block + code(c) { + if (typeof c == "function") + c(); + else if (c !== code_1.nil) + this._leafNode(new AnyCode(c)); + return this; + } + // returns code for object literal for the passed argument list of key-value pairs + object(...keyValues) { + const code = ["{"]; + for (const [key, value] of keyValues) { + if (code.length > 1) + code.push(","); + code.push(key); + if (key !== value || this.opts.es5) { + code.push(":"); + code_1.addCodeArg(code, value); + } + } + code.push("}"); + return new code_1._Code(code); + } + // `if` clause (or statement if `thenBody` and, optionally, `elseBody` are passed) + if(condition, thenBody, elseBody) { + this._blockNode(new If(condition)); + if (thenBody && elseBody) { + this.code(thenBody).else().code(elseBody).endIf(); + } + else if (thenBody) { + this.code(thenBody).endIf(); + } + else if (elseBody) { + throw new Error('CodeGen: "else" body without "then" body'); + } + return this; + } + // `else if` clause - invalid without `if` or after `else` clauses + elseIf(condition) { + return this._elseNode(new If(condition)); + } + // `else` clause - only valid after `if` or `else if` clauses + else() { + return this._elseNode(new Else()); + } + // end `if` statement (needed if gen.if was used only with condition) + endIf() { + return this._endBlockNode(If, Else); + } + _for(node, forBody) { + this._blockNode(node); + if (forBody) + this.code(forBody).endFor(); + return this; + } + // a generic `for` clause (or statement if `forBody` is passed) + for(iteration, forBody) { + return this._for(new ForLoop(iteration), forBody); + } + // `for` statement for a range of values + forRange(nameOrPrefix, from, to, forBody, varKind = this.opts.es5 ? scope_1.varKinds.var : scope_1.varKinds.let) { + const name = this._scope.toName(nameOrPrefix); + return this._for(new ForRange(varKind, name, from, to), () => forBody(name)); + } + // `for-of` statement (in es5 mode replace with a normal for loop) + forOf(nameOrPrefix, iterable, forBody, varKind = scope_1.varKinds.const) { + const name = this._scope.toName(nameOrPrefix); + if (this.opts.es5) { + const arr = iterable instanceof code_1.Name ? iterable : this.var("_arr", iterable); + return this.forRange("_i", 0, code_1._ `${arr}.length`, (i) => { + this.var(name, code_1._ `${arr}[${i}]`); + forBody(name); + }); + } + return this._for(new ForIter("of", varKind, name, iterable), () => forBody(name)); + } + // `for-in` statement. + // With option `ownProperties` replaced with a `for-of` loop for object keys + forIn(nameOrPrefix, obj, forBody, varKind = this.opts.es5 ? scope_1.varKinds.var : scope_1.varKinds.const) { + if (this.opts.ownProperties) { + return this.forOf(nameOrPrefix, code_1._ `Object.keys(${obj})`, forBody); + } + const name = this._scope.toName(nameOrPrefix); + return this._for(new ForIter("in", varKind, name, obj), () => forBody(name)); + } + // end `for` loop + endFor() { + return this._endBlockNode(For); + } + // `label` statement + label(label) { + return this._leafNode(new Label(label)); + } + // `break` statement + break(label) { + return this._leafNode(new Break(label)); + } + // `return` statement + return(value) { + const node = new Return(); + this._blockNode(node); + this.code(value); + if (node.nodes.length !== 1) + throw new Error('CodeGen: "return" should have one node'); + return this._endBlockNode(Return); + } + // `try` statement + try(tryBody, catchCode, finallyCode) { + if (!catchCode && !finallyCode) + throw new Error('CodeGen: "try" without "catch" and "finally"'); + const node = new Try(); + this._blockNode(node); + this.code(tryBody); + if (catchCode) { + const error = this.name("e"); + this._currNode = node.catch = new Catch(error); + catchCode(error); + } + if (finallyCode) { + this._currNode = node.finally = new Finally(); + this.code(finallyCode); + } + return this._endBlockNode(Catch, Finally); + } + // `throw` statement + throw(error) { + return this._leafNode(new Throw(error)); + } + // start self-balancing block + block(body, nodeCount) { + this._blockStarts.push(this._nodes.length); + if (body) + this.code(body).endBlock(nodeCount); + return this; + } + // end the current self-balancing block + endBlock(nodeCount) { + const len = this._blockStarts.pop(); + if (len === undefined) + throw new Error("CodeGen: not in self-balancing block"); + const toClose = this._nodes.length - len; + if (toClose < 0 || (nodeCount !== undefined && toClose !== nodeCount)) { + throw new Error(`CodeGen: wrong number of nodes: ${toClose} vs ${nodeCount} expected`); + } + this._nodes.length = len; + return this; + } + // `function` heading (or definition if funcBody is passed) + func(name, args = code_1.nil, async, funcBody) { + this._blockNode(new Func(name, args, async)); + if (funcBody) + this.code(funcBody).endFunc(); + return this; + } + // end function definition + endFunc() { + return this._endBlockNode(Func); + } + optimize(n = 1) { + while (n-- > 0) { + this._root.optimizeNodes(); + this._root.optimizeNames(this._root.names, this._constants); + } + } + _leafNode(node) { + this._currNode.nodes.push(node); + return this; + } + _blockNode(node) { + this._currNode.nodes.push(node); + this._nodes.push(node); + } + _endBlockNode(N1, N2) { + const n = this._currNode; + if (n instanceof N1 || (N2 && n instanceof N2)) { + this._nodes.pop(); + return this; + } + throw new Error(`CodeGen: not in block "${N2 ? `${N1.kind}/${N2.kind}` : N1.kind}"`); + } + _elseNode(node) { + const n = this._currNode; + if (!(n instanceof If)) { + throw new Error('CodeGen: "else" without "if"'); + } + this._currNode = n.else = node; + return this; + } + get _root() { + return this._nodes[0]; + } + get _currNode() { + const ns = this._nodes; + return ns[ns.length - 1]; + } + set _currNode(node) { + const ns = this._nodes; + ns[ns.length - 1] = node; + } +} +exports.CodeGen = CodeGen; +function addNames(names, from) { + for (const n in from) + names[n] = (names[n] || 0) + (from[n] || 0); + return names; +} +function addExprNames(names, from) { + return from instanceof code_1._CodeOrName ? addNames(names, from.names) : names; +} +function optimizeExpr(expr, names, constants) { + if (expr instanceof code_1.Name) + return replaceName(expr); + if (!canOptimize(expr)) + return expr; + return new code_1._Code(expr._items.reduce((items, c) => { + if (c instanceof code_1.Name) + c = replaceName(c); + if (c instanceof code_1._Code) + items.push(...c._items); + else + items.push(c); + return items; + }, [])); + function replaceName(n) { + const c = constants[n.str]; + if (c === undefined || names[n.str] !== 1) + return n; + delete names[n.str]; + return c; + } + function canOptimize(e) { + return (e instanceof code_1._Code && + e._items.some((c) => c instanceof code_1.Name && names[c.str] === 1 && constants[c.str] !== undefined)); + } +} +function subtractNames(names, from) { + for (const n in from) + names[n] = (names[n] || 0) - (from[n] || 0); +} +function not(x) { + return typeof x == "boolean" || typeof x == "number" || x === null ? !x : code_1._ `!${par(x)}`; +} +exports.not = not; +const andCode = mappend(exports.operators.AND); +// boolean AND (&&) expression with the passed arguments +function and(...args) { + return args.reduce(andCode); +} +exports.and = and; +const orCode = mappend(exports.operators.OR); +// boolean OR (||) expression with the passed arguments +function or(...args) { + return args.reduce(orCode); +} +exports.or = or; +function mappend(op) { + return (x, y) => (x === code_1.nil ? y : y === code_1.nil ? x : code_1._ `${par(x)} ${op} ${par(y)}`); +} +function par(x) { + return x instanceof code_1.Name ? x : code_1._ `(${x})`; +} +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/codegen/scope.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/codegen/scope.js new file mode 100644 index 00000000000000..ef1b1670127d50 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/codegen/scope.js @@ -0,0 +1,137 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ValueScope = exports.ValueScopeName = exports.Scope = exports.varKinds = void 0; +const code_1 = require("./code"); +class ValueError extends Error { + constructor(name) { + super(`CodeGen: "code" for ${name} not defined`); + this.value = name.value; + } +} +exports.varKinds = { + const: new code_1.Name("const"), + let: new code_1.Name("let"), + var: new code_1.Name("var"), +}; +class Scope { + constructor({ prefixes, parent } = {}) { + this._names = {}; + this._prefixes = prefixes; + this._parent = parent; + } + toName(nameOrPrefix) { + return nameOrPrefix instanceof code_1.Name ? nameOrPrefix : this.name(nameOrPrefix); + } + name(prefix) { + return new code_1.Name(this._newName(prefix)); + } + _newName(prefix) { + const ng = this._names[prefix] || this._nameGroup(prefix); + return `${prefix}${ng.index++}`; + } + _nameGroup(prefix) { + var _a, _b; + if (((_b = (_a = this._parent) === null || _a === void 0 ? void 0 : _a._prefixes) === null || _b === void 0 ? void 0 : _b.has(prefix)) || (this._prefixes && !this._prefixes.has(prefix))) { + throw new Error(`CodeGen: prefix "${prefix}" is not allowed in this scope`); + } + return (this._names[prefix] = { prefix, index: 0 }); + } +} +exports.Scope = Scope; +class ValueScopeName extends code_1.Name { + constructor(prefix, nameStr) { + super(nameStr); + this.prefix = prefix; + } + setValue(value, { property, itemIndex }) { + this.value = value; + this.scopePath = code_1._ `.${new code_1.Name(property)}[${itemIndex}]`; + } +} +exports.ValueScopeName = ValueScopeName; +const line = code_1._ `\n`; +class ValueScope extends Scope { + constructor(opts) { + super(opts); + this._values = {}; + this._scope = opts.scope; + this.opts = { ...opts, _n: opts.lines ? line : code_1.nil }; + } + get() { + return this._scope; + } + name(prefix) { + return new ValueScopeName(prefix, this._newName(prefix)); + } + value(nameOrPrefix, value) { + var _a; + if (value.ref === undefined) + throw new Error("CodeGen: ref must be passed in value"); + const name = this.toName(nameOrPrefix); + const { prefix } = name; + const valueKey = (_a = value.key) !== null && _a !== void 0 ? _a : value.ref; + let vs = this._values[prefix]; + if (vs) { + const _name = vs.get(valueKey); + if (_name) + return _name; + } + else { + vs = this._values[prefix] = new Map(); + } + vs.set(valueKey, name); + const s = this._scope[prefix] || (this._scope[prefix] = []); + const itemIndex = s.length; + s[itemIndex] = value.ref; + name.setValue(value, { property: prefix, itemIndex }); + return name; + } + getValue(prefix, keyOrRef) { + const vs = this._values[prefix]; + if (!vs) + return; + return vs.get(keyOrRef); + } + scopeRefs(scopeName, values = this._values) { + return this._reduceValues(values, (name) => { + if (name.scopePath === undefined) + throw new Error(`CodeGen: name "${name}" has no value`); + return code_1._ `${scopeName}${name.scopePath}`; + }); + } + scopeCode(values = this._values, usedValues, getCode) { + return this._reduceValues(values, (name) => { + if (name.value === undefined) + throw new Error(`CodeGen: name "${name}" has no value`); + return name.value.code; + }, usedValues, getCode); + } + _reduceValues(values, valueCode, usedValues = {}, getCode) { + let code = code_1.nil; + for (const prefix in values) { + const vs = values[prefix]; + if (!vs) + continue; + const nameSet = (usedValues[prefix] = usedValues[prefix] || new Set()); + vs.forEach((name) => { + if (nameSet.has(name)) + return; + nameSet.add(name); + let c = valueCode(name); + if (c) { + const def = this.opts.es5 ? exports.varKinds.var : exports.varKinds.const; + code = code_1._ `${code}${def} ${name} = ${c};${this.opts._n}`; + } + else if ((c = getCode === null || getCode === void 0 ? void 0 : getCode(name))) { + code = code_1._ `${code}${c}${this.opts._n}`; + } + else { + throw new ValueError(name); + } + }); + } + return code; + } +} +exports.ValueScope = ValueScope; +//# sourceMappingURL=scope.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/context.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/context.js new file mode 100644 index 00000000000000..fc3e3f7e1d9005 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/context.js @@ -0,0 +1,240 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getData = void 0; +const dataType_1 = require("./validate/dataType"); +const util_1 = require("./util"); +const errors_1 = require("./errors"); +const codegen_1 = require("./codegen"); +const names_1 = require("./names"); +const subschema_1 = require("./subschema"); +class KeywordCxt { + constructor(it, def, keyword) { + validateKeywordUsage(it, def, keyword); + this.gen = it.gen; + this.allErrors = it.allErrors; + this.keyword = keyword; + this.data = it.data; + this.schema = it.schema[keyword]; + this.$data = def.$data && it.opts.$data && this.schema && this.schema.$data; + this.schemaValue = util_1.schemaRefOrVal(it, this.schema, keyword, this.$data); + this.schemaType = def.schemaType; + this.parentSchema = it.schema; + this.params = {}; + this.it = it; + this.def = def; + if (this.$data) { + this.schemaCode = it.gen.const("vSchema", getData(this.$data, it)); + } + else { + this.schemaCode = this.schemaValue; + if (!validSchemaType(this.schema, def.schemaType, def.allowUndefined)) { + throw new Error(`${keyword} value must be ${JSON.stringify(def.schemaType)}`); + } + } + if ("code" in def ? def.trackErrors : def.errors !== false) { + this.errsCount = it.gen.const("_errs", names_1.default.errors); + } + } + result(condition, successAction, failAction) { + this.gen.if(codegen_1.not(condition)); + if (failAction) + failAction(); + else + this.error(); + if (successAction) { + this.gen.else(); + successAction(); + if (this.allErrors) + this.gen.endIf(); + } + else { + if (this.allErrors) + this.gen.endIf(); + else + this.gen.else(); + } + } + pass(condition, failAction) { + this.result(condition, undefined, failAction); + } + fail(condition) { + if (condition === undefined) { + this.error(); + if (!this.allErrors) + this.gen.if(false); // this branch will be removed by gen.optimize + return; + } + this.gen.if(condition); + this.error(); + if (this.allErrors) + this.gen.endIf(); + else + this.gen.else(); + } + fail$data(condition) { + if (!this.$data) + return this.fail(condition); + const { schemaCode } = this; + this.fail(codegen_1._ `${schemaCode} !== undefined && (${codegen_1.or(this.invalid$data(), condition)})`); + } + error(append) { + ; + (append ? errors_1.reportExtraError : errors_1.reportError)(this, this.def.error || errors_1.keywordError); + } + $dataError() { + errors_1.reportError(this, this.def.$dataError || errors_1.keyword$DataError); + } + reset() { + if (this.errsCount === undefined) + throw new Error('add "trackErrors" to keyword definition'); + errors_1.resetErrorsCount(this.gen, this.errsCount); + } + ok(cond) { + if (!this.allErrors) + this.gen.if(cond); + } + setParams(obj, assign) { + if (assign) + Object.assign(this.params, obj); + else + this.params = obj; + } + block$data(valid, codeBlock, $dataValid = codegen_1.nil) { + this.gen.block(() => { + this.check$data(valid, $dataValid); + codeBlock(); + }); + } + check$data(valid = codegen_1.nil, $dataValid = codegen_1.nil) { + if (!this.$data) + return; + const { gen, schemaCode, schemaType, def } = this; + gen.if(codegen_1.or(codegen_1._ `${schemaCode} === undefined`, $dataValid)); + if (valid !== codegen_1.nil) + gen.assign(valid, true); + if (schemaType.length || def.validateSchema) { + gen.elseIf(this.invalid$data()); + this.$dataError(); + if (valid !== codegen_1.nil) + gen.assign(valid, false); + } + gen.else(); + } + invalid$data() { + const { gen, schemaCode, schemaType, def, it } = this; + return codegen_1.or(wrong$DataType(), invalid$DataSchema()); + function wrong$DataType() { + if (schemaType.length) { + /* istanbul ignore if */ + if (!(schemaCode instanceof codegen_1.Name)) + throw new Error("ajv implementation error"); + const st = Array.isArray(schemaType) ? schemaType : [schemaType]; + return codegen_1._ `${dataType_1.checkDataTypes(st, schemaCode, it.opts.strict, dataType_1.DataType.Wrong)}`; + } + return codegen_1.nil; + } + function invalid$DataSchema() { + if (def.validateSchema) { + const validateSchemaRef = gen.scopeValue("validate$data", { ref: def.validateSchema }); // TODO value.code for standalone + return codegen_1._ `!${validateSchemaRef}(${schemaCode})`; + } + return codegen_1.nil; + } + } + subschema(appl, valid) { + return subschema_1.applySubschema(this.it, appl, valid); + } + mergeEvaluated(schemaCxt, toName) { + const { it, gen } = this; + if (!it.opts.unevaluated) + return; + if (it.props !== true && schemaCxt.props !== undefined) { + it.props = util_1.mergeEvaluated.props(gen, schemaCxt.props, it.props, toName); + } + if (it.items !== true && schemaCxt.items !== undefined) { + it.items = util_1.mergeEvaluated.items(gen, schemaCxt.items, it.items, toName); + } + } + mergeValidEvaluated(schemaCxt, valid) { + const { it, gen } = this; + if (it.opts.unevaluated && (it.props !== true || it.items !== true)) { + gen.if(valid, () => this.mergeEvaluated(schemaCxt, codegen_1.Name)); + return true; + } + } +} +exports.default = KeywordCxt; +function validSchemaType(schema, schemaType, allowUndefined = false) { + // TODO add tests + return (!schemaType.length || + schemaType.some((st) => st === "array" + ? Array.isArray(schema) + : st === "object" + ? schema && typeof schema == "object" && !Array.isArray(schema) + : typeof schema == st || (allowUndefined && typeof schema == "undefined"))); +} +function validateKeywordUsage({ schema, opts, self }, def, keyword) { + /* istanbul ignore if */ + if (Array.isArray(def.keyword) ? !def.keyword.includes(keyword) : def.keyword !== keyword) { + throw new Error("ajv implementation error"); + } + const deps = def.dependencies; + if (deps === null || deps === void 0 ? void 0 : deps.some((kwd) => !Object.prototype.hasOwnProperty.call(schema, kwd))) { + throw new Error(`parent schema must have dependencies of ${keyword}: ${deps.join(",")}`); + } + if (def.validateSchema) { + const valid = def.validateSchema(schema[keyword]); + if (!valid) { + const msg = "keyword value is invalid: " + self.errorsText(def.validateSchema.errors); + if (opts.validateSchema === "log") + self.logger.error(msg); + else + throw new Error(msg); + } + } +} +const JSON_POINTER = /^\/(?:[^~]|~0|~1)*$/; +const RELATIVE_JSON_POINTER = /^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/; +function getData($data, { dataLevel, dataNames, dataPathArr }) { + let jsonPointer; + let data; + if ($data === "") + return names_1.default.rootData; + if ($data[0] === "/") { + if (!JSON_POINTER.test($data)) + throw new Error(`Invalid JSON-pointer: ${$data}`); + jsonPointer = $data; + data = names_1.default.rootData; + } + else { + const matches = RELATIVE_JSON_POINTER.exec($data); + if (!matches) + throw new Error(`Invalid JSON-pointer: ${$data}`); + const up = +matches[1]; + jsonPointer = matches[2]; + if (jsonPointer === "#") { + if (up >= dataLevel) + throw new Error(errorMsg("property/index", up)); + return dataPathArr[dataLevel - up]; + } + if (up > dataLevel) + throw new Error(errorMsg("data", up)); + data = dataNames[dataLevel - up]; + if (!jsonPointer) + return data; + } + let expr = data; + const segments = jsonPointer.split("/"); + for (const segment of segments) { + if (segment) { + data = codegen_1._ `${data}${codegen_1.getProperty(util_1.unescapeJsonPointer(segment))}`; + expr = codegen_1._ `${expr} && ${data}`; + } + } + return expr; + function errorMsg(pointerType, up) { + return `Cannot access ${pointerType} ${up} levels up, current level is ${dataLevel}`; + } +} +exports.getData = getData; +//# sourceMappingURL=context.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/equal.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/equal.js new file mode 100644 index 00000000000000..e5b45c3ca8d4c8 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/equal.js @@ -0,0 +1,5 @@ +"use strict"; +// do NOT remove this file - it would break pre-compiled schemas +// https://github.com/ajv-validator/ajv/issues/889 +module.exports = require("fast-deep-equal"); +//# sourceMappingURL=equal.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/error_classes.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/error_classes.js new file mode 100644 index 00000000000000..753d657af035c2 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/error_classes.js @@ -0,0 +1,25 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.MissingRefError = exports.ValidationError = void 0; +const resolve_1 = require("./resolve"); +class ValidationError extends Error { + constructor(errors) { + super("validation failed"); + this.errors = errors; + this.ajv = this.validation = true; + } +} +exports.ValidationError = ValidationError; +class MissingRefError extends Error { + constructor(baseId, ref) { + super(`can't resolve reference ${ref} from id ${baseId}`); + this.missingRef = resolve_1.resolveUrl(baseId, ref); + this.missingSchema = resolve_1.normalizeId(resolve_1.getFullPath(this.missingRef)); + } +} +exports.MissingRefError = MissingRefError; +module.exports = { + ValidationError, + MissingRefError, +}; +//# sourceMappingURL=error_classes.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/errors.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/errors.js new file mode 100644 index 00000000000000..f248e67c2c7866 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/errors.js @@ -0,0 +1,103 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.extendErrors = exports.resetErrorsCount = exports.reportExtraError = exports.reportError = exports.keyword$DataError = exports.keywordError = void 0; +const codegen_1 = require("./codegen"); +const names_1 = require("./names"); +exports.keywordError = { + message: ({ keyword }) => codegen_1.str `should pass "${keyword}" keyword validation`, +}; +exports.keyword$DataError = { + message: ({ keyword, schemaType }) => schemaType + ? codegen_1.str `"${keyword}" keyword must be ${schemaType} ($data)` + : codegen_1.str `"${keyword}" keyword is invalid ($data)`, +}; +function reportError(cxt, error, overrideAllErrors) { + const { it } = cxt; + const { gen, compositeRule, allErrors } = it; + const errObj = errorObjectCode(cxt, error); + if (overrideAllErrors !== null && overrideAllErrors !== void 0 ? overrideAllErrors : (compositeRule || allErrors)) { + addError(gen, errObj); + } + else { + returnErrors(it, codegen_1._ `[${errObj}]`); + } +} +exports.reportError = reportError; +function reportExtraError(cxt, error) { + const { it } = cxt; + const { gen, compositeRule, allErrors } = it; + const errObj = errorObjectCode(cxt, error); + addError(gen, errObj); + if (!(compositeRule || allErrors)) { + returnErrors(it, names_1.default.vErrors); + } +} +exports.reportExtraError = reportExtraError; +function resetErrorsCount(gen, errsCount) { + gen.assign(names_1.default.errors, errsCount); + gen.if(codegen_1._ `${names_1.default.vErrors} !== null`, () => gen.if(errsCount, () => gen.assign(codegen_1._ `${names_1.default.vErrors}.length`, errsCount), () => gen.assign(names_1.default.vErrors, null))); +} +exports.resetErrorsCount = resetErrorsCount; +function extendErrors({ gen, keyword, schemaValue, data, errsCount, it, }) { + /* istanbul ignore if */ + if (errsCount === undefined) + throw new Error("ajv implementation error"); + const err = gen.name("err"); + gen.forRange("i", errsCount, names_1.default.errors, (i) => { + gen.const(err, codegen_1._ `${names_1.default.vErrors}[${i}]`); + gen.if(codegen_1._ `${err}.dataPath === undefined`, () => gen.assign(codegen_1._ `${err}.dataPath`, codegen_1.strConcat(names_1.default.dataPath, it.errorPath))); + gen.assign(codegen_1._ `${err}.schemaPath`, codegen_1.str `${it.errSchemaPath}/${keyword}`); + if (it.opts.verbose) { + gen.assign(codegen_1._ `${err}.schema`, schemaValue); + gen.assign(codegen_1._ `${err}.data`, data); + } + }); +} +exports.extendErrors = extendErrors; +function addError(gen, errObj) { + const err = gen.const("err", errObj); + gen.if(codegen_1._ `${names_1.default.vErrors} === null`, () => gen.assign(names_1.default.vErrors, codegen_1._ `[${err}]`), codegen_1._ `${names_1.default.vErrors}.push(${err})`); + gen.code(codegen_1._ `${names_1.default.errors}++`); +} +function returnErrors(it, errs) { + const { gen, validateName, schemaEnv } = it; + if (schemaEnv.$async) { + gen.throw(codegen_1._ `new ${it.ValidationError}(${errs})`); + } + else { + gen.assign(codegen_1._ `${validateName}.errors`, errs); + gen.return(false); + } +} +const E = { + keyword: new codegen_1.Name("keyword"), + schemaPath: new codegen_1.Name("schemaPath"), + params: new codegen_1.Name("params"), + propertyName: new codegen_1.Name("propertyName"), + message: new codegen_1.Name("message"), + schema: new codegen_1.Name("schema"), + parentSchema: new codegen_1.Name("parentSchema"), +}; +function errorObjectCode(cxt, error) { + const { keyword, data, schemaValue, it: { gen, createErrors, topSchemaRef, schemaPath, errorPath, errSchemaPath, propertyName, opts }, } = cxt; + if (createErrors === false) + return codegen_1._ `{}`; + const { params, message } = error; + const keyValues = [ + [E.keyword, keyword], + [names_1.default.dataPath, codegen_1.strConcat(names_1.default.dataPath, errorPath)], + [E.schemaPath, codegen_1.str `${errSchemaPath}/${keyword}`], + [E.params, typeof params == "function" ? params(cxt) : params || codegen_1._ `{}`], + ]; + if (propertyName) + keyValues.push([E.propertyName, propertyName]); + if (opts.messages !== false) { + const msg = typeof message == "function" ? message(cxt) : message; + keyValues.push([E.message, msg]); + } + if (opts.verbose) { + keyValues.push([E.schema, schemaValue], [E.parentSchema, codegen_1._ `${topSchemaRef}${schemaPath}`], [names_1.default.data, data]); + } + return gen.object(...keyValues); +} +//# sourceMappingURL=errors.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/index.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/index.js new file mode 100644 index 00000000000000..b9d9bfb09974ce --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/index.js @@ -0,0 +1,230 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.resolveSchema = exports.resolveRef = exports.compileSchema = exports.SchemaEnv = void 0; +const codegen_1 = require("./codegen"); +const error_classes_1 = require("./error_classes"); +const names_1 = require("./names"); +const resolve_1 = require("./resolve"); +const util_1 = require("./util"); +const validate_1 = require("./validate"); +const URI = require("uri-js"); +class SchemaEnv { + constructor(env) { + var _a; + this.refs = {}; + this.dynamicAnchors = {}; + let schema; + if (typeof env.schema == "object") + schema = env.schema; + this.schema = env.schema; + this.root = env.root || this; + this.baseId = (_a = env.baseId) !== null && _a !== void 0 ? _a : resolve_1.normalizeId(schema === null || schema === void 0 ? void 0 : schema.$id); + this.localRefs = env.localRefs; + this.meta = env.meta; + this.$async = schema === null || schema === void 0 ? void 0 : schema.$async; + this.refs = {}; + } +} +exports.SchemaEnv = SchemaEnv; +// let codeSize = 0 +// let nodeCount = 0 +// Compiles schema in SchemaEnv +function compileSchema(sch) { + // TODO refactor - remove compilations + const _sch = getCompilingSchema.call(this, sch); + if (_sch) + return _sch; + const rootId = resolve_1.getFullPath(sch.root.baseId); // TODO if getFullPath removed 1 tests fails + const { es5, lines } = this.opts.code; + const { ownProperties } = this.opts; + const gen = new codegen_1.CodeGen(this.scope, { es5, lines, ownProperties }); + let _ValidationError; + if (sch.$async) { + _ValidationError = gen.scopeValue("Error", { + ref: error_classes_1.ValidationError, + code: codegen_1._ `require("ajv/dist/compile/error_classes").ValidationError`, + }); + } + const validateName = gen.scopeName("validate"); + sch.validateName = validateName; + const schemaCxt = { + gen, + allErrors: this.opts.allErrors, + data: names_1.default.data, + parentData: names_1.default.parentData, + parentDataProperty: names_1.default.parentDataProperty, + dataNames: [names_1.default.data], + dataPathArr: [codegen_1.nil], + dataLevel: 0, + dataTypes: [], + topSchemaRef: gen.scopeValue("schema", this.opts.code.source === true + ? { ref: sch.schema, code: codegen_1.stringify(sch.schema) } + : { ref: sch.schema }), + validateName, + ValidationError: _ValidationError, + schema: sch.schema, + schemaEnv: sch, + strictSchema: true, + rootId, + baseId: sch.baseId || rootId, + schemaPath: codegen_1.nil, + errSchemaPath: "#", + errorPath: codegen_1._ `""`, + opts: this.opts, + self: this, + }; + let sourceCode; + try { + this._compilations.add(sch); + validate_1.validateFunctionCode(schemaCxt); + gen.optimize(this.opts.code.optimize); + // gen.optimize(1) + const validateCode = gen.toString(); + sourceCode = `${gen.scopeRefs(names_1.default.scope)}return ${validateCode}`; + // console.log((codeSize += sourceCode.length), (nodeCount += gen.nodeCount)) + if (this.opts.code.process) + sourceCode = this.opts.code.process(sourceCode, sch); + // console.log("\n\n\n *** \n", sourceCode) + const makeValidate = new Function(`${names_1.default.self}`, `${names_1.default.scope}`, sourceCode); + const validate = makeValidate(this, this.scope.get()); + this.scope.value(validateName, { ref: validate }); + validate.errors = null; + validate.schema = sch.schema; + validate.schemaEnv = sch; + if (sch.$async) + validate.$async = true; + if (this.opts.code.source === true) { + validate.source = { validateName, validateCode, scopeValues: gen._values }; + } + if (this.opts.unevaluated) { + const { props, items } = schemaCxt; + validate.evaluated = { + props: props instanceof codegen_1.Name ? undefined : props, + items: items instanceof codegen_1.Name ? undefined : items, + dynamicProps: props instanceof codegen_1.Name, + dynamicItems: items instanceof codegen_1.Name, + }; + if (validate.source) + validate.source.evaluated = codegen_1.stringify(validate.evaluated); + } + sch.validate = validate; + return sch; + } + catch (e) { + delete sch.validate; + delete sch.validateName; + if (sourceCode) + this.logger.error("Error compiling schema, function code:", sourceCode); + // console.log("\n\n\n *** \n", sourceCode, this.opts) + throw e; + } + finally { + this._compilations.delete(sch); + } +} +exports.compileSchema = compileSchema; +function resolveRef(root, baseId, ref) { + var _a; + ref = resolve_1.resolveUrl(baseId, ref); + const schOrFunc = root.refs[ref]; + if (schOrFunc) + return schOrFunc; + let _sch = resolve.call(this, root, ref); + if (_sch === undefined) { + const schema = (_a = root.localRefs) === null || _a === void 0 ? void 0 : _a[ref]; // TODO maybe localRefs should hold SchemaEnv + if (schema) + _sch = new SchemaEnv({ schema, root, baseId }); + } + if (_sch === undefined) + return; + return (root.refs[ref] = inlineOrCompile.call(this, _sch)); +} +exports.resolveRef = resolveRef; +function inlineOrCompile(sch) { + if (resolve_1.inlineRef(sch.schema, this.opts.inlineRefs)) + return sch.schema; + return sch.validate ? sch : compileSchema.call(this, sch); +} +// Index of schema compilation in the currently compiled list +function getCompilingSchema(schEnv) { + for (const sch of this._compilations) { + if (sameSchemaEnv(sch, schEnv)) + return sch; + } +} +function sameSchemaEnv(s1, s2) { + return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId; +} +// resolve and compile the references ($ref) +// TODO returns AnySchemaObject (if the schema can be inlined) or validation function +function resolve(root, // information about the root schema for the current schema +ref // reference to resolve +) { + let sch; + while (typeof (sch = this.refs[ref]) == "string") + ref = sch; + return sch || this.schemas[ref] || resolveSchema.call(this, root, ref); +} +// Resolve schema, its root and baseId +function resolveSchema(root, // root object with properties schema, refs TODO below SchemaEnv is assigned to it +ref // reference to resolve +) { + const p = URI.parse(ref); + const refPath = resolve_1._getFullPath(p); + const baseId = resolve_1.getFullPath(root.baseId); + // TODO `Object.keys(root.schema).length > 0` should not be needed - but removing breaks 2 tests + if (Object.keys(root.schema).length > 0 && refPath === baseId) { + return getJsonPointer.call(this, p, root); + } + const id = resolve_1.normalizeId(refPath); + const schOrRef = this.refs[id] || this.schemas[id]; + if (typeof schOrRef == "string") { + const sch = resolveSchema.call(this, root, schOrRef); + if (typeof (sch === null || sch === void 0 ? void 0 : sch.schema) !== "object") + return; + return getJsonPointer.call(this, p, sch); + } + if (typeof (schOrRef === null || schOrRef === void 0 ? void 0 : schOrRef.schema) !== "object") + return; + if (!schOrRef.validate) + compileSchema.call(this, schOrRef); + if (id === resolve_1.normalizeId(ref)) + return new SchemaEnv({ schema: schOrRef.schema, root, baseId }); + return getJsonPointer.call(this, p, schOrRef); +} +exports.resolveSchema = resolveSchema; +const PREVENT_SCOPE_CHANGE = new Set([ + "properties", + "patternProperties", + "enum", + "dependencies", + "definitions", +]); +function getJsonPointer(parsedRef, { baseId, schema, root }) { + var _a; + if (((_a = parsedRef.fragment) === null || _a === void 0 ? void 0 : _a[0]) !== "/") + return; + for (const part of parsedRef.fragment.slice(1).split("/")) { + if (typeof schema == "boolean") + return; + schema = schema[util_1.unescapeFragment(part)]; + if (schema === undefined) + return; + // TODO PREVENT_SCOPE_CHANGE could be defined in keyword def? + if (!PREVENT_SCOPE_CHANGE.has(part) && typeof schema == "object" && schema.$id) { + baseId = resolve_1.resolveUrl(baseId, schema.$id); + } + } + let env; + if (typeof schema != "boolean" && schema.$ref && !util_1.schemaHasRulesButRef(schema, this.RULES)) { + const $ref = resolve_1.resolveUrl(baseId, schema.$ref); + env = resolveSchema.call(this, root, $ref); + } + // even though resolution failed we need to return SchemaEnv to throw exception + // so that compileAsync loads missing schema. + env = env || new SchemaEnv({ schema, root, baseId }); + if (env.schema !== env.root.schema) + return env; + return undefined; +} +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/names.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/names.js new file mode 100644 index 00000000000000..d40037194ae3d9 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/names.js @@ -0,0 +1,23 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("./codegen"); +const names = { + // validation function arguments + data: new codegen_1.Name("data"), + // args passed from referencing schema + valCxt: new codegen_1.Name("valCxt"), + dataPath: new codegen_1.Name("dataPath"), + parentData: new codegen_1.Name("parentData"), + parentDataProperty: new codegen_1.Name("parentDataProperty"), + rootData: new codegen_1.Name("rootData"), + dynamicAnchors: new codegen_1.Name("dynamicAnchors"), + // function scoped variables + vErrors: new codegen_1.Name("vErrors"), + errors: new codegen_1.Name("errors"), + this: new codegen_1.Name("this"), + // "globals" + self: new codegen_1.Name("self"), + scope: new codegen_1.Name("scope"), +}; +exports.default = names; +//# sourceMappingURL=names.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/resolve.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/resolve.js new file mode 100644 index 00000000000000..37eb9a8654c43d --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/resolve.js @@ -0,0 +1,152 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getSchemaRefs = exports.resolveUrl = exports.normalizeId = exports._getFullPath = exports.getFullPath = exports.inlineRef = void 0; +const util_1 = require("./util"); +const equal = require("fast-deep-equal"); +const traverse = require("json-schema-traverse"); +const URI = require("uri-js"); +// TODO refactor to use keyword definitions +const SIMPLE_INLINED = new Set([ + "type", + "format", + "pattern", + "maxLength", + "minLength", + "maxProperties", + "minProperties", + "maxItems", + "minItems", + "maximum", + "minimum", + "uniqueItems", + "multipleOf", + "required", + "enum", + "const", +]); +function inlineRef(schema, limit = true) { + if (typeof schema == "boolean") + return true; + if (limit === true) + return !hasRef(schema); + if (!limit) + return false; + return countKeys(schema) <= limit; +} +exports.inlineRef = inlineRef; +const REF_KEYWORDS = new Set([ + "$ref", + "$recursiveRef", + "$recursiveAnchor", + "$dynamicRef", + "$dynamicAnchor", +]); +function hasRef(schema) { + for (const key in schema) { + if (REF_KEYWORDS.has(key)) + return true; + const sch = schema[key]; + if (Array.isArray(sch) && sch.some(hasRef)) + return true; + if (typeof sch == "object" && hasRef(sch)) + return true; + } + return false; +} +function countKeys(schema) { + let count = 0; + for (const key in schema) { + if (key === "$ref") + return Infinity; + count++; + if (SIMPLE_INLINED.has(key)) + continue; + if (typeof schema[key] == "object") { + util_1.eachItem(schema[key], (sch) => (count += countKeys(sch))); + } + if (count === Infinity) + return Infinity; + } + return count; +} +function getFullPath(id = "", normalize) { + if (normalize !== false) + id = normalizeId(id); + const p = URI.parse(id); + return _getFullPath(p); +} +exports.getFullPath = getFullPath; +function _getFullPath(p) { + return URI.serialize(p).split("#")[0] + "#"; +} +exports._getFullPath = _getFullPath; +const TRAILING_SLASH_HASH = /#\/?$/; +function normalizeId(id) { + return id ? id.replace(TRAILING_SLASH_HASH, "") : ""; +} +exports.normalizeId = normalizeId; +function resolveUrl(baseId, id) { + id = normalizeId(id); + return URI.resolve(baseId, id); +} +exports.resolveUrl = resolveUrl; +const ANCHOR = /^[a-z_][-a-z0-9._]*$/i; +function getSchemaRefs(schema) { + if (typeof schema == "boolean") + return {}; + const schemaId = normalizeId(schema.$id); + const baseIds = { "": schemaId }; + const pathPrefix = getFullPath(schemaId, false); + const localRefs = {}; + const schemaRefs = new Set(); + traverse(schema, { allKeys: true }, (sch, jsonPtr, _, parentJsonPtr) => { + if (parentJsonPtr === undefined) + return; + const fullPath = pathPrefix + jsonPtr; + let baseId = baseIds[parentJsonPtr]; + if (typeof sch.$id == "string") + baseId = addRef.call(this, sch.$id); + addAnchor.call(this, sch.$anchor); + addAnchor.call(this, sch.$dynamicAnchor); + baseIds[jsonPtr] = baseId; + function addRef(ref) { + ref = normalizeId(baseId ? URI.resolve(baseId, ref) : ref); + if (schemaRefs.has(ref)) + throw ambiguos(ref); + schemaRefs.add(ref); + let schOrRef = this.refs[ref]; + if (typeof schOrRef == "string") + schOrRef = this.refs[schOrRef]; + if (typeof schOrRef == "object") { + checkAmbiguosRef(sch, schOrRef.schema, ref); + } + else if (ref !== normalizeId(fullPath)) { + if (ref[0] === "#") { + checkAmbiguosRef(sch, localRefs[ref], ref); + localRefs[ref] = sch; + } + else { + this.refs[ref] = fullPath; + } + } + return ref; + } + function addAnchor(anchor) { + if (typeof anchor == "string") { + if (!ANCHOR.test(anchor)) + throw new Error(`invalid anchor "${anchor}"`); + addRef.call(this, `#${anchor}`); + } + } + }); + return localRefs; + function checkAmbiguosRef(sch1, sch2, ref) { + if (sch2 !== undefined && !equal(sch1, sch2)) + throw ambiguos(ref); + } + function ambiguos(ref) { + return new Error(`reference "${ref}" resolves to more than one schema`); + } +} +exports.getSchemaRefs = getSchemaRefs; +//# sourceMappingURL=resolve.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/rules.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/rules.js new file mode 100644 index 00000000000000..11c114a4c33477 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/rules.js @@ -0,0 +1,26 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getRules = exports.isJSONType = void 0; +const _jsonTypes = ["string", "number", "integer", "boolean", "null", "object", "array"]; +const jsonTypes = new Set(_jsonTypes); +function isJSONType(x) { + return typeof x == "string" && jsonTypes.has(x); +} +exports.isJSONType = isJSONType; +function getRules() { + const groups = { + number: { type: "number", rules: [] }, + string: { type: "string", rules: [] }, + array: { type: "array", rules: [] }, + object: { type: "object", rules: [] }, + }; + return { + types: { ...groups, integer: true, boolean: true, null: true }, + rules: [{ rules: [] }, groups.number, groups.string, groups.array, groups.object], + post: { rules: [] }, + all: { type: true, $comment: true }, + keywords: { type: true, $comment: true }, + }; +} +exports.getRules = getRules; +//# sourceMappingURL=rules.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/subschema.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/subschema.js new file mode 100644 index 00000000000000..df69e4cc54bf7e --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/subschema.js @@ -0,0 +1,106 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.applySubschema = exports.Type = void 0; +const validate_1 = require("./validate"); +const util_1 = require("./util"); +const codegen_1 = require("./codegen"); +var Type; +(function (Type) { + Type[Type["Num"] = 0] = "Num"; + Type[Type["Str"] = 1] = "Str"; +})(Type = exports.Type || (exports.Type = {})); +function applySubschema(it, appl, valid) { + const subschema = getSubschema(it, appl); + extendSubschemaData(subschema, it, appl); + extendSubschemaMode(subschema, appl); + const nextContext = { ...it, ...subschema, items: undefined, props: undefined }; + validate_1.subschemaCode(nextContext, valid); + return nextContext; +} +exports.applySubschema = applySubschema; +function getSubschema(it, { keyword, schemaProp, schema, strictSchema, schemaPath, errSchemaPath, topSchemaRef, }) { + if (keyword !== undefined && schema !== undefined) { + throw new Error('both "keyword" and "schema" passed, only one allowed'); + } + if (keyword !== undefined) { + const sch = it.schema[keyword]; + return schemaProp === undefined + ? { + schema: sch, + schemaPath: codegen_1._ `${it.schemaPath}${codegen_1.getProperty(keyword)}`, + errSchemaPath: `${it.errSchemaPath}/${keyword}`, + } + : { + schema: sch[schemaProp], + schemaPath: codegen_1._ `${it.schemaPath}${codegen_1.getProperty(keyword)}${codegen_1.getProperty(schemaProp)}`, + errSchemaPath: `${it.errSchemaPath}/${keyword}/${util_1.escapeFragment(schemaProp)}`, + }; + } + if (schema !== undefined) { + if (schemaPath === undefined || errSchemaPath === undefined || topSchemaRef === undefined) { + throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"'); + } + return { + schema, + strictSchema, + schemaPath, + topSchemaRef, + errSchemaPath, + }; + } + throw new Error('either "keyword" or "schema" must be passed'); +} +function extendSubschemaData(subschema, it, { dataProp, dataPropType: dpType, data, dataTypes, propertyName }) { + if (data !== undefined && dataProp !== undefined) { + throw new Error('both "data" and "dataProp" passed, only one allowed'); + } + const { gen } = it; + if (dataProp !== undefined) { + const { errorPath, dataPathArr, opts } = it; + const nextData = gen.let("data", codegen_1._ `${it.data}${codegen_1.getProperty(dataProp)}`, true); + dataContextProps(nextData); + subschema.errorPath = codegen_1.str `${errorPath}${getErrorPath(dataProp, dpType, opts.jsPropertySyntax)}`; + subschema.parentDataProperty = codegen_1._ `${dataProp}`; + subschema.dataPathArr = [...dataPathArr, subschema.parentDataProperty]; + } + if (data !== undefined) { + const nextData = data instanceof codegen_1.Name ? data : gen.let("data", data, true); // replaceable if used once? + dataContextProps(nextData); + if (propertyName !== undefined) + subschema.propertyName = propertyName; + // TODO something is possibly wrong here with not changing parentDataProperty and not appending dataPathArr + } + if (dataTypes) + subschema.dataTypes = dataTypes; + function dataContextProps(_nextData) { + subschema.data = _nextData; + subschema.dataLevel = it.dataLevel + 1; + subschema.dataTypes = []; + subschema.parentData = it.data; + subschema.dataNames = [...it.dataNames, _nextData]; + } +} +function extendSubschemaMode(subschema, { compositeRule, createErrors, allErrors, strictSchema }) { + if (compositeRule !== undefined) + subschema.compositeRule = compositeRule; + if (createErrors !== undefined) + subschema.createErrors = createErrors; + if (allErrors !== undefined) + subschema.allErrors = allErrors; + subschema.strictSchema = strictSchema; // not inherited +} +function getErrorPath(dataProp, dataPropType, jsPropertySyntax) { + // let path + if (dataProp instanceof codegen_1.Name) { + const isNumber = dataPropType === Type.Num; + return jsPropertySyntax + ? isNumber + ? codegen_1._ `"[" + ${dataProp} + "]"` + : codegen_1._ `"['" + ${dataProp} + "']"` + : isNumber + ? codegen_1._ `"/" + ${dataProp}` + : codegen_1._ `"/" + ${dataProp}.replace(/~/g, "~0").replace(/\\//g, "~1")`; // TODO maybe use global escapePointer + } + return jsPropertySyntax ? codegen_1.getProperty(dataProp).toString() : "/" + util_1.escapeJsonPointer(dataProp); +} +//# sourceMappingURL=subschema.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/ucs2length.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/ucs2length.js new file mode 100644 index 00000000000000..ba946089f7a780 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/ucs2length.js @@ -0,0 +1,23 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// https://mathiasbynens.be/notes/javascript-encoding +// https://github.com/bestiejs/punycode.js - punycode.ucs2.decode +function ucs2length(str) { + const len = str.length; + let length = 0; + let pos = 0; + let value; + while (pos < len) { + length++; + value = str.charCodeAt(pos++); + if (value >= 0xd800 && value <= 0xdbff && pos < len) { + // high surrogate, and there is a next character + value = str.charCodeAt(pos); + if ((value & 0xfc00) === 0xdc00) + pos++; // low surrogate + } + } + return length; +} +exports.default = ucs2length; +//# sourceMappingURL=ucs2length.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/util.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/util.js new file mode 100644 index 00000000000000..e0c90c7e1475ab --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/util.js @@ -0,0 +1,141 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.setEvaluated = exports.evaluatedPropsToName = exports.mergeEvaluated = exports.eachItem = exports.unescapeJsonPointer = exports.escapeJsonPointer = exports.escapeFragment = exports.unescapeFragment = exports.schemaRefOrVal = exports.schemaHasRulesButRef = exports.schemaHasRules = exports.checkUnknownRules = exports.alwaysValidSchema = exports.toHash = void 0; +const codegen_1 = require("./codegen"); +const validate_1 = require("./validate"); +// TODO refactor to use Set +function toHash(arr) { + const hash = {}; + for (const item of arr) + hash[item] = true; + return hash; +} +exports.toHash = toHash; +function alwaysValidSchema(it, schema) { + if (typeof schema == "boolean") + return schema; + if (Object.keys(schema).length === 0) + return true; + checkUnknownRules(it, schema); + return !schemaHasRules(schema, it.self.RULES.all); +} +exports.alwaysValidSchema = alwaysValidSchema; +function checkUnknownRules(it, schema = it.schema) { + const { opts, self } = it; + if (!opts.strict) + return; + if (typeof schema === "boolean") + return; + const rules = self.RULES.keywords; + for (const key in schema) { + if (!rules[key]) + validate_1.checkStrictMode(it, `unknown keyword: "${key}"`); + } +} +exports.checkUnknownRules = checkUnknownRules; +function schemaHasRules(schema, rules) { + if (typeof schema == "boolean") + return !schema; + for (const key in schema) + if (rules[key]) + return true; + return false; +} +exports.schemaHasRules = schemaHasRules; +function schemaHasRulesButRef(schema, RULES) { + if (typeof schema == "boolean") + return !schema; + for (const key in schema) + if (key !== "$ref" && RULES.all[key]) + return true; + return false; +} +exports.schemaHasRulesButRef = schemaHasRulesButRef; +function schemaRefOrVal({ topSchemaRef, schemaPath }, schema, keyword, $data) { + if (!$data) { + if (typeof schema == "number" || typeof schema == "boolean") + return schema; + if (typeof schema == "string") + return codegen_1._ `${schema}`; + } + return codegen_1._ `${topSchemaRef}${schemaPath}${codegen_1.getProperty(keyword)}`; +} +exports.schemaRefOrVal = schemaRefOrVal; +function unescapeFragment(str) { + return unescapeJsonPointer(decodeURIComponent(str)); +} +exports.unescapeFragment = unescapeFragment; +function escapeFragment(str) { + return encodeURIComponent(escapeJsonPointer(str)); +} +exports.escapeFragment = escapeFragment; +function escapeJsonPointer(str) { + if (typeof str == "number") + return `${str}`; + return str.replace(/~/g, "~0").replace(/\//g, "~1"); +} +exports.escapeJsonPointer = escapeJsonPointer; +function unescapeJsonPointer(str) { + return str.replace(/~1/g, "/").replace(/~0/g, "~"); +} +exports.unescapeJsonPointer = unescapeJsonPointer; +function eachItem(xs, f) { + if (Array.isArray(xs)) { + for (const x of xs) + f(x); + } + else { + f(xs); + } +} +exports.eachItem = eachItem; +function makeMergeEvaluated({ mergeNames, mergeToName, mergeValues, resultToName, }) { + return (gen, from, to, toName) => { + const res = to === undefined + ? from + : to instanceof codegen_1.Name + ? (from instanceof codegen_1.Name ? mergeNames(gen, from, to) : mergeToName(gen, from, to), to) + : from instanceof codegen_1.Name + ? (mergeToName(gen, to, from), from) + : mergeValues(from, to); + return toName === codegen_1.Name && !(res instanceof codegen_1.Name) ? resultToName(gen, res) : res; + }; +} +exports.mergeEvaluated = { + props: makeMergeEvaluated({ + mergeNames: (gen, from, to) => gen.if(codegen_1._ `${to} !== true && ${from} !== undefined`, () => { + gen.if(codegen_1._ `${from} === true`, () => gen.assign(to, true), () => gen.code(codegen_1._ `Object.assign(${to}, ${from})`)); + }), + mergeToName: (gen, from, to) => gen.if(codegen_1._ `${to} !== true`, () => { + if (from === true) { + gen.assign(to, true); + } + else { + gen.assign(to, codegen_1._ `${to} || {}`); + setEvaluated(gen, to, from); + } + }), + mergeValues: (from, to) => (from === true ? true : { ...from, ...to }), + resultToName: evaluatedPropsToName, + }), + items: makeMergeEvaluated({ + mergeNames: (gen, from, to) => gen.if(codegen_1._ `${to} !== true && ${from} !== undefined`, () => gen.assign(to, codegen_1._ `${from} === true ? true : ${to} > ${from} ? ${to} : ${from}`)), + mergeToName: (gen, from, to) => gen.if(codegen_1._ `${to} !== true`, () => gen.assign(to, from === true ? true : codegen_1._ `${to} > ${from} ? ${to} : ${from}`)), + mergeValues: (from, to) => (from === true ? true : Math.max(from, to)), + resultToName: (gen, items) => gen.var("items", items), + }), +}; +function evaluatedPropsToName(gen, ps) { + if (ps === true) + return gen.var("props", true); + const props = gen.var("props", codegen_1._ `{}`); + if (ps !== undefined) + setEvaluated(gen, props, ps); + return props; +} +exports.evaluatedPropsToName = evaluatedPropsToName; +function setEvaluated(gen, props, ps) { + Object.keys(ps).forEach((p) => gen.assign(codegen_1._ `${props}${codegen_1.getProperty(p)}`, true)); +} +exports.setEvaluated = setEvaluated; +//# sourceMappingURL=util.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/validate/applicability.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/validate/applicability.js new file mode 100644 index 00000000000000..7a3ebde278aecc --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/validate/applicability.js @@ -0,0 +1,18 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.shouldUseRule = exports.shouldUseGroup = exports.schemaHasRulesForType = void 0; +function schemaHasRulesForType({ schema, self }, type) { + const group = self.RULES.types[type]; + return group && group !== true && shouldUseGroup(schema, group); +} +exports.schemaHasRulesForType = schemaHasRulesForType; +function shouldUseGroup(schema, group) { + return group.rules.some((rule) => shouldUseRule(schema, rule)); +} +exports.shouldUseGroup = shouldUseGroup; +function shouldUseRule(schema, rule) { + var _a; + return (schema[rule.keyword] !== undefined || ((_a = rule.definition.implements) === null || _a === void 0 ? void 0 : _a.some((kwd) => schema[kwd] !== undefined))); +} +exports.shouldUseRule = shouldUseRule; +//# sourceMappingURL=applicability.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/validate/boolSchema.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/validate/boolSchema.js new file mode 100644 index 00000000000000..52919a9940ed5f --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/validate/boolSchema.js @@ -0,0 +1,50 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.boolOrEmptySchema = exports.topBoolOrEmptySchema = void 0; +const errors_1 = require("../errors"); +const codegen_1 = require("../codegen"); +const names_1 = require("../names"); +const boolError = { + message: "boolean schema is false", +}; +function topBoolOrEmptySchema(it) { + const { gen, schema, validateName } = it; + if (schema === false) { + falseSchemaError(it, false); + } + else if (typeof schema == "object" && schema.$async === true) { + gen.return(names_1.default.data); + } + else { + gen.assign(codegen_1._ `${validateName}.errors`, null); + gen.return(true); + } +} +exports.topBoolOrEmptySchema = topBoolOrEmptySchema; +function boolOrEmptySchema(it, valid) { + const { gen, schema } = it; + if (schema === false) { + gen.var(valid, false); // TODO var + falseSchemaError(it); + } + else { + gen.var(valid, true); // TODO var + } +} +exports.boolOrEmptySchema = boolOrEmptySchema; +function falseSchemaError(it, overrideAllErrors) { + const { gen, data } = it; + // TODO maybe some other interface should be used for non-keyword validation errors... + const cxt = { + gen, + keyword: "false schema", + data, + schema: false, + schemaCode: false, + schemaValue: false, + params: {}, + it, + }; + errors_1.reportError(cxt, boolError, overrideAllErrors); +} +//# sourceMappingURL=boolSchema.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/validate/dataType.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/validate/dataType.js new file mode 100644 index 00000000000000..89dee09ad5619d --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/validate/dataType.js @@ -0,0 +1,202 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.reportTypeError = exports.checkDataTypes = exports.checkDataType = exports.coerceAndCheckDataType = exports.getJSONTypes = exports.getSchemaTypes = exports.DataType = void 0; +const rules_1 = require("../rules"); +const applicability_1 = require("./applicability"); +const errors_1 = require("../errors"); +const codegen_1 = require("../codegen"); +const util_1 = require("../util"); +var DataType; +(function (DataType) { + DataType[DataType["Correct"] = 0] = "Correct"; + DataType[DataType["Wrong"] = 1] = "Wrong"; +})(DataType = exports.DataType || (exports.DataType = {})); +function getSchemaTypes(schema) { + const types = getJSONTypes(schema.type); + const hasNull = types.includes("null"); + if (hasNull) { + if (schema.nullable === false) + throw new Error("type: null contradicts nullable: false"); + } + else { + if (!types.length && schema.nullable !== undefined) { + throw new Error('"nullable" cannot be used without "type"'); + } + if (schema.nullable === true) + types.push("null"); + } + return types; +} +exports.getSchemaTypes = getSchemaTypes; +function getJSONTypes(ts) { + const types = Array.isArray(ts) ? ts : ts ? [ts] : []; + if (types.every(rules_1.isJSONType)) + return types; + throw new Error("type must be JSONType or JSONType[]: " + types.join(",")); +} +exports.getJSONTypes = getJSONTypes; +function coerceAndCheckDataType(it, types) { + const { gen, data, opts } = it; + const coerceTo = coerceToTypes(types, opts.coerceTypes); + const checkTypes = types.length > 0 && + !(coerceTo.length === 0 && types.length === 1 && applicability_1.schemaHasRulesForType(it, types[0])); + if (checkTypes) { + const wrongType = checkDataTypes(types, data, opts.strict, DataType.Wrong); + gen.if(wrongType, () => { + if (coerceTo.length) + coerceData(it, types, coerceTo); + else + reportTypeError(it); + }); + } + return checkTypes; +} +exports.coerceAndCheckDataType = coerceAndCheckDataType; +const COERCIBLE = new Set(["string", "number", "integer", "boolean", "null"]); +function coerceToTypes(types, coerceTypes) { + return coerceTypes + ? types.filter((t) => COERCIBLE.has(t) || (coerceTypes === "array" && t === "array")) + : []; +} +function coerceData(it, types, coerceTo) { + const { gen, data, opts } = it; + const dataType = gen.let("dataType", codegen_1._ `typeof ${data}`); + const coerced = gen.let("coerced", codegen_1._ `undefined`); + if (opts.coerceTypes === "array") { + gen.if(codegen_1._ `${dataType} == 'object' && Array.isArray(${data}) && ${data}.length == 1`, () => gen + .assign(data, codegen_1._ `${data}[0]`) + .assign(dataType, codegen_1._ `typeof ${data}`) + .if(checkDataTypes(types, data, opts.strict), () => gen.assign(coerced, data))); + } + gen.if(codegen_1._ `${coerced} !== undefined`); + for (const t of coerceTo) { + if (COERCIBLE.has(t) || (t === "array" && opts.coerceTypes === "array")) { + coerceSpecificType(t); + } + } + gen.else(); + reportTypeError(it); + gen.endIf(); + gen.if(codegen_1._ `${coerced} !== undefined`, () => { + gen.assign(data, coerced); + assignParentData(it, coerced); + }); + function coerceSpecificType(t) { + switch (t) { + case "string": + gen + .elseIf(codegen_1._ `${dataType} == "number" || ${dataType} == "boolean"`) + .assign(coerced, codegen_1._ `"" + ${data}`) + .elseIf(codegen_1._ `${data} === null`) + .assign(coerced, codegen_1._ `""`); + return; + case "number": + gen + .elseIf(codegen_1._ `${dataType} == "boolean" || ${data} === null + || (${dataType} == "string" && ${data} && ${data} == +${data})`) + .assign(coerced, codegen_1._ `+${data}`); + return; + case "integer": + gen + .elseIf(codegen_1._ `${dataType} === "boolean" || ${data} === null + || (${dataType} === "string" && ${data} && ${data} == +${data} && !(${data} % 1))`) + .assign(coerced, codegen_1._ `+${data}`); + return; + case "boolean": + gen + .elseIf(codegen_1._ `${data} === "false" || ${data} === 0 || ${data} === null`) + .assign(coerced, false) + .elseIf(codegen_1._ `${data} === "true" || ${data} === 1`) + .assign(coerced, true); + return; + case "null": + gen.elseIf(codegen_1._ `${data} === "" || ${data} === 0 || ${data} === false`); + gen.assign(coerced, null); + return; + case "array": + gen + .elseIf(codegen_1._ `${dataType} === "string" || ${dataType} === "number" + || ${dataType} === "boolean" || ${data} === null`) + .assign(coerced, codegen_1._ `[${data}]`); + } + } +} +function assignParentData({ gen, parentData, parentDataProperty }, expr) { + // TODO use gen.property + gen.if(codegen_1._ `${parentData} !== undefined`, () => gen.assign(codegen_1._ `${parentData}[${parentDataProperty}]`, expr)); +} +function checkDataType(dataType, data, strictNums, correct = DataType.Correct) { + const EQ = correct === DataType.Correct ? codegen_1.operators.EQ : codegen_1.operators.NEQ; + let cond; + switch (dataType) { + case "null": + return codegen_1._ `${data} ${EQ} null`; + case "array": + cond = codegen_1._ `Array.isArray(${data})`; + break; + case "object": + cond = codegen_1._ `${data} && typeof ${data} == "object" && !Array.isArray(${data})`; + break; + case "integer": + cond = numCond(codegen_1._ `!(${data} % 1) && !isNaN(${data})`); + break; + case "number": + cond = numCond(); + break; + default: + return codegen_1._ `typeof ${data} ${EQ} ${dataType}`; + } + return correct === DataType.Correct ? cond : codegen_1.not(cond); + function numCond(_cond = codegen_1.nil) { + return codegen_1.and(codegen_1._ `typeof ${data} == "number"`, _cond, strictNums ? codegen_1._ `isFinite(${data})` : codegen_1.nil); + } +} +exports.checkDataType = checkDataType; +function checkDataTypes(dataTypes, data, strictNums, correct) { + if (dataTypes.length === 1) { + return checkDataType(dataTypes[0], data, strictNums, correct); + } + let cond; + const types = util_1.toHash(dataTypes); + if (types.array && types.object) { + const notObj = codegen_1._ `typeof ${data} != "object"`; + cond = types.null ? notObj : codegen_1._ `!${data} || ${notObj}`; + delete types.null; + delete types.array; + delete types.object; + } + else { + cond = codegen_1.nil; + } + if (types.number) + delete types.integer; + for (const t in types) + cond = codegen_1.and(cond, checkDataType(t, data, strictNums, correct)); + return cond; +} +exports.checkDataTypes = checkDataTypes; +const typeError = { + message: ({ schema }) => codegen_1.str `should be ${schema}`, + params: ({ schema, schemaValue }) => typeof schema == "string" ? codegen_1._ `{type: ${schema}}` : codegen_1._ `{type: ${schemaValue}}`, +}; +function reportTypeError(it) { + const cxt = getTypeErrorContext(it); + errors_1.reportError(cxt, typeError); +} +exports.reportTypeError = reportTypeError; +function getTypeErrorContext(it) { + const { gen, data, schema } = it; + const schemaCode = util_1.schemaRefOrVal(it, schema, "type"); + return { + gen, + keyword: "type", + data, + schema: schema.type, + schemaCode, + schemaValue: schemaCode, + parentSchema: schema, + params: {}, + it, + }; +} +//# sourceMappingURL=dataType.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/validate/defaults.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/validate/defaults.js new file mode 100644 index 00000000000000..542e05a494748e --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/validate/defaults.js @@ -0,0 +1,35 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.assignDefaults = void 0; +const codegen_1 = require("../codegen"); +const _1 = require("."); +function assignDefaults(it, ty) { + const { properties, items } = it.schema; + if (ty === "object" && properties) { + for (const key in properties) { + assignDefault(it, key, properties[key].default); + } + } + else if (ty === "array" && Array.isArray(items)) { + items.forEach((sch, i) => assignDefault(it, i, sch.default)); + } +} +exports.assignDefaults = assignDefaults; +function assignDefault(it, prop, defaultValue) { + const { gen, compositeRule, data, opts } = it; + if (defaultValue === undefined) + return; + const childData = codegen_1._ `${data}${codegen_1.getProperty(prop)}`; + if (compositeRule) { + _1.checkStrictMode(it, `default is ignored for: ${childData}`); + return; + } + let condition = codegen_1._ `${childData} === undefined`; + if (opts.useDefaults === "empty") { + condition = codegen_1._ `${condition} || ${childData} === null || ${childData} === ""`; + } + // `${childData} === undefined` + + // (opts.useDefaults === "empty" ? ` || ${childData} === null || ${childData} === ""` : "") + gen.if(condition, codegen_1._ `${childData} = ${codegen_1.stringify(defaultValue)}`); +} +//# sourceMappingURL=defaults.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/validate/index.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/validate/index.js new file mode 100644 index 00000000000000..0db360a2cfc3e9 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/validate/index.js @@ -0,0 +1,185 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.checkStrictMode = exports.schemaCxtHasRules = exports.subschemaCode = exports.validateFunctionCode = void 0; +const boolSchema_1 = require("./boolSchema"); +const dataType_1 = require("./dataType"); +const iterate_1 = require("./iterate"); +const codegen_1 = require("../codegen"); +const names_1 = require("../names"); +const resolve_1 = require("../resolve"); +const util_1 = require("../util"); +// schema compilation - generates validation function, subschemaCode (below) is used for subschemas +function validateFunctionCode(it) { + if (isSchemaObj(it)) { + checkKeywords(it); + if (schemaCxtHasRules(it)) { + topSchemaObjCode(it); + return; + } + } + validateFunction(it, () => boolSchema_1.topBoolOrEmptySchema(it)); +} +exports.validateFunctionCode = validateFunctionCode; +function validateFunction({ gen, validateName, schema, schemaEnv, opts }, body) { + if (opts.code.es5) { + gen.func(validateName, codegen_1._ `${names_1.default.data}, ${names_1.default.valCxt}`, schemaEnv.$async, () => { + gen.code(codegen_1._ `"use strict"; ${funcSourceUrl(schema, opts)}`); + destructureValCxtES5(gen, opts); + gen.code(body); + }); + } + else { + gen.func(validateName, codegen_1._ `${names_1.default.data}, ${destructureValCxt(opts)}`, schemaEnv.$async, () => gen.code(funcSourceUrl(schema, opts)).code(body)); + } +} +function destructureValCxt(opts) { + return codegen_1._ `{${names_1.default.dataPath}="", ${names_1.default.parentData}, ${names_1.default.parentDataProperty}, ${names_1.default.rootData}=${names_1.default.data}${opts.dynamicRef ? codegen_1._ `, ${names_1.default.dynamicAnchors}={}` : codegen_1.nil}}={}`; +} +function destructureValCxtES5(gen, opts) { + gen.if(names_1.default.valCxt, () => { + gen.var(names_1.default.dataPath, codegen_1._ `${names_1.default.valCxt}.${names_1.default.dataPath}`); + gen.var(names_1.default.parentData, codegen_1._ `${names_1.default.valCxt}.${names_1.default.parentData}`); + gen.var(names_1.default.parentDataProperty, codegen_1._ `${names_1.default.valCxt}.${names_1.default.parentDataProperty}`); + gen.var(names_1.default.rootData, codegen_1._ `${names_1.default.valCxt}.${names_1.default.rootData}`); + if (opts.dynamicRef) + gen.var(names_1.default.dynamicAnchors, codegen_1._ `${names_1.default.valCxt}.${names_1.default.dynamicAnchors}`); + }, () => { + gen.var(names_1.default.dataPath, codegen_1._ `""`); + gen.var(names_1.default.parentData, codegen_1._ `undefined`); + gen.var(names_1.default.parentDataProperty, codegen_1._ `undefined`); + gen.var(names_1.default.rootData, names_1.default.data); + if (opts.dynamicRef) + gen.var(names_1.default.dynamicAnchors, codegen_1._ `{}`); + }); +} +function topSchemaObjCode(it) { + const { schema, opts, gen } = it; + validateFunction(it, () => { + if (opts.$comment && schema.$comment) + commentKeyword(it); + checkNoDefault(it); + gen.let(names_1.default.vErrors, null); + gen.let(names_1.default.errors, 0); + if (opts.unevaluated) + resetEvaluated(it); + typeAndKeywords(it); + returnResults(it); + }); + return; +} +function resetEvaluated(it) { + // TODO maybe some hook to execute it in the end to check whether props/items are Name, as in assignEvaluated + const { gen, validateName } = it; + it.evaluated = gen.const("evaluated", codegen_1._ `${validateName}.evaluated`); + gen.if(codegen_1._ `${it.evaluated}.dynamicProps`, () => gen.assign(codegen_1._ `${it.evaluated}.props`, codegen_1._ `undefined`)); + gen.if(codegen_1._ `${it.evaluated}.dynamicItems`, () => gen.assign(codegen_1._ `${it.evaluated}.items`, codegen_1._ `undefined`)); +} +function funcSourceUrl(schema, opts) { + return typeof schema == "object" && schema.$id && (opts.code.source || opts.code.process) + ? codegen_1._ `/*# sourceURL=${schema.$id} */` + : codegen_1.nil; +} +// schema compilation - this function is used recursively to generate code for sub-schemas +function subschemaCode(it, valid) { + if (isSchemaObj(it)) { + checkKeywords(it); + if (schemaCxtHasRules(it)) { + subSchemaObjCode(it, valid); + return; + } + } + boolSchema_1.boolOrEmptySchema(it, valid); +} +exports.subschemaCode = subschemaCode; +function schemaCxtHasRules({ schema, self }) { + if (typeof schema == "boolean") + return !schema; + for (const key in schema) + if (self.RULES.all[key]) + return true; + return false; +} +exports.schemaCxtHasRules = schemaCxtHasRules; +function isSchemaObj(it) { + return typeof it.schema != "boolean"; +} +function subSchemaObjCode(it, valid) { + const { schema, gen, opts } = it; + if (opts.$comment && schema.$comment) + commentKeyword(it); + updateContext(it); + checkAsync(it); + const errsCount = gen.const("_errs", names_1.default.errors); + typeAndKeywords(it, errsCount); + // TODO var + gen.var(valid, codegen_1._ `${errsCount} === ${names_1.default.errors}`); +} +function checkKeywords(it) { + util_1.checkUnknownRules(it); + checkRefsAndKeywords(it); +} +function typeAndKeywords(it, errsCount) { + const types = dataType_1.getSchemaTypes(it.schema); + const checkedTypes = dataType_1.coerceAndCheckDataType(it, types); + iterate_1.schemaKeywords(it, types, !checkedTypes, errsCount); +} +function checkRefsAndKeywords(it) { + const { schema, errSchemaPath, opts, self } = it; + if (schema.$ref && opts.ignoreKeywordsWithRef && util_1.schemaHasRulesButRef(schema, self.RULES)) { + self.logger.warn(`$ref: keywords ignored in schema at path "${errSchemaPath}"`); + } +} +function checkNoDefault(it) { + const { schema, opts } = it; + if (schema.default !== undefined && opts.useDefaults && opts.strict) { + checkStrictMode(it, "default is ignored in the schema root"); + } +} +function updateContext(it) { + if (it.schema.$id) + it.baseId = resolve_1.resolveUrl(it.baseId, it.schema.$id); +} +function checkAsync(it) { + if (it.schema.$async && !it.schemaEnv.$async) + throw new Error("async schema in sync schema"); +} +function commentKeyword({ gen, schemaEnv, schema, errSchemaPath, opts }) { + const msg = schema.$comment; + if (opts.$comment === true) { + gen.code(codegen_1._ `${names_1.default.self}.logger.log(${msg})`); + } + else if (typeof opts.$comment == "function") { + const schemaPath = codegen_1.str `${errSchemaPath}/$comment`; + const rootName = gen.scopeValue("root", { ref: schemaEnv.root }); + gen.code(codegen_1._ `${names_1.default.self}.opts.$comment(${msg}, ${schemaPath}, ${rootName}.schema)`); + } +} +function returnResults(it) { + const { gen, schemaEnv, validateName, ValidationError, opts } = it; + if (schemaEnv.$async) { + // TODO assign unevaluated + gen.if(codegen_1._ `${names_1.default.errors} === 0`, () => gen.return(names_1.default.data), () => gen.throw(codegen_1._ `new ${ValidationError}(${names_1.default.vErrors})`)); + } + else { + gen.assign(codegen_1._ `${validateName}.errors`, names_1.default.vErrors); + if (opts.unevaluated) + assignEvaluated(it); + gen.return(codegen_1._ `${names_1.default.errors} === 0`); + } +} +function assignEvaluated({ gen, evaluated, props, items }) { + if (props instanceof codegen_1.Name) + gen.assign(codegen_1._ `${evaluated}.props`, props); + if (items instanceof codegen_1.Name) + gen.assign(codegen_1._ `${evaluated}.items`, items); +} +function checkStrictMode(it, msg, mode = it.opts.strict) { + if (!mode) + return; + msg = `strict mode: ${msg}`; + if (mode === true) + throw new Error(msg); + it.self.logger.warn(msg); +} +exports.checkStrictMode = checkStrictMode; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/validate/iterate.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/validate/iterate.js new file mode 100644 index 00000000000000..6ffdd11c523edc --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/validate/iterate.js @@ -0,0 +1,109 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.schemaKeywords = void 0; +const applicability_1 = require("./applicability"); +const dataType_1 = require("./dataType"); +const defaults_1 = require("./defaults"); +const dataType_2 = require("./dataType"); +const keyword_1 = require("./keyword"); +const util_1 = require("../util"); +const _1 = require("."); +const codegen_1 = require("../codegen"); +const names_1 = require("../names"); +function schemaKeywords(it, types, typeErrors, errsCount) { + const { gen, schema, data, allErrors, opts, self } = it; + const { RULES } = self; + if (schema.$ref && (opts.ignoreKeywordsWithRef || !util_1.schemaHasRulesButRef(schema, RULES))) { + gen.block(() => keyword_1.keywordCode(it, "$ref", RULES.all.$ref.definition)); // TODO typecast + return; + } + checkStrictTypes(it, types); + gen.block(() => { + for (const group of RULES.rules) + groupKeywords(group); + groupKeywords(RULES.post); + }); + function groupKeywords(group) { + if (!applicability_1.shouldUseGroup(schema, group)) + return; + if (group.type) { + gen.if(dataType_1.checkDataType(group.type, data, opts.strict)); + iterateKeywords(it, group); + if (types.length === 1 && types[0] === group.type && typeErrors) { + gen.else(); + dataType_2.reportTypeError(it); + } + gen.endIf(); + } + else { + iterateKeywords(it, group); + } + // TODO make it "ok" call? + if (!allErrors) + gen.if(codegen_1._ `${names_1.default.errors} === ${errsCount || 0}`); + } +} +exports.schemaKeywords = schemaKeywords; +function iterateKeywords(it, group) { + const { gen, schema, opts: { useDefaults }, } = it; + if (useDefaults) + defaults_1.assignDefaults(it, group.type); + gen.block(() => { + for (const rule of group.rules) { + if (applicability_1.shouldUseRule(schema, rule)) { + keyword_1.keywordCode(it, rule.keyword, rule.definition, group.type); + } + } + }); +} +function checkStrictTypes(it, types) { + if (it.schemaEnv.meta || !it.opts.strictTypes) + return; + checkContextTypes(it, types); + if (!it.opts.allowUnionTypes) + checkMultipleTypes(it, types); + checkKeywordTypes(it, it.dataTypes); +} +function checkContextTypes(it, types) { + if (!types.length) + return; + if (!it.dataTypes.length) { + it.dataTypes = types; + return; + } + types.forEach((t) => { + if (!includesType(it.dataTypes, t)) { + strictTypesError(it, `type "${t}" not allowed by context "${it.dataTypes.join(",")}"`); + } + }); + it.dataTypes = it.dataTypes.filter((t) => includesType(types, t)); +} +function checkMultipleTypes(it, ts) { + if (ts.length > 1 && !(ts.length === 2 && ts.includes("null"))) { + strictTypesError(it, "use allowUnionTypes to allow union type keyword"); + } +} +function checkKeywordTypes(it, ts) { + const rules = it.self.RULES.all; + for (const keyword in rules) { + const rule = rules[keyword]; + if (typeof rule == "object" && applicability_1.shouldUseRule(it.schema, rule)) { + const { type } = rule.definition; + if (type.length && !type.some((t) => hasApplicableType(ts, t))) { + strictTypesError(it, `missing type "${type.join(",")}" for keyword "${keyword}"`); + } + } + } +} +function hasApplicableType(schTs, kwdT) { + return schTs.includes(kwdT) || (kwdT === "number" && schTs.includes("integer")); +} +function includesType(ts, t) { + return ts.includes(t) || (t === "integer" && ts.includes("number")); +} +function strictTypesError(it, msg) { + const schemaPath = it.schemaEnv.baseId + it.errSchemaPath; + msg += ` at "${schemaPath}" (strictTypes)`; + _1.checkStrictMode(it, msg, it.opts.strictTypes); +} +//# sourceMappingURL=iterate.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/validate/keyword.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/validate/keyword.js new file mode 100644 index 00000000000000..2d67b195aaaa7d --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/validate/keyword.js @@ -0,0 +1,107 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.keywordCode = void 0; +const context_1 = require("../context"); +const errors_1 = require("../errors"); +const code_1 = require("../../vocabularies/code"); +const codegen_1 = require("../codegen"); +const names_1 = require("../names"); +function keywordCode(it, keyword, def, ruleType) { + const cxt = new context_1.default(it, def, keyword); + if ("code" in def) { + def.code(cxt, ruleType); + } + else if (cxt.$data && def.validate) { + funcKeywordCode(cxt, def); + } + else if ("macro" in def) { + macroKeywordCode(cxt, def); + } + else if (def.compile || def.validate) { + funcKeywordCode(cxt, def); + } +} +exports.keywordCode = keywordCode; +function macroKeywordCode(cxt, def) { + const { gen, keyword, schema, parentSchema, it } = cxt; + const macroSchema = def.macro.call(it.self, schema, parentSchema, it); + const schemaRef = useKeyword(gen, keyword, macroSchema); + if (it.opts.validateSchema !== false) + it.self.validateSchema(macroSchema, true); + const valid = gen.name("valid"); + cxt.subschema({ + schema: macroSchema, + schemaPath: codegen_1.nil, + errSchemaPath: `${it.errSchemaPath}/${keyword}`, + topSchemaRef: schemaRef, + compositeRule: true, + }, valid); + cxt.pass(valid, () => cxt.error(true)); +} +function funcKeywordCode(cxt, def) { + var _a; + const { gen, keyword, schema, parentSchema, $data, it } = cxt; + checkAsync(it, def); + const validate = !$data && def.compile ? def.compile.call(it.self, schema, parentSchema, it) : def.validate; + const validateRef = useKeyword(gen, keyword, validate); + const valid = gen.let("valid"); + cxt.block$data(valid, validateKeyword); + cxt.ok((_a = def.valid) !== null && _a !== void 0 ? _a : valid); + function validateKeyword() { + if (def.errors === false) { + assignValid(); + if (def.modifying) + modifyData(cxt); + reportErrs(() => cxt.error()); + } + else { + const ruleErrs = def.async ? validateAsync() : validateSync(); + if (def.modifying) + modifyData(cxt); + reportErrs(() => addErrs(cxt, ruleErrs)); + } + } + function validateAsync() { + const ruleErrs = gen.let("ruleErrs", null); + gen.try(() => assignValid(codegen_1._ `await `), (e) => gen.assign(valid, false).if(codegen_1._ `${e} instanceof ${it.ValidationError}`, () => gen.assign(ruleErrs, codegen_1._ `${e}.errors`), () => gen.throw(e))); + return ruleErrs; + } + function validateSync() { + const validateErrs = codegen_1._ `${validateRef}.errors`; + gen.assign(validateErrs, null); + assignValid(codegen_1.nil); + return validateErrs; + } + function assignValid(_await = def.async ? codegen_1._ `await ` : codegen_1.nil) { + const passCxt = it.opts.passContext ? names_1.default.this : names_1.default.self; + const passSchema = !(("compile" in def && !$data) || def.schema === false); + gen.assign(valid, codegen_1._ `${_await}${code_1.callValidateCode(cxt, validateRef, passCxt, passSchema)}`, def.modifying); + } + function reportErrs(errors) { + var _a; + gen.if(codegen_1.not((_a = def.valid) !== null && _a !== void 0 ? _a : valid), errors); + } +} +function modifyData(cxt) { + const { gen, data, it } = cxt; + gen.if(it.parentData, () => gen.assign(data, codegen_1._ `${it.parentData}[${it.parentDataProperty}]`)); +} +function addErrs(cxt, errs) { + const { gen } = cxt; + gen.if(codegen_1._ `Array.isArray(${errs})`, () => { + gen + .assign(names_1.default.vErrors, codegen_1._ `${names_1.default.vErrors} === null ? ${errs} : ${names_1.default.vErrors}.concat(${errs})`) + .assign(names_1.default.errors, codegen_1._ `${names_1.default.vErrors}.length`); + errors_1.extendErrors(cxt); + }, () => cxt.error()); +} +function checkAsync({ schemaEnv }, def) { + if (def.async && !schemaEnv.$async) + throw new Error("async keyword in sync schema"); +} +function useKeyword(gen, keyword, result) { + if (result === undefined) + throw new Error(`keyword "${keyword}" failed to compile`); + return gen.scopeValue("keyword", typeof result == "function" ? { ref: result } : { ref: result, code: codegen_1.stringify(result) }); +} +//# sourceMappingURL=keyword.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/core.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/core.js new file mode 100644 index 00000000000000..23aae7ea64e951 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/core.js @@ -0,0 +1,586 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = void 0; +const context_1 = require("./compile/context"); +exports.KeywordCxt = context_1.default; +var codegen_1 = require("./compile/codegen"); +Object.defineProperty(exports, "_", { enumerable: true, get: function () { return codegen_1._; } }); +Object.defineProperty(exports, "str", { enumerable: true, get: function () { return codegen_1.str; } }); +Object.defineProperty(exports, "stringify", { enumerable: true, get: function () { return codegen_1.stringify; } }); +Object.defineProperty(exports, "nil", { enumerable: true, get: function () { return codegen_1.nil; } }); +Object.defineProperty(exports, "Name", { enumerable: true, get: function () { return codegen_1.Name; } }); +Object.defineProperty(exports, "CodeGen", { enumerable: true, get: function () { return codegen_1.CodeGen; } }); +const error_classes_1 = require("./compile/error_classes"); +const rules_1 = require("./compile/rules"); +const compile_1 = require("./compile"); +const codegen_2 = require("./compile/codegen"); +const resolve_1 = require("./compile/resolve"); +const dataType_1 = require("./compile/validate/dataType"); +const util_1 = require("./compile/util"); +const $dataRefSchema = require("./refs/data.json"); +const META_IGNORE_OPTIONS = ["removeAdditional", "useDefaults", "coerceTypes"]; +const EXT_SCOPE_NAMES = new Set([ + "validate", + "wrapper", + "root", + "schema", + "keyword", + "pattern", + "formats", + "validate$data", + "func", + "obj", + "Error", +]); +const removedOptions = { + errorDataPath: "", + format: "`validateFormats: false` can be used instead.", + nullable: '"nullable" keyword is supported by default.', + jsonPointers: "Deprecated jsPropertySyntax can be used instead.", + extendRefs: "Deprecated ignoreKeywordsWithRef can be used instead.", + missingRefs: "Pass empty schema with $id that should be ignored to ajv.addSchema.", + processCode: "Use option `code: {process: (code, schemaEnv: object) => string}`", + sourceCode: "Use option `code: {source: true}`", + schemaId: "JSON Schema draft-04 is not supported in Ajv v7.", + strictDefaults: "It is default now, see option `strict`.", + strictKeywords: "It is default now, see option `strict`.", + strictNumbers: "It is default now, see option `strict`.", + uniqueItems: '"uniqueItems" keyword is always validated.', + unknownFormats: "Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).", + cache: "Map is used as cache, schema object as key.", + serialize: "Map is used as cache, schema object as key.", +}; +const deprecatedOptions = { + ignoreKeywordsWithRef: "", + jsPropertySyntax: "", + unicode: '"minLength"/"maxLength" account for unicode characters by default.', +}; +function requiredOptions(o) { + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m; + const strict = (_a = o.strict) !== null && _a !== void 0 ? _a : true; + const strictLog = strict ? "log" : false; + const _optz = (_b = o.code) === null || _b === void 0 ? void 0 : _b.optimize; + const optimize = _optz === true || _optz === undefined ? 1 : _optz || 0; + return { + strict, + strictTypes: (_c = o.strictTypes) !== null && _c !== void 0 ? _c : strictLog, + strictTuples: (_d = o.strictTuples) !== null && _d !== void 0 ? _d : strictLog, + code: o.code ? { ...o.code, optimize } : { optimize }, + loopRequired: (_e = o.loopRequired) !== null && _e !== void 0 ? _e : Infinity, + loopEnum: (_f = o.loopEnum) !== null && _f !== void 0 ? _f : Infinity, + meta: (_g = o.meta) !== null && _g !== void 0 ? _g : true, + messages: (_h = o.messages) !== null && _h !== void 0 ? _h : true, + inlineRefs: (_j = o.inlineRefs) !== null && _j !== void 0 ? _j : true, + addUsedSchema: (_k = o.addUsedSchema) !== null && _k !== void 0 ? _k : true, + validateSchema: (_l = o.validateSchema) !== null && _l !== void 0 ? _l : true, + validateFormats: (_m = o.validateFormats) !== null && _m !== void 0 ? _m : true, + }; +} +class Ajv { + constructor(opts = {}) { + this.schemas = {}; + this.refs = {}; + this.formats = {}; + this._compilations = new Set(); + this._loading = {}; + this._cache = new Map(); + opts = this.opts = { ...opts, ...requiredOptions(opts) }; + const { es5, lines } = this.opts.code; + this.scope = new codegen_2.ValueScope({ scope: {}, prefixes: EXT_SCOPE_NAMES, es5, lines }); + this.logger = getLogger(opts.logger); + const formatOpt = opts.validateFormats; + opts.validateFormats = false; + this.RULES = rules_1.getRules(); + checkOptions.call(this, removedOptions, opts, "NOT SUPPORTED"); + checkOptions.call(this, deprecatedOptions, opts, "DEPRECATED", "warn"); + this._metaOpts = getMetaSchemaOptions.call(this); + if (opts.formats) + addInitialFormats.call(this); + this._addVocabularies(); + this._addDefaultMetaSchema(); + if (opts.keywords) + addInitialKeywords.call(this, opts.keywords); + if (typeof opts.meta == "object") + this.addMetaSchema(opts.meta); + addInitialSchemas.call(this); + opts.validateFormats = formatOpt; + } + _addVocabularies() { + this.addKeyword("$async"); + } + _addDefaultMetaSchema() { + const { $data, meta } = this.opts; + if (meta && $data) + this.addMetaSchema($dataRefSchema, $dataRefSchema.$id, false); + } + defaultMeta() { + const { meta } = this.opts; + return (this.opts.defaultMeta = typeof meta == "object" ? meta.$id || meta : undefined); + } + validate(schemaKeyRef, // key, ref or schema object + data // to be validated + ) { + let v; + if (typeof schemaKeyRef == "string") { + v = this.getSchema(schemaKeyRef); + if (!v) + throw new Error(`no schema with key or ref "${schemaKeyRef}"`); + } + else { + v = this.compile(schemaKeyRef); + } + const valid = v(data); + if (!("$async" in v)) + this.errors = v.errors; + return valid; + } + compile(schema, _meta) { + const sch = this._addSchema(schema, _meta); + return (sch.validate || this._compileSchemaEnv(sch)); + } + compileAsync(schema, meta) { + if (typeof this.opts.loadSchema != "function") { + throw new Error("options.loadSchema should be a function"); + } + const { loadSchema } = this.opts; + return runCompileAsync.call(this, schema, meta); + async function runCompileAsync(_schema, _meta) { + await loadMetaSchema.call(this, _schema.$schema); + const sch = this._addSchema(_schema, _meta); + return sch.validate || _compileAsync.call(this, sch); + } + async function loadMetaSchema($ref) { + if ($ref && !this.getSchema($ref)) { + await runCompileAsync.call(this, { $ref }, true); + } + } + async function _compileAsync(sch) { + try { + return this._compileSchemaEnv(sch); + } + catch (e) { + if (!(e instanceof error_classes_1.MissingRefError)) + throw e; + checkLoaded.call(this, e); + await loadMissingSchema.call(this, e.missingSchema); + return _compileAsync.call(this, sch); + } + } + function checkLoaded({ missingSchema: ref, missingRef }) { + if (this.refs[ref]) { + throw new Error(`AnySchema ${ref} is loaded but ${missingRef} cannot be resolved`); + } + } + async function loadMissingSchema(ref) { + const _schema = await _loadSchema.call(this, ref); + if (!this.refs[ref]) + await loadMetaSchema.call(this, _schema.$schema); + if (!this.refs[ref]) + this.addSchema(_schema, ref, meta); + } + async function _loadSchema(ref) { + const p = this._loading[ref]; + if (p) + return p; + try { + return await (this._loading[ref] = loadSchema(ref)); + } + finally { + delete this._loading[ref]; + } + } + } + // Adds schema to the instance + addSchema(schema, // If array is passed, `key` will be ignored + key, // Optional schema key. Can be passed to `validate` method instead of schema object or id/ref. One schema per instance can have empty `id` and `key`. + _meta, // true if schema is a meta-schema. Used internally, addMetaSchema should be used instead. + _validateSchema = this.opts.validateSchema // false to skip schema validation. Used internally, option validateSchema should be used instead. + ) { + if (Array.isArray(schema)) { + for (const sch of schema) + this.addSchema(sch, undefined, _meta, _validateSchema); + return this; + } + let id; + if (typeof schema === "object") { + id = schema.$id; + if (id !== undefined && typeof id != "string") + throw new Error("schema id must be string"); + } + key = resolve_1.normalizeId(key || id); + this._checkUnique(key); + this.schemas[key] = this._addSchema(schema, _meta, _validateSchema, true); + return this; + } + // Add schema that will be used to validate other schemas + // options in META_IGNORE_OPTIONS are alway set to false + addMetaSchema(schema, key, // schema key + _validateSchema = this.opts.validateSchema // false to skip schema validation, can be used to override validateSchema option for meta-schema + ) { + this.addSchema(schema, key, true, _validateSchema); + return this; + } + // Validate schema against its meta-schema + validateSchema(schema, throwOrLogError) { + if (typeof schema == "boolean") + return true; + let $schema; + $schema = schema.$schema; + if ($schema !== undefined && typeof $schema != "string") { + throw new Error("$schema must be a string"); + } + $schema = $schema || this.opts.defaultMeta || this.defaultMeta(); + if (!$schema) { + this.logger.warn("meta-schema not available"); + this.errors = null; + return true; + } + const valid = this.validate($schema, schema); + if (!valid && throwOrLogError) { + const message = "schema is invalid: " + this.errorsText(); + if (this.opts.validateSchema === "log") + this.logger.error(message); + else + throw new Error(message); + } + return valid; + } + // Get compiled schema by `key` or `ref`. + // (`key` that was passed to `addSchema` or full schema reference - `schema.$id` or resolved id) + getSchema(keyRef) { + let sch; + while (typeof (sch = getSchEnv.call(this, keyRef)) == "string") + keyRef = sch; + if (sch === undefined) { + const root = new compile_1.SchemaEnv({ schema: {} }); + sch = compile_1.resolveSchema.call(this, root, keyRef); + if (!sch) + return; + this.refs[keyRef] = sch; + } + return (sch.validate || this._compileSchemaEnv(sch)); + } + // Remove cached schema(s). + // If no parameter is passed all schemas but meta-schemas are removed. + // If RegExp is passed all schemas with key/id matching pattern but meta-schemas are removed. + // Even if schema is referenced by other schemas it still can be removed as other schemas have local references. + removeSchema(schemaKeyRef) { + if (schemaKeyRef instanceof RegExp) { + this._removeAllSchemas(this.schemas, schemaKeyRef); + this._removeAllSchemas(this.refs, schemaKeyRef); + return this; + } + switch (typeof schemaKeyRef) { + case "undefined": + this._removeAllSchemas(this.schemas); + this._removeAllSchemas(this.refs); + this._cache.clear(); + return this; + case "string": { + const sch = getSchEnv.call(this, schemaKeyRef); + if (typeof sch == "object") + this._cache.delete(sch.schema); + delete this.schemas[schemaKeyRef]; + delete this.refs[schemaKeyRef]; + return this; + } + case "object": { + const cacheKey = schemaKeyRef; + this._cache.delete(cacheKey); + let id = schemaKeyRef.$id; + if (id) { + id = resolve_1.normalizeId(id); + delete this.schemas[id]; + delete this.refs[id]; + } + return this; + } + default: + throw new Error("ajv.removeSchema: invalid parameter"); + } + } + // add "vocabulary" - a collection of keywords + addVocabulary(definitions) { + for (const def of definitions) + this.addKeyword(def); + return this; + } + addKeyword(kwdOrDef, def // deprecated + ) { + let keyword; + if (typeof kwdOrDef == "string") { + keyword = kwdOrDef; + if (typeof def == "object") { + this.logger.warn("these parameters are deprecated, see docs for addKeyword"); + def.keyword = keyword; + } + } + else if (typeof kwdOrDef == "object" && def === undefined) { + def = kwdOrDef; + keyword = def.keyword; + if (Array.isArray(keyword) && !keyword.length) { + throw new Error("addKeywords: keyword must be string or non-empty array"); + } + } + else { + throw new Error("invalid addKeywords parameters"); + } + checkKeyword.call(this, keyword, def); + if (!def) { + util_1.eachItem(keyword, (kwd) => addRule.call(this, kwd)); + return this; + } + keywordMetaschema.call(this, def); + const definition = { + ...def, + type: dataType_1.getJSONTypes(def.type), + schemaType: dataType_1.getJSONTypes(def.schemaType), + }; + util_1.eachItem(keyword, definition.type.length === 0 + ? (k) => addRule.call(this, k, definition) + : (k) => definition.type.forEach((t) => addRule.call(this, k, definition, t))); + return this; + } + getKeyword(keyword) { + const rule = this.RULES.all[keyword]; + return typeof rule == "object" ? rule.definition : !!rule; + } + // Remove keyword + removeKeyword(keyword) { + // TODO return type should be Ajv + const { RULES } = this; + delete RULES.keywords[keyword]; + delete RULES.all[keyword]; + for (const group of RULES.rules) { + const i = group.rules.findIndex((rule) => rule.keyword === keyword); + if (i >= 0) + group.rules.splice(i, 1); + } + return this; + } + // Add format + addFormat(name, format) { + if (typeof format == "string") + format = new RegExp(format); + this.formats[name] = format; + return this; + } + errorsText(errors = this.errors, // optional array of validation errors + { separator = ", ", dataVar = "data" } = {} // optional options with properties `separator` and `dataVar` + ) { + if (!errors || errors.length === 0) + return "No errors"; + return errors + .map((e) => `${dataVar}${e.dataPath} ${e.message}`) + .reduce((text, msg) => text + separator + msg); + } + $dataMetaSchema(metaSchema, keywordsJsonPointers) { + const rules = this.RULES.all; + metaSchema = JSON.parse(JSON.stringify(metaSchema)); + for (const jsonPointer of keywordsJsonPointers) { + const segments = jsonPointer.split("/").slice(1); // first segment is an empty string + let keywords = metaSchema; + for (const seg of segments) + keywords = keywords[seg]; + for (const key in rules) { + const rule = rules[key]; + if (typeof rule != "object") + continue; + const { $data } = rule.definition; + const schema = keywords[key]; + if ($data && schema) + keywords[key] = schemaOrData(schema); + } + } + return metaSchema; + } + _removeAllSchemas(schemas, regex) { + for (const keyRef in schemas) { + const sch = schemas[keyRef]; + if (!regex || regex.test(keyRef)) { + if (typeof sch == "string") { + delete schemas[keyRef]; + } + else if (sch && !sch.meta) { + this._cache.delete(sch.schema); + delete schemas[keyRef]; + } + } + } + } + _addSchema(schema, meta, validateSchema = this.opts.validateSchema, addSchema = this.opts.addUsedSchema) { + if (typeof schema != "object" && typeof schema != "boolean") { + throw new Error("schema must be object or boolean"); + } + let sch = this._cache.get(schema); + if (sch !== undefined) + return sch; + const localRefs = resolve_1.getSchemaRefs.call(this, schema); + sch = new compile_1.SchemaEnv({ schema, meta, localRefs }); + this._cache.set(sch.schema, sch); + const id = sch.baseId; + if (addSchema && !id.startsWith("#")) { + // TODO atm it is allowed to overwrite schemas without id (instead of not adding them) + if (id) + this._checkUnique(id); + this.refs[id] = sch; + } + if (validateSchema) + this.validateSchema(schema, true); + return sch; + } + _checkUnique(id) { + if (this.schemas[id] || this.refs[id]) { + throw new Error(`schema with key or id "${id}" already exists`); + } + } + _compileSchemaEnv(sch) { + if (sch.meta) + this._compileMetaSchema(sch); + else + compile_1.compileSchema.call(this, sch); + /* istanbul ignore if */ + if (!sch.validate) + throw new Error("ajv implementation error"); + return sch.validate; + } + _compileMetaSchema(sch) { + const currentOpts = this.opts; + this.opts = this._metaOpts; + try { + compile_1.compileSchema.call(this, sch); + } + finally { + this.opts = currentOpts; + } + } +} +exports.default = Ajv; +Ajv.ValidationError = error_classes_1.ValidationError; +Ajv.MissingRefError = error_classes_1.MissingRefError; +function checkOptions(checkOpts, options, msg, log = "error") { + for (const key in checkOpts) { + const opt = key; + if (opt in options) + this.logger[log](`${msg}: option ${key}. ${checkOpts[opt]}`); + } +} +function getSchEnv(keyRef) { + keyRef = resolve_1.normalizeId(keyRef); // TODO tests fail without this line + return this.schemas[keyRef] || this.refs[keyRef]; +} +function addInitialSchemas() { + const optsSchemas = this.opts.schemas; + if (!optsSchemas) + return; + if (Array.isArray(optsSchemas)) + this.addSchema(optsSchemas); + else + for (const key in optsSchemas) + this.addSchema(optsSchemas[key], key); +} +function addInitialFormats() { + for (const name in this.opts.formats) { + const format = this.opts.formats[name]; + if (format) + this.addFormat(name, format); + } +} +function addInitialKeywords(defs) { + if (Array.isArray(defs)) { + this.addVocabulary(defs); + return; + } + this.logger.warn("keywords option as map is deprecated, pass array"); + for (const keyword in defs) { + const def = defs[keyword]; + if (!def.keyword) + def.keyword = keyword; + this.addKeyword(def); + } +} +function getMetaSchemaOptions() { + const metaOpts = { ...this.opts }; + for (const opt of META_IGNORE_OPTIONS) + delete metaOpts[opt]; + return metaOpts; +} +const noLogs = { log() { }, warn() { }, error() { } }; +function getLogger(logger) { + if (logger === false) + return noLogs; + if (logger === undefined) + return console; + if (logger.log && logger.warn && logger.error) + return logger; + throw new Error("logger must implement log, warn and error methods"); +} +const KEYWORD_NAME = /^[a-z_$][a-z0-9_$-]*$/i; +function checkKeyword(keyword, def) { + const { RULES } = this; + util_1.eachItem(keyword, (kwd) => { + if (RULES.keywords[kwd]) + throw new Error(`Keyword ${kwd} is already defined`); + if (!KEYWORD_NAME.test(kwd)) + throw new Error(`Keyword ${kwd} has invalid name`); + }); + if (!def) + return; + if (def.$data && !("code" in def || "validate" in def)) { + throw new Error('$data keyword must have "code" or "validate" function'); + } +} +function addRule(keyword, definition, dataType) { + var _a; + const post = definition === null || definition === void 0 ? void 0 : definition.post; + if (dataType && post) + throw new Error('keyword with "post" flag cannot have "type"'); + const { RULES } = this; + let ruleGroup = post ? RULES.post : RULES.rules.find(({ type: t }) => t === dataType); + if (!ruleGroup) { + ruleGroup = { type: dataType, rules: [] }; + RULES.rules.push(ruleGroup); + } + RULES.keywords[keyword] = true; + if (!definition) + return; + const rule = { + keyword, + definition: { + ...definition, + type: dataType_1.getJSONTypes(definition.type), + schemaType: dataType_1.getJSONTypes(definition.schemaType), + }, + }; + if (definition.before) + addBeforeRule.call(this, ruleGroup, rule, definition.before); + else + ruleGroup.rules.push(rule); + RULES.all[keyword] = rule; + (_a = definition.implements) === null || _a === void 0 ? void 0 : _a.forEach((kwd) => this.addKeyword(kwd)); +} +function addBeforeRule(ruleGroup, rule, before) { + const i = ruleGroup.rules.findIndex((_rule) => _rule.keyword === before); + if (i >= 0) { + ruleGroup.rules.splice(i, 0, rule); + } + else { + ruleGroup.rules.push(rule); + this.logger.warn(`rule ${before} is not defined`); + } +} +function keywordMetaschema(def) { + let { metaSchema } = def; + if (metaSchema === undefined) + return; + if (def.$data && this.opts.$data) + metaSchema = schemaOrData(metaSchema); + def.validateSchema = this.compile(metaSchema, true); +} +const $dataRef = { + $ref: "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#", +}; +function schemaOrData(schema) { + return { anyOf: [schema, $dataRef] }; +} +//# sourceMappingURL=core.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/refs/data.json b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/refs/data.json new file mode 100644 index 00000000000000..9ffc9f5ce05484 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/refs/data.json @@ -0,0 +1,13 @@ +{ + "$id": "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#", + "description": "Meta-schema for $data reference (JSON AnySchema extension proposal)", + "type": "object", + "required": ["$data"], + "properties": { + "$data": { + "type": "string", + "anyOf": [{"format": "relative-json-pointer"}, {"format": "json-pointer"}] + } + }, + "additionalProperties": false +} diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/refs/json-schema-2019-09/index.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/refs/json-schema-2019-09/index.js new file mode 100644 index 00000000000000..14775366ed69fa --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/refs/json-schema-2019-09/index.js @@ -0,0 +1,28 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const metaSchema = require("./schema.json"); +const metaApplicator = require("./meta/applicator.json"); +const metaContent = require("./meta/content.json"); +const metaCore = require("./meta/core.json"); +const metaFormat = require("./meta/format.json"); +const metaMetadata = require("./meta/meta-data.json"); +const metaValidation = require("./meta/validation.json"); +const META_SUPPORT_DATA = ["/properties"]; +function addMetaSchema2019($data) { + ; + [ + metaSchema, + metaApplicator, + metaContent, + metaCore, + with$data(this, metaFormat), + metaMetadata, + with$data(this, metaValidation), + ].forEach((sch) => this.addMetaSchema(sch, undefined, false)); + return this; + function with$data(ajv, sch) { + return $data ? ajv.$dataMetaSchema(sch, META_SUPPORT_DATA) : sch; + } +} +exports.default = addMetaSchema2019; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/refs/json-schema-2019-09/meta/applicator.json b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/refs/json-schema-2019-09/meta/applicator.json new file mode 100644 index 00000000000000..c5e91cf2ac8469 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/refs/json-schema-2019-09/meta/applicator.json @@ -0,0 +1,53 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$id": "https://json-schema.org/draft/2019-09/meta/applicator", + "$vocabulary": { + "https://json-schema.org/draft/2019-09/vocab/applicator": true + }, + "$recursiveAnchor": true, + + "title": "Applicator vocabulary meta-schema", + "type": ["object", "boolean"], + "properties": { + "additionalItems": {"$recursiveRef": "#"}, + "unevaluatedItems": {"$recursiveRef": "#"}, + "items": { + "anyOf": [{"$recursiveRef": "#"}, {"$ref": "#/$defs/schemaArray"}] + }, + "contains": {"$recursiveRef": "#"}, + "additionalProperties": {"$recursiveRef": "#"}, + "unevaluatedProperties": {"$recursiveRef": "#"}, + "properties": { + "type": "object", + "additionalProperties": {"$recursiveRef": "#"}, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": {"$recursiveRef": "#"}, + "propertyNames": {"format": "regex"}, + "default": {} + }, + "dependentSchemas": { + "type": "object", + "additionalProperties": { + "$recursiveRef": "#" + } + }, + "propertyNames": {"$recursiveRef": "#"}, + "if": {"$recursiveRef": "#"}, + "then": {"$recursiveRef": "#"}, + "else": {"$recursiveRef": "#"}, + "allOf": {"$ref": "#/$defs/schemaArray"}, + "anyOf": {"$ref": "#/$defs/schemaArray"}, + "oneOf": {"$ref": "#/$defs/schemaArray"}, + "not": {"$recursiveRef": "#"} + }, + "$defs": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": {"$recursiveRef": "#"} + } + } +} diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/refs/json-schema-2019-09/meta/content.json b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/refs/json-schema-2019-09/meta/content.json new file mode 100644 index 00000000000000..b8f63734343046 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/refs/json-schema-2019-09/meta/content.json @@ -0,0 +1,17 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$id": "https://json-schema.org/draft/2019-09/meta/content", + "$vocabulary": { + "https://json-schema.org/draft/2019-09/vocab/content": true + }, + "$recursiveAnchor": true, + + "title": "Content vocabulary meta-schema", + + "type": ["object", "boolean"], + "properties": { + "contentMediaType": {"type": "string"}, + "contentEncoding": {"type": "string"}, + "contentSchema": {"$recursiveRef": "#"} + } +} diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/refs/json-schema-2019-09/meta/core.json b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/refs/json-schema-2019-09/meta/core.json new file mode 100644 index 00000000000000..f71adbff04fe9e --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/refs/json-schema-2019-09/meta/core.json @@ -0,0 +1,57 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$id": "https://json-schema.org/draft/2019-09/meta/core", + "$vocabulary": { + "https://json-schema.org/draft/2019-09/vocab/core": true + }, + "$recursiveAnchor": true, + + "title": "Core vocabulary meta-schema", + "type": ["object", "boolean"], + "properties": { + "$id": { + "type": "string", + "format": "uri-reference", + "$comment": "Non-empty fragments not allowed.", + "pattern": "^[^#]*#?$" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "$anchor": { + "type": "string", + "pattern": "^[A-Za-z][-A-Za-z0-9.:_]*$" + }, + "$ref": { + "type": "string", + "format": "uri-reference" + }, + "$recursiveRef": { + "type": "string", + "format": "uri-reference" + }, + "$recursiveAnchor": { + "type": "boolean", + "default": false + }, + "$vocabulary": { + "type": "object", + "propertyNames": { + "type": "string", + "format": "uri" + }, + "additionalProperties": { + "type": "boolean" + } + }, + "$comment": { + "type": "string" + }, + "$defs": { + "type": "object", + "additionalProperties": {"$recursiveRef": "#"}, + "default": {} + } + } +} diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/refs/json-schema-2019-09/meta/format.json b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/refs/json-schema-2019-09/meta/format.json new file mode 100644 index 00000000000000..03ccfce26efeaf --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/refs/json-schema-2019-09/meta/format.json @@ -0,0 +1,14 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$id": "https://json-schema.org/draft/2019-09/meta/format", + "$vocabulary": { + "https://json-schema.org/draft/2019-09/vocab/format": true + }, + "$recursiveAnchor": true, + + "title": "Format vocabulary meta-schema", + "type": ["object", "boolean"], + "properties": { + "format": {"type": "string"} + } +} diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/refs/json-schema-2019-09/meta/meta-data.json b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/refs/json-schema-2019-09/meta/meta-data.json new file mode 100644 index 00000000000000..0e194326fa133b --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/refs/json-schema-2019-09/meta/meta-data.json @@ -0,0 +1,37 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$id": "https://json-schema.org/draft/2019-09/meta/meta-data", + "$vocabulary": { + "https://json-schema.org/draft/2019-09/vocab/meta-data": true + }, + "$recursiveAnchor": true, + + "title": "Meta-data vocabulary meta-schema", + + "type": ["object", "boolean"], + "properties": { + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": true, + "deprecated": { + "type": "boolean", + "default": false + }, + "readOnly": { + "type": "boolean", + "default": false + }, + "writeOnly": { + "type": "boolean", + "default": false + }, + "examples": { + "type": "array", + "items": true + } + } +} diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/refs/json-schema-2019-09/meta/validation.json b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/refs/json-schema-2019-09/meta/validation.json new file mode 100644 index 00000000000000..7027a1279a014a --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/refs/json-schema-2019-09/meta/validation.json @@ -0,0 +1,90 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$id": "https://json-schema.org/draft/2019-09/meta/validation", + "$vocabulary": { + "https://json-schema.org/draft/2019-09/vocab/validation": true + }, + "$recursiveAnchor": true, + + "title": "Validation vocabulary meta-schema", + "type": ["object", "boolean"], + "properties": { + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": {"$ref": "#/$defs/nonNegativeInteger"}, + "minLength": {"$ref": "#/$defs/nonNegativeIntegerDefault0"}, + "pattern": { + "type": "string", + "format": "regex" + }, + "maxItems": {"$ref": "#/$defs/nonNegativeInteger"}, + "minItems": {"$ref": "#/$defs/nonNegativeIntegerDefault0"}, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "maxContains": {"$ref": "#/$defs/nonNegativeInteger"}, + "minContains": { + "$ref": "#/$defs/nonNegativeInteger", + "default": 1 + }, + "maxProperties": {"$ref": "#/$defs/nonNegativeInteger"}, + "minProperties": {"$ref": "#/$defs/nonNegativeIntegerDefault0"}, + "required": {"$ref": "#/$defs/stringArray"}, + "dependentRequired": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/stringArray" + } + }, + "const": true, + "enum": { + "type": "array", + "items": true + }, + "type": { + "anyOf": [ + {"$ref": "#/$defs/simpleTypes"}, + { + "type": "array", + "items": {"$ref": "#/$defs/simpleTypes"}, + "minItems": 1, + "uniqueItems": true + } + ] + } + }, + "$defs": { + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "$ref": "#/$defs/nonNegativeInteger", + "default": 0 + }, + "simpleTypes": { + "enum": ["array", "boolean", "integer", "null", "number", "object", "string"] + }, + "stringArray": { + "type": "array", + "items": {"type": "string"}, + "uniqueItems": true, + "default": [] + } + } +} diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/refs/json-schema-2019-09/schema.json b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/refs/json-schema-2019-09/schema.json new file mode 100644 index 00000000000000..54eb7157afed69 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/refs/json-schema-2019-09/schema.json @@ -0,0 +1,39 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$id": "https://json-schema.org/draft/2019-09/schema", + "$vocabulary": { + "https://json-schema.org/draft/2019-09/vocab/core": true, + "https://json-schema.org/draft/2019-09/vocab/applicator": true, + "https://json-schema.org/draft/2019-09/vocab/validation": true, + "https://json-schema.org/draft/2019-09/vocab/meta-data": true, + "https://json-schema.org/draft/2019-09/vocab/format": false, + "https://json-schema.org/draft/2019-09/vocab/content": true + }, + "$recursiveAnchor": true, + + "title": "Core and Validation specifications meta-schema", + "allOf": [ + {"$ref": "meta/core"}, + {"$ref": "meta/applicator"}, + {"$ref": "meta/validation"}, + {"$ref": "meta/meta-data"}, + {"$ref": "meta/format"}, + {"$ref": "meta/content"} + ], + "type": ["object", "boolean"], + "properties": { + "definitions": { + "$comment": "While no longer an official keyword as it is replaced by $defs, this keyword is retained in the meta-schema to prevent incompatible extensions as it remains in common use.", + "type": "object", + "additionalProperties": {"$recursiveRef": "#"}, + "default": {} + }, + "dependencies": { + "$comment": "\"dependencies\" is no longer a keyword, but schema authors should avoid redefining it to facilitate a smooth transition to \"dependentSchemas\" and \"dependentRequired\"", + "type": "object", + "additionalProperties": { + "anyOf": [{"$recursiveRef": "#"}, {"$ref": "meta/validation#/$defs/stringArray"}] + } + } + } +} diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/refs/json-schema-draft-06.json b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/refs/json-schema-draft-06.json new file mode 100644 index 00000000000000..5410064ba8df93 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/refs/json-schema-draft-06.json @@ -0,0 +1,137 @@ +{ + "$schema": "http://json-schema.org/draft-06/schema#", + "$id": "http://json-schema.org/draft-06/schema#", + "title": "Core schema meta-schema", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": {"$ref": "#"} + }, + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "allOf": [{"$ref": "#/definitions/nonNegativeInteger"}, {"default": 0}] + }, + "simpleTypes": { + "enum": ["array", "boolean", "integer", "null", "number", "object", "string"] + }, + "stringArray": { + "type": "array", + "items": {"type": "string"}, + "uniqueItems": true, + "default": [] + } + }, + "type": ["object", "boolean"], + "properties": { + "$id": { + "type": "string", + "format": "uri-reference" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "$ref": { + "type": "string", + "format": "uri-reference" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": {}, + "examples": { + "type": "array", + "items": {} + }, + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": {"$ref": "#/definitions/nonNegativeInteger"}, + "minLength": {"$ref": "#/definitions/nonNegativeIntegerDefault0"}, + "pattern": { + "type": "string", + "format": "regex" + }, + "additionalItems": {"$ref": "#"}, + "items": { + "anyOf": [{"$ref": "#"}, {"$ref": "#/definitions/schemaArray"}], + "default": {} + }, + "maxItems": {"$ref": "#/definitions/nonNegativeInteger"}, + "minItems": {"$ref": "#/definitions/nonNegativeIntegerDefault0"}, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "contains": {"$ref": "#"}, + "maxProperties": {"$ref": "#/definitions/nonNegativeInteger"}, + "minProperties": {"$ref": "#/definitions/nonNegativeIntegerDefault0"}, + "required": {"$ref": "#/definitions/stringArray"}, + "additionalProperties": {"$ref": "#"}, + "definitions": { + "type": "object", + "additionalProperties": {"$ref": "#"}, + "default": {} + }, + "properties": { + "type": "object", + "additionalProperties": {"$ref": "#"}, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": {"$ref": "#"}, + "default": {} + }, + "dependencies": { + "type": "object", + "additionalProperties": { + "anyOf": [{"$ref": "#"}, {"$ref": "#/definitions/stringArray"}] + } + }, + "propertyNames": {"$ref": "#"}, + "const": {}, + "enum": { + "type": "array", + "minItems": 1, + "uniqueItems": true + }, + "type": { + "anyOf": [ + {"$ref": "#/definitions/simpleTypes"}, + { + "type": "array", + "items": {"$ref": "#/definitions/simpleTypes"}, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "format": {"type": "string"}, + "allOf": {"$ref": "#/definitions/schemaArray"}, + "anyOf": {"$ref": "#/definitions/schemaArray"}, + "oneOf": {"$ref": "#/definitions/schemaArray"}, + "not": {"$ref": "#"} + }, + "default": {} +} diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/refs/json-schema-draft-07.json b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/refs/json-schema-draft-07.json new file mode 100644 index 00000000000000..6a74851043623c --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/refs/json-schema-draft-07.json @@ -0,0 +1,151 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "http://json-schema.org/draft-07/schema#", + "title": "Core schema meta-schema", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": {"$ref": "#"} + }, + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "allOf": [{"$ref": "#/definitions/nonNegativeInteger"}, {"default": 0}] + }, + "simpleTypes": { + "enum": ["array", "boolean", "integer", "null", "number", "object", "string"] + }, + "stringArray": { + "type": "array", + "items": {"type": "string"}, + "uniqueItems": true, + "default": [] + } + }, + "type": ["object", "boolean"], + "properties": { + "$id": { + "type": "string", + "format": "uri-reference" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "$ref": { + "type": "string", + "format": "uri-reference" + }, + "$comment": { + "type": "string" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": true, + "readOnly": { + "type": "boolean", + "default": false + }, + "examples": { + "type": "array", + "items": true + }, + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": {"$ref": "#/definitions/nonNegativeInteger"}, + "minLength": {"$ref": "#/definitions/nonNegativeIntegerDefault0"}, + "pattern": { + "type": "string", + "format": "regex" + }, + "additionalItems": {"$ref": "#"}, + "items": { + "anyOf": [{"$ref": "#"}, {"$ref": "#/definitions/schemaArray"}], + "default": true + }, + "maxItems": {"$ref": "#/definitions/nonNegativeInteger"}, + "minItems": {"$ref": "#/definitions/nonNegativeIntegerDefault0"}, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "contains": {"$ref": "#"}, + "maxProperties": {"$ref": "#/definitions/nonNegativeInteger"}, + "minProperties": {"$ref": "#/definitions/nonNegativeIntegerDefault0"}, + "required": {"$ref": "#/definitions/stringArray"}, + "additionalProperties": {"$ref": "#"}, + "definitions": { + "type": "object", + "additionalProperties": {"$ref": "#"}, + "default": {} + }, + "properties": { + "type": "object", + "additionalProperties": {"$ref": "#"}, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": {"$ref": "#"}, + "propertyNames": {"format": "regex"}, + "default": {} + }, + "dependencies": { + "type": "object", + "additionalProperties": { + "anyOf": [{"$ref": "#"}, {"$ref": "#/definitions/stringArray"}] + } + }, + "propertyNames": {"$ref": "#"}, + "const": true, + "enum": { + "type": "array", + "items": true, + "minItems": 1, + "uniqueItems": true + }, + "type": { + "anyOf": [ + {"$ref": "#/definitions/simpleTypes"}, + { + "type": "array", + "items": {"$ref": "#/definitions/simpleTypes"}, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "format": {"type": "string"}, + "contentMediaType": {"type": "string"}, + "contentEncoding": {"type": "string"}, + "if": {"$ref": "#"}, + "then": {"$ref": "#"}, + "else": {"$ref": "#"}, + "allOf": {"$ref": "#/definitions/schemaArray"}, + "anyOf": {"$ref": "#/definitions/schemaArray"}, + "oneOf": {"$ref": "#/definitions/schemaArray"}, + "not": {"$ref": "#"} + }, + "default": true +} diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/refs/json-schema-secure.json b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/refs/json-schema-secure.json new file mode 100644 index 00000000000000..3968abd5d97e7b --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/refs/json-schema-secure.json @@ -0,0 +1,88 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/json-schema-secure.json#", + "title": "Meta-schema for the security assessment of JSON Schemas", + "description": "If a JSON AnySchema fails validation against this meta-schema, it may be unsafe to validate untrusted data", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": {"$ref": "#"} + } + }, + "dependencies": { + "patternProperties": { + "description": "prevent slow validation of large property names", + "required": ["propertyNames"], + "properties": { + "propertyNames": { + "required": ["maxLength"] + } + } + }, + "uniqueItems": { + "description": "prevent slow validation of large non-scalar arrays", + "if": { + "properties": { + "uniqueItems": {"const": true}, + "items": { + "properties": { + "type": { + "anyOf": [ + { + "enum": ["object", "array"] + }, + { + "type": "array", + "contains": {"enum": ["object", "array"]} + } + ] + } + } + } + } + }, + "then": { + "required": ["maxItems"] + } + }, + "pattern": { + "description": "prevent slow pattern matching of large strings", + "required": ["maxLength"] + }, + "format": { + "description": "prevent slow format validation of large strings", + "required": ["maxLength"] + } + }, + "properties": { + "additionalItems": {"$ref": "#"}, + "additionalProperties": {"$ref": "#"}, + "dependencies": { + "additionalProperties": { + "anyOf": [{"type": "array"}, {"$ref": "#"}] + } + }, + "items": { + "anyOf": [{"$ref": "#"}, {"$ref": "#/definitions/schemaArray"}] + }, + "definitions": { + "additionalProperties": {"$ref": "#"} + }, + "patternProperties": { + "additionalProperties": {"$ref": "#"} + }, + "properties": { + "additionalProperties": {"$ref": "#"} + }, + "if": {"$ref": "#"}, + "then": {"$ref": "#"}, + "else": {"$ref": "#"}, + "allOf": {"$ref": "#/definitions/schemaArray"}, + "anyOf": {"$ref": "#/definitions/schemaArray"}, + "oneOf": {"$ref": "#/definitions/schemaArray"}, + "not": {"$ref": "#"}, + "contains": {"$ref": "#"}, + "propertyNames": {"$ref": "#"} + } +} diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/standalone/index.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/standalone/index.js new file mode 100644 index 00000000000000..c49bde936bcb33 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/standalone/index.js @@ -0,0 +1,67 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const scope_1 = require("../compile/codegen/scope"); +const code_1 = require("../compile/codegen/code"); +function standaloneCode(ajv, refsOrFunc) { + if (!ajv.opts.code.source) { + throw new Error("moduleCode: ajv instance must have code.source option"); + } + const { _n } = ajv.scope.opts; + return typeof refsOrFunc == "function" + ? funcExportCode(refsOrFunc.source) + : refsOrFunc !== undefined + ? multiExportsCode(refsOrFunc, getValidate) + : multiExportsCode(ajv.schemas, (sch) => sch.meta ? undefined : ajv.compile(sch.schema)); + function getValidate(id) { + const v = ajv.getSchema(id); + if (!v) + throw new Error(`moduleCode: no schema with id ${id}`); + return v; + } + function funcExportCode(source) { + const usedValues = {}; + const n = source === null || source === void 0 ? void 0 : source.validateName; + const vCode = validateCode(usedValues, source); + return `"use strict";${_n}module.exports = ${n};${_n}module.exports.default = ${n};${_n}${vCode}`; + } + function multiExportsCode(schemas, getValidateFunc) { + var _a; + const usedValues = {}; + let code = code_1._ `"use strict";`; + for (const name in schemas) { + const v = getValidateFunc(schemas[name]); + if (v) { + const vCode = validateCode(usedValues, v.source); + code = code_1._ `${code}${_n}exports${code_1.getProperty(name)} = ${(_a = v.source) === null || _a === void 0 ? void 0 : _a.validateName};${_n}${vCode}`; + } + } + return `${code}`; + } + function validateCode(usedValues, s) { + if (!s) + throw new Error('moduleCode: function does not have "source" property'); + const { prefix } = s.validateName; + const nameSet = (usedValues[prefix] = usedValues[prefix] || new Set()); + nameSet.add(s.validateName); + const scopeCode = ajv.scope.scopeCode(s.scopeValues, usedValues, refValidateCode); + const code = new code_1._Code(`${scopeCode}${_n}${s.validateCode}`); + return s.evaluated ? code_1._ `${code}${s.validateName}.evaluated = ${s.evaluated};${_n}` : code; + function refValidateCode(n) { + var _a; + const vRef = (_a = n.value) === null || _a === void 0 ? void 0 : _a.ref; + if (n.prefix === "validate" && typeof vRef == "function") { + const v = vRef; + return validateCode(usedValues, v.source); + } + else if ((n.prefix === "root" || n.prefix === "wrapper") && typeof vRef == "object") { + const { validate, validateName } = vRef; + const vCode = validateCode(usedValues, validate === null || validate === void 0 ? void 0 : validate.source); + const def = ajv.opts.code.es5 ? scope_1.varKinds.var : scope_1.varKinds.const; + return code_1._ `${def} ${n} = {validate: ${validateName}};${_n}${vCode}`; + } + return undefined; + } + } +} +exports.default = standaloneCode; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/standalone/instance.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/standalone/instance.js new file mode 100644 index 00000000000000..aa43ac5617e992 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/standalone/instance.js @@ -0,0 +1,35 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const core_1 = require("../core"); +const _1 = require("."); +const requireFromString = require("require-from-string"); +class AjvPack { + constructor(ajv) { + this.ajv = ajv; + } + validate(schemaKeyRef, data) { + return core_1.default.prototype.validate.call(this, schemaKeyRef, data); + } + compile(schema, meta) { + return this.getStandalone(this.ajv.compile(schema, meta)); + } + getSchema(keyRef) { + const v = this.ajv.getSchema(keyRef); + if (!v) + return undefined; + return this.getStandalone(v); + } + getStandalone(v) { + return requireFromString(_1.default(this.ajv, v)); + } + addSchema(...args) { + this.ajv.addSchema.call(this.ajv, ...args); + return this; + } + addKeyword(...args) { + this.ajv.addKeyword.call(this.ajv, ...args); + return this; + } +} +exports.default = AjvPack; +//# sourceMappingURL=instance.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/types/index.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/types/index.js new file mode 100644 index 00000000000000..aa219d8f2aa44d --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/types/index.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/types/json-schema.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/types/json-schema.js new file mode 100644 index 00000000000000..2d8f98dc534255 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/types/json-schema.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=json-schema.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js new file mode 100644 index 00000000000000..76f8aab9f5ce13 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js @@ -0,0 +1,45 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("../../compile/codegen"); +const subschema_1 = require("../../compile/subschema"); +const util_1 = require("../../compile/util"); +const validate_1 = require("../../compile/validate"); +const error = { + message: ({ params: { len } }) => codegen_1.str `should NOT have more than ${len} items`, + params: ({ params: { len } }) => codegen_1._ `{limit: ${len}}`, +}; +const def = { + keyword: "additionalItems", + type: "array", + schemaType: ["boolean", "object"], + before: "uniqueItems", + error, + code(cxt) { + const { gen, schema, parentSchema, data, it } = cxt; + const { items } = parentSchema; + if (!Array.isArray(items)) { + validate_1.checkStrictMode(it, '"additionalItems" is ignored when "items" is not an array of schemas'); + return; + } + it.items = true; + const len = gen.const("len", codegen_1._ `${data}.length`); + if (schema === false) { + cxt.setParams({ len: items.length }); + cxt.pass(codegen_1._ `${len} <= ${items.length}`); + } + else if (typeof schema == "object" && !util_1.alwaysValidSchema(it, schema)) { + const valid = gen.var("valid", codegen_1._ `${len} <= ${items.length}`); // TODO var + gen.if(codegen_1.not(valid), () => validateItems(valid)); + cxt.ok(valid); + } + function validateItems(valid) { + gen.forRange("i", items.length, len, (i) => { + cxt.subschema({ keyword: "additionalItems", dataProp: i, dataPropType: subschema_1.Type.Num }, valid); + if (!it.allErrors) + gen.if(codegen_1.not(valid), () => gen.break()); + }); + } + }, +}; +exports.default = def; +//# sourceMappingURL=additionalItems.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js new file mode 100644 index 00000000000000..226c2a7a13ba49 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js @@ -0,0 +1,108 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const code_1 = require("../code"); +const codegen_1 = require("../../compile/codegen"); +const names_1 = require("../../compile/names"); +const subschema_1 = require("../../compile/subschema"); +const util_1 = require("../../compile/util"); +const error = { + message: "should NOT have additional properties", + params: ({ params }) => codegen_1._ `{additionalProperty: ${params.additionalProperty}}`, +}; +const def = { + keyword: "additionalProperties", + type: ["object"], + schemaType: ["boolean", "object"], + allowUndefined: true, + trackErrors: true, + error, + code(cxt) { + const { gen, schema, parentSchema, data, errsCount, it } = cxt; + /* istanbul ignore if */ + if (!errsCount) + throw new Error("ajv implementation error"); + const { allErrors, opts } = it; + it.props = true; + if (opts.removeAdditional !== "all" && util_1.alwaysValidSchema(it, schema)) + return; + const props = code_1.allSchemaProperties(parentSchema.properties); + const patProps = code_1.allSchemaProperties(parentSchema.patternProperties); + checkAdditionalProperties(); + cxt.ok(codegen_1._ `${errsCount} === ${names_1.default.errors}`); + function checkAdditionalProperties() { + gen.forIn("key", data, (key) => { + if (!props.length && !patProps.length) + additionalPropertyCode(key); + else + gen.if(isAdditional(key), () => additionalPropertyCode(key)); + }); + } + function isAdditional(key) { + let definedProp; + if (props.length > 8) { + // TODO maybe an option instead of hard-coded 8? + const propsSchema = util_1.schemaRefOrVal(it, parentSchema.properties, "properties"); + definedProp = codegen_1._ `${propsSchema}.hasOwnProperty(${key})`; + } + else if (props.length) { + definedProp = codegen_1.or(...props.map((p) => codegen_1._ `${key} === ${p}`)); + } + else { + definedProp = codegen_1.nil; + } + if (patProps.length) { + definedProp = codegen_1.or(definedProp, ...patProps.map((p) => codegen_1._ `${code_1.usePattern(gen, p)}.test(${key})`)); + } + return codegen_1._ `!(${definedProp})`; + } + function deleteAdditional(key) { + gen.code(codegen_1._ `delete ${data}[${key}]`); + } + function additionalPropertyCode(key) { + if (opts.removeAdditional === "all" || (opts.removeAdditional && schema === false)) { + deleteAdditional(key); + return; + } + if (schema === false) { + cxt.setParams({ additionalProperty: key }); + cxt.error(); + if (!allErrors) + gen.break(); + return; + } + if (typeof schema == "object" && !util_1.alwaysValidSchema(it, schema)) { + const valid = gen.name("valid"); + if (opts.removeAdditional === "failing") { + applyAdditionalSchema(key, valid, false); + gen.if(codegen_1.not(valid), () => { + cxt.reset(); + deleteAdditional(key); + }); + } + else { + applyAdditionalSchema(key, valid); + if (!allErrors) + gen.if(codegen_1.not(valid), () => gen.break()); + } + } + } + function applyAdditionalSchema(key, valid, errors) { + const subschema = { + keyword: "additionalProperties", + dataProp: key, + dataPropType: subschema_1.Type.Str, + strictSchema: it.strictSchema, + }; + if (errors === false) { + Object.assign(subschema, { + compositeRule: true, + createErrors: false, + allErrors: false, + }); + } + cxt.subschema(subschema, valid); + } + }, +}; +exports.default = def; +//# sourceMappingURL=additionalProperties.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/allOf.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/allOf.js new file mode 100644 index 00000000000000..acda3d16b4109a --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/allOf.js @@ -0,0 +1,23 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const util_1 = require("../../compile/util"); +const def = { + keyword: "allOf", + schemaType: "array", + code(cxt) { + const { gen, schema, it } = cxt; + /* istanbul ignore if */ + if (!Array.isArray(schema)) + throw new Error("ajv implementation error"); + const valid = gen.name("valid"); + schema.forEach((sch, i) => { + if (util_1.alwaysValidSchema(it, sch)) + return; + const schCxt = cxt.subschema({ keyword: "allOf", schemaProp: i }, valid); + cxt.ok(valid); + cxt.mergeEvaluated(schCxt); + }); + }, +}; +exports.default = def; +//# sourceMappingURL=allOf.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/anyOf.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/anyOf.js new file mode 100644 index 00000000000000..e209708a548e39 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/anyOf.js @@ -0,0 +1,39 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("../../compile/codegen"); +const util_1 = require("../../compile/util"); +const def = { + keyword: "anyOf", + schemaType: "array", + trackErrors: true, + code(cxt) { + const { gen, schema, it } = cxt; + /* istanbul ignore if */ + if (!Array.isArray(schema)) + throw new Error("ajv implementation error"); + const alwaysValid = schema.some((sch) => util_1.alwaysValidSchema(it, sch)); + if (alwaysValid && !it.opts.unevaluated) + return; + const valid = gen.let("valid", false); + const schValid = gen.name("_valid"); + gen.block(() => schema.forEach((_sch, i) => { + const schCxt = cxt.subschema({ + keyword: "anyOf", + schemaProp: i, + compositeRule: true, + }, schValid); + gen.assign(valid, codegen_1._ `${valid} || ${schValid}`); + const merged = cxt.mergeValidEvaluated(schCxt, schValid); + // can short-circuit if `unevaluatedProperties/Items` not supported (opts.unevaluated !== true) + // or if all properties and items were evaluated (it.props === true && it.items === true) + if (!merged) + gen.if(codegen_1.not(valid)); + })); + cxt.result(valid, () => cxt.reset(), () => cxt.error(true)); + }, + error: { + message: "should match some schema in anyOf", + }, +}; +exports.default = def; +//# sourceMappingURL=anyOf.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/contains.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/contains.js new file mode 100644 index 00000000000000..cece62b848fe40 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/contains.js @@ -0,0 +1,89 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("../../compile/codegen"); +const subschema_1 = require("../../compile/subschema"); +const util_1 = require("../../compile/util"); +const validate_1 = require("../../compile/validate"); +const error = { + message: ({ params: { min, max } }) => max === undefined + ? codegen_1.str `should contain at least ${min} valid item(s)` + : codegen_1.str `should contain at least ${min} and no more than ${max} valid item(s)`, + params: ({ params: { min, max } }) => max === undefined ? codegen_1._ `{minContains: ${min}}` : codegen_1._ `{minContains: ${min}, maxContains: ${max}}`, +}; +const def = { + keyword: "contains", + type: "array", + schemaType: ["object", "boolean"], + before: "uniqueItems", + trackErrors: true, + error, + code(cxt) { + const { gen, schema, parentSchema, data, it } = cxt; + let min; + let max; + const { minContains, maxContains } = parentSchema; + if (it.opts.next) { + min = minContains === undefined ? 1 : minContains; + max = maxContains; + } + else { + min = 1; + } + const len = gen.const("len", codegen_1._ `${data}.length`); + cxt.setParams({ min, max }); + if (max === undefined && min === 0) { + validate_1.checkStrictMode(it, `"minContains" == 0 without "maxContains": "contains" keyword ignored`); + return; + } + if (max !== undefined && min > max) { + validate_1.checkStrictMode(it, `"minContains" > "maxContains" is always invalid`); + cxt.fail(); + return; + } + if (util_1.alwaysValidSchema(it, schema)) { + let cond = codegen_1._ `${len} >= ${min}`; + if (max !== undefined) + cond = codegen_1._ `${cond} && ${len} <= ${max}`; + cxt.pass(cond); + return; + } + it.items = true; + const valid = gen.name("valid"); + if (max === undefined && min === 1) { + validateItems(valid, () => gen.if(valid, () => gen.break())); + } + else { + gen.let(valid, false); + const schValid = gen.name("_valid"); + const count = gen.let("count", 0); + validateItems(schValid, () => gen.if(schValid, () => checkLimits(count))); + } + cxt.result(valid, () => cxt.reset()); + function validateItems(_valid, block) { + gen.forRange("i", 0, len, (i) => { + cxt.subschema({ + keyword: "contains", + dataProp: i, + dataPropType: subschema_1.Type.Num, + compositeRule: true, + }, _valid); + block(); + }); + } + function checkLimits(count) { + gen.code(codegen_1._ `${count}++`); + if (max === undefined) { + gen.if(codegen_1._ `${count} >= ${min}`, () => gen.assign(valid, true).break()); + } + else { + gen.if(codegen_1._ `${count} > ${max}`, () => gen.assign(valid, false).break()); + if (min === 1) + gen.assign(valid, true); + else + gen.if(codegen_1._ `${count} >= ${min}`, () => gen.assign(valid, true)); + } + } + }, +}; +exports.default = def; +//# sourceMappingURL=contains.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/dependencies.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/dependencies.js new file mode 100644 index 00000000000000..9ec12ab16cf4d9 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/dependencies.js @@ -0,0 +1,85 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.validateSchemaDeps = exports.validatePropertyDeps = exports.error = void 0; +const codegen_1 = require("../../compile/codegen"); +const util_1 = require("../../compile/util"); +const code_1 = require("../code"); +exports.error = { + message: ({ params: { property, depsCount, deps } }) => { + const property_ies = depsCount === 1 ? "property" : "properties"; + return codegen_1.str `should have ${property_ies} ${deps} when property ${property} is present`; + }, + params: ({ params: { property, depsCount, deps, missingProperty } }) => codegen_1._ `{property: ${property}, + missingProperty: ${missingProperty}, + depsCount: ${depsCount}, + deps: ${deps}}`, +}; +const def = { + keyword: "dependencies", + type: "object", + schemaType: "object", + error: exports.error, + code(cxt) { + const [propDeps, schDeps] = splitDependencies(cxt); + validatePropertyDeps(cxt, propDeps); + validateSchemaDeps(cxt, schDeps); + }, +}; +function splitDependencies({ schema }) { + const propertyDeps = {}; + const schemaDeps = {}; + for (const key in schema) { + if (key === "__proto__") + continue; + const deps = Array.isArray(schema[key]) ? propertyDeps : schemaDeps; + deps[key] = schema[key]; + } + return [propertyDeps, schemaDeps]; +} +function validatePropertyDeps(cxt, propertyDeps = cxt.schema) { + const { gen, data, it } = cxt; + if (Object.keys(propertyDeps).length === 0) + return; + const missing = gen.let("missing"); + for (const prop in propertyDeps) { + const deps = propertyDeps[prop]; + if (deps.length === 0) + continue; + const hasProperty = code_1.propertyInData(data, prop, it.opts.ownProperties); + cxt.setParams({ + property: prop, + depsCount: deps.length, + deps: deps.join(", "), + }); + if (it.allErrors) { + gen.if(hasProperty, () => { + for (const depProp of deps) { + code_1.checkReportMissingProp(cxt, depProp); + } + }); + } + else { + gen.if(codegen_1._ `${hasProperty} && (${code_1.checkMissingProp(cxt, deps, missing)})`); + code_1.reportMissingProp(cxt, missing); + gen.else(); + } + } +} +exports.validatePropertyDeps = validatePropertyDeps; +function validateSchemaDeps(cxt, schemaDeps = cxt.schema) { + const { gen, data, keyword, it } = cxt; + const valid = gen.name("valid"); + for (const prop in schemaDeps) { + if (util_1.alwaysValidSchema(it, schemaDeps[prop])) + continue; + gen.if(code_1.propertyInData(data, prop, it.opts.ownProperties), () => { + const schCxt = cxt.subschema({ keyword, schemaProp: prop }, valid); + cxt.mergeValidEvaluated(schCxt, valid); + }, () => gen.var(valid, true) // TODO var + ); + cxt.ok(valid); + } +} +exports.validateSchemaDeps = validateSchemaDeps; +exports.default = def; +//# sourceMappingURL=dependencies.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.js new file mode 100644 index 00000000000000..5801980ae6ed1b --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.js @@ -0,0 +1,11 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const dependencies_1 = require("./dependencies"); +const def = { + keyword: "dependentSchemas", + type: "object", + schemaType: "object", + code: (cxt) => dependencies_1.validateSchemaDeps(cxt), +}; +exports.default = def; +//# sourceMappingURL=dependentSchemas.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/if.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/if.js new file mode 100644 index 00000000000000..79bfee85984373 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/if.js @@ -0,0 +1,67 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("../../compile/codegen"); +const util_1 = require("../../compile/util"); +const validate_1 = require("../../compile/validate"); +const error = { + message: ({ params }) => codegen_1.str `should match "${params.ifClause}" schema`, + params: ({ params }) => codegen_1._ `{failingKeyword: ${params.ifClause}}`, +}; +const def = { + keyword: "if", + schemaType: ["object", "boolean"], + trackErrors: true, + error, + code(cxt) { + const { gen, parentSchema, it } = cxt; + if (parentSchema.then === undefined && parentSchema.else === undefined) { + validate_1.checkStrictMode(it, '"if" without "then" and "else" is ignored'); + } + const hasThen = hasSchema(it, "then"); + const hasElse = hasSchema(it, "else"); + if (!hasThen && !hasElse) + return; + const valid = gen.let("valid", true); + const schValid = gen.name("_valid"); + validateIf(); + cxt.reset(); + if (hasThen && hasElse) { + const ifClause = gen.let("ifClause"); + cxt.setParams({ ifClause }); + gen.if(schValid, validateClause("then", ifClause), validateClause("else", ifClause)); + } + else if (hasThen) { + gen.if(schValid, validateClause("then")); + } + else { + gen.if(codegen_1.not(schValid), validateClause("else")); + } + cxt.pass(valid, () => cxt.error(true)); + function validateIf() { + const schCxt = cxt.subschema({ + keyword: "if", + compositeRule: true, + createErrors: false, + allErrors: false, + }, schValid); + cxt.mergeEvaluated(schCxt); + } + function validateClause(keyword, ifClause) { + return () => { + const schCxt = cxt.subschema({ keyword }, schValid); + gen.assign(valid, schValid); + cxt.mergeValidEvaluated(schCxt, valid); + if (ifClause) + gen.assign(ifClause, codegen_1._ `${keyword}`); + else + cxt.setParams({ ifClause: keyword }); + }; + } + }, +}; +function hasSchema(it, keyword) { + const schema = it.schema[keyword]; + return schema !== undefined && !util_1.alwaysValidSchema(it, schema); +} +exports.default = def; +//# sourceMappingURL=if.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/index.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/index.js new file mode 100644 index 00000000000000..a4fa1704022aa3 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/index.js @@ -0,0 +1,37 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const additionalItems_1 = require("./additionalItems"); +const items_1 = require("./items"); +const contains_1 = require("./contains"); +const dependencies_1 = require("./dependencies"); +const propertyNames_1 = require("./propertyNames"); +const additionalProperties_1 = require("./additionalProperties"); +const properties_1 = require("./properties"); +const patternProperties_1 = require("./patternProperties"); +const not_1 = require("./not"); +const anyOf_1 = require("./anyOf"); +const oneOf_1 = require("./oneOf"); +const allOf_1 = require("./allOf"); +const if_1 = require("./if"); +const thenElse_1 = require("./thenElse"); +const applicator = [ + // any + not_1.default, + anyOf_1.default, + oneOf_1.default, + allOf_1.default, + if_1.default, + thenElse_1.default, + // array + additionalItems_1.default, + items_1.default, + contains_1.default, + // object + propertyNames_1.default, + additionalProperties_1.default, + dependencies_1.default, + properties_1.default, + patternProperties_1.default, +]; +exports.default = applicator; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/items.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/items.js new file mode 100644 index 00000000000000..e398dfbc7af2f1 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/items.js @@ -0,0 +1,64 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("../../compile/codegen"); +const subschema_1 = require("../../compile/subschema"); +const util_1 = require("../../compile/util"); +const validate_1 = require("../../compile/validate"); +const def = { + keyword: "items", + type: "array", + schemaType: ["object", "array", "boolean"], + before: "uniqueItems", + code(cxt) { + const { gen, schema, parentSchema, data, it } = cxt; + const len = gen.const("len", codegen_1._ `${data}.length`); + if (Array.isArray(schema)) { + if (it.opts.unevaluated && schema.length && it.items !== true) { + it.items = util_1.mergeEvaluated.items(gen, schema.length, it.items); + } + validateTuple(schema); + } + else { + it.items = true; + if (!util_1.alwaysValidSchema(it, schema)) + validateArray(); + } + function validateTuple(schArr) { + if (it.opts.strictTuples && !fullTupleSchema(schema.length, parentSchema)) { + const msg = `"items" is ${schArr.length}-tuple, but minItems or maxItems/additionalItems are not specified or different`; + validate_1.checkStrictMode(it, msg, it.opts.strictTuples); + } + const valid = gen.name("valid"); + schArr.forEach((sch, i) => { + if (util_1.alwaysValidSchema(it, sch)) + return; + gen.if(codegen_1._ `${len} > ${i}`, () => cxt.subschema({ + keyword: "items", + schemaProp: i, + dataProp: i, + strictSchema: it.strictSchema, + }, valid)); + cxt.ok(valid); + }); + } + function validateArray() { + const valid = gen.name("valid"); + gen.forRange("i", 0, len, (i) => { + cxt.subschema({ + keyword: "items", + dataProp: i, + dataPropType: subschema_1.Type.Num, + strictSchema: it.strictSchema, + }, valid); + if (!it.allErrors) + gen.if(codegen_1.not(valid), () => gen.break()); + }); + cxt.ok(valid); + } + }, +}; +function fullTupleSchema(len, sch) { + return len === sch.minItems && (len === sch.maxItems || sch.additionalItems === false); +} +exports.default = def; +//# sourceMappingURL=items.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/not.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/not.js new file mode 100644 index 00000000000000..6e7f363be09bb6 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/not.js @@ -0,0 +1,28 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const util_1 = require("../../compile/util"); +const def = { + keyword: "not", + schemaType: ["object", "boolean"], + trackErrors: true, + code(cxt) { + const { gen, schema, it } = cxt; + if (util_1.alwaysValidSchema(it, schema)) { + cxt.fail(); + return; + } + const valid = gen.name("valid"); + cxt.subschema({ + keyword: "not", + compositeRule: true, + createErrors: false, + allErrors: false, + }, valid); + cxt.result(valid, () => cxt.error(), () => cxt.reset()); + }, + error: { + message: "should NOT be valid", + }, +}; +exports.default = def; +//# sourceMappingURL=not.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/oneOf.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/oneOf.js new file mode 100644 index 00000000000000..21135cd7ecfb3d --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/oneOf.js @@ -0,0 +1,58 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("../../compile/codegen"); +const util_1 = require("../../compile/util"); +const error = { + message: "should match exactly one schema in oneOf", + params: ({ params }) => codegen_1._ `{passingSchemas: ${params.passing}}`, +}; +const def = { + keyword: "oneOf", + schemaType: "array", + trackErrors: true, + error, + code(cxt) { + const { gen, schema, it } = cxt; + /* istanbul ignore if */ + if (!Array.isArray(schema)) + throw new Error("ajv implementation error"); + const schArr = schema; + const valid = gen.let("valid", false); + const passing = gen.let("passing", null); + const schValid = gen.name("_valid"); + cxt.setParams({ passing }); + // TODO possibly fail straight away (with warning or exception) if there are two empty always valid schemas + gen.block(validateOneOf); + cxt.result(valid, () => cxt.reset(), () => cxt.error(true)); + function validateOneOf() { + schArr.forEach((sch, i) => { + let schCxt; + if (util_1.alwaysValidSchema(it, sch)) { + gen.var(schValid, true); + } + else { + schCxt = cxt.subschema({ + keyword: "oneOf", + schemaProp: i, + compositeRule: true, + }, schValid); + } + if (i > 0) { + gen + .if(codegen_1._ `${schValid} && ${valid}`) + .assign(valid, false) + .assign(passing, codegen_1._ `[${passing}, ${i}]`) + .else(); + } + gen.if(schValid, () => { + gen.assign(valid, true); + gen.assign(passing, i); + if (schCxt) + cxt.mergeEvaluated(schCxt, codegen_1.Name); + }); + }); + } + }, +}; +exports.default = def; +//# sourceMappingURL=oneOf.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js new file mode 100644 index 00000000000000..25e9e4f5fbaf88 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js @@ -0,0 +1,71 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const code_1 = require("../code"); +const codegen_1 = require("../../compile/codegen"); +const subschema_1 = require("../../compile/subschema"); +const validate_1 = require("../../compile/validate"); +const util_1 = require("../../compile/util"); +const def = { + keyword: "patternProperties", + type: "object", + schemaType: "object", + code(cxt) { + const { gen, schema, data, parentSchema, it } = cxt; + const { opts } = it; + const patterns = code_1.schemaProperties(it, schema); + // TODO mark properties matching patterns with always valid schemas as evaluated + if (patterns.length === 0) + return; + const checkProperties = opts.strict && !opts.allowMatchingProperties && parentSchema.properties; + const valid = gen.name("valid"); + if (it.props !== true && !(it.props instanceof codegen_1.Name)) { + it.props = util_1.evaluatedPropsToName(gen, it.props); + } + const { props } = it; + validatePatternProperties(); + function validatePatternProperties() { + for (const pat of patterns) { + if (checkProperties) + checkMatchingProperties(pat); + if (it.allErrors) { + validateProperties(pat); + } + else { + gen.var(valid, true); // TODO var + validateProperties(pat); + gen.if(valid); + } + } + } + function checkMatchingProperties(pat) { + for (const prop in checkProperties) { + if (new RegExp(pat).test(prop)) { + validate_1.checkStrictMode(it, `property ${prop} matches pattern ${pat} (use allowMatchingProperties)`); + } + } + } + function validateProperties(pat) { + gen.forIn("key", data, (key) => { + gen.if(codegen_1._ `${code_1.usePattern(gen, pat)}.test(${key})`, () => { + cxt.subschema({ + keyword: "patternProperties", + schemaProp: pat, + dataProp: key, + dataPropType: subschema_1.Type.Str, + strictSchema: it.strictSchema, + }, valid); + if (it.opts.unevaluated && props !== true) { + gen.assign(codegen_1._ `${props}[${key}]`, true); + } + else if (!it.allErrors) { + // can short-circuit if `unevaluatedProperties` is not supported (opts.next === false) + // or if all properties were evaluated (props === true) + gen.if(codegen_1.not(valid), () => gen.break()); + } + }); + }); + } + }, +}; +exports.default = def; +//# sourceMappingURL=patternProperties.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/properties.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/properties.js new file mode 100644 index 00000000000000..23dadd7b7ce409 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/properties.js @@ -0,0 +1,51 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const context_1 = require("../../compile/context"); +const code_1 = require("../code"); +const util_1 = require("../../compile/util"); +const additionalProperties_1 = require("./additionalProperties"); +const def = { + keyword: "properties", + type: "object", + schemaType: "object", + code(cxt) { + const { gen, schema, parentSchema, data, it } = cxt; + if (it.opts.removeAdditional === "all" && parentSchema.additionalProperties === undefined) { + additionalProperties_1.default.code(new context_1.default(it, additionalProperties_1.default, "additionalProperties")); + } + const allProps = code_1.allSchemaProperties(schema); + if (it.opts.unevaluated && allProps.length && it.props !== true) { + it.props = util_1.mergeEvaluated.props(gen, util_1.toHash(allProps), it.props); + } + const properties = allProps.filter((p) => !util_1.alwaysValidSchema(it, schema[p])); + if (properties.length === 0) + return; + const valid = gen.name("valid"); + for (const prop of properties) { + if (hasDefault(prop)) { + applyPropertySchema(prop); + } + else { + gen.if(code_1.propertyInData(data, prop, it.opts.ownProperties)); + applyPropertySchema(prop); + if (!it.allErrors) + gen.else().var(valid, true); + gen.endIf(); + } + cxt.ok(valid); + } + function hasDefault(prop) { + return it.opts.useDefaults && !it.compositeRule && schema[prop].default !== undefined; + } + function applyPropertySchema(prop) { + cxt.subschema({ + keyword: "properties", + schemaProp: prop, + dataProp: prop, + strictSchema: it.strictSchema, + }, valid); + } + }, +}; +exports.default = def; +//# sourceMappingURL=properties.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js new file mode 100644 index 00000000000000..9467ce79e18733 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js @@ -0,0 +1,39 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("../../compile/codegen"); +const util_1 = require("../../compile/util"); +const error = { + message: ({ params }) => codegen_1.str `property name '${params.propertyName}' is invalid`, + params: ({ params }) => codegen_1._ `{propertyName: ${params.propertyName}}`, +}; +const def = { + keyword: "propertyNames", + type: "object", + schemaType: ["object", "boolean"], + error, + code(cxt) { + const { gen, schema, data, it } = cxt; + if (util_1.alwaysValidSchema(it, schema)) + return; + const valid = gen.name("valid"); + gen.forIn("key", data, (key) => { + cxt.setParams({ propertyName: key }); + cxt.subschema({ + keyword: "propertyNames", + data: key, + dataTypes: ["string"], + propertyName: key, + compositeRule: true, + strictSchema: it.strictSchema, + }, valid); + gen.if(codegen_1.not(valid), () => { + cxt.error(true); + if (!it.allErrors) + gen.break(); + }); + }); + cxt.ok(valid); + }, +}; +exports.default = def; +//# sourceMappingURL=propertyNames.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/thenElse.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/thenElse.js new file mode 100644 index 00000000000000..f5138c08111ce9 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/thenElse.js @@ -0,0 +1,13 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const validate_1 = require("../../compile/validate"); +const def = { + keyword: ["then", "else"], + schemaType: ["object", "boolean"], + code({ keyword, parentSchema, it }) { + if (parentSchema.if === undefined) + validate_1.checkStrictMode(it, `"${keyword}" without "if" is ignored`); + }, +}; +exports.default = def; +//# sourceMappingURL=thenElse.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/code.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/code.js new file mode 100644 index 00000000000000..7f877151522f51 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/code.js @@ -0,0 +1,67 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.usePattern = exports.callValidateCode = exports.schemaProperties = exports.allSchemaProperties = exports.noPropertyInData = exports.propertyInData = exports.reportMissingProp = exports.checkMissingProp = exports.checkReportMissingProp = void 0; +const codegen_1 = require("../compile/codegen"); +const util_1 = require("../compile/util"); +const names_1 = require("../compile/names"); +function checkReportMissingProp(cxt, prop) { + const { gen, data, it } = cxt; + gen.if(noPropertyInData(data, prop, it.opts.ownProperties), () => { + cxt.setParams({ missingProperty: codegen_1._ `${prop}` }, true); + cxt.error(); + }); +} +exports.checkReportMissingProp = checkReportMissingProp; +function checkMissingProp({ data, it: { opts } }, properties, missing) { + return codegen_1.or(...properties.map((prop) => codegen_1._ `${noPropertyInData(data, prop, opts.ownProperties)} && (${missing} = ${prop})`)); +} +exports.checkMissingProp = checkMissingProp; +function reportMissingProp(cxt, missing) { + cxt.setParams({ missingProperty: missing }, true); + cxt.error(); +} +exports.reportMissingProp = reportMissingProp; +function isOwnProperty(data, property) { + return codegen_1._ `Object.prototype.hasOwnProperty.call(${data}, ${property})`; +} +function propertyInData(data, property, ownProperties) { + const cond = codegen_1._ `${data}${codegen_1.getProperty(property)} !== undefined`; + return ownProperties ? codegen_1._ `${cond} && ${isOwnProperty(data, property)}` : cond; +} +exports.propertyInData = propertyInData; +function noPropertyInData(data, property, ownProperties) { + const cond = codegen_1._ `${data}${codegen_1.getProperty(property)} === undefined`; + return ownProperties ? codegen_1._ `${cond} || !${isOwnProperty(data, property)}` : cond; +} +exports.noPropertyInData = noPropertyInData; +function allSchemaProperties(schemaMap) { + return schemaMap ? Object.keys(schemaMap).filter((p) => p !== "__proto__") : []; +} +exports.allSchemaProperties = allSchemaProperties; +function schemaProperties(it, schemaMap) { + return allSchemaProperties(schemaMap).filter((p) => !util_1.alwaysValidSchema(it, schemaMap[p])); +} +exports.schemaProperties = schemaProperties; +function callValidateCode({ schemaCode, data, it: { gen, topSchemaRef, schemaPath, errorPath }, it }, func, context, passSchema) { + const dataAndSchema = passSchema ? codegen_1._ `${schemaCode}, ${data}, ${topSchemaRef}${schemaPath}` : data; + const valCxt = [ + [names_1.default.dataPath, codegen_1.strConcat(names_1.default.dataPath, errorPath)], + [names_1.default.parentData, it.parentData], + [names_1.default.parentDataProperty, it.parentDataProperty], + [names_1.default.rootData, names_1.default.rootData], + ]; + if (it.opts.dynamicRef) + valCxt.push([names_1.default.dynamicAnchors, names_1.default.dynamicAnchors]); + const args = codegen_1._ `${dataAndSchema}, ${gen.object(...valCxt)}`; + return context !== codegen_1.nil ? codegen_1._ `${func}.call(${context}, ${args})` : codegen_1._ `${func}(${args})`; +} +exports.callValidateCode = callValidateCode; +function usePattern(gen, pattern) { + return gen.scopeValue("pattern", { + key: pattern, + ref: new RegExp(pattern, "u"), + code: codegen_1._ `new RegExp(${pattern}, "u")`, + }); +} +exports.usePattern = usePattern; +//# sourceMappingURL=code.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/core/id.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/core/id.js new file mode 100644 index 00000000000000..313598aab87eb6 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/core/id.js @@ -0,0 +1,10 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const def = { + keyword: "id", + code() { + throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID'); + }, +}; +exports.default = def; +//# sourceMappingURL=id.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/core/index.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/core/index.js new file mode 100644 index 00000000000000..d3981d4b58dcdb --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/core/index.js @@ -0,0 +1,15 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const id_1 = require("./id"); +const ref_1 = require("./ref"); +const core = [ + "$schema", + "$id", + "$defs", + "$vocabulary", + "definitions", + id_1.default, + ref_1.default, +]; +exports.default = core; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/core/ref.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/core/ref.js new file mode 100644 index 00000000000000..b56fbcc511710d --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/core/ref.js @@ -0,0 +1,124 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.callRef = exports.getValidate = void 0; +const error_classes_1 = require("../../compile/error_classes"); +const code_1 = require("../code"); +const codegen_1 = require("../../compile/codegen"); +const names_1 = require("../../compile/names"); +const compile_1 = require("../../compile"); +const util_1 = require("../../compile/util"); +const def = { + keyword: "$ref", + schemaType: "string", + code(cxt) { + const { gen, schema, it } = cxt; + const { baseId, schemaEnv: env, validateName, opts, self } = it; + // TODO See comment in dynamicRef.ts + // This has to be improved to resolve #815. + if (schema === "#" || schema === "#/") + return callRootRef(); + const schOrEnv = compile_1.resolveRef.call(self, env.root, baseId, schema); + if (schOrEnv === undefined) + throw new error_classes_1.MissingRefError(baseId, schema); + if (schOrEnv instanceof compile_1.SchemaEnv) + return callValidate(schOrEnv); + return inlineRefSchema(schOrEnv); + function callRootRef() { + if (env === env.root) + return callRef(cxt, validateName, env, env.$async); + const rootName = gen.scopeValue("root", { ref: env.root }); + return callRef(cxt, codegen_1._ `${rootName}.validate`, env.root, env.root.$async); + } + function callValidate(sch) { + const v = getValidate(cxt, sch); + callRef(cxt, v, sch, sch.$async); + } + function inlineRefSchema(sch) { + const schName = gen.scopeValue("schema", opts.code.source === true ? { ref: sch, code: codegen_1.stringify(sch) } : { ref: sch }); + const valid = gen.name("valid"); + const schCxt = cxt.subschema({ + schema: sch, + strictSchema: true, + dataTypes: [], + schemaPath: codegen_1.nil, + topSchemaRef: schName, + errSchemaPath: schema, + }, valid); + cxt.mergeEvaluated(schCxt); + cxt.ok(valid); + } + }, +}; +function getValidate(cxt, sch) { + const { gen } = cxt; + return sch.validate + ? gen.scopeValue("validate", { ref: sch.validate }) + : codegen_1._ `${gen.scopeValue("wrapper", { ref: sch })}.validate`; +} +exports.getValidate = getValidate; +function callRef(cxt, v, sch, $async) { + const { gen, it } = cxt; + const { allErrors, schemaEnv: env, opts } = it; + const passCxt = opts.passContext ? names_1.default.this : codegen_1.nil; + if ($async) + callAsyncRef(); + else + callSyncRef(); + function callAsyncRef() { + if (!env.$async) + throw new Error("async schema referenced by sync schema"); + const valid = gen.let("valid"); + gen.try(() => { + gen.code(codegen_1._ `await ${code_1.callValidateCode(cxt, v, passCxt)}`); + addEvaluatedFrom(v); // TODO will not work with async, it has to be returned with the result + if (!allErrors) + gen.assign(valid, true); + }, (e) => { + gen.if(codegen_1._ `!(${e} instanceof ${it.ValidationError})`, () => gen.throw(e)); + addErrorsFrom(e); + if (!allErrors) + gen.assign(valid, false); + }); + cxt.ok(valid); + } + function callSyncRef() { + cxt.result(code_1.callValidateCode(cxt, v, passCxt), () => addEvaluatedFrom(v), () => addErrorsFrom(v)); + } + function addErrorsFrom(source) { + const errs = codegen_1._ `${source}.errors`; + gen.assign(names_1.default.vErrors, codegen_1._ `${names_1.default.vErrors} === null ? ${errs} : ${names_1.default.vErrors}.concat(${errs})`); // TODO tagged + gen.assign(names_1.default.errors, codegen_1._ `${names_1.default.vErrors}.length`); + } + function addEvaluatedFrom(source) { + var _a; + if (!it.opts.unevaluated) + return; + const schEvaluated = (_a = sch === null || sch === void 0 ? void 0 : sch.validate) === null || _a === void 0 ? void 0 : _a.evaluated; + // TODO refactor + if (it.props !== true) { + if (schEvaluated && !schEvaluated.dynamicProps) { + if (schEvaluated.props !== undefined) { + it.props = util_1.mergeEvaluated.props(gen, schEvaluated.props, it.props); + } + } + else { + const props = gen.var("props", codegen_1._ `${source}.evaluated.props`); + it.props = util_1.mergeEvaluated.props(gen, props, it.props, codegen_1.Name); + } + } + if (it.items !== true) { + if (schEvaluated && !schEvaluated.dynamicItems) { + if (schEvaluated.items !== undefined) { + it.items = util_1.mergeEvaluated.items(gen, schEvaluated.items, it.items); + } + } + else { + const items = gen.var("items", codegen_1._ `${source}.evaluated.items`); + it.items = util_1.mergeEvaluated.items(gen, items, it.items, codegen_1.Name); + } + } + } +} +exports.callRef = callRef; +exports.default = def; +//# sourceMappingURL=ref.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/draft7.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/draft7.js new file mode 100644 index 00000000000000..a9755d2fbd605e --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/draft7.js @@ -0,0 +1,17 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const core_1 = require("./core"); +const validation_1 = require("./validation"); +const applicator_1 = require("./applicator"); +const format_1 = require("./format"); +const metadata_1 = require("./metadata"); +const draft7Vocabularies = [ + core_1.default, + validation_1.default, + applicator_1.default, + format_1.default, + metadata_1.metadataVocabulary, + metadata_1.contentVocabulary, +]; +exports.default = draft7Vocabularies; +//# sourceMappingURL=draft7.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.js new file mode 100644 index 00000000000000..8beea65ce6511e --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.js @@ -0,0 +1,29 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.dynamicAnchor = void 0; +const codegen_1 = require("../../compile/codegen"); +const names_1 = require("../../compile/names"); +const compile_1 = require("../../compile"); +const ref_1 = require("../core/ref"); +const def = { + keyword: "$dynamicAnchor", + schemaType: "string", + code: (cxt) => dynamicAnchor(cxt, cxt.schema), +}; +function dynamicAnchor(cxt, anchor) { + const { gen, it } = cxt; + it.schemaEnv.root.dynamicAnchors[anchor] = true; + const v = codegen_1._ `${names_1.default.dynamicAnchors}${codegen_1.getProperty(anchor)}`; + const validate = it.errSchemaPath === "#" ? it.validateName : _getValidate(cxt); + gen.if(codegen_1._ `!${v}`, () => gen.assign(v, validate)); +} +exports.dynamicAnchor = dynamicAnchor; +function _getValidate(cxt) { + const { schemaEnv, schema, self } = cxt.it; + const { root, baseId, localRefs, meta } = schemaEnv.root; + const sch = new compile_1.SchemaEnv({ schema, root, baseId, localRefs, meta }); + compile_1.compileSchema.call(self, sch); + return ref_1.getValidate(cxt, sch); +} +exports.default = def; +//# sourceMappingURL=dynamicAnchor.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.js new file mode 100644 index 00000000000000..6e67b1cc9b8912 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.js @@ -0,0 +1,51 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.dynamicRef = void 0; +const codegen_1 = require("../../compile/codegen"); +const names_1 = require("../../compile/names"); +const ref_1 = require("../core/ref"); +const def = { + keyword: "$dynamicRef", + schemaType: "string", + code: (cxt) => dynamicRef(cxt, cxt.schema), +}; +function dynamicRef(cxt, ref) { + const { gen, keyword, it } = cxt; + if (ref[0] !== "#") + throw new Error(`"${keyword}" only supports hash fragment reference`); + const anchor = ref.slice(1); + if (it.allErrors) { + _dynamicRef(); + } + else { + const valid = gen.let("valid", false); + _dynamicRef(valid); + cxt.ok(valid); + } + function _dynamicRef(valid) { + // TODO the assumption here is that `recursiveRef: #` always points to the root + // of the schema object, which is not correct, because there may be $id that + // makes # point to it, and the target schema may not contain dynamic/recursiveAnchor. + // Because of that 2 tests in recursiveRef.json fail. + // This is a similar problem to #815 (`$id` doesn't alter resolution scope for `{ "$ref": "#" }`). + // (This problem is not tested in JSON-Schema-Test-Suite) + if (it.schemaEnv.root.dynamicAnchors[anchor]) { + const v = gen.let("_v", codegen_1._ `${names_1.default.dynamicAnchors}${codegen_1.getProperty(anchor)}`); + gen.if(v, _callRef(v, valid), _callRef(it.validateName, valid)); + } + else { + _callRef(it.validateName, valid)(); + } + } + function _callRef(validate, valid) { + return valid + ? () => gen.block(() => { + ref_1.callRef(cxt, validate); + gen.let(valid, true); + }) + : () => ref_1.callRef(cxt, validate); + } +} +exports.dynamicRef = dynamicRef; +exports.default = def; +//# sourceMappingURL=dynamicRef.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/dynamic/index.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/dynamic/index.js new file mode 100644 index 00000000000000..f2388a7571c900 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/dynamic/index.js @@ -0,0 +1,9 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const dynamicAnchor_1 = require("./dynamicAnchor"); +const dynamicRef_1 = require("./dynamicRef"); +const recursiveAnchor_1 = require("./recursiveAnchor"); +const recursiveRef_1 = require("./recursiveRef"); +const dynamic = [dynamicAnchor_1.default, dynamicRef_1.default, recursiveAnchor_1.default, recursiveRef_1.default]; +exports.default = dynamic; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.js new file mode 100644 index 00000000000000..3e0bb6146a55c9 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.js @@ -0,0 +1,16 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const dynamicAnchor_1 = require("./dynamicAnchor"); +const validate_1 = require("../../compile/validate"); +const def = { + keyword: "$recursiveAnchor", + schemaType: "boolean", + code(cxt) { + if (cxt.schema) + dynamicAnchor_1.dynamicAnchor(cxt, ""); + else + validate_1.checkStrictMode(cxt.it, "$recursiveAnchor: false is ignored"); + }, +}; +exports.default = def; +//# sourceMappingURL=recursiveAnchor.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.js new file mode 100644 index 00000000000000..f421c4cbe27623 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.js @@ -0,0 +1,10 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const dynamicRef_1 = require("./dynamicRef"); +const def = { + keyword: "$recursiveRef", + schemaType: "string", + code: (cxt) => dynamicRef_1.dynamicRef(cxt, cxt.schema), +}; +exports.default = def; +//# sourceMappingURL=recursiveRef.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/errors.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/errors.js new file mode 100644 index 00000000000000..d4d3fba0029359 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/errors.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=errors.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/format/format.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/format/format.js new file mode 100644 index 00000000000000..69c6d2a9bc6b06 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/format/format.js @@ -0,0 +1,91 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("../../compile/codegen"); +const error = { + message: ({ schemaCode }) => codegen_1.str `should match format "${schemaCode}"`, + params: ({ schemaCode }) => codegen_1._ `{format: ${schemaCode}}`, +}; +const def = { + keyword: "format", + type: ["number", "string"], + schemaType: "string", + $data: true, + error, + code(cxt, ruleType) { + const { gen, data, $data, schema, schemaCode, it } = cxt; + const { opts, errSchemaPath, schemaEnv, self } = it; + if (!opts.validateFormats) + return; + if ($data) + validate$DataFormat(); + else + validateFormat(); + function validate$DataFormat() { + const fmts = gen.scopeValue("formats", { + ref: self.formats, + code: opts.code.formats, + }); + const fDef = gen.const("fDef", codegen_1._ `${fmts}[${schemaCode}]`); + const fType = gen.let("fType"); + const format = gen.let("format"); + // TODO simplify + gen.if(codegen_1._ `typeof ${fDef} == "object" && !(${fDef} instanceof RegExp)`, () => gen.assign(fType, codegen_1._ `${fDef}.type || "string"`).assign(format, codegen_1._ `${fDef}.validate`), () => gen.assign(fType, codegen_1._ `"string"`).assign(format, fDef)); + cxt.fail$data(codegen_1.or(unknownFmt(), invalidFmt())); + function unknownFmt() { + if (opts.strict === false) + return codegen_1.nil; + return codegen_1._ `${schemaCode} && !${format}`; + } + function invalidFmt() { + const callFormat = schemaEnv.$async + ? codegen_1._ `(${fDef}.async ? await ${format}(${data}) : ${format}(${data}))` + : codegen_1._ `${format}(${data})`; + const validData = codegen_1._ `(typeof ${format} == "function" ? ${callFormat} : ${format}.test(${data}))`; + return codegen_1._ `${format} && ${format} !== true && ${fType} === ${ruleType} && !${validData}`; + } + } + function validateFormat() { + const formatDef = self.formats[schema]; + if (!formatDef) { + unknownFormat(); + return; + } + if (formatDef === true) + return; + const [fmtType, format, fmtRef] = getFormat(formatDef); + if (fmtType === ruleType) + cxt.pass(validCondition()); + function unknownFormat() { + if (opts.strict === false) { + self.logger.warn(unknownMsg()); + return; + } + throw new Error(unknownMsg()); + function unknownMsg() { + return `unknown format "${schema}" ignored in schema at path "${errSchemaPath}"`; + } + } + function getFormat(fmtDef) { + const fmt = gen.scopeValue("formats", { + key: schema, + ref: fmtDef, + code: opts.code.formats ? codegen_1._ `${opts.code.formats}${codegen_1.getProperty(schema)}` : undefined, + }); + if (typeof fmtDef == "object" && !(fmtDef instanceof RegExp)) { + return [fmtDef.type || "string", fmtDef.validate, codegen_1._ `${fmt}.validate`]; + } + return ["string", fmtDef, fmt]; + } + function validCondition() { + if (typeof formatDef == "object" && !(formatDef instanceof RegExp) && formatDef.async) { + if (!schemaEnv.$async) + throw new Error("async format in sync schema"); + return codegen_1._ `await ${fmtRef}(${data})`; + } + return typeof format == "function" ? codegen_1._ `${fmtRef}(${data})` : codegen_1._ `${fmtRef}.test(${data})`; + } + } + }, +}; +exports.default = def; +//# sourceMappingURL=format.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/format/index.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/format/index.js new file mode 100644 index 00000000000000..d19023d24525c8 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/format/index.js @@ -0,0 +1,6 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const format_1 = require("./format"); +const format = [format_1.default]; +exports.default = format; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/metadata.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/metadata.js new file mode 100644 index 00000000000000..f07bf28b5a0e6c --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/metadata.js @@ -0,0 +1,18 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.contentVocabulary = exports.metadataVocabulary = void 0; +exports.metadataVocabulary = [ + "title", + "description", + "default", + "deprecated", + "readOnly", + "writeOnly", + "examples", +]; +exports.contentVocabulary = [ + "contentMediaType", + "contentEncoding", + "contentSchema", +]; +//# sourceMappingURL=metadata.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/next.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/next.js new file mode 100644 index 00000000000000..c861b32433810e --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/next.js @@ -0,0 +1,8 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const dependentRequired_1 = require("./validation/dependentRequired"); +const dependentSchemas_1 = require("./applicator/dependentSchemas"); +const limitContains_1 = require("./validation/limitContains"); +const next = [dependentRequired_1.default, dependentSchemas_1.default, limitContains_1.default]; +exports.default = next; +//# sourceMappingURL=next.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/unevaluated/index.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/unevaluated/index.js new file mode 100644 index 00000000000000..30e316748de25f --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/unevaluated/index.js @@ -0,0 +1,7 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const unevaluatedProperties_1 = require("./unevaluatedProperties"); +const unevaluatedItems_1 = require("./unevaluatedItems"); +const unevaluated = [unevaluatedProperties_1.default, unevaluatedItems_1.default]; +exports.default = unevaluated; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.js new file mode 100644 index 00000000000000..6ae74763f94ba3 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.js @@ -0,0 +1,41 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("../../compile/codegen"); +const subschema_1 = require("../../compile/subschema"); +const util_1 = require("../../compile/util"); +const error = { + message: ({ params: { len } }) => codegen_1.str `should NOT have more than ${len} items`, + params: ({ params: { len } }) => codegen_1._ `{limit: ${len}}`, +}; +const def = { + keyword: "unevaluatedItems", + type: "array", + schemaType: ["boolean", "object"], + error, + code(cxt) { + const { gen, schema, data, it } = cxt; + const items = it.items || 0; + if (items === true) + return; + const len = gen.const("len", codegen_1._ `${data}.length`); + if (schema === false) { + cxt.setParams({ len: items }); + cxt.fail(codegen_1._ `${len} > ${items}`); + } + else if (typeof schema == "object" && !util_1.alwaysValidSchema(it, schema)) { + const valid = gen.var("valid", codegen_1._ `${len} <= ${items}`); + gen.if(codegen_1.not(valid), () => validateItems(valid, items)); + cxt.ok(valid); + } + it.items = true; + function validateItems(valid, from) { + gen.forRange("i", from, len, (i) => { + cxt.subschema({ keyword: "unevaluatedItems", dataProp: i, dataPropType: subschema_1.Type.Num }, valid); + if (!it.allErrors) + gen.if(codegen_1.not(valid), () => gen.break()); + }); + } + }, +}; +exports.default = def; +//# sourceMappingURL=unevaluatedItems.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js new file mode 100644 index 00000000000000..ce77b261cab7ec --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js @@ -0,0 +1,67 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("../../compile/codegen"); +const util_1 = require("../../compile/util"); +const names_1 = require("../../compile/names"); +const subschema_1 = require("../../compile/subschema"); +const error = { + message: "should NOT have unevaluated properties", + params: ({ params }) => codegen_1._ `{unevaluatedProperty: ${params.unevaluatedProperty}}`, +}; +const def = { + keyword: "unevaluatedProperties", + type: "object", + schemaType: ["boolean", "object"], + trackErrors: true, + error, + code(cxt) { + const { gen, schema, data, errsCount, it } = cxt; + /* istanbul ignore if */ + if (!errsCount) + throw new Error("ajv implementation error"); + const { allErrors, props } = it; + if (props instanceof codegen_1.Name) { + gen.if(codegen_1._ `${props} !== true`, () => gen.forIn("key", data, (key) => gen.if(unevaluatedDynamic(props, key), () => unevaluatedPropCode(key)))); + } + else if (props !== true) { + gen.forIn("key", data, (key) => props === undefined + ? unevaluatedPropCode(key) + : gen.if(unevaluatedStatic(props, key), () => unevaluatedPropCode(key))); + } + it.props = true; + cxt.ok(codegen_1._ `${errsCount} === ${names_1.default.errors}`); + function unevaluatedPropCode(key) { + if (schema === false) { + cxt.setParams({ unevaluatedProperty: key }); + cxt.error(); + if (!allErrors) + gen.break(); + return; + } + if (!util_1.alwaysValidSchema(it, schema)) { + const valid = gen.name("valid"); + cxt.subschema({ + keyword: "unevaluatedProperties", + dataProp: key, + dataPropType: subschema_1.Type.Str, + strictSchema: it.strictSchema, + }, valid); + if (!allErrors) + gen.if(codegen_1.not(valid), () => gen.break()); + } + } + function unevaluatedDynamic(evaluatedProps, key) { + return codegen_1._ `!${evaluatedProps} || !${evaluatedProps}[${key}]`; + } + function unevaluatedStatic(evaluatedProps, key) { + const ps = []; + for (const p in evaluatedProps) { + if (evaluatedProps[p] === true) + ps.push(codegen_1._ `${key} !== ${p}`); + } + return codegen_1.and(...ps); + } + }, +}; +exports.default = def; +//# sourceMappingURL=unevaluatedProperties.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/validation/const.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/validation/const.js new file mode 100644 index 00000000000000..24ac5a43e26c1a --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/validation/const.js @@ -0,0 +1,23 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("../../compile/codegen"); +const equal = require("fast-deep-equal"); +const error = { + message: "should be equal to constant", + params: ({ schemaCode }) => codegen_1._ `{allowedValue: ${schemaCode}}`, +}; +const def = { + keyword: "const", + $data: true, + error, + code(cxt) { + const eql = cxt.gen.scopeValue("func", { + ref: equal, + code: codegen_1._ `require("ajv/dist/compile/equal")`, + }); + // TODO optimize for scalar values in schema + cxt.fail$data(codegen_1._ `!${eql}(${cxt.data}, ${cxt.schemaCode})`); + }, +}; +exports.default = def; +//# sourceMappingURL=const.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/validation/dependentRequired.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/validation/dependentRequired.js new file mode 100644 index 00000000000000..27c4eb26050fc3 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/validation/dependentRequired.js @@ -0,0 +1,12 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const dependencies_1 = require("../applicator/dependencies"); +const def = { + keyword: "dependentRequired", + type: "object", + schemaType: "object", + error: dependencies_1.error, + code: (cxt) => dependencies_1.validatePropertyDeps(cxt), +}; +exports.default = def; +//# sourceMappingURL=dependentRequired.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/validation/enum.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/validation/enum.js new file mode 100644 index 00000000000000..ffc7f84622d815 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/validation/enum.js @@ -0,0 +1,49 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("../../compile/codegen"); +const equal = require("fast-deep-equal"); +const error = { + message: "should be equal to one of the allowed values", + params: ({ schemaCode }) => codegen_1._ `{allowedValues: ${schemaCode}}`, +}; +const def = { + keyword: "enum", + schemaType: "array", + $data: true, + error, + code(cxt) { + const { gen, data, $data, schema, schemaCode, it } = cxt; + if (!$data && schema.length === 0) + throw new Error("enum must have non-empty array"); + const useLoop = schema.length >= it.opts.loopEnum; + const eql = cxt.gen.scopeValue("func", { + ref: equal, + code: codegen_1._ `require("ajv/dist/compile/equal")`, + }); + let valid; + if (useLoop || $data) { + valid = gen.let("valid"); + cxt.block$data(valid, loopEnum); + } + else { + /* istanbul ignore if */ + if (!Array.isArray(schema)) + throw new Error("ajv implementation error"); + const vSchema = gen.const("vSchema", schemaCode); + valid = codegen_1.or(...schema.map((_x, i) => equalCode(vSchema, i))); + } + cxt.pass(valid); + function loopEnum() { + gen.assign(valid, false); + gen.forOf("v", schemaCode, (v) => gen.if(codegen_1._ `${eql}(${data}, ${v})`, () => gen.assign(valid, true).break())); + } + function equalCode(vSchema, i) { + const sch = schema[i]; + return sch && typeof sch === "object" + ? codegen_1._ `${eql}(${data}, ${vSchema}[${i}])` + : codegen_1._ `${data} === ${sch}`; + } + }, +}; +exports.default = def; +//# sourceMappingURL=enum.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/validation/index.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/validation/index.js new file mode 100644 index 00000000000000..9a7b711c1b2ca1 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/validation/index.js @@ -0,0 +1,32 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const limitNumber_1 = require("./limitNumber"); +const multipleOf_1 = require("./multipleOf"); +const limitLength_1 = require("./limitLength"); +const pattern_1 = require("./pattern"); +const limitProperties_1 = require("./limitProperties"); +const required_1 = require("./required"); +const limitItems_1 = require("./limitItems"); +const uniqueItems_1 = require("./uniqueItems"); +const const_1 = require("./const"); +const enum_1 = require("./enum"); +const validation = [ + // number + limitNumber_1.default, + multipleOf_1.default, + // string + limitLength_1.default, + pattern_1.default, + // object + limitProperties_1.default, + required_1.default, + // array + limitItems_1.default, + uniqueItems_1.default, + // any + { keyword: "nullable", schemaType: "boolean" }, + const_1.default, + enum_1.default, +]; +exports.default = validation; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/validation/limitContains.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/validation/limitContains.js new file mode 100644 index 00000000000000..155654b0518166 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/validation/limitContains.js @@ -0,0 +1,15 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const validate_1 = require("../../compile/validate"); +const def = { + keyword: ["maxContains", "minContains"], + type: "array", + schemaType: "number", + code({ keyword, parentSchema, it }) { + if (parentSchema.contains === undefined) { + validate_1.checkStrictMode(it, `"${keyword}" without "contains" is ignored`); + } + }, +}; +exports.default = def; +//# sourceMappingURL=limitContains.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/validation/limitItems.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/validation/limitItems.js new file mode 100644 index 00000000000000..fbcf8f87543d2b --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/validation/limitItems.js @@ -0,0 +1,24 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("../../compile/codegen"); +const error = { + message({ keyword, schemaCode }) { + const comp = keyword === "maxItems" ? "more" : "fewer"; + return codegen_1.str `should NOT have ${comp} than ${schemaCode} items`; + }, + params: ({ schemaCode }) => codegen_1._ `{limit: ${schemaCode}}`, +}; +const def = { + keyword: ["maxItems", "minItems"], + type: "array", + schemaType: "number", + $data: true, + error, + code(cxt) { + const { keyword, data, schemaCode } = cxt; + const op = keyword === "maxItems" ? codegen_1.operators.GT : codegen_1.operators.LT; + cxt.fail$data(codegen_1._ `${data}.length ${op} ${schemaCode}`); + }, +}; +exports.default = def; +//# sourceMappingURL=limitItems.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/validation/limitLength.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/validation/limitLength.js new file mode 100644 index 00000000000000..8102ddb13029b9 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/validation/limitLength.js @@ -0,0 +1,36 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("../../compile/codegen"); +const ucs2length_1 = require("../../compile/ucs2length"); +const error = { + message({ keyword, schemaCode }) { + const comp = keyword === "maxLength" ? "more" : "fewer"; + return codegen_1.str `should NOT have ${comp} than ${schemaCode} characters`; + }, + params: ({ schemaCode }) => codegen_1._ `{limit: ${schemaCode}}`, +}; +const def = { + keyword: ["maxLength", "minLength"], + type: "string", + schemaType: "number", + $data: true, + error, + code(cxt) { + const { keyword, data, schemaCode, it } = cxt; + const op = keyword === "maxLength" ? codegen_1.operators.GT : codegen_1.operators.LT; + let len; + if (it.opts.unicode === false) { + len = codegen_1._ `${data}.length`; + } + else { + const u2l = cxt.gen.scopeValue("func", { + ref: ucs2length_1.default, + code: codegen_1._ `require("ajv/dist/compile/ucs2length").default`, + }); + len = codegen_1._ `${u2l}(${data})`; + } + cxt.fail$data(codegen_1._ `${len} ${op} ${schemaCode}`); + }, +}; +exports.default = def; +//# sourceMappingURL=limitLength.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/validation/limitNumber.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/validation/limitNumber.js new file mode 100644 index 00000000000000..a86bfef7b3ba29 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/validation/limitNumber.js @@ -0,0 +1,27 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("../../compile/codegen"); +const ops = codegen_1.operators; +const KWDs = { + maximum: { okStr: "<=", ok: ops.LTE, fail: ops.GT }, + minimum: { okStr: ">=", ok: ops.GTE, fail: ops.LT }, + exclusiveMaximum: { okStr: "<", ok: ops.LT, fail: ops.GTE }, + exclusiveMinimum: { okStr: ">", ok: ops.GT, fail: ops.LTE }, +}; +const error = { + message: ({ keyword, schemaCode }) => codegen_1.str `should be ${KWDs[keyword].okStr} ${schemaCode}`, + params: ({ keyword, schemaCode }) => codegen_1._ `{comparison: ${KWDs[keyword].okStr}, limit: ${schemaCode}}`, +}; +const def = { + keyword: Object.keys(KWDs), + type: "number", + schemaType: "number", + $data: true, + error, + code(cxt) { + const { keyword, data, schemaCode } = cxt; + cxt.fail$data(codegen_1._ `${data} ${KWDs[keyword].fail} ${schemaCode} || isNaN(${data})`); + }, +}; +exports.default = def; +//# sourceMappingURL=limitNumber.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/validation/limitProperties.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/validation/limitProperties.js new file mode 100644 index 00000000000000..19a558ea674e5a --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/validation/limitProperties.js @@ -0,0 +1,24 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("../../compile/codegen"); +const error = { + message({ keyword, schemaCode }) { + const comp = keyword === "maxProperties" ? "more" : "fewer"; + return codegen_1.str `should NOT have ${comp} than ${schemaCode} items`; + }, + params: ({ schemaCode }) => codegen_1._ `{limit: ${schemaCode}}`, +}; +const def = { + keyword: ["maxProperties", "minProperties"], + type: "object", + schemaType: "number", + $data: true, + error, + code(cxt) { + const { keyword, data, schemaCode } = cxt; + const op = keyword === "maxProperties" ? codegen_1.operators.GT : codegen_1.operators.LT; + cxt.fail$data(codegen_1._ `Object.keys(${data}).length ${op} ${schemaCode}`); + }, +}; +exports.default = def; +//# sourceMappingURL=limitProperties.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/validation/multipleOf.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/validation/multipleOf.js new file mode 100644 index 00000000000000..6c6fd44a568a6b --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/validation/multipleOf.js @@ -0,0 +1,26 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("../../compile/codegen"); +const error = { + message: ({ schemaCode }) => codegen_1.str `should be multiple of ${schemaCode}`, + params: ({ schemaCode }) => codegen_1._ `{multipleOf: ${schemaCode}}`, +}; +const def = { + keyword: "multipleOf", + type: "number", + schemaType: "number", + $data: true, + error, + code(cxt) { + const { gen, data, schemaCode, it } = cxt; + // const bdt = bad$DataType(schemaCode, def.schemaType, $data) + const prec = it.opts.multipleOfPrecision; + const res = gen.let("res"); + const invalid = prec + ? codegen_1._ `Math.abs(Math.round(${res}) - ${res}) > 1e-${prec}` + : codegen_1._ `${res} !== parseInt(${res})`; + cxt.fail$data(codegen_1._ `(${schemaCode} === 0 || (${res} = ${data}/${schemaCode}, ${invalid}))`); + }, +}; +exports.default = def; +//# sourceMappingURL=multipleOf.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/validation/pattern.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/validation/pattern.js new file mode 100644 index 00000000000000..d17780db31664b --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/validation/pattern.js @@ -0,0 +1,22 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const code_1 = require("../code"); +const codegen_1 = require("../../compile/codegen"); +const error = { + message: ({ schemaCode }) => codegen_1.str `should match pattern "${schemaCode}"`, + params: ({ schemaCode }) => codegen_1._ `{pattern: ${schemaCode}}`, +}; +const def = { + keyword: "pattern", + type: "string", + schemaType: "string", + $data: true, + error, + code(cxt) { + const { gen, data, $data, schema, schemaCode } = cxt; + const regExp = $data ? codegen_1._ `(new RegExp(${schemaCode}, "u"))` : code_1.usePattern(gen, schema); // TODO regexp should be wrapped in try/catch + cxt.fail$data(codegen_1._ `!${regExp}.test(${data})`); + }, +}; +exports.default = def; +//# sourceMappingURL=pattern.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/validation/required.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/validation/required.js new file mode 100644 index 00000000000000..2d385229fbcd17 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/validation/required.js @@ -0,0 +1,67 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const code_1 = require("../code"); +const codegen_1 = require("../../compile/codegen"); +const error = { + message: ({ params: { missingProperty } }) => codegen_1.str `should have required property '${missingProperty}'`, + params: ({ params: { missingProperty } }) => codegen_1._ `{missingProperty: ${missingProperty}}`, +}; +const def = { + keyword: "required", + type: "object", + schemaType: "array", + $data: true, + error, + code(cxt) { + const { gen, schema, schemaCode, data, $data, it } = cxt; + const { opts } = it; + if (!$data && schema.length === 0) + return; + const useLoop = schema.length >= opts.loopRequired; + if (it.allErrors) + allErrorsMode(); + else + exitOnErrorMode(); + function allErrorsMode() { + if (useLoop || $data) { + cxt.block$data(codegen_1.nil, loopAllRequired); + } + else { + for (const prop of schema) { + code_1.checkReportMissingProp(cxt, prop); + } + } + } + function exitOnErrorMode() { + const missing = gen.let("missing"); + if (useLoop || $data) { + const valid = gen.let("valid", true); + cxt.block$data(valid, () => loopUntilMissing(missing, valid)); + cxt.ok(valid); + } + else { + gen.if(code_1.checkMissingProp(cxt, schema, missing)); + code_1.reportMissingProp(cxt, missing); + gen.else(); + } + } + function loopAllRequired() { + gen.forOf("prop", schemaCode, (prop) => { + cxt.setParams({ missingProperty: prop }); + gen.if(code_1.noPropertyInData(data, prop, opts.ownProperties), () => cxt.error()); + }); + } + function loopUntilMissing(missing, valid) { + cxt.setParams({ missingProperty: missing }); + gen.forOf(missing, schemaCode, () => { + gen.assign(valid, code_1.propertyInData(data, missing, opts.ownProperties)); + gen.if(codegen_1.not(valid), () => { + cxt.error(); + gen.break(); + }); + }, codegen_1.nil); + } + }, +}; +exports.default = def; +//# sourceMappingURL=required.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js new file mode 100644 index 00000000000000..68d31a13cbee51 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js @@ -0,0 +1,66 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const dataType_1 = require("../../compile/validate/dataType"); +const codegen_1 = require("../../compile/codegen"); +const equal = require("fast-deep-equal"); +const error = { + message: ({ params: { i, j } }) => codegen_1.str `should NOT have duplicate items (items ## ${j} and ${i} are identical)`, + params: ({ params: { i, j } }) => codegen_1._ `{i: ${i}, j: ${j}}`, +}; +const def = { + keyword: "uniqueItems", + type: "array", + schemaType: "boolean", + $data: true, + error, + code(cxt) { + const { gen, data, $data, schema, parentSchema, schemaCode, it } = cxt; + if (!$data && !schema) + return; + const valid = gen.let("valid"); + const itemTypes = parentSchema.items ? dataType_1.getSchemaTypes(parentSchema.items) : []; + cxt.block$data(valid, validateUniqueItems, codegen_1._ `${schemaCode} === false`); + cxt.ok(valid); + function validateUniqueItems() { + const i = gen.let("i", codegen_1._ `${data}.length`); + const j = gen.let("j"); + cxt.setParams({ i, j }); + gen.assign(valid, true); + gen.if(codegen_1._ `${i} > 1`, () => (canOptimize() ? loopN : loopN2)(i, j)); + } + function canOptimize() { + return itemTypes.length > 0 && !itemTypes.some((t) => t === "object" || t === "array"); + } + function loopN(i, j) { + const item = gen.name("item"); + const wrongType = dataType_1.checkDataTypes(itemTypes, item, it.opts.strict, dataType_1.DataType.Wrong); + const indices = gen.const("indices", codegen_1._ `{}`); + gen.for(codegen_1._ `;${i}--;`, () => { + gen.let(item, codegen_1._ `${data}[${i}]`); + gen.if(wrongType, codegen_1._ `continue`); + if (itemTypes.length > 1) + gen.if(codegen_1._ `typeof ${item} == "string"`, codegen_1._ `${item} += "_"`); + gen + .if(codegen_1._ `typeof ${indices}[${item}] == "number"`, () => { + gen.assign(j, codegen_1._ `${indices}[${item}]`); + cxt.error(); + gen.assign(valid, false).break(); + }) + .code(codegen_1._ `${indices}[${item}] = ${i}`); + }); + } + function loopN2(i, j) { + const eql = cxt.gen.scopeValue("func", { + ref: equal, + code: codegen_1._ `require("ajv/dist/compile/equal")`, + }); + const outer = gen.name("outer"); + gen.label(outer).for(codegen_1._ `;${i}--;`, () => gen.for(codegen_1._ `${j} = ${i}; ${j}--;`, () => gen.if(codegen_1._ `${eql}(${data}[${i}], ${data}[${j}])`, () => { + cxt.error(); + gen.assign(valid, false).break(outer); + }))); + } + }, +}; +exports.default = def; +//# sourceMappingURL=uniqueItems.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/lib/compile/equal.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/lib/compile/equal.js new file mode 100644 index 00000000000000..b67591643e6e1f --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/lib/compile/equal.js @@ -0,0 +1,3 @@ +// do NOT remove this file - it would break pre-compiled schemas +// https://github.com/ajv-validator/ajv/issues/889 +module.exports = require("fast-deep-equal") diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/lib/refs/data.json b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/lib/refs/data.json new file mode 100644 index 00000000000000..9ffc9f5ce05484 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/lib/refs/data.json @@ -0,0 +1,13 @@ +{ + "$id": "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#", + "description": "Meta-schema for $data reference (JSON AnySchema extension proposal)", + "type": "object", + "required": ["$data"], + "properties": { + "$data": { + "type": "string", + "anyOf": [{"format": "relative-json-pointer"}, {"format": "json-pointer"}] + } + }, + "additionalProperties": false +} diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/lib/refs/json-schema-2019-09/meta/applicator.json b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/lib/refs/json-schema-2019-09/meta/applicator.json new file mode 100644 index 00000000000000..c5e91cf2ac8469 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/lib/refs/json-schema-2019-09/meta/applicator.json @@ -0,0 +1,53 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$id": "https://json-schema.org/draft/2019-09/meta/applicator", + "$vocabulary": { + "https://json-schema.org/draft/2019-09/vocab/applicator": true + }, + "$recursiveAnchor": true, + + "title": "Applicator vocabulary meta-schema", + "type": ["object", "boolean"], + "properties": { + "additionalItems": {"$recursiveRef": "#"}, + "unevaluatedItems": {"$recursiveRef": "#"}, + "items": { + "anyOf": [{"$recursiveRef": "#"}, {"$ref": "#/$defs/schemaArray"}] + }, + "contains": {"$recursiveRef": "#"}, + "additionalProperties": {"$recursiveRef": "#"}, + "unevaluatedProperties": {"$recursiveRef": "#"}, + "properties": { + "type": "object", + "additionalProperties": {"$recursiveRef": "#"}, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": {"$recursiveRef": "#"}, + "propertyNames": {"format": "regex"}, + "default": {} + }, + "dependentSchemas": { + "type": "object", + "additionalProperties": { + "$recursiveRef": "#" + } + }, + "propertyNames": {"$recursiveRef": "#"}, + "if": {"$recursiveRef": "#"}, + "then": {"$recursiveRef": "#"}, + "else": {"$recursiveRef": "#"}, + "allOf": {"$ref": "#/$defs/schemaArray"}, + "anyOf": {"$ref": "#/$defs/schemaArray"}, + "oneOf": {"$ref": "#/$defs/schemaArray"}, + "not": {"$recursiveRef": "#"} + }, + "$defs": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": {"$recursiveRef": "#"} + } + } +} diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/lib/refs/json-schema-2019-09/meta/content.json b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/lib/refs/json-schema-2019-09/meta/content.json new file mode 100644 index 00000000000000..b8f63734343046 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/lib/refs/json-schema-2019-09/meta/content.json @@ -0,0 +1,17 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$id": "https://json-schema.org/draft/2019-09/meta/content", + "$vocabulary": { + "https://json-schema.org/draft/2019-09/vocab/content": true + }, + "$recursiveAnchor": true, + + "title": "Content vocabulary meta-schema", + + "type": ["object", "boolean"], + "properties": { + "contentMediaType": {"type": "string"}, + "contentEncoding": {"type": "string"}, + "contentSchema": {"$recursiveRef": "#"} + } +} diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/lib/refs/json-schema-2019-09/meta/core.json b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/lib/refs/json-schema-2019-09/meta/core.json new file mode 100644 index 00000000000000..f71adbff04fe9e --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/lib/refs/json-schema-2019-09/meta/core.json @@ -0,0 +1,57 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$id": "https://json-schema.org/draft/2019-09/meta/core", + "$vocabulary": { + "https://json-schema.org/draft/2019-09/vocab/core": true + }, + "$recursiveAnchor": true, + + "title": "Core vocabulary meta-schema", + "type": ["object", "boolean"], + "properties": { + "$id": { + "type": "string", + "format": "uri-reference", + "$comment": "Non-empty fragments not allowed.", + "pattern": "^[^#]*#?$" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "$anchor": { + "type": "string", + "pattern": "^[A-Za-z][-A-Za-z0-9.:_]*$" + }, + "$ref": { + "type": "string", + "format": "uri-reference" + }, + "$recursiveRef": { + "type": "string", + "format": "uri-reference" + }, + "$recursiveAnchor": { + "type": "boolean", + "default": false + }, + "$vocabulary": { + "type": "object", + "propertyNames": { + "type": "string", + "format": "uri" + }, + "additionalProperties": { + "type": "boolean" + } + }, + "$comment": { + "type": "string" + }, + "$defs": { + "type": "object", + "additionalProperties": {"$recursiveRef": "#"}, + "default": {} + } + } +} diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/lib/refs/json-schema-2019-09/meta/format.json b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/lib/refs/json-schema-2019-09/meta/format.json new file mode 100644 index 00000000000000..03ccfce26efeaf --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/lib/refs/json-schema-2019-09/meta/format.json @@ -0,0 +1,14 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$id": "https://json-schema.org/draft/2019-09/meta/format", + "$vocabulary": { + "https://json-schema.org/draft/2019-09/vocab/format": true + }, + "$recursiveAnchor": true, + + "title": "Format vocabulary meta-schema", + "type": ["object", "boolean"], + "properties": { + "format": {"type": "string"} + } +} diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/lib/refs/json-schema-2019-09/meta/meta-data.json b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/lib/refs/json-schema-2019-09/meta/meta-data.json new file mode 100644 index 00000000000000..0e194326fa133b --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/lib/refs/json-schema-2019-09/meta/meta-data.json @@ -0,0 +1,37 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$id": "https://json-schema.org/draft/2019-09/meta/meta-data", + "$vocabulary": { + "https://json-schema.org/draft/2019-09/vocab/meta-data": true + }, + "$recursiveAnchor": true, + + "title": "Meta-data vocabulary meta-schema", + + "type": ["object", "boolean"], + "properties": { + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": true, + "deprecated": { + "type": "boolean", + "default": false + }, + "readOnly": { + "type": "boolean", + "default": false + }, + "writeOnly": { + "type": "boolean", + "default": false + }, + "examples": { + "type": "array", + "items": true + } + } +} diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/lib/refs/json-schema-2019-09/meta/validation.json b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/lib/refs/json-schema-2019-09/meta/validation.json new file mode 100644 index 00000000000000..7027a1279a014a --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/lib/refs/json-schema-2019-09/meta/validation.json @@ -0,0 +1,90 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$id": "https://json-schema.org/draft/2019-09/meta/validation", + "$vocabulary": { + "https://json-schema.org/draft/2019-09/vocab/validation": true + }, + "$recursiveAnchor": true, + + "title": "Validation vocabulary meta-schema", + "type": ["object", "boolean"], + "properties": { + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": {"$ref": "#/$defs/nonNegativeInteger"}, + "minLength": {"$ref": "#/$defs/nonNegativeIntegerDefault0"}, + "pattern": { + "type": "string", + "format": "regex" + }, + "maxItems": {"$ref": "#/$defs/nonNegativeInteger"}, + "minItems": {"$ref": "#/$defs/nonNegativeIntegerDefault0"}, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "maxContains": {"$ref": "#/$defs/nonNegativeInteger"}, + "minContains": { + "$ref": "#/$defs/nonNegativeInteger", + "default": 1 + }, + "maxProperties": {"$ref": "#/$defs/nonNegativeInteger"}, + "minProperties": {"$ref": "#/$defs/nonNegativeIntegerDefault0"}, + "required": {"$ref": "#/$defs/stringArray"}, + "dependentRequired": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/stringArray" + } + }, + "const": true, + "enum": { + "type": "array", + "items": true + }, + "type": { + "anyOf": [ + {"$ref": "#/$defs/simpleTypes"}, + { + "type": "array", + "items": {"$ref": "#/$defs/simpleTypes"}, + "minItems": 1, + "uniqueItems": true + } + ] + } + }, + "$defs": { + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "$ref": "#/$defs/nonNegativeInteger", + "default": 0 + }, + "simpleTypes": { + "enum": ["array", "boolean", "integer", "null", "number", "object", "string"] + }, + "stringArray": { + "type": "array", + "items": {"type": "string"}, + "uniqueItems": true, + "default": [] + } + } +} diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/lib/refs/json-schema-2019-09/schema.json b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/lib/refs/json-schema-2019-09/schema.json new file mode 100644 index 00000000000000..54eb7157afed69 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/lib/refs/json-schema-2019-09/schema.json @@ -0,0 +1,39 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$id": "https://json-schema.org/draft/2019-09/schema", + "$vocabulary": { + "https://json-schema.org/draft/2019-09/vocab/core": true, + "https://json-schema.org/draft/2019-09/vocab/applicator": true, + "https://json-schema.org/draft/2019-09/vocab/validation": true, + "https://json-schema.org/draft/2019-09/vocab/meta-data": true, + "https://json-schema.org/draft/2019-09/vocab/format": false, + "https://json-schema.org/draft/2019-09/vocab/content": true + }, + "$recursiveAnchor": true, + + "title": "Core and Validation specifications meta-schema", + "allOf": [ + {"$ref": "meta/core"}, + {"$ref": "meta/applicator"}, + {"$ref": "meta/validation"}, + {"$ref": "meta/meta-data"}, + {"$ref": "meta/format"}, + {"$ref": "meta/content"} + ], + "type": ["object", "boolean"], + "properties": { + "definitions": { + "$comment": "While no longer an official keyword as it is replaced by $defs, this keyword is retained in the meta-schema to prevent incompatible extensions as it remains in common use.", + "type": "object", + "additionalProperties": {"$recursiveRef": "#"}, + "default": {} + }, + "dependencies": { + "$comment": "\"dependencies\" is no longer a keyword, but schema authors should avoid redefining it to facilitate a smooth transition to \"dependentSchemas\" and \"dependentRequired\"", + "type": "object", + "additionalProperties": { + "anyOf": [{"$recursiveRef": "#"}, {"$ref": "meta/validation#/$defs/stringArray"}] + } + } + } +} diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/lib/refs/json-schema-draft-06.json b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/lib/refs/json-schema-draft-06.json new file mode 100644 index 00000000000000..5410064ba8df93 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/lib/refs/json-schema-draft-06.json @@ -0,0 +1,137 @@ +{ + "$schema": "http://json-schema.org/draft-06/schema#", + "$id": "http://json-schema.org/draft-06/schema#", + "title": "Core schema meta-schema", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": {"$ref": "#"} + }, + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "allOf": [{"$ref": "#/definitions/nonNegativeInteger"}, {"default": 0}] + }, + "simpleTypes": { + "enum": ["array", "boolean", "integer", "null", "number", "object", "string"] + }, + "stringArray": { + "type": "array", + "items": {"type": "string"}, + "uniqueItems": true, + "default": [] + } + }, + "type": ["object", "boolean"], + "properties": { + "$id": { + "type": "string", + "format": "uri-reference" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "$ref": { + "type": "string", + "format": "uri-reference" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": {}, + "examples": { + "type": "array", + "items": {} + }, + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": {"$ref": "#/definitions/nonNegativeInteger"}, + "minLength": {"$ref": "#/definitions/nonNegativeIntegerDefault0"}, + "pattern": { + "type": "string", + "format": "regex" + }, + "additionalItems": {"$ref": "#"}, + "items": { + "anyOf": [{"$ref": "#"}, {"$ref": "#/definitions/schemaArray"}], + "default": {} + }, + "maxItems": {"$ref": "#/definitions/nonNegativeInteger"}, + "minItems": {"$ref": "#/definitions/nonNegativeIntegerDefault0"}, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "contains": {"$ref": "#"}, + "maxProperties": {"$ref": "#/definitions/nonNegativeInteger"}, + "minProperties": {"$ref": "#/definitions/nonNegativeIntegerDefault0"}, + "required": {"$ref": "#/definitions/stringArray"}, + "additionalProperties": {"$ref": "#"}, + "definitions": { + "type": "object", + "additionalProperties": {"$ref": "#"}, + "default": {} + }, + "properties": { + "type": "object", + "additionalProperties": {"$ref": "#"}, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": {"$ref": "#"}, + "default": {} + }, + "dependencies": { + "type": "object", + "additionalProperties": { + "anyOf": [{"$ref": "#"}, {"$ref": "#/definitions/stringArray"}] + } + }, + "propertyNames": {"$ref": "#"}, + "const": {}, + "enum": { + "type": "array", + "minItems": 1, + "uniqueItems": true + }, + "type": { + "anyOf": [ + {"$ref": "#/definitions/simpleTypes"}, + { + "type": "array", + "items": {"$ref": "#/definitions/simpleTypes"}, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "format": {"type": "string"}, + "allOf": {"$ref": "#/definitions/schemaArray"}, + "anyOf": {"$ref": "#/definitions/schemaArray"}, + "oneOf": {"$ref": "#/definitions/schemaArray"}, + "not": {"$ref": "#"} + }, + "default": {} +} diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/lib/refs/json-schema-draft-07.json b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/lib/refs/json-schema-draft-07.json new file mode 100644 index 00000000000000..6a74851043623c --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/lib/refs/json-schema-draft-07.json @@ -0,0 +1,151 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "http://json-schema.org/draft-07/schema#", + "title": "Core schema meta-schema", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": {"$ref": "#"} + }, + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "allOf": [{"$ref": "#/definitions/nonNegativeInteger"}, {"default": 0}] + }, + "simpleTypes": { + "enum": ["array", "boolean", "integer", "null", "number", "object", "string"] + }, + "stringArray": { + "type": "array", + "items": {"type": "string"}, + "uniqueItems": true, + "default": [] + } + }, + "type": ["object", "boolean"], + "properties": { + "$id": { + "type": "string", + "format": "uri-reference" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "$ref": { + "type": "string", + "format": "uri-reference" + }, + "$comment": { + "type": "string" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": true, + "readOnly": { + "type": "boolean", + "default": false + }, + "examples": { + "type": "array", + "items": true + }, + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": {"$ref": "#/definitions/nonNegativeInteger"}, + "minLength": {"$ref": "#/definitions/nonNegativeIntegerDefault0"}, + "pattern": { + "type": "string", + "format": "regex" + }, + "additionalItems": {"$ref": "#"}, + "items": { + "anyOf": [{"$ref": "#"}, {"$ref": "#/definitions/schemaArray"}], + "default": true + }, + "maxItems": {"$ref": "#/definitions/nonNegativeInteger"}, + "minItems": {"$ref": "#/definitions/nonNegativeIntegerDefault0"}, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "contains": {"$ref": "#"}, + "maxProperties": {"$ref": "#/definitions/nonNegativeInteger"}, + "minProperties": {"$ref": "#/definitions/nonNegativeIntegerDefault0"}, + "required": {"$ref": "#/definitions/stringArray"}, + "additionalProperties": {"$ref": "#"}, + "definitions": { + "type": "object", + "additionalProperties": {"$ref": "#"}, + "default": {} + }, + "properties": { + "type": "object", + "additionalProperties": {"$ref": "#"}, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": {"$ref": "#"}, + "propertyNames": {"format": "regex"}, + "default": {} + }, + "dependencies": { + "type": "object", + "additionalProperties": { + "anyOf": [{"$ref": "#"}, {"$ref": "#/definitions/stringArray"}] + } + }, + "propertyNames": {"$ref": "#"}, + "const": true, + "enum": { + "type": "array", + "items": true, + "minItems": 1, + "uniqueItems": true + }, + "type": { + "anyOf": [ + {"$ref": "#/definitions/simpleTypes"}, + { + "type": "array", + "items": {"$ref": "#/definitions/simpleTypes"}, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "format": {"type": "string"}, + "contentMediaType": {"type": "string"}, + "contentEncoding": {"type": "string"}, + "if": {"$ref": "#"}, + "then": {"$ref": "#"}, + "else": {"$ref": "#"}, + "allOf": {"$ref": "#/definitions/schemaArray"}, + "anyOf": {"$ref": "#/definitions/schemaArray"}, + "oneOf": {"$ref": "#/definitions/schemaArray"}, + "not": {"$ref": "#"} + }, + "default": true +} diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/lib/refs/json-schema-secure.json b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/lib/refs/json-schema-secure.json new file mode 100644 index 00000000000000..3968abd5d97e7b --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/lib/refs/json-schema-secure.json @@ -0,0 +1,88 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/json-schema-secure.json#", + "title": "Meta-schema for the security assessment of JSON Schemas", + "description": "If a JSON AnySchema fails validation against this meta-schema, it may be unsafe to validate untrusted data", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": {"$ref": "#"} + } + }, + "dependencies": { + "patternProperties": { + "description": "prevent slow validation of large property names", + "required": ["propertyNames"], + "properties": { + "propertyNames": { + "required": ["maxLength"] + } + } + }, + "uniqueItems": { + "description": "prevent slow validation of large non-scalar arrays", + "if": { + "properties": { + "uniqueItems": {"const": true}, + "items": { + "properties": { + "type": { + "anyOf": [ + { + "enum": ["object", "array"] + }, + { + "type": "array", + "contains": {"enum": ["object", "array"]} + } + ] + } + } + } + } + }, + "then": { + "required": ["maxItems"] + } + }, + "pattern": { + "description": "prevent slow pattern matching of large strings", + "required": ["maxLength"] + }, + "format": { + "description": "prevent slow format validation of large strings", + "required": ["maxLength"] + } + }, + "properties": { + "additionalItems": {"$ref": "#"}, + "additionalProperties": {"$ref": "#"}, + "dependencies": { + "additionalProperties": { + "anyOf": [{"type": "array"}, {"$ref": "#"}] + } + }, + "items": { + "anyOf": [{"$ref": "#"}, {"$ref": "#/definitions/schemaArray"}] + }, + "definitions": { + "additionalProperties": {"$ref": "#"} + }, + "patternProperties": { + "additionalProperties": {"$ref": "#"} + }, + "properties": { + "additionalProperties": {"$ref": "#"} + }, + "if": {"$ref": "#"}, + "then": {"$ref": "#"}, + "else": {"$ref": "#"}, + "allOf": {"$ref": "#/definitions/schemaArray"}, + "anyOf": {"$ref": "#/definitions/schemaArray"}, + "oneOf": {"$ref": "#/definitions/schemaArray"}, + "not": {"$ref": "#"}, + "contains": {"$ref": "#"}, + "propertyNames": {"$ref": "#"} + } +} diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/package.json b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/package.json new file mode 100644 index 00000000000000..977045fa8c2dbd --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/package.json @@ -0,0 +1,121 @@ +{ + "author": { + "name": "Evgeny Poberezkin" + }, + "bugs": { + "url": "https://github.com/ajv-validator/ajv/issues" + }, + "bundleDependencies": false, + "collective": { + "type": "opencollective", + "url": "https://opencollective.com/ajv" + }, + "dependencies": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + }, + "deprecated": false, + "description": "Another JSON Schema Validator", + "devDependencies": { + "@ajv-validator/config": "^0.3.0", + "@types/chai": "^4.2.12", + "@types/mocha": "^8.0.3", + "@types/node": "^14.0.27", + "@types/require-from-string": "^1.2.0", + "@typescript-eslint/eslint-plugin": "^3.8.0", + "@typescript-eslint/parser": "^3.8.0", + "ajv-formats": "^1.5.0", + "browserify": "^17.0.0", + "chai": "^4.0.1", + "cross-env": "^7.0.2", + "eslint": "^7.8.1", + "eslint-config-prettier": "^7.0.0", + "glob": "^7.0.0", + "husky": "^4.2.5", + "if-node-version": "^1.0.0", + "js-beautify": "^1.7.3", + "json-schema-test": "^2.0.0", + "karma": "^5.0.0", + "karma-chrome-launcher": "^3.0.0", + "karma-mocha": "^2.0.0", + "lint-staged": "^10.2.11", + "mocha": "^8.0.1", + "nyc": "^15.0.0", + "prettier": "^2.0.5", + "terser": "^5.2.1", + "ts-node": "^9.0.0", + "tsify": "^5.0.2", + "typescript": "^4.0.0" + }, + "files": [ + "lib/", + "docs/", + "dist/", + "scripts/", + ".tonic_example.js" + ], + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + }, + "homepage": "https://github.com/ajv-validator/ajv", + "husky": { + "hooks": { + "pre-commit": "lint-staged && npm test" + } + }, + "keywords": [ + "JSON", + "schema", + "validator", + "validation", + "jsonschema", + "json-schema", + "json-schema-validator", + "json-schema-validation" + ], + "license": "MIT", + "lint-staged": { + "*.{md,json,yaml,js,ts}": "prettier --write" + }, + "main": "dist/ajv.js", + "name": "ajv", + "nyc": { + "exclude": [ + "**/spec/**", + "node_modules" + ], + "reporter": [ + "lcov", + "text-summary" + ] + }, + "prettier": "@ajv-validator/config/prettierrc.json", + "repository": { + "type": "git", + "url": "git+https://github.com/ajv-validator/ajv.git" + }, + "scripts": { + "build": "rm -rf dist && tsc && cp -r lib/refs dist && rm dist/refs/json-schema-2019-09/index.ts", + "bundle": "rm -rf bundle && node ./scripts/bundle.js ajv ajv7 ajv7 && node ./scripts/bundle.js 2019 ajv2019 ajv2019", + "eslint": "eslint \"lib/**/*.ts\" \"spec/**/*.*s\" scripts --ignore-pattern spec/JSON-Schema-Test-Suite", + "json-tests": "rm -rf spec/_json/*.js && node scripts/jsontests", + "prepublish": "npm run build", + "prettier:check": "prettier --list-different \"./**/*.{md,json,yaml,js,ts}\"", + "prettier:write": "prettier --write \"./**/*.{md,json,yaml,js,ts}\"", + "test": "npm link && npm link ajv && npm run json-tests && npm run eslint && npm run test-cov", + "test-all": "npm run test-cov && if-node-version 12 npm run test-browser", + "test-browser": "rm -rf .browser && npm run bundle && scripts/prepare-tests && karma start", + "test-ci": "AJV_FULL_TEST=true npm test", + "test-codegen": "nyc cross-env TS_NODE_PROJECT=spec/tsconfig.json mocha -r ts-node/register 'spec/codegen.spec.ts' -R spec", + "test-cov": "nyc npm run test-spec", + "test-debug": "npm run test-spec -- --inspect-brk", + "test-karma": "karma start", + "test-spec": "cross-env TS_NODE_PROJECT=spec/tsconfig.json mocha -r ts-node/register \"spec/**/*.spec.{ts,js}\" -R dot" + }, + "tonicExampleFilename": ".tonic_example.js", + "types": "dist/ajv.d.ts", + "version": "7.0.2" +} \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/scripts/bundle.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/scripts/bundle.js new file mode 100644 index 00000000000000..62560f24a0bb3b --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/scripts/bundle.js @@ -0,0 +1,48 @@ +"use strict" + +const fs = require("fs") +const path = require("path") +const browserify = require("browserify") +const {minify} = require("terser") + +const [sourceFile, outFile, globalName] = process.argv.slice(2) + +const json = require(path.join(__dirname, "..", "package.json")) +const bundleDir = path.join(__dirname, "..", "bundle") +if (!fs.existsSync(bundleDir)) fs.mkdirSync(bundleDir) + +browserify({standalone: globalName}) + .require(path.join(__dirname, "../dist", sourceFile), {expose: sourceFile}) + .bundle(saveAndMinify) + +async function saveAndMinify(err, buf) { + if (err) { + console.error("browserify error:", err) + process.exit(1) + } + + const bundlePath = path.join(bundleDir, outFile) + const opts = { + ecma: 2018, + warnings: true, + compress: { + pure_getters: true, + keep_infinity: true, + unsafe_methods: true, + }, + format: { + preamble: `/* ${json.name} ${json.version} (${globalName}): ${json.description} */`, + }, + sourceMap: { + filename: outFile + ".min.js", + url: outFile + ".min.js.map", + }, + } + + const result = await minify(buf.toString(), opts) + + fs.writeFileSync(bundlePath + ".bundle.js", buf) + fs.writeFileSync(bundlePath + ".min.js", result.code) + fs.writeFileSync(bundlePath + ".min.js.map", result.map) + if (result.warnings) result.warnings.forEach((msg) => console.warn("terser.minify warning:", msg)) +} diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/scripts/jsontests.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/scripts/jsontests.js new file mode 100644 index 00000000000000..88423d81bd6d34 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/scripts/jsontests.js @@ -0,0 +1,31 @@ +"use strict" + +const testSuitePaths = { + draft6: "spec/JSON-Schema-Test-Suite/tests/draft6/", + draft7: "spec/JSON-Schema-Test-Suite/tests/draft7/", + draft2019: "spec/JSON-Schema-Test-Suite/tests/draft2019-09/", + tests: "spec/tests/", + security: "spec/security/", + extras: "spec/extras/", + async: "spec/async/", +} + +const glob = require("glob") +const fs = require("fs") + +for (const suite in testSuitePaths) { + const p = testSuitePaths[suite] + const files = glob.sync(`${p}{**/,}*.json`) + if (files.length === 0) { + console.error(`Missing folder ${p}\nTry: git submodule update --init\n`) + process.exit(1) + } + const code = files + .map((f) => { + const name = f.replace(p, "").replace(/\.json$/, "") + const testPath = f.replace(/^spec/, "..") + return `\n {name: "${name}", test: require("${testPath}")},` + }) + .reduce((list, f) => list + f) + fs.writeFileSync(`./spec/_json/${suite}.js`, `module.exports = [${code}\n]\n`) +} diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/scripts/prepare-tests b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/scripts/prepare-tests new file mode 100755 index 00000000000000..1b0789632dcc23 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/scripts/prepare-tests @@ -0,0 +1,12 @@ +#!/usr/bin/env sh + +set -e + +mkdir -p .browser + +echo +echo Preparing browser tests: + +find spec -type f -name '*.spec.*s' | \ +xargs -I {} sh -c \ +'export f="{}"; echo $f; ./node_modules/.bin/browserify $f -p [ tsify -p ./spec/tsconfig.json ] -x ajv -u buffer -o $(echo $f | sed -e "s/spec/.browser/" | sed -e "s/.spec.ts/.spec.js/");' diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/scripts/publish-bundles b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/scripts/publish-bundles new file mode 100755 index 00000000000000..d91d01c034a813 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/scripts/publish-bundles @@ -0,0 +1,37 @@ +#!/usr/bin/env bash + +set -e + +if [[ $GITHUB_REF == refs/tags/v* ]]; then + npm run bundle + + echo "About to publish $GITHUB_REF to ajv-dist..." + + git config --global user.name "$GIT_USER_NAME" + git config --global user.email "$GIT_USER_EMAIL" + + git clone https://${GH_TOKEN_PUBLIC}@github.com/ajv-validator/ajv-dist.git ../ajv-dist + + rm -rf ../ajv-dist/dist + mkdir ../ajv-dist/dist + cp ./bundle/*.* ../ajv-dist/dist + cd ../ajv-dist + + VERSION=${GITHUB_REF#refs/tags/v} + + sed -E "s/\"version\": \"([^\"]*)\"/\"version\": \"$VERSION\"/" package.json > new_package.json + mv new_package.json package.json + + if [[ `git status --porcelain` ]]; then + echo "Changes detected. Updating master branch..." + git add -A + git commit -m "$VERSION: updated by ajv workflow https://github.com/ajv-validator/ajv/actions/runs/$GITHUB_RUN_ID" + git push --quiet origin master > /dev/null 2>&1 + fi + + echo "Publishing tag..." + git tag "v$VERSION" + git push --tags > /dev/null 2>&1 + + echo "Done" +fi diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/scripts/publish-gh-pages b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/scripts/publish-gh-pages new file mode 100755 index 00000000000000..34e488a948aa94 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/scripts/publish-gh-pages @@ -0,0 +1,31 @@ +#!/usr/bin/env bash + +set -ex + +echo "About to publish $GITHUB_REF to gh-pages..." + +rm -rf ../gh-pages + +git config --global user.name "$GIT_USER_NAME" +git config --global user.email "$GIT_USER_EMAIL" +git clone -b gh-pages --single-branch https://${GH_TOKEN_PUBLIC}@github.com/ajv-validator/ajv.git ../gh-pages +SOURCE=../gh-pages/_source +mkdir -p $SOURCE +cp *.md $SOURCE +cp -R docs $SOURCE +cp LICENSE $SOURCE +cd ../gh-pages +node ./generate + +# remove logo from README +sed -E "s/]+ajv_logo[^>]+>//" index.md > new-index.md +mv new-index.md index.md + +if [[ `git status --porcelain` ]]; then + echo "Changes detected. Updating gh-pages branch..." + git add -A + git commit -m "updated by ajv workflow https://github.com/ajv-validator/ajv/actions/runs/$GITHUB_RUN_ID" + git push --quiet origin gh-pages > /dev/null 2>&1 +fi + +echo "Done" diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/json-schema-traverse/LICENSE b/tools/node_modules/eslint/node_modules/table/node_modules/json-schema-traverse/LICENSE new file mode 100644 index 00000000000000..7f1543566f6abb --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/json-schema-traverse/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017 Evgeny Poberezkin + +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/table/node_modules/json-schema-traverse/README.md b/tools/node_modules/eslint/node_modules/table/node_modules/json-schema-traverse/README.md new file mode 100644 index 00000000000000..f3e60073a15c18 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/json-schema-traverse/README.md @@ -0,0 +1,95 @@ +# json-schema-traverse +Traverse JSON Schema passing each schema object to callback + +[![build](https://github.com/epoberezkin/json-schema-traverse/workflows/build/badge.svg)](https://github.com/epoberezkin/json-schema-traverse/actions?query=workflow%3Abuild) +[![npm](https://img.shields.io/npm/v/json-schema-traverse)](https://www.npmjs.com/package/json-schema-traverse) +[![coverage](https://coveralls.io/repos/github/epoberezkin/json-schema-traverse/badge.svg?branch=master)](https://coveralls.io/github/epoberezkin/json-schema-traverse?branch=master) + + +## Install + +``` +npm install json-schema-traverse +``` + + +## Usage + +```javascript +const traverse = require('json-schema-traverse'); +const schema = { + properties: { + foo: {type: 'string'}, + bar: {type: 'integer'} + } +}; + +traverse(schema, {cb}); +// cb is called 3 times with: +// 1. root schema +// 2. {type: 'string'} +// 3. {type: 'integer'} + +// Or: + +traverse(schema, {cb: {pre, post}}); +// pre is called 3 times with: +// 1. root schema +// 2. {type: 'string'} +// 3. {type: 'integer'} +// +// post is called 3 times with: +// 1. {type: 'string'} +// 2. {type: 'integer'} +// 3. root schema + +``` + +Callback function `cb` is called for each schema object (not including draft-06 boolean schemas), including the root schema, in pre-order traversal. Schema references ($ref) are not resolved, they are passed as is. Alternatively, you can pass a `{pre, post}` object as `cb`, and then `pre` will be called before traversing child elements, and `post` will be called after all child elements have been traversed. + +Callback is passed these parameters: + +- _schema_: the current schema object +- _JSON pointer_: from the root schema to the current schema object +- _root schema_: the schema passed to `traverse` object +- _parent JSON pointer_: from the root schema to the parent schema object (see below) +- _parent keyword_: the keyword inside which this schema appears (e.g. `properties`, `anyOf`, etc.) +- _parent schema_: not necessarily parent object/array; in the example above the parent schema for `{type: 'string'}` is the root schema +- _index/property_: index or property name in the array/object containing multiple schemas; in the example above for `{type: 'string'}` the property name is `'foo'` + + +## Traverse objects in all unknown keywords + +```javascript +const traverse = require('json-schema-traverse'); +const schema = { + mySchema: { + minimum: 1, + maximum: 2 + } +}; + +traverse(schema, {allKeys: true, cb}); +// cb is called 2 times with: +// 1. root schema +// 2. mySchema +``` + +Without option `allKeys: true` callback will be called only with root schema. + + +## Enterprise support + +json-schema-traverse package is a part of [Tidelift enterprise subscription](https://tidelift.com/subscription/pkg/npm-json-schema-traverse?utm_source=npm-json-schema-traverse&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) - it provides a centralised commercial support to open-source software users, in addition to the support provided by software maintainers. + + +## Security contact + +To report a security vulnerability, please use the +[Tidelift security contact](https://tidelift.com/security). +Tidelift will coordinate the fix and disclosure. Please do NOT report security vulnerability via GitHub issues. + + +## License + +[MIT](https://github.com/epoberezkin/json-schema-traverse/blob/master/LICENSE) diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/json-schema-traverse/index.js b/tools/node_modules/eslint/node_modules/table/node_modules/json-schema-traverse/index.js new file mode 100644 index 00000000000000..e521bfa858a7ee --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/json-schema-traverse/index.js @@ -0,0 +1,93 @@ +'use strict'; + +var traverse = module.exports = function (schema, opts, cb) { + // Legacy support for v0.3.1 and earlier. + if (typeof opts == 'function') { + cb = opts; + opts = {}; + } + + cb = opts.cb || cb; + var pre = (typeof cb == 'function') ? cb : cb.pre || function() {}; + var post = cb.post || function() {}; + + _traverse(opts, pre, post, schema, '', schema); +}; + + +traverse.keywords = { + additionalItems: true, + items: true, + contains: true, + additionalProperties: true, + propertyNames: true, + not: true, + if: true, + then: true, + else: true +}; + +traverse.arrayKeywords = { + items: true, + allOf: true, + anyOf: true, + oneOf: true +}; + +traverse.propsKeywords = { + $defs: true, + definitions: true, + properties: true, + patternProperties: true, + dependencies: true +}; + +traverse.skipKeywords = { + default: true, + enum: true, + const: true, + required: true, + maximum: true, + minimum: true, + exclusiveMaximum: true, + exclusiveMinimum: true, + multipleOf: true, + maxLength: true, + minLength: true, + pattern: true, + format: true, + maxItems: true, + minItems: true, + uniqueItems: true, + maxProperties: true, + minProperties: true +}; + + +function _traverse(opts, pre, post, schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex) { + if (schema && typeof schema == 'object' && !Array.isArray(schema)) { + pre(schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex); + for (var key in schema) { + var sch = schema[key]; + if (Array.isArray(sch)) { + if (key in traverse.arrayKeywords) { + for (var i=0; i=10.0.0" @@ -82,9 +83,9 @@ "scripts": { "build": "rm -fr ./dist && NODE_ENV=production babel ./src --out-dir ./dist --copy-files --source-maps && npm run create-validators && flow-copy-source src dist", "create-readme": "gitdown ./.README/README.md --output-file ./README.md", - "create-validators": "ajv compile --all-errors --inline-refs=false -s src/schemas/config -c ajv-keywords/keywords/typeof -o dist/validateConfig.js && ajv compile --all-errors --inline-refs=false -s src/schemas/streamConfig -c ajv-keywords/keywords/typeof -o dist/validateStreamConfig.js", + "create-validators": "ajv compile --all-errors --inline-refs=false -s src/schemas/config -s src/schemas/streamConfig -r src/schemas/shared -c ajv-keywords/dist/keywords/typeof -o | js-beautify > dist/validators.js", "lint": "npm run build && eslint ./src ./test && flow", "test": "mocha --require @babel/register" }, - "version": "6.0.4" + "version": "6.0.6" } \ No newline at end of file diff --git a/tools/node_modules/eslint/package.json b/tools/node_modules/eslint/package.json index 707c2d7e12fa64..80e0105bdcffaf 100644 --- a/tools/node_modules/eslint/package.json +++ b/tools/node_modules/eslint/package.json @@ -154,5 +154,5 @@ "test:cli": "mocha", "webpack": "node Makefile.js webpack" }, - "version": "7.16.0" + "version": "7.17.0" } \ No newline at end of file