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/.eslintrc.js b/.eslintrc.js index af1249eae6436e..010c02be11bcf4 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -18,6 +18,7 @@ const hacks = [ 'eslint-plugin-markdown', '@babel/eslint-parser', '@babel/plugin-syntax-class-properties', + '@babel/plugin-syntax-top-level-await', ]; Module._findPath = (request, paths, isMain) => { const r = ModuleFindPath(request, paths, isMain); @@ -41,7 +42,10 @@ module.exports = { parser: '@babel/eslint-parser', parserOptions: { babelOptions: { - plugins: [Module._findPath('@babel/plugin-syntax-class-properties')], + plugins: [ + Module._findPath('@babel/plugin-syntax-class-properties'), + Module._findPath('@babel/plugin-syntax-top-level-await'), + ], }, requireConfigFile: false, sourceType: 'script', @@ -53,6 +57,7 @@ module.exports = { 'doc/api/module.md', 'doc/api/modules.md', 'doc/api/packages.md', + 'doc/api/wasi.md', 'test/es-module/test-esm-type-flag.js', 'test/es-module/test-esm-type-flag-alias.js', '*.mjs', diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 66efca5cd000e7..56632fda4c67eb 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,21 +1,15 @@ - -##### Checklist - +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. -- [ ] `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) - - unpublish policies

Unpublishing a single version of a package

npm unpublish [<@scope>/]<pkg>@<version>
 
@@ -152,16 +153,21 @@

Unpublishing an entire package

npm unpublish [<@scope>/]<pkg> --force
 

Warning

-

Consider using the deprecate command instead, if your intent is to encourage users to upgrade, or if you no longer want to maintain a package.

+

Consider using the deprecate command instead, +if your intent is to encourage users to upgrade, or if you no longer +want to maintain a package.

Description

-

This removes a package version from the registry, deleting its -entry and removing the tarball.

-

If no version is specified, or if all versions are removed then -the root package entry is removed from the registry entirely.

-

Even if a package version is unpublished, that specific name and -version combination can never be reused. In order to publish the -package again, a new version number must be used. If you unpublish the entire package, you may not publish any new versions of that package until 24 hours have passed.

-

To learn more about how unpublish is treated on the npm registry, see our unpublish policies.

+

This removes a package version from the registry, deleting its entry and +removing the tarball.

+

The npm registry will return an error if you are not logged +in.

+

If you do not specify a version or if you remove all of a package’s +versions then the registry will remove the root package entry entirely.

+

Even if you unpublish a package version, that specific name and version +combination can never be reused. In order to publish the package again, +you must use a new version number. If you unpublish the entire package, +you may not publish any new versions of that package until 24 hours have +passed.

See Also

diff --git a/deps/npm/docs/output/commands/npm.html b/deps/npm/docs/output/commands/npm.html index 6e9e2a618f154e..03d4c92821011c 100644 --- a/deps/npm/docs/output/commands/npm.html +++ b/deps/npm/docs/output/commands/npm.html @@ -141,14 +141,14 @@

npm

Table of contents

-
+

Synopsis

npm <command> [args]
 

Version

-

7.3.0

+

7.4.3

Description

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

Configuration

Contributions

Patches welcome!

If you would like to contribute, but don’t know what to work on, read -the contributing guidelines and check the issues list.

- +the contributing guidelines +and check the issues list.

Bugs

-

When you find issues, please report them:

- +

When you find issues, please report them: https://github.com/npm/cli/issues

Be sure to follow the template and bug reporting guidelines.

Feature Requests

Discuss new feature ideas on our discussion forum:

@@ -269,11 +260,6 @@

Feature Requests

-

Author

-

Isaac Z. Schlueter :: -isaacs :: -@izs :: -i@izs.me

See Also

If you don’t have a clear idea of what you want to do, it is strongly recommended that you do not use this option!

+

foreground-scripts

+ +

Run all build scripts (ie, preinstall, install, and postinstall) +scripts for installed packages in the foreground process, sharing standard +input, output, and error with the main npm process.

+

Note that this will generally make installs run slower, and be much +noisier, but can be useful for debugging.

format-package-lock

+ diff --git a/lib/_http_agent.js b/lib/_http_agent.js index 6f248fd8fec0d7..ba165b42b1dc3a 100644 --- a/lib/_http_agent.js +++ b/lib/_http_agent.js @@ -106,7 +106,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; diff --git a/lib/_http_client.js b/lib/_http_client.js index b81ffa1cefc573..cdf728aa65846d 100644 --- a/lib/_http_client.js +++ b/lib/_http_client.js @@ -44,6 +44,7 @@ const { const net = require('net'); const url = require('url'); const assert = require('internal/assert'); +const { once } = require('internal/util'); const { _checkIsHttpToken: checkIsHttpToken, debug, @@ -57,7 +58,7 @@ const { OutgoingMessage } = require('_http_outgoing'); const Agent = require('_http_agent'); const { Buffer } = require('buffer'); const { defaultTriggerAsyncIdScope } = require('internal/async_hooks'); -const { URL, urlToOptions, searchParamsSymbol } = require('internal/url'); +const { URL, urlToHttpOptions, searchParamsSymbol } = require('internal/url'); const { kOutHeaders, kNeedDrain } = require('internal/http'); const { connResetException, codes } = require('internal/errors'); const { @@ -76,7 +77,7 @@ const { DTRACE_HTTP_CLIENT_RESPONSE } = require('internal/dtrace'); -const { addAbortSignal } = require('stream'); +const { addAbortSignal, finished } = require('stream'); const INVALID_PATH_REGEX = /[^\u0021-\u00ff]/; const kError = Symbol('kError'); @@ -104,7 +105,7 @@ function ClientRequest(input, options, cb) { if (typeof input === 'string') { const urlStr = input; try { - input = urlToOptions(new URL(urlStr)); + input = urlToHttpOptions(new URL(urlStr)); } catch (err) { input = url.parse(urlStr); if (!input.hostname) { @@ -121,7 +122,7 @@ function ClientRequest(input, options, cb) { } else if (input && input[searchParamsSymbol] && input[searchParamsSymbol][searchParamsSymbol]) { // url.URL instance - input = urlToOptions(input); + input = urlToHttpOptions(input); } else { cb = options; options = input; @@ -240,8 +241,6 @@ function ClientRequest(input, options, cb) { this.host = host; this.protocol = protocol; - let called = false; - if (this.agent) { // If there is an agent we should default to Connection:keep-alive, // but only if the Agent will actually reuse the connection! @@ -305,18 +304,6 @@ function ClientRequest(input, options, cb) { options.headers); } - const oncreate = (err, socket) => { - if (called) - return; - called = true; - if (err) { - process.nextTick(() => this.emit('error', err)); - return; - } - this.onSocket(socket); - this._deferToConnect(null, null, () => this._flush()); - }; - // initiate connection if (this.agent) { this.agent.addRequest(this, options); @@ -325,20 +312,27 @@ function ClientRequest(input, options, cb) { this._last = true; this.shouldKeepAlive = false; if (typeof options.createConnection === 'function') { - const newSocket = options.createConnection(options, oncreate); - if (newSocket && !called) { - called = true; - this.onSocket(newSocket); - } else { - return; + const oncreate = once((err, socket) => { + if (err) { + process.nextTick(() => this.emit('error', err)); + } else { + this.onSocket(socket); + } + }); + + try { + const newSocket = options.createConnection(options, oncreate); + if (newSocket) { + oncreate(null, newSocket); + } + } catch (err) { + oncreate(err); } } else { debug('CLIENT use net.createConnection', options); this.onSocket(net.createConnection(options)); } } - - this._deferToConnect(null, null, () => this._flush()); } ObjectSetPrototypeOf(ClientRequest.prototype, OutgoingMessage.prototype); ObjectSetPrototypeOf(ClientRequest, OutgoingMessage); @@ -376,38 +370,12 @@ ClientRequest.prototype.destroy = function destroy(err) { this.res._dump(); } - // In the event that we don't have a socket, we will pop out of - // the request queue through handling in onSocket. - if (this.socket) { - _destroy(this, this.socket, err); - } else if (err) { - this[kError] = err; - } + this[kError] = err; + this.socket?.destroy(err); return this; }; -function _destroy(req, socket, err) { - // TODO (ronag): Check if socket was used at all (e.g. headersSent) and - // re-use it in that case. `req.socket` just checks whether the socket was - // assigned to the request and *might* have been used. - if (socket && (!req.agent || req.socket)) { - socket.destroy(err); - } else { - if (socket) { - socket.emit('free'); - } - if (!req.aborted && !err) { - err = connResetException('socket hang up'); - } - if (err) { - req.emit('error', err); - } - req._closed = true; - req.emit('close'); - } -} - function emitAbortNT(req) { req.emit('abort'); } @@ -819,13 +787,33 @@ ClientRequest.prototype.onSocket = function onSocket(socket, err) { }; function onSocketNT(req, socket, err) { - if (req.destroyed) { - _destroy(req, socket, req[kError]); - } else if (err) { + if (req.destroyed || err) { req.destroyed = true; - _destroy(req, null, err); + + function _destroy(req, err) { + if (!req.aborted && !err) { + err = connResetException('socket hang up'); + } + if (err) { + req.emit('error', err); + } + req._closed = true; + req.emit('close'); + } + + if (!err && req.agent) { + socket?.emit('free'); + } else if (socket) { + finished(socket.destroy(err || req[kError]), (er) => { + _destroy(req, er || err); + }); + return; + } + + _destroy(req, err || req[kError]); } else { tickOnSocket(req, socket); + req._flush(); } } diff --git a/lib/_http_incoming.js b/lib/_http_incoming.js index 44ecee4799f102..6a870a33697a1f 100644 --- a/lib/_http_incoming.js +++ b/lib/_http_incoming.js @@ -174,12 +174,8 @@ IncomingMessage.prototype._destroy = function _destroy(err, cb) { 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) { + // If aborted destroy socket. + if (this.socket && this.aborted) { this.socket.destroy(err); const cleanup = finished(this.socket, (e) => { cleanup(); diff --git a/lib/_http_outgoing.js b/lib/_http_outgoing.js index 8b2959986af8e0..872fc04edbadc8 100644 --- a/lib/_http_outgoing.js +++ b/lib/_http_outgoing.js @@ -457,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) { @@ -818,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, @@ -829,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') { @@ -840,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(); } diff --git a/lib/_http_server.js b/lib/_http_server.js index 9225ff06117859..a0b1ea7720066d 100644 --- a/lib/_http_server.js +++ b/lib/_http_server.js @@ -181,6 +181,7 @@ function ServerResponse(req) { if (req.method === 'HEAD') this._hasBody = false; + this.req = req; this.sendDate = true; this._sent100 = false; this._expect_continue = false; @@ -581,11 +582,7 @@ function socketOnTimeout() { function socketOnClose(socket, state) { debug('server socket close'); - // Mark this parser as reusable - if (socket.parser) { - freeParser(socket.parser, null, socket); - } - + freeParser(socket.parser, null, socket); abortIncoming(state.incoming); } @@ -602,18 +599,15 @@ function socketOnEnd(server, socket, parser, state) { if (ret instanceof Error) { debug('parse error'); + // socketOnError has additional logic and will call socket.destroy(err). FunctionPrototypeCall(socketOnError, socket, ret); - return; - } - - if (!server.httpAllowHalfOpen) { - abortIncoming(state.incoming); - if (socket.writable) socket.end(); + } else if (!server.httpAllowHalfOpen) { + socket.end(); } else if (state.outgoing.length) { state.outgoing[state.outgoing.length - 1]._last = true; } else if (socket._httpMessage) { socket._httpMessage._last = true; - } else if (socket.writable) { + } else { socket.end(); } } @@ -628,6 +622,7 @@ function socketOnData(server, socket, parser, state, d) { function onRequestTimeout(socket) { socket[kRequestTimeout] = undefined; + // socketOnError has additional logic and will call socket.destroy(err). ReflectApply(socketOnError, socket, [new ERR_HTTP_REQUEST_TIMEOUT()]); } 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 1447253bf73224..b5fbe4d36b2578 100644 --- a/lib/_tls_wrap.js +++ b/lib/_tls_wrap.js @@ -1458,7 +1458,8 @@ Server.prototype[EE.captureRejectionSymbol] = function( function SNICallback(servername, callback) { const contexts = this.server._contexts; - for (const elem of contexts) { + for (let i = contexts.length - 1; i >= 0; --i) { + const elem = contexts[i]; if (RegExpPrototypeTest(elem[0], servername)) { callback(null, elem[1]); return; diff --git a/lib/async_hooks.js b/lib/async_hooks.js index 90b48ebe4b2754..c3bbdb1b795e87 100644 --- a/lib/async_hooks.js +++ b/lib/async_hooks.js @@ -220,10 +220,15 @@ class AsyncResource { return this[trigger_async_id_symbol]; } - bind(fn) { + bind(fn, thisArg = this) { if (typeof fn !== 'function') throw new ERR_INVALID_ARG_TYPE('fn', 'Function', fn); - const ret = FunctionPrototypeBind(this.runInAsyncScope, this, fn); + const ret = + FunctionPrototypeBind( + this.runInAsyncScope, + this, + fn, + thisArg); ObjectDefineProperties(ret, { 'length': { configurable: true, @@ -241,9 +246,9 @@ class AsyncResource { return ret; } - static bind(fn, type) { + static bind(fn, type, thisArg) { type = type || fn.name; - return (new AsyncResource(type || 'bound-anonymous-fn')).bind(fn); + return (new AsyncResource(type || 'bound-anonymous-fn')).bind(fn, thisArg); } } diff --git a/lib/buffer.js b/lib/buffer.js index d3034a46c60b29..591ddd632383fb 100644 --- a/lib/buffer.js +++ b/lib/buffer.js @@ -100,6 +100,7 @@ const { hideStackFrames } = require('internal/errors'); const { + validateArray, validateBuffer, validateInteger, validateString @@ -115,6 +116,10 @@ const { createUnsafeBuffer } = require('internal/buffer'); +const { + Blob, +} = require('internal/blob'); + FastBuffer.prototype.constructor = Buffer; Buffer.prototype = FastBuffer.prototype; addBufferPrototypeMethods(Buffer.prototype); @@ -530,9 +535,7 @@ Buffer.isEncoding = function isEncoding(encoding) { Buffer[kIsEncodingSymbol] = Buffer.isEncoding; Buffer.concat = function concat(list, length) { - if (!ArrayIsArray(list)) { - throw new ERR_INVALID_ARG_TYPE('list', 'Array', list); - } + validateArray(list, 'list'); if (list.length === 0) return new FastBuffer(); @@ -646,6 +649,20 @@ const encodingOps = { encodingsMap.base64, dir) }, + base64url: { + encoding: 'base64url', + encodingVal: encodingsMap.base64url, + byteLength: (string) => base64ByteLength(string, string.length), + write: (buf, string, offset, len) => + buf.base64urlWrite(string, offset, len), + slice: (buf, start, end) => buf.base64urlSlice(start, end), + indexOf: (buf, val, byteOffset, dir) => + indexOfBuffer(buf, + fromStringFast(val, encodingOps.base64url), + byteOffset, + encodingsMap.base64url, + dir) + }, hex: { encoding: 'hex', encodingVal: encodingsMap.hex, @@ -702,6 +719,11 @@ function getEncodingOps(encoding) { if (encoding === 'hex' || StringPrototypeToLowerCase(encoding) === 'hex') return encodingOps.hex; break; + case 9: + if (encoding === 'base64url' || + StringPrototypeToLowerCase(encoding) === 'base64url') + return encodingOps.base64url; + break; } } @@ -1191,6 +1213,7 @@ if (internalBinding('config').hasIntl) { } module.exports = { + Blob, Buffer, SlowBuffer, transcode, diff --git a/lib/child_process.js b/lib/child_process.js index b67ea1c7f05eca..daa1d44e8974df 100644 --- a/lib/child_process.js +++ b/lib/child_process.js @@ -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,14 +382,11 @@ function execFile(file /* , args, options, callback */) { } if (options.signal) { if (options.signal.aborted) { - process.nextTick(() => kill()); + process.nextTick(abortHandler); } else { const childController = new AbortController(); - options.signal.addEventListener('abort', () => { - if (!ex) - ex = new AbortError(); - kill(); - }, { signal: childController.signal }); + options.signal.addEventListener('abort', abortHandler, + { signal: childController.signal }); child.once('close', () => childController.abort()); } } diff --git a/lib/cluster.js b/lib/cluster.js index 848b2247a87b06..7ca8b532ee243f 100644 --- a/lib/cluster.js +++ b/lib/cluster.js @@ -21,5 +21,5 @@ 'use strict'; -const childOrMaster = 'NODE_UNIQUE_ID' in process.env ? 'child' : 'master'; -module.exports = require(`internal/cluster/${childOrMaster}`); +const childOrPrimary = 'NODE_UNIQUE_ID' in process.env ? 'child' : 'primary'; +module.exports = require(`internal/cluster/${childOrPrimary}`); 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/dgram.js b/lib/dgram.js index 79501847784d1f..ea1aba522fc938 100644 --- a/lib/dgram.js +++ b/lib/dgram.js @@ -157,13 +157,13 @@ function replaceHandle(self, newHandle) { const state = self[kStateSymbol]; const oldHandle = state.handle; - // Set up the handle that we got from master. + // Set up the handle that we got from primary. newHandle.lookup = oldHandle.lookup; newHandle.bind = oldHandle.bind; newHandle.send = oldHandle.send; newHandle[owner_symbol] = self; - // Replace the existing handle by the handle we got from master. + // Replace the existing handle by the handle we got from primary. oldHandle.close(); state.handle = newHandle; // Check if the udp handle was connected and set the state accordingly @@ -183,7 +183,7 @@ function bufferSize(self, size, buffer) { return ret; } -// Query master process to get the server handle and utilize it. +// Query primary process to get the server handle and utilize it. function bindServerHandle(self, options, errCb) { if (!cluster) cluster = require('cluster'); 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 942e5e01eee044..75baac156aaf86 100644 --- a/lib/events.js +++ b/lib/events.js @@ -203,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); @@ -709,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) => { @@ -736,7 +736,7 @@ async function once(emitter, name, options = {}) { } function abortListener() { eventTargetAgnosticRemoveListener(emitter, name, resolver); - eventTargetAgnosticRemoveListener(emitter, 'error', resolver); + eventTargetAgnosticRemoveListener(emitter, 'error', errorListener); reject(lazyDOMException('The operation was aborted', 'AbortError')); } if (signal != null) { @@ -765,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); @@ -780,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'); } diff --git a/lib/fs.js b/lib/fs.js index 918762877e6f99..b873593e2307a4 100644 --- a/lib/fs.js +++ b/lib/fs.js @@ -37,7 +37,6 @@ const { BigIntPrototypeToString, MathMax, Number, - NumberIsSafeInteger, ObjectCreate, ObjectDefineProperties, ObjectDefineProperty, @@ -75,7 +74,8 @@ const { ERR_FS_FILE_TOO_LARGE, ERR_INVALID_ARG_VALUE, ERR_INVALID_ARG_TYPE, - ERR_FEATURE_UNAVAILABLE_ON_PLATFORM + ERR_FEATURE_UNAVAILABLE_ON_PLATFORM, + ERR_OUT_OF_RANGE, }, hideStackFrames, uvErrmapGet, @@ -181,7 +181,7 @@ function maybeCallback(cb) { function makeCallback(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 @@ -545,9 +545,23 @@ function read(fd, buffer, offset, length, position, callback) { validateOffsetLengthRead(offset, length, buffer.byteLength); - if (!NumberIsSafeInteger(position)) + if (position == null) position = -1; + if (typeof position === 'number') { + validateInteger(position, 'position'); + } else if (typeof position === 'bigint') { + if (!(position >= -(2n ** 63n) && position <= 2n ** 63n - 1n)) { + throw new ERR_OUT_OF_RANGE('position', + `>= ${-(2n ** 63n)} && <= ${2n ** 63n - 1n}`, + position); + } + } else { + throw new ERR_INVALID_ARG_TYPE('position', + ['integer', 'bigint'], + position); + } + function wrapper(err, bytesRead) { // Retain a reference to buffer so that it can't be GC'ed too soon. callback(err, bytesRead || 0, buffer); @@ -597,9 +611,23 @@ function readSync(fd, buffer, offset, length, position) { validateOffsetLengthRead(offset, length, buffer.byteLength); - if (!NumberIsSafeInteger(position)) + if (position == null) position = -1; + if (typeof position === 'number') { + validateInteger(position, 'position'); + } else if (typeof position === 'bigint') { + if (!(position >= -(2n ** 63n) && position <= 2n ** 63n - 1n)) { + throw new ERR_OUT_OF_RANGE('position', + `>= ${-(2n ** 63n)} && <= ${2n ** 63n - 1n}`, + position); + } + } else { + throw new ERR_INVALID_ARG_TYPE('position', + ['integer', 'bigint'], + position); + } + const ctx = {}; const result = binding.read(fd, buffer, offset, length, position, undefined, ctx); diff --git a/lib/https.js b/lib/https.js index a7fcf06a95f273..79ac6c6bd58707 100644 --- a/lib/https.js +++ b/lib/https.js @@ -48,7 +48,7 @@ const { ClientRequest } = require('_http_client'); let debug = require('internal/util/debuglog').debuglog('https', (fn) => { debug = fn; }); -const { URL, urlToOptions, searchParamsSymbol } = require('internal/url'); +const { URL, urlToHttpOptions, searchParamsSymbol } = require('internal/url'); const { IncomingMessage, ServerResponse } = require('http'); const { kIncomingMessage } = require('_http_common'); @@ -303,7 +303,7 @@ function request(...args) { if (typeof args[0] === 'string') { const urlStr = ArrayPrototypeShift(args); try { - options = urlToOptions(new URL(urlStr)); + options = urlToHttpOptions(new URL(urlStr)); } catch (err) { options = url.parse(urlStr); if (!options.hostname) { @@ -320,7 +320,7 @@ function request(...args) { } else if (args[0] && args[0][searchParamsSymbol] && args[0][searchParamsSymbol][searchParamsSymbol]) { // url.URL instance - options = urlToOptions(ArrayPrototypeShift(args)); + options = urlToHttpOptions(ArrayPrototypeShift(args)); } if (args[0] && typeof args[0] !== 'function') { diff --git a/lib/internal/blob.js b/lib/internal/blob.js new file mode 100644 index 00000000000000..e49b3710e0768a --- /dev/null +++ b/lib/internal/blob.js @@ -0,0 +1,238 @@ +'use strict'; + +const { + ArrayFrom, + ObjectSetPrototypeOf, + Promise, + PromiseResolve, + RegExpPrototypeTest, + StringPrototypeToLowerCase, + Symbol, + SymbolIterator, + Uint8Array, +} = primordials; + +const { + createBlob, + FixedSizeBlobCopyJob, +} = internalBinding('buffer'); + +const { + JSTransferable, + kClone, + kDeserialize, +} = require('internal/worker/js_transferable'); + +const { + isAnyArrayBuffer, + isArrayBufferView, +} = require('internal/util/types'); + +const { + customInspectSymbol: kInspect, + emitExperimentalWarning, +} = require('internal/util'); +const { inspect } = require('internal/util/inspect'); + +const { + AbortError, + codes: { + ERR_INVALID_ARG_TYPE, + ERR_BUFFER_TOO_LARGE, + ERR_OUT_OF_RANGE, + } +} = require('internal/errors'); + +const { + validateObject, + validateString, + validateUint32, + isUint32, +} = require('internal/validators'); + +const kHandle = Symbol('kHandle'); +const kType = Symbol('kType'); +const kLength = Symbol('kLength'); + +let Buffer; + +function deferred() { + let res, rej; + const promise = new Promise((resolve, reject) => { + res = resolve; + rej = reject; + }); + return { promise, resolve: res, reject: rej }; +} + +function lazyBuffer() { + if (Buffer === undefined) + Buffer = require('buffer').Buffer; + return Buffer; +} + +function isBlob(object) { + return object?.[kHandle] !== undefined; +} + +function getSource(source, encoding) { + if (isBlob(source)) + return [source.size, source[kHandle]]; + + if (typeof source === 'string') { + source = lazyBuffer().from(source, encoding); + } else if (isAnyArrayBuffer(source)) { + source = new Uint8Array(source); + } else if (!isArrayBufferView(source)) { + throw new ERR_INVALID_ARG_TYPE( + 'source', + [ + 'string', + 'ArrayBuffer', + 'SharedArrayBuffer', + 'Buffer', + 'TypedArray', + 'DataView' + ], + source); + } + + // We copy into a new Uint8Array because the underlying + // BackingStores are going to be detached and owned by + // the Blob. We also don't want to have to worry about + // byte offsets. + source = new Uint8Array(source); + return [source.byteLength, source]; +} + +class InternalBlob extends JSTransferable { + constructor(handle, length, type = '') { + super(); + this[kHandle] = handle; + this[kType] = type; + this[kLength] = length; + } +} + +class Blob extends JSTransferable { + constructor(sources = [], options) { + emitExperimentalWarning('buffer.Blob'); + if (sources === null || + typeof sources[SymbolIterator] !== 'function' || + typeof sources === 'string') { + throw new ERR_INVALID_ARG_TYPE('sources', 'Iterable', sources); + } + if (options !== undefined) + validateObject(options, 'options'); + const { + encoding = 'utf8', + type = '', + } = { ...options }; + + let length = 0; + const sources_ = ArrayFrom(sources, (source) => { + const { 0: len, 1: src } = getSource(source, encoding); + length += len; + return src; + }); + + // This is a MIME media type but we're not actively checking the syntax. + // But, to be fair, neither does Chrome. + validateString(type, 'options.type'); + + if (!isUint32(length)) + throw new ERR_BUFFER_TOO_LARGE(0xFFFFFFFF); + + super(); + this[kHandle] = createBlob(sources_, length); + this[kLength] = length; + this[kType] = RegExpPrototypeTest(/[^\u{0020}-\u{007E}]/u, type) ? + '' : StringPrototypeToLowerCase(type); + } + + [kInspect](depth, options) { + if (depth < 0) + return this; + + const opts = { + ...options, + depth: options.depth == null ? null : options.depth - 1 + }; + + return `Blob ${inspect({ + size: this.size, + type: this.type, + }, opts)}`; + } + + [kClone]() { + const handle = this[kHandle]; + const type = this[kType]; + const length = this[kLength]; + return { + data: { handle, type, length }, + deserializeInfo: 'internal/blob:InternalBlob' + }; + } + + [kDeserialize]({ handle, type, length }) { + this[kHandle] = handle; + this[kType] = type; + this[kLength] = length; + } + + get type() { return this[kType]; } + + get size() { return this[kLength]; } + + slice(start = 0, end = (this[kLength]), type = this[kType]) { + validateUint32(start, 'start'); + if (end < 0) end = this[kLength] + end; + validateUint32(end, 'end'); + validateString(type, 'type'); + if (end < start) + throw new ERR_OUT_OF_RANGE('end', 'greater than start', end); + if (end > this[kLength]) + throw new ERR_OUT_OF_RANGE('end', 'less than or equal to length', end); + return new InternalBlob( + this[kHandle].slice(start, end), + end - start, type); + } + + async arrayBuffer() { + const job = new FixedSizeBlobCopyJob(this[kHandle]); + + const ret = job.run(); + if (ret !== undefined) + return PromiseResolve(ret); + + const { + promise, + resolve, + reject + } = deferred(); + job.ondone = (err, ab) => { + if (err !== undefined) + return reject(new AbortError()); + resolve(ab); + }; + + return promise; + } + + async text() { + const dec = new TextDecoder(); + return dec.decode(await this.arrayBuffer()); + } +} + +InternalBlob.prototype.constructor = Blob; +ObjectSetPrototypeOf( + InternalBlob.prototype, + Blob.prototype); + +module.exports = { + Blob, + InternalBlob, + isBlob, +}; 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..2924e7f8cc17fa 100644 --- a/lib/internal/bootstrap/switches/does_own_process_state.js +++ b/lib/internal/bootstrap/switches/does_own_process_state.js @@ -24,13 +24,11 @@ if (credentials.implementsPosixCredentials) { const { parseFileMode, + validateArray, validateString } = require('internal/validators'); function wrapPosixCredentialSetters(credentials) { - const { - ArrayIsArray, - } = primordials; const { codes: { ERR_INVALID_ARG_TYPE, @@ -63,9 +61,7 @@ function wrapPosixCredentialSetters(credentials) { } function setgroups(groups) { - if (!ArrayIsArray(groups)) { - throw new ERR_INVALID_ARG_TYPE('groups', 'Array', groups); - } + validateArray(groups, 'groups'); for (let i = 0; i < groups.length; i++) { validateId(groups[i], `groups[${i}]`); } @@ -80,6 +76,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 3515626041bbad..b20b8c6ae76448 100644 --- a/lib/internal/buffer.js +++ b/lib/internal/buffer.js @@ -18,12 +18,14 @@ const { validateNumber } = require('internal/validators'); const { asciiSlice, base64Slice, + base64urlSlice, latin1Slice, hexSlice, ucs2Slice, utf8Slice, asciiWrite, base64Write, + base64urlWrite, latin1Write, hexWrite, ucs2Write, @@ -1027,12 +1029,14 @@ function addBufferPrototypeMethods(proto) { proto.asciiSlice = asciiSlice; proto.base64Slice = base64Slice; + proto.base64urlSlice = base64urlSlice; proto.latin1Slice = latin1Slice; proto.hexSlice = hexSlice; proto.ucs2Slice = ucs2Slice; proto.utf8Slice = utf8Slice; proto.asciiWrite = asciiWrite; proto.base64Write = base64Write; + proto.base64urlWrite = base64urlWrite; proto.latin1Write = latin1Write; proto.hexWrite = hexWrite; proto.ucs2Write = ucs2Write; diff --git a/lib/internal/child_process.js b/lib/internal/child_process.js index 8dd85d287fc950..605ffac79ef7b5 100644 --- a/lib/internal/child_process.js +++ b/lib/internal/child_process.js @@ -29,7 +29,11 @@ const { ERR_MISSING_ARGS } } = require('internal/errors'); -const { validateString, validateOneOf } = require('internal/validators'); +const { + validateArray, + validateOneOf, + validateString, +} = require('internal/validators'); const EventEmitter = require('events'); const net = require('net'); const dgram = require('dgram'); @@ -231,6 +235,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: @@ -376,12 +381,12 @@ ChildProcess.prototype.spawn = function(options) { validateString(options.file, 'options.file'); this.spawnfile = options.file; - if (ArrayIsArray(options.args)) - this.spawnargs = options.args; - else if (options.args === undefined) + if (options.args === undefined) { this.spawnargs = []; - else - throw new ERR_INVALID_ARG_TYPE('options.args', 'Array', options.args); + } else { + validateArray(options.args, 'options.args'); + this.spawnargs = options.args; + } const err = this._handle.spawn(options); @@ -852,7 +857,7 @@ function setupChannel(target, channel, serializationMode) { } } - /* If the master is > 2 read() calls behind, please stop sending. */ + /* If the primary is > 2 read() calls behind, please stop sending. */ return channel.writeQueueSize < (65536 * 2); }; @@ -976,9 +981,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..a6035d7a75b013 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'); @@ -22,7 +23,8 @@ const noop = FunctionPrototype; module.exports = cluster; cluster.isWorker = true; -cluster.isMaster = false; +cluster.isMaster = false; // Deprecated alias. Must be same as isPrimary. +cluster.isPrimary = false; cluster.worker = null; cluster.Worker = Worker; @@ -39,7 +41,7 @@ cluster._setupWorker = function() { worker.emit('disconnect'); if (!worker.exitedAfterDisconnect) { - // Unexpected disconnect, master exited, or some such nastiness, so + // Unexpected disconnect, primary exited, or some such nastiness, so // worker exits immediately. process.exit(0); } @@ -73,14 +75,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 +102,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 +116,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 +138,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,15 +146,15 @@ 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); let key = message.key; function listen(backlog) { - // TODO(bnoordhuis) Send a message to the master that tells it to + // TODO(bnoordhuis) Send a message to the primary that tells it to // update the backlog size. The actual backlog should probably be // the largest requested size by any worker. return 0; @@ -149,15 +163,15 @@ function rr(message, indexesKey, cb) { function close() { // lib/net.js treats server._handle.close() as effectively synchronous. // That means there is a time window between the call to close() and - // the ack by the master process in which we can still receive handles. + // the ack by the primary process in which we can still receive handles. // onconnection() below handles that by sending those handles back to - // the master. + // the primary. if (key === undefined) return; send({ act: 'close', key }); handles.delete(key); - indexes.delete(indexesKey); + removeIndexesKey(indexesKey, index); key = undefined; } @@ -199,7 +213,7 @@ function send(message, cb) { return sendHelper(process, message, null, cb); } -function _disconnect(masterInitiated) { +function _disconnect(primaryInitiated) { this.exitedAfterDisconnect = true; let waitingCount = 1; @@ -208,10 +222,10 @@ function _disconnect(masterInitiated) { if (waitingCount === 0) { // If disconnect is worker initiated, wait for ack to be sure - // exitedAfterDisconnect is properly set in the master, otherwise, if - // it's master initiated there's no need to send the + // exitedAfterDisconnect is properly set in the primary, otherwise, if + // it's primary initiated there's no need to send the // exitedAfterDisconnect message - if (masterInitiated) { + if (primaryInitiated) { process.disconnect(); } else { send({ act: 'exitedAfterDisconnect' }, () => process.disconnect()); diff --git a/lib/internal/cluster/master.js b/lib/internal/cluster/primary.js similarity index 93% rename from lib/internal/cluster/master.js rename to lib/internal/cluster/primary.js index 8d872d22f81e4d..fcad64ae1d29ff 100644 --- a/lib/internal/cluster/master.js +++ b/lib/internal/cluster/primary.js @@ -30,12 +30,13 @@ module.exports = cluster; const handles = new SafeMap(); cluster.isWorker = false; -cluster.isMaster = true; +cluster.isMaster = true; // Deprecated alias. Must be same as isPrimary. +cluster.isPrimary = true; cluster.Worker = Worker; cluster.workers = {}; cluster.settings = {}; cluster.SCHED_NONE = SCHED_NONE; // Leave it to the operating system. -cluster.SCHED_RR = SCHED_RR; // Master distributes connections. +cluster.SCHED_RR = SCHED_RR; // Primary distributes connections. let ids = 0; let debugPortOffset = 1; @@ -56,7 +57,7 @@ else if (process.platform === 'win32') { cluster.schedulingPolicy = schedulingPolicy; -cluster.setupMaster = function(options) { +cluster.setupPrimary = function(options) { const settings = { args: ArrayPrototypeSlice(process.argv, 2), exec: process.argv[1], @@ -105,6 +106,9 @@ cluster.setupMaster = function(options) { }); }; +// Deprecated alias must be same as setupPrimary +cluster.setupMaster = cluster.setupPrimary; + function setupSettingsNT(settings) { cluster.emit('setup', settings); } @@ -170,7 +174,7 @@ function removeHandlesForWorker(worker) { } cluster.fork = function(env) { - cluster.setupMaster(); + cluster.setupPrimary(); const id = ++ids; const workerProcess = createWorkerProcess(id, env); const worker = new Worker({ @@ -203,7 +207,7 @@ cluster.fork = function(env) { /* * Now is a good time to remove the handles * associated with this worker because it is - * not connected to the master anymore. + * not connected to the primary anymore. */ removeHandlesForWorker(worker); @@ -248,19 +252,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) { @@ -357,7 +363,7 @@ function send(worker, message, handle, cb) { return sendHelper(worker.process, message, handle, cb); } -// Extend generic Worker with methods specific to the master process. +// Extend generic Worker with methods specific to the primary process. Worker.prototype.disconnect = function() { this.exitedAfterDisconnect = true; send(this, { act: 'disconnect' }); diff --git a/lib/internal/cluster/worker.js b/lib/internal/cluster/worker.js index cdc1cd97ce06c8..53285413530230 100644 --- a/lib/internal/cluster/worker.js +++ b/lib/internal/cluster/worker.js @@ -9,7 +9,7 @@ const EventEmitter = require('events'); module.exports = Worker; -// Common Worker implementation shared between the cluster master and workers. +// Common Worker implementation shared between the cluster primary and workers. function Worker(options) { if (!(this instanceof Worker)) return new Worker(options); 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 a28d61369b1c94..a82c03eb76d65c 100644 --- a/lib/internal/crypto/diffiehellman.js +++ b/lib/internal/crypto/diffiehellman.js @@ -70,7 +70,6 @@ const { toBuf, kHandle, kKeyObject, - kNamedCurveAliases, } = require('internal/crypto/util'); const { @@ -451,7 +450,7 @@ async function asyncDeriveBitsECDH(algorithm, baseKey, length) { const bits = await new Promise((resolve, reject) => { deriveBitsECDH( - kNamedCurveAliases[baseKey.algorithm.namedCurve], + baseKey.algorithm.namedCurve, key[kKeyObject][kHandle], baseKey[kKeyObject][kHandle], (err, bits) => { if (err) return reject(err); diff --git a/lib/internal/crypto/ec.js b/lib/internal/crypto/ec.js index b14bddd4911876..248bba57ad2c3f 100644 --- a/lib/internal/crypto/ec.js +++ b/lib/internal/crypto/ec.js @@ -6,17 +6,21 @@ const { SafeSet, } = primordials; +const { Buffer } = require('buffer'); + const { ECKeyExportJob, KeyObjectHandle, SignJob, kCryptoJobAsync, kKeyTypePrivate, + kKeyTypePublic, kSignJobModeSign, kSignJobModeVerify, } = internalBinding('crypto'); const { + validateBoolean, validateOneOf, validateString, } = require('internal/validators'); @@ -60,6 +64,10 @@ function verifyAcceptableEcKeyUse(name, type, usages) { case 'ECDH': checkSet = ['deriveKey', 'deriveBits']; break; + case 'NODE-ED25519': + // Fall through + case 'NODE-ED448': + // Fall through case 'ECDSA': switch (type) { case 'private': @@ -84,6 +92,41 @@ function createECPublicKeyRaw(namedCurve, keyData) { return new PublicKeyObject(handle); } +function createECRawKey(namedCurve, keyData, isPublic) { + const handle = new KeyObjectHandle(); + keyData = getArrayBufferOrView(keyData, 'keyData'); + + switch (namedCurve) { + case 'NODE-ED25519': + case 'NODE-X25519': + if (keyData.byteLength !== 32) { + throw lazyDOMException( + `${namedCurve} raw keys must be exactly 32-bytes`); + } + break; + case 'NODE-ED448': + if (keyData.byteLength !== 57) { + throw lazyDOMException( + `${namedCurve} raw keys must be exactly 57-bytes`); + } + break; + case 'NODE-X448': + if (keyData.byteLength !== 56) { + throw lazyDOMException( + `${namedCurve} raw keys must be exactly 56-bytes`); + } + break; + } + + if (isPublic) { + handle.initEDRaw(namedCurve, keyData, kKeyTypePublic); + return new PublicKeyObject(handle); + } + + handle.initEDRaw(namedCurve, keyData, kKeyTypePrivate); + return new PrivateKeyObject(handle); +} + async function ecGenerateKey(algorithm, extractable, keyUsages) { const { name, namedCurve } = algorithm; validateString(namedCurve, 'algorithm.namedCurve'); @@ -95,6 +138,16 @@ async function ecGenerateKey(algorithm, extractable, keyUsages) { const usageSet = new SafeSet(keyUsages); switch (name) { case 'ECDSA': + if (namedCurve === 'NODE-ED25519' || + namedCurve === 'NODE-ED448' || + namedCurve === 'NODE-X25519' || + namedCurve === 'NODE-X448') { + throw lazyDOMException('Unsupported named curves for ECDSA'); + } + // Fall through + case 'NODE-ED25519': + // Fall through + case 'NODE-ED448': if (hasAnyNotIn(usageSet, 'sign', 'verify')) { throw lazyDOMException( 'Unsupported key usage for an ECDSA key', @@ -107,6 +160,10 @@ async function ecGenerateKey(algorithm, extractable, keyUsages) { 'Unsupported key usage for an ECDH key', 'SyntaxError'); } + if (namedCurve === 'NODE-ED25519' || namedCurve === 'NODE-ED448') { + throw lazyDOMException('Unsupported named curves for ECDH'); + } + // Fall through } return new Promise((resolve, reject) => { generateKeyPair('ec', { namedCurve }, (err, pubKey, privKey) => { @@ -121,6 +178,10 @@ async function ecGenerateKey(algorithm, extractable, keyUsages) { let publicUsages; let privateUsages; switch (name) { + case 'NODE-ED25519': + // Fall through + case 'NODE-ED448': + // Fall through case 'ECDSA': publicUsages = getUsagesUnion(usageSet, 'verify'); privateUsages = getUsagesUnion(usageSet, 'sign'); @@ -170,9 +231,13 @@ async function ecImportKey( namedCurve, 'algorithm.namedCurve', ObjectKeys(kNamedCurveAliases)); - + // Only used for NODE-EDnnnn key variants to distinguish between + // importing a raw public key or raw private key. + if (algorithm.public !== undefined) + validateBoolean(algorithm.public, 'algorithm.public'); let keyObject; const usagesSet = new SafeSet(keyUsages); + let checkNamedCurve = true; switch (format) { case 'node.keyObject': { if (!isKeyObject(keyData)) @@ -205,68 +270,111 @@ async function ecImportKey( let curve; if (keyData == null || typeof keyData !== 'object') throw lazyDOMException('Invalid JWK keyData', 'DataError'); - - if (keyData.kty !== 'EC') - throw lazyDOMException('Invalid key type', 'DataError'); - - if (keyData.d !== undefined) { - verifyAcceptableEcKeyUse(name, 'private', usagesSet); - } else { - verifyAcceptableEcKeyUse(name, 'public', usagesSet); - } - - if (usagesSet.size > 0 && keyData.use !== undefined) { - if (algorithm.name === 'ECDSA' && keyData.use !== 'sig') - throw lazyDOMException('Invalid use type', 'DataError'); - if (algorithm.name === 'ECDH' && keyData.use !== 'enc') - throw lazyDOMException('Invalid use type', 'DataError'); - } - - validateKeyOps(keyData.key_ops, usagesSet); - - if (keyData.ext !== undefined && - keyData.ext === false && - extractable === true) { - throw lazyDOMException('JWK is not extractable', 'DataError'); - } - - if (algorithm.name === 'ECDSA' && keyData.alg !== undefined) { - if (typeof keyData.alg !== 'string') - throw lazyDOMException('Invalid alg', 'DataError'); - switch (keyData.alg) { - case 'ES256': curve = 'P-256'; break; - case 'ES384': curve = 'P-384'; break; - case 'ES512': curve = 'P-521'; break; + switch (keyData.kty) { + case 'OKP': { + checkNamedCurve = false; + const isPublic = keyData.d === undefined; + const type = + namedCurve === 'NODE-X25519' || 'NODE-X448' ? 'ECDH' : 'ECDSA'; + verifyAcceptableEcKeyUse( + type, + isPublic ? 'public' : 'private', + usagesSet); + keyObject = createECRawKey( + namedCurve, + Buffer.from( + isPublic ? keyData.k : keyData.d, + 'base64'), + isPublic); + break; + } + default: { + if (keyData.kty !== 'EC') + throw lazyDOMException('Invalid key type', 'DataError'); + + if (keyData.d !== undefined) { + verifyAcceptableEcKeyUse(name, 'private', usagesSet); + } else { + verifyAcceptableEcKeyUse(name, 'public', usagesSet); + } + + if (usagesSet.size > 0 && keyData.use !== undefined) { + if (algorithm.name === 'ECDSA' && keyData.use !== 'sig') + throw lazyDOMException('Invalid use type', 'DataError'); + if (algorithm.name === 'ECDH' && keyData.use !== 'enc') + throw lazyDOMException('Invalid use type', 'DataError'); + } + + validateKeyOps(keyData.key_ops, usagesSet); + + if (keyData.ext !== undefined && + keyData.ext === false && + extractable === true) { + throw lazyDOMException('JWK is not extractable', 'DataError'); + } + + if (algorithm.name === 'ECDSA' && keyData.alg !== undefined) { + if (typeof keyData.alg !== 'string') + throw lazyDOMException('Invalid alg', 'DataError'); + switch (keyData.alg) { + case 'ES256': curve = 'P-256'; break; + case 'ES384': curve = 'P-384'; break; + case 'ES512': curve = 'P-521'; break; + } + if (curve !== namedCurve) + throw lazyDOMException('Named curve mismatch', 'DataError'); + } + + const handle = new KeyObjectHandle(); + const type = handle.initJwk(keyData, namedCurve); + if (type === undefined) + throw lazyDOMException('Invalid JWK keyData', 'DataError'); + keyObject = type === kKeyTypePrivate ? + new PrivateKeyObject(handle) : + new PublicKeyObject(handle); } - if (curve !== namedCurve) - throw lazyDOMException('Named curve mismatch', 'DataError'); } - - const handle = new KeyObjectHandle(); - const type = handle.initJwk(keyData, namedCurve); - if (type === undefined) - throw lazyDOMException('Invalid JWK keyData', 'DataError'); - - keyObject = type === kKeyTypePrivate ? - new PrivateKeyObject(handle) : - new PublicKeyObject(handle); - break; } case 'raw': { - verifyAcceptableEcKeyUse(name, 'public', usagesSet); - keyObject = createECPublicKeyRaw(namedCurve, keyData); + switch (namedCurve) { + case 'NODE-X25519': + // Fall through + case 'NODE-X448': + checkNamedCurve = false; + verifyAcceptableEcKeyUse( + 'ECDH', + algorithm.public === true ? 'public' : 'private', + usagesSet); + keyObject = createECRawKey(namedCurve, keyData, algorithm.public); + break; + case 'NODE-ED25519': + // Fall through + case 'NODE-ED448': + checkNamedCurve = false; + verifyAcceptableEcKeyUse( + 'ECDSA', + algorithm.public === true ? 'public' : 'private', + usagesSet); + keyObject = createECRawKey(namedCurve, keyData, algorithm.public); + break; + default: + verifyAcceptableEcKeyUse(name, 'public', usagesSet); + keyObject = createECPublicKeyRaw(namedCurve, keyData); + } if (keyObject === undefined) throw lazyDOMException('Unable to import EC key', 'OperationError'); break; } } - const { - namedCurve: checkNamedCurve - } = keyObject[kHandle].keyDetail({}); - if (kNamedCurveAliases[namedCurve] !== checkNamedCurve) - throw lazyDOMException('Named curve mismatch', 'DataError'); + if (checkNamedCurve) { + const { + namedCurve: checkNamedCurve + } = keyObject[kHandle].keyDetail({}); + if (kNamedCurveAliases[namedCurve] !== checkNamedCurve) + throw lazyDOMException('Named curve mismatch', 'DataError'); + } return new InternalCryptoKey( keyObject, @@ -275,22 +383,33 @@ async function ecImportKey( extractable); } -function ecdsaSignVerify(key, data, { hash }, signature) { - if (hash === undefined) - throw new ERR_MISSING_OPTION('algorithm.hash'); - +function ecdsaSignVerify(key, data, { name, hash }, signature) { const mode = signature === undefined ? kSignJobModeSign : kSignJobModeVerify; const type = mode === kSignJobModeSign ? 'private' : 'public'; if (key.type !== type) throw lazyDOMException(`Key must be a ${type} key`, 'InvalidAccessError'); + let hashname; + switch (name) { + case 'NODE-ED25519': + // Fall through + case 'NODE-ED448': + if (hash !== undefined) + throw new lazyDOMException(`Hash is not permitted for ${name}`); + break; + default: + if (hash === undefined) + throw new ERR_MISSING_OPTION('algorithm.hash'); + hashname = normalizeHashName(hash.name); + } + return jobPromise(new SignJob( kCryptoJobAsync, mode, key[kKeyObject][kHandle], data, - normalizeHashName(hash.name), + hashname, undefined, // Salt length, not used with ECDSA undefined, // PSS Padding, not used with ECDSA signature)); diff --git a/lib/internal/crypto/keygen.js b/lib/internal/crypto/keygen.js index 2b0d58afd663fc..56f06f7a79fe2a 100644 --- a/lib/internal/crypto/keygen.js +++ b/lib/internal/crypto/keygen.js @@ -94,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), diff --git a/lib/internal/crypto/keys.js b/lib/internal/crypto/keys.js index f54393a5e3b4bd..9d6f86d32b0b78 100644 --- a/lib/internal/crypto/keys.js +++ b/lib/internal/crypto/keys.js @@ -5,6 +5,7 @@ const { ObjectDefineProperty, ObjectSetPrototypeOf, Symbol, + Uint8Array, } = primordials; const { @@ -36,6 +37,7 @@ const { kHandle, kKeyObject, getArrayBufferOrView, + bigIntArrayToUnsignedBigInt, } = require('internal/crypto/util'); const { @@ -128,12 +130,39 @@ const [ } const kAsymmetricKeyType = Symbol('kAsymmetricKeyType'); + const kAsymmetricKeyDetails = Symbol('kAsymmetricKeyDetails'); + + function normalizeKeyDetails(details = {}) { + if (details.publicExponent !== undefined) { + return { + ...details, + publicExponent: + bigIntArrayToUnsignedBigInt(new Uint8Array(details.publicExponent)) + }; + } + return details; + } class AsymmetricKeyObject extends KeyObject { get asymmetricKeyType() { return this[kAsymmetricKeyType] || (this[kAsymmetricKeyType] = this[kHandle].getAsymmetricKeyType()); } + + get asymmetricKeyDetails() { + switch (this.asymmetricKeyType) { + case 'rsa': + case 'rsa-pss': + case 'dsa': + case 'ec': + return this[kAsymmetricKeyDetails] || + (this[kAsymmetricKeyDetails] = normalizeKeyDetails( + this[kHandle].keyDetail({}) + )); + default: + return {}; + } + } } class PublicKeyObject extends AsymmetricKeyObject { diff --git a/lib/internal/crypto/random.js b/lib/internal/crypto/random.js index 93b32b92007908..3a11a74648ff05 100644 --- a/lib/internal/crypto/random.js +++ b/lib/internal/crypto/random.js @@ -12,24 +12,28 @@ 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_OUT_OF_RANGE, + ERR_OPERATION_FAILED, } } = require('internal/errors'); const { validateNumber, + validateBoolean, validateCallback, + validateObject, } = require('internal/validators'); const { @@ -214,20 +218,20 @@ function randomInt(min, max, callback) { `<= ${RAND_MAX}`, range); } - const excess = RAND_MAX % range; - const randLimit = RAND_MAX - excess; + // For (x % range) to produce an unbiased value greater than or equal to 0 and + // less than range, x must be drawn randomly from the set of integers greater + // than or equal to 0 and less than randLimit. + const randLimit = RAND_MAX - (RAND_MAX % range); if (isSync) { // Sync API while (true) { const x = randomBytes(6).readUIntBE(0, 6); - // If x > (maxVal - (maxVal % range)), we will get "modulo bias" - if (x > randLimit) { - // Try again + if (x >= randLimit) { + // Try again. continue; } - const n = (x % range) + min; - return n; + return (x % range) + min; } } else { // Async API @@ -235,9 +239,8 @@ function randomInt(min, max, callback) { randomBytes(6, (err, bytes) => { if (err) return callback(err); const x = bytes.readUIntBE(0, 6); - // If x > (maxVal - (maxVal % range)), we will get "modulo bias" - if (x > randLimit) { - // Try again + if (x >= randLimit) { + // Try again. return pickAttempt(); } const n = (x % range) + min; @@ -281,10 +284,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/util.js b/lib/internal/crypto/util.js index 20d8058e585565..d08249559a81e5 100644 --- a/lib/internal/crypto/util.js +++ b/lib/internal/crypto/util.js @@ -3,7 +3,9 @@ const { ArrayPrototypeIncludes, ArrayPrototypePush, + BigInt, FunctionPrototypeBind, + Number, Promise, StringPrototypeToLowerCase, StringPrototypeToUpperCase, @@ -15,8 +17,11 @@ const { getCurves: _getCurves, getHashes: _getHashes, setEngine: _setEngine, + secureHeapUsed: _secureHeapUsed, } = internalBinding('crypto'); +const { getOptionValue } = require('internal/options'); + const { crypto: { ENGINE_METHOD_ALL @@ -143,6 +148,10 @@ const kNamedCurveAliases = { 'P-256': 'prime256v1', 'P-384': 'secp384r1', 'P-521': 'secp521r1', + 'NODE-ED25519': 'ed25519', + 'NODE-ED448': 'ed448', + 'NODE-X25519': 'x25519', + 'NODE-X448': 'x448', }; const kAesKeyLengths = [128, 192, 256]; @@ -170,7 +179,9 @@ const kAlgorithms = [ // should be prefixed with 'node-' 'node-dsa', 'node-dh', - 'node-scrypt' + 'node-scrypt', + 'node-ed25519', + 'node-ed448', ]; // These are the only export and import formats we currently @@ -304,6 +315,17 @@ function bigIntArrayToUnsignedInt(input) { return result; } +function bigIntArrayToUnsignedBigInt(input) { + let result = 0n; + + for (let n = 0; n < input.length; ++n) { + const n_reversed = input.length - n - 1; + result |= BigInt(input[n]) << 8n * BigInt(n_reversed); + } + + return result; +} + function getStringOption(options, key) { let value; if (options && (value = options[key]) != null) @@ -371,6 +393,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, @@ -398,8 +431,10 @@ module.exports = { jobPromise, lazyRequire, validateMaxBufferLength, + bigIntArrayToUnsignedBigInt, bigIntArrayToUnsignedInt, getStringOption, getUsagesUnion, getHashLength, + secureHeapUsed, }; diff --git a/lib/internal/crypto/webcrypto.js b/lib/internal/crypto/webcrypto.js index 7bd487972eb08f..2e14fcc90c35ed 100644 --- a/lib/internal/crypto/webcrypto.js +++ b/lib/internal/crypto/webcrypto.js @@ -78,6 +78,10 @@ async function generateKey( case 'RSA-OAEP': return lazyRequire('internal/crypto/rsa') .rsaKeyGenerate(algorithm, extractable, keyUsages); + case 'NODE-ED25519': + // Fall through + case 'NODE-ED448': + // Fall through case 'ECDSA': // Fall through case 'ECDH': @@ -203,6 +207,10 @@ async function exportKeySpki(key) { .rsaExportKey(key, kWebCryptoKeyFormatSPKI); } break; + case 'NODE-ED25519': + // Fall through + case 'NODE-ED448': + // Fall through case 'ECDSA': // Fall through case 'ECDH': @@ -242,6 +250,10 @@ async function exportKeyPkcs8(key) { .rsaExportKey(key, kWebCryptoKeyFormatPKCS8); } break; + case 'NODE-ED25519': + // Fall through + case 'NODE-ED448': + // Fall through case 'ECDSA': // Fall through case 'ECDH': @@ -271,6 +283,11 @@ async function exportKeyPkcs8(key) { async function exportKeyRaw(key) { switch (key.algorithm.name) { + case 'NODE-ED25519': + // Fall through + case 'NODE-ED448': + return lazyRequire('internal/crypto/ec') + .ecExportKey(key, kWebCryptoKeyFormatRaw); case 'ECDSA': // Fall through case 'ECDH': @@ -320,7 +337,7 @@ async function exportKeyJWK(key) { case 'ECDSA': // Fall through case 'ECDH': - jwk.crv = key.algorithm.namedCurve; + jwk.crv ||= key.algorithm.namedCurve; return jwk; case 'AES-CTR': // Fall through @@ -342,6 +359,10 @@ async function exportKeyJWK(key) { key.algorithm.hash.name, normalizeHashName.kContextJwkDsa); return jwk; + case 'NODE-ED25519': + // Fall through + case 'NODE-ED448': + return jwk; default: // Fall through } @@ -445,6 +466,10 @@ async function importKey( case 'RSA-OAEP': return lazyRequire('internal/crypto/rsa') .rsaImportKey(format, keyData, algorithm, extractable, keyUsages); + case 'NODE-ED25519': + // Fall through + case 'NODE-ED448': + // Fall through case 'ECDSA': // Fall through case 'ECDH': @@ -564,6 +589,10 @@ function signVerify(algorithm, key, data, signature) { case 'RSASSA-PKCS1-V1_5': return lazyRequire('internal/crypto/rsa') .rsaSignVerify(key, data, algorithm, signature); + case 'NODE-ED25519': + // Fall through + case 'NODE-ED448': + // Fall through case 'ECDSA': return lazyRequire('internal/crypto/ec') .ecdsaSignVerify(key, data, algorithm, signature); 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/dns/utils.js b/lib/internal/dns/utils.js index 27d25c92ad93aa..40f5ba0088e83e 100644 --- a/lib/internal/dns/utils.js +++ b/lib/internal/dns/utils.js @@ -1,7 +1,6 @@ 'use strict'; const { - ArrayIsArray, ArrayPrototypeForEach, ArrayPrototypeJoin, ArrayPrototypeMap, @@ -14,7 +13,7 @@ const { const errors = require('internal/errors'); const { isIP } = require('internal/net'); -const { validateInt32 } = require('internal/validators'); +const { validateArray, validateInt32 } = require('internal/validators'); const { ChannelWrap, strerror, @@ -60,9 +59,7 @@ class Resolver { } setServers(servers) { - if (!ArrayIsArray(servers)) { - throw new ERR_INVALID_ARG_TYPE('servers', 'Array', servers); - } + validateArray(servers, 'servers'); // Cache the original servers because in the event of an error while // setting the servers, c-ares won't have any servers available for diff --git a/lib/internal/errors.js b/lib/internal/errors.js index 0b6a95d761ee75..35b091c1853b60 100644 --- a/lib/internal/errors.js +++ b/lib/internal/errors.js @@ -26,6 +26,7 @@ const { ErrorCaptureStackTrace, ErrorPrototypeToString, JSONStringify, + MapPrototypeGet, MathAbs, MathMax, Number, @@ -404,7 +405,7 @@ function uvErrmapGet(name) { if (!uvBinding.errmap) { uvBinding.errmap = uvBinding.getErrorMap(); } - return uvBinding.errmap.get(name); + return MapPrototypeGet(uvBinding.errmap, name); } const captureLargerStackTrace = hideStackFrames( diff --git a/lib/internal/event_target.js b/lib/internal/event_target.js index fd29b07bf6df02..9616030d9dd5d8 100644 --- a/lib/internal/event_target.js +++ b/lib/internal/event_target.js @@ -95,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); } @@ -185,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; } } @@ -340,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) @@ -555,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; } @@ -586,7 +581,7 @@ 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) { diff --git a/lib/internal/fs/dir.js b/lib/internal/fs/dir.js index e63d09713bdcca..917319661a647d 100644 --- a/lib/internal/fs/dir.js +++ b/lib/internal/fs/dir.js @@ -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); } @@ -182,7 +182,7 @@ class Dir { } if (this[kDirOperationQueue] !== null) { - this[kDirOperationQueue].push(() => { + ArrayPrototypePush(this[kDirOperationQueue], () => { this.close(callback); }); return; diff --git a/lib/internal/fs/promises.js b/lib/internal/fs/promises.js index 34aa897c331dc1..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](); } 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 00149db50236da..f599e4b3edb5f5 100644 --- a/lib/internal/histogram.js +++ b/lib/internal/histogram.js @@ -5,7 +5,7 @@ const { } = require('internal/util'); const { format } = require('util'); -const { SafeMap, Symbol } = primordials; +const { NumberIsNaN, SafeMap, Symbol } = primordials; const { ERR_INVALID_ARG_TYPE, @@ -61,7 +61,7 @@ class Histogram { if (typeof percentile !== 'number') throw new ERR_INVALID_ARG_TYPE('percentile', 'number', percentile); - if (percentile <= 0 || percentile > 100) + if (NumberIsNaN(percentile) || percentile <= 0 || percentile > 100) throw new ERR_INVALID_ARG_VALUE.RangeError('percentile', percentile); return this[kHandle]?.percentile(percentile); diff --git a/lib/internal/http2/compat.js b/lib/internal/http2/compat.js index e7a0cbb436b1f5..ddc017a144cfbe 100644 --- a/lib/internal/http2/compat.js +++ b/lib/internal/http2/compat.js @@ -11,6 +11,8 @@ const { ObjectPrototypeHasOwnProperty, ReflectApply, ReflectGetPrototypeOf, + StringPrototypeIncludes, + SafeArrayIterator, StringPrototypeToLowerCase, StringPrototypeTrim, Symbol, @@ -81,7 +83,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)) { @@ -145,7 +149,8 @@ function onStreamTrailers(trailers, flags, rawTrailers) { const request = this[kRequest]; if (request !== undefined) { ObjectAssign(request[kTrailers], trailers); - ArrayPrototypePush(request[kRawTrailers], ...rawTrailers); + ArrayPrototypePush(request[kRawTrailers], + ...new SafeArrayIterator(rawTrailers)); } } @@ -524,6 +529,10 @@ class Http2ServerResponse extends Stream { return this[kStream].headersSent; } + get req() { + return this[kStream][kRequest]; + } + get sendDate() { return this[kState].sendDate; } diff --git a/lib/internal/http2/core.js b/lib/internal/http2/core.js index bc4bdeec5110b8..a4eab21c135b35 100644 --- a/lib/internal/http2/core.js +++ b/lib/internal/http2/core.js @@ -7,6 +7,7 @@ const { ArrayIsArray, ArrayPrototypeForEach, ArrayPrototypePush, + ArrayPrototypeUnshift, FunctionPrototypeBind, FunctionPrototypeCall, MathMin, @@ -20,6 +21,7 @@ const { ReflectApply, ReflectGetPrototypeOf, RegExpPrototypeTest, + SafeArrayIterator, SafeMap, SafeSet, StringPrototypeSlice, @@ -187,21 +189,22 @@ let debug = require('internal/util/debuglog').debuglog('http2', (fn) => { // this seems pretty fast, though. function debugStream(id, sessionType, message, ...args) { debug('Http2Stream %s [Http2Session %s]: ' + message, - id, sessionName(sessionType), ...args); + id, sessionName(sessionType), ...new SafeArrayIterator(args)); } function debugStreamObj(stream, message, ...args) { const session = stream[kSession]; const type = session ? session[kType] : undefined; - debugStream(stream[kID], type, message, ...args); + debugStream(stream[kID], type, message, ...new SafeArrayIterator(args)); } function debugSession(sessionType, message, ...args) { - debug('Http2Session %s: ' + message, sessionName(sessionType), ...args); + debug('Http2Session %s: ' + message, sessionName(sessionType), + ...new SafeArrayIterator(args)); } function debugSessionObj(session, message, ...args) { - debugSession(session[kType], message, ...args); + debugSession(session[kType], message, ...new SafeArrayIterator(args)); } const kMaxFrameSize = (2 ** 24) - 1; @@ -317,7 +320,7 @@ const SESSION_FLAGS_DESTROYED = 0x4; // Top level to avoid creating a closure function emit(self, ...args) { - self.emit(...args); + ReflectApply(self.emit, self, args); } // Called when a new block of headers has been received for a given @@ -1020,7 +1023,7 @@ function setupHandle(socket, type, options) { if (type === NGHTTP2_SESSION_SERVER && ArrayIsArray(options.origins)) { - this.origin(...options.origins); + ReflectApply(this.origin, this, options.origins); } process.nextTick(emit, this, 'connect', this, socket); @@ -1291,7 +1294,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) @@ -1422,7 +1425,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. @@ -1495,7 +1498,7 @@ class Http2Session extends EventEmitter { [EventEmitter.captureRejectionSymbol](err, event, ...args) { switch (event) { case 'stream': - const [stream] = args; + const stream = args[0]; stream.destroy(err); break; default: @@ -1663,7 +1666,9 @@ class ClientHttp2Session extends Http2Session { this[kUpdateTimer](); if (headers !== null && headers !== undefined) { - for (const header of ObjectKeys(headers)) { + const keys = ObjectKeys(headers); + for (let i = 0; i < keys.length; i++) { + const header = keys[i]; if (header[0] === ':') { assertValidPseudoHeader(header); } else if (header && !checkIsHttpToken(header)) @@ -3095,7 +3100,7 @@ Http2Server.prototype[EventEmitter.captureRejectionSymbol] = function( case 'stream': // TODO(mcollina): we might want to match this with what we do on // the compat side. - const [stream] = args; + const { 0: stream } = args; if (stream.sentHeaders) { stream.destroy(err); } else { @@ -3104,7 +3109,7 @@ Http2Server.prototype[EventEmitter.captureRejectionSymbol] = function( } break; case 'request': - const [, res] = args; + const { 1: res } = args; if (!res.headersSent && !res.finished) { // Don't leak headers. for (const name of res.getHeaderNames()) { @@ -3117,8 +3122,9 @@ Http2Server.prototype[EventEmitter.captureRejectionSymbol] = function( } break; default: + ArrayPrototypeUnshift(args, err, event); ReflectApply(net.Server.prototype[EventEmitter.captureRejectionSymbol], - this, [err, event, ...args]); + this, args); } }; diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js index b129e94d9890c0..0c69d547d40b9a 100644 --- a/lib/internal/modules/cjs/loader.js +++ b/lib/internal/modules/cjs/loader.js @@ -233,9 +233,9 @@ ObjectDefineProperty(Module, 'wrapper', { } }); -ObjectDefineProperty(Module.prototype, 'isPreloading', { - get() { return isPreloading; } -}); +const isPreloadingDesc = { get() { return isPreloading; } }; +ObjectDefineProperty(Module.prototype, 'isPreloading', isPreloadingDesc); +ObjectDefineProperty(NativeModule.prototype, 'isPreloading', isPreloadingDesc); function getModuleParent() { return moduleParentCache.get(this); 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 5043da896622be..6cf968553bae6d 100644 --- a/lib/internal/modules/esm/module_job.js +++ b/lib/internal/modules/esm/module_job.js @@ -110,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..5a578902cbb01a 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 === '.') @@ -105,13 +104,8 @@ function getConditionsSet(conditions) { const realpathCache = new SafeMap(); const packageJSONCache = new SafeMap(); /* string -> PackageConfig */ -function tryStatSync(path) { - try { - return statSync(path); - } catch { - return new Stats(); - } -} +const tryStatSync = + (path) => statSync(path, { throwIfNoEntry: false }) ?? new Stats(); function getPackageConfig(path, specifier, base) { const existing = packageJSONCache.get(path); 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 7947c14cde8d39..ec1316d3245a41 100644 --- a/lib/internal/per_context/primordials.js +++ b/lib/internal/per_context/primordials.js @@ -6,6 +6,12 @@ // so that Node.js's builtin modules do not need to later look these up from // the global proxy, which can be mutated by users. +const { + defineProperty: ReflectDefineProperty, + getOwnPropertyDescriptor: ReflectGetOwnPropertyDescriptor, + ownKeys: ReflectOwnKeys, +} = Reflect; + // TODO(joyeecheung): we can restrict access to these globals in builtin // modules through the JS linter, for example: ban access such as `Object` // (which falls back to a lookup in the global proxy) in favor of @@ -13,23 +19,12 @@ // 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) { - for (const key of Reflect.ownKeys(src)) { - if (!Reflect.getOwnPropertyDescriptor(dest, key)) { - Reflect.defineProperty( - dest, - key, - Reflect.getOwnPropertyDescriptor(src, key)); - } - } -} - function getNewKey(key) { return typeof key === 'symbol' ? `Symbol${key.description[7].toUpperCase()}${key.description.slice(8)}` : @@ -37,12 +32,12 @@ function getNewKey(key) { } function copyAccessor(dest, prefix, key, { enumerable, get, set }) { - Reflect.defineProperty(dest, `${prefix}Get${key}`, { + ReflectDefineProperty(dest, `${prefix}Get${key}`, { value: uncurryThis(get), enumerable }); if (set !== undefined) { - Reflect.defineProperty(dest, `${prefix}Set${key}`, { + ReflectDefineProperty(dest, `${prefix}Set${key}`, { value: uncurryThis(set), enumerable }); @@ -50,128 +45,46 @@ function copyAccessor(dest, prefix, key, { enumerable, get, set }) { } function copyPropsRenamed(src, dest, prefix) { - for (const key of Reflect.ownKeys(src)) { + for (const key of ReflectOwnKeys(src)) { const newKey = getNewKey(key); - const desc = Reflect.getOwnPropertyDescriptor(src, key); + const desc = ReflectGetOwnPropertyDescriptor(src, key); if ('get' in desc) { copyAccessor(dest, prefix, newKey, desc); } else { - Reflect.defineProperty(dest, `${prefix}${newKey}`, desc); + ReflectDefineProperty(dest, `${prefix}${newKey}`, desc); } } } function copyPropsRenamedBound(src, dest, prefix) { - for (const key of Reflect.ownKeys(src)) { + for (const key of ReflectOwnKeys(src)) { const newKey = getNewKey(key); - const desc = Reflect.getOwnPropertyDescriptor(src, key); + const desc = ReflectGetOwnPropertyDescriptor(src, key); if ('get' in desc) { copyAccessor(dest, prefix, newKey, desc); } else { if (typeof desc.value === 'function') { desc.value = desc.value.bind(src); } - Reflect.defineProperty(dest, `${prefix}${newKey}`, desc); + ReflectDefineProperty(dest, `${prefix}${newKey}`, desc); } } } function copyPrototype(src, dest, prefix) { - for (const key of Reflect.ownKeys(src)) { + for (const key of ReflectOwnKeys(src)) { const newKey = getNewKey(key); - const desc = Reflect.getOwnPropertyDescriptor(src, key); + const desc = ReflectGetOwnPropertyDescriptor(src, key); if ('get' in desc) { copyAccessor(dest, prefix, newKey, desc); } else { if (typeof desc.value === 'function') { desc.value = uncurryThis(desc.value); } - Reflect.defineProperty(dest, `${prefix}${newKey}`, desc); - } - } -} - -const createSafeIterator = (factory, next) => { - class SafeIterator { - constructor(iterable) { - this._iterator = factory(iterable); - } - next() { - return next(this._iterator); - } - [Symbol.iterator]() { - return this; - } - } - Object.setPrototypeOf(SafeIterator.prototype, null); - Object.freeze(SafeIterator.prototype); - Object.freeze(SafeIterator); - return SafeIterator; -}; - -function makeSafe(unsafe, safe) { - if (Symbol.iterator in unsafe.prototype) { - const dummy = new unsafe(); - let next; // We can reuse the same `next` method. - - for (const key of Reflect.ownKeys(unsafe.prototype)) { - if (!Reflect.getOwnPropertyDescriptor(safe.prototype, key)) { - const desc = Reflect.getOwnPropertyDescriptor(unsafe.prototype, key); - if ( - typeof desc.value === 'function' && - desc.value.length === 0 && - Symbol.iterator in (desc.value.call(dummy) ?? {}) - ) { - const createIterator = uncurryThis(desc.value); - next ??= uncurryThis(createIterator(dummy).next); - const SafeIterator = createSafeIterator(createIterator, next); - desc.value = function() { - return new SafeIterator(this); - }; - } - Reflect.defineProperty(safe.prototype, key, desc); - } + ReflectDefineProperty(dest, `${prefix}${newKey}`, desc); } - } else { - copyProps(unsafe.prototype, safe.prototype); } - copyProps(unsafe, safe); - - Object.setPrototypeOf(safe.prototype, null); - Object.freeze(safe.prototype); - Object.freeze(safe); - return safe; } -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 { - constructor(i) { super(i); } // eslint-disable-line no-useless-constructor - } -); -primordials.SafeWeakMap = makeSafe( - WeakMap, - class SafeWeakMap extends WeakMap { - constructor(i) { super(i); } // eslint-disable-line no-useless-constructor - } -); -primordials.SafeSet = makeSafe( - Set, - class SafeSet extends Set { - constructor(i) { super(i); } // eslint-disable-line no-useless-constructor - } -); -primordials.SafeWeakSet = makeSafe( - WeakSet, - class SafeWeakSet extends WeakSet { - constructor(i) { super(i); } // eslint-disable-line no-useless-constructor - } -); // Create copies of the namespace objects [ @@ -256,6 +169,41 @@ primordials.SafeWeakSet = makeSafe( copyPrototype(original.prototype, primordials, `${name}Prototype`); }); +/* eslint-enable node-core/prefer-primordials */ + +const { + ArrayPrototypeForEach, + FunctionPrototypeCall, + Map, + ObjectFreeze, + ObjectSetPrototypeOf, + Set, + SymbolIterator, + WeakMap, + WeakSet, +} = primordials; + +// Because these functions are used by `makeSafe`, which is exposed +// on the `primordials` object, it's important to use const references +// to the primordials that they use: +const createSafeIterator = (factory, next) => { + class SafeIterator { + constructor(iterable) { + this._iterator = factory(iterable); + } + next() { + return next(this._iterator); + } + [SymbolIterator]() { + return this; + } + } + ObjectSetPrototypeOf(SafeIterator.prototype, null); + ObjectFreeze(SafeIterator.prototype); + ObjectFreeze(SafeIterator); + return SafeIterator; +}; + primordials.SafeArrayIterator = createSafeIterator( primordials.ArrayPrototypeSymbolIterator, primordials.ArrayIteratorPrototypeNext @@ -265,5 +213,80 @@ primordials.SafeStringIterator = createSafeIterator( primordials.StringIteratorPrototypeNext ); -Object.setPrototypeOf(primordials, null); -Object.freeze(primordials); +const copyProps = (src, dest) => { + ArrayPrototypeForEach(ReflectOwnKeys(src), (key) => { + if (!ReflectGetOwnPropertyDescriptor(dest, key)) { + ReflectDefineProperty( + dest, + key, + ReflectGetOwnPropertyDescriptor(src, key)); + } + }); +}; + +const makeSafe = (unsafe, safe) => { + if (SymbolIterator in unsafe.prototype) { + const dummy = new unsafe(); + let next; // We can reuse the same `next` method. + + ArrayPrototypeForEach(ReflectOwnKeys(unsafe.prototype), (key) => { + if (!ReflectGetOwnPropertyDescriptor(safe.prototype, key)) { + const desc = ReflectGetOwnPropertyDescriptor(unsafe.prototype, key); + if ( + typeof desc.value === 'function' && + desc.value.length === 0 && + SymbolIterator in (FunctionPrototypeCall(desc.value, dummy) ?? {}) + ) { + const createIterator = uncurryThis(desc.value); + next ??= uncurryThis(createIterator(dummy).next); + const SafeIterator = createSafeIterator(createIterator, next); + desc.value = function() { + return new SafeIterator(this); + }; + } + ReflectDefineProperty(safe.prototype, key, desc); + } + }); + } else { + copyProps(unsafe.prototype, safe.prototype); + } + copyProps(unsafe, safe); + + ObjectSetPrototypeOf(safe.prototype, null); + ObjectFreeze(safe.prototype); + ObjectFreeze(safe); + return safe; +}; +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 { + constructor(i) { super(i); } // eslint-disable-line no-useless-constructor + } +); +primordials.SafeWeakMap = makeSafe( + WeakMap, + class SafeWeakMap extends WeakMap { + constructor(i) { super(i); } // eslint-disable-line no-useless-constructor + } +); +primordials.SafeSet = makeSafe( + Set, + class SafeSet extends Set { + constructor(i) { super(i); } // eslint-disable-line no-useless-constructor + } +); +primordials.SafeWeakSet = makeSafe( + WeakSet, + class SafeWeakSet extends WeakSet { + constructor(i) { super(i); } // eslint-disable-line no-useless-constructor + } +); + +ObjectSetPrototypeOf(primordials, null); +ObjectFreeze(primordials); diff --git a/lib/internal/process/per_thread.js b/lib/internal/process/per_thread.js index b16705f9fb95b0..4fdf0ba8764455 100644 --- a/lib/internal/process/per_thread.js +++ b/lib/internal/process/per_thread.js @@ -5,7 +5,6 @@ // thread and the worker threads. const { - ArrayIsArray, ArrayPrototypeMap, ArrayPrototypePush, ArrayPrototypeSplice, @@ -35,6 +34,7 @@ const { } } = require('internal/errors'); const format = require('internal/util/inspect').format; +const { validateArray } = require('internal/validators'); const constants = internalBinding('constants').os.signals; function assert(x, msg) { @@ -55,9 +55,7 @@ function getFastAPIs(binding) { _hrtime.hrtime(); if (time !== undefined) { - if (!ArrayIsArray(time)) { - throw new ERR_INVALID_ARG_TYPE('time', 'Array', time); - } + validateArray(time, 'time'); if (time.length !== 2) { throw new ERR_OUT_OF_RANGE('time', 2, time.length); } @@ -93,6 +91,7 @@ function wrapProcessMethods(binding) { const { cpuUsage: _cpuUsage, memoryUsage: _memoryUsage, + rss, resourceUsage: _resourceUsage } = binding; @@ -168,6 +167,8 @@ function wrapProcessMethods(binding) { }; } + memoryUsage.rss = rss; + function exit(code) { if (code || code === 0) process.exitCode = code; diff --git a/lib/internal/repl/utils.js b/lib/internal/repl/utils.js index 594b6a0c4485c7..8fee6d40123c49 100644 --- a/lib/internal/repl/utils.js +++ b/lib/internal/repl/utils.js @@ -245,7 +245,7 @@ function setupPreview(repl, contextSymbol, bufferSymbol, active) { } // Result and the text that was completed. - const [rawCompletions, completeOn] = data; + const { 0: rawCompletions, 1: completeOn } = data; if (!rawCompletions || rawCompletions.length === 0) { return; diff --git a/lib/internal/source_map/source_map.js b/lib/internal/source_map/source_map.js index 37912a2c9750bc..f49de5d8c4deda 100644 --- a/lib/internal/source_map/source_map.js +++ b/lib/internal/source_map/source_map.js @@ -67,7 +67,12 @@ 'use strict'; const { - ArrayIsArray + ArrayIsArray, + ArrayPrototypePush, + ArrayPrototypeSlice, + ArrayPrototypeSort, + ObjectPrototypeHasOwnProperty, + StringPrototypeCharAt, } = primordials; const { @@ -94,14 +99,14 @@ class StringCharIterator { * @return {string} */ next() { - return this._string.charAt(this._position++); + return StringPrototypeCharAt(this._string, this._position++); } /** * @return {string} */ peek() { - return this._string.charAt(this._position); + return StringPrototypeCharAt(this._string, this._position); } /** @@ -158,7 +163,7 @@ class SourceMap { } else { this.#parseMap(this.#payload, 0, 0); } - this.#mappings.sort(compareSourceMapEntry); + ArrayPrototypeSort(this.#mappings, compareSourceMapEntry); } /** @@ -211,7 +216,7 @@ class SourceMap { /** * @override */ - #parseMap = (map, lineNumber, columnNumber) => { + #parseMap(map, lineNumber, columnNumber) { let sourceIndex = 0; let sourceLineNumber = 0; let sourceColumnNumber = 0; @@ -222,7 +227,7 @@ class SourceMap { for (let i = 0; i < map.sources.length; ++i) { const url = map.sources[i]; originalToCanonicalURLMap[url] = url; - sources.push(url); + ArrayPrototypePush(sources, url); this.#sources[url] = true; if (map.sourcesContent && map.sourcesContent[i]) @@ -246,7 +251,7 @@ class SourceMap { columnNumber += decodeVLQ(stringCharIterator); if (isSeparator(stringCharIterator.peek())) { - this.#mappings.push([lineNumber, columnNumber]); + ArrayPrototypePush(this.#mappings, [lineNumber, columnNumber]); continue; } @@ -264,8 +269,11 @@ class SourceMap { name = map.names?.[nameIndex]; } - this.#mappings.push([lineNumber, columnNumber, sourceURL, - sourceLineNumber, sourceColumnNumber, name]); + ArrayPrototypePush( + this.#mappings, + [lineNumber, columnNumber, sourceURL, sourceLineNumber, + sourceColumnNumber, name] + ); } }; } @@ -320,8 +328,9 @@ function cloneSourceMapV3(payload) { } payload = { ...payload }; for (const key in payload) { - if (payload.hasOwnProperty(key) && ArrayIsArray(payload[key])) { - payload[key] = payload[key].slice(0); + if (ObjectPrototypeHasOwnProperty(payload, key) && + ArrayIsArray(payload[key])) { + payload[key] = ArrayPrototypeSlice(payload[key]); } } return payload; @@ -334,8 +343,8 @@ function cloneSourceMapV3(payload) { * @return {number} */ function compareSourceMapEntry(entry1, entry2) { - const [lineNumber1, columnNumber1] = entry1; - const [lineNumber2, columnNumber2] = entry2; + const { 0: lineNumber1, 1: columnNumber1 } = entry1; + const { 0: lineNumber2, 1: columnNumber2 } = entry2; if (lineNumber1 !== lineNumber2) { return lineNumber1 - lineNumber2; } diff --git a/lib/internal/source_map/source_map_cache.js b/lib/internal/source_map/source_map_cache.js index b95653ebba84e9..f0d911f78fad8b 100644 --- a/lib/internal/source_map/source_map_cache.js +++ b/lib/internal/source_map/source_map_cache.js @@ -138,7 +138,7 @@ function sourceMapFromFile(mapURL) { // data:[][;base64], see: // https://tools.ietf.org/html/rfc2397#section-2 function sourceMapFromDataUrl(sourceURL, url) { - const [format, data] = StringPrototypeSplit(url, ','); + const { 0: format, 1: data } = StringPrototypeSplit(url, ','); const splitFormat = StringPrototypeSplit(format, ';'); const contentType = splitFormat[0]; const base64 = splitFormat[splitFormat.length - 1] === 'base64'; 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..8eee330beced3a 100644 --- a/lib/internal/streams/end-of-stream.js +++ b/lib/internal/streams/end-of-stream.js @@ -9,10 +9,28 @@ const { } = require('internal/errors').codes; const { once } = require('internal/util'); +function isSocket(stream) { + return ( + typeof stream.connect === 'function' && + typeof stream.setNoDelay === 'function' && + typeof stream.setKeepAlive === 'function' + ); +} + 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,10 +90,10 @@ 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 && + (state.emitClose || isSocket(stream)) && state.closed === false && isReadable(stream) === readable && isWritable(stream) === writable @@ -129,7 +147,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 +158,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/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/test/binding.js b/lib/internal/test/binding.js index 882ea90093d039..063b9b5c900aad 100644 --- a/lib/internal/test/binding.js +++ b/lib/internal/test/binding.js @@ -4,4 +4,9 @@ process.emitWarning( 'These APIs are for internal testing only. Do not use them.', 'internal/test/binding'); -module.exports = { internalBinding }; +if (module.isPreloading) { + globalThis.internalBinding = internalBinding; + globalThis.primordials = primordials; +} + +module.exports = { internalBinding, primordials }; 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 900b6b03cd9ec1..3c90ec3d3672a8 100644 --- a/lib/internal/url.js +++ b/lib/internal/url.js @@ -437,7 +437,7 @@ ObjectDefineProperties(URL.prototype, { ret += '@'; } ret += options.unicode ? - domainToUnicode(this.hostname) : this.hostname; + domainToUnicode(ctx.host) : ctx.host; if (ctx.port !== null) ret += `:${ctx.port}`; } @@ -1295,7 +1295,7 @@ function domainToUnicode(domain) { // Utility function that converts a URL object into an ordinary // options object as expected by the http.request and https.request // APIs. -function urlToOptions(url) { +function urlToHttpOptions(url) { const options = { protocol: url.protocol, hostname: typeof url.hostname === 'string' && @@ -1494,7 +1494,7 @@ module.exports = { URLSearchParams, domainToASCII, domainToUnicode, - urlToOptions, + urlToHttpOptions, formatSymbol: kFormat, searchParamsSymbol: searchParams, encodeStr diff --git a/lib/internal/util.js b/lib/internal/util.js index cd0edfe44ee13f..5d5a2b14a708b4 100644 --- a/lib/internal/util.js +++ b/lib/internal/util.js @@ -180,6 +180,11 @@ function slowCases(enc) { StringPrototypeToLowerCase(`${enc}`) === 'utf-16le') return 'utf16le'; break; + case 9: + if (enc === 'base64url' || enc === 'BASE64URL' || + StringPrototypeToLowerCase(`${enc}`) === 'base64url') + return 'base64url'; + break; default: if (enc === '') return 'utf8'; } diff --git a/lib/internal/util/comparisons.js b/lib/internal/util/comparisons.js index 0bc46257e829fc..ed8ddf6ad321d8 100644 --- a/lib/internal/util/comparisons.js +++ b/lib/internal/util/comparisons.js @@ -44,15 +44,6 @@ const { isSymbolObject, isFloat32Array, isFloat64Array, - isUint8Array, - isUint8ClampedArray, - isUint16Array, - isUint32Array, - isInt8Array, - isInt16Array, - isInt32Array, - isBigInt64Array, - isBigUint64Array } = types; const { getOwnNonIndexProperties, @@ -126,38 +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${TypedArrayPrototypeGetSymbolToStringTag(a)}`]; - 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 ' + - `${TypedArrayPrototypeGetSymbolToStringTag(a)} ${a}\n` + - `and ${TypedArrayPrototypeGetSymbolToStringTag(b)} ${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 @@ -241,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; diff --git a/lib/internal/util/inspect.js b/lib/internal/util/inspect.js index 2672ccb50bfa1c..c40083a1ad497b 100644 --- a/lib/internal/util/inspect.js +++ b/lib/internal/util/inspect.js @@ -4,6 +4,7 @@ const { Array, ArrayIsArray, ArrayPrototypeFilter, + ArrayPrototypeForEach, ArrayPrototypePush, ArrayPrototypeSort, ArrayPrototypeUnshift, @@ -42,6 +43,7 @@ const { ObjectPrototypePropertyIsEnumerable, ObjectSeal, ObjectSetPrototypeOf, + ReflectOwnKeys, RegExp, RegExpPrototypeTest, RegExpPrototypeToString, @@ -308,7 +310,8 @@ function inspect(value, opts) { ctx.showHidden = opts; } else if (opts) { const optKeys = ObjectKeys(opts); - for (const key of optKeys) { + for (let i = 0; i < optKeys.length; ++i) { + const key = optKeys[i]; // TODO(BridgeAR): Find a solution what to do about stylize. Either make // this function public or add a new API with a similar or better // functionality. @@ -462,12 +465,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) { @@ -488,7 +492,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 || @@ -609,14 +613,10 @@ function addPrototypeProperties(ctx, main, obj, recurseTimes, output) { if (depth === 0) { 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); - } + keys = ReflectOwnKeys(obj); for (const key of keys) { // Ignore the `constructor` property and keys that exist on layers above. if (key === 'constructor' || @@ -632,9 +632,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` @@ -664,7 +664,7 @@ function getKeys(value, showHidden) { if (showHidden) { keys = ObjectGetOwnPropertyNames(value); if (symbols.length !== 0) - keys.push(...symbols); + ArrayPrototypePush(keys, ...symbols); } else { // This might throw if `value` is a Module Namespace Object from an // unevaluated module, but we don't want to perform the actual type @@ -1867,7 +1867,7 @@ function tryStringify(arg) { } function format(...args) { - return formatWithOptionsInternal(undefined, ...args); + return formatWithOptionsInternal(undefined, args); } function formatWithOptions(inspectOptions, ...args) { @@ -1875,10 +1875,10 @@ function formatWithOptions(inspectOptions, ...args) { throw new ERR_INVALID_ARG_TYPE( 'inspectOptions', 'object', inspectOptions); } - return formatWithOptionsInternal(inspectOptions, ...args); + return formatWithOptionsInternal(inspectOptions, args); } -function formatWithOptionsInternal(inspectOptions, ...args) { +function formatWithOptionsInternal(inspectOptions, args) { const first = args[0]; let a = 0; let str = ''; 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/vm/module.js b/lib/internal/vm/module.js index 30ce655bd0d8b9..f847f2404f47e0 100644 --- a/lib/internal/vm/module.js +++ b/lib/internal/vm/module.js @@ -11,6 +11,7 @@ const { ObjectGetPrototypeOf, ObjectSetPrototypeOf, PromiseAll, + ReflectApply, SafeWeakMap, Symbol, SymbolToStringTag, @@ -445,7 +446,7 @@ class SyntheticModule extends Module { function importModuleDynamicallyWrap(importModuleDynamically) { const importModuleDynamicallyWrapper = async (...args) => { - const m = await importModuleDynamically(...args); + const m = await ReflectApply(importModuleDynamically, this, args); if (isModuleNamespaceObject(m)) { return m; } diff --git a/lib/internal/worker.js b/lib/internal/worker.js index cb51c0a1a5efd0..38f3ba66f214e6 100644 --- a/lib/internal/worker.js +++ b/lib/internal/worker.js @@ -4,6 +4,7 @@ const { ArrayIsArray, + ArrayPrototypeForEach, ArrayPrototypeMap, ArrayPrototypePush, Float64Array, @@ -14,7 +15,9 @@ const { ObjectEntries, Promise, PromiseResolve, + ReflectApply, RegExpPrototypeTest, + SafeArrayIterator, String, Symbol, SymbolFor, @@ -54,6 +57,7 @@ const { } = workerIo; const { deserializeError } = require('internal/error_serdes'); const { fileURLToPath, isURLInstance, pathToFileURL } = require('internal/url'); +const { validateArray } = require('internal/validators'); const { ownsProcessState, @@ -106,9 +110,7 @@ class Worker extends EventEmitter { } let argv; if (options.argv) { - if (!ArrayIsArray(options.argv)) { - throw new ERR_INVALID_ARG_TYPE('options.argv', 'Array', options.argv); - } + validateArray(options.argv, 'options.argv'); argv = ArrayPrototypeMap(options.argv, String); } @@ -155,8 +157,10 @@ class Worker extends EventEmitter { let env; if (typeof options.env === 'object' && options.env !== null) { env = ObjectCreate(null); - for (const [ key, value ] of ObjectEntries(options.env)) - env[key] = `${value}`; + ArrayPrototypeForEach( + ObjectEntries(options.env), + ({ 0: key, 1: value }) => { env[key] = `${value}`; } + ); } else if (options.env == null) { env = process.env; } else if (options.env !== SHARE_ENV) { @@ -209,12 +213,13 @@ class Worker extends EventEmitter { const transferList = [port2]; // If transferList is provided. if (options.transferList) - ArrayPrototypePush(transferList, ...options.transferList); + ArrayPrototypePush(transferList, + ...new SafeArrayIterator(options.transferList)); this[kPublicPort] = port1; - for (const event of ['message', 'messageerror']) { + ArrayPrototypeForEach(['message', 'messageerror'], (event) => { this[kPublicPort].on(event, (message) => this.emit(event, message)); - } + }); setupPortReferencing(this[kPublicPort], this, 'message'); this[kPort].postMessage({ argv, @@ -279,8 +284,9 @@ class Worker extends EventEmitter { { const { stream, chunks } = message; const readable = this[kParentSideStdio][stream]; - for (const { chunk, encoding } of chunks) + ArrayPrototypeForEach(chunks, ({ chunk, encoding }) => { readable.push(chunk, encoding); + }); return; } case messageTypes.STDIO_WANTS_MORE_DATA: @@ -314,7 +320,7 @@ class Worker extends EventEmitter { postMessage(...args) { if (this[kPublicPort] === null) return; - this[kPublicPort].postMessage(...args); + ReflectApply(this[kPublicPort].postMessage, this[kPublicPort], args); } terminate(callback) { diff --git a/lib/net.js b/lib/net.js index 149e4df20f2717..b945c1a3f9aa1b 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 @@ -663,6 +664,12 @@ Socket.prototype._destroy = function(exception, cb) { this._handle.close(() => { debug('emit close'); + if (this._writableState) { + this._writableState.closed = true; + } + if (this._readableState) { + this._readableState.closed = true; + } this.emit('close', isException); }); this._handle.onread = noop; @@ -1148,6 +1155,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)) @@ -1336,7 +1359,7 @@ function listenInCluster(server, address, port, addressType, if (cluster === undefined) cluster = require('cluster'); - if (cluster.isMaster || exclusive) { + if (cluster.isPrimary || exclusive) { // Will create a new handle // _listen2 sets up the listened handle, it is still named like this // to avoid breaking code that wraps this method @@ -1352,10 +1375,10 @@ function listenInCluster(server, address, port, addressType, flags, }; - // Get the master's server handle, and listen on it - cluster._getServer(server, serverQuery, listenOnMasterHandle); + // Get the primary's server handle, and listen on it + cluster._getServer(server, serverQuery, listenOnPrimaryHandle); - function listenOnMasterHandle(err, handle) { + function listenOnPrimaryHandle(err, handle) { err = checkBindError(err, port, handle); if (err) { @@ -1363,7 +1386,7 @@ function listenInCluster(server, address, port, addressType, return server.emit('error', ex); } - // Reuse master's server handle + // Reuse primary's server handle server._handle = handle; // _listen2 sets up the listened handle, it is still named like this // to avoid breaking code that wraps this method @@ -1398,6 +1421,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); @@ -1425,7 +1449,7 @@ Server.prototype.listen = function(...args) { lookupAndListen(this, options.port | 0, options.host, backlog, options.exclusive, flags); } else { // Undefined host, listens on unspecified address - // Default addressType 4 will be used to search for master server + // Default addressType 4 will be used to search for primary server listenInCluster(this, null, options.port | 0, 4, backlog, undefined, options.exclusive); } @@ -1633,6 +1657,12 @@ Server.prototype._emitCloseIfDrained = function() { function emitCloseNT(self) { debug('SERVER: emit close'); + if (self._writableState) { + self._writableState.closed = true; + } + if (self._readableState) { + self._readableState.closed = true; + } self.emit('close'); } diff --git a/lib/perf_hooks.js b/lib/perf_hooks.js index 6733992b9fae39..a5b0fdf1f60028 100644 --- a/lib/perf_hooks.js +++ b/lib/perf_hooks.js @@ -3,6 +3,7 @@ const { ArrayIsArray, ArrayPrototypeFilter, + ArrayPrototypeForEach, ArrayPrototypeIncludes, ArrayPrototypeMap, ArrayPrototypePush, @@ -81,7 +82,6 @@ const kInsertEntry = Symbol('insert-entry'); const kGetEntries = Symbol('get-entries'); const kIndex = Symbol('index'); const kMarks = Symbol('marks'); -const kCount = Symbol('count'); const observers = {}; const observerableTypes = [ @@ -286,11 +286,6 @@ class PerformanceObserverEntryList { writable: true, enumerable: false, value: {} - }, - [kCount]: { - writable: true, - enumerable: false, - value: 0 } }); L.init(this[kEntries]); @@ -299,11 +294,6 @@ class PerformanceObserverEntryList { [kInsertEntry](entry) { const item = { entry }; L.append(this[kEntries], item); - this[kCount]++; - } - - get length() { - return this[kCount]; } [kGetEntries](name, type) { @@ -375,13 +365,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) { @@ -408,14 +398,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(); @@ -640,6 +630,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 7ae4b806608d21..888ac81d564d11 100644 --- a/lib/readline.js +++ b/lib/readline.js @@ -282,9 +282,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; @@ -300,6 +297,9 @@ function Interface(input, output, completer, terminal) { self.once('close', onSelfCloseWithTerminal); } + // Current line + this.line = ''; + input.resume(); } diff --git a/lib/repl.js b/lib/repl.js index 3368b5997ae01d..b1905195ab4b47 100644 --- a/lib/repl.js +++ b/lib/repl.js @@ -46,6 +46,7 @@ const { ArrayPrototypeConcat, ArrayPrototypeFilter, ArrayPrototypeFindIndex, + ArrayPrototypeForEach, ArrayPrototypeIncludes, ArrayPrototypeJoin, ArrayPrototypeMap, @@ -663,7 +664,7 @@ function REPLServer(prompt, let matched = false; errStack = ''; - for (const line of lines) { + ArrayPrototypeForEach(lines, (line) => { if (!matched && RegExpPrototypeTest(/^\[?([A-Z][a-z0-9_]*)*Error/, line)) { errStack += writer.options.breakLength >= line.length ? @@ -673,7 +674,7 @@ function REPLServer(prompt, } else { errStack += line; } - } + }); if (!matched) { const ln = lines.length === 1 ? ' ' : ':\n'; errStack = `Uncaught${ln}${errStack}`; @@ -754,9 +755,7 @@ function REPLServer(prompt, const prioritizedSigintQueue = new SafeSet(); self.on('SIGINT', function onSigInt() { if (prioritizedSigintQueue.size > 0) { - for (const task of prioritizedSigintQueue) { - task(); - } + ArrayPrototypeForEach(prioritizedSigintQueue, (task) => task()); return; } @@ -1010,13 +1009,13 @@ REPLServer.prototype.createContext = function() { }, () => { context = vm.createContext(); }); - for (const name of ObjectGetOwnPropertyNames(global)) { + ArrayPrototypeForEach(ObjectGetOwnPropertyNames(global), (name) => { // Only set properties that do not already exist as a global builtin. if (!globalBuiltins.has(name)) { ObjectDefineProperty(context, name, ObjectGetOwnPropertyDescriptor(global, name)); } - } + }); context.global = context; const _console = new Console(this.output); ObjectDefineProperty(context, 'console', { @@ -1231,7 +1230,7 @@ function complete(line, callback) { paths = ArrayPrototypeConcat(module.paths, CJSModule.globalPaths); } - for (let dir of paths) { + ArrayPrototypeForEach(paths, (dir) => { dir = path.resolve(dir, subdir); const dirents = gracefulReaddir(dir, { withFileTypes: true }) || []; for (const dirent of dirents) { @@ -1259,7 +1258,7 @@ function complete(line, callback) { } } } - } + }); if (group.length) { ArrayPrototypePush(completionGroups, group); } @@ -1269,7 +1268,7 @@ function complete(line, callback) { } } else if (RegExpPrototypeTest(fsAutoCompleteRE, line) && this.allowBlockingCompletions) { - [completionGroups, completeOn] = completeFSFunctions(line); + ({ 0: completionGroups, 1: completeOn } = completeFSFunctions(line)); // Handle variable member lookup. // We support simple chained expressions like the following (no function // calls, etc.). That is for simplicity and also because we *eval* that @@ -1282,7 +1281,7 @@ function complete(line, callback) { // foo.<|> # completions for 'foo' with filter '' } else if (line.length === 0 || RegExpPrototypeTest(/\w|\.|\$/, line[line.length - 1])) { - const [match] = RegExpPrototypeExec(simpleExpressionRE, line) || ['']; + const { 0: match } = RegExpPrototypeExec(simpleExpressionRE, line) || ['']; if (line.length !== 0 && !match) { completionGroupsLoaded(); return; @@ -1352,11 +1351,11 @@ function complete(line, callback) { if (memberGroups.length) { expr += chaining; - for (const group of memberGroups) { + ArrayPrototypeForEach(memberGroups, (group) => { ArrayPrototypePush(completionGroups, ArrayPrototypeMap(group, (member) => `${expr}${member}`)); - } + }); if (filter) { filter = `${expr}${filter}`; } @@ -1375,7 +1374,7 @@ function complete(line, callback) { // Filter, sort (within each group), uniq and merge the completion groups. if (completionGroups.length && filter) { const newCompletionGroups = []; - for (const group of completionGroups) { + ArrayPrototypeForEach(completionGroups, (group) => { const filteredGroup = ArrayPrototypeFilter( group, (str) => StringPrototypeStartsWith(str, filter) @@ -1383,29 +1382,30 @@ function complete(line, callback) { if (filteredGroup.length) { ArrayPrototypePush(newCompletionGroups, filteredGroup); } - } + }); completionGroups = newCompletionGroups; } const completions = []; // Unique completions across all groups. - const uniqueSet = new SafeSet(['']); + const uniqueSet = new SafeSet(); + uniqueSet.add(''); // Completion group 0 is the "closest" (least far up the inheritance // chain) so we put its completions last: to be closest in the REPL. - for (const group of completionGroups) { + ArrayPrototypeForEach(completionGroups, (group) => { ArrayPrototypeSort(group, (a, b) => (b > a ? 1 : -1)); const setSize = uniqueSet.size; - for (const entry of group) { + ArrayPrototypeForEach(group, (entry) => { if (!uniqueSet.has(entry)) { ArrayPrototypeUnshift(completions, entry); uniqueSet.add(entry); } - } + }); // Add a separator between groups. if (uniqueSet.size !== setSize) { ArrayPrototypeUnshift(completions, ''); } - } + }); // Remove obsolete group entry, if present. if (completions[0] === '') { @@ -1569,14 +1569,13 @@ function defineDefaultCommands(repl) { const longestNameLength = MathMax( ...ArrayPrototypeMap(names, (name) => name.length) ); - for (let n = 0; n < names.length; n++) { - const name = names[n]; + ArrayPrototypeForEach(names, (name) => { const cmd = this.commands[name]; const spaces = StringPrototypeRepeat(' ', longestNameLength - name.length + 3); const line = `.${name}${cmd.help ? spaces + cmd.help : ''}\n`; this.output.write(line); - } + }); this.output.write('\nPress Ctrl+C to abort current expression, ' + 'Ctrl+D to exit the REPL\n'); this.displayPrompt(); 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 55d554bb838e95..c46b98f798ccaf 100644 --- a/lib/timers/promises.js +++ b/lib/timers/promises.js @@ -49,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; @@ -94,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/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..a13988031241d0 100644 --- a/lib/url.js +++ b/lib/url.js @@ -26,6 +26,7 @@ const { ObjectCreate, ObjectKeys, SafeSet, + StringPrototypeCharCodeAt, } = primordials; const { toASCII } = require('internal/idna'); @@ -46,9 +47,10 @@ const { URLSearchParams, domainToASCII, domainToUnicode, + fileURLToPath, formatSymbol, pathToFileURL, - fileURLToPath + urlToHttpOptions, } = require('internal/url'); // Original url.parse() API @@ -156,6 +158,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 +374,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 +599,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 ); @@ -979,5 +988,6 @@ module.exports = { // Utilities pathToFileURL, - fileURLToPath + fileURLToPath, + urlToHttpOptions, }; diff --git a/lib/vm.js b/lib/vm.js index 33893845084141..79c97f3af3ff02 100644 --- a/lib/vm.js +++ b/lib/vm.js @@ -23,6 +23,7 @@ const { ArrayPrototypeForEach, + ArrayPrototypeUnshift, Symbol, PromiseReject, ReflectApply, @@ -130,17 +131,17 @@ class Script extends ContextifyScript { if (breakOnSigint && process.listenerCount('SIGINT') > 0) { return sigintHandlersWrap(super.runInThisContext, this, args); } - return super.runInThisContext(...args); + return ReflectApply(super.runInThisContext, this, args); } runInContext(contextifiedObject, options) { validateContext(contextifiedObject); const { breakOnSigint, args } = getRunInContextArgs(options); + ArrayPrototypeUnshift(args, contextifiedObject); if (breakOnSigint && process.listenerCount('SIGINT') > 0) { - return sigintHandlersWrap(super.runInContext, this, - [contextifiedObject, ...args]); + return sigintHandlersWrap(super.runInContext, this, args); } - return super.runInContext(contextifiedObject, ...args); + return ReflectApply(super.runInContext, this, args); } runInNewContext(contextObject, options) { @@ -274,9 +275,9 @@ function sigintHandlersWrap(fn, thisArg, argsArray) { } finally { // Add using the public methods so that the `newListener` handler of // process can re-attach the listeners. - for (const listener of sigintListeners) { + ArrayPrototypeForEach(sigintListeners, (listener) => { process.addListener('SIGINT', listener); - } + }); } } 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 cb7e0cff40e48e..38460c1263aa42 100644 --- a/lib/zlib.js +++ b/lib/zlib.js @@ -23,6 +23,7 @@ const { ArrayBuffer, + ArrayPrototypeForEach, ArrayPrototypeMap, ArrayPrototypePush, Error, @@ -37,6 +38,7 @@ const { ObjectKeys, ObjectSetPrototypeOf, ReflectApply, + StringPrototypeStartsWith, Symbol, TypedArrayPrototypeFill, Uint32Array, @@ -786,7 +788,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); @@ -800,8 +804,8 @@ function Brotli(opts, mode) { assert(mode === BROTLI_DECODE || mode === BROTLI_ENCODE); TypedArrayPrototypeFill(brotliInitParamsArray, -1); - if (opts && opts.params) { - for (const origKey of ObjectKeys(opts.params)) { + if (opts?.params) { + ArrayPrototypeForEach(ObjectKeys(opts.params), (origKey) => { const key = +origKey; if (NumberIsNaN(key) || key < 0 || key > kMaxBrotliParam || (brotliInitParamsArray[key] | 0) !== -1) { @@ -814,7 +818,7 @@ function Brotli(opts, mode) { 'number', opts.params[origKey]); } brotliInitParamsArray[key] = value; - } + }); } const handle = mode === BROTLI_DECODE ? @@ -927,7 +931,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..473af0b3419779 100644 --- a/node.gyp +++ b/node.gyp @@ -111,13 +111,14 @@ 'lib/internal/assert/assertion_error.js', 'lib/internal/assert/calltracker.js', 'lib/internal/async_hooks.js', + 'lib/internal/blob.js', 'lib/internal/blocklist.js', 'lib/internal/buffer.js', 'lib/internal/cli_table.js', 'lib/internal/child_process.js', 'lib/internal/child_process/serialization.js', 'lib/internal/cluster/child.js', - 'lib/internal/cluster/master.js', + 'lib/internal/cluster/primary.js', 'lib/internal/cluster/round_robin_handle.js', 'lib/internal/cluster/shared_handle.js', 'lib/internal/cluster/utils.js', @@ -143,6 +144,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', @@ -608,6 +610,7 @@ 'src/node.cc', 'src/node_api.cc', 'src/node_binding.cc', + 'src/node_blob.cc', 'src/node_buffer.cc', 'src/node_config.cc', 'src/node_constants.cc', @@ -706,6 +709,7 @@ 'src/node_api.h', 'src/node_api_types.h', 'src/node_binding.h', + 'src/node_blob.h', 'src/node_buffer.h', 'src/node_constants.h', 'src/node_context_data.h', @@ -941,6 +945,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 +970,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 +1475,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/api/encoding.cc b/src/api/encoding.cc index 6df4a7faf30393..f64aeee15c3b34 100644 --- a/src/api/encoding.cc +++ b/src/api/encoding.cc @@ -68,6 +68,8 @@ enum encoding ParseEncoding(const char* encoding, } else if (encoding[1] == 'a') { if (strncmp(encoding + 2, "se64", 5) == 0) return BASE64; + if (strncmp(encoding + 2, "se64url", 8) == 0) + return BASE64URL; } if (StringEqualNoCase(encoding, "binary")) return LATIN1; // BINARY is a deprecated alias of LATIN1. @@ -75,6 +77,8 @@ enum encoding ParseEncoding(const char* encoding, return BUFFER; if (StringEqualNoCase(encoding, "base64")) return BASE64; + if (StringEqualNoCase(encoding, "base64url")) + return BASE64URL; break; case 'a': diff --git a/src/async_wrap.h b/src/async_wrap.h index 1a82a5bfce846c..90f43f64e521db 100644 --- a/src/async_wrap.h +++ b/src/async_wrap.h @@ -38,6 +38,7 @@ namespace node { V(ELDHISTOGRAM) \ V(FILEHANDLE) \ V(FILEHANDLECLOSEREQ) \ + V(FIXEDSIZEBLOBCOPY) \ V(FSEVENTWRAP) \ V(FSREQCALLBACK) \ V(FSREQPROMISE) \ 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..6d3ee26fc701a7 100644 --- a/src/crypto/crypto_ecdh.cc +++ b/src/crypto/crypto_ecdh.cc @@ -7,6 +7,7 @@ #include "env-inl.h" #include "memory_tracker-inl.h" #include "node_buffer.h" +#include "string_bytes.h" #include "threadpoolwork-inl.h" #include "v8.h" @@ -30,14 +31,25 @@ using v8::Uint32; using v8::Value; namespace crypto { -namespace { + int GetCurveFromName(const char* name) { int nid = EC_curve_nist2nid(name); if (nid == NID_undef) nid = OBJ_sn2nid(name); + // If there is still no match, check manually for known curves + if (nid == NID_undef) { + if (strcmp(name, "NODE-ED25519") == 0) { + nid = EVP_PKEY_ED25519; + } else if (strcmp(name, "NODE-ED448") == 0) { + nid = EVP_PKEY_ED448; + } else if (strcmp(name, "NODE-X25519") == 0) { + nid = EVP_PKEY_X25519; + } else if (strcmp(name, "NODE-X448") == 0) { + nid = EVP_PKEY_X448; + } + } return nid; } -} // namespace void ECDH::Initialize(Environment* env, Local target) { Local t = env->NewFunctionTemplate(New); @@ -52,9 +64,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); @@ -394,6 +404,11 @@ void ECDH::ConvertKey(const FunctionCallbackInfo& args) { args.GetReturnValue().Set(buf); } +void ECDHBitsConfig::MemoryInfo(MemoryTracker* tracker) const { + tracker->TrackField("public", public_); + tracker->TrackField("private", private_); +} + Maybe ECDHBitsTraits::EncodeOutput( Environment* env, const ECDHBitsConfig& params, @@ -418,6 +433,7 @@ Maybe ECDHBitsTraits::AdditionalConfig( KeyObjectHandle* public_key; Utf8Value name(env->isolate(), args[offset]); + ASSIGN_OR_RETURN_UNWRAP(&public_key, args[offset + 1], Nothing()); ASSIGN_OR_RETURN_UNWRAP(&private_key, args[offset + 2], Nothing()); @@ -427,23 +443,9 @@ Maybe ECDHBitsTraits::AdditionalConfig( return Nothing(); } - params->private_key = ECKeyPointer( - EC_KEY_dup( - EVP_PKEY_get1_EC_KEY(private_key->Data()->GetAsymmetricKey().get()))); - if (!params->private_key) { - THROW_ERR_CRYPTO_INVALID_KEYTYPE(env); - return Nothing(); - } - - params->public_key = ECKeyPointer( - EC_KEY_dup( - EVP_PKEY_get1_EC_KEY(public_key->Data()->GetAsymmetricKey().get()))); - if (!params->public_key) { - THROW_ERR_CRYPTO_INVALID_KEYTYPE(env); - return Nothing(); - } - - params->group = EC_KEY_get0_group(params->private_key.get()); + params->id_ = GetCurveFromName(*name); + params->private_ = private_key->Data(); + params->public_ = public_key->Data(); return Just(true); } @@ -452,44 +454,102 @@ bool ECDHBitsTraits::DeriveBits( Environment* env, const ECDHBitsConfig& params, ByteSource* out) { - if (params.group == nullptr) - return false; - CHECK_EQ(EC_KEY_check_key(params.private_key.get()), 1); - CHECK_EQ(EC_KEY_check_key(params.public_key.get()), 1); - const EC_POINT* pub = EC_KEY_get0_public_key(params.public_key.get()); - int field_size = EC_GROUP_get_degree(params.group); - size_t len = (field_size + 7) / 8; - char* data = MallocOpenSSL(len); - ByteSource buf = ByteSource::Allocated(data, len); - if (ECDH_compute_key( - data, - len, - pub, - params.private_key.get(), - nullptr) <= 0) { - return false; + + char* data = nullptr; + size_t len = 0; + + switch (params.id_) { + case EVP_PKEY_X25519: + // Fall through + case EVP_PKEY_X448: { + EVPKeyCtxPointer ctx( + EVP_PKEY_CTX_new( + params.private_->GetAsymmetricKey().get(), + nullptr)); + if (EVP_PKEY_derive_init(ctx.get()) <= 0 || + EVP_PKEY_derive_set_peer( + ctx.get(), + params.public_->GetAsymmetricKey().get()) <= 0 || + EVP_PKEY_derive(ctx.get(), nullptr, &len) <= 0) { + return false; + } + + data = MallocOpenSSL(len); + + if (EVP_PKEY_derive( + ctx.get(), + reinterpret_cast(data), + &len) <= 0) { + return false; + } + + break; + } + default: { + const EC_KEY* private_key = + EVP_PKEY_get0_EC_KEY(params.private_->GetAsymmetricKey().get()); + const EC_KEY* public_key = + EVP_PKEY_get0_EC_KEY(params.public_->GetAsymmetricKey().get()); + + const EC_GROUP* group = EC_KEY_get0_group(private_key); + if (group == nullptr) + return false; + + CHECK_EQ(EC_KEY_check_key(private_key), 1); + CHECK_EQ(EC_KEY_check_key(public_key), 1); + const EC_POINT* pub = EC_KEY_get0_public_key(public_key); + int field_size = EC_GROUP_get_degree(group); + len = (field_size + 7) / 8; + data = MallocOpenSSL(len); + CHECK_NOT_NULL(data); + CHECK_NOT_NULL(pub); + CHECK_NOT_NULL(private_key); + if (ECDH_compute_key( + data, + len, + pub, + private_key, + nullptr) <= 0) { + return false; + } + } } + ByteSource buf = ByteSource::Allocated(data, len); *out = std::move(buf); return true; } EVPKeyCtxPointer EcKeyGenTraits::Setup(EcKeyPairGenConfig* params) { - EVPKeyCtxPointer param_ctx(EVP_PKEY_CTX_new_id(EVP_PKEY_EC, nullptr)); - EVP_PKEY* raw_params = nullptr; - if (!param_ctx || - EVP_PKEY_paramgen_init(param_ctx.get()) <= 0 || - EVP_PKEY_CTX_set_ec_paramgen_curve_nid( - param_ctx.get(), params->params.curve_nid) <= 0 || - EVP_PKEY_CTX_set_ec_param_enc( - param_ctx.get(), params->params.param_encoding) <= 0 || - EVP_PKEY_paramgen(param_ctx.get(), &raw_params) <= 0) { - return EVPKeyCtxPointer(); - } - EVPKeyPointer key_params(raw_params); - EVPKeyCtxPointer key_ctx(EVP_PKEY_CTX_new(key_params.get(), nullptr)); - - if (!key_ctx || EVP_PKEY_keygen_init(key_ctx.get()) <= 0) - return EVPKeyCtxPointer(); + EVPKeyCtxPointer key_ctx; + switch (params->params.curve_nid) { + case EVP_PKEY_ED25519: + // Fall through + case EVP_PKEY_ED448: + // Fall through + case EVP_PKEY_X25519: + // Fall through + case EVP_PKEY_X448: + key_ctx.reset(EVP_PKEY_CTX_new_id(params->params.curve_nid, nullptr)); + break; + default: { + EVPKeyCtxPointer param_ctx(EVP_PKEY_CTX_new_id(EVP_PKEY_EC, nullptr)); + EVP_PKEY* raw_params = nullptr; + if (!param_ctx || + EVP_PKEY_paramgen_init(param_ctx.get()) <= 0 || + EVP_PKEY_CTX_set_ec_paramgen_curve_nid( + param_ctx.get(), params->params.curve_nid) <= 0 || + EVP_PKEY_CTX_set_ec_param_enc( + param_ctx.get(), params->params.param_encoding) <= 0 || + EVP_PKEY_paramgen(param_ctx.get(), &raw_params) <= 0) { + return EVPKeyCtxPointer(); + } + EVPKeyPointer key_params(raw_params); + key_ctx.reset(EVP_PKEY_CTX_new(key_params.get(), nullptr)); + } + } + + if (key_ctx && EVP_PKEY_keygen_init(key_ctx.get()) <= 0) + key_ctx.reset(); return key_ctx; } @@ -540,23 +600,49 @@ WebCryptoKeyExportStatus EC_Raw_Export( CHECK(key_data->GetAsymmetricKey()); EC_KEY* ec_key = EVP_PKEY_get0_EC_KEY(key_data->GetAsymmetricKey().get()); - CHECK_NOT_NULL(ec_key); - const EC_GROUP* group = EC_KEY_get0_group(ec_key); - const EC_POINT* point = EC_KEY_get0_public_key(ec_key); - point_conversion_form_t form = POINT_CONVERSION_UNCOMPRESSED; - - // Get the allocated data size... - size_t len = EC_POINT_point2oct(group, point, form, nullptr, 0, nullptr); - if (len == 0) - return WebCryptoKeyExportStatus::FAILED; - - unsigned char* data = MallocOpenSSL(len); - size_t check_len = EC_POINT_point2oct(group, point, form, data, len, nullptr); - if (check_len == 0) - return WebCryptoKeyExportStatus::FAILED; - - CHECK_EQ(len, check_len); + unsigned char* data; + size_t len = 0; + + if (ec_key == nullptr) { + typedef int (*export_fn)(const EVP_PKEY*, unsigned char*, size_t* len); + export_fn fn = nullptr; + switch (key_data->GetKeyType()) { + case kKeyTypePrivate: + fn = EVP_PKEY_get_raw_private_key; + break; + case kKeyTypePublic: + fn = EVP_PKEY_get_raw_public_key; + break; + case kKeyTypeSecret: + UNREACHABLE(); + } + CHECK_NOT_NULL(fn); + // Get the size of the raw key data + if (fn(key_data->GetAsymmetricKey().get(), nullptr, &len) == 0) + return WebCryptoKeyExportStatus::INVALID_KEY_TYPE; + data = MallocOpenSSL(len); + if (fn(key_data->GetAsymmetricKey().get(), data, &len) == 0) + return WebCryptoKeyExportStatus::INVALID_KEY_TYPE; + } else { + if (key_data->GetKeyType() != kKeyTypePublic) + return WebCryptoKeyExportStatus::INVALID_KEY_TYPE; + const EC_GROUP* group = EC_KEY_get0_group(ec_key); + const EC_POINT* point = EC_KEY_get0_public_key(ec_key); + point_conversion_form_t form = POINT_CONVERSION_UNCOMPRESSED; + + // Get the allocated data size... + len = EC_POINT_point2oct(group, point, form, nullptr, 0, nullptr); + if (len == 0) + return WebCryptoKeyExportStatus::FAILED; + data = MallocOpenSSL(len); + size_t check_len = + EC_POINT_point2oct(group, point, form, data, len, nullptr); + if (check_len == 0) + return WebCryptoKeyExportStatus::FAILED; + + CHECK_EQ(len, check_len); + } *out = ByteSource::Allocated(reinterpret_cast(data), len); @@ -580,8 +666,6 @@ WebCryptoKeyExportStatus ECKeyExportTraits::DoExport( switch (format) { case kWebCryptoKeyFormatRaw: - if (key_data->GetKeyType() != kKeyTypePublic) - return WebCryptoKeyExportStatus::INVALID_KEY_TYPE; return EC_Raw_Export(key_data.get(), params, out); case kWebCryptoKeyFormatPKCS8: if (key_data->GetKeyType() != kKeyTypePrivate) @@ -653,6 +737,90 @@ Maybe ExportJWKEcKey( return Just(true); } +Maybe ExportJWKEdKey( + Environment* env, + std::shared_ptr key, + Local target) { + ManagedEVPPKey pkey = key->GetAsymmetricKey(); + + const char* curve = nullptr; + switch (EVP_PKEY_id(pkey.get())) { + case EVP_PKEY_ED25519: + curve = "Ed25519"; + break; + case EVP_PKEY_ED448: + curve = "Ed448"; + break; + case EVP_PKEY_X25519: + curve = "X25519"; + break; + case EVP_PKEY_X448: + curve = "X448"; + break; + default: + UNREACHABLE(); + } + if (target->Set( + env->context(), + env->jwk_crv_string(), + OneByteString(env->isolate(), curve)).IsNothing()) { + return Nothing(); + } + + size_t len = 0; + Local encoded; + Local error; + + if (!EVP_PKEY_get_raw_public_key(pkey.get(), nullptr, &len)) + return Nothing(); + + unsigned char* data = MallocOpenSSL(len); + ByteSource out = ByteSource::Allocated(reinterpret_cast(data), len); + + if (key->GetKeyType() == kKeyTypePrivate) { + if (!EVP_PKEY_get_raw_private_key(pkey.get(), data, &len) || + !StringBytes::Encode( + env->isolate(), + reinterpret_cast(data), + len, + BASE64URL, + &error).ToLocal(&encoded) || + !target->Set( + env->context(), + env->jwk_d_string(), + encoded).IsJust()) { + if (!error.IsEmpty()) + env->isolate()->ThrowException(error); + return Nothing(); + } + } + + if (!EVP_PKEY_get_raw_public_key(pkey.get(), data, &len) || + !StringBytes::Encode( + env->isolate(), + reinterpret_cast(data), + len, + BASE64URL, + &error).ToLocal(&encoded) || + !target->Set( + env->context(), + env->jwk_x_string(), + encoded).IsJust()) { + if (!error.IsEmpty()) + env->isolate()->ThrowException(error); + return Nothing(); + } + + if (target->Set( + env->context(), + env->jwk_kty_string(), + env->jwk_okp_string()).IsNothing()) { + return Nothing(); + } + + return Just(true); +} + std::shared_ptr ImportJWKEcKey( Environment* env, Local jwk, diff --git a/src/crypto/crypto_ecdh.h b/src/crypto/crypto_ecdh.h index c83818d16be0fb..b2ae9e5b2bebf2 100644 --- a/src/crypto/crypto_ecdh.h +++ b/src/crypto/crypto_ecdh.h @@ -16,6 +16,8 @@ namespace node { namespace crypto { +int GetCurveFromName(const char* name); + class ECDH final : public BaseObject { public: ~ECDH() override; @@ -52,11 +54,11 @@ class ECDH final : public BaseObject { }; struct ECDHBitsConfig final : public MemoryRetainer { - ECKeyPointer private_key; - ECKeyPointer public_key; - const EC_GROUP* group = nullptr; + int id_; + std::shared_ptr private_; + std::shared_ptr public_; - SET_NO_MEMORY_INFO(); + void MemoryInfo(MemoryTracker* tracker) const override; SET_MEMORY_INFO_NAME(ECDHBitsConfig); SET_SELF_SIZE(ECDHBitsConfig); }; @@ -144,6 +146,11 @@ v8::Maybe ExportJWKEcKey( std::shared_ptr key, v8::Local target); +v8::Maybe ExportJWKEdKey( + Environment* env, + std::shared_ptr key, + v8::Local target); + std::shared_ptr ImportJWKEcKey( Environment* env, v8::Local jwk, 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_keygen.h b/src/crypto/crypto_keygen.h index c4197c6eaed8f9..58e3b8211d6bd7 100644 --- a/src/crypto/crypto_keygen.h +++ b/src/crypto/crypto_keygen.h @@ -161,7 +161,8 @@ struct KeyPairGenTraits final { Environment* env, AdditionalParameters* params) { EVPKeyCtxPointer ctx = KeyPairAlgorithmTraits::Setup(params); - if (!ctx || EVP_PKEY_keygen_init(ctx.get()) <= 0) + + if (!ctx) return KeyGenJobStatus::FAILED; // Generate the key diff --git a/src/crypto/crypto_keys.cc b/src/crypto/crypto_keys.cc index f80a39ce5de575..4457141f4617ba 100644 --- a/src/crypto/crypto_keys.cc +++ b/src/crypto/crypto_keys.cc @@ -492,6 +492,13 @@ Maybe ExportJWKAsymmetricKey( case EVP_PKEY_RSA_PSS: return ExportJWKRsaKey(env, key, target); case EVP_PKEY_DSA: return ExportJWKDsaKey(env, key, target); case EVP_PKEY_EC: return ExportJWKEcKey(env, key, target); + case EVP_PKEY_ED25519: + // Fall through + case EVP_PKEY_ED448: + // Fall through + case EVP_PKEY_X25519: + // Fall through + case EVP_PKEY_X448: return ExportJWKEdKey(env, key, target); } THROW_ERR_CRYPTO_INVALID_KEYTYPE(env); return Just(false); @@ -873,6 +880,7 @@ v8::Local KeyObjectHandle::Initialize(Environment* env) { env->SetProtoMethod(t, "export", Export); env->SetProtoMethod(t, "exportJwk", ExportJWK); env->SetProtoMethod(t, "initECRaw", InitECRaw); + env->SetProtoMethod(t, "initEDRaw", InitEDRaw); env->SetProtoMethod(t, "initJwk", InitJWK); env->SetProtoMethod(t, "keyDetail", GetKeyDetail); @@ -1032,6 +1040,48 @@ void KeyObjectHandle::InitECRaw(const FunctionCallbackInfo& args) { args.GetReturnValue().Set(true); } +void KeyObjectHandle::InitEDRaw(const FunctionCallbackInfo& args) { + Environment* env = Environment::GetCurrent(args); + KeyObjectHandle* key; + ASSIGN_OR_RETURN_UNWRAP(&key, args.Holder()); + + CHECK(args[0]->IsString()); + Utf8Value name(env->isolate(), args[0]); + + ArrayBufferOrViewContents key_data(args[1]); + KeyType type = static_cast(args[2].As()->Value()); + + MarkPopErrorOnReturn mark_pop_error_on_return; + + typedef EVP_PKEY* (*new_key_fn)(int, ENGINE*, const unsigned char*, size_t); + new_key_fn fn = type == kKeyTypePrivate + ? EVP_PKEY_new_raw_private_key + : EVP_PKEY_new_raw_public_key; + + int id = GetCurveFromName(*name); + + switch (id) { + case EVP_PKEY_X25519: + case EVP_PKEY_X448: + case EVP_PKEY_ED25519: + case EVP_PKEY_ED448: { + EVPKeyPointer pkey(fn(id, nullptr, key_data.data(), key_data.size())); + if (!pkey) + return args.GetReturnValue().Set(false); + key->data_ = + KeyObjectData::CreateAsymmetric( + type, + ManagedEVPPKey(std::move(pkey))); + CHECK(key->data_); + break; + } + default: + UNREACHABLE(); + } + + args.GetReturnValue().Set(true); +} + void KeyObjectHandle::GetKeyDetail(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); KeyObjectHandle* key; diff --git a/src/crypto/crypto_keys.h b/src/crypto/crypto_keys.h index 8938a203eb1d08..64bf45a1dba0ed 100644 --- a/src/crypto/crypto_keys.h +++ b/src/crypto/crypto_keys.h @@ -185,6 +185,7 @@ class KeyObjectHandle : public BaseObject { static void Init(const v8::FunctionCallbackInfo& args); static void InitECRaw(const v8::FunctionCallbackInfo& args); + static void InitEDRaw(const v8::FunctionCallbackInfo& args); static void InitJWK(const v8::FunctionCallbackInfo& args); static void GetKeyDetail(const v8::FunctionCallbackInfo& args); diff --git a/src/crypto/crypto_rsa.cc b/src/crypto/crypto_rsa.cc index d859551392a382..971b184b0c53f5 100644 --- a/src/crypto/crypto_rsa.cc +++ b/src/crypto/crypto_rsa.cc @@ -367,7 +367,14 @@ Maybe ExportJWKRsaKey( int type = EVP_PKEY_id(pkey.get()); CHECK(type == EVP_PKEY_RSA || type == EVP_PKEY_RSA_PSS); - RSA* rsa = EVP_PKEY_get0_RSA(pkey.get()); + // TODO(tniessen): Remove the "else" branch once we drop support for OpenSSL + // versions older than 1.1.1e via FIPS / dynamic linking. + RSA* rsa; + if (OpenSSL_version_num() >= 0x1010105fL) { + rsa = EVP_PKEY_get0_RSA(pkey.get()); + } else { + rsa = static_cast(EVP_PKEY_get0(pkey.get())); + } CHECK_NOT_NULL(rsa); const BIGNUM* n; @@ -508,7 +515,14 @@ Maybe GetRsaKeyDetail( int type = EVP_PKEY_id(pkey.get()); CHECK(type == EVP_PKEY_RSA || type == EVP_PKEY_RSA_PSS); - RSA* rsa = EVP_PKEY_get0_RSA(pkey.get()); + // TODO(tniessen): Remove the "else" branch once we drop support for OpenSSL + // versions older than 1.1.1e via FIPS / dynamic linking. + RSA* rsa; + if (OpenSSL_version_num() >= 0x1010105fL) { + rsa = EVP_PKEY_get0_RSA(pkey.get()); + } else { + rsa = static_cast(EVP_PKEY_get0(pkey.get())); + } CHECK_NOT_NULL(rsa); RSA_get0_key(rsa, &n, &e, nullptr); diff --git a/src/crypto/crypto_sig.cc b/src/crypto/crypto_sig.cc index 59a9569ce8143c..455d1bfdd6cfd3 100644 --- a/src/crypto/crypto_sig.cc +++ b/src/crypto/crypto_sig.cc @@ -223,6 +223,16 @@ void CheckThrow(Environment* env, SignBase::Error error) { return; } } + +bool IsOneShot(const ManagedEVPPKey& key) { + switch (EVP_PKEY_id(key.get())) { + case EVP_PKEY_ED25519: + case EVP_PKEY_ED448: + return true; + default: + return false; + } +} } // namespace SignBase::Error SignBase::Init(const char* sign_type) { @@ -276,9 +286,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 +404,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); } @@ -811,26 +817,47 @@ bool SignTraits::DeriveBits( switch (params.mode) { case SignConfiguration::kSign: { size_t len; - if (!EVP_DigestSignUpdate( - context.get(), - params.data.data(), - params.data.size()) || - !EVP_DigestSignFinal(context.get(), nullptr, &len)) { - return false; - } - char* data = MallocOpenSSL(len); - ByteSource buf = ByteSource::Allocated(data, len); - unsigned char* ptr = reinterpret_cast(data); - if (!EVP_DigestSignFinal(context.get(), ptr, &len)) - return false; - - // If this is an EC key (assuming ECDSA) we have to - // convert the signature in to the proper format. - if (EVP_PKEY_id(params.key->GetAsymmetricKey().get()) == EVP_PKEY_EC) { - *out = ConvertToWebCryptoSignature(params.key->GetAsymmetricKey(), buf); - } else { - buf.Resize(len); + unsigned char* data = nullptr; + if (IsOneShot(params.key->GetAsymmetricKey())) { + EVP_DigestSign( + context.get(), + nullptr, + &len, + params.data.data(), + params.data.size()); + data = MallocOpenSSL(len); + EVP_DigestSign( + context.get(), + data, + &len, + params.data.data(), + params.data.size()); + ByteSource buf = + ByteSource::Allocated(reinterpret_cast(data), len); *out = std::move(buf); + } else { + if (!EVP_DigestSignUpdate( + context.get(), + params.data.data(), + params.data.size()) || + !EVP_DigestSignFinal(context.get(), nullptr, &len)) { + return false; + } + data = MallocOpenSSL(len); + ByteSource buf = + ByteSource::Allocated(reinterpret_cast(data), len); + if (!EVP_DigestSignFinal(context.get(), data, &len)) + return false; + + // If this is an EC key (assuming ECDSA) we have to + // convert the signature in to the proper format. + if (EVP_PKEY_id(params.key->GetAsymmetricKey().get()) == EVP_PKEY_EC) { + *out = ConvertToWebCryptoSignature( + params.key->GetAsymmetricKey(), buf); + } else { + buf.Resize(len); + *out = std::move(buf); + } } break; } @@ -838,17 +865,12 @@ bool SignTraits::DeriveBits( char* data = MallocOpenSSL(1); data[0] = 0; *out = ByteSource::Allocated(data, 1); - if (!EVP_DigestVerifyUpdate( - context.get(), - params.data.data(), - params.data.size())) { - return false; - } - - if (EVP_DigestVerifyFinal( + if (EVP_DigestVerify( context.get(), params.signature.data(), - params.signature.size()) == 1) { + params.signature.size(), + params.data.data(), + params.data.size()) == 1) { data[0] = 1; } } diff --git a/src/crypto/crypto_tls.cc b/src/crypto/crypto_tls.cc index f4850e425f46b3..52e57ab9862021 100644 --- a/src/crypto/crypto_tls.cc +++ b/src/crypto/crypto_tls.cc @@ -1339,8 +1339,6 @@ int TLSWrap::SelectSNIContextCallback(SSL* s, int* ad, void* arg) { return SSL_TLSEXT_ERR_OK; } -#ifndef OPENSSL_NO_PSK - int TLSWrap::SetCACerts(SecureContext* sc) { int err = SSL_set1_verify_cert_store( ssl_.get(), SSL_CTX_get_cert_store(sc->ctx_.get())); @@ -1355,6 +1353,8 @@ int TLSWrap::SetCACerts(SecureContext* sc) { return 1; } +#ifndef OPENSSL_NO_PSK + void TLSWrap::SetPskIdentityHint(const FunctionCallbackInfo& args) { TLSWrap* p; ASSIGN_OR_RETURN_UNWRAP(&p, args.Holder()); 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..0ea91bca877564 --- /dev/null +++ b/src/crypto/crypto_x509.cc @@ -0,0 +1,532 @@ +#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( + BaseObject::kInternalFieldCount); + 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/debug_utils.cc b/src/debug_utils.cc index a601c5ecf40ea9..aa97bfbe943bab 100644 --- a/src/debug_utils.cc +++ b/src/debug_utils.cc @@ -377,7 +377,7 @@ std::vector NativeSymbolDebuggingContext::GetLoadedLibraries() { [](struct dl_phdr_info* info, size_t size, void* data) { auto list = static_cast*>(data); if (*info->dlpi_name != '\0') { - list->push_back(info->dlpi_name); + list->emplace_back(info->dlpi_name); } return 0; }, @@ -386,7 +386,7 @@ std::vector NativeSymbolDebuggingContext::GetLoadedLibraries() { uint32_t i = 0; for (const char* name = _dyld_get_image_name(i); name != nullptr; name = _dyld_get_image_name(++i)) { - list.push_back(name); + list.emplace_back(name); } #elif _AIX @@ -411,10 +411,10 @@ std::vector NativeSymbolDebuggingContext::GetLoadedLibraries() { strlen(cur_info->ldinfo_filename) + 1; if (*member_name != '\0') { str << cur_info->ldinfo_filename << "(" << member_name << ")"; - list.push_back(str.str()); + list.emplace_back(str.str()); str.str(""); } else { - list.push_back(cur_info->ldinfo_filename); + list.emplace_back(cur_info->ldinfo_filename); } buf += cur_info->ldinfo_next; } while (cur_info->ldinfo_next != 0); @@ -424,7 +424,7 @@ std::vector NativeSymbolDebuggingContext::GetLoadedLibraries() { if (dlinfo(RTLD_SELF, RTLD_DI_LINKMAP, &p) != -1) { for (Link_map* l = p; l != nullptr; l = l->l_next) { - list.push_back(l->l_name); + list.emplace_back(l->l_name); } } @@ -459,7 +459,7 @@ std::vector NativeSymbolDebuggingContext::GetLoadedLibraries() { char* str = new char[size]; WideCharToMultiByte( CP_UTF8, 0, module_name, -1, str, size, nullptr, nullptr); - list.push_back(str); + list.emplace_back(str); } } } diff --git a/src/env-inl.h b/src/env-inl.h index cd9f6daaaff758..4cb68e1c5dea8f 100644 --- a/src/env-inl.h +++ b/src/env-inl.h @@ -1024,6 +1024,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 a0d59ff8728deb..6d554f3fcfc04b 100644 --- a/src/env.h +++ b/src/env.h @@ -280,6 +280,7 @@ constexpr size_t kFsStatsBufferLength = V(isclosing_string, "isClosing") \ V(issuer_string, "issuer") \ V(issuercert_string, "issuerCertificate") \ + V(jwk_crv_string, "crv") \ V(jwk_d_string, "d") \ V(jwk_dp_string, "dp") \ V(jwk_dq_string, "dq") \ @@ -294,6 +295,7 @@ constexpr size_t kFsStatsBufferLength = V(jwk_kty_string, "kty") \ V(jwk_n_string, "n") \ V(jwk_oct_string, "oct") \ + V(jwk_okp_string, "OKP") \ V(jwk_rsa_string, "RSA") \ V(jwk_x_string, "x") \ V(jwk_y_string, "y") \ @@ -343,6 +345,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") \ @@ -447,6 +450,7 @@ constexpr size_t kFsStatsBufferLength = V(async_wrap_object_ctor_template, v8::FunctionTemplate) \ V(base_object_ctor_template, v8::FunctionTemplate) \ V(binding_data_ctor_template, v8::FunctionTemplate) \ + V(blob_constructor_template, v8::FunctionTemplate) \ V(blocklist_instance_template, v8::ObjectTemplate) \ V(compiled_fn_entry_template, v8::ObjectTemplate) \ V(dir_instance_template, v8::ObjectTemplate) \ @@ -475,6 +479,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 @@ -1233,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_blob.cc b/src/node_blob.cc new file mode 100644 index 00000000000000..b147b8764a7668 --- /dev/null +++ b/src/node_blob.cc @@ -0,0 +1,337 @@ +#include "node_blob.h" +#include "async_wrap-inl.h" +#include "base_object-inl.h" +#include "env-inl.h" +#include "memory_tracker-inl.h" +#include "node_errors.h" +#include "node_external_reference.h" +#include "threadpoolwork-inl.h" +#include "v8.h" + +#include + +namespace node { + +using v8::Array; +using v8::ArrayBuffer; +using v8::ArrayBufferView; +using v8::BackingStore; +using v8::Context; +using v8::EscapableHandleScope; +using v8::Function; +using v8::FunctionCallbackInfo; +using v8::FunctionTemplate; +using v8::HandleScope; +using v8::Local; +using v8::MaybeLocal; +using v8::Number; +using v8::Object; +using v8::Uint32; +using v8::Undefined; +using v8::Value; + +void Blob::Initialize(Environment* env, v8::Local target) { + env->SetMethod(target, "createBlob", New); + FixedSizeBlobCopyJob::Initialize(env, target); +} + +Local Blob::GetConstructorTemplate(Environment* env) { + Local tmpl = env->blob_constructor_template(); + if (tmpl.IsEmpty()) { + tmpl = FunctionTemplate::New(env->isolate()); + tmpl->InstanceTemplate()->SetInternalFieldCount( + BaseObject::kInternalFieldCount); + tmpl->Inherit(BaseObject::GetConstructorTemplate(env)); + tmpl->SetClassName( + FIXED_ONE_BYTE_STRING(env->isolate(), "Blob")); + env->SetProtoMethod(tmpl, "toArrayBuffer", ToArrayBuffer); + env->SetProtoMethod(tmpl, "slice", ToSlice); + env->set_blob_constructor_template(tmpl); + } + return tmpl; +} + +bool Blob::HasInstance(Environment* env, v8::Local object) { + return GetConstructorTemplate(env)->HasInstance(object); +} + +BaseObjectPtr Blob::Create( + Environment* env, + const std::vector store, + size_t length) { + + HandleScope scope(env->isolate()); + + Local ctor; + if (!GetConstructorTemplate(env)->GetFunction(env->context()).ToLocal(&ctor)) + return BaseObjectPtr(); + + Local obj; + if (!ctor->NewInstance(env->context()).ToLocal(&obj)) + return BaseObjectPtr(); + + return MakeBaseObject(env, obj, store, length); +} + +void Blob::New(const FunctionCallbackInfo& args) { + Environment* env = Environment::GetCurrent(args); + CHECK(args[0]->IsArray()); // sources + CHECK(args[1]->IsUint32()); // length + + std::vector entries; + + size_t length = args[1].As()->Value(); + size_t len = 0; + Local ary = args[0].As(); + for (size_t n = 0; n < ary->Length(); n++) { + Local entry; + if (!ary->Get(env->context(), n).ToLocal(&entry)) + return; + CHECK(entry->IsArrayBufferView() || Blob::HasInstance(env, entry)); + if (entry->IsArrayBufferView()) { + Local view = entry.As(); + CHECK_EQ(view->ByteOffset(), 0); + std::shared_ptr store = view->Buffer()->GetBackingStore(); + size_t byte_length = view->ByteLength(); + view->Buffer()->Detach(); // The Blob will own the backing store now. + entries.emplace_back(BlobEntry{std::move(store), byte_length, 0}); + len += byte_length; + } else { + Blob* blob; + ASSIGN_OR_RETURN_UNWRAP(&blob, entry); + auto source = blob->entries(); + entries.insert(entries.end(), source.begin(), source.end()); + len += blob->length(); + } + } + CHECK_EQ(length, len); + + BaseObjectPtr blob = Create(env, entries, length); + if (blob) + args.GetReturnValue().Set(blob->object()); +} + +void Blob::ToArrayBuffer(const FunctionCallbackInfo& args) { + Environment* env = Environment::GetCurrent(args); + Blob* blob; + ASSIGN_OR_RETURN_UNWRAP(&blob, args.Holder()); + Local ret; + if (blob->GetArrayBuffer(env).ToLocal(&ret)) + args.GetReturnValue().Set(ret); +} + +void Blob::ToSlice(const FunctionCallbackInfo& args) { + Environment* env = Environment::GetCurrent(args); + Blob* blob; + ASSIGN_OR_RETURN_UNWRAP(&blob, args.Holder()); + CHECK(args[0]->IsUint32()); + CHECK(args[1]->IsUint32()); + size_t start = args[0].As()->Value(); + size_t end = args[1].As()->Value(); + BaseObjectPtr slice = blob->Slice(env, start, end); + if (slice) + args.GetReturnValue().Set(slice->object()); +} + +void Blob::MemoryInfo(MemoryTracker* tracker) const { + tracker->TrackFieldWithSize("store", length_); +} + +MaybeLocal Blob::GetArrayBuffer(Environment* env) { + EscapableHandleScope scope(env->isolate()); + size_t len = length(); + std::shared_ptr store = + ArrayBuffer::NewBackingStore(env->isolate(), len); + if (len > 0) { + unsigned char* dest = static_cast(store->Data()); + size_t total = 0; + for (const auto& entry : entries()) { + unsigned char* src = static_cast(entry.store->Data()); + src += entry.offset; + memcpy(dest, src, entry.length); + dest += entry.length; + total += entry.length; + CHECK_LE(total, len); + } + } + + return scope.Escape(ArrayBuffer::New(env->isolate(), store)); +} + +BaseObjectPtr Blob::Slice(Environment* env, size_t start, size_t end) { + CHECK_LE(start, length()); + CHECK_LE(end, length()); + CHECK_LE(start, end); + + std::vector slices; + size_t total = end - start; + size_t remaining = total; + + if (total == 0) return Create(env, slices, 0); + + for (const auto& entry : entries()) { + if (start + entry.offset > entry.store->ByteLength()) { + start -= entry.length; + continue; + } + + size_t offset = entry.offset + start; + size_t len = std::min(remaining, entry.store->ByteLength() - offset); + slices.emplace_back(BlobEntry{entry.store, len, offset}); + + remaining -= len; + start = 0; + + if (remaining == 0) + break; + } + + return Create(env, slices, total); +} + +Blob::Blob( + Environment* env, + v8::Local obj, + const std::vector& store, + size_t length) + : BaseObject(env, obj), + store_(store), + length_(length) { + MakeWeak(); +} + +BaseObjectPtr +Blob::BlobTransferData::Deserialize( + Environment* env, + Local context, + std::unique_ptr self) { + if (context != env->context()) { + THROW_ERR_MESSAGE_TARGET_CONTEXT_UNAVAILABLE(env); + return {}; + } + return Blob::Create(env, store_, length_); +} + +BaseObject::TransferMode Blob::GetTransferMode() const { + return BaseObject::TransferMode::kCloneable; +} + +std::unique_ptr Blob::CloneForMessaging() const { + return std::make_unique(store_, length_); +} + +FixedSizeBlobCopyJob::FixedSizeBlobCopyJob( + Environment* env, + Local object, + Blob* blob, + FixedSizeBlobCopyJob::Mode mode) + : AsyncWrap(env, object, AsyncWrap::PROVIDER_FIXEDSIZEBLOBCOPY), + ThreadPoolWork(env), + mode_(mode) { + if (mode == FixedSizeBlobCopyJob::Mode::SYNC) MakeWeak(); + source_ = blob->entries(); + length_ = blob->length(); +} + +void FixedSizeBlobCopyJob::AfterThreadPoolWork(int status) { + Environment* env = AsyncWrap::env(); + CHECK_EQ(mode_, Mode::ASYNC); + CHECK(status == 0 || status == UV_ECANCELED); + std::unique_ptr ptr(this); + HandleScope handle_scope(env->isolate()); + Context::Scope context_scope(env->context()); + Local args[2]; + + if (status == UV_ECANCELED) { + args[0] = Number::New(env->isolate(), status), + args[1] = Undefined(env->isolate()); + } else { + args[0] = Undefined(env->isolate()); + args[1] = ArrayBuffer::New(env->isolate(), destination_); + } + + ptr->MakeCallback(env->ondone_string(), arraysize(args), args); +} + +void FixedSizeBlobCopyJob::DoThreadPoolWork() { + Environment* env = AsyncWrap::env(); + destination_ = ArrayBuffer::NewBackingStore(env->isolate(), length_); + unsigned char* dest = static_cast(destination_->Data()); + if (length_ > 0) { + size_t total = 0; + for (const auto& entry : source_) { + unsigned char* src = static_cast(entry.store->Data()); + src += entry.offset; + memcpy(dest, src, entry.length); + dest += entry.length; + total += entry.length; + CHECK_LE(total, length_); + } + } +} + +void FixedSizeBlobCopyJob::MemoryInfo(MemoryTracker* tracker) const { + tracker->TrackFieldWithSize("source", length_); + tracker->TrackFieldWithSize( + "destination", + destination_ ? destination_->ByteLength() : 0); +} + +void FixedSizeBlobCopyJob::Initialize(Environment* env, Local target) { + v8::Local job = env->NewFunctionTemplate(New); + job->Inherit(AsyncWrap::GetConstructorTemplate(env)); + job->InstanceTemplate()->SetInternalFieldCount( + AsyncWrap::kInternalFieldCount); + env->SetProtoMethod(job, "run", Run); + env->SetConstructorFunction(target, "FixedSizeBlobCopyJob", job); +} + +void FixedSizeBlobCopyJob::New(const FunctionCallbackInfo& args) { + static constexpr size_t kMaxSyncLength = 4096; + static constexpr size_t kMaxEntryCount = 4; + + Environment* env = Environment::GetCurrent(args); + CHECK(args.IsConstructCall()); + CHECK(args[0]->IsObject()); + CHECK(Blob::HasInstance(env, args[0])); + + Blob* blob; + ASSIGN_OR_RETURN_UNWRAP(&blob, args[0]); + + // This is a fairly arbitrary heuristic. We want to avoid deferring to + // the threadpool if the amount of data being copied is small and there + // aren't that many entries to copy. + FixedSizeBlobCopyJob::Mode mode = + (blob->length() < kMaxSyncLength && + blob->entries().size() < kMaxEntryCount) ? + FixedSizeBlobCopyJob::Mode::SYNC : + FixedSizeBlobCopyJob::Mode::ASYNC; + + new FixedSizeBlobCopyJob(env, args.This(), blob, mode); +} + +void FixedSizeBlobCopyJob::Run(const FunctionCallbackInfo& args) { + Environment* env = Environment::GetCurrent(args); + FixedSizeBlobCopyJob* job; + ASSIGN_OR_RETURN_UNWRAP(&job, args.Holder()); + if (job->mode() == FixedSizeBlobCopyJob::Mode::ASYNC) + return job->ScheduleWork(); + + job->DoThreadPoolWork(); + args.GetReturnValue().Set( + ArrayBuffer::New(env->isolate(), job->destination_)); +} + +void FixedSizeBlobCopyJob::RegisterExternalReferences( + ExternalReferenceRegistry* registry) { + registry->Register(New); + registry->Register(Run); +} + +void Blob::RegisterExternalReferences(ExternalReferenceRegistry* registry) { + registry->Register(Blob::New); + registry->Register(Blob::ToArrayBuffer); + registry->Register(Blob::ToSlice); +} + +} // namespace node diff --git a/src/node_blob.h b/src/node_blob.h new file mode 100644 index 00000000000000..965f65390bdd41 --- /dev/null +++ b/src/node_blob.h @@ -0,0 +1,137 @@ +#ifndef SRC_NODE_BLOB_H_ +#define SRC_NODE_BLOB_H_ + +#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + +#include "async_wrap.h" +#include "base_object.h" +#include "env.h" +#include "memory_tracker.h" +#include "node_internals.h" +#include "node_worker.h" +#include "v8.h" + +#include + +namespace node { + +struct BlobEntry { + std::shared_ptr store; + size_t length; + size_t offset; +}; + +class Blob : public BaseObject { + public: + static void RegisterExternalReferences( + ExternalReferenceRegistry* registry); + static void Initialize(Environment* env, v8::Local target); + + static void New(const v8::FunctionCallbackInfo& args); + static void ToArrayBuffer(const v8::FunctionCallbackInfo& args); + static void ToSlice(const v8::FunctionCallbackInfo& args); + + static v8::Local GetConstructorTemplate( + Environment* env); + + static BaseObjectPtr Create( + Environment* env, + const std::vector store, + size_t length); + + static bool HasInstance(Environment* env, v8::Local object); + + const std::vector entries() const { + return store_; + } + + void MemoryInfo(MemoryTracker* tracker) const override; + SET_MEMORY_INFO_NAME(Blob); + SET_SELF_SIZE(Blob); + + // Copies the contents of the Blob into an ArrayBuffer. + v8::MaybeLocal GetArrayBuffer(Environment* env); + + BaseObjectPtr Slice(Environment* env, size_t start, size_t end); + + inline size_t length() const { return length_; } + + class BlobTransferData : public worker::TransferData { + public: + explicit BlobTransferData( + const std::vector& store, + size_t length) + : store_(store), + length_(length) {} + + BaseObjectPtr Deserialize( + Environment* env, + v8::Local context, + std::unique_ptr self) override; + + SET_MEMORY_INFO_NAME(BlobTransferData) + SET_SELF_SIZE(BlobTransferData) + SET_NO_MEMORY_INFO() + + private: + std::vector store_; + size_t length_ = 0; + }; + + BaseObject::TransferMode GetTransferMode() const override; + std::unique_ptr CloneForMessaging() const override; + + Blob( + Environment* env, + v8::Local obj, + const std::vector& store, + size_t length); + + private: + std::vector store_; + size_t length_ = 0; +}; + +class FixedSizeBlobCopyJob : public AsyncWrap, public ThreadPoolWork { + public: + enum class Mode { + SYNC, + ASYNC + }; + + static void RegisterExternalReferences( + ExternalReferenceRegistry* registry); + static void Initialize(Environment* env, v8::Local target); + static void New(const v8::FunctionCallbackInfo& args); + static void Run(const v8::FunctionCallbackInfo& args); + + bool IsNotIndicativeOfMemoryLeakAtExit() const override { + return true; + } + + void DoThreadPoolWork() override; + void AfterThreadPoolWork(int status) override; + + Mode mode() const { return mode_; } + + void MemoryInfo(MemoryTracker* tracker) const override; + SET_MEMORY_INFO_NAME(FixedSizeBlobCopyJob) + SET_SELF_SIZE(FixedSizeBlobCopyJob) + + private: + FixedSizeBlobCopyJob( + Environment* env, + v8::Local object, + Blob* blob, + Mode mode = Mode::ASYNC); + + Mode mode_; + std::vector source_; + std::shared_ptr destination_; + size_t length_ = 0; +}; + +} // namespace node + +#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS +#endif // SRC_NODE_BLOB_H_ diff --git a/src/node_buffer.cc b/src/node_buffer.cc index 77efa7bae2fea5..485e273f2fbe9e 100644 --- a/src/node_buffer.cc +++ b/src/node_buffer.cc @@ -22,6 +22,7 @@ #include "node_buffer.h" #include "allocated_buffer-inl.h" #include "node.h" +#include "node_blob.h" #include "node_errors.h" #include "node_external_reference.h" #include "node_internals.h" @@ -1184,6 +1185,7 @@ void Initialize(Local target, env->SetMethodNoSideEffect(target, "asciiSlice", StringSlice); env->SetMethodNoSideEffect(target, "base64Slice", StringSlice); + env->SetMethodNoSideEffect(target, "base64urlSlice", StringSlice); env->SetMethodNoSideEffect(target, "latin1Slice", StringSlice); env->SetMethodNoSideEffect(target, "hexSlice", StringSlice); env->SetMethodNoSideEffect(target, "ucs2Slice", StringSlice); @@ -1191,12 +1193,15 @@ void Initialize(Local target, env->SetMethod(target, "asciiWrite", StringWrite); env->SetMethod(target, "base64Write", StringWrite); + env->SetMethod(target, "base64urlWrite", StringWrite); env->SetMethod(target, "latin1Write", StringWrite); env->SetMethod(target, "hexWrite", StringWrite); env->SetMethod(target, "ucs2Write", StringWrite); env->SetMethod(target, "utf8Write", StringWrite); env->SetMethod(target, "getZeroFillToggle", GetZeroFillToggle); + + Blob::Initialize(env, target); } } // anonymous namespace @@ -1223,6 +1228,7 @@ void RegisterExternalReferences(ExternalReferenceRegistry* registry) { registry->Register(StringSlice); registry->Register(StringSlice); + registry->Register(StringSlice); registry->Register(StringSlice); registry->Register(StringSlice); registry->Register(StringSlice); @@ -1230,11 +1236,15 @@ void RegisterExternalReferences(ExternalReferenceRegistry* registry) { registry->Register(StringWrite); registry->Register(StringWrite); + registry->Register(StringWrite); registry->Register(StringWrite); registry->Register(StringWrite); registry->Register(StringWrite); registry->Register(StringWrite); registry->Register(GetZeroFillToggle); + + Blob::RegisterExternalReferences(registry); + FixedSizeBlobCopyJob::RegisterExternalReferences(registry); } } // namespace Buffer 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 6e32ec28b6a2ed..edf55e8766b84b 100644 --- a/src/node_file.cc +++ b/src/node_file.cc @@ -51,6 +51,7 @@ namespace node { namespace fs { using v8::Array; +using v8::BigInt; using v8::Boolean; using v8::Context; using v8::EscapableHandleScope; @@ -1832,8 +1833,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); @@ -2038,8 +2039,10 @@ static void Read(const FunctionCallbackInfo& args) { const size_t len = static_cast(args[3].As()->Value()); CHECK(Buffer::IsWithinBounds(off, len, buffer_length)); - CHECK(IsSafeJsInt(args[4])); - const int64_t pos = args[4].As()->Value(); + CHECK(IsSafeJsInt(args[4]) || args[4]->IsBigInt()); + const int64_t pos = args[4]->IsNumber() ? + args[4].As()->Value() : + args[4].As()->Int64Value(); char* buf = buffer_data + off; uv_buf_t uvbuf = uv_buf_init(buf, len); @@ -2471,13 +2474,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 +2505,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_os.cc b/src/node_os.cc index 2e151ac4f89213..3cde80996f095f 100644 --- a/src/node_os.cc +++ b/src/node_os.cc @@ -112,16 +112,17 @@ static void GetCPUInfo(const FunctionCallbackInfo& args) { // assemble them into objects in JS than to call Object::Set() repeatedly // The array is in the format // [model, speed, (5 entries of cpu_times), model2, speed2, ...] - std::vector> result(count * 7); - for (int i = 0, j = 0; i < count; i++) { + std::vector> result; + result.reserve(count * 7); + for (int i = 0; i < count; i++) { uv_cpu_info_t* ci = cpu_infos + i; - result[j++] = OneByteString(isolate, ci->model); - result[j++] = Number::New(isolate, ci->speed); - result[j++] = Number::New(isolate, ci->cpu_times.user); - result[j++] = Number::New(isolate, ci->cpu_times.nice); - result[j++] = Number::New(isolate, ci->cpu_times.sys); - result[j++] = Number::New(isolate, ci->cpu_times.idle); - result[j++] = Number::New(isolate, ci->cpu_times.irq); + result.emplace_back(OneByteString(isolate, ci->model)); + result.emplace_back(Number::New(isolate, ci->speed)); + result.emplace_back(Number::New(isolate, ci->cpu_times.user)); + result.emplace_back(Number::New(isolate, ci->cpu_times.nice)); + result.emplace_back(Number::New(isolate, ci->cpu_times.sys)); + result.emplace_back(Number::New(isolate, ci->cpu_times.idle)); + result.emplace_back(Number::New(isolate, ci->cpu_times.irq)); } uv_free_cpu_info(cpu_infos, count); @@ -182,7 +183,8 @@ static void GetInterfaceAddresses(const FunctionCallbackInfo& args) { } Local no_scope_id = Integer::New(isolate, -1); - std::vector> result(count * 7); + std::vector> result; + result.reserve(count * 7); for (i = 0; i < count; i++) { const char* const raw_name = interfaces[i].name; @@ -216,18 +218,18 @@ static void GetInterfaceAddresses(const FunctionCallbackInfo& args) { family = env->unknown_string(); } - result[i * 7] = name; - result[i * 7 + 1] = OneByteString(isolate, ip); - result[i * 7 + 2] = OneByteString(isolate, netmask); - result[i * 7 + 3] = family; - result[i * 7 + 4] = FIXED_ONE_BYTE_STRING(isolate, mac); - result[i * 7 + 5] = - interfaces[i].is_internal ? True(isolate) : False(isolate); + result.emplace_back(name); + result.emplace_back(OneByteString(isolate, ip)); + result.emplace_back(OneByteString(isolate, netmask)); + result.emplace_back(family); + result.emplace_back(FIXED_ONE_BYTE_STRING(isolate, mac)); + result.emplace_back( + interfaces[i].is_internal ? True(isolate) : False(isolate)); if (interfaces[i].address.address4.sin_family == AF_INET6) { uint32_t scopeid = interfaces[i].address.address6.sin6_scope_id; - result[i * 7 + 6] = Integer::NewFromUnsigned(isolate, scopeid); + result.emplace_back(Integer::NewFromUnsigned(isolate, scopeid)); } else { - result[i * 7 + 6] = no_scope_id; + result.emplace_back(no_scope_id); } } 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 b51d315989ce71..879253f9bc2ebc 100644 --- a/src/node_serdes.cc +++ b/src/node_serdes.cc @@ -475,13 +475,8 @@ void Initialize(Local target, "_setTreatArrayBufferViewsAsHostObjects", SerializerContext::SetTreatArrayBufferViewsAsHostObjects); - Local serializerString = - FIXED_ONE_BYTE_STRING(env->isolate(), "Serializer"); - ser->SetClassName(serializerString); ser->ReadOnlyPrototype(); - target->Set(env->context(), - serializerString, - ser->GetFunction(env->context()).ToLocalChecked()).Check(); + env->SetConstructorFunction(target, "Serializer", ser); Local des = env->NewFunctionTemplate(DeserializerContext::New); @@ -503,14 +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->SetLength(1); des->ReadOnlyPrototype(); - des->SetClassName(deserializerString); - target->Set(env->context(), - deserializerString, - des->GetFunction(env->context()).ToLocalChecked()).Check(); + 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_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_base-inl.h b/src/stream_base-inl.h index c003ffc1ef6595..c1590cc957e230 100644 --- a/src/stream_base-inl.h +++ b/src/stream_base-inl.h @@ -137,8 +137,11 @@ int StreamBase::Shutdown(v8::Local req_wrap_obj) { StreamReq::ResetObject(req_wrap_obj); } + BaseObjectPtr req_wrap_ptr; AsyncHooks::DefaultTriggerAsyncIdScope trigger_scope(GetAsyncWrap()); ShutdownWrap* req_wrap = CreateShutdownWrap(req_wrap_obj); + if (req_wrap != nullptr) + req_wrap_ptr.reset(req_wrap->GetAsyncWrap()); int err = DoShutdown(req_wrap); if (err != 0 && req_wrap != nullptr) { @@ -172,7 +175,7 @@ StreamWriteResult StreamBase::Write( if (send_handle == nullptr) { err = DoTryWrite(&bufs, &count); if (err != 0 || count == 0) { - return StreamWriteResult { false, err, nullptr, total_bytes }; + return StreamWriteResult { false, err, nullptr, total_bytes, {} }; } } @@ -182,13 +185,14 @@ StreamWriteResult StreamBase::Write( if (!env->write_wrap_template() ->NewInstance(env->context()) .ToLocal(&req_wrap_obj)) { - return StreamWriteResult { false, UV_EBUSY, nullptr, 0 }; + return StreamWriteResult { false, UV_EBUSY, nullptr, 0, {} }; } StreamReq::ResetObject(req_wrap_obj); } AsyncHooks::DefaultTriggerAsyncIdScope trigger_scope(GetAsyncWrap()); WriteWrap* req_wrap = CreateWriteWrap(req_wrap_obj); + BaseObjectPtr req_wrap_ptr(req_wrap->GetAsyncWrap()); err = DoWrite(req_wrap, bufs, count, send_handle); bool async = err == 0; @@ -206,7 +210,8 @@ StreamWriteResult StreamBase::Write( ClearError(); } - return StreamWriteResult { async, err, req_wrap, total_bytes }; + return StreamWriteResult { + async, err, req_wrap, total_bytes, std::move(req_wrap_ptr) }; } template diff --git a/src/stream_base.cc b/src/stream_base.cc index 3ad201746007dc..87781efb0e8111 100644 --- a/src/stream_base.cc +++ b/src/stream_base.cc @@ -265,7 +265,7 @@ int StreamBase::WriteString(const FunctionCallbackInfo& args) { // Immediate failure or success if (err != 0 || count == 0) { - SetWriteResult(StreamWriteResult { false, err, nullptr, data_size }); + SetWriteResult(StreamWriteResult { false, err, nullptr, data_size, {} }); return err; } diff --git a/src/stream_base.h b/src/stream_base.h index 21765a5b7667f3..a5680ba8860d49 100644 --- a/src/stream_base.h +++ b/src/stream_base.h @@ -25,6 +25,7 @@ struct StreamWriteResult { int err; WriteWrap* wrap; size_t bytes; + BaseObjectPtr wrap_obj; }; using JSMethodFunction = void(const v8::FunctionCallbackInfo& args); 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..a915f5744f3b00 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, @@ -63,7 +70,10 @@ MaybeLocal StringDecoder::DecodeData(Isolate* isolate, size_t nread = *nread_ptr; - if (Encoding() == UTF8 || Encoding() == UCS2 || Encoding() == BASE64) { + if (Encoding() == UTF8 || + Encoding() == UCS2 || + Encoding() == BASE64 || + Encoding() == BASE64URL) { // See if we want bytes to finish a character from the previous // chunk; if so, copy the new bytes to the missing bytes buffer // and create a small string from it that is to be prepended to the @@ -191,7 +201,7 @@ MaybeLocal StringDecoder::DecodeData(Isolate* isolate, state_[kBufferedBytes] = 2; state_[kMissingBytes] = 2; } - } else if (Encoding() == BASE64) { + } else if (Encoding() == BASE64 || Encoding() == BASE64URL) { state_[kBufferedBytes] = nread % 3; if (state_[kBufferedBytes] > 0) state_[kMissingBytes] = 3 - BufferedBytes(); @@ -304,6 +314,7 @@ void InitializeStringDecoder(Local target, ADD_TO_ENCODINGS_ARRAY(ASCII, "ascii"); ADD_TO_ENCODINGS_ARRAY(UTF8, "utf8"); ADD_TO_ENCODINGS_ARRAY(BASE64, "base64"); + ADD_TO_ENCODINGS_ARRAY(BASE64URL, "base64url"); ADD_TO_ENCODINGS_ARRAY(UCS2, "utf16le"); ADD_TO_ENCODINGS_ARRAY(HEX, "hex"); ADD_TO_ENCODINGS_ARRAY(BUFFER, "buffer"); 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/abort/abort.status b/test/abort/abort.status new file mode 100644 index 00000000000000..e56c24ff433d63 --- /dev/null +++ b/test/abort/abort.status @@ -0,0 +1,11 @@ +prefix abort + +# To mark a test as flaky, list the test name in the appropriate section +# below, without ".js", followed by ": PASS,FLAKY". Example: +# sample-test : PASS,FLAKY + +[true] # This section applies to all platforms + +[$system==ibmi] +# https://github.com/nodejs/node/issues/34410 +test-addon-register-signal-handler: PASS,FLAKY diff --git a/test/addons/addon.status b/test/addons/addon.status index 951cddc48465d1..b56e0aa461cc36 100644 --- a/test/addons/addon.status +++ b/test/addons/addon.status @@ -13,3 +13,5 @@ openssl-binding/test: PASS,FLAKY [$system==ibmi] openssl-binding/test: SKIP zlib-binding/test: SKIP +# https://github.com/nodejs/node/issues/34410 +register-signal-handler/test: PASS,FLAKY diff --git a/test/addons/parse-encoding/binding.cc b/test/addons/parse-encoding/binding.cc index cdbd8e44466db8..7fae5bf4bdb61c 100644 --- a/test/addons/parse-encoding/binding.cc +++ b/test/addons/parse-encoding/binding.cc @@ -6,6 +6,7 @@ namespace { #define ENCODING_MAP(V) \ V(ASCII) \ V(BASE64) \ + V(BASE64URL) \ V(BUFFER) \ V(HEX) \ V(LATIN1) \ diff --git a/test/addons/parse-encoding/test.js b/test/addons/parse-encoding/test.js index 1456115a926f3e..da52f2dc4248af 100644 --- a/test/addons/parse-encoding/test.js +++ b/test/addons/parse-encoding/test.js @@ -8,6 +8,7 @@ assert.strictEqual(parseEncoding(''), 'UNKNOWN'); assert.strictEqual(parseEncoding('ascii'), 'ASCII'); assert.strictEqual(parseEncoding('base64'), 'BASE64'); +assert.strictEqual(parseEncoding('base64url'), 'BASE64URL'); assert.strictEqual(parseEncoding('binary'), 'LATIN1'); assert.strictEqual(parseEncoding('buffer'), 'BUFFER'); assert.strictEqual(parseEncoding('hex'), 'HEX'); diff --git a/test/async-hooks/test-callback-error.js b/test/async-hooks/test-callback-error.js index 8bbed364980f2b..e8e255a7cf96c9 100644 --- a/test/async-hooks/test-callback-error.js +++ b/test/async-hooks/test-callback-error.js @@ -30,7 +30,7 @@ switch (arg) { return; } -// This part should run only for the master test +// This part should run only for the primary test assert.ok(!arg); { // console.log should stay until this test's flakiness is solved @@ -75,7 +75,7 @@ assert.ok(!arg); assert.strictEqual(child.status, null); // Most posix systems will show 'SIGABRT', but alpine34 does not if (child.signal !== 'SIGABRT') { - console.log(`parent received signal ${child.signal}\nchild's stderr:`); + console.log(`primary received signal ${child.signal}\nchild's stderr:`); console.log(child.stderr); process.exit(1); } diff --git a/test/cctest/test_environment.cc b/test/cctest/test_environment.cc index d24ff93cc74645..e2931337bf6a40 100644 --- a/test/cctest/test_environment.cc +++ b/test/cctest/test_environment.cc @@ -1,6 +1,7 @@ #include "node_buffer.h" #include "node_internals.h" #include "libplatform/libplatform.h" +#include "util.h" #include #include "gtest/gtest.h" @@ -10,6 +11,7 @@ using node::AtExit; using node::RunAtExit; +using node::USE; static bool called_cb_1 = false; static bool called_cb_2 = false; @@ -74,7 +76,7 @@ class RedirectStdErr { fflush(stderr); fgetpos(stderr, &pos_); fd_ = dup(fileno(stderr)); - freopen(filename_, "w", stderr); + USE(freopen(filename_, "w", stderr)); } ~RedirectStdErr() { 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/common/index.js b/test/common/index.js index 39caa1b6b68bae..b8ffc9dbff939d 100644 --- a/test/common/index.js +++ b/test/common/index.js @@ -61,7 +61,7 @@ if (process.argv.length === 2 && isMainThread && hasCrypto && require.main && - require('cluster').isMaster) { + require('cluster').isPrimary) { // The copyright notice is relatively big and the flags could come afterwards. const bytesToRead = 1500; const buffer = Buffer.allocUnsafe(bytesToRead); diff --git a/test/common/tls.js b/test/common/tls.js index e7cacde7456707..5094755c240afd 100644 --- a/test/common/tls.js +++ b/test/common/tls.js @@ -15,9 +15,9 @@ class TestTLSSocket extends net.Socket { this.handshake_list = []; // AES128-GCM-SHA256 this.ciphers = Buffer.from('000002009c0', 'hex'); - this.pre_master_secret = + this.pre_primary_secret = Buffer.concat([this.version, crypto.randomBytes(46)]); - this.master_secret = null; + this.primary_secret = null; this.write_seq = 0; this.client_random = crypto.randomBytes(32); @@ -26,12 +26,12 @@ class TestTLSSocket extends net.Socket { }); this.on('server_random', (server_random) => { - this.master_secret = PRF12('sha256', this.pre_master_secret, - 'master secret', - Buffer.concat([this.client_random, - server_random]), - 48); - const key_block = PRF12('sha256', this.master_secret, + this.primary_secret = PRF12('sha256', this.pre_primary_secret, + 'primary secret', + Buffer.concat([this.client_random, + server_random]), + 48); + const key_block = PRF12('sha256', this.primary_secret, 'key expansion', Buffer.concat([server_random, this.client_random]), @@ -51,14 +51,14 @@ class TestTLSSocket extends net.Socket { } createClientKeyExchange() { - const encrypted_pre_master_secret = crypto.publicEncrypt({ + const encrypted_pre_primary_secret = crypto.publicEncrypt({ key: this.server_cert, padding: crypto.constants.RSA_PKCS1_PADDING - }, this.pre_master_secret); + }, this.pre_primary_secret); const length = Buffer.alloc(2); - length.writeUIntBE(encrypted_pre_master_secret.length, 0, 2); + length.writeUIntBE(encrypted_pre_primary_secret.length, 0, 2); const msg = addHandshakeHeader(0x10, Buffer.concat([ - length, encrypted_pre_master_secret])); + length, encrypted_pre_primary_secret])); this.emit('handshake', msg); return addRecordHeader(0x16, msg); } @@ -67,7 +67,7 @@ class TestTLSSocket extends net.Socket { const shasum = crypto.createHash('sha256'); shasum.update(Buffer.concat(this.handshake_list)); const message_hash = shasum.digest(); - const r = PRF12('sha256', this.master_secret, + const r = PRF12('sha256', this.primary_secret, 'client finished', message_hash, 12); const msg = addHandshakeHeader(0x14, r); this.emit('handshake', msg); diff --git a/test/es-module/test-esm-dynamic-import.js b/test/es-module/test-esm-dynamic-import.js index 6f8757da1b914e..6e64f86423c66b 100644 --- a/test/es-module/test-esm-dynamic-import.js +++ b/test/es-module/test-esm-dynamic-import.js @@ -1,7 +1,6 @@ 'use strict'; const common = require('../common'); const assert = require('assert'); -const { URL } = require('url'); const relativePath = '../fixtures/es-modules/test-esm-ok.mjs'; const absolutePath = require.resolve('../fixtures/es-modules/test-esm-ok.mjs'); diff --git a/test/es-module/test-esm-loader-modulemap.js b/test/es-module/test-esm-loader-modulemap.js index a4d56a2c2fda1c..2d74cd385be52b 100644 --- a/test/es-module/test-esm-loader-modulemap.js +++ b/test/es-module/test-esm-loader-modulemap.js @@ -7,7 +7,6 @@ require('../common'); const assert = require('assert'); -const { URL } = require('url'); const { Loader } = require('internal/modules/esm/loader'); const ModuleMap = require('internal/modules/esm/module_map'); const ModuleJob = require('internal/modules/esm/module_job'); 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/cluster-preload-test.js b/test/fixtures/cluster-preload-test.js index 570cb83bdc496e..8c5f9ce32350e9 100644 --- a/test/fixtures/cluster-preload-test.js +++ b/test/fixtures/cluster-preload-test.js @@ -1,5 +1,5 @@ const cluster = require('cluster'); -if (cluster.isMaster) { +if (cluster.isPrimary) { cluster.fork(); // one child cluster.on('exit', function(worker, code, signal) { console.log(`worker terminated with code ${code}`); diff --git a/test/fixtures/cluster-preload.js b/test/fixtures/cluster-preload.js index bb38793b65d7de..077f91cdad451e 100644 --- a/test/fixtures/cluster-preload.js +++ b/test/fixtures/cluster-preload.js @@ -8,5 +8,5 @@ const expectedPaths = require('module')._nodeModulePaths(process.cwd()); assert.deepStrictEqual(module.parent.paths, expectedPaths); const cluster = require('cluster'); -cluster.isMaster || process.exit(42 + cluster.worker.id); // +42 to distinguish +cluster.isPrimary || process.exit(42 + cluster.worker.id); // +42 to distinguish // from exit(1) for other random reasons diff --git a/test/fixtures/clustered-server/app.js b/test/fixtures/clustered-server/app.js index 16ac62fca847dc..72e609c120844c 100644 --- a/test/fixtures/clustered-server/app.js +++ b/test/fixtures/clustered-server/app.js @@ -10,7 +10,7 @@ function handleRequest(request, response) { const NUMBER_OF_WORKERS = 2; var workersOnline = 0; -if (cluster.isMaster) { +if (cluster.isPrimary) { cluster.on('online', function() { if (++workersOnline === NUMBER_OF_WORKERS) { console.error('all workers are running'); 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/FileAPI/BlobURL/support/file_test2.txt b/test/fixtures/wpt/FileAPI/BlobURL/support/file_test2.txt new file mode 100644 index 00000000000000..e69de29bb2d1d6 diff --git a/test/fixtures/wpt/FileAPI/BlobURL/test2-manual.html b/test/fixtures/wpt/FileAPI/BlobURL/test2-manual.html new file mode 100644 index 00000000000000..07fb27ef8af10b --- /dev/null +++ b/test/fixtures/wpt/FileAPI/BlobURL/test2-manual.html @@ -0,0 +1,62 @@ + + + + + Blob and File reference URL Test(2) + + + + + + +
+
+
+ +
+

Test steps:

+
    +
  1. Download the file.
  2. +
  3. Select the file in the file inputbox.
  4. +
  5. Delete the file.
  6. +
  7. Click the 'start' button.
  8. +
+
+ +
+ + + + diff --git a/test/fixtures/wpt/FileAPI/FileReader/progress_event_bubbles_cancelable.html b/test/fixtures/wpt/FileAPI/FileReader/progress_event_bubbles_cancelable.html new file mode 100644 index 00000000000000..6a03243f934081 --- /dev/null +++ b/test/fixtures/wpt/FileAPI/FileReader/progress_event_bubbles_cancelable.html @@ -0,0 +1,33 @@ + + +File API Test: Progress Event - bubbles, cancelable + + + + +
+ + diff --git a/test/fixtures/wpt/FileAPI/FileReader/support/file_test1.txt b/test/fixtures/wpt/FileAPI/FileReader/support/file_test1.txt new file mode 100644 index 00000000000000..e69de29bb2d1d6 diff --git a/test/fixtures/wpt/FileAPI/FileReader/test_errors-manual.html b/test/fixtures/wpt/FileAPI/FileReader/test_errors-manual.html new file mode 100644 index 00000000000000..b8c3f84d2bf23a --- /dev/null +++ b/test/fixtures/wpt/FileAPI/FileReader/test_errors-manual.html @@ -0,0 +1,72 @@ + + + + + FileReader Errors Test + + + + + + +
+
+
+ +
+

Test steps:

+
    +
  1. Download the file.
  2. +
  3. Select the file in the file inputbox.
  4. +
  5. Delete the file.
  6. +
  7. Click the 'start' button.
  8. +
+
+ +
+ + + + diff --git a/test/fixtures/wpt/FileAPI/FileReader/test_notreadableerrors-manual.html b/test/fixtures/wpt/FileAPI/FileReader/test_notreadableerrors-manual.html new file mode 100644 index 00000000000000..46d73598a0f91a --- /dev/null +++ b/test/fixtures/wpt/FileAPI/FileReader/test_notreadableerrors-manual.html @@ -0,0 +1,42 @@ + + +FileReader NotReadableError Test + + + + +
+
+
+ +
+

Test steps:

+
    +
  1. Download the file.
  2. +
  3. Select the file in the file inputbox.
  4. +
  5. Delete the file's readable permission.
  6. +
  7. Click the 'start' button.
  8. +
+
+ + + diff --git a/test/fixtures/wpt/FileAPI/FileReader/test_securityerrors-manual.html b/test/fixtures/wpt/FileAPI/FileReader/test_securityerrors-manual.html new file mode 100644 index 00000000000000..add93ed69d139a --- /dev/null +++ b/test/fixtures/wpt/FileAPI/FileReader/test_securityerrors-manual.html @@ -0,0 +1,40 @@ + + +FileReader SecurityError Test + + + + +
+
+
+ +
+

Test steps:

+
    +
  1. Select a system sensitive file (e.g. files in /usr/bin, password files, + and other native operating system executables) in the file inputbox.
  2. +
  3. Click the 'start' button.
  4. +
+
+ + diff --git a/test/fixtures/wpt/FileAPI/FileReader/workers.html b/test/fixtures/wpt/FileAPI/FileReader/workers.html new file mode 100644 index 00000000000000..8e114eeaf86ff5 --- /dev/null +++ b/test/fixtures/wpt/FileAPI/FileReader/workers.html @@ -0,0 +1,27 @@ + + + + + diff --git a/test/fixtures/wpt/FileAPI/FileReaderSync.worker.js b/test/fixtures/wpt/FileAPI/FileReaderSync.worker.js new file mode 100644 index 00000000000000..3d7a0222f31266 --- /dev/null +++ b/test/fixtures/wpt/FileAPI/FileReaderSync.worker.js @@ -0,0 +1,56 @@ +importScripts("/resources/testharness.js"); + +var blob, empty_blob, readerSync; +setup(() => { + readerSync = new FileReaderSync(); + blob = new Blob(["test"]); + empty_blob = new Blob(); +}); + +test(() => { + assert_true(readerSync instanceof FileReaderSync); +}, "Interface"); + +test(() => { + var text = readerSync.readAsText(blob); + assert_equals(text, "test"); +}, "readAsText"); + +test(() => { + var text = readerSync.readAsText(empty_blob); + assert_equals(text, ""); +}, "readAsText with empty blob"); + +test(() => { + var data = readerSync.readAsDataURL(blob); + assert_equals(data.indexOf("data:"), 0); +}, "readAsDataURL"); + +test(() => { + var data = readerSync.readAsDataURL(empty_blob); + assert_equals(data.indexOf("data:"), 0); +}, "readAsDataURL with empty blob"); + +test(() => { + var data = readerSync.readAsBinaryString(blob); + assert_equals(data, "test"); +}, "readAsBinaryString"); + +test(() => { + var data = readerSync.readAsBinaryString(empty_blob); + assert_equals(data, ""); +}, "readAsBinaryString with empty blob"); + +test(() => { + var data = readerSync.readAsArrayBuffer(blob); + assert_true(data instanceof ArrayBuffer); + assert_equals(data.byteLength, "test".length); +}, "readAsArrayBuffer"); + +test(() => { + var data = readerSync.readAsArrayBuffer(empty_blob); + assert_true(data instanceof ArrayBuffer); + assert_equals(data.byteLength, 0); +}, "readAsArrayBuffer with empty blob"); + +done(); diff --git a/test/fixtures/wpt/FileAPI/META.yml b/test/fixtures/wpt/FileAPI/META.yml new file mode 100644 index 00000000000000..506a59fec1eb33 --- /dev/null +++ b/test/fixtures/wpt/FileAPI/META.yml @@ -0,0 +1,6 @@ +spec: https://w3c.github.io/FileAPI/ +suggested_reviewers: + - inexorabletash + - zqzhang + - jdm + - mkruisselbrink diff --git a/test/fixtures/wpt/FileAPI/blob/Blob-array-buffer.any.js b/test/fixtures/wpt/FileAPI/blob/Blob-array-buffer.any.js new file mode 100644 index 00000000000000..2310646e5fdeab --- /dev/null +++ b/test/fixtures/wpt/FileAPI/blob/Blob-array-buffer.any.js @@ -0,0 +1,45 @@ +// META: title=Blob Array Buffer +// META: script=../support/Blob.js +'use strict'; + +promise_test(async () => { + const input_arr = new TextEncoder().encode("PASS"); + const blob = new Blob([input_arr]); + const array_buffer = await blob.arrayBuffer(); + assert_true(array_buffer instanceof ArrayBuffer); + assert_equals_typed_array(new Uint8Array(array_buffer), input_arr); +}, "Blob.arrayBuffer()") + +promise_test(async () => { + const input_arr = new TextEncoder().encode(""); + const blob = new Blob([input_arr]); + const array_buffer = await blob.arrayBuffer(); + assert_true(array_buffer instanceof ArrayBuffer); + assert_equals_typed_array(new Uint8Array(array_buffer), input_arr); +}, "Blob.arrayBuffer() empty Blob data") + +promise_test(async () => { + const input_arr = new TextEncoder().encode("\u08B8\u000a"); + const blob = new Blob([input_arr]); + const array_buffer = await blob.arrayBuffer(); + assert_equals_typed_array(new Uint8Array(array_buffer), input_arr); +}, "Blob.arrayBuffer() non-ascii input") + +promise_test(async () => { + const input_arr = [8, 241, 48, 123, 151]; + const typed_arr = new Uint8Array(input_arr); + const blob = new Blob([typed_arr]); + const array_buffer = await blob.arrayBuffer(); + assert_equals_typed_array(new Uint8Array(array_buffer), typed_arr); +}, "Blob.arrayBuffer() non-unicode input") + +promise_test(async () => { + const input_arr = new TextEncoder().encode("PASS"); + const blob = new Blob([input_arr]); + const array_buffer_results = await Promise.all([blob.arrayBuffer(), + blob.arrayBuffer(), blob.arrayBuffer()]); + for (let array_buffer of array_buffer_results) { + assert_true(array_buffer instanceof ArrayBuffer); + assert_equals_typed_array(new Uint8Array(array_buffer), input_arr); + } +}, "Blob.arrayBuffer() concurrent reads") diff --git a/test/fixtures/wpt/FileAPI/blob/Blob-constructor-endings.html b/test/fixtures/wpt/FileAPI/blob/Blob-constructor-endings.html new file mode 100644 index 00000000000000..04edd2a303b135 --- /dev/null +++ b/test/fixtures/wpt/FileAPI/blob/Blob-constructor-endings.html @@ -0,0 +1,104 @@ + + +Blob constructor: endings option + + + + diff --git a/test/fixtures/wpt/FileAPI/blob/Blob-constructor.html b/test/fixtures/wpt/FileAPI/blob/Blob-constructor.html new file mode 100644 index 00000000000000..62a649aed66418 --- /dev/null +++ b/test/fixtures/wpt/FileAPI/blob/Blob-constructor.html @@ -0,0 +1,501 @@ + + +Blob constructor + + + + + + + +
+ diff --git a/test/fixtures/wpt/FileAPI/blob/Blob-in-worker.worker.js b/test/fixtures/wpt/FileAPI/blob/Blob-in-worker.worker.js new file mode 100644 index 00000000000000..a67060e7b85eff --- /dev/null +++ b/test/fixtures/wpt/FileAPI/blob/Blob-in-worker.worker.js @@ -0,0 +1,14 @@ +importScripts("/resources/testharness.js"); + +async_test(function() { + var data = "TEST"; + var blob = new Blob([data], {type: "text/plain"}); + var reader = new FileReader(); + reader.onload = this.step_func_done(function() { + assert_equals(reader.result, data); + }); + reader.onerror = this.unreached_func("Unexpected error event"); + reader.readAsText(blob); +}, "Create Blob in Worker"); + +done(); diff --git a/test/fixtures/wpt/FileAPI/blob/Blob-slice-overflow.html b/test/fixtures/wpt/FileAPI/blob/Blob-slice-overflow.html new file mode 100644 index 00000000000000..74cd83a34f7116 --- /dev/null +++ b/test/fixtures/wpt/FileAPI/blob/Blob-slice-overflow.html @@ -0,0 +1,42 @@ + + +Blob slice overflow + + + + +
+ + diff --git a/test/fixtures/wpt/FileAPI/blob/Blob-slice.html b/test/fixtures/wpt/FileAPI/blob/Blob-slice.html new file mode 100644 index 00000000000000..03fe6ca5343bd1 --- /dev/null +++ b/test/fixtures/wpt/FileAPI/blob/Blob-slice.html @@ -0,0 +1,238 @@ + + +Blob slice + + + + + +
+ diff --git a/test/fixtures/wpt/FileAPI/blob/Blob-stream.any.js b/test/fixtures/wpt/FileAPI/blob/Blob-stream.any.js new file mode 100644 index 00000000000000..792b6639c35a26 --- /dev/null +++ b/test/fixtures/wpt/FileAPI/blob/Blob-stream.any.js @@ -0,0 +1,72 @@ +// META: title=Blob Stream +// META: script=../support/Blob.js +// META: script=../../streams/resources/test-utils.js +'use strict'; + +// Helper function that triggers garbage collection while reading a chunk +// if perform_gc is true. +async function read_and_gc(reader, perform_gc) { + const read_promise = reader.read(); + if (perform_gc) + garbageCollect(); + return read_promise; +} + +// Takes in a ReadableStream and reads from it until it is done, returning +// an array that contains the results of each read operation. If perform_gc +// is true, garbage collection is triggered while reading every chunk. +async function read_all_chunks(stream, perform_gc = false) { + assert_true(stream instanceof ReadableStream); + assert_true('getReader' in stream); + const reader = stream.getReader(); + + assert_true('read' in reader); + let read_value = await read_and_gc(reader, perform_gc); + + let out = []; + let i = 0; + while (!read_value.done) { + for (let val of read_value.value) { + out[i++] = val; + } + read_value = await read_and_gc(reader, perform_gc); + } + return out; +} + +promise_test(async () => { + const blob = new Blob(["PASS"]); + const stream = blob.stream(); + const chunks = await read_all_chunks(stream); + for (let [index, value] of chunks.entries()) { + assert_equals(value, "PASS".charCodeAt(index)); + } +}, "Blob.stream()") + +promise_test(async () => { + const blob = new Blob(); + const stream = blob.stream(); + const chunks = await read_all_chunks(stream); + assert_array_equals(chunks, []); +}, "Blob.stream() empty Blob") + +promise_test(async () => { + const input_arr = [8, 241, 48, 123, 151]; + const typed_arr = new Uint8Array(input_arr); + const blob = new Blob([typed_arr]); + const stream = blob.stream(); + const chunks = await read_all_chunks(stream); + assert_array_equals(chunks, input_arr); +}, "Blob.stream() non-unicode input") + +promise_test(async() => { + const input_arr = [8, 241, 48, 123, 151]; + const typed_arr = new Uint8Array(input_arr); + let blob = new Blob([typed_arr]); + const stream = blob.stream(); + blob = null; + garbageCollect(); + const chunks = await read_all_chunks(stream, /*perform_gc=*/true); + assert_array_equals(chunks, input_arr); +}, "Blob.stream() garbage collection of blob shouldn't break stream" + + "consumption") diff --git a/test/fixtures/wpt/FileAPI/blob/Blob-text.any.js b/test/fixtures/wpt/FileAPI/blob/Blob-text.any.js new file mode 100644 index 00000000000000..d04fa97cffe6a3 --- /dev/null +++ b/test/fixtures/wpt/FileAPI/blob/Blob-text.any.js @@ -0,0 +1,64 @@ +// META: title=Blob Text +// META: script=../support/Blob.js +'use strict'; + +promise_test(async () => { + const blob = new Blob(["PASS"]); + const text = await blob.text(); + assert_equals(text, "PASS"); +}, "Blob.text()") + +promise_test(async () => { + const blob = new Blob(); + const text = await blob.text(); + assert_equals(text, ""); +}, "Blob.text() empty blob data") + +promise_test(async () => { + const blob = new Blob(["P", "A", "SS"]); + const text = await blob.text(); + assert_equals(text, "PASS"); +}, "Blob.text() multi-element array in constructor") + +promise_test(async () => { + const non_unicode = "\u0061\u030A"; + const input_arr = new TextEncoder().encode(non_unicode); + const blob = new Blob([input_arr]); + const text = await blob.text(); + assert_equals(text, non_unicode); +}, "Blob.text() non-unicode") + +promise_test(async () => { + const blob = new Blob(["PASS"], { type: "text/plain;charset=utf-16le" }); + const text = await blob.text(); + assert_equals(text, "PASS"); +}, "Blob.text() different charset param in type option") + +promise_test(async () => { + const non_unicode = "\u0061\u030A"; + const input_arr = new TextEncoder().encode(non_unicode); + const blob = new Blob([input_arr], { type: "text/plain;charset=utf-16le" }); + const text = await blob.text(); + assert_equals(text, non_unicode); +}, "Blob.text() different charset param with non-ascii input") + +promise_test(async () => { + const input_arr = new Uint8Array([192, 193, 245, 246, 247, 248, 249, 250, 251, + 252, 253, 254, 255]); + const blob = new Blob([input_arr]); + const text = await blob.text(); + assert_equals(text, "\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd" + + "\ufffd\ufffd\ufffd\ufffd"); +}, "Blob.text() invalid utf-8 input") + +promise_test(async () => { + const input_arr = new Uint8Array([192, 193, 245, 246, 247, 248, 249, 250, 251, + 252, 253, 254, 255]); + const blob = new Blob([input_arr]); + const text_results = await Promise.all([blob.text(), blob.text(), + blob.text()]); + for (let text of text_results) { + assert_equals(text, "\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd" + + "\ufffd\ufffd\ufffd\ufffd"); + } +}, "Blob.text() concurrent reads") diff --git a/test/fixtures/wpt/FileAPI/file/File-constructor-endings.html b/test/fixtures/wpt/FileAPI/file/File-constructor-endings.html new file mode 100644 index 00000000000000..1282b6c5ac2c79 --- /dev/null +++ b/test/fixtures/wpt/FileAPI/file/File-constructor-endings.html @@ -0,0 +1,104 @@ + + +File constructor: endings option + + + + diff --git a/test/fixtures/wpt/FileAPI/file/File-constructor.html b/test/fixtures/wpt/FileAPI/file/File-constructor.html new file mode 100644 index 00000000000000..3477e4ada16e92 --- /dev/null +++ b/test/fixtures/wpt/FileAPI/file/File-constructor.html @@ -0,0 +1,159 @@ + + +File constructor + + + +
+ diff --git a/test/fixtures/wpt/FileAPI/file/Worker-read-file-constructor.worker.js b/test/fixtures/wpt/FileAPI/file/Worker-read-file-constructor.worker.js new file mode 100644 index 00000000000000..4e003b3c958a94 --- /dev/null +++ b/test/fixtures/wpt/FileAPI/file/Worker-read-file-constructor.worker.js @@ -0,0 +1,15 @@ +importScripts("/resources/testharness.js"); + +async_test(function() { + var file = new File(["bits"], "dummy", { 'type': 'text/plain', lastModified: 42 }); + var reader = new FileReader(); + reader.onload = this.step_func_done(function() { + assert_equals(file.name, "dummy", "file name"); + assert_equals(reader.result, "bits", "file content"); + assert_equals(file.lastModified, 42, "file lastModified"); + }); + reader.onerror = this.unreached_func("Unexpected error event"); + reader.readAsText(file); +}, "FileReader in Worker"); + +done(); diff --git a/test/fixtures/wpt/FileAPI/file/send-file-form-controls.tentative.html b/test/fixtures/wpt/FileAPI/file/send-file-form-controls.tentative.html new file mode 100644 index 00000000000000..d11f4a860931b4 --- /dev/null +++ b/test/fixtures/wpt/FileAPI/file/send-file-form-controls.tentative.html @@ -0,0 +1,117 @@ + + +Upload files named using controls (tentative) + + + + + + + + + diff --git a/test/fixtures/wpt/FileAPI/file/send-file-form-iso-2022-jp.tentative.html b/test/fixtures/wpt/FileAPI/file/send-file-form-iso-2022-jp.tentative.html new file mode 100644 index 00000000000000..659af3bde85852 --- /dev/null +++ b/test/fixtures/wpt/FileAPI/file/send-file-form-iso-2022-jp.tentative.html @@ -0,0 +1,72 @@ + + + +Upload files in ISO-2022-JP form (tentative) + + + + + + + + + + diff --git a/test/fixtures/wpt/FileAPI/file/send-file-form-punctuation.tentative.html b/test/fixtures/wpt/FileAPI/file/send-file-form-punctuation.tentative.html new file mode 100644 index 00000000000000..5c2d6d0bf1fe01 --- /dev/null +++ b/test/fixtures/wpt/FileAPI/file/send-file-form-punctuation.tentative.html @@ -0,0 +1,230 @@ + + +Upload files named using punctuation (tentative) + + + + + + + + + diff --git a/test/fixtures/wpt/FileAPI/file/send-file-form-utf-8.html b/test/fixtures/wpt/FileAPI/file/send-file-form-utf-8.html new file mode 100644 index 00000000000000..1be44f4f4db09e --- /dev/null +++ b/test/fixtures/wpt/FileAPI/file/send-file-form-utf-8.html @@ -0,0 +1,62 @@ + + +Upload files in UTF-8 form + + + + + + + + diff --git a/test/fixtures/wpt/FileAPI/file/send-file-form-windows-1252.tentative.html b/test/fixtures/wpt/FileAPI/file/send-file-form-windows-1252.tentative.html new file mode 100644 index 00000000000000..a2c37186b3e023 --- /dev/null +++ b/test/fixtures/wpt/FileAPI/file/send-file-form-windows-1252.tentative.html @@ -0,0 +1,69 @@ + + +Upload files in Windows-1252 form (tentative) + + + + + + + + + + diff --git a/test/fixtures/wpt/FileAPI/file/send-file-form-x-user-defined.tentative.html b/test/fixtures/wpt/FileAPI/file/send-file-form-x-user-defined.tentative.html new file mode 100644 index 00000000000000..503b08a51706f7 --- /dev/null +++ b/test/fixtures/wpt/FileAPI/file/send-file-form-x-user-defined.tentative.html @@ -0,0 +1,70 @@ + + +Upload files in x-user-defined form (tentative) + + + + + + + + + + diff --git a/test/fixtures/wpt/FileAPI/file/send-file-form.html b/test/fixtures/wpt/FileAPI/file/send-file-form.html new file mode 100644 index 00000000000000..baa8d4286c5789 --- /dev/null +++ b/test/fixtures/wpt/FileAPI/file/send-file-form.html @@ -0,0 +1,25 @@ + + +Upload ASCII-named file in UTF-8 form + + + + + + + + diff --git a/test/fixtures/wpt/FileAPI/file/send-file-formdata-controls.tentative.html b/test/fixtures/wpt/FileAPI/file/send-file-formdata-controls.tentative.html new file mode 100644 index 00000000000000..4259741b63ef31 --- /dev/null +++ b/test/fixtures/wpt/FileAPI/file/send-file-formdata-controls.tentative.html @@ -0,0 +1,93 @@ + + +FormData: Upload files named using controls (tentative) + + + + + + + + + diff --git a/test/fixtures/wpt/FileAPI/file/send-file-formdata-punctuation.tentative.html b/test/fixtures/wpt/FileAPI/file/send-file-formdata-punctuation.tentative.html new file mode 100644 index 00000000000000..d8e84e9d978094 --- /dev/null +++ b/test/fixtures/wpt/FileAPI/file/send-file-formdata-punctuation.tentative.html @@ -0,0 +1,168 @@ + + +FormData: Upload files named using punctuation (tentative) + + + + + + + + + diff --git a/test/fixtures/wpt/FileAPI/file/send-file-formdata-utf-8.html b/test/fixtures/wpt/FileAPI/file/send-file-formdata-utf-8.html new file mode 100644 index 00000000000000..7a7f6cefe776b9 --- /dev/null +++ b/test/fixtures/wpt/FileAPI/file/send-file-formdata-utf-8.html @@ -0,0 +1,53 @@ + + +FormData: Upload files in UTF-8 fetch() + + + + + + + + diff --git a/test/fixtures/wpt/FileAPI/file/send-file-formdata.html b/test/fixtures/wpt/FileAPI/file/send-file-formdata.html new file mode 100644 index 00000000000000..77e048e54741c0 --- /dev/null +++ b/test/fixtures/wpt/FileAPI/file/send-file-formdata.html @@ -0,0 +1,28 @@ + + +FormData: Upload ASCII-named file in UTF-8 form + + + + + + + + diff --git a/test/fixtures/wpt/FileAPI/fileReader.html b/test/fixtures/wpt/FileAPI/fileReader.html new file mode 100644 index 00000000000000..b767e22d4a66eb --- /dev/null +++ b/test/fixtures/wpt/FileAPI/fileReader.html @@ -0,0 +1,67 @@ + + + + FileReader States + + + + + + +
+ + + diff --git a/test/fixtures/wpt/FileAPI/filelist-section/filelist.html b/test/fixtures/wpt/FileAPI/filelist-section/filelist.html new file mode 100644 index 00000000000000..b97dcde19f647c --- /dev/null +++ b/test/fixtures/wpt/FileAPI/filelist-section/filelist.html @@ -0,0 +1,57 @@ + + + + + FileAPI Test: filelist + + + + + + + + + +
+ +
+
+ + + + + diff --git a/test/fixtures/wpt/FileAPI/filelist-section/filelist_multiple_selected_files-manual.html b/test/fixtures/wpt/FileAPI/filelist-section/filelist_multiple_selected_files-manual.html new file mode 100644 index 00000000000000..2efaa059fa4897 --- /dev/null +++ b/test/fixtures/wpt/FileAPI/filelist-section/filelist_multiple_selected_files-manual.html @@ -0,0 +1,64 @@ + + + + + FileAPI Test: filelist_multiple_selected_files + + + + + + + + + +
+ +
+
+

Test steps:

+
    +
  1. Download upload.txt, upload.zip to local.
  2. +
  3. Select the local two files (upload.txt, upload.zip) to run the test.
  4. +
+
+ +
+ + + + diff --git a/test/fixtures/wpt/FileAPI/filelist-section/filelist_selected_file-manual.html b/test/fixtures/wpt/FileAPI/filelist-section/filelist_selected_file-manual.html new file mode 100644 index 00000000000000..966aadda615589 --- /dev/null +++ b/test/fixtures/wpt/FileAPI/filelist-section/filelist_selected_file-manual.html @@ -0,0 +1,64 @@ + + + + + FileAPI Test: filelist_selected_file + + + + + + + + + +
+ +
+
+

Test steps:

+
    +
  1. Download upload.txt to local.
  2. +
  3. Select the local upload.txt file to run the test.
  4. +
+
+ +
+ + + + diff --git a/test/fixtures/wpt/FileAPI/filelist-section/support/upload.txt b/test/fixtures/wpt/FileAPI/filelist-section/support/upload.txt new file mode 100644 index 00000000000000..f45965b711f127 --- /dev/null +++ b/test/fixtures/wpt/FileAPI/filelist-section/support/upload.txt @@ -0,0 +1 @@ +Hello, this is test file for file upload. diff --git a/test/fixtures/wpt/FileAPI/filelist-section/support/upload.zip b/test/fixtures/wpt/FileAPI/filelist-section/support/upload.zip new file mode 100644 index 00000000000000..41bfebe5eed561 Binary files /dev/null and b/test/fixtures/wpt/FileAPI/filelist-section/support/upload.zip differ diff --git a/test/fixtures/wpt/FileAPI/historical.https.html b/test/fixtures/wpt/FileAPI/historical.https.html new file mode 100644 index 00000000000000..4f841f17639459 --- /dev/null +++ b/test/fixtures/wpt/FileAPI/historical.https.html @@ -0,0 +1,65 @@ + + + + + Historical features + + + + + +
+ + + diff --git a/test/fixtures/wpt/FileAPI/idlharness-manual.html b/test/fixtures/wpt/FileAPI/idlharness-manual.html new file mode 100644 index 00000000000000..c1d8b0c7149d75 --- /dev/null +++ b/test/fixtures/wpt/FileAPI/idlharness-manual.html @@ -0,0 +1,45 @@ + + + + + File API manual IDL tests + + + + + + + + +

File API manual IDL tests

+ +

Either download upload.txt and select it below or select an + arbitrary local file.

+ +
+ +
+ +
+ + + + diff --git a/test/fixtures/wpt/FileAPI/idlharness.html b/test/fixtures/wpt/FileAPI/idlharness.html new file mode 100644 index 00000000000000..5e0a43f80df3f8 --- /dev/null +++ b/test/fixtures/wpt/FileAPI/idlharness.html @@ -0,0 +1,40 @@ + + + + + File API automated IDL tests + + + + + + + + +

File API automated IDL tests

+ +
+ +
+ +
+ + + + + diff --git a/test/fixtures/wpt/FileAPI/idlharness.worker.js b/test/fixtures/wpt/FileAPI/idlharness.worker.js new file mode 100644 index 00000000000000..786b7e4199fb45 --- /dev/null +++ b/test/fixtures/wpt/FileAPI/idlharness.worker.js @@ -0,0 +1,20 @@ +importScripts("/resources/testharness.js"); +importScripts("/resources/WebIDLParser.js", "/resources/idlharness.js"); + +'use strict'; + +// https://w3c.github.io/FileAPI/ + +idl_test( + ['FileAPI'], + ['dom', 'html', 'url'], + idl_array => { + idl_array.add_objects({ + Blob: ['new Blob(["TEST"])'], + File: ['new File(["myFileBits"], "myFileName")'], + FileReader: ['new FileReader()'], + FileReaderSync: ['new FileReaderSync()'] + }); + } +); +done(); diff --git a/test/fixtures/wpt/FileAPI/progress-manual.html b/test/fixtures/wpt/FileAPI/progress-manual.html new file mode 100644 index 00000000000000..b2e03b3eb27387 --- /dev/null +++ b/test/fixtures/wpt/FileAPI/progress-manual.html @@ -0,0 +1,49 @@ + + +Process Events for FileReader + + + + +Please choose one file through this input below.
+ +
+ diff --git a/test/fixtures/wpt/FileAPI/reading-data-section/Determining-Encoding.html b/test/fixtures/wpt/FileAPI/reading-data-section/Determining-Encoding.html new file mode 100644 index 00000000000000..d65ae9db18a1ff --- /dev/null +++ b/test/fixtures/wpt/FileAPI/reading-data-section/Determining-Encoding.html @@ -0,0 +1,91 @@ + + +FileAPI Test: Blob Determining Encoding + + + + + +
+ diff --git a/test/fixtures/wpt/FileAPI/reading-data-section/FileReader-event-handler-attributes.html b/test/fixtures/wpt/FileAPI/reading-data-section/FileReader-event-handler-attributes.html new file mode 100644 index 00000000000000..86657b5711aff1 --- /dev/null +++ b/test/fixtures/wpt/FileAPI/reading-data-section/FileReader-event-handler-attributes.html @@ -0,0 +1,23 @@ + + +FileReader event handler attributes + + +
+ diff --git a/test/fixtures/wpt/FileAPI/reading-data-section/FileReader-multiple-reads.html b/test/fixtures/wpt/FileAPI/reading-data-section/FileReader-multiple-reads.html new file mode 100644 index 00000000000000..e7279fe4bd445e --- /dev/null +++ b/test/fixtures/wpt/FileAPI/reading-data-section/FileReader-multiple-reads.html @@ -0,0 +1,89 @@ + +FileReader: starting new reads while one is in progress + + + + +
+ diff --git a/test/fixtures/wpt/FileAPI/reading-data-section/filereader_abort.html b/test/fixtures/wpt/FileAPI/reading-data-section/filereader_abort.html new file mode 100644 index 00000000000000..940a775d35bf42 --- /dev/null +++ b/test/fixtures/wpt/FileAPI/reading-data-section/filereader_abort.html @@ -0,0 +1,53 @@ + + + + + FileAPI Test: filereader_abort + + + + + + +
+ + + + diff --git a/test/fixtures/wpt/FileAPI/reading-data-section/filereader_error.html b/test/fixtures/wpt/FileAPI/reading-data-section/filereader_error.html new file mode 100644 index 00000000000000..cf4524825b80ca --- /dev/null +++ b/test/fixtures/wpt/FileAPI/reading-data-section/filereader_error.html @@ -0,0 +1,35 @@ + + + + + FileAPI Test: filereader_error + + + + + + + +
+ + + + diff --git a/test/fixtures/wpt/FileAPI/reading-data-section/filereader_events.any.js b/test/fixtures/wpt/FileAPI/reading-data-section/filereader_events.any.js new file mode 100644 index 00000000000000..ac692907d119f7 --- /dev/null +++ b/test/fixtures/wpt/FileAPI/reading-data-section/filereader_events.any.js @@ -0,0 +1,19 @@ +promise_test(async t => { + var reader = new FileReader(); + var eventWatcher = new EventWatcher(t, reader, ['loadstart', 'progress', 'abort', 'error', 'load', 'loadend']); + reader.readAsText(new Blob([])); + await eventWatcher.wait_for('loadstart'); + // No progress event for an empty blob, as no data is loaded. + await eventWatcher.wait_for('load'); + await eventWatcher.wait_for('loadend'); +}, 'events are dispatched in the correct order for an empty blob'); + +promise_test(async t => { + var reader = new FileReader(); + var eventWatcher = new EventWatcher(t, reader, ['loadstart', 'progress', 'abort', 'error', 'load', 'loadend']); + reader.readAsText(new Blob(['a'])); + await eventWatcher.wait_for('loadstart'); + await eventWatcher.wait_for('progress'); + await eventWatcher.wait_for('load'); + await eventWatcher.wait_for('loadend'); +}, 'events are dispatched in the correct order for a non-empty blob'); diff --git a/test/fixtures/wpt/FileAPI/reading-data-section/filereader_file-manual.html b/test/fixtures/wpt/FileAPI/reading-data-section/filereader_file-manual.html new file mode 100644 index 00000000000000..702ca9afd7b067 --- /dev/null +++ b/test/fixtures/wpt/FileAPI/reading-data-section/filereader_file-manual.html @@ -0,0 +1,69 @@ + + + + + FileAPI Test: filereader_file + + + + + + + +
+

Test step:

+
    +
  1. Download blue-100x100.png to local.
  2. +
  3. Select the local file (blue-100x100.png) to run the test.
  4. +
+
+ +
+ +
+ +
+ + + diff --git a/test/fixtures/wpt/FileAPI/reading-data-section/filereader_file_img-manual.html b/test/fixtures/wpt/FileAPI/reading-data-section/filereader_file_img-manual.html new file mode 100644 index 00000000000000..fca42c7fceba48 --- /dev/null +++ b/test/fixtures/wpt/FileAPI/reading-data-section/filereader_file_img-manual.html @@ -0,0 +1,47 @@ + + + + + FileAPI Test: filereader_file_img + + + + + + + +
+

Test step:

+
    +
  1. Download blue-100x100.png to local.
  2. +
  3. Select the local file (blue-100x100.png) to run the test.
  4. +
+
+ +
+ +
+ +
+ + + diff --git a/test/fixtures/wpt/FileAPI/reading-data-section/filereader_readAsArrayBuffer.html b/test/fixtures/wpt/FileAPI/reading-data-section/filereader_readAsArrayBuffer.html new file mode 100644 index 00000000000000..31001a51a0727f --- /dev/null +++ b/test/fixtures/wpt/FileAPI/reading-data-section/filereader_readAsArrayBuffer.html @@ -0,0 +1,38 @@ + + + + + FileAPI Test: filereader_readAsArrayBuffer + + + + + + +
+ + + + diff --git a/test/fixtures/wpt/FileAPI/reading-data-section/filereader_readAsBinaryString.html b/test/fixtures/wpt/FileAPI/reading-data-section/filereader_readAsBinaryString.html new file mode 100644 index 00000000000000..b550e4d0a96dc7 --- /dev/null +++ b/test/fixtures/wpt/FileAPI/reading-data-section/filereader_readAsBinaryString.html @@ -0,0 +1,32 @@ + + +FileAPI Test: filereader_readAsBinaryString + + + + + diff --git a/test/fixtures/wpt/FileAPI/reading-data-section/filereader_readAsDataURL.html b/test/fixtures/wpt/FileAPI/reading-data-section/filereader_readAsDataURL.html new file mode 100644 index 00000000000000..5bc39499a229d1 --- /dev/null +++ b/test/fixtures/wpt/FileAPI/reading-data-section/filereader_readAsDataURL.html @@ -0,0 +1,51 @@ + + +FileAPI Test: FileReader.readAsDataURL + + + + + + \ No newline at end of file diff --git a/test/fixtures/wpt/FileAPI/reading-data-section/filereader_readAsText.html b/test/fixtures/wpt/FileAPI/reading-data-section/filereader_readAsText.html new file mode 100644 index 00000000000000..7d639d0111473b --- /dev/null +++ b/test/fixtures/wpt/FileAPI/reading-data-section/filereader_readAsText.html @@ -0,0 +1,51 @@ + + + + + FileAPI Test: filereader_readAsText + + + + + + +
+ + + + diff --git a/test/fixtures/wpt/FileAPI/reading-data-section/filereader_readystate.html b/test/fixtures/wpt/FileAPI/reading-data-section/filereader_readystate.html new file mode 100644 index 00000000000000..1586b8995059f7 --- /dev/null +++ b/test/fixtures/wpt/FileAPI/reading-data-section/filereader_readystate.html @@ -0,0 +1,34 @@ + + + + + FileAPI Test: filereader_readystate + + + + + + +
+ + + + diff --git a/test/fixtures/wpt/FileAPI/reading-data-section/filereader_result.html b/test/fixtures/wpt/FileAPI/reading-data-section/filereader_result.html new file mode 100644 index 00000000000000..b80322ed424f83 --- /dev/null +++ b/test/fixtures/wpt/FileAPI/reading-data-section/filereader_result.html @@ -0,0 +1,97 @@ + + + + + FileAPI Test: filereader_result + + + + + + +
+ + + + diff --git a/test/fixtures/wpt/FileAPI/reading-data-section/support/blue-100x100.png b/test/fixtures/wpt/FileAPI/reading-data-section/support/blue-100x100.png new file mode 100644 index 00000000000000..b662fe18ec4797 Binary files /dev/null and b/test/fixtures/wpt/FileAPI/reading-data-section/support/blue-100x100.png differ diff --git a/test/fixtures/wpt/FileAPI/support/Blob.js b/test/fixtures/wpt/FileAPI/support/Blob.js new file mode 100644 index 00000000000000..04069acd3ccbe7 --- /dev/null +++ b/test/fixtures/wpt/FileAPI/support/Blob.js @@ -0,0 +1,70 @@ +'use strict' + +function test_blob(fn, expectations) { + var expected = expectations.expected, + type = expectations.type, + desc = expectations.desc; + + var t = async_test(desc); + t.step(function() { + var blob = fn(); + assert_true(blob instanceof Blob); + assert_false(blob instanceof File); + assert_equals(blob.type, type); + assert_equals(blob.size, expected.length); + + var fr = new FileReader(); + fr.onload = t.step_func_done(function(event) { + assert_equals(this.result, expected); + }, fr); + fr.onerror = t.step_func(function(e) { + assert_unreached("got error event on FileReader"); + }); + fr.readAsText(blob, "UTF-8"); + }); +} + +function test_blob_binary(fn, expectations) { + var expected = expectations.expected, + type = expectations.type, + desc = expectations.desc; + + var t = async_test(desc); + t.step(function() { + var blob = fn(); + assert_true(blob instanceof Blob); + assert_false(blob instanceof File); + assert_equals(blob.type, type); + assert_equals(blob.size, expected.length); + + var fr = new FileReader(); + fr.onload = t.step_func_done(function(event) { + assert_true(this.result instanceof ArrayBuffer, + "Result should be an ArrayBuffer"); + assert_array_equals(new Uint8Array(this.result), expected); + }, fr); + fr.onerror = t.step_func(function(e) { + assert_unreached("got error event on FileReader"); + }); + fr.readAsArrayBuffer(blob); + }); +} + +// Assert that two TypedArray objects have the same byte values +self.assert_equals_typed_array = (array1, array2) => { + const [view1, view2] = [array1, array2].map((array) => { + assert_true(array.buffer instanceof ArrayBuffer, + 'Expect input ArrayBuffers to contain field `buffer`'); + return new DataView(array.buffer, array.byteOffset, array.byteLength); + }); + + assert_equals(view1.byteLength, view2.byteLength, + 'Expect both arrays to be of the same byte length'); + + const byteLength = view1.byteLength; + + for (let i = 0; i < byteLength; ++i) { + assert_equals(view1.getUint8(i), view2.getUint8(i), + `Expect byte at buffer position ${i} to be equal`); + } +} diff --git a/test/fixtures/wpt/FileAPI/support/document-domain-setter.sub.html b/test/fixtures/wpt/FileAPI/support/document-domain-setter.sub.html new file mode 100644 index 00000000000000..61aebdf326679c --- /dev/null +++ b/test/fixtures/wpt/FileAPI/support/document-domain-setter.sub.html @@ -0,0 +1,7 @@ + +Relevant/current/blob source page used as a test helper + + diff --git a/test/fixtures/wpt/FileAPI/support/historical-serviceworker.js b/test/fixtures/wpt/FileAPI/support/historical-serviceworker.js new file mode 100644 index 00000000000000..8bd89a23adb70f --- /dev/null +++ b/test/fixtures/wpt/FileAPI/support/historical-serviceworker.js @@ -0,0 +1,5 @@ +importScripts('/resources/testharness.js'); + +test(() => { + assert_false('FileReaderSync' in self); +}, '"FileReaderSync" should not be supported in service workers'); diff --git a/test/fixtures/wpt/FileAPI/support/incumbent.sub.html b/test/fixtures/wpt/FileAPI/support/incumbent.sub.html new file mode 100644 index 00000000000000..63a81cd3281c46 --- /dev/null +++ b/test/fixtures/wpt/FileAPI/support/incumbent.sub.html @@ -0,0 +1,22 @@ + +Incumbent page used as a test helper + + + + + + diff --git a/test/fixtures/wpt/FileAPI/support/send-file-form-helper.js b/test/fixtures/wpt/FileAPI/support/send-file-form-helper.js new file mode 100644 index 00000000000000..d6adf21ec33795 --- /dev/null +++ b/test/fixtures/wpt/FileAPI/support/send-file-form-helper.js @@ -0,0 +1,282 @@ +'use strict'; + +// See /FileAPI/file/resources/echo-content-escaped.py +function escapeString(string) { + return string.replace(/\\/g, "\\\\").replace( + /[^\x20-\x7E]/g, + (x) => { + let hex = x.charCodeAt(0).toString(16); + if (hex.length < 2) hex = "0" + hex; + return `\\x${hex}`; + }, + ).replace(/\\x0d\\x0a/g, "\r\n"); +} + +// Rationale for this particular test character sequence, which is +// used in filenames and also in file contents: +// +// - ABC~ ensures the string starts with something we can read to +// ensure it is from the correct source; ~ is used because even +// some 1-byte otherwise-ASCII-like parts of ISO-2022-JP +// interpret it differently. +// - ‾¥ are inside a single-byte range of ISO-2022-JP and help +// diagnose problems due to filesystem encoding or locale +// - ≈ is inside IBM437 and helps diagnose problems due to filesystem +// encoding or locale +// - ¤ is inside Latin-1 and helps diagnose problems due to +// filesystem encoding or locale; it is also the "simplest" case +// needing substitution in ISO-2022-JP +// - ・ is inside a single-byte range of ISO-2022-JP in some variants +// and helps diagnose problems due to filesystem encoding or locale; +// on the web it is distinct when decoding but unified when encoding +// - ・ is inside a double-byte range of ISO-2022-JP and helps +// diagnose problems due to filesystem encoding or locale +// - • is inside Windows-1252 and helps diagnose problems due to +// filesystem encoding or locale and also ensures these aren't +// accidentally turned into e.g. control codes +// - ∙ is inside IBM437 and helps diagnose problems due to filesystem +// encoding or locale +// - · is inside Latin-1 and helps diagnose problems due to +// filesystem encoding or locale and also ensures HTML named +// character references (e.g. ·) are not used +// - ☼ is inside IBM437 shadowing C0 and helps diagnose problems due to +// filesystem encoding or locale and also ensures these aren't +// accidentally turned into e.g. control codes +// - ★ is inside ISO-2022-JP on a non-Kanji page and makes correct +// output easier to spot +// - 星 is inside ISO-2022-JP on a Kanji page and makes correct +// output easier to spot +// - 🌟 is outside the BMP and makes incorrect surrogate pair +// substitution detectable and ensures substitutions work +// correctly immediately after Kanji 2-byte ISO-2022-JP +// - 星 repeated here ensures the correct codec state is used +// after a non-BMP substitution +// - ★ repeated here also makes correct output easier to spot +// - ☼ is inside IBM437 shadowing C0 and helps diagnose problems due to +// filesystem encoding or locale and also ensures these aren't +// accidentally turned into e.g. control codes and also ensures +// substitutions work correctly immediately after non-Kanji +// 2-byte ISO-2022-JP +// - · is inside Latin-1 and helps diagnose problems due to +// filesystem encoding or locale and also ensures HTML named +// character references (e.g. ·) are not used +// - ∙ is inside IBM437 and helps diagnose problems due to filesystem +// encoding or locale +// - • is inside Windows-1252 and again helps diagnose problems +// due to filesystem encoding or locale +// - ・ is inside a double-byte range of ISO-2022-JP and helps +// diagnose problems due to filesystem encoding or locale +// - ・ is inside a single-byte range of ISO-2022-JP in some variants +// and helps diagnose problems due to filesystem encoding or locale; +// on the web it is distinct when decoding but unified when encoding +// - ¤ is inside Latin-1 and helps diagnose problems due to +// filesystem encoding or locale; again it is a "simple" +// substitution case +// - ≈ is inside IBM437 and helps diagnose problems due to filesystem +// encoding or locale +// - ¥‾ are inside a single-byte range of ISO-2022-JP and help +// diagnose problems due to filesystem encoding or locale +// - ~XYZ ensures earlier errors don't lead to misencoding of +// simple ASCII +// +// Overall the near-symmetry makes common I18N mistakes like +// off-by-1-after-non-BMP easier to spot. All the characters +// are also allowed in Windows Unicode filenames. +const kTestChars = 'ABC~‾¥≈¤・・•∙·☼★星🌟星★☼·∙•・・¤≈¥‾~XYZ'; + +// The kTestFallback* strings represent the expected byte sequence from +// encoding kTestChars with the given encoding with "html" replacement +// mode, isomorphic-decoded. That means, characters that can't be +// encoded in that encoding get HTML-escaped, but no further +// `escapeString`-like escapes are needed. +const kTestFallbackUtf8 = ( + "ABC~\xE2\x80\xBE\xC2\xA5\xE2\x89\x88\xC2\xA4\xEF\xBD\xA5\xE3\x83\xBB\xE2" + + "\x80\xA2\xE2\x88\x99\xC2\xB7\xE2\x98\xBC\xE2\x98\x85\xE6\x98\x9F\xF0\x9F" + + "\x8C\x9F\xE6\x98\x9F\xE2\x98\x85\xE2\x98\xBC\xC2\xB7\xE2\x88\x99\xE2\x80" + + "\xA2\xE3\x83\xBB\xEF\xBD\xA5\xC2\xA4\xE2\x89\x88\xC2\xA5\xE2\x80\xBE~XYZ" +); + +const kTestFallbackIso2022jp = ( + ("ABC~\x1B(J~\\≈¤\x1B$B!&!&\x1B(B•∙·☼\x1B$B!z@1\x1B(B🌟" + + "\x1B$B@1!z\x1B(B☼·∙•\x1B$B!&!&\x1B(B¤≈\x1B(J\\~\x1B(B~XYZ") + .replace(/[^\0-\x7F]/gu, (x) => `&#${x.codePointAt(0)};`) +); + +const kTestFallbackWindows1252 = ( + "ABC~‾\xA5≈\xA4・・\x95∙\xB7☼★星🌟星★☼\xB7∙\x95・・\xA4≈\xA5‾~XYZ".replace( + /[^\0-\xFF]/gu, + (x) => `&#${x.codePointAt(0)};`, + ) +); + +const kTestFallbackXUserDefined = kTestChars.replace( + /[^\0-\x7F]/gu, + (x) => `&#${x.codePointAt(0)};`, +); + +// formPostFileUploadTest - verifies multipart upload structure and +// numeric character reference replacement for filenames, field names, +// and field values using form submission. +// +// Uses /FileAPI/file/resources/echo-content-escaped.py to echo the +// upload POST with controls and non-ASCII bytes escaped. This is done +// because navigations whose response body contains [\0\b\v] may get +// treated as a download, which is not what we want. Use the +// `escapeString` function to replicate that kind of escape (note that +// it takes an isomorphic-decoded string, not a byte sequence). +// +// Fields in the parameter object: +// +// - fileNameSource: purely explanatory and gives a clue about which +// character encoding is the source for the non-7-bit-ASCII parts of +// the fileBaseName, or Unicode if no smaller-than-Unicode source +// contains all the characters. Used in the test name. +// - fileBaseName: the not-necessarily-just-7-bit-ASCII file basename +// used for the constructed test file. Used in the test name. +// - formEncoding: the acceptCharset of the form used to submit the +// test file. Used in the test name. +// - expectedEncodedBaseName: the expected formEncoding-encoded +// version of fileBaseName, isomorphic-decoded. That means, characters +// that can't be encoded in that encoding get HTML-escaped, but no +// further `escapeString`-like escapes are needed. +const formPostFileUploadTest = ({ + fileNameSource, + fileBaseName, + formEncoding, + expectedEncodedBaseName, +}) => { + promise_test(async testCase => { + + if (document.readyState !== 'complete') { + await new Promise(resolve => addEventListener('load', resolve)); + } + + const formTargetFrame = Object.assign(document.createElement('iframe'), { + name: 'formtargetframe', + }); + document.body.append(formTargetFrame); + testCase.add_cleanup(() => { + document.body.removeChild(formTargetFrame); + }); + + const form = Object.assign(document.createElement('form'), { + acceptCharset: formEncoding, + action: '/FileAPI/file/resources/echo-content-escaped.py', + method: 'POST', + enctype: 'multipart/form-data', + target: formTargetFrame.name, + }); + document.body.append(form); + testCase.add_cleanup(() => { + document.body.removeChild(form); + }); + + // Used to verify that the browser agrees with the test about + // which form charset is used. + form.append(Object.assign(document.createElement('input'), { + type: 'hidden', + name: '_charset_', + })); + + // Used to verify that the browser agrees with the test about + // field value replacement and encoding independently of file system + // idiosyncracies. + form.append(Object.assign(document.createElement('input'), { + type: 'hidden', + name: 'filename', + value: fileBaseName, + })); + + // Same, but with name and value reversed to ensure field names + // get the same treatment. + form.append(Object.assign(document.createElement('input'), { + type: 'hidden', + name: fileBaseName, + value: 'filename', + })); + + const fileInput = Object.assign(document.createElement('input'), { + type: 'file', + name: 'file', + }); + form.append(fileInput); + + // Removes c:\fakepath\ or other pseudofolder and returns just the + // final component of filePath; allows both / and \ as segment + // delimiters. + const baseNameOfFilePath = filePath => filePath.split(/[\/\\]/).pop(); + await new Promise(resolve => { + const dataTransfer = new DataTransfer; + dataTransfer.items.add( + new File([kTestChars], fileBaseName, {type: 'text/plain'})); + fileInput.files = dataTransfer.files; + // For historical reasons .value will be prefixed with + // c:\fakepath\, but the basename should match the file name + // exposed through the newer .files[0].name API. This check + // verifies that assumption. + assert_equals( + baseNameOfFilePath(fileInput.files[0].name), + baseNameOfFilePath(fileInput.value), + `The basename of the field's value should match its files[0].name`); + form.submit(); + formTargetFrame.onload = resolve; + }); + + const formDataText = formTargetFrame.contentDocument.body.textContent; + const formDataLines = formDataText.split('\n'); + if (formDataLines.length && !formDataLines[formDataLines.length - 1]) { + --formDataLines.length; + } + assert_greater_than( + formDataLines.length, + 2, + `${fileBaseName}: multipart form data must have at least 3 lines: ${ + JSON.stringify(formDataText) + }`); + const boundary = formDataLines[0]; + assert_equals( + formDataLines[formDataLines.length - 1], + boundary + '--', + `${fileBaseName}: multipart form data must end with ${boundary}--: ${ + JSON.stringify(formDataText) + }`); + + const asValue = expectedEncodedBaseName.replace(/\r\n?|\n/g, "\r\n"); + const asName = asValue.replace(/[\r\n"]/g, encodeURIComponent); + const asFilename = expectedEncodedBaseName.replace(/[\r\n"]/g, encodeURIComponent); + + // The response body from echo-content-escaped.py has controls and non-ASCII + // bytes escaped, so any caller-provided field that might contain such bytes + // must be passed to `escapeString`, after any other expected + // transformations. + const expectedText = [ + boundary, + 'Content-Disposition: form-data; name="_charset_"', + '', + formEncoding, + boundary, + 'Content-Disposition: form-data; name="filename"', + '', + // Unlike for names and filenames, multipart/form-data values don't escape + // \r\n linebreaks, and when they're read from an iframe they become \n. + escapeString(asValue).replace(/\r\n/g, "\n"), + boundary, + `Content-Disposition: form-data; name="${escapeString(asName)}"`, + '', + 'filename', + boundary, + `Content-Disposition: form-data; name="file"; ` + + `filename="${escapeString(asFilename)}"`, + 'Content-Type: text/plain', + '', + escapeString(kTestFallbackUtf8), + boundary + '--', + ].join('\n'); + + assert_true( + formDataText.startsWith(expectedText), + `Unexpected multipart-shaped form data received:\n${ + formDataText + }\nExpected:\n${expectedText}`); + }, `Upload ${fileBaseName} (${fileNameSource}) in ${formEncoding} form`); +}; diff --git a/test/fixtures/wpt/FileAPI/support/send-file-formdata-helper.js b/test/fixtures/wpt/FileAPI/support/send-file-formdata-helper.js new file mode 100644 index 00000000000000..53572ef36c8d1b --- /dev/null +++ b/test/fixtures/wpt/FileAPI/support/send-file-formdata-helper.js @@ -0,0 +1,97 @@ +"use strict"; + +const kTestChars = "ABC~‾¥≈¤・・•∙·☼★星🌟星★☼·∙•・・¤≈¥‾~XYZ"; + +// formDataPostFileUploadTest - verifies multipart upload structure and +// numeric character reference replacement for filenames, field names, +// and field values using FormData and fetch(). +// +// Uses /fetch/api/resources/echo-content.py to echo the upload +// POST (unlike in send-file-form-helper.js, here we expect all +// multipart/form-data request bodies to be UTF-8, so we don't need to +// escape controls and non-ASCII bytes). +// +// Fields in the parameter object: +// +// - fileNameSource: purely explanatory and gives a clue about which +// character encoding is the source for the non-7-bit-ASCII parts of +// the fileBaseName, or Unicode if no smaller-than-Unicode source +// contains all the characters. Used in the test name. +// - fileBaseName: the not-necessarily-just-7-bit-ASCII file basename +// used for the constructed test file. Used in the test name. +const formDataPostFileUploadTest = ({ + fileNameSource, + fileBaseName, +}) => { + promise_test(async (testCase) => { + const formData = new FormData(); + let file = new Blob([kTestChars], { type: "text/plain" }); + try { + // Switch to File in browsers that allow this + file = new File([file], fileBaseName, { type: file.type }); + } catch (ignoredException) { + } + + // Used to verify that the browser agrees with the test about + // field value replacement and encoding independently of file system + // idiosyncracies. + formData.append("filename", fileBaseName); + + // Same, but with name and value reversed to ensure field names + // get the same treatment. + formData.append(fileBaseName, "filename"); + + formData.append("file", file, fileBaseName); + + const formDataText = await (await fetch( + `/fetch/api/resources/echo-content.py`, + { + method: "POST", + body: formData, + }, + )).text(); + const formDataLines = formDataText.split("\r\n"); + if (formDataLines.length && !formDataLines[formDataLines.length - 1]) { + --formDataLines.length; + } + assert_greater_than( + formDataLines.length, + 2, + `${fileBaseName}: multipart form data must have at least 3 lines: ${ + JSON.stringify(formDataText) + }`, + ); + const boundary = formDataLines[0]; + assert_equals( + formDataLines[formDataLines.length - 1], + boundary + "--", + `${fileBaseName}: multipart form data must end with ${boundary}--: ${ + JSON.stringify(formDataText) + }`, + ); + + const asName = fileBaseName.replace(/[\r\n"]/g, encodeURIComponent); + const expectedText = [ + boundary, + 'Content-Disposition: form-data; name="filename"', + "", + fileBaseName, + boundary, + `Content-Disposition: form-data; name="${asName}"`, + "", + "filename", + boundary, + `Content-Disposition: form-data; name="file"; ` + + `filename="${asName}"`, + "Content-Type: text/plain", + "", + kTestChars, + boundary + "--", + ].join("\r\n"); + + assert_true( + formDataText.startsWith(expectedText), + `Unexpected multipart-shaped form data received:\n${formDataText}\nExpected:\n${expectedText}`, + ); + }, `Upload ${fileBaseName} (${fileNameSource}) in fetch with FormData`); +}; diff --git a/test/fixtures/wpt/FileAPI/support/upload.txt b/test/fixtures/wpt/FileAPI/support/upload.txt new file mode 100644 index 00000000000000..5ab2f8a4323aba --- /dev/null +++ b/test/fixtures/wpt/FileAPI/support/upload.txt @@ -0,0 +1 @@ +Hello \ No newline at end of file diff --git a/test/fixtures/wpt/FileAPI/support/url-origin.html b/test/fixtures/wpt/FileAPI/support/url-origin.html new file mode 100644 index 00000000000000..63755113915f9f --- /dev/null +++ b/test/fixtures/wpt/FileAPI/support/url-origin.html @@ -0,0 +1,6 @@ + + diff --git a/test/fixtures/wpt/FileAPI/unicode.html b/test/fixtures/wpt/FileAPI/unicode.html new file mode 100644 index 00000000000000..ce3e3579d7c2c7 --- /dev/null +++ b/test/fixtures/wpt/FileAPI/unicode.html @@ -0,0 +1,46 @@ + + +Blob/Unicode interaction: normalization and encoding + + + diff --git a/test/fixtures/wpt/FileAPI/url/cross-global-revoke.sub.html b/test/fixtures/wpt/FileAPI/url/cross-global-revoke.sub.html new file mode 100644 index 00000000000000..21b8c5bb1986d5 --- /dev/null +++ b/test/fixtures/wpt/FileAPI/url/cross-global-revoke.sub.html @@ -0,0 +1,61 @@ + + + + + + \ No newline at end of file diff --git a/test/fixtures/wpt/FileAPI/url/multi-global-origin-serialization.sub.html b/test/fixtures/wpt/FileAPI/url/multi-global-origin-serialization.sub.html new file mode 100644 index 00000000000000..0052b26fa62130 --- /dev/null +++ b/test/fixtures/wpt/FileAPI/url/multi-global-origin-serialization.sub.html @@ -0,0 +1,26 @@ + + +Blob URL serialization (specifically the origin) in multi-global situations + + + + + + + + + + + diff --git a/test/fixtures/wpt/FileAPI/url/resources/create-helper.html b/test/fixtures/wpt/FileAPI/url/resources/create-helper.html new file mode 100644 index 00000000000000..fa6cf4e671e835 --- /dev/null +++ b/test/fixtures/wpt/FileAPI/url/resources/create-helper.html @@ -0,0 +1,7 @@ + + \ No newline at end of file diff --git a/test/fixtures/wpt/FileAPI/url/resources/create-helper.js b/test/fixtures/wpt/FileAPI/url/resources/create-helper.js new file mode 100644 index 00000000000000..e6344f700ced60 --- /dev/null +++ b/test/fixtures/wpt/FileAPI/url/resources/create-helper.js @@ -0,0 +1,4 @@ +self.addEventListener('message', e => { + let url = URL.createObjectURL(e.data.blob); + self.postMessage({url: url}); +}); diff --git a/test/fixtures/wpt/FileAPI/url/resources/fetch-tests.js b/test/fixtures/wpt/FileAPI/url/resources/fetch-tests.js new file mode 100644 index 00000000000000..a81ea1e7b1de35 --- /dev/null +++ b/test/fixtures/wpt/FileAPI/url/resources/fetch-tests.js @@ -0,0 +1,71 @@ +// This method generates a number of tests verifying fetching of blob URLs, +// allowing the same tests to be used both with fetch() and XMLHttpRequest. +// +// |fetch_method| is only used in test names, and should describe the +// (javascript) method being used by the other two arguments (i.e. 'fetch' or 'XHR'). +// +// |fetch_should_succeed| is a callback that is called with the Test and a URL. +// Fetching the URL is expected to succeed. The callback should return a promise +// resolved with whatever contents were fetched. +// +// |fetch_should_fail| similarly is a callback that is called with the Test, a URL +// to fetch, and optionally a method to use to do the fetch. If no method is +// specified the callback should use the 'GET' method. Fetching of these URLs is +// expected to fail, and the callback should return a promise that resolves iff +// fetching did indeed fail. +function fetch_tests(fetch_method, fetch_should_succeed, fetch_should_fail) { + const blob_contents = 'test blob contents'; + const blob = new Blob([blob_contents]); + + promise_test(t => { + const url = URL.createObjectURL(blob); + + return fetch_should_succeed(t, url).then(text => { + assert_equals(text, blob_contents); + }); + }, 'Blob URLs can be used in ' + fetch_method); + + promise_test(t => { + const url = URL.createObjectURL(blob); + + return fetch_should_succeed(t, url + '#fragment').then(text => { + assert_equals(text, blob_contents); + }); + }, fetch_method + ' with a fragment should succeed'); + + promise_test(t => { + const url = URL.createObjectURL(blob); + URL.revokeObjectURL(url); + + return fetch_should_fail(t, url); + }, fetch_method + ' of a revoked URL should fail'); + + promise_test(t => { + const url = URL.createObjectURL(blob); + URL.revokeObjectURL(url + '#fragment'); + + return fetch_should_succeed(t, url).then(text => { + assert_equals(text, blob_contents); + }); + }, 'Only exact matches should revoke URLs, using ' + fetch_method); + + promise_test(t => { + const url = URL.createObjectURL(blob); + + return fetch_should_fail(t, url + '?querystring'); + }, 'Appending a query string should cause ' + fetch_method + ' to fail'); + + promise_test(t => { + const url = URL.createObjectURL(blob); + + return fetch_should_fail(t, url + '/path'); + }, 'Appending a path should cause ' + fetch_method + ' to fail'); + + for (const method of ['HEAD', 'POST', 'DELETE', 'OPTIONS', 'PUT', 'CUSTOM']) { + const url = URL.createObjectURL(blob); + + promise_test(t => { + return fetch_should_fail(t, url, method); + }, fetch_method + ' with method "' + method + '" should fail'); + } +} \ No newline at end of file diff --git a/test/fixtures/wpt/FileAPI/url/resources/revoke-helper.html b/test/fixtures/wpt/FileAPI/url/resources/revoke-helper.html new file mode 100644 index 00000000000000..adf5a014a668d6 --- /dev/null +++ b/test/fixtures/wpt/FileAPI/url/resources/revoke-helper.html @@ -0,0 +1,7 @@ + + \ No newline at end of file diff --git a/test/fixtures/wpt/FileAPI/url/resources/revoke-helper.js b/test/fixtures/wpt/FileAPI/url/resources/revoke-helper.js new file mode 100644 index 00000000000000..c3e05b64b1a6c8 --- /dev/null +++ b/test/fixtures/wpt/FileAPI/url/resources/revoke-helper.js @@ -0,0 +1,9 @@ +self.addEventListener('message', e => { + URL.revokeObjectURL(e.data.url); + // Registering a new object URL will make absolutely sure that the revocation + // has propagated. Without this at least in chrome it is possible for the + // below postMessage to arrive at its destination before the revocation has + // been fully processed. + URL.createObjectURL(new Blob([])); + self.postMessage('revoked'); +}); diff --git a/test/fixtures/wpt/FileAPI/url/sandboxed-iframe.html b/test/fixtures/wpt/FileAPI/url/sandboxed-iframe.html new file mode 100644 index 00000000000000..a52939a3eb297c --- /dev/null +++ b/test/fixtures/wpt/FileAPI/url/sandboxed-iframe.html @@ -0,0 +1,32 @@ + + +FileAPI Test: Verify behavior of Blob URL in unique origins + + + + + + + diff --git a/test/fixtures/wpt/FileAPI/url/unicode-origin.sub.html b/test/fixtures/wpt/FileAPI/url/unicode-origin.sub.html new file mode 100644 index 00000000000000..2c4921c0344998 --- /dev/null +++ b/test/fixtures/wpt/FileAPI/url/unicode-origin.sub.html @@ -0,0 +1,23 @@ + + +FileAPI Test: Verify origin of Blob URL + + + + diff --git a/test/fixtures/wpt/FileAPI/url/url-charset.window.js b/test/fixtures/wpt/FileAPI/url/url-charset.window.js new file mode 100644 index 00000000000000..777709b64a50e5 --- /dev/null +++ b/test/fixtures/wpt/FileAPI/url/url-charset.window.js @@ -0,0 +1,34 @@ +async_test(t => { + // This could be detected as ISO-2022-JP, in which case there would be no + // bbb` + ], + {type: 'text/html;charset=utf-8'}); + const url = URL.createObjectURL(blob); + const win = window.open(url); + t.add_cleanup(() => { + win.close(); + }); + + win.onload = t.step_func_done(() => { + assert_equals(win.document.charset, 'UTF-8'); + }); +}, 'Blob charset should override any auto-detected charset.'); + +async_test(t => { + const blob = new Blob( + [`\n`], + {type: 'text/html;charset=utf-8'}); + const url = URL.createObjectURL(blob); + const win = window.open(url); + t.add_cleanup(() => { + win.close(); + }); + + win.onload = t.step_func_done(() => { + assert_equals(win.document.charset, 'UTF-8'); + }); +}, 'Blob charset should override .'); diff --git a/test/fixtures/wpt/FileAPI/url/url-format.any.js b/test/fixtures/wpt/FileAPI/url/url-format.any.js new file mode 100644 index 00000000000000..33732fa61fc3dd --- /dev/null +++ b/test/fixtures/wpt/FileAPI/url/url-format.any.js @@ -0,0 +1,64 @@ +// META: timeout=long +const blob = new Blob(['test']); +const file = new File(['test'], 'name'); + +test(() => { + const url_count = 5000; + let list = []; + + for (let i = 0; i < url_count; ++i) + list.push(URL.createObjectURL(blob)); + + list.sort(); + + for (let i = 1; i < list.length; ++i) + assert_not_equals(list[i], list[i-1], 'generated Blob URLs should be unique'); +}, 'Generated Blob URLs are unique'); + +test(() => { + const url = URL.createObjectURL(blob); + assert_equals(typeof url, 'string'); + assert_true(url.startsWith('blob:')); +}, 'Blob URL starts with "blob:"'); + +test(() => { + const url = URL.createObjectURL(file); + assert_equals(typeof url, 'string'); + assert_true(url.startsWith('blob:')); +}, 'Blob URL starts with "blob:" for Files'); + +test(() => { + const url = URL.createObjectURL(blob); + assert_equals(new URL(url).origin, location.origin); + if (location.origin !== 'null') { + assert_true(url.includes(location.origin)); + assert_true(url.startsWith('blob:' + location.protocol)); + } +}, 'Origin of Blob URL matches our origin'); + +test(() => { + const url = URL.createObjectURL(blob); + const url_record = new URL(url); + assert_equals(url_record.protocol, 'blob:'); + assert_equals(url_record.origin, location.origin); + assert_equals(url_record.host, '', 'host should be an empty string'); + assert_equals(url_record.port, '', 'port should be an empty string'); + const uuid_path_re = /\/[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i; + assert_true(uuid_path_re.test(url_record.pathname), 'Path must end with a valid UUID'); + if (location.origin !== 'null') { + const nested_url = new URL(url_record.pathname); + assert_equals(nested_url.origin, location.origin); + assert_equals(nested_url.pathname.search(uuid_path_re), 0, 'Path must be a valid UUID'); + assert_true(url.includes(location.origin)); + assert_true(url.startsWith('blob:' + location.protocol)); + } +}, 'Blob URL parses correctly'); + +test(() => { + const url = URL.createObjectURL(file); + assert_equals(new URL(url).origin, location.origin); + if (location.origin !== 'null') { + assert_true(url.includes(location.origin)); + assert_true(url.startsWith('blob:' + location.protocol)); + } +}, 'Origin of Blob URL matches our origin for Files'); diff --git a/test/fixtures/wpt/FileAPI/url/url-in-tags-revoke.window.js b/test/fixtures/wpt/FileAPI/url/url-in-tags-revoke.window.js new file mode 100644 index 00000000000000..1cdad79f7e34e0 --- /dev/null +++ b/test/fixtures/wpt/FileAPI/url/url-in-tags-revoke.window.js @@ -0,0 +1,115 @@ +// META: timeout=long +async_test(t => { + const run_result = 'test_frame_OK'; + const blob_contents = '\n\n' + + ''; + const blob = new Blob([blob_contents], {type: 'text/html'}); + const url = URL.createObjectURL(blob); + + const frame = document.createElement('iframe'); + frame.setAttribute('src', url); + frame.setAttribute('style', 'display:none;'); + document.body.appendChild(frame); + URL.revokeObjectURL(url); + + frame.onload = t.step_func_done(() => { + assert_equals(frame.contentWindow.test_result, run_result); + }); +}, 'Fetching a blob URL immediately before revoking it works in an iframe.'); + +async_test(t => { + const run_result = 'test_frame_OK'; + const blob_contents = '\n\n' + + ''; + const blob = new Blob([blob_contents], {type: 'text/html'}); + const url = URL.createObjectURL(blob); + + const frame = document.createElement('iframe'); + frame.setAttribute('src', '/common/blank.html'); + frame.setAttribute('style', 'display:none;'); + document.body.appendChild(frame); + + frame.onload = t.step_func(() => { + frame.contentWindow.location = url; + URL.revokeObjectURL(url); + frame.onload = t.step_func_done(() => { + assert_equals(frame.contentWindow.test_result, run_result); + }); + }); +}, 'Fetching a blob URL immediately before revoking it works in an iframe navigation.'); + +async_test(t => { + const run_result = 'test_frame_OK'; + const blob_contents = '\n\n' + + ''; + const blob = new Blob([blob_contents], {type: 'text/html'}); + const url = URL.createObjectURL(blob); + const win = window.open(url); + URL.revokeObjectURL(url); + add_completion_callback(() => { win.close(); }); + + win.onload = t.step_func_done(() => { + assert_equals(win.test_result, run_result); + }); +}, 'Opening a blob URL in a new window immediately before revoking it works.'); + +function receive_message_on_channel(t, channel_name) { + const channel = new BroadcastChannel(channel_name); + return new Promise(resolve => { + channel.addEventListener('message', t.step_func(e => { + resolve(e.data); + })); + }); +} + +function window_contents_for_channel(channel_name) { + return '\n' + + ''; +} + +async_test(t => { + const channel_name = 'noopener-window-test'; + const blob = new Blob([window_contents_for_channel(channel_name)], {type: 'text/html'}); + receive_message_on_channel(t, channel_name).then(t.step_func_done(t => { + assert_equals(t, 'foobar'); + })); + const url = URL.createObjectURL(blob); + const win = window.open(); + win.opener = null; + win.location = url; + URL.revokeObjectURL(url); +}, 'Opening a blob URL in a noopener about:blank window immediately before revoking it works.'); + +async_test(t => { + const run_result = 'test_script_OK'; + const blob_contents = 'window.script_test_result = "' + run_result + '";'; + const blob = new Blob([blob_contents]); + const url = URL.createObjectURL(blob); + + const e = document.createElement('script'); + e.setAttribute('src', url); + e.onload = t.step_func_done(() => { + assert_equals(window.script_test_result, run_result); + }); + + document.body.appendChild(e); + URL.revokeObjectURL(url); +}, 'Fetching a blob URL immediately before revoking it works in '; + const blob = new Blob([blob_contents], {type: 'text/html'}); + const url = URL.createObjectURL(blob); + + const frame = document.createElement('iframe'); + frame.setAttribute('src', url); + frame.setAttribute('style', 'display:none;'); + document.body.appendChild(frame); + + frame.onload = t.step_func_done(() => { + assert_equals(frame.contentWindow.test_result, run_result); + }); +}, 'Blob URLs can be used in iframes, and are treated same origin'); + +async_test(t => { + const blob_contents = '\n\n' + + '\n' + + '\n' + + '
\n' + + '
'; + const blob = new Blob([blob_contents], {type: 'text/html'}); + const url = URL.createObjectURL(blob); + + const frame = document.createElement('iframe'); + frame.setAttribute('src', url + '#block2'); + document.body.appendChild(frame); + frame.contentWindow.onscroll = t.step_func_done(() => { + assert_equals(frame.contentWindow.scrollY, 5000); + }); +}, 'Blob URL fragment is implemented.'); diff --git a/test/fixtures/wpt/FileAPI/url/url-lifetime.html b/test/fixtures/wpt/FileAPI/url/url-lifetime.html new file mode 100644 index 00000000000000..ad5d667193a3d0 --- /dev/null +++ b/test/fixtures/wpt/FileAPI/url/url-lifetime.html @@ -0,0 +1,56 @@ + + + + + + \ No newline at end of file diff --git a/test/fixtures/wpt/FileAPI/url/url-reload.window.js b/test/fixtures/wpt/FileAPI/url/url-reload.window.js new file mode 100644 index 00000000000000..d333b3a74aa82c --- /dev/null +++ b/test/fixtures/wpt/FileAPI/url/url-reload.window.js @@ -0,0 +1,36 @@ +function blob_url_reload_test(t, revoke_before_reload) { + const run_result = 'test_frame_OK'; + const blob_contents = '\n\n' + + ''; + const blob = new Blob([blob_contents], {type: 'text/html'}); + const url = URL.createObjectURL(blob); + + const frame = document.createElement('iframe'); + frame.setAttribute('src', url); + frame.setAttribute('style', 'display:none;'); + document.body.appendChild(frame); + + frame.onload = t.step_func(() => { + if (revoke_before_reload) + URL.revokeObjectURL(url); + assert_equals(frame.contentWindow.test_result, run_result); + frame.contentWindow.test_result = null; + frame.onload = t.step_func_done(() => { + assert_equals(frame.contentWindow.test_result, run_result); + }); + // Slight delay before reloading to ensure revoke actually has had a chance + // to be processed. + t.step_timeout(() => { + frame.contentWindow.location.reload(); + }, 250); + }); +} + +async_test(t => { + blob_url_reload_test(t, false); +}, 'Reloading a blob URL succeeds.'); + + +async_test(t => { + blob_url_reload_test(t, true); +}, 'Reloading a blob URL succeeds even if the URL was revoked.'); diff --git a/test/fixtures/wpt/FileAPI/url/url-with-fetch.any.js b/test/fixtures/wpt/FileAPI/url/url-with-fetch.any.js new file mode 100644 index 00000000000000..9bd8d383df4e1e --- /dev/null +++ b/test/fixtures/wpt/FileAPI/url/url-with-fetch.any.js @@ -0,0 +1,53 @@ +// META: script=resources/fetch-tests.js + +function fetch_should_succeed(test, request) { + return fetch(request).then(response => response.text()); +} + +function fetch_should_fail(test, url, method = 'GET') { + return promise_rejects_js(test, TypeError, fetch(url, {method: method})); +} + +fetch_tests('fetch', fetch_should_succeed, fetch_should_fail); + +promise_test(t => { + const blob_contents = 'test blob contents'; + const blob_type = 'image/png'; + const blob = new Blob([blob_contents], {type: blob_type}); + const url = URL.createObjectURL(blob); + + return fetch(url).then(response => { + assert_equals(response.headers.get('Content-Type'), blob_type); + }); +}, 'fetch should return Content-Type from Blob'); + +promise_test(t => { + const blob_contents = 'test blob contents'; + const blob = new Blob([blob_contents]); + const url = URL.createObjectURL(blob); + const request = new Request(url); + + // Revoke the object URL. Request should take a reference to the blob as + // soon as it receives it in open(), so the request succeeds even though we + // revoke the URL before calling fetch(). + URL.revokeObjectURL(url); + + return fetch_should_succeed(t, request).then(text => { + assert_equals(text, blob_contents); + }); +}, 'Revoke blob URL after creating Request, will fetch'); + +promise_test(function(t) { + const blob_contents = 'test blob contents'; + const blob = new Blob([blob_contents]); + const url = URL.createObjectURL(blob); + + const result = fetch_should_succeed(t, url).then(text => { + assert_equals(text, blob_contents); + }); + + // Revoke the object URL. fetch should have already resolved the blob URL. + URL.revokeObjectURL(url); + + return result; +}, 'Revoke blob URL after calling fetch, fetch should succeed'); diff --git a/test/fixtures/wpt/FileAPI/url/url-with-xhr.any.js b/test/fixtures/wpt/FileAPI/url/url-with-xhr.any.js new file mode 100644 index 00000000000000..29d83080ab5845 --- /dev/null +++ b/test/fixtures/wpt/FileAPI/url/url-with-xhr.any.js @@ -0,0 +1,68 @@ +// META: script=resources/fetch-tests.js + +function xhr_should_succeed(test, url) { + return new Promise((resolve, reject) => { + const xhr = new XMLHttpRequest(); + xhr.open('GET', url); + xhr.onload = test.step_func(() => { + assert_equals(xhr.status, 200); + assert_equals(xhr.statusText, 'OK'); + resolve(xhr.response); + }); + xhr.onerror = () => reject('Got unexpected error event'); + xhr.send(); + }); +} + +function xhr_should_fail(test, url, method = 'GET') { + const xhr = new XMLHttpRequest(); + xhr.open(method, url); + const result1 = new Promise((resolve, reject) => { + xhr.onload = () => reject('Got unexpected load event'); + xhr.onerror = resolve; + }); + const result2 = new Promise(resolve => { + xhr.onreadystatechange = test.step_func(() => { + if (xhr.readyState !== xhr.DONE) return; + assert_equals(xhr.status, 0); + resolve(); + }); + }); + xhr.send(); + return Promise.all([result1, result2]); +} + +fetch_tests('XHR', xhr_should_succeed, xhr_should_fail); + +async_test(t => { + const blob_contents = 'test blob contents'; + const blob_type = 'image/png'; + const blob = new Blob([blob_contents], {type: blob_type}); + const url = URL.createObjectURL(blob); + const xhr = new XMLHttpRequest(); + xhr.open('GET', url); + xhr.onloadend = t.step_func_done(() => { + assert_equals(xhr.getResponseHeader('Content-Type'), blob_type); + }); + xhr.send(); +}, 'XHR should return Content-Type from Blob'); + +async_test(t => { + const blob_contents = 'test blob contents'; + const blob = new Blob([blob_contents]); + const url = URL.createObjectURL(blob); + const xhr = new XMLHttpRequest(); + xhr.open('GET', url); + + // Revoke the object URL. XHR should take a reference to the blob as soon as + // it receives it in open(), so the request succeeds even though we revoke the + // URL before calling send(). + URL.revokeObjectURL(url); + + xhr.onload = t.step_func_done(() => { + assert_equals(xhr.response, blob_contents); + }); + xhr.onerror = t.unreached_func('Got unexpected error event'); + + xhr.send(); +}, 'Revoke blob URL after open(), will fetch'); diff --git a/test/fixtures/wpt/FileAPI/url/url_createobjecturl_file-manual.html b/test/fixtures/wpt/FileAPI/url/url_createobjecturl_file-manual.html new file mode 100644 index 00000000000000..7ae32512e07c76 --- /dev/null +++ b/test/fixtures/wpt/FileAPI/url/url_createobjecturl_file-manual.html @@ -0,0 +1,45 @@ + + +FileAPI Test: Creating Blob URL with File + + + + + + +
+

Test steps:

+
    +
  1. Download blue96x96.png to local.
  2. +
  3. Select the local file (blue96x96.png) to run the test.
  4. +
+
+ +
+ +
+ +
+ + + diff --git a/test/fixtures/wpt/FileAPI/url/url_createobjecturl_file_img-manual.html b/test/fixtures/wpt/FileAPI/url/url_createobjecturl_file_img-manual.html new file mode 100644 index 00000000000000..534c1de9968da8 --- /dev/null +++ b/test/fixtures/wpt/FileAPI/url/url_createobjecturl_file_img-manual.html @@ -0,0 +1,28 @@ + + +FileAPI Test: Creating Blob URL with File as image source + + + +
+

Test steps:

+
    +
  1. Download blue96x96.png to local.
  2. +
  3. Select the local file (blue96x96.png) to run the test.
  4. +
+

Pass/fail criteria:

+

Test passes if there is a filled blue square.

+ +

+

+
+ + + diff --git a/test/fixtures/wpt/FileAPI/url/url_xmlhttprequest_img-ref.html b/test/fixtures/wpt/FileAPI/url/url_xmlhttprequest_img-ref.html new file mode 100644 index 00000000000000..7d7390442d3631 --- /dev/null +++ b/test/fixtures/wpt/FileAPI/url/url_xmlhttprequest_img-ref.html @@ -0,0 +1,12 @@ + + +FileAPI Reference File + + + +

Test passes if there is a filled blue square.

+ +

+ +

+ diff --git a/test/fixtures/wpt/FileAPI/url/url_xmlhttprequest_img.html b/test/fixtures/wpt/FileAPI/url/url_xmlhttprequest_img.html new file mode 100644 index 00000000000000..468dcb086d770a --- /dev/null +++ b/test/fixtures/wpt/FileAPI/url/url_xmlhttprequest_img.html @@ -0,0 +1,27 @@ + + + +FileAPI Test: Creating Blob URL via XMLHttpRequest as image source + + + + +

Test passes if there is a filled blue square.

+ +

+ +

+ + + + diff --git a/test/fixtures/wpt/README.md b/test/fixtures/wpt/README.md index 855fca6d179ff6..4a5d73c742acea 100644 --- a/test/fixtures/wpt/README.md +++ b/test/fixtures/wpt/README.md @@ -11,15 +11,16 @@ 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 - common: https://github.com/web-platform-tests/wpt/tree/4dacb6e2ff/common - dom/abort: https://github.com/web-platform-tests/wpt/tree/7caa3de747/dom/abort +- FileAPI: https://github.com/web-platform-tests/wpt/tree/d9d921b8f9/FileAPI [Web Platform Tests]: https://github.com/web-platform-tests/wpt [`git node wpt`]: https://github.com/nodejs/node-core-utils/blob/master/docs/git-node.md#git-node-wpt 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..20fed894db94b6 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": { @@ -38,5 +38,9 @@ "dom/abort": { "commit": "7caa3de7471cf19b78ee9efa313c7341a462b5e3", "path": "dom/abort" + }, + "FileAPI": { + "commit": "d9d921b8f9235e0d2ec92672040c0ccfc8262e21", + "path": "FileAPI" } } \ No newline at end of file diff --git a/test/known_issues/test-dgram-bind-shared-ports-after-port-0.js b/test/known_issues/test-dgram-bind-shared-ports-after-port-0.js index 5ceac4ebeeb5ec..089a5836520059 100644 --- a/test/known_issues/test-dgram-bind-shared-ports-after-port-0.js +++ b/test/known_issues/test-dgram-bind-shared-ports-after-port-0.js @@ -13,7 +13,7 @@ const cluster = require('cluster'); const dgram = require('dgram'); const BYE = 'bye'; -if (cluster.isMaster) { +if (cluster.isPrimary) { const worker1 = cluster.fork(); // Verify that Windows doesn't support this scenario @@ -40,7 +40,7 @@ if (cluster.isMaster) { worker2.send(BYE); }); }); - // end master code + // end primary code } else { // worker code process.on('message', (msg) => msg === BYE && process.exit(0)); diff --git a/test/known_issues/test-inspector-cluster-port-clash.js b/test/known_issues/test-inspector-cluster-port-clash.js index f5baedf8aa670b..e5daee61b78ff6 100644 --- a/test/known_issues/test-inspector-cluster-port-clash.js +++ b/test/known_issues/test-inspector-cluster-port-clash.js @@ -47,7 +47,7 @@ function serialFork() { }); } -if (cluster.isMaster) { +if (cluster.isPrimary) { cluster.on('online', common.mustCall((worker) => worker.send('dbgport'), 2)); // Block one of the ports with a listening socket. 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..f5bb33cfa64915 100644 --- a/test/parallel/parallel.status +++ b/test/parallel/parallel.status @@ -69,3 +69,7 @@ test-net-write-after-end-nt: SKIP test-tls-env-extra-ca: SKIP # https://github.com/nodejs/node/pull/34209 test-dgram-error-message-address: SKIP +# https://github.com/nodejs/node/issues/36929 +test-crypto-secure-heap: PASS,FLAKY +# https://github.com/nodejs/node/issues/36925 +test-fs-read-type: PASS,FLAKY diff --git a/test/parallel/test-asyncresource-bind.js b/test/parallel/test-asyncresource-bind.js index 3aeed475aee126..a9f613d9302edf 100644 --- a/test/parallel/test-asyncresource-bind.js +++ b/test/parallel/test-asyncresource-bind.js @@ -33,3 +33,19 @@ setImmediate(() => { assert.strictEqual(asyncResource.asyncId(), fn2()); assert.notStrictEqual(asyncId, fn2()); }); + +const foo = {}; +const fn3 = asyncResource.bind(common.mustCall(function() { + assert.strictEqual(this, foo); +}), foo); +fn3(); + +const fn4 = asyncResource.bind(common.mustCall(function() { + assert.strictEqual(this, asyncResource); +})); +fn4(); + +const fn5 = asyncResource.bind(common.mustCall(function() { + assert.strictEqual(this, false); +}), false); +fn5(); diff --git a/test/parallel/test-blob.js b/test/parallel/test-blob.js new file mode 100644 index 00000000000000..795d4bb6fbdff5 --- /dev/null +++ b/test/parallel/test-blob.js @@ -0,0 +1,186 @@ +'use strict'; + +const common = require('../common'); +const assert = require('assert'); +const { Blob } = require('buffer'); + +{ + const b = new Blob(); + assert.strictEqual(b.size, 0); + assert.strictEqual(b.type, ''); +} + +assert.throws(() => new Blob(false), { + code: 'ERR_INVALID_ARG_TYPE' +}); + +assert.throws(() => new Blob('hello'), { + code: 'ERR_INVALID_ARG_TYPE' +}); + +assert.throws(() => new Blob({}), { + code: 'ERR_INVALID_ARG_TYPE' +}); + +assert.throws(() => new Blob(['test', 1]), { + code: 'ERR_INVALID_ARG_TYPE' +}); + +{ + const b = new Blob([]); + assert(b); + assert.strictEqual(b.size, 0); + assert.strictEqual(b.type, ''); + + b.arrayBuffer().then(common.mustCall((ab) => { + assert.deepStrictEqual(ab, new ArrayBuffer(0)); + })); + b.text().then(common.mustCall((text) => { + assert.strictEqual(text, ''); + })); + const c = b.slice(); + assert.strictEqual(c.size, 0); +} + +{ + assert.throws(() => new Blob([], { type: 1 }), { + code: 'ERR_INVALID_ARG_TYPE' + }); + assert.throws(() => new Blob([], { type: false }), { + code: 'ERR_INVALID_ARG_TYPE' + }); + assert.throws(() => new Blob([], { type: {} }), { + code: 'ERR_INVALID_ARG_TYPE' + }); +} + +{ + const b = new Blob(['616263'], { encoding: 'hex', type: 'foo' }); + assert.strictEqual(b.size, 3); + assert.strictEqual(b.type, 'foo'); + b.text().then(common.mustCall((text) => { + assert.strictEqual(text, 'abc'); + })); +} + +{ + const b = new Blob([Buffer.from('abc')]); + assert.strictEqual(b.size, 3); + b.text().then(common.mustCall((text) => { + assert.strictEqual(text, 'abc'); + })); +} + +{ + const b = new Blob([new ArrayBuffer(3)]); + assert.strictEqual(b.size, 3); + b.text().then(common.mustCall((text) => { + assert.strictEqual(text, '\0\0\0'); + })); +} + +{ + const b = new Blob([new Uint8Array(3)]); + assert.strictEqual(b.size, 3); + b.text().then(common.mustCall((text) => { + assert.strictEqual(text, '\0\0\0'); + })); +} + +{ + const b = new Blob([new Blob(['abc'])]); + assert.strictEqual(b.size, 3); + b.text().then(common.mustCall((text) => { + assert.strictEqual(text, 'abc'); + })); +} + +{ + const b = new Blob(['hello', Buffer.from('world')]); + assert.strictEqual(b.size, 10); + b.text().then(common.mustCall((text) => { + assert.strictEqual(text, 'helloworld'); + })); +} + +{ + const b = new Blob( + [ + 'h', + 'e', + 'l', + 'lo', + Buffer.from('world') + ]); + assert.strictEqual(b.size, 10); + b.text().then(common.mustCall((text) => { + assert.strictEqual(text, 'helloworld'); + })); +} + +{ + const b = new Blob(['hello', Buffer.from('world')]); + assert.strictEqual(b.size, 10); + assert.strictEqual(b.type, ''); + + const c = b.slice(1, -1, 'foo'); + assert.strictEqual(c.type, 'foo'); + c.text().then(common.mustCall((text) => { + assert.strictEqual(text, 'elloworl'); + })); + + const d = c.slice(1, -1); + d.text().then(common.mustCall((text) => { + assert.strictEqual(text, 'llowor'); + })); + + const e = d.slice(1, -1); + e.text().then(common.mustCall((text) => { + assert.strictEqual(text, 'lowo'); + })); + + const f = e.slice(1, -1); + f.text().then(common.mustCall((text) => { + assert.strictEqual(text, 'ow'); + })); + + const g = f.slice(1, -1); + assert.strictEqual(g.type, 'foo'); + g.text().then(common.mustCall((text) => { + assert.strictEqual(text, ''); + })); + + assert.strictEqual(b.size, 10); + assert.strictEqual(b.type, ''); + + assert.throws(() => b.slice(-1, 1), { + code: 'ERR_OUT_OF_RANGE' + }); + assert.throws(() => b.slice(1, 100), { + code: 'ERR_OUT_OF_RANGE' + }); + + assert.throws(() => b.slice(1, 2, false), { + code: 'ERR_INVALID_ARG_TYPE' + }); +} + +{ + const b = new Blob([Buffer.from('hello'), Buffer.from('world')]); + const mc = new MessageChannel(); + mc.port1.onmessage = common.mustCall(({ data }) => { + data.text().then(common.mustCall((text) => { + assert.strictEqual(text, 'helloworld'); + })); + mc.port1.close(); + }); + mc.port2.postMessage(b); + b.text().then(common.mustCall((text) => { + assert.strictEqual(text, 'helloworld'); + })); +} + +{ + const b = new Blob(['hello'], { type: '\x01' }); + assert.strictEqual(b.type, ''); +} 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-bootstrap-modules.js b/test/parallel/test-bootstrap-modules.js index 0887b8a48362f6..105bfb10866499 100644 --- a/test/parallel/test-bootstrap-modules.js +++ b/test/parallel/test-bootstrap-modules.js @@ -101,6 +101,7 @@ const expectedModules = new Set([ 'NativeModule internal/vm/module', 'NativeModule internal/worker/io', 'NativeModule internal/worker/js_transferable', + 'NativeModule internal/blob', 'NativeModule path', 'NativeModule stream', 'NativeModule timers', diff --git a/test/parallel/test-buffer-alloc.js b/test/parallel/test-buffer-alloc.js index c72e286f3f0e2c..1368136abe8f22 100644 --- a/test/parallel/test-buffer-alloc.js +++ b/test/parallel/test-buffer-alloc.js @@ -293,14 +293,40 @@ Buffer.alloc(1).write('', 1, 0); // Test toString('base64') // assert.strictEqual((Buffer.from('Man')).toString('base64'), 'TWFu'); +assert.strictEqual((Buffer.from('Woman')).toString('base64'), 'V29tYW4='); + +// +// Test toString('base64url') +// +assert.strictEqual((Buffer.from('Man')).toString('base64url'), 'TWFu'); +assert.strictEqual((Buffer.from('Woman')).toString('base64url'), 'V29tYW4'); { - // Test that regular and URL-safe base64 both work + // Test that regular and URL-safe base64 both work both ways const expected = [0xff, 0xff, 0xbe, 0xff, 0xef, 0xbf, 0xfb, 0xef, 0xff]; assert.deepStrictEqual(Buffer.from('//++/++/++//', 'base64'), Buffer.from(expected)); assert.deepStrictEqual(Buffer.from('__--_--_--__', 'base64'), Buffer.from(expected)); + assert.deepStrictEqual(Buffer.from('//++/++/++//', 'base64url'), + Buffer.from(expected)); + assert.deepStrictEqual(Buffer.from('__--_--_--__', 'base64url'), + Buffer.from(expected)); +} + +const base64flavors = ['base64', 'base64url']; + +{ + // Test that regular and URL-safe base64 both work both ways with padding + const expected = [0xff, 0xff, 0xbe, 0xff, 0xef, 0xbf, 0xfb, 0xef, 0xff, 0xfb]; + assert.deepStrictEqual(Buffer.from('//++/++/++//+w==', 'base64'), + Buffer.from(expected)); + assert.deepStrictEqual(Buffer.from('//++/++/++//+w==', 'base64'), + Buffer.from(expected)); + assert.deepStrictEqual(Buffer.from('//++/++/++//+w==', 'base64url'), + Buffer.from(expected)); + assert.deepStrictEqual(Buffer.from('//++/++/++//+w==', 'base64url'), + Buffer.from(expected)); } { @@ -317,137 +343,182 @@ assert.strictEqual((Buffer.from('Man')).toString('base64'), 'TWFu'); 'dWVkIGFuZCBpbmRlZmF0aWdhYmxlIGdlbmVyYXRpb24gb2Yga25vd2xlZ' + 'GdlLCBleGNlZWRzIHRoZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm' + '5hbCBwbGVhc3VyZS4='; - assert.strictEqual((Buffer.from(quote)).toString('base64'), expected); - - let b = Buffer.allocUnsafe(1024); - let bytesWritten = b.write(expected, 0, 'base64'); - assert.strictEqual(quote.length, bytesWritten); - assert.strictEqual(quote, b.toString('ascii', 0, quote.length)); - - // Check that the base64 decoder ignores whitespace - const expectedWhite = `${expected.slice(0, 60)} \n` + - `${expected.slice(60, 120)} \n` + - `${expected.slice(120, 180)} \n` + - `${expected.slice(180, 240)} \n` + - `${expected.slice(240, 300)}\n` + - `${expected.slice(300, 360)}\n`; - b = Buffer.allocUnsafe(1024); - bytesWritten = b.write(expectedWhite, 0, 'base64'); - assert.strictEqual(quote.length, bytesWritten); - assert.strictEqual(quote, b.toString('ascii', 0, quote.length)); - - // Check that the base64 decoder on the constructor works - // even in the presence of whitespace. - b = Buffer.from(expectedWhite, 'base64'); - assert.strictEqual(quote.length, b.length); - assert.strictEqual(quote, b.toString('ascii', 0, quote.length)); - - // Check that the base64 decoder ignores illegal chars - const expectedIllegal = expected.slice(0, 60) + ' \x80' + - expected.slice(60, 120) + ' \xff' + - expected.slice(120, 180) + ' \x00' + - expected.slice(180, 240) + ' \x98' + - expected.slice(240, 300) + '\x03' + - expected.slice(300, 360); - b = Buffer.from(expectedIllegal, 'base64'); - assert.strictEqual(quote.length, b.length); - assert.strictEqual(quote, b.toString('ascii', 0, quote.length)); + assert.strictEqual(Buffer.from(quote).toString('base64'), expected); + assert.strictEqual( + Buffer.from(quote).toString('base64url'), + expected.replaceAll('+', '-').replaceAll('/', '_').replaceAll('=', '') + ); + + base64flavors.forEach((encoding) => { + let b = Buffer.allocUnsafe(1024); + let bytesWritten = b.write(expected, 0, encoding); + assert.strictEqual(quote.length, bytesWritten); + assert.strictEqual(quote, b.toString('ascii', 0, quote.length)); + + // Check that the base64 decoder ignores whitespace + const expectedWhite = `${expected.slice(0, 60)} \n` + + `${expected.slice(60, 120)} \n` + + `${expected.slice(120, 180)} \n` + + `${expected.slice(180, 240)} \n` + + `${expected.slice(240, 300)}\n` + + `${expected.slice(300, 360)}\n`; + b = Buffer.allocUnsafe(1024); + bytesWritten = b.write(expectedWhite, 0, encoding); + assert.strictEqual(quote.length, bytesWritten); + assert.strictEqual(quote, b.toString('ascii', 0, quote.length)); + + // Check that the base64 decoder on the constructor works + // even in the presence of whitespace. + b = Buffer.from(expectedWhite, encoding); + assert.strictEqual(quote.length, b.length); + assert.strictEqual(quote, b.toString('ascii', 0, quote.length)); + + // Check that the base64 decoder ignores illegal chars + const expectedIllegal = expected.slice(0, 60) + ' \x80' + + expected.slice(60, 120) + ' \xff' + + expected.slice(120, 180) + ' \x00' + + expected.slice(180, 240) + ' \x98' + + expected.slice(240, 300) + '\x03' + + expected.slice(300, 360); + b = Buffer.from(expectedIllegal, encoding); + assert.strictEqual(quote.length, b.length); + assert.strictEqual(quote, b.toString('ascii', 0, quote.length)); + }); } -assert.strictEqual(Buffer.from('', 'base64').toString(), ''); -assert.strictEqual(Buffer.from('K', 'base64').toString(), ''); - -// multiple-of-4 with padding -assert.strictEqual(Buffer.from('Kg==', 'base64').toString(), '*'); -assert.strictEqual(Buffer.from('Kio=', 'base64').toString(), '*'.repeat(2)); -assert.strictEqual(Buffer.from('Kioq', 'base64').toString(), '*'.repeat(3)); -assert.strictEqual(Buffer.from('KioqKg==', 'base64').toString(), '*'.repeat(4)); -assert.strictEqual(Buffer.from('KioqKio=', 'base64').toString(), '*'.repeat(5)); -assert.strictEqual(Buffer.from('KioqKioq', 'base64').toString(), '*'.repeat(6)); -assert.strictEqual(Buffer.from('KioqKioqKg==', 'base64').toString(), - '*'.repeat(7)); -assert.strictEqual(Buffer.from('KioqKioqKio=', 'base64').toString(), - '*'.repeat(8)); -assert.strictEqual(Buffer.from('KioqKioqKioq', 'base64').toString(), - '*'.repeat(9)); -assert.strictEqual(Buffer.from('KioqKioqKioqKg==', 'base64').toString(), - '*'.repeat(10)); -assert.strictEqual(Buffer.from('KioqKioqKioqKio=', 'base64').toString(), - '*'.repeat(11)); -assert.strictEqual(Buffer.from('KioqKioqKioqKioq', 'base64').toString(), - '*'.repeat(12)); -assert.strictEqual(Buffer.from('KioqKioqKioqKioqKg==', 'base64').toString(), - '*'.repeat(13)); -assert.strictEqual(Buffer.from('KioqKioqKioqKioqKio=', 'base64').toString(), - '*'.repeat(14)); -assert.strictEqual(Buffer.from('KioqKioqKioqKioqKioq', 'base64').toString(), - '*'.repeat(15)); -assert.strictEqual(Buffer.from('KioqKioqKioqKioqKioqKg==', 'base64').toString(), - '*'.repeat(16)); -assert.strictEqual(Buffer.from('KioqKioqKioqKioqKioqKio=', 'base64').toString(), - '*'.repeat(17)); -assert.strictEqual(Buffer.from('KioqKioqKioqKioqKioqKioq', 'base64').toString(), - '*'.repeat(18)); -assert.strictEqual(Buffer.from('KioqKioqKioqKioqKioqKioqKg==', - 'base64').toString(), - '*'.repeat(19)); -assert.strictEqual(Buffer.from('KioqKioqKioqKioqKioqKioqKio=', - 'base64').toString(), - '*'.repeat(20)); - -// No padding, not a multiple of 4 -assert.strictEqual(Buffer.from('Kg', 'base64').toString(), '*'); -assert.strictEqual(Buffer.from('Kio', 'base64').toString(), '*'.repeat(2)); -assert.strictEqual(Buffer.from('KioqKg', 'base64').toString(), '*'.repeat(4)); -assert.strictEqual(Buffer.from('KioqKio', 'base64').toString(), '*'.repeat(5)); -assert.strictEqual(Buffer.from('KioqKioqKg', 'base64').toString(), - '*'.repeat(7)); -assert.strictEqual(Buffer.from('KioqKioqKio', 'base64').toString(), - '*'.repeat(8)); -assert.strictEqual(Buffer.from('KioqKioqKioqKg', 'base64').toString(), - '*'.repeat(10)); -assert.strictEqual(Buffer.from('KioqKioqKioqKio', 'base64').toString(), - '*'.repeat(11)); -assert.strictEqual(Buffer.from('KioqKioqKioqKioqKg', 'base64').toString(), - '*'.repeat(13)); -assert.strictEqual(Buffer.from('KioqKioqKioqKioqKio', 'base64').toString(), - '*'.repeat(14)); -assert.strictEqual(Buffer.from('KioqKioqKioqKioqKioqKg', 'base64').toString(), - '*'.repeat(16)); -assert.strictEqual(Buffer.from('KioqKioqKioqKioqKioqKio', 'base64').toString(), - '*'.repeat(17)); -assert.strictEqual(Buffer.from('KioqKioqKioqKioqKioqKioqKg', - 'base64').toString(), - '*'.repeat(19)); -assert.strictEqual(Buffer.from('KioqKioqKioqKioqKioqKioqKio', - 'base64').toString(), - '*'.repeat(20)); +base64flavors.forEach((encoding) => { + assert.strictEqual(Buffer.from('', encoding).toString(), ''); + assert.strictEqual(Buffer.from('K', encoding).toString(), ''); + + // multiple-of-4 with padding + assert.strictEqual(Buffer.from('Kg==', encoding).toString(), '*'); + assert.strictEqual(Buffer.from('Kio=', encoding).toString(), '*'.repeat(2)); + assert.strictEqual(Buffer.from('Kioq', encoding).toString(), '*'.repeat(3)); + assert.strictEqual( + Buffer.from('KioqKg==', encoding).toString(), '*'.repeat(4)); + assert.strictEqual( + Buffer.from('KioqKio=', encoding).toString(), '*'.repeat(5)); + assert.strictEqual( + Buffer.from('KioqKioq', encoding).toString(), '*'.repeat(6)); + assert.strictEqual(Buffer.from('KioqKioqKg==', encoding).toString(), + '*'.repeat(7)); + assert.strictEqual(Buffer.from('KioqKioqKio=', encoding).toString(), + '*'.repeat(8)); + assert.strictEqual(Buffer.from('KioqKioqKioq', encoding).toString(), + '*'.repeat(9)); + assert.strictEqual(Buffer.from('KioqKioqKioqKg==', encoding).toString(), + '*'.repeat(10)); + assert.strictEqual(Buffer.from('KioqKioqKioqKio=', encoding).toString(), + '*'.repeat(11)); + assert.strictEqual(Buffer.from('KioqKioqKioqKioq', encoding).toString(), + '*'.repeat(12)); + assert.strictEqual(Buffer.from('KioqKioqKioqKioqKg==', encoding).toString(), + '*'.repeat(13)); + assert.strictEqual(Buffer.from('KioqKioqKioqKioqKio=', encoding).toString(), + '*'.repeat(14)); + assert.strictEqual(Buffer.from('KioqKioqKioqKioqKioq', encoding).toString(), + '*'.repeat(15)); + assert.strictEqual( + Buffer.from('KioqKioqKioqKioqKioqKg==', encoding).toString(), + '*'.repeat(16)); + assert.strictEqual( + Buffer.from('KioqKioqKioqKioqKioqKio=', encoding).toString(), + '*'.repeat(17)); + assert.strictEqual( + Buffer.from('KioqKioqKioqKioqKioqKioq', encoding).toString(), + '*'.repeat(18)); + assert.strictEqual(Buffer.from('KioqKioqKioqKioqKioqKioqKg==', + encoding).toString(), + '*'.repeat(19)); + assert.strictEqual(Buffer.from('KioqKioqKioqKioqKioqKioqKio=', + encoding).toString(), + '*'.repeat(20)); + + // No padding, not a multiple of 4 + assert.strictEqual(Buffer.from('Kg', encoding).toString(), '*'); + assert.strictEqual(Buffer.from('Kio', encoding).toString(), '*'.repeat(2)); + assert.strictEqual(Buffer.from('KioqKg', encoding).toString(), '*'.repeat(4)); + assert.strictEqual( + Buffer.from('KioqKio', encoding).toString(), '*'.repeat(5)); + assert.strictEqual(Buffer.from('KioqKioqKg', encoding).toString(), + '*'.repeat(7)); + assert.strictEqual(Buffer.from('KioqKioqKio', encoding).toString(), + '*'.repeat(8)); + assert.strictEqual(Buffer.from('KioqKioqKioqKg', encoding).toString(), + '*'.repeat(10)); + assert.strictEqual(Buffer.from('KioqKioqKioqKio', encoding).toString(), + '*'.repeat(11)); + assert.strictEqual(Buffer.from('KioqKioqKioqKioqKg', encoding).toString(), + '*'.repeat(13)); + assert.strictEqual(Buffer.from('KioqKioqKioqKioqKio', encoding).toString(), + '*'.repeat(14)); + assert.strictEqual(Buffer.from('KioqKioqKioqKioqKioqKg', encoding).toString(), + '*'.repeat(16)); + assert.strictEqual( + Buffer.from('KioqKioqKioqKioqKioqKio', encoding).toString(), + '*'.repeat(17)); + assert.strictEqual( + Buffer.from('KioqKioqKioqKioqKioqKioqKg', encoding).toString(), + '*'.repeat(19)); + assert.strictEqual( + Buffer.from('KioqKioqKioqKioqKioqKioqKio', encoding).toString(), + '*'.repeat(20)); +}); // Handle padding graciously, multiple-of-4 or not assert.strictEqual( Buffer.from('72INjkR5fchcxk9+VgdGPFJDxUBFR5/rMFsghgxADiw==', 'base64').length, 32 ); +assert.strictEqual( + Buffer.from('72INjkR5fchcxk9-VgdGPFJDxUBFR5_rMFsghgxADiw==', 'base64url') + .length, + 32 +); assert.strictEqual( Buffer.from('72INjkR5fchcxk9+VgdGPFJDxUBFR5/rMFsghgxADiw=', 'base64').length, 32 ); +assert.strictEqual( + Buffer.from('72INjkR5fchcxk9-VgdGPFJDxUBFR5_rMFsghgxADiw=', 'base64url') + .length, + 32 +); assert.strictEqual( Buffer.from('72INjkR5fchcxk9+VgdGPFJDxUBFR5/rMFsghgxADiw', 'base64').length, 32 ); +assert.strictEqual( + Buffer.from('72INjkR5fchcxk9-VgdGPFJDxUBFR5_rMFsghgxADiw', 'base64url') + .length, + 32 +); assert.strictEqual( Buffer.from('w69jACy6BgZmaFvv96HG6MYksWytuZu3T1FvGnulPg==', 'base64').length, 31 ); +assert.strictEqual( + Buffer.from('w69jACy6BgZmaFvv96HG6MYksWytuZu3T1FvGnulPg==', 'base64url') + .length, + 31 +); assert.strictEqual( Buffer.from('w69jACy6BgZmaFvv96HG6MYksWytuZu3T1FvGnulPg=', 'base64').length, 31 ); +assert.strictEqual( + Buffer.from('w69jACy6BgZmaFvv96HG6MYksWytuZu3T1FvGnulPg=', 'base64url') + .length, + 31 +); assert.strictEqual( Buffer.from('w69jACy6BgZmaFvv96HG6MYksWytuZu3T1FvGnulPg', 'base64').length, 31 ); +assert.strictEqual( + Buffer.from('w69jACy6BgZmaFvv96HG6MYksWytuZu3T1FvGnulPg', 'base64url').length, + 31 +); { // This string encodes single '.' character in UTF-16 @@ -459,6 +530,16 @@ assert.strictEqual( assert.strictEqual(dot.toString('base64'), '//4uAA=='); } +{ +// This string encodes single '.' character in UTF-16 + const dot = Buffer.from('//4uAA', 'base64url'); + assert.strictEqual(dot[0], 0xff); + assert.strictEqual(dot[1], 0xfe); + assert.strictEqual(dot[2], 0x2e); + assert.strictEqual(dot[3], 0x00); + assert.strictEqual(dot.toString('base64url'), '__4uAA'); +} + { // Writing base64 at a position > 0 should not mangle the result. // @@ -474,6 +555,21 @@ assert.strictEqual( 'Madness?! This is node.js!'); } +{ + // Writing base64url at a position > 0 should not mangle the result. + // + // https://github.com/joyent/node/issues/402 + const segments = ['TWFkbmVzcz8h', 'IFRoaXM', 'IGlz', 'IG5vZGUuanMh']; + const b = Buffer.allocUnsafe(64); + let pos = 0; + + for (let i = 0; i < segments.length; ++i) { + pos += b.write(segments[i], pos, 'base64url'); + } + assert.strictEqual(b.toString('latin1', 0, pos), + 'Madness?! This is node.js!'); +} + // Regression test for https://github.com/nodejs/node/issues/3496. assert.strictEqual(Buffer.from('=bad'.repeat(1e4), 'base64').length, 0); diff --git a/test/parallel/test-buffer-bytelength.js b/test/parallel/test-buffer-bytelength.js index b5264ba092ce1e..2355e4e0a0b442 100644 --- a/test/parallel/test-buffer-bytelength.js +++ b/test/parallel/test-buffer-bytelength.js @@ -91,9 +91,19 @@ assert.strictEqual(Buffer.byteLength('aGkk', 'base64'), 3); assert.strictEqual( Buffer.byteLength('bHNrZGZsa3NqZmtsc2xrZmFqc2RsZmtqcw==', 'base64'), 25 ); +// base64url +assert.strictEqual(Buffer.byteLength('aGVsbG8gd29ybGQ', 'base64url'), 11); +assert.strictEqual(Buffer.byteLength('aGVsbG8gd29ybGQ', 'BASE64URL'), 11); +assert.strictEqual(Buffer.byteLength('bm9kZS5qcyByb2NrcyE', 'base64url'), 14); +assert.strictEqual(Buffer.byteLength('aGkk', 'base64url'), 3); +assert.strictEqual( + Buffer.byteLength('bHNrZGZsa3NqZmtsc2xrZmFqc2RsZmtqcw', 'base64url'), 25 +); // special padding assert.strictEqual(Buffer.byteLength('aaa=', 'base64'), 2); assert.strictEqual(Buffer.byteLength('aaaa==', 'base64'), 3); +assert.strictEqual(Buffer.byteLength('aaa=', 'base64url'), 2); +assert.strictEqual(Buffer.byteLength('aaaa==', 'base64url'), 3); assert.strictEqual(Buffer.byteLength('Il était tué'), 14); assert.strictEqual(Buffer.byteLength('Il était tué', 'utf8'), 14); diff --git a/test/parallel/test-buffer-fill.js b/test/parallel/test-buffer-fill.js index 6e24b3511e6e1a..6e7b24989a53bb 100644 --- a/test/parallel/test-buffer-fill.js +++ b/test/parallel/test-buffer-fill.js @@ -131,20 +131,36 @@ assert.throws(() => { }); // BASE64 -testBufs('YWJj', 'ucs2'); -testBufs('yKJhYQ==', 'ucs2'); -testBufs('Yci0Ysi1Y8i2', 'ucs2'); -testBufs('YWJj', 4, 'ucs2'); -testBufs('YWJj', SIZE, 'ucs2'); -testBufs('yKJhYQ==', 2, 'ucs2'); -testBufs('yKJhYQ==', 8, 'ucs2'); -testBufs('Yci0Ysi1Y8i2', 4, 'ucs2'); -testBufs('Yci0Ysi1Y8i2', 12, 'ucs2'); -testBufs('YWJj', 4, 1, 'ucs2'); -testBufs('YWJj', 5, 1, 'ucs2'); -testBufs('yKJhYQ==', 8, 1, 'ucs2'); -testBufs('Yci0Ysi1Y8i2', 4, 1, 'ucs2'); -testBufs('Yci0Ysi1Y8i2', 12, 1, 'ucs2'); +testBufs('YWJj', 'base64'); +testBufs('yKJhYQ==', 'base64'); +testBufs('Yci0Ysi1Y8i2', 'base64'); +testBufs('YWJj', 4, 'base64'); +testBufs('YWJj', SIZE, 'base64'); +testBufs('yKJhYQ==', 2, 'base64'); +testBufs('yKJhYQ==', 8, 'base64'); +testBufs('Yci0Ysi1Y8i2', 4, 'base64'); +testBufs('Yci0Ysi1Y8i2', 12, 'base64'); +testBufs('YWJj', 4, 1, 'base64'); +testBufs('YWJj', 5, 1, 'base64'); +testBufs('yKJhYQ==', 8, 1, 'base64'); +testBufs('Yci0Ysi1Y8i2', 4, 1, 'base64'); +testBufs('Yci0Ysi1Y8i2', 12, 1, 'base64'); + +// BASE64URL +testBufs('YWJj', 'base64url'); +testBufs('yKJhYQ', 'base64url'); +testBufs('Yci0Ysi1Y8i2', 'base64url'); +testBufs('YWJj', 4, 'base64url'); +testBufs('YWJj', SIZE, 'base64url'); +testBufs('yKJhYQ', 2, 'base64url'); +testBufs('yKJhYQ', 8, 'base64url'); +testBufs('Yci0Ysi1Y8i2', 4, 'base64url'); +testBufs('Yci0Ysi1Y8i2', 12, 'base64url'); +testBufs('YWJj', 4, 1, 'base64url'); +testBufs('YWJj', 5, 1, 'base64url'); +testBufs('yKJhYQ', 8, 1, 'base64url'); +testBufs('Yci0Ysi1Y8i2', 4, 1, 'base64url'); +testBufs('Yci0Ysi1Y8i2', 12, 1, 'base64url'); // Buffer function deepStrictEqualValues(buf, arr) { diff --git a/test/parallel/test-buffer-isencoding.js b/test/parallel/test-buffer-isencoding.js index e67d1c078397a3..1a9e17dc48714d 100644 --- a/test/parallel/test-buffer-isencoding.js +++ b/test/parallel/test-buffer-isencoding.js @@ -11,6 +11,7 @@ const assert = require('assert'); 'latin1', 'binary', 'base64', + 'base64url', 'ucs2', 'ucs-2', 'utf16le', diff --git a/test/parallel/test-buffer-write.js b/test/parallel/test-buffer-write.js index 842b12c04c04db..3a4a3a8b696612 100644 --- a/test/parallel/test-buffer-write.js +++ b/test/parallel/test-buffer-write.js @@ -23,6 +23,7 @@ const resultMap = new Map([ ['binary', Buffer.from([102, 111, 111, 0, 0, 0, 0, 0, 0])], ['utf16le', Buffer.from([102, 0, 111, 0, 111, 0, 0, 0, 0])], ['base64', Buffer.from([102, 111, 111, 0, 0, 0, 0, 0, 0])], + ['base64url', Buffer.from([102, 111, 111, 0, 0, 0, 0, 0, 0])], ['hex', Buffer.from([102, 111, 111, 0, 0, 0, 0, 0, 0])] ]); @@ -44,7 +45,7 @@ encodings }); // base64 -['base64', 'BASE64'].forEach((encoding) => { +['base64', 'BASE64', 'base64url', 'BASE64URL'].forEach((encoding) => { const buf = Buffer.alloc(9); const len = Buffer.byteLength('Zm9v', encoding); diff --git a/test/parallel/test-child-process-execfile.js b/test/parallel/test-child-process-execfile.js index aec80b4e2baf22..49a4bdbda29957 100644 --- a/test/parallel/test-child-process-execfile.js +++ b/test/parallel/test-child-process-execfile.js @@ -53,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(); } { diff --git a/test/parallel/test-child-process-fork-closed-channel-segfault.js b/test/parallel/test-child-process-fork-closed-channel-segfault.js index c24a62379bf66e..47eb87c45fd045 100644 --- a/test/parallel/test-child-process-fork-closed-channel-segfault.js +++ b/test/parallel/test-child-process-fork-closed-channel-segfault.js @@ -8,8 +8,8 @@ const assert = require('assert'); const cluster = require('cluster'); const net = require('net'); -if (!cluster.isMaster) { - // Exit on first received handle to leave the queue non-empty in master +if (!cluster.isPrimary) { + // Exit on first received handle to leave the queue non-empty in primary process.on('message', function() { process.exit(1); }); diff --git a/test/parallel/test-child-process-recv-handle.js b/test/parallel/test-child-process-recv-handle.js index bc31ee6bf025eb..d6bfa0d4257f64 100644 --- a/test/parallel/test-child-process-recv-handle.js +++ b/test/parallel/test-child-process-recv-handle.js @@ -31,9 +31,9 @@ const spawn = require('child_process').spawn; if (process.argv[2] === 'worker') worker(); else - master(); + primary(); -function master() { +function primary() { // spawn() can only create one IPC channel so we use stdin/stdout as an // ad-hoc command channel. const proc = spawn(process.execPath, [ diff --git a/test/parallel/test-child-process-silent.js b/test/parallel/test-child-process-silent.js index bedef1509cf9c7..892c4527c9e2a2 100644 --- a/test/parallel/test-child-process-silent.js +++ b/test/parallel/test-child-process-silent.js @@ -33,11 +33,11 @@ if (process.argv[2] === 'pipe') { // Child IPC test process.send('message from child'); process.on('message', function() { - process.send('got message from master'); + process.send('got message from primary'); }); -} else if (process.argv[2] === 'parent') { - // Parent | start child pipe test +} else if (process.argv[2] === 'primary') { + // Primary | start child pipe test const child = childProcess.fork(process.argv[1], ['pipe'], { silent: true }); @@ -49,19 +49,19 @@ if (process.argv[2] === 'pipe') { }); } else { - // Testcase | start parent && child IPC test + // Testcase | start primary && child IPC test - // testing: is stderr and stdout piped to parent - const args = [process.argv[1], 'parent']; - const parent = childProcess.spawn(process.execPath, args); + // testing: is stderr and stdout piped to primary + const args = [process.argv[1], 'primary']; + const primary = childProcess.spawn(process.execPath, args); // Got any stderr or std data let stdoutData = false; - parent.stdout.on('data', function() { + primary.stdout.on('data', function() { stdoutData = true; }); let stderrData = false; - parent.stderr.on('data', function() { + primary.stderr.on('data', function() { stderrData = true; }); @@ -80,7 +80,7 @@ if (process.argv[2] === 'pipe') { } if (childReceiving === false) { - childReceiving = (message === 'got message from master'); + childReceiving = (message === 'got message from primary'); } if (childReceiving === true) { @@ -93,7 +93,7 @@ if (process.argv[2] === 'pipe') { process.on('exit', function() { // clean up child.kill(); - parent.kill(); + primary.kill(); // Check std(out|err) pipes assert.ok(!stdoutData); 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-advanced-serialization.js b/test/parallel/test-cluster-advanced-serialization.js index 2144d08f28702b..ffca3a8f9727ca 100644 --- a/test/parallel/test-cluster-advanced-serialization.js +++ b/test/parallel/test-cluster-advanced-serialization.js @@ -3,7 +3,7 @@ const common = require('../common'); const assert = require('assert'); const cluster = require('cluster'); -if (cluster.isMaster) { +if (cluster.isPrimary) { cluster.settings.serialization = 'advanced'; const worker = cluster.fork(); const circular = {}; diff --git a/test/parallel/test-cluster-basic.js b/test/parallel/test-cluster-basic.js index 0d51a18607f6bf..79d8640cf4f65c 100644 --- a/test/parallel/test-cluster-basic.js +++ b/test/parallel/test-cluster-basic.js @@ -38,7 +38,7 @@ function forEach(obj, fn) { if (cluster.isWorker) { require('http').Server(common.mustNotCall()).listen(0, '127.0.0.1'); -} else if (cluster.isMaster) { +} else if (cluster.isPrimary) { const checks = { cluster: { diff --git a/test/parallel/test-cluster-bind-privileged-port.js b/test/parallel/test-cluster-bind-privileged-port.js index 57aa4c735d480f..b952ac1c6ce5d3 100644 --- a/test/parallel/test-cluster-bind-privileged-port.js +++ b/test/parallel/test-cluster-bind-privileged-port.js @@ -39,7 +39,7 @@ const assert = require('assert'); const cluster = require('cluster'); const net = require('net'); -if (cluster.isMaster) { +if (cluster.isPrimary) { cluster.fork().on('exit', common.mustCall((exitCode) => { assert.strictEqual(exitCode, 0); })); diff --git a/test/parallel/test-cluster-bind-twice.js b/test/parallel/test-cluster-bind-twice.js index 7bd818a5e1fe8c..aa9442e1672555 100644 --- a/test/parallel/test-cluster-bind-twice.js +++ b/test/parallel/test-cluster-bind-twice.js @@ -29,7 +29,7 @@ // // // / \ -// +// // / \ // // @@ -78,7 +78,7 @@ if (!id) { })); } else if (id === 'one') { - if (cluster.isMaster) return startWorker(); + if (cluster.isPrimary) return startWorker(); const server = http.createServer(common.mustNotCall()); server.listen(0, common.mustCall(() => { @@ -89,7 +89,7 @@ if (!id) { if (m === 'QUIT') process.exit(); })); } else if (id === 'two') { - if (cluster.isMaster) return startWorker(); + if (cluster.isPrimary) return startWorker(); const server = http.createServer(common.mustNotCall()); process.on('message', common.mustCall((m) => { diff --git a/test/parallel/test-cluster-call-and-destroy.js b/test/parallel/test-cluster-call-and-destroy.js index 76b5c73d9797c7..2ff20cf03a0269 100644 --- a/test/parallel/test-cluster-call-and-destroy.js +++ b/test/parallel/test-cluster-call-and-destroy.js @@ -3,7 +3,7 @@ const common = require('../common'); const cluster = require('cluster'); const assert = require('assert'); -if (cluster.isMaster) { +if (cluster.isPrimary) { const worker = cluster.fork(); worker.on('disconnect', common.mustCall(() => { assert.strictEqual(worker.isConnected(), false); 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-cluster-concurrent-disconnect.js b/test/parallel/test-cluster-concurrent-disconnect.js index 22f72040263027..4920276745c180 100644 --- a/test/parallel/test-cluster-concurrent-disconnect.js +++ b/test/parallel/test-cluster-concurrent-disconnect.js @@ -8,7 +8,7 @@ const assert = require('assert'); const cluster = require('cluster'); const os = require('os'); -if (cluster.isMaster) { +if (cluster.isPrimary) { const workers = []; const numCPUs = os.cpus().length; let waitOnline = numCPUs; diff --git a/test/parallel/test-cluster-cwd.js b/test/parallel/test-cluster-cwd.js index 485276befaf39b..c5d47e73014bd0 100644 --- a/test/parallel/test-cluster-cwd.js +++ b/test/parallel/test-cluster-cwd.js @@ -4,7 +4,7 @@ const assert = require('assert'); const cluster = require('cluster'); const tmpdir = require('../common/tmpdir'); -if (cluster.isMaster) { +if (cluster.isPrimary) { tmpdir.refresh(); assert.strictEqual(cluster.settings.cwd, undefined); @@ -12,7 +12,7 @@ if (cluster.isMaster) { assert.strictEqual(msg, process.cwd()); })); - cluster.setupMaster({ cwd: tmpdir.path }); + cluster.setupPrimary({ cwd: tmpdir.path }); assert.strictEqual(cluster.settings.cwd, tmpdir.path); cluster.fork().on('message', common.mustCall((msg) => { assert.strictEqual(msg, tmpdir.path); diff --git a/test/parallel/test-cluster-dgram-1.js b/test/parallel/test-cluster-dgram-1.js index 4e7bf97d271eaf..cd96c382c77346 100644 --- a/test/parallel/test-cluster-dgram-1.js +++ b/test/parallel/test-cluster-dgram-1.js @@ -31,13 +31,13 @@ const assert = require('assert'); const cluster = require('cluster'); const dgram = require('dgram'); -if (cluster.isMaster) - master(); +if (cluster.isPrimary) + primary(); else worker(); -function master() { +function primary() { let listening = 0; // Fork 4 workers. @@ -100,7 +100,7 @@ function worker() { socket.on('message', common.mustCall((data, info) => { received++; - // Every 10 messages, notify the master. + // Every 10 messages, notify the primary. if (received === PACKETS_PER_WORKER) { process.send({ received }); socket.close(); diff --git a/test/parallel/test-cluster-dgram-2.js b/test/parallel/test-cluster-dgram-2.js index 7c1dae65600fc0..924d572a867cfc 100644 --- a/test/parallel/test-cluster-dgram-2.js +++ b/test/parallel/test-cluster-dgram-2.js @@ -31,13 +31,13 @@ const cluster = require('cluster'); const dgram = require('dgram'); const assert = require('assert'); -if (cluster.isMaster) - master(); +if (cluster.isPrimary) + primary(); else worker(); -function master() { +function primary() { let received = 0; // Start listening on a socket. @@ -69,7 +69,7 @@ function master() { function worker() { - // Create udp socket and send packets to master. + // Create udp socket and send packets to primary. const socket = dgram.createSocket('udp4'); const buf = Buffer.from('hello world'); diff --git a/test/parallel/test-cluster-dgram-bind-fd.js b/test/parallel/test-cluster-dgram-bind-fd.js index 7b6fb89501fae1..b2efe58721c818 100644 --- a/test/parallel/test-cluster-dgram-bind-fd.js +++ b/test/parallel/test-cluster-dgram-bind-fd.js @@ -11,13 +11,13 @@ const assert = require('assert'); const cluster = require('cluster'); const dgram = require('dgram'); -if (cluster.isMaster) - master(); +if (cluster.isPrimary) + primary(); else worker(); -function master() { +function primary() { const { internalBinding } = require('internal/test/binding'); const { UDP } = internalBinding('udp_wrap'); @@ -97,7 +97,7 @@ function worker() { socket.on('message', common.mustCall((data, info) => { received++; - // Every 10 messages, notify the master. + // Every 10 messages, notify the primary. if (received === PACKETS_PER_WORKER) { process.send({ received }); socket.close(); diff --git a/test/parallel/test-cluster-dgram-ipv6only.js b/test/parallel/test-cluster-dgram-ipv6only.js index 0906baec929d21..a6283f94d4bffc 100644 --- a/test/parallel/test-cluster-dgram-ipv6only.js +++ b/test/parallel/test-cluster-dgram-ipv6only.js @@ -12,7 +12,7 @@ const dgram = require('dgram'); // This test ensures that the `ipv6Only` option in `dgram.createSock()` // works as expected. -if (cluster.isMaster) { +if (cluster.isPrimary) { cluster.fork().on('exit', common.mustCall((code) => { assert.strictEqual(code, 0); })); diff --git a/test/parallel/test-cluster-dgram-reuse.js b/test/parallel/test-cluster-dgram-reuse.js index 51a4944e554856..d2790b5d99c012 100644 --- a/test/parallel/test-cluster-dgram-reuse.js +++ b/test/parallel/test-cluster-dgram-reuse.js @@ -7,7 +7,7 @@ const assert = require('assert'); const cluster = require('cluster'); const dgram = require('dgram'); -if (cluster.isMaster) { +if (cluster.isPrimary) { cluster.fork().on('exit', common.mustCall((code) => { assert.strictEqual(code, 0); })); diff --git a/test/parallel/test-cluster-disconnect-before-exit.js b/test/parallel/test-cluster-disconnect-before-exit.js index 008ba8d03d4673..f95f1384d5fe6b 100644 --- a/test/parallel/test-cluster-disconnect-before-exit.js +++ b/test/parallel/test-cluster-disconnect-before-exit.js @@ -23,7 +23,7 @@ const common = require('../common'); const cluster = require('cluster'); -if (cluster.isMaster) { +if (cluster.isPrimary) { const worker = cluster.fork().on('online', common.mustCall(disconnect)); function disconnect() { diff --git a/test/parallel/test-cluster-disconnect-exitedAfterDisconnect-race.js b/test/parallel/test-cluster-disconnect-exitedAfterDisconnect-race.js index db2aa6d34a6116..f1a8dea0a9a6df 100644 --- a/test/parallel/test-cluster-disconnect-exitedAfterDisconnect-race.js +++ b/test/parallel/test-cluster-disconnect-exitedAfterDisconnect-race.js @@ -7,7 +7,7 @@ const common = require('../common'); const assert = require('assert'); const cluster = require('cluster'); -if (cluster.isMaster) { +if (cluster.isPrimary) { cluster.on('exit', (worker, code) => { assert.strictEqual(code, 0, `worker exited with code: ${code}, expected 0`); }); diff --git a/test/parallel/test-cluster-disconnect-idle-worker.js b/test/parallel/test-cluster-disconnect-idle-worker.js index 63b8b925da0939..566f63131287c4 100644 --- a/test/parallel/test-cluster-disconnect-idle-worker.js +++ b/test/parallel/test-cluster-disconnect-idle-worker.js @@ -25,7 +25,7 @@ const assert = require('assert'); const cluster = require('cluster'); const fork = cluster.fork; -if (cluster.isMaster) { +if (cluster.isPrimary) { fork(); // It is intentionally called `fork` instead of fork(); // `cluster.fork` to test that `this` is not used cluster.disconnect(common.mustCall(() => { diff --git a/test/parallel/test-cluster-disconnect-leak.js b/test/parallel/test-cluster-disconnect-leak.js index dddc12a3b5471e..e2a417e5cd3a98 100644 --- a/test/parallel/test-cluster-disconnect-leak.js +++ b/test/parallel/test-cluster-disconnect-leak.js @@ -8,7 +8,7 @@ const cluster = require('cluster'); cluster.schedulingPolicy = cluster.SCHED_NONE; -if (cluster.isMaster) { +if (cluster.isPrimary) { const worker = cluster.fork(); // This is the important part of the test: Confirm that `disconnect` fires. diff --git a/test/parallel/test-cluster-disconnect-race.js b/test/parallel/test-cluster-disconnect-race.js index 9e8b6d41d5c99e..ce9e3c6abf51a1 100644 --- a/test/parallel/test-cluster-disconnect-race.js +++ b/test/parallel/test-cluster-disconnect-race.js @@ -13,7 +13,7 @@ const cluster = require('cluster'); cluster.schedulingPolicy = cluster.SCHED_NONE; -if (cluster.isMaster) { +if (cluster.isPrimary) { let worker2; const worker1 = cluster.fork(); diff --git a/test/parallel/test-cluster-disconnect-unshared-tcp.js b/test/parallel/test-cluster-disconnect-unshared-tcp.js index e18617788c53f6..72c163fec8385c 100644 --- a/test/parallel/test-cluster-disconnect-unshared-tcp.js +++ b/test/parallel/test-cluster-disconnect-unshared-tcp.js @@ -26,7 +26,7 @@ process.env.NODE_CLUSTER_SCHED_POLICY = 'none'; const cluster = require('cluster'); const net = require('net'); -if (cluster.isMaster) { +if (cluster.isPrimary) { const unbound = cluster.fork().on('online', bind); function bind() { diff --git a/test/parallel/test-cluster-disconnect-unshared-udp.js b/test/parallel/test-cluster-disconnect-unshared-udp.js index 5857e9132f9679..52eb58026af69b 100644 --- a/test/parallel/test-cluster-disconnect-unshared-udp.js +++ b/test/parallel/test-cluster-disconnect-unshared-udp.js @@ -29,7 +29,7 @@ if (common.isWindows) const cluster = require('cluster'); const dgram = require('dgram'); -if (cluster.isMaster) { +if (cluster.isPrimary) { const unbound = cluster.fork().on('online', bind); function bind() { diff --git a/test/parallel/test-cluster-disconnect.js b/test/parallel/test-cluster-disconnect.js index 3d1f14257bca59..240bb972fa359e 100644 --- a/test/parallel/test-cluster-disconnect.js +++ b/test/parallel/test-cluster-disconnect.js @@ -33,7 +33,7 @@ if (cluster.isWorker) { net.createServer((socket) => { socket.end('echo'); }).listen(0, '127.0.0.1'); -} else if (cluster.isMaster) { +} else if (cluster.isPrimary) { const servers = 2; const serverPorts = new Set(); diff --git a/test/parallel/test-cluster-eaccess.js b/test/parallel/test-cluster-eaccess.js index cf6eae1d38eaa6..2f533acea1e5b3 100644 --- a/test/parallel/test-cluster-eaccess.js +++ b/test/parallel/test-cluster-eaccess.js @@ -23,22 +23,22 @@ const common = require('../common'); // Test that errors propagated from cluster workers are properly -// received in their master. Creates an EADDRINUSE condition by forking -// a process in child cluster and propagates the error to the master. +// received in their primary. Creates an EADDRINUSE condition by forking +// a process in child cluster and propagates the error to the primary. const assert = require('assert'); const cluster = require('cluster'); const fork = require('child_process').fork; const net = require('net'); -if (cluster.isMaster && process.argv.length !== 3) { - // cluster.isMaster +if (cluster.isPrimary && process.argv.length !== 3) { + // cluster.isPrimary const tmpdir = require('../common/tmpdir'); tmpdir.refresh(); const PIPE_NAME = common.PIPE; const worker = cluster.fork({ PIPE_NAME }); - // Makes sure master is able to fork the worker + // Makes sure primary is able to fork the worker cluster.on('fork', common.mustCall()); // Makes sure the worker is ready @@ -59,14 +59,14 @@ if (cluster.isMaster && process.argv.length !== 3) { const server = net.createServer().listen(PIPE_NAME, function() { // Message child process so that it can exit cp.send('end'); - // Inform master about the unexpected situation + // Inform primary about the unexpected situation process.send('PIPE should have been in use.'); }); server.on('error', function(err) { // Message to child process tells it to exit cp.send('end'); - // Propagate error to parent + // Propagate error to primary process.send(err); }); })); diff --git a/test/parallel/test-cluster-eaddrinuse.js b/test/parallel/test-cluster-eaddrinuse.js index eae6d9a455c773..f74d4ab7ec2eb9 100644 --- a/test/parallel/test-cluster-eaddrinuse.js +++ b/test/parallel/test-cluster-eaddrinuse.js @@ -21,7 +21,7 @@ 'use strict'; // Check that having a worker bind to a port that's already taken doesn't -// leave the master process in a confused state. Releasing the port and +// leave the primary process in a confused state. Releasing the port and // trying again should Just Work[TM]. const common = require('../common'); diff --git a/test/parallel/test-cluster-fork-env.js b/test/parallel/test-cluster-fork-env.js index 57e7881013d0fd..90b456b19668cd 100644 --- a/test/parallel/test-cluster-fork-env.js +++ b/test/parallel/test-cluster-fork-env.js @@ -36,7 +36,7 @@ if (cluster.isWorker) { }); assert.strictEqual(result, true); -} else if (cluster.isMaster) { +} else if (cluster.isPrimary) { const checks = { using: false, diff --git a/test/parallel/test-cluster-fork-stdio.js b/test/parallel/test-cluster-fork-stdio.js index 1d00e0768e5746..263c2ba8024f25 100644 --- a/test/parallel/test-cluster-fork-stdio.js +++ b/test/parallel/test-cluster-fork-stdio.js @@ -4,10 +4,10 @@ const assert = require('assert'); const cluster = require('cluster'); const net = require('net'); -if (cluster.isMaster) { +if (cluster.isPrimary) { const buf = Buffer.from('foobar'); - cluster.setupMaster({ + cluster.setupPrimary({ stdio: ['pipe', 'pipe', 'pipe', 'ipc', 'pipe'] }); diff --git a/test/parallel/test-cluster-fork-windowsHide.js b/test/parallel/test-cluster-fork-windowsHide.js index b788c2263e5246..9ba809d71a318f 100644 --- a/test/parallel/test-cluster-fork-windowsHide.js +++ b/test/parallel/test-cluster-fork-windowsHide.js @@ -14,7 +14,7 @@ if (!process.argv[2]) { // by D with `detached: true`, no console window will pop up for W. // // So, we have to spawn a detached process first to run the actual test. - const master = child_process.spawn( + const primary = child_process.spawn( process.argv[0], [process.argv[1], '--cluster'], { detached: true, stdio: ['ignore', 'ignore', 'ignore', 'ipc'] }); @@ -31,19 +31,19 @@ if (!process.argv[2]) { }) }; - master.on('message', (msg) => { + primary.on('message', (msg) => { const handler = messageHandlers[msg.type]; assert.ok(handler); handler(msg); }); - master.on('exit', common.mustCall((code, signal) => { + primary.on('exit', common.mustCall((code, signal) => { assert.strictEqual(code, 0); assert.strictEqual(signal, null); })); -} else if (cluster.isMaster) { - cluster.setupMaster({ +} else if (cluster.isPrimary) { + cluster.setupPrimary({ silent: true, windowsHide: true }); diff --git a/test/parallel/test-cluster-http-pipe.js b/test/parallel/test-cluster-http-pipe.js index 173ddd04f4f26d..bdd8fe8c4f135f 100644 --- a/test/parallel/test-cluster-http-pipe.js +++ b/test/parallel/test-cluster-http-pipe.js @@ -31,7 +31,7 @@ const assert = require('assert'); const cluster = require('cluster'); const http = require('http'); -if (cluster.isMaster) { +if (cluster.isPrimary) { const tmpdir = require('../common/tmpdir'); tmpdir.refresh(); const worker = cluster.fork(); diff --git a/test/parallel/test-cluster-invalid-message.js b/test/parallel/test-cluster-invalid-message.js index 006c80a7aae8fc..a42f5284dba134 100644 --- a/test/parallel/test-cluster-invalid-message.js +++ b/test/parallel/test-cluster-invalid-message.js @@ -3,7 +3,7 @@ const common = require('../common'); const assert = require('assert'); const cluster = require('cluster'); -if (cluster.isMaster) { +if (cluster.isPrimary) { const worker = cluster.fork(); worker.on('exit', common.mustCall((code, signal) => { diff --git a/test/parallel/test-cluster-ipc-throw.js b/test/parallel/test-cluster-ipc-throw.js index d19cf0c3811aa5..ec979448ddb96e 100644 --- a/test/parallel/test-cluster-ipc-throw.js +++ b/test/parallel/test-cluster-ipc-throw.js @@ -8,7 +8,7 @@ cluster.schedulingPolicy = cluster.SCHED_RR; const server = http.createServer(); -if (cluster.isMaster) { +if (cluster.isPrimary) { server.listen({ port: 0 }, common.mustCall(() => { const worker = cluster.fork({ PORT: server.address().port }); worker.on('exit', common.mustCall(() => { diff --git a/test/parallel/test-cluster-kill-disconnect.js b/test/parallel/test-cluster-kill-disconnect.js index f5407612a83b5f..3e1f2f08416739 100644 --- a/test/parallel/test-cluster-kill-disconnect.js +++ b/test/parallel/test-cluster-kill-disconnect.js @@ -9,7 +9,7 @@ const common = require('../common'); const assert = require('assert'); const cluster = require('cluster'); -if (cluster.isMaster) { +if (cluster.isPrimary) { function forkWorker(action) { const worker = cluster.fork({ action }); worker.on('disconnect', common.mustCall(() => { diff --git a/test/parallel/test-cluster-kill-infinite-loop.js b/test/parallel/test-cluster-kill-infinite-loop.js index f53e6e3976ec28..bd2384941b2122 100644 --- a/test/parallel/test-cluster-kill-infinite-loop.js +++ b/test/parallel/test-cluster-kill-infinite-loop.js @@ -3,7 +3,7 @@ const common = require('../common'); const cluster = require('cluster'); const assert = require('assert'); -if (cluster.isMaster) { +if (cluster.isPrimary) { const worker = cluster.fork(); worker.on('online', common.mustCall(() => { diff --git a/test/parallel/test-cluster-listening-port.js b/test/parallel/test-cluster-listening-port.js index 40d66065d947ce..c09134e1de9e6d 100644 --- a/test/parallel/test-cluster-listening-port.js +++ b/test/parallel/test-cluster-listening-port.js @@ -4,7 +4,7 @@ const assert = require('assert'); const cluster = require('cluster'); const net = require('net'); -if (cluster.isMaster) { +if (cluster.isPrimary) { cluster.fork(); cluster.on('listening', common.mustCall(function(worker, address) { const port = address.port; diff --git a/test/parallel/test-cluster-message.js b/test/parallel/test-cluster-message.js index 5585a64d48149d..45854c77a5a347 100644 --- a/test/parallel/test-cluster-message.js +++ b/test/parallel/test-cluster-message.js @@ -40,7 +40,7 @@ if (cluster.isWorker) { function maybeReply() { if (!socket || !message) return; - // Tell master using TCP socket that a message is received. + // Tell primary using TCP socket that a message is received. socket.write(JSON.stringify({ code: 'received message', echo: message @@ -61,14 +61,14 @@ if (cluster.isWorker) { }); server.listen(0, '127.0.0.1'); -} else if (cluster.isMaster) { +} else if (cluster.isPrimary) { const checks = { global: { 'receive': false, 'correct': false }, - master: { + primary: { 'receive': false, 'correct': false }, @@ -101,7 +101,7 @@ if (cluster.isWorker) { // When a IPC message is received from the worker worker.on('message', function(message) { - check('master', message === 'message from worker'); + check('primary', message === 'message from worker'); }); cluster.on('message', function(worker_, message) { assert.strictEqual(worker_, worker); @@ -113,7 +113,7 @@ if (cluster.isWorker) { client = net.connect(address.port, function() { // Send message to worker. - worker.send('message from master'); + worker.send('message from primary'); }); client.on('data', function(data) { @@ -121,7 +121,7 @@ if (cluster.isWorker) { data = JSON.parse(data.toString()); if (data.code === 'received message') { - check('worker', data.echo === 'message from master'); + check('worker', data.echo === 'message from primary'); } else { throw new Error(`wrong TCP message received: ${data}`); } diff --git a/test/parallel/test-cluster-net-listen-ipv6only-false.js b/test/parallel/test-cluster-net-listen-ipv6only-false.js index f48e9f1c29dc4a..52be91efae681c 100644 --- a/test/parallel/test-cluster-net-listen-ipv6only-false.js +++ b/test/parallel/test-cluster-net-listen-ipv6only-false.js @@ -13,7 +13,7 @@ const net = require('net'); const host = '::'; const WORKER_COUNT = 3; -if (cluster.isMaster) { +if (cluster.isPrimary) { const workers = []; let address; diff --git a/test/parallel/test-cluster-net-listen-relative-path.js b/test/parallel/test-cluster-net-listen-relative-path.js index 76676b2902730b..bb4d0b90f203e6 100644 --- a/test/parallel/test-cluster-net-listen-relative-path.js +++ b/test/parallel/test-cluster-net-listen-relative-path.js @@ -23,7 +23,7 @@ const socketName = 'A'.repeat(101 - socketDir.length); assert.ok(path.resolve(socketDir, socketName).length > 100, 'absolute socket path should be longer than 100 bytes'); -if (cluster.isMaster) { +if (cluster.isPrimary) { // Ensure that the worker exits peacefully. tmpdir.refresh(); process.chdir(tmpdir.path); diff --git a/test/parallel/test-cluster-net-listen.js b/test/parallel/test-cluster-net-listen.js index ff102797eab8f9..9fa975aaaf718b 100644 --- a/test/parallel/test-cluster-net-listen.js +++ b/test/parallel/test-cluster-net-listen.js @@ -25,7 +25,7 @@ const assert = require('assert'); const cluster = require('cluster'); const net = require('net'); -if (cluster.isMaster) { +if (cluster.isPrimary) { // Ensure that the worker exits peacefully cluster.fork().on('exit', common.mustCall(function(statusCode) { assert.strictEqual(statusCode, 0); diff --git a/test/parallel/test-cluster-net-send.js b/test/parallel/test-cluster-net-send.js index 9e0ad6b3be5594..f6b735db997d8a 100644 --- a/test/parallel/test-cluster-net-send.js +++ b/test/parallel/test-cluster-net-send.js @@ -26,7 +26,7 @@ const fork = require('child_process').fork; const net = require('net'); if (process.argv[2] !== 'child') { - console.error(`[${process.pid}] master`); + console.error(`[${process.pid}] primary`); const worker = fork(__filename, ['child']); let called = false; diff --git a/test/parallel/test-cluster-master-error.js b/test/parallel/test-cluster-primary-error.js similarity index 93% rename from test/parallel/test-cluster-master-error.js rename to test/parallel/test-cluster-primary-error.js index eb0a3959969e48..f48682da4eab16 100644 --- a/test/parallel/test-cluster-master-error.js +++ b/test/parallel/test-cluster-primary-error.js @@ -73,10 +73,10 @@ if (cluster.isWorker) { const workers = []; // Spawn a cluster process - const master = fork(process.argv[1], ['cluster'], { silent: true }); + const primary = fork(process.argv[1], ['cluster'], { silent: true }); // Handle messages from the cluster - master.on('message', common.mustCall((data) => { + primary.on('message', common.mustCall((data) => { // Add worker pid to list and progress tracker if (data.cmd === 'worker') { workers.push(data.workerPID); @@ -84,7 +84,7 @@ if (cluster.isWorker) { }, totalWorkers)); // When cluster is dead - master.on('exit', common.mustCall((code) => { + primary.on('exit', common.mustCall((code) => { // Check that the cluster died accidentally (non-zero exit code) assert.strictEqual(code, 1); @@ -92,7 +92,7 @@ if (cluster.isWorker) { // flaky – another process might end up being started right after the // workers finished and receive the same PID. const pollWorkers = () => { - // When master is dead all workers should be dead too + // When primary is dead all workers should be dead too if (workers.some((pid) => common.isAlive(pid))) { setTimeout(pollWorkers, 50); } diff --git a/test/parallel/test-cluster-master-kill.js b/test/parallel/test-cluster-primary-kill.js similarity index 88% rename from test/parallel/test-cluster-master-kill.js rename to test/parallel/test-cluster-primary-kill.js index 3c22e07edeaad2..08c78096039f3f 100644 --- a/test/parallel/test-cluster-master-kill.js +++ b/test/parallel/test-cluster-primary-kill.js @@ -52,19 +52,19 @@ if (cluster.isWorker) { const fork = require('child_process').fork; // Spawn a cluster process - const master = fork(process.argv[1], ['cluster']); + const primary = fork(process.argv[1], ['cluster']); // get pid info let pid = null; - master.once('message', (data) => { + primary.once('message', (data) => { pid = data.pid; }); - // When master is dead + // When primary is dead let alive = true; - master.on('exit', common.mustCall((code) => { + primary.on('exit', common.mustCall((code) => { - // Make sure that the master died on purpose + // Make sure that the primary died on purpose assert.strictEqual(code, 0); // Check worker process status @@ -82,7 +82,8 @@ if (cluster.isWorker) { assert.strictEqual(typeof pid, 'number', `got ${pid} instead of a worker pid`); assert.strictEqual(alive, false, - `worker was alive after master died (alive = ${alive})`); + `worker was alive after primary died (alive = ${alive})` + ); }); } diff --git a/test/parallel/test-cluster-process-disconnect.js b/test/parallel/test-cluster-process-disconnect.js index 39690ac9682917..378c4ef24df896 100644 --- a/test/parallel/test-cluster-process-disconnect.js +++ b/test/parallel/test-cluster-process-disconnect.js @@ -3,7 +3,7 @@ const common = require('../common'); const assert = require('assert'); const cluster = require('cluster'); -if (cluster.isMaster) { +if (cluster.isPrimary) { const worker = cluster.fork(); worker.on('exit', common.mustCall((code, signal) => { assert.strictEqual( diff --git a/test/parallel/test-cluster-rr-domain-listen.js b/test/parallel/test-cluster-rr-domain-listen.js index 0f94eb8e6b8060..6043535d3ba7f1 100644 --- a/test/parallel/test-cluster-rr-domain-listen.js +++ b/test/parallel/test-cluster-rr-domain-listen.js @@ -34,7 +34,7 @@ if (cluster.isWorker) { const http = require('http'); http.Server(() => {}).listen(0, '127.0.0.1'); -} else if (cluster.isMaster) { +} else if (cluster.isPrimary) { // Kill worker when listening cluster.on('listening', function() { diff --git a/test/parallel/test-cluster-rr-ref.js b/test/parallel/test-cluster-rr-ref.js index cf5e4f346bf7e2..92bb673ccdc62c 100644 --- a/test/parallel/test-cluster-rr-ref.js +++ b/test/parallel/test-cluster-rr-ref.js @@ -4,7 +4,7 @@ const common = require('../common'); const cluster = require('cluster'); const net = require('net'); -if (cluster.isMaster) { +if (cluster.isPrimary) { cluster.fork().on('message', function(msg) { if (msg === 'done') this.kill(); }); diff --git a/test/parallel/test-cluster-send-deadlock.js b/test/parallel/test-cluster-send-deadlock.js index b34eb892adb464..8ddc40c2529441 100644 --- a/test/parallel/test-cluster-send-deadlock.js +++ b/test/parallel/test-cluster-send-deadlock.js @@ -20,15 +20,15 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. 'use strict'; -// Testing mutual send of handles: from master to worker, and from worker to -// master. +// Testing mutual send of handles: from primary to worker, and from worker to +// primary. require('../common'); const assert = require('assert'); const cluster = require('cluster'); const net = require('net'); -if (cluster.isMaster) { +if (cluster.isPrimary) { const worker = cluster.fork(); worker.on('exit', (code, signal) => { assert.strictEqual(code, 0, `Worker exited with an error code: ${code}`); diff --git a/test/parallel/test-cluster-send-handle-twice.js b/test/parallel/test-cluster-send-handle-twice.js index 9eb87d826daa20..c413f6f82bffca 100644 --- a/test/parallel/test-cluster-send-handle-twice.js +++ b/test/parallel/test-cluster-send-handle-twice.js @@ -20,7 +20,7 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. 'use strict'; -// Testing to send an handle twice to the parent process. +// Testing to send an handle twice to the primary process. const common = require('../common'); const assert = require('assert'); @@ -31,7 +31,7 @@ const workers = { toStart: 1 }; -if (cluster.isMaster) { +if (cluster.isPrimary) { for (let i = 0; i < workers.toStart; ++i) { const worker = cluster.fork(); worker.on('exit', common.mustCall(function(code, signal) { diff --git a/test/parallel/test-cluster-send-socket-to-worker-http-server.js b/test/parallel/test-cluster-send-socket-to-worker-http-server.js index 805603d2c9b069..49993514dddc36 100644 --- a/test/parallel/test-cluster-send-socket-to-worker-http-server.js +++ b/test/parallel/test-cluster-send-socket-to-worker-http-server.js @@ -10,7 +10,7 @@ const cluster = require('cluster'); const http = require('http'); const net = require('net'); -if (cluster.isMaster) { +if (cluster.isPrimary) { const worker = cluster.fork(); const server = net.createServer(common.mustCall((socket) => { worker.send('socket', socket); diff --git a/test/parallel/test-cluster-server-restart-none.js b/test/parallel/test-cluster-server-restart-none.js index 88a6e5858635d2..fdc3fa5a36a718 100644 --- a/test/parallel/test-cluster-server-restart-none.js +++ b/test/parallel/test-cluster-server-restart-none.js @@ -5,7 +5,7 @@ const cluster = require('cluster'); cluster.schedulingPolicy = cluster.SCHED_NONE; -if (cluster.isMaster) { +if (cluster.isPrimary) { const worker1 = cluster.fork(); worker1.on('listening', common.mustCall(() => { const worker2 = cluster.fork(); diff --git a/test/parallel/test-cluster-server-restart-rr.js b/test/parallel/test-cluster-server-restart-rr.js index 63edaf9fac7b8d..446a7de1549072 100644 --- a/test/parallel/test-cluster-server-restart-rr.js +++ b/test/parallel/test-cluster-server-restart-rr.js @@ -5,7 +5,7 @@ const cluster = require('cluster'); cluster.schedulingPolicy = cluster.SCHED_RR; -if (cluster.isMaster) { +if (cluster.isPrimary) { const worker1 = cluster.fork(); worker1.on('listening', common.mustCall(() => { const worker2 = cluster.fork(); diff --git a/test/parallel/test-cluster-setup-master-argv.js b/test/parallel/test-cluster-setup-primary-argv.js similarity index 98% rename from test/parallel/test-cluster-setup-master-argv.js rename to test/parallel/test-cluster-setup-primary-argv.js index fa0779dca9a67d..4c465bb72a8dc0 100644 --- a/test/parallel/test-cluster-setup-master-argv.js +++ b/test/parallel/test-cluster-setup-primary-argv.js @@ -36,4 +36,4 @@ cluster.on('setup', common.mustCall(function() { assert.notStrictEqual(process.argv[process.argv.length - 1], 'OMG,OMG'); process.argv.push('OMG,OMG'); process.argv.push('OMG,OMG'); -cluster.setupMaster(); +cluster.setupPrimary(); diff --git a/test/parallel/test-cluster-setup-master-cumulative.js b/test/parallel/test-cluster-setup-primary-cumulative.js similarity index 90% rename from test/parallel/test-cluster-setup-master-cumulative.js rename to test/parallel/test-cluster-setup-primary-cumulative.js index 2621685e315bcc..cf62291e9d4ce0 100644 --- a/test/parallel/test-cluster-setup-master-cumulative.js +++ b/test/parallel/test-cluster-setup-primary-cumulative.js @@ -24,12 +24,12 @@ require('../common'); const assert = require('assert'); const cluster = require('cluster'); -assert(cluster.isMaster); +assert(cluster.isPrimary); // cluster.settings should not be initialized until needed assert.deepStrictEqual(cluster.settings, {}); -cluster.setupMaster(); +cluster.setupPrimary(); assert.deepStrictEqual(cluster.settings, { args: process.argv.slice(2), exec: process.argv[1], @@ -38,21 +38,21 @@ assert.deepStrictEqual(cluster.settings, { }); console.log('ok sets defaults'); -cluster.setupMaster({ exec: 'overridden' }); +cluster.setupPrimary({ exec: 'overridden' }); assert.strictEqual(cluster.settings.exec, 'overridden'); console.log('ok overrides defaults'); -cluster.setupMaster({ args: ['foo', 'bar'] }); +cluster.setupPrimary({ args: ['foo', 'bar'] }); assert.strictEqual(cluster.settings.exec, 'overridden'); assert.deepStrictEqual(cluster.settings.args, ['foo', 'bar']); -cluster.setupMaster({ execArgv: ['baz', 'bang'] }); +cluster.setupPrimary({ execArgv: ['baz', 'bang'] }); assert.strictEqual(cluster.settings.exec, 'overridden'); assert.deepStrictEqual(cluster.settings.args, ['foo', 'bar']); assert.deepStrictEqual(cluster.settings.execArgv, ['baz', 'bang']); console.log('ok preserves unchanged settings on repeated calls'); -cluster.setupMaster(); +cluster.setupPrimary(); assert.deepStrictEqual(cluster.settings, { args: ['foo', 'bar'], exec: 'overridden', diff --git a/test/parallel/test-cluster-setup-master-emit.js b/test/parallel/test-cluster-setup-primary-emit.js similarity index 94% rename from test/parallel/test-cluster-setup-master-emit.js rename to test/parallel/test-cluster-setup-primary-emit.js index d6643ef62a6700..08414d5b21fda9 100644 --- a/test/parallel/test-cluster-setup-master-emit.js +++ b/test/parallel/test-cluster-setup-primary-emit.js @@ -24,14 +24,14 @@ const common = require('../common'); const assert = require('assert'); const cluster = require('cluster'); -assert(cluster.isMaster); +assert(cluster.isPrimary); function emitAndCatch(next) { cluster.once('setup', common.mustCall(function(settings) { assert.strictEqual(settings.exec, 'new-exec'); setImmediate(next); })); - cluster.setupMaster({ exec: 'new-exec' }); + cluster.setupPrimary({ exec: 'new-exec' }); } function emitAndCatch2(next) { @@ -39,7 +39,7 @@ function emitAndCatch2(next) { assert('exec' in settings); setImmediate(next); })); - cluster.setupMaster(); + cluster.setupPrimary(); } emitAndCatch(common.mustCall(function() { diff --git a/test/parallel/test-cluster-setup-master-multiple.js b/test/parallel/test-cluster-setup-primary-multiple.js similarity index 94% rename from test/parallel/test-cluster-setup-master-multiple.js rename to test/parallel/test-cluster-setup-primary-multiple.js index 11434edb90048a..0fd8c0943c58f6 100644 --- a/test/parallel/test-cluster-setup-master-multiple.js +++ b/test/parallel/test-cluster-setup-primary-multiple.js @@ -25,7 +25,7 @@ const assert = require('assert'); const cluster = require('cluster'); const debug = require('util').debuglog('test'); -assert(cluster.isMaster); +assert(cluster.isPrimary); // The cluster.settings object is cloned even though the current implementation // makes that unnecessary. This is to make the test less fragile if the @@ -48,7 +48,7 @@ const execs = [ ]; process.on('exit', () => { - // Tests that "setup" is emitted for every call to setupMaster + // Tests that "setup" is emitted for every call to setupPrimary assert.strictEqual(configs.length, execs.length); assert.strictEqual(configs[0].exec, execs[0]); @@ -59,7 +59,7 @@ process.on('exit', () => { // Make changes to cluster settings execs.forEach((v, i) => { setTimeout(() => { - cluster.setupMaster({ exec: v }); + cluster.setupPrimary({ exec: v }); }, i * 100); }); diff --git a/test/parallel/test-cluster-setup-master.js b/test/parallel/test-cluster-setup-primary.js similarity index 97% rename from test/parallel/test-cluster-setup-master.js rename to test/parallel/test-cluster-setup-primary.js index 619a8439904d92..efba017fd76fae 100644 --- a/test/parallel/test-cluster-setup-master.js +++ b/test/parallel/test-cluster-setup-primary.js @@ -29,7 +29,7 @@ if (cluster.isWorker) { // Just keep the worker alive process.send(process.argv[2]); -} else if (cluster.isMaster) { +} else if (cluster.isPrimary) { const checks = { args: false, @@ -40,8 +40,8 @@ if (cluster.isWorker) { const totalWorkers = 2; let settings; - // Setup master - cluster.setupMaster({ + // Setup primary + cluster.setupPrimary({ args: ['custom argument'], silent: true }); diff --git a/test/parallel/test-cluster-shared-handle-bind-error.js b/test/parallel/test-cluster-shared-handle-bind-error.js index 1ce7a573cf6477..79f588d8de0dbe 100644 --- a/test/parallel/test-cluster-shared-handle-bind-error.js +++ b/test/parallel/test-cluster-shared-handle-bind-error.js @@ -25,8 +25,8 @@ const assert = require('assert'); const cluster = require('cluster'); const net = require('net'); -if (cluster.isMaster) { - // Master opens and binds the socket and shares it with the worker. +if (cluster.isPrimary) { + // Primary opens and binds the socket and shares it with the worker. cluster.schedulingPolicy = cluster.SCHED_NONE; // Hog the TCP port so that when the worker tries to bind, it'll fail. const server = net.createServer(common.mustNotCall()); diff --git a/test/parallel/test-cluster-shared-handle-bind-privileged-port.js b/test/parallel/test-cluster-shared-handle-bind-privileged-port.js index 31906bac30517d..775487ad7df034 100644 --- a/test/parallel/test-cluster-shared-handle-bind-privileged-port.js +++ b/test/parallel/test-cluster-shared-handle-bind-privileged-port.js @@ -39,8 +39,8 @@ const assert = require('assert'); const cluster = require('cluster'); const net = require('net'); -if (cluster.isMaster) { - // Master opens and binds the socket and shares it with the worker. +if (cluster.isPrimary) { + // Primary opens and binds the socket and shares it with the worker. cluster.schedulingPolicy = cluster.SCHED_NONE; cluster.fork().on('exit', common.mustCall(function(exitCode) { assert.strictEqual(exitCode, 0); diff --git a/test/parallel/test-cluster-shared-leak.js b/test/parallel/test-cluster-shared-leak.js index a7b3023f3ed3ba..67c11ea32145e0 100644 --- a/test/parallel/test-cluster-shared-leak.js +++ b/test/parallel/test-cluster-shared-leak.js @@ -9,7 +9,7 @@ const net = require('net'); const cluster = require('cluster'); cluster.schedulingPolicy = cluster.SCHED_NONE; -if (cluster.isMaster) { +if (cluster.isPrimary) { let conn, worker2; const worker1 = cluster.fork(); diff --git a/test/parallel/test-cluster-uncaught-exception.js b/test/parallel/test-cluster-uncaught-exception.js index 3d31fece668501..80d1ec61189766 100644 --- a/test/parallel/test-cluster-uncaught-exception.js +++ b/test/parallel/test-cluster-uncaught-exception.js @@ -34,16 +34,16 @@ const MAGIC_EXIT_CODE = 42; const isTestRunner = process.argv[2] !== 'child'; if (isTestRunner) { - const master = fork(__filename, ['child']); - master.on('exit', common.mustCall((code) => { + const primary = fork(__filename, ['child']); + primary.on('exit', common.mustCall((code) => { assert.strictEqual(code, MAGIC_EXIT_CODE); })); -} else if (cluster.isMaster) { +} else if (cluster.isPrimary) { process.on('uncaughtException', common.mustCall(() => { process.nextTick(() => process.exit(MAGIC_EXIT_CODE)); })); cluster.fork(); - throw new Error('kill master'); + throw new Error('kill primary'); } else { // worker process.exit(); } diff --git a/test/parallel/test-cluster-worker-death.js b/test/parallel/test-cluster-worker-death.js index 0a7b081c117a85..700cae7c52001c 100644 --- a/test/parallel/test-cluster-worker-death.js +++ b/test/parallel/test-cluster-worker-death.js @@ -24,7 +24,7 @@ const common = require('../common'); const assert = require('assert'); const cluster = require('cluster'); -if (!cluster.isMaster) { +if (!cluster.isPrimary) { process.exit(42); } else { const worker = cluster.fork(); diff --git a/test/parallel/test-cluster-worker-destroy.js b/test/parallel/test-cluster-worker-destroy.js index b08919c052593e..91eee51a5a186b 100644 --- a/test/parallel/test-cluster-worker-destroy.js +++ b/test/parallel/test-cluster-worker-destroy.js @@ -24,7 +24,7 @@ // The goal of this test is to cover the Workers' implementation of // Worker.prototype.destroy. Worker.prototype.destroy is called within // the worker's context: once when the worker is still connected to the -// master, and another time when it's not connected to it, so that we cover +// primary, and another time when it's not connected to it, so that we cover // both code paths. const common = require('../common'); @@ -32,7 +32,7 @@ const assert = require('assert'); const cluster = require('cluster'); let worker1, worker2; -if (cluster.isMaster) { +if (cluster.isPrimary) { worker1 = cluster.fork(); worker2 = cluster.fork(); diff --git a/test/parallel/test-cluster-worker-disconnect-on-error.js b/test/parallel/test-cluster-worker-disconnect-on-error.js index 3b03b21ee7a21a..122d31a62e64da 100644 --- a/test/parallel/test-cluster-worker-disconnect-on-error.js +++ b/test/parallel/test-cluster-worker-disconnect-on-error.js @@ -7,7 +7,7 @@ const assert = require('assert'); cluster.schedulingPolicy = cluster.SCHED_NONE; const server = http.createServer(); -if (cluster.isMaster) { +if (cluster.isPrimary) { let worker; server.listen(0, common.mustSucceed(() => { diff --git a/test/parallel/test-cluster-worker-disconnect.js b/test/parallel/test-cluster-worker-disconnect.js index 71c151410cdb2c..b28c0fbd8f5d9e 100644 --- a/test/parallel/test-cluster-worker-disconnect.js +++ b/test/parallel/test-cluster-worker-disconnect.js @@ -34,7 +34,7 @@ if (cluster.isWorker) { process.exit(42); })); -} else if (cluster.isMaster) { +} else if (cluster.isPrimary) { const checks = { cluster: { diff --git a/test/parallel/test-cluster-worker-events.js b/test/parallel/test-cluster-worker-events.js index 3b156addedc63f..6c044ace8df04c 100644 --- a/test/parallel/test-cluster-worker-events.js +++ b/test/parallel/test-cluster-worker-events.js @@ -26,7 +26,7 @@ const cluster = require('cluster'); const OK = 2; -if (cluster.isMaster) { +if (cluster.isPrimary) { const worker = cluster.fork(); diff --git a/test/parallel/test-cluster-worker-exit.js b/test/parallel/test-cluster-worker-exit.js index f93a3f587096ab..8867696b9a413d 100644 --- a/test/parallel/test-cluster-worker-exit.js +++ b/test/parallel/test-cluster-worker-exit.js @@ -22,7 +22,7 @@ 'use strict'; // test-cluster-worker-exit.js // verifies that, when a child process exits (by calling `process.exit(code)`) -// - the parent receives the proper events in the proper order, no duplicates +// - the primary receives the proper events in the proper order, no duplicates // - the exitCode and signalCode are correct in the 'exit' event // - the worker.exitedAfterDisconnect flag, and worker.state are correct // - the worker process actually goes away @@ -42,7 +42,7 @@ if (cluster.isWorker) { })); server.listen(0, '127.0.0.1'); -} else if (cluster.isMaster) { +} else if (cluster.isPrimary) { const expected_results = { cluster_emitDisconnect: [1, "the cluster did not emit 'disconnect'"], diff --git a/test/parallel/test-cluster-worker-init.js b/test/parallel/test-cluster-worker-init.js index 47a884c1cdcc22..2acc55c148caa4 100644 --- a/test/parallel/test-cluster-worker-init.js +++ b/test/parallel/test-cluster-worker-init.js @@ -29,7 +29,7 @@ const assert = require('assert'); const cluster = require('cluster'); const msg = 'foo'; -if (cluster.isMaster) { +if (cluster.isPrimary) { const worker = cluster.fork(); worker.on('message', common.mustCall((message) => { diff --git a/test/parallel/test-cluster-worker-isconnected.js b/test/parallel/test-cluster-worker-isconnected.js index a0ada77bd023b1..75df689fd0c44e 100644 --- a/test/parallel/test-cluster-worker-isconnected.js +++ b/test/parallel/test-cluster-worker-isconnected.js @@ -3,7 +3,7 @@ const common = require('../common'); const cluster = require('cluster'); const assert = require('assert'); -if (cluster.isMaster) { +if (cluster.isPrimary) { const worker = cluster.fork(); assert.strictEqual(worker.isConnected(), true); diff --git a/test/parallel/test-cluster-worker-isdead.js b/test/parallel/test-cluster-worker-isdead.js index 15567b929a59e6..6f2aa3c52ecd5c 100644 --- a/test/parallel/test-cluster-worker-isdead.js +++ b/test/parallel/test-cluster-worker-isdead.js @@ -3,7 +3,7 @@ require('../common'); const cluster = require('cluster'); const assert = require('assert'); -if (cluster.isMaster) { +if (cluster.isPrimary) { const worker = cluster.fork(); let workerDead = worker.isDead(); assert.ok(!workerDead, diff --git a/test/parallel/test-cluster-worker-kill.js b/test/parallel/test-cluster-worker-kill.js index 0cd6d0321cf670..9fcb924149704e 100644 --- a/test/parallel/test-cluster-worker-kill.js +++ b/test/parallel/test-cluster-worker-kill.js @@ -22,7 +22,7 @@ 'use strict'; // test-cluster-worker-kill.js // verifies that, when a child process is killed (we use SIGKILL) -// - the parent receives the proper events in the proper order, no duplicates +// - the primary receives the proper events in the proper order, no duplicates // - the exitCode and signalCode are correct in the 'exit' event // - the worker.exitedAfterDisconnect flag, and worker.state are correct // - the worker process actually goes away @@ -38,7 +38,7 @@ if (cluster.isWorker) { server.once('listening', common.mustCall(() => { })); server.listen(0, '127.0.0.1'); -} else if (cluster.isMaster) { +} else if (cluster.isPrimary) { const KILL_SIGNAL = 'SIGKILL'; const expected_results = { diff --git a/test/parallel/test-cluster-worker-no-exit.js b/test/parallel/test-cluster-worker-no-exit.js index 7325759741592c..e4694a4a3a1cfb 100644 --- a/test/parallel/test-cluster-worker-no-exit.js +++ b/test/parallel/test-cluster-worker-no-exit.js @@ -40,7 +40,7 @@ let server; // 3 wait to confirm it did not exit // 4 destroy connection // 5 confirm it does exit -if (cluster.isMaster) { +if (cluster.isPrimary) { server = net.createServer(function(conn) { server.close(); worker.disconnect(); diff --git a/test/parallel/test-cluster-worker-wait-server-close.js b/test/parallel/test-cluster-worker-wait-server-close.js index ad3320327acd29..71a8cacb5260a3 100644 --- a/test/parallel/test-cluster-worker-wait-server-close.js +++ b/test/parallel/test-cluster-worker-wait-server-close.js @@ -28,7 +28,7 @@ if (cluster.isWorker) { assert(serverClosed); clearInterval(keepOpen); }); -} else if (cluster.isMaster) { +} else if (cluster.isPrimary) { // start worker const worker = cluster.fork(); 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-key-objects.js b/test/parallel/test-crypto-key-objects.js index fdb63afa7659f3..34c2cef4c7677c 100644 --- a/test/parallel/test-crypto-key-objects.js +++ b/test/parallel/test-crypto-key-objects.js @@ -70,6 +70,7 @@ const privateDsa = fixtures.readKey('dsa_private_encrypted_1025.pem', assert.strictEqual(key.type, 'secret'); assert.strictEqual(key.symmetricKeySize, 32); assert.strictEqual(key.asymmetricKeyType, undefined); + assert.strictEqual(key.asymmetricKeyDetails, undefined); const exportedKey = key.export(); assert(keybuf.equals(exportedKey)); diff --git a/test/parallel/test-crypto-keygen.js b/test/parallel/test-crypto-keygen.js index f59a26a422f96d..c27d5fe166220e 100644 --- a/test/parallel/test-crypto-keygen.js +++ b/test/parallel/test-crypto-keygen.js @@ -114,6 +114,31 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher); testSignVerify(publicKey, privateKey); } +{ + // Test sync key generation with key objects with a non-standard + // publicExpononent + const { publicKey, privateKey } = generateKeyPairSync('rsa', { + publicExponent: 3, + modulusLength: 512 + }); + + assert.strictEqual(typeof publicKey, 'object'); + assert.strictEqual(publicKey.type, 'public'); + assert.strictEqual(publicKey.asymmetricKeyType, 'rsa'); + assert.deepStrictEqual(publicKey.asymmetricKeyDetails, { + modulusLength: 512, + publicExponent: 3n + }); + + assert.strictEqual(typeof privateKey, 'object'); + assert.strictEqual(privateKey.type, 'private'); + assert.strictEqual(privateKey.asymmetricKeyType, 'rsa'); + assert.deepStrictEqual(privateKey.asymmetricKeyDetails, { + modulusLength: 512, + publicExponent: 3n + }); +} + { // Test sync key generation with key objects. const { publicKey, privateKey } = generateKeyPairSync('rsa', { @@ -123,10 +148,18 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher); assert.strictEqual(typeof publicKey, 'object'); assert.strictEqual(publicKey.type, 'public'); assert.strictEqual(publicKey.asymmetricKeyType, 'rsa'); + assert.deepStrictEqual(publicKey.asymmetricKeyDetails, { + modulusLength: 512, + publicExponent: 65537n + }); assert.strictEqual(typeof privateKey, 'object'); assert.strictEqual(privateKey.type, 'private'); assert.strictEqual(privateKey.asymmetricKeyType, 'rsa'); + assert.deepStrictEqual(privateKey.asymmetricKeyDetails, { + modulusLength: 512, + publicExponent: 65537n + }); } { @@ -268,9 +301,17 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher); }, common.mustSucceed((publicKey, privateKey) => { assert.strictEqual(publicKey.type, 'public'); assert.strictEqual(publicKey.asymmetricKeyType, 'rsa-pss'); + assert.deepStrictEqual(publicKey.asymmetricKeyDetails, { + modulusLength: 512, + publicExponent: 65537n + }); assert.strictEqual(privateKey.type, 'private'); assert.strictEqual(privateKey.asymmetricKeyType, 'rsa-pss'); + assert.deepStrictEqual(privateKey.asymmetricKeyDetails, { + modulusLength: 512, + publicExponent: 65537n + }); // Unlike RSA, RSA-PSS does not allow encryption. assert.throws(() => { @@ -342,6 +383,28 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher); })); } +{ + // Test async DSA key object generation. + generateKeyPair('dsa', { + modulusLength: 512, + divisorLength: 256 + }, common.mustSucceed((publicKey, privateKey) => { + assert.strictEqual(publicKey.type, 'public'); + assert.strictEqual(publicKey.asymmetricKeyType, 'dsa'); + assert.deepStrictEqual(publicKey.asymmetricKeyDetails, { + modulusLength: 512, + divisorLength: 256 + }); + + assert.strictEqual(privateKey.type, 'private'); + assert.strictEqual(privateKey.asymmetricKeyType, 'dsa'); + assert.deepStrictEqual(privateKey.asymmetricKeyDetails, { + modulusLength: 512, + divisorLength: 256 + }); + })); +} + { // Test async elliptic curve key generation, e.g. for ECDSA, with a SEC1 // private key. @@ -925,16 +988,24 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher); // It should recognize both NIST and standard curve names. generateKeyPair('ec', { namedCurve: 'P-256', - publicKeyEncoding: { type: 'spki', format: 'pem' }, - privateKeyEncoding: { type: 'pkcs8', format: 'pem' } }, common.mustSucceed((publicKey, privateKey) => { + assert.deepStrictEqual(publicKey.asymmetricKeyDetails, { + namedCurve: 'prime256v1' + }); + assert.deepStrictEqual(privateKey.asymmetricKeyDetails, { + namedCurve: 'prime256v1' + }); })); generateKeyPair('ec', { namedCurve: 'secp256k1', - publicKeyEncoding: { type: 'spki', format: 'pem' }, - privateKeyEncoding: { type: 'pkcs8', format: 'pem' } }, common.mustSucceed((publicKey, privateKey) => { + assert.deepStrictEqual(publicKey.asymmetricKeyDetails, { + namedCurve: 'secp256k1' + }); + assert.deepStrictEqual(privateKey.asymmetricKeyDetails, { + namedCurve: 'secp256k1' + }); })); } @@ -945,9 +1016,11 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher); generateKeyPair(keyType, common.mustSucceed((publicKey, privateKey) => { assert.strictEqual(publicKey.type, 'public'); assert.strictEqual(publicKey.asymmetricKeyType, keyType); + assert.deepStrictEqual(publicKey.asymmetricKeyDetails, {}); assert.strictEqual(privateKey.type, 'private'); assert.strictEqual(privateKey.asymmetricKeyType, keyType); + assert.deepStrictEqual(privateKey.asymmetricKeyDetails, {}); })); }); } 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..3d2031c52131b3 --- /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().replaceAll('\r\n', '\n'), 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-dgram-cluster-bind-error.js b/test/parallel/test-dgram-cluster-bind-error.js index fb338da9727123..11c2bc1796f25a 100644 --- a/test/parallel/test-dgram-cluster-bind-error.js +++ b/test/parallel/test-dgram-cluster-bind-error.js @@ -7,7 +7,7 @@ const dgram = require('dgram'); const { internalBinding } = require('internal/test/binding'); const { UV_UNKNOWN } = internalBinding('uv'); -if (cluster.isMaster) { +if (cluster.isPrimary) { cluster.fork(); } else { // When the socket attempts to bind, it requests a handle from the cluster. diff --git a/test/parallel/test-dgram-cluster-close-during-bind.js b/test/parallel/test-dgram-cluster-close-during-bind.js index 4e8cdbf9d35cbb..065ff094f18fdd 100644 --- a/test/parallel/test-dgram-cluster-close-during-bind.js +++ b/test/parallel/test-dgram-cluster-close-during-bind.js @@ -7,7 +7,7 @@ const assert = require('assert'); const cluster = require('cluster'); const dgram = require('dgram'); -if (cluster.isMaster) { +if (cluster.isPrimary) { cluster.fork(); } else { // When the socket attempts to bind, it requests a handle from the cluster. diff --git a/test/parallel/test-dgram-exclusive-implicit-bind.js b/test/parallel/test-dgram-exclusive-implicit-bind.js index 4603507240f8b7..cb2fdaa438717b 100644 --- a/test/parallel/test-dgram-exclusive-implicit-bind.js +++ b/test/parallel/test-dgram-exclusive-implicit-bind.js @@ -30,16 +30,16 @@ const dgram = require('dgram'); // number causes all sockets bound to that number to share a port. // // The 2 workers that call bind() will share a port, the two workers that do -// not will not share a port, so master will see 3 unique source ports. +// not will not share a port, so primary will see 3 unique source ports. // Note that on Windows, clustered dgram is not supported. Since explicit // binding causes the dgram to be clustered, don't fork the workers that bind. // This is a useful test, still, because it demonstrates that by avoiding // clustering, client (ephemeral, implicitly bound) dgram sockets become -// supported while using cluster, though servers still cause the master to error -// with ENOTSUP. +// supported while using cluster, though servers still cause the primary +// to error with ENOTSUP. -if (cluster.isMaster) { +if (cluster.isPrimary) { let messages = 0; const ports = {}; const pids = []; 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-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..14b8ea5815a61a 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(); @@ -157,6 +169,19 @@ async function abortSignalAfterEvent() { await once(ee, 'foo', { signal: ac.signal }); } +async function abortSignalRemoveListener() { + const ee = new EventEmitter(); + const ac = new AbortController(); + + try { + process.nextTick(() => ac.abort()); + await once(ee, 'test', { signal: ac.signal }); + } catch { + strictEqual(ee.listeners('test').length, 0); + strictEqual(ee.listeners('error').length, 0); + } +} + async function eventTargetAbortSignalBefore() { const et = new EventTarget(); const ac = new AbortController(); @@ -195,6 +220,7 @@ async function eventTargetAbortSignalAfterEvent() { Promise.all([ onceAnEvent(), + onceAnEventWithNullOptions(), onceAnEventWithTwoArgs(), catchesErrors(), stopListeningAfterCatchingError(), @@ -205,6 +231,7 @@ Promise.all([ abortSignalBefore(), abortSignalAfter(), abortSignalAfterEvent(), + abortSignalRemoveListener(), eventTargetAbortSignalBefore(), eventTargetAbortSignalAfter(), eventTargetAbortSignalAfterEvent(), 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-fs-exists.js b/test/parallel/test-fs-exists.js index cd2d9a712f3f58..75b7adfc3ee3d0 100644 --- a/test/parallel/test-fs-exists.js +++ b/test/parallel/test-fs-exists.js @@ -23,7 +23,6 @@ const common = require('../common'); const assert = require('assert'); const fs = require('fs'); -const { URL } = require('url'); const f = __filename; assert.throws(() => fs.exists(f), { code: 'ERR_INVALID_CALLBACK' }); diff --git a/test/parallel/test-fs-null-bytes.js b/test/parallel/test-fs-null-bytes.js index beaea00969b630..d4548c02c07009 100644 --- a/test/parallel/test-fs-null-bytes.js +++ b/test/parallel/test-fs-null-bytes.js @@ -23,7 +23,6 @@ const common = require('../common'); const assert = require('assert'); const fs = require('fs'); -const URL = require('url').URL; function check(async, sync) { const argsSync = Array.prototype.slice.call(arguments, 2); diff --git a/test/parallel/test-fs-read-type.js b/test/parallel/test-fs-read-type.js index 0f9bdbab588661..5635fe0a662c64 100644 --- a/test/parallel/test-fs-read-type.js +++ b/test/parallel/test-fs-read-type.js @@ -76,6 +76,51 @@ assert.throws(() => { 'It must be >= 0. Received -1' }); +[true, () => {}, {}, ''].forEach((value) => { + assert.throws(() => { + fs.read(fd, + Buffer.allocUnsafe(expected.length), + 0, + expected.length, + value, + common.mustNotCall()); + }, { + code: 'ERR_INVALID_ARG_TYPE', + name: 'TypeError' + }); +}); + +[0.5, 2 ** 53, 2n ** 63n].forEach((value) => { + assert.throws(() => { + fs.read(fd, + Buffer.allocUnsafe(expected.length), + 0, + expected.length, + value, + common.mustNotCall()); + }, { + code: 'ERR_OUT_OF_RANGE', + name: 'RangeError' + }); +}); + +fs.read(fd, + Buffer.allocUnsafe(expected.length), + 0, + expected.length, + 0n, + common.mustSucceed()); + +fs.read(fd, + Buffer.allocUnsafe(expected.length), + 0, + expected.length, + 2n ** 53n - 1n, + common.mustCall((err) => { + if (err) { + assert.strictEqual(err.code, 'EFBIG'); + } + })); assert.throws( () => fs.readSync(fd, expected.length, 0, 'utf-8'), @@ -151,3 +196,48 @@ assert.throws(() => { message: 'The value of "length" is out of range. ' + 'It must be <= 4. Received 5' }); + +[true, () => {}, {}, ''].forEach((value) => { + assert.throws(() => { + fs.readSync(fd, + Buffer.allocUnsafe(expected.length), + 0, + expected.length, + value); + }, { + code: 'ERR_INVALID_ARG_TYPE', + name: 'TypeError' + }); +}); + +[0.5, 2 ** 53, 2n ** 63n].forEach((value) => { + assert.throws(() => { + fs.readSync(fd, + Buffer.allocUnsafe(expected.length), + 0, + expected.length, + value); + }, { + code: 'ERR_OUT_OF_RANGE', + name: 'RangeError' + }); +}); + +fs.readSync(fd, + Buffer.allocUnsafe(expected.length), + 0, + expected.length, + 0n); + +try { + fs.readSync(fd, + Buffer.allocUnsafe(expected.length), + 0, + expected.length, + 2n ** 53n - 1n); +} catch (err) { + // On systems where max file size is below 2^53-1, we'd expect a EFBIG error. + // This is not using `assert.throws` because the above call should not raise + // any error on systems that allows file of that size. + if (err.code !== 'EFBIG') throw err; +} diff --git a/test/parallel/test-fs-whatwg-url.js b/test/parallel/test-fs-whatwg-url.js index a506e5eb942a54..829cfa92fafebd 100644 --- a/test/parallel/test-fs-whatwg-url.js +++ b/test/parallel/test-fs-whatwg-url.js @@ -6,7 +6,6 @@ const assert = require('assert'); const path = require('path'); const fs = require('fs'); const os = require('os'); -const URL = require('url').URL; function pathToFileURL(p) { if (!path.isAbsolute(p)) 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-get-url.js b/test/parallel/test-http-client-get-url.js index a72eea56538c4d..3b091a72eda493 100644 --- a/test/parallel/test-http-client-get-url.js +++ b/test/parallel/test-http-client-get-url.js @@ -24,7 +24,6 @@ const common = require('../common'); const assert = require('assert'); const http = require('http'); const url = require('url'); -const URL = url.URL; const testPath = '/foo?bar'; const server = http.createServer(common.mustCall((req, res) => { 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.js b/test/parallel/test-http-server.js index f591cd59fc63c2..dcefc761728d36 100644 --- a/test/parallel/test-http-server.js +++ b/test/parallel/test-http-server.js @@ -49,6 +49,8 @@ const server = http.createServer(function(req, res) { res.id = request_number; req.id = request_number++; + assert.strictEqual(res.req, req); + if (req.id === 0) { assert.strictEqual(req.method, 'GET'); assert.strictEqual(url.parse(req.url).pathname, '/hello'); diff --git a/test/parallel/test-http-transfer-encoding-smuggling.js b/test/parallel/test-http-transfer-encoding-smuggling.js new file mode 100644 index 00000000000000..77e719d37e143e --- /dev/null +++ b/test/parallel/test-http-transfer-encoding-smuggling.js @@ -0,0 +1,44 @@ +'use strict'; + +const common = require('../common'); + +const http = require('http'); +const net = require('net'); + +const msg = [ + 'POST / HTTP/1.1', + 'Host: 127.0.0.1', + 'Transfer-Encoding: chunked', + 'Transfer-Encoding: chunked-false', + 'Connection: upgrade', + '', + '1', + 'A', + '0', + '', + 'GET /flag HTTP/1.1', + 'Host: 127.0.0.1', + '', + '', +].join('\r\n'); + +// Verify that the server is called only once even with a smuggled request. + +const server = http.createServer(common.mustCall((req, res) => { + res.end(); +}, 1)); + +function send(next) { + const client = net.connect(server.address().port, 'localhost'); + client.setEncoding('utf8'); + client.on('error', common.mustNotCall()); + client.on('end', next); + client.write(msg); + client.resume(); +} + +server.listen(0, common.mustSucceed(() => { + send(common.mustCall(() => { + server.close(); + })); +})); diff --git a/test/parallel/test-http2-altsvc.js b/test/parallel/test-http2-altsvc.js index 3a1a1cf62991b7..39a3ca97b78bf3 100644 --- a/test/parallel/test-http2-altsvc.js +++ b/test/parallel/test-http2-altsvc.js @@ -6,7 +6,6 @@ if (!common.hasCrypto) const assert = require('assert'); const http2 = require('http2'); -const { URL } = require('url'); const Countdown = require('../common/countdown'); const server = http2.createServer(); diff --git a/test/parallel/test-http2-compat-serverresponse.js b/test/parallel/test-http2-compat-serverresponse.js new file mode 100644 index 00000000000000..379677a68f81e1 --- /dev/null +++ b/test/parallel/test-http2-compat-serverresponse.js @@ -0,0 +1,40 @@ +'use strict'; + +const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); +const assert = require('assert'); +const h2 = require('http2'); + +// Http2ServerResponse should expose convenience properties + +const server = h2.createServer(); +server.listen(0, common.mustCall(function() { + const port = server.address().port; + server.once('request', common.mustCall(function(request, response) { + assert.strictEqual(response.req, request); + + response.on('finish', common.mustCall(function() { + process.nextTick(() => { + server.close(); + }); + })); + response.end(); + })); + + const url = `http://localhost:${port}`; + const client = h2.connect(url, common.mustCall(function() { + const headers = { + ':path': '/foobar', + ':method': 'GET', + ':scheme': 'http', + ':authority': `localhost:${port}` + }; + const request = client.request(headers); + request.on('end', common.mustCall(function() { + client.close(); + })); + request.end(); + request.resume(); + })); +})); diff --git a/test/parallel/test-http2-connect-method.js b/test/parallel/test-http2-connect-method.js index d5b4c4bd274950..4ada9f47553528 100644 --- a/test/parallel/test-http2-connect-method.js +++ b/test/parallel/test-http2-connect-method.js @@ -6,7 +6,6 @@ if (!common.hasCrypto) const assert = require('assert'); const net = require('net'); const http2 = require('http2'); -const { URL } = require('url'); const { HTTP2_HEADER_METHOD, diff --git a/test/parallel/test-http2-create-client-connect.js b/test/parallel/test-http2-create-client-connect.js index 8a4fc9a1d0e075..5723fcecd6f069 100644 --- a/test/parallel/test-http2-create-client-connect.js +++ b/test/parallel/test-http2-create-client-connect.js @@ -9,7 +9,6 @@ if (!common.hasCrypto) const fixtures = require('../common/fixtures'); const h2 = require('http2'); const url = require('url'); -const URL = url.URL; { const server = h2.createServer(); diff --git a/test/parallel/test-http2-response-splitting.js b/test/parallel/test-http2-response-splitting.js index 9613eca9636ae4..a94b9ca4f72b35 100644 --- a/test/parallel/test-http2-response-splitting.js +++ b/test/parallel/test-http2-response-splitting.js @@ -9,7 +9,6 @@ if (!common.hasCrypto) common.skip('missing crypto'); const assert = require('assert'); const http2 = require('http2'); -const { URL } = require('url'); // Response splitting example, credit: Amit Klein, Safebreach const str = '/welcome?lang=bar%c4%8d%c4%8aContent­Length:%200%c4%8d%c4%8a%c' + diff --git a/test/parallel/test-https-client-get-url.js b/test/parallel/test-https-client-get-url.js index 76328775e80187..fb91a4f1e7cb8a 100644 --- a/test/parallel/test-https-client-get-url.js +++ b/test/parallel/test-https-client-get-url.js @@ -32,8 +32,6 @@ const assert = require('assert'); const https = require('https'); const url = require('url'); -const URL = url.URL; - const options = { key: fixtures.readKey('agent1-key.pem'), cert: fixtures.readKey('agent1-cert.pem') diff --git a/test/parallel/test-inspect-support-for-node_options.js b/test/parallel/test-inspect-support-for-node_options.js index 05c7ec24b90d30..05bb3b2c429b27 100644 --- a/test/parallel/test-inspect-support-for-node_options.js +++ b/test/parallel/test-inspect-support-for-node_options.js @@ -13,7 +13,7 @@ function checkForInspectSupport(flag) { const numWorkers = 2; process.env.NODE_OPTIONS = flag; - if (cluster.isMaster) { + if (cluster.isPrimary) { for (let i = 0; i < numWorkers; i++) { cluster.fork(); } diff --git a/test/parallel/test-inspector-port-zero-cluster.js b/test/parallel/test-inspector-port-zero-cluster.js index 0330f1d50e6f70..8e2db0b69d5ca0 100644 --- a/test/parallel/test-inspector-port-zero-cluster.js +++ b/test/parallel/test-inspector-port-zero-cluster.js @@ -28,11 +28,11 @@ function serialFork() { }); } -if (cluster.isMaster) { +if (cluster.isPrimary) { Promise.all([serialFork(), serialFork(), serialFork()]) .then(common.mustCall((ports) => { ports.splice(0, 0, process.debugPort); - // 4 = [master, worker1, worker2, worker3].length() + // 4 = [primary, worker1, worker2, worker3].length() assert.strictEqual(ports.length, 4); assert(ports.every((port) => port > 0)); assert(ports.every((port) => port < 65536)); diff --git a/test/parallel/test-internal-util-normalizeencoding.js b/test/parallel/test-internal-util-normalizeencoding.js index d7a0259ac9c9fd..af567cbcf5cab3 100644 --- a/test/parallel/test-internal-util-normalizeencoding.js +++ b/test/parallel/test-internal-util-normalizeencoding.js @@ -33,6 +33,9 @@ const tests = [ ['base64', 'base64'], ['BASE64', 'base64'], ['Base64', 'base64'], + ['base64url', 'base64url'], + ['BASE64url', 'base64url'], + ['Base64url', 'base64url'], ['hex', 'hex'], ['HEX', 'hex'], ['ASCII', 'ascii'], diff --git a/test/parallel/test-listen-fd-cluster.js b/test/parallel/test-listen-fd-cluster.js index 45bb03ce588ae0..ea46b037a233d4 100644 --- a/test/parallel/test-listen-fd-cluster.js +++ b/test/parallel/test-listen-fd-cluster.js @@ -34,10 +34,10 @@ console.error('Cluster listen fd test', process.argv[2] || 'runner'); // Process relationship is: // // parent: the test main script -// -> master: the cluster master +// -> primary: the cluster primary // -> worker: the cluster worker switch (process.argv[2]) { - case 'master': return master(); + case 'primary': return primary(); case 'worker': return worker(); } @@ -88,35 +88,35 @@ function test(cb) { console.error(`server listening on ${port}`); const spawn = require('child_process').spawn; - const master = spawn(process.execPath, [__filename, 'master'], { + const primary = spawn(process.execPath, [__filename, 'primary'], { stdio: [ 0, 'pipe', 2, server._handle, 'ipc' ], detached: true }); - // Now close the parent, so that the master is the only thing + // Now close the parent, so that the primary is the only thing // referencing that handle. Note that connections will still - // be accepted, because the master has the fd open. + // be accepted, because the primary has the fd open. server.close(); - master.on('exit', function(code) { - console.error('master exited', code); + primary.on('exit', function(code) { + console.error('primary exited', code); }); - master.on('close', function() { - console.error('master closed'); + primary.on('close', function() { + console.error('primary closed'); }); - console.error('master spawned'); - master.on('message', function(msg) { + console.error('primary spawned'); + primary.on('message', function(msg) { if (msg === 'started worker') { - cb(master, port); + cb(primary, port); } }); }); } -function master() { - console.error('in master, spawning worker'); - cluster.setupMaster({ +function primary() { + console.error('in primary, spawning worker'); + cluster.setupPrimary({ args: [ 'worker' ] }); const worker = cluster.fork(); @@ -128,7 +128,7 @@ function master() { // Prevent outliving our parent process in case it is abnormally killed - // under normal conditions our parent kills this process before exiting. process.on('disconnect', function() { - console.error('master exit on disconnect'); + console.error('primary exit on disconnect'); process.exit(0); }); } 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-finished.js b/test/parallel/test-net-finished.js new file mode 100644 index 00000000000000..74acff0faa2384 --- /dev/null +++ b/test/parallel/test-net-finished.js @@ -0,0 +1,25 @@ +'use strict'; +const common = require('../common'); +const net = require('net'); +const { finished } = require('stream'); + +const server = net.createServer(function(con) { + con.on('close', common.mustCall()); +}); + +server.listen(0, common.mustCall(function() { + const con = net.connect({ + port: this.address().port + }) + .on('connect', () => { + finished(con, common.mustCall()); + con.destroy(); + finished(con, common.mustCall()); + con.on('close', common.mustCall(() => { + finished(con, common.mustCall(() => { + server.close(); + })); + })); + }) + .end(); +})); diff --git a/test/parallel/test-net-listen-exclusive-random-ports.js b/test/parallel/test-net-listen-exclusive-random-ports.js index 681e1236cc919a..66dfb598204e7b 100644 --- a/test/parallel/test-net-listen-exclusive-random-ports.js +++ b/test/parallel/test-net-listen-exclusive-random-ports.js @@ -5,7 +5,7 @@ const assert = require('assert'); const cluster = require('cluster'); const net = require('net'); -if (cluster.isMaster) { +if (cluster.isPrimary) { const worker1 = cluster.fork(); worker1.on('message', function(port1) { 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-net-socket-constructor.js b/test/parallel/test-net-socket-constructor.js index 0454a6fbe1233e..47010aa3b3e0e6 100644 --- a/test/parallel/test-net-socket-constructor.js +++ b/test/parallel/test-net-socket-constructor.js @@ -26,7 +26,7 @@ function test(sock, readable, writable) { assert.strictEqual(socket.writable, writable); } -if (cluster.isMaster) { +if (cluster.isPrimary) { test(undefined, true, true); const server = net.createServer(common.mustCall((socket) => { @@ -48,7 +48,7 @@ if (cluster.isMaster) { test(socket, true, true); })); - cluster.setupMaster({ + cluster.setupPrimary({ stdio: ['pipe', 'pipe', 'pipe', 'ipc', 'pipe', 'pipe', 'pipe'] }); diff --git a/test/parallel/test-npm-install.js b/test/parallel/test-npm-install.js index 1eec5f57ad6db9..17deacdbc14d2a 100644 --- a/test/parallel/test-npm-install.js +++ b/test/parallel/test-npm-install.js @@ -42,6 +42,8 @@ const env = { ...process.env, PATH: path.dirname(process.execPath), NPM_CONFIG_PREFIX: path.join(npmSandbox, 'npm-prefix'), NPM_CONFIG_TMP: path.join(npmSandbox, 'npm-tmp'), + NPM_CONFIG_AUDIT: false, + NPM_CONFIG_UPDATE_NOTIFIER: false, HOME: homeDir, }; 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-remove-all-signal-listeners.js b/test/parallel/test-process-remove-all-signal-listeners.js index 759820c2dc56d4..afd574daaa26b9 100644 --- a/test/parallel/test-process-remove-all-signal-listeners.js +++ b/test/parallel/test-process-remove-all-signal-listeners.js @@ -8,7 +8,7 @@ const assert = require('assert'); const spawn = require('child_process').spawn; if (process.argv[2] !== '--do-test') { - // We are the master, fork a child so we can verify it exits with correct + // We are the primary, fork a child so we can verify it exits with correct // status. process.env.DOTEST = 'y'; const child = spawn(process.execPath, [__filename, '--do-test']); 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-history-navigation.js b/test/parallel/test-repl-history-navigation.js index fa40ac624000f4..4dd9c350229b19 100644 --- a/test/parallel/test-repl-history-navigation.js +++ b/test/parallel/test-repl-history-navigation.js @@ -504,7 +504,56 @@ const tests = [ prompt, ], clean: true - } + }, + { + env: { NODE_REPL_HISTORY: defaultHistoryPath }, + test: (function*() { + // Deleting Array iterator should not break history feature. + // + // Using a generator function instead of an object to allow the test to + // keep iterating even when Array.prototype[Symbol.iterator] has been + // deleted. + yield 'const ArrayIteratorPrototype ='; + yield ' Object.getPrototypeOf(Array.prototype[Symbol.iterator]());'; + yield ENTER; + yield 'const {next} = ArrayIteratorPrototype;'; + yield ENTER; + yield 'const realArrayIterator = Array.prototype[Symbol.iterator];'; + yield ENTER; + yield 'delete Array.prototype[Symbol.iterator];'; + yield ENTER; + yield 'delete ArrayIteratorPrototype.next;'; + yield ENTER; + yield UP; + yield UP; + yield DOWN; + yield DOWN; + yield 'fu'; + yield 'n'; + yield RIGHT; + yield BACKSPACE; + yield LEFT; + yield LEFT; + yield 'A'; + yield BACKSPACE; + yield GO_TO_END; + yield BACKSPACE; + yield WORD_LEFT; + yield WORD_RIGHT; + yield ESCAPE; + yield ENTER; + yield 'Array.proto'; + yield RIGHT; + yield '.pu'; + yield ENTER; + yield 'ArrayIteratorPrototype.next = next;'; + yield ENTER; + yield 'Array.prototype[Symbol.iterator] = realArrayIterator;'; + yield ENTER; + })(), + expected: [], + clean: false + }, ]; const numtests = tests.length; 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-repl-unsafe-array-iteration.js b/test/parallel/test-repl-unsafe-array-iteration.js new file mode 100644 index 00000000000000..3fc65f54cf1f37 --- /dev/null +++ b/test/parallel/test-repl-unsafe-array-iteration.js @@ -0,0 +1,68 @@ +'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( + 'const ArrayIteratorPrototype =' + + ' Object.getPrototypeOf(Array.prototype[Symbol.iterator]());' + ); + await writeLn('delete Array.prototype[Symbol.iterator];'); + await writeLn('delete ArrayIteratorPrototype.next;'); + + await writeLn( + 'for(const x of [3, 2, 1]);', + /Uncaught TypeError: \[3,2,1\] is not iterable/ + ); + await writeLn('.exit'); + + assert(!replProcess.connected); +} + +main().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-buffer-list.js b/test/parallel/test-stream-buffer-list.js index 5b495a41e08545..d9d0405f4d5a45 100644 --- a/test/parallel/test-stream-buffer-list.js +++ b/test/parallel/test-stream-buffer-list.js @@ -48,3 +48,37 @@ const shifted = list.shift(); testIterator(list, 0); assert.strictEqual(shifted, buf); assert.deepStrictEqual(list, new BufferList()); + +{ + const list = new BufferList(); + list.push('foo'); + list.push('bar'); + list.push('foo'); + list.push('bar'); + assert.strictEqual(list.consume(6, true), 'foobar'); + assert.strictEqual(list.consume(6, true), 'foobar'); +} + +{ + const list = new BufferList(); + list.push('foo'); + list.push('bar'); + assert.strictEqual(list.consume(5, true), 'fooba'); +} + +{ + const list = new BufferList(); + list.push(buf); + list.push(buf); + list.push(buf); + list.push(buf); + assert.strictEqual(list.consume(6).toString(), 'foofoo'); + assert.strictEqual(list.consume(6).toString(), 'foofoo'); +} + +{ + const list = new BufferList(); + list.push(buf); + list.push(buf); + assert.strictEqual(list.consume(5).toString(), 'foofo'); +} 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-end.js b/test/parallel/test-string-decoder-end.js index ee0a47e3572f6d..5a3c5cc720789d 100644 --- a/test/parallel/test-string-decoder-end.js +++ b/test/parallel/test-string-decoder-end.js @@ -27,7 +27,7 @@ require('../common'); const assert = require('assert'); const SD = require('string_decoder').StringDecoder; -const encodings = ['base64', 'hex', 'utf8', 'utf16le', 'ucs2']; +const encodings = ['base64', 'base64url', 'hex', 'utf8', 'utf16le', 'ucs2']; const bufs = [ '☃💩', 'asdf' ].map((b) => Buffer.from(b)); @@ -79,6 +79,13 @@ testEnd('base64', Buffer.of(0x61, 0x61), Buffer.of(0x61), 'YWE=YQ=='); testEnd('base64', Buffer.of(0x61, 0x61, 0x61), Buffer.of(), 'YWFh'); testEnd('base64', Buffer.of(0x61, 0x61, 0x61), Buffer.of(0x61), 'YWFhYQ=='); +testEnd('base64url', Buffer.of(0x61), Buffer.of(), 'YQ'); +testEnd('base64url', Buffer.of(0x61), Buffer.of(0x61), 'YQYQ'); +testEnd('base64url', Buffer.of(0x61, 0x61), Buffer.of(), 'YWE'); +testEnd('base64url', Buffer.of(0x61, 0x61), Buffer.of(0x61), 'YWEYQ'); +testEnd('base64url', Buffer.of(0x61, 0x61, 0x61), Buffer.of(), 'YWFh'); +testEnd('base64url', Buffer.of(0x61, 0x61, 0x61), Buffer.of(0x61), 'YWFhYQ'); + function testEncoding(encoding) { bufs.forEach((buf) => { testBuf(encoding, buf); diff --git a/test/parallel/test-string-decoder-fuzz.js b/test/parallel/test-string-decoder-fuzz.js index d8d01881591161..ac6f74e94981a8 100644 --- a/test/parallel/test-string-decoder-fuzz.js +++ b/test/parallel/test-string-decoder-fuzz.js @@ -20,7 +20,7 @@ function randBuf(maxLen) { } const encodings = [ - 'utf16le', 'utf8', 'ascii', 'hex', 'base64', 'latin1' + 'utf16le', 'utf8', 'ascii', 'hex', 'base64', 'latin1', 'base64url' ]; function runSingleFuzzTest() { 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-tls-secure-context-usage-order.js b/test/parallel/test-tls-secure-context-usage-order.js new file mode 100644 index 00000000000000..c79a3eac775822 --- /dev/null +++ b/test/parallel/test-tls-secure-context-usage-order.js @@ -0,0 +1,99 @@ +'use strict'; +const common = require('../common'); +const fixtures = require('../common/fixtures'); + +if (!common.hasCrypto) + common.skip('missing crypto'); + +// This test ensures that when a TLS connection is established, the server +// selects the most recently added SecureContext that matches the servername. + +const assert = require('assert'); +const tls = require('tls'); + +function loadPEM(n) { + return fixtures.readKey(`${n}.pem`); +} + +const serverOptions = { + key: loadPEM('agent2-key'), + cert: loadPEM('agent2-cert'), + requestCert: true, + rejectUnauthorized: false, +}; + +const badSecureContext = { + key: loadPEM('agent1-key'), + cert: loadPEM('agent1-cert'), + ca: [ loadPEM('ca2-cert') ] +}; + +const goodSecureContext = { + key: loadPEM('agent1-key'), + cert: loadPEM('agent1-cert'), + ca: [ loadPEM('ca1-cert') ] +}; + +const server = tls.createServer(serverOptions, (c) => { + // The 'a' and 'b' subdomains are used to distinguish between client + // connections. + // Connection to subdomain 'a' is made when the 'bad' secure context is + // the only one in use. + if ('a.example.com' === c.servername) { + assert.strictEqual(c.authorized, false); + } + // Connection to subdomain 'b' is made after the 'good' context has been + // added. + if ('b.example.com' === c.servername) { + assert.strictEqual(c.authorized, true); + } +}); + +// 1. Add the 'bad' secure context. A connection using this context will not be +// authorized. +server.addContext('*.example.com', badSecureContext); + +server.listen(0, () => { + const options = { + port: server.address().port, + key: loadPEM('agent1-key'), + cert: loadPEM('agent1-cert'), + ca: [loadPEM('ca1-cert')], + servername: 'a.example.com', + rejectUnauthorized: false, + }; + + // 2. Make a connection using servername 'a.example.com'. Since a 'bad' + // secure context is used, this connection should not be authorized. + const client = tls.connect(options, () => { + client.end(); + }); + + client.on('close', common.mustCall(() => { + // 3. Add a 'good' secure context. + server.addContext('*.example.com', goodSecureContext); + + options.servername = 'b.example.com'; + // 4. Make a connection using servername 'b.example.com'. This connection + // should be authorized because the 'good' secure context is the most + // recently added matching context. + + const other = tls.connect(options, () => { + other.end(); + }); + + other.on('close', common.mustCall(() => { + // 5. Make another connection using servername 'b.example.com' to ensure + // that the array of secure contexts is not reversed in place with each + // SNICallback call, as someone might be tempted to refactor this piece of + // code by using Array.prototype.reverse() method. + const onemore = tls.connect(options, () => { + onemore.end(); + }); + + onemore.on('close', common.mustCall(() => { + server.close(); + })); + })); + })); +}); diff --git a/test/parallel/test-tls-ticket-cluster.js b/test/parallel/test-tls-ticket-cluster.js index cc4f46e1430aea..089660258cda41 100644 --- a/test/parallel/test-tls-ticket-cluster.js +++ b/test/parallel/test-tls-ticket-cluster.js @@ -32,7 +32,7 @@ const fixtures = require('../common/fixtures'); const workerCount = 4; const expectedReqCount = 16; -if (cluster.isMaster) { +if (cluster.isPrimary) { let reusedCount = 0; let reqCount = 0; let lastSession = null; @@ -40,7 +40,8 @@ if (cluster.isMaster) { let workerPort = null; function shoot() { - console.error('[master] connecting', workerPort, 'session?', !!lastSession); + console.error('[primary] connecting', + workerPort, 'session?', !!lastSession); const c = tls.connect(workerPort, { session: lastSession, rejectUnauthorized: false @@ -69,7 +70,7 @@ if (cluster.isMaster) { function fork() { const worker = cluster.fork(); worker.on('message', ({ msg, port }) => { - console.error('[master] got %j', msg); + console.error('[primary] got %j', msg); if (msg === 'reused') { ++reusedCount; } else if (msg === 'listening' && !shootOnce) { @@ -80,7 +81,7 @@ if (cluster.isMaster) { }); worker.on('exit', () => { - console.error('[master] worker died'); + console.error('[primary] worker died'); }); } for (let i = 0; i < workerCount; i++) { diff --git a/test/parallel/test-tls-use-after-free-regression.js b/test/parallel/test-tls-use-after-free-regression.js new file mode 100644 index 00000000000000..51835fc03390e5 --- /dev/null +++ b/test/parallel/test-tls-use-after-free-regression.js @@ -0,0 +1,58 @@ +'use strict'; + +const common = require('../common'); + +if (!common.hasCrypto) + common.skip('missing crypto'); + +const https = require('https'); +const tls = require('tls'); + +const kMessage = + 'GET / HTTP/1.1\r\nHost: localhost\r\nConnection: Keep-alive\r\n\r\n'; + +const key = `-----BEGIN EC PARAMETERS----- +BggqhkjOPQMBBw== +-----END EC PARAMETERS----- +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIDKfHHbiJMdu2STyHL11fWC7psMY19/gUNpsUpkwgGACoAoGCCqGSM49 +AwEHoUQDQgAEItqm+pYj3Ca8bi5mBs+H8xSMxuW2JNn4I+kw3aREsetLk8pn3o81 +PWBiTdSZrGBGQSy+UAlQvYeE6Z/QXQk8aw== +-----END EC PRIVATE KEY-----`; + +const cert = `-----BEGIN CERTIFICATE----- +MIIBhjCCASsCFDJU1tCo88NYU//pE+DQKO9hUDsFMAoGCCqGSM49BAMCMEUxCzAJ +BgNVBAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEwHwYDVQQKDBhJbnRlcm5l +dCBXaWRnaXRzIFB0eSBMdGQwHhcNMjAwOTIyMDg1NDU5WhcNNDgwMjA3MDg1NDU5 +WjBFMQswCQYDVQQGEwJBVTETMBEGA1UECAwKU29tZS1TdGF0ZTEhMB8GA1UECgwY +SW50ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcD +QgAEItqm+pYj3Ca8bi5mBs+H8xSMxuW2JNn4I+kw3aREsetLk8pn3o81PWBiTdSZ +rGBGQSy+UAlQvYeE6Z/QXQk8azAKBggqhkjOPQQDAgNJADBGAiEA7Bdn4F87KqIe +Y/ABy/XIXXpFUb2nyv3zV7POQi2lPcECIQC3UWLmfiedpiIKsf9YRIyO0uEood7+ +glj2R1NNr1X68w== +-----END CERTIFICATE-----`; + +const server = https.createServer( + { key, cert }, + common.mustCall((req, res) => { + res.writeHead(200); + res.end('boom goes the dynamite\n'); + }, 3)); + +server.listen(0, common.mustCall(() => { + const socket = + tls.connect( + server.address().port, + 'localhost', + { rejectUnauthorized: false }, + common.mustCall(() => { + socket.write(kMessage); + socket.write(kMessage); + socket.write(kMessage); + })); + + socket.on('data', common.mustCall(() => socket.destroy())); + socket.on('close', () => { + setImmediate(() => server.close()); + }); +})); diff --git a/test/parallel/test-url-format-whatwg.js b/test/parallel/test-url-format-whatwg.js index ab3d18bdc3aa25..9c86a7ae2c6910 100644 --- a/test/parallel/test-url-format-whatwg.js +++ b/test/parallel/test-url-format-whatwg.js @@ -6,7 +6,6 @@ if (!common.hasIntl) const assert = require('assert'); const url = require('url'); -const URL = url.URL; const myURL = new URL('http://xn--lck1c3crb1723bpq4a.com/a?a=b#c'); 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-url-urltooptions.js b/test/parallel/test-url-urltooptions.js new file mode 100644 index 00000000000000..cc4838eeecb00f --- /dev/null +++ b/test/parallel/test-url-urltooptions.js @@ -0,0 +1,37 @@ +'use strict'; +require('../common'); +const assert = require('assert'); +const { urlToHttpOptions } = require('url'); + +// Test urlToHttpOptions +const urlObj = new URL('http://user:pass@foo.bar.com:21/aaa/zzz?l=24#test'); +const opts = urlToHttpOptions(urlObj); +assert.strictEqual(opts instanceof URL, false); +assert.strictEqual(opts.protocol, 'http:'); +assert.strictEqual(opts.auth, 'user:pass'); +assert.strictEqual(opts.hostname, 'foo.bar.com'); +assert.strictEqual(opts.port, 21); +assert.strictEqual(opts.path, '/aaa/zzz?l=24'); +assert.strictEqual(opts.pathname, '/aaa/zzz'); +assert.strictEqual(opts.search, '?l=24'); +assert.strictEqual(opts.hash, '#test'); + +const { hostname } = urlToHttpOptions(new URL('http://[::1]:21')); +assert.strictEqual(hostname, '::1'); + +// If a WHATWG URL object is copied, it is possible that the resulting copy +// contains the Symbols that Node uses for brand checking, but not the data +// properties, which are getters. Verify that urlToHttpOptions() can handle +// such a case. +const copiedUrlObj = { ...urlObj }; +const copiedOpts = urlToHttpOptions(copiedUrlObj); +assert.strictEqual(copiedOpts instanceof URL, false); +assert.strictEqual(copiedOpts.protocol, undefined); +assert.strictEqual(copiedOpts.auth, undefined); +assert.strictEqual(copiedOpts.hostname, undefined); +assert.strictEqual(copiedOpts.port, NaN); +assert.strictEqual(copiedOpts.path, ''); +assert.strictEqual(copiedOpts.pathname, undefined); +assert.strictEqual(copiedOpts.search, undefined); +assert.strictEqual(copiedOpts.hash, undefined); +assert.strictEqual(copiedOpts.href, undefined); diff --git a/test/parallel/test-util-inspect.js b/test/parallel/test-util-inspect.js index ad8da0a7a47e9d..4e4ef3f30df952 100644 --- a/test/parallel/test-util-inspect.js +++ b/test/parallel/test-util-inspect.js @@ -3059,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-vm-module-errors.js b/test/parallel/test-vm-module-errors.js index 942e2f370dfff8..25b43c3e4df9d0 100644 --- a/test/parallel/test-vm-module-errors.js +++ b/test/parallel/test-vm-module-errors.js @@ -6,7 +6,7 @@ const common = require('../common'); const assert = require('assert'); -const { SourceTextModule, createContext } = require('vm'); +const { SourceTextModule, createContext, Module } = require('vm'); async function createEmptyLinkedModule() { const m = new SourceTextModule(''); @@ -205,6 +205,17 @@ async function checkInvalidOptionForEvaluate() { "Received type string ('a-string')", code: 'ERR_INVALID_ARG_TYPE' }); + + { + ['link', 'evaluate'].forEach(async (method) => { + await assert.rejects(async () => { + await Module.prototype[method](); + }, { + code: 'ERR_VM_MODULE_NOT_MODULE', + message: /Provided module is not an instance of Module/ + }); + }); + } } function checkInvalidCachedData() { @@ -223,6 +234,19 @@ function checkInvalidCachedData() { }); } +function checkGettersErrors() { + const getters = ['identifier', 'context', 'namespace', 'status', 'error']; + getters.forEach((getter) => { + assert.throws(() => { + // eslint-disable-next-line no-unused-expressions + Module.prototype[getter]; + }, { + code: 'ERR_VM_MODULE_NOT_MODULE', + message: /Provided module is not an instance of Module/ + }); + }); +} + const finished = common.mustCall(); (async function main() { @@ -232,5 +256,6 @@ const finished = common.mustCall(); await checkExecution(); await checkInvalidOptionForEvaluate(); checkInvalidCachedData(); + checkGettersErrors(); finished(); })().then(common.mustCall()); diff --git a/test/parallel/test-vm-module-link.js b/test/parallel/test-vm-module-link.js index 5b5eb6b08ffc31..39520bcf8e6891 100644 --- a/test/parallel/test-vm-module-link.js +++ b/test/parallel/test-vm-module-link.js @@ -5,7 +5,6 @@ const common = require('../common'); const assert = require('assert'); -const { URL } = require('url'); const { SourceTextModule } = require('vm'); diff --git a/test/parallel/test-vm-module-synthetic.js b/test/parallel/test-vm-module-synthetic.js index 660c0c64ed8d5d..9d1c07ead5c4cd 100644 --- a/test/parallel/test-vm-module-synthetic.js +++ b/test/parallel/test-vm-module-synthetic.js @@ -65,4 +65,14 @@ const assert = require('assert'); code: 'ERR_VM_MODULE_STATUS', }); } + + { + assert.throws(() => { + SyntheticModule.prototype.setExport.call({}, 'foo'); + }, { + code: 'ERR_VM_MODULE_NOT_MODULE', + message: /Provided module is not an instance of Module/ + }); + } + })().then(common.mustCall()); diff --git a/test/parallel/test-webcrypto-ed25519-ed448.js b/test/parallel/test-webcrypto-ed25519-ed448.js new file mode 100644 index 00000000000000..b06de24c78f682 --- /dev/null +++ b/test/parallel/test-webcrypto-ed25519-ed448.js @@ -0,0 +1,367 @@ +'use strict'; + +const common = require('../common'); + +if (!common.hasCrypto) + common.skip('missing crypto'); + +const assert = require('assert'); +const { subtle } = require('crypto').webcrypto; + +async function generateKey(namedCurve) { + return subtle.generateKey( + { + name: namedCurve, + namedCurve + }, + true, + ['sign', 'verify']); +} + +async function test1(namedCurve) { + const { + publicKey, + privateKey, + } = await generateKey(namedCurve); + + const data = Buffer.from('hello world'); + + assert(publicKey); + assert(privateKey); + + const sig = await subtle.sign( + { name: namedCurve }, + privateKey, + data + ); + + assert(sig); + + assert(await subtle.verify( + { name: namedCurve }, + publicKey, + sig, + data + )); +} + +Promise.all([ + test1('NODE-ED25519'), + test1('NODE-ED448') +]).then(common.mustCall()); + +assert.rejects( + subtle.importKey( + 'raw', + Buffer.alloc(10), + { + name: 'NODE-ED25519', + namedCurve: 'NODE-ED25519' + }, + false, + ['sign']), + { + message: /NODE-ED25519 raw keys must be exactly 32-bytes/ + }); + +assert.rejects( + subtle.importKey( + 'raw', + Buffer.alloc(10), + { + name: 'NODE-ED448', + namedCurve: 'NODE-ED448' + }, + false, + ['sign']), + { + message: /NODE-ED448 raw keys must be exactly 57-bytes/ + }); + +const testVectors = { + 'NODE-ED25519': [ + { + privateKey: + Buffer.from( + '9d61b19deffd5a60ba844af492ec2cc44449c5697b326919703bac031cae7f60', + 'hex'), + publicKey: + Buffer.from( + 'd75a980182b10ab7d54bfed3c964073a0ee172f3daa62325af021a68f707511a', + 'hex'), + message: Buffer.alloc(0), + sig: + Buffer.from( + 'e5564300c360ac729086e2cc806e828a84877f1eb8e5d974d873e06522490155' + + '5fb8821590a33bacc61e39701cf9b46bd25bf5f0595bbe24655141438e7a100b', + 'hex'), + crv: 'Ed25519', + }, + { + privateKey: + Buffer.from( + '4ccd089b28ff96da9db6c346ec114e0f5b8a319f35aba624da8cf6ed4fb8a6fb', + 'hex'), + publicKey: + Buffer.from( + '3d4017c3e843895a92b70aa74d1b7ebc9c982ccf2ec4968cc0cd55f12af4660c', + 'hex'), + message: Buffer.from('72', 'hex'), + sig: + Buffer.from( + '92a009a9f0d4cab8720e820b5f642540a2b27b5416503f8fb3762223ebdb69da' + + '085ac1e43e15996e458f3613d0f11d8c387b2eaeb4302aeeb00d291612bb0c00', + 'hex'), + crv: 'Ed25519', + }, + { + privateKey: + Buffer.from( + 'c5aa8df43f9f837bedb7442f31dcb7b166d38535076f094b85ce3a2e0b4458f7', + 'hex'), + publicKey: + Buffer.from( + 'fc51cd8e6218a1a38da47ed00230f0580816ed13ba3303ac5deb911548908025', + 'hex'), + message: Buffer.from('af82', 'hex'), + sig: + Buffer.from( + '6291d657deec24024827e69c3abe01a30ce548a284743a445e3680d7db5ac3ac' + + '18ff9b538d16f290ae67f760984dc6594a7c15e9716ed28dc027beceea1ec40a', + 'hex'), + crv: 'Ed25519', + }, + { + privateKey: + Buffer.from( + 'f5e5767cf153319517630f226876b86c8160cc583bc013744c6bf255f5cc0ee5', + 'hex'), + publicKey: + Buffer.from( + '278117fc144c72340f67d0f2316e8386ceffbf2b2428c9c51fef7c597f1d426e', + 'hex'), + message: Buffer.from( + '08b8b2b733424243760fe426a4b54908632110a66c2f6591eabd3345e3e4eb98' + + 'fa6e264bf09efe12ee50f8f54e9f77b1e355f6c50544e23fb1433ddf73be84d8' + + '79de7c0046dc4996d9e773f4bc9efe5738829adb26c81b37c93a1b270b20329d' + + '658675fc6ea534e0810a4432826bf58c941efb65d57a338bbd2e26640f89ffbc' + + '1a858efcb8550ee3a5e1998bd177e93a7363c344fe6b199ee5d02e82d522c4fe' + + 'ba15452f80288a821a579116ec6dad2b3b310da903401aa62100ab5d1a36553e' + + '06203b33890cc9b832f79ef80560ccb9a39ce767967ed628c6ad573cb116dbef' + + 'efd75499da96bd68a8a97b928a8bbc103b6621fcde2beca1231d206be6cd9ec7' + + 'aff6f6c94fcd7204ed3455c68c83f4a41da4af2b74ef5c53f1d8ac70bdcb7ed1' + + '85ce81bd84359d44254d95629e9855a94a7c1958d1f8ada5d0532ed8a5aa3fb2' + + 'd17ba70eb6248e594e1a2297acbbb39d502f1a8c6eb6f1ce22b3de1a1f40cc24' + + '554119a831a9aad6079cad88425de6bde1a9187ebb6092cf67bf2b13fd65f270' + + '88d78b7e883c8759d2c4f5c65adb7553878ad575f9fad878e80a0c9ba63bcbcc' + + '2732e69485bbc9c90bfbd62481d9089beccf80cfe2df16a2cf65bd92dd597b07' + + '07e0917af48bbb75fed413d238f5555a7a569d80c3414a8d0859dc65a46128ba' + + 'b27af87a71314f318c782b23ebfe808b82b0ce26401d2e22f04d83d1255dc51a' + + 'ddd3b75a2b1ae0784504df543af8969be3ea7082ff7fc9888c144da2af58429e' + + 'c96031dbcad3dad9af0dcbaaaf268cb8fcffead94f3c7ca495e056a9b47acdb7' + + '51fb73e666c6c655ade8297297d07ad1ba5e43f1bca32301651339e22904cc8c' + + '42f58c30c04aafdb038dda0847dd988dcda6f3bfd15c4b4c4525004aa06eeff8' + + 'ca61783aacec57fb3d1f92b0fe2fd1a85f6724517b65e614ad6808d6f6ee34df' + + 'f7310fdc82aebfd904b01e1dc54b2927094b2db68d6f903b68401adebf5a7e08' + + 'd78ff4ef5d63653a65040cf9bfd4aca7984a74d37145986780fc0b16ac451649' + + 'de6188a7dbdf191f64b5fc5e2ab47b57f7f7276cd419c17a3ca8e1b939ae49e4' + + '88acba6b965610b5480109c8b17b80e1b7b750dfc7598d5d5011fd2dcc5600a3' + + '2ef5b52a1ecc820e308aa342721aac0943bf6686b64b2579376504ccc493d97e' + + '6aed3fb0f9cd71a43dd497f01f17c0e2cb3797aa2a2f256656168e6c496afc5f' + + 'b93246f6b1116398a346f1a641f3b041e989f7914f90cc2c7fff357876e506b5' + + '0d334ba77c225bc307ba537152f3f1610e4eafe595f6d9d90d11faa933a15ef1' + + '369546868a7f3a45a96768d40fd9d03412c091c6315cf4fde7cb68606937380d' + + 'b2eaaa707b4c4185c32eddcdd306705e4dc1ffc872eeee475a64dfac86aba41c' + + '0618983f8741c5ef68d3a101e8a3b8cac60c905c15fc910840b94c00a0b9d0', + 'hex'), + sig: Buffer.from( + '0aab4c900501b3e24d7cdf4663326a3a87df5e4843b2cbdb67cbf6e460fec350' + + 'aa5371b1508f9f4528ecea23c436d94b5e8fcd4f681e30a6ac00a9704a188a03', + 'hex'), + crv: 'Ed25519', + } + ], + 'NODE-ED448': [ + { + privateKey: + Buffer.from( + '6c82a562cb808d10d632be89c8513ebf6c929f34ddfa8c9f63c9960ef6e348a3' + + '528c8a3fcc2f044e39a3fc5b94492f8f032e7549a20098f95b', 'hex'), + publicKey: + Buffer.from( + '5fd7449b59b461fd2ce787ec616ad46a1da1342485a70e1f8a0ea75d80e96778' + + 'edf124769b46c7061bd6783df1e50f6cd1fa1abeafe8256180', 'hex'), + message: Buffer.alloc(0), + sig: + Buffer.from( + '533a37f6bbe457251f023c0d88f976ae2dfb504a843e34d2074fd823d41a591f' + + '2b233f034f628281f2fd7a22ddd47d7828c59bd0a21bfd3980ff0d2028d4b18a' + + '9df63e006c5d1c2d345b925d8dc00b4104852db99ac5c7cdda8530a113a0f4db' + + 'b61149f05a7363268c71d95808ff2e652600', 'hex'), + crv: 'Ed448', + }, + { + privateKey: + Buffer.from( + 'c4eab05d357007c632f3dbb48489924d552b08fe0c353a0d4a1f00acda2c463a' + + 'fbea67c5e8d2877c5e3bc397a659949ef8021e954e0a12274e', 'hex'), + publicKey: + Buffer.from( + '43ba28f430cdff456ae531545f7ecd0ac834a55d9358c0372bfa0c6c6798c086' + + '6aea01eb00742802b8438ea4cb82169c235160627b4c3a9480', 'hex'), + message: Buffer.from('03', 'hex'), + sig: + Buffer.from( + '26b8f91727bd62897af15e41eb43c377efb9c610d48f2335cb0bd0087810f435' + + '2541b143c4b981b7e18f62de8ccdf633fc1bf037ab7cd779805e0dbcc0aae1cb' + + 'cee1afb2e027df36bc04dcecbf154336c19f0af7e0a6472905e799f1953d2a0f' + + 'f3348ab21aa4adafd1d234441cf807c03a00', 'hex'), + crv: 'Ed448', + }, + { + privateKey: + Buffer.from( + 'cd23d24f714274e744343237b93290f511f6425f98e64459ff203e8985083ffd' + + 'f60500553abc0e05cd02184bdb89c4ccd67e187951267eb328', 'hex'), + publicKey: + Buffer.from( + 'dcea9e78f35a1bf3499a831b10b86c90aac01cd84b67a0109b55a36e9328b1e3' + + '65fce161d71ce7131a543ea4cb5f7e9f1d8b00696447001400', 'hex'), + message: Buffer.from('0c3e544074ec63b0265e0c', 'hex'), + sig: + Buffer.from( + '1f0a8888ce25e8d458a21130879b840a9089d999aaba039eaf3e3afa090a09d3' + + '89dba82c4ff2ae8ac5cdfb7c55e94d5d961a29fe0109941e00b8dbdeea6d3b05' + + '1068df7254c0cdc129cbe62db2dc957dbb47b51fd3f213fb8698f064774250a5' + + '028961c9bf8ffd973fe5d5c206492b140e00', 'hex'), + crv: 'Ed448', + } + ] +}; + +async function test2(namedCurve) { + const vectors = testVectors[namedCurve]; + await Promise.all(vectors.map(async (vector) => { + const [ + privateKey, + publicKey, + ] = await Promise.all([ + subtle.importKey( + 'raw', + vector.privateKey, + { + name: namedCurve, + namedCurve + }, + true, ['sign']), + subtle.importKey( + 'raw', + vector.publicKey, + { + name: namedCurve, + namedCurve, + public: true + }, + true, ['verify']) + ]); + + const [ + rawKey1, + rawKey2 + ] = await Promise.all([ + subtle.exportKey('raw', privateKey), + subtle.exportKey('raw', publicKey) + ]); + assert.deepStrictEqual(Buffer.from(rawKey1), vector.privateKey); + assert.deepStrictEqual(Buffer.from(rawKey2), vector.publicKey); + + const sig = await subtle.sign( + { name: namedCurve }, + privateKey, + vector.message + ); + + assert(sig); + + assert(await subtle.verify( + { name: namedCurve }, + publicKey, + vector.sig, + vector.message + )); + + const [ + publicKeyJwk, + privateKeyJwk + ] = await Promise.all([ + subtle.exportKey('jwk', publicKey), + subtle.exportKey('jwk', privateKey) + ]); + assert.strictEqual(publicKeyJwk.kty, 'OKP'); + assert.strictEqual(privateKeyJwk.kty, 'OKP'); + assert.strictEqual(publicKeyJwk.crv, vector.crv); + assert.strictEqual(privateKeyJwk.crv, vector.crv); + assert.deepStrictEqual( + Buffer.from(publicKeyJwk.x, 'base64'), + vector.publicKey); + assert.deepStrictEqual( + Buffer.from(privateKeyJwk.x, 'base64'), + vector.publicKey); + assert.deepStrictEqual( + Buffer.from(privateKeyJwk.d, 'base64'), + vector.privateKey); + })); +} + +Promise.all([ + test2('NODE-ED25519'), + test2('NODE-ED448') +]).then(common.mustCall()); + +assert.rejects( + subtle.generateKey( + { + name: 'ECDSA', + namedCurve: 'NODE-X25519' + }, + true, + ['sign', 'verify']), + { + message: /Unsupported named curves for ECDSA/ + }); + +assert.rejects( + subtle.generateKey( + { + name: 'ECDSA', + namedCurve: 'NODE-X448' + }, + true, + ['sign', 'verify']), + { + message: /Unsupported named curves for ECDSA/ + }); + +assert.rejects( + subtle.generateKey( + { + name: 'ECDSA', + namedCurve: 'NODE-ED25519' + }, + true, + ['sign', 'verify']), + { + message: /Unsupported named curves for ECDSA/ + }); + +assert.rejects( + subtle.generateKey( + { + name: 'ECDSA', + namedCurve: 'NODE-ED448' + }, + true, + ['sign', 'verify']), + { + message: /Unsupported named curves for ECDSA/ + }); diff --git a/test/parallel/test-webcrypto-rsa-pss-params.js b/test/parallel/test-webcrypto-rsa-pss-params.js new file mode 100644 index 00000000000000..964eaf32e890fd --- /dev/null +++ b/test/parallel/test-webcrypto-rsa-pss-params.js @@ -0,0 +1,40 @@ +'use strict'; + +const common = require('../common'); + +if (!common.hasCrypto) + common.skip('missing crypto'); + +const { + createPrivateKey, + createPublicKey, + webcrypto: { + subtle + } +} = require('crypto'); + +const fixtures = require('../common/fixtures'); + +{ + const rsaPssKeyWithoutParams = fixtures.readKey('rsa_pss_private_2048.pem'); + + const pkcs8 = createPrivateKey(rsaPssKeyWithoutParams).export({ + type: 'pkcs8', + format: 'der' + }); + const spki = createPublicKey(rsaPssKeyWithoutParams).export({ + type: 'spki', + format: 'der' + }); + + const hashes = ['SHA-1', 'SHA-256', 'SHA-384', 'SHA-512']; + + const tasks = []; + for (const hash of hashes) { + const algorithm = { name: 'RSA-PSS', hash }; + tasks.push(subtle.importKey('pkcs8', pkcs8, algorithm, true, ['sign'])); + tasks.push(subtle.importKey('spki', spki, algorithm, true, ['verify'])); + } + + Promise.all(tasks).then(common.mustCall()); +} diff --git a/test/parallel/test-webcrypto-sign-verify-rsa.js b/test/parallel/test-webcrypto-sign-verify-rsa.js index 35bd363c5558a6..46ee119f781586 100644 --- a/test/parallel/test-webcrypto-sign-verify-rsa.js +++ b/test/parallel/test-webcrypto-sign-verify-rsa.js @@ -23,7 +23,7 @@ async function testVerify({ noVerifyPublicKey, privateKey, hmacKey, - rsaKeys + ecdsaKeys ] = await Promise.all([ subtle.importKey( 'spki', @@ -85,7 +85,7 @@ async function testVerify({ }); await assert.rejects( - subtle.verify(algorithm, rsaKeys.publicKey, signature, plaintext), { + subtle.verify(algorithm, ecdsaKeys.publicKey, signature, plaintext), { message: /Unable to use this key to verify/ }); @@ -138,7 +138,7 @@ async function testSign({ noSignPrivateKey, privateKey, hmacKey, - rsaKeys, + ecdsaKeys ] = await Promise.all([ subtle.importKey( 'spki', @@ -205,7 +205,7 @@ async function testSign({ }); await assert.rejects( - subtle.sign(algorithm, rsaKeys.privateKey, plaintext), { + subtle.sign(algorithm, ecdsaKeys.privateKey, plaintext), { message: /Unable to use this key to sign/ }); } diff --git a/test/parallel/test-webcrypto-wrap-unwrap.js b/test/parallel/test-webcrypto-wrap-unwrap.js index cadeeca8ec3ee5..42784c4a660812 100644 --- a/test/parallel/test-webcrypto-wrap-unwrap.js +++ b/test/parallel/test-webcrypto-wrap-unwrap.js @@ -243,7 +243,7 @@ async function testWrap(wrappingKey, unwrappingKey, key, wrap, format) { assert.deepStrictEqual(exported, exportedAgain); } -async function testWrapping(name, keys, ecdhPeerKey) { +async function testWrapping(name, keys) { const variations = []; const { @@ -264,13 +264,9 @@ async function testWrapping(name, keys, ecdhPeerKey) { (async function() { await generateWrappingKeys(); const keys = await generateKeysToWrap(); - const ecdhPeerKey = await subtle.generateKey({ - name: 'ECDH', - namedCurve: 'P-384' - }, true, ['deriveBits']); const variations = []; Object.keys(kWrappingData).forEach((name) => { - return testWrapping(name, keys, ecdhPeerKey); + return testWrapping(name, keys); }); await Promise.all(variations); })().then(common.mustCall()); diff --git a/test/parallel/test-webcrypto-x25519-x448.js b/test/parallel/test-webcrypto-x25519-x448.js new file mode 100644 index 00000000000000..947948406306c6 --- /dev/null +++ b/test/parallel/test-webcrypto-x25519-x448.js @@ -0,0 +1,246 @@ +'use strict'; + +const common = require('../common'); + +if (!common.hasCrypto) + common.skip('missing crypto'); + +const assert = require('assert'); +const { subtle } = require('crypto').webcrypto; + +// X25519 and X448 are ECDH named curves that should work +// with the existing ECDH mechanisms with no additional +// changes. + +async function generateKeys(namedCurve, ...usages) { + return subtle.generateKey( + { + name: 'ECDH', + namedCurve + }, + true, + usages); +} + +async function deriveKey(publicKey, privateKey, length = 256) { + return subtle.deriveKey( + { + name: 'ECDH', + public: publicKey, + }, + privateKey, + { + name: 'HMAC', + length, + hash: 'SHA-512', + }, + true, + ['sign', 'verify'] + ); +} + +async function exportKey(secretKey) { + return subtle.exportKey('raw', secretKey); +} + +async function importKey(namedCurve, keyData, isPublic = false) { + return subtle.importKey( + 'raw', + keyData, + { name: 'ECDH', namedCurve, public: isPublic }, + true, + ['deriveKey'] + ); +} + +assert.rejects(importKey('NODE-X25519', Buffer.alloc(10), true), { + message: /NODE-X25519 raw keys must be exactly 32-bytes/ +}); +assert.rejects(importKey('NODE-X448', Buffer.alloc(10), true), { + message: /NODE-X448 raw keys must be exactly 56-bytes/ +}); + +async function test1(namedCurve) { + const { + publicKey: publicKey1, + privateKey: privateKey1, + } = await generateKeys(namedCurve, 'deriveKey', 'deriveBits'); + + const { + publicKey: publicKey2, + privateKey: privateKey2, + } = await generateKeys(namedCurve, 'deriveKey', 'deriveBits'); + + assert(publicKey1); + assert(privateKey1); + assert(publicKey2); + assert(privateKey2); + + assert.strictEqual(publicKey1.algorithm.namedCurve, namedCurve); + assert.strictEqual(privateKey1.algorithm.namedCurve, namedCurve); + assert.strictEqual(publicKey2.algorithm.namedCurve, namedCurve); + assert.strictEqual(privateKey2.algorithm.namedCurve, namedCurve); + + const [key1, key2] = await Promise.all([ + deriveKey(publicKey1, privateKey2), + deriveKey(publicKey2, privateKey1), + ]); + + assert(key1); + assert(key2); + + const [secret1, secret2] = await Promise.all([ + exportKey(key1), + exportKey(key2), + ]); + + assert.deepStrictEqual(secret1, secret2); +} + +Promise.all([ + test1('NODE-X25519'), + test1('NODE-X448'), +]).then(common.mustCall()); + +const testVectors = { + 'NODE-X25519': { + alice: { + privateKey: + Buffer.from( + '77076d0a7318a57d3c16c17251b26645df4c2f87ebc0992ab177fba51db92c2a', + 'hex'), + publicKey: + Buffer.from( + '8520f0098930a754748b7ddcb43ef75a0dbf3a0d26381af4eba4a98eaa9b4e6a', + 'hex'), + }, + bob: { + privateKey: + Buffer.from( + '5dab087e624a8a4b79e17f8b83800ee66f3bb1292618b6fd1c2f8b27ff88e0eb', + 'hex'), + publicKey: + Buffer.from( + 'de9edb7d7b7dc1b4d35b61c2ece435373f8343c85b78674dadfc7e146f882b4f', + 'hex'), + }, + sharedSecret: + Buffer.from( + '4a5d9d5ba4ce2de1728e3bf480350f25e07e21c947d19e3376f09b3c1e161742', + 'hex'), + }, + 'NODE-X448': { + alice: { + privateKey: + Buffer.from( + '9a8f4925d1519f5775cf46b04b5800d4ee9ee8bae8bc5565d498c28d' + + 'd9c9baf574a9419744897391006382a6f127ab1d9ac2d8c0a598726b', + 'hex'), + publicKey: + Buffer.from( + '9b08f7cc31b7e3e67d22d5aea121074a273bd2b83de09c63faa73d2c' + + '22c5d9bbc836647241d953d40c5b12da88120d53177f80e532c41fa0', + 'hex'), + }, + bob: { + privateKey: + Buffer.from( + '1c306a7ac2a0e2e0990b294470cba339e6453772b075811d8fad0d1d' + + '6927c120bb5ee8972b0d3e21374c9c921b09d1b0366f10b65173992d', + 'hex'), + publicKey: + Buffer.from( + '3eb7a829b0cd20f5bcfc0b599b6feccf6da4627107bdb0d4f345b430' + + '27d8b972fc3e34fb4232a13ca706dcb57aec3dae07bdc1c67bf33609', + 'hex'), + }, + sharedSecret: + Buffer.from( + '07fff4181ac6cc95ec1c16a94a0f74d12da232ce40a77552281d282b' + + 'b60c0b56fd2464c335543936521c24403085d59a449a5037514a879d', + 'hex'), + }, +}; + +async function test2(namedCurve, length) { + const [ + publicKey1, + publicKey2, + privateKey1, + privateKey2, + ] = await Promise.all([ + importKey(namedCurve, testVectors[namedCurve].alice.publicKey, true), + importKey(namedCurve, testVectors[namedCurve].bob.publicKey, true), + importKey(namedCurve, testVectors[namedCurve].alice.privateKey), + importKey(namedCurve, testVectors[namedCurve].bob.privateKey), + ]); + + const [key1, key2] = await Promise.all([ + deriveKey(publicKey1, privateKey2, length), + deriveKey(publicKey2, privateKey1, length), + ]); + + assert(key1); + assert(key2); + + const [secret1, secret2] = await Promise.all([ + exportKey(key1), + exportKey(key2), + ]); + + assert.deepStrictEqual(secret1, secret2); + + assert.deepStrictEqual( + Buffer.from(secret1), + testVectors[namedCurve].sharedSecret); + + const [ + publicKeyJwk, + privateKeyJwk + ] = await Promise.all([ + subtle.exportKey('jwk', publicKey1), + subtle.exportKey('jwk', privateKey1) + ]); + assert.strictEqual(publicKeyJwk.kty, 'OKP'); + assert.strictEqual(privateKeyJwk.kty, 'OKP'); + assert.strictEqual(publicKeyJwk.crv, namedCurve.slice(5)); + assert.strictEqual(privateKeyJwk.crv, namedCurve.slice(5)); + assert.deepStrictEqual( + Buffer.from(publicKeyJwk.x, 'base64'), + testVectors[namedCurve].alice.publicKey); + assert.deepStrictEqual( + Buffer.from(privateKeyJwk.x, 'base64'), + testVectors[namedCurve].alice.publicKey); + assert.deepStrictEqual( + Buffer.from(privateKeyJwk.d, 'base64'), + testVectors[namedCurve].alice.privateKey); +} + +Promise.all([ + test2('NODE-X25519', 256), + test2('NODE-X448', 448), +]).then(common.mustCall()); + +assert.rejects( + subtle.generateKey( + { + name: 'ECDH', + namedCurve: 'NODE-ED25519' + }, + true, + ['deriveBits']), + { + message: /Unsupported named curves for ECDH/ + }); + +assert.rejects( + subtle.generateKey( + { + name: 'ECDH', + namedCurve: 'NODE-ED448' + }, + true, + ['deriveBits']), + { + message: /Unsupported named curves for ECDH/ + }); diff --git a/test/parallel/test-whatwg-url-constructor.js b/test/parallel/test-whatwg-url-constructor.js index d5b12a6021b772..3dc1c5986027e7 100644 --- a/test/parallel/test-whatwg-url-constructor.js +++ b/test/parallel/test-whatwg-url-constructor.js @@ -6,7 +6,6 @@ if (!common.hasIntl) { } const fixtures = require('../common/fixtures'); -const { URL, URLSearchParams } = require('url'); const { test, assert_equals, assert_true, assert_throws } = require('../common/wpt').harness; diff --git a/test/parallel/test-whatwg-url-custom-global.js b/test/parallel/test-whatwg-url-custom-global.js index c79723f0490e07..b99dfd8f3e7d94 100644 --- a/test/parallel/test-whatwg-url-custom-global.js +++ b/test/parallel/test-whatwg-url-custom-global.js @@ -4,7 +4,6 @@ require('../common'); const assert = require('assert'); -const { URL, URLSearchParams } = require('url'); assert.deepStrictEqual( Object.getOwnPropertyDescriptor(global, 'URL'), diff --git a/test/parallel/test-whatwg-url-custom-inspect.js b/test/parallel/test-whatwg-url-custom-inspect.js index 318b8b66d5672a..ad77f5725d30ed 100644 --- a/test/parallel/test-whatwg-url-custom-inspect.js +++ b/test/parallel/test-whatwg-url-custom-inspect.js @@ -9,7 +9,6 @@ if (!common.hasIntl) { } const util = require('util'); -const URL = require('url').URL; const assert = require('assert'); const url = new URL('https://username:password@host.name:8080/path/name/?que=ry#hash'); diff --git a/test/parallel/test-whatwg-url-custom-parsing.js b/test/parallel/test-whatwg-url-custom-parsing.js index 2799a9caef3efe..6d9a9a816eff83 100644 --- a/test/parallel/test-whatwg-url-custom-parsing.js +++ b/test/parallel/test-whatwg-url-custom-parsing.js @@ -8,7 +8,6 @@ if (!common.hasIntl) { common.skip('missing Intl'); } -const URL = require('url').URL; const assert = require('assert'); const fixtures = require('../common/fixtures'); diff --git a/test/parallel/test-whatwg-url-custom-properties.js b/test/parallel/test-whatwg-url-custom-properties.js index 3a9ae43f1a4d74..cdbd2f6bdd4424 100644 --- a/test/parallel/test-whatwg-url-custom-properties.js +++ b/test/parallel/test-whatwg-url-custom-properties.js @@ -4,9 +4,7 @@ // Tests below are not from WPT. require('../common'); -const URL = require('url').URL; const assert = require('assert'); -const urlToOptions = require('internal/url').urlToOptions; const url = new URL('http://user:pass@foo.bar.com:21/aaa/zzz?l=24#test'); const oldParams = url.searchParams; // For test of [SameObject] @@ -131,41 +129,6 @@ assert.strictEqual(url.toString(), assert.strictEqual((delete url.searchParams), true); assert.strictEqual(url.searchParams, oldParams); -// Test urlToOptions -{ - const urlObj = new URL('http://user:pass@foo.bar.com:21/aaa/zzz?l=24#test'); - const opts = urlToOptions(urlObj); - assert.strictEqual(opts instanceof URL, false); - assert.strictEqual(opts.protocol, 'http:'); - assert.strictEqual(opts.auth, 'user:pass'); - assert.strictEqual(opts.hostname, 'foo.bar.com'); - assert.strictEqual(opts.port, 21); - assert.strictEqual(opts.path, '/aaa/zzz?l=24'); - assert.strictEqual(opts.pathname, '/aaa/zzz'); - assert.strictEqual(opts.search, '?l=24'); - assert.strictEqual(opts.hash, '#test'); - - const { hostname } = urlToOptions(new URL('http://[::1]:21')); - assert.strictEqual(hostname, '::1'); - - // If a WHATWG URL object is copied, it is possible that the resulting copy - // contains the Symbols that Node uses for brand checking, but not the data - // properties, which are getters. Verify that urlToOptions() can handle such - // a case. - const copiedUrlObj = { ...urlObj }; - const copiedOpts = urlToOptions(copiedUrlObj); - assert.strictEqual(copiedOpts instanceof URL, false); - assert.strictEqual(copiedOpts.protocol, undefined); - assert.strictEqual(copiedOpts.auth, undefined); - assert.strictEqual(copiedOpts.hostname, undefined); - assert.strictEqual(copiedOpts.port, NaN); - assert.strictEqual(copiedOpts.path, ''); - assert.strictEqual(copiedOpts.pathname, undefined); - assert.strictEqual(copiedOpts.search, undefined); - assert.strictEqual(copiedOpts.hash, undefined); - assert.strictEqual(copiedOpts.href, undefined); -} - // Test special origins [ { expected: 'https://whatwg.org', diff --git a/test/parallel/test-whatwg-url-custom-searchparams-append.js b/test/parallel/test-whatwg-url-custom-searchparams-append.js index cf93950ebd514c..5d2976a23cad53 100644 --- a/test/parallel/test-whatwg-url-custom-searchparams-append.js +++ b/test/parallel/test-whatwg-url-custom-searchparams-append.js @@ -4,7 +4,6 @@ require('../common'); const assert = require('assert'); -const URLSearchParams = require('url').URLSearchParams; { const params = new URLSearchParams(); diff --git a/test/parallel/test-whatwg-url-custom-searchparams-constructor.js b/test/parallel/test-whatwg-url-custom-searchparams-constructor.js index ab065814179d3f..878caed43ff0ab 100644 --- a/test/parallel/test-whatwg-url-custom-searchparams-constructor.js +++ b/test/parallel/test-whatwg-url-custom-searchparams-constructor.js @@ -4,7 +4,6 @@ require('../common'); const assert = require('assert'); -const URLSearchParams = require('url').URLSearchParams; function makeIterableFunc(array) { return Object.assign(() => {}, { diff --git a/test/parallel/test-whatwg-url-custom-searchparams-delete.js b/test/parallel/test-whatwg-url-custom-searchparams-delete.js index 5c3088b0363ff1..e84f10e3f93df8 100644 --- a/test/parallel/test-whatwg-url-custom-searchparams-delete.js +++ b/test/parallel/test-whatwg-url-custom-searchparams-delete.js @@ -4,7 +4,6 @@ require('../common'); const assert = require('assert'); -const { URL, URLSearchParams } = require('url'); { const params = new URLSearchParams(); diff --git a/test/parallel/test-whatwg-url-custom-searchparams-entries.js b/test/parallel/test-whatwg-url-custom-searchparams-entries.js index b70717ff2b78c1..6e5dabb1a768c4 100644 --- a/test/parallel/test-whatwg-url-custom-searchparams-entries.js +++ b/test/parallel/test-whatwg-url-custom-searchparams-entries.js @@ -2,7 +2,6 @@ require('../common'); const assert = require('assert'); -const URLSearchParams = require('url').URLSearchParams; // Tests below are not from WPT. const params = new URLSearchParams('a=b&c=d'); diff --git a/test/parallel/test-whatwg-url-custom-searchparams-foreach.js b/test/parallel/test-whatwg-url-custom-searchparams-foreach.js index b796cff9bc1b5c..0c035161dbea97 100644 --- a/test/parallel/test-whatwg-url-custom-searchparams-foreach.js +++ b/test/parallel/test-whatwg-url-custom-searchparams-foreach.js @@ -4,7 +4,6 @@ require('../common'); const assert = require('assert'); -const { URLSearchParams } = require('url'); { const params = new URLSearchParams(); diff --git a/test/parallel/test-whatwg-url-custom-searchparams-get.js b/test/parallel/test-whatwg-url-custom-searchparams-get.js index 1088fcc43d439a..4ce16805ceceb9 100644 --- a/test/parallel/test-whatwg-url-custom-searchparams-get.js +++ b/test/parallel/test-whatwg-url-custom-searchparams-get.js @@ -4,7 +4,6 @@ require('../common'); const assert = require('assert'); -const URLSearchParams = require('url').URLSearchParams; { const params = new URLSearchParams(); diff --git a/test/parallel/test-whatwg-url-custom-searchparams-getall.js b/test/parallel/test-whatwg-url-custom-searchparams-getall.js index 8d229a25979d6c..d3f271fcc5dc7b 100644 --- a/test/parallel/test-whatwg-url-custom-searchparams-getall.js +++ b/test/parallel/test-whatwg-url-custom-searchparams-getall.js @@ -4,7 +4,6 @@ require('../common'); const assert = require('assert'); -const URLSearchParams = require('url').URLSearchParams; { const params = new URLSearchParams(); diff --git a/test/parallel/test-whatwg-url-custom-searchparams-has.js b/test/parallel/test-whatwg-url-custom-searchparams-has.js index 4a76dda6d3dc48..1963e40057ef72 100644 --- a/test/parallel/test-whatwg-url-custom-searchparams-has.js +++ b/test/parallel/test-whatwg-url-custom-searchparams-has.js @@ -4,7 +4,6 @@ require('../common'); const assert = require('assert'); -const URLSearchParams = require('url').URLSearchParams; { const params = new URLSearchParams(); diff --git a/test/parallel/test-whatwg-url-custom-searchparams-inspect.js b/test/parallel/test-whatwg-url-custom-searchparams-inspect.js index 6cc22caea62436..c03890938d9cfe 100644 --- a/test/parallel/test-whatwg-url-custom-searchparams-inspect.js +++ b/test/parallel/test-whatwg-url-custom-searchparams-inspect.js @@ -5,7 +5,6 @@ require('../common'); const assert = require('assert'); const util = require('util'); -const URLSearchParams = require('url').URLSearchParams; const sp = new URLSearchParams('?a=a&b=b&b=c'); assert.strictEqual(util.inspect(sp), diff --git a/test/parallel/test-whatwg-url-custom-searchparams-keys.js b/test/parallel/test-whatwg-url-custom-searchparams-keys.js index 5a222c7428eac7..b65e71c9a24153 100644 --- a/test/parallel/test-whatwg-url-custom-searchparams-keys.js +++ b/test/parallel/test-whatwg-url-custom-searchparams-keys.js @@ -4,7 +4,6 @@ require('../common'); const assert = require('assert'); -const URLSearchParams = require('url').URLSearchParams; const params = new URLSearchParams('a=b&c=d'); const keys = params.keys(); diff --git a/test/parallel/test-whatwg-url-custom-searchparams-set.js b/test/parallel/test-whatwg-url-custom-searchparams-set.js index 39462bf4880065..106e94d6a249a9 100644 --- a/test/parallel/test-whatwg-url-custom-searchparams-set.js +++ b/test/parallel/test-whatwg-url-custom-searchparams-set.js @@ -4,7 +4,6 @@ require('../common'); const assert = require('assert'); -const URLSearchParams = require('url').URLSearchParams; { const params = new URLSearchParams(); diff --git a/test/parallel/test-whatwg-url-custom-searchparams-sort.js b/test/parallel/test-whatwg-url-custom-searchparams-sort.js index 49c3b065f957c6..e0b0c5c1ed12f6 100644 --- a/test/parallel/test-whatwg-url-custom-searchparams-sort.js +++ b/test/parallel/test-whatwg-url-custom-searchparams-sort.js @@ -3,7 +3,6 @@ // Tests below are not from WPT. require('../common'); -const { URL, URLSearchParams } = require('url'); const { test, assert_array_equals } = require('../common/wpt').harness; // TODO(joyeecheung): upstream this to WPT, if possible - even diff --git a/test/parallel/test-whatwg-url-custom-searchparams-stringifier.js b/test/parallel/test-whatwg-url-custom-searchparams-stringifier.js index 35307fa914975a..e46865e8b014eb 100644 --- a/test/parallel/test-whatwg-url-custom-searchparams-stringifier.js +++ b/test/parallel/test-whatwg-url-custom-searchparams-stringifier.js @@ -4,7 +4,6 @@ require('../common'); const assert = require('assert'); -const URLSearchParams = require('url').URLSearchParams; { const params = new URLSearchParams(); diff --git a/test/parallel/test-whatwg-url-custom-searchparams-values.js b/test/parallel/test-whatwg-url-custom-searchparams-values.js index eedad691fa351c..9c4bb05d0e587d 100644 --- a/test/parallel/test-whatwg-url-custom-searchparams-values.js +++ b/test/parallel/test-whatwg-url-custom-searchparams-values.js @@ -4,7 +4,6 @@ require('../common'); const assert = require('assert'); -const URLSearchParams = require('url').URLSearchParams; const params = new URLSearchParams('a=b&c=d'); const values = params.values(); diff --git a/test/parallel/test-whatwg-url-custom-searchparams.js b/test/parallel/test-whatwg-url-custom-searchparams.js index 39c8d87b6a60bf..272435b001a366 100644 --- a/test/parallel/test-whatwg-url-custom-searchparams.js +++ b/test/parallel/test-whatwg-url-custom-searchparams.js @@ -4,7 +4,6 @@ require('../common'); const assert = require('assert'); -const { URL, URLSearchParams } = require('url'); const fixtures = require('../common/fixtures'); const serialized = 'a=a&a=1&a=true&a=undefined&a=null&a=%EF%BF%BD' + diff --git a/test/parallel/test-whatwg-url-custom-setters.js b/test/parallel/test-whatwg-url-custom-setters.js index e10ebb9fe66968..b98bf5d8d3b393 100644 --- a/test/parallel/test-whatwg-url-custom-setters.js +++ b/test/parallel/test-whatwg-url-custom-setters.js @@ -9,7 +9,6 @@ if (!common.hasIntl) { } const assert = require('assert'); -const URL = require('url').URL; const { test, assert_equals } = require('../common/wpt').harness; const fixtures = require('../common/fixtures'); diff --git a/test/parallel/test-whatwg-url-custom-tostringtag.js b/test/parallel/test-whatwg-url-custom-tostringtag.js index 784a3ebc7728e5..54e5850a8f07b9 100644 --- a/test/parallel/test-whatwg-url-custom-tostringtag.js +++ b/test/parallel/test-whatwg-url-custom-tostringtag.js @@ -4,7 +4,6 @@ require('../common'); const assert = require('assert'); -const URL = require('url').URL; const toString = Object.prototype.toString; diff --git a/test/parallel/test-whatwg-url-origin.js b/test/parallel/test-whatwg-url-origin.js index 05bd1229177e15..532ff06bb1152f 100644 --- a/test/parallel/test-whatwg-url-origin.js +++ b/test/parallel/test-whatwg-url-origin.js @@ -6,7 +6,6 @@ if (!common.hasIntl) { } const fixtures = require('../common/fixtures'); -const URL = require('url').URL; const { test, assert_equals } = require('../common/wpt').harness; const request = { diff --git a/test/parallel/test-whatwg-url-override-hostname.js b/test/parallel/test-whatwg-url-override-hostname.js new file mode 100644 index 00000000000000..61e3412c6b7b53 --- /dev/null +++ b/test/parallel/test-whatwg-url-override-hostname.js @@ -0,0 +1,20 @@ +'use strict'; + +require('../common'); +const assert = require('assert'); + +{ + const url = new (class extends URL { get hostname() { return 'bar.com'; } })('http://foo.com/'); + assert.strictEqual(url.href, 'http://foo.com/'); + assert.strictEqual(url.toString(), 'http://foo.com/'); + assert.strictEqual(url.toJSON(), 'http://foo.com/'); + assert.strictEqual(url.hash, ''); + assert.strictEqual(url.host, 'foo.com'); + assert.strictEqual(url.hostname, 'bar.com'); + assert.strictEqual(url.origin, 'http://foo.com'); + assert.strictEqual(url.password, ''); + assert.strictEqual(url.protocol, 'http:'); + assert.strictEqual(url.username, ''); + assert.strictEqual(url.search, ''); + assert.strictEqual(url.searchParams.toString(), ''); +} diff --git a/test/parallel/test-whatwg-url-setters.js b/test/parallel/test-whatwg-url-setters.js index 6634fdd4b844e5..8742ab8ed372de 100644 --- a/test/parallel/test-whatwg-url-setters.js +++ b/test/parallel/test-whatwg-url-setters.js @@ -6,7 +6,6 @@ if (!common.hasIntl) { common.skip('missing Intl'); } -const URL = require('url').URL; const { test, assert_equals } = require('../common/wpt').harness; const fixtures = require('../common/fixtures'); diff --git a/test/parallel/test-whatwg-url-toascii.js b/test/parallel/test-whatwg-url-toascii.js index c5f0f24d6031d1..e5180bfb344127 100644 --- a/test/parallel/test-whatwg-url-toascii.js +++ b/test/parallel/test-whatwg-url-toascii.js @@ -6,7 +6,6 @@ if (!common.hasIntl) { } const fixtures = require('../common/fixtures'); -const { URL } = require('url'); const { test, assert_equals, assert_throws } = require('../common/wpt').harness; const request = { diff --git a/test/parallel/test-worker-unsupported-things.js b/test/parallel/test-worker-unsupported-things.js index a9f434eeaf55bb..18c1617c3cde5e 100644 --- a/test/parallel/test-worker-unsupported-things.js +++ b/test/parallel/test-worker-unsupported-things.js @@ -24,6 +24,14 @@ if (!process.env.HAS_STARTED_WORKER) { assert.strictEqual(process.debugPort, before); } + { + const mask = 0o600; + assert.throws(() => { process.umask(mask); }, { + code: 'ERR_WORKER_UNSUPPORTED_OPERATION', + message: 'Setting process.umask() is not supported in workers' + }); + } + const stubs = ['abort', 'chdir', 'send', 'disconnect']; if (!common.isWindows) { @@ -35,13 +43,19 @@ if (!process.env.HAS_STARTED_WORKER) { assert.strictEqual(process[fn].disabled, true); assert.throws(() => { process[fn](); - }, { code: 'ERR_WORKER_UNSUPPORTED_OPERATION' }); + }, { + code: 'ERR_WORKER_UNSUPPORTED_OPERATION', + message: `process.${fn}() is not supported in workers` + }); }); ['channel', 'connected'].forEach((fn) => { assert.throws(() => { process[fn]; // eslint-disable-line no-unused-expressions - }, { code: 'ERR_WORKER_UNSUPPORTED_OPERATION' }); + }, { + code: 'ERR_WORKER_UNSUPPORTED_OPERATION', + message: `process.${fn} is not supported in workers` + }); }); assert.strictEqual('_startProfilerIdleNotifier' in process, false); 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/test/sequential/test-async-wrap-getasyncid.js b/test/sequential/test-async-wrap-getasyncid.js index e37e613b747dc2..e9b2e2d2cca247 100644 --- a/test/sequential/test-async-wrap-getasyncid.js +++ b/test/sequential/test-async-wrap-getasyncid.js @@ -69,6 +69,7 @@ const { getSystemErrorName } = require('util'); delete providers.ELDHISTOGRAM; delete providers.SIGINTWATCHDOG; delete providers.WORKERHEAPSNAPSHOT; + delete providers.FIXEDSIZEBLOBCOPY; const objKeys = Object.keys(providers); if (objKeys.length > 0) diff --git a/test/sequential/test-cluster-inspect-brk.js b/test/sequential/test-cluster-inspect-brk.js index 95c9b3c51177e1..fbae27f9ba4eb4 100644 --- a/test/sequential/test-cluster-inspect-brk.js +++ b/test/sequential/test-cluster-inspect-brk.js @@ -9,10 +9,10 @@ const assert = require('assert'); const cluster = require('cluster'); const debuggerPort = common.PORT; -if (cluster.isMaster) { +if (cluster.isPrimary) { function test(execArgv) { - cluster.setupMaster({ + cluster.setupPrimary({ execArgv: execArgv, stdio: ['pipe', 'pipe', 'pipe', 'ipc', 'pipe'] }); diff --git a/test/sequential/test-cluster-net-listen-ipv6only-none.js b/test/sequential/test-cluster-net-listen-ipv6only-none.js index ef167f650850bb..ebcdfca7d0bc10 100644 --- a/test/sequential/test-cluster-net-listen-ipv6only-none.js +++ b/test/sequential/test-cluster-net-listen-ipv6only-none.js @@ -14,7 +14,7 @@ cluster.schedulingPolicy = cluster.SCHED_NONE; const host = '::'; const WORKER_ACCOUNT = 3; -if (cluster.isMaster) { +if (cluster.isPrimary) { const workers = []; for (let i = 0; i < WORKER_ACCOUNT; i += 1) { diff --git a/test/sequential/test-cluster-net-listen-ipv6only-rr.js b/test/sequential/test-cluster-net-listen-ipv6only-rr.js index 514e5032823c2c..0948bdac25d6b1 100644 --- a/test/sequential/test-cluster-net-listen-ipv6only-rr.js +++ b/test/sequential/test-cluster-net-listen-ipv6only-rr.js @@ -14,7 +14,7 @@ cluster.schedulingPolicy = cluster.SCHED_RR; const host = '::'; const WORKER_ACCOUNT = 3; -if (cluster.isMaster) { +if (cluster.isPrimary) { const workers = []; let address; @@ -51,7 +51,7 @@ if (cluster.isMaster) { })); } else { // As the cluster member has the potential to grab any port - // from the environment, this can cause collision when master + // from the environment, this can cause collision when primary // obtains the port from cluster member and tries to listen on. // So move this to sequential, and provide a static port. // Refs: https://github.com/nodejs/node/issues/25813 diff --git a/test/sequential/test-cluster-send-handle-large-payload.js b/test/sequential/test-cluster-send-handle-large-payload.js index f0ffa63421bff6..b227a7970ae6ba 100644 --- a/test/sequential/test-cluster-send-handle-large-payload.js +++ b/test/sequential/test-cluster-send-handle-large-payload.js @@ -7,7 +7,7 @@ const net = require('net'); const payload = 'a'.repeat(800004); -if (cluster.isMaster) { +if (cluster.isPrimary) { const server = net.createServer(); server.on('connection', common.mustCall((socket) => { socket.unref(); })); @@ -33,7 +33,7 @@ if (cluster.isMaster) { assert.strictEqual(payload, received); assert(handle instanceof net.Socket); - // On macOS, the parent process might not receive a message if it is sent + // On macOS, the primary process might not receive a message if it is sent // to soon, and then subsequent messages are also sometimes not received. // // (Is this a bug or expected operating system behavior like the way a file diff --git a/test/sequential/test-dgram-bind-shared-ports.js b/test/sequential/test-dgram-bind-shared-ports.js index cc12d93787df14..c68cfac969dedf 100644 --- a/test/sequential/test-dgram-bind-shared-ports.js +++ b/test/sequential/test-dgram-bind-shared-ports.js @@ -31,7 +31,7 @@ const dgram = require('dgram'); const BYE = 'bye'; const WORKER2_NAME = 'wrker2'; -if (cluster.isMaster) { +if (cluster.isPrimary) { const worker1 = cluster.fork(); if (common.isWindows) { @@ -65,7 +65,7 @@ if (cluster.isMaster) { assert.strictEqual(signal, null); assert.strictEqual(code, 0); })); - // end master code + // end primary code } else { // worker code process.on('message', common.mustCallAtLeast((msg) => { diff --git a/test/sequential/test-inspector-port-cluster.js b/test/sequential/test-inspector-port-cluster.js index 0b950df64e17ec..6dc2307e2ff02a 100644 --- a/test/sequential/test-inspector-port-cluster.js +++ b/test/sequential/test-inspector-port-cluster.js @@ -18,12 +18,12 @@ let offset = 0; // for different execArgv combinations function testRunnerMain() { - let defaultPortCase = spawnMaster({ + let defaultPortCase = spawnPrimary({ execArgv: ['--inspect'], workers: [{ expectedPort: 9230 }] }); - spawnMaster({ + spawnPrimary({ execArgv: ['--inspect=65534'], workers: [ { expectedPort: 65535 }, @@ -35,7 +35,7 @@ function testRunnerMain() { let port = debuggerPort + offset++ * 5; - spawnMaster({ + spawnPrimary({ execArgv: [`--inspect=${port}`], workers: [ { expectedPort: port + 1 }, @@ -46,28 +46,28 @@ function testRunnerMain() { port = debuggerPort + offset++ * 5; - spawnMaster({ + spawnPrimary({ execArgv: ['--inspect', `--inspect-port=${port}`], workers: [{ expectedPort: port + 1 }] }); port = debuggerPort + offset++ * 5; - spawnMaster({ + spawnPrimary({ execArgv: ['--inspect', `--debug-port=${port}`], workers: [{ expectedPort: port + 1 }] }); port = debuggerPort + offset++ * 5; - spawnMaster({ + spawnPrimary({ execArgv: [`--inspect=0.0.0.0:${port}`], workers: [{ expectedPort: port + 1, expectedHost: '0.0.0.0' }] }); port = debuggerPort + offset++ * 5; - spawnMaster({ + spawnPrimary({ execArgv: [`--inspect=127.0.0.1:${port}`], workers: [{ expectedPort: port + 1, expectedHost: '127.0.0.1' }] }); @@ -75,14 +75,14 @@ function testRunnerMain() { if (common.hasIPv6) { port = debuggerPort + offset++ * 5; - spawnMaster({ + spawnPrimary({ execArgv: [`--inspect=[::]:${port}`], workers: [{ expectedPort: port + 1, expectedHost: '::' }] }); port = debuggerPort + offset++ * 5; - spawnMaster({ + spawnPrimary({ execArgv: [`--inspect=[::1]:${port}`], workers: [{ expectedPort: port + 1, expectedHost: '::1' }] }); @@ -93,7 +93,7 @@ function testRunnerMain() { port = debuggerPort + offset++ * 5; - spawnMaster({ + spawnPrimary({ execArgv: [`--inspect=${port}`], clusterSettings: { inspectPort: port + 2 }, workers: [{ expectedPort: port + 2 }] @@ -101,7 +101,7 @@ function testRunnerMain() { port = debuggerPort + offset++ * 5; - spawnMaster({ + spawnPrimary({ execArgv: [`--inspect=${port}`], clusterSettings: { inspectPort: 'addTwo' }, workers: [ @@ -112,7 +112,7 @@ function testRunnerMain() { port = debuggerPort + offset++ * 5; - spawnMaster({ + spawnPrimary({ execArgv: [`--inspect=${port}`], clusterSettings: { inspectPort: 'string' }, workers: [{}] @@ -120,7 +120,7 @@ function testRunnerMain() { port = debuggerPort + offset++ * 5; - spawnMaster({ + spawnPrimary({ execArgv: [`--inspect=${port}`], clusterSettings: { inspectPort: 'null' }, workers: [{}] @@ -128,7 +128,7 @@ function testRunnerMain() { port = debuggerPort + offset++ * 5; - spawnMaster({ + spawnPrimary({ execArgv: [`--inspect=${port}`], clusterSettings: { inspectPort: 'bignumber' }, workers: [{}] @@ -136,7 +136,7 @@ function testRunnerMain() { port = debuggerPort + offset++ * 5; - spawnMaster({ + spawnPrimary({ execArgv: [`--inspect=${port}`], clusterSettings: { inspectPort: 'negativenumber' }, workers: [{}] @@ -144,7 +144,7 @@ function testRunnerMain() { port = debuggerPort + offset++ * 5; - spawnMaster({ + spawnPrimary({ execArgv: [`--inspect=${port}`], clusterSettings: { inspectPort: 'bignumberfunc' }, workers: [{}] @@ -152,7 +152,7 @@ function testRunnerMain() { port = debuggerPort + offset++ * 5; - spawnMaster({ + spawnPrimary({ execArgv: [`--inspect=${port}`], clusterSettings: { inspectPort: 'strfunc' }, workers: [{}] @@ -160,7 +160,7 @@ function testRunnerMain() { port = debuggerPort + offset++ * 5; - spawnMaster({ + spawnPrimary({ execArgv: [], clusterSettings: { inspectPort: port, execArgv: ['--inspect'] }, workers: [ @@ -170,7 +170,7 @@ function testRunnerMain() { port = debuggerPort + offset++ * 5; - spawnMaster({ + spawnPrimary({ execArgv: [`--inspect=${port}`], clusterSettings: { inspectPort: 0 }, workers: [ @@ -182,7 +182,7 @@ function testRunnerMain() { port = debuggerPort + offset++ * 5; - spawnMaster({ + spawnPrimary({ execArgv: [], clusterSettings: { inspectPort: 0 }, workers: [ @@ -194,7 +194,7 @@ function testRunnerMain() { defaultPortCase.then(() => { port = debuggerPort + offset++ * 5; - defaultPortCase = spawnMaster({ + defaultPortCase = spawnPrimary({ execArgv: ['--inspect'], clusterSettings: { inspectPort: port + 2 }, workers: [ @@ -204,7 +204,7 @@ function testRunnerMain() { }); } -function masterProcessMain() { +function primaryProcessMain() { const workers = JSON.parse(process.env.workers); const clusterSettings = JSON.parse(process.env.clusterSettings) || {}; const badPortError = { name: 'RangeError', code: 'ERR_SOCKET_BAD_PORT' }; @@ -236,7 +236,7 @@ function masterProcessMain() { ); } else if (clusterSettings.inspectPort === 'string') { clusterSettings.inspectPort = 'string'; - cluster.setupMaster(clusterSettings); + cluster.setupPrimary(clusterSettings); assert.throws(() => { cluster.fork(params).on('exit', common.mustCall(checkExitCode)); @@ -245,7 +245,7 @@ function masterProcessMain() { return; } else if (clusterSettings.inspectPort === 'null') { clusterSettings.inspectPort = null; - cluster.setupMaster(clusterSettings); + cluster.setupPrimary(clusterSettings); assert.throws(() => { cluster.fork(params).on('exit', common.mustCall(checkExitCode)); @@ -254,7 +254,7 @@ function masterProcessMain() { return; } else if (clusterSettings.inspectPort === 'bignumber') { clusterSettings.inspectPort = 1293812; - cluster.setupMaster(clusterSettings); + cluster.setupPrimary(clusterSettings); assert.throws(() => { cluster.fork(params).on('exit', common.mustCall(checkExitCode)); @@ -263,7 +263,7 @@ function masterProcessMain() { return; } else if (clusterSettings.inspectPort === 'negativenumber') { clusterSettings.inspectPort = -9776; - cluster.setupMaster(clusterSettings); + cluster.setupPrimary(clusterSettings); assert.throws(() => { cluster.fork(params).on('exit', common.mustCall(checkExitCode)); @@ -276,7 +276,7 @@ function masterProcessMain() { workers.length ); - cluster.setupMaster(clusterSettings); + cluster.setupPrimary(clusterSettings); assert.throws(() => { cluster.fork(params).on('exit', common.mustCall(checkExitCode)); @@ -289,7 +289,7 @@ function masterProcessMain() { workers.length ); - cluster.setupMaster(clusterSettings); + cluster.setupPrimary(clusterSettings); assert.throws(() => { cluster.fork(params).on('exit', common.mustCall(checkExitCode)); @@ -298,7 +298,7 @@ function masterProcessMain() { return; } - cluster.setupMaster(clusterSettings); + cluster.setupPrimary(clusterSettings); cluster.fork(params).on('exit', common.mustCall(checkExitCode)); } @@ -324,7 +324,7 @@ function workerProcessMain() { process.exit(); } -function spawnMaster({ execArgv, workers, clusterSettings = {} }) { +function spawnPrimary({ execArgv, workers, clusterSettings = {} }) { return new Promise((resolve) => { childProcess.fork(__filename, { env: { ...process.env, @@ -347,8 +347,8 @@ function checkExitCode(code, signal) { if (!process.env.testProcess) { testRunnerMain(); -} else if (cluster.isMaster) { - masterProcessMain(); +} else if (cluster.isPrimary) { + primaryProcessMain(); } else { workerProcessMain(); } diff --git a/test/sequential/test-inspector-port-zero.js b/test/sequential/test-inspector-port-zero.js index 59027b5e30769d..1683394a1dd4a3 100644 --- a/test/sequential/test-inspector-port-zero.js +++ b/test/sequential/test-inspector-port-zero.js @@ -4,7 +4,6 @@ const { mustCall, skipIfInspectorDisabled } = require('../common'); skipIfInspectorDisabled(); const assert = require('assert'); -const { URL } = require('url'); const { spawn } = require('child_process'); function test(arg, port = '') { diff --git a/test/sequential/test-net-listen-shared-ports.js b/test/sequential/test-net-listen-shared-ports.js index 41345f37e66b6c..e902d5387d6915 100644 --- a/test/sequential/test-net-listen-shared-ports.js +++ b/test/sequential/test-net-listen-shared-ports.js @@ -25,7 +25,7 @@ const assert = require('assert'); const cluster = require('cluster'); const net = require('net'); -if (cluster.isMaster) { +if (cluster.isPrimary) { const worker1 = cluster.fork(); worker1.on('message', common.mustCall(function(msg) { diff --git a/test/sequential/test-performance-eventloopdelay.js b/test/sequential/test-performance-eventloopdelay.js index 5021ee98073d0e..b23e0977428347 100644 --- a/test/sequential/test-performance-eventloopdelay.js +++ b/test/sequential/test-performance-eventloopdelay.js @@ -86,7 +86,7 @@ const { sleep } = require('internal/util'); } ); }); - [-1, 0, 101].forEach((i) => { + [-1, 0, 101, NaN].forEach((i) => { assert.throws( () => histogram.percentile(i), { diff --git a/test/wpt/status/FileAPI/blob.json b/test/wpt/status/FileAPI/blob.json new file mode 100644 index 00000000000000..1b463a1f0a1b7f --- /dev/null +++ b/test/wpt/status/FileAPI/blob.json @@ -0,0 +1,8 @@ +{ + "Blob-stream.any.js": { + "skip": "Depends on Web Streams API" + }, + "Blob-in-worker.worker.js": { + "skip": "Depends on Web Workers API" + } +} diff --git a/test/wpt/test-blob.js b/test/wpt/test-blob.js new file mode 100644 index 00000000000000..92e18bc0ef2f22 --- /dev/null +++ b/test/wpt/test-blob.js @@ -0,0 +1,13 @@ +'use strict'; + +require('../common'); +const { WPTRunner } = require('../common/wpt'); + +const runner = new WPTRunner('FileAPI/blob'); + +runner.setInitScript(` + const { Blob } = require('buffer'); + global.Blob = Blob; +`); + +runner.runJsTests(); diff --git a/tools/doc/allhtml.js b/tools/doc/allhtml.js index c038b1f57a9bb8..5a24cee4292656 100644 --- a/tools/doc/allhtml.js +++ b/tools/doc/allhtml.js @@ -31,10 +31,10 @@ for (const link of toc.match(//g)) { const data = fs.readFileSync(source + '/' + href, 'utf8'); // Split the doc. - const match = /(<\/ul>\s*)?<\/div>\s*
/.exec(data); + const match = /(<\/ul>\s*)?<\/\w+>\s*<\w+ id="apicontent">/.exec(data); contents += data.slice(0, match.index) - .replace(/[\s\S]*?
\s*

.*?<\/h2>\s*(
    \s*)?/, ''); + .replace(/[\s\S]*?id="toc"[^>]*>\s*<\w+>.*?<\/\w+>\s*(
      \s*)?/, ''); apicontent += data.slice(match.index + match[0].length) .replace(/[\s\S]*/, '') @@ -59,13 +59,13 @@ let all = toc.replace(/index\.html/g, 'all.html') all = all.replace(/.*?\| /, '<title>'); // Insert the combined table of contents. -const tocStart = /<div id="toc">\s*<h2>.*?<\/h2>\s*/.exec(all); +const tocStart = /<\w+ id="toc"[^>]*>\s*<\w+>.*?<\/\w+>\s*/.exec(all); all = all.slice(0, tocStart.index + tocStart[0].length) + '<ul>\n' + contents + '</ul>\n' + all.slice(tocStart.index + tocStart[0].length); // Replace apicontent with the concatenated set of apicontents from each source. -const apiStart = /<div id="apicontent">\s*/.exec(all); +const apiStart = /<\w+ id="apicontent">\s*/.exec(all); const apiEnd = all.lastIndexOf('<!-- API END -->'); all = all.slice(0, apiStart.index + apiStart[0].length) + apicontent + diff --git a/tools/doc/alljson.js b/tools/doc/alljson.js index 7e027f764e7efd..0d697dde01d091 100644 --- a/tools/doc/alljson.js +++ b/tools/doc/alljson.js @@ -43,6 +43,9 @@ for (const link of toc.match(/<a.*?>/g)) { for (const property in data) { if (results.hasOwnProperty(property)) { + data[property].forEach((mod) => { + mod.source = data.source; + }); results[property].push(...data[property]); } } 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 /^<!-- YAML/.test(text); @@ -20,8 +19,8 @@ function extractAndParseYAML(text) { .replace(/^<!-- YAML/, '') .replace(/-->$/, ''); - // 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/stability.js b/tools/doc/stability.js new file mode 100644 index 00000000000000..ca4158ebc9a77e --- /dev/null +++ b/tools/doc/stability.js @@ -0,0 +1,111 @@ +'use strict'; + +// Build stability table to documentation.html/json/md by generated all.json + +const fs = require('fs'); +const path = require('path'); +const unified = require('unified'); +const raw = require('rehype-raw'); +const markdown = require('remark-parse'); +const htmlStringify = require('rehype-stringify'); +const gfm = require('remark-gfm'); +const remark2rehype = require('remark-rehype'); +const visit = require('unist-util-visit'); + +const source = `${__dirname}/../../out/doc/api`; +const data = require(path.join(source, 'all.json')); +const mark = '<!-- STABILITY_OVERVIEW_SLOT -->'; + +const output = { + json: path.join(source, 'stability.json'), + docHTML: path.join(source, 'documentation.html'), + docJSON: path.join(source, 'documentation.json'), + docMarkdown: path.join(source, 'documentation.md'), +}; + +function collectStability(data) { + const stability = []; + + for (const mod of data.modules) { + if (mod.displayName && mod.stability >= 0) { + const link = mod.source.replace('doc/api/', '').replace('.md', '.html'); + // const link = re.exec(toc)[1] + stability.push({ + api: mod.name, + link: link, + stability: mod.stability, + stabilityText: `(${mod.stability}) ${mod.stabilityText}`, + }); + } + } + + stability.sort((a, b) => a.api.localeCompare(b.api)); + return stability; +} + +function createMarkdownTable(data) { + const md = ['| API | Stability |', '| --- | --------- |']; + + for (const mod of data) { + md.push(`| [${mod.api}](${mod.link}) | ${mod.stabilityText} |`); + } + + return md.join('\n'); +} + +function createHTML(md) { + const file = unified() + .use(markdown) + .use(gfm) + .use(remark2rehype, { allowDangerousHtml: true }) + .use(raw) + .use(htmlStringify) + .use(processStability) + .processSync(md); + + return file.contents.trim(); +} + +function processStability() { + return (tree) => { + visit(tree, { type: 'element', tagName: 'tr' }, (node) => { + const [api, stability] = node.children; + if (api.tagName !== 'td') { + return; + } + + api.properties.class = 'module_stability'; + + const level = stability.children[0].value[1]; + stability.properties.class = `api_stability api_stability_${level}`; + }); + }; +} + +function updateStabilityMark(file, value, mark) { + const fd = fs.openSync(file, 'r+'); + const content = fs.readFileSync(fd); + + // Find the position of the `mark`. + const index = content.indexOf(mark); + + // Overwrite the mark with `value` parameter. + const offset = fs.writeSync(fd, value, index, 'utf-8'); + + // Re-write the end of the file after `value`. + fs.writeSync(fd, content, index + mark.length, undefined, index + offset); + fs.closeSync(fd); +} + +const stability = collectStability(data); + +// add markdown +const markdownTable = createMarkdownTable(stability); +updateStabilityMark(output.docMarkdown, markdownTable, mark); + +// add html table +const html = createHTML(markdownTable); +updateStabilityMark(output.docHTML, html, mark); + +// add json output +updateStabilityMark(output.docJSON, JSON.stringify(html), JSON.stringify(mark)); diff --git a/tools/doc/type-parser.js b/tools/doc/type-parser.js index 72a2ec419940de..41e6086bf006bb 100644 --- a/tools/doc/type-parser.js +++ b/tools/doc/type-parser.js @@ -40,6 +40,8 @@ const customTypesMap = { 'WebAssembly.Instance': `${jsDocPrefix}Reference/Global_Objects/WebAssembly/Instance`, + 'Blob': 'buffer.html#buffer_class_blob', + 'BroadcastChannel': 'worker_threads.html#worker_threads_class_broadcastchannel_' + 'extends_eventtarget', @@ -112,6 +114,10 @@ const customTypesMap = { 'NodeScryptImportParams': 'webcrypto.html#webcrypto_class_nodescryptimportparams', 'NodeScryptParams': 'webcrypto.html#webcrypto_class_nodescryptparams', + 'NodeEdKeyImportParams': + 'webcrypto.html#webcrypto_class_nodeedkeyimportparams', + 'NodeEdKeyGenParams': + 'webcrypto.html#webcrypto_class_nodeedkeygenparams', 'dgram.Socket': 'dgram.html#dgram_class_dgram_socket', @@ -217,6 +223,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/icu/current_ver.dep b/tools/icu/current_ver.dep index a73a4b1117ede6..1c7f45879621c0 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" + "url": "https://github.com/unicode-org/icu/releases/download/release-68-2/icu4c-68_2-src.tgz", + "md5": "c21cbdfe31a1e325afe765a16f907d20" } ] diff --git a/tools/icu/icu-generic.gyp b/tools/icu/icu-generic.gyp index 680f8528df1384..36339144926096 100644 --- a/tools/icu/icu-generic.gyp +++ b/tools/icu/icu-generic.gyp @@ -107,80 +107,6 @@ 'sources': [ '<@(icu_src_i18n)' ], - ## if your compiler can dead-strip, these exclusions will - ## make ZERO difference to binary size. - ## Made ICU-specific for future-proofing. - 'conditions': [ - [ 'icu_ver_major == 55', { 'sources!': [ - # alphabetic index - '<(icu_path)/source/i18n/alphaindex.cpp', - # BOCSU - # misc - '<(icu_path)/source/i18n/regexcmp.cpp', - '<(icu_path)/source/i18n/regexcmp.h', - '<(icu_path)/source/i18n/regexcst.h', - '<(icu_path)/source/i18n/regeximp.cpp', - '<(icu_path)/source/i18n/regeximp.h', - '<(icu_path)/source/i18n/regexst.cpp', - '<(icu_path)/source/i18n/regexst.h', - '<(icu_path)/source/i18n/regextxt.cpp', - '<(icu_path)/source/i18n/regextxt.h', - '<(icu_path)/source/i18n/region.cpp', - '<(icu_path)/source/i18n/region_impl.h', - '<(icu_path)/source/i18n/reldatefmt.cpp', - '<(icu_path)/source/i18n/reldatefmt.h' - '<(icu_path)/source/i18n/scientificformathelper.cpp', - '<(icu_path)/source/i18n/tmunit.cpp', - '<(icu_path)/source/i18n/tmutamt.cpp', - '<(icu_path)/source/i18n/tmutfmt.cpp', - '<(icu_path)/source/i18n/uregex.cpp', - '<(icu_path)/source/i18n/uregexc.cpp', - '<(icu_path)/source/i18n/uregion.cpp', - '<(icu_path)/source/i18n/uspoof.cpp', - '<(icu_path)/source/i18n/uspoof_build.cpp', - '<(icu_path)/source/i18n/uspoof_conf.cpp', - '<(icu_path)/source/i18n/uspoof_conf.h', - '<(icu_path)/source/i18n/uspoof_impl.cpp', - '<(icu_path)/source/i18n/uspoof_impl.h', - '<(icu_path)/source/i18n/uspoof_wsconf.cpp', - '<(icu_path)/source/i18n/uspoof_wsconf.h', - ]}], - [ 'icu_ver_major == 57', { 'sources!': [ - - # alphabetic index - '<(icu_path)/source/i18n/alphaindex.cpp', - # BOCSU - # misc - '<(icu_path)/source/i18n/regexcmp.cpp', - '<(icu_path)/source/i18n/regexcmp.h', - '<(icu_path)/source/i18n/regexcst.h', - '<(icu_path)/source/i18n/regeximp.cpp', - '<(icu_path)/source/i18n/regeximp.h', - '<(icu_path)/source/i18n/regexst.cpp', - '<(icu_path)/source/i18n/regexst.h', - '<(icu_path)/source/i18n/regextxt.cpp', - '<(icu_path)/source/i18n/regextxt.h', - '<(icu_path)/source/i18n/region.cpp', - '<(icu_path)/source/i18n/region_impl.h', - '<(icu_path)/source/i18n/reldatefmt.cpp', - '<(icu_path)/source/i18n/reldatefmt.h' - '<(icu_path)/source/i18n/scientificformathelper.cpp', - '<(icu_path)/source/i18n/tmunit.cpp', - '<(icu_path)/source/i18n/tmutamt.cpp', - '<(icu_path)/source/i18n/tmutfmt.cpp', - '<(icu_path)/source/i18n/uregex.cpp', - '<(icu_path)/source/i18n/uregexc.cpp', - '<(icu_path)/source/i18n/uregion.cpp', - '<(icu_path)/source/i18n/uspoof.cpp', - '<(icu_path)/source/i18n/uspoof_build.cpp', - '<(icu_path)/source/i18n/uspoof_conf.cpp', - '<(icu_path)/source/i18n/uspoof_conf.h', - '<(icu_path)/source/i18n/uspoof_impl.cpp', - '<(icu_path)/source/i18n/uspoof_impl.h', - '<(icu_path)/source/i18n/uspoof_wsconf.cpp', - '<(icu_path)/source/i18n/uspoof_wsconf.h', - ]}], - ], 'include_dirs': [ '<(icu_path)/source/i18n', ], @@ -410,35 +336,6 @@ ## make ZERO difference to binary size. ## Made ICU-specific for future-proofing. 'conditions': [ - [ 'icu_ver_major == 55', { 'sources!': [ - - # bidi- not needed (yet!) - '<(icu_path)/source/common/ubidi.c', - '<(icu_path)/source/common/ubidiimp.h', - '<(icu_path)/source/common/ubidiln.c', - '<(icu_path)/source/common/ubidiwrt.c', - #'<(icu_path)/source/common/ubidi_props.c', - #'<(icu_path)/source/common/ubidi_props.h', - #'<(icu_path)/source/common/ubidi_props_data.h', - # and the callers - '<(icu_path)/source/common/ushape.cpp', - ]}], - [ 'icu_ver_major == 57', { 'sources!': [ - # work around http://bugs.icu-project.org/trac/ticket/12451 - # (benign afterwards) - '<(icu_path)/source/common/cstr.cpp', - - # bidi- not needed (yet!) - '<(icu_path)/source/common/ubidi.c', - '<(icu_path)/source/common/ubidiimp.h', - '<(icu_path)/source/common/ubidiln.c', - '<(icu_path)/source/common/ubidiwrt.c', - #'<(icu_path)/source/common/ubidi_props.c', - #'<(icu_path)/source/common/ubidi_props.h', - #'<(icu_path)/source/common/ubidi_props_data.h', - # and the callers - '<(icu_path)/source/common/ushape.cpp', - ]}], [ 'OS == "solaris"', { 'defines': [ '_XOPEN_SOURCE_EXTENDED=0', ]}], diff --git a/tools/icu/patches/64/source/common/putil.cpp b/tools/icu/patches/64/source/common/putil.cpp deleted file mode 100644 index 59cf232afee6a8..00000000000000 --- a/tools/icu/patches/64/source/common/putil.cpp +++ /dev/null @@ -1,2415 +0,0 @@ -// © 2016 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html -/* -****************************************************************************** -* -* Copyright (C) 1997-2016, International Business Machines -* Corporation and others. All Rights Reserved. -* -****************************************************************************** -* -* FILE NAME : putil.c (previously putil.cpp and ptypes.cpp) -* -* Date Name Description -* 04/14/97 aliu Creation. -* 04/24/97 aliu Added getDefaultDataDirectory() and -* getDefaultLocaleID(). -* 04/28/97 aliu Rewritten to assume Unix and apply general methods -* for assumed case. Non-UNIX platforms must be -* special-cased. Rewrote numeric methods dealing -* with NaN and Infinity to be platform independent -* over all IEEE 754 platforms. -* 05/13/97 aliu Restored sign of timezone -* (semantics are hours West of GMT) -* 06/16/98 erm Added IEEE_754 stuff, cleaned up isInfinite, isNan, -* nextDouble.. -* 07/22/98 stephen Added remainder, max, min, trunc -* 08/13/98 stephen Added isNegativeInfinity, isPositiveInfinity -* 08/24/98 stephen Added longBitsFromDouble -* 09/08/98 stephen Minor changes for Mac Port -* 03/02/99 stephen Removed openFile(). Added AS400 support. -* Fixed EBCDIC tables -* 04/15/99 stephen Converted to C. -* 06/28/99 stephen Removed mutex locking in u_isBigEndian(). -* 08/04/99 jeffrey R. Added OS/2 changes -* 11/15/99 helena Integrated S/390 IEEE support. -* 04/26/01 Barry N. OS/400 support for uprv_getDefaultLocaleID -* 08/15/01 Steven H. OS/400 support for uprv_getDefaultCodepage -* 01/03/08 Steven L. Fake Time Support -****************************************************************************** -*/ - -// Defines _XOPEN_SOURCE for access to POSIX functions. -// Must be before any other #includes. -#include "uposixdefs.h" - -// First, the platform type. Need this for U_PLATFORM. -#include "unicode/platform.h" - -#if U_PLATFORM == U_PF_MINGW && defined __STRICT_ANSI__ -/* tzset isn't defined in strict ANSI on MinGW. */ -#undef __STRICT_ANSI__ -#endif - -/* - * Cygwin with GCC requires inclusion of time.h after the above disabling strict asci mode statement. - */ -#include <time.h> - -#if !U_PLATFORM_USES_ONLY_WIN32_API -#include <sys/time.h> -#endif - -/* include the rest of the ICU headers */ -#include "unicode/putil.h" -#include "unicode/ustring.h" -#include "putilimp.h" -#include "uassert.h" -#include "umutex.h" -#include "cmemory.h" -#include "cstring.h" -#include "locmap.h" -#include "ucln_cmn.h" -#include "charstr.h" - -/* Include standard headers. */ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <math.h> -#include <locale.h> -#include <float.h> - -#ifndef U_COMMON_IMPLEMENTATION -#error U_COMMON_IMPLEMENTATION not set - must be set for all ICU source files in common/ - see http://userguide.icu-project.org/howtouseicu -#endif - - -/* include system headers */ -#if U_PLATFORM_USES_ONLY_WIN32_API - /* - * TODO: U_PLATFORM_USES_ONLY_WIN32_API includes MinGW. - * Should Cygwin be included as well (U_PLATFORM_HAS_WIN32_API) - * to use native APIs as much as possible? - */ -#ifndef WIN32_LEAN_AND_MEAN -# define WIN32_LEAN_AND_MEAN -#endif -# define VC_EXTRALEAN -# define NOUSER -# define NOSERVICE -# define NOIME -# define NOMCX -# include <windows.h> -# include "unicode/uloc.h" -# include "wintz.h" -#elif U_PLATFORM == U_PF_OS400 -# include <float.h> -# include <qusec.h> /* error code structure */ -# include <qusrjobi.h> -# include <qliept.h> /* EPT_CALL macro - this include must be after all other "QSYSINCs" */ -# include <mih/testptr.h> /* For uprv_maximumPtr */ -#elif U_PLATFORM == U_PF_OS390 -# include "unicode/ucnv.h" /* Needed for UCNV_SWAP_LFNL_OPTION_STRING */ -#elif U_PLATFORM_IS_DARWIN_BASED || U_PLATFORM_IS_LINUX_BASED || U_PLATFORM == U_PF_BSD || U_PLATFORM == U_PF_SOLARIS -# include <limits.h> -# include <unistd.h> -# if U_PLATFORM == U_PF_SOLARIS -# ifndef _XPG4_2 -# define _XPG4_2 -# endif -# endif -#elif U_PLATFORM == U_PF_QNX -# include <sys/neutrino.h> -#endif - -/* - * Only include langinfo.h if we have a way to get the codeset. If we later - * depend on more feature, we can test on U_HAVE_NL_LANGINFO. - * - */ - -#if U_HAVE_NL_LANGINFO_CODESET -#include <langinfo.h> -#endif - -/** - * Simple things (presence of functions, etc) should just go in configure.in and be added to - * icucfg.h via autoheader. - */ -#if U_PLATFORM_IMPLEMENTS_POSIX -# if U_PLATFORM == U_PF_OS400 -# define HAVE_DLFCN_H 0 -# define HAVE_DLOPEN 0 -# else -# ifndef HAVE_DLFCN_H -# define HAVE_DLFCN_H 1 -# endif -# ifndef HAVE_DLOPEN -# define HAVE_DLOPEN 1 -# endif -# endif -# ifndef HAVE_GETTIMEOFDAY -# define HAVE_GETTIMEOFDAY 1 -# endif -#else -# define HAVE_DLFCN_H 0 -# define HAVE_DLOPEN 0 -# define HAVE_GETTIMEOFDAY 0 -#endif - -U_NAMESPACE_USE - -/* Define the extension for data files, again... */ -#define DATA_TYPE "dat" - -/* Leave this copyright notice here! */ -static const char copyright[] = U_COPYRIGHT_STRING; - -/* floating point implementations ------------------------------------------- */ - -/* We return QNAN rather than SNAN*/ -#define SIGN 0x80000000U - -/* Make it easy to define certain types of constants */ -typedef union { - int64_t i64; /* This must be defined first in order to allow the initialization to work. This is a C89 feature. */ - double d64; -} BitPatternConversion; -static const BitPatternConversion gNan = { (int64_t) INT64_C(0x7FF8000000000000) }; -static const BitPatternConversion gInf = { (int64_t) INT64_C(0x7FF0000000000000) }; - -/*--------------------------------------------------------------------------- - Platform utilities - Our general strategy is to assume we're on a POSIX platform. Platforms which - are non-POSIX must declare themselves so. The default POSIX implementation - will sometimes work for non-POSIX platforms as well (e.g., the NaN-related - functions). - ---------------------------------------------------------------------------*/ - -#if U_PLATFORM_USES_ONLY_WIN32_API || U_PLATFORM == U_PF_OS400 -# undef U_POSIX_LOCALE -#else -# define U_POSIX_LOCALE 1 -#endif - -/* - WARNING! u_topNBytesOfDouble and u_bottomNBytesOfDouble - can't be properly optimized by the gcc compiler sometimes (i.e. gcc 3.2). -*/ -#if !IEEE_754 -static char* -u_topNBytesOfDouble(double* d, int n) -{ -#if U_IS_BIG_ENDIAN - return (char*)d; -#else - return (char*)(d + 1) - n; -#endif -} - -static char* -u_bottomNBytesOfDouble(double* d, int n) -{ -#if U_IS_BIG_ENDIAN - return (char*)(d + 1) - n; -#else - return (char*)d; -#endif -} -#endif /* !IEEE_754 */ - -#if IEEE_754 -static UBool -u_signBit(double d) { - uint8_t hiByte; -#if U_IS_BIG_ENDIAN - hiByte = *(uint8_t *)&d; -#else - hiByte = *(((uint8_t *)&d) + sizeof(double) - 1); -#endif - return (hiByte & 0x80) != 0; -} -#endif - - - -#if defined (U_DEBUG_FAKETIME) -/* Override the clock to test things without having to move the system clock. - * Assumes POSIX gettimeofday() will function - */ -UDate fakeClock_t0 = 0; /** Time to start the clock from **/ -UDate fakeClock_dt = 0; /** Offset (fake time - real time) **/ -UBool fakeClock_set = FALSE; /** True if fake clock has spun up **/ - -static UDate getUTCtime_real() { - struct timeval posixTime; - gettimeofday(&posixTime, NULL); - return (UDate)(((int64_t)posixTime.tv_sec * U_MILLIS_PER_SECOND) + (posixTime.tv_usec/1000)); -} - -static UDate getUTCtime_fake() { - static UMutex fakeClockMutex = U_MUTEX_INTIALIZER; - umtx_lock(&fakeClockMutex); - if(!fakeClock_set) { - UDate real = getUTCtime_real(); - const char *fake_start = getenv("U_FAKETIME_START"); - if((fake_start!=NULL) && (fake_start[0]!=0)) { - sscanf(fake_start,"%lf",&fakeClock_t0); - fakeClock_dt = fakeClock_t0 - real; - fprintf(stderr,"U_DEBUG_FAKETIME was set at compile time, so the ICU clock will start at a preset value\n" - "env variable U_FAKETIME_START=%.0f (%s) for an offset of %.0f ms from the current time %.0f\n", - fakeClock_t0, fake_start, fakeClock_dt, real); - } else { - fakeClock_dt = 0; - fprintf(stderr,"U_DEBUG_FAKETIME was set at compile time, but U_FAKETIME_START was not set.\n" - "Set U_FAKETIME_START to the number of milliseconds since 1/1/1970 to set the ICU clock.\n"); - } - fakeClock_set = TRUE; - } - umtx_unlock(&fakeClockMutex); - - return getUTCtime_real() + fakeClock_dt; -} -#endif - -#if U_PLATFORM_USES_ONLY_WIN32_API -typedef union { - int64_t int64; - FILETIME fileTime; -} FileTimeConversion; /* This is like a ULARGE_INTEGER */ - -/* Number of 100 nanoseconds from 1/1/1601 to 1/1/1970 */ -#define EPOCH_BIAS INT64_C(116444736000000000) -#define HECTONANOSECOND_PER_MILLISECOND 10000 - -#endif - -/*--------------------------------------------------------------------------- - Universal Implementations - These are designed to work on all platforms. Try these, and if they - don't work on your platform, then special case your platform with new - implementations. ----------------------------------------------------------------------------*/ - -U_CAPI UDate U_EXPORT2 -uprv_getUTCtime() -{ -#if defined(U_DEBUG_FAKETIME) - return getUTCtime_fake(); /* Hook for overriding the clock */ -#else - return uprv_getRawUTCtime(); -#endif -} - -/* Return UTC (GMT) time measured in milliseconds since 0:00 on 1/1/70.*/ -U_CAPI UDate U_EXPORT2 -uprv_getRawUTCtime() -{ -#if U_PLATFORM_USES_ONLY_WIN32_API - - FileTimeConversion winTime; - GetSystemTimeAsFileTime(&winTime.fileTime); - return (UDate)((winTime.int64 - EPOCH_BIAS) / HECTONANOSECOND_PER_MILLISECOND); -#else - -#if HAVE_GETTIMEOFDAY - struct timeval posixTime; - gettimeofday(&posixTime, NULL); - return (UDate)(((int64_t)posixTime.tv_sec * U_MILLIS_PER_SECOND) + (posixTime.tv_usec/1000)); -#else - time_t epochtime; - time(&epochtime); - return (UDate)epochtime * U_MILLIS_PER_SECOND; -#endif - -#endif -} - -/*----------------------------------------------------------------------------- - IEEE 754 - These methods detect and return NaN and infinity values for doubles - conforming to IEEE 754. Platforms which support this standard include X86, - Mac 680x0, Mac PowerPC, AIX RS/6000, and most others. - If this doesn't work on your platform, you have non-IEEE floating-point, and - will need to code your own versions. A naive implementation is to return 0.0 - for getNaN and getInfinity, and false for isNaN and isInfinite. - ---------------------------------------------------------------------------*/ - -U_CAPI UBool U_EXPORT2 -uprv_isNaN(double number) -{ -#if IEEE_754 - BitPatternConversion convertedNumber; - convertedNumber.d64 = number; - /* Infinity is 0x7FF0000000000000U. Anything greater than that is a NaN */ - return (UBool)((convertedNumber.i64 & U_INT64_MAX) > gInf.i64); - -#elif U_PLATFORM == U_PF_OS390 - uint32_t highBits = *(uint32_t*)u_topNBytesOfDouble(&number, - sizeof(uint32_t)); - uint32_t lowBits = *(uint32_t*)u_bottomNBytesOfDouble(&number, - sizeof(uint32_t)); - - return ((highBits & 0x7F080000L) == 0x7F080000L) && - (lowBits == 0x00000000L); - -#else - /* If your platform doesn't support IEEE 754 but *does* have an NaN value,*/ - /* you'll need to replace this default implementation with what's correct*/ - /* for your platform.*/ - return number != number; -#endif -} - -U_CAPI UBool U_EXPORT2 -uprv_isInfinite(double number) -{ -#if IEEE_754 - BitPatternConversion convertedNumber; - convertedNumber.d64 = number; - /* Infinity is exactly 0x7FF0000000000000U. */ - return (UBool)((convertedNumber.i64 & U_INT64_MAX) == gInf.i64); -#elif U_PLATFORM == U_PF_OS390 - uint32_t highBits = *(uint32_t*)u_topNBytesOfDouble(&number, - sizeof(uint32_t)); - uint32_t lowBits = *(uint32_t*)u_bottomNBytesOfDouble(&number, - sizeof(uint32_t)); - - return ((highBits & ~SIGN) == 0x70FF0000L) && (lowBits == 0x00000000L); - -#else - /* If your platform doesn't support IEEE 754 but *does* have an infinity*/ - /* value, you'll need to replace this default implementation with what's*/ - /* correct for your platform.*/ - return number == (2.0 * number); -#endif -} - -U_CAPI UBool U_EXPORT2 -uprv_isPositiveInfinity(double number) -{ -#if IEEE_754 || U_PLATFORM == U_PF_OS390 - return (UBool)(number > 0 && uprv_isInfinite(number)); -#else - return uprv_isInfinite(number); -#endif -} - -U_CAPI UBool U_EXPORT2 -uprv_isNegativeInfinity(double number) -{ -#if IEEE_754 || U_PLATFORM == U_PF_OS390 - return (UBool)(number < 0 && uprv_isInfinite(number)); - -#else - uint32_t highBits = *(uint32_t*)u_topNBytesOfDouble(&number, - sizeof(uint32_t)); - return((highBits & SIGN) && uprv_isInfinite(number)); - -#endif -} - -U_CAPI double U_EXPORT2 -uprv_getNaN() -{ -#if IEEE_754 || U_PLATFORM == U_PF_OS390 - return gNan.d64; -#else - /* If your platform doesn't support IEEE 754 but *does* have an NaN value,*/ - /* you'll need to replace this default implementation with what's correct*/ - /* for your platform.*/ - return 0.0; -#endif -} - -U_CAPI double U_EXPORT2 -uprv_getInfinity() -{ -#if IEEE_754 || U_PLATFORM == U_PF_OS390 - return gInf.d64; -#else - /* If your platform doesn't support IEEE 754 but *does* have an infinity*/ - /* value, you'll need to replace this default implementation with what's*/ - /* correct for your platform.*/ - return 0.0; -#endif -} - -U_CAPI double U_EXPORT2 -uprv_floor(double x) -{ - return floor(x); -} - -U_CAPI double U_EXPORT2 -uprv_ceil(double x) -{ - return ceil(x); -} - -U_CAPI double U_EXPORT2 -uprv_round(double x) -{ - return uprv_floor(x + 0.5); -} - -U_CAPI double U_EXPORT2 -uprv_fabs(double x) -{ - return fabs(x); -} - -U_CAPI double U_EXPORT2 -uprv_modf(double x, double* y) -{ - return modf(x, y); -} - -U_CAPI double U_EXPORT2 -uprv_fmod(double x, double y) -{ - return fmod(x, y); -} - -U_CAPI double U_EXPORT2 -uprv_pow(double x, double y) -{ - /* This is declared as "double pow(double x, double y)" */ - return pow(x, y); -} - -U_CAPI double U_EXPORT2 -uprv_pow10(int32_t x) -{ - return pow(10.0, (double)x); -} - -U_CAPI double U_EXPORT2 -uprv_fmax(double x, double y) -{ -#if IEEE_754 - /* first handle NaN*/ - if(uprv_isNaN(x) || uprv_isNaN(y)) - return uprv_getNaN(); - - /* check for -0 and 0*/ - if(x == 0.0 && y == 0.0 && u_signBit(x)) - return y; - -#endif - - /* this should work for all flt point w/o NaN and Inf special cases */ - return (x > y ? x : y); -} - -U_CAPI double U_EXPORT2 -uprv_fmin(double x, double y) -{ -#if IEEE_754 - /* first handle NaN*/ - if(uprv_isNaN(x) || uprv_isNaN(y)) - return uprv_getNaN(); - - /* check for -0 and 0*/ - if(x == 0.0 && y == 0.0 && u_signBit(y)) - return y; - -#endif - - /* this should work for all flt point w/o NaN and Inf special cases */ - return (x > y ? y : x); -} - -U_CAPI UBool U_EXPORT2 -uprv_add32_overflow(int32_t a, int32_t b, int32_t* res) { - // NOTE: Some compilers (GCC, Clang) have primitives available, like __builtin_add_overflow. - // This function could be optimized by calling one of those primitives. - auto a64 = static_cast<int64_t>(a); - auto b64 = static_cast<int64_t>(b); - int64_t res64 = a64 + b64; - *res = static_cast<int32_t>(res64); - return res64 != *res; -} - -U_CAPI UBool U_EXPORT2 -uprv_mul32_overflow(int32_t a, int32_t b, int32_t* res) { - // NOTE: Some compilers (GCC, Clang) have primitives available, like __builtin_mul_overflow. - // This function could be optimized by calling one of those primitives. - auto a64 = static_cast<int64_t>(a); - auto b64 = static_cast<int64_t>(b); - int64_t res64 = a64 * b64; - *res = static_cast<int32_t>(res64); - return res64 != *res; -} - -/** - * Truncates the given double. - * trunc(3.3) = 3.0, trunc (-3.3) = -3.0 - * This is different than calling floor() or ceil(): - * floor(3.3) = 3, floor(-3.3) = -4 - * ceil(3.3) = 4, ceil(-3.3) = -3 - */ -U_CAPI double U_EXPORT2 -uprv_trunc(double d) -{ -#if IEEE_754 - /* handle error cases*/ - if(uprv_isNaN(d)) - return uprv_getNaN(); - if(uprv_isInfinite(d)) - return uprv_getInfinity(); - - if(u_signBit(d)) /* Signbit() picks up -0.0; d<0 does not. */ - return ceil(d); - else - return floor(d); - -#else - return d >= 0 ? floor(d) : ceil(d); - -#endif -} - -/** - * Return the largest positive number that can be represented by an integer - * type of arbitrary bit length. - */ -U_CAPI double U_EXPORT2 -uprv_maxMantissa(void) -{ - return pow(2.0, DBL_MANT_DIG + 1.0) - 1.0; -} - -U_CAPI double U_EXPORT2 -uprv_log(double d) -{ - return log(d); -} - -U_CAPI void * U_EXPORT2 -uprv_maximumPtr(void * base) -{ -#if U_PLATFORM == U_PF_OS400 - /* - * With the provided function we should never be out of range of a given segment - * (a traditional/typical segment that is). Our segments have 5 bytes for the - * id and 3 bytes for the offset. The key is that the casting takes care of - * only retrieving the offset portion minus x1000. Hence, the smallest offset - * seen in a program is x001000 and when casted to an int would be 0. - * That's why we can only add 0xffefff. Otherwise, we would exceed the segment. - * - * Currently, 16MB is the current addressing limitation on i5/OS if the activation is - * non-TERASPACE. If it is TERASPACE it is 2GB - 4k(header information). - * This function determines the activation based on the pointer that is passed in and - * calculates the appropriate maximum available size for - * each pointer type (TERASPACE and non-TERASPACE) - * - * Unlike other operating systems, the pointer model isn't determined at - * compile time on i5/OS. - */ - if ((base != NULL) && (_TESTPTR(base, _C_TERASPACE_CHECK))) { - /* if it is a TERASPACE pointer the max is 2GB - 4k */ - return ((void *)(((char *)base)-((uint32_t)(base))+((uint32_t)0x7fffefff))); - } - /* otherwise 16MB since NULL ptr is not checkable or the ptr is not TERASPACE */ - return ((void *)(((char *)base)-((uint32_t)(base))+((uint32_t)0xffefff))); - -#else - return U_MAX_PTR(base); -#endif -} - -/*--------------------------------------------------------------------------- - Platform-specific Implementations - Try these, and if they don't work on your platform, then special case your - platform with new implementations. - ---------------------------------------------------------------------------*/ - -/* Generic time zone layer -------------------------------------------------- */ - -/* Time zone utilities */ -U_CAPI void U_EXPORT2 -uprv_tzset() -{ -#if defined(U_TZSET) - U_TZSET(); -#else - /* no initialization*/ -#endif -} - -U_CAPI int32_t U_EXPORT2 -uprv_timezone() -{ -#ifdef U_TIMEZONE - return U_TIMEZONE; -#else - time_t t, t1, t2; - struct tm tmrec; - int32_t tdiff = 0; - - time(&t); - uprv_memcpy( &tmrec, localtime(&t), sizeof(tmrec) ); -#if U_PLATFORM != U_PF_IPHONE - UBool dst_checked = (tmrec.tm_isdst != 0); /* daylight savings time is checked*/ -#endif - t1 = mktime(&tmrec); /* local time in seconds*/ - uprv_memcpy( &tmrec, gmtime(&t), sizeof(tmrec) ); - t2 = mktime(&tmrec); /* GMT (or UTC) in seconds*/ - tdiff = t2 - t1; - -#if U_PLATFORM != U_PF_IPHONE - /* imitate NT behaviour, which returns same timezone offset to GMT for - winter and summer. - This does not work on all platforms. For instance, on glibc on Linux - and on Mac OS 10.5, tdiff calculated above remains the same - regardless of whether DST is in effect or not. iOS is another - platform where this does not work. Linux + glibc and Mac OS 10.5 - have U_TIMEZONE defined so that this code is not reached. - */ - if (dst_checked) - tdiff += 3600; -#endif - return tdiff; -#endif -} - -/* Note that U_TZNAME does *not* have to be tzname, but if it is, - some platforms need to have it declared here. */ - -#if defined(U_TZNAME) && (U_PLATFORM == U_PF_IRIX || U_PLATFORM_IS_DARWIN_BASED) -/* RS6000 and others reject char **tzname. */ -extern U_IMPORT char *U_TZNAME[]; -#endif - -#if !UCONFIG_NO_FILE_IO && ((U_PLATFORM_IS_DARWIN_BASED && (U_PLATFORM != U_PF_IPHONE || defined(U_TIMEZONE))) || U_PLATFORM_IS_LINUX_BASED || U_PLATFORM == U_PF_BSD || U_PLATFORM == U_PF_SOLARIS) -/* These platforms are likely to use Olson timezone IDs. */ -/* common targets of the symbolic link at TZDEFAULT are: - * "/usr/share/zoneinfo/<olsonID>" default, older Linux distros, macOS to 10.12 - * "../usr/share/zoneinfo/<olsonID>" newer Linux distros: Red Hat Enterprise Linux 7, Ubuntu 16, SuSe Linux 12 - * "/usr/share/lib/zoneinfo/<olsonID>" Solaris - * "../usr/share/lib/zoneinfo/<olsonID>" Solaris - * "/var/db/timezone/zoneinfo/<olsonID>" macOS 10.13 - * To avoid checking lots of paths, just check that the target path - * before the <olsonID> ends with "/zoneinfo/", and the <olsonID> is valid. - */ - -#define CHECK_LOCALTIME_LINK 1 -#if U_PLATFORM_IS_DARWIN_BASED -#include <tzfile.h> -#define TZZONEINFO (TZDIR "/") -#elif U_PLATFORM == U_PF_SOLARIS -#define TZDEFAULT "/etc/localtime" -#define TZZONEINFO "/usr/share/lib/zoneinfo/" -#define TZ_ENV_CHECK "localtime" -#else -#define TZDEFAULT "/etc/localtime" -#define TZZONEINFO "/usr/share/zoneinfo/" -#endif -#define TZZONEINFOTAIL "/zoneinfo/" -#if U_HAVE_DIRENT_H -#define TZFILE_SKIP "posixrules" /* tz file to skip when searching. */ -/* Some Linux distributions have 'localtime' in /usr/share/zoneinfo - symlinked to /etc/localtime, which makes searchForTZFile return - 'localtime' when it's the first match. */ -#define TZFILE_SKIP2 "localtime" -#define SEARCH_TZFILE -#include <dirent.h> /* Needed to search through system timezone files */ -#endif -static char gTimeZoneBuffer[PATH_MAX]; -static char *gTimeZoneBufferPtr = NULL; -#endif - -#if !U_PLATFORM_USES_ONLY_WIN32_API -#define isNonDigit(ch) (ch < '0' || '9' < ch) -static UBool isValidOlsonID(const char *id) { - int32_t idx = 0; - - /* Determine if this is something like Iceland (Olson ID) - or AST4ADT (non-Olson ID) */ - while (id[idx] && isNonDigit(id[idx]) && id[idx] != ',') { - idx++; - } - - /* If we went through the whole string, then it might be okay. - The timezone is sometimes set to "CST-7CDT", "CST6CDT5,J129,J131/19:30", - "GRNLNDST3GRNLNDDT" or similar, so we cannot use it. - The rest of the time it could be an Olson ID. George */ - return (UBool)(id[idx] == 0 - || uprv_strcmp(id, "PST8PDT") == 0 - || uprv_strcmp(id, "MST7MDT") == 0 - || uprv_strcmp(id, "CST6CDT") == 0 - || uprv_strcmp(id, "EST5EDT") == 0); -} - -/* On some Unix-like OS, 'posix' subdirectory in - /usr/share/zoneinfo replicates the top-level contents. 'right' - subdirectory has the same set of files, but individual files - are different from those in the top-level directory or 'posix' - because 'right' has files for TAI (Int'l Atomic Time) while 'posix' - has files for UTC. - When the first match for /etc/localtime is in either of them - (usually in posix because 'right' has different file contents), - or TZ environment variable points to one of them, createTimeZone - fails because, say, 'posix/America/New_York' is not an Olson - timezone id ('America/New_York' is). So, we have to skip - 'posix/' and 'right/' at the beginning. */ -static void skipZoneIDPrefix(const char** id) { - if (uprv_strncmp(*id, "posix/", 6) == 0 - || uprv_strncmp(*id, "right/", 6) == 0) - { - *id += 6; - } -} -#endif - -#if defined(U_TZNAME) && !U_PLATFORM_USES_ONLY_WIN32_API - -#define CONVERT_HOURS_TO_SECONDS(offset) (int32_t)(offset*3600) -typedef struct OffsetZoneMapping { - int32_t offsetSeconds; - int32_t daylightType; /* 0=U_DAYLIGHT_NONE, 1=daylight in June-U_DAYLIGHT_JUNE, 2=daylight in December=U_DAYLIGHT_DECEMBER*/ - const char *stdID; - const char *dstID; - const char *olsonID; -} OffsetZoneMapping; - -enum { U_DAYLIGHT_NONE=0,U_DAYLIGHT_JUNE=1,U_DAYLIGHT_DECEMBER=2 }; - -/* -This list tries to disambiguate a set of abbreviated timezone IDs and offsets -and maps it to an Olson ID. -Before adding anything to this list, take a look at -icu/source/tools/tzcode/tz.alias -Sometimes no daylight savings (0) is important to define due to aliases. -This list can be tested with icu/source/test/compat/tzone.pl -More values could be added to daylightType to increase precision. -*/ -static const struct OffsetZoneMapping OFFSET_ZONE_MAPPINGS[] = { - {-45900, 2, "CHAST", "CHADT", "Pacific/Chatham"}, - {-43200, 1, "PETT", "PETST", "Asia/Kamchatka"}, - {-43200, 2, "NZST", "NZDT", "Pacific/Auckland"}, - {-43200, 1, "ANAT", "ANAST", "Asia/Anadyr"}, - {-39600, 1, "MAGT", "MAGST", "Asia/Magadan"}, - {-37800, 2, "LHST", "LHST", "Australia/Lord_Howe"}, - {-36000, 2, "EST", "EST", "Australia/Sydney"}, - {-36000, 1, "SAKT", "SAKST", "Asia/Sakhalin"}, - {-36000, 1, "VLAT", "VLAST", "Asia/Vladivostok"}, - {-34200, 2, "CST", "CST", "Australia/South"}, - {-32400, 1, "YAKT", "YAKST", "Asia/Yakutsk"}, - {-32400, 1, "CHOT", "CHOST", "Asia/Choibalsan"}, - {-31500, 2, "CWST", "CWST", "Australia/Eucla"}, - {-28800, 1, "IRKT", "IRKST", "Asia/Irkutsk"}, - {-28800, 1, "ULAT", "ULAST", "Asia/Ulaanbaatar"}, - {-28800, 2, "WST", "WST", "Australia/West"}, - {-25200, 1, "HOVT", "HOVST", "Asia/Hovd"}, - {-25200, 1, "KRAT", "KRAST", "Asia/Krasnoyarsk"}, - {-21600, 1, "NOVT", "NOVST", "Asia/Novosibirsk"}, - {-21600, 1, "OMST", "OMSST", "Asia/Omsk"}, - {-18000, 1, "YEKT", "YEKST", "Asia/Yekaterinburg"}, - {-14400, 1, "SAMT", "SAMST", "Europe/Samara"}, - {-14400, 1, "AMT", "AMST", "Asia/Yerevan"}, - {-14400, 1, "AZT", "AZST", "Asia/Baku"}, - {-10800, 1, "AST", "ADT", "Asia/Baghdad"}, - {-10800, 1, "MSK", "MSD", "Europe/Moscow"}, - {-10800, 1, "VOLT", "VOLST", "Europe/Volgograd"}, - {-7200, 0, "EET", "CEST", "Africa/Tripoli"}, - {-7200, 1, "EET", "EEST", "Europe/Athens"}, /* Conflicts with Africa/Cairo */ - {-7200, 1, "IST", "IDT", "Asia/Jerusalem"}, - {-3600, 0, "CET", "WEST", "Africa/Algiers"}, - {-3600, 2, "WAT", "WAST", "Africa/Windhoek"}, - {0, 1, "GMT", "IST", "Europe/Dublin"}, - {0, 1, "GMT", "BST", "Europe/London"}, - {0, 0, "WET", "WEST", "Africa/Casablanca"}, - {0, 0, "WET", "WET", "Africa/El_Aaiun"}, - {3600, 1, "AZOT", "AZOST", "Atlantic/Azores"}, - {3600, 1, "EGT", "EGST", "America/Scoresbysund"}, - {10800, 1, "PMST", "PMDT", "America/Miquelon"}, - {10800, 2, "UYT", "UYST", "America/Montevideo"}, - {10800, 1, "WGT", "WGST", "America/Godthab"}, - {10800, 2, "BRT", "BRST", "Brazil/East"}, - {12600, 1, "NST", "NDT", "America/St_Johns"}, - {14400, 1, "AST", "ADT", "Canada/Atlantic"}, - {14400, 2, "AMT", "AMST", "America/Cuiaba"}, - {14400, 2, "CLT", "CLST", "Chile/Continental"}, - {14400, 2, "FKT", "FKST", "Atlantic/Stanley"}, - {14400, 2, "PYT", "PYST", "America/Asuncion"}, - {18000, 1, "CST", "CDT", "America/Havana"}, - {18000, 1, "EST", "EDT", "US/Eastern"}, /* Conflicts with America/Grand_Turk */ - {21600, 2, "EAST", "EASST", "Chile/EasterIsland"}, - {21600, 0, "CST", "MDT", "Canada/Saskatchewan"}, - {21600, 0, "CST", "CDT", "America/Guatemala"}, - {21600, 1, "CST", "CDT", "US/Central"}, /* Conflicts with Mexico/General */ - {25200, 1, "MST", "MDT", "US/Mountain"}, /* Conflicts with Mexico/BajaSur */ - {28800, 0, "PST", "PST", "Pacific/Pitcairn"}, - {28800, 1, "PST", "PDT", "US/Pacific"}, /* Conflicts with Mexico/BajaNorte */ - {32400, 1, "AKST", "AKDT", "US/Alaska"}, - {36000, 1, "HAST", "HADT", "US/Aleutian"} -}; - -/*#define DEBUG_TZNAME*/ - -static const char* remapShortTimeZone(const char *stdID, const char *dstID, int32_t daylightType, int32_t offset) -{ - int32_t idx; -#ifdef DEBUG_TZNAME - fprintf(stderr, "TZ=%s std=%s dst=%s daylight=%d offset=%d\n", getenv("TZ"), stdID, dstID, daylightType, offset); -#endif - for (idx = 0; idx < UPRV_LENGTHOF(OFFSET_ZONE_MAPPINGS); idx++) - { - if (offset == OFFSET_ZONE_MAPPINGS[idx].offsetSeconds - && daylightType == OFFSET_ZONE_MAPPINGS[idx].daylightType - && strcmp(OFFSET_ZONE_MAPPINGS[idx].stdID, stdID) == 0 - && strcmp(OFFSET_ZONE_MAPPINGS[idx].dstID, dstID) == 0) - { - return OFFSET_ZONE_MAPPINGS[idx].olsonID; - } - } - return NULL; -} -#endif - -#ifdef SEARCH_TZFILE -#define MAX_READ_SIZE 512 - -typedef struct DefaultTZInfo { - char* defaultTZBuffer; - int64_t defaultTZFileSize; - FILE* defaultTZFilePtr; - UBool defaultTZstatus; - int32_t defaultTZPosition; -} DefaultTZInfo; - -/* - * This method compares the two files given to see if they are a match. - * It is currently use to compare two TZ files. - */ -static UBool compareBinaryFiles(const char* defaultTZFileName, const char* TZFileName, DefaultTZInfo* tzInfo) { - FILE* file; - int64_t sizeFile; - int64_t sizeFileLeft; - int32_t sizeFileRead; - int32_t sizeFileToRead; - char bufferFile[MAX_READ_SIZE]; - UBool result = TRUE; - - if (tzInfo->defaultTZFilePtr == NULL) { - tzInfo->defaultTZFilePtr = fopen(defaultTZFileName, "r"); - } - file = fopen(TZFileName, "r"); - - tzInfo->defaultTZPosition = 0; /* reset position to begin search */ - - if (file != NULL && tzInfo->defaultTZFilePtr != NULL) { - /* First check that the file size are equal. */ - if (tzInfo->defaultTZFileSize == 0) { - fseek(tzInfo->defaultTZFilePtr, 0, SEEK_END); - tzInfo->defaultTZFileSize = ftell(tzInfo->defaultTZFilePtr); - } - fseek(file, 0, SEEK_END); - sizeFile = ftell(file); - sizeFileLeft = sizeFile; - - if (sizeFile != tzInfo->defaultTZFileSize) { - result = FALSE; - } else { - /* Store the data from the files in seperate buffers and - * compare each byte to determine equality. - */ - if (tzInfo->defaultTZBuffer == NULL) { - rewind(tzInfo->defaultTZFilePtr); - tzInfo->defaultTZBuffer = (char*)uprv_malloc(sizeof(char) * tzInfo->defaultTZFileSize); - sizeFileRead = fread(tzInfo->defaultTZBuffer, 1, tzInfo->defaultTZFileSize, tzInfo->defaultTZFilePtr); - } - rewind(file); - while(sizeFileLeft > 0) { - uprv_memset(bufferFile, 0, MAX_READ_SIZE); - sizeFileToRead = sizeFileLeft < MAX_READ_SIZE ? sizeFileLeft : MAX_READ_SIZE; - - sizeFileRead = fread(bufferFile, 1, sizeFileToRead, file); - if (memcmp(tzInfo->defaultTZBuffer + tzInfo->defaultTZPosition, bufferFile, sizeFileRead) != 0) { - result = FALSE; - break; - } - sizeFileLeft -= sizeFileRead; - tzInfo->defaultTZPosition += sizeFileRead; - } - } - } else { - result = FALSE; - } - - if (file != NULL) { - fclose(file); - } - - return result; -} - - -/* dirent also lists two entries: "." and ".." that we can safely ignore. */ -#define SKIP1 "." -#define SKIP2 ".." -static UBool U_CALLCONV putil_cleanup(void); -static CharString *gSearchTZFileResult = NULL; - -/* - * This method recursively traverses the directory given for a matching TZ file and returns the first match. - * This function is not thread safe - it uses a global, gSearchTZFileResult, to hold its results. - */ -static char* searchForTZFile(const char* path, DefaultTZInfo* tzInfo) { - DIR* dirp = NULL; - struct dirent* dirEntry = NULL; - char* result = NULL; - UErrorCode status = U_ZERO_ERROR; - - /* Save the current path */ - CharString curpath(path, -1, status); - if (U_FAILURE(status)) { - goto cleanupAndReturn; - } - - dirp = opendir(path); - if (dirp == NULL) { - goto cleanupAndReturn; - } - - if (gSearchTZFileResult == NULL) { - gSearchTZFileResult = new CharString; - if (gSearchTZFileResult == NULL) { - goto cleanupAndReturn; - } - ucln_common_registerCleanup(UCLN_COMMON_PUTIL, putil_cleanup); - } - - /* Check each entry in the directory. */ - while((dirEntry = readdir(dirp)) != NULL) { - const char* dirName = dirEntry->d_name; - if (uprv_strcmp(dirName, SKIP1) != 0 && uprv_strcmp(dirName, SKIP2) != 0 - && uprv_strcmp(TZFILE_SKIP, dirName) != 0 && uprv_strcmp(TZFILE_SKIP2, dirName) != 0) { - /* Create a newpath with the new entry to test each entry in the directory. */ - CharString newpath(curpath, status); - newpath.append(dirName, -1, status); - if (U_FAILURE(status)) { - break; - } - - DIR* subDirp = NULL; - if ((subDirp = opendir(newpath.data())) != NULL) { - /* If this new path is a directory, make a recursive call with the newpath. */ - closedir(subDirp); - newpath.append('/', status); - if (U_FAILURE(status)) { - break; - } - result = searchForTZFile(newpath.data(), tzInfo); - /* - Have to get out here. Otherwise, we'd keep looking - and return the first match in the top-level directory - if there's a match in the top-level. If not, this function - would return NULL and set gTimeZoneBufferPtr to NULL in initDefault(). - It worked without this in most cases because we have a fallback of calling - localtime_r to figure out the default timezone. - */ - if (result != NULL) - break; - } else { - if(compareBinaryFiles(TZDEFAULT, newpath.data(), tzInfo)) { - int32_t amountToSkip = sizeof(TZZONEINFO) - 1; - if (amountToSkip > newpath.length()) { - amountToSkip = newpath.length(); - } - const char* zoneid = newpath.data() + amountToSkip; - skipZoneIDPrefix(&zoneid); - gSearchTZFileResult->clear(); - gSearchTZFileResult->append(zoneid, -1, status); - if (U_FAILURE(status)) { - break; - } - result = gSearchTZFileResult->data(); - /* Get out after the first one found. */ - break; - } - } - } - } - - cleanupAndReturn: - if (dirp) { - closedir(dirp); - } - return result; -} -#endif - -U_CAPI void U_EXPORT2 -uprv_tzname_clear_cache() -{ -#if defined(CHECK_LOCALTIME_LINK) && !defined(DEBUG_SKIP_LOCALTIME_LINK) - gTimeZoneBufferPtr = NULL; -#endif -} - -U_CAPI const char* U_EXPORT2 -uprv_tzname(int n) -{ - (void)n; // Avoid unreferenced parameter warning. - const char *tzid = NULL; -#if U_PLATFORM_USES_ONLY_WIN32_API - tzid = uprv_detectWindowsTimeZone(); - - if (tzid != NULL) { - return tzid; - } - -#ifndef U_TZNAME - // The return value is free'd in timezone.cpp on Windows because - // the other code path returns a pointer to a heap location. - // If we don't have a name already, then tzname wouldn't be any - // better, so just fall back. - return uprv_strdup(""); -#endif // !U_TZNAME - -#else - -/*#if U_PLATFORM_IS_DARWIN_BASED - int ret; - - tzid = getenv("TZFILE"); - if (tzid != NULL) { - return tzid; - } -#endif*/ - -/* This code can be temporarily disabled to test tzname resolution later on. */ -#ifndef DEBUG_TZNAME - tzid = getenv("TZ"); - if (tzid != NULL && isValidOlsonID(tzid) -#if U_PLATFORM == U_PF_SOLARIS - /* When TZ equals localtime on Solaris, check the /etc/localtime file. */ - && uprv_strcmp(tzid, TZ_ENV_CHECK) != 0 -#endif - ) { - /* The colon forces tzset() to treat the remainder as zoneinfo path */ - if (tzid[0] == ':') { - tzid++; - } - /* This might be a good Olson ID. */ - skipZoneIDPrefix(&tzid); - return tzid; - } - /* else U_TZNAME will give a better result. */ -#endif - -#if defined(CHECK_LOCALTIME_LINK) && !defined(DEBUG_SKIP_LOCALTIME_LINK) - /* Caller must handle threading issues */ - if (gTimeZoneBufferPtr == NULL) { - /* - This is a trick to look at the name of the link to get the Olson ID - because the tzfile contents is underspecified. - This isn't guaranteed to work because it may not be a symlink. - */ - int32_t ret = (int32_t)readlink(TZDEFAULT, gTimeZoneBuffer, sizeof(gTimeZoneBuffer)-1); - if (0 < ret) { - int32_t tzZoneInfoTailLen = uprv_strlen(TZZONEINFOTAIL); - gTimeZoneBuffer[ret] = 0; - char * tzZoneInfoTailPtr = uprv_strstr(gTimeZoneBuffer, TZZONEINFOTAIL); - - if (tzZoneInfoTailPtr != NULL - && isValidOlsonID(tzZoneInfoTailPtr + tzZoneInfoTailLen)) - { - return (gTimeZoneBufferPtr = tzZoneInfoTailPtr + tzZoneInfoTailLen); - } - } else { -#if defined(SEARCH_TZFILE) - DefaultTZInfo* tzInfo = (DefaultTZInfo*)uprv_malloc(sizeof(DefaultTZInfo)); - if (tzInfo != NULL) { - tzInfo->defaultTZBuffer = NULL; - tzInfo->defaultTZFileSize = 0; - tzInfo->defaultTZFilePtr = NULL; - tzInfo->defaultTZstatus = FALSE; - tzInfo->defaultTZPosition = 0; - - gTimeZoneBufferPtr = searchForTZFile(TZZONEINFO, tzInfo); - - /* Free previously allocated memory */ - if (tzInfo->defaultTZBuffer != NULL) { - uprv_free(tzInfo->defaultTZBuffer); - } - if (tzInfo->defaultTZFilePtr != NULL) { - fclose(tzInfo->defaultTZFilePtr); - } - uprv_free(tzInfo); - } - - if (gTimeZoneBufferPtr != NULL && isValidOlsonID(gTimeZoneBufferPtr)) { - return gTimeZoneBufferPtr; - } -#endif - } - } - else { - return gTimeZoneBufferPtr; - } -#endif -#endif - -#ifdef U_TZNAME -#if U_PLATFORM_USES_ONLY_WIN32_API - /* The return value is free'd in timezone.cpp on Windows because - * the other code path returns a pointer to a heap location. */ - return uprv_strdup(U_TZNAME[n]); -#else - /* - U_TZNAME is usually a non-unique abbreviation, which isn't normally usable. - So we remap the abbreviation to an olson ID. - - Since Windows exposes a little more timezone information, - we normally don't use this code on Windows because - uprv_detectWindowsTimeZone should have already given the correct answer. - */ - { - struct tm juneSol, decemberSol; - int daylightType; - static const time_t juneSolstice=1182478260; /*2007-06-21 18:11 UT*/ - static const time_t decemberSolstice=1198332540; /*2007-12-22 06:09 UT*/ - - /* This probing will tell us when daylight savings occurs. */ - localtime_r(&juneSolstice, &juneSol); - localtime_r(&decemberSolstice, &decemberSol); - if(decemberSol.tm_isdst > 0) { - daylightType = U_DAYLIGHT_DECEMBER; - } else if(juneSol.tm_isdst > 0) { - daylightType = U_DAYLIGHT_JUNE; - } else { - daylightType = U_DAYLIGHT_NONE; - } - tzid = remapShortTimeZone(U_TZNAME[0], U_TZNAME[1], daylightType, uprv_timezone()); - if (tzid != NULL) { - return tzid; - } - } - return U_TZNAME[n]; -#endif -#else - return ""; -#endif -} - -/* Get and set the ICU data directory --------------------------------------- */ - -static icu::UInitOnce gDataDirInitOnce = U_INITONCE_INITIALIZER; -static char *gDataDirectory = NULL; - -UInitOnce gTimeZoneFilesInitOnce = U_INITONCE_INITIALIZER; -static CharString *gTimeZoneFilesDirectory = NULL; - -#if U_POSIX_LOCALE || U_PLATFORM_USES_ONLY_WIN32_API - static const char *gCorrectedPOSIXLocale = NULL; /* Sometimes heap allocated */ - static bool gCorrectedPOSIXLocaleHeapAllocated = false; -#endif - -static UBool U_CALLCONV putil_cleanup(void) -{ - if (gDataDirectory && *gDataDirectory) { - uprv_free(gDataDirectory); - } - gDataDirectory = NULL; - gDataDirInitOnce.reset(); - - delete gTimeZoneFilesDirectory; - gTimeZoneFilesDirectory = NULL; - gTimeZoneFilesInitOnce.reset(); - -#ifdef SEARCH_TZFILE - delete gSearchTZFileResult; - gSearchTZFileResult = NULL; -#endif - -#if U_POSIX_LOCALE || U_PLATFORM_USES_ONLY_WIN32_API - if (gCorrectedPOSIXLocale && gCorrectedPOSIXLocaleHeapAllocated) { - uprv_free(const_cast<char *>(gCorrectedPOSIXLocale)); - gCorrectedPOSIXLocale = NULL; - gCorrectedPOSIXLocaleHeapAllocated = false; - } -#endif - return TRUE; -} - -/* - * Set the data directory. - * Make a copy of the passed string, and set the global data dir to point to it. - */ -U_CAPI void U_EXPORT2 -u_setDataDirectory(const char *directory) { - char *newDataDir; - int32_t length; - - if(directory==NULL || *directory==0) { - /* A small optimization to prevent the malloc and copy when the - shared library is used, and this is a way to make sure that NULL - is never returned. - */ - newDataDir = (char *)""; - } - else { - length=(int32_t)uprv_strlen(directory); - newDataDir = (char *)uprv_malloc(length + 2); - /* Exit out if newDataDir could not be created. */ - if (newDataDir == NULL) { - return; - } - uprv_strcpy(newDataDir, directory); - -#if (U_FILE_SEP_CHAR != U_FILE_ALT_SEP_CHAR) - { - char *p; - while((p = uprv_strchr(newDataDir, U_FILE_ALT_SEP_CHAR)) != NULL) { - *p = U_FILE_SEP_CHAR; - } - } -#endif - } - - if (gDataDirectory && *gDataDirectory) { - uprv_free(gDataDirectory); - } - gDataDirectory = newDataDir; - ucln_common_registerCleanup(UCLN_COMMON_PUTIL, putil_cleanup); -} - -U_CAPI UBool U_EXPORT2 -uprv_pathIsAbsolute(const char *path) -{ - if(!path || !*path) { - return FALSE; - } - - if(*path == U_FILE_SEP_CHAR) { - return TRUE; - } - -#if (U_FILE_SEP_CHAR != U_FILE_ALT_SEP_CHAR) - if(*path == U_FILE_ALT_SEP_CHAR) { - return TRUE; - } -#endif - -#if U_PLATFORM_USES_ONLY_WIN32_API - if( (((path[0] >= 'A') && (path[0] <= 'Z')) || - ((path[0] >= 'a') && (path[0] <= 'z'))) && - path[1] == ':' ) { - return TRUE; - } -#endif - - return FALSE; -} - -/* Backup setting of ICU_DATA_DIR_PREFIX_ENV_VAR - (needed for some Darwin ICU build environments) */ -#if U_PLATFORM_IS_DARWIN_BASED && TARGET_OS_SIMULATOR -# if !defined(ICU_DATA_DIR_PREFIX_ENV_VAR) -# define ICU_DATA_DIR_PREFIX_ENV_VAR "IPHONE_SIMULATOR_ROOT" -# endif -#endif - -#if U_PLATFORM_HAS_WINUWP_API != 0 -// Helper function to get the ICU Data Directory under the Windows directory location. -static BOOL U_CALLCONV getIcuDataDirectoryUnderWindowsDirectory(char* directoryBuffer, UINT bufferLength) -{ -#if defined(ICU_DATA_DIR_WINDOWS) - wchar_t windowsPath[MAX_PATH]; - char windowsPathUtf8[MAX_PATH]; - - UINT length = GetSystemWindowsDirectoryW(windowsPath, UPRV_LENGTHOF(windowsPath)); - if ((length > 0) && (length < (UPRV_LENGTHOF(windowsPath) - 1))) { - // Convert UTF-16 to a UTF-8 string. - UErrorCode status = U_ZERO_ERROR; - int32_t windowsPathUtf8Len = 0; - u_strToUTF8(windowsPathUtf8, static_cast<int32_t>(UPRV_LENGTHOF(windowsPathUtf8)), - &windowsPathUtf8Len, reinterpret_cast<const UChar*>(windowsPath), -1, &status); - - if (U_SUCCESS(status) && (status != U_STRING_NOT_TERMINATED_WARNING) && - (windowsPathUtf8Len < (UPRV_LENGTHOF(windowsPathUtf8) - 1))) { - // Ensure it always has a separator, so we can append the ICU data path. - if (windowsPathUtf8[windowsPathUtf8Len - 1] != U_FILE_SEP_CHAR) { - windowsPathUtf8[windowsPathUtf8Len++] = U_FILE_SEP_CHAR; - windowsPathUtf8[windowsPathUtf8Len] = '\0'; - } - // Check if the concatenated string will fit. - if ((windowsPathUtf8Len + UPRV_LENGTHOF(ICU_DATA_DIR_WINDOWS)) < bufferLength) { - uprv_strcpy(directoryBuffer, windowsPathUtf8); - uprv_strcat(directoryBuffer, ICU_DATA_DIR_WINDOWS); - return TRUE; - } - } - } -#endif - - return FALSE; -} -#endif - -static void U_CALLCONV dataDirectoryInitFn() { - /* If we already have the directory, then return immediately. Will happen if user called - * u_setDataDirectory(). - */ - if (gDataDirectory) { - return; - } - - const char *path = NULL; -#if defined(ICU_DATA_DIR_PREFIX_ENV_VAR) - char datadir_path_buffer[PATH_MAX]; -#endif - - /* - When ICU_NO_USER_DATA_OVERRIDE is defined, users aren't allowed to - override ICU's data with the ICU_DATA environment variable. This prevents - problems where multiple custom copies of ICU's specific version of data - are installed on a system. Either the application must define the data - directory with u_setDataDirectory, define ICU_DATA_DIR when compiling - ICU, set the data with udata_setCommonData or trust that all of the - required data is contained in ICU's data library that contains - the entry point defined by U_ICUDATA_ENTRY_POINT. - - There may also be some platforms where environment variables - are not allowed. - */ -# if !defined(ICU_NO_USER_DATA_OVERRIDE) && !UCONFIG_NO_FILE_IO - /* First try to get the environment variable */ -# if U_PLATFORM_HAS_WINUWP_API == 0 // Windows UWP does not support getenv - path=getenv("ICU_DATA"); -# endif -# endif - - /* ICU_DATA_DIR may be set as a compile option. - * U_ICU_DATA_DEFAULT_DIR is provided and is set by ICU at compile time - * and is used only when data is built in archive mode eliminating the need - * for ICU_DATA_DIR to be set. U_ICU_DATA_DEFAULT_DIR is set to the installation - * directory of the data dat file. Users should use ICU_DATA_DIR if they want to - * set their own path. - */ -#if defined(ICU_DATA_DIR) || defined(U_ICU_DATA_DEFAULT_DIR) - if(path==NULL || *path==0) { -# if defined(ICU_DATA_DIR_PREFIX_ENV_VAR) - const char *prefix = getenv(ICU_DATA_DIR_PREFIX_ENV_VAR); -# endif -# ifdef ICU_DATA_DIR - path=ICU_DATA_DIR; -# else - path=U_ICU_DATA_DEFAULT_DIR; -# endif -# if defined(ICU_DATA_DIR_PREFIX_ENV_VAR) - if (prefix != NULL) { - snprintf(datadir_path_buffer, PATH_MAX, "%s%s", prefix, path); - path=datadir_path_buffer; - } -# endif - } -#endif - -#if U_PLATFORM_HAS_WINUWP_API != 0 && defined(ICU_DATA_DIR_WINDOWS) - char datadir_path_buffer[MAX_PATH]; - if (getIcuDataDirectoryUnderWindowsDirectory(datadir_path_buffer, UPRV_LENGTHOF(datadir_path_buffer))) { - path = datadir_path_buffer; - } -#endif - - if(path==NULL) { - /* It looks really bad, set it to something. */ - path = ""; - } - - u_setDataDirectory(path); - return; -} - -U_CAPI const char * U_EXPORT2 -u_getDataDirectory(void) { - umtx_initOnce(gDataDirInitOnce, &dataDirectoryInitFn); - return gDataDirectory; -} - -static void setTimeZoneFilesDir(const char *path, UErrorCode &status) { - if (U_FAILURE(status)) { - return; - } - gTimeZoneFilesDirectory->clear(); - gTimeZoneFilesDirectory->append(path, status); -#if (U_FILE_SEP_CHAR != U_FILE_ALT_SEP_CHAR) - char *p = gTimeZoneFilesDirectory->data(); - while ((p = uprv_strchr(p, U_FILE_ALT_SEP_CHAR)) != NULL) { - *p = U_FILE_SEP_CHAR; - } -#endif -} - -#define TO_STRING(x) TO_STRING_2(x) -#define TO_STRING_2(x) #x - -static void U_CALLCONV TimeZoneDataDirInitFn(UErrorCode &status) { - U_ASSERT(gTimeZoneFilesDirectory == NULL); - ucln_common_registerCleanup(UCLN_COMMON_PUTIL, putil_cleanup); - gTimeZoneFilesDirectory = new CharString(); - if (gTimeZoneFilesDirectory == NULL) { - status = U_MEMORY_ALLOCATION_ERROR; - return; - } - - const char *dir = ""; - -#if U_PLATFORM_HAS_WINUWP_API != 0 - // The UWP version does not support the environment variable setting, but can possibly pick them up from the Windows directory. - char datadir_path_buffer[MAX_PATH]; - if (getIcuDataDirectoryUnderWindowsDirectory(datadir_path_buffer, UPRV_LENGTHOF(datadir_path_buffer))) { - dir = datadir_path_buffer; - } -#else - dir = getenv("ICU_TIMEZONE_FILES_DIR"); -#endif // U_PLATFORM_HAS_WINUWP_API - -#if defined(U_TIMEZONE_FILES_DIR) - if (dir == NULL) { - // Build time configuration setting. - dir = TO_STRING(U_TIMEZONE_FILES_DIR); - } -#endif - - if (dir == NULL) { - dir = ""; - } - - setTimeZoneFilesDir(dir, status); -} - - -U_CAPI const char * U_EXPORT2 -u_getTimeZoneFilesDirectory(UErrorCode *status) { - umtx_initOnce(gTimeZoneFilesInitOnce, &TimeZoneDataDirInitFn, *status); - return U_SUCCESS(*status) ? gTimeZoneFilesDirectory->data() : ""; -} - -U_CAPI void U_EXPORT2 -u_setTimeZoneFilesDirectory(const char *path, UErrorCode *status) { - umtx_initOnce(gTimeZoneFilesInitOnce, &TimeZoneDataDirInitFn, *status); - setTimeZoneFilesDir(path, *status); - - // Note: this function does some extra churn, first setting based on the - // environment, then immediately replacing with the value passed in. - // The logic is simpler that way, and performance shouldn't be an issue. -} - - -#if U_POSIX_LOCALE -/* A helper function used by uprv_getPOSIXIDForDefaultLocale and - * uprv_getPOSIXIDForDefaultCodepage. Returns the posix locale id for - * LC_CTYPE and LC_MESSAGES. It doesn't support other locale categories. - */ -static const char *uprv_getPOSIXIDForCategory(int category) -{ - const char* posixID = NULL; - if (category == LC_MESSAGES || category == LC_CTYPE) { - /* - * On Solaris two different calls to setlocale can result in - * different values. Only get this value once. - * - * We must check this first because an application can set this. - * - * LC_ALL can't be used because it's platform dependent. The LANG - * environment variable seems to affect LC_CTYPE variable by default. - * Here is what setlocale(LC_ALL, NULL) can return. - * HPUX can return 'C C C C C C C' - * Solaris can return /en_US/C/C/C/C/C on the second try. - * Linux can return LC_CTYPE=C;LC_NUMERIC=C;... - * - * The default codepage detection also needs to use LC_CTYPE. - * - * Do not call setlocale(LC_*, "")! Using an empty string instead - * of NULL, will modify the libc behavior. - */ - posixID = setlocale(category, NULL); - if ((posixID == 0) - || (uprv_strcmp("C", posixID) == 0) - || (uprv_strcmp("POSIX", posixID) == 0)) - { - /* Maybe we got some garbage. Try something more reasonable */ - posixID = getenv("LC_ALL"); - /* Solaris speaks POSIX - See IEEE Std 1003.1-2008 - * This is needed to properly handle empty env. variables - */ -#if U_PLATFORM == U_PF_SOLARIS - if ((posixID == 0) || (posixID[0] == '\0')) { - posixID = getenv(category == LC_MESSAGES ? "LC_MESSAGES" : "LC_CTYPE"); - if ((posixID == 0) || (posixID[0] == '\0')) { -#else - if (posixID == 0) { - posixID = getenv(category == LC_MESSAGES ? "LC_MESSAGES" : "LC_CTYPE"); - if (posixID == 0) { -#endif - posixID = getenv("LANG"); - } - } - } - } - if ((posixID==0) - || (uprv_strcmp("C", posixID) == 0) - || (uprv_strcmp("POSIX", posixID) == 0)) - { - /* Nothing worked. Give it a nice POSIX default value. */ - posixID = "en_US_POSIX"; - // Note: this test will not catch 'C.UTF-8', - // that will be handled in uprv_getDefaultLocaleID(). - // Leave this mapping here for the uprv_getPOSIXIDForDefaultCodepage() - // caller which expects to see "en_US_POSIX" in many branches. - } - return posixID; -} - -/* Return just the POSIX id for the default locale, whatever happens to be in - * it. It gets the value from LC_MESSAGES and indirectly from LC_ALL and LANG. - */ -static const char *uprv_getPOSIXIDForDefaultLocale(void) -{ - static const char* posixID = NULL; - if (posixID == 0) { - posixID = uprv_getPOSIXIDForCategory(LC_MESSAGES); - } - return posixID; -} - -#if !U_CHARSET_IS_UTF8 -/* Return just the POSIX id for the default codepage, whatever happens to be in - * it. It gets the value from LC_CTYPE and indirectly from LC_ALL and LANG. - */ -static const char *uprv_getPOSIXIDForDefaultCodepage(void) -{ - static const char* posixID = NULL; - if (posixID == 0) { - posixID = uprv_getPOSIXIDForCategory(LC_CTYPE); - } - return posixID; -} -#endif -#endif - -/* NOTE: The caller should handle thread safety */ -U_CAPI const char* U_EXPORT2 -uprv_getDefaultLocaleID() -{ -#if U_POSIX_LOCALE -/* - Note that: (a '!' means the ID is improper somehow) - LC_ALL ----> default_loc codepage --------------------------------------------------------- - ab.CD ab CD - ab@CD ab__CD - - ab@CD.EF ab__CD EF - - ab_CD.EF@GH ab_CD_GH EF - -Some 'improper' ways to do the same as above: - ! ab_CD@GH.EF ab_CD_GH EF - ! ab_CD.EF@GH.IJ ab_CD_GH EF - ! ab_CD@ZZ.EF@GH.IJ ab_CD_GH EF - - _CD@GH _CD_GH - - _CD.EF@GH _CD_GH EF - -The variant cannot have dots in it. -The 'rightmost' variant (@xxx) wins. -The leftmost codepage (.xxx) wins. -*/ - const char* posixID = uprv_getPOSIXIDForDefaultLocale(); - - /* Format: (no spaces) - ll [ _CC ] [ . MM ] [ @ VV] - - l = lang, C = ctry, M = charmap, V = variant - */ - - if (gCorrectedPOSIXLocale != nullptr) { - return gCorrectedPOSIXLocale; - } - - // Copy the ID into owned memory. - // Over-allocate in case we replace "C" with "en_US_POSIX" (+10), + null termination - char *correctedPOSIXLocale = static_cast<char *>(uprv_malloc(uprv_strlen(posixID) + 10 + 1)); - if (correctedPOSIXLocale == nullptr) { - return nullptr; - } - uprv_strcpy(correctedPOSIXLocale, posixID); - - char *limit; - if ((limit = uprv_strchr(correctedPOSIXLocale, '.')) != nullptr) { - *limit = 0; - } - if ((limit = uprv_strchr(correctedPOSIXLocale, '@')) != nullptr) { - *limit = 0; - } - - if ((uprv_strcmp("C", correctedPOSIXLocale) == 0) // no @ variant - || (uprv_strcmp("POSIX", correctedPOSIXLocale) == 0)) { - // Raw input was C.* or POSIX.*, Give it a nice POSIX default value. - // (The "C"/"POSIX" case is handled in uprv_getPOSIXIDForCategory()) - uprv_strcpy(correctedPOSIXLocale, "en_US_POSIX"); - } - - /* Note that we scan the *uncorrected* ID. */ - const char *p; - if ((p = uprv_strrchr(posixID, '@')) != nullptr) { - p++; - - /* Take care of any special cases here.. */ - if (!uprv_strcmp(p, "nynorsk")) { - p = "NY"; - /* Don't worry about no__NY. In practice, it won't appear. */ - } - - if (uprv_strchr(correctedPOSIXLocale,'_') == nullptr) { - uprv_strcat(correctedPOSIXLocale, "__"); /* aa@b -> aa__b (note this can make the new locale 1 char longer) */ - } - else { - uprv_strcat(correctedPOSIXLocale, "_"); /* aa_CC@b -> aa_CC_b */ - } - - const char *q; - if ((q = uprv_strchr(p, '.')) != nullptr) { - /* How big will the resulting string be? */ - int32_t len = (int32_t)(uprv_strlen(correctedPOSIXLocale) + (q-p)); - uprv_strncat(correctedPOSIXLocale, p, q-p); // do not include charset - correctedPOSIXLocale[len] = 0; - } - else { - /* Anything following the @ sign */ - uprv_strcat(correctedPOSIXLocale, p); - } - - /* Should there be a map from 'no@nynorsk' -> no_NO_NY here? - * How about 'russian' -> 'ru'? - * Many of the other locales using ISO codes will be handled by the - * canonicalization functions in uloc_getDefault. - */ - } - - if (gCorrectedPOSIXLocale == nullptr) { - gCorrectedPOSIXLocale = correctedPOSIXLocale; - gCorrectedPOSIXLocaleHeapAllocated = true; - ucln_common_registerCleanup(UCLN_COMMON_PUTIL, putil_cleanup); - correctedPOSIXLocale = nullptr; - } - posixID = gCorrectedPOSIXLocale; - - if (correctedPOSIXLocale != nullptr) { /* Was already set - clean up. */ - uprv_free(correctedPOSIXLocale); - } - - return posixID; - -#elif U_PLATFORM_USES_ONLY_WIN32_API -#define POSIX_LOCALE_CAPACITY 64 - UErrorCode status = U_ZERO_ERROR; - char *correctedPOSIXLocale = nullptr; - - // If we have already figured this out just use the cached value - if (gCorrectedPOSIXLocale != nullptr) { - return gCorrectedPOSIXLocale; - } - - // No cached value, need to determine the current value - static WCHAR windowsLocale[LOCALE_NAME_MAX_LENGTH] = {}; - int length = GetLocaleInfoEx(LOCALE_NAME_USER_DEFAULT, LOCALE_SNAME, windowsLocale, LOCALE_NAME_MAX_LENGTH); - - // Now we should have a Windows locale name that needs converted to the POSIX style. - if (length > 0) // If length is 0, then the GetLocaleInfoEx failed. - { - // First we need to go from UTF-16 to char (and also convert from _ to - while we're at it.) - char modifiedWindowsLocale[LOCALE_NAME_MAX_LENGTH] = {}; - - int32_t i; - for (i = 0; i < UPRV_LENGTHOF(modifiedWindowsLocale); i++) - { - if (windowsLocale[i] == '_') - { - modifiedWindowsLocale[i] = '-'; - } - else - { - modifiedWindowsLocale[i] = static_cast<char>(windowsLocale[i]); - } - - if (modifiedWindowsLocale[i] == '\0') - { - break; - } - } - - if (i >= UPRV_LENGTHOF(modifiedWindowsLocale)) - { - // Ran out of room, can't really happen, maybe we'll be lucky about a matching - // locale when tags are dropped - modifiedWindowsLocale[UPRV_LENGTHOF(modifiedWindowsLocale) - 1] = '\0'; - } - - // Now normalize the resulting name - correctedPOSIXLocale = static_cast<char *>(uprv_malloc(POSIX_LOCALE_CAPACITY + 1)); - /* TODO: Should we just exit on memory allocation failure? */ - if (correctedPOSIXLocale) - { - int32_t posixLen = uloc_canonicalize(modifiedWindowsLocale, correctedPOSIXLocale, POSIX_LOCALE_CAPACITY, &status); - if (U_SUCCESS(status)) - { - *(correctedPOSIXLocale + posixLen) = 0; - gCorrectedPOSIXLocale = correctedPOSIXLocale; - gCorrectedPOSIXLocaleHeapAllocated = true; - ucln_common_registerCleanup(UCLN_COMMON_PUTIL, putil_cleanup); - } - else - { - uprv_free(correctedPOSIXLocale); - } - } - } - - // If unable to find a locale we can agree upon, use en-US by default - if (gCorrectedPOSIXLocale == nullptr) { - gCorrectedPOSIXLocale = "en_US"; - } - return gCorrectedPOSIXLocale; - -#elif U_PLATFORM == U_PF_OS400 - /* locales are process scoped and are by definition thread safe */ - static char correctedLocale[64]; - const char *localeID = getenv("LC_ALL"); - char *p; - - if (localeID == NULL) - localeID = getenv("LANG"); - if (localeID == NULL) - localeID = setlocale(LC_ALL, NULL); - /* Make sure we have something... */ - if (localeID == NULL) - return "en_US_POSIX"; - - /* Extract the locale name from the path. */ - if((p = uprv_strrchr(localeID, '/')) != NULL) - { - /* Increment p to start of locale name. */ - p++; - localeID = p; - } - - /* Copy to work location. */ - uprv_strcpy(correctedLocale, localeID); - - /* Strip off the '.locale' extension. */ - if((p = uprv_strchr(correctedLocale, '.')) != NULL) { - *p = 0; - } - - /* Upper case the locale name. */ - T_CString_toUpperCase(correctedLocale); - - /* See if we are using the POSIX locale. Any of the - * following are equivalent and use the same QLGPGCMA - * (POSIX) locale. - * QLGPGCMA2 means UCS2 - * QLGPGCMA_4 means UTF-32 - * QLGPGCMA_8 means UTF-8 - */ - if ((uprv_strcmp("C", correctedLocale) == 0) || - (uprv_strcmp("POSIX", correctedLocale) == 0) || - (uprv_strncmp("QLGPGCMA", correctedLocale, 8) == 0)) - { - uprv_strcpy(correctedLocale, "en_US_POSIX"); - } - else - { - int16_t LocaleLen; - - /* Lower case the lang portion. */ - for(p = correctedLocale; *p != 0 && *p != '_'; p++) - { - *p = uprv_tolower(*p); - } - - /* Adjust for Euro. After '_E' add 'URO'. */ - LocaleLen = uprv_strlen(correctedLocale); - if (correctedLocale[LocaleLen - 2] == '_' && - correctedLocale[LocaleLen - 1] == 'E') - { - uprv_strcat(correctedLocale, "URO"); - } - - /* If using Lotus-based locale then convert to - * equivalent non Lotus. - */ - else if (correctedLocale[LocaleLen - 2] == '_' && - correctedLocale[LocaleLen - 1] == 'L') - { - correctedLocale[LocaleLen - 2] = 0; - } - - /* There are separate simplified and traditional - * locales called zh_HK_S and zh_HK_T. - */ - else if (uprv_strncmp(correctedLocale, "zh_HK", 5) == 0) - { - uprv_strcpy(correctedLocale, "zh_HK"); - } - - /* A special zh_CN_GBK locale... - */ - else if (uprv_strcmp(correctedLocale, "zh_CN_GBK") == 0) - { - uprv_strcpy(correctedLocale, "zh_CN"); - } - - } - - return correctedLocale; -#endif - -} - -#if !U_CHARSET_IS_UTF8 -#if U_POSIX_LOCALE -/* -Due to various platform differences, one platform may specify a charset, -when they really mean a different charset. Remap the names so that they are -compatible with ICU. Only conflicting/ambiguous aliases should be resolved -here. Before adding anything to this function, please consider adding unique -names to the ICU alias table in the data directory. -*/ -static const char* -remapPlatformDependentCodepage(const char *locale, const char *name) { - if (locale != NULL && *locale == 0) { - /* Make sure that an empty locale is handled the same way. */ - locale = NULL; - } - if (name == NULL) { - return NULL; - } -#if U_PLATFORM == U_PF_AIX - if (uprv_strcmp(name, "IBM-943") == 0) { - /* Use the ASCII compatible ibm-943 */ - name = "Shift-JIS"; - } - else if (uprv_strcmp(name, "IBM-1252") == 0) { - /* Use the windows-1252 that contains the Euro */ - name = "IBM-5348"; - } -#elif U_PLATFORM == U_PF_SOLARIS - if (locale != NULL && uprv_strcmp(name, "EUC") == 0) { - /* Solaris underspecifies the "EUC" name. */ - if (uprv_strcmp(locale, "zh_CN") == 0) { - name = "EUC-CN"; - } - else if (uprv_strcmp(locale, "zh_TW") == 0) { - name = "EUC-TW"; - } - else if (uprv_strcmp(locale, "ko_KR") == 0) { - name = "EUC-KR"; - } - } - else if (uprv_strcmp(name, "eucJP") == 0) { - /* - ibm-954 is the best match. - ibm-33722 is the default for eucJP (similar to Windows). - */ - name = "eucjis"; - } - else if (uprv_strcmp(name, "646") == 0) { - /* - * The default codepage given by Solaris is 646 but the C library routines treat it as if it was - * ISO-8859-1 instead of US-ASCII(646). - */ - name = "ISO-8859-1"; - } -#elif U_PLATFORM_IS_DARWIN_BASED - if (locale == NULL && *name == 0) { - /* - No locale was specified, and an empty name was passed in. - This usually indicates that nl_langinfo didn't return valid information. - Mac OS X uses UTF-8 by default (especially the locale data and console). - */ - name = "UTF-8"; - } - else if (uprv_strcmp(name, "CP949") == 0) { - /* Remap CP949 to a similar codepage to avoid issues with backslash and won symbol. */ - name = "EUC-KR"; - } - else if (locale != NULL && uprv_strcmp(locale, "en_US_POSIX") != 0 && uprv_strcmp(name, "US-ASCII") == 0) { - /* - * For non C/POSIX locale, default the code page to UTF-8 instead of US-ASCII. - */ - name = "UTF-8"; - } -#elif U_PLATFORM == U_PF_BSD - if (uprv_strcmp(name, "CP949") == 0) { - /* Remap CP949 to a similar codepage to avoid issues with backslash and won symbol. */ - name = "EUC-KR"; - } -#elif U_PLATFORM == U_PF_HPUX - if (locale != NULL && uprv_strcmp(locale, "zh_HK") == 0 && uprv_strcmp(name, "big5") == 0) { - /* HP decided to extend big5 as hkbig5 even though it's not compatible :-( */ - /* zh_TW.big5 is not the same charset as zh_HK.big5! */ - name = "hkbig5"; - } - else if (uprv_strcmp(name, "eucJP") == 0) { - /* - ibm-1350 is the best match, but unavailable. - ibm-954 is mostly a superset of ibm-1350. - ibm-33722 is the default for eucJP (similar to Windows). - */ - name = "eucjis"; - } -#elif U_PLATFORM == U_PF_LINUX - if (locale != NULL && uprv_strcmp(name, "euc") == 0) { - /* Linux underspecifies the "EUC" name. */ - if (uprv_strcmp(locale, "korean") == 0) { - name = "EUC-KR"; - } - else if (uprv_strcmp(locale, "japanese") == 0) { - /* See comment below about eucJP */ - name = "eucjis"; - } - } - else if (uprv_strcmp(name, "eucjp") == 0) { - /* - ibm-1350 is the best match, but unavailable. - ibm-954 is mostly a superset of ibm-1350. - ibm-33722 is the default for eucJP (similar to Windows). - */ - name = "eucjis"; - } - else if (locale != NULL && uprv_strcmp(locale, "en_US_POSIX") != 0 && - (uprv_strcmp(name, "ANSI_X3.4-1968") == 0 || uprv_strcmp(name, "US-ASCII") == 0)) { - /* - * For non C/POSIX locale, default the code page to UTF-8 instead of US-ASCII. - */ - name = "UTF-8"; - } - /* - * Linux returns ANSI_X3.4-1968 for C/POSIX, but the call site takes care of - * it by falling back to 'US-ASCII' when NULL is returned from this - * function. So, we don't have to worry about it here. - */ -#endif - /* return NULL when "" is passed in */ - if (*name == 0) { - name = NULL; - } - return name; -} - -static const char* -getCodepageFromPOSIXID(const char *localeName, char * buffer, int32_t buffCapacity) -{ - char localeBuf[100]; - const char *name = NULL; - char *variant = NULL; - - if (localeName != NULL && (name = (uprv_strchr(localeName, '.'))) != NULL) { - size_t localeCapacity = uprv_min(sizeof(localeBuf), (name-localeName)+1); - uprv_strncpy(localeBuf, localeName, localeCapacity); - localeBuf[localeCapacity-1] = 0; /* ensure NULL termination */ - name = uprv_strncpy(buffer, name+1, buffCapacity); - buffer[buffCapacity-1] = 0; /* ensure NULL termination */ - if ((variant = const_cast<char *>(uprv_strchr(name, '@'))) != NULL) { - *variant = 0; - } - name = remapPlatformDependentCodepage(localeBuf, name); - } - return name; -} -#endif - -static const char* -int_getDefaultCodepage() -{ -#if U_PLATFORM == U_PF_OS400 - uint32_t ccsid = 37; /* Default to ibm-37 */ - static char codepage[64]; - Qwc_JOBI0400_t jobinfo; - Qus_EC_t error = { sizeof(Qus_EC_t) }; /* SPI error code */ - - EPT_CALL(QUSRJOBI)(&jobinfo, sizeof(jobinfo), "JOBI0400", - "* ", " ", &error); - - if (error.Bytes_Available == 0) { - if (jobinfo.Coded_Char_Set_ID != 0xFFFF) { - ccsid = (uint32_t)jobinfo.Coded_Char_Set_ID; - } - else if (jobinfo.Default_Coded_Char_Set_Id != 0xFFFF) { - ccsid = (uint32_t)jobinfo.Default_Coded_Char_Set_Id; - } - /* else use the default */ - } - sprintf(codepage,"ibm-%d", ccsid); - return codepage; - -#elif U_PLATFORM == U_PF_OS390 - static char codepage[64]; - - strncpy(codepage, nl_langinfo(CODESET),63-strlen(UCNV_SWAP_LFNL_OPTION_STRING)); - strcat(codepage,UCNV_SWAP_LFNL_OPTION_STRING); - codepage[63] = 0; /* NULL terminate */ - - return codepage; - -#elif U_PLATFORM_USES_ONLY_WIN32_API - static char codepage[64]; - DWORD codepageNumber = 0; - -#if U_PLATFORM_HAS_WINUWP_API > 0 - // UWP doesn't have a direct API to get the default ACP as Microsoft would rather - // have folks use Unicode than a "system" code page, however this is the same - // codepage as the system default locale codepage. (FWIW, the system locale is - // ONLY used for codepage, it should never be used for anything else) - GetLocaleInfoEx(LOCALE_NAME_SYSTEM_DEFAULT, LOCALE_IDEFAULTANSICODEPAGE | LOCALE_RETURN_NUMBER, - (LPWSTR)&codepageNumber, sizeof(codepageNumber) / sizeof(WCHAR)); -#else - // Win32 apps can call GetACP - codepageNumber = GetACP(); -#endif - // Special case for UTF-8 - if (codepageNumber == 65001) - { - return "UTF-8"; - } - // Windows codepages can look like windows-1252, so format the found number - // the numbers are eclectic, however all valid system code pages, besides UTF-8 - // are between 3 and 19999 - if (codepageNumber > 0 && codepageNumber < 20000) - { - sprintf(codepage, "windows-%ld", codepageNumber); - return codepage; - } - // If the codepage number call failed then return UTF-8 - return "UTF-8"; - -#elif U_POSIX_LOCALE - static char codesetName[100]; - const char *localeName = NULL; - const char *name = NULL; - - localeName = uprv_getPOSIXIDForDefaultCodepage(); - uprv_memset(codesetName, 0, sizeof(codesetName)); - /* On Solaris nl_langinfo returns C locale values unless setlocale - * was called earlier. - */ -#if (U_HAVE_NL_LANGINFO_CODESET && U_PLATFORM != U_PF_SOLARIS) - /* When available, check nl_langinfo first because it usually gives more - useful names. It depends on LC_CTYPE. - nl_langinfo may use the same buffer as setlocale. */ - { - const char *codeset = nl_langinfo(U_NL_LANGINFO_CODESET); -#if U_PLATFORM_IS_DARWIN_BASED || U_PLATFORM_IS_LINUX_BASED - /* - * On Linux and MacOSX, ensure that default codepage for non C/POSIX locale is UTF-8 - * instead of ASCII. - */ - if (uprv_strcmp(localeName, "en_US_POSIX") != 0) { - codeset = remapPlatformDependentCodepage(localeName, codeset); - } else -#endif - { - codeset = remapPlatformDependentCodepage(NULL, codeset); - } - - if (codeset != NULL) { - uprv_strncpy(codesetName, codeset, sizeof(codesetName)); - codesetName[sizeof(codesetName)-1] = 0; - return codesetName; - } - } -#endif - - /* Use setlocale in a nice way, and then check some environment variables. - Maybe the application used setlocale already. - */ - uprv_memset(codesetName, 0, sizeof(codesetName)); - name = getCodepageFromPOSIXID(localeName, codesetName, sizeof(codesetName)); - if (name) { - /* if we can find the codeset name from setlocale, return that. */ - return name; - } - - if (*codesetName == 0) - { - /* Everything failed. Return US ASCII (ISO 646). */ - (void)uprv_strcpy(codesetName, "US-ASCII"); - } - return codesetName; -#else - return "US-ASCII"; -#endif -} - - -U_CAPI const char* U_EXPORT2 -uprv_getDefaultCodepage() -{ - static char const *name = NULL; - umtx_lock(NULL); - if (name == NULL) { - name = int_getDefaultCodepage(); - } - umtx_unlock(NULL); - return name; -} -#endif /* !U_CHARSET_IS_UTF8 */ - - -/* end of platform-specific implementation -------------- */ - -/* version handling --------------------------------------------------------- */ - -U_CAPI void U_EXPORT2 -u_versionFromString(UVersionInfo versionArray, const char *versionString) { - char *end; - uint16_t part=0; - - if(versionArray==NULL) { - return; - } - - if(versionString!=NULL) { - for(;;) { - versionArray[part]=(uint8_t)uprv_strtoul(versionString, &end, 10); - if(end==versionString || ++part==U_MAX_VERSION_LENGTH || *end!=U_VERSION_DELIMITER) { - break; - } - versionString=end+1; - } - } - - while(part<U_MAX_VERSION_LENGTH) { - versionArray[part++]=0; - } -} - -U_CAPI void U_EXPORT2 -u_versionFromUString(UVersionInfo versionArray, const UChar *versionString) { - if(versionArray!=NULL && versionString!=NULL) { - char versionChars[U_MAX_VERSION_STRING_LENGTH+1]; - int32_t len = u_strlen(versionString); - if(len>U_MAX_VERSION_STRING_LENGTH) { - len = U_MAX_VERSION_STRING_LENGTH; - } - u_UCharsToChars(versionString, versionChars, len); - versionChars[len]=0; - u_versionFromString(versionArray, versionChars); - } -} - -U_CAPI void U_EXPORT2 -u_versionToString(const UVersionInfo versionArray, char *versionString) { - uint16_t count, part; - uint8_t field; - - if(versionString==NULL) { - return; - } - - if(versionArray==NULL) { - versionString[0]=0; - return; - } - - /* count how many fields need to be written */ - for(count=4; count>0 && versionArray[count-1]==0; --count) { - } - - if(count <= 1) { - count = 2; - } - - /* write the first part */ - /* write the decimal field value */ - field=versionArray[0]; - if(field>=100) { - *versionString++=(char)('0'+field/100); - field%=100; - } - if(field>=10) { - *versionString++=(char)('0'+field/10); - field%=10; - } - *versionString++=(char)('0'+field); - - /* write the following parts */ - for(part=1; part<count; ++part) { - /* write a dot first */ - *versionString++=U_VERSION_DELIMITER; - - /* write the decimal field value */ - field=versionArray[part]; - if(field>=100) { - *versionString++=(char)('0'+field/100); - field%=100; - } - if(field>=10) { - *versionString++=(char)('0'+field/10); - field%=10; - } - *versionString++=(char)('0'+field); - } - - /* NUL-terminate */ - *versionString=0; -} - -U_CAPI void U_EXPORT2 -u_getVersion(UVersionInfo versionArray) { - (void)copyright; // Suppress unused variable warning from clang. - u_versionFromString(versionArray, U_ICU_VERSION); -} - -/** - * icucfg.h dependent code - */ - -#if U_ENABLE_DYLOAD && HAVE_DLOPEN && !U_PLATFORM_USES_ONLY_WIN32_API - -#if HAVE_DLFCN_H -#ifdef __MVS__ -#ifndef __SUSV3 -#define __SUSV3 1 -#endif -#endif -#include <dlfcn.h> -#endif /* HAVE_DLFCN_H */ - -U_INTERNAL void * U_EXPORT2 -uprv_dl_open(const char *libName, UErrorCode *status) { - void *ret = NULL; - if(U_FAILURE(*status)) return ret; - ret = dlopen(libName, RTLD_NOW|RTLD_GLOBAL); - if(ret==NULL) { -#ifdef U_TRACE_DYLOAD - printf("dlerror on dlopen(%s): %s\n", libName, dlerror()); -#endif - *status = U_MISSING_RESOURCE_ERROR; - } - return ret; -} - -U_INTERNAL void U_EXPORT2 -uprv_dl_close(void *lib, UErrorCode *status) { - if(U_FAILURE(*status)) return; - dlclose(lib); -} - -U_INTERNAL UVoidFunction* U_EXPORT2 -uprv_dlsym_func(void *lib, const char* sym, UErrorCode *status) { - union { - UVoidFunction *fp; - void *vp; - } uret; - uret.fp = NULL; - if(U_FAILURE(*status)) return uret.fp; - uret.vp = dlsym(lib, sym); - if(uret.vp == NULL) { -#ifdef U_TRACE_DYLOAD - printf("dlerror on dlsym(%p,%s): %s\n", lib,sym, dlerror()); -#endif - *status = U_MISSING_RESOURCE_ERROR; - } - return uret.fp; -} - -#elif U_ENABLE_DYLOAD && U_PLATFORM_USES_ONLY_WIN32_API && !U_PLATFORM_HAS_WINUWP_API - -/* Windows API implementation. */ -// Note: UWP does not expose/allow these APIs, so the UWP version gets the null implementation. */ - -U_INTERNAL void * U_EXPORT2 -uprv_dl_open(const char *libName, UErrorCode *status) { - HMODULE lib = NULL; - - if(U_FAILURE(*status)) return NULL; - - lib = LoadLibraryA(libName); - - if(lib==NULL) { - *status = U_MISSING_RESOURCE_ERROR; - } - - return (void*)lib; -} - -U_INTERNAL void U_EXPORT2 -uprv_dl_close(void *lib, UErrorCode *status) { - HMODULE handle = (HMODULE)lib; - if(U_FAILURE(*status)) return; - - FreeLibrary(handle); - - return; -} - -U_INTERNAL UVoidFunction* U_EXPORT2 -uprv_dlsym_func(void *lib, const char* sym, UErrorCode *status) { - HMODULE handle = (HMODULE)lib; - UVoidFunction* addr = NULL; - - if(U_FAILURE(*status) || lib==NULL) return NULL; - - addr = (UVoidFunction*)GetProcAddress(handle, sym); - - if(addr==NULL) { - DWORD lastError = GetLastError(); - if(lastError == ERROR_PROC_NOT_FOUND) { - *status = U_MISSING_RESOURCE_ERROR; - } else { - *status = U_UNSUPPORTED_ERROR; /* other unknown error. */ - } - } - - return addr; -} - -#else - -/* No dynamic loading, null (nonexistent) implementation. */ - -U_INTERNAL void * U_EXPORT2 -uprv_dl_open(const char *libName, UErrorCode *status) { - (void)libName; - if(U_FAILURE(*status)) return NULL; - *status = U_UNSUPPORTED_ERROR; - return NULL; -} - -U_INTERNAL void U_EXPORT2 -uprv_dl_close(void *lib, UErrorCode *status) { - (void)lib; - if(U_FAILURE(*status)) return; - *status = U_UNSUPPORTED_ERROR; - return; -} - -U_INTERNAL UVoidFunction* U_EXPORT2 -uprv_dlsym_func(void *lib, const char* sym, UErrorCode *status) { - (void)lib; - (void)sym; - if(U_SUCCESS(*status)) { - *status = U_UNSUPPORTED_ERROR; - } - return (UVoidFunction*)NULL; -} - -#endif - -/* - * Hey, Emacs, please set the following: - * - * Local Variables: - * indent-tabs-mode: nil - * End: - * - */ diff --git a/tools/icu/patches/64/source/i18n/dtptngen.cpp b/tools/icu/patches/64/source/i18n/dtptngen.cpp deleted file mode 100644 index eb8bcfb971f427..00000000000000 --- a/tools/icu/patches/64/source/i18n/dtptngen.cpp +++ /dev/null @@ -1,2778 +0,0 @@ -// © 2016 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html -/* -******************************************************************************* -* Copyright (C) 2007-2016, International Business Machines Corporation and -* others. All Rights Reserved. -******************************************************************************* -* -* File DTPTNGEN.CPP -* -******************************************************************************* -*/ - -#include "unicode/utypes.h" -#if !UCONFIG_NO_FORMATTING - -#include "unicode/datefmt.h" -#include "unicode/decimfmt.h" -#include "unicode/dtfmtsym.h" -#include "unicode/dtptngen.h" -#include "unicode/localpointer.h" -#include "unicode/simpleformatter.h" -#include "unicode/smpdtfmt.h" -#include "unicode/udat.h" -#include "unicode/udatpg.h" -#include "unicode/uniset.h" -#include "unicode/uloc.h" -#include "unicode/ures.h" -#include "unicode/ustring.h" -#include "unicode/rep.h" -#include "cpputils.h" -#include "mutex.h" -#include "umutex.h" -#include "cmemory.h" -#include "cstring.h" -#include "locbased.h" -#include "hash.h" -#include "uhash.h" -#include "uresimp.h" -#include "dtptngen_impl.h" -#include "ucln_in.h" -#include "charstr.h" -#include "uassert.h" - -#if U_CHARSET_FAMILY==U_EBCDIC_FAMILY -/** - * If we are on EBCDIC, use an iterator which will - * traverse the bundles in ASCII order. - */ -#define U_USE_ASCII_BUNDLE_ITERATOR -#define U_SORT_ASCII_BUNDLE_ITERATOR -#endif - -#if defined(U_USE_ASCII_BUNDLE_ITERATOR) - -#include "unicode/ustring.h" -#include "uarrsort.h" - -struct UResAEntry { - UChar *key; - UResourceBundle *item; -}; - -struct UResourceBundleAIterator { - UResourceBundle *bund; - UResAEntry *entries; - int32_t num; - int32_t cursor; -}; - -/* Must be C linkage to pass function pointer to the sort function */ - -U_CDECL_BEGIN - -static int32_t U_CALLCONV -ures_a_codepointSort(const void *context, const void *left, const void *right) { - //CompareContext *cmp=(CompareContext *)context; - return u_strcmp(((const UResAEntry *)left)->key, - ((const UResAEntry *)right)->key); -} - -U_CDECL_END - -static void ures_a_open(UResourceBundleAIterator *aiter, UResourceBundle *bund, UErrorCode *status) { - if(U_FAILURE(*status)) { - return; - } - aiter->bund = bund; - aiter->num = ures_getSize(aiter->bund); - aiter->cursor = 0; -#if !defined(U_SORT_ASCII_BUNDLE_ITERATOR) - aiter->entries = nullptr; -#else - aiter->entries = (UResAEntry*)uprv_malloc(sizeof(UResAEntry)*aiter->num); - for(int i=0;i<aiter->num;i++) { - aiter->entries[i].item = ures_getByIndex(aiter->bund, i, nullptr, status); - const char *akey = ures_getKey(aiter->entries[i].item); - int32_t len = uprv_strlen(akey)+1; - aiter->entries[i].key = (UChar*)uprv_malloc(len*sizeof(UChar)); - u_charsToUChars(akey, aiter->entries[i].key, len); - } - uprv_sortArray(aiter->entries, aiter->num, sizeof(UResAEntry), ures_a_codepointSort, nullptr, TRUE, status); -#endif -} - -static void ures_a_close(UResourceBundleAIterator *aiter) { -#if defined(U_SORT_ASCII_BUNDLE_ITERATOR) - for(int i=0;i<aiter->num;i++) { - uprv_free(aiter->entries[i].key); - ures_close(aiter->entries[i].item); - } -#endif -} - -static const UChar *ures_a_getNextString(UResourceBundleAIterator *aiter, int32_t *len, const char **key, UErrorCode *err) { -#if !defined(U_SORT_ASCII_BUNDLE_ITERATOR) - return ures_getNextString(aiter->bund, len, key, err); -#else - if(U_FAILURE(*err)) return nullptr; - UResourceBundle *item = aiter->entries[aiter->cursor].item; - const UChar* ret = ures_getString(item, len, err); - *key = ures_getKey(item); - aiter->cursor++; - return ret; -#endif -} - - -#endif - - -U_NAMESPACE_BEGIN - -// ***************************************************************************** -// class DateTimePatternGenerator -// ***************************************************************************** -static const UChar Canonical_Items[] = { - // GyQMwWEDFdaHmsSv - CAP_G, LOW_Y, CAP_Q, CAP_M, LOW_W, CAP_W, CAP_E, - CAP_D, CAP_F, LOW_D, LOW_A, // The UDATPG_x_FIELD constants and these fields have a different order than in ICU4J - CAP_H, LOW_M, LOW_S, CAP_S, LOW_V, 0 -}; - -static const dtTypeElem dtTypes[] = { - // patternChar, field, type, minLen, weight - {CAP_G, UDATPG_ERA_FIELD, DT_SHORT, 1, 3,}, - {CAP_G, UDATPG_ERA_FIELD, DT_LONG, 4, 0}, - {CAP_G, UDATPG_ERA_FIELD, DT_NARROW, 5, 0}, - - {LOW_Y, UDATPG_YEAR_FIELD, DT_NUMERIC, 1, 20}, - {CAP_Y, UDATPG_YEAR_FIELD, DT_NUMERIC + DT_DELTA, 1, 20}, - {LOW_U, UDATPG_YEAR_FIELD, DT_NUMERIC + 2*DT_DELTA, 1, 20}, - {LOW_R, UDATPG_YEAR_FIELD, DT_NUMERIC + 3*DT_DELTA, 1, 20}, - {CAP_U, UDATPG_YEAR_FIELD, DT_SHORT, 1, 3}, - {CAP_U, UDATPG_YEAR_FIELD, DT_LONG, 4, 0}, - {CAP_U, UDATPG_YEAR_FIELD, DT_NARROW, 5, 0}, - - {CAP_Q, UDATPG_QUARTER_FIELD, DT_NUMERIC, 1, 2}, - {CAP_Q, UDATPG_QUARTER_FIELD, DT_SHORT, 3, 0}, - {CAP_Q, UDATPG_QUARTER_FIELD, DT_LONG, 4, 0}, - {CAP_Q, UDATPG_QUARTER_FIELD, DT_NARROW, 5, 0}, - {LOW_Q, UDATPG_QUARTER_FIELD, DT_NUMERIC + DT_DELTA, 1, 2}, - {LOW_Q, UDATPG_QUARTER_FIELD, DT_SHORT - DT_DELTA, 3, 0}, - {LOW_Q, UDATPG_QUARTER_FIELD, DT_LONG - DT_DELTA, 4, 0}, - {LOW_Q, UDATPG_QUARTER_FIELD, DT_NARROW - DT_DELTA, 5, 0}, - - {CAP_M, UDATPG_MONTH_FIELD, DT_NUMERIC, 1, 2}, - {CAP_M, UDATPG_MONTH_FIELD, DT_SHORT, 3, 0}, - {CAP_M, UDATPG_MONTH_FIELD, DT_LONG, 4, 0}, - {CAP_M, UDATPG_MONTH_FIELD, DT_NARROW, 5, 0}, - {CAP_L, UDATPG_MONTH_FIELD, DT_NUMERIC + DT_DELTA, 1, 2}, - {CAP_L, UDATPG_MONTH_FIELD, DT_SHORT - DT_DELTA, 3, 0}, - {CAP_L, UDATPG_MONTH_FIELD, DT_LONG - DT_DELTA, 4, 0}, - {CAP_L, UDATPG_MONTH_FIELD, DT_NARROW - DT_DELTA, 5, 0}, - {LOW_L, UDATPG_MONTH_FIELD, DT_NUMERIC + DT_DELTA, 1, 1}, - - {LOW_W, UDATPG_WEEK_OF_YEAR_FIELD, DT_NUMERIC, 1, 2}, - - {CAP_W, UDATPG_WEEK_OF_MONTH_FIELD, DT_NUMERIC, 1, 0}, - - {CAP_E, UDATPG_WEEKDAY_FIELD, DT_SHORT, 1, 3}, - {CAP_E, UDATPG_WEEKDAY_FIELD, DT_LONG, 4, 0}, - {CAP_E, UDATPG_WEEKDAY_FIELD, DT_NARROW, 5, 0}, - {CAP_E, UDATPG_WEEKDAY_FIELD, DT_SHORTER, 6, 0}, - {LOW_C, UDATPG_WEEKDAY_FIELD, DT_NUMERIC + 2*DT_DELTA, 1, 2}, - {LOW_C, UDATPG_WEEKDAY_FIELD, DT_SHORT - 2*DT_DELTA, 3, 0}, - {LOW_C, UDATPG_WEEKDAY_FIELD, DT_LONG - 2*DT_DELTA, 4, 0}, - {LOW_C, UDATPG_WEEKDAY_FIELD, DT_NARROW - 2*DT_DELTA, 5, 0}, - {LOW_C, UDATPG_WEEKDAY_FIELD, DT_SHORTER - 2*DT_DELTA, 6, 0}, - {LOW_E, UDATPG_WEEKDAY_FIELD, DT_NUMERIC + DT_DELTA, 1, 2}, // LOW_E is currently not used in CLDR data, should not be canonical - {LOW_E, UDATPG_WEEKDAY_FIELD, DT_SHORT - DT_DELTA, 3, 0}, - {LOW_E, UDATPG_WEEKDAY_FIELD, DT_LONG - DT_DELTA, 4, 0}, - {LOW_E, UDATPG_WEEKDAY_FIELD, DT_NARROW - DT_DELTA, 5, 0}, - {LOW_E, UDATPG_WEEKDAY_FIELD, DT_SHORTER - DT_DELTA, 6, 0}, - - {LOW_D, UDATPG_DAY_FIELD, DT_NUMERIC, 1, 2}, - {LOW_G, UDATPG_DAY_FIELD, DT_NUMERIC + DT_DELTA, 1, 20}, // really internal use, so we don't care - - {CAP_D, UDATPG_DAY_OF_YEAR_FIELD, DT_NUMERIC, 1, 3}, - - {CAP_F, UDATPG_DAY_OF_WEEK_IN_MONTH_FIELD, DT_NUMERIC, 1, 0}, - - {LOW_A, UDATPG_DAYPERIOD_FIELD, DT_SHORT, 1, 3}, - {LOW_A, UDATPG_DAYPERIOD_FIELD, DT_LONG, 4, 0}, - {LOW_A, UDATPG_DAYPERIOD_FIELD, DT_NARROW, 5, 0}, - {LOW_B, UDATPG_DAYPERIOD_FIELD, DT_SHORT - DT_DELTA, 1, 3}, - {LOW_B, UDATPG_DAYPERIOD_FIELD, DT_LONG - DT_DELTA, 4, 0}, - {LOW_B, UDATPG_DAYPERIOD_FIELD, DT_NARROW - DT_DELTA, 5, 0}, - // b needs to be closer to a than to B, so we make this 3*DT_DELTA - {CAP_B, UDATPG_DAYPERIOD_FIELD, DT_SHORT - 3*DT_DELTA, 1, 3}, - {CAP_B, UDATPG_DAYPERIOD_FIELD, DT_LONG - 3*DT_DELTA, 4, 0}, - {CAP_B, UDATPG_DAYPERIOD_FIELD, DT_NARROW - 3*DT_DELTA, 5, 0}, - - {CAP_H, UDATPG_HOUR_FIELD, DT_NUMERIC + 10*DT_DELTA, 1, 2}, // 24 hour - {LOW_K, UDATPG_HOUR_FIELD, DT_NUMERIC + 11*DT_DELTA, 1, 2}, // 24 hour - {LOW_H, UDATPG_HOUR_FIELD, DT_NUMERIC, 1, 2}, // 12 hour - {CAP_K, UDATPG_HOUR_FIELD, DT_NUMERIC + DT_DELTA, 1, 2}, // 12 hour - // The C code has had versions of the following 3, keep & update. Should not need these, but... - // Without these, certain tests using e.g. staticGetSkeleton fail because j/J in patterns - // get skipped instead of mapped to the right hour chars, for example in - // DateFormatTest::TestPatternFromSkeleton - // IntlTestDateTimePatternGeneratorAPI:: testStaticGetSkeleton - // DateIntervalFormatTest::testTicket11985 - // Need to investigate better handling of jJC replacement e.g. in staticGetSkeleton. - {CAP_J, UDATPG_HOUR_FIELD, DT_NUMERIC + 5*DT_DELTA, 1, 2}, // 12/24 hour no AM/PM - {LOW_J, UDATPG_HOUR_FIELD, DT_NUMERIC + 6*DT_DELTA, 1, 6}, // 12/24 hour - {CAP_C, UDATPG_HOUR_FIELD, DT_NUMERIC + 7*DT_DELTA, 1, 6}, // 12/24 hour with preferred dayPeriods for 12 - - {LOW_M, UDATPG_MINUTE_FIELD, DT_NUMERIC, 1, 2}, - - {LOW_S, UDATPG_SECOND_FIELD, DT_NUMERIC, 1, 2}, - {CAP_A, UDATPG_SECOND_FIELD, DT_NUMERIC + DT_DELTA, 1, 1000}, - - {CAP_S, UDATPG_FRACTIONAL_SECOND_FIELD, DT_NUMERIC, 1, 1000}, - - {LOW_V, UDATPG_ZONE_FIELD, DT_SHORT - 2*DT_DELTA, 1, 0}, - {LOW_V, UDATPG_ZONE_FIELD, DT_LONG - 2*DT_DELTA, 4, 0}, - {LOW_Z, UDATPG_ZONE_FIELD, DT_SHORT, 1, 3}, - {LOW_Z, UDATPG_ZONE_FIELD, DT_LONG, 4, 0}, - {CAP_Z, UDATPG_ZONE_FIELD, DT_NARROW - DT_DELTA, 1, 3}, - {CAP_Z, UDATPG_ZONE_FIELD, DT_LONG - DT_DELTA, 4, 0}, - {CAP_Z, UDATPG_ZONE_FIELD, DT_SHORT - DT_DELTA, 5, 0}, - {CAP_O, UDATPG_ZONE_FIELD, DT_SHORT - DT_DELTA, 1, 0}, - {CAP_O, UDATPG_ZONE_FIELD, DT_LONG - DT_DELTA, 4, 0}, - {CAP_V, UDATPG_ZONE_FIELD, DT_SHORT - DT_DELTA, 1, 0}, - {CAP_V, UDATPG_ZONE_FIELD, DT_LONG - DT_DELTA, 2, 0}, - {CAP_V, UDATPG_ZONE_FIELD, DT_LONG-1 - DT_DELTA, 3, 0}, - {CAP_V, UDATPG_ZONE_FIELD, DT_LONG-2 - DT_DELTA, 4, 0}, - {CAP_X, UDATPG_ZONE_FIELD, DT_NARROW - DT_DELTA, 1, 0}, - {CAP_X, UDATPG_ZONE_FIELD, DT_SHORT - DT_DELTA, 2, 0}, - {CAP_X, UDATPG_ZONE_FIELD, DT_LONG - DT_DELTA, 4, 0}, - {LOW_X, UDATPG_ZONE_FIELD, DT_NARROW - DT_DELTA, 1, 0}, - {LOW_X, UDATPG_ZONE_FIELD, DT_SHORT - DT_DELTA, 2, 0}, - {LOW_X, UDATPG_ZONE_FIELD, DT_LONG - DT_DELTA, 4, 0}, - - {0, UDATPG_FIELD_COUNT, 0, 0, 0} , // last row of dtTypes[] - }; - -static const char* const CLDR_FIELD_APPEND[] = { - "Era", "Year", "Quarter", "Month", "Week", "*", "Day-Of-Week", - "*", "*", "Day", "*", // The UDATPG_x_FIELD constants and these fields have a different order than in ICU4J - "Hour", "Minute", "Second", "*", "Timezone" -}; - -static const char* const CLDR_FIELD_NAME[UDATPG_FIELD_COUNT] = { - "era", "year", "quarter", "month", "week", "weekOfMonth", "weekday", - "dayOfYear", "weekdayOfMonth", "day", "dayperiod", // The UDATPG_x_FIELD constants and these fields have a different order than in ICU4J - "hour", "minute", "second", "*", "zone" -}; - -static const char* const CLDR_FIELD_WIDTH[] = { // [UDATPG_WIDTH_COUNT] - "", "-short", "-narrow" -}; - -// TODO(ticket:13619): remove when definition uncommented in dtptngen.h. -static const int32_t UDATPG_WIDTH_COUNT = UDATPG_NARROW + 1; -static constexpr UDateTimePGDisplayWidth UDATPG_WIDTH_APPENDITEM = UDATPG_WIDE; -static constexpr int32_t UDATPG_FIELD_KEY_MAX = 24; // max length of CLDR field tag (type + width) - -// For appendItems -static const UChar UDATPG_ItemFormat[]= {0x7B, 0x30, 0x7D, 0x20, 0x251C, 0x7B, 0x32, 0x7D, 0x3A, - 0x20, 0x7B, 0x31, 0x7D, 0x2524, 0}; // {0} \u251C{2}: {1}\u2524 - -//static const UChar repeatedPatterns[6]={CAP_G, CAP_E, LOW_Z, LOW_V, CAP_Q, 0}; // "GEzvQ" - -static const char DT_DateTimePatternsTag[]="DateTimePatterns"; -static const char DT_DateTimeCalendarTag[]="calendar"; -static const char DT_DateTimeGregorianTag[]="gregorian"; -static const char DT_DateTimeAppendItemsTag[]="appendItems"; -static const char DT_DateTimeFieldsTag[]="fields"; -static const char DT_DateTimeAvailableFormatsTag[]="availableFormats"; -//static const UnicodeString repeatedPattern=UnicodeString(repeatedPatterns); - -UOBJECT_DEFINE_RTTI_IMPLEMENTATION(DateTimePatternGenerator) -UOBJECT_DEFINE_RTTI_IMPLEMENTATION(DTSkeletonEnumeration) -UOBJECT_DEFINE_RTTI_IMPLEMENTATION(DTRedundantEnumeration) - -DateTimePatternGenerator* U_EXPORT2 -DateTimePatternGenerator::createInstance(UErrorCode& status) { - return createInstance(Locale::getDefault(), status); -} - -DateTimePatternGenerator* U_EXPORT2 -DateTimePatternGenerator::createInstance(const Locale& locale, UErrorCode& status) { - if (U_FAILURE(status)) { - return nullptr; - } - LocalPointer<DateTimePatternGenerator> result( - new DateTimePatternGenerator(locale, status), status); - return U_SUCCESS(status) ? result.orphan() : nullptr; -} - -DateTimePatternGenerator* U_EXPORT2 -DateTimePatternGenerator::createEmptyInstance(UErrorCode& status) { - if (U_FAILURE(status)) { - return nullptr; - } - LocalPointer<DateTimePatternGenerator> result( - new DateTimePatternGenerator(status), status); - return U_SUCCESS(status) ? result.orphan() : nullptr; -} - -DateTimePatternGenerator::DateTimePatternGenerator(UErrorCode &status) : - skipMatcher(nullptr), - fAvailableFormatKeyHash(nullptr), - internalErrorCode(U_ZERO_ERROR) -{ - fp = new FormatParser(); - dtMatcher = new DateTimeMatcher(); - distanceInfo = new DistanceInfo(); - patternMap = new PatternMap(); - if (fp == nullptr || dtMatcher == nullptr || distanceInfo == nullptr || patternMap == nullptr) { - internalErrorCode = status = U_MEMORY_ALLOCATION_ERROR; - } -} - -DateTimePatternGenerator::DateTimePatternGenerator(const Locale& locale, UErrorCode &status) : - skipMatcher(nullptr), - fAvailableFormatKeyHash(nullptr), - internalErrorCode(U_ZERO_ERROR) -{ - fp = new FormatParser(); - dtMatcher = new DateTimeMatcher(); - distanceInfo = new DistanceInfo(); - patternMap = new PatternMap(); - if (fp == nullptr || dtMatcher == nullptr || distanceInfo == nullptr || patternMap == nullptr) { - internalErrorCode = status = U_MEMORY_ALLOCATION_ERROR; - } - else { - initData(locale, status); - } -} - -DateTimePatternGenerator::DateTimePatternGenerator(const DateTimePatternGenerator& other) : - UObject(), - skipMatcher(nullptr), - fAvailableFormatKeyHash(nullptr), - internalErrorCode(U_ZERO_ERROR) -{ - fp = new FormatParser(); - dtMatcher = new DateTimeMatcher(); - distanceInfo = new DistanceInfo(); - patternMap = new PatternMap(); - if (fp == nullptr || dtMatcher == nullptr || distanceInfo == nullptr || patternMap == nullptr) { - internalErrorCode = U_MEMORY_ALLOCATION_ERROR; - } - *this=other; -} - -DateTimePatternGenerator& -DateTimePatternGenerator::operator=(const DateTimePatternGenerator& other) { - // reflexive case - if (&other == this) { - return *this; - } - internalErrorCode = other.internalErrorCode; - pLocale = other.pLocale; - fDefaultHourFormatChar = other.fDefaultHourFormatChar; - *fp = *(other.fp); - dtMatcher->copyFrom(other.dtMatcher->skeleton); - *distanceInfo = *(other.distanceInfo); - dateTimeFormat = other.dateTimeFormat; - decimal = other.decimal; - // NUL-terminate for the C API. - dateTimeFormat.getTerminatedBuffer(); - decimal.getTerminatedBuffer(); - delete skipMatcher; - if ( other.skipMatcher == nullptr ) { - skipMatcher = nullptr; - } - else { - skipMatcher = new DateTimeMatcher(*other.skipMatcher); - if (skipMatcher == nullptr) - { - internalErrorCode = U_MEMORY_ALLOCATION_ERROR; - return *this; - } - } - for (int32_t i=0; i< UDATPG_FIELD_COUNT; ++i ) { - appendItemFormats[i] = other.appendItemFormats[i]; - appendItemFormats[i].getTerminatedBuffer(); // NUL-terminate for the C API. - for (int32_t j=0; j< UDATPG_WIDTH_COUNT; ++j ) { - fieldDisplayNames[i][j] = other.fieldDisplayNames[i][j]; - fieldDisplayNames[i][j].getTerminatedBuffer(); // NUL-terminate for the C API. - } - } - patternMap->copyFrom(*other.patternMap, internalErrorCode); - copyHashtable(other.fAvailableFormatKeyHash, internalErrorCode); - return *this; -} - - -UBool -DateTimePatternGenerator::operator==(const DateTimePatternGenerator& other) const { - if (this == &other) { - return TRUE; - } - if ((pLocale==other.pLocale) && (patternMap->equals(*other.patternMap)) && - (dateTimeFormat==other.dateTimeFormat) && (decimal==other.decimal)) { - for ( int32_t i=0 ; i<UDATPG_FIELD_COUNT; ++i ) { - if (appendItemFormats[i] != other.appendItemFormats[i]) { - return FALSE; - } - for (int32_t j=0; j< UDATPG_WIDTH_COUNT; ++j ) { - if (fieldDisplayNames[i][j] != other.fieldDisplayNames[i][j]) { - return FALSE; - } - } - } - return TRUE; - } - else { - return FALSE; - } -} - -UBool -DateTimePatternGenerator::operator!=(const DateTimePatternGenerator& other) const { - return !operator==(other); -} - -DateTimePatternGenerator::~DateTimePatternGenerator() { - if (fAvailableFormatKeyHash!=nullptr) { - delete fAvailableFormatKeyHash; - } - - if (fp != nullptr) delete fp; - if (dtMatcher != nullptr) delete dtMatcher; - if (distanceInfo != nullptr) delete distanceInfo; - if (patternMap != nullptr) delete patternMap; - if (skipMatcher != nullptr) delete skipMatcher; -} - -namespace { - -UInitOnce initOnce = U_INITONCE_INITIALIZER; -UHashtable *localeToAllowedHourFormatsMap = nullptr; - -// Value deleter for hashmap. -U_CFUNC void U_CALLCONV deleteAllowedHourFormats(void *ptr) { - uprv_free(ptr); -} - -// Close hashmap at cleanup. -U_CFUNC UBool U_CALLCONV allowedHourFormatsCleanup() { - uhash_close(localeToAllowedHourFormatsMap); - return TRUE; -} - -enum AllowedHourFormat{ - ALLOWED_HOUR_FORMAT_UNKNOWN = -1, - ALLOWED_HOUR_FORMAT_h, - ALLOWED_HOUR_FORMAT_H, - ALLOWED_HOUR_FORMAT_K, // Added ICU-20383, used by JP - ALLOWED_HOUR_FORMAT_k, // Added ICU-20383, not currently used - ALLOWED_HOUR_FORMAT_hb, - ALLOWED_HOUR_FORMAT_hB, - ALLOWED_HOUR_FORMAT_Kb, // Added ICU-20383, not currently used - ALLOWED_HOUR_FORMAT_KB, // Added ICU-20383, not currently used - // ICU-20383 The following are unlikely and not currently used - ALLOWED_HOUR_FORMAT_Hb, - ALLOWED_HOUR_FORMAT_HB -}; - -} // namespace - -void -DateTimePatternGenerator::initData(const Locale& locale, UErrorCode &status) { - //const char *baseLangName = locale.getBaseName(); // unused - - skipMatcher = nullptr; - fAvailableFormatKeyHash=nullptr; - addCanonicalItems(status); - addICUPatterns(locale, status); - addCLDRData(locale, status); - setDateTimeFromCalendar(locale, status); - setDecimalSymbols(locale, status); - umtx_initOnce(initOnce, loadAllowedHourFormatsData, status); - getAllowedHourFormats(locale, status); - // If any of the above methods failed then the object is in an invalid state. - internalErrorCode = status; -} // DateTimePatternGenerator::initData - -namespace { - -struct AllowedHourFormatsSink : public ResourceSink { - // Initialize sub-sinks. - AllowedHourFormatsSink() {} - virtual ~AllowedHourFormatsSink(); - - virtual void put(const char *key, ResourceValue &value, UBool /*noFallback*/, - UErrorCode &errorCode) { - ResourceTable timeData = value.getTable(errorCode); - if (U_FAILURE(errorCode)) { return; } - for (int32_t i = 0; timeData.getKeyAndValue(i, key, value); ++i) { - const char *regionOrLocale = key; - ResourceTable formatList = value.getTable(errorCode); - if (U_FAILURE(errorCode)) { return; } - // below we construct a list[] that has an entry for the "preferred" value at [0], - // followed by 1 or more entries for the "allowed" values, terminated with an - // entry for ALLOWED_HOUR_FORMAT_UNKNOWN (not included in length below) - LocalMemory<int32_t> list; - int32_t length = 0; - int32_t preferredFormat = ALLOWED_HOUR_FORMAT_UNKNOWN; - for (int32_t j = 0; formatList.getKeyAndValue(j, key, value); ++j) { - if (uprv_strcmp(key, "allowed") == 0) { - if (value.getType() == URES_STRING) { - length = 2; // 1 preferred to add later, 1 allowed to add now - if (list.allocateInsteadAndReset(length + 1) == nullptr) { - errorCode = U_MEMORY_ALLOCATION_ERROR; - return; - } - list[1] = getHourFormatFromUnicodeString(value.getUnicodeString(errorCode)); - } - else { - ResourceArray allowedFormats = value.getArray(errorCode); - length = allowedFormats.getSize() + 1; // 1 preferred, getSize allowed - if (list.allocateInsteadAndReset(length + 1) == nullptr) { - errorCode = U_MEMORY_ALLOCATION_ERROR; - return; - } - for (int32_t k = 1; k < length; ++k) { - allowedFormats.getValue(k-1, value); - list[k] = getHourFormatFromUnicodeString(value.getUnicodeString(errorCode)); - } - } - } else if (uprv_strcmp(key, "preferred") == 0) { - preferredFormat = getHourFormatFromUnicodeString(value.getUnicodeString(errorCode)); - } - } - if (length > 1) { - list[0] = (preferredFormat!=ALLOWED_HOUR_FORMAT_UNKNOWN)? preferredFormat: list[1]; - } else { - // fallback handling for missing data - length = 2; // 1 preferred, 1 allowed - if (list.allocateInsteadAndReset(length + 1) == nullptr) { - errorCode = U_MEMORY_ALLOCATION_ERROR; - return; - } - list[0] = (preferredFormat!=ALLOWED_HOUR_FORMAT_UNKNOWN)? preferredFormat: ALLOWED_HOUR_FORMAT_H; - list[1] = list[0]; - } - list[length] = ALLOWED_HOUR_FORMAT_UNKNOWN; - // At this point list[] will have at least two non-ALLOWED_HOUR_FORMAT_UNKNOWN entries, - // followed by ALLOWED_HOUR_FORMAT_UNKNOWN. - uhash_put(localeToAllowedHourFormatsMap, const_cast<char *>(regionOrLocale), list.orphan(), &errorCode); - if (U_FAILURE(errorCode)) { return; } - } - } - - AllowedHourFormat getHourFormatFromUnicodeString(const UnicodeString &s) { - if (s.length() == 1) { - if (s[0] == LOW_H) { return ALLOWED_HOUR_FORMAT_h; } - if (s[0] == CAP_H) { return ALLOWED_HOUR_FORMAT_H; } - if (s[0] == CAP_K) { return ALLOWED_HOUR_FORMAT_K; } - if (s[0] == LOW_K) { return ALLOWED_HOUR_FORMAT_k; } - } else if (s.length() == 2) { - if (s[0] == LOW_H && s[1] == LOW_B) { return ALLOWED_HOUR_FORMAT_hb; } - if (s[0] == LOW_H && s[1] == CAP_B) { return ALLOWED_HOUR_FORMAT_hB; } - if (s[0] == CAP_K && s[1] == LOW_B) { return ALLOWED_HOUR_FORMAT_Kb; } - if (s[0] == CAP_K && s[1] == CAP_B) { return ALLOWED_HOUR_FORMAT_KB; } - if (s[0] == CAP_H && s[1] == LOW_B) { return ALLOWED_HOUR_FORMAT_Hb; } - if (s[0] == CAP_H && s[1] == CAP_B) { return ALLOWED_HOUR_FORMAT_HB; } - } - - return ALLOWED_HOUR_FORMAT_UNKNOWN; - } -}; - -} // namespace - -AllowedHourFormatsSink::~AllowedHourFormatsSink() {} - -U_CFUNC void U_CALLCONV DateTimePatternGenerator::loadAllowedHourFormatsData(UErrorCode &status) { - if (U_FAILURE(status)) { return; } - localeToAllowedHourFormatsMap = uhash_open( - uhash_hashChars, uhash_compareChars, nullptr, &status); - if (U_FAILURE(status)) { return; } - - uhash_setValueDeleter(localeToAllowedHourFormatsMap, deleteAllowedHourFormats); - ucln_i18n_registerCleanup(UCLN_I18N_ALLOWED_HOUR_FORMATS, allowedHourFormatsCleanup); - - LocalUResourceBundlePointer rb(ures_openDirect(nullptr, "supplementalData", &status)); - if (U_FAILURE(status)) { return; } - - AllowedHourFormatsSink sink; - // TODO: Currently in the enumeration each table allocates a new array. - // Try to reduce the number of memory allocations. Consider storing a - // UVector32 with the concatenation of all of the sub-arrays, put the start index - // into the hashmap, store 6 single-value sub-arrays right at the beginning of the - // vector (at index enum*2) for easy data sharing, copy sub-arrays into runtime - // object. Remember to clean up the vector, too. - ures_getAllItemsWithFallback(rb.getAlias(), "timeData", sink, status); -} - -void DateTimePatternGenerator::getAllowedHourFormats(const Locale &locale, UErrorCode &status) { - if (U_FAILURE(status)) { return; } - Locale maxLocale(locale); - maxLocale.addLikelySubtags(status); - if (U_FAILURE(status)) { - return; - } - - const char *country = maxLocale.getCountry(); - if (*country == '\0') { country = "001"; } - const char *language = maxLocale.getLanguage(); - - CharString langCountry; - langCountry.append(language, static_cast<int32_t>(uprv_strlen(language)), status); - langCountry.append('_', status); - langCountry.append(country, static_cast<int32_t>(uprv_strlen(country)), status); - - int32_t *allowedFormats; - allowedFormats = (int32_t *)uhash_get(localeToAllowedHourFormatsMap, langCountry.data()); - if (allowedFormats == nullptr) { - allowedFormats = (int32_t *)uhash_get(localeToAllowedHourFormatsMap, const_cast<char *>(country)); - } - - if (allowedFormats != nullptr) { // Lookup is successful - // Here allowedFormats points to a list consisting of key for preferredFormat, - // followed by one or more keys for allowedFormats, then followed by ALLOWED_HOUR_FORMAT_UNKNOWN. - switch (allowedFormats[0]) { - case ALLOWED_HOUR_FORMAT_h: fDefaultHourFormatChar = LOW_H; break; - case ALLOWED_HOUR_FORMAT_H: fDefaultHourFormatChar = CAP_H; break; - case ALLOWED_HOUR_FORMAT_K: fDefaultHourFormatChar = CAP_K; break; - case ALLOWED_HOUR_FORMAT_k: fDefaultHourFormatChar = LOW_K; break; - default: fDefaultHourFormatChar = CAP_H; break; - } - for (int32_t i = 0; i < UPRV_LENGTHOF(fAllowedHourFormats); ++i) { - fAllowedHourFormats[i] = allowedFormats[i + 1]; - if (fAllowedHourFormats[i] == ALLOWED_HOUR_FORMAT_UNKNOWN) { - break; - } - } - } else { // Lookup failed, twice - fDefaultHourFormatChar = CAP_H; - fAllowedHourFormats[0] = ALLOWED_HOUR_FORMAT_H; - fAllowedHourFormats[1] = ALLOWED_HOUR_FORMAT_UNKNOWN; - } -} - -UnicodeString -DateTimePatternGenerator::getSkeleton(const UnicodeString& pattern, UErrorCode& -/*status*/) { - FormatParser fp2; - DateTimeMatcher matcher; - PtnSkeleton localSkeleton; - matcher.set(pattern, &fp2, localSkeleton); - return localSkeleton.getSkeleton(); -} - -UnicodeString -DateTimePatternGenerator::staticGetSkeleton( - const UnicodeString& pattern, UErrorCode& /*status*/) { - FormatParser fp; - DateTimeMatcher matcher; - PtnSkeleton localSkeleton; - matcher.set(pattern, &fp, localSkeleton); - return localSkeleton.getSkeleton(); -} - -UnicodeString -DateTimePatternGenerator::getBaseSkeleton(const UnicodeString& pattern, UErrorCode& /*status*/) { - FormatParser fp2; - DateTimeMatcher matcher; - PtnSkeleton localSkeleton; - matcher.set(pattern, &fp2, localSkeleton); - return localSkeleton.getBaseSkeleton(); -} - -UnicodeString -DateTimePatternGenerator::staticGetBaseSkeleton( - const UnicodeString& pattern, UErrorCode& /*status*/) { - FormatParser fp; - DateTimeMatcher matcher; - PtnSkeleton localSkeleton; - matcher.set(pattern, &fp, localSkeleton); - return localSkeleton.getBaseSkeleton(); -} - -void -DateTimePatternGenerator::addICUPatterns(const Locale& locale, UErrorCode& status) { - if (U_FAILURE(status)) { return; } - UnicodeString dfPattern; - UnicodeString conflictingString; - DateFormat* df; - - // Load with ICU patterns - for (int32_t i=DateFormat::kFull; i<=DateFormat::kShort; i++) { - DateFormat::EStyle style = (DateFormat::EStyle)i; - df = DateFormat::createDateInstance(style, locale); - SimpleDateFormat* sdf; - if (df != nullptr && (sdf = dynamic_cast<SimpleDateFormat*>(df)) != nullptr) { - sdf->toPattern(dfPattern); - addPattern(dfPattern, FALSE, conflictingString, status); - } - // TODO Maybe we should return an error when the date format isn't simple. - delete df; - if (U_FAILURE(status)) { return; } - - df = DateFormat::createTimeInstance(style, locale); - if (df != nullptr && (sdf = dynamic_cast<SimpleDateFormat*>(df)) != nullptr) { - sdf->toPattern(dfPattern); - addPattern(dfPattern, FALSE, conflictingString, status); - - // TODO: C++ and Java are inconsistent (see #12568). - // C++ uses MEDIUM, but Java uses SHORT. - if ( i==DateFormat::kShort && !dfPattern.isEmpty() ) { - consumeShortTimePattern(dfPattern, status); - } - } - // TODO Maybe we should return an error when the date format isn't simple. - delete df; - if (U_FAILURE(status)) { return; } - } -} - -void -DateTimePatternGenerator::hackTimes(const UnicodeString& hackPattern, UErrorCode& status) { - UnicodeString conflictingString; - - fp->set(hackPattern); - UnicodeString mmss; - UBool gotMm=FALSE; - for (int32_t i=0; i<fp->itemNumber; ++i) { - UnicodeString field = fp->items[i]; - if ( fp->isQuoteLiteral(field) ) { - if ( gotMm ) { - UnicodeString quoteLiteral; - fp->getQuoteLiteral(quoteLiteral, &i); - mmss += quoteLiteral; - } - } - else { - if (fp->isPatternSeparator(field) && gotMm) { - mmss+=field; - } - else { - UChar ch=field.charAt(0); - if (ch==LOW_M) { - gotMm=TRUE; - mmss+=field; - } - else { - if (ch==LOW_S) { - if (!gotMm) { - break; - } - mmss+= field; - addPattern(mmss, FALSE, conflictingString, status); - break; - } - else { - if (gotMm || ch==LOW_Z || ch==CAP_Z || ch==LOW_V || ch==CAP_V) { - break; - } - } - } - } - } - } -} - -#define ULOC_LOCALE_IDENTIFIER_CAPACITY (ULOC_FULLNAME_CAPACITY + 1 + ULOC_KEYWORD_AND_VALUES_CAPACITY) - -void -DateTimePatternGenerator::getCalendarTypeToUse(const Locale& locale, CharString& destination, UErrorCode& err) { - destination.clear().append(DT_DateTimeGregorianTag, -1, err); // initial default - if ( U_SUCCESS(err) ) { - UErrorCode localStatus = U_ZERO_ERROR; - char localeWithCalendarKey[ULOC_LOCALE_IDENTIFIER_CAPACITY]; - // obtain a locale that always has the calendar key value that should be used - ures_getFunctionalEquivalent( - localeWithCalendarKey, - ULOC_LOCALE_IDENTIFIER_CAPACITY, - nullptr, - "calendar", - "calendar", - locale.getName(), - nullptr, - FALSE, - &localStatus); - localeWithCalendarKey[ULOC_LOCALE_IDENTIFIER_CAPACITY-1] = 0; // ensure null termination - // now get the calendar key value from that locale - char calendarType[ULOC_KEYWORDS_CAPACITY]; - int32_t calendarTypeLen = uloc_getKeywordValue( - localeWithCalendarKey, - "calendar", - calendarType, - ULOC_KEYWORDS_CAPACITY, - &localStatus); - // If the input locale was invalid, don't fail with missing resource error, instead - // continue with default of Gregorian. - if (U_FAILURE(localStatus) && localStatus != U_MISSING_RESOURCE_ERROR) { - err = localStatus; - return; - } - if (calendarTypeLen < ULOC_KEYWORDS_CAPACITY) { - destination.clear().append(calendarType, -1, err); - if (U_FAILURE(err)) { return; } - } - } -} - -void -DateTimePatternGenerator::consumeShortTimePattern(const UnicodeString& shortTimePattern, - UErrorCode& status) { - if (U_FAILURE(status)) { return; } - // ICU-20383 No longer set fDefaultHourFormatChar to the hour format character from - // this pattern; instead it is set from localeToAllowedHourFormatsMap which now - // includes entries for both preferred and allowed formats. - - // HACK for hh:ss - hackTimes(shortTimePattern, status); -} - -struct DateTimePatternGenerator::AppendItemFormatsSink : public ResourceSink { - - // Destination for data, modified via setters. - DateTimePatternGenerator& dtpg; - - AppendItemFormatsSink(DateTimePatternGenerator& _dtpg) : dtpg(_dtpg) {} - virtual ~AppendItemFormatsSink(); - - virtual void put(const char *key, ResourceValue &value, UBool /*noFallback*/, - UErrorCode &errorCode) { - ResourceTable itemsTable = value.getTable(errorCode); - if (U_FAILURE(errorCode)) { return; } - for (int32_t i = 0; itemsTable.getKeyAndValue(i, key, value); ++i) { - UDateTimePatternField field = dtpg.getAppendFormatNumber(key); - if (field == UDATPG_FIELD_COUNT) { continue; } - const UnicodeString& valueStr = value.getUnicodeString(errorCode); - if (dtpg.getAppendItemFormat(field).isEmpty() && !valueStr.isEmpty()) { - dtpg.setAppendItemFormat(field, valueStr); - } - } - } - - void fillInMissing() { - UnicodeString defaultItemFormat(TRUE, UDATPG_ItemFormat, UPRV_LENGTHOF(UDATPG_ItemFormat)-1); // Read-only alias. - for (int32_t i = 0; i < UDATPG_FIELD_COUNT; i++) { - UDateTimePatternField field = (UDateTimePatternField)i; - if (dtpg.getAppendItemFormat(field).isEmpty()) { - dtpg.setAppendItemFormat(field, defaultItemFormat); - } - } - } -}; - -struct DateTimePatternGenerator::AppendItemNamesSink : public ResourceSink { - - // Destination for data, modified via setters. - DateTimePatternGenerator& dtpg; - - AppendItemNamesSink(DateTimePatternGenerator& _dtpg) : dtpg(_dtpg) {} - virtual ~AppendItemNamesSink(); - - virtual void put(const char *key, ResourceValue &value, UBool /*noFallback*/, - UErrorCode &errorCode) { - ResourceTable itemsTable = value.getTable(errorCode); - if (U_FAILURE(errorCode)) { return; } - for (int32_t i = 0; itemsTable.getKeyAndValue(i, key, value); ++i) { - UDateTimePGDisplayWidth width; - UDateTimePatternField field = dtpg.getFieldAndWidthIndices(key, &width); - if (field == UDATPG_FIELD_COUNT) { continue; } - ResourceTable detailsTable = value.getTable(errorCode); - if (U_FAILURE(errorCode)) { return; } - for (int32_t j = 0; detailsTable.getKeyAndValue(j, key, value); ++j) { - if (uprv_strcmp(key, "dn") != 0) { continue; } - const UnicodeString& valueStr = value.getUnicodeString(errorCode); - if (dtpg.getFieldDisplayName(field,width).isEmpty() && !valueStr.isEmpty()) { - dtpg.setFieldDisplayName(field,width,valueStr); - } - break; - } - } - } - - void fillInMissing() { - for (int32_t i = 0; i < UDATPG_FIELD_COUNT; i++) { - UnicodeString& valueStr = dtpg.getMutableFieldDisplayName((UDateTimePatternField)i, UDATPG_WIDE); - if (valueStr.isEmpty()) { - valueStr = CAP_F; - U_ASSERT(i < 20); - if (i < 10) { - // F0, F1, ..., F9 - valueStr += (UChar)(i+0x30); - } else { - // F10, F11, ... - valueStr += (UChar)0x31; - valueStr += (UChar)(i-10 + 0x30); - } - // NUL-terminate for the C API. - valueStr.getTerminatedBuffer(); - } - for (int32_t j = 1; j < UDATPG_WIDTH_COUNT; j++) { - UnicodeString& valueStr2 = dtpg.getMutableFieldDisplayName((UDateTimePatternField)i, (UDateTimePGDisplayWidth)j); - if (valueStr2.isEmpty()) { - valueStr2 = dtpg.getFieldDisplayName((UDateTimePatternField)i, (UDateTimePGDisplayWidth)(j-1)); - } - } - } - } -}; - -struct DateTimePatternGenerator::AvailableFormatsSink : public ResourceSink { - - // Destination for data, modified via setters. - DateTimePatternGenerator& dtpg; - - // Temporary variable, required for calling addPatternWithSkeleton. - UnicodeString conflictingPattern; - - AvailableFormatsSink(DateTimePatternGenerator& _dtpg) : dtpg(_dtpg) {} - virtual ~AvailableFormatsSink(); - - virtual void put(const char *key, ResourceValue &value, UBool isRoot, - UErrorCode &errorCode) { - ResourceTable itemsTable = value.getTable(errorCode); - if (U_FAILURE(errorCode)) { return; } - for (int32_t i = 0; itemsTable.getKeyAndValue(i, key, value); ++i) { - const UnicodeString formatKey(key, -1, US_INV); - if (!dtpg.isAvailableFormatSet(formatKey) ) { - dtpg.setAvailableFormat(formatKey, errorCode); - // Add pattern with its associated skeleton. Override any duplicate - // derived from std patterns, but not a previous availableFormats entry: - const UnicodeString& formatValue = value.getUnicodeString(errorCode); - conflictingPattern.remove(); - dtpg.addPatternWithSkeleton(formatValue, &formatKey, !isRoot, conflictingPattern, errorCode); - } - } - } -}; - -// Virtual destructors must be defined out of line. -DateTimePatternGenerator::AppendItemFormatsSink::~AppendItemFormatsSink() {} -DateTimePatternGenerator::AppendItemNamesSink::~AppendItemNamesSink() {} -DateTimePatternGenerator::AvailableFormatsSink::~AvailableFormatsSink() {} - -void -DateTimePatternGenerator::addCLDRData(const Locale& locale, UErrorCode& errorCode) { - if (U_FAILURE(errorCode)) { return; } - UnicodeString rbPattern, value, field; - CharString path; - - LocalUResourceBundlePointer rb(ures_open(nullptr, locale.getName(), &errorCode)); - if (U_FAILURE(errorCode)) { return; } - - CharString calendarTypeToUse; // to be filled in with the type to use, if all goes well - getCalendarTypeToUse(locale, calendarTypeToUse, errorCode); - if (U_FAILURE(errorCode)) { return; } - - // Local err to ignore resource not found exceptions - UErrorCode err = U_ZERO_ERROR; - - // Load append item formats. - AppendItemFormatsSink appendItemFormatsSink(*this); - path.clear() - .append(DT_DateTimeCalendarTag, errorCode) - .append('/', errorCode) - .append(calendarTypeToUse, errorCode) - .append('/', errorCode) - .append(DT_DateTimeAppendItemsTag, errorCode); // i.e., calendar/xxx/appendItems - if (U_FAILURE(errorCode)) { return; } - ures_getAllItemsWithFallback(rb.getAlias(), path.data(), appendItemFormatsSink, err); - appendItemFormatsSink.fillInMissing(); - - // Load CLDR item names. - err = U_ZERO_ERROR; - AppendItemNamesSink appendItemNamesSink(*this); - ures_getAllItemsWithFallback(rb.getAlias(), DT_DateTimeFieldsTag, appendItemNamesSink, err); - appendItemNamesSink.fillInMissing(); - - // Load the available formats from CLDR. - err = U_ZERO_ERROR; - initHashtable(errorCode); - if (U_FAILURE(errorCode)) { return; } - AvailableFormatsSink availableFormatsSink(*this); - path.clear() - .append(DT_DateTimeCalendarTag, errorCode) - .append('/', errorCode) - .append(calendarTypeToUse, errorCode) - .append('/', errorCode) - .append(DT_DateTimeAvailableFormatsTag, errorCode); // i.e., calendar/xxx/availableFormats - if (U_FAILURE(errorCode)) { return; } - ures_getAllItemsWithFallback(rb.getAlias(), path.data(), availableFormatsSink, err); -} - -void -DateTimePatternGenerator::initHashtable(UErrorCode& err) { - if (U_FAILURE(err)) { return; } - if (fAvailableFormatKeyHash!=nullptr) { - return; - } - LocalPointer<Hashtable> hash(new Hashtable(FALSE, err), err); - if (U_SUCCESS(err)) { - fAvailableFormatKeyHash = hash.orphan(); - } -} - -void -DateTimePatternGenerator::setAppendItemFormat(UDateTimePatternField field, const UnicodeString& value) { - appendItemFormats[field] = value; - // NUL-terminate for the C API. - appendItemFormats[field].getTerminatedBuffer(); -} - -const UnicodeString& -DateTimePatternGenerator::getAppendItemFormat(UDateTimePatternField field) const { - return appendItemFormats[field]; -} - -void -DateTimePatternGenerator::setAppendItemName(UDateTimePatternField field, const UnicodeString& value) { - setFieldDisplayName(field, UDATPG_WIDTH_APPENDITEM, value); -} - -const UnicodeString& -DateTimePatternGenerator::getAppendItemName(UDateTimePatternField field) const { - return fieldDisplayNames[field][UDATPG_WIDTH_APPENDITEM]; -} - -void -DateTimePatternGenerator::setFieldDisplayName(UDateTimePatternField field, UDateTimePGDisplayWidth width, const UnicodeString& value) { - fieldDisplayNames[field][width] = value; - // NUL-terminate for the C API. - fieldDisplayNames[field][width].getTerminatedBuffer(); -} - -UnicodeString -DateTimePatternGenerator::getFieldDisplayName(UDateTimePatternField field, UDateTimePGDisplayWidth width) const { - return fieldDisplayNames[field][width]; -} - -UnicodeString& -DateTimePatternGenerator::getMutableFieldDisplayName(UDateTimePatternField field, UDateTimePGDisplayWidth width) { - return fieldDisplayNames[field][width]; -} - -void -DateTimePatternGenerator::getAppendName(UDateTimePatternField field, UnicodeString& value) { - value = SINGLE_QUOTE; - value += fieldDisplayNames[field][UDATPG_WIDTH_APPENDITEM]; - value += SINGLE_QUOTE; -} - -UnicodeString -DateTimePatternGenerator::getBestPattern(const UnicodeString& patternForm, UErrorCode& status) { - return getBestPattern(patternForm, UDATPG_MATCH_NO_OPTIONS, status); -} - -UnicodeString -DateTimePatternGenerator::getBestPattern(const UnicodeString& patternForm, UDateTimePatternMatchOptions options, UErrorCode& status) { - if (U_FAILURE(status)) { - return UnicodeString(); - } - if (U_FAILURE(internalErrorCode)) { - status = internalErrorCode; - return UnicodeString(); - } - const UnicodeString *bestPattern = nullptr; - UnicodeString dtFormat; - UnicodeString resultPattern; - int32_t flags = kDTPGNoFlags; - - int32_t dateMask=(1<<UDATPG_DAYPERIOD_FIELD) - 1; - int32_t timeMask=(1<<UDATPG_FIELD_COUNT) - 1 - dateMask; - - // Replace hour metacharacters 'j', 'C' and 'J', set flags as necessary - UnicodeString patternFormMapped = mapSkeletonMetacharacters(patternForm, &flags, status); - if (U_FAILURE(status)) { - return UnicodeString(); - } - - resultPattern.remove(); - dtMatcher->set(patternFormMapped, fp); - const PtnSkeleton* specifiedSkeleton = nullptr; - bestPattern=getBestRaw(*dtMatcher, -1, distanceInfo, status, &specifiedSkeleton); - if (U_FAILURE(status)) { - return UnicodeString(); - } - - if ( distanceInfo->missingFieldMask==0 && distanceInfo->extraFieldMask==0 ) { - resultPattern = adjustFieldTypes(*bestPattern, specifiedSkeleton, flags, options); - - return resultPattern; - } - int32_t neededFields = dtMatcher->getFieldMask(); - UnicodeString datePattern=getBestAppending(neededFields & dateMask, flags, status, options); - UnicodeString timePattern=getBestAppending(neededFields & timeMask, flags, status, options); - if (U_FAILURE(status)) { - return UnicodeString(); - } - if (datePattern.length()==0) { - if (timePattern.length()==0) { - resultPattern.remove(); - } - else { - return timePattern; - } - } - if (timePattern.length()==0) { - return datePattern; - } - resultPattern.remove(); - status = U_ZERO_ERROR; - dtFormat=getDateTimeFormat(); - SimpleFormatter(dtFormat, 2, 2, status).format(timePattern, datePattern, resultPattern, status); - return resultPattern; -} - -/* - * Map a skeleton that may have metacharacters jJC to one without, by replacing - * the metacharacters with locale-appropriate fields of h/H/k/K and of a/b/B - * (depends on fDefaultHourFormatChar and fAllowedHourFormats being set, which in - * turn depends on initData having been run). This method also updates the flags - * as necessary. Returns the updated skeleton. - */ -UnicodeString -DateTimePatternGenerator::mapSkeletonMetacharacters(const UnicodeString& patternForm, int32_t* flags, UErrorCode& status) { - UnicodeString patternFormMapped; - patternFormMapped.remove(); - UBool inQuoted = FALSE; - int32_t patPos, patLen = patternForm.length(); - for (patPos = 0; patPos < patLen; patPos++) { - UChar patChr = patternForm.charAt(patPos); - if (patChr == SINGLE_QUOTE) { - inQuoted = !inQuoted; - } else if (!inQuoted) { - // Handle special mappings for 'j' and 'C' in which fields lengths - // 1,3,5 => hour field length 1 - // 2,4,6 => hour field length 2 - // 1,2 => abbreviated dayPeriod (field length 1..3) - // 3,4 => long dayPeriod (field length 4) - // 5,6 => narrow dayPeriod (field length 5) - if (patChr == LOW_J || patChr == CAP_C) { - int32_t extraLen = 0; // 1 less than total field length - while (patPos+1 < patLen && patternForm.charAt(patPos+1)==patChr) { - extraLen++; - patPos++; - } - int32_t hourLen = 1 + (extraLen & 1); - int32_t dayPeriodLen = (extraLen < 2)? 1: 3 + (extraLen >> 1); - UChar hourChar = LOW_H; - UChar dayPeriodChar = LOW_A; - if (patChr == LOW_J) { - hourChar = fDefaultHourFormatChar; - } else { - AllowedHourFormat bestAllowed; - if (fAllowedHourFormats[0] != ALLOWED_HOUR_FORMAT_UNKNOWN) { - bestAllowed = (AllowedHourFormat)fAllowedHourFormats[0]; - } else { - status = U_INVALID_FORMAT_ERROR; - return UnicodeString(); - } - if (bestAllowed == ALLOWED_HOUR_FORMAT_H || bestAllowed == ALLOWED_HOUR_FORMAT_HB || bestAllowed == ALLOWED_HOUR_FORMAT_Hb) { - hourChar = CAP_H; - } else if (bestAllowed == ALLOWED_HOUR_FORMAT_K || bestAllowed == ALLOWED_HOUR_FORMAT_KB || bestAllowed == ALLOWED_HOUR_FORMAT_Kb) { - hourChar = CAP_K; - } else if (bestAllowed == ALLOWED_HOUR_FORMAT_k) { - hourChar = LOW_K; - } - // in #13183 just add b/B to skeleton, no longer need to set special flags - if (bestAllowed == ALLOWED_HOUR_FORMAT_HB || bestAllowed == ALLOWED_HOUR_FORMAT_hB || bestAllowed == ALLOWED_HOUR_FORMAT_KB) { - dayPeriodChar = CAP_B; - } else if (bestAllowed == ALLOWED_HOUR_FORMAT_Hb || bestAllowed == ALLOWED_HOUR_FORMAT_hb || bestAllowed == ALLOWED_HOUR_FORMAT_Kb) { - dayPeriodChar = LOW_B; - } - } - if (hourChar==CAP_H || hourChar==LOW_K) { - dayPeriodLen = 0; - } - while (dayPeriodLen-- > 0) { - patternFormMapped.append(dayPeriodChar); - } - while (hourLen-- > 0) { - patternFormMapped.append(hourChar); - } - } else if (patChr == CAP_J) { - // Get pattern for skeleton with H, then replace H or k - // with fDefaultHourFormatChar (if different) - patternFormMapped.append(CAP_H); - *flags |= kDTPGSkeletonUsesCapJ; - } else { - patternFormMapped.append(patChr); - } - } - } - return patternFormMapped; -} - -UnicodeString -DateTimePatternGenerator::replaceFieldTypes(const UnicodeString& pattern, - const UnicodeString& skeleton, - UErrorCode& status) { - return replaceFieldTypes(pattern, skeleton, UDATPG_MATCH_NO_OPTIONS, status); -} - -UnicodeString -DateTimePatternGenerator::replaceFieldTypes(const UnicodeString& pattern, - const UnicodeString& skeleton, - UDateTimePatternMatchOptions options, - UErrorCode& status) { - if (U_FAILURE(status)) { - return UnicodeString(); - } - if (U_FAILURE(internalErrorCode)) { - status = internalErrorCode; - return UnicodeString(); - } - dtMatcher->set(skeleton, fp); - UnicodeString result = adjustFieldTypes(pattern, nullptr, kDTPGNoFlags, options); - return result; -} - -void -DateTimePatternGenerator::setDecimal(const UnicodeString& newDecimal) { - this->decimal = newDecimal; - // NUL-terminate for the C API. - this->decimal.getTerminatedBuffer(); -} - -const UnicodeString& -DateTimePatternGenerator::getDecimal() const { - return decimal; -} - -void -DateTimePatternGenerator::addCanonicalItems(UErrorCode& status) { - if (U_FAILURE(status)) { return; } - UnicodeString conflictingPattern; - - for (int32_t i=0; i<UDATPG_FIELD_COUNT; i++) { - if (Canonical_Items[i] > 0) { - addPattern(UnicodeString(Canonical_Items[i]), FALSE, conflictingPattern, status); - } - if (U_FAILURE(status)) { return; } - } -} - -void -DateTimePatternGenerator::setDateTimeFormat(const UnicodeString& dtFormat) { - dateTimeFormat = dtFormat; - // NUL-terminate for the C API. - dateTimeFormat.getTerminatedBuffer(); -} - -const UnicodeString& -DateTimePatternGenerator::getDateTimeFormat() const { - return dateTimeFormat; -} - -void -DateTimePatternGenerator::setDateTimeFromCalendar(const Locale& locale, UErrorCode& status) { - if (U_FAILURE(status)) { return; } - - const UChar *resStr; - int32_t resStrLen = 0; - - LocalPointer<Calendar> fCalendar(Calendar::createInstance(locale, status), status); - if (U_FAILURE(status)) { return; } - - LocalUResourceBundlePointer calData(ures_open(nullptr, locale.getBaseName(), &status)); - if (U_FAILURE(status)) { return; } - ures_getByKey(calData.getAlias(), DT_DateTimeCalendarTag, calData.getAlias(), &status); - if (U_FAILURE(status)) { return; } - - LocalUResourceBundlePointer dateTimePatterns; - if (fCalendar->getType() != nullptr && *fCalendar->getType() != '\0' - && uprv_strcmp(fCalendar->getType(), DT_DateTimeGregorianTag) != 0) { - dateTimePatterns.adoptInstead(ures_getByKeyWithFallback(calData.getAlias(), fCalendar->getType(), - nullptr, &status)); - ures_getByKeyWithFallback(dateTimePatterns.getAlias(), DT_DateTimePatternsTag, - dateTimePatterns.getAlias(), &status); - } - - if (dateTimePatterns.isNull() || status == U_MISSING_RESOURCE_ERROR) { - status = U_ZERO_ERROR; - dateTimePatterns.adoptInstead(ures_getByKeyWithFallback(calData.getAlias(), DT_DateTimeGregorianTag, - dateTimePatterns.orphan(), &status)); - ures_getByKeyWithFallback(dateTimePatterns.getAlias(), DT_DateTimePatternsTag, - dateTimePatterns.getAlias(), &status); - } - if (U_FAILURE(status)) { return; } - - if (ures_getSize(dateTimePatterns.getAlias()) <= DateFormat::kDateTime) - { - status = U_INVALID_FORMAT_ERROR; - return; - } - resStr = ures_getStringByIndex(dateTimePatterns.getAlias(), (int32_t)DateFormat::kDateTime, &resStrLen, &status); - setDateTimeFormat(UnicodeString(TRUE, resStr, resStrLen)); -} - -void -DateTimePatternGenerator::setDecimalSymbols(const Locale& locale, UErrorCode& status) { - DecimalFormatSymbols dfs = DecimalFormatSymbols(locale, status); - if(U_SUCCESS(status)) { - decimal = dfs.getSymbol(DecimalFormatSymbols::kDecimalSeparatorSymbol); - // NUL-terminate for the C API. - decimal.getTerminatedBuffer(); - } -} - -UDateTimePatternConflict -DateTimePatternGenerator::addPattern( - const UnicodeString& pattern, - UBool override, - UnicodeString &conflictingPattern, - UErrorCode& status) -{ - if (U_FAILURE(internalErrorCode)) { - status = internalErrorCode; - return UDATPG_NO_CONFLICT; - } - - return addPatternWithSkeleton(pattern, nullptr, override, conflictingPattern, status); -} - -// For DateTimePatternGenerator::addPatternWithSkeleton - -// If skeletonToUse is specified, then an availableFormats entry is being added. In this case: -// 1. We pass that skeleton to matcher.set instead of having it derive a skeleton from the pattern. -// 2. If the new entry's skeleton or basePattern does match an existing entry but that entry also had a skeleton specified -// (i.e. it was also from availableFormats), then the new entry does not override it regardless of the value of the override -// parameter. This prevents later availableFormats entries from a parent locale overriding earlier ones from the actual -// specified locale. However, availableFormats entries *should* override entries with matching skeleton whose skeleton was -// derived (i.e. entries derived from the standard date/time patters for the specified locale). -// 3. When adding the pattern (patternMap->add), we set a new boolean to indicate that the added entry had a -// specified skeleton (which sets a new field in the PtnElem in the PatternMap). -UDateTimePatternConflict -DateTimePatternGenerator::addPatternWithSkeleton( - const UnicodeString& pattern, - const UnicodeString* skeletonToUse, - UBool override, - UnicodeString& conflictingPattern, - UErrorCode& status) -{ - if (U_FAILURE(internalErrorCode)) { - status = internalErrorCode; - return UDATPG_NO_CONFLICT; - } - - UnicodeString basePattern; - PtnSkeleton skeleton; - UDateTimePatternConflict conflictingStatus = UDATPG_NO_CONFLICT; - - DateTimeMatcher matcher; - if ( skeletonToUse == nullptr ) { - matcher.set(pattern, fp, skeleton); - matcher.getBasePattern(basePattern); - } else { - matcher.set(*skeletonToUse, fp, skeleton); // no longer trims skeleton fields to max len 3, per #7930 - matcher.getBasePattern(basePattern); // or perhaps instead: basePattern = *skeletonToUse; - } - // We only care about base conflicts - and replacing the pattern associated with a base - if: - // 1. the conflicting previous base pattern did *not* have an explicit skeleton; in that case the previous - // base + pattern combination was derived from either (a) a canonical item, (b) a standard format, or - // (c) a pattern specified programmatically with a previous call to addPattern (which would only happen - // if we are getting here from a subsequent call to addPattern). - // 2. a skeleton is specified for the current pattern, but override=false; in that case we are checking - // availableFormats items from root, which should not override any previous entry with the same base. - UBool entryHadSpecifiedSkeleton; - const UnicodeString *duplicatePattern = patternMap->getPatternFromBasePattern(basePattern, entryHadSpecifiedSkeleton); - if (duplicatePattern != nullptr && (!entryHadSpecifiedSkeleton || (skeletonToUse != nullptr && !override))) { - conflictingStatus = UDATPG_BASE_CONFLICT; - conflictingPattern = *duplicatePattern; - if (!override) { - return conflictingStatus; - } - } - // The only time we get here with override=true and skeletonToUse!=null is when adding availableFormats - // items from CLDR data. In that case, we don't want an item from a parent locale to replace an item with - // same skeleton from the specified locale, so skip the current item if skeletonWasSpecified is true for - // the previously-specified conflicting item. - const PtnSkeleton* entrySpecifiedSkeleton = nullptr; - duplicatePattern = patternMap->getPatternFromSkeleton(skeleton, &entrySpecifiedSkeleton); - if (duplicatePattern != nullptr ) { - conflictingStatus = UDATPG_CONFLICT; - conflictingPattern = *duplicatePattern; - if (!override || (skeletonToUse != nullptr && entrySpecifiedSkeleton != nullptr)) { - return conflictingStatus; - } - } - patternMap->add(basePattern, skeleton, pattern, skeletonToUse != nullptr, status); - if(U_FAILURE(status)) { - return conflictingStatus; - } - - return UDATPG_NO_CONFLICT; -} - - -UDateTimePatternField -DateTimePatternGenerator::getAppendFormatNumber(const char* field) const { - for (int32_t i=0; i<UDATPG_FIELD_COUNT; ++i ) { - if (uprv_strcmp(CLDR_FIELD_APPEND[i], field)==0) { - return (UDateTimePatternField)i; - } - } - return UDATPG_FIELD_COUNT; -} - -UDateTimePatternField -DateTimePatternGenerator::getFieldAndWidthIndices(const char* key, UDateTimePGDisplayWidth* widthP) const { - char cldrFieldKey[UDATPG_FIELD_KEY_MAX + 1]; - uprv_strncpy(cldrFieldKey, key, UDATPG_FIELD_KEY_MAX); - cldrFieldKey[UDATPG_FIELD_KEY_MAX]=0; // ensure termination - *widthP = UDATPG_WIDE; - char* hyphenPtr = uprv_strchr(cldrFieldKey, '-'); - if (hyphenPtr) { - for (int32_t i=UDATPG_WIDTH_COUNT-1; i>0; --i) { - if (uprv_strcmp(CLDR_FIELD_WIDTH[i], hyphenPtr)==0) { - *widthP=(UDateTimePGDisplayWidth)i; - break; - } - } - *hyphenPtr = 0; // now delete width portion of key - } - for (int32_t i=0; i<UDATPG_FIELD_COUNT; ++i ) { - if (uprv_strcmp(CLDR_FIELD_NAME[i],cldrFieldKey)==0) { - return (UDateTimePatternField)i; - } - } - return UDATPG_FIELD_COUNT; -} - -const UnicodeString* -DateTimePatternGenerator::getBestRaw(DateTimeMatcher& source, - int32_t includeMask, - DistanceInfo* missingFields, - UErrorCode &status, - const PtnSkeleton** specifiedSkeletonPtr) { - int32_t bestDistance = 0x7fffffff; - DistanceInfo tempInfo; - const UnicodeString *bestPattern=nullptr; - const PtnSkeleton* specifiedSkeleton=nullptr; - - PatternMapIterator it(status); - if (U_FAILURE(status)) { return nullptr; } - - for (it.set(*patternMap); it.hasNext(); ) { - DateTimeMatcher trial = it.next(); - if (trial.equals(skipMatcher)) { - continue; - } - int32_t distance=source.getDistance(trial, includeMask, tempInfo); - if (distance<bestDistance) { - bestDistance=distance; - bestPattern=patternMap->getPatternFromSkeleton(*trial.getSkeletonPtr(), &specifiedSkeleton); - missingFields->setTo(tempInfo); - if (distance==0) { - break; - } - } - } - - // If the best raw match had a specified skeleton and that skeleton was requested by the caller, - // then return it too. This generally happens when the caller needs to pass that skeleton - // through to adjustFieldTypes so the latter can do a better job. - if (bestPattern && specifiedSkeletonPtr) { - *specifiedSkeletonPtr = specifiedSkeleton; - } - return bestPattern; -} - -UnicodeString -DateTimePatternGenerator::adjustFieldTypes(const UnicodeString& pattern, - const PtnSkeleton* specifiedSkeleton, - int32_t flags, - UDateTimePatternMatchOptions options) { - UnicodeString newPattern; - fp->set(pattern); - for (int32_t i=0; i < fp->itemNumber; i++) { - UnicodeString field = fp->items[i]; - if ( fp->isQuoteLiteral(field) ) { - - UnicodeString quoteLiteral; - fp->getQuoteLiteral(quoteLiteral, &i); - newPattern += quoteLiteral; - } - else { - if (fp->isPatternSeparator(field)) { - newPattern+=field; - continue; - } - int32_t canonicalIndex = fp->getCanonicalIndex(field); - if (canonicalIndex < 0) { - newPattern+=field; - continue; // don't adjust - } - const dtTypeElem *row = &dtTypes[canonicalIndex]; - int32_t typeValue = row->field; - - // handle day periods - with #13183, no longer need special handling here, integrated with normal types - - if ((flags & kDTPGFixFractionalSeconds) != 0 && typeValue == UDATPG_SECOND_FIELD) { - field += decimal; - dtMatcher->skeleton.original.appendFieldTo(UDATPG_FRACTIONAL_SECOND_FIELD, field); - } else if (dtMatcher->skeleton.type[typeValue]!=0) { - // Here: - // - "reqField" is the field from the originally requested skeleton, with length - // "reqFieldLen". - // - "field" is the field from the found pattern. - // - // The adjusted field should consist of characters from the originally requested - // skeleton, except in the case of UDATPG_HOUR_FIELD or UDATPG_MONTH_FIELD or - // UDATPG_WEEKDAY_FIELD or UDATPG_YEAR_FIELD, in which case it should consist - // of characters from the found pattern. - // - // The length of the adjusted field (adjFieldLen) should match that in the originally - // requested skeleton, except that in the following cases the length of the adjusted field - // should match that in the found pattern (i.e. the length of this pattern field should - // not be adjusted): - // 1. typeValue is UDATPG_HOUR_FIELD/MINUTE/SECOND and the corresponding bit in options is - // not set (ticket #7180). Note, we may want to implement a similar change for other - // numeric fields (MM, dd, etc.) so the default behavior is to get locale preference for - // field length, but options bits can be used to override this. - // 2. There is a specified skeleton for the found pattern and one of the following is true: - // a) The length of the field in the skeleton (skelFieldLen) is equal to reqFieldLen. - // b) The pattern field is numeric and the skeleton field is not, or vice versa. - - UChar reqFieldChar = dtMatcher->skeleton.original.getFieldChar(typeValue); - int32_t reqFieldLen = dtMatcher->skeleton.original.getFieldLength(typeValue); - if (reqFieldChar == CAP_E && reqFieldLen < 3) - reqFieldLen = 3; // 1-3 for E are equivalent to 3 for c,e - int32_t adjFieldLen = reqFieldLen; - if ( (typeValue==UDATPG_HOUR_FIELD && (options & UDATPG_MATCH_HOUR_FIELD_LENGTH)==0) || - (typeValue==UDATPG_MINUTE_FIELD && (options & UDATPG_MATCH_MINUTE_FIELD_LENGTH)==0) || - (typeValue==UDATPG_SECOND_FIELD && (options & UDATPG_MATCH_SECOND_FIELD_LENGTH)==0) ) { - adjFieldLen = field.length(); - } else if (specifiedSkeleton) { - int32_t skelFieldLen = specifiedSkeleton->original.getFieldLength(typeValue); - UBool patFieldIsNumeric = (row->type > 0); - UBool skelFieldIsNumeric = (specifiedSkeleton->type[typeValue] > 0); - if (skelFieldLen == reqFieldLen || (patFieldIsNumeric && !skelFieldIsNumeric) || (skelFieldIsNumeric && !patFieldIsNumeric)) { - // don't adjust the field length in the found pattern - adjFieldLen = field.length(); - } - } - UChar c = (typeValue!= UDATPG_HOUR_FIELD - && typeValue!= UDATPG_MONTH_FIELD - && typeValue!= UDATPG_WEEKDAY_FIELD - && (typeValue!= UDATPG_YEAR_FIELD || reqFieldChar==CAP_Y)) - ? reqFieldChar - : field.charAt(0); - if (typeValue == UDATPG_HOUR_FIELD && (flags & kDTPGSkeletonUsesCapJ) != 0) { - c = fDefaultHourFormatChar; - } - field.remove(); - for (int32_t j=adjFieldLen; j>0; --j) { - field += c; - } - } - newPattern+=field; - } - } - return newPattern; -} - -UnicodeString -DateTimePatternGenerator::getBestAppending(int32_t missingFields, int32_t flags, UErrorCode &status, UDateTimePatternMatchOptions options) { - if (U_FAILURE(status)) { - return UnicodeString(); - } - UnicodeString resultPattern, tempPattern; - const UnicodeString* tempPatternPtr; - int32_t lastMissingFieldMask=0; - if (missingFields!=0) { - resultPattern=UnicodeString(); - const PtnSkeleton* specifiedSkeleton=nullptr; - tempPatternPtr = getBestRaw(*dtMatcher, missingFields, distanceInfo, status, &specifiedSkeleton); - if (U_FAILURE(status)) { - return UnicodeString(); - } - tempPattern = *tempPatternPtr; - resultPattern = adjustFieldTypes(tempPattern, specifiedSkeleton, flags, options); - if ( distanceInfo->missingFieldMask==0 ) { - return resultPattern; - } - while (distanceInfo->missingFieldMask!=0) { // precondition: EVERY single field must work! - if ( lastMissingFieldMask == distanceInfo->missingFieldMask ) { - break; // cannot find the proper missing field - } - if (((distanceInfo->missingFieldMask & UDATPG_SECOND_AND_FRACTIONAL_MASK)==UDATPG_FRACTIONAL_MASK) && - ((missingFields & UDATPG_SECOND_AND_FRACTIONAL_MASK) == UDATPG_SECOND_AND_FRACTIONAL_MASK)) { - resultPattern = adjustFieldTypes(resultPattern, specifiedSkeleton, flags | kDTPGFixFractionalSeconds, options); - distanceInfo->missingFieldMask &= ~UDATPG_FRACTIONAL_MASK; - continue; - } - int32_t startingMask = distanceInfo->missingFieldMask; - tempPatternPtr = getBestRaw(*dtMatcher, distanceInfo->missingFieldMask, distanceInfo, status, &specifiedSkeleton); - if (U_FAILURE(status)) { - return UnicodeString(); - } - tempPattern = *tempPatternPtr; - tempPattern = adjustFieldTypes(tempPattern, specifiedSkeleton, flags, options); - int32_t foundMask=startingMask& ~distanceInfo->missingFieldMask; - int32_t topField=getTopBitNumber(foundMask); - - if (appendItemFormats[topField].length() != 0) { - UnicodeString appendName; - getAppendName((UDateTimePatternField)topField, appendName); - const UnicodeString *values[3] = { - &resultPattern, - &tempPattern, - &appendName - }; - SimpleFormatter(appendItemFormats[topField], 2, 3, status). - formatAndReplace(values, 3, resultPattern, nullptr, 0, status); - } - lastMissingFieldMask = distanceInfo->missingFieldMask; - } - } - return resultPattern; -} - -int32_t -DateTimePatternGenerator::getTopBitNumber(int32_t foundMask) const { - if ( foundMask==0 ) { - return 0; - } - int32_t i=0; - while (foundMask!=0) { - foundMask >>=1; - ++i; - } - if (i-1 >UDATPG_ZONE_FIELD) { - return UDATPG_ZONE_FIELD; - } - else - return i-1; -} - -void -DateTimePatternGenerator::setAvailableFormat(const UnicodeString &key, UErrorCode& err) -{ - fAvailableFormatKeyHash->puti(key, 1, err); -} - -UBool -DateTimePatternGenerator::isAvailableFormatSet(const UnicodeString &key) const { - return (UBool)(fAvailableFormatKeyHash->geti(key) == 1); -} - -void -DateTimePatternGenerator::copyHashtable(Hashtable *other, UErrorCode &status) { - if (other == nullptr || U_FAILURE(status)) { - return; - } - if (fAvailableFormatKeyHash != nullptr) { - delete fAvailableFormatKeyHash; - fAvailableFormatKeyHash = nullptr; - } - initHashtable(status); - if(U_FAILURE(status)){ - return; - } - int32_t pos = UHASH_FIRST; - const UHashElement* elem = nullptr; - // walk through the hash table and create a deep clone - while((elem = other->nextElement(pos))!= nullptr){ - const UHashTok otherKeyTok = elem->key; - UnicodeString* otherKey = (UnicodeString*)otherKeyTok.pointer; - fAvailableFormatKeyHash->puti(*otherKey, 1, status); - if(U_FAILURE(status)){ - return; - } - } -} - -StringEnumeration* -DateTimePatternGenerator::getSkeletons(UErrorCode& status) const { - if (U_FAILURE(status)) { - return nullptr; - } - if (U_FAILURE(internalErrorCode)) { - status = internalErrorCode; - return nullptr; - } - LocalPointer<StringEnumeration> skeletonEnumerator( - new DTSkeletonEnumeration(*patternMap, DT_SKELETON, status), status); - - return U_SUCCESS(status) ? skeletonEnumerator.orphan() : nullptr; -} - -const UnicodeString& -DateTimePatternGenerator::getPatternForSkeleton(const UnicodeString& skeleton) const { - PtnElem *curElem; - - if (skeleton.length() ==0) { - return emptyString; - } - curElem = patternMap->getHeader(skeleton.charAt(0)); - while ( curElem != nullptr ) { - if ( curElem->skeleton->getSkeleton()==skeleton ) { - return curElem->pattern; - } - curElem = curElem->next.getAlias(); - } - return emptyString; -} - -StringEnumeration* -DateTimePatternGenerator::getBaseSkeletons(UErrorCode& status) const { - if (U_FAILURE(status)) { - return nullptr; - } - if (U_FAILURE(internalErrorCode)) { - status = internalErrorCode; - return nullptr; - } - LocalPointer<StringEnumeration> baseSkeletonEnumerator( - new DTSkeletonEnumeration(*patternMap, DT_BASESKELETON, status), status); - - return U_SUCCESS(status) ? baseSkeletonEnumerator.orphan() : nullptr; -} - -StringEnumeration* -DateTimePatternGenerator::getRedundants(UErrorCode& status) { - if (U_FAILURE(status)) { return nullptr; } - if (U_FAILURE(internalErrorCode)) { - status = internalErrorCode; - return nullptr; - } - LocalPointer<StringEnumeration> output(new DTRedundantEnumeration(), status); - if (U_FAILURE(status)) { return nullptr; } - const UnicodeString *pattern; - PatternMapIterator it(status); - if (U_FAILURE(status)) { return nullptr; } - - for (it.set(*patternMap); it.hasNext(); ) { - DateTimeMatcher current = it.next(); - pattern = patternMap->getPatternFromSkeleton(*(it.getSkeleton())); - if ( isCanonicalItem(*pattern) ) { - continue; - } - if ( skipMatcher == nullptr ) { - skipMatcher = new DateTimeMatcher(current); - if (skipMatcher == nullptr) { - status = U_MEMORY_ALLOCATION_ERROR; - return nullptr; - } - } - else { - *skipMatcher = current; - } - UnicodeString trial = getBestPattern(current.getPattern(), status); - if (U_FAILURE(status)) { return nullptr; } - if (trial == *pattern) { - ((DTRedundantEnumeration *)output.getAlias())->add(*pattern, status); - if (U_FAILURE(status)) { return nullptr; } - } - if (current.equals(skipMatcher)) { - continue; - } - } - return output.orphan(); -} - -UBool -DateTimePatternGenerator::isCanonicalItem(const UnicodeString& item) const { - if ( item.length() != 1 ) { - return FALSE; - } - for (int32_t i=0; i<UDATPG_FIELD_COUNT; ++i) { - if (item.charAt(0)==Canonical_Items[i]) { - return TRUE; - } - } - return FALSE; -} - - -DateTimePatternGenerator* -DateTimePatternGenerator::clone() const { - return new DateTimePatternGenerator(*this); -} - -PatternMap::PatternMap() { - for (int32_t i=0; i < MAX_PATTERN_ENTRIES; ++i ) { - boot[i] = nullptr; - } - isDupAllowed = TRUE; -} - -void -PatternMap::copyFrom(const PatternMap& other, UErrorCode& status) { - if (U_FAILURE(status)) { - return; - } - this->isDupAllowed = other.isDupAllowed; - for (int32_t bootIndex = 0; bootIndex < MAX_PATTERN_ENTRIES; ++bootIndex) { - PtnElem *curElem, *otherElem, *prevElem=nullptr; - otherElem = other.boot[bootIndex]; - while (otherElem != nullptr) { - LocalPointer<PtnElem> newElem(new PtnElem(otherElem->basePattern, otherElem->pattern), status); - if (U_FAILURE(status)) { - return; // out of memory - } - newElem->skeleton.adoptInsteadAndCheckErrorCode(new PtnSkeleton(*(otherElem->skeleton)), status); - if (U_FAILURE(status)) { - return; // out of memory - } - newElem->skeletonWasSpecified = otherElem->skeletonWasSpecified; - - // Release ownership from the LocalPointer of the PtnElem object. - // The PtnElem will now be owned by either the boot (for the first entry in the linked-list) - // or owned by the previous PtnElem object in the linked-list. - curElem = newElem.orphan(); - - if (this->boot[bootIndex] == nullptr) { - this->boot[bootIndex] = curElem; - } else { - if (prevElem != nullptr) { - prevElem->next.adoptInstead(curElem); - } else { - UPRV_UNREACHABLE; - } - } - prevElem = curElem; - otherElem = otherElem->next.getAlias(); - } - - } -} - -PtnElem* -PatternMap::getHeader(UChar baseChar) const { - PtnElem* curElem; - - if ( (baseChar >= CAP_A) && (baseChar <= CAP_Z) ) { - curElem = boot[baseChar-CAP_A]; - } - else { - if ( (baseChar >=LOW_A) && (baseChar <= LOW_Z) ) { - curElem = boot[26+baseChar-LOW_A]; - } - else { - return nullptr; - } - } - return curElem; -} - -PatternMap::~PatternMap() { - for (int32_t i=0; i < MAX_PATTERN_ENTRIES; ++i ) { - if (boot[i] != nullptr ) { - delete boot[i]; - boot[i] = nullptr; - } - } -} // PatternMap destructor - -void -PatternMap::add(const UnicodeString& basePattern, - const PtnSkeleton& skeleton, - const UnicodeString& value,// mapped pattern value - UBool skeletonWasSpecified, - UErrorCode &status) { - UChar baseChar = basePattern.charAt(0); - PtnElem *curElem, *baseElem; - status = U_ZERO_ERROR; - - // the baseChar must be A-Z or a-z - if ((baseChar >= CAP_A) && (baseChar <= CAP_Z)) { - baseElem = boot[baseChar-CAP_A]; - } - else { - if ((baseChar >=LOW_A) && (baseChar <= LOW_Z)) { - baseElem = boot[26+baseChar-LOW_A]; - } - else { - status = U_ILLEGAL_CHARACTER; - return; - } - } - - if (baseElem == nullptr) { - LocalPointer<PtnElem> newElem(new PtnElem(basePattern, value), status); - if (U_FAILURE(status)) { - return; // out of memory - } - newElem->skeleton.adoptInsteadAndCheckErrorCode(new PtnSkeleton(skeleton), status); - if (U_FAILURE(status)) { - return; // out of memory - } - newElem->skeletonWasSpecified = skeletonWasSpecified; - if (baseChar >= LOW_A) { - boot[26 + (baseChar - LOW_A)] = newElem.orphan(); // the boot array now owns the PtnElem. - } - else { - boot[baseChar - CAP_A] = newElem.orphan(); // the boot array now owns the PtnElem. - } - } - if ( baseElem != nullptr ) { - curElem = getDuplicateElem(basePattern, skeleton, baseElem); - - if (curElem == nullptr) { - // add new element to the list. - curElem = baseElem; - while( curElem -> next != nullptr ) - { - curElem = curElem->next.getAlias(); - } - - LocalPointer<PtnElem> newElem(new PtnElem(basePattern, value), status); - if (U_FAILURE(status)) { - return; // out of memory - } - newElem->skeleton.adoptInsteadAndCheckErrorCode(new PtnSkeleton(skeleton), status); - if (U_FAILURE(status)) { - return; // out of memory - } - newElem->skeletonWasSpecified = skeletonWasSpecified; - curElem->next.adoptInstead(newElem.orphan()); - curElem = curElem->next.getAlias(); - } - else { - // Pattern exists in the list already. - if ( !isDupAllowed ) { - return; - } - // Overwrite the value. - curElem->pattern = value; - // It was a bug that we were not doing the following previously, - // though that bug hid other problems by making things partly work. - curElem->skeletonWasSpecified = skeletonWasSpecified; - } - } -} // PatternMap::add - -// Find the pattern from the given basePattern string. -const UnicodeString * -PatternMap::getPatternFromBasePattern(const UnicodeString& basePattern, UBool& skeletonWasSpecified) const { // key to search for - PtnElem *curElem; - - if ((curElem=getHeader(basePattern.charAt(0)))==nullptr) { - return nullptr; // no match - } - - do { - if ( basePattern.compare(curElem->basePattern)==0 ) { - skeletonWasSpecified = curElem->skeletonWasSpecified; - return &(curElem->pattern); - } - curElem = curElem->next.getAlias(); - } while (curElem != nullptr); - - return nullptr; -} // PatternMap::getFromBasePattern - - -// Find the pattern from the given skeleton. -// At least when this is called from getBestRaw & addPattern (in which case specifiedSkeletonPtr is non-NULL), -// the comparison should be based on skeleton.original (which is unique and tied to the distance measurement in bestRaw) -// and not skeleton.baseOriginal (which is not unique); otherwise we may pick a different skeleton than the one with the -// optimum distance value in getBestRaw. When this is called from public getRedundants (specifiedSkeletonPtr is NULL), -// for now it will continue to compare based on baseOriginal so as not to change the behavior unnecessarily. -const UnicodeString * -PatternMap::getPatternFromSkeleton(const PtnSkeleton& skeleton, const PtnSkeleton** specifiedSkeletonPtr) const { // key to search for - PtnElem *curElem; - - if (specifiedSkeletonPtr) { - *specifiedSkeletonPtr = nullptr; - } - - // find boot entry - UChar baseChar = skeleton.getFirstChar(); - if ((curElem=getHeader(baseChar))==nullptr) { - return nullptr; // no match - } - - do { - UBool equal; - if (specifiedSkeletonPtr != nullptr) { // called from DateTimePatternGenerator::getBestRaw or addPattern, use original - equal = curElem->skeleton->original == skeleton.original; - } else { // called from DateTimePatternGenerator::getRedundants, use baseOriginal - equal = curElem->skeleton->baseOriginal == skeleton.baseOriginal; - } - if (equal) { - if (specifiedSkeletonPtr && curElem->skeletonWasSpecified) { - *specifiedSkeletonPtr = curElem->skeleton.getAlias(); - } - return &(curElem->pattern); - } - curElem = curElem->next.getAlias(); - } while (curElem != nullptr); - - return nullptr; -} - -UBool -PatternMap::equals(const PatternMap& other) const { - if ( this==&other ) { - return TRUE; - } - for (int32_t bootIndex = 0; bootIndex < MAX_PATTERN_ENTRIES; ++bootIndex) { - if (boot[bootIndex] == other.boot[bootIndex]) { - continue; - } - if ((boot[bootIndex] == nullptr) || (other.boot[bootIndex] == nullptr)) { - return FALSE; - } - PtnElem *otherElem = other.boot[bootIndex]; - PtnElem *myElem = boot[bootIndex]; - while ((otherElem != nullptr) || (myElem != nullptr)) { - if ( myElem == otherElem ) { - break; - } - if ((otherElem == nullptr) || (myElem == nullptr)) { - return FALSE; - } - if ( (myElem->basePattern != otherElem->basePattern) || - (myElem->pattern != otherElem->pattern) ) { - return FALSE; - } - if ((myElem->skeleton.getAlias() != otherElem->skeleton.getAlias()) && - !myElem->skeleton->equals(*(otherElem->skeleton))) { - return FALSE; - } - myElem = myElem->next.getAlias(); - otherElem = otherElem->next.getAlias(); - } - } - return TRUE; -} - -// find any key existing in the mapping table already. -// return TRUE if there is an existing key, otherwise return FALSE. -PtnElem* -PatternMap::getDuplicateElem( - const UnicodeString &basePattern, - const PtnSkeleton &skeleton, - PtnElem *baseElem) { - PtnElem *curElem; - - if ( baseElem == nullptr ) { - return nullptr; - } - else { - curElem = baseElem; - } - do { - if ( basePattern.compare(curElem->basePattern)==0 ) { - UBool isEqual = TRUE; - for (int32_t i = 0; i < UDATPG_FIELD_COUNT; ++i) { - if (curElem->skeleton->type[i] != skeleton.type[i] ) { - isEqual = FALSE; - break; - } - } - if (isEqual) { - return curElem; - } - } - curElem = curElem->next.getAlias(); - } while( curElem != nullptr ); - - // end of the list - return nullptr; - -} // PatternMap::getDuplicateElem - -DateTimeMatcher::DateTimeMatcher(void) { -} - -DateTimeMatcher::~DateTimeMatcher() {} - -DateTimeMatcher::DateTimeMatcher(const DateTimeMatcher& other) { - copyFrom(other.skeleton); -} - - -void -DateTimeMatcher::set(const UnicodeString& pattern, FormatParser* fp) { - PtnSkeleton localSkeleton; - return set(pattern, fp, localSkeleton); -} - -void -DateTimeMatcher::set(const UnicodeString& pattern, FormatParser* fp, PtnSkeleton& skeletonResult) { - int32_t i; - for (i=0; i<UDATPG_FIELD_COUNT; ++i) { - skeletonResult.type[i] = NONE; - } - skeletonResult.original.clear(); - skeletonResult.baseOriginal.clear(); - skeletonResult.addedDefaultDayPeriod = FALSE; - - fp->set(pattern); - for (i=0; i < fp->itemNumber; i++) { - const UnicodeString& value = fp->items[i]; - // don't skip 'a' anymore, dayPeriod handled specially below - - if ( fp->isQuoteLiteral(value) ) { - UnicodeString quoteLiteral; - fp->getQuoteLiteral(quoteLiteral, &i); - continue; - } - int32_t canonicalIndex = fp->getCanonicalIndex(value); - if (canonicalIndex < 0) { - continue; - } - const dtTypeElem *row = &dtTypes[canonicalIndex]; - int32_t field = row->field; - skeletonResult.original.populate(field, value); - UChar repeatChar = row->patternChar; - int32_t repeatCount = row->minLen; - skeletonResult.baseOriginal.populate(field, repeatChar, repeatCount); - int16_t subField = row->type; - if (row->type > 0) { - U_ASSERT(value.length() < INT16_MAX); - subField += static_cast<int16_t>(value.length()); - } - skeletonResult.type[field] = subField; - } - // #13183, handle special behavior for day period characters (a, b, B) - if (!skeletonResult.original.isFieldEmpty(UDATPG_HOUR_FIELD)) { - if (skeletonResult.original.getFieldChar(UDATPG_HOUR_FIELD)==LOW_H || skeletonResult.original.getFieldChar(UDATPG_HOUR_FIELD)==CAP_K) { - // We have a skeleton with 12-hour-cycle format - if (skeletonResult.original.isFieldEmpty(UDATPG_DAYPERIOD_FIELD)) { - // But we do not have a day period in the skeleton; add the default DAYPERIOD (currently "a") - for (i = 0; dtTypes[i].patternChar != 0; i++) { - if ( dtTypes[i].field == UDATPG_DAYPERIOD_FIELD ) { - // first entry for UDATPG_DAYPERIOD_FIELD - skeletonResult.original.populate(UDATPG_DAYPERIOD_FIELD, dtTypes[i].patternChar, dtTypes[i].minLen); - skeletonResult.baseOriginal.populate(UDATPG_DAYPERIOD_FIELD, dtTypes[i].patternChar, dtTypes[i].minLen); - skeletonResult.type[UDATPG_DAYPERIOD_FIELD] = dtTypes[i].type; - skeletonResult.addedDefaultDayPeriod = TRUE; - break; - } - } - } - } else { - // Skeleton has 24-hour-cycle hour format and has dayPeriod, delete dayPeriod (i.e. ignore it) - skeletonResult.original.clearField(UDATPG_DAYPERIOD_FIELD); - skeletonResult.baseOriginal.clearField(UDATPG_DAYPERIOD_FIELD); - skeletonResult.type[UDATPG_DAYPERIOD_FIELD] = NONE; - } - } - copyFrom(skeletonResult); -} - -void -DateTimeMatcher::getBasePattern(UnicodeString &result ) { - result.remove(); // Reset the result first. - skeleton.baseOriginal.appendTo(result); -} - -UnicodeString -DateTimeMatcher::getPattern() { - UnicodeString result; - return skeleton.original.appendTo(result); -} - -int32_t -DateTimeMatcher::getDistance(const DateTimeMatcher& other, int32_t includeMask, DistanceInfo& distanceInfo) const { - int32_t result = 0; - distanceInfo.clear(); - for (int32_t i=0; i<UDATPG_FIELD_COUNT; ++i ) { - int32_t myType = (includeMask&(1<<i))==0 ? 0 : skeleton.type[i]; - int32_t otherType = other.skeleton.type[i]; - if (myType==otherType) { - continue; - } - if (myType==0) {// and other is not - result += EXTRA_FIELD; - distanceInfo.addExtra(i); - } - else { - if (otherType==0) { - result += MISSING_FIELD; - distanceInfo.addMissing(i); - } - else { - result += abs(myType - otherType); - } - } - - } - return result; -} - -void -DateTimeMatcher::copyFrom(const PtnSkeleton& newSkeleton) { - skeleton.copyFrom(newSkeleton); -} - -void -DateTimeMatcher::copyFrom() { - // same as clear - skeleton.clear(); -} - -UBool -DateTimeMatcher::equals(const DateTimeMatcher* other) const { - if (other==nullptr) { return FALSE; } - return skeleton.original == other->skeleton.original; -} - -int32_t -DateTimeMatcher::getFieldMask() const { - int32_t result = 0; - - for (int32_t i=0; i<UDATPG_FIELD_COUNT; ++i) { - if (skeleton.type[i]!=0) { - result |= (1<<i); - } - } - return result; -} - -PtnSkeleton* -DateTimeMatcher::getSkeletonPtr() { - return &skeleton; -} - -FormatParser::FormatParser () { - status = START; - itemNumber = 0; -} - - -FormatParser::~FormatParser () { -} - - -// Find the next token with the starting position and length -// Note: the startPos may -FormatParser::TokenStatus -FormatParser::setTokens(const UnicodeString& pattern, int32_t startPos, int32_t *len) { - int32_t curLoc = startPos; - if ( curLoc >= pattern.length()) { - return DONE; - } - // check the current char is between A-Z or a-z - do { - UChar c=pattern.charAt(curLoc); - if ( (c>=CAP_A && c<=CAP_Z) || (c>=LOW_A && c<=LOW_Z) ) { - curLoc++; - } - else { - startPos = curLoc; - *len=1; - return ADD_TOKEN; - } - - if ( pattern.charAt(curLoc)!= pattern.charAt(startPos) ) { - break; // not the same token - } - } while(curLoc <= pattern.length()); - *len = curLoc-startPos; - return ADD_TOKEN; -} - -void -FormatParser::set(const UnicodeString& pattern) { - int32_t startPos = 0; - TokenStatus result = START; - int32_t len = 0; - itemNumber = 0; - - do { - result = setTokens( pattern, startPos, &len ); - if ( result == ADD_TOKEN ) - { - items[itemNumber++] = UnicodeString(pattern, startPos, len ); - startPos += len; - } - else { - break; - } - } while (result==ADD_TOKEN && itemNumber < MAX_DT_TOKEN); -} - -int32_t -FormatParser::getCanonicalIndex(const UnicodeString& s, UBool strict) { - int32_t len = s.length(); - if (len == 0) { - return -1; - } - UChar ch = s.charAt(0); - - // Verify that all are the same character. - for (int32_t l = 1; l < len; l++) { - if (ch != s.charAt(l)) { - return -1; - } - } - int32_t i = 0; - int32_t bestRow = -1; - while (dtTypes[i].patternChar != 0x0000) { - if ( dtTypes[i].patternChar != ch ) { - ++i; - continue; - } - bestRow = i; - if (dtTypes[i].patternChar != dtTypes[i+1].patternChar) { - return i; - } - if (dtTypes[i+1].minLen <= len) { - ++i; - continue; - } - return i; - } - return strict ? -1 : bestRow; -} - -UBool -FormatParser::isQuoteLiteral(const UnicodeString& s) { - return (UBool)(s.charAt(0) == SINGLE_QUOTE); -} - -// This function assumes the current itemIndex points to the quote literal. -// Please call isQuoteLiteral prior to this function. -void -FormatParser::getQuoteLiteral(UnicodeString& quote, int32_t *itemIndex) { - int32_t i = *itemIndex; - - quote.remove(); - if (items[i].charAt(0)==SINGLE_QUOTE) { - quote += items[i]; - ++i; - } - while ( i < itemNumber ) { - if ( items[i].charAt(0)==SINGLE_QUOTE ) { - if ( (i+1<itemNumber) && (items[i+1].charAt(0)==SINGLE_QUOTE)) { - // two single quotes e.g. 'o''clock' - quote += items[i++]; - quote += items[i++]; - continue; - } - else { - quote += items[i]; - break; - } - } - else { - quote += items[i]; - } - ++i; - } - *itemIndex=i; -} - -UBool -FormatParser::isPatternSeparator(const UnicodeString& field) const { - for (int32_t i=0; i<field.length(); ++i ) { - UChar c= field.charAt(i); - if ( (c==SINGLE_QUOTE) || (c==BACKSLASH) || (c==SPACE) || (c==COLON) || - (c==QUOTATION_MARK) || (c==COMMA) || (c==HYPHEN) ||(items[i].charAt(0)==DOT) ) { - continue; - } - else { - return FALSE; - } - } - return TRUE; -} - -DistanceInfo::~DistanceInfo() {} - -void -DistanceInfo::setTo(const DistanceInfo& other) { - missingFieldMask = other.missingFieldMask; - extraFieldMask= other.extraFieldMask; -} - -PatternMapIterator::PatternMapIterator(UErrorCode& status) : - bootIndex(0), nodePtr(nullptr), matcher(nullptr), patternMap(nullptr) -{ - if (U_FAILURE(status)) { return; } - matcher.adoptInsteadAndCheckErrorCode(new DateTimeMatcher(), status); -} - -PatternMapIterator::~PatternMapIterator() { -} - -void -PatternMapIterator::set(PatternMap& newPatternMap) { - this->patternMap=&newPatternMap; -} - -PtnSkeleton* -PatternMapIterator::getSkeleton() const { - if ( nodePtr == nullptr ) { - return nullptr; - } - else { - return nodePtr->skeleton.getAlias(); - } -} - -UBool -PatternMapIterator::hasNext() const { - int32_t headIndex = bootIndex; - PtnElem *curPtr = nodePtr; - - if (patternMap==nullptr) { - return FALSE; - } - while ( headIndex < MAX_PATTERN_ENTRIES ) { - if ( curPtr != nullptr ) { - if ( curPtr->next != nullptr ) { - return TRUE; - } - else { - headIndex++; - curPtr=nullptr; - continue; - } - } - else { - if ( patternMap->boot[headIndex] != nullptr ) { - return TRUE; - } - else { - headIndex++; - continue; - } - } - } - return FALSE; -} - -DateTimeMatcher& -PatternMapIterator::next() { - while ( bootIndex < MAX_PATTERN_ENTRIES ) { - if ( nodePtr != nullptr ) { - if ( nodePtr->next != nullptr ) { - nodePtr = nodePtr->next.getAlias(); - break; - } - else { - bootIndex++; - nodePtr=nullptr; - continue; - } - } - else { - if ( patternMap->boot[bootIndex] != nullptr ) { - nodePtr = patternMap->boot[bootIndex]; - break; - } - else { - bootIndex++; - continue; - } - } - } - if (nodePtr!=nullptr) { - matcher->copyFrom(*nodePtr->skeleton); - } - else { - matcher->copyFrom(); - } - return *matcher; -} - - -SkeletonFields::SkeletonFields() { - // Set initial values to zero - clear(); -} - -void SkeletonFields::clear() { - uprv_memset(chars, 0, sizeof(chars)); - uprv_memset(lengths, 0, sizeof(lengths)); -} - -void SkeletonFields::copyFrom(const SkeletonFields& other) { - uprv_memcpy(chars, other.chars, sizeof(chars)); - uprv_memcpy(lengths, other.lengths, sizeof(lengths)); -} - -void SkeletonFields::clearField(int32_t field) { - chars[field] = 0; - lengths[field] = 0; -} - -UChar SkeletonFields::getFieldChar(int32_t field) const { - return chars[field]; -} - -int32_t SkeletonFields::getFieldLength(int32_t field) const { - return lengths[field]; -} - -void SkeletonFields::populate(int32_t field, const UnicodeString& value) { - populate(field, value.charAt(0), value.length()); -} - -void SkeletonFields::populate(int32_t field, UChar ch, int32_t length) { - chars[field] = (int8_t) ch; - lengths[field] = (int8_t) length; -} - -UBool SkeletonFields::isFieldEmpty(int32_t field) const { - return lengths[field] == 0; -} - -UnicodeString& SkeletonFields::appendTo(UnicodeString& string) const { - for (int32_t i = 0; i < UDATPG_FIELD_COUNT; ++i) { - appendFieldTo(i, string); - } - return string; -} - -UnicodeString& SkeletonFields::appendFieldTo(int32_t field, UnicodeString& string) const { - UChar ch(chars[field]); - int32_t length = (int32_t) lengths[field]; - - for (int32_t i=0; i<length; i++) { - string += ch; - } - return string; -} - -UChar SkeletonFields::getFirstChar() const { - for (int32_t i = 0; i < UDATPG_FIELD_COUNT; ++i) { - if (lengths[i] != 0) { - return chars[i]; - } - } - return '\0'; -} - - -PtnSkeleton::PtnSkeleton() { -} - -PtnSkeleton::PtnSkeleton(const PtnSkeleton& other) { - copyFrom(other); -} - -void PtnSkeleton::copyFrom(const PtnSkeleton& other) { - uprv_memcpy(type, other.type, sizeof(type)); - original.copyFrom(other.original); - baseOriginal.copyFrom(other.baseOriginal); -} - -void PtnSkeleton::clear() { - uprv_memset(type, 0, sizeof(type)); - original.clear(); - baseOriginal.clear(); -} - -UBool -PtnSkeleton::equals(const PtnSkeleton& other) const { - return (original == other.original) - && (baseOriginal == other.baseOriginal) - && (uprv_memcmp(type, other.type, sizeof(type)) == 0); -} - -UnicodeString -PtnSkeleton::getSkeleton() const { - UnicodeString result; - result = original.appendTo(result); - int32_t pos; - if (addedDefaultDayPeriod && (pos = result.indexOf(LOW_A)) >= 0) { - // for backward compatibility: if DateTimeMatcher.set added a single 'a' that - // was not in the provided skeleton, remove it here before returning skeleton. - result.remove(pos, 1); - } - return result; -} - -UnicodeString -PtnSkeleton::getBaseSkeleton() const { - UnicodeString result; - result = baseOriginal.appendTo(result); - int32_t pos; - if (addedDefaultDayPeriod && (pos = result.indexOf(LOW_A)) >= 0) { - // for backward compatibility: if DateTimeMatcher.set added a single 'a' that - // was not in the provided skeleton, remove it here before returning skeleton. - result.remove(pos, 1); - } - return result; -} - -UChar -PtnSkeleton::getFirstChar() const { - return baseOriginal.getFirstChar(); -} - -PtnSkeleton::~PtnSkeleton() { -} - -PtnElem::PtnElem(const UnicodeString &basePat, const UnicodeString &pat) : - basePattern(basePat), skeleton(nullptr), pattern(pat), next(nullptr) -{ -} - -PtnElem::~PtnElem() { -} - -DTSkeletonEnumeration::DTSkeletonEnumeration(PatternMap& patternMap, dtStrEnum type, UErrorCode& status) : fSkeletons(nullptr) { - PtnElem *curElem; - PtnSkeleton *curSkeleton; - UnicodeString s; - int32_t bootIndex; - - pos=0; - fSkeletons.adoptInsteadAndCheckErrorCode(new UVector(status), status); - if (U_FAILURE(status)) { - return; - } - - for (bootIndex=0; bootIndex<MAX_PATTERN_ENTRIES; ++bootIndex ) { - curElem = patternMap.boot[bootIndex]; - while (curElem!=nullptr) { - switch(type) { - case DT_BASESKELETON: - s=curElem->basePattern; - break; - case DT_PATTERN: - s=curElem->pattern; - break; - case DT_SKELETON: - curSkeleton=curElem->skeleton.getAlias(); - s=curSkeleton->getSkeleton(); - break; - } - if ( !isCanonicalItem(s) ) { - LocalPointer<UnicodeString> newElem(new UnicodeString(s), status); - if (U_FAILURE(status)) { - return; - } - fSkeletons->addElement(newElem.getAlias(), status); - if (U_FAILURE(status)) { - fSkeletons.adoptInstead(nullptr); - return; - } - newElem.orphan(); // fSkeletons vector now owns the UnicodeString. - } - curElem = curElem->next.getAlias(); - } - } - if ((bootIndex==MAX_PATTERN_ENTRIES) && (curElem!=nullptr) ) { - status = U_BUFFER_OVERFLOW_ERROR; - } -} - -const UnicodeString* -DTSkeletonEnumeration::snext(UErrorCode& status) { - if (U_SUCCESS(status) && fSkeletons.isValid() && pos < fSkeletons->size()) { - return (const UnicodeString*)fSkeletons->elementAt(pos++); - } - return nullptr; -} - -void -DTSkeletonEnumeration::reset(UErrorCode& /*status*/) { - pos=0; -} - -int32_t -DTSkeletonEnumeration::count(UErrorCode& /*status*/) const { - return (fSkeletons.isNull()) ? 0 : fSkeletons->size(); -} - -UBool -DTSkeletonEnumeration::isCanonicalItem(const UnicodeString& item) { - if ( item.length() != 1 ) { - return FALSE; - } - for (int32_t i=0; i<UDATPG_FIELD_COUNT; ++i) { - if (item.charAt(0)==Canonical_Items[i]) { - return TRUE; - } - } - return FALSE; -} - -DTSkeletonEnumeration::~DTSkeletonEnumeration() { - UnicodeString *s; - if (fSkeletons.isValid()) { - for (int32_t i = 0; i < fSkeletons->size(); ++i) { - if ((s = (UnicodeString *)fSkeletons->elementAt(i)) != nullptr) { - delete s; - } - } - } -} - -DTRedundantEnumeration::DTRedundantEnumeration() : pos(0), fPatterns(nullptr) { -} - -void -DTRedundantEnumeration::add(const UnicodeString& pattern, UErrorCode& status) { - if (U_FAILURE(status)) { return; } - if (fPatterns.isNull()) { - fPatterns.adoptInsteadAndCheckErrorCode(new UVector(status), status); - if (U_FAILURE(status)) { - return; - } - } - LocalPointer<UnicodeString> newElem(new UnicodeString(pattern), status); - if (U_FAILURE(status)) { - return; - } - fPatterns->addElement(newElem.getAlias(), status); - if (U_FAILURE(status)) { - fPatterns.adoptInstead(nullptr); - return; - } - newElem.orphan(); // fPatterns now owns the string. -} - -const UnicodeString* -DTRedundantEnumeration::snext(UErrorCode& status) { - if (U_SUCCESS(status) && fPatterns.isValid() && pos < fPatterns->size()) { - return (const UnicodeString*)fPatterns->elementAt(pos++); - } - return nullptr; -} - -void -DTRedundantEnumeration::reset(UErrorCode& /*status*/) { - pos=0; -} - -int32_t -DTRedundantEnumeration::count(UErrorCode& /*status*/) const { - return (fPatterns.isNull()) ? 0 : fPatterns->size(); -} - -UBool -DTRedundantEnumeration::isCanonicalItem(const UnicodeString& item) const { - if ( item.length() != 1 ) { - return FALSE; - } - for (int32_t i=0; i<UDATPG_FIELD_COUNT; ++i) { - if (item.charAt(0)==Canonical_Items[i]) { - return TRUE; - } - } - return FALSE; -} - -DTRedundantEnumeration::~DTRedundantEnumeration() { - UnicodeString *s; - if (fPatterns.isValid()) { - for (int32_t i = 0; i < fPatterns->size(); ++i) { - if ((s = (UnicodeString *)fPatterns->elementAt(i)) != nullptr) { - delete s; - } - } - } -} - -U_NAMESPACE_END - - -#endif /* #if !UCONFIG_NO_FORMATTING */ - -//eof 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 <https://feross.org> * @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 <https://github.com/jonschlinkert/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 = '<stdin>'; - -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 || '<stdin>'; + + 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 <https://github.com/jonschlinkert/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 <https://github.com/micromatch/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 <https://github.com/jonschlinkert/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<String>} */ - 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 = "ffi"; -const fflig = "ff"; -const ffllig = "ffl"; -const ffr = "𝔣"; -const filig = "fi"; -const fjlig = "fj"; -const flat = "♭"; -const fllig = "fl"; -const fltns = "▱"; -const fnof = "ƒ"; -const fopf = "𝕗"; -const forall = "∀"; -const fork = "⋔"; -const forkv = "⫙"; -const fpartint = "⨍"; -const frac1 = "¼"; -const frac12 = "½"; -const frac13 = "⅓"; -const frac14 = "¼"; -const frac15 = "⅕"; -const frac16 = "⅙"; -const frac18 = "⅛"; -const frac23 = "⅔"; -const frac25 = "⅖"; -const frac3 = "¾"; -const frac34 = "¾"; -const frac35 = "⅗"; -const frac38 = "⅜"; -const frac45 = "⅘"; -const frac56 = "⅚"; -const frac58 = "⅝"; -const frac78 = "⅞"; -const frasl = "⁄"; -const frown = "⌢"; -const fscr = "𝒻"; -const gE = "≧"; -const gEl = "⪌"; -const gacute = "ǵ"; -const gamma = "γ"; -const gammad = "ϝ"; -const gap = "⪆"; -const gbreve = "ğ"; -const gcirc = "ĝ"; -const gcy = "г"; -const gdot = "ġ"; -const ge = "≥"; -const gel = "⋛"; -const geq = "≥"; -const geqq = "≧"; -const geqslant = "⩾"; -const ges = "⩾"; -const gescc = "⪩"; -const gesdot = "⪀"; -const gesdoto = "⪂"; -const gesdotol = "⪄"; -const gesl = "⋛︀"; -const gesles = "⪔"; -const gfr = "𝔤"; -const gg = "≫"; -const ggg = "⋙"; -const gimel = "ℷ"; -const gjcy = "ѓ"; -const gl = "≷"; -const glE = "⪒"; -const gla = "⪥"; -const glj = "⪤"; -const gnE = "≩"; -const gnap = "⪊"; -const gnapprox = "⪊"; -const gne = "⪈"; -const gneq = "⪈"; -const gneqq = "≩"; -const gnsim = "⋧"; -const gopf = "𝕘"; -const grave = "`"; -const gscr = "ℊ"; -const gsim = "≳"; -const gsime = "⪎"; -const gsiml = "⪐"; -const g = ">"; -const gt = ">"; -const gtcc = "⪧"; -const gtcir = "⩺"; -const gtdot = "⋗"; -const gtlPar = "⦕"; -const gtquest = "⩼"; -const gtrapprox = "⪆"; -const gtrarr = "⥸"; -const gtrdot = "⋗"; -const gtreqless = "⋛"; -const gtreqqless = "⪌"; -const gtrless = "≷"; -const gtrsim = "≳"; -const gvertneqq = "≩︀"; -const gvnE = "≩︀"; -const hArr = "⇔"; -const hairsp = " "; -const half = "½"; -const hamilt = "ℋ"; -const hardcy = "ъ"; -const harr = "↔"; -const harrcir = "⥈"; -const harrw = "↭"; -const hbar = "ℏ"; -const hcirc = "ĥ"; -const hearts = "♥"; -const heartsuit = "♥"; -const hellip = "…"; -const hercon = "⊹"; -const hfr = "𝔥"; -const hksearow = "⤥"; -const hkswarow = "⤦"; -const hoarr = "⇿"; -const homtht = "∻"; -const hookleftarrow = "↩"; -const hookrightarrow = "↪"; -const hopf = "𝕙"; -const horbar = "―"; -const hscr = "𝒽"; -const hslash = "ℏ"; -const hstrok = "ħ"; -const hybull = "⁃"; -const hyphen = "‐"; -const iacut = "í"; -const iacute = "í"; -const ic = "⁣"; -const icir = "î"; -const icirc = "î"; -const icy = "и"; -const iecy = "е"; -const iexc = "¡"; -const iexcl = "¡"; -const iff = "⇔"; -const ifr = "𝔦"; -const igrav = "ì"; -const igrave = "ì"; -const ii = "ⅈ"; -const iiiint = "⨌"; -const iiint = "∭"; -const iinfin = "⧜"; -const iiota = "℩"; -const ijlig = "ij"; -const imacr = "ī"; -const image = "ℑ"; -const imagline = "ℐ"; -const imagpart = "ℑ"; -const imath = "ı"; -const imof = "⊷"; -const imped = "Ƶ"; -const incare = "℅"; -const infin = "∞"; -const infintie = "⧝"; -const inodot = "ı"; -const int = "∫"; -const intcal = "⊺"; -const integers = "ℤ"; -const intercal = "⊺"; -const intlarhk = "⨗"; -const intprod = "⨼"; -const iocy = "ё"; -const iogon = "į"; -const iopf = "𝕚"; -const iota = "ι"; -const iprod = "⨼"; -const iques = "¿"; -const iquest = "¿"; -const iscr = "𝒾"; -const isin = "∈"; -const isinE = "⋹"; -const isindot = "⋵"; -const isins = "⋴"; -const isinsv = "⋳"; -const isinv = "∈"; -const it = "⁢"; -const itilde = "ĩ"; -const iukcy = "і"; -const ium = "ï"; -const iuml = "ï"; -const jcirc = "ĵ"; -const jcy = "й"; -const jfr = "𝔧"; -const jmath = "ȷ"; -const jopf = "𝕛"; -const jscr = "𝒿"; -const jsercy = "ј"; -const jukcy = "є"; -const kappa = "κ"; -const kappav = "ϰ"; -const kcedil = "ķ"; -const kcy = "к"; -const kfr = "𝔨"; -const kgreen = "ĸ"; -const khcy = "х"; -const kjcy = "ќ"; -const kopf = "𝕜"; -const kscr = "𝓀"; -const lAarr = "⇚"; -const lArr = "⇐"; -const lAtail = "⤛"; -const lBarr = "⤎"; -const lE = "≦"; -const lEg = "⪋"; -const lHar = "⥢"; -const lacute = "ĺ"; -const laemptyv = "⦴"; -const lagran = "ℒ"; -const lambda = "λ"; -const lang = "⟨"; -const langd = "⦑"; -const langle = "⟨"; -const lap = "⪅"; -const laqu = "«"; -const laquo = "«"; -const larr = "←"; -const larrb = "⇤"; -const larrbfs = "⤟"; -const larrfs = "⤝"; -const larrhk = "↩"; -const larrlp = "↫"; -const larrpl = "⤹"; -const larrsim = "⥳"; -const larrtl = "↢"; -const lat = "⪫"; -const latail = "⤙"; -const late = "⪭"; -const lates = "⪭︀"; -const lbarr = "⤌"; -const lbbrk = "❲"; -const lbrace = "{"; -const lbrack = "["; -const lbrke = "⦋"; -const lbrksld = "⦏"; -const lbrkslu = "⦍"; -const lcaron = "ľ"; -const lcedil = "ļ"; -const lceil = "⌈"; -const lcub = "{"; -const lcy = "л"; -const ldca = "⤶"; -const ldquo = "“"; -const ldquor = "„"; -const ldrdhar = "⥧"; -const ldrushar = "⥋"; -const ldsh = "↲"; -const le = "≤"; -const leftarrow = "←"; -const leftarrowtail = "↢"; -const leftharpoondown = "↽"; -const leftharpoonup = "↼"; -const leftleftarrows = "⇇"; -const leftrightarrow = "↔"; -const leftrightarrows = "⇆"; -const leftrightharpoons = "⇋"; -const leftrightsquigarrow = "↭"; -const leftthreetimes = "⋋"; -const leg = "⋚"; -const leq = "≤"; -const leqq = "≦"; -const leqslant = "⩽"; -const les = "⩽"; -const lescc = "⪨"; -const lesdot = "⩿"; -const lesdoto = "⪁"; -const lesdotor = "⪃"; -const lesg = "⋚︀"; -const lesges = "⪓"; -const lessapprox = "⪅"; -const lessdot = "⋖"; -const lesseqgtr = "⋚"; -const lesseqqgtr = "⪋"; -const lessgtr = "≶"; -const lesssim = "≲"; -const lfisht = "⥼"; -const lfloor = "⌊"; -const lfr = "𝔩"; -const lg = "≶"; -const lgE = "⪑"; -const lhard = "↽"; -const lharu = "↼"; -const lharul = "⥪"; -const lhblk = "▄"; -const ljcy = "љ"; -const ll = "≪"; -const llarr = "⇇"; -const llcorner = "⌞"; -const llhard = "⥫"; -const lltri = "◺"; -const lmidot = "ŀ"; -const lmoust = "⎰"; -const lmoustache = "⎰"; -const lnE = "≨"; -const lnap = "⪉"; -const lnapprox = "⪉"; -const lne = "⪇"; -const lneq = "⪇"; -const lneqq = "≨"; -const lnsim = "⋦"; -const loang = "⟬"; -const loarr = "⇽"; -const lobrk = "⟦"; -const longleftarrow = "⟵"; -const longleftrightarrow = "⟷"; -const longmapsto = "⟼"; -const longrightarrow = "⟶"; -const looparrowleft = "↫"; -const looparrowright = "↬"; -const lopar = "⦅"; -const lopf = "𝕝"; -const loplus = "⨭"; -const lotimes = "⨴"; -const lowast = "∗"; -const lowbar = "_"; -const loz = "◊"; -const lozenge = "◊"; -const lozf = "⧫"; -const lpar = "("; -const lparlt = "⦓"; -const lrarr = "⇆"; -const lrcorner = "⌟"; -const lrhar = "⇋"; -const lrhard = "⥭"; -const lrm = "‎"; -const lrtri = "⊿"; -const lsaquo = "‹"; -const lscr = "𝓁"; -const lsh = "↰"; -const lsim = "≲"; -const lsime = "⪍"; -const lsimg = "⪏"; -const lsqb = "["; -const lsquo = "‘"; -const lsquor = "‚"; -const lstrok = "ł"; -const l = "<"; -const lt = "<"; -const ltcc = "⪦"; -const ltcir = "⩹"; -const ltdot = "⋖"; -const lthree = "⋋"; -const ltimes = "⋉"; -const ltlarr = "⥶"; -const ltquest = "⩻"; -const ltrPar = "⦖"; -const ltri = "◃"; -const ltrie = "⊴"; -const ltrif = "◂"; -const lurdshar = "⥊"; -const luruhar = "⥦"; -const lvertneqq = "≨︀"; -const lvnE = "≨︀"; -const mDDot = "∺"; -const mac = "¯"; -const macr = "¯"; -const male = "♂"; -const malt = "✠"; -const maltese = "✠"; -const map$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 = "ffi"; +const fflig = "ff"; +const ffllig = "ffl"; +const ffr = "𝔣"; +const filig = "fi"; +const fjlig = "fj"; +const flat = "♭"; +const fllig = "fl"; +const fltns = "▱"; +const fnof = "ƒ"; +const fopf = "𝕗"; +const forall = "∀"; +const fork = "⋔"; +const forkv = "⫙"; +const fpartint = "⨍"; +const frac1 = "¼"; +const frac12 = "½"; +const frac13 = "⅓"; +const frac14 = "¼"; +const frac15 = "⅕"; +const frac16 = "⅙"; +const frac18 = "⅛"; +const frac23 = "⅔"; +const frac25 = "⅖"; +const frac3 = "¾"; +const frac34 = "¾"; +const frac35 = "⅗"; +const frac38 = "⅜"; +const frac45 = "⅘"; +const frac56 = "⅚"; +const frac58 = "⅝"; +const frac78 = "⅞"; +const frasl = "⁄"; +const frown = "⌢"; +const fscr = "𝒻"; +const gE = "≧"; +const gEl = "⪌"; +const gacute = "ǵ"; +const gamma = "γ"; +const gammad = "ϝ"; +const gap = "⪆"; +const gbreve = "ğ"; +const gcirc = "ĝ"; +const gcy = "г"; +const gdot = "ġ"; +const ge = "≥"; +const gel = "⋛"; +const geq = "≥"; +const geqq = "≧"; +const geqslant = "⩾"; +const ges = "⩾"; +const gescc = "⪩"; +const gesdot = "⪀"; +const gesdoto = "⪂"; +const gesdotol = "⪄"; +const gesl = "⋛︀"; +const gesles = "⪔"; +const gfr = "𝔤"; +const gg = "≫"; +const ggg = "⋙"; +const gimel = "ℷ"; +const gjcy = "ѓ"; +const gl = "≷"; +const glE = "⪒"; +const gla = "⪥"; +const glj = "⪤"; +const gnE = "≩"; +const gnap = "⪊"; +const gnapprox = "⪊"; +const gne = "⪈"; +const gneq = "⪈"; +const gneqq = "≩"; +const gnsim = "⋧"; +const gopf = "𝕘"; +const grave = "`"; +const gscr = "ℊ"; +const gsim = "≳"; +const gsime = "⪎"; +const gsiml = "⪐"; +const g = ">"; +const gt = ">"; +const gtcc = "⪧"; +const gtcir = "⩺"; +const gtdot = "⋗"; +const gtlPar = "⦕"; +const gtquest = "⩼"; +const gtrapprox = "⪆"; +const gtrarr = "⥸"; +const gtrdot = "⋗"; +const gtreqless = "⋛"; +const gtreqqless = "⪌"; +const gtrless = "≷"; +const gtrsim = "≳"; +const gvertneqq = "≩︀"; +const gvnE = "≩︀"; +const hArr = "⇔"; +const hairsp = " "; +const half = "½"; +const hamilt = "ℋ"; +const hardcy = "ъ"; +const harr = "↔"; +const harrcir = "⥈"; +const harrw = "↭"; +const hbar = "ℏ"; +const hcirc = "ĥ"; +const hearts = "♥"; +const heartsuit = "♥"; +const hellip = "…"; +const hercon = "⊹"; +const hfr = "𝔥"; +const hksearow = "⤥"; +const hkswarow = "⤦"; +const hoarr = "⇿"; +const homtht = "∻"; +const hookleftarrow = "↩"; +const hookrightarrow = "↪"; +const hopf = "𝕙"; +const horbar = "―"; +const hscr = "𝒽"; +const hslash = "ℏ"; +const hstrok = "ħ"; +const hybull = "⁃"; +const hyphen = "‐"; +const iacut = "í"; +const iacute = "í"; +const ic = "⁣"; +const icir = "î"; +const icirc = "î"; +const icy = "и"; +const iecy = "е"; +const iexc = "¡"; +const iexcl = "¡"; +const iff = "⇔"; +const ifr = "𝔦"; +const igrav = "ì"; +const igrave = "ì"; +const ii = "ⅈ"; +const iiiint = "⨌"; +const iiint = "∭"; +const iinfin = "⧜"; +const iiota = "℩"; +const ijlig = "ij"; +const imacr = "ī"; +const image = "ℑ"; +const imagline = "ℐ"; +const imagpart = "ℑ"; +const imath = "ı"; +const imof = "⊷"; +const imped = "Ƶ"; +const incare = "℅"; +const infin = "∞"; +const infintie = "⧝"; +const inodot = "ı"; +const int$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 <https://spec.commonmark.org/0.29/#html-blocks>. -var htmlBlockNames = [ +var basics = [ 'address', 'article', 'aside', @@ -37922,29 +35456,25 @@ var htmlBlockNames = [ 'ul' ]; -// This module is copied from <https://spec.commonmark.org/0.29/#html-blocks>. -var htmlRawNames = ['pre', 'script', 'style']; - -var tokenize$g = tokenizeHtml; -var resolveTo = resolveToHtml; -var concrete$1 = true; - - - - - - - - - - - +var htmlBlockNames = basics; +// This module is copied from <https://spec.commonmark.org/0.29/#html-blocks>. +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 (`<!--lint ignore-->`). -// 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"} + * + * <http://www.example.com> + * <mailto:foo@bar.com> + * + * Most Markdown vendors don’t recognize the following as a link: + * <www.example.com> + * + * @example {"name": "not-ok.md", "label": "input"} + * + * <foo@bar.com> + * + * @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"} + * + * <http://foo.bar/baz> + * + * @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}} + * + * <!-- This requires commonmark. --> + * + * 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.<string>` 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/ + * + * <!-- Comments are fine between and after definitions --> + * + * [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"} + * + * <h1>An HTML heading is also seen by this rule.</h1> + * + * @example {"name": "ok-delayed.md"} + * + * You can use markdown content before the heading. + * + * <div>Or non-heading HTML</div> + * + * <h1>So the first heading, be it HTML or markdown, is checked</h1> + * + * @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"} + * + * <h2>Charlie</h2> + * + * 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} + * + * <h2>Echo</h2> + * + * 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"} + * + * <h1>Golf</h1> + * + * 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 = /<h([1-6])/; @@ -45388,6 +44081,79 @@ function infer(node) { return results ? Number(results[1]) : undefined } +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module heading-style + * @fileoverview + * Warn when a heading does not conform to a given style. + * + * Options: `'consistent'`, `'atx'`, `'atx-closed'`, or `'setext'`, + * default: `'consistent'`. + * + * `'consistent'` detects the first used heading style and warns when + * subsequent headings use different styles. + * + * ## Fix + * + * [`remark-stringify`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify) + * formats headings as ATX by default. + * This can be configured with the + * [`setext`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify#optionssetext) + * and + * [`closeAtx`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify#optionscloseatx) + * options. + * + * 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": "atx"} + * + * # Alpha + * + * ## Bravo + * + * ### Charlie + * + * @example {"name": "ok.md", "setting": "atx-closed"} + * + * # Delta ## + * + * ## Echo ## + * + * ### Foxtrot ### + * + * @example {"name": "ok.md", "setting": "setext"} + * + * Golf + * ==== + * + * Hotel + * ----- + * + * ### India + * + * @example {"name": "not-ok.md", "label": "input"} + * + * Juliett + * ======= + * + * ## Kilo + * + * ### Lima ### + * + * @example {"name": "not-ok.md", "label": "output"} + * + * 4:1-4:8: Headings should use setext + * 6:1-6:13: Headings should use setext + */ + + + + + + var remarkLintHeadingStyle = unifiedLintRule('remark-lint:heading-style', headingStyle); var types$2 = ['atx', 'atx-closed', 'setext']; @@ -45410,6 +44176,103 @@ function headingStyle(tree, file, option) { } } +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module maximum-line-length + * @fileoverview + * Warn when lines are too long. + * + * Options: `number`, default: `80`. + * + * Ignores nodes that cannot be wrapped, such as headings, tables, code, + * definitions, HTML, and JSX. + * + * Ignores images, links, and inline code if they start before the wrap, end + * after the wrap, and there’s no whitespace after them. + * + * @example {"name": "ok.md", "config": {"positionless": true}} + * + * This line is simply not toooooooooooooooooooooooooooooooooooooooooooo + * long. + * + * This is also fine: <http://this-long-url-with-a-long-domain.co.uk/a-long-path?query=variables> + * + * <http://this-link-is-fine.com> + * + * `alphaBravoCharlieDeltaEchoFoxtrotGolfHotelIndiaJuliettKiloLimaMikeNovemberOscarPapaQuebec.romeo()` + * + * [foo](http://this-long-url-with-a-long-domain-is-ok.co.uk/a-long-path?query=variables) + * + * <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 | | | | | | | | | | . | + * + * <a><b><i><p><q><s><u>alpha bravo charlie delta echo foxtrot golf</u></s></q></p></i></b></a> + * + * The following is also fine, because there is no whitespace. + * + * <http://this-long-url-with-a-long-domain-is-ok.co.uk/a-long-path?query=variables>. + * + * In addition, definitions are also fine: + * + * [foo]: <http://this-long-url-with-a-long-domain-is-ok.co.uk/a-long-path?query=variables> + * + * @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: <http://line.com> + * + * <http://this-long-url-with-a-long-domain-is-not-ok.co.uk/a-long-path?query=variables> 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} + * + * <!-- Empty cells are OK, but those surrounding them may not be. --> + * + * | | 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} + * + * <!-- Missing cells are fine as well. --> + * + * | 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/@babel/core/lib/config/files/configuration.js b/tools/node_modules/@babel/core/lib/config/files/configuration.js index 999c3269cd2ef8..4835fb31904706 100644 --- a/tools/node_modules/@babel/core/lib/config/files/configuration.js +++ b/tools/node_modules/@babel/core/lib/config/files/configuration.js @@ -62,8 +62,6 @@ var _patternToRegex = _interopRequireDefault(require("../pattern-to-regex")); var fs = _interopRequireWildcard(require("../../gensync-utils/fs")); -var _resolve = _interopRequireDefault(require("../../gensync-utils/resolve")); - function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = 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; } @@ -147,8 +145,17 @@ function* loadOneConfig(names, dirname, envName, caller, previousConfig = null) } function* loadConfig(name, dirname, envName, caller) { - const filepath = yield* (0, _resolve.default)(name, { - basedir: dirname + const filepath = (parseFloat(process.versions.node) >= 8.9 ? require.resolve : (r, { + paths: [b] + }, M = require("module")) => { + let f = M._findPath(r, M._nodeModulePaths(b).concat(b)); + + if (f) return f; + f = new Error(`Cannot resolve module '${r}'`); + f.code = "MODULE_NOT_FOUND"; + throw f; + })(name, { + paths: [dirname] }); const conf = yield* readConfig(filepath, envName, caller); diff --git a/tools/node_modules/@babel/core/lib/config/files/plugins.js b/tools/node_modules/@babel/core/lib/config/files/plugins.js index 6b9cb715c88568..eddce5f1715316 100644 --- a/tools/node_modules/@babel/core/lib/config/files/plugins.js +++ b/tools/node_modules/@babel/core/lib/config/files/plugins.js @@ -18,16 +18,6 @@ function _debug() { return data; } -function _resolve() { - const data = _interopRequireDefault(require("resolve")); - - _resolve = function () { - return data; - }; - - return data; -} - function _path() { const data = _interopRequireDefault(require("path")); @@ -98,8 +88,17 @@ function resolveStandardizedName(type, name, dirname = process.cwd()) { const standardizedName = standardizeName(type, name); try { - return _resolve().default.sync(standardizedName, { - basedir: dirname + return (parseFloat(process.versions.node) >= 8.9 ? require.resolve : (r, { + paths: [b] + }, M = require("module")) => { + let f = M._findPath(r, M._nodeModulePaths(b).concat(b)); + + if (f) return f; + f = new Error(`Cannot resolve module '${r}'`); + f.code = "MODULE_NOT_FOUND"; + throw f; + })(standardizedName, { + paths: [dirname] }); } catch (e) { if (e.code !== "MODULE_NOT_FOUND") throw e; @@ -108,10 +107,18 @@ function resolveStandardizedName(type, name, dirname = process.cwd()) { let resolvedOriginal = false; try { - _resolve().default.sync(name, { - basedir: dirname + (parseFloat(process.versions.node) >= 8.9 ? require.resolve : (r, { + paths: [b] + }, M = require("module")) => { + let f = M._findPath(r, M._nodeModulePaths(b).concat(b)); + + if (f) return f; + f = new Error(`Cannot resolve module '${r}'`); + f.code = "MODULE_NOT_FOUND"; + throw f; + })(name, { + paths: [dirname] }); - resolvedOriginal = true; } catch (_unused) {} @@ -123,10 +130,18 @@ function resolveStandardizedName(type, name, dirname = process.cwd()) { let resolvedBabel = false; try { - _resolve().default.sync(standardizeName(type, "@babel/" + name), { - basedir: dirname + (parseFloat(process.versions.node) >= 8.9 ? require.resolve : (r, { + paths: [b] + }, M = require("module")) => { + let f = M._findPath(r, M._nodeModulePaths(b).concat(b)); + + if (f) return f; + f = new Error(`Cannot resolve module '${r}'`); + f.code = "MODULE_NOT_FOUND"; + throw f; + })(standardizeName(type, "@babel/" + name), { + paths: [dirname] }); - resolvedBabel = true; } catch (_unused2) {} @@ -138,10 +153,18 @@ function resolveStandardizedName(type, name, dirname = process.cwd()) { const oppositeType = type === "preset" ? "plugin" : "preset"; try { - _resolve().default.sync(standardizeName(oppositeType, name), { - basedir: dirname + (parseFloat(process.versions.node) >= 8.9 ? require.resolve : (r, { + paths: [b] + }, M = require("module")) => { + let f = M._findPath(r, M._nodeModulePaths(b).concat(b)); + + if (f) return f; + f = new Error(`Cannot resolve module '${r}'`); + f.code = "MODULE_NOT_FOUND"; + throw f; + })(standardizeName(oppositeType, name), { + paths: [dirname] }); - resolvedOppositeType = true; } catch (_unused3) {} diff --git a/tools/node_modules/@babel/core/lib/gensync-utils/resolve.js b/tools/node_modules/@babel/core/lib/gensync-utils/resolve.js deleted file mode 100644 index 2ca39d7612d472..00000000000000 --- a/tools/node_modules/@babel/core/lib/gensync-utils/resolve.js +++ /dev/null @@ -1,35 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -function _resolve() { - const data = _interopRequireDefault(require("resolve")); - - _resolve = function () { - return data; - }; - - return data; -} - -function _gensync() { - const data = _interopRequireDefault(require("gensync")); - - _gensync = function () { - return data; - }; - - return data; -} - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var _default = (0, _gensync().default)({ - sync: _resolve().default.sync, - errback: _resolve().default -}); - -exports.default = _default; \ No newline at end of file diff --git a/tools/node_modules/@babel/core/node_modules/@babel/code-frame/README.md b/tools/node_modules/@babel/core/node_modules/@babel/code-frame/README.md index 185f93d2471999..08cacb0477fb94 100644 --- a/tools/node_modules/@babel/core/node_modules/@babel/code-frame/README.md +++ b/tools/node_modules/@babel/core/node_modules/@babel/code-frame/README.md @@ -2,7 +2,7 @@ > Generate errors that contain a code frame that point to source locations. -See our website [@babel/code-frame](https://babeljs.io/docs/en/next/babel-code-frame.html) for more information. +See our website [@babel/code-frame](https://babeljs.io/docs/en/babel-code-frame) for more information. ## Install diff --git a/tools/node_modules/@babel/core/node_modules/@babel/code-frame/package.json b/tools/node_modules/@babel/core/node_modules/@babel/code-frame/package.json index d2e0ccffde9971..07a28a6bda4ec3 100644 --- a/tools/node_modules/@babel/core/node_modules/@babel/code-frame/package.json +++ b/tools/node_modules/@babel/core/node_modules/@babel/code-frame/package.json @@ -1,6 +1,6 @@ { "name": "@babel/code-frame", - "version": "7.10.4", + "version": "7.12.11", "description": "Generate errors that contain a code frame that point to source locations.", "author": "Sebastian McKenzie <sebmck@gmail.com>", "homepage": "https://babeljs.io/", @@ -18,8 +18,8 @@ "@babel/highlight": "^7.10.4" }, "devDependencies": { + "@types/chalk": "^2.0.0", "chalk": "^2.0.0", "strip-ansi": "^4.0.0" - }, - "gitHead": "7fd40d86a0d03ff0e9c3ea16b29689945433d4df" -} + } +} \ No newline at end of file diff --git a/tools/node_modules/@babel/core/node_modules/@babel/generator/lib/generators/types.js b/tools/node_modules/@babel/core/node_modules/@babel/generator/lib/generators/types.js index 603a5935b5061c..ef3054b83273e2 100644 --- a/tools/node_modules/@babel/core/node_modules/@babel/generator/lib/generators/types.js +++ b/tools/node_modules/@babel/core/node_modules/@babel/generator/lib/generators/types.js @@ -218,13 +218,9 @@ function StringLiteral(node) { return; } - const opts = this.format.jsescOption; - - if (this.format.jsonCompatibleStrings) { - opts.json = true; - } - - const val = (0, _jsesc.default)(node.value, opts); + const val = (0, _jsesc.default)(node.value, Object.assign(this.format.jsescOption, this.format.jsonCompatibleStrings && { + json: true + })); return this.token(val); } @@ -232,22 +228,22 @@ function BigIntLiteral(node) { const raw = this.getPossibleRaw(node); if (!this.format.minified && raw != null) { - this.token(raw); + this.word(raw); return; } - this.token(node.value + "n"); + this.word(node.value + "n"); } function DecimalLiteral(node) { const raw = this.getPossibleRaw(node); if (!this.format.minified && raw != null) { - this.token(raw); + this.word(raw); return; } - this.token(node.value + "m"); + this.word(node.value + "m"); } function PipelineTopicExpression(node) { diff --git a/tools/node_modules/@babel/core/node_modules/@babel/generator/lib/index.js b/tools/node_modules/@babel/core/node_modules/@babel/generator/lib/index.js index 115ab16a10a898..b3fcd73b364610 100644 --- a/tools/node_modules/@babel/core/node_modules/@babel/generator/lib/index.js +++ b/tools/node_modules/@babel/core/node_modules/@babel/generator/lib/index.js @@ -38,7 +38,6 @@ function normalizeOptions(code, opts) { compact: opts.compact, minified: opts.minified, concise: opts.concise, - jsonCompatibleStrings: opts.jsonCompatibleStrings, indent: { adjustMultilineComment: true, style: " ", @@ -51,6 +50,9 @@ function normalizeOptions(code, opts) { }, opts.jsescOption), recordAndTupleSyntaxType: opts.recordAndTupleSyntaxType }; + { + format.jsonCompatibleStrings = opts.jsonCompatibleStrings; + } if (format.minified) { format.compact = true; diff --git a/tools/node_modules/@babel/core/node_modules/@babel/generator/package.json b/tools/node_modules/@babel/core/node_modules/@babel/generator/package.json index b76c14e291015c..96f3acfa11306c 100644 --- a/tools/node_modules/@babel/core/node_modules/@babel/generator/package.json +++ b/tools/node_modules/@babel/core/node_modules/@babel/generator/package.json @@ -1,6 +1,6 @@ { "name": "@babel/generator", - "version": "7.12.5", + "version": "7.12.11", "description": "Turns an AST into code.", "author": "Sebastian McKenzie <sebmck@gmail.com>", "homepage": "https://babeljs.io/", @@ -18,12 +18,12 @@ "lib" ], "dependencies": { - "@babel/types": "^7.12.5", + "@babel/types": "^7.12.11", "jsesc": "^2.5.1", "source-map": "^0.5.0" }, "devDependencies": { - "@babel/helper-fixtures": "7.10.5", - "@babel/parser": "7.12.5" + "@babel/helper-fixtures": "7.12.10", + "@babel/parser": "7.12.11" } } \ No newline at end of file diff --git a/tools/node_modules/@babel/core/node_modules/@babel/helper-function-name/README.md b/tools/node_modules/@babel/core/node_modules/@babel/helper-function-name/README.md index a8a6809ace3d6e..36a65931b20ebb 100644 --- a/tools/node_modules/@babel/core/node_modules/@babel/helper-function-name/README.md +++ b/tools/node_modules/@babel/core/node_modules/@babel/helper-function-name/README.md @@ -2,7 +2,7 @@ > Helper function to change the property 'name' of every function -See our website [@babel/helper-function-name](https://babeljs.io/docs/en/next/babel-helper-function-name.html) for more information. +See our website [@babel/helper-function-name](https://babeljs.io/docs/en/babel-helper-function-name) for more information. ## Install diff --git a/tools/node_modules/@babel/core/node_modules/@babel/helper-function-name/package.json b/tools/node_modules/@babel/core/node_modules/@babel/helper-function-name/package.json index 98c7f62ce193d4..42b3e100e1ced0 100644 --- a/tools/node_modules/@babel/core/node_modules/@babel/helper-function-name/package.json +++ b/tools/node_modules/@babel/core/node_modules/@babel/helper-function-name/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-function-name", - "version": "7.10.4", + "version": "7.12.11", "description": "Helper function to change the property 'name' of every function", "repository": { "type": "git", @@ -13,9 +13,8 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/helper-get-function-arity": "^7.10.4", - "@babel/template": "^7.10.4", - "@babel/types": "^7.10.4" - }, - "gitHead": "7fd40d86a0d03ff0e9c3ea16b29689945433d4df" -} + "@babel/helper-get-function-arity": "^7.12.10", + "@babel/template": "^7.12.7", + "@babel/types": "^7.12.11" + } +} \ No newline at end of file diff --git a/tools/node_modules/@babel/core/node_modules/@babel/helper-get-function-arity/README.md b/tools/node_modules/@babel/core/node_modules/@babel/helper-get-function-arity/README.md index 1de8084fb133bc..8fa48c13e71816 100644 --- a/tools/node_modules/@babel/core/node_modules/@babel/helper-get-function-arity/README.md +++ b/tools/node_modules/@babel/core/node_modules/@babel/helper-get-function-arity/README.md @@ -2,7 +2,7 @@ > Helper function to get function arity -See our website [@babel/helper-get-function-arity](https://babeljs.io/docs/en/next/babel-helper-get-function-arity.html) for more information. +See our website [@babel/helper-get-function-arity](https://babeljs.io/docs/en/babel-helper-get-function-arity) for more information. ## Install diff --git a/tools/node_modules/@babel/core/node_modules/@babel/helper-get-function-arity/package.json b/tools/node_modules/@babel/core/node_modules/@babel/helper-get-function-arity/package.json index 6b53c0b74b3b71..736839ec5ff305 100644 --- a/tools/node_modules/@babel/core/node_modules/@babel/helper-get-function-arity/package.json +++ b/tools/node_modules/@babel/core/node_modules/@babel/helper-get-function-arity/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-get-function-arity", - "version": "7.10.4", + "version": "7.12.10", "description": "Helper function to get function arity", "repository": { "type": "git", @@ -13,7 +13,6 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/types": "^7.10.4" - }, - "gitHead": "7fd40d86a0d03ff0e9c3ea16b29689945433d4df" -} + "@babel/types": "^7.12.10" + } +} \ No newline at end of file diff --git a/tools/node_modules/@babel/core/node_modules/@babel/helper-optimise-call-expression/lib/index.js b/tools/node_modules/@babel/core/node_modules/@babel/helper-optimise-call-expression/lib/index.js index 0d5b34e5d6fded..0751eb3ca5527b 100644 --- a/tools/node_modules/@babel/core/node_modules/@babel/helper-optimise-call-expression/lib/index.js +++ b/tools/node_modules/@babel/core/node_modules/@babel/helper-optimise-call-expression/lib/index.js @@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); -exports.default = _default; +exports.default = optimiseCallExpression; var t = _interopRequireWildcard(require("@babel/types")); @@ -11,7 +11,7 @@ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return 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 _default(callee, thisNode, args, optional) { +function optimiseCallExpression(callee, thisNode, args, optional) { if (args.length === 1 && t.isSpreadElement(args[0]) && t.isIdentifier(args[0].argument, { name: "arguments" })) { diff --git a/tools/node_modules/@babel/core/node_modules/@babel/helper-optimise-call-expression/package.json b/tools/node_modules/@babel/core/node_modules/@babel/helper-optimise-call-expression/package.json index e71c0e887520da..3973be801216bd 100644 --- a/tools/node_modules/@babel/core/node_modules/@babel/helper-optimise-call-expression/package.json +++ b/tools/node_modules/@babel/core/node_modules/@babel/helper-optimise-call-expression/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-optimise-call-expression", - "version": "7.12.7", + "version": "7.12.10", "description": "Helper function to optimise call expression", "repository": { "type": "git", @@ -13,10 +13,10 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/types": "^7.12.7" + "@babel/types": "^7.12.10" }, "devDependencies": { - "@babel/generator": "7.12.5", - "@babel/parser": "7.12.7" + "@babel/generator": "7.12.10", + "@babel/parser": "7.12.10" } } \ No newline at end of file diff --git a/tools/node_modules/@babel/core/node_modules/@babel/helper-replace-supers/lib/index.js b/tools/node_modules/@babel/core/node_modules/@babel/helper-replace-supers/lib/index.js index d434da7028c5ae..f08da165b1afec 100644 --- a/tools/node_modules/@babel/core/node_modules/@babel/helper-replace-supers/lib/index.js +++ b/tools/node_modules/@babel/core/node_modules/@babel/helper-replace-supers/lib/index.js @@ -40,7 +40,7 @@ function skipAllButComputedKey(path) { } const environmentVisitor = { - [`${t.StaticBlock ? "StaticBlock|" : ""}ClassPrivateProperty|TypeAnnotation`](path) { + [`${t.staticBlock ? "StaticBlock|" : ""}ClassPrivateProperty|TypeAnnotation`](path) { path.skip(); }, diff --git a/tools/node_modules/@babel/core/node_modules/@babel/helper-replace-supers/package.json b/tools/node_modules/@babel/core/node_modules/@babel/helper-replace-supers/package.json index e2c2392524fef8..bc8d05da90c053 100644 --- a/tools/node_modules/@babel/core/node_modules/@babel/helper-replace-supers/package.json +++ b/tools/node_modules/@babel/core/node_modules/@babel/helper-replace-supers/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-replace-supers", - "version": "7.12.5", + "version": "7.12.11", "description": "Helper function to replace supers", "repository": { "type": "git", @@ -13,9 +13,9 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/helper-member-expression-to-functions": "^7.12.1", - "@babel/helper-optimise-call-expression": "^7.10.4", - "@babel/traverse": "^7.12.5", - "@babel/types": "^7.12.5" + "@babel/helper-member-expression-to-functions": "^7.12.7", + "@babel/helper-optimise-call-expression": "^7.12.10", + "@babel/traverse": "^7.12.10", + "@babel/types": "^7.12.11" } } \ No newline at end of file diff --git a/tools/node_modules/@babel/core/node_modules/@babel/helper-split-export-declaration/README.md b/tools/node_modules/@babel/core/node_modules/@babel/helper-split-export-declaration/README.md index d241fee0f6dc44..a6f54046044463 100644 --- a/tools/node_modules/@babel/core/node_modules/@babel/helper-split-export-declaration/README.md +++ b/tools/node_modules/@babel/core/node_modules/@babel/helper-split-export-declaration/README.md @@ -2,7 +2,7 @@ > -See our website [@babel/helper-split-export-declaration](https://babeljs.io/docs/en/next/babel-helper-split-export-declaration.html) for more information. +See our website [@babel/helper-split-export-declaration](https://babeljs.io/docs/en/babel-helper-split-export-declaration) for more information. ## Install diff --git a/tools/node_modules/@babel/core/node_modules/@babel/helper-split-export-declaration/package.json b/tools/node_modules/@babel/core/node_modules/@babel/helper-split-export-declaration/package.json index 3cd12554e9aa5a..5913ccfef09e91 100644 --- a/tools/node_modules/@babel/core/node_modules/@babel/helper-split-export-declaration/package.json +++ b/tools/node_modules/@babel/core/node_modules/@babel/helper-split-export-declaration/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-split-export-declaration", - "version": "7.11.0", + "version": "7.12.11", "description": "", "repository": { "type": "git", @@ -13,6 +13,6 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/types": "^7.11.0" + "@babel/types": "^7.12.11" } -} +} \ No newline at end of file diff --git a/tools/node_modules/@babel/core/node_modules/@babel/helper-validator-identifier/README.md b/tools/node_modules/@babel/core/node_modules/@babel/helper-validator-identifier/README.md index ab2dad173149e8..6733576a8ce76b 100644 --- a/tools/node_modules/@babel/core/node_modules/@babel/helper-validator-identifier/README.md +++ b/tools/node_modules/@babel/core/node_modules/@babel/helper-validator-identifier/README.md @@ -2,7 +2,7 @@ > Validate identifier/keywords name -See our website [@babel/helper-validator-identifier](https://babeljs.io/docs/en/next/babel-helper-validator-identifier.html) for more information. +See our website [@babel/helper-validator-identifier](https://babeljs.io/docs/en/babel-helper-validator-identifier) for more information. ## Install diff --git a/tools/node_modules/@babel/core/node_modules/@babel/helper-validator-identifier/package.json b/tools/node_modules/@babel/core/node_modules/@babel/helper-validator-identifier/package.json index 79112981bddbb9..464dbfa3aace49 100644 --- a/tools/node_modules/@babel/core/node_modules/@babel/helper-validator-identifier/package.json +++ b/tools/node_modules/@babel/core/node_modules/@babel/helper-validator-identifier/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-validator-identifier", - "version": "7.10.4", + "version": "7.12.11", "description": "Validate identifier/keywords name", "repository": { "type": "git", @@ -16,6 +16,5 @@ "devDependencies": { "charcodes": "^0.2.0", "unicode-13.0.0": "^0.8.0" - }, - "gitHead": "7fd40d86a0d03ff0e9c3ea16b29689945433d4df" -} + } +} \ No newline at end of file diff --git a/tools/node_modules/@babel/core/node_modules/@babel/parser/lib/index.js b/tools/node_modules/@babel/core/node_modules/@babel/parser/lib/index.js index a37d8f6a4c85fc..2f888fabfe390a 100644 --- a/tools/node_modules/@babel/core/node_modules/@babel/parser/lib/index.js +++ b/tools/node_modules/@babel/core/node_modules/@babel/parser/lib/index.js @@ -608,7 +608,7 @@ const ErrorMessages = Object.freeze({ DuplicateStaticBlock: "Duplicate static block in the same class", ElementAfterRest: "Rest element must be last element", EscapedCharNotAnIdentifier: "Invalid Unicode escape", - ExportBindingIsString: "A string literal cannot be used as an exported binding without `from`.\n- Did you mean `export { %0 as '%1' } from 'some-module'`?", + ExportBindingIsString: "A string literal cannot be used as an exported binding without `from`.\n- Did you mean `export { '%0' as '%1' } from 'some-module'`?", ExportDefaultFromAsIdentifier: "'from' is not allowed as an identifier after 'export default'", ForInOfLoopInitializer: "%0 loop variable declaration may not have an initializer", GeneratorInSingleStatementContext: "Generators can only be declared at the top level or inside a block", @@ -758,10 +758,6 @@ class ParserError extends CommentsParser { } -function isSimpleProperty(node) { - return node != null && node.type === "Property" && node.kind === "init" && node.method === false; -} - var estree = (superClass => class extends superClass { estreeParseRegExpLiteral({ pattern, @@ -782,7 +778,14 @@ var estree = (superClass => class extends superClass { } estreeParseBigIntLiteral(value) { - const bigInt = typeof BigInt !== "undefined" ? BigInt(value) : null; + let bigInt; + + try { + bigInt = BigInt(value); + } catch (_unused) { + bigInt = null; + } + const node = this.estreeParseLiteral(bigInt); node.bigint = String(node.value || value); return node; @@ -803,7 +806,7 @@ var estree = (superClass => class extends superClass { const directiveLiteral = directive.value; const stmt = this.startNodeAt(directive.start, directive.loc.start); const expression = this.startNodeAt(directiveLiteral.start, directiveLiteral.loc.start); - expression.value = directiveLiteral.value; + expression.value = directiveLiteral.extra.expressionValue; expression.raw = directiveLiteral.extra.raw; stmt.expression = this.finishNodeAt(expression, "Literal", directiveLiteral.end, directiveLiteral.loc.end); stmt.directive = directiveLiteral.extra.raw.slice(1, -1); @@ -816,7 +819,7 @@ var estree = (superClass => class extends superClass { } checkDeclaration(node) { - if (isSimpleProperty(node)) { + if (node != null && this.isObjectProperty(node)) { this.checkDeclaration(node.value); } else { super.checkDeclaration(node); @@ -827,27 +830,6 @@ var estree = (superClass => class extends superClass { return method.value.params; } - checkLVal(expr, contextDescription, ...args) { - switch (expr.type) { - case "ObjectPattern": - expr.properties.forEach(prop => { - this.checkLVal(prop.type === "Property" ? prop.value : prop, "object destructuring pattern", ...args); - }); - break; - - default: - super.checkLVal(expr, contextDescription, ...args); - } - } - - checkProto(prop, isRecord, protoRef, refExpressionErrors) { - if (prop.method) { - return; - } - - super.checkProto(prop, isRecord, protoRef, refExpressionErrors); - } - isValidDirective(stmt) { var _stmt$expression$extr; @@ -857,12 +839,12 @@ var estree = (superClass => class extends superClass { stmtToDirective(stmt) { const directive = super.stmtToDirective(stmt); const value = stmt.expression.value; - directive.value.value = value; + this.addExtra(directive.value, "expressionValue", value); return directive; } - parseBlockBody(node, allowDirectives, topLevel, end) { - super.parseBlockBody(node, allowDirectives, topLevel, end); + parseBlockBody(node, ...args) { + super.parseBlockBody(node, ...args); const directiveStatements = node.directives.map(d => this.directiveToStmt(d)); node.body = directiveStatements.concat(node.body); delete node.directives; @@ -955,8 +937,8 @@ var estree = (superClass => class extends superClass { } toAssignable(node, isLHS = false) { - if (isSimpleProperty(node)) { - this.toAssignable(node.value); + if (node != null && this.isObjectProperty(node)) { + this.toAssignable(node.value, isLHS); return node; } @@ -965,9 +947,9 @@ var estree = (superClass => class extends superClass { toAssignableObjectExpressionProp(prop, ...args) { if (prop.kind === "get" || prop.kind === "set") { - throw this.raise(prop.key.start, ErrorMessages.PatternHasAccessor); + this.raise(prop.key.start, ErrorMessages.PatternHasAccessor); } else if (prop.method) { - throw this.raise(prop.key.start, ErrorMessages.PatternHasMethod); + this.raise(prop.key.start, ErrorMessages.PatternHasMethod); } else { super.toAssignableObjectExpressionProp(prop, ...args); } @@ -1035,6 +1017,26 @@ var estree = (superClass => class extends superClass { return node; } + hasPropertyAsPrivateName(node) { + if (node.type === "ChainExpression") { + node = node.expression; + } + + return super.hasPropertyAsPrivateName(node); + } + + isOptionalChain(node) { + return node.type === "ChainExpression"; + } + + isObjectProperty(node) { + return node.type === "Property" && node.kind === "init" && !node.method; + } + + isObjectMethod(node) { + return node.method || node.kind === "get" || node.kind === "set"; + } + }); class TokContext { @@ -4323,6 +4325,7 @@ const JsxErrors = Object.freeze({ AttributeIsEmpty: "JSX attributes must only be assigned a non-empty expression", MissingClosingTagFragment: "Expected corresponding JSX closing tag for <>", MissingClosingTagElement: "Expected corresponding JSX closing tag for <%0>", + UnexpectedSequenceExpression: "Sequence expressions cannot be directly nested inside JSX. Did you mean to wrap it in parentheses (...)?", UnsupportedJsxValue: "JSX value should be either an expression or a quoted JSX text", UnterminatedJsxContent: "Unterminated JSX contents", UnwrappedAdjacentJSXElements: "Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...</>?" @@ -4607,7 +4610,8 @@ var jsx = (superClass => class extends superClass { if (this.match(types.braceR)) { node.expression = this.jsxParseEmptyExpression(); } else { - node.expression = this.parseExpression(); + const expression = this.parseExpression(); + node.expression = expression; } this.expect(types.braceR); @@ -7723,7 +7727,7 @@ class State { this.context = [types$1.braceStatement]; this.exprAllowed = true; this.containsEsc = false; - this.octalPositions = []; + this.strictErrors = new Map(); this.exportedIdentifiers = []; this.tokensLength = 0; } @@ -7855,15 +7859,11 @@ class Tokenizer extends ParserError { setStrict(strict) { this.state.strict = strict; - if (!this.match(types.num) && !this.match(types.string)) return; - this.state.pos = this.state.start; - while (this.state.pos < this.state.lineStart) { - this.state.lineStart = this.input.lastIndexOf("\n", this.state.lineStart - 2) + 1; - --this.state.curLine; + if (strict) { + this.state.strictErrors.forEach((message, pos) => this.raise(pos, message)); + this.state.strictErrors.clear(); } - - this.nextToken(); } curContext() { @@ -7873,7 +7873,6 @@ class Tokenizer extends ParserError { nextToken() { const curContext = this.curContext(); if (!(curContext == null ? void 0 : curContext.preserveSpace)) this.skipSpace(); - this.state.octalPositions = []; this.state.start = this.state.pos; this.state.startLoc = this.state.curPosition(); @@ -8600,10 +8599,9 @@ class Tokenizer extends ParserError { if (hasLeadingZero) { const integer = this.input.slice(start, this.state.pos); + this.recordStrictModeErrors(start, ErrorMessages.StrictOctalLiteral); - if (this.state.strict) { - this.raise(start, ErrorMessages.StrictOctalLiteral); - } else { + if (!this.state.strict) { const underscorePos = integer.indexOf("_"); if (underscorePos > 0) { @@ -8802,6 +8800,14 @@ class Tokenizer extends ParserError { } } + recordStrictModeErrors(pos, message) { + if (this.state.strict && !this.state.strictErrors.has(pos)) { + this.raise(pos, message); + } else { + this.state.strictErrors.set(pos, message); + } + } + readEscapedChar(inTemplate) { const throwOnInvalid = !inTemplate; const ch = this.input.charCodeAt(++this.state.pos); @@ -8855,8 +8861,8 @@ class Tokenizer extends ParserError { case 57: if (inTemplate) { return null; - } else if (this.state.strict) { - this.raise(this.state.pos - 1, ErrorMessages.StrictNumericEscape); + } else { + this.recordStrictModeErrors(this.state.pos - 1, ErrorMessages.StrictNumericEscape); } default: @@ -8877,10 +8883,8 @@ class Tokenizer extends ParserError { if (octalStr !== "0" || next === 56 || next === 57) { if (inTemplate) { return null; - } else if (this.state.strict) { - this.raise(codePos, ErrorMessages.StrictNumericEscape); } else { - this.state.octalPositions.push(codePos); + this.recordStrictModeErrors(codePos, ErrorMessages.StrictNumericEscape); } } @@ -9194,6 +9198,30 @@ class UtilParser extends Tokenizer { return this.match(types.name) || !!this.state.type.keyword || this.match(types.string) || this.match(types.num) || this.match(types.bigint) || this.match(types.decimal); } + isPrivateName(node) { + return node.type === "PrivateName"; + } + + getPrivateNameSV(node) { + return node.id.name; + } + + hasPropertyAsPrivateName(node) { + return (node.type === "MemberExpression" || node.type === "OptionalMemberExpression") && this.isPrivateName(node.property); + } + + isOptionalChain(node) { + return node.type === "OptionalMemberExpression" || node.type === "OptionalCallExpression"; + } + + isObjectProperty(node) { + return node.type === "ObjectProperty"; + } + + isObjectMethod(node) { + return node.type === "ObjectMethod"; + } + } class ExpressionErrors { constructor() { @@ -9575,7 +9603,7 @@ class LValParser extends NodeUtils { case "ObjectPattern": for (let _i2 = 0, _expr$properties = expr.properties; _i2 < _expr$properties.length; _i2++) { let prop = _expr$properties[_i2]; - if (prop.type === "ObjectProperty") prop = prop.value;else if (prop.type === "ObjectMethod") continue; + if (this.isObjectProperty(prop)) prop = prop.value;else if (this.isObjectMethod(prop)) continue; this.checkLVal(prop, "object destructuring pattern", bindingType, checkClashes, disallowLetBinding); } @@ -9777,7 +9805,7 @@ function newExpressionScope() { class ExpressionParser extends LValParser { checkProto(prop, isRecord, protoRef, refExpressionErrors) { - if (prop.type === "SpreadElement" || prop.type === "ObjectMethod" || prop.computed || prop.shorthand) { + if (prop.type === "SpreadElement" || this.isObjectMethod(prop) || prop.computed || prop.shorthand) { return; } @@ -10078,7 +10106,7 @@ class ExpressionParser extends LValParser { if (arg.type === "Identifier") { this.raise(node.start, ErrorMessages.StrictDelete); - } else if ((arg.type === "MemberExpression" || arg.type === "OptionalMemberExpression") && arg.property.type === "PrivateName") { + } else if (this.hasPropertyAsPrivateName(arg)) { this.raise(node.start, ErrorMessages.DeletePrivateField); } } @@ -10153,13 +10181,12 @@ class ExpressionParser extends LValParser { let optional = false; if (this.match(types.questionDot)) { - state.optionalChainMember = optional = true; - if (noCalls && this.lookaheadCharCode() === 40) { state.stop = true; return base; } + state.optionalChainMember = optional = true; this.next(); } @@ -10180,12 +10207,12 @@ class ExpressionParser extends LValParser { node.computed = computed; const property = computed ? this.parseExpression() : this.parseMaybePrivateName(true); - if (property.type === "PrivateName") { + if (this.isPrivateName(property)) { if (node.object.type === "Super") { this.raise(startPos, ErrorMessages.SuperPrivateField); } - this.classScope.usePrivateName(property.id.name, property.start); + this.classScope.usePrivateName(this.getPrivateNameSV(property), property.start); } node.property = property; @@ -10816,7 +10843,7 @@ class ExpressionParser extends LValParser { if (node.callee.type === "Import") { this.raise(node.callee.start, ErrorMessages.ImportCallNotNewExpression); - } else if (node.callee.type === "OptionalMemberExpression" || node.callee.type === "OptionalCallExpression") { + } else if (this.isOptionalChain(node.callee)) { this.raise(this.state.lastTokEnd, ErrorMessages.OptionalChainingNoNew); } else if (this.eat(types.questionDot)) { this.raise(this.state.start, ErrorMessages.OptionalChainingNoNew); @@ -10907,7 +10934,7 @@ class ExpressionParser extends LValParser { this.checkProto(prop, isRecord, propHash, refExpressionErrors); } - if (isRecord && prop.type !== "ObjectProperty" && prop.type !== "SpreadElement") { + if (isRecord && !this.isObjectProperty(prop) && prop.type !== "SpreadElement") { this.raise(prop.start, ErrorMessages.InvalidRecordProperty); } @@ -11102,7 +11129,7 @@ class ExpressionParser extends LValParser { this.state.inPropertyName = true; prop.key = this.match(types.num) || this.match(types.string) || this.match(types.bigint) || this.match(types.decimal) ? this.parseExprAtom() : this.parseMaybePrivateName(isPrivateNameAllowed); - if (prop.key.type !== "PrivateName") { + if (!this.isPrivateName(prop.key)) { prop.computed = false; } @@ -11364,11 +11391,10 @@ class ExpressionParser extends LValParser { } isAwaitAllowed() { - if (this.scope.inFunction) return this.prodParam.hasAwait; - if (this.options.allowAwaitOutsideFunction) return true; + if (this.prodParam.hasAwait) return true; - if (this.hasPlugin("topLevelAwait")) { - return this.inModule && this.prodParam.hasAwait; + if (this.options.allowAwaitOutsideFunction && !this.scope.inFunction) { + return true; } return false; @@ -12193,6 +12219,11 @@ class StatementParser extends ExpressionParser { parseBlock(allowDirectives = false, createNewLexicalScope = true, afterBlockParse) { const node = this.startNode(); + + if (allowDirectives) { + this.state.strictErrors.clear(); + } + this.expect(types.braceL); if (createNewLexicalScope) { @@ -12219,41 +12250,33 @@ class StatementParser extends ExpressionParser { } parseBlockOrModuleBlockBody(body, directives, topLevel, end, afterBlockParse) { - const octalPositions = []; const oldStrict = this.state.strict; let hasStrictModeDirective = false; let parsedNonDirective = false; while (!this.match(end)) { - if (!parsedNonDirective && this.state.octalPositions.length) { - octalPositions.push(...this.state.octalPositions); - } - const stmt = this.parseStatement(null, topLevel); - if (directives && !parsedNonDirective && this.isValidDirective(stmt)) { - const directive = this.stmtToDirective(stmt); - directives.push(directive); + if (directives && !parsedNonDirective) { + if (this.isValidDirective(stmt)) { + const directive = this.stmtToDirective(stmt); + directives.push(directive); + + if (!hasStrictModeDirective && directive.value.value === "use strict") { + hasStrictModeDirective = true; + this.setStrict(true); + } - if (!hasStrictModeDirective && directive.value.value === "use strict") { - hasStrictModeDirective = true; - this.setStrict(true); + continue; } - continue; + parsedNonDirective = true; + this.state.strictErrors.clear(); } - parsedNonDirective = true; body.push(stmt); } - if (this.state.strict && octalPositions.length) { - for (let _i3 = 0; _i3 < octalPositions.length; _i3++) { - const pos = octalPositions[_i3]; - this.raise(pos, ErrorMessages.StrictOctalLiteral); - } - } - if (afterBlockParse) { afterBlockParse.call(this, hasStrictModeDirective); } @@ -12522,7 +12545,7 @@ class StatementParser extends ExpressionParser { method.kind = "method"; this.parseClassElementName(method); - if (method.key.type === "PrivateName") { + if (this.isPrivateName(method.key)) { this.pushClassPrivateMethod(classBody, privateMethod, true, false); return; } @@ -12537,7 +12560,7 @@ class StatementParser extends ExpressionParser { const containsEsc = this.state.containsEsc; const key = this.parseClassElementName(member); - const isPrivate = key.type === "PrivateName"; + const isPrivate = this.isPrivateName(key); const isSimple = key.type === "Identifier"; const maybeQuestionTokenStart = this.state.start; this.parsePostMemberNameModifiers(publicMember); @@ -12582,7 +12605,7 @@ class StatementParser extends ExpressionParser { this.parseClassElementName(method); this.parsePostMemberNameModifiers(publicMember); - if (method.key.type === "PrivateName") { + if (this.isPrivateName(method.key)) { this.pushClassPrivateMethod(classBody, privateMethod, isGenerator, true); } else { if (this.isNonstaticConstructor(publicMethod)) { @@ -12595,7 +12618,7 @@ class StatementParser extends ExpressionParser { method.kind = key.name; this.parseClassElementName(publicMethod); - if (method.key.type === "PrivateName") { + if (this.isPrivateName(method.key)) { this.pushClassPrivateMethod(classBody, privateMethod, false, false); } else { if (this.isNonstaticConstructor(publicMethod)) { @@ -12624,7 +12647,7 @@ class StatementParser extends ExpressionParser { this.raise(key.start, ErrorMessages.StaticPrototype); } - if (key.type === "PrivateName" && key.id.name === "constructor") { + if (this.isPrivateName(key) && this.getPrivateNameSV(key) === "constructor") { this.raise(key.start, ErrorMessages.ConstructorClassPrivateField); } @@ -12671,7 +12694,7 @@ class StatementParser extends ExpressionParser { this.expectPlugin("classPrivateProperties", prop.key.start); const node = this.parseClassPrivateProperty(prop); classBody.body.push(node); - this.classScope.declarePrivateName(node.key.id.name, CLASS_ELEMENT_OTHER, node.key.start); + this.classScope.declarePrivateName(this.getPrivateNameSV(node.key), CLASS_ELEMENT_OTHER, node.key.start); } pushClassMethod(classBody, method, isGenerator, isAsync, isConstructor, allowsDirectSuper) { @@ -12683,7 +12706,7 @@ class StatementParser extends ExpressionParser { const node = this.parseMethod(method, isGenerator, isAsync, false, false, "ClassPrivateMethod", true); classBody.body.push(node); const kind = node.kind === "get" ? node.static ? CLASS_ELEMENT_STATIC_GETTER : CLASS_ELEMENT_INSTANCE_GETTER : node.kind === "set" ? node.static ? CLASS_ELEMENT_STATIC_SETTER : CLASS_ELEMENT_INSTANCE_SETTER : CLASS_ELEMENT_OTHER; - this.classScope.declarePrivateName(node.key.id.name, kind, node.key.start); + this.classScope.declarePrivateName(this.getPrivateNameSV(node.key), kind, node.key.start); } parsePostMemberNameModifiers(methodOrProp) {} @@ -12955,8 +12978,8 @@ class StatementParser extends ExpressionParser { } } } else if (node.specifiers && node.specifiers.length) { - for (let _i4 = 0, _node$specifiers = node.specifiers; _i4 < _node$specifiers.length; _i4++) { - const specifier = _node$specifiers[_i4]; + for (let _i3 = 0, _node$specifiers = node.specifiers; _i3 < _node$specifiers.length; _i3++) { + const specifier = _node$specifiers[_i3]; const { exported } = specifier; @@ -12969,7 +12992,7 @@ class StatementParser extends ExpressionParser { } = specifier; if (local.type === "StringLiteral") { - this.raise(specifier.start, ErrorMessages.ExportBindingIsString, local.extra.raw, exportedName); + this.raise(specifier.start, ErrorMessages.ExportBindingIsString, local.value, exportedName); } else { this.checkReservedWord(local.name, local.start, true, false); this.scope.checkLocalExport(local); @@ -12982,8 +13005,8 @@ class StatementParser extends ExpressionParser { if (!id) throw new Error("Assertion failure"); this.checkDuplicateExports(node, id.name); } else if (node.declaration.type === "VariableDeclaration") { - for (let _i5 = 0, _node$declaration$dec = node.declaration.declarations; _i5 < _node$declaration$dec.length; _i5++) { - const declaration = _node$declaration$dec[_i5]; + for (let _i4 = 0, _node$declaration$dec = node.declaration.declarations; _i4 < _node$declaration$dec.length; _i4++) { + const declaration = _node$declaration$dec[_i4]; this.checkDeclaration(declaration.id); } } @@ -13001,13 +13024,13 @@ class StatementParser extends ExpressionParser { if (node.type === "Identifier") { this.checkDuplicateExports(node, node.name); } else if (node.type === "ObjectPattern") { - for (let _i6 = 0, _node$properties = node.properties; _i6 < _node$properties.length; _i6++) { - const prop = _node$properties[_i6]; + for (let _i5 = 0, _node$properties = node.properties; _i5 < _node$properties.length; _i5++) { + const prop = _node$properties[_i5]; this.checkDeclaration(prop); } } else if (node.type === "ArrayPattern") { - for (let _i7 = 0, _node$elements = node.elements; _i7 < _node$elements.length; _i7++) { - const elem = _node$elements[_i7]; + for (let _i6 = 0, _node$elements = node.elements; _i6 < _node$elements.length; _i6++) { + const elem = _node$elements[_i6]; if (elem) { this.checkDeclaration(elem); diff --git a/tools/node_modules/@babel/core/node_modules/@babel/parser/package.json b/tools/node_modules/@babel/core/node_modules/@babel/parser/package.json index d26cd44fb7852b..0632cf7c13535f 100644 --- a/tools/node_modules/@babel/core/node_modules/@babel/parser/package.json +++ b/tools/node_modules/@babel/core/node_modules/@babel/parser/package.json @@ -1,6 +1,6 @@ { "name": "@babel/parser", - "version": "7.12.7", + "version": "7.12.11", "description": "A JavaScript parser", "author": "Sebastian McKenzie <sebmck@gmail.com>", "homepage": "https://babeljs.io/", @@ -32,9 +32,9 @@ "node": ">=6.0.0" }, "devDependencies": { - "@babel/code-frame": "7.10.4", - "@babel/helper-fixtures": "7.10.5", - "@babel/helper-validator-identifier": "7.10.4", + "@babel/code-frame": "7.12.11", + "@babel/helper-fixtures": "7.12.10", + "@babel/helper-validator-identifier": "7.12.11", "charcodes": "^0.2.0" }, "bin": "./bin/babel-parser.js" diff --git a/tools/node_modules/@babel/core/node_modules/@babel/traverse/lib/path/modification.js b/tools/node_modules/@babel/core/node_modules/@babel/traverse/lib/path/modification.js index e8bee5944c14de..cc1e2d0e519de6 100644 --- a/tools/node_modules/@babel/core/node_modules/@babel/traverse/lib/path/modification.js +++ b/tools/node_modules/@babel/core/node_modules/@babel/traverse/lib/path/modification.js @@ -186,7 +186,7 @@ function unshiftContainer(listKey, nodes) { container: this.node[listKey], listKey, key: 0 - }); + }).setContext(this.context); return path._containerInsertBefore(nodes); } @@ -203,7 +203,7 @@ function pushContainer(listKey, nodes) { container: container, listKey, key: container.length - }); + }).setContext(this.context); return path.replaceWithMultiple(nodes); } diff --git a/tools/node_modules/@babel/core/node_modules/@babel/traverse/lib/scope/lib/renamer.js b/tools/node_modules/@babel/core/node_modules/@babel/traverse/lib/scope/lib/renamer.js index 6d1bb1847f437e..2f82343bc6f565 100644 --- a/tools/node_modules/@babel/core/node_modules/@babel/traverse/lib/scope/lib/renamer.js +++ b/tools/node_modules/@babel/core/node_modules/@babel/traverse/lib/scope/lib/renamer.js @@ -104,7 +104,15 @@ class Renamer { } } - scope.traverse(block || scope.block, renameVisitor, this); + const blockToTraverse = block || scope.block; + + if ((blockToTraverse == null ? void 0 : blockToTraverse.type) === "SwitchStatement") { + blockToTraverse.cases.forEach(c => { + scope.traverse(c, renameVisitor, this); + }); + } else { + scope.traverse(blockToTraverse, renameVisitor, this); + } if (!block) { scope.removeOwnBinding(oldName); diff --git a/tools/node_modules/@babel/core/node_modules/@babel/traverse/package.json b/tools/node_modules/@babel/core/node_modules/@babel/traverse/package.json index 3a875cf867494a..7a9969f86498b9 100644 --- a/tools/node_modules/@babel/core/node_modules/@babel/traverse/package.json +++ b/tools/node_modules/@babel/core/node_modules/@babel/traverse/package.json @@ -1,6 +1,6 @@ { "name": "@babel/traverse", - "version": "7.12.9", + "version": "7.12.12", "description": "The Babel Traverse module maintains the overall tree state, and is responsible for replacing, removing, and adding nodes", "author": "Sebastian McKenzie <sebmck@gmail.com>", "homepage": "https://babeljs.io/", @@ -15,12 +15,12 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/code-frame": "^7.10.4", - "@babel/generator": "^7.12.5", - "@babel/helper-function-name": "^7.10.4", - "@babel/helper-split-export-declaration": "^7.11.0", - "@babel/parser": "^7.12.7", - "@babel/types": "^7.12.7", + "@babel/code-frame": "^7.12.11", + "@babel/generator": "^7.12.11", + "@babel/helper-function-name": "^7.12.11", + "@babel/helper-split-export-declaration": "^7.12.11", + "@babel/parser": "^7.12.11", + "@babel/types": "^7.12.12", "debug": "^4.1.0", "globals": "^11.1.0", "lodash": "^4.17.19" diff --git a/tools/node_modules/@babel/core/node_modules/@babel/types/lib/asserts/generated/index.js b/tools/node_modules/@babel/core/node_modules/@babel/types/lib/asserts/generated/index.js index 659c4196f3e3fc..dd9c71a68d0fde 100644 --- a/tools/node_modules/@babel/core/node_modules/@babel/types/lib/asserts/generated/index.js +++ b/tools/node_modules/@babel/core/node_modules/@babel/types/lib/asserts/generated/index.js @@ -305,1151 +305,1151 @@ function assert(type, node, opts) { } } -function assertArrayExpression(node, opts = {}) { +function assertArrayExpression(node, opts) { assert("ArrayExpression", node, opts); } -function assertAssignmentExpression(node, opts = {}) { +function assertAssignmentExpression(node, opts) { assert("AssignmentExpression", node, opts); } -function assertBinaryExpression(node, opts = {}) { +function assertBinaryExpression(node, opts) { assert("BinaryExpression", node, opts); } -function assertInterpreterDirective(node, opts = {}) { +function assertInterpreterDirective(node, opts) { assert("InterpreterDirective", node, opts); } -function assertDirective(node, opts = {}) { +function assertDirective(node, opts) { assert("Directive", node, opts); } -function assertDirectiveLiteral(node, opts = {}) { +function assertDirectiveLiteral(node, opts) { assert("DirectiveLiteral", node, opts); } -function assertBlockStatement(node, opts = {}) { +function assertBlockStatement(node, opts) { assert("BlockStatement", node, opts); } -function assertBreakStatement(node, opts = {}) { +function assertBreakStatement(node, opts) { assert("BreakStatement", node, opts); } -function assertCallExpression(node, opts = {}) { +function assertCallExpression(node, opts) { assert("CallExpression", node, opts); } -function assertCatchClause(node, opts = {}) { +function assertCatchClause(node, opts) { assert("CatchClause", node, opts); } -function assertConditionalExpression(node, opts = {}) { +function assertConditionalExpression(node, opts) { assert("ConditionalExpression", node, opts); } -function assertContinueStatement(node, opts = {}) { +function assertContinueStatement(node, opts) { assert("ContinueStatement", node, opts); } -function assertDebuggerStatement(node, opts = {}) { +function assertDebuggerStatement(node, opts) { assert("DebuggerStatement", node, opts); } -function assertDoWhileStatement(node, opts = {}) { +function assertDoWhileStatement(node, opts) { assert("DoWhileStatement", node, opts); } -function assertEmptyStatement(node, opts = {}) { +function assertEmptyStatement(node, opts) { assert("EmptyStatement", node, opts); } -function assertExpressionStatement(node, opts = {}) { +function assertExpressionStatement(node, opts) { assert("ExpressionStatement", node, opts); } -function assertFile(node, opts = {}) { +function assertFile(node, opts) { assert("File", node, opts); } -function assertForInStatement(node, opts = {}) { +function assertForInStatement(node, opts) { assert("ForInStatement", node, opts); } -function assertForStatement(node, opts = {}) { +function assertForStatement(node, opts) { assert("ForStatement", node, opts); } -function assertFunctionDeclaration(node, opts = {}) { +function assertFunctionDeclaration(node, opts) { assert("FunctionDeclaration", node, opts); } -function assertFunctionExpression(node, opts = {}) { +function assertFunctionExpression(node, opts) { assert("FunctionExpression", node, opts); } -function assertIdentifier(node, opts = {}) { +function assertIdentifier(node, opts) { assert("Identifier", node, opts); } -function assertIfStatement(node, opts = {}) { +function assertIfStatement(node, opts) { assert("IfStatement", node, opts); } -function assertLabeledStatement(node, opts = {}) { +function assertLabeledStatement(node, opts) { assert("LabeledStatement", node, opts); } -function assertStringLiteral(node, opts = {}) { +function assertStringLiteral(node, opts) { assert("StringLiteral", node, opts); } -function assertNumericLiteral(node, opts = {}) { +function assertNumericLiteral(node, opts) { assert("NumericLiteral", node, opts); } -function assertNullLiteral(node, opts = {}) { +function assertNullLiteral(node, opts) { assert("NullLiteral", node, opts); } -function assertBooleanLiteral(node, opts = {}) { +function assertBooleanLiteral(node, opts) { assert("BooleanLiteral", node, opts); } -function assertRegExpLiteral(node, opts = {}) { +function assertRegExpLiteral(node, opts) { assert("RegExpLiteral", node, opts); } -function assertLogicalExpression(node, opts = {}) { +function assertLogicalExpression(node, opts) { assert("LogicalExpression", node, opts); } -function assertMemberExpression(node, opts = {}) { +function assertMemberExpression(node, opts) { assert("MemberExpression", node, opts); } -function assertNewExpression(node, opts = {}) { +function assertNewExpression(node, opts) { assert("NewExpression", node, opts); } -function assertProgram(node, opts = {}) { +function assertProgram(node, opts) { assert("Program", node, opts); } -function assertObjectExpression(node, opts = {}) { +function assertObjectExpression(node, opts) { assert("ObjectExpression", node, opts); } -function assertObjectMethod(node, opts = {}) { +function assertObjectMethod(node, opts) { assert("ObjectMethod", node, opts); } -function assertObjectProperty(node, opts = {}) { +function assertObjectProperty(node, opts) { assert("ObjectProperty", node, opts); } -function assertRestElement(node, opts = {}) { +function assertRestElement(node, opts) { assert("RestElement", node, opts); } -function assertReturnStatement(node, opts = {}) { +function assertReturnStatement(node, opts) { assert("ReturnStatement", node, opts); } -function assertSequenceExpression(node, opts = {}) { +function assertSequenceExpression(node, opts) { assert("SequenceExpression", node, opts); } -function assertParenthesizedExpression(node, opts = {}) { +function assertParenthesizedExpression(node, opts) { assert("ParenthesizedExpression", node, opts); } -function assertSwitchCase(node, opts = {}) { +function assertSwitchCase(node, opts) { assert("SwitchCase", node, opts); } -function assertSwitchStatement(node, opts = {}) { +function assertSwitchStatement(node, opts) { assert("SwitchStatement", node, opts); } -function assertThisExpression(node, opts = {}) { +function assertThisExpression(node, opts) { assert("ThisExpression", node, opts); } -function assertThrowStatement(node, opts = {}) { +function assertThrowStatement(node, opts) { assert("ThrowStatement", node, opts); } -function assertTryStatement(node, opts = {}) { +function assertTryStatement(node, opts) { assert("TryStatement", node, opts); } -function assertUnaryExpression(node, opts = {}) { +function assertUnaryExpression(node, opts) { assert("UnaryExpression", node, opts); } -function assertUpdateExpression(node, opts = {}) { +function assertUpdateExpression(node, opts) { assert("UpdateExpression", node, opts); } -function assertVariableDeclaration(node, opts = {}) { +function assertVariableDeclaration(node, opts) { assert("VariableDeclaration", node, opts); } -function assertVariableDeclarator(node, opts = {}) { +function assertVariableDeclarator(node, opts) { assert("VariableDeclarator", node, opts); } -function assertWhileStatement(node, opts = {}) { +function assertWhileStatement(node, opts) { assert("WhileStatement", node, opts); } -function assertWithStatement(node, opts = {}) { +function assertWithStatement(node, opts) { assert("WithStatement", node, opts); } -function assertAssignmentPattern(node, opts = {}) { +function assertAssignmentPattern(node, opts) { assert("AssignmentPattern", node, opts); } -function assertArrayPattern(node, opts = {}) { +function assertArrayPattern(node, opts) { assert("ArrayPattern", node, opts); } -function assertArrowFunctionExpression(node, opts = {}) { +function assertArrowFunctionExpression(node, opts) { assert("ArrowFunctionExpression", node, opts); } -function assertClassBody(node, opts = {}) { +function assertClassBody(node, opts) { assert("ClassBody", node, opts); } -function assertClassExpression(node, opts = {}) { +function assertClassExpression(node, opts) { assert("ClassExpression", node, opts); } -function assertClassDeclaration(node, opts = {}) { +function assertClassDeclaration(node, opts) { assert("ClassDeclaration", node, opts); } -function assertExportAllDeclaration(node, opts = {}) { +function assertExportAllDeclaration(node, opts) { assert("ExportAllDeclaration", node, opts); } -function assertExportDefaultDeclaration(node, opts = {}) { +function assertExportDefaultDeclaration(node, opts) { assert("ExportDefaultDeclaration", node, opts); } -function assertExportNamedDeclaration(node, opts = {}) { +function assertExportNamedDeclaration(node, opts) { assert("ExportNamedDeclaration", node, opts); } -function assertExportSpecifier(node, opts = {}) { +function assertExportSpecifier(node, opts) { assert("ExportSpecifier", node, opts); } -function assertForOfStatement(node, opts = {}) { +function assertForOfStatement(node, opts) { assert("ForOfStatement", node, opts); } -function assertImportDeclaration(node, opts = {}) { +function assertImportDeclaration(node, opts) { assert("ImportDeclaration", node, opts); } -function assertImportDefaultSpecifier(node, opts = {}) { +function assertImportDefaultSpecifier(node, opts) { assert("ImportDefaultSpecifier", node, opts); } -function assertImportNamespaceSpecifier(node, opts = {}) { +function assertImportNamespaceSpecifier(node, opts) { assert("ImportNamespaceSpecifier", node, opts); } -function assertImportSpecifier(node, opts = {}) { +function assertImportSpecifier(node, opts) { assert("ImportSpecifier", node, opts); } -function assertMetaProperty(node, opts = {}) { +function assertMetaProperty(node, opts) { assert("MetaProperty", node, opts); } -function assertClassMethod(node, opts = {}) { +function assertClassMethod(node, opts) { assert("ClassMethod", node, opts); } -function assertObjectPattern(node, opts = {}) { +function assertObjectPattern(node, opts) { assert("ObjectPattern", node, opts); } -function assertSpreadElement(node, opts = {}) { +function assertSpreadElement(node, opts) { assert("SpreadElement", node, opts); } -function assertSuper(node, opts = {}) { +function assertSuper(node, opts) { assert("Super", node, opts); } -function assertTaggedTemplateExpression(node, opts = {}) { +function assertTaggedTemplateExpression(node, opts) { assert("TaggedTemplateExpression", node, opts); } -function assertTemplateElement(node, opts = {}) { +function assertTemplateElement(node, opts) { assert("TemplateElement", node, opts); } -function assertTemplateLiteral(node, opts = {}) { +function assertTemplateLiteral(node, opts) { assert("TemplateLiteral", node, opts); } -function assertYieldExpression(node, opts = {}) { +function assertYieldExpression(node, opts) { assert("YieldExpression", node, opts); } -function assertAwaitExpression(node, opts = {}) { +function assertAwaitExpression(node, opts) { assert("AwaitExpression", node, opts); } -function assertImport(node, opts = {}) { +function assertImport(node, opts) { assert("Import", node, opts); } -function assertBigIntLiteral(node, opts = {}) { +function assertBigIntLiteral(node, opts) { assert("BigIntLiteral", node, opts); } -function assertExportNamespaceSpecifier(node, opts = {}) { +function assertExportNamespaceSpecifier(node, opts) { assert("ExportNamespaceSpecifier", node, opts); } -function assertOptionalMemberExpression(node, opts = {}) { +function assertOptionalMemberExpression(node, opts) { assert("OptionalMemberExpression", node, opts); } -function assertOptionalCallExpression(node, opts = {}) { +function assertOptionalCallExpression(node, opts) { assert("OptionalCallExpression", node, opts); } -function assertAnyTypeAnnotation(node, opts = {}) { +function assertAnyTypeAnnotation(node, opts) { assert("AnyTypeAnnotation", node, opts); } -function assertArrayTypeAnnotation(node, opts = {}) { +function assertArrayTypeAnnotation(node, opts) { assert("ArrayTypeAnnotation", node, opts); } -function assertBooleanTypeAnnotation(node, opts = {}) { +function assertBooleanTypeAnnotation(node, opts) { assert("BooleanTypeAnnotation", node, opts); } -function assertBooleanLiteralTypeAnnotation(node, opts = {}) { +function assertBooleanLiteralTypeAnnotation(node, opts) { assert("BooleanLiteralTypeAnnotation", node, opts); } -function assertNullLiteralTypeAnnotation(node, opts = {}) { +function assertNullLiteralTypeAnnotation(node, opts) { assert("NullLiteralTypeAnnotation", node, opts); } -function assertClassImplements(node, opts = {}) { +function assertClassImplements(node, opts) { assert("ClassImplements", node, opts); } -function assertDeclareClass(node, opts = {}) { +function assertDeclareClass(node, opts) { assert("DeclareClass", node, opts); } -function assertDeclareFunction(node, opts = {}) { +function assertDeclareFunction(node, opts) { assert("DeclareFunction", node, opts); } -function assertDeclareInterface(node, opts = {}) { +function assertDeclareInterface(node, opts) { assert("DeclareInterface", node, opts); } -function assertDeclareModule(node, opts = {}) { +function assertDeclareModule(node, opts) { assert("DeclareModule", node, opts); } -function assertDeclareModuleExports(node, opts = {}) { +function assertDeclareModuleExports(node, opts) { assert("DeclareModuleExports", node, opts); } -function assertDeclareTypeAlias(node, opts = {}) { +function assertDeclareTypeAlias(node, opts) { assert("DeclareTypeAlias", node, opts); } -function assertDeclareOpaqueType(node, opts = {}) { +function assertDeclareOpaqueType(node, opts) { assert("DeclareOpaqueType", node, opts); } -function assertDeclareVariable(node, opts = {}) { +function assertDeclareVariable(node, opts) { assert("DeclareVariable", node, opts); } -function assertDeclareExportDeclaration(node, opts = {}) { +function assertDeclareExportDeclaration(node, opts) { assert("DeclareExportDeclaration", node, opts); } -function assertDeclareExportAllDeclaration(node, opts = {}) { +function assertDeclareExportAllDeclaration(node, opts) { assert("DeclareExportAllDeclaration", node, opts); } -function assertDeclaredPredicate(node, opts = {}) { +function assertDeclaredPredicate(node, opts) { assert("DeclaredPredicate", node, opts); } -function assertExistsTypeAnnotation(node, opts = {}) { +function assertExistsTypeAnnotation(node, opts) { assert("ExistsTypeAnnotation", node, opts); } -function assertFunctionTypeAnnotation(node, opts = {}) { +function assertFunctionTypeAnnotation(node, opts) { assert("FunctionTypeAnnotation", node, opts); } -function assertFunctionTypeParam(node, opts = {}) { +function assertFunctionTypeParam(node, opts) { assert("FunctionTypeParam", node, opts); } -function assertGenericTypeAnnotation(node, opts = {}) { +function assertGenericTypeAnnotation(node, opts) { assert("GenericTypeAnnotation", node, opts); } -function assertInferredPredicate(node, opts = {}) { +function assertInferredPredicate(node, opts) { assert("InferredPredicate", node, opts); } -function assertInterfaceExtends(node, opts = {}) { +function assertInterfaceExtends(node, opts) { assert("InterfaceExtends", node, opts); } -function assertInterfaceDeclaration(node, opts = {}) { +function assertInterfaceDeclaration(node, opts) { assert("InterfaceDeclaration", node, opts); } -function assertInterfaceTypeAnnotation(node, opts = {}) { +function assertInterfaceTypeAnnotation(node, opts) { assert("InterfaceTypeAnnotation", node, opts); } -function assertIntersectionTypeAnnotation(node, opts = {}) { +function assertIntersectionTypeAnnotation(node, opts) { assert("IntersectionTypeAnnotation", node, opts); } -function assertMixedTypeAnnotation(node, opts = {}) { +function assertMixedTypeAnnotation(node, opts) { assert("MixedTypeAnnotation", node, opts); } -function assertEmptyTypeAnnotation(node, opts = {}) { +function assertEmptyTypeAnnotation(node, opts) { assert("EmptyTypeAnnotation", node, opts); } -function assertNullableTypeAnnotation(node, opts = {}) { +function assertNullableTypeAnnotation(node, opts) { assert("NullableTypeAnnotation", node, opts); } -function assertNumberLiteralTypeAnnotation(node, opts = {}) { +function assertNumberLiteralTypeAnnotation(node, opts) { assert("NumberLiteralTypeAnnotation", node, opts); } -function assertNumberTypeAnnotation(node, opts = {}) { +function assertNumberTypeAnnotation(node, opts) { assert("NumberTypeAnnotation", node, opts); } -function assertObjectTypeAnnotation(node, opts = {}) { +function assertObjectTypeAnnotation(node, opts) { assert("ObjectTypeAnnotation", node, opts); } -function assertObjectTypeInternalSlot(node, opts = {}) { +function assertObjectTypeInternalSlot(node, opts) { assert("ObjectTypeInternalSlot", node, opts); } -function assertObjectTypeCallProperty(node, opts = {}) { +function assertObjectTypeCallProperty(node, opts) { assert("ObjectTypeCallProperty", node, opts); } -function assertObjectTypeIndexer(node, opts = {}) { +function assertObjectTypeIndexer(node, opts) { assert("ObjectTypeIndexer", node, opts); } -function assertObjectTypeProperty(node, opts = {}) { +function assertObjectTypeProperty(node, opts) { assert("ObjectTypeProperty", node, opts); } -function assertObjectTypeSpreadProperty(node, opts = {}) { +function assertObjectTypeSpreadProperty(node, opts) { assert("ObjectTypeSpreadProperty", node, opts); } -function assertOpaqueType(node, opts = {}) { +function assertOpaqueType(node, opts) { assert("OpaqueType", node, opts); } -function assertQualifiedTypeIdentifier(node, opts = {}) { +function assertQualifiedTypeIdentifier(node, opts) { assert("QualifiedTypeIdentifier", node, opts); } -function assertStringLiteralTypeAnnotation(node, opts = {}) { +function assertStringLiteralTypeAnnotation(node, opts) { assert("StringLiteralTypeAnnotation", node, opts); } -function assertStringTypeAnnotation(node, opts = {}) { +function assertStringTypeAnnotation(node, opts) { assert("StringTypeAnnotation", node, opts); } -function assertSymbolTypeAnnotation(node, opts = {}) { +function assertSymbolTypeAnnotation(node, opts) { assert("SymbolTypeAnnotation", node, opts); } -function assertThisTypeAnnotation(node, opts = {}) { +function assertThisTypeAnnotation(node, opts) { assert("ThisTypeAnnotation", node, opts); } -function assertTupleTypeAnnotation(node, opts = {}) { +function assertTupleTypeAnnotation(node, opts) { assert("TupleTypeAnnotation", node, opts); } -function assertTypeofTypeAnnotation(node, opts = {}) { +function assertTypeofTypeAnnotation(node, opts) { assert("TypeofTypeAnnotation", node, opts); } -function assertTypeAlias(node, opts = {}) { +function assertTypeAlias(node, opts) { assert("TypeAlias", node, opts); } -function assertTypeAnnotation(node, opts = {}) { +function assertTypeAnnotation(node, opts) { assert("TypeAnnotation", node, opts); } -function assertTypeCastExpression(node, opts = {}) { +function assertTypeCastExpression(node, opts) { assert("TypeCastExpression", node, opts); } -function assertTypeParameter(node, opts = {}) { +function assertTypeParameter(node, opts) { assert("TypeParameter", node, opts); } -function assertTypeParameterDeclaration(node, opts = {}) { +function assertTypeParameterDeclaration(node, opts) { assert("TypeParameterDeclaration", node, opts); } -function assertTypeParameterInstantiation(node, opts = {}) { +function assertTypeParameterInstantiation(node, opts) { assert("TypeParameterInstantiation", node, opts); } -function assertUnionTypeAnnotation(node, opts = {}) { +function assertUnionTypeAnnotation(node, opts) { assert("UnionTypeAnnotation", node, opts); } -function assertVariance(node, opts = {}) { +function assertVariance(node, opts) { assert("Variance", node, opts); } -function assertVoidTypeAnnotation(node, opts = {}) { +function assertVoidTypeAnnotation(node, opts) { assert("VoidTypeAnnotation", node, opts); } -function assertEnumDeclaration(node, opts = {}) { +function assertEnumDeclaration(node, opts) { assert("EnumDeclaration", node, opts); } -function assertEnumBooleanBody(node, opts = {}) { +function assertEnumBooleanBody(node, opts) { assert("EnumBooleanBody", node, opts); } -function assertEnumNumberBody(node, opts = {}) { +function assertEnumNumberBody(node, opts) { assert("EnumNumberBody", node, opts); } -function assertEnumStringBody(node, opts = {}) { +function assertEnumStringBody(node, opts) { assert("EnumStringBody", node, opts); } -function assertEnumSymbolBody(node, opts = {}) { +function assertEnumSymbolBody(node, opts) { assert("EnumSymbolBody", node, opts); } -function assertEnumBooleanMember(node, opts = {}) { +function assertEnumBooleanMember(node, opts) { assert("EnumBooleanMember", node, opts); } -function assertEnumNumberMember(node, opts = {}) { +function assertEnumNumberMember(node, opts) { assert("EnumNumberMember", node, opts); } -function assertEnumStringMember(node, opts = {}) { +function assertEnumStringMember(node, opts) { assert("EnumStringMember", node, opts); } -function assertEnumDefaultedMember(node, opts = {}) { +function assertEnumDefaultedMember(node, opts) { assert("EnumDefaultedMember", node, opts); } -function assertJSXAttribute(node, opts = {}) { +function assertJSXAttribute(node, opts) { assert("JSXAttribute", node, opts); } -function assertJSXClosingElement(node, opts = {}) { +function assertJSXClosingElement(node, opts) { assert("JSXClosingElement", node, opts); } -function assertJSXElement(node, opts = {}) { +function assertJSXElement(node, opts) { assert("JSXElement", node, opts); } -function assertJSXEmptyExpression(node, opts = {}) { +function assertJSXEmptyExpression(node, opts) { assert("JSXEmptyExpression", node, opts); } -function assertJSXExpressionContainer(node, opts = {}) { +function assertJSXExpressionContainer(node, opts) { assert("JSXExpressionContainer", node, opts); } -function assertJSXSpreadChild(node, opts = {}) { +function assertJSXSpreadChild(node, opts) { assert("JSXSpreadChild", node, opts); } -function assertJSXIdentifier(node, opts = {}) { +function assertJSXIdentifier(node, opts) { assert("JSXIdentifier", node, opts); } -function assertJSXMemberExpression(node, opts = {}) { +function assertJSXMemberExpression(node, opts) { assert("JSXMemberExpression", node, opts); } -function assertJSXNamespacedName(node, opts = {}) { +function assertJSXNamespacedName(node, opts) { assert("JSXNamespacedName", node, opts); } -function assertJSXOpeningElement(node, opts = {}) { +function assertJSXOpeningElement(node, opts) { assert("JSXOpeningElement", node, opts); } -function assertJSXSpreadAttribute(node, opts = {}) { +function assertJSXSpreadAttribute(node, opts) { assert("JSXSpreadAttribute", node, opts); } -function assertJSXText(node, opts = {}) { +function assertJSXText(node, opts) { assert("JSXText", node, opts); } -function assertJSXFragment(node, opts = {}) { +function assertJSXFragment(node, opts) { assert("JSXFragment", node, opts); } -function assertJSXOpeningFragment(node, opts = {}) { +function assertJSXOpeningFragment(node, opts) { assert("JSXOpeningFragment", node, opts); } -function assertJSXClosingFragment(node, opts = {}) { +function assertJSXClosingFragment(node, opts) { assert("JSXClosingFragment", node, opts); } -function assertNoop(node, opts = {}) { +function assertNoop(node, opts) { assert("Noop", node, opts); } -function assertPlaceholder(node, opts = {}) { +function assertPlaceholder(node, opts) { assert("Placeholder", node, opts); } -function assertV8IntrinsicIdentifier(node, opts = {}) { +function assertV8IntrinsicIdentifier(node, opts) { assert("V8IntrinsicIdentifier", node, opts); } -function assertArgumentPlaceholder(node, opts = {}) { +function assertArgumentPlaceholder(node, opts) { assert("ArgumentPlaceholder", node, opts); } -function assertBindExpression(node, opts = {}) { +function assertBindExpression(node, opts) { assert("BindExpression", node, opts); } -function assertClassProperty(node, opts = {}) { +function assertClassProperty(node, opts) { assert("ClassProperty", node, opts); } -function assertPipelineTopicExpression(node, opts = {}) { +function assertPipelineTopicExpression(node, opts) { assert("PipelineTopicExpression", node, opts); } -function assertPipelineBareFunction(node, opts = {}) { +function assertPipelineBareFunction(node, opts) { assert("PipelineBareFunction", node, opts); } -function assertPipelinePrimaryTopicReference(node, opts = {}) { +function assertPipelinePrimaryTopicReference(node, opts) { assert("PipelinePrimaryTopicReference", node, opts); } -function assertClassPrivateProperty(node, opts = {}) { +function assertClassPrivateProperty(node, opts) { assert("ClassPrivateProperty", node, opts); } -function assertClassPrivateMethod(node, opts = {}) { +function assertClassPrivateMethod(node, opts) { assert("ClassPrivateMethod", node, opts); } -function assertImportAttribute(node, opts = {}) { +function assertImportAttribute(node, opts) { assert("ImportAttribute", node, opts); } -function assertDecorator(node, opts = {}) { +function assertDecorator(node, opts) { assert("Decorator", node, opts); } -function assertDoExpression(node, opts = {}) { +function assertDoExpression(node, opts) { assert("DoExpression", node, opts); } -function assertExportDefaultSpecifier(node, opts = {}) { +function assertExportDefaultSpecifier(node, opts) { assert("ExportDefaultSpecifier", node, opts); } -function assertPrivateName(node, opts = {}) { +function assertPrivateName(node, opts) { assert("PrivateName", node, opts); } -function assertRecordExpression(node, opts = {}) { +function assertRecordExpression(node, opts) { assert("RecordExpression", node, opts); } -function assertTupleExpression(node, opts = {}) { +function assertTupleExpression(node, opts) { assert("TupleExpression", node, opts); } -function assertDecimalLiteral(node, opts = {}) { +function assertDecimalLiteral(node, opts) { assert("DecimalLiteral", node, opts); } -function assertStaticBlock(node, opts = {}) { +function assertStaticBlock(node, opts) { assert("StaticBlock", node, opts); } -function assertTSParameterProperty(node, opts = {}) { +function assertTSParameterProperty(node, opts) { assert("TSParameterProperty", node, opts); } -function assertTSDeclareFunction(node, opts = {}) { +function assertTSDeclareFunction(node, opts) { assert("TSDeclareFunction", node, opts); } -function assertTSDeclareMethod(node, opts = {}) { +function assertTSDeclareMethod(node, opts) { assert("TSDeclareMethod", node, opts); } -function assertTSQualifiedName(node, opts = {}) { +function assertTSQualifiedName(node, opts) { assert("TSQualifiedName", node, opts); } -function assertTSCallSignatureDeclaration(node, opts = {}) { +function assertTSCallSignatureDeclaration(node, opts) { assert("TSCallSignatureDeclaration", node, opts); } -function assertTSConstructSignatureDeclaration(node, opts = {}) { +function assertTSConstructSignatureDeclaration(node, opts) { assert("TSConstructSignatureDeclaration", node, opts); } -function assertTSPropertySignature(node, opts = {}) { +function assertTSPropertySignature(node, opts) { assert("TSPropertySignature", node, opts); } -function assertTSMethodSignature(node, opts = {}) { +function assertTSMethodSignature(node, opts) { assert("TSMethodSignature", node, opts); } -function assertTSIndexSignature(node, opts = {}) { +function assertTSIndexSignature(node, opts) { assert("TSIndexSignature", node, opts); } -function assertTSAnyKeyword(node, opts = {}) { +function assertTSAnyKeyword(node, opts) { assert("TSAnyKeyword", node, opts); } -function assertTSBooleanKeyword(node, opts = {}) { +function assertTSBooleanKeyword(node, opts) { assert("TSBooleanKeyword", node, opts); } -function assertTSBigIntKeyword(node, opts = {}) { +function assertTSBigIntKeyword(node, opts) { assert("TSBigIntKeyword", node, opts); } -function assertTSIntrinsicKeyword(node, opts = {}) { +function assertTSIntrinsicKeyword(node, opts) { assert("TSIntrinsicKeyword", node, opts); } -function assertTSNeverKeyword(node, opts = {}) { +function assertTSNeverKeyword(node, opts) { assert("TSNeverKeyword", node, opts); } -function assertTSNullKeyword(node, opts = {}) { +function assertTSNullKeyword(node, opts) { assert("TSNullKeyword", node, opts); } -function assertTSNumberKeyword(node, opts = {}) { +function assertTSNumberKeyword(node, opts) { assert("TSNumberKeyword", node, opts); } -function assertTSObjectKeyword(node, opts = {}) { +function assertTSObjectKeyword(node, opts) { assert("TSObjectKeyword", node, opts); } -function assertTSStringKeyword(node, opts = {}) { +function assertTSStringKeyword(node, opts) { assert("TSStringKeyword", node, opts); } -function assertTSSymbolKeyword(node, opts = {}) { +function assertTSSymbolKeyword(node, opts) { assert("TSSymbolKeyword", node, opts); } -function assertTSUndefinedKeyword(node, opts = {}) { +function assertTSUndefinedKeyword(node, opts) { assert("TSUndefinedKeyword", node, opts); } -function assertTSUnknownKeyword(node, opts = {}) { +function assertTSUnknownKeyword(node, opts) { assert("TSUnknownKeyword", node, opts); } -function assertTSVoidKeyword(node, opts = {}) { +function assertTSVoidKeyword(node, opts) { assert("TSVoidKeyword", node, opts); } -function assertTSThisType(node, opts = {}) { +function assertTSThisType(node, opts) { assert("TSThisType", node, opts); } -function assertTSFunctionType(node, opts = {}) { +function assertTSFunctionType(node, opts) { assert("TSFunctionType", node, opts); } -function assertTSConstructorType(node, opts = {}) { +function assertTSConstructorType(node, opts) { assert("TSConstructorType", node, opts); } -function assertTSTypeReference(node, opts = {}) { +function assertTSTypeReference(node, opts) { assert("TSTypeReference", node, opts); } -function assertTSTypePredicate(node, opts = {}) { +function assertTSTypePredicate(node, opts) { assert("TSTypePredicate", node, opts); } -function assertTSTypeQuery(node, opts = {}) { +function assertTSTypeQuery(node, opts) { assert("TSTypeQuery", node, opts); } -function assertTSTypeLiteral(node, opts = {}) { +function assertTSTypeLiteral(node, opts) { assert("TSTypeLiteral", node, opts); } -function assertTSArrayType(node, opts = {}) { +function assertTSArrayType(node, opts) { assert("TSArrayType", node, opts); } -function assertTSTupleType(node, opts = {}) { +function assertTSTupleType(node, opts) { assert("TSTupleType", node, opts); } -function assertTSOptionalType(node, opts = {}) { +function assertTSOptionalType(node, opts) { assert("TSOptionalType", node, opts); } -function assertTSRestType(node, opts = {}) { +function assertTSRestType(node, opts) { assert("TSRestType", node, opts); } -function assertTSNamedTupleMember(node, opts = {}) { +function assertTSNamedTupleMember(node, opts) { assert("TSNamedTupleMember", node, opts); } -function assertTSUnionType(node, opts = {}) { +function assertTSUnionType(node, opts) { assert("TSUnionType", node, opts); } -function assertTSIntersectionType(node, opts = {}) { +function assertTSIntersectionType(node, opts) { assert("TSIntersectionType", node, opts); } -function assertTSConditionalType(node, opts = {}) { +function assertTSConditionalType(node, opts) { assert("TSConditionalType", node, opts); } -function assertTSInferType(node, opts = {}) { +function assertTSInferType(node, opts) { assert("TSInferType", node, opts); } -function assertTSParenthesizedType(node, opts = {}) { +function assertTSParenthesizedType(node, opts) { assert("TSParenthesizedType", node, opts); } -function assertTSTypeOperator(node, opts = {}) { +function assertTSTypeOperator(node, opts) { assert("TSTypeOperator", node, opts); } -function assertTSIndexedAccessType(node, opts = {}) { +function assertTSIndexedAccessType(node, opts) { assert("TSIndexedAccessType", node, opts); } -function assertTSMappedType(node, opts = {}) { +function assertTSMappedType(node, opts) { assert("TSMappedType", node, opts); } -function assertTSLiteralType(node, opts = {}) { +function assertTSLiteralType(node, opts) { assert("TSLiteralType", node, opts); } -function assertTSExpressionWithTypeArguments(node, opts = {}) { +function assertTSExpressionWithTypeArguments(node, opts) { assert("TSExpressionWithTypeArguments", node, opts); } -function assertTSInterfaceDeclaration(node, opts = {}) { +function assertTSInterfaceDeclaration(node, opts) { assert("TSInterfaceDeclaration", node, opts); } -function assertTSInterfaceBody(node, opts = {}) { +function assertTSInterfaceBody(node, opts) { assert("TSInterfaceBody", node, opts); } -function assertTSTypeAliasDeclaration(node, opts = {}) { +function assertTSTypeAliasDeclaration(node, opts) { assert("TSTypeAliasDeclaration", node, opts); } -function assertTSAsExpression(node, opts = {}) { +function assertTSAsExpression(node, opts) { assert("TSAsExpression", node, opts); } -function assertTSTypeAssertion(node, opts = {}) { +function assertTSTypeAssertion(node, opts) { assert("TSTypeAssertion", node, opts); } -function assertTSEnumDeclaration(node, opts = {}) { +function assertTSEnumDeclaration(node, opts) { assert("TSEnumDeclaration", node, opts); } -function assertTSEnumMember(node, opts = {}) { +function assertTSEnumMember(node, opts) { assert("TSEnumMember", node, opts); } -function assertTSModuleDeclaration(node, opts = {}) { +function assertTSModuleDeclaration(node, opts) { assert("TSModuleDeclaration", node, opts); } -function assertTSModuleBlock(node, opts = {}) { +function assertTSModuleBlock(node, opts) { assert("TSModuleBlock", node, opts); } -function assertTSImportType(node, opts = {}) { +function assertTSImportType(node, opts) { assert("TSImportType", node, opts); } -function assertTSImportEqualsDeclaration(node, opts = {}) { +function assertTSImportEqualsDeclaration(node, opts) { assert("TSImportEqualsDeclaration", node, opts); } -function assertTSExternalModuleReference(node, opts = {}) { +function assertTSExternalModuleReference(node, opts) { assert("TSExternalModuleReference", node, opts); } -function assertTSNonNullExpression(node, opts = {}) { +function assertTSNonNullExpression(node, opts) { assert("TSNonNullExpression", node, opts); } -function assertTSExportAssignment(node, opts = {}) { +function assertTSExportAssignment(node, opts) { assert("TSExportAssignment", node, opts); } -function assertTSNamespaceExportDeclaration(node, opts = {}) { +function assertTSNamespaceExportDeclaration(node, opts) { assert("TSNamespaceExportDeclaration", node, opts); } -function assertTSTypeAnnotation(node, opts = {}) { +function assertTSTypeAnnotation(node, opts) { assert("TSTypeAnnotation", node, opts); } -function assertTSTypeParameterInstantiation(node, opts = {}) { +function assertTSTypeParameterInstantiation(node, opts) { assert("TSTypeParameterInstantiation", node, opts); } -function assertTSTypeParameterDeclaration(node, opts = {}) { +function assertTSTypeParameterDeclaration(node, opts) { assert("TSTypeParameterDeclaration", node, opts); } -function assertTSTypeParameter(node, opts = {}) { +function assertTSTypeParameter(node, opts) { assert("TSTypeParameter", node, opts); } -function assertExpression(node, opts = {}) { +function assertExpression(node, opts) { assert("Expression", node, opts); } -function assertBinary(node, opts = {}) { +function assertBinary(node, opts) { assert("Binary", node, opts); } -function assertScopable(node, opts = {}) { +function assertScopable(node, opts) { assert("Scopable", node, opts); } -function assertBlockParent(node, opts = {}) { +function assertBlockParent(node, opts) { assert("BlockParent", node, opts); } -function assertBlock(node, opts = {}) { +function assertBlock(node, opts) { assert("Block", node, opts); } -function assertStatement(node, opts = {}) { +function assertStatement(node, opts) { assert("Statement", node, opts); } -function assertTerminatorless(node, opts = {}) { +function assertTerminatorless(node, opts) { assert("Terminatorless", node, opts); } -function assertCompletionStatement(node, opts = {}) { +function assertCompletionStatement(node, opts) { assert("CompletionStatement", node, opts); } -function assertConditional(node, opts = {}) { +function assertConditional(node, opts) { assert("Conditional", node, opts); } -function assertLoop(node, opts = {}) { +function assertLoop(node, opts) { assert("Loop", node, opts); } -function assertWhile(node, opts = {}) { +function assertWhile(node, opts) { assert("While", node, opts); } -function assertExpressionWrapper(node, opts = {}) { +function assertExpressionWrapper(node, opts) { assert("ExpressionWrapper", node, opts); } -function assertFor(node, opts = {}) { +function assertFor(node, opts) { assert("For", node, opts); } -function assertForXStatement(node, opts = {}) { +function assertForXStatement(node, opts) { assert("ForXStatement", node, opts); } -function assertFunction(node, opts = {}) { +function assertFunction(node, opts) { assert("Function", node, opts); } -function assertFunctionParent(node, opts = {}) { +function assertFunctionParent(node, opts) { assert("FunctionParent", node, opts); } -function assertPureish(node, opts = {}) { +function assertPureish(node, opts) { assert("Pureish", node, opts); } -function assertDeclaration(node, opts = {}) { +function assertDeclaration(node, opts) { assert("Declaration", node, opts); } -function assertPatternLike(node, opts = {}) { +function assertPatternLike(node, opts) { assert("PatternLike", node, opts); } -function assertLVal(node, opts = {}) { +function assertLVal(node, opts) { assert("LVal", node, opts); } -function assertTSEntityName(node, opts = {}) { +function assertTSEntityName(node, opts) { assert("TSEntityName", node, opts); } -function assertLiteral(node, opts = {}) { +function assertLiteral(node, opts) { assert("Literal", node, opts); } -function assertImmutable(node, opts = {}) { +function assertImmutable(node, opts) { assert("Immutable", node, opts); } -function assertUserWhitespacable(node, opts = {}) { +function assertUserWhitespacable(node, opts) { assert("UserWhitespacable", node, opts); } -function assertMethod(node, opts = {}) { +function assertMethod(node, opts) { assert("Method", node, opts); } -function assertObjectMember(node, opts = {}) { +function assertObjectMember(node, opts) { assert("ObjectMember", node, opts); } -function assertProperty(node, opts = {}) { +function assertProperty(node, opts) { assert("Property", node, opts); } -function assertUnaryLike(node, opts = {}) { +function assertUnaryLike(node, opts) { assert("UnaryLike", node, opts); } -function assertPattern(node, opts = {}) { +function assertPattern(node, opts) { assert("Pattern", node, opts); } -function assertClass(node, opts = {}) { +function assertClass(node, opts) { assert("Class", node, opts); } -function assertModuleDeclaration(node, opts = {}) { +function assertModuleDeclaration(node, opts) { assert("ModuleDeclaration", node, opts); } -function assertExportDeclaration(node, opts = {}) { +function assertExportDeclaration(node, opts) { assert("ExportDeclaration", node, opts); } -function assertModuleSpecifier(node, opts = {}) { +function assertModuleSpecifier(node, opts) { assert("ModuleSpecifier", node, opts); } -function assertFlow(node, opts = {}) { +function assertFlow(node, opts) { assert("Flow", node, opts); } -function assertFlowType(node, opts = {}) { +function assertFlowType(node, opts) { assert("FlowType", node, opts); } -function assertFlowBaseAnnotation(node, opts = {}) { +function assertFlowBaseAnnotation(node, opts) { assert("FlowBaseAnnotation", node, opts); } -function assertFlowDeclaration(node, opts = {}) { +function assertFlowDeclaration(node, opts) { assert("FlowDeclaration", node, opts); } -function assertFlowPredicate(node, opts = {}) { +function assertFlowPredicate(node, opts) { assert("FlowPredicate", node, opts); } -function assertEnumBody(node, opts = {}) { +function assertEnumBody(node, opts) { assert("EnumBody", node, opts); } -function assertEnumMember(node, opts = {}) { +function assertEnumMember(node, opts) { assert("EnumMember", node, opts); } -function assertJSX(node, opts = {}) { +function assertJSX(node, opts) { assert("JSX", node, opts); } -function assertPrivate(node, opts = {}) { +function assertPrivate(node, opts) { assert("Private", node, opts); } -function assertTSTypeElement(node, opts = {}) { +function assertTSTypeElement(node, opts) { assert("TSTypeElement", node, opts); } -function assertTSType(node, opts = {}) { +function assertTSType(node, opts) { assert("TSType", node, opts); } -function assertTSBaseType(node, opts = {}) { +function assertTSBaseType(node, opts) { assert("TSBaseType", node, opts); } diff --git a/tools/node_modules/@babel/core/node_modules/@babel/types/lib/ast-types/generated/index.js b/tools/node_modules/@babel/core/node_modules/@babel/types/lib/ast-types/generated/index.js new file mode 100644 index 00000000000000..e69de29bb2d1d6 diff --git a/tools/node_modules/@babel/core/node_modules/@babel/types/lib/builders/generated/index.js b/tools/node_modules/@babel/core/node_modules/@babel/types/lib/builders/generated/index.js index 18152119ac791c..a4ed3056921cc2 100644 --- a/tools/node_modules/@babel/core/node_modules/@babel/types/lib/builders/generated/index.js +++ b/tools/node_modules/@babel/core/node_modules/@babel/types/lib/builders/generated/index.js @@ -3,1223 +3,1223 @@ Object.defineProperty(exports, "__esModule", { value: true }); -exports.ArrayExpression = exports.arrayExpression = arrayExpression; -exports.AssignmentExpression = exports.assignmentExpression = assignmentExpression; -exports.BinaryExpression = exports.binaryExpression = binaryExpression; -exports.InterpreterDirective = exports.interpreterDirective = interpreterDirective; -exports.Directive = exports.directive = directive; -exports.DirectiveLiteral = exports.directiveLiteral = directiveLiteral; -exports.BlockStatement = exports.blockStatement = blockStatement; -exports.BreakStatement = exports.breakStatement = breakStatement; -exports.CallExpression = exports.callExpression = callExpression; -exports.CatchClause = exports.catchClause = catchClause; -exports.ConditionalExpression = exports.conditionalExpression = conditionalExpression; -exports.ContinueStatement = exports.continueStatement = continueStatement; -exports.DebuggerStatement = exports.debuggerStatement = debuggerStatement; -exports.DoWhileStatement = exports.doWhileStatement = doWhileStatement; -exports.EmptyStatement = exports.emptyStatement = emptyStatement; -exports.ExpressionStatement = exports.expressionStatement = expressionStatement; -exports.File = exports.file = file; -exports.ForInStatement = exports.forInStatement = forInStatement; -exports.ForStatement = exports.forStatement = forStatement; -exports.FunctionDeclaration = exports.functionDeclaration = functionDeclaration; -exports.FunctionExpression = exports.functionExpression = functionExpression; -exports.Identifier = exports.identifier = identifier; -exports.IfStatement = exports.ifStatement = ifStatement; -exports.LabeledStatement = exports.labeledStatement = labeledStatement; -exports.StringLiteral = exports.stringLiteral = stringLiteral; -exports.NumericLiteral = exports.numericLiteral = numericLiteral; -exports.NullLiteral = exports.nullLiteral = nullLiteral; -exports.BooleanLiteral = exports.booleanLiteral = booleanLiteral; -exports.RegExpLiteral = exports.regExpLiteral = regExpLiteral; -exports.LogicalExpression = exports.logicalExpression = logicalExpression; -exports.MemberExpression = exports.memberExpression = memberExpression; -exports.NewExpression = exports.newExpression = newExpression; -exports.Program = exports.program = program; -exports.ObjectExpression = exports.objectExpression = objectExpression; -exports.ObjectMethod = exports.objectMethod = objectMethod; -exports.ObjectProperty = exports.objectProperty = objectProperty; -exports.RestElement = exports.restElement = restElement; -exports.ReturnStatement = exports.returnStatement = returnStatement; -exports.SequenceExpression = exports.sequenceExpression = sequenceExpression; -exports.ParenthesizedExpression = exports.parenthesizedExpression = parenthesizedExpression; -exports.SwitchCase = exports.switchCase = switchCase; -exports.SwitchStatement = exports.switchStatement = switchStatement; -exports.ThisExpression = exports.thisExpression = thisExpression; -exports.ThrowStatement = exports.throwStatement = throwStatement; -exports.TryStatement = exports.tryStatement = tryStatement; -exports.UnaryExpression = exports.unaryExpression = unaryExpression; -exports.UpdateExpression = exports.updateExpression = updateExpression; -exports.VariableDeclaration = exports.variableDeclaration = variableDeclaration; -exports.VariableDeclarator = exports.variableDeclarator = variableDeclarator; -exports.WhileStatement = exports.whileStatement = whileStatement; -exports.WithStatement = exports.withStatement = withStatement; -exports.AssignmentPattern = exports.assignmentPattern = assignmentPattern; -exports.ArrayPattern = exports.arrayPattern = arrayPattern; -exports.ArrowFunctionExpression = exports.arrowFunctionExpression = arrowFunctionExpression; -exports.ClassBody = exports.classBody = classBody; -exports.ClassExpression = exports.classExpression = classExpression; -exports.ClassDeclaration = exports.classDeclaration = classDeclaration; -exports.ExportAllDeclaration = exports.exportAllDeclaration = exportAllDeclaration; -exports.ExportDefaultDeclaration = exports.exportDefaultDeclaration = exportDefaultDeclaration; -exports.ExportNamedDeclaration = exports.exportNamedDeclaration = exportNamedDeclaration; -exports.ExportSpecifier = exports.exportSpecifier = exportSpecifier; -exports.ForOfStatement = exports.forOfStatement = forOfStatement; -exports.ImportDeclaration = exports.importDeclaration = importDeclaration; -exports.ImportDefaultSpecifier = exports.importDefaultSpecifier = importDefaultSpecifier; -exports.ImportNamespaceSpecifier = exports.importNamespaceSpecifier = importNamespaceSpecifier; -exports.ImportSpecifier = exports.importSpecifier = importSpecifier; -exports.MetaProperty = exports.metaProperty = metaProperty; -exports.ClassMethod = exports.classMethod = classMethod; -exports.ObjectPattern = exports.objectPattern = objectPattern; -exports.SpreadElement = exports.spreadElement = spreadElement; -exports.super = exports.Super = _super; -exports.TaggedTemplateExpression = exports.taggedTemplateExpression = taggedTemplateExpression; -exports.TemplateElement = exports.templateElement = templateElement; -exports.TemplateLiteral = exports.templateLiteral = templateLiteral; -exports.YieldExpression = exports.yieldExpression = yieldExpression; -exports.AwaitExpression = exports.awaitExpression = awaitExpression; -exports.import = exports.Import = _import; -exports.BigIntLiteral = exports.bigIntLiteral = bigIntLiteral; -exports.ExportNamespaceSpecifier = exports.exportNamespaceSpecifier = exportNamespaceSpecifier; -exports.OptionalMemberExpression = exports.optionalMemberExpression = optionalMemberExpression; -exports.OptionalCallExpression = exports.optionalCallExpression = optionalCallExpression; -exports.AnyTypeAnnotation = exports.anyTypeAnnotation = anyTypeAnnotation; -exports.ArrayTypeAnnotation = exports.arrayTypeAnnotation = arrayTypeAnnotation; -exports.BooleanTypeAnnotation = exports.booleanTypeAnnotation = booleanTypeAnnotation; -exports.BooleanLiteralTypeAnnotation = exports.booleanLiteralTypeAnnotation = booleanLiteralTypeAnnotation; -exports.NullLiteralTypeAnnotation = exports.nullLiteralTypeAnnotation = nullLiteralTypeAnnotation; -exports.ClassImplements = exports.classImplements = classImplements; -exports.DeclareClass = exports.declareClass = declareClass; -exports.DeclareFunction = exports.declareFunction = declareFunction; -exports.DeclareInterface = exports.declareInterface = declareInterface; -exports.DeclareModule = exports.declareModule = declareModule; -exports.DeclareModuleExports = exports.declareModuleExports = declareModuleExports; -exports.DeclareTypeAlias = exports.declareTypeAlias = declareTypeAlias; -exports.DeclareOpaqueType = exports.declareOpaqueType = declareOpaqueType; -exports.DeclareVariable = exports.declareVariable = declareVariable; -exports.DeclareExportDeclaration = exports.declareExportDeclaration = declareExportDeclaration; -exports.DeclareExportAllDeclaration = exports.declareExportAllDeclaration = declareExportAllDeclaration; -exports.DeclaredPredicate = exports.declaredPredicate = declaredPredicate; -exports.ExistsTypeAnnotation = exports.existsTypeAnnotation = existsTypeAnnotation; -exports.FunctionTypeAnnotation = exports.functionTypeAnnotation = functionTypeAnnotation; -exports.FunctionTypeParam = exports.functionTypeParam = functionTypeParam; -exports.GenericTypeAnnotation = exports.genericTypeAnnotation = genericTypeAnnotation; -exports.InferredPredicate = exports.inferredPredicate = inferredPredicate; -exports.InterfaceExtends = exports.interfaceExtends = interfaceExtends; -exports.InterfaceDeclaration = exports.interfaceDeclaration = interfaceDeclaration; -exports.InterfaceTypeAnnotation = exports.interfaceTypeAnnotation = interfaceTypeAnnotation; -exports.IntersectionTypeAnnotation = exports.intersectionTypeAnnotation = intersectionTypeAnnotation; -exports.MixedTypeAnnotation = exports.mixedTypeAnnotation = mixedTypeAnnotation; -exports.EmptyTypeAnnotation = exports.emptyTypeAnnotation = emptyTypeAnnotation; -exports.NullableTypeAnnotation = exports.nullableTypeAnnotation = nullableTypeAnnotation; -exports.NumberLiteralTypeAnnotation = exports.numberLiteralTypeAnnotation = numberLiteralTypeAnnotation; -exports.NumberTypeAnnotation = exports.numberTypeAnnotation = numberTypeAnnotation; -exports.ObjectTypeAnnotation = exports.objectTypeAnnotation = objectTypeAnnotation; -exports.ObjectTypeInternalSlot = exports.objectTypeInternalSlot = objectTypeInternalSlot; -exports.ObjectTypeCallProperty = exports.objectTypeCallProperty = objectTypeCallProperty; -exports.ObjectTypeIndexer = exports.objectTypeIndexer = objectTypeIndexer; -exports.ObjectTypeProperty = exports.objectTypeProperty = objectTypeProperty; -exports.ObjectTypeSpreadProperty = exports.objectTypeSpreadProperty = objectTypeSpreadProperty; -exports.OpaqueType = exports.opaqueType = opaqueType; -exports.QualifiedTypeIdentifier = exports.qualifiedTypeIdentifier = qualifiedTypeIdentifier; -exports.StringLiteralTypeAnnotation = exports.stringLiteralTypeAnnotation = stringLiteralTypeAnnotation; -exports.StringTypeAnnotation = exports.stringTypeAnnotation = stringTypeAnnotation; -exports.SymbolTypeAnnotation = exports.symbolTypeAnnotation = symbolTypeAnnotation; -exports.ThisTypeAnnotation = exports.thisTypeAnnotation = thisTypeAnnotation; -exports.TupleTypeAnnotation = exports.tupleTypeAnnotation = tupleTypeAnnotation; -exports.TypeofTypeAnnotation = exports.typeofTypeAnnotation = typeofTypeAnnotation; -exports.TypeAlias = exports.typeAlias = typeAlias; -exports.TypeAnnotation = exports.typeAnnotation = typeAnnotation; -exports.TypeCastExpression = exports.typeCastExpression = typeCastExpression; -exports.TypeParameter = exports.typeParameter = typeParameter; -exports.TypeParameterDeclaration = exports.typeParameterDeclaration = typeParameterDeclaration; -exports.TypeParameterInstantiation = exports.typeParameterInstantiation = typeParameterInstantiation; -exports.UnionTypeAnnotation = exports.unionTypeAnnotation = unionTypeAnnotation; -exports.Variance = exports.variance = variance; -exports.VoidTypeAnnotation = exports.voidTypeAnnotation = voidTypeAnnotation; -exports.EnumDeclaration = exports.enumDeclaration = enumDeclaration; -exports.EnumBooleanBody = exports.enumBooleanBody = enumBooleanBody; -exports.EnumNumberBody = exports.enumNumberBody = enumNumberBody; -exports.EnumStringBody = exports.enumStringBody = enumStringBody; -exports.EnumSymbolBody = exports.enumSymbolBody = enumSymbolBody; -exports.EnumBooleanMember = exports.enumBooleanMember = enumBooleanMember; -exports.EnumNumberMember = exports.enumNumberMember = enumNumberMember; -exports.EnumStringMember = exports.enumStringMember = enumStringMember; -exports.EnumDefaultedMember = exports.enumDefaultedMember = enumDefaultedMember; -exports.jSXAttribute = exports.JSXAttribute = exports.jsxAttribute = jsxAttribute; -exports.jSXClosingElement = exports.JSXClosingElement = exports.jsxClosingElement = jsxClosingElement; -exports.jSXElement = exports.JSXElement = exports.jsxElement = jsxElement; -exports.jSXEmptyExpression = exports.JSXEmptyExpression = exports.jsxEmptyExpression = jsxEmptyExpression; -exports.jSXExpressionContainer = exports.JSXExpressionContainer = exports.jsxExpressionContainer = jsxExpressionContainer; -exports.jSXSpreadChild = exports.JSXSpreadChild = exports.jsxSpreadChild = jsxSpreadChild; -exports.jSXIdentifier = exports.JSXIdentifier = exports.jsxIdentifier = jsxIdentifier; -exports.jSXMemberExpression = exports.JSXMemberExpression = exports.jsxMemberExpression = jsxMemberExpression; -exports.jSXNamespacedName = exports.JSXNamespacedName = exports.jsxNamespacedName = jsxNamespacedName; -exports.jSXOpeningElement = exports.JSXOpeningElement = exports.jsxOpeningElement = jsxOpeningElement; -exports.jSXSpreadAttribute = exports.JSXSpreadAttribute = exports.jsxSpreadAttribute = jsxSpreadAttribute; -exports.jSXText = exports.JSXText = exports.jsxText = jsxText; -exports.jSXFragment = exports.JSXFragment = exports.jsxFragment = jsxFragment; -exports.jSXOpeningFragment = exports.JSXOpeningFragment = exports.jsxOpeningFragment = jsxOpeningFragment; -exports.jSXClosingFragment = exports.JSXClosingFragment = exports.jsxClosingFragment = jsxClosingFragment; -exports.Noop = exports.noop = noop; -exports.Placeholder = exports.placeholder = placeholder; -exports.V8IntrinsicIdentifier = exports.v8IntrinsicIdentifier = v8IntrinsicIdentifier; -exports.ArgumentPlaceholder = exports.argumentPlaceholder = argumentPlaceholder; -exports.BindExpression = exports.bindExpression = bindExpression; -exports.ClassProperty = exports.classProperty = classProperty; -exports.PipelineTopicExpression = exports.pipelineTopicExpression = pipelineTopicExpression; -exports.PipelineBareFunction = exports.pipelineBareFunction = pipelineBareFunction; -exports.PipelinePrimaryTopicReference = exports.pipelinePrimaryTopicReference = pipelinePrimaryTopicReference; -exports.ClassPrivateProperty = exports.classPrivateProperty = classPrivateProperty; -exports.ClassPrivateMethod = exports.classPrivateMethod = classPrivateMethod; -exports.ImportAttribute = exports.importAttribute = importAttribute; -exports.Decorator = exports.decorator = decorator; -exports.DoExpression = exports.doExpression = doExpression; -exports.ExportDefaultSpecifier = exports.exportDefaultSpecifier = exportDefaultSpecifier; -exports.PrivateName = exports.privateName = privateName; -exports.RecordExpression = exports.recordExpression = recordExpression; -exports.TupleExpression = exports.tupleExpression = tupleExpression; -exports.DecimalLiteral = exports.decimalLiteral = decimalLiteral; -exports.StaticBlock = exports.staticBlock = staticBlock; -exports.tSParameterProperty = exports.TSParameterProperty = exports.tsParameterProperty = tsParameterProperty; -exports.tSDeclareFunction = exports.TSDeclareFunction = exports.tsDeclareFunction = tsDeclareFunction; -exports.tSDeclareMethod = exports.TSDeclareMethod = exports.tsDeclareMethod = tsDeclareMethod; -exports.tSQualifiedName = exports.TSQualifiedName = exports.tsQualifiedName = tsQualifiedName; -exports.tSCallSignatureDeclaration = exports.TSCallSignatureDeclaration = exports.tsCallSignatureDeclaration = tsCallSignatureDeclaration; -exports.tSConstructSignatureDeclaration = exports.TSConstructSignatureDeclaration = exports.tsConstructSignatureDeclaration = tsConstructSignatureDeclaration; -exports.tSPropertySignature = exports.TSPropertySignature = exports.tsPropertySignature = tsPropertySignature; -exports.tSMethodSignature = exports.TSMethodSignature = exports.tsMethodSignature = tsMethodSignature; -exports.tSIndexSignature = exports.TSIndexSignature = exports.tsIndexSignature = tsIndexSignature; -exports.tSAnyKeyword = exports.TSAnyKeyword = exports.tsAnyKeyword = tsAnyKeyword; -exports.tSBooleanKeyword = exports.TSBooleanKeyword = exports.tsBooleanKeyword = tsBooleanKeyword; -exports.tSBigIntKeyword = exports.TSBigIntKeyword = exports.tsBigIntKeyword = tsBigIntKeyword; -exports.tSIntrinsicKeyword = exports.TSIntrinsicKeyword = exports.tsIntrinsicKeyword = tsIntrinsicKeyword; -exports.tSNeverKeyword = exports.TSNeverKeyword = exports.tsNeverKeyword = tsNeverKeyword; -exports.tSNullKeyword = exports.TSNullKeyword = exports.tsNullKeyword = tsNullKeyword; -exports.tSNumberKeyword = exports.TSNumberKeyword = exports.tsNumberKeyword = tsNumberKeyword; -exports.tSObjectKeyword = exports.TSObjectKeyword = exports.tsObjectKeyword = tsObjectKeyword; -exports.tSStringKeyword = exports.TSStringKeyword = exports.tsStringKeyword = tsStringKeyword; -exports.tSSymbolKeyword = exports.TSSymbolKeyword = exports.tsSymbolKeyword = tsSymbolKeyword; -exports.tSUndefinedKeyword = exports.TSUndefinedKeyword = exports.tsUndefinedKeyword = tsUndefinedKeyword; -exports.tSUnknownKeyword = exports.TSUnknownKeyword = exports.tsUnknownKeyword = tsUnknownKeyword; -exports.tSVoidKeyword = exports.TSVoidKeyword = exports.tsVoidKeyword = tsVoidKeyword; -exports.tSThisType = exports.TSThisType = exports.tsThisType = tsThisType; -exports.tSFunctionType = exports.TSFunctionType = exports.tsFunctionType = tsFunctionType; -exports.tSConstructorType = exports.TSConstructorType = exports.tsConstructorType = tsConstructorType; -exports.tSTypeReference = exports.TSTypeReference = exports.tsTypeReference = tsTypeReference; -exports.tSTypePredicate = exports.TSTypePredicate = exports.tsTypePredicate = tsTypePredicate; -exports.tSTypeQuery = exports.TSTypeQuery = exports.tsTypeQuery = tsTypeQuery; -exports.tSTypeLiteral = exports.TSTypeLiteral = exports.tsTypeLiteral = tsTypeLiteral; -exports.tSArrayType = exports.TSArrayType = exports.tsArrayType = tsArrayType; -exports.tSTupleType = exports.TSTupleType = exports.tsTupleType = tsTupleType; -exports.tSOptionalType = exports.TSOptionalType = exports.tsOptionalType = tsOptionalType; -exports.tSRestType = exports.TSRestType = exports.tsRestType = tsRestType; -exports.tSNamedTupleMember = exports.TSNamedTupleMember = exports.tsNamedTupleMember = tsNamedTupleMember; -exports.tSUnionType = exports.TSUnionType = exports.tsUnionType = tsUnionType; -exports.tSIntersectionType = exports.TSIntersectionType = exports.tsIntersectionType = tsIntersectionType; -exports.tSConditionalType = exports.TSConditionalType = exports.tsConditionalType = tsConditionalType; -exports.tSInferType = exports.TSInferType = exports.tsInferType = tsInferType; -exports.tSParenthesizedType = exports.TSParenthesizedType = exports.tsParenthesizedType = tsParenthesizedType; -exports.tSTypeOperator = exports.TSTypeOperator = exports.tsTypeOperator = tsTypeOperator; -exports.tSIndexedAccessType = exports.TSIndexedAccessType = exports.tsIndexedAccessType = tsIndexedAccessType; -exports.tSMappedType = exports.TSMappedType = exports.tsMappedType = tsMappedType; -exports.tSLiteralType = exports.TSLiteralType = exports.tsLiteralType = tsLiteralType; -exports.tSExpressionWithTypeArguments = exports.TSExpressionWithTypeArguments = exports.tsExpressionWithTypeArguments = tsExpressionWithTypeArguments; -exports.tSInterfaceDeclaration = exports.TSInterfaceDeclaration = exports.tsInterfaceDeclaration = tsInterfaceDeclaration; -exports.tSInterfaceBody = exports.TSInterfaceBody = exports.tsInterfaceBody = tsInterfaceBody; -exports.tSTypeAliasDeclaration = exports.TSTypeAliasDeclaration = exports.tsTypeAliasDeclaration = tsTypeAliasDeclaration; -exports.tSAsExpression = exports.TSAsExpression = exports.tsAsExpression = tsAsExpression; -exports.tSTypeAssertion = exports.TSTypeAssertion = exports.tsTypeAssertion = tsTypeAssertion; -exports.tSEnumDeclaration = exports.TSEnumDeclaration = exports.tsEnumDeclaration = tsEnumDeclaration; -exports.tSEnumMember = exports.TSEnumMember = exports.tsEnumMember = tsEnumMember; -exports.tSModuleDeclaration = exports.TSModuleDeclaration = exports.tsModuleDeclaration = tsModuleDeclaration; -exports.tSModuleBlock = exports.TSModuleBlock = exports.tsModuleBlock = tsModuleBlock; -exports.tSImportType = exports.TSImportType = exports.tsImportType = tsImportType; -exports.tSImportEqualsDeclaration = exports.TSImportEqualsDeclaration = exports.tsImportEqualsDeclaration = tsImportEqualsDeclaration; -exports.tSExternalModuleReference = exports.TSExternalModuleReference = exports.tsExternalModuleReference = tsExternalModuleReference; -exports.tSNonNullExpression = exports.TSNonNullExpression = exports.tsNonNullExpression = tsNonNullExpression; -exports.tSExportAssignment = exports.TSExportAssignment = exports.tsExportAssignment = tsExportAssignment; -exports.tSNamespaceExportDeclaration = exports.TSNamespaceExportDeclaration = exports.tsNamespaceExportDeclaration = tsNamespaceExportDeclaration; -exports.tSTypeAnnotation = exports.TSTypeAnnotation = exports.tsTypeAnnotation = tsTypeAnnotation; -exports.tSTypeParameterInstantiation = exports.TSTypeParameterInstantiation = exports.tsTypeParameterInstantiation = tsTypeParameterInstantiation; -exports.tSTypeParameterDeclaration = exports.TSTypeParameterDeclaration = exports.tsTypeParameterDeclaration = tsTypeParameterDeclaration; -exports.tSTypeParameter = exports.TSTypeParameter = exports.tsTypeParameter = tsTypeParameter; -exports.numberLiteral = exports.NumberLiteral = NumberLiteral; -exports.regexLiteral = exports.RegexLiteral = RegexLiteral; -exports.restProperty = exports.RestProperty = RestProperty; -exports.spreadProperty = exports.SpreadProperty = SpreadProperty; +exports.arrayExpression = arrayExpression; +exports.assignmentExpression = assignmentExpression; +exports.binaryExpression = binaryExpression; +exports.interpreterDirective = interpreterDirective; +exports.directive = directive; +exports.directiveLiteral = directiveLiteral; +exports.blockStatement = blockStatement; +exports.breakStatement = breakStatement; +exports.callExpression = callExpression; +exports.catchClause = catchClause; +exports.conditionalExpression = conditionalExpression; +exports.continueStatement = continueStatement; +exports.debuggerStatement = debuggerStatement; +exports.doWhileStatement = doWhileStatement; +exports.emptyStatement = emptyStatement; +exports.expressionStatement = expressionStatement; +exports.file = file; +exports.forInStatement = forInStatement; +exports.forStatement = forStatement; +exports.functionDeclaration = functionDeclaration; +exports.functionExpression = functionExpression; +exports.identifier = identifier; +exports.ifStatement = ifStatement; +exports.labeledStatement = labeledStatement; +exports.stringLiteral = stringLiteral; +exports.numericLiteral = numericLiteral; +exports.nullLiteral = nullLiteral; +exports.booleanLiteral = booleanLiteral; +exports.regExpLiteral = regExpLiteral; +exports.logicalExpression = logicalExpression; +exports.memberExpression = memberExpression; +exports.newExpression = newExpression; +exports.program = program; +exports.objectExpression = objectExpression; +exports.objectMethod = objectMethod; +exports.objectProperty = objectProperty; +exports.restElement = restElement; +exports.returnStatement = returnStatement; +exports.sequenceExpression = sequenceExpression; +exports.parenthesizedExpression = parenthesizedExpression; +exports.switchCase = switchCase; +exports.switchStatement = switchStatement; +exports.thisExpression = thisExpression; +exports.throwStatement = throwStatement; +exports.tryStatement = tryStatement; +exports.unaryExpression = unaryExpression; +exports.updateExpression = updateExpression; +exports.variableDeclaration = variableDeclaration; +exports.variableDeclarator = variableDeclarator; +exports.whileStatement = whileStatement; +exports.withStatement = withStatement; +exports.assignmentPattern = assignmentPattern; +exports.arrayPattern = arrayPattern; +exports.arrowFunctionExpression = arrowFunctionExpression; +exports.classBody = classBody; +exports.classExpression = classExpression; +exports.classDeclaration = classDeclaration; +exports.exportAllDeclaration = exportAllDeclaration; +exports.exportDefaultDeclaration = exportDefaultDeclaration; +exports.exportNamedDeclaration = exportNamedDeclaration; +exports.exportSpecifier = exportSpecifier; +exports.forOfStatement = forOfStatement; +exports.importDeclaration = importDeclaration; +exports.importDefaultSpecifier = importDefaultSpecifier; +exports.importNamespaceSpecifier = importNamespaceSpecifier; +exports.importSpecifier = importSpecifier; +exports.metaProperty = metaProperty; +exports.classMethod = classMethod; +exports.objectPattern = objectPattern; +exports.spreadElement = spreadElement; +exports.super = _super; +exports.taggedTemplateExpression = taggedTemplateExpression; +exports.templateElement = templateElement; +exports.templateLiteral = templateLiteral; +exports.yieldExpression = yieldExpression; +exports.awaitExpression = awaitExpression; +exports.import = _import; +exports.bigIntLiteral = bigIntLiteral; +exports.exportNamespaceSpecifier = exportNamespaceSpecifier; +exports.optionalMemberExpression = optionalMemberExpression; +exports.optionalCallExpression = optionalCallExpression; +exports.anyTypeAnnotation = anyTypeAnnotation; +exports.arrayTypeAnnotation = arrayTypeAnnotation; +exports.booleanTypeAnnotation = booleanTypeAnnotation; +exports.booleanLiteralTypeAnnotation = booleanLiteralTypeAnnotation; +exports.nullLiteralTypeAnnotation = nullLiteralTypeAnnotation; +exports.classImplements = classImplements; +exports.declareClass = declareClass; +exports.declareFunction = declareFunction; +exports.declareInterface = declareInterface; +exports.declareModule = declareModule; +exports.declareModuleExports = declareModuleExports; +exports.declareTypeAlias = declareTypeAlias; +exports.declareOpaqueType = declareOpaqueType; +exports.declareVariable = declareVariable; +exports.declareExportDeclaration = declareExportDeclaration; +exports.declareExportAllDeclaration = declareExportAllDeclaration; +exports.declaredPredicate = declaredPredicate; +exports.existsTypeAnnotation = existsTypeAnnotation; +exports.functionTypeAnnotation = functionTypeAnnotation; +exports.functionTypeParam = functionTypeParam; +exports.genericTypeAnnotation = genericTypeAnnotation; +exports.inferredPredicate = inferredPredicate; +exports.interfaceExtends = interfaceExtends; +exports.interfaceDeclaration = interfaceDeclaration; +exports.interfaceTypeAnnotation = interfaceTypeAnnotation; +exports.intersectionTypeAnnotation = intersectionTypeAnnotation; +exports.mixedTypeAnnotation = mixedTypeAnnotation; +exports.emptyTypeAnnotation = emptyTypeAnnotation; +exports.nullableTypeAnnotation = nullableTypeAnnotation; +exports.numberLiteralTypeAnnotation = numberLiteralTypeAnnotation; +exports.numberTypeAnnotation = numberTypeAnnotation; +exports.objectTypeAnnotation = objectTypeAnnotation; +exports.objectTypeInternalSlot = objectTypeInternalSlot; +exports.objectTypeCallProperty = objectTypeCallProperty; +exports.objectTypeIndexer = objectTypeIndexer; +exports.objectTypeProperty = objectTypeProperty; +exports.objectTypeSpreadProperty = objectTypeSpreadProperty; +exports.opaqueType = opaqueType; +exports.qualifiedTypeIdentifier = qualifiedTypeIdentifier; +exports.stringLiteralTypeAnnotation = stringLiteralTypeAnnotation; +exports.stringTypeAnnotation = stringTypeAnnotation; +exports.symbolTypeAnnotation = symbolTypeAnnotation; +exports.thisTypeAnnotation = thisTypeAnnotation; +exports.tupleTypeAnnotation = tupleTypeAnnotation; +exports.typeofTypeAnnotation = typeofTypeAnnotation; +exports.typeAlias = typeAlias; +exports.typeAnnotation = typeAnnotation; +exports.typeCastExpression = typeCastExpression; +exports.typeParameter = typeParameter; +exports.typeParameterDeclaration = typeParameterDeclaration; +exports.typeParameterInstantiation = typeParameterInstantiation; +exports.unionTypeAnnotation = unionTypeAnnotation; +exports.variance = variance; +exports.voidTypeAnnotation = voidTypeAnnotation; +exports.enumDeclaration = enumDeclaration; +exports.enumBooleanBody = enumBooleanBody; +exports.enumNumberBody = enumNumberBody; +exports.enumStringBody = enumStringBody; +exports.enumSymbolBody = enumSymbolBody; +exports.enumBooleanMember = enumBooleanMember; +exports.enumNumberMember = enumNumberMember; +exports.enumStringMember = enumStringMember; +exports.enumDefaultedMember = enumDefaultedMember; +exports.jSXAttribute = exports.jsxAttribute = jsxAttribute; +exports.jSXClosingElement = exports.jsxClosingElement = jsxClosingElement; +exports.jSXElement = exports.jsxElement = jsxElement; +exports.jSXEmptyExpression = exports.jsxEmptyExpression = jsxEmptyExpression; +exports.jSXExpressionContainer = exports.jsxExpressionContainer = jsxExpressionContainer; +exports.jSXSpreadChild = exports.jsxSpreadChild = jsxSpreadChild; +exports.jSXIdentifier = exports.jsxIdentifier = jsxIdentifier; +exports.jSXMemberExpression = exports.jsxMemberExpression = jsxMemberExpression; +exports.jSXNamespacedName = exports.jsxNamespacedName = jsxNamespacedName; +exports.jSXOpeningElement = exports.jsxOpeningElement = jsxOpeningElement; +exports.jSXSpreadAttribute = exports.jsxSpreadAttribute = jsxSpreadAttribute; +exports.jSXText = exports.jsxText = jsxText; +exports.jSXFragment = exports.jsxFragment = jsxFragment; +exports.jSXOpeningFragment = exports.jsxOpeningFragment = jsxOpeningFragment; +exports.jSXClosingFragment = exports.jsxClosingFragment = jsxClosingFragment; +exports.noop = noop; +exports.placeholder = placeholder; +exports.v8IntrinsicIdentifier = v8IntrinsicIdentifier; +exports.argumentPlaceholder = argumentPlaceholder; +exports.bindExpression = bindExpression; +exports.classProperty = classProperty; +exports.pipelineTopicExpression = pipelineTopicExpression; +exports.pipelineBareFunction = pipelineBareFunction; +exports.pipelinePrimaryTopicReference = pipelinePrimaryTopicReference; +exports.classPrivateProperty = classPrivateProperty; +exports.classPrivateMethod = classPrivateMethod; +exports.importAttribute = importAttribute; +exports.decorator = decorator; +exports.doExpression = doExpression; +exports.exportDefaultSpecifier = exportDefaultSpecifier; +exports.privateName = privateName; +exports.recordExpression = recordExpression; +exports.tupleExpression = tupleExpression; +exports.decimalLiteral = decimalLiteral; +exports.staticBlock = staticBlock; +exports.tSParameterProperty = exports.tsParameterProperty = tsParameterProperty; +exports.tSDeclareFunction = exports.tsDeclareFunction = tsDeclareFunction; +exports.tSDeclareMethod = exports.tsDeclareMethod = tsDeclareMethod; +exports.tSQualifiedName = exports.tsQualifiedName = tsQualifiedName; +exports.tSCallSignatureDeclaration = exports.tsCallSignatureDeclaration = tsCallSignatureDeclaration; +exports.tSConstructSignatureDeclaration = exports.tsConstructSignatureDeclaration = tsConstructSignatureDeclaration; +exports.tSPropertySignature = exports.tsPropertySignature = tsPropertySignature; +exports.tSMethodSignature = exports.tsMethodSignature = tsMethodSignature; +exports.tSIndexSignature = exports.tsIndexSignature = tsIndexSignature; +exports.tSAnyKeyword = exports.tsAnyKeyword = tsAnyKeyword; +exports.tSBooleanKeyword = exports.tsBooleanKeyword = tsBooleanKeyword; +exports.tSBigIntKeyword = exports.tsBigIntKeyword = tsBigIntKeyword; +exports.tSIntrinsicKeyword = exports.tsIntrinsicKeyword = tsIntrinsicKeyword; +exports.tSNeverKeyword = exports.tsNeverKeyword = tsNeverKeyword; +exports.tSNullKeyword = exports.tsNullKeyword = tsNullKeyword; +exports.tSNumberKeyword = exports.tsNumberKeyword = tsNumberKeyword; +exports.tSObjectKeyword = exports.tsObjectKeyword = tsObjectKeyword; +exports.tSStringKeyword = exports.tsStringKeyword = tsStringKeyword; +exports.tSSymbolKeyword = exports.tsSymbolKeyword = tsSymbolKeyword; +exports.tSUndefinedKeyword = exports.tsUndefinedKeyword = tsUndefinedKeyword; +exports.tSUnknownKeyword = exports.tsUnknownKeyword = tsUnknownKeyword; +exports.tSVoidKeyword = exports.tsVoidKeyword = tsVoidKeyword; +exports.tSThisType = exports.tsThisType = tsThisType; +exports.tSFunctionType = exports.tsFunctionType = tsFunctionType; +exports.tSConstructorType = exports.tsConstructorType = tsConstructorType; +exports.tSTypeReference = exports.tsTypeReference = tsTypeReference; +exports.tSTypePredicate = exports.tsTypePredicate = tsTypePredicate; +exports.tSTypeQuery = exports.tsTypeQuery = tsTypeQuery; +exports.tSTypeLiteral = exports.tsTypeLiteral = tsTypeLiteral; +exports.tSArrayType = exports.tsArrayType = tsArrayType; +exports.tSTupleType = exports.tsTupleType = tsTupleType; +exports.tSOptionalType = exports.tsOptionalType = tsOptionalType; +exports.tSRestType = exports.tsRestType = tsRestType; +exports.tSNamedTupleMember = exports.tsNamedTupleMember = tsNamedTupleMember; +exports.tSUnionType = exports.tsUnionType = tsUnionType; +exports.tSIntersectionType = exports.tsIntersectionType = tsIntersectionType; +exports.tSConditionalType = exports.tsConditionalType = tsConditionalType; +exports.tSInferType = exports.tsInferType = tsInferType; +exports.tSParenthesizedType = exports.tsParenthesizedType = tsParenthesizedType; +exports.tSTypeOperator = exports.tsTypeOperator = tsTypeOperator; +exports.tSIndexedAccessType = exports.tsIndexedAccessType = tsIndexedAccessType; +exports.tSMappedType = exports.tsMappedType = tsMappedType; +exports.tSLiteralType = exports.tsLiteralType = tsLiteralType; +exports.tSExpressionWithTypeArguments = exports.tsExpressionWithTypeArguments = tsExpressionWithTypeArguments; +exports.tSInterfaceDeclaration = exports.tsInterfaceDeclaration = tsInterfaceDeclaration; +exports.tSInterfaceBody = exports.tsInterfaceBody = tsInterfaceBody; +exports.tSTypeAliasDeclaration = exports.tsTypeAliasDeclaration = tsTypeAliasDeclaration; +exports.tSAsExpression = exports.tsAsExpression = tsAsExpression; +exports.tSTypeAssertion = exports.tsTypeAssertion = tsTypeAssertion; +exports.tSEnumDeclaration = exports.tsEnumDeclaration = tsEnumDeclaration; +exports.tSEnumMember = exports.tsEnumMember = tsEnumMember; +exports.tSModuleDeclaration = exports.tsModuleDeclaration = tsModuleDeclaration; +exports.tSModuleBlock = exports.tsModuleBlock = tsModuleBlock; +exports.tSImportType = exports.tsImportType = tsImportType; +exports.tSImportEqualsDeclaration = exports.tsImportEqualsDeclaration = tsImportEqualsDeclaration; +exports.tSExternalModuleReference = exports.tsExternalModuleReference = tsExternalModuleReference; +exports.tSNonNullExpression = exports.tsNonNullExpression = tsNonNullExpression; +exports.tSExportAssignment = exports.tsExportAssignment = tsExportAssignment; +exports.tSNamespaceExportDeclaration = exports.tsNamespaceExportDeclaration = tsNamespaceExportDeclaration; +exports.tSTypeAnnotation = exports.tsTypeAnnotation = tsTypeAnnotation; +exports.tSTypeParameterInstantiation = exports.tsTypeParameterInstantiation = tsTypeParameterInstantiation; +exports.tSTypeParameterDeclaration = exports.tsTypeParameterDeclaration = tsTypeParameterDeclaration; +exports.tSTypeParameter = exports.tsTypeParameter = tsTypeParameter; +exports.numberLiteral = NumberLiteral; +exports.regexLiteral = RegexLiteral; +exports.restProperty = RestProperty; +exports.spreadProperty = SpreadProperty; var _builder = _interopRequireDefault(require("../builder")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -function arrayExpression(...args) { - return (0, _builder.default)("ArrayExpression", ...args); +function arrayExpression(elements) { + return (0, _builder.default)("ArrayExpression", ...arguments); } -function assignmentExpression(...args) { - return (0, _builder.default)("AssignmentExpression", ...args); +function assignmentExpression(operator, left, right) { + return (0, _builder.default)("AssignmentExpression", ...arguments); } -function binaryExpression(...args) { - return (0, _builder.default)("BinaryExpression", ...args); +function binaryExpression(operator, left, right) { + return (0, _builder.default)("BinaryExpression", ...arguments); } -function interpreterDirective(...args) { - return (0, _builder.default)("InterpreterDirective", ...args); +function interpreterDirective(value) { + return (0, _builder.default)("InterpreterDirective", ...arguments); } -function directive(...args) { - return (0, _builder.default)("Directive", ...args); +function directive(value) { + return (0, _builder.default)("Directive", ...arguments); } -function directiveLiteral(...args) { - return (0, _builder.default)("DirectiveLiteral", ...args); +function directiveLiteral(value) { + return (0, _builder.default)("DirectiveLiteral", ...arguments); } -function blockStatement(...args) { - return (0, _builder.default)("BlockStatement", ...args); +function blockStatement(body, directives) { + return (0, _builder.default)("BlockStatement", ...arguments); } -function breakStatement(...args) { - return (0, _builder.default)("BreakStatement", ...args); +function breakStatement(label) { + return (0, _builder.default)("BreakStatement", ...arguments); } -function callExpression(...args) { - return (0, _builder.default)("CallExpression", ...args); +function callExpression(callee, _arguments) { + return (0, _builder.default)("CallExpression", ...arguments); } -function catchClause(...args) { - return (0, _builder.default)("CatchClause", ...args); +function catchClause(param, body) { + return (0, _builder.default)("CatchClause", ...arguments); } -function conditionalExpression(...args) { - return (0, _builder.default)("ConditionalExpression", ...args); +function conditionalExpression(test, consequent, alternate) { + return (0, _builder.default)("ConditionalExpression", ...arguments); } -function continueStatement(...args) { - return (0, _builder.default)("ContinueStatement", ...args); +function continueStatement(label) { + return (0, _builder.default)("ContinueStatement", ...arguments); } -function debuggerStatement(...args) { - return (0, _builder.default)("DebuggerStatement", ...args); +function debuggerStatement() { + return (0, _builder.default)("DebuggerStatement", ...arguments); } -function doWhileStatement(...args) { - return (0, _builder.default)("DoWhileStatement", ...args); +function doWhileStatement(test, body) { + return (0, _builder.default)("DoWhileStatement", ...arguments); } -function emptyStatement(...args) { - return (0, _builder.default)("EmptyStatement", ...args); +function emptyStatement() { + return (0, _builder.default)("EmptyStatement", ...arguments); } -function expressionStatement(...args) { - return (0, _builder.default)("ExpressionStatement", ...args); +function expressionStatement(expression) { + return (0, _builder.default)("ExpressionStatement", ...arguments); } -function file(...args) { - return (0, _builder.default)("File", ...args); +function file(program, comments, tokens) { + return (0, _builder.default)("File", ...arguments); } -function forInStatement(...args) { - return (0, _builder.default)("ForInStatement", ...args); +function forInStatement(left, right, body) { + return (0, _builder.default)("ForInStatement", ...arguments); } -function forStatement(...args) { - return (0, _builder.default)("ForStatement", ...args); +function forStatement(init, test, update, body) { + return (0, _builder.default)("ForStatement", ...arguments); } -function functionDeclaration(...args) { - return (0, _builder.default)("FunctionDeclaration", ...args); +function functionDeclaration(id, params, body, generator, async) { + return (0, _builder.default)("FunctionDeclaration", ...arguments); } -function functionExpression(...args) { - return (0, _builder.default)("FunctionExpression", ...args); +function functionExpression(id, params, body, generator, async) { + return (0, _builder.default)("FunctionExpression", ...arguments); } -function identifier(...args) { - return (0, _builder.default)("Identifier", ...args); +function identifier(name) { + return (0, _builder.default)("Identifier", ...arguments); } -function ifStatement(...args) { - return (0, _builder.default)("IfStatement", ...args); +function ifStatement(test, consequent, alternate) { + return (0, _builder.default)("IfStatement", ...arguments); } -function labeledStatement(...args) { - return (0, _builder.default)("LabeledStatement", ...args); +function labeledStatement(label, body) { + return (0, _builder.default)("LabeledStatement", ...arguments); } -function stringLiteral(...args) { - return (0, _builder.default)("StringLiteral", ...args); +function stringLiteral(value) { + return (0, _builder.default)("StringLiteral", ...arguments); } -function numericLiteral(...args) { - return (0, _builder.default)("NumericLiteral", ...args); +function numericLiteral(value) { + return (0, _builder.default)("NumericLiteral", ...arguments); } -function nullLiteral(...args) { - return (0, _builder.default)("NullLiteral", ...args); +function nullLiteral() { + return (0, _builder.default)("NullLiteral", ...arguments); } -function booleanLiteral(...args) { - return (0, _builder.default)("BooleanLiteral", ...args); +function booleanLiteral(value) { + return (0, _builder.default)("BooleanLiteral", ...arguments); } -function regExpLiteral(...args) { - return (0, _builder.default)("RegExpLiteral", ...args); +function regExpLiteral(pattern, flags) { + return (0, _builder.default)("RegExpLiteral", ...arguments); } -function logicalExpression(...args) { - return (0, _builder.default)("LogicalExpression", ...args); +function logicalExpression(operator, left, right) { + return (0, _builder.default)("LogicalExpression", ...arguments); } -function memberExpression(...args) { - return (0, _builder.default)("MemberExpression", ...args); +function memberExpression(object, property, computed, optional) { + return (0, _builder.default)("MemberExpression", ...arguments); } -function newExpression(...args) { - return (0, _builder.default)("NewExpression", ...args); +function newExpression(callee, _arguments) { + return (0, _builder.default)("NewExpression", ...arguments); } -function program(...args) { - return (0, _builder.default)("Program", ...args); +function program(body, directives, sourceType, interpreter) { + return (0, _builder.default)("Program", ...arguments); } -function objectExpression(...args) { - return (0, _builder.default)("ObjectExpression", ...args); +function objectExpression(properties) { + return (0, _builder.default)("ObjectExpression", ...arguments); } -function objectMethod(...args) { - return (0, _builder.default)("ObjectMethod", ...args); +function objectMethod(kind, key, params, body, computed, generator, async) { + return (0, _builder.default)("ObjectMethod", ...arguments); } -function objectProperty(...args) { - return (0, _builder.default)("ObjectProperty", ...args); +function objectProperty(key, value, computed, shorthand, decorators) { + return (0, _builder.default)("ObjectProperty", ...arguments); } -function restElement(...args) { - return (0, _builder.default)("RestElement", ...args); +function restElement(argument) { + return (0, _builder.default)("RestElement", ...arguments); } -function returnStatement(...args) { - return (0, _builder.default)("ReturnStatement", ...args); +function returnStatement(argument) { + return (0, _builder.default)("ReturnStatement", ...arguments); } -function sequenceExpression(...args) { - return (0, _builder.default)("SequenceExpression", ...args); +function sequenceExpression(expressions) { + return (0, _builder.default)("SequenceExpression", ...arguments); } -function parenthesizedExpression(...args) { - return (0, _builder.default)("ParenthesizedExpression", ...args); +function parenthesizedExpression(expression) { + return (0, _builder.default)("ParenthesizedExpression", ...arguments); } -function switchCase(...args) { - return (0, _builder.default)("SwitchCase", ...args); +function switchCase(test, consequent) { + return (0, _builder.default)("SwitchCase", ...arguments); } -function switchStatement(...args) { - return (0, _builder.default)("SwitchStatement", ...args); +function switchStatement(discriminant, cases) { + return (0, _builder.default)("SwitchStatement", ...arguments); } -function thisExpression(...args) { - return (0, _builder.default)("ThisExpression", ...args); +function thisExpression() { + return (0, _builder.default)("ThisExpression", ...arguments); } -function throwStatement(...args) { - return (0, _builder.default)("ThrowStatement", ...args); +function throwStatement(argument) { + return (0, _builder.default)("ThrowStatement", ...arguments); } -function tryStatement(...args) { - return (0, _builder.default)("TryStatement", ...args); +function tryStatement(block, handler, finalizer) { + return (0, _builder.default)("TryStatement", ...arguments); } -function unaryExpression(...args) { - return (0, _builder.default)("UnaryExpression", ...args); +function unaryExpression(operator, argument, prefix) { + return (0, _builder.default)("UnaryExpression", ...arguments); } -function updateExpression(...args) { - return (0, _builder.default)("UpdateExpression", ...args); +function updateExpression(operator, argument, prefix) { + return (0, _builder.default)("UpdateExpression", ...arguments); } -function variableDeclaration(...args) { - return (0, _builder.default)("VariableDeclaration", ...args); +function variableDeclaration(kind, declarations) { + return (0, _builder.default)("VariableDeclaration", ...arguments); } -function variableDeclarator(...args) { - return (0, _builder.default)("VariableDeclarator", ...args); +function variableDeclarator(id, init) { + return (0, _builder.default)("VariableDeclarator", ...arguments); } -function whileStatement(...args) { - return (0, _builder.default)("WhileStatement", ...args); +function whileStatement(test, body) { + return (0, _builder.default)("WhileStatement", ...arguments); } -function withStatement(...args) { - return (0, _builder.default)("WithStatement", ...args); +function withStatement(object, body) { + return (0, _builder.default)("WithStatement", ...arguments); } -function assignmentPattern(...args) { - return (0, _builder.default)("AssignmentPattern", ...args); +function assignmentPattern(left, right) { + return (0, _builder.default)("AssignmentPattern", ...arguments); } -function arrayPattern(...args) { - return (0, _builder.default)("ArrayPattern", ...args); +function arrayPattern(elements) { + return (0, _builder.default)("ArrayPattern", ...arguments); } -function arrowFunctionExpression(...args) { - return (0, _builder.default)("ArrowFunctionExpression", ...args); +function arrowFunctionExpression(params, body, async) { + return (0, _builder.default)("ArrowFunctionExpression", ...arguments); } -function classBody(...args) { - return (0, _builder.default)("ClassBody", ...args); +function classBody(body) { + return (0, _builder.default)("ClassBody", ...arguments); } -function classExpression(...args) { - return (0, _builder.default)("ClassExpression", ...args); +function classExpression(id, superClass, body, decorators) { + return (0, _builder.default)("ClassExpression", ...arguments); } -function classDeclaration(...args) { - return (0, _builder.default)("ClassDeclaration", ...args); +function classDeclaration(id, superClass, body, decorators) { + return (0, _builder.default)("ClassDeclaration", ...arguments); } -function exportAllDeclaration(...args) { - return (0, _builder.default)("ExportAllDeclaration", ...args); +function exportAllDeclaration(source) { + return (0, _builder.default)("ExportAllDeclaration", ...arguments); } -function exportDefaultDeclaration(...args) { - return (0, _builder.default)("ExportDefaultDeclaration", ...args); +function exportDefaultDeclaration(declaration) { + return (0, _builder.default)("ExportDefaultDeclaration", ...arguments); } -function exportNamedDeclaration(...args) { - return (0, _builder.default)("ExportNamedDeclaration", ...args); +function exportNamedDeclaration(declaration, specifiers, source) { + return (0, _builder.default)("ExportNamedDeclaration", ...arguments); } -function exportSpecifier(...args) { - return (0, _builder.default)("ExportSpecifier", ...args); +function exportSpecifier(local, exported) { + return (0, _builder.default)("ExportSpecifier", ...arguments); } -function forOfStatement(...args) { - return (0, _builder.default)("ForOfStatement", ...args); +function forOfStatement(left, right, body, _await) { + return (0, _builder.default)("ForOfStatement", ...arguments); } -function importDeclaration(...args) { - return (0, _builder.default)("ImportDeclaration", ...args); +function importDeclaration(specifiers, source) { + return (0, _builder.default)("ImportDeclaration", ...arguments); } -function importDefaultSpecifier(...args) { - return (0, _builder.default)("ImportDefaultSpecifier", ...args); +function importDefaultSpecifier(local) { + return (0, _builder.default)("ImportDefaultSpecifier", ...arguments); } -function importNamespaceSpecifier(...args) { - return (0, _builder.default)("ImportNamespaceSpecifier", ...args); +function importNamespaceSpecifier(local) { + return (0, _builder.default)("ImportNamespaceSpecifier", ...arguments); } -function importSpecifier(...args) { - return (0, _builder.default)("ImportSpecifier", ...args); +function importSpecifier(local, imported) { + return (0, _builder.default)("ImportSpecifier", ...arguments); } -function metaProperty(...args) { - return (0, _builder.default)("MetaProperty", ...args); +function metaProperty(meta, property) { + return (0, _builder.default)("MetaProperty", ...arguments); } -function classMethod(...args) { - return (0, _builder.default)("ClassMethod", ...args); +function classMethod(kind, key, params, body, computed, _static, generator, async) { + return (0, _builder.default)("ClassMethod", ...arguments); } -function objectPattern(...args) { - return (0, _builder.default)("ObjectPattern", ...args); +function objectPattern(properties) { + return (0, _builder.default)("ObjectPattern", ...arguments); } -function spreadElement(...args) { - return (0, _builder.default)("SpreadElement", ...args); +function spreadElement(argument) { + return (0, _builder.default)("SpreadElement", ...arguments); } -function _super(...args) { - return (0, _builder.default)("Super", ...args); +function _super() { + return (0, _builder.default)("Super", ...arguments); } -function taggedTemplateExpression(...args) { - return (0, _builder.default)("TaggedTemplateExpression", ...args); +function taggedTemplateExpression(tag, quasi) { + return (0, _builder.default)("TaggedTemplateExpression", ...arguments); } -function templateElement(...args) { - return (0, _builder.default)("TemplateElement", ...args); +function templateElement(value, tail) { + return (0, _builder.default)("TemplateElement", ...arguments); } -function templateLiteral(...args) { - return (0, _builder.default)("TemplateLiteral", ...args); +function templateLiteral(quasis, expressions) { + return (0, _builder.default)("TemplateLiteral", ...arguments); } -function yieldExpression(...args) { - return (0, _builder.default)("YieldExpression", ...args); +function yieldExpression(argument, delegate) { + return (0, _builder.default)("YieldExpression", ...arguments); } -function awaitExpression(...args) { - return (0, _builder.default)("AwaitExpression", ...args); +function awaitExpression(argument) { + return (0, _builder.default)("AwaitExpression", ...arguments); } -function _import(...args) { - return (0, _builder.default)("Import", ...args); +function _import() { + return (0, _builder.default)("Import", ...arguments); } -function bigIntLiteral(...args) { - return (0, _builder.default)("BigIntLiteral", ...args); +function bigIntLiteral(value) { + return (0, _builder.default)("BigIntLiteral", ...arguments); } -function exportNamespaceSpecifier(...args) { - return (0, _builder.default)("ExportNamespaceSpecifier", ...args); +function exportNamespaceSpecifier(exported) { + return (0, _builder.default)("ExportNamespaceSpecifier", ...arguments); } -function optionalMemberExpression(...args) { - return (0, _builder.default)("OptionalMemberExpression", ...args); +function optionalMemberExpression(object, property, computed, optional) { + return (0, _builder.default)("OptionalMemberExpression", ...arguments); } -function optionalCallExpression(...args) { - return (0, _builder.default)("OptionalCallExpression", ...args); +function optionalCallExpression(callee, _arguments, optional) { + return (0, _builder.default)("OptionalCallExpression", ...arguments); } -function anyTypeAnnotation(...args) { - return (0, _builder.default)("AnyTypeAnnotation", ...args); +function anyTypeAnnotation() { + return (0, _builder.default)("AnyTypeAnnotation", ...arguments); } -function arrayTypeAnnotation(...args) { - return (0, _builder.default)("ArrayTypeAnnotation", ...args); +function arrayTypeAnnotation(elementType) { + return (0, _builder.default)("ArrayTypeAnnotation", ...arguments); } -function booleanTypeAnnotation(...args) { - return (0, _builder.default)("BooleanTypeAnnotation", ...args); +function booleanTypeAnnotation() { + return (0, _builder.default)("BooleanTypeAnnotation", ...arguments); } -function booleanLiteralTypeAnnotation(...args) { - return (0, _builder.default)("BooleanLiteralTypeAnnotation", ...args); +function booleanLiteralTypeAnnotation(value) { + return (0, _builder.default)("BooleanLiteralTypeAnnotation", ...arguments); } -function nullLiteralTypeAnnotation(...args) { - return (0, _builder.default)("NullLiteralTypeAnnotation", ...args); +function nullLiteralTypeAnnotation() { + return (0, _builder.default)("NullLiteralTypeAnnotation", ...arguments); } -function classImplements(...args) { - return (0, _builder.default)("ClassImplements", ...args); +function classImplements(id, typeParameters) { + return (0, _builder.default)("ClassImplements", ...arguments); } -function declareClass(...args) { - return (0, _builder.default)("DeclareClass", ...args); +function declareClass(id, typeParameters, _extends, body) { + return (0, _builder.default)("DeclareClass", ...arguments); } -function declareFunction(...args) { - return (0, _builder.default)("DeclareFunction", ...args); +function declareFunction(id) { + return (0, _builder.default)("DeclareFunction", ...arguments); } -function declareInterface(...args) { - return (0, _builder.default)("DeclareInterface", ...args); +function declareInterface(id, typeParameters, _extends, body) { + return (0, _builder.default)("DeclareInterface", ...arguments); } -function declareModule(...args) { - return (0, _builder.default)("DeclareModule", ...args); +function declareModule(id, body, kind) { + return (0, _builder.default)("DeclareModule", ...arguments); } -function declareModuleExports(...args) { - return (0, _builder.default)("DeclareModuleExports", ...args); +function declareModuleExports(typeAnnotation) { + return (0, _builder.default)("DeclareModuleExports", ...arguments); } -function declareTypeAlias(...args) { - return (0, _builder.default)("DeclareTypeAlias", ...args); +function declareTypeAlias(id, typeParameters, right) { + return (0, _builder.default)("DeclareTypeAlias", ...arguments); } -function declareOpaqueType(...args) { - return (0, _builder.default)("DeclareOpaqueType", ...args); +function declareOpaqueType(id, typeParameters, supertype) { + return (0, _builder.default)("DeclareOpaqueType", ...arguments); } -function declareVariable(...args) { - return (0, _builder.default)("DeclareVariable", ...args); +function declareVariable(id) { + return (0, _builder.default)("DeclareVariable", ...arguments); } -function declareExportDeclaration(...args) { - return (0, _builder.default)("DeclareExportDeclaration", ...args); +function declareExportDeclaration(declaration, specifiers, source) { + return (0, _builder.default)("DeclareExportDeclaration", ...arguments); } -function declareExportAllDeclaration(...args) { - return (0, _builder.default)("DeclareExportAllDeclaration", ...args); +function declareExportAllDeclaration(source) { + return (0, _builder.default)("DeclareExportAllDeclaration", ...arguments); } -function declaredPredicate(...args) { - return (0, _builder.default)("DeclaredPredicate", ...args); +function declaredPredicate(value) { + return (0, _builder.default)("DeclaredPredicate", ...arguments); } -function existsTypeAnnotation(...args) { - return (0, _builder.default)("ExistsTypeAnnotation", ...args); +function existsTypeAnnotation() { + return (0, _builder.default)("ExistsTypeAnnotation", ...arguments); } -function functionTypeAnnotation(...args) { - return (0, _builder.default)("FunctionTypeAnnotation", ...args); +function functionTypeAnnotation(typeParameters, params, rest, returnType) { + return (0, _builder.default)("FunctionTypeAnnotation", ...arguments); } -function functionTypeParam(...args) { - return (0, _builder.default)("FunctionTypeParam", ...args); +function functionTypeParam(name, typeAnnotation) { + return (0, _builder.default)("FunctionTypeParam", ...arguments); } -function genericTypeAnnotation(...args) { - return (0, _builder.default)("GenericTypeAnnotation", ...args); +function genericTypeAnnotation(id, typeParameters) { + return (0, _builder.default)("GenericTypeAnnotation", ...arguments); } -function inferredPredicate(...args) { - return (0, _builder.default)("InferredPredicate", ...args); +function inferredPredicate() { + return (0, _builder.default)("InferredPredicate", ...arguments); } -function interfaceExtends(...args) { - return (0, _builder.default)("InterfaceExtends", ...args); +function interfaceExtends(id, typeParameters) { + return (0, _builder.default)("InterfaceExtends", ...arguments); } -function interfaceDeclaration(...args) { - return (0, _builder.default)("InterfaceDeclaration", ...args); +function interfaceDeclaration(id, typeParameters, _extends, body) { + return (0, _builder.default)("InterfaceDeclaration", ...arguments); } -function interfaceTypeAnnotation(...args) { - return (0, _builder.default)("InterfaceTypeAnnotation", ...args); +function interfaceTypeAnnotation(_extends, body) { + return (0, _builder.default)("InterfaceTypeAnnotation", ...arguments); } -function intersectionTypeAnnotation(...args) { - return (0, _builder.default)("IntersectionTypeAnnotation", ...args); +function intersectionTypeAnnotation(types) { + return (0, _builder.default)("IntersectionTypeAnnotation", ...arguments); } -function mixedTypeAnnotation(...args) { - return (0, _builder.default)("MixedTypeAnnotation", ...args); +function mixedTypeAnnotation() { + return (0, _builder.default)("MixedTypeAnnotation", ...arguments); } -function emptyTypeAnnotation(...args) { - return (0, _builder.default)("EmptyTypeAnnotation", ...args); +function emptyTypeAnnotation() { + return (0, _builder.default)("EmptyTypeAnnotation", ...arguments); } -function nullableTypeAnnotation(...args) { - return (0, _builder.default)("NullableTypeAnnotation", ...args); +function nullableTypeAnnotation(typeAnnotation) { + return (0, _builder.default)("NullableTypeAnnotation", ...arguments); } -function numberLiteralTypeAnnotation(...args) { - return (0, _builder.default)("NumberLiteralTypeAnnotation", ...args); +function numberLiteralTypeAnnotation(value) { + return (0, _builder.default)("NumberLiteralTypeAnnotation", ...arguments); } -function numberTypeAnnotation(...args) { - return (0, _builder.default)("NumberTypeAnnotation", ...args); +function numberTypeAnnotation() { + return (0, _builder.default)("NumberTypeAnnotation", ...arguments); } -function objectTypeAnnotation(...args) { - return (0, _builder.default)("ObjectTypeAnnotation", ...args); +function objectTypeAnnotation(properties, indexers, callProperties, internalSlots, exact) { + return (0, _builder.default)("ObjectTypeAnnotation", ...arguments); } -function objectTypeInternalSlot(...args) { - return (0, _builder.default)("ObjectTypeInternalSlot", ...args); +function objectTypeInternalSlot(id, value, optional, _static, method) { + return (0, _builder.default)("ObjectTypeInternalSlot", ...arguments); } -function objectTypeCallProperty(...args) { - return (0, _builder.default)("ObjectTypeCallProperty", ...args); +function objectTypeCallProperty(value) { + return (0, _builder.default)("ObjectTypeCallProperty", ...arguments); } -function objectTypeIndexer(...args) { - return (0, _builder.default)("ObjectTypeIndexer", ...args); +function objectTypeIndexer(id, key, value, variance) { + return (0, _builder.default)("ObjectTypeIndexer", ...arguments); } -function objectTypeProperty(...args) { - return (0, _builder.default)("ObjectTypeProperty", ...args); +function objectTypeProperty(key, value, variance) { + return (0, _builder.default)("ObjectTypeProperty", ...arguments); } -function objectTypeSpreadProperty(...args) { - return (0, _builder.default)("ObjectTypeSpreadProperty", ...args); +function objectTypeSpreadProperty(argument) { + return (0, _builder.default)("ObjectTypeSpreadProperty", ...arguments); } -function opaqueType(...args) { - return (0, _builder.default)("OpaqueType", ...args); +function opaqueType(id, typeParameters, supertype, impltype) { + return (0, _builder.default)("OpaqueType", ...arguments); } -function qualifiedTypeIdentifier(...args) { - return (0, _builder.default)("QualifiedTypeIdentifier", ...args); +function qualifiedTypeIdentifier(id, qualification) { + return (0, _builder.default)("QualifiedTypeIdentifier", ...arguments); } -function stringLiteralTypeAnnotation(...args) { - return (0, _builder.default)("StringLiteralTypeAnnotation", ...args); +function stringLiteralTypeAnnotation(value) { + return (0, _builder.default)("StringLiteralTypeAnnotation", ...arguments); } -function stringTypeAnnotation(...args) { - return (0, _builder.default)("StringTypeAnnotation", ...args); +function stringTypeAnnotation() { + return (0, _builder.default)("StringTypeAnnotation", ...arguments); } -function symbolTypeAnnotation(...args) { - return (0, _builder.default)("SymbolTypeAnnotation", ...args); +function symbolTypeAnnotation() { + return (0, _builder.default)("SymbolTypeAnnotation", ...arguments); } -function thisTypeAnnotation(...args) { - return (0, _builder.default)("ThisTypeAnnotation", ...args); +function thisTypeAnnotation() { + return (0, _builder.default)("ThisTypeAnnotation", ...arguments); } -function tupleTypeAnnotation(...args) { - return (0, _builder.default)("TupleTypeAnnotation", ...args); +function tupleTypeAnnotation(types) { + return (0, _builder.default)("TupleTypeAnnotation", ...arguments); } -function typeofTypeAnnotation(...args) { - return (0, _builder.default)("TypeofTypeAnnotation", ...args); +function typeofTypeAnnotation(argument) { + return (0, _builder.default)("TypeofTypeAnnotation", ...arguments); } -function typeAlias(...args) { - return (0, _builder.default)("TypeAlias", ...args); +function typeAlias(id, typeParameters, right) { + return (0, _builder.default)("TypeAlias", ...arguments); } -function typeAnnotation(...args) { - return (0, _builder.default)("TypeAnnotation", ...args); +function typeAnnotation(typeAnnotation) { + return (0, _builder.default)("TypeAnnotation", ...arguments); } -function typeCastExpression(...args) { - return (0, _builder.default)("TypeCastExpression", ...args); +function typeCastExpression(expression, typeAnnotation) { + return (0, _builder.default)("TypeCastExpression", ...arguments); } -function typeParameter(...args) { - return (0, _builder.default)("TypeParameter", ...args); +function typeParameter(bound, _default, variance) { + return (0, _builder.default)("TypeParameter", ...arguments); } -function typeParameterDeclaration(...args) { - return (0, _builder.default)("TypeParameterDeclaration", ...args); +function typeParameterDeclaration(params) { + return (0, _builder.default)("TypeParameterDeclaration", ...arguments); } -function typeParameterInstantiation(...args) { - return (0, _builder.default)("TypeParameterInstantiation", ...args); +function typeParameterInstantiation(params) { + return (0, _builder.default)("TypeParameterInstantiation", ...arguments); } -function unionTypeAnnotation(...args) { - return (0, _builder.default)("UnionTypeAnnotation", ...args); +function unionTypeAnnotation(types) { + return (0, _builder.default)("UnionTypeAnnotation", ...arguments); } -function variance(...args) { - return (0, _builder.default)("Variance", ...args); +function variance(kind) { + return (0, _builder.default)("Variance", ...arguments); } -function voidTypeAnnotation(...args) { - return (0, _builder.default)("VoidTypeAnnotation", ...args); +function voidTypeAnnotation() { + return (0, _builder.default)("VoidTypeAnnotation", ...arguments); } -function enumDeclaration(...args) { - return (0, _builder.default)("EnumDeclaration", ...args); +function enumDeclaration(id, body) { + return (0, _builder.default)("EnumDeclaration", ...arguments); } -function enumBooleanBody(...args) { - return (0, _builder.default)("EnumBooleanBody", ...args); +function enumBooleanBody(members) { + return (0, _builder.default)("EnumBooleanBody", ...arguments); } -function enumNumberBody(...args) { - return (0, _builder.default)("EnumNumberBody", ...args); +function enumNumberBody(members) { + return (0, _builder.default)("EnumNumberBody", ...arguments); } -function enumStringBody(...args) { - return (0, _builder.default)("EnumStringBody", ...args); +function enumStringBody(members) { + return (0, _builder.default)("EnumStringBody", ...arguments); } -function enumSymbolBody(...args) { - return (0, _builder.default)("EnumSymbolBody", ...args); +function enumSymbolBody(members) { + return (0, _builder.default)("EnumSymbolBody", ...arguments); } -function enumBooleanMember(...args) { - return (0, _builder.default)("EnumBooleanMember", ...args); +function enumBooleanMember(id) { + return (0, _builder.default)("EnumBooleanMember", ...arguments); } -function enumNumberMember(...args) { - return (0, _builder.default)("EnumNumberMember", ...args); +function enumNumberMember(id, init) { + return (0, _builder.default)("EnumNumberMember", ...arguments); } -function enumStringMember(...args) { - return (0, _builder.default)("EnumStringMember", ...args); +function enumStringMember(id, init) { + return (0, _builder.default)("EnumStringMember", ...arguments); } -function enumDefaultedMember(...args) { - return (0, _builder.default)("EnumDefaultedMember", ...args); +function enumDefaultedMember(id) { + return (0, _builder.default)("EnumDefaultedMember", ...arguments); } -function jsxAttribute(...args) { - return (0, _builder.default)("JSXAttribute", ...args); +function jsxAttribute(name, value) { + return (0, _builder.default)("JSXAttribute", ...arguments); } -function jsxClosingElement(...args) { - return (0, _builder.default)("JSXClosingElement", ...args); +function jsxClosingElement(name) { + return (0, _builder.default)("JSXClosingElement", ...arguments); } -function jsxElement(...args) { - return (0, _builder.default)("JSXElement", ...args); +function jsxElement(openingElement, closingElement, children, selfClosing) { + return (0, _builder.default)("JSXElement", ...arguments); } -function jsxEmptyExpression(...args) { - return (0, _builder.default)("JSXEmptyExpression", ...args); +function jsxEmptyExpression() { + return (0, _builder.default)("JSXEmptyExpression", ...arguments); } -function jsxExpressionContainer(...args) { - return (0, _builder.default)("JSXExpressionContainer", ...args); +function jsxExpressionContainer(expression) { + return (0, _builder.default)("JSXExpressionContainer", ...arguments); } -function jsxSpreadChild(...args) { - return (0, _builder.default)("JSXSpreadChild", ...args); +function jsxSpreadChild(expression) { + return (0, _builder.default)("JSXSpreadChild", ...arguments); } -function jsxIdentifier(...args) { - return (0, _builder.default)("JSXIdentifier", ...args); +function jsxIdentifier(name) { + return (0, _builder.default)("JSXIdentifier", ...arguments); } -function jsxMemberExpression(...args) { - return (0, _builder.default)("JSXMemberExpression", ...args); +function jsxMemberExpression(object, property) { + return (0, _builder.default)("JSXMemberExpression", ...arguments); } -function jsxNamespacedName(...args) { - return (0, _builder.default)("JSXNamespacedName", ...args); +function jsxNamespacedName(namespace, name) { + return (0, _builder.default)("JSXNamespacedName", ...arguments); } -function jsxOpeningElement(...args) { - return (0, _builder.default)("JSXOpeningElement", ...args); +function jsxOpeningElement(name, attributes, selfClosing) { + return (0, _builder.default)("JSXOpeningElement", ...arguments); } -function jsxSpreadAttribute(...args) { - return (0, _builder.default)("JSXSpreadAttribute", ...args); +function jsxSpreadAttribute(argument) { + return (0, _builder.default)("JSXSpreadAttribute", ...arguments); } -function jsxText(...args) { - return (0, _builder.default)("JSXText", ...args); +function jsxText(value) { + return (0, _builder.default)("JSXText", ...arguments); } -function jsxFragment(...args) { - return (0, _builder.default)("JSXFragment", ...args); +function jsxFragment(openingFragment, closingFragment, children) { + return (0, _builder.default)("JSXFragment", ...arguments); } -function jsxOpeningFragment(...args) { - return (0, _builder.default)("JSXOpeningFragment", ...args); +function jsxOpeningFragment() { + return (0, _builder.default)("JSXOpeningFragment", ...arguments); } -function jsxClosingFragment(...args) { - return (0, _builder.default)("JSXClosingFragment", ...args); +function jsxClosingFragment() { + return (0, _builder.default)("JSXClosingFragment", ...arguments); } -function noop(...args) { - return (0, _builder.default)("Noop", ...args); +function noop() { + return (0, _builder.default)("Noop", ...arguments); } -function placeholder(...args) { - return (0, _builder.default)("Placeholder", ...args); +function placeholder(expectedNode, name) { + return (0, _builder.default)("Placeholder", ...arguments); } -function v8IntrinsicIdentifier(...args) { - return (0, _builder.default)("V8IntrinsicIdentifier", ...args); +function v8IntrinsicIdentifier(name) { + return (0, _builder.default)("V8IntrinsicIdentifier", ...arguments); } -function argumentPlaceholder(...args) { - return (0, _builder.default)("ArgumentPlaceholder", ...args); +function argumentPlaceholder() { + return (0, _builder.default)("ArgumentPlaceholder", ...arguments); } -function bindExpression(...args) { - return (0, _builder.default)("BindExpression", ...args); +function bindExpression(object, callee) { + return (0, _builder.default)("BindExpression", ...arguments); } -function classProperty(...args) { - return (0, _builder.default)("ClassProperty", ...args); +function classProperty(key, value, typeAnnotation, decorators, computed, _static) { + return (0, _builder.default)("ClassProperty", ...arguments); } -function pipelineTopicExpression(...args) { - return (0, _builder.default)("PipelineTopicExpression", ...args); +function pipelineTopicExpression(expression) { + return (0, _builder.default)("PipelineTopicExpression", ...arguments); } -function pipelineBareFunction(...args) { - return (0, _builder.default)("PipelineBareFunction", ...args); +function pipelineBareFunction(callee) { + return (0, _builder.default)("PipelineBareFunction", ...arguments); } -function pipelinePrimaryTopicReference(...args) { - return (0, _builder.default)("PipelinePrimaryTopicReference", ...args); +function pipelinePrimaryTopicReference() { + return (0, _builder.default)("PipelinePrimaryTopicReference", ...arguments); } -function classPrivateProperty(...args) { - return (0, _builder.default)("ClassPrivateProperty", ...args); +function classPrivateProperty(key, value, decorators, _static) { + return (0, _builder.default)("ClassPrivateProperty", ...arguments); } -function classPrivateMethod(...args) { - return (0, _builder.default)("ClassPrivateMethod", ...args); +function classPrivateMethod(kind, key, params, body, _static) { + return (0, _builder.default)("ClassPrivateMethod", ...arguments); } -function importAttribute(...args) { - return (0, _builder.default)("ImportAttribute", ...args); +function importAttribute(key, value) { + return (0, _builder.default)("ImportAttribute", ...arguments); } -function decorator(...args) { - return (0, _builder.default)("Decorator", ...args); +function decorator(expression) { + return (0, _builder.default)("Decorator", ...arguments); } -function doExpression(...args) { - return (0, _builder.default)("DoExpression", ...args); +function doExpression(body) { + return (0, _builder.default)("DoExpression", ...arguments); } -function exportDefaultSpecifier(...args) { - return (0, _builder.default)("ExportDefaultSpecifier", ...args); +function exportDefaultSpecifier(exported) { + return (0, _builder.default)("ExportDefaultSpecifier", ...arguments); } -function privateName(...args) { - return (0, _builder.default)("PrivateName", ...args); +function privateName(id) { + return (0, _builder.default)("PrivateName", ...arguments); } -function recordExpression(...args) { - return (0, _builder.default)("RecordExpression", ...args); +function recordExpression(properties) { + return (0, _builder.default)("RecordExpression", ...arguments); } -function tupleExpression(...args) { - return (0, _builder.default)("TupleExpression", ...args); +function tupleExpression(elements) { + return (0, _builder.default)("TupleExpression", ...arguments); } -function decimalLiteral(...args) { - return (0, _builder.default)("DecimalLiteral", ...args); +function decimalLiteral(value) { + return (0, _builder.default)("DecimalLiteral", ...arguments); } -function staticBlock(...args) { - return (0, _builder.default)("StaticBlock", ...args); +function staticBlock(body) { + return (0, _builder.default)("StaticBlock", ...arguments); } -function tsParameterProperty(...args) { - return (0, _builder.default)("TSParameterProperty", ...args); +function tsParameterProperty(parameter) { + return (0, _builder.default)("TSParameterProperty", ...arguments); } -function tsDeclareFunction(...args) { - return (0, _builder.default)("TSDeclareFunction", ...args); +function tsDeclareFunction(id, typeParameters, params, returnType) { + return (0, _builder.default)("TSDeclareFunction", ...arguments); } -function tsDeclareMethod(...args) { - return (0, _builder.default)("TSDeclareMethod", ...args); +function tsDeclareMethod(decorators, key, typeParameters, params, returnType) { + return (0, _builder.default)("TSDeclareMethod", ...arguments); } -function tsQualifiedName(...args) { - return (0, _builder.default)("TSQualifiedName", ...args); +function tsQualifiedName(left, right) { + return (0, _builder.default)("TSQualifiedName", ...arguments); } -function tsCallSignatureDeclaration(...args) { - return (0, _builder.default)("TSCallSignatureDeclaration", ...args); +function tsCallSignatureDeclaration(typeParameters, parameters, typeAnnotation) { + return (0, _builder.default)("TSCallSignatureDeclaration", ...arguments); } -function tsConstructSignatureDeclaration(...args) { - return (0, _builder.default)("TSConstructSignatureDeclaration", ...args); +function tsConstructSignatureDeclaration(typeParameters, parameters, typeAnnotation) { + return (0, _builder.default)("TSConstructSignatureDeclaration", ...arguments); } -function tsPropertySignature(...args) { - return (0, _builder.default)("TSPropertySignature", ...args); +function tsPropertySignature(key, typeAnnotation, initializer) { + return (0, _builder.default)("TSPropertySignature", ...arguments); } -function tsMethodSignature(...args) { - return (0, _builder.default)("TSMethodSignature", ...args); +function tsMethodSignature(key, typeParameters, parameters, typeAnnotation) { + return (0, _builder.default)("TSMethodSignature", ...arguments); } -function tsIndexSignature(...args) { - return (0, _builder.default)("TSIndexSignature", ...args); +function tsIndexSignature(parameters, typeAnnotation) { + return (0, _builder.default)("TSIndexSignature", ...arguments); } -function tsAnyKeyword(...args) { - return (0, _builder.default)("TSAnyKeyword", ...args); +function tsAnyKeyword() { + return (0, _builder.default)("TSAnyKeyword", ...arguments); } -function tsBooleanKeyword(...args) { - return (0, _builder.default)("TSBooleanKeyword", ...args); +function tsBooleanKeyword() { + return (0, _builder.default)("TSBooleanKeyword", ...arguments); } -function tsBigIntKeyword(...args) { - return (0, _builder.default)("TSBigIntKeyword", ...args); +function tsBigIntKeyword() { + return (0, _builder.default)("TSBigIntKeyword", ...arguments); } -function tsIntrinsicKeyword(...args) { - return (0, _builder.default)("TSIntrinsicKeyword", ...args); +function tsIntrinsicKeyword() { + return (0, _builder.default)("TSIntrinsicKeyword", ...arguments); } -function tsNeverKeyword(...args) { - return (0, _builder.default)("TSNeverKeyword", ...args); +function tsNeverKeyword() { + return (0, _builder.default)("TSNeverKeyword", ...arguments); } -function tsNullKeyword(...args) { - return (0, _builder.default)("TSNullKeyword", ...args); +function tsNullKeyword() { + return (0, _builder.default)("TSNullKeyword", ...arguments); } -function tsNumberKeyword(...args) { - return (0, _builder.default)("TSNumberKeyword", ...args); +function tsNumberKeyword() { + return (0, _builder.default)("TSNumberKeyword", ...arguments); } -function tsObjectKeyword(...args) { - return (0, _builder.default)("TSObjectKeyword", ...args); +function tsObjectKeyword() { + return (0, _builder.default)("TSObjectKeyword", ...arguments); } -function tsStringKeyword(...args) { - return (0, _builder.default)("TSStringKeyword", ...args); +function tsStringKeyword() { + return (0, _builder.default)("TSStringKeyword", ...arguments); } -function tsSymbolKeyword(...args) { - return (0, _builder.default)("TSSymbolKeyword", ...args); +function tsSymbolKeyword() { + return (0, _builder.default)("TSSymbolKeyword", ...arguments); } -function tsUndefinedKeyword(...args) { - return (0, _builder.default)("TSUndefinedKeyword", ...args); +function tsUndefinedKeyword() { + return (0, _builder.default)("TSUndefinedKeyword", ...arguments); } -function tsUnknownKeyword(...args) { - return (0, _builder.default)("TSUnknownKeyword", ...args); +function tsUnknownKeyword() { + return (0, _builder.default)("TSUnknownKeyword", ...arguments); } -function tsVoidKeyword(...args) { - return (0, _builder.default)("TSVoidKeyword", ...args); +function tsVoidKeyword() { + return (0, _builder.default)("TSVoidKeyword", ...arguments); } -function tsThisType(...args) { - return (0, _builder.default)("TSThisType", ...args); +function tsThisType() { + return (0, _builder.default)("TSThisType", ...arguments); } -function tsFunctionType(...args) { - return (0, _builder.default)("TSFunctionType", ...args); +function tsFunctionType(typeParameters, parameters, typeAnnotation) { + return (0, _builder.default)("TSFunctionType", ...arguments); } -function tsConstructorType(...args) { - return (0, _builder.default)("TSConstructorType", ...args); +function tsConstructorType(typeParameters, parameters, typeAnnotation) { + return (0, _builder.default)("TSConstructorType", ...arguments); } -function tsTypeReference(...args) { - return (0, _builder.default)("TSTypeReference", ...args); +function tsTypeReference(typeName, typeParameters) { + return (0, _builder.default)("TSTypeReference", ...arguments); } -function tsTypePredicate(...args) { - return (0, _builder.default)("TSTypePredicate", ...args); +function tsTypePredicate(parameterName, typeAnnotation, asserts) { + return (0, _builder.default)("TSTypePredicate", ...arguments); } -function tsTypeQuery(...args) { - return (0, _builder.default)("TSTypeQuery", ...args); +function tsTypeQuery(exprName) { + return (0, _builder.default)("TSTypeQuery", ...arguments); } -function tsTypeLiteral(...args) { - return (0, _builder.default)("TSTypeLiteral", ...args); +function tsTypeLiteral(members) { + return (0, _builder.default)("TSTypeLiteral", ...arguments); } -function tsArrayType(...args) { - return (0, _builder.default)("TSArrayType", ...args); +function tsArrayType(elementType) { + return (0, _builder.default)("TSArrayType", ...arguments); } -function tsTupleType(...args) { - return (0, _builder.default)("TSTupleType", ...args); +function tsTupleType(elementTypes) { + return (0, _builder.default)("TSTupleType", ...arguments); } -function tsOptionalType(...args) { - return (0, _builder.default)("TSOptionalType", ...args); +function tsOptionalType(typeAnnotation) { + return (0, _builder.default)("TSOptionalType", ...arguments); } -function tsRestType(...args) { - return (0, _builder.default)("TSRestType", ...args); +function tsRestType(typeAnnotation) { + return (0, _builder.default)("TSRestType", ...arguments); } -function tsNamedTupleMember(...args) { - return (0, _builder.default)("TSNamedTupleMember", ...args); +function tsNamedTupleMember(label, elementType, optional) { + return (0, _builder.default)("TSNamedTupleMember", ...arguments); } -function tsUnionType(...args) { - return (0, _builder.default)("TSUnionType", ...args); +function tsUnionType(types) { + return (0, _builder.default)("TSUnionType", ...arguments); } -function tsIntersectionType(...args) { - return (0, _builder.default)("TSIntersectionType", ...args); +function tsIntersectionType(types) { + return (0, _builder.default)("TSIntersectionType", ...arguments); } -function tsConditionalType(...args) { - return (0, _builder.default)("TSConditionalType", ...args); +function tsConditionalType(checkType, extendsType, trueType, falseType) { + return (0, _builder.default)("TSConditionalType", ...arguments); } -function tsInferType(...args) { - return (0, _builder.default)("TSInferType", ...args); +function tsInferType(typeParameter) { + return (0, _builder.default)("TSInferType", ...arguments); } -function tsParenthesizedType(...args) { - return (0, _builder.default)("TSParenthesizedType", ...args); +function tsParenthesizedType(typeAnnotation) { + return (0, _builder.default)("TSParenthesizedType", ...arguments); } -function tsTypeOperator(...args) { - return (0, _builder.default)("TSTypeOperator", ...args); +function tsTypeOperator(typeAnnotation) { + return (0, _builder.default)("TSTypeOperator", ...arguments); } -function tsIndexedAccessType(...args) { - return (0, _builder.default)("TSIndexedAccessType", ...args); +function tsIndexedAccessType(objectType, indexType) { + return (0, _builder.default)("TSIndexedAccessType", ...arguments); } -function tsMappedType(...args) { - return (0, _builder.default)("TSMappedType", ...args); +function tsMappedType(typeParameter, typeAnnotation, nameType) { + return (0, _builder.default)("TSMappedType", ...arguments); } -function tsLiteralType(...args) { - return (0, _builder.default)("TSLiteralType", ...args); +function tsLiteralType(literal) { + return (0, _builder.default)("TSLiteralType", ...arguments); } -function tsExpressionWithTypeArguments(...args) { - return (0, _builder.default)("TSExpressionWithTypeArguments", ...args); +function tsExpressionWithTypeArguments(expression, typeParameters) { + return (0, _builder.default)("TSExpressionWithTypeArguments", ...arguments); } -function tsInterfaceDeclaration(...args) { - return (0, _builder.default)("TSInterfaceDeclaration", ...args); +function tsInterfaceDeclaration(id, typeParameters, _extends, body) { + return (0, _builder.default)("TSInterfaceDeclaration", ...arguments); } -function tsInterfaceBody(...args) { - return (0, _builder.default)("TSInterfaceBody", ...args); +function tsInterfaceBody(body) { + return (0, _builder.default)("TSInterfaceBody", ...arguments); } -function tsTypeAliasDeclaration(...args) { - return (0, _builder.default)("TSTypeAliasDeclaration", ...args); +function tsTypeAliasDeclaration(id, typeParameters, typeAnnotation) { + return (0, _builder.default)("TSTypeAliasDeclaration", ...arguments); } -function tsAsExpression(...args) { - return (0, _builder.default)("TSAsExpression", ...args); +function tsAsExpression(expression, typeAnnotation) { + return (0, _builder.default)("TSAsExpression", ...arguments); } -function tsTypeAssertion(...args) { - return (0, _builder.default)("TSTypeAssertion", ...args); +function tsTypeAssertion(typeAnnotation, expression) { + return (0, _builder.default)("TSTypeAssertion", ...arguments); } -function tsEnumDeclaration(...args) { - return (0, _builder.default)("TSEnumDeclaration", ...args); +function tsEnumDeclaration(id, members) { + return (0, _builder.default)("TSEnumDeclaration", ...arguments); } -function tsEnumMember(...args) { - return (0, _builder.default)("TSEnumMember", ...args); +function tsEnumMember(id, initializer) { + return (0, _builder.default)("TSEnumMember", ...arguments); } -function tsModuleDeclaration(...args) { - return (0, _builder.default)("TSModuleDeclaration", ...args); +function tsModuleDeclaration(id, body) { + return (0, _builder.default)("TSModuleDeclaration", ...arguments); } -function tsModuleBlock(...args) { - return (0, _builder.default)("TSModuleBlock", ...args); +function tsModuleBlock(body) { + return (0, _builder.default)("TSModuleBlock", ...arguments); } -function tsImportType(...args) { - return (0, _builder.default)("TSImportType", ...args); +function tsImportType(argument, qualifier, typeParameters) { + return (0, _builder.default)("TSImportType", ...arguments); } -function tsImportEqualsDeclaration(...args) { - return (0, _builder.default)("TSImportEqualsDeclaration", ...args); +function tsImportEqualsDeclaration(id, moduleReference) { + return (0, _builder.default)("TSImportEqualsDeclaration", ...arguments); } -function tsExternalModuleReference(...args) { - return (0, _builder.default)("TSExternalModuleReference", ...args); +function tsExternalModuleReference(expression) { + return (0, _builder.default)("TSExternalModuleReference", ...arguments); } -function tsNonNullExpression(...args) { - return (0, _builder.default)("TSNonNullExpression", ...args); +function tsNonNullExpression(expression) { + return (0, _builder.default)("TSNonNullExpression", ...arguments); } -function tsExportAssignment(...args) { - return (0, _builder.default)("TSExportAssignment", ...args); +function tsExportAssignment(expression) { + return (0, _builder.default)("TSExportAssignment", ...arguments); } -function tsNamespaceExportDeclaration(...args) { - return (0, _builder.default)("TSNamespaceExportDeclaration", ...args); +function tsNamespaceExportDeclaration(id) { + return (0, _builder.default)("TSNamespaceExportDeclaration", ...arguments); } -function tsTypeAnnotation(...args) { - return (0, _builder.default)("TSTypeAnnotation", ...args); +function tsTypeAnnotation(typeAnnotation) { + return (0, _builder.default)("TSTypeAnnotation", ...arguments); } -function tsTypeParameterInstantiation(...args) { - return (0, _builder.default)("TSTypeParameterInstantiation", ...args); +function tsTypeParameterInstantiation(params) { + return (0, _builder.default)("TSTypeParameterInstantiation", ...arguments); } -function tsTypeParameterDeclaration(...args) { - return (0, _builder.default)("TSTypeParameterDeclaration", ...args); +function tsTypeParameterDeclaration(params) { + return (0, _builder.default)("TSTypeParameterDeclaration", ...arguments); } -function tsTypeParameter(...args) { - return (0, _builder.default)("TSTypeParameter", ...args); +function tsTypeParameter(constraint, _default, name) { + return (0, _builder.default)("TSTypeParameter", ...arguments); } function NumberLiteral(...args) { diff --git a/tools/node_modules/@babel/core/node_modules/@babel/types/lib/builders/generated/uppercase.js b/tools/node_modules/@babel/core/node_modules/@babel/types/lib/builders/generated/uppercase.js new file mode 100644 index 00000000000000..1ce7732836ae4a --- /dev/null +++ b/tools/node_modules/@babel/core/node_modules/@babel/types/lib/builders/generated/uppercase.js @@ -0,0 +1,1483 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "ArrayExpression", { + enumerable: true, + get: function () { + return _index.arrayExpression; + } +}); +Object.defineProperty(exports, "AssignmentExpression", { + enumerable: true, + get: function () { + return _index.assignmentExpression; + } +}); +Object.defineProperty(exports, "BinaryExpression", { + enumerable: true, + get: function () { + return _index.binaryExpression; + } +}); +Object.defineProperty(exports, "InterpreterDirective", { + enumerable: true, + get: function () { + return _index.interpreterDirective; + } +}); +Object.defineProperty(exports, "Directive", { + enumerable: true, + get: function () { + return _index.directive; + } +}); +Object.defineProperty(exports, "DirectiveLiteral", { + enumerable: true, + get: function () { + return _index.directiveLiteral; + } +}); +Object.defineProperty(exports, "BlockStatement", { + enumerable: true, + get: function () { + return _index.blockStatement; + } +}); +Object.defineProperty(exports, "BreakStatement", { + enumerable: true, + get: function () { + return _index.breakStatement; + } +}); +Object.defineProperty(exports, "CallExpression", { + enumerable: true, + get: function () { + return _index.callExpression; + } +}); +Object.defineProperty(exports, "CatchClause", { + enumerable: true, + get: function () { + return _index.catchClause; + } +}); +Object.defineProperty(exports, "ConditionalExpression", { + enumerable: true, + get: function () { + return _index.conditionalExpression; + } +}); +Object.defineProperty(exports, "ContinueStatement", { + enumerable: true, + get: function () { + return _index.continueStatement; + } +}); +Object.defineProperty(exports, "DebuggerStatement", { + enumerable: true, + get: function () { + return _index.debuggerStatement; + } +}); +Object.defineProperty(exports, "DoWhileStatement", { + enumerable: true, + get: function () { + return _index.doWhileStatement; + } +}); +Object.defineProperty(exports, "EmptyStatement", { + enumerable: true, + get: function () { + return _index.emptyStatement; + } +}); +Object.defineProperty(exports, "ExpressionStatement", { + enumerable: true, + get: function () { + return _index.expressionStatement; + } +}); +Object.defineProperty(exports, "File", { + enumerable: true, + get: function () { + return _index.file; + } +}); +Object.defineProperty(exports, "ForInStatement", { + enumerable: true, + get: function () { + return _index.forInStatement; + } +}); +Object.defineProperty(exports, "ForStatement", { + enumerable: true, + get: function () { + return _index.forStatement; + } +}); +Object.defineProperty(exports, "FunctionDeclaration", { + enumerable: true, + get: function () { + return _index.functionDeclaration; + } +}); +Object.defineProperty(exports, "FunctionExpression", { + enumerable: true, + get: function () { + return _index.functionExpression; + } +}); +Object.defineProperty(exports, "Identifier", { + enumerable: true, + get: function () { + return _index.identifier; + } +}); +Object.defineProperty(exports, "IfStatement", { + enumerable: true, + get: function () { + return _index.ifStatement; + } +}); +Object.defineProperty(exports, "LabeledStatement", { + enumerable: true, + get: function () { + return _index.labeledStatement; + } +}); +Object.defineProperty(exports, "StringLiteral", { + enumerable: true, + get: function () { + return _index.stringLiteral; + } +}); +Object.defineProperty(exports, "NumericLiteral", { + enumerable: true, + get: function () { + return _index.numericLiteral; + } +}); +Object.defineProperty(exports, "NullLiteral", { + enumerable: true, + get: function () { + return _index.nullLiteral; + } +}); +Object.defineProperty(exports, "BooleanLiteral", { + enumerable: true, + get: function () { + return _index.booleanLiteral; + } +}); +Object.defineProperty(exports, "RegExpLiteral", { + enumerable: true, + get: function () { + return _index.regExpLiteral; + } +}); +Object.defineProperty(exports, "LogicalExpression", { + enumerable: true, + get: function () { + return _index.logicalExpression; + } +}); +Object.defineProperty(exports, "MemberExpression", { + enumerable: true, + get: function () { + return _index.memberExpression; + } +}); +Object.defineProperty(exports, "NewExpression", { + enumerable: true, + get: function () { + return _index.newExpression; + } +}); +Object.defineProperty(exports, "Program", { + enumerable: true, + get: function () { + return _index.program; + } +}); +Object.defineProperty(exports, "ObjectExpression", { + enumerable: true, + get: function () { + return _index.objectExpression; + } +}); +Object.defineProperty(exports, "ObjectMethod", { + enumerable: true, + get: function () { + return _index.objectMethod; + } +}); +Object.defineProperty(exports, "ObjectProperty", { + enumerable: true, + get: function () { + return _index.objectProperty; + } +}); +Object.defineProperty(exports, "RestElement", { + enumerable: true, + get: function () { + return _index.restElement; + } +}); +Object.defineProperty(exports, "ReturnStatement", { + enumerable: true, + get: function () { + return _index.returnStatement; + } +}); +Object.defineProperty(exports, "SequenceExpression", { + enumerable: true, + get: function () { + return _index.sequenceExpression; + } +}); +Object.defineProperty(exports, "ParenthesizedExpression", { + enumerable: true, + get: function () { + return _index.parenthesizedExpression; + } +}); +Object.defineProperty(exports, "SwitchCase", { + enumerable: true, + get: function () { + return _index.switchCase; + } +}); +Object.defineProperty(exports, "SwitchStatement", { + enumerable: true, + get: function () { + return _index.switchStatement; + } +}); +Object.defineProperty(exports, "ThisExpression", { + enumerable: true, + get: function () { + return _index.thisExpression; + } +}); +Object.defineProperty(exports, "ThrowStatement", { + enumerable: true, + get: function () { + return _index.throwStatement; + } +}); +Object.defineProperty(exports, "TryStatement", { + enumerable: true, + get: function () { + return _index.tryStatement; + } +}); +Object.defineProperty(exports, "UnaryExpression", { + enumerable: true, + get: function () { + return _index.unaryExpression; + } +}); +Object.defineProperty(exports, "UpdateExpression", { + enumerable: true, + get: function () { + return _index.updateExpression; + } +}); +Object.defineProperty(exports, "VariableDeclaration", { + enumerable: true, + get: function () { + return _index.variableDeclaration; + } +}); +Object.defineProperty(exports, "VariableDeclarator", { + enumerable: true, + get: function () { + return _index.variableDeclarator; + } +}); +Object.defineProperty(exports, "WhileStatement", { + enumerable: true, + get: function () { + return _index.whileStatement; + } +}); +Object.defineProperty(exports, "WithStatement", { + enumerable: true, + get: function () { + return _index.withStatement; + } +}); +Object.defineProperty(exports, "AssignmentPattern", { + enumerable: true, + get: function () { + return _index.assignmentPattern; + } +}); +Object.defineProperty(exports, "ArrayPattern", { + enumerable: true, + get: function () { + return _index.arrayPattern; + } +}); +Object.defineProperty(exports, "ArrowFunctionExpression", { + enumerable: true, + get: function () { + return _index.arrowFunctionExpression; + } +}); +Object.defineProperty(exports, "ClassBody", { + enumerable: true, + get: function () { + return _index.classBody; + } +}); +Object.defineProperty(exports, "ClassExpression", { + enumerable: true, + get: function () { + return _index.classExpression; + } +}); +Object.defineProperty(exports, "ClassDeclaration", { + enumerable: true, + get: function () { + return _index.classDeclaration; + } +}); +Object.defineProperty(exports, "ExportAllDeclaration", { + enumerable: true, + get: function () { + return _index.exportAllDeclaration; + } +}); +Object.defineProperty(exports, "ExportDefaultDeclaration", { + enumerable: true, + get: function () { + return _index.exportDefaultDeclaration; + } +}); +Object.defineProperty(exports, "ExportNamedDeclaration", { + enumerable: true, + get: function () { + return _index.exportNamedDeclaration; + } +}); +Object.defineProperty(exports, "ExportSpecifier", { + enumerable: true, + get: function () { + return _index.exportSpecifier; + } +}); +Object.defineProperty(exports, "ForOfStatement", { + enumerable: true, + get: function () { + return _index.forOfStatement; + } +}); +Object.defineProperty(exports, "ImportDeclaration", { + enumerable: true, + get: function () { + return _index.importDeclaration; + } +}); +Object.defineProperty(exports, "ImportDefaultSpecifier", { + enumerable: true, + get: function () { + return _index.importDefaultSpecifier; + } +}); +Object.defineProperty(exports, "ImportNamespaceSpecifier", { + enumerable: true, + get: function () { + return _index.importNamespaceSpecifier; + } +}); +Object.defineProperty(exports, "ImportSpecifier", { + enumerable: true, + get: function () { + return _index.importSpecifier; + } +}); +Object.defineProperty(exports, "MetaProperty", { + enumerable: true, + get: function () { + return _index.metaProperty; + } +}); +Object.defineProperty(exports, "ClassMethod", { + enumerable: true, + get: function () { + return _index.classMethod; + } +}); +Object.defineProperty(exports, "ObjectPattern", { + enumerable: true, + get: function () { + return _index.objectPattern; + } +}); +Object.defineProperty(exports, "SpreadElement", { + enumerable: true, + get: function () { + return _index.spreadElement; + } +}); +Object.defineProperty(exports, "Super", { + enumerable: true, + get: function () { + return _index.super; + } +}); +Object.defineProperty(exports, "TaggedTemplateExpression", { + enumerable: true, + get: function () { + return _index.taggedTemplateExpression; + } +}); +Object.defineProperty(exports, "TemplateElement", { + enumerable: true, + get: function () { + return _index.templateElement; + } +}); +Object.defineProperty(exports, "TemplateLiteral", { + enumerable: true, + get: function () { + return _index.templateLiteral; + } +}); +Object.defineProperty(exports, "YieldExpression", { + enumerable: true, + get: function () { + return _index.yieldExpression; + } +}); +Object.defineProperty(exports, "AwaitExpression", { + enumerable: true, + get: function () { + return _index.awaitExpression; + } +}); +Object.defineProperty(exports, "Import", { + enumerable: true, + get: function () { + return _index.import; + } +}); +Object.defineProperty(exports, "BigIntLiteral", { + enumerable: true, + get: function () { + return _index.bigIntLiteral; + } +}); +Object.defineProperty(exports, "ExportNamespaceSpecifier", { + enumerable: true, + get: function () { + return _index.exportNamespaceSpecifier; + } +}); +Object.defineProperty(exports, "OptionalMemberExpression", { + enumerable: true, + get: function () { + return _index.optionalMemberExpression; + } +}); +Object.defineProperty(exports, "OptionalCallExpression", { + enumerable: true, + get: function () { + return _index.optionalCallExpression; + } +}); +Object.defineProperty(exports, "AnyTypeAnnotation", { + enumerable: true, + get: function () { + return _index.anyTypeAnnotation; + } +}); +Object.defineProperty(exports, "ArrayTypeAnnotation", { + enumerable: true, + get: function () { + return _index.arrayTypeAnnotation; + } +}); +Object.defineProperty(exports, "BooleanTypeAnnotation", { + enumerable: true, + get: function () { + return _index.booleanTypeAnnotation; + } +}); +Object.defineProperty(exports, "BooleanLiteralTypeAnnotation", { + enumerable: true, + get: function () { + return _index.booleanLiteralTypeAnnotation; + } +}); +Object.defineProperty(exports, "NullLiteralTypeAnnotation", { + enumerable: true, + get: function () { + return _index.nullLiteralTypeAnnotation; + } +}); +Object.defineProperty(exports, "ClassImplements", { + enumerable: true, + get: function () { + return _index.classImplements; + } +}); +Object.defineProperty(exports, "DeclareClass", { + enumerable: true, + get: function () { + return _index.declareClass; + } +}); +Object.defineProperty(exports, "DeclareFunction", { + enumerable: true, + get: function () { + return _index.declareFunction; + } +}); +Object.defineProperty(exports, "DeclareInterface", { + enumerable: true, + get: function () { + return _index.declareInterface; + } +}); +Object.defineProperty(exports, "DeclareModule", { + enumerable: true, + get: function () { + return _index.declareModule; + } +}); +Object.defineProperty(exports, "DeclareModuleExports", { + enumerable: true, + get: function () { + return _index.declareModuleExports; + } +}); +Object.defineProperty(exports, "DeclareTypeAlias", { + enumerable: true, + get: function () { + return _index.declareTypeAlias; + } +}); +Object.defineProperty(exports, "DeclareOpaqueType", { + enumerable: true, + get: function () { + return _index.declareOpaqueType; + } +}); +Object.defineProperty(exports, "DeclareVariable", { + enumerable: true, + get: function () { + return _index.declareVariable; + } +}); +Object.defineProperty(exports, "DeclareExportDeclaration", { + enumerable: true, + get: function () { + return _index.declareExportDeclaration; + } +}); +Object.defineProperty(exports, "DeclareExportAllDeclaration", { + enumerable: true, + get: function () { + return _index.declareExportAllDeclaration; + } +}); +Object.defineProperty(exports, "DeclaredPredicate", { + enumerable: true, + get: function () { + return _index.declaredPredicate; + } +}); +Object.defineProperty(exports, "ExistsTypeAnnotation", { + enumerable: true, + get: function () { + return _index.existsTypeAnnotation; + } +}); +Object.defineProperty(exports, "FunctionTypeAnnotation", { + enumerable: true, + get: function () { + return _index.functionTypeAnnotation; + } +}); +Object.defineProperty(exports, "FunctionTypeParam", { + enumerable: true, + get: function () { + return _index.functionTypeParam; + } +}); +Object.defineProperty(exports, "GenericTypeAnnotation", { + enumerable: true, + get: function () { + return _index.genericTypeAnnotation; + } +}); +Object.defineProperty(exports, "InferredPredicate", { + enumerable: true, + get: function () { + return _index.inferredPredicate; + } +}); +Object.defineProperty(exports, "InterfaceExtends", { + enumerable: true, + get: function () { + return _index.interfaceExtends; + } +}); +Object.defineProperty(exports, "InterfaceDeclaration", { + enumerable: true, + get: function () { + return _index.interfaceDeclaration; + } +}); +Object.defineProperty(exports, "InterfaceTypeAnnotation", { + enumerable: true, + get: function () { + return _index.interfaceTypeAnnotation; + } +}); +Object.defineProperty(exports, "IntersectionTypeAnnotation", { + enumerable: true, + get: function () { + return _index.intersectionTypeAnnotation; + } +}); +Object.defineProperty(exports, "MixedTypeAnnotation", { + enumerable: true, + get: function () { + return _index.mixedTypeAnnotation; + } +}); +Object.defineProperty(exports, "EmptyTypeAnnotation", { + enumerable: true, + get: function () { + return _index.emptyTypeAnnotation; + } +}); +Object.defineProperty(exports, "NullableTypeAnnotation", { + enumerable: true, + get: function () { + return _index.nullableTypeAnnotation; + } +}); +Object.defineProperty(exports, "NumberLiteralTypeAnnotation", { + enumerable: true, + get: function () { + return _index.numberLiteralTypeAnnotation; + } +}); +Object.defineProperty(exports, "NumberTypeAnnotation", { + enumerable: true, + get: function () { + return _index.numberTypeAnnotation; + } +}); +Object.defineProperty(exports, "ObjectTypeAnnotation", { + enumerable: true, + get: function () { + return _index.objectTypeAnnotation; + } +}); +Object.defineProperty(exports, "ObjectTypeInternalSlot", { + enumerable: true, + get: function () { + return _index.objectTypeInternalSlot; + } +}); +Object.defineProperty(exports, "ObjectTypeCallProperty", { + enumerable: true, + get: function () { + return _index.objectTypeCallProperty; + } +}); +Object.defineProperty(exports, "ObjectTypeIndexer", { + enumerable: true, + get: function () { + return _index.objectTypeIndexer; + } +}); +Object.defineProperty(exports, "ObjectTypeProperty", { + enumerable: true, + get: function () { + return _index.objectTypeProperty; + } +}); +Object.defineProperty(exports, "ObjectTypeSpreadProperty", { + enumerable: true, + get: function () { + return _index.objectTypeSpreadProperty; + } +}); +Object.defineProperty(exports, "OpaqueType", { + enumerable: true, + get: function () { + return _index.opaqueType; + } +}); +Object.defineProperty(exports, "QualifiedTypeIdentifier", { + enumerable: true, + get: function () { + return _index.qualifiedTypeIdentifier; + } +}); +Object.defineProperty(exports, "StringLiteralTypeAnnotation", { + enumerable: true, + get: function () { + return _index.stringLiteralTypeAnnotation; + } +}); +Object.defineProperty(exports, "StringTypeAnnotation", { + enumerable: true, + get: function () { + return _index.stringTypeAnnotation; + } +}); +Object.defineProperty(exports, "SymbolTypeAnnotation", { + enumerable: true, + get: function () { + return _index.symbolTypeAnnotation; + } +}); +Object.defineProperty(exports, "ThisTypeAnnotation", { + enumerable: true, + get: function () { + return _index.thisTypeAnnotation; + } +}); +Object.defineProperty(exports, "TupleTypeAnnotation", { + enumerable: true, + get: function () { + return _index.tupleTypeAnnotation; + } +}); +Object.defineProperty(exports, "TypeofTypeAnnotation", { + enumerable: true, + get: function () { + return _index.typeofTypeAnnotation; + } +}); +Object.defineProperty(exports, "TypeAlias", { + enumerable: true, + get: function () { + return _index.typeAlias; + } +}); +Object.defineProperty(exports, "TypeAnnotation", { + enumerable: true, + get: function () { + return _index.typeAnnotation; + } +}); +Object.defineProperty(exports, "TypeCastExpression", { + enumerable: true, + get: function () { + return _index.typeCastExpression; + } +}); +Object.defineProperty(exports, "TypeParameter", { + enumerable: true, + get: function () { + return _index.typeParameter; + } +}); +Object.defineProperty(exports, "TypeParameterDeclaration", { + enumerable: true, + get: function () { + return _index.typeParameterDeclaration; + } +}); +Object.defineProperty(exports, "TypeParameterInstantiation", { + enumerable: true, + get: function () { + return _index.typeParameterInstantiation; + } +}); +Object.defineProperty(exports, "UnionTypeAnnotation", { + enumerable: true, + get: function () { + return _index.unionTypeAnnotation; + } +}); +Object.defineProperty(exports, "Variance", { + enumerable: true, + get: function () { + return _index.variance; + } +}); +Object.defineProperty(exports, "VoidTypeAnnotation", { + enumerable: true, + get: function () { + return _index.voidTypeAnnotation; + } +}); +Object.defineProperty(exports, "EnumDeclaration", { + enumerable: true, + get: function () { + return _index.enumDeclaration; + } +}); +Object.defineProperty(exports, "EnumBooleanBody", { + enumerable: true, + get: function () { + return _index.enumBooleanBody; + } +}); +Object.defineProperty(exports, "EnumNumberBody", { + enumerable: true, + get: function () { + return _index.enumNumberBody; + } +}); +Object.defineProperty(exports, "EnumStringBody", { + enumerable: true, + get: function () { + return _index.enumStringBody; + } +}); +Object.defineProperty(exports, "EnumSymbolBody", { + enumerable: true, + get: function () { + return _index.enumSymbolBody; + } +}); +Object.defineProperty(exports, "EnumBooleanMember", { + enumerable: true, + get: function () { + return _index.enumBooleanMember; + } +}); +Object.defineProperty(exports, "EnumNumberMember", { + enumerable: true, + get: function () { + return _index.enumNumberMember; + } +}); +Object.defineProperty(exports, "EnumStringMember", { + enumerable: true, + get: function () { + return _index.enumStringMember; + } +}); +Object.defineProperty(exports, "EnumDefaultedMember", { + enumerable: true, + get: function () { + return _index.enumDefaultedMember; + } +}); +Object.defineProperty(exports, "JSXAttribute", { + enumerable: true, + get: function () { + return _index.jsxAttribute; + } +}); +Object.defineProperty(exports, "JSXClosingElement", { + enumerable: true, + get: function () { + return _index.jsxClosingElement; + } +}); +Object.defineProperty(exports, "JSXElement", { + enumerable: true, + get: function () { + return _index.jsxElement; + } +}); +Object.defineProperty(exports, "JSXEmptyExpression", { + enumerable: true, + get: function () { + return _index.jsxEmptyExpression; + } +}); +Object.defineProperty(exports, "JSXExpressionContainer", { + enumerable: true, + get: function () { + return _index.jsxExpressionContainer; + } +}); +Object.defineProperty(exports, "JSXSpreadChild", { + enumerable: true, + get: function () { + return _index.jsxSpreadChild; + } +}); +Object.defineProperty(exports, "JSXIdentifier", { + enumerable: true, + get: function () { + return _index.jsxIdentifier; + } +}); +Object.defineProperty(exports, "JSXMemberExpression", { + enumerable: true, + get: function () { + return _index.jsxMemberExpression; + } +}); +Object.defineProperty(exports, "JSXNamespacedName", { + enumerable: true, + get: function () { + return _index.jsxNamespacedName; + } +}); +Object.defineProperty(exports, "JSXOpeningElement", { + enumerable: true, + get: function () { + return _index.jsxOpeningElement; + } +}); +Object.defineProperty(exports, "JSXSpreadAttribute", { + enumerable: true, + get: function () { + return _index.jsxSpreadAttribute; + } +}); +Object.defineProperty(exports, "JSXText", { + enumerable: true, + get: function () { + return _index.jsxText; + } +}); +Object.defineProperty(exports, "JSXFragment", { + enumerable: true, + get: function () { + return _index.jsxFragment; + } +}); +Object.defineProperty(exports, "JSXOpeningFragment", { + enumerable: true, + get: function () { + return _index.jsxOpeningFragment; + } +}); +Object.defineProperty(exports, "JSXClosingFragment", { + enumerable: true, + get: function () { + return _index.jsxClosingFragment; + } +}); +Object.defineProperty(exports, "Noop", { + enumerable: true, + get: function () { + return _index.noop; + } +}); +Object.defineProperty(exports, "Placeholder", { + enumerable: true, + get: function () { + return _index.placeholder; + } +}); +Object.defineProperty(exports, "V8IntrinsicIdentifier", { + enumerable: true, + get: function () { + return _index.v8IntrinsicIdentifier; + } +}); +Object.defineProperty(exports, "ArgumentPlaceholder", { + enumerable: true, + get: function () { + return _index.argumentPlaceholder; + } +}); +Object.defineProperty(exports, "BindExpression", { + enumerable: true, + get: function () { + return _index.bindExpression; + } +}); +Object.defineProperty(exports, "ClassProperty", { + enumerable: true, + get: function () { + return _index.classProperty; + } +}); +Object.defineProperty(exports, "PipelineTopicExpression", { + enumerable: true, + get: function () { + return _index.pipelineTopicExpression; + } +}); +Object.defineProperty(exports, "PipelineBareFunction", { + enumerable: true, + get: function () { + return _index.pipelineBareFunction; + } +}); +Object.defineProperty(exports, "PipelinePrimaryTopicReference", { + enumerable: true, + get: function () { + return _index.pipelinePrimaryTopicReference; + } +}); +Object.defineProperty(exports, "ClassPrivateProperty", { + enumerable: true, + get: function () { + return _index.classPrivateProperty; + } +}); +Object.defineProperty(exports, "ClassPrivateMethod", { + enumerable: true, + get: function () { + return _index.classPrivateMethod; + } +}); +Object.defineProperty(exports, "ImportAttribute", { + enumerable: true, + get: function () { + return _index.importAttribute; + } +}); +Object.defineProperty(exports, "Decorator", { + enumerable: true, + get: function () { + return _index.decorator; + } +}); +Object.defineProperty(exports, "DoExpression", { + enumerable: true, + get: function () { + return _index.doExpression; + } +}); +Object.defineProperty(exports, "ExportDefaultSpecifier", { + enumerable: true, + get: function () { + return _index.exportDefaultSpecifier; + } +}); +Object.defineProperty(exports, "PrivateName", { + enumerable: true, + get: function () { + return _index.privateName; + } +}); +Object.defineProperty(exports, "RecordExpression", { + enumerable: true, + get: function () { + return _index.recordExpression; + } +}); +Object.defineProperty(exports, "TupleExpression", { + enumerable: true, + get: function () { + return _index.tupleExpression; + } +}); +Object.defineProperty(exports, "DecimalLiteral", { + enumerable: true, + get: function () { + return _index.decimalLiteral; + } +}); +Object.defineProperty(exports, "StaticBlock", { + enumerable: true, + get: function () { + return _index.staticBlock; + } +}); +Object.defineProperty(exports, "TSParameterProperty", { + enumerable: true, + get: function () { + return _index.tsParameterProperty; + } +}); +Object.defineProperty(exports, "TSDeclareFunction", { + enumerable: true, + get: function () { + return _index.tsDeclareFunction; + } +}); +Object.defineProperty(exports, "TSDeclareMethod", { + enumerable: true, + get: function () { + return _index.tsDeclareMethod; + } +}); +Object.defineProperty(exports, "TSQualifiedName", { + enumerable: true, + get: function () { + return _index.tsQualifiedName; + } +}); +Object.defineProperty(exports, "TSCallSignatureDeclaration", { + enumerable: true, + get: function () { + return _index.tsCallSignatureDeclaration; + } +}); +Object.defineProperty(exports, "TSConstructSignatureDeclaration", { + enumerable: true, + get: function () { + return _index.tsConstructSignatureDeclaration; + } +}); +Object.defineProperty(exports, "TSPropertySignature", { + enumerable: true, + get: function () { + return _index.tsPropertySignature; + } +}); +Object.defineProperty(exports, "TSMethodSignature", { + enumerable: true, + get: function () { + return _index.tsMethodSignature; + } +}); +Object.defineProperty(exports, "TSIndexSignature", { + enumerable: true, + get: function () { + return _index.tsIndexSignature; + } +}); +Object.defineProperty(exports, "TSAnyKeyword", { + enumerable: true, + get: function () { + return _index.tsAnyKeyword; + } +}); +Object.defineProperty(exports, "TSBooleanKeyword", { + enumerable: true, + get: function () { + return _index.tsBooleanKeyword; + } +}); +Object.defineProperty(exports, "TSBigIntKeyword", { + enumerable: true, + get: function () { + return _index.tsBigIntKeyword; + } +}); +Object.defineProperty(exports, "TSIntrinsicKeyword", { + enumerable: true, + get: function () { + return _index.tsIntrinsicKeyword; + } +}); +Object.defineProperty(exports, "TSNeverKeyword", { + enumerable: true, + get: function () { + return _index.tsNeverKeyword; + } +}); +Object.defineProperty(exports, "TSNullKeyword", { + enumerable: true, + get: function () { + return _index.tsNullKeyword; + } +}); +Object.defineProperty(exports, "TSNumberKeyword", { + enumerable: true, + get: function () { + return _index.tsNumberKeyword; + } +}); +Object.defineProperty(exports, "TSObjectKeyword", { + enumerable: true, + get: function () { + return _index.tsObjectKeyword; + } +}); +Object.defineProperty(exports, "TSStringKeyword", { + enumerable: true, + get: function () { + return _index.tsStringKeyword; + } +}); +Object.defineProperty(exports, "TSSymbolKeyword", { + enumerable: true, + get: function () { + return _index.tsSymbolKeyword; + } +}); +Object.defineProperty(exports, "TSUndefinedKeyword", { + enumerable: true, + get: function () { + return _index.tsUndefinedKeyword; + } +}); +Object.defineProperty(exports, "TSUnknownKeyword", { + enumerable: true, + get: function () { + return _index.tsUnknownKeyword; + } +}); +Object.defineProperty(exports, "TSVoidKeyword", { + enumerable: true, + get: function () { + return _index.tsVoidKeyword; + } +}); +Object.defineProperty(exports, "TSThisType", { + enumerable: true, + get: function () { + return _index.tsThisType; + } +}); +Object.defineProperty(exports, "TSFunctionType", { + enumerable: true, + get: function () { + return _index.tsFunctionType; + } +}); +Object.defineProperty(exports, "TSConstructorType", { + enumerable: true, + get: function () { + return _index.tsConstructorType; + } +}); +Object.defineProperty(exports, "TSTypeReference", { + enumerable: true, + get: function () { + return _index.tsTypeReference; + } +}); +Object.defineProperty(exports, "TSTypePredicate", { + enumerable: true, + get: function () { + return _index.tsTypePredicate; + } +}); +Object.defineProperty(exports, "TSTypeQuery", { + enumerable: true, + get: function () { + return _index.tsTypeQuery; + } +}); +Object.defineProperty(exports, "TSTypeLiteral", { + enumerable: true, + get: function () { + return _index.tsTypeLiteral; + } +}); +Object.defineProperty(exports, "TSArrayType", { + enumerable: true, + get: function () { + return _index.tsArrayType; + } +}); +Object.defineProperty(exports, "TSTupleType", { + enumerable: true, + get: function () { + return _index.tsTupleType; + } +}); +Object.defineProperty(exports, "TSOptionalType", { + enumerable: true, + get: function () { + return _index.tsOptionalType; + } +}); +Object.defineProperty(exports, "TSRestType", { + enumerable: true, + get: function () { + return _index.tsRestType; + } +}); +Object.defineProperty(exports, "TSNamedTupleMember", { + enumerable: true, + get: function () { + return _index.tsNamedTupleMember; + } +}); +Object.defineProperty(exports, "TSUnionType", { + enumerable: true, + get: function () { + return _index.tsUnionType; + } +}); +Object.defineProperty(exports, "TSIntersectionType", { + enumerable: true, + get: function () { + return _index.tsIntersectionType; + } +}); +Object.defineProperty(exports, "TSConditionalType", { + enumerable: true, + get: function () { + return _index.tsConditionalType; + } +}); +Object.defineProperty(exports, "TSInferType", { + enumerable: true, + get: function () { + return _index.tsInferType; + } +}); +Object.defineProperty(exports, "TSParenthesizedType", { + enumerable: true, + get: function () { + return _index.tsParenthesizedType; + } +}); +Object.defineProperty(exports, "TSTypeOperator", { + enumerable: true, + get: function () { + return _index.tsTypeOperator; + } +}); +Object.defineProperty(exports, "TSIndexedAccessType", { + enumerable: true, + get: function () { + return _index.tsIndexedAccessType; + } +}); +Object.defineProperty(exports, "TSMappedType", { + enumerable: true, + get: function () { + return _index.tsMappedType; + } +}); +Object.defineProperty(exports, "TSLiteralType", { + enumerable: true, + get: function () { + return _index.tsLiteralType; + } +}); +Object.defineProperty(exports, "TSExpressionWithTypeArguments", { + enumerable: true, + get: function () { + return _index.tsExpressionWithTypeArguments; + } +}); +Object.defineProperty(exports, "TSInterfaceDeclaration", { + enumerable: true, + get: function () { + return _index.tsInterfaceDeclaration; + } +}); +Object.defineProperty(exports, "TSInterfaceBody", { + enumerable: true, + get: function () { + return _index.tsInterfaceBody; + } +}); +Object.defineProperty(exports, "TSTypeAliasDeclaration", { + enumerable: true, + get: function () { + return _index.tsTypeAliasDeclaration; + } +}); +Object.defineProperty(exports, "TSAsExpression", { + enumerable: true, + get: function () { + return _index.tsAsExpression; + } +}); +Object.defineProperty(exports, "TSTypeAssertion", { + enumerable: true, + get: function () { + return _index.tsTypeAssertion; + } +}); +Object.defineProperty(exports, "TSEnumDeclaration", { + enumerable: true, + get: function () { + return _index.tsEnumDeclaration; + } +}); +Object.defineProperty(exports, "TSEnumMember", { + enumerable: true, + get: function () { + return _index.tsEnumMember; + } +}); +Object.defineProperty(exports, "TSModuleDeclaration", { + enumerable: true, + get: function () { + return _index.tsModuleDeclaration; + } +}); +Object.defineProperty(exports, "TSModuleBlock", { + enumerable: true, + get: function () { + return _index.tsModuleBlock; + } +}); +Object.defineProperty(exports, "TSImportType", { + enumerable: true, + get: function () { + return _index.tsImportType; + } +}); +Object.defineProperty(exports, "TSImportEqualsDeclaration", { + enumerable: true, + get: function () { + return _index.tsImportEqualsDeclaration; + } +}); +Object.defineProperty(exports, "TSExternalModuleReference", { + enumerable: true, + get: function () { + return _index.tsExternalModuleReference; + } +}); +Object.defineProperty(exports, "TSNonNullExpression", { + enumerable: true, + get: function () { + return _index.tsNonNullExpression; + } +}); +Object.defineProperty(exports, "TSExportAssignment", { + enumerable: true, + get: function () { + return _index.tsExportAssignment; + } +}); +Object.defineProperty(exports, "TSNamespaceExportDeclaration", { + enumerable: true, + get: function () { + return _index.tsNamespaceExportDeclaration; + } +}); +Object.defineProperty(exports, "TSTypeAnnotation", { + enumerable: true, + get: function () { + return _index.tsTypeAnnotation; + } +}); +Object.defineProperty(exports, "TSTypeParameterInstantiation", { + enumerable: true, + get: function () { + return _index.tsTypeParameterInstantiation; + } +}); +Object.defineProperty(exports, "TSTypeParameterDeclaration", { + enumerable: true, + get: function () { + return _index.tsTypeParameterDeclaration; + } +}); +Object.defineProperty(exports, "TSTypeParameter", { + enumerable: true, + get: function () { + return _index.tsTypeParameter; + } +}); +Object.defineProperty(exports, "NumberLiteral", { + enumerable: true, + get: function () { + return _index.numberLiteral; + } +}); +Object.defineProperty(exports, "RegexLiteral", { + enumerable: true, + get: function () { + return _index.regexLiteral; + } +}); +Object.defineProperty(exports, "RestProperty", { + enumerable: true, + get: function () { + return _index.restProperty; + } +}); +Object.defineProperty(exports, "SpreadProperty", { + enumerable: true, + get: function () { + return _index.spreadProperty; + } +}); + +var _index = require("./index"); \ No newline at end of file diff --git a/tools/node_modules/@babel/core/node_modules/@babel/types/lib/builders/typescript/createTSUnionType.js b/tools/node_modules/@babel/core/node_modules/@babel/types/lib/builders/typescript/createTSUnionType.js index 7dbe885f2c42b3..9f1b8c9bff4abd 100644 --- a/tools/node_modules/@babel/core/node_modules/@babel/types/lib/builders/typescript/createTSUnionType.js +++ b/tools/node_modules/@babel/core/node_modules/@babel/types/lib/builders/typescript/createTSUnionType.js @@ -12,7 +12,7 @@ var _removeTypeDuplicates = _interopRequireDefault(require("../../modifications/ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function createTSUnionType(typeAnnotations) { - const types = typeAnnotations.map(type => type.typeAnnotations); + const types = typeAnnotations.map(type => type.typeAnnotation); const flattened = (0, _removeTypeDuplicates.default)(types); if (flattened.length === 1) { diff --git a/tools/node_modules/@babel/core/node_modules/@babel/types/lib/clone/cloneNode.js b/tools/node_modules/@babel/core/node_modules/@babel/types/lib/clone/cloneNode.js index 44032e3f9d896f..01b08e6a5cb079 100644 --- a/tools/node_modules/@babel/core/node_modules/@babel/types/lib/clone/cloneNode.js +++ b/tools/node_modules/@babel/core/node_modules/@babel/types/lib/clone/cloneNode.js @@ -7,6 +7,8 @@ exports.default = cloneNode; var _definitions = require("../definitions"); +var _generated = require("../validators/generated"); + const has = Function.call.bind(Object.prototype.hasOwnProperty); function cloneIfNode(obj, deep, withoutLoc) { @@ -31,10 +33,10 @@ function cloneNode(node, deep = true, withoutLoc = false) { type } = node; const newNode = { - type + type: node.type }; - if (type === "Identifier") { + if ((0, _generated.isIdentifier)(node)) { newNode.name = node.name; if (has(node, "optional") && typeof node.optional === "boolean") { @@ -50,7 +52,7 @@ function cloneNode(node, deep = true, withoutLoc = false) { for (const field of Object.keys(_definitions.NODE_FIELDS[type])) { if (has(node, field)) { if (deep) { - newNode[field] = type === "File" && field === "comments" ? maybeCloneComments(node.comments, deep, withoutLoc) : cloneIfNodeOrArray(node[field], true, withoutLoc); + newNode[field] = (0, _generated.isFile)(node) && field === "comments" ? maybeCloneComments(node.comments, deep, withoutLoc) : cloneIfNodeOrArray(node[field], true, withoutLoc); } else { newNode[field] = node[field]; } diff --git a/tools/node_modules/@babel/core/node_modules/@babel/types/lib/converters/Scope.js b/tools/node_modules/@babel/core/node_modules/@babel/types/lib/converters/Scope.js new file mode 100644 index 00000000000000..e69de29bb2d1d6 diff --git a/tools/node_modules/@babel/core/node_modules/@babel/types/lib/converters/toExpression.js b/tools/node_modules/@babel/core/node_modules/@babel/types/lib/converters/toExpression.js index 6e58b0de4d6e60..2d944f0e98d825 100644 --- a/tools/node_modules/@babel/core/node_modules/@babel/types/lib/converters/toExpression.js +++ b/tools/node_modules/@babel/core/node_modules/@babel/types/lib/converters/toExpression.js @@ -3,10 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true }); -exports.default = toExpression; +exports.default = void 0; var _generated = require("../validators/generated"); +var _default = toExpression; +exports.default = _default; + function toExpression(node) { if ((0, _generated.isExpressionStatement)(node)) { node = node.expression; diff --git a/tools/node_modules/@babel/core/node_modules/@babel/types/lib/converters/toStatement.js b/tools/node_modules/@babel/core/node_modules/@babel/types/lib/converters/toStatement.js index 69b22ae09cc6ce..da020a61a017c8 100644 --- a/tools/node_modules/@babel/core/node_modules/@babel/types/lib/converters/toStatement.js +++ b/tools/node_modules/@babel/core/node_modules/@babel/types/lib/converters/toStatement.js @@ -3,12 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true }); -exports.default = toStatement; +exports.default = void 0; var _generated = require("../validators/generated"); var _generated2 = require("../builders/generated"); +var _default = toStatement; +exports.default = _default; + function toStatement(node, ignore) { if ((0, _generated.isStatement)(node)) { return node; diff --git a/tools/node_modules/@babel/core/node_modules/@babel/types/lib/converters/valueToNode.js b/tools/node_modules/@babel/core/node_modules/@babel/types/lib/converters/valueToNode.js index d1118e164b0aa4..95c3061ba5c3fd 100644 --- a/tools/node_modules/@babel/core/node_modules/@babel/types/lib/converters/valueToNode.js +++ b/tools/node_modules/@babel/core/node_modules/@babel/types/lib/converters/valueToNode.js @@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); -exports.default = valueToNode; +exports.default = void 0; var _isPlainObject = _interopRequireDefault(require("lodash/isPlainObject")); @@ -15,6 +15,9 @@ var _generated = require("../builders/generated"); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +var _default = valueToNode; +exports.default = _default; + function valueToNode(value) { if (value === undefined) { return (0, _generated.identifier)("undefined"); diff --git a/tools/node_modules/@babel/core/node_modules/@babel/types/lib/definitions/core.js b/tools/node_modules/@babel/core/node_modules/@babel/types/lib/definitions/core.js index d6cb97eac285fb..daa22190b34461 100644 --- a/tools/node_modules/@babel/core/node_modules/@babel/types/lib/definitions/core.js +++ b/tools/node_modules/@babel/core/node_modules/@babel/types/lib/definitions/core.js @@ -409,7 +409,7 @@ exports.patternLikeCommon = patternLikeCommon; })) return; } - if (((0, _helperValidatorIdentifier.isKeyword)(node.name) || (0, _helperValidatorIdentifier.isReservedWord)(node.name)) && node.name !== "this") { + if (((0, _helperValidatorIdentifier.isKeyword)(node.name) || (0, _helperValidatorIdentifier.isReservedWord)(node.name, false)) && node.name !== "this") { throw new TypeError(`"${node.name}" is not a valid identifier`); } } @@ -1052,6 +1052,7 @@ exports.patternLikeCommon = patternLikeCommon; source: { validate: (0, _utils.assertNodeType)("StringLiteral") }, + exportKind: (0, _utils.validateOptional)((0, _utils.assertOneOf)("type", "value")), assertions: { optional: true, validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertNodeType)("ImportAttribute")) @@ -1471,7 +1472,7 @@ exports.classMethodOrDeclareMethodCommon = classMethodOrDeclareMethodCommon; validate: (0, _utils.assertNodeType)("Expression") }, arguments: { - validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Expression", "SpreadElement", "JSXNamespacedName"))) + validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Expression", "SpreadElement", "JSXNamespacedName", "ArgumentPlaceholder"))) }, optional: { validate: !process.env.BABEL_TYPES_8_BREAKING ? (0, _utils.assertValueType)("boolean") : (0, _utils.chain)((0, _utils.assertValueType)("boolean"), (0, _utils.assertOptionalChainStart)()) diff --git a/tools/node_modules/@babel/core/node_modules/@babel/types/lib/definitions/experimental.js b/tools/node_modules/@babel/core/node_modules/@babel/types/lib/definitions/experimental.js index 1a67e2446ef4e3..5ed7ba92c9364b 100644 --- a/tools/node_modules/@babel/core/node_modules/@babel/types/lib/definitions/experimental.js +++ b/tools/node_modules/@babel/core/node_modules/@babel/types/lib/definitions/experimental.js @@ -96,6 +96,10 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; validate: (0, _utils.assertNodeType)("Expression"), optional: true }, + typeAnnotation: { + validate: (0, _utils.assertNodeType)("TypeAnnotation", "TSTypeAnnotation", "Noop"), + optional: true + }, decorators: { validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Decorator"))), optional: true diff --git a/tools/node_modules/@babel/core/node_modules/@babel/types/lib/definitions/flow.js b/tools/node_modules/@babel/core/node_modules/@babel/types/lib/definitions/flow.js index a6d74d7aa4c9a9..15341a7b01228a 100644 --- a/tools/node_modules/@babel/core/node_modules/@babel/types/lib/definitions/flow.js +++ b/tools/node_modules/@babel/core/node_modules/@babel/types/lib/definitions/flow.js @@ -266,7 +266,8 @@ defineInterfaceishType("InterfaceDeclaration"); static: (0, _utils.validate)((0, _utils.assertValueType)("boolean")), proto: (0, _utils.validate)((0, _utils.assertValueType)("boolean")), optional: (0, _utils.validate)((0, _utils.assertValueType)("boolean")), - variance: (0, _utils.validateOptionalType)("Variance") + variance: (0, _utils.validateOptionalType)("Variance"), + method: (0, _utils.validate)((0, _utils.assertValueType)("boolean")) } }); (0, _utils.default)("ObjectTypeSpreadProperty", { @@ -401,7 +402,7 @@ defineInterfaceishType("InterfaceDeclaration"); aliases: ["EnumBody"], visitor: ["members"], fields: { - explicit: (0, _utils.validate)((0, _utils.assertValueType)("boolean")), + explicitType: (0, _utils.validate)((0, _utils.assertValueType)("boolean")), members: (0, _utils.validateArrayOfType)("EnumBooleanMember") } }); @@ -409,7 +410,7 @@ defineInterfaceishType("InterfaceDeclaration"); aliases: ["EnumBody"], visitor: ["members"], fields: { - explicit: (0, _utils.validate)((0, _utils.assertValueType)("boolean")), + explicitType: (0, _utils.validate)((0, _utils.assertValueType)("boolean")), members: (0, _utils.validateArrayOfType)("EnumNumberMember") } }); @@ -417,7 +418,7 @@ defineInterfaceishType("InterfaceDeclaration"); aliases: ["EnumBody"], visitor: ["members"], fields: { - explicit: (0, _utils.validate)((0, _utils.assertValueType)("boolean")), + explicitType: (0, _utils.validate)((0, _utils.assertValueType)("boolean")), members: (0, _utils.validateArrayOfType)(["EnumStringMember", "EnumDefaultedMember"]) } }); diff --git a/tools/node_modules/@babel/core/node_modules/@babel/types/lib/definitions/utils.js b/tools/node_modules/@babel/core/node_modules/@babel/types/lib/definitions/utils.js index 447142642b7d5b..9059ca7f0611b9 100644 --- a/tools/node_modules/@babel/core/node_modules/@babel/types/lib/definitions/utils.js +++ b/tools/node_modules/@babel/core/node_modules/@babel/types/lib/definitions/utils.js @@ -224,11 +224,11 @@ function assertOptionalChainStart() { } function chain(...fns) { - function validate(...args) { + const validate = function (...args) { for (const fn of fns) { fn(...args); } - } + }; validate.chainOf = fns; return validate; diff --git a/tools/node_modules/@babel/core/node_modules/@babel/types/lib/index.js b/tools/node_modules/@babel/core/node_modules/@babel/types/lib/index.js index 2801bc6882885a..5650d39806a3fa 100644 --- a/tools/node_modules/@babel/core/node_modules/@babel/types/lib/index.js +++ b/tools/node_modules/@babel/core/node_modules/@babel/types/lib/index.js @@ -442,6 +442,20 @@ Object.keys(_generated2).forEach(function (key) { }); }); +var _uppercase = require("./builders/generated/uppercase"); + +Object.keys(_uppercase).forEach(function (key) { + if (key === "default" || key === "__esModule") return; + if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; + if (key in exports && exports[key] === _uppercase[key]) return; + Object.defineProperty(exports, key, { + enumerable: true, + get: function () { + return _uppercase[key]; + } + }); +}); + var _cloneNode = _interopRequireDefault(require("./clone/cloneNode")); var _clone = _interopRequireDefault(require("./clone/clone")); @@ -544,7 +558,19 @@ var _getBindingIdentifiers = _interopRequireDefault(require("./retrievers/getBin var _getOuterBindingIdentifiers = _interopRequireDefault(require("./retrievers/getOuterBindingIdentifiers")); -var _traverse = _interopRequireDefault(require("./traverse/traverse")); +var _traverse = _interopRequireWildcard(require("./traverse/traverse")); + +Object.keys(_traverse).forEach(function (key) { + if (key === "default" || key === "__esModule") return; + if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; + if (key in exports && exports[key] === _traverse[key]) return; + Object.defineProperty(exports, key, { + enumerable: true, + get: function () { + return _traverse[key]; + } + }); +}); var _traverseFast = _interopRequireDefault(require("./traverse/traverseFast")); @@ -600,6 +626,24 @@ Object.keys(_generated4).forEach(function (key) { }); }); +var _generated5 = require("./ast-types/generated"); + +Object.keys(_generated5).forEach(function (key) { + if (key === "default" || key === "__esModule") return; + if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; + if (key in exports && exports[key] === _generated5[key]) return; + Object.defineProperty(exports, key, { + enumerable: true, + get: function () { + return _generated5[key]; + } + }); +}); + +function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = 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 _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } const react = { diff --git a/tools/node_modules/@babel/core/node_modules/@babel/types/lib/index.js.flow b/tools/node_modules/@babel/core/node_modules/@babel/types/lib/index.js.flow index aaebaa6ef52efb..7377915351301e 100644 --- a/tools/node_modules/@babel/core/node_modules/@babel/types/lib/index.js.flow +++ b/tools/node_modules/@babel/core/node_modules/@babel/types/lib/index.js.flow @@ -430,6 +430,7 @@ declare class BabelNodeExportAllDeclaration extends BabelNode { type: "ExportAllDeclaration"; source: BabelNodeStringLiteral; assertions?: BabelNodeImportAttribute; + exportKind?: "type" | "value"; } declare class BabelNodeExportDefaultDeclaration extends BabelNode { @@ -579,7 +580,7 @@ declare class BabelNodeOptionalMemberExpression extends BabelNode { declare class BabelNodeOptionalCallExpression extends BabelNode { type: "OptionalCallExpression"; callee: BabelNodeExpression; - arguments: Array<BabelNodeExpression | BabelNodeSpreadElement | BabelNodeJSXNamespacedName>; + arguments: Array<BabelNodeExpression | BabelNodeSpreadElement | BabelNodeJSXNamespacedName | BabelNodeArgumentPlaceholder>; optional: boolean; typeArguments?: BabelNodeTypeParameterInstantiation; typeParameters?: BabelNodeTSTypeParameterInstantiation; @@ -796,6 +797,7 @@ declare class BabelNodeObjectTypeProperty extends BabelNode { value: BabelNodeFlowType; variance?: BabelNodeVariance; kind: "init" | "get" | "set"; + method: boolean; optional: boolean; proto: boolean; } @@ -904,19 +906,19 @@ declare class BabelNodeEnumDeclaration extends BabelNode { declare class BabelNodeEnumBooleanBody extends BabelNode { type: "EnumBooleanBody"; members: Array<BabelNodeEnumBooleanMember>; - explicit: boolean; + explicitType: boolean; } declare class BabelNodeEnumNumberBody extends BabelNode { type: "EnumNumberBody"; members: Array<BabelNodeEnumNumberMember>; - explicit: boolean; + explicitType: boolean; } declare class BabelNodeEnumStringBody extends BabelNode { type: "EnumStringBody"; members: Array<BabelNodeEnumStringMember | BabelNodeEnumDefaultedMember>; - explicit: boolean; + explicitType: boolean; } declare class BabelNodeEnumSymbolBody extends BabelNode { @@ -1089,6 +1091,7 @@ declare class BabelNodeClassPrivateProperty extends BabelNode { key: BabelNodePrivateName; value?: BabelNodeExpression; decorators?: Array<BabelNodeDecorator>; + typeAnnotation?: BabelNodeTypeAnnotation | BabelNodeTSTypeAnnotation | BabelNodeNoop; } declare class BabelNodeClassPrivateMethod extends BabelNode { @@ -1579,867 +1582,871 @@ type BabelNodeTSType = BabelNodeTSAnyKeyword | BabelNodeTSBooleanKeyword | Babel type BabelNodeTSBaseType = BabelNodeTSAnyKeyword | BabelNodeTSBooleanKeyword | BabelNodeTSBigIntKeyword | BabelNodeTSIntrinsicKeyword | BabelNodeTSNeverKeyword | BabelNodeTSNullKeyword | BabelNodeTSNumberKeyword | BabelNodeTSObjectKeyword | BabelNodeTSStringKeyword | BabelNodeTSSymbolKeyword | BabelNodeTSUndefinedKeyword | BabelNodeTSUnknownKeyword | BabelNodeTSVoidKeyword | BabelNodeTSThisType | BabelNodeTSLiteralType; declare module "@babel/types" { - declare function arrayExpression(elements?: Array<null | BabelNodeExpression | BabelNodeSpreadElement>): BabelNodeArrayExpression; - declare function assignmentExpression(operator: string, left: BabelNodeLVal, right: BabelNodeExpression): BabelNodeAssignmentExpression; - declare function binaryExpression(operator: "+" | "-" | "/" | "%" | "*" | "**" | "&" | "|" | ">>" | ">>>" | "<<" | "^" | "==" | "===" | "!=" | "!==" | "in" | "instanceof" | ">" | "<" | ">=" | "<=", left: BabelNodeExpression | BabelNodePrivateName, right: BabelNodeExpression): BabelNodeBinaryExpression; - declare function interpreterDirective(value: string): BabelNodeInterpreterDirective; - declare function directive(value: BabelNodeDirectiveLiteral): BabelNodeDirective; - declare function directiveLiteral(value: string): BabelNodeDirectiveLiteral; - declare function blockStatement(body: Array<BabelNodeStatement>, directives?: Array<BabelNodeDirective>): BabelNodeBlockStatement; - declare function breakStatement(label?: BabelNodeIdentifier): BabelNodeBreakStatement; - declare function callExpression(callee: BabelNodeExpression | BabelNodeV8IntrinsicIdentifier, _arguments: Array<BabelNodeExpression | BabelNodeSpreadElement | BabelNodeJSXNamespacedName | BabelNodeArgumentPlaceholder>): BabelNodeCallExpression; - declare function catchClause(param?: BabelNodeIdentifier | BabelNodeArrayPattern | BabelNodeObjectPattern, body: BabelNodeBlockStatement): BabelNodeCatchClause; - declare function conditionalExpression(test: BabelNodeExpression, consequent: BabelNodeExpression, alternate: BabelNodeExpression): BabelNodeConditionalExpression; - declare function continueStatement(label?: BabelNodeIdentifier): BabelNodeContinueStatement; - declare function debuggerStatement(): BabelNodeDebuggerStatement; - declare function doWhileStatement(test: BabelNodeExpression, body: BabelNodeStatement): BabelNodeDoWhileStatement; - declare function emptyStatement(): BabelNodeEmptyStatement; - declare function expressionStatement(expression: BabelNodeExpression): BabelNodeExpressionStatement; - declare function file(program: BabelNodeProgram, comments?: Array<BabelNodeCommentBlock | BabelNodeCommentLine>, tokens?: Array<any>): BabelNodeFile; - declare function forInStatement(left: BabelNodeVariableDeclaration | BabelNodeLVal, right: BabelNodeExpression, body: BabelNodeStatement): BabelNodeForInStatement; - declare function forStatement(init?: BabelNodeVariableDeclaration | BabelNodeExpression, test?: BabelNodeExpression, update?: BabelNodeExpression, body: BabelNodeStatement): BabelNodeForStatement; - declare function functionDeclaration(id?: BabelNodeIdentifier, params: Array<BabelNodeIdentifier | BabelNodePattern | BabelNodeRestElement | BabelNodeTSParameterProperty>, body: BabelNodeBlockStatement, generator?: boolean, async?: boolean): BabelNodeFunctionDeclaration; - declare function functionExpression(id?: BabelNodeIdentifier, params: Array<BabelNodeIdentifier | BabelNodePattern | BabelNodeRestElement | BabelNodeTSParameterProperty>, body: BabelNodeBlockStatement, generator?: boolean, async?: boolean): BabelNodeFunctionExpression; - declare function identifier(name: string): BabelNodeIdentifier; - declare function ifStatement(test: BabelNodeExpression, consequent: BabelNodeStatement, alternate?: BabelNodeStatement): BabelNodeIfStatement; - declare function labeledStatement(label: BabelNodeIdentifier, body: BabelNodeStatement): BabelNodeLabeledStatement; - declare function stringLiteral(value: string): BabelNodeStringLiteral; - declare function numericLiteral(value: number): BabelNodeNumericLiteral; - declare function nullLiteral(): BabelNodeNullLiteral; - declare function booleanLiteral(value: boolean): BabelNodeBooleanLiteral; - declare function regExpLiteral(pattern: string, flags?: string): BabelNodeRegExpLiteral; - declare function logicalExpression(operator: "||" | "&&" | "??", left: BabelNodeExpression, right: BabelNodeExpression): BabelNodeLogicalExpression; - declare function memberExpression(object: BabelNodeExpression, property: BabelNodeExpression | BabelNodeIdentifier | BabelNodePrivateName, computed?: boolean, optional?: true | false): BabelNodeMemberExpression; - declare function newExpression(callee: BabelNodeExpression | BabelNodeV8IntrinsicIdentifier, _arguments: Array<BabelNodeExpression | BabelNodeSpreadElement | BabelNodeJSXNamespacedName | BabelNodeArgumentPlaceholder>): BabelNodeNewExpression; - declare function program(body: Array<BabelNodeStatement>, directives?: Array<BabelNodeDirective>, sourceType?: "script" | "module", interpreter?: BabelNodeInterpreterDirective): BabelNodeProgram; - declare function objectExpression(properties: Array<BabelNodeObjectMethod | BabelNodeObjectProperty | BabelNodeSpreadElement>): BabelNodeObjectExpression; - declare function objectMethod(kind?: "method" | "get" | "set", key: BabelNodeExpression | BabelNodeIdentifier | BabelNodeStringLiteral | BabelNodeNumericLiteral, params: Array<BabelNodeIdentifier | BabelNodePattern | BabelNodeRestElement | BabelNodeTSParameterProperty>, body: BabelNodeBlockStatement, computed?: boolean, generator?: boolean, async?: boolean): BabelNodeObjectMethod; - declare function objectProperty(key: BabelNodeExpression | BabelNodeIdentifier | BabelNodeStringLiteral | BabelNodeNumericLiteral, value: BabelNodeExpression | BabelNodePatternLike, computed?: boolean, shorthand?: boolean, decorators?: Array<BabelNodeDecorator>): BabelNodeObjectProperty; - declare function restElement(argument: BabelNodeLVal): BabelNodeRestElement; - declare function returnStatement(argument?: BabelNodeExpression): BabelNodeReturnStatement; - declare function sequenceExpression(expressions: Array<BabelNodeExpression>): BabelNodeSequenceExpression; - declare function parenthesizedExpression(expression: BabelNodeExpression): BabelNodeParenthesizedExpression; - declare function switchCase(test?: BabelNodeExpression, consequent: Array<BabelNodeStatement>): BabelNodeSwitchCase; - declare function switchStatement(discriminant: BabelNodeExpression, cases: Array<BabelNodeSwitchCase>): BabelNodeSwitchStatement; - declare function thisExpression(): BabelNodeThisExpression; - declare function throwStatement(argument: BabelNodeExpression): BabelNodeThrowStatement; - declare function tryStatement(block: BabelNodeBlockStatement, handler?: BabelNodeCatchClause, finalizer?: BabelNodeBlockStatement): BabelNodeTryStatement; - declare function unaryExpression(operator: "void" | "throw" | "delete" | "!" | "+" | "-" | "~" | "typeof", argument: BabelNodeExpression, prefix?: boolean): BabelNodeUnaryExpression; - declare function updateExpression(operator: "++" | "--", argument: BabelNodeExpression, prefix?: boolean): BabelNodeUpdateExpression; - declare function variableDeclaration(kind: "var" | "let" | "const", declarations: Array<BabelNodeVariableDeclarator>): BabelNodeVariableDeclaration; - declare function variableDeclarator(id: BabelNodeLVal, init?: BabelNodeExpression): BabelNodeVariableDeclarator; - declare function whileStatement(test: BabelNodeExpression, body: BabelNodeStatement): BabelNodeWhileStatement; - declare function withStatement(object: BabelNodeExpression, body: BabelNodeStatement): BabelNodeWithStatement; - declare function assignmentPattern(left: BabelNodeIdentifier | BabelNodeObjectPattern | BabelNodeArrayPattern | BabelNodeMemberExpression, right: BabelNodeExpression): BabelNodeAssignmentPattern; - declare function arrayPattern(elements: Array<null | BabelNodePatternLike>): BabelNodeArrayPattern; - declare function arrowFunctionExpression(params: Array<BabelNodeIdentifier | BabelNodePattern | BabelNodeRestElement | BabelNodeTSParameterProperty>, body: BabelNodeBlockStatement | BabelNodeExpression, async?: boolean): BabelNodeArrowFunctionExpression; - declare function classBody(body: Array<BabelNodeClassMethod | BabelNodeClassPrivateMethod | BabelNodeClassProperty | BabelNodeClassPrivateProperty | BabelNodeTSDeclareMethod | BabelNodeTSIndexSignature>): BabelNodeClassBody; - declare function classExpression(id?: BabelNodeIdentifier, superClass?: BabelNodeExpression, body: BabelNodeClassBody, decorators?: Array<BabelNodeDecorator>): BabelNodeClassExpression; - declare function classDeclaration(id: BabelNodeIdentifier, superClass?: BabelNodeExpression, body: BabelNodeClassBody, decorators?: Array<BabelNodeDecorator>): BabelNodeClassDeclaration; - declare function exportAllDeclaration(source: BabelNodeStringLiteral): BabelNodeExportAllDeclaration; - declare function exportDefaultDeclaration(declaration: BabelNodeFunctionDeclaration | BabelNodeTSDeclareFunction | BabelNodeClassDeclaration | BabelNodeExpression): BabelNodeExportDefaultDeclaration; - declare function exportNamedDeclaration(declaration?: BabelNodeDeclaration, specifiers?: Array<BabelNodeExportSpecifier | BabelNodeExportDefaultSpecifier | BabelNodeExportNamespaceSpecifier>, source?: BabelNodeStringLiteral): BabelNodeExportNamedDeclaration; - declare function exportSpecifier(local: BabelNodeIdentifier, exported: BabelNodeIdentifier | BabelNodeStringLiteral): BabelNodeExportSpecifier; - declare function forOfStatement(left: BabelNodeVariableDeclaration | BabelNodeLVal, right: BabelNodeExpression, body: BabelNodeStatement, _await?: boolean): BabelNodeForOfStatement; - declare function importDeclaration(specifiers: Array<BabelNodeImportSpecifier | BabelNodeImportDefaultSpecifier | BabelNodeImportNamespaceSpecifier>, source: BabelNodeStringLiteral): BabelNodeImportDeclaration; - declare function importDefaultSpecifier(local: BabelNodeIdentifier): BabelNodeImportDefaultSpecifier; - declare function importNamespaceSpecifier(local: BabelNodeIdentifier): BabelNodeImportNamespaceSpecifier; - declare function importSpecifier(local: BabelNodeIdentifier, imported: BabelNodeIdentifier | BabelNodeStringLiteral): BabelNodeImportSpecifier; - declare function metaProperty(meta: BabelNodeIdentifier, property: BabelNodeIdentifier): BabelNodeMetaProperty; - declare function classMethod(kind?: "get" | "set" | "method" | "constructor", key: BabelNodeIdentifier | BabelNodeStringLiteral | BabelNodeNumericLiteral | BabelNodeExpression, params: Array<BabelNodeIdentifier | BabelNodePattern | BabelNodeRestElement | BabelNodeTSParameterProperty>, body: BabelNodeBlockStatement, computed?: boolean, _static?: boolean, generator?: boolean, async?: boolean): BabelNodeClassMethod; - declare function objectPattern(properties: Array<BabelNodeRestElement | BabelNodeObjectProperty>): BabelNodeObjectPattern; - declare function spreadElement(argument: BabelNodeExpression): BabelNodeSpreadElement; + declare export function arrayExpression(elements?: Array<null | BabelNodeExpression | BabelNodeSpreadElement>): BabelNodeArrayExpression; + declare export function assignmentExpression(operator: string, left: BabelNodeLVal, right: BabelNodeExpression): BabelNodeAssignmentExpression; + declare export function binaryExpression(operator: "+" | "-" | "/" | "%" | "*" | "**" | "&" | "|" | ">>" | ">>>" | "<<" | "^" | "==" | "===" | "!=" | "!==" | "in" | "instanceof" | ">" | "<" | ">=" | "<=", left: BabelNodeExpression | BabelNodePrivateName, right: BabelNodeExpression): BabelNodeBinaryExpression; + declare export function interpreterDirective(value: string): BabelNodeInterpreterDirective; + declare export function directive(value: BabelNodeDirectiveLiteral): BabelNodeDirective; + declare export function directiveLiteral(value: string): BabelNodeDirectiveLiteral; + declare export function blockStatement(body: Array<BabelNodeStatement>, directives?: Array<BabelNodeDirective>): BabelNodeBlockStatement; + declare export function breakStatement(label?: BabelNodeIdentifier): BabelNodeBreakStatement; + declare export function callExpression(callee: BabelNodeExpression | BabelNodeV8IntrinsicIdentifier, _arguments: Array<BabelNodeExpression | BabelNodeSpreadElement | BabelNodeJSXNamespacedName | BabelNodeArgumentPlaceholder>): BabelNodeCallExpression; + declare export function catchClause(param?: BabelNodeIdentifier | BabelNodeArrayPattern | BabelNodeObjectPattern, body: BabelNodeBlockStatement): BabelNodeCatchClause; + declare export function conditionalExpression(test: BabelNodeExpression, consequent: BabelNodeExpression, alternate: BabelNodeExpression): BabelNodeConditionalExpression; + declare export function continueStatement(label?: BabelNodeIdentifier): BabelNodeContinueStatement; + declare export function debuggerStatement(): BabelNodeDebuggerStatement; + declare export function doWhileStatement(test: BabelNodeExpression, body: BabelNodeStatement): BabelNodeDoWhileStatement; + declare export function emptyStatement(): BabelNodeEmptyStatement; + declare export function expressionStatement(expression: BabelNodeExpression): BabelNodeExpressionStatement; + declare export function file(program: BabelNodeProgram, comments?: Array<BabelNodeCommentBlock | BabelNodeCommentLine>, tokens?: Array<any>): BabelNodeFile; + declare export function forInStatement(left: BabelNodeVariableDeclaration | BabelNodeLVal, right: BabelNodeExpression, body: BabelNodeStatement): BabelNodeForInStatement; + declare export function forStatement(init?: BabelNodeVariableDeclaration | BabelNodeExpression, test?: BabelNodeExpression, update?: BabelNodeExpression, body: BabelNodeStatement): BabelNodeForStatement; + declare export function functionDeclaration(id?: BabelNodeIdentifier, params: Array<BabelNodeIdentifier | BabelNodePattern | BabelNodeRestElement | BabelNodeTSParameterProperty>, body: BabelNodeBlockStatement, generator?: boolean, async?: boolean): BabelNodeFunctionDeclaration; + declare export function functionExpression(id?: BabelNodeIdentifier, params: Array<BabelNodeIdentifier | BabelNodePattern | BabelNodeRestElement | BabelNodeTSParameterProperty>, body: BabelNodeBlockStatement, generator?: boolean, async?: boolean): BabelNodeFunctionExpression; + declare export function identifier(name: string): BabelNodeIdentifier; + declare export function ifStatement(test: BabelNodeExpression, consequent: BabelNodeStatement, alternate?: BabelNodeStatement): BabelNodeIfStatement; + declare export function labeledStatement(label: BabelNodeIdentifier, body: BabelNodeStatement): BabelNodeLabeledStatement; + declare export function stringLiteral(value: string): BabelNodeStringLiteral; + declare export function numericLiteral(value: number): BabelNodeNumericLiteral; + declare export function nullLiteral(): BabelNodeNullLiteral; + declare export function booleanLiteral(value: boolean): BabelNodeBooleanLiteral; + declare export function regExpLiteral(pattern: string, flags?: string): BabelNodeRegExpLiteral; + declare export function logicalExpression(operator: "||" | "&&" | "??", left: BabelNodeExpression, right: BabelNodeExpression): BabelNodeLogicalExpression; + declare export function memberExpression(object: BabelNodeExpression, property: BabelNodeExpression | BabelNodeIdentifier | BabelNodePrivateName, computed?: boolean, optional?: true | false): BabelNodeMemberExpression; + declare export function newExpression(callee: BabelNodeExpression | BabelNodeV8IntrinsicIdentifier, _arguments: Array<BabelNodeExpression | BabelNodeSpreadElement | BabelNodeJSXNamespacedName | BabelNodeArgumentPlaceholder>): BabelNodeNewExpression; + declare export function program(body: Array<BabelNodeStatement>, directives?: Array<BabelNodeDirective>, sourceType?: "script" | "module", interpreter?: BabelNodeInterpreterDirective): BabelNodeProgram; + declare export function objectExpression(properties: Array<BabelNodeObjectMethod | BabelNodeObjectProperty | BabelNodeSpreadElement>): BabelNodeObjectExpression; + declare export function objectMethod(kind?: "method" | "get" | "set", key: BabelNodeExpression | BabelNodeIdentifier | BabelNodeStringLiteral | BabelNodeNumericLiteral, params: Array<BabelNodeIdentifier | BabelNodePattern | BabelNodeRestElement | BabelNodeTSParameterProperty>, body: BabelNodeBlockStatement, computed?: boolean, generator?: boolean, async?: boolean): BabelNodeObjectMethod; + declare export function objectProperty(key: BabelNodeExpression | BabelNodeIdentifier | BabelNodeStringLiteral | BabelNodeNumericLiteral, value: BabelNodeExpression | BabelNodePatternLike, computed?: boolean, shorthand?: boolean, decorators?: Array<BabelNodeDecorator>): BabelNodeObjectProperty; + declare export function restElement(argument: BabelNodeLVal): BabelNodeRestElement; + declare export function returnStatement(argument?: BabelNodeExpression): BabelNodeReturnStatement; + declare export function sequenceExpression(expressions: Array<BabelNodeExpression>): BabelNodeSequenceExpression; + declare export function parenthesizedExpression(expression: BabelNodeExpression): BabelNodeParenthesizedExpression; + declare export function switchCase(test?: BabelNodeExpression, consequent: Array<BabelNodeStatement>): BabelNodeSwitchCase; + declare export function switchStatement(discriminant: BabelNodeExpression, cases: Array<BabelNodeSwitchCase>): BabelNodeSwitchStatement; + declare export function thisExpression(): BabelNodeThisExpression; + declare export function throwStatement(argument: BabelNodeExpression): BabelNodeThrowStatement; + declare export function tryStatement(block: BabelNodeBlockStatement, handler?: BabelNodeCatchClause, finalizer?: BabelNodeBlockStatement): BabelNodeTryStatement; + declare export function unaryExpression(operator: "void" | "throw" | "delete" | "!" | "+" | "-" | "~" | "typeof", argument: BabelNodeExpression, prefix?: boolean): BabelNodeUnaryExpression; + declare export function updateExpression(operator: "++" | "--", argument: BabelNodeExpression, prefix?: boolean): BabelNodeUpdateExpression; + declare export function variableDeclaration(kind: "var" | "let" | "const", declarations: Array<BabelNodeVariableDeclarator>): BabelNodeVariableDeclaration; + declare export function variableDeclarator(id: BabelNodeLVal, init?: BabelNodeExpression): BabelNodeVariableDeclarator; + declare export function whileStatement(test: BabelNodeExpression, body: BabelNodeStatement): BabelNodeWhileStatement; + declare export function withStatement(object: BabelNodeExpression, body: BabelNodeStatement): BabelNodeWithStatement; + declare export function assignmentPattern(left: BabelNodeIdentifier | BabelNodeObjectPattern | BabelNodeArrayPattern | BabelNodeMemberExpression, right: BabelNodeExpression): BabelNodeAssignmentPattern; + declare export function arrayPattern(elements: Array<null | BabelNodePatternLike>): BabelNodeArrayPattern; + declare export function arrowFunctionExpression(params: Array<BabelNodeIdentifier | BabelNodePattern | BabelNodeRestElement | BabelNodeTSParameterProperty>, body: BabelNodeBlockStatement | BabelNodeExpression, async?: boolean): BabelNodeArrowFunctionExpression; + declare export function classBody(body: Array<BabelNodeClassMethod | BabelNodeClassPrivateMethod | BabelNodeClassProperty | BabelNodeClassPrivateProperty | BabelNodeTSDeclareMethod | BabelNodeTSIndexSignature>): BabelNodeClassBody; + declare export function classExpression(id?: BabelNodeIdentifier, superClass?: BabelNodeExpression, body: BabelNodeClassBody, decorators?: Array<BabelNodeDecorator>): BabelNodeClassExpression; + declare export function classDeclaration(id: BabelNodeIdentifier, superClass?: BabelNodeExpression, body: BabelNodeClassBody, decorators?: Array<BabelNodeDecorator>): BabelNodeClassDeclaration; + declare export function exportAllDeclaration(source: BabelNodeStringLiteral): BabelNodeExportAllDeclaration; + declare export function exportDefaultDeclaration(declaration: BabelNodeFunctionDeclaration | BabelNodeTSDeclareFunction | BabelNodeClassDeclaration | BabelNodeExpression): BabelNodeExportDefaultDeclaration; + declare export function exportNamedDeclaration(declaration?: BabelNodeDeclaration, specifiers?: Array<BabelNodeExportSpecifier | BabelNodeExportDefaultSpecifier | BabelNodeExportNamespaceSpecifier>, source?: BabelNodeStringLiteral): BabelNodeExportNamedDeclaration; + declare export function exportSpecifier(local: BabelNodeIdentifier, exported: BabelNodeIdentifier | BabelNodeStringLiteral): BabelNodeExportSpecifier; + declare export function forOfStatement(left: BabelNodeVariableDeclaration | BabelNodeLVal, right: BabelNodeExpression, body: BabelNodeStatement, _await?: boolean): BabelNodeForOfStatement; + declare export function importDeclaration(specifiers: Array<BabelNodeImportSpecifier | BabelNodeImportDefaultSpecifier | BabelNodeImportNamespaceSpecifier>, source: BabelNodeStringLiteral): BabelNodeImportDeclaration; + declare export function importDefaultSpecifier(local: BabelNodeIdentifier): BabelNodeImportDefaultSpecifier; + declare export function importNamespaceSpecifier(local: BabelNodeIdentifier): BabelNodeImportNamespaceSpecifier; + declare export function importSpecifier(local: BabelNodeIdentifier, imported: BabelNodeIdentifier | BabelNodeStringLiteral): BabelNodeImportSpecifier; + declare export function metaProperty(meta: BabelNodeIdentifier, property: BabelNodeIdentifier): BabelNodeMetaProperty; + declare export function classMethod(kind?: "get" | "set" | "method" | "constructor", key: BabelNodeIdentifier | BabelNodeStringLiteral | BabelNodeNumericLiteral | BabelNodeExpression, params: Array<BabelNodeIdentifier | BabelNodePattern | BabelNodeRestElement | BabelNodeTSParameterProperty>, body: BabelNodeBlockStatement, computed?: boolean, _static?: boolean, generator?: boolean, async?: boolean): BabelNodeClassMethod; + declare export function objectPattern(properties: Array<BabelNodeRestElement | BabelNodeObjectProperty>): BabelNodeObjectPattern; + declare export function spreadElement(argument: BabelNodeExpression): BabelNodeSpreadElement; declare function _super(): BabelNodeSuper; declare export { _super as super } - declare function taggedTemplateExpression(tag: BabelNodeExpression, quasi: BabelNodeTemplateLiteral): BabelNodeTaggedTemplateExpression; - declare function templateElement(value: { raw: string, cooked?: string }, tail?: boolean): BabelNodeTemplateElement; - declare function templateLiteral(quasis: Array<BabelNodeTemplateElement>, expressions: Array<BabelNodeExpression | BabelNodeTSType>): BabelNodeTemplateLiteral; - declare function yieldExpression(argument?: BabelNodeExpression, delegate?: boolean): BabelNodeYieldExpression; - declare function awaitExpression(argument: BabelNodeExpression): BabelNodeAwaitExpression; + declare export function taggedTemplateExpression(tag: BabelNodeExpression, quasi: BabelNodeTemplateLiteral): BabelNodeTaggedTemplateExpression; + declare export function templateElement(value: { raw: string, cooked?: string }, tail?: boolean): BabelNodeTemplateElement; + declare export function templateLiteral(quasis: Array<BabelNodeTemplateElement>, expressions: Array<BabelNodeExpression | BabelNodeTSType>): BabelNodeTemplateLiteral; + declare export function yieldExpression(argument?: BabelNodeExpression, delegate?: boolean): BabelNodeYieldExpression; + declare export function awaitExpression(argument: BabelNodeExpression): BabelNodeAwaitExpression; declare function _import(): BabelNodeImport; declare export { _import as import } - declare function bigIntLiteral(value: string): BabelNodeBigIntLiteral; - declare function exportNamespaceSpecifier(exported: BabelNodeIdentifier): BabelNodeExportNamespaceSpecifier; - declare function optionalMemberExpression(object: BabelNodeExpression, property: BabelNodeExpression | BabelNodeIdentifier, computed?: boolean, optional: boolean): BabelNodeOptionalMemberExpression; - declare function optionalCallExpression(callee: BabelNodeExpression, _arguments: Array<BabelNodeExpression | BabelNodeSpreadElement | BabelNodeJSXNamespacedName>, optional: boolean): BabelNodeOptionalCallExpression; - declare function anyTypeAnnotation(): BabelNodeAnyTypeAnnotation; - declare function arrayTypeAnnotation(elementType: BabelNodeFlowType): BabelNodeArrayTypeAnnotation; - declare function booleanTypeAnnotation(): BabelNodeBooleanTypeAnnotation; - declare function booleanLiteralTypeAnnotation(value: boolean): BabelNodeBooleanLiteralTypeAnnotation; - declare function nullLiteralTypeAnnotation(): BabelNodeNullLiteralTypeAnnotation; - declare function classImplements(id: BabelNodeIdentifier, typeParameters?: BabelNodeTypeParameterInstantiation): BabelNodeClassImplements; - declare function declareClass(id: BabelNodeIdentifier, typeParameters?: BabelNodeTypeParameterDeclaration, _extends?: Array<BabelNodeInterfaceExtends>, body: BabelNodeObjectTypeAnnotation): BabelNodeDeclareClass; - declare function declareFunction(id: BabelNodeIdentifier): BabelNodeDeclareFunction; - declare function declareInterface(id: BabelNodeIdentifier, typeParameters?: BabelNodeTypeParameterDeclaration, _extends?: Array<BabelNodeInterfaceExtends>, body: BabelNodeObjectTypeAnnotation): BabelNodeDeclareInterface; - declare function declareModule(id: BabelNodeIdentifier | BabelNodeStringLiteral, body: BabelNodeBlockStatement, kind?: "CommonJS" | "ES"): BabelNodeDeclareModule; - declare function declareModuleExports(typeAnnotation: BabelNodeTypeAnnotation): BabelNodeDeclareModuleExports; - declare function declareTypeAlias(id: BabelNodeIdentifier, typeParameters?: BabelNodeTypeParameterDeclaration, right: BabelNodeFlowType): BabelNodeDeclareTypeAlias; - declare function declareOpaqueType(id: BabelNodeIdentifier, typeParameters?: BabelNodeTypeParameterDeclaration, supertype?: BabelNodeFlowType): BabelNodeDeclareOpaqueType; - declare function declareVariable(id: BabelNodeIdentifier): BabelNodeDeclareVariable; - declare function declareExportDeclaration(declaration?: BabelNodeFlow, specifiers?: Array<BabelNodeExportSpecifier | BabelNodeExportNamespaceSpecifier>, source?: BabelNodeStringLiteral): BabelNodeDeclareExportDeclaration; - declare function declareExportAllDeclaration(source: BabelNodeStringLiteral): BabelNodeDeclareExportAllDeclaration; - declare function declaredPredicate(value: BabelNodeFlow): BabelNodeDeclaredPredicate; - declare function existsTypeAnnotation(): BabelNodeExistsTypeAnnotation; - declare function functionTypeAnnotation(typeParameters?: BabelNodeTypeParameterDeclaration, params: Array<BabelNodeFunctionTypeParam>, rest?: BabelNodeFunctionTypeParam, returnType: BabelNodeFlowType): BabelNodeFunctionTypeAnnotation; - declare function functionTypeParam(name?: BabelNodeIdentifier, typeAnnotation: BabelNodeFlowType): BabelNodeFunctionTypeParam; - declare function genericTypeAnnotation(id: BabelNodeIdentifier | BabelNodeQualifiedTypeIdentifier, typeParameters?: BabelNodeTypeParameterInstantiation): BabelNodeGenericTypeAnnotation; - declare function inferredPredicate(): BabelNodeInferredPredicate; - declare function interfaceExtends(id: BabelNodeIdentifier | BabelNodeQualifiedTypeIdentifier, typeParameters?: BabelNodeTypeParameterInstantiation): BabelNodeInterfaceExtends; - declare function interfaceDeclaration(id: BabelNodeIdentifier, typeParameters?: BabelNodeTypeParameterDeclaration, _extends?: Array<BabelNodeInterfaceExtends>, body: BabelNodeObjectTypeAnnotation): BabelNodeInterfaceDeclaration; - declare function interfaceTypeAnnotation(_extends?: Array<BabelNodeInterfaceExtends>, body: BabelNodeObjectTypeAnnotation): BabelNodeInterfaceTypeAnnotation; - declare function intersectionTypeAnnotation(types: Array<BabelNodeFlowType>): BabelNodeIntersectionTypeAnnotation; - declare function mixedTypeAnnotation(): BabelNodeMixedTypeAnnotation; - declare function emptyTypeAnnotation(): BabelNodeEmptyTypeAnnotation; - declare function nullableTypeAnnotation(typeAnnotation: BabelNodeFlowType): BabelNodeNullableTypeAnnotation; - declare function numberLiteralTypeAnnotation(value: number): BabelNodeNumberLiteralTypeAnnotation; - declare function numberTypeAnnotation(): BabelNodeNumberTypeAnnotation; - declare function objectTypeAnnotation(properties: Array<BabelNodeObjectTypeProperty | BabelNodeObjectTypeSpreadProperty>, indexers?: Array<BabelNodeObjectTypeIndexer>, callProperties?: Array<BabelNodeObjectTypeCallProperty>, internalSlots?: Array<BabelNodeObjectTypeInternalSlot>, exact?: boolean): BabelNodeObjectTypeAnnotation; - declare function objectTypeInternalSlot(id: BabelNodeIdentifier, value: BabelNodeFlowType, optional: boolean, _static: boolean, method: boolean): BabelNodeObjectTypeInternalSlot; - declare function objectTypeCallProperty(value: BabelNodeFlowType): BabelNodeObjectTypeCallProperty; - declare function objectTypeIndexer(id?: BabelNodeIdentifier, key: BabelNodeFlowType, value: BabelNodeFlowType, variance?: BabelNodeVariance): BabelNodeObjectTypeIndexer; - declare function objectTypeProperty(key: BabelNodeIdentifier | BabelNodeStringLiteral, value: BabelNodeFlowType, variance?: BabelNodeVariance): BabelNodeObjectTypeProperty; - declare function objectTypeSpreadProperty(argument: BabelNodeFlowType): BabelNodeObjectTypeSpreadProperty; - declare function opaqueType(id: BabelNodeIdentifier, typeParameters?: BabelNodeTypeParameterDeclaration, supertype?: BabelNodeFlowType, impltype: BabelNodeFlowType): BabelNodeOpaqueType; - declare function qualifiedTypeIdentifier(id: BabelNodeIdentifier, qualification: BabelNodeIdentifier | BabelNodeQualifiedTypeIdentifier): BabelNodeQualifiedTypeIdentifier; - declare function stringLiteralTypeAnnotation(value: string): BabelNodeStringLiteralTypeAnnotation; - declare function stringTypeAnnotation(): BabelNodeStringTypeAnnotation; - declare function symbolTypeAnnotation(): BabelNodeSymbolTypeAnnotation; - declare function thisTypeAnnotation(): BabelNodeThisTypeAnnotation; - declare function tupleTypeAnnotation(types: Array<BabelNodeFlowType>): BabelNodeTupleTypeAnnotation; - declare function typeofTypeAnnotation(argument: BabelNodeFlowType): BabelNodeTypeofTypeAnnotation; - declare function typeAlias(id: BabelNodeIdentifier, typeParameters?: BabelNodeTypeParameterDeclaration, right: BabelNodeFlowType): BabelNodeTypeAlias; - declare function typeAnnotation(typeAnnotation: BabelNodeFlowType): BabelNodeTypeAnnotation; - declare function typeCastExpression(expression: BabelNodeExpression, typeAnnotation: BabelNodeTypeAnnotation): BabelNodeTypeCastExpression; - declare function typeParameter(bound?: BabelNodeTypeAnnotation, _default?: BabelNodeFlowType, variance?: BabelNodeVariance): BabelNodeTypeParameter; - declare function typeParameterDeclaration(params: Array<BabelNodeTypeParameter>): BabelNodeTypeParameterDeclaration; - declare function typeParameterInstantiation(params: Array<BabelNodeFlowType>): BabelNodeTypeParameterInstantiation; - declare function unionTypeAnnotation(types: Array<BabelNodeFlowType>): BabelNodeUnionTypeAnnotation; - declare function variance(kind: "minus" | "plus"): BabelNodeVariance; - declare function voidTypeAnnotation(): BabelNodeVoidTypeAnnotation; - declare function enumDeclaration(id: BabelNodeIdentifier, body: BabelNodeEnumBooleanBody | BabelNodeEnumNumberBody | BabelNodeEnumStringBody | BabelNodeEnumSymbolBody): BabelNodeEnumDeclaration; - declare function enumBooleanBody(members: Array<BabelNodeEnumBooleanMember>): BabelNodeEnumBooleanBody; - declare function enumNumberBody(members: Array<BabelNodeEnumNumberMember>): BabelNodeEnumNumberBody; - declare function enumStringBody(members: Array<BabelNodeEnumStringMember | BabelNodeEnumDefaultedMember>): BabelNodeEnumStringBody; - declare function enumSymbolBody(members: Array<BabelNodeEnumDefaultedMember>): BabelNodeEnumSymbolBody; - declare function enumBooleanMember(id: BabelNodeIdentifier): BabelNodeEnumBooleanMember; - declare function enumNumberMember(id: BabelNodeIdentifier, init: BabelNodeNumericLiteral): BabelNodeEnumNumberMember; - declare function enumStringMember(id: BabelNodeIdentifier, init: BabelNodeStringLiteral): BabelNodeEnumStringMember; - declare function enumDefaultedMember(id: BabelNodeIdentifier): BabelNodeEnumDefaultedMember; - declare function jsxAttribute(name: BabelNodeJSXIdentifier | BabelNodeJSXNamespacedName, value?: BabelNodeJSXElement | BabelNodeJSXFragment | BabelNodeStringLiteral | BabelNodeJSXExpressionContainer): BabelNodeJSXAttribute; - declare function jsxClosingElement(name: BabelNodeJSXIdentifier | BabelNodeJSXMemberExpression | BabelNodeJSXNamespacedName): BabelNodeJSXClosingElement; - declare function jsxElement(openingElement: BabelNodeJSXOpeningElement, closingElement?: BabelNodeJSXClosingElement, children: Array<BabelNodeJSXText | BabelNodeJSXExpressionContainer | BabelNodeJSXSpreadChild | BabelNodeJSXElement | BabelNodeJSXFragment>, selfClosing?: boolean): BabelNodeJSXElement; - declare function jsxEmptyExpression(): BabelNodeJSXEmptyExpression; - declare function jsxExpressionContainer(expression: BabelNodeExpression | BabelNodeJSXEmptyExpression): BabelNodeJSXExpressionContainer; - declare function jsxSpreadChild(expression: BabelNodeExpression): BabelNodeJSXSpreadChild; - declare function jsxIdentifier(name: string): BabelNodeJSXIdentifier; - declare function jsxMemberExpression(object: BabelNodeJSXMemberExpression | BabelNodeJSXIdentifier, property: BabelNodeJSXIdentifier): BabelNodeJSXMemberExpression; - declare function jsxNamespacedName(namespace: BabelNodeJSXIdentifier, name: BabelNodeJSXIdentifier): BabelNodeJSXNamespacedName; - declare function jsxOpeningElement(name: BabelNodeJSXIdentifier | BabelNodeJSXMemberExpression | BabelNodeJSXNamespacedName, attributes: Array<BabelNodeJSXAttribute | BabelNodeJSXSpreadAttribute>, selfClosing?: boolean): BabelNodeJSXOpeningElement; - declare function jsxSpreadAttribute(argument: BabelNodeExpression): BabelNodeJSXSpreadAttribute; - declare function jsxText(value: string): BabelNodeJSXText; - declare function jsxFragment(openingFragment: BabelNodeJSXOpeningFragment, closingFragment: BabelNodeJSXClosingFragment, children: Array<BabelNodeJSXText | BabelNodeJSXExpressionContainer | BabelNodeJSXSpreadChild | BabelNodeJSXElement | BabelNodeJSXFragment>): BabelNodeJSXFragment; - declare function jsxOpeningFragment(): BabelNodeJSXOpeningFragment; - declare function jsxClosingFragment(): BabelNodeJSXClosingFragment; - declare function noop(): BabelNodeNoop; - declare function placeholder(expectedNode: "Identifier" | "StringLiteral" | "Expression" | "Statement" | "Declaration" | "BlockStatement" | "ClassBody" | "Pattern", name: BabelNodeIdentifier): BabelNodePlaceholder; - declare function v8IntrinsicIdentifier(name: string): BabelNodeV8IntrinsicIdentifier; - declare function argumentPlaceholder(): BabelNodeArgumentPlaceholder; - declare function bindExpression(object: BabelNodeExpression, callee: BabelNodeExpression): BabelNodeBindExpression; - declare function classProperty(key: BabelNodeIdentifier | BabelNodeStringLiteral | BabelNodeNumericLiteral | BabelNodeExpression, value?: BabelNodeExpression, typeAnnotation?: BabelNodeTypeAnnotation | BabelNodeTSTypeAnnotation | BabelNodeNoop, decorators?: Array<BabelNodeDecorator>, computed?: boolean, _static?: boolean): BabelNodeClassProperty; - declare function pipelineTopicExpression(expression: BabelNodeExpression): BabelNodePipelineTopicExpression; - declare function pipelineBareFunction(callee: BabelNodeExpression): BabelNodePipelineBareFunction; - declare function pipelinePrimaryTopicReference(): BabelNodePipelinePrimaryTopicReference; - declare function classPrivateProperty(key: BabelNodePrivateName, value?: BabelNodeExpression, decorators?: Array<BabelNodeDecorator>, _static: any): BabelNodeClassPrivateProperty; - declare function classPrivateMethod(kind?: "get" | "set" | "method" | "constructor", key: BabelNodePrivateName, params: Array<BabelNodeIdentifier | BabelNodePattern | BabelNodeRestElement | BabelNodeTSParameterProperty>, body: BabelNodeBlockStatement, _static?: boolean): BabelNodeClassPrivateMethod; - declare function importAttribute(key: BabelNodeIdentifier | BabelNodeStringLiteral, value: BabelNodeStringLiteral): BabelNodeImportAttribute; - declare function decorator(expression: BabelNodeExpression): BabelNodeDecorator; - declare function doExpression(body: BabelNodeBlockStatement): BabelNodeDoExpression; - declare function exportDefaultSpecifier(exported: BabelNodeIdentifier): BabelNodeExportDefaultSpecifier; - declare function privateName(id: BabelNodeIdentifier): BabelNodePrivateName; - declare function recordExpression(properties: Array<BabelNodeObjectProperty | BabelNodeSpreadElement>): BabelNodeRecordExpression; - declare function tupleExpression(elements?: Array<BabelNodeExpression | BabelNodeSpreadElement>): BabelNodeTupleExpression; - declare function decimalLiteral(value: string): BabelNodeDecimalLiteral; - declare function staticBlock(body: Array<BabelNodeStatement>): BabelNodeStaticBlock; - declare function tsParameterProperty(parameter: BabelNodeIdentifier | BabelNodeAssignmentPattern): BabelNodeTSParameterProperty; - declare function tsDeclareFunction(id?: BabelNodeIdentifier, typeParameters?: BabelNodeTSTypeParameterDeclaration | BabelNodeNoop, params: Array<BabelNodeIdentifier | BabelNodePattern | BabelNodeRestElement | BabelNodeTSParameterProperty>, returnType?: BabelNodeTSTypeAnnotation | BabelNodeNoop): BabelNodeTSDeclareFunction; - declare function tsDeclareMethod(decorators?: Array<BabelNodeDecorator>, key: BabelNodeIdentifier | BabelNodeStringLiteral | BabelNodeNumericLiteral | BabelNodeExpression, typeParameters?: BabelNodeTSTypeParameterDeclaration | BabelNodeNoop, params: Array<BabelNodeIdentifier | BabelNodePattern | BabelNodeRestElement | BabelNodeTSParameterProperty>, returnType?: BabelNodeTSTypeAnnotation | BabelNodeNoop): BabelNodeTSDeclareMethod; - declare function tsQualifiedName(left: BabelNodeTSEntityName, right: BabelNodeIdentifier): BabelNodeTSQualifiedName; - declare function tsCallSignatureDeclaration(typeParameters?: BabelNodeTSTypeParameterDeclaration, parameters: Array<BabelNodeIdentifier | BabelNodeRestElement>, typeAnnotation?: BabelNodeTSTypeAnnotation): BabelNodeTSCallSignatureDeclaration; - declare function tsConstructSignatureDeclaration(typeParameters?: BabelNodeTSTypeParameterDeclaration, parameters: Array<BabelNodeIdentifier | BabelNodeRestElement>, typeAnnotation?: BabelNodeTSTypeAnnotation): BabelNodeTSConstructSignatureDeclaration; - declare function tsPropertySignature(key: BabelNodeExpression, typeAnnotation?: BabelNodeTSTypeAnnotation, initializer?: BabelNodeExpression): BabelNodeTSPropertySignature; - declare function tsMethodSignature(key: BabelNodeExpression, typeParameters?: BabelNodeTSTypeParameterDeclaration, parameters: Array<BabelNodeIdentifier | BabelNodeRestElement>, typeAnnotation?: BabelNodeTSTypeAnnotation): BabelNodeTSMethodSignature; - declare function tsIndexSignature(parameters: Array<BabelNodeIdentifier>, typeAnnotation?: BabelNodeTSTypeAnnotation): BabelNodeTSIndexSignature; - declare function tsAnyKeyword(): BabelNodeTSAnyKeyword; - declare function tsBooleanKeyword(): BabelNodeTSBooleanKeyword; - declare function tsBigIntKeyword(): BabelNodeTSBigIntKeyword; - declare function tsIntrinsicKeyword(): BabelNodeTSIntrinsicKeyword; - declare function tsNeverKeyword(): BabelNodeTSNeverKeyword; - declare function tsNullKeyword(): BabelNodeTSNullKeyword; - declare function tsNumberKeyword(): BabelNodeTSNumberKeyword; - declare function tsObjectKeyword(): BabelNodeTSObjectKeyword; - declare function tsStringKeyword(): BabelNodeTSStringKeyword; - declare function tsSymbolKeyword(): BabelNodeTSSymbolKeyword; - declare function tsUndefinedKeyword(): BabelNodeTSUndefinedKeyword; - declare function tsUnknownKeyword(): BabelNodeTSUnknownKeyword; - declare function tsVoidKeyword(): BabelNodeTSVoidKeyword; - declare function tsThisType(): BabelNodeTSThisType; - declare function tsFunctionType(typeParameters?: BabelNodeTSTypeParameterDeclaration, parameters: Array<BabelNodeIdentifier | BabelNodeRestElement>, typeAnnotation?: BabelNodeTSTypeAnnotation): BabelNodeTSFunctionType; - declare function tsConstructorType(typeParameters?: BabelNodeTSTypeParameterDeclaration, parameters: Array<BabelNodeIdentifier | BabelNodeRestElement>, typeAnnotation?: BabelNodeTSTypeAnnotation): BabelNodeTSConstructorType; - declare function tsTypeReference(typeName: BabelNodeTSEntityName, typeParameters?: BabelNodeTSTypeParameterInstantiation): BabelNodeTSTypeReference; - declare function tsTypePredicate(parameterName: BabelNodeIdentifier | BabelNodeTSThisType, typeAnnotation?: BabelNodeTSTypeAnnotation, asserts?: boolean): BabelNodeTSTypePredicate; - declare function tsTypeQuery(exprName: BabelNodeTSEntityName | BabelNodeTSImportType): BabelNodeTSTypeQuery; - declare function tsTypeLiteral(members: Array<BabelNodeTSTypeElement>): BabelNodeTSTypeLiteral; - declare function tsArrayType(elementType: BabelNodeTSType): BabelNodeTSArrayType; - declare function tsTupleType(elementTypes: Array<BabelNodeTSType | BabelNodeTSNamedTupleMember>): BabelNodeTSTupleType; - declare function tsOptionalType(typeAnnotation: BabelNodeTSType): BabelNodeTSOptionalType; - declare function tsRestType(typeAnnotation: BabelNodeTSType): BabelNodeTSRestType; - declare function tsNamedTupleMember(label: BabelNodeIdentifier, elementType: BabelNodeTSType, optional?: boolean): BabelNodeTSNamedTupleMember; - declare function tsUnionType(types: Array<BabelNodeTSType>): BabelNodeTSUnionType; - declare function tsIntersectionType(types: Array<BabelNodeTSType>): BabelNodeTSIntersectionType; - declare function tsConditionalType(checkType: BabelNodeTSType, extendsType: BabelNodeTSType, trueType: BabelNodeTSType, falseType: BabelNodeTSType): BabelNodeTSConditionalType; - declare function tsInferType(typeParameter: BabelNodeTSTypeParameter): BabelNodeTSInferType; - declare function tsParenthesizedType(typeAnnotation: BabelNodeTSType): BabelNodeTSParenthesizedType; - declare function tsTypeOperator(typeAnnotation: BabelNodeTSType): BabelNodeTSTypeOperator; - declare function tsIndexedAccessType(objectType: BabelNodeTSType, indexType: BabelNodeTSType): BabelNodeTSIndexedAccessType; - declare function tsMappedType(typeParameter: BabelNodeTSTypeParameter, typeAnnotation?: BabelNodeTSType, nameType?: BabelNodeTSType): BabelNodeTSMappedType; - declare function tsLiteralType(literal: BabelNodeNumericLiteral | BabelNodeStringLiteral | BabelNodeBooleanLiteral | BabelNodeBigIntLiteral): BabelNodeTSLiteralType; - declare function tsExpressionWithTypeArguments(expression: BabelNodeTSEntityName, typeParameters?: BabelNodeTSTypeParameterInstantiation): BabelNodeTSExpressionWithTypeArguments; - declare function tsInterfaceDeclaration(id: BabelNodeIdentifier, typeParameters?: BabelNodeTSTypeParameterDeclaration, _extends?: Array<BabelNodeTSExpressionWithTypeArguments>, body: BabelNodeTSInterfaceBody): BabelNodeTSInterfaceDeclaration; - declare function tsInterfaceBody(body: Array<BabelNodeTSTypeElement>): BabelNodeTSInterfaceBody; - declare function tsTypeAliasDeclaration(id: BabelNodeIdentifier, typeParameters?: BabelNodeTSTypeParameterDeclaration, typeAnnotation: BabelNodeTSType): BabelNodeTSTypeAliasDeclaration; - declare function tsAsExpression(expression: BabelNodeExpression, typeAnnotation: BabelNodeTSType): BabelNodeTSAsExpression; - declare function tsTypeAssertion(typeAnnotation: BabelNodeTSType, expression: BabelNodeExpression): BabelNodeTSTypeAssertion; - declare function tsEnumDeclaration(id: BabelNodeIdentifier, members: Array<BabelNodeTSEnumMember>): BabelNodeTSEnumDeclaration; - declare function tsEnumMember(id: BabelNodeIdentifier | BabelNodeStringLiteral, initializer?: BabelNodeExpression): BabelNodeTSEnumMember; - declare function tsModuleDeclaration(id: BabelNodeIdentifier | BabelNodeStringLiteral, body: BabelNodeTSModuleBlock | BabelNodeTSModuleDeclaration): BabelNodeTSModuleDeclaration; - declare function tsModuleBlock(body: Array<BabelNodeStatement>): BabelNodeTSModuleBlock; - declare function tsImportType(argument: BabelNodeStringLiteral, qualifier?: BabelNodeTSEntityName, typeParameters?: BabelNodeTSTypeParameterInstantiation): BabelNodeTSImportType; - declare function tsImportEqualsDeclaration(id: BabelNodeIdentifier, moduleReference: BabelNodeTSEntityName | BabelNodeTSExternalModuleReference): BabelNodeTSImportEqualsDeclaration; - declare function tsExternalModuleReference(expression: BabelNodeStringLiteral): BabelNodeTSExternalModuleReference; - declare function tsNonNullExpression(expression: BabelNodeExpression): BabelNodeTSNonNullExpression; - declare function tsExportAssignment(expression: BabelNodeExpression): BabelNodeTSExportAssignment; - declare function tsNamespaceExportDeclaration(id: BabelNodeIdentifier): BabelNodeTSNamespaceExportDeclaration; - declare function tsTypeAnnotation(typeAnnotation: BabelNodeTSType): BabelNodeTSTypeAnnotation; - declare function tsTypeParameterInstantiation(params: Array<BabelNodeTSType>): BabelNodeTSTypeParameterInstantiation; - declare function tsTypeParameterDeclaration(params: Array<BabelNodeTSTypeParameter>): BabelNodeTSTypeParameterDeclaration; - declare function tsTypeParameter(constraint?: BabelNodeTSType, _default?: BabelNodeTSType, name: string): BabelNodeTSTypeParameter; - declare function isArrayExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeArrayExpression) - declare function assertArrayExpression(node: ?Object, opts?: ?Object): void - declare function isAssignmentExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeAssignmentExpression) - declare function assertAssignmentExpression(node: ?Object, opts?: ?Object): void - declare function isBinaryExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeBinaryExpression) - declare function assertBinaryExpression(node: ?Object, opts?: ?Object): void - declare function isInterpreterDirective(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeInterpreterDirective) - declare function assertInterpreterDirective(node: ?Object, opts?: ?Object): void - declare function isDirective(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeDirective) - declare function assertDirective(node: ?Object, opts?: ?Object): void - declare function isDirectiveLiteral(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeDirectiveLiteral) - declare function assertDirectiveLiteral(node: ?Object, opts?: ?Object): void - declare function isBlockStatement(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeBlockStatement) - declare function assertBlockStatement(node: ?Object, opts?: ?Object): void - declare function isBreakStatement(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeBreakStatement) - declare function assertBreakStatement(node: ?Object, opts?: ?Object): void - declare function isCallExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeCallExpression) - declare function assertCallExpression(node: ?Object, opts?: ?Object): void - declare function isCatchClause(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeCatchClause) - declare function assertCatchClause(node: ?Object, opts?: ?Object): void - declare function isConditionalExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeConditionalExpression) - declare function assertConditionalExpression(node: ?Object, opts?: ?Object): void - declare function isContinueStatement(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeContinueStatement) - declare function assertContinueStatement(node: ?Object, opts?: ?Object): void - declare function isDebuggerStatement(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeDebuggerStatement) - declare function assertDebuggerStatement(node: ?Object, opts?: ?Object): void - declare function isDoWhileStatement(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeDoWhileStatement) - declare function assertDoWhileStatement(node: ?Object, opts?: ?Object): void - declare function isEmptyStatement(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeEmptyStatement) - declare function assertEmptyStatement(node: ?Object, opts?: ?Object): void - declare function isExpressionStatement(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeExpressionStatement) - declare function assertExpressionStatement(node: ?Object, opts?: ?Object): void - declare function isFile(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeFile) - declare function assertFile(node: ?Object, opts?: ?Object): void - declare function isForInStatement(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeForInStatement) - declare function assertForInStatement(node: ?Object, opts?: ?Object): void - declare function isForStatement(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeForStatement) - declare function assertForStatement(node: ?Object, opts?: ?Object): void - declare function isFunctionDeclaration(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeFunctionDeclaration) - declare function assertFunctionDeclaration(node: ?Object, opts?: ?Object): void - declare function isFunctionExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeFunctionExpression) - declare function assertFunctionExpression(node: ?Object, opts?: ?Object): void - declare function isIdentifier(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeIdentifier) - declare function assertIdentifier(node: ?Object, opts?: ?Object): void - declare function isIfStatement(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeIfStatement) - declare function assertIfStatement(node: ?Object, opts?: ?Object): void - declare function isLabeledStatement(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeLabeledStatement) - declare function assertLabeledStatement(node: ?Object, opts?: ?Object): void - declare function isStringLiteral(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeStringLiteral) - declare function assertStringLiteral(node: ?Object, opts?: ?Object): void - declare function isNumericLiteral(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeNumericLiteral) - declare function assertNumericLiteral(node: ?Object, opts?: ?Object): void - declare function isNullLiteral(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeNullLiteral) - declare function assertNullLiteral(node: ?Object, opts?: ?Object): void - declare function isBooleanLiteral(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeBooleanLiteral) - declare function assertBooleanLiteral(node: ?Object, opts?: ?Object): void - declare function isRegExpLiteral(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeRegExpLiteral) - declare function assertRegExpLiteral(node: ?Object, opts?: ?Object): void - declare function isLogicalExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeLogicalExpression) - declare function assertLogicalExpression(node: ?Object, opts?: ?Object): void - declare function isMemberExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeMemberExpression) - declare function assertMemberExpression(node: ?Object, opts?: ?Object): void - declare function isNewExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeNewExpression) - declare function assertNewExpression(node: ?Object, opts?: ?Object): void - declare function isProgram(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeProgram) - declare function assertProgram(node: ?Object, opts?: ?Object): void - declare function isObjectExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeObjectExpression) - declare function assertObjectExpression(node: ?Object, opts?: ?Object): void - declare function isObjectMethod(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeObjectMethod) - declare function assertObjectMethod(node: ?Object, opts?: ?Object): void - declare function isObjectProperty(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeObjectProperty) - declare function assertObjectProperty(node: ?Object, opts?: ?Object): void - declare function isRestElement(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeRestElement) - declare function assertRestElement(node: ?Object, opts?: ?Object): void - declare function isReturnStatement(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeReturnStatement) - declare function assertReturnStatement(node: ?Object, opts?: ?Object): void - declare function isSequenceExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeSequenceExpression) - declare function assertSequenceExpression(node: ?Object, opts?: ?Object): void - declare function isParenthesizedExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeParenthesizedExpression) - declare function assertParenthesizedExpression(node: ?Object, opts?: ?Object): void - declare function isSwitchCase(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeSwitchCase) - declare function assertSwitchCase(node: ?Object, opts?: ?Object): void - declare function isSwitchStatement(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeSwitchStatement) - declare function assertSwitchStatement(node: ?Object, opts?: ?Object): void - declare function isThisExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeThisExpression) - declare function assertThisExpression(node: ?Object, opts?: ?Object): void - declare function isThrowStatement(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeThrowStatement) - declare function assertThrowStatement(node: ?Object, opts?: ?Object): void - declare function isTryStatement(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTryStatement) - declare function assertTryStatement(node: ?Object, opts?: ?Object): void - declare function isUnaryExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeUnaryExpression) - declare function assertUnaryExpression(node: ?Object, opts?: ?Object): void - declare function isUpdateExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeUpdateExpression) - declare function assertUpdateExpression(node: ?Object, opts?: ?Object): void - declare function isVariableDeclaration(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeVariableDeclaration) - declare function assertVariableDeclaration(node: ?Object, opts?: ?Object): void - declare function isVariableDeclarator(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeVariableDeclarator) - declare function assertVariableDeclarator(node: ?Object, opts?: ?Object): void - declare function isWhileStatement(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeWhileStatement) - declare function assertWhileStatement(node: ?Object, opts?: ?Object): void - declare function isWithStatement(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeWithStatement) - declare function assertWithStatement(node: ?Object, opts?: ?Object): void - declare function isAssignmentPattern(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeAssignmentPattern) - declare function assertAssignmentPattern(node: ?Object, opts?: ?Object): void - declare function isArrayPattern(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeArrayPattern) - declare function assertArrayPattern(node: ?Object, opts?: ?Object): void - declare function isArrowFunctionExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeArrowFunctionExpression) - declare function assertArrowFunctionExpression(node: ?Object, opts?: ?Object): void - declare function isClassBody(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeClassBody) - declare function assertClassBody(node: ?Object, opts?: ?Object): void - declare function isClassExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeClassExpression) - declare function assertClassExpression(node: ?Object, opts?: ?Object): void - declare function isClassDeclaration(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeClassDeclaration) - declare function assertClassDeclaration(node: ?Object, opts?: ?Object): void - declare function isExportAllDeclaration(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeExportAllDeclaration) - declare function assertExportAllDeclaration(node: ?Object, opts?: ?Object): void - declare function isExportDefaultDeclaration(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeExportDefaultDeclaration) - declare function assertExportDefaultDeclaration(node: ?Object, opts?: ?Object): void - declare function isExportNamedDeclaration(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeExportNamedDeclaration) - declare function assertExportNamedDeclaration(node: ?Object, opts?: ?Object): void - declare function isExportSpecifier(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeExportSpecifier) - declare function assertExportSpecifier(node: ?Object, opts?: ?Object): void - declare function isForOfStatement(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeForOfStatement) - declare function assertForOfStatement(node: ?Object, opts?: ?Object): void - declare function isImportDeclaration(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeImportDeclaration) - declare function assertImportDeclaration(node: ?Object, opts?: ?Object): void - declare function isImportDefaultSpecifier(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeImportDefaultSpecifier) - declare function assertImportDefaultSpecifier(node: ?Object, opts?: ?Object): void - declare function isImportNamespaceSpecifier(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeImportNamespaceSpecifier) - declare function assertImportNamespaceSpecifier(node: ?Object, opts?: ?Object): void - declare function isImportSpecifier(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeImportSpecifier) - declare function assertImportSpecifier(node: ?Object, opts?: ?Object): void - declare function isMetaProperty(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeMetaProperty) - declare function assertMetaProperty(node: ?Object, opts?: ?Object): void - declare function isClassMethod(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeClassMethod) - declare function assertClassMethod(node: ?Object, opts?: ?Object): void - declare function isObjectPattern(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeObjectPattern) - declare function assertObjectPattern(node: ?Object, opts?: ?Object): void - declare function isSpreadElement(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeSpreadElement) - declare function assertSpreadElement(node: ?Object, opts?: ?Object): void - declare function isSuper(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeSuper) - declare function assertSuper(node: ?Object, opts?: ?Object): void - declare function isTaggedTemplateExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTaggedTemplateExpression) - declare function assertTaggedTemplateExpression(node: ?Object, opts?: ?Object): void - declare function isTemplateElement(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTemplateElement) - declare function assertTemplateElement(node: ?Object, opts?: ?Object): void - declare function isTemplateLiteral(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTemplateLiteral) - declare function assertTemplateLiteral(node: ?Object, opts?: ?Object): void - declare function isYieldExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeYieldExpression) - declare function assertYieldExpression(node: ?Object, opts?: ?Object): void - declare function isAwaitExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeAwaitExpression) - declare function assertAwaitExpression(node: ?Object, opts?: ?Object): void - declare function isImport(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeImport) - declare function assertImport(node: ?Object, opts?: ?Object): void - declare function isBigIntLiteral(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeBigIntLiteral) - declare function assertBigIntLiteral(node: ?Object, opts?: ?Object): void - declare function isExportNamespaceSpecifier(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeExportNamespaceSpecifier) - declare function assertExportNamespaceSpecifier(node: ?Object, opts?: ?Object): void - declare function isOptionalMemberExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeOptionalMemberExpression) - declare function assertOptionalMemberExpression(node: ?Object, opts?: ?Object): void - declare function isOptionalCallExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeOptionalCallExpression) - declare function assertOptionalCallExpression(node: ?Object, opts?: ?Object): void - declare function isAnyTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeAnyTypeAnnotation) - declare function assertAnyTypeAnnotation(node: ?Object, opts?: ?Object): void - declare function isArrayTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeArrayTypeAnnotation) - declare function assertArrayTypeAnnotation(node: ?Object, opts?: ?Object): void - declare function isBooleanTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeBooleanTypeAnnotation) - declare function assertBooleanTypeAnnotation(node: ?Object, opts?: ?Object): void - declare function isBooleanLiteralTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeBooleanLiteralTypeAnnotation) - declare function assertBooleanLiteralTypeAnnotation(node: ?Object, opts?: ?Object): void - declare function isNullLiteralTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeNullLiteralTypeAnnotation) - declare function assertNullLiteralTypeAnnotation(node: ?Object, opts?: ?Object): void - declare function isClassImplements(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeClassImplements) - declare function assertClassImplements(node: ?Object, opts?: ?Object): void - declare function isDeclareClass(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeDeclareClass) - declare function assertDeclareClass(node: ?Object, opts?: ?Object): void - declare function isDeclareFunction(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeDeclareFunction) - declare function assertDeclareFunction(node: ?Object, opts?: ?Object): void - declare function isDeclareInterface(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeDeclareInterface) - declare function assertDeclareInterface(node: ?Object, opts?: ?Object): void - declare function isDeclareModule(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeDeclareModule) - declare function assertDeclareModule(node: ?Object, opts?: ?Object): void - declare function isDeclareModuleExports(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeDeclareModuleExports) - declare function assertDeclareModuleExports(node: ?Object, opts?: ?Object): void - declare function isDeclareTypeAlias(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeDeclareTypeAlias) - declare function assertDeclareTypeAlias(node: ?Object, opts?: ?Object): void - declare function isDeclareOpaqueType(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeDeclareOpaqueType) - declare function assertDeclareOpaqueType(node: ?Object, opts?: ?Object): void - declare function isDeclareVariable(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeDeclareVariable) - declare function assertDeclareVariable(node: ?Object, opts?: ?Object): void - declare function isDeclareExportDeclaration(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeDeclareExportDeclaration) - declare function assertDeclareExportDeclaration(node: ?Object, opts?: ?Object): void - declare function isDeclareExportAllDeclaration(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeDeclareExportAllDeclaration) - declare function assertDeclareExportAllDeclaration(node: ?Object, opts?: ?Object): void - declare function isDeclaredPredicate(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeDeclaredPredicate) - declare function assertDeclaredPredicate(node: ?Object, opts?: ?Object): void - declare function isExistsTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeExistsTypeAnnotation) - declare function assertExistsTypeAnnotation(node: ?Object, opts?: ?Object): void - declare function isFunctionTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeFunctionTypeAnnotation) - declare function assertFunctionTypeAnnotation(node: ?Object, opts?: ?Object): void - declare function isFunctionTypeParam(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeFunctionTypeParam) - declare function assertFunctionTypeParam(node: ?Object, opts?: ?Object): void - declare function isGenericTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeGenericTypeAnnotation) - declare function assertGenericTypeAnnotation(node: ?Object, opts?: ?Object): void - declare function isInferredPredicate(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeInferredPredicate) - declare function assertInferredPredicate(node: ?Object, opts?: ?Object): void - declare function isInterfaceExtends(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeInterfaceExtends) - declare function assertInterfaceExtends(node: ?Object, opts?: ?Object): void - declare function isInterfaceDeclaration(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeInterfaceDeclaration) - declare function assertInterfaceDeclaration(node: ?Object, opts?: ?Object): void - declare function isInterfaceTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeInterfaceTypeAnnotation) - declare function assertInterfaceTypeAnnotation(node: ?Object, opts?: ?Object): void - declare function isIntersectionTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeIntersectionTypeAnnotation) - declare function assertIntersectionTypeAnnotation(node: ?Object, opts?: ?Object): void - declare function isMixedTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeMixedTypeAnnotation) - declare function assertMixedTypeAnnotation(node: ?Object, opts?: ?Object): void - declare function isEmptyTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeEmptyTypeAnnotation) - declare function assertEmptyTypeAnnotation(node: ?Object, opts?: ?Object): void - declare function isNullableTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeNullableTypeAnnotation) - declare function assertNullableTypeAnnotation(node: ?Object, opts?: ?Object): void - declare function isNumberLiteralTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeNumberLiteralTypeAnnotation) - declare function assertNumberLiteralTypeAnnotation(node: ?Object, opts?: ?Object): void - declare function isNumberTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeNumberTypeAnnotation) - declare function assertNumberTypeAnnotation(node: ?Object, opts?: ?Object): void - declare function isObjectTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeObjectTypeAnnotation) - declare function assertObjectTypeAnnotation(node: ?Object, opts?: ?Object): void - declare function isObjectTypeInternalSlot(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeObjectTypeInternalSlot) - declare function assertObjectTypeInternalSlot(node: ?Object, opts?: ?Object): void - declare function isObjectTypeCallProperty(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeObjectTypeCallProperty) - declare function assertObjectTypeCallProperty(node: ?Object, opts?: ?Object): void - declare function isObjectTypeIndexer(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeObjectTypeIndexer) - declare function assertObjectTypeIndexer(node: ?Object, opts?: ?Object): void - declare function isObjectTypeProperty(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeObjectTypeProperty) - declare function assertObjectTypeProperty(node: ?Object, opts?: ?Object): void - declare function isObjectTypeSpreadProperty(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeObjectTypeSpreadProperty) - declare function assertObjectTypeSpreadProperty(node: ?Object, opts?: ?Object): void - declare function isOpaqueType(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeOpaqueType) - declare function assertOpaqueType(node: ?Object, opts?: ?Object): void - declare function isQualifiedTypeIdentifier(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeQualifiedTypeIdentifier) - declare function assertQualifiedTypeIdentifier(node: ?Object, opts?: ?Object): void - declare function isStringLiteralTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeStringLiteralTypeAnnotation) - declare function assertStringLiteralTypeAnnotation(node: ?Object, opts?: ?Object): void - declare function isStringTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeStringTypeAnnotation) - declare function assertStringTypeAnnotation(node: ?Object, opts?: ?Object): void - declare function isSymbolTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeSymbolTypeAnnotation) - declare function assertSymbolTypeAnnotation(node: ?Object, opts?: ?Object): void - declare function isThisTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeThisTypeAnnotation) - declare function assertThisTypeAnnotation(node: ?Object, opts?: ?Object): void - declare function isTupleTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTupleTypeAnnotation) - declare function assertTupleTypeAnnotation(node: ?Object, opts?: ?Object): void - declare function isTypeofTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTypeofTypeAnnotation) - declare function assertTypeofTypeAnnotation(node: ?Object, opts?: ?Object): void - declare function isTypeAlias(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTypeAlias) - declare function assertTypeAlias(node: ?Object, opts?: ?Object): void - declare function isTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTypeAnnotation) - declare function assertTypeAnnotation(node: ?Object, opts?: ?Object): void - declare function isTypeCastExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTypeCastExpression) - declare function assertTypeCastExpression(node: ?Object, opts?: ?Object): void - declare function isTypeParameter(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTypeParameter) - declare function assertTypeParameter(node: ?Object, opts?: ?Object): void - declare function isTypeParameterDeclaration(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTypeParameterDeclaration) - declare function assertTypeParameterDeclaration(node: ?Object, opts?: ?Object): void - declare function isTypeParameterInstantiation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTypeParameterInstantiation) - declare function assertTypeParameterInstantiation(node: ?Object, opts?: ?Object): void - declare function isUnionTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeUnionTypeAnnotation) - declare function assertUnionTypeAnnotation(node: ?Object, opts?: ?Object): void - declare function isVariance(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeVariance) - declare function assertVariance(node: ?Object, opts?: ?Object): void - declare function isVoidTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeVoidTypeAnnotation) - declare function assertVoidTypeAnnotation(node: ?Object, opts?: ?Object): void - declare function isEnumDeclaration(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeEnumDeclaration) - declare function assertEnumDeclaration(node: ?Object, opts?: ?Object): void - declare function isEnumBooleanBody(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeEnumBooleanBody) - declare function assertEnumBooleanBody(node: ?Object, opts?: ?Object): void - declare function isEnumNumberBody(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeEnumNumberBody) - declare function assertEnumNumberBody(node: ?Object, opts?: ?Object): void - declare function isEnumStringBody(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeEnumStringBody) - declare function assertEnumStringBody(node: ?Object, opts?: ?Object): void - declare function isEnumSymbolBody(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeEnumSymbolBody) - declare function assertEnumSymbolBody(node: ?Object, opts?: ?Object): void - declare function isEnumBooleanMember(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeEnumBooleanMember) - declare function assertEnumBooleanMember(node: ?Object, opts?: ?Object): void - declare function isEnumNumberMember(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeEnumNumberMember) - declare function assertEnumNumberMember(node: ?Object, opts?: ?Object): void - declare function isEnumStringMember(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeEnumStringMember) - declare function assertEnumStringMember(node: ?Object, opts?: ?Object): void - declare function isEnumDefaultedMember(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeEnumDefaultedMember) - declare function assertEnumDefaultedMember(node: ?Object, opts?: ?Object): void - declare function isJSXAttribute(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeJSXAttribute) - declare function assertJSXAttribute(node: ?Object, opts?: ?Object): void - declare function isJSXClosingElement(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeJSXClosingElement) - declare function assertJSXClosingElement(node: ?Object, opts?: ?Object): void - declare function isJSXElement(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeJSXElement) - declare function assertJSXElement(node: ?Object, opts?: ?Object): void - declare function isJSXEmptyExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeJSXEmptyExpression) - declare function assertJSXEmptyExpression(node: ?Object, opts?: ?Object): void - declare function isJSXExpressionContainer(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeJSXExpressionContainer) - declare function assertJSXExpressionContainer(node: ?Object, opts?: ?Object): void - declare function isJSXSpreadChild(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeJSXSpreadChild) - declare function assertJSXSpreadChild(node: ?Object, opts?: ?Object): void - declare function isJSXIdentifier(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeJSXIdentifier) - declare function assertJSXIdentifier(node: ?Object, opts?: ?Object): void - declare function isJSXMemberExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeJSXMemberExpression) - declare function assertJSXMemberExpression(node: ?Object, opts?: ?Object): void - declare function isJSXNamespacedName(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeJSXNamespacedName) - declare function assertJSXNamespacedName(node: ?Object, opts?: ?Object): void - declare function isJSXOpeningElement(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeJSXOpeningElement) - declare function assertJSXOpeningElement(node: ?Object, opts?: ?Object): void - declare function isJSXSpreadAttribute(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeJSXSpreadAttribute) - declare function assertJSXSpreadAttribute(node: ?Object, opts?: ?Object): void - declare function isJSXText(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeJSXText) - declare function assertJSXText(node: ?Object, opts?: ?Object): void - declare function isJSXFragment(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeJSXFragment) - declare function assertJSXFragment(node: ?Object, opts?: ?Object): void - declare function isJSXOpeningFragment(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeJSXOpeningFragment) - declare function assertJSXOpeningFragment(node: ?Object, opts?: ?Object): void - declare function isJSXClosingFragment(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeJSXClosingFragment) - declare function assertJSXClosingFragment(node: ?Object, opts?: ?Object): void - declare function isNoop(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeNoop) - declare function assertNoop(node: ?Object, opts?: ?Object): void - declare function isPlaceholder(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodePlaceholder) - declare function assertPlaceholder(node: ?Object, opts?: ?Object): void - declare function isV8IntrinsicIdentifier(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeV8IntrinsicIdentifier) - declare function assertV8IntrinsicIdentifier(node: ?Object, opts?: ?Object): void - declare function isArgumentPlaceholder(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeArgumentPlaceholder) - declare function assertArgumentPlaceholder(node: ?Object, opts?: ?Object): void - declare function isBindExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeBindExpression) - declare function assertBindExpression(node: ?Object, opts?: ?Object): void - declare function isClassProperty(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeClassProperty) - declare function assertClassProperty(node: ?Object, opts?: ?Object): void - declare function isPipelineTopicExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodePipelineTopicExpression) - declare function assertPipelineTopicExpression(node: ?Object, opts?: ?Object): void - declare function isPipelineBareFunction(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodePipelineBareFunction) - declare function assertPipelineBareFunction(node: ?Object, opts?: ?Object): void - declare function isPipelinePrimaryTopicReference(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodePipelinePrimaryTopicReference) - declare function assertPipelinePrimaryTopicReference(node: ?Object, opts?: ?Object): void - declare function isClassPrivateProperty(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeClassPrivateProperty) - declare function assertClassPrivateProperty(node: ?Object, opts?: ?Object): void - declare function isClassPrivateMethod(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeClassPrivateMethod) - declare function assertClassPrivateMethod(node: ?Object, opts?: ?Object): void - declare function isImportAttribute(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeImportAttribute) - declare function assertImportAttribute(node: ?Object, opts?: ?Object): void - declare function isDecorator(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeDecorator) - declare function assertDecorator(node: ?Object, opts?: ?Object): void - declare function isDoExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeDoExpression) - declare function assertDoExpression(node: ?Object, opts?: ?Object): void - declare function isExportDefaultSpecifier(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeExportDefaultSpecifier) - declare function assertExportDefaultSpecifier(node: ?Object, opts?: ?Object): void - declare function isPrivateName(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodePrivateName) - declare function assertPrivateName(node: ?Object, opts?: ?Object): void - declare function isRecordExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeRecordExpression) - declare function assertRecordExpression(node: ?Object, opts?: ?Object): void - declare function isTupleExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTupleExpression) - declare function assertTupleExpression(node: ?Object, opts?: ?Object): void - declare function isDecimalLiteral(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeDecimalLiteral) - declare function assertDecimalLiteral(node: ?Object, opts?: ?Object): void - declare function isStaticBlock(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeStaticBlock) - declare function assertStaticBlock(node: ?Object, opts?: ?Object): void - declare function isTSParameterProperty(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSParameterProperty) - declare function assertTSParameterProperty(node: ?Object, opts?: ?Object): void - declare function isTSDeclareFunction(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSDeclareFunction) - declare function assertTSDeclareFunction(node: ?Object, opts?: ?Object): void - declare function isTSDeclareMethod(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSDeclareMethod) - declare function assertTSDeclareMethod(node: ?Object, opts?: ?Object): void - declare function isTSQualifiedName(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSQualifiedName) - declare function assertTSQualifiedName(node: ?Object, opts?: ?Object): void - declare function isTSCallSignatureDeclaration(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSCallSignatureDeclaration) - declare function assertTSCallSignatureDeclaration(node: ?Object, opts?: ?Object): void - declare function isTSConstructSignatureDeclaration(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSConstructSignatureDeclaration) - declare function assertTSConstructSignatureDeclaration(node: ?Object, opts?: ?Object): void - declare function isTSPropertySignature(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSPropertySignature) - declare function assertTSPropertySignature(node: ?Object, opts?: ?Object): void - declare function isTSMethodSignature(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSMethodSignature) - declare function assertTSMethodSignature(node: ?Object, opts?: ?Object): void - declare function isTSIndexSignature(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSIndexSignature) - declare function assertTSIndexSignature(node: ?Object, opts?: ?Object): void - declare function isTSAnyKeyword(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSAnyKeyword) - declare function assertTSAnyKeyword(node: ?Object, opts?: ?Object): void - declare function isTSBooleanKeyword(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSBooleanKeyword) - declare function assertTSBooleanKeyword(node: ?Object, opts?: ?Object): void - declare function isTSBigIntKeyword(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSBigIntKeyword) - declare function assertTSBigIntKeyword(node: ?Object, opts?: ?Object): void - declare function isTSIntrinsicKeyword(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSIntrinsicKeyword) - declare function assertTSIntrinsicKeyword(node: ?Object, opts?: ?Object): void - declare function isTSNeverKeyword(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSNeverKeyword) - declare function assertTSNeverKeyword(node: ?Object, opts?: ?Object): void - declare function isTSNullKeyword(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSNullKeyword) - declare function assertTSNullKeyword(node: ?Object, opts?: ?Object): void - declare function isTSNumberKeyword(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSNumberKeyword) - declare function assertTSNumberKeyword(node: ?Object, opts?: ?Object): void - declare function isTSObjectKeyword(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSObjectKeyword) - declare function assertTSObjectKeyword(node: ?Object, opts?: ?Object): void - declare function isTSStringKeyword(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSStringKeyword) - declare function assertTSStringKeyword(node: ?Object, opts?: ?Object): void - declare function isTSSymbolKeyword(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSSymbolKeyword) - declare function assertTSSymbolKeyword(node: ?Object, opts?: ?Object): void - declare function isTSUndefinedKeyword(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSUndefinedKeyword) - declare function assertTSUndefinedKeyword(node: ?Object, opts?: ?Object): void - declare function isTSUnknownKeyword(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSUnknownKeyword) - declare function assertTSUnknownKeyword(node: ?Object, opts?: ?Object): void - declare function isTSVoidKeyword(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSVoidKeyword) - declare function assertTSVoidKeyword(node: ?Object, opts?: ?Object): void - declare function isTSThisType(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSThisType) - declare function assertTSThisType(node: ?Object, opts?: ?Object): void - declare function isTSFunctionType(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSFunctionType) - declare function assertTSFunctionType(node: ?Object, opts?: ?Object): void - declare function isTSConstructorType(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSConstructorType) - declare function assertTSConstructorType(node: ?Object, opts?: ?Object): void - declare function isTSTypeReference(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSTypeReference) - declare function assertTSTypeReference(node: ?Object, opts?: ?Object): void - declare function isTSTypePredicate(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSTypePredicate) - declare function assertTSTypePredicate(node: ?Object, opts?: ?Object): void - declare function isTSTypeQuery(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSTypeQuery) - declare function assertTSTypeQuery(node: ?Object, opts?: ?Object): void - declare function isTSTypeLiteral(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSTypeLiteral) - declare function assertTSTypeLiteral(node: ?Object, opts?: ?Object): void - declare function isTSArrayType(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSArrayType) - declare function assertTSArrayType(node: ?Object, opts?: ?Object): void - declare function isTSTupleType(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSTupleType) - declare function assertTSTupleType(node: ?Object, opts?: ?Object): void - declare function isTSOptionalType(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSOptionalType) - declare function assertTSOptionalType(node: ?Object, opts?: ?Object): void - declare function isTSRestType(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSRestType) - declare function assertTSRestType(node: ?Object, opts?: ?Object): void - declare function isTSNamedTupleMember(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSNamedTupleMember) - declare function assertTSNamedTupleMember(node: ?Object, opts?: ?Object): void - declare function isTSUnionType(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSUnionType) - declare function assertTSUnionType(node: ?Object, opts?: ?Object): void - declare function isTSIntersectionType(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSIntersectionType) - declare function assertTSIntersectionType(node: ?Object, opts?: ?Object): void - declare function isTSConditionalType(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSConditionalType) - declare function assertTSConditionalType(node: ?Object, opts?: ?Object): void - declare function isTSInferType(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSInferType) - declare function assertTSInferType(node: ?Object, opts?: ?Object): void - declare function isTSParenthesizedType(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSParenthesizedType) - declare function assertTSParenthesizedType(node: ?Object, opts?: ?Object): void - declare function isTSTypeOperator(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSTypeOperator) - declare function assertTSTypeOperator(node: ?Object, opts?: ?Object): void - declare function isTSIndexedAccessType(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSIndexedAccessType) - declare function assertTSIndexedAccessType(node: ?Object, opts?: ?Object): void - declare function isTSMappedType(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSMappedType) - declare function assertTSMappedType(node: ?Object, opts?: ?Object): void - declare function isTSLiteralType(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSLiteralType) - declare function assertTSLiteralType(node: ?Object, opts?: ?Object): void - declare function isTSExpressionWithTypeArguments(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSExpressionWithTypeArguments) - declare function assertTSExpressionWithTypeArguments(node: ?Object, opts?: ?Object): void - declare function isTSInterfaceDeclaration(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSInterfaceDeclaration) - declare function assertTSInterfaceDeclaration(node: ?Object, opts?: ?Object): void - declare function isTSInterfaceBody(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSInterfaceBody) - declare function assertTSInterfaceBody(node: ?Object, opts?: ?Object): void - declare function isTSTypeAliasDeclaration(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSTypeAliasDeclaration) - declare function assertTSTypeAliasDeclaration(node: ?Object, opts?: ?Object): void - declare function isTSAsExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSAsExpression) - declare function assertTSAsExpression(node: ?Object, opts?: ?Object): void - declare function isTSTypeAssertion(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSTypeAssertion) - declare function assertTSTypeAssertion(node: ?Object, opts?: ?Object): void - declare function isTSEnumDeclaration(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSEnumDeclaration) - declare function assertTSEnumDeclaration(node: ?Object, opts?: ?Object): void - declare function isTSEnumMember(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSEnumMember) - declare function assertTSEnumMember(node: ?Object, opts?: ?Object): void - declare function isTSModuleDeclaration(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSModuleDeclaration) - declare function assertTSModuleDeclaration(node: ?Object, opts?: ?Object): void - declare function isTSModuleBlock(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSModuleBlock) - declare function assertTSModuleBlock(node: ?Object, opts?: ?Object): void - declare function isTSImportType(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSImportType) - declare function assertTSImportType(node: ?Object, opts?: ?Object): void - declare function isTSImportEqualsDeclaration(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSImportEqualsDeclaration) - declare function assertTSImportEqualsDeclaration(node: ?Object, opts?: ?Object): void - declare function isTSExternalModuleReference(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSExternalModuleReference) - declare function assertTSExternalModuleReference(node: ?Object, opts?: ?Object): void - declare function isTSNonNullExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSNonNullExpression) - declare function assertTSNonNullExpression(node: ?Object, opts?: ?Object): void - declare function isTSExportAssignment(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSExportAssignment) - declare function assertTSExportAssignment(node: ?Object, opts?: ?Object): void - declare function isTSNamespaceExportDeclaration(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSNamespaceExportDeclaration) - declare function assertTSNamespaceExportDeclaration(node: ?Object, opts?: ?Object): void - declare function isTSTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSTypeAnnotation) - declare function assertTSTypeAnnotation(node: ?Object, opts?: ?Object): void - declare function isTSTypeParameterInstantiation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSTypeParameterInstantiation) - declare function assertTSTypeParameterInstantiation(node: ?Object, opts?: ?Object): void - declare function isTSTypeParameterDeclaration(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSTypeParameterDeclaration) - declare function assertTSTypeParameterDeclaration(node: ?Object, opts?: ?Object): void - declare function isTSTypeParameter(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSTypeParameter) - declare function assertTSTypeParameter(node: ?Object, opts?: ?Object): void - declare function isExpression(node: ?Object, opts?: ?Object): boolean - declare function assertExpression(node: ?Object, opts?: ?Object): void - declare function isBinary(node: ?Object, opts?: ?Object): boolean - declare function assertBinary(node: ?Object, opts?: ?Object): void - declare function isScopable(node: ?Object, opts?: ?Object): boolean - declare function assertScopable(node: ?Object, opts?: ?Object): void - declare function isBlockParent(node: ?Object, opts?: ?Object): boolean - declare function assertBlockParent(node: ?Object, opts?: ?Object): void - declare function isBlock(node: ?Object, opts?: ?Object): boolean - declare function assertBlock(node: ?Object, opts?: ?Object): void - declare function isStatement(node: ?Object, opts?: ?Object): boolean - declare function assertStatement(node: ?Object, opts?: ?Object): void - declare function isTerminatorless(node: ?Object, opts?: ?Object): boolean - declare function assertTerminatorless(node: ?Object, opts?: ?Object): void - declare function isCompletionStatement(node: ?Object, opts?: ?Object): boolean - declare function assertCompletionStatement(node: ?Object, opts?: ?Object): void - declare function isConditional(node: ?Object, opts?: ?Object): boolean - declare function assertConditional(node: ?Object, opts?: ?Object): void - declare function isLoop(node: ?Object, opts?: ?Object): boolean - declare function assertLoop(node: ?Object, opts?: ?Object): void - declare function isWhile(node: ?Object, opts?: ?Object): boolean - declare function assertWhile(node: ?Object, opts?: ?Object): void - declare function isExpressionWrapper(node: ?Object, opts?: ?Object): boolean - declare function assertExpressionWrapper(node: ?Object, opts?: ?Object): void - declare function isFor(node: ?Object, opts?: ?Object): boolean - declare function assertFor(node: ?Object, opts?: ?Object): void - declare function isForXStatement(node: ?Object, opts?: ?Object): boolean - declare function assertForXStatement(node: ?Object, opts?: ?Object): void - declare function isFunction(node: ?Object, opts?: ?Object): boolean - declare function assertFunction(node: ?Object, opts?: ?Object): void - declare function isFunctionParent(node: ?Object, opts?: ?Object): boolean - declare function assertFunctionParent(node: ?Object, opts?: ?Object): void - declare function isPureish(node: ?Object, opts?: ?Object): boolean - declare function assertPureish(node: ?Object, opts?: ?Object): void - declare function isDeclaration(node: ?Object, opts?: ?Object): boolean - declare function assertDeclaration(node: ?Object, opts?: ?Object): void - declare function isPatternLike(node: ?Object, opts?: ?Object): boolean - declare function assertPatternLike(node: ?Object, opts?: ?Object): void - declare function isLVal(node: ?Object, opts?: ?Object): boolean - declare function assertLVal(node: ?Object, opts?: ?Object): void - declare function isTSEntityName(node: ?Object, opts?: ?Object): boolean - declare function assertTSEntityName(node: ?Object, opts?: ?Object): void - declare function isLiteral(node: ?Object, opts?: ?Object): boolean - declare function assertLiteral(node: ?Object, opts?: ?Object): void - declare function isImmutable(node: ?Object, opts?: ?Object): boolean - declare function assertImmutable(node: ?Object, opts?: ?Object): void - declare function isUserWhitespacable(node: ?Object, opts?: ?Object): boolean - declare function assertUserWhitespacable(node: ?Object, opts?: ?Object): void - declare function isMethod(node: ?Object, opts?: ?Object): boolean - declare function assertMethod(node: ?Object, opts?: ?Object): void - declare function isObjectMember(node: ?Object, opts?: ?Object): boolean - declare function assertObjectMember(node: ?Object, opts?: ?Object): void - declare function isProperty(node: ?Object, opts?: ?Object): boolean - declare function assertProperty(node: ?Object, opts?: ?Object): void - declare function isUnaryLike(node: ?Object, opts?: ?Object): boolean - declare function assertUnaryLike(node: ?Object, opts?: ?Object): void - declare function isPattern(node: ?Object, opts?: ?Object): boolean - declare function assertPattern(node: ?Object, opts?: ?Object): void - declare function isClass(node: ?Object, opts?: ?Object): boolean - declare function assertClass(node: ?Object, opts?: ?Object): void - declare function isModuleDeclaration(node: ?Object, opts?: ?Object): boolean - declare function assertModuleDeclaration(node: ?Object, opts?: ?Object): void - declare function isExportDeclaration(node: ?Object, opts?: ?Object): boolean - declare function assertExportDeclaration(node: ?Object, opts?: ?Object): void - declare function isModuleSpecifier(node: ?Object, opts?: ?Object): boolean - declare function assertModuleSpecifier(node: ?Object, opts?: ?Object): void - declare function isFlow(node: ?Object, opts?: ?Object): boolean - declare function assertFlow(node: ?Object, opts?: ?Object): void - declare function isFlowType(node: ?Object, opts?: ?Object): boolean - declare function assertFlowType(node: ?Object, opts?: ?Object): void - declare function isFlowBaseAnnotation(node: ?Object, opts?: ?Object): boolean - declare function assertFlowBaseAnnotation(node: ?Object, opts?: ?Object): void - declare function isFlowDeclaration(node: ?Object, opts?: ?Object): boolean - declare function assertFlowDeclaration(node: ?Object, opts?: ?Object): void - declare function isFlowPredicate(node: ?Object, opts?: ?Object): boolean - declare function assertFlowPredicate(node: ?Object, opts?: ?Object): void - declare function isEnumBody(node: ?Object, opts?: ?Object): boolean - declare function assertEnumBody(node: ?Object, opts?: ?Object): void - declare function isEnumMember(node: ?Object, opts?: ?Object): boolean - declare function assertEnumMember(node: ?Object, opts?: ?Object): void - declare function isJSX(node: ?Object, opts?: ?Object): boolean - declare function assertJSX(node: ?Object, opts?: ?Object): void - declare function isPrivate(node: ?Object, opts?: ?Object): boolean - declare function assertPrivate(node: ?Object, opts?: ?Object): void - declare function isTSTypeElement(node: ?Object, opts?: ?Object): boolean - declare function assertTSTypeElement(node: ?Object, opts?: ?Object): void - declare function isTSType(node: ?Object, opts?: ?Object): boolean - declare function assertTSType(node: ?Object, opts?: ?Object): void - declare function isTSBaseType(node: ?Object, opts?: ?Object): boolean - declare function assertTSBaseType(node: ?Object, opts?: ?Object): void - declare function isNumberLiteral(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeNumericLiteral) - declare function assertNumberLiteral(node: ?Object, opts?: ?Object): void - declare function isRegexLiteral(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeRegExpLiteral) - declare function assertRegexLiteral(node: ?Object, opts?: ?Object): void - declare function isRestProperty(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeRestElement) - declare function assertRestProperty(node: ?Object, opts?: ?Object): void - declare function isSpreadProperty(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeSpreadElement) - declare function assertSpreadProperty(node: ?Object, opts?: ?Object): void - declare function assertNode(obj: any): void - declare function createTypeAnnotationBasedOnTypeof(type: 'string' | 'number' | 'undefined' | 'boolean' | 'function' | 'object' | 'symbol'): BabelNodeTypeAnnotation - declare function createUnionTypeAnnotation(types: Array<BabelNodeFlowType>): BabelNodeUnionTypeAnnotation - declare function createFlowUnionType(types: Array<BabelNodeFlowType>): BabelNodeUnionTypeAnnotation - declare function buildChildren(node: { children: Array<BabelNodeJSXText | BabelNodeJSXExpressionContainer | BabelNodeJSXSpreadChild | BabelNodeJSXElement | BabelNodeJSXFragment | BabelNodeJSXEmptyExpression> }): Array<BabelNodeJSXText | BabelNodeJSXExpressionContainer | BabelNodeJSXSpreadChild | BabelNodeJSXElement | BabelNodeJSXFragment> - declare function clone<T>(n: T): T; - declare function cloneDeep<T>(n: T): T; - declare function cloneDeepWithoutLoc<T>(n: T): T; - declare function cloneNode<T>(n: T, deep?: boolean, withoutLoc?: boolean): T; - declare function cloneWithoutLoc<T>(n: T): T; + declare export function bigIntLiteral(value: string): BabelNodeBigIntLiteral; + declare export function exportNamespaceSpecifier(exported: BabelNodeIdentifier): BabelNodeExportNamespaceSpecifier; + declare export function optionalMemberExpression(object: BabelNodeExpression, property: BabelNodeExpression | BabelNodeIdentifier, computed?: boolean, optional: boolean): BabelNodeOptionalMemberExpression; + declare export function optionalCallExpression(callee: BabelNodeExpression, _arguments: Array<BabelNodeExpression | BabelNodeSpreadElement | BabelNodeJSXNamespacedName | BabelNodeArgumentPlaceholder>, optional: boolean): BabelNodeOptionalCallExpression; + declare export function anyTypeAnnotation(): BabelNodeAnyTypeAnnotation; + declare export function arrayTypeAnnotation(elementType: BabelNodeFlowType): BabelNodeArrayTypeAnnotation; + declare export function booleanTypeAnnotation(): BabelNodeBooleanTypeAnnotation; + declare export function booleanLiteralTypeAnnotation(value: boolean): BabelNodeBooleanLiteralTypeAnnotation; + declare export function nullLiteralTypeAnnotation(): BabelNodeNullLiteralTypeAnnotation; + declare export function classImplements(id: BabelNodeIdentifier, typeParameters?: BabelNodeTypeParameterInstantiation): BabelNodeClassImplements; + declare export function declareClass(id: BabelNodeIdentifier, typeParameters?: BabelNodeTypeParameterDeclaration, _extends?: Array<BabelNodeInterfaceExtends>, body: BabelNodeObjectTypeAnnotation): BabelNodeDeclareClass; + declare export function declareFunction(id: BabelNodeIdentifier): BabelNodeDeclareFunction; + declare export function declareInterface(id: BabelNodeIdentifier, typeParameters?: BabelNodeTypeParameterDeclaration, _extends?: Array<BabelNodeInterfaceExtends>, body: BabelNodeObjectTypeAnnotation): BabelNodeDeclareInterface; + declare export function declareModule(id: BabelNodeIdentifier | BabelNodeStringLiteral, body: BabelNodeBlockStatement, kind?: "CommonJS" | "ES"): BabelNodeDeclareModule; + declare export function declareModuleExports(typeAnnotation: BabelNodeTypeAnnotation): BabelNodeDeclareModuleExports; + declare export function declareTypeAlias(id: BabelNodeIdentifier, typeParameters?: BabelNodeTypeParameterDeclaration, right: BabelNodeFlowType): BabelNodeDeclareTypeAlias; + declare export function declareOpaqueType(id: BabelNodeIdentifier, typeParameters?: BabelNodeTypeParameterDeclaration, supertype?: BabelNodeFlowType): BabelNodeDeclareOpaqueType; + declare export function declareVariable(id: BabelNodeIdentifier): BabelNodeDeclareVariable; + declare export function declareExportDeclaration(declaration?: BabelNodeFlow, specifiers?: Array<BabelNodeExportSpecifier | BabelNodeExportNamespaceSpecifier>, source?: BabelNodeStringLiteral): BabelNodeDeclareExportDeclaration; + declare export function declareExportAllDeclaration(source: BabelNodeStringLiteral): BabelNodeDeclareExportAllDeclaration; + declare export function declaredPredicate(value: BabelNodeFlow): BabelNodeDeclaredPredicate; + declare export function existsTypeAnnotation(): BabelNodeExistsTypeAnnotation; + declare export function functionTypeAnnotation(typeParameters?: BabelNodeTypeParameterDeclaration, params: Array<BabelNodeFunctionTypeParam>, rest?: BabelNodeFunctionTypeParam, returnType: BabelNodeFlowType): BabelNodeFunctionTypeAnnotation; + declare export function functionTypeParam(name?: BabelNodeIdentifier, typeAnnotation: BabelNodeFlowType): BabelNodeFunctionTypeParam; + declare export function genericTypeAnnotation(id: BabelNodeIdentifier | BabelNodeQualifiedTypeIdentifier, typeParameters?: BabelNodeTypeParameterInstantiation): BabelNodeGenericTypeAnnotation; + declare export function inferredPredicate(): BabelNodeInferredPredicate; + declare export function interfaceExtends(id: BabelNodeIdentifier | BabelNodeQualifiedTypeIdentifier, typeParameters?: BabelNodeTypeParameterInstantiation): BabelNodeInterfaceExtends; + declare export function interfaceDeclaration(id: BabelNodeIdentifier, typeParameters?: BabelNodeTypeParameterDeclaration, _extends?: Array<BabelNodeInterfaceExtends>, body: BabelNodeObjectTypeAnnotation): BabelNodeInterfaceDeclaration; + declare export function interfaceTypeAnnotation(_extends?: Array<BabelNodeInterfaceExtends>, body: BabelNodeObjectTypeAnnotation): BabelNodeInterfaceTypeAnnotation; + declare export function intersectionTypeAnnotation(types: Array<BabelNodeFlowType>): BabelNodeIntersectionTypeAnnotation; + declare export function mixedTypeAnnotation(): BabelNodeMixedTypeAnnotation; + declare export function emptyTypeAnnotation(): BabelNodeEmptyTypeAnnotation; + declare export function nullableTypeAnnotation(typeAnnotation: BabelNodeFlowType): BabelNodeNullableTypeAnnotation; + declare export function numberLiteralTypeAnnotation(value: number): BabelNodeNumberLiteralTypeAnnotation; + declare export function numberTypeAnnotation(): BabelNodeNumberTypeAnnotation; + declare export function objectTypeAnnotation(properties: Array<BabelNodeObjectTypeProperty | BabelNodeObjectTypeSpreadProperty>, indexers?: Array<BabelNodeObjectTypeIndexer>, callProperties?: Array<BabelNodeObjectTypeCallProperty>, internalSlots?: Array<BabelNodeObjectTypeInternalSlot>, exact?: boolean): BabelNodeObjectTypeAnnotation; + declare export function objectTypeInternalSlot(id: BabelNodeIdentifier, value: BabelNodeFlowType, optional: boolean, _static: boolean, method: boolean): BabelNodeObjectTypeInternalSlot; + declare export function objectTypeCallProperty(value: BabelNodeFlowType): BabelNodeObjectTypeCallProperty; + declare export function objectTypeIndexer(id?: BabelNodeIdentifier, key: BabelNodeFlowType, value: BabelNodeFlowType, variance?: BabelNodeVariance): BabelNodeObjectTypeIndexer; + declare export function objectTypeProperty(key: BabelNodeIdentifier | BabelNodeStringLiteral, value: BabelNodeFlowType, variance?: BabelNodeVariance): BabelNodeObjectTypeProperty; + declare export function objectTypeSpreadProperty(argument: BabelNodeFlowType): BabelNodeObjectTypeSpreadProperty; + declare export function opaqueType(id: BabelNodeIdentifier, typeParameters?: BabelNodeTypeParameterDeclaration, supertype?: BabelNodeFlowType, impltype: BabelNodeFlowType): BabelNodeOpaqueType; + declare export function qualifiedTypeIdentifier(id: BabelNodeIdentifier, qualification: BabelNodeIdentifier | BabelNodeQualifiedTypeIdentifier): BabelNodeQualifiedTypeIdentifier; + declare export function stringLiteralTypeAnnotation(value: string): BabelNodeStringLiteralTypeAnnotation; + declare export function stringTypeAnnotation(): BabelNodeStringTypeAnnotation; + declare export function symbolTypeAnnotation(): BabelNodeSymbolTypeAnnotation; + declare export function thisTypeAnnotation(): BabelNodeThisTypeAnnotation; + declare export function tupleTypeAnnotation(types: Array<BabelNodeFlowType>): BabelNodeTupleTypeAnnotation; + declare export function typeofTypeAnnotation(argument: BabelNodeFlowType): BabelNodeTypeofTypeAnnotation; + declare export function typeAlias(id: BabelNodeIdentifier, typeParameters?: BabelNodeTypeParameterDeclaration, right: BabelNodeFlowType): BabelNodeTypeAlias; + declare export function typeAnnotation(typeAnnotation: BabelNodeFlowType): BabelNodeTypeAnnotation; + declare export function typeCastExpression(expression: BabelNodeExpression, typeAnnotation: BabelNodeTypeAnnotation): BabelNodeTypeCastExpression; + declare export function typeParameter(bound?: BabelNodeTypeAnnotation, _default?: BabelNodeFlowType, variance?: BabelNodeVariance): BabelNodeTypeParameter; + declare export function typeParameterDeclaration(params: Array<BabelNodeTypeParameter>): BabelNodeTypeParameterDeclaration; + declare export function typeParameterInstantiation(params: Array<BabelNodeFlowType>): BabelNodeTypeParameterInstantiation; + declare export function unionTypeAnnotation(types: Array<BabelNodeFlowType>): BabelNodeUnionTypeAnnotation; + declare export function variance(kind: "minus" | "plus"): BabelNodeVariance; + declare export function voidTypeAnnotation(): BabelNodeVoidTypeAnnotation; + declare export function enumDeclaration(id: BabelNodeIdentifier, body: BabelNodeEnumBooleanBody | BabelNodeEnumNumberBody | BabelNodeEnumStringBody | BabelNodeEnumSymbolBody): BabelNodeEnumDeclaration; + declare export function enumBooleanBody(members: Array<BabelNodeEnumBooleanMember>): BabelNodeEnumBooleanBody; + declare export function enumNumberBody(members: Array<BabelNodeEnumNumberMember>): BabelNodeEnumNumberBody; + declare export function enumStringBody(members: Array<BabelNodeEnumStringMember | BabelNodeEnumDefaultedMember>): BabelNodeEnumStringBody; + declare export function enumSymbolBody(members: Array<BabelNodeEnumDefaultedMember>): BabelNodeEnumSymbolBody; + declare export function enumBooleanMember(id: BabelNodeIdentifier): BabelNodeEnumBooleanMember; + declare export function enumNumberMember(id: BabelNodeIdentifier, init: BabelNodeNumericLiteral): BabelNodeEnumNumberMember; + declare export function enumStringMember(id: BabelNodeIdentifier, init: BabelNodeStringLiteral): BabelNodeEnumStringMember; + declare export function enumDefaultedMember(id: BabelNodeIdentifier): BabelNodeEnumDefaultedMember; + declare export function jsxAttribute(name: BabelNodeJSXIdentifier | BabelNodeJSXNamespacedName, value?: BabelNodeJSXElement | BabelNodeJSXFragment | BabelNodeStringLiteral | BabelNodeJSXExpressionContainer): BabelNodeJSXAttribute; + declare export function jsxClosingElement(name: BabelNodeJSXIdentifier | BabelNodeJSXMemberExpression | BabelNodeJSXNamespacedName): BabelNodeJSXClosingElement; + declare export function jsxElement(openingElement: BabelNodeJSXOpeningElement, closingElement?: BabelNodeJSXClosingElement, children: Array<BabelNodeJSXText | BabelNodeJSXExpressionContainer | BabelNodeJSXSpreadChild | BabelNodeJSXElement | BabelNodeJSXFragment>, selfClosing?: boolean): BabelNodeJSXElement; + declare export function jsxEmptyExpression(): BabelNodeJSXEmptyExpression; + declare export function jsxExpressionContainer(expression: BabelNodeExpression | BabelNodeJSXEmptyExpression): BabelNodeJSXExpressionContainer; + declare export function jsxSpreadChild(expression: BabelNodeExpression): BabelNodeJSXSpreadChild; + declare export function jsxIdentifier(name: string): BabelNodeJSXIdentifier; + declare export function jsxMemberExpression(object: BabelNodeJSXMemberExpression | BabelNodeJSXIdentifier, property: BabelNodeJSXIdentifier): BabelNodeJSXMemberExpression; + declare export function jsxNamespacedName(namespace: BabelNodeJSXIdentifier, name: BabelNodeJSXIdentifier): BabelNodeJSXNamespacedName; + declare export function jsxOpeningElement(name: BabelNodeJSXIdentifier | BabelNodeJSXMemberExpression | BabelNodeJSXNamespacedName, attributes: Array<BabelNodeJSXAttribute | BabelNodeJSXSpreadAttribute>, selfClosing?: boolean): BabelNodeJSXOpeningElement; + declare export function jsxSpreadAttribute(argument: BabelNodeExpression): BabelNodeJSXSpreadAttribute; + declare export function jsxText(value: string): BabelNodeJSXText; + declare export function jsxFragment(openingFragment: BabelNodeJSXOpeningFragment, closingFragment: BabelNodeJSXClosingFragment, children: Array<BabelNodeJSXText | BabelNodeJSXExpressionContainer | BabelNodeJSXSpreadChild | BabelNodeJSXElement | BabelNodeJSXFragment>): BabelNodeJSXFragment; + declare export function jsxOpeningFragment(): BabelNodeJSXOpeningFragment; + declare export function jsxClosingFragment(): BabelNodeJSXClosingFragment; + declare export function noop(): BabelNodeNoop; + declare export function placeholder(expectedNode: "Identifier" | "StringLiteral" | "Expression" | "Statement" | "Declaration" | "BlockStatement" | "ClassBody" | "Pattern", name: BabelNodeIdentifier): BabelNodePlaceholder; + declare export function v8IntrinsicIdentifier(name: string): BabelNodeV8IntrinsicIdentifier; + declare export function argumentPlaceholder(): BabelNodeArgumentPlaceholder; + declare export function bindExpression(object: BabelNodeExpression, callee: BabelNodeExpression): BabelNodeBindExpression; + declare export function classProperty(key: BabelNodeIdentifier | BabelNodeStringLiteral | BabelNodeNumericLiteral | BabelNodeExpression, value?: BabelNodeExpression, typeAnnotation?: BabelNodeTypeAnnotation | BabelNodeTSTypeAnnotation | BabelNodeNoop, decorators?: Array<BabelNodeDecorator>, computed?: boolean, _static?: boolean): BabelNodeClassProperty; + declare export function pipelineTopicExpression(expression: BabelNodeExpression): BabelNodePipelineTopicExpression; + declare export function pipelineBareFunction(callee: BabelNodeExpression): BabelNodePipelineBareFunction; + declare export function pipelinePrimaryTopicReference(): BabelNodePipelinePrimaryTopicReference; + declare export function classPrivateProperty(key: BabelNodePrivateName, value?: BabelNodeExpression, decorators?: Array<BabelNodeDecorator>, _static: any): BabelNodeClassPrivateProperty; + declare export function classPrivateMethod(kind?: "get" | "set" | "method" | "constructor", key: BabelNodePrivateName, params: Array<BabelNodeIdentifier | BabelNodePattern | BabelNodeRestElement | BabelNodeTSParameterProperty>, body: BabelNodeBlockStatement, _static?: boolean): BabelNodeClassPrivateMethod; + declare export function importAttribute(key: BabelNodeIdentifier | BabelNodeStringLiteral, value: BabelNodeStringLiteral): BabelNodeImportAttribute; + declare export function decorator(expression: BabelNodeExpression): BabelNodeDecorator; + declare export function doExpression(body: BabelNodeBlockStatement): BabelNodeDoExpression; + declare export function exportDefaultSpecifier(exported: BabelNodeIdentifier): BabelNodeExportDefaultSpecifier; + declare export function privateName(id: BabelNodeIdentifier): BabelNodePrivateName; + declare export function recordExpression(properties: Array<BabelNodeObjectProperty | BabelNodeSpreadElement>): BabelNodeRecordExpression; + declare export function tupleExpression(elements?: Array<BabelNodeExpression | BabelNodeSpreadElement>): BabelNodeTupleExpression; + declare export function decimalLiteral(value: string): BabelNodeDecimalLiteral; + declare export function staticBlock(body: Array<BabelNodeStatement>): BabelNodeStaticBlock; + declare export function tsParameterProperty(parameter: BabelNodeIdentifier | BabelNodeAssignmentPattern): BabelNodeTSParameterProperty; + declare export function tsDeclareFunction(id?: BabelNodeIdentifier, typeParameters?: BabelNodeTSTypeParameterDeclaration | BabelNodeNoop, params: Array<BabelNodeIdentifier | BabelNodePattern | BabelNodeRestElement | BabelNodeTSParameterProperty>, returnType?: BabelNodeTSTypeAnnotation | BabelNodeNoop): BabelNodeTSDeclareFunction; + declare export function tsDeclareMethod(decorators?: Array<BabelNodeDecorator>, key: BabelNodeIdentifier | BabelNodeStringLiteral | BabelNodeNumericLiteral | BabelNodeExpression, typeParameters?: BabelNodeTSTypeParameterDeclaration | BabelNodeNoop, params: Array<BabelNodeIdentifier | BabelNodePattern | BabelNodeRestElement | BabelNodeTSParameterProperty>, returnType?: BabelNodeTSTypeAnnotation | BabelNodeNoop): BabelNodeTSDeclareMethod; + declare export function tsQualifiedName(left: BabelNodeTSEntityName, right: BabelNodeIdentifier): BabelNodeTSQualifiedName; + declare export function tsCallSignatureDeclaration(typeParameters?: BabelNodeTSTypeParameterDeclaration, parameters: Array<BabelNodeIdentifier | BabelNodeRestElement>, typeAnnotation?: BabelNodeTSTypeAnnotation): BabelNodeTSCallSignatureDeclaration; + declare export function tsConstructSignatureDeclaration(typeParameters?: BabelNodeTSTypeParameterDeclaration, parameters: Array<BabelNodeIdentifier | BabelNodeRestElement>, typeAnnotation?: BabelNodeTSTypeAnnotation): BabelNodeTSConstructSignatureDeclaration; + declare export function tsPropertySignature(key: BabelNodeExpression, typeAnnotation?: BabelNodeTSTypeAnnotation, initializer?: BabelNodeExpression): BabelNodeTSPropertySignature; + declare export function tsMethodSignature(key: BabelNodeExpression, typeParameters?: BabelNodeTSTypeParameterDeclaration, parameters: Array<BabelNodeIdentifier | BabelNodeRestElement>, typeAnnotation?: BabelNodeTSTypeAnnotation): BabelNodeTSMethodSignature; + declare export function tsIndexSignature(parameters: Array<BabelNodeIdentifier>, typeAnnotation?: BabelNodeTSTypeAnnotation): BabelNodeTSIndexSignature; + declare export function tsAnyKeyword(): BabelNodeTSAnyKeyword; + declare export function tsBooleanKeyword(): BabelNodeTSBooleanKeyword; + declare export function tsBigIntKeyword(): BabelNodeTSBigIntKeyword; + declare export function tsIntrinsicKeyword(): BabelNodeTSIntrinsicKeyword; + declare export function tsNeverKeyword(): BabelNodeTSNeverKeyword; + declare export function tsNullKeyword(): BabelNodeTSNullKeyword; + declare export function tsNumberKeyword(): BabelNodeTSNumberKeyword; + declare export function tsObjectKeyword(): BabelNodeTSObjectKeyword; + declare export function tsStringKeyword(): BabelNodeTSStringKeyword; + declare export function tsSymbolKeyword(): BabelNodeTSSymbolKeyword; + declare export function tsUndefinedKeyword(): BabelNodeTSUndefinedKeyword; + declare export function tsUnknownKeyword(): BabelNodeTSUnknownKeyword; + declare export function tsVoidKeyword(): BabelNodeTSVoidKeyword; + declare export function tsThisType(): BabelNodeTSThisType; + declare export function tsFunctionType(typeParameters?: BabelNodeTSTypeParameterDeclaration, parameters: Array<BabelNodeIdentifier | BabelNodeRestElement>, typeAnnotation?: BabelNodeTSTypeAnnotation): BabelNodeTSFunctionType; + declare export function tsConstructorType(typeParameters?: BabelNodeTSTypeParameterDeclaration, parameters: Array<BabelNodeIdentifier | BabelNodeRestElement>, typeAnnotation?: BabelNodeTSTypeAnnotation): BabelNodeTSConstructorType; + declare export function tsTypeReference(typeName: BabelNodeTSEntityName, typeParameters?: BabelNodeTSTypeParameterInstantiation): BabelNodeTSTypeReference; + declare export function tsTypePredicate(parameterName: BabelNodeIdentifier | BabelNodeTSThisType, typeAnnotation?: BabelNodeTSTypeAnnotation, asserts?: boolean): BabelNodeTSTypePredicate; + declare export function tsTypeQuery(exprName: BabelNodeTSEntityName | BabelNodeTSImportType): BabelNodeTSTypeQuery; + declare export function tsTypeLiteral(members: Array<BabelNodeTSTypeElement>): BabelNodeTSTypeLiteral; + declare export function tsArrayType(elementType: BabelNodeTSType): BabelNodeTSArrayType; + declare export function tsTupleType(elementTypes: Array<BabelNodeTSType | BabelNodeTSNamedTupleMember>): BabelNodeTSTupleType; + declare export function tsOptionalType(typeAnnotation: BabelNodeTSType): BabelNodeTSOptionalType; + declare export function tsRestType(typeAnnotation: BabelNodeTSType): BabelNodeTSRestType; + declare export function tsNamedTupleMember(label: BabelNodeIdentifier, elementType: BabelNodeTSType, optional?: boolean): BabelNodeTSNamedTupleMember; + declare export function tsUnionType(types: Array<BabelNodeTSType>): BabelNodeTSUnionType; + declare export function tsIntersectionType(types: Array<BabelNodeTSType>): BabelNodeTSIntersectionType; + declare export function tsConditionalType(checkType: BabelNodeTSType, extendsType: BabelNodeTSType, trueType: BabelNodeTSType, falseType: BabelNodeTSType): BabelNodeTSConditionalType; + declare export function tsInferType(typeParameter: BabelNodeTSTypeParameter): BabelNodeTSInferType; + declare export function tsParenthesizedType(typeAnnotation: BabelNodeTSType): BabelNodeTSParenthesizedType; + declare export function tsTypeOperator(typeAnnotation: BabelNodeTSType): BabelNodeTSTypeOperator; + declare export function tsIndexedAccessType(objectType: BabelNodeTSType, indexType: BabelNodeTSType): BabelNodeTSIndexedAccessType; + declare export function tsMappedType(typeParameter: BabelNodeTSTypeParameter, typeAnnotation?: BabelNodeTSType, nameType?: BabelNodeTSType): BabelNodeTSMappedType; + declare export function tsLiteralType(literal: BabelNodeNumericLiteral | BabelNodeStringLiteral | BabelNodeBooleanLiteral | BabelNodeBigIntLiteral): BabelNodeTSLiteralType; + declare export function tsExpressionWithTypeArguments(expression: BabelNodeTSEntityName, typeParameters?: BabelNodeTSTypeParameterInstantiation): BabelNodeTSExpressionWithTypeArguments; + declare export function tsInterfaceDeclaration(id: BabelNodeIdentifier, typeParameters?: BabelNodeTSTypeParameterDeclaration, _extends?: Array<BabelNodeTSExpressionWithTypeArguments>, body: BabelNodeTSInterfaceBody): BabelNodeTSInterfaceDeclaration; + declare export function tsInterfaceBody(body: Array<BabelNodeTSTypeElement>): BabelNodeTSInterfaceBody; + declare export function tsTypeAliasDeclaration(id: BabelNodeIdentifier, typeParameters?: BabelNodeTSTypeParameterDeclaration, typeAnnotation: BabelNodeTSType): BabelNodeTSTypeAliasDeclaration; + declare export function tsAsExpression(expression: BabelNodeExpression, typeAnnotation: BabelNodeTSType): BabelNodeTSAsExpression; + declare export function tsTypeAssertion(typeAnnotation: BabelNodeTSType, expression: BabelNodeExpression): BabelNodeTSTypeAssertion; + declare export function tsEnumDeclaration(id: BabelNodeIdentifier, members: Array<BabelNodeTSEnumMember>): BabelNodeTSEnumDeclaration; + declare export function tsEnumMember(id: BabelNodeIdentifier | BabelNodeStringLiteral, initializer?: BabelNodeExpression): BabelNodeTSEnumMember; + declare export function tsModuleDeclaration(id: BabelNodeIdentifier | BabelNodeStringLiteral, body: BabelNodeTSModuleBlock | BabelNodeTSModuleDeclaration): BabelNodeTSModuleDeclaration; + declare export function tsModuleBlock(body: Array<BabelNodeStatement>): BabelNodeTSModuleBlock; + declare export function tsImportType(argument: BabelNodeStringLiteral, qualifier?: BabelNodeTSEntityName, typeParameters?: BabelNodeTSTypeParameterInstantiation): BabelNodeTSImportType; + declare export function tsImportEqualsDeclaration(id: BabelNodeIdentifier, moduleReference: BabelNodeTSEntityName | BabelNodeTSExternalModuleReference): BabelNodeTSImportEqualsDeclaration; + declare export function tsExternalModuleReference(expression: BabelNodeStringLiteral): BabelNodeTSExternalModuleReference; + declare export function tsNonNullExpression(expression: BabelNodeExpression): BabelNodeTSNonNullExpression; + declare export function tsExportAssignment(expression: BabelNodeExpression): BabelNodeTSExportAssignment; + declare export function tsNamespaceExportDeclaration(id: BabelNodeIdentifier): BabelNodeTSNamespaceExportDeclaration; + declare export function tsTypeAnnotation(typeAnnotation: BabelNodeTSType): BabelNodeTSTypeAnnotation; + declare export function tsTypeParameterInstantiation(params: Array<BabelNodeTSType>): BabelNodeTSTypeParameterInstantiation; + declare export function tsTypeParameterDeclaration(params: Array<BabelNodeTSTypeParameter>): BabelNodeTSTypeParameterDeclaration; + declare export function tsTypeParameter(constraint?: BabelNodeTSType, _default?: BabelNodeTSType, name: string): BabelNodeTSTypeParameter; + declare export function isArrayExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeArrayExpression) + declare export function assertArrayExpression(node: ?Object, opts?: ?Object): void + declare export function isAssignmentExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeAssignmentExpression) + declare export function assertAssignmentExpression(node: ?Object, opts?: ?Object): void + declare export function isBinaryExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeBinaryExpression) + declare export function assertBinaryExpression(node: ?Object, opts?: ?Object): void + declare export function isInterpreterDirective(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeInterpreterDirective) + declare export function assertInterpreterDirective(node: ?Object, opts?: ?Object): void + declare export function isDirective(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeDirective) + declare export function assertDirective(node: ?Object, opts?: ?Object): void + declare export function isDirectiveLiteral(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeDirectiveLiteral) + declare export function assertDirectiveLiteral(node: ?Object, opts?: ?Object): void + declare export function isBlockStatement(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeBlockStatement) + declare export function assertBlockStatement(node: ?Object, opts?: ?Object): void + declare export function isBreakStatement(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeBreakStatement) + declare export function assertBreakStatement(node: ?Object, opts?: ?Object): void + declare export function isCallExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeCallExpression) + declare export function assertCallExpression(node: ?Object, opts?: ?Object): void + declare export function isCatchClause(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeCatchClause) + declare export function assertCatchClause(node: ?Object, opts?: ?Object): void + declare export function isConditionalExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeConditionalExpression) + declare export function assertConditionalExpression(node: ?Object, opts?: ?Object): void + declare export function isContinueStatement(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeContinueStatement) + declare export function assertContinueStatement(node: ?Object, opts?: ?Object): void + declare export function isDebuggerStatement(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeDebuggerStatement) + declare export function assertDebuggerStatement(node: ?Object, opts?: ?Object): void + declare export function isDoWhileStatement(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeDoWhileStatement) + declare export function assertDoWhileStatement(node: ?Object, opts?: ?Object): void + declare export function isEmptyStatement(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeEmptyStatement) + declare export function assertEmptyStatement(node: ?Object, opts?: ?Object): void + declare export function isExpressionStatement(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeExpressionStatement) + declare export function assertExpressionStatement(node: ?Object, opts?: ?Object): void + declare export function isFile(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeFile) + declare export function assertFile(node: ?Object, opts?: ?Object): void + declare export function isForInStatement(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeForInStatement) + declare export function assertForInStatement(node: ?Object, opts?: ?Object): void + declare export function isForStatement(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeForStatement) + declare export function assertForStatement(node: ?Object, opts?: ?Object): void + declare export function isFunctionDeclaration(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeFunctionDeclaration) + declare export function assertFunctionDeclaration(node: ?Object, opts?: ?Object): void + declare export function isFunctionExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeFunctionExpression) + declare export function assertFunctionExpression(node: ?Object, opts?: ?Object): void + declare export function isIdentifier(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeIdentifier) + declare export function assertIdentifier(node: ?Object, opts?: ?Object): void + declare export function isIfStatement(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeIfStatement) + declare export function assertIfStatement(node: ?Object, opts?: ?Object): void + declare export function isLabeledStatement(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeLabeledStatement) + declare export function assertLabeledStatement(node: ?Object, opts?: ?Object): void + declare export function isStringLiteral(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeStringLiteral) + declare export function assertStringLiteral(node: ?Object, opts?: ?Object): void + declare export function isNumericLiteral(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeNumericLiteral) + declare export function assertNumericLiteral(node: ?Object, opts?: ?Object): void + declare export function isNullLiteral(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeNullLiteral) + declare export function assertNullLiteral(node: ?Object, opts?: ?Object): void + declare export function isBooleanLiteral(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeBooleanLiteral) + declare export function assertBooleanLiteral(node: ?Object, opts?: ?Object): void + declare export function isRegExpLiteral(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeRegExpLiteral) + declare export function assertRegExpLiteral(node: ?Object, opts?: ?Object): void + declare export function isLogicalExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeLogicalExpression) + declare export function assertLogicalExpression(node: ?Object, opts?: ?Object): void + declare export function isMemberExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeMemberExpression) + declare export function assertMemberExpression(node: ?Object, opts?: ?Object): void + declare export function isNewExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeNewExpression) + declare export function assertNewExpression(node: ?Object, opts?: ?Object): void + declare export function isProgram(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeProgram) + declare export function assertProgram(node: ?Object, opts?: ?Object): void + declare export function isObjectExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeObjectExpression) + declare export function assertObjectExpression(node: ?Object, opts?: ?Object): void + declare export function isObjectMethod(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeObjectMethod) + declare export function assertObjectMethod(node: ?Object, opts?: ?Object): void + declare export function isObjectProperty(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeObjectProperty) + declare export function assertObjectProperty(node: ?Object, opts?: ?Object): void + declare export function isRestElement(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeRestElement) + declare export function assertRestElement(node: ?Object, opts?: ?Object): void + declare export function isReturnStatement(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeReturnStatement) + declare export function assertReturnStatement(node: ?Object, opts?: ?Object): void + declare export function isSequenceExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeSequenceExpression) + declare export function assertSequenceExpression(node: ?Object, opts?: ?Object): void + declare export function isParenthesizedExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeParenthesizedExpression) + declare export function assertParenthesizedExpression(node: ?Object, opts?: ?Object): void + declare export function isSwitchCase(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeSwitchCase) + declare export function assertSwitchCase(node: ?Object, opts?: ?Object): void + declare export function isSwitchStatement(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeSwitchStatement) + declare export function assertSwitchStatement(node: ?Object, opts?: ?Object): void + declare export function isThisExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeThisExpression) + declare export function assertThisExpression(node: ?Object, opts?: ?Object): void + declare export function isThrowStatement(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeThrowStatement) + declare export function assertThrowStatement(node: ?Object, opts?: ?Object): void + declare export function isTryStatement(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTryStatement) + declare export function assertTryStatement(node: ?Object, opts?: ?Object): void + declare export function isUnaryExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeUnaryExpression) + declare export function assertUnaryExpression(node: ?Object, opts?: ?Object): void + declare export function isUpdateExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeUpdateExpression) + declare export function assertUpdateExpression(node: ?Object, opts?: ?Object): void + declare export function isVariableDeclaration(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeVariableDeclaration) + declare export function assertVariableDeclaration(node: ?Object, opts?: ?Object): void + declare export function isVariableDeclarator(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeVariableDeclarator) + declare export function assertVariableDeclarator(node: ?Object, opts?: ?Object): void + declare export function isWhileStatement(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeWhileStatement) + declare export function assertWhileStatement(node: ?Object, opts?: ?Object): void + declare export function isWithStatement(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeWithStatement) + declare export function assertWithStatement(node: ?Object, opts?: ?Object): void + declare export function isAssignmentPattern(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeAssignmentPattern) + declare export function assertAssignmentPattern(node: ?Object, opts?: ?Object): void + declare export function isArrayPattern(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeArrayPattern) + declare export function assertArrayPattern(node: ?Object, opts?: ?Object): void + declare export function isArrowFunctionExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeArrowFunctionExpression) + declare export function assertArrowFunctionExpression(node: ?Object, opts?: ?Object): void + declare export function isClassBody(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeClassBody) + declare export function assertClassBody(node: ?Object, opts?: ?Object): void + declare export function isClassExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeClassExpression) + declare export function assertClassExpression(node: ?Object, opts?: ?Object): void + declare export function isClassDeclaration(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeClassDeclaration) + declare export function assertClassDeclaration(node: ?Object, opts?: ?Object): void + declare export function isExportAllDeclaration(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeExportAllDeclaration) + declare export function assertExportAllDeclaration(node: ?Object, opts?: ?Object): void + declare export function isExportDefaultDeclaration(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeExportDefaultDeclaration) + declare export function assertExportDefaultDeclaration(node: ?Object, opts?: ?Object): void + declare export function isExportNamedDeclaration(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeExportNamedDeclaration) + declare export function assertExportNamedDeclaration(node: ?Object, opts?: ?Object): void + declare export function isExportSpecifier(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeExportSpecifier) + declare export function assertExportSpecifier(node: ?Object, opts?: ?Object): void + declare export function isForOfStatement(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeForOfStatement) + declare export function assertForOfStatement(node: ?Object, opts?: ?Object): void + declare export function isImportDeclaration(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeImportDeclaration) + declare export function assertImportDeclaration(node: ?Object, opts?: ?Object): void + declare export function isImportDefaultSpecifier(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeImportDefaultSpecifier) + declare export function assertImportDefaultSpecifier(node: ?Object, opts?: ?Object): void + declare export function isImportNamespaceSpecifier(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeImportNamespaceSpecifier) + declare export function assertImportNamespaceSpecifier(node: ?Object, opts?: ?Object): void + declare export function isImportSpecifier(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeImportSpecifier) + declare export function assertImportSpecifier(node: ?Object, opts?: ?Object): void + declare export function isMetaProperty(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeMetaProperty) + declare export function assertMetaProperty(node: ?Object, opts?: ?Object): void + declare export function isClassMethod(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeClassMethod) + declare export function assertClassMethod(node: ?Object, opts?: ?Object): void + declare export function isObjectPattern(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeObjectPattern) + declare export function assertObjectPattern(node: ?Object, opts?: ?Object): void + declare export function isSpreadElement(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeSpreadElement) + declare export function assertSpreadElement(node: ?Object, opts?: ?Object): void + declare export function isSuper(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeSuper) + declare export function assertSuper(node: ?Object, opts?: ?Object): void + declare export function isTaggedTemplateExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTaggedTemplateExpression) + declare export function assertTaggedTemplateExpression(node: ?Object, opts?: ?Object): void + declare export function isTemplateElement(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTemplateElement) + declare export function assertTemplateElement(node: ?Object, opts?: ?Object): void + declare export function isTemplateLiteral(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTemplateLiteral) + declare export function assertTemplateLiteral(node: ?Object, opts?: ?Object): void + declare export function isYieldExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeYieldExpression) + declare export function assertYieldExpression(node: ?Object, opts?: ?Object): void + declare export function isAwaitExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeAwaitExpression) + declare export function assertAwaitExpression(node: ?Object, opts?: ?Object): void + declare export function isImport(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeImport) + declare export function assertImport(node: ?Object, opts?: ?Object): void + declare export function isBigIntLiteral(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeBigIntLiteral) + declare export function assertBigIntLiteral(node: ?Object, opts?: ?Object): void + declare export function isExportNamespaceSpecifier(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeExportNamespaceSpecifier) + declare export function assertExportNamespaceSpecifier(node: ?Object, opts?: ?Object): void + declare export function isOptionalMemberExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeOptionalMemberExpression) + declare export function assertOptionalMemberExpression(node: ?Object, opts?: ?Object): void + declare export function isOptionalCallExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeOptionalCallExpression) + declare export function assertOptionalCallExpression(node: ?Object, opts?: ?Object): void + declare export function isAnyTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeAnyTypeAnnotation) + declare export function assertAnyTypeAnnotation(node: ?Object, opts?: ?Object): void + declare export function isArrayTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeArrayTypeAnnotation) + declare export function assertArrayTypeAnnotation(node: ?Object, opts?: ?Object): void + declare export function isBooleanTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeBooleanTypeAnnotation) + declare export function assertBooleanTypeAnnotation(node: ?Object, opts?: ?Object): void + declare export function isBooleanLiteralTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeBooleanLiteralTypeAnnotation) + declare export function assertBooleanLiteralTypeAnnotation(node: ?Object, opts?: ?Object): void + declare export function isNullLiteralTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeNullLiteralTypeAnnotation) + declare export function assertNullLiteralTypeAnnotation(node: ?Object, opts?: ?Object): void + declare export function isClassImplements(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeClassImplements) + declare export function assertClassImplements(node: ?Object, opts?: ?Object): void + declare export function isDeclareClass(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeDeclareClass) + declare export function assertDeclareClass(node: ?Object, opts?: ?Object): void + declare export function isDeclareFunction(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeDeclareFunction) + declare export function assertDeclareFunction(node: ?Object, opts?: ?Object): void + declare export function isDeclareInterface(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeDeclareInterface) + declare export function assertDeclareInterface(node: ?Object, opts?: ?Object): void + declare export function isDeclareModule(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeDeclareModule) + declare export function assertDeclareModule(node: ?Object, opts?: ?Object): void + declare export function isDeclareModuleExports(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeDeclareModuleExports) + declare export function assertDeclareModuleExports(node: ?Object, opts?: ?Object): void + declare export function isDeclareTypeAlias(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeDeclareTypeAlias) + declare export function assertDeclareTypeAlias(node: ?Object, opts?: ?Object): void + declare export function isDeclareOpaqueType(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeDeclareOpaqueType) + declare export function assertDeclareOpaqueType(node: ?Object, opts?: ?Object): void + declare export function isDeclareVariable(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeDeclareVariable) + declare export function assertDeclareVariable(node: ?Object, opts?: ?Object): void + declare export function isDeclareExportDeclaration(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeDeclareExportDeclaration) + declare export function assertDeclareExportDeclaration(node: ?Object, opts?: ?Object): void + declare export function isDeclareExportAllDeclaration(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeDeclareExportAllDeclaration) + declare export function assertDeclareExportAllDeclaration(node: ?Object, opts?: ?Object): void + declare export function isDeclaredPredicate(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeDeclaredPredicate) + declare export function assertDeclaredPredicate(node: ?Object, opts?: ?Object): void + declare export function isExistsTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeExistsTypeAnnotation) + declare export function assertExistsTypeAnnotation(node: ?Object, opts?: ?Object): void + declare export function isFunctionTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeFunctionTypeAnnotation) + declare export function assertFunctionTypeAnnotation(node: ?Object, opts?: ?Object): void + declare export function isFunctionTypeParam(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeFunctionTypeParam) + declare export function assertFunctionTypeParam(node: ?Object, opts?: ?Object): void + declare export function isGenericTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeGenericTypeAnnotation) + declare export function assertGenericTypeAnnotation(node: ?Object, opts?: ?Object): void + declare export function isInferredPredicate(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeInferredPredicate) + declare export function assertInferredPredicate(node: ?Object, opts?: ?Object): void + declare export function isInterfaceExtends(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeInterfaceExtends) + declare export function assertInterfaceExtends(node: ?Object, opts?: ?Object): void + declare export function isInterfaceDeclaration(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeInterfaceDeclaration) + declare export function assertInterfaceDeclaration(node: ?Object, opts?: ?Object): void + declare export function isInterfaceTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeInterfaceTypeAnnotation) + declare export function assertInterfaceTypeAnnotation(node: ?Object, opts?: ?Object): void + declare export function isIntersectionTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeIntersectionTypeAnnotation) + declare export function assertIntersectionTypeAnnotation(node: ?Object, opts?: ?Object): void + declare export function isMixedTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeMixedTypeAnnotation) + declare export function assertMixedTypeAnnotation(node: ?Object, opts?: ?Object): void + declare export function isEmptyTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeEmptyTypeAnnotation) + declare export function assertEmptyTypeAnnotation(node: ?Object, opts?: ?Object): void + declare export function isNullableTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeNullableTypeAnnotation) + declare export function assertNullableTypeAnnotation(node: ?Object, opts?: ?Object): void + declare export function isNumberLiteralTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeNumberLiteralTypeAnnotation) + declare export function assertNumberLiteralTypeAnnotation(node: ?Object, opts?: ?Object): void + declare export function isNumberTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeNumberTypeAnnotation) + declare export function assertNumberTypeAnnotation(node: ?Object, opts?: ?Object): void + declare export function isObjectTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeObjectTypeAnnotation) + declare export function assertObjectTypeAnnotation(node: ?Object, opts?: ?Object): void + declare export function isObjectTypeInternalSlot(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeObjectTypeInternalSlot) + declare export function assertObjectTypeInternalSlot(node: ?Object, opts?: ?Object): void + declare export function isObjectTypeCallProperty(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeObjectTypeCallProperty) + declare export function assertObjectTypeCallProperty(node: ?Object, opts?: ?Object): void + declare export function isObjectTypeIndexer(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeObjectTypeIndexer) + declare export function assertObjectTypeIndexer(node: ?Object, opts?: ?Object): void + declare export function isObjectTypeProperty(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeObjectTypeProperty) + declare export function assertObjectTypeProperty(node: ?Object, opts?: ?Object): void + declare export function isObjectTypeSpreadProperty(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeObjectTypeSpreadProperty) + declare export function assertObjectTypeSpreadProperty(node: ?Object, opts?: ?Object): void + declare export function isOpaqueType(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeOpaqueType) + declare export function assertOpaqueType(node: ?Object, opts?: ?Object): void + declare export function isQualifiedTypeIdentifier(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeQualifiedTypeIdentifier) + declare export function assertQualifiedTypeIdentifier(node: ?Object, opts?: ?Object): void + declare export function isStringLiteralTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeStringLiteralTypeAnnotation) + declare export function assertStringLiteralTypeAnnotation(node: ?Object, opts?: ?Object): void + declare export function isStringTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeStringTypeAnnotation) + declare export function assertStringTypeAnnotation(node: ?Object, opts?: ?Object): void + declare export function isSymbolTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeSymbolTypeAnnotation) + declare export function assertSymbolTypeAnnotation(node: ?Object, opts?: ?Object): void + declare export function isThisTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeThisTypeAnnotation) + declare export function assertThisTypeAnnotation(node: ?Object, opts?: ?Object): void + declare export function isTupleTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTupleTypeAnnotation) + declare export function assertTupleTypeAnnotation(node: ?Object, opts?: ?Object): void + declare export function isTypeofTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTypeofTypeAnnotation) + declare export function assertTypeofTypeAnnotation(node: ?Object, opts?: ?Object): void + declare export function isTypeAlias(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTypeAlias) + declare export function assertTypeAlias(node: ?Object, opts?: ?Object): void + declare export function isTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTypeAnnotation) + declare export function assertTypeAnnotation(node: ?Object, opts?: ?Object): void + declare export function isTypeCastExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTypeCastExpression) + declare export function assertTypeCastExpression(node: ?Object, opts?: ?Object): void + declare export function isTypeParameter(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTypeParameter) + declare export function assertTypeParameter(node: ?Object, opts?: ?Object): void + declare export function isTypeParameterDeclaration(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTypeParameterDeclaration) + declare export function assertTypeParameterDeclaration(node: ?Object, opts?: ?Object): void + declare export function isTypeParameterInstantiation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTypeParameterInstantiation) + declare export function assertTypeParameterInstantiation(node: ?Object, opts?: ?Object): void + declare export function isUnionTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeUnionTypeAnnotation) + declare export function assertUnionTypeAnnotation(node: ?Object, opts?: ?Object): void + declare export function isVariance(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeVariance) + declare export function assertVariance(node: ?Object, opts?: ?Object): void + declare export function isVoidTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeVoidTypeAnnotation) + declare export function assertVoidTypeAnnotation(node: ?Object, opts?: ?Object): void + declare export function isEnumDeclaration(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeEnumDeclaration) + declare export function assertEnumDeclaration(node: ?Object, opts?: ?Object): void + declare export function isEnumBooleanBody(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeEnumBooleanBody) + declare export function assertEnumBooleanBody(node: ?Object, opts?: ?Object): void + declare export function isEnumNumberBody(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeEnumNumberBody) + declare export function assertEnumNumberBody(node: ?Object, opts?: ?Object): void + declare export function isEnumStringBody(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeEnumStringBody) + declare export function assertEnumStringBody(node: ?Object, opts?: ?Object): void + declare export function isEnumSymbolBody(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeEnumSymbolBody) + declare export function assertEnumSymbolBody(node: ?Object, opts?: ?Object): void + declare export function isEnumBooleanMember(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeEnumBooleanMember) + declare export function assertEnumBooleanMember(node: ?Object, opts?: ?Object): void + declare export function isEnumNumberMember(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeEnumNumberMember) + declare export function assertEnumNumberMember(node: ?Object, opts?: ?Object): void + declare export function isEnumStringMember(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeEnumStringMember) + declare export function assertEnumStringMember(node: ?Object, opts?: ?Object): void + declare export function isEnumDefaultedMember(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeEnumDefaultedMember) + declare export function assertEnumDefaultedMember(node: ?Object, opts?: ?Object): void + declare export function isJSXAttribute(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeJSXAttribute) + declare export function assertJSXAttribute(node: ?Object, opts?: ?Object): void + declare export function isJSXClosingElement(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeJSXClosingElement) + declare export function assertJSXClosingElement(node: ?Object, opts?: ?Object): void + declare export function isJSXElement(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeJSXElement) + declare export function assertJSXElement(node: ?Object, opts?: ?Object): void + declare export function isJSXEmptyExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeJSXEmptyExpression) + declare export function assertJSXEmptyExpression(node: ?Object, opts?: ?Object): void + declare export function isJSXExpressionContainer(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeJSXExpressionContainer) + declare export function assertJSXExpressionContainer(node: ?Object, opts?: ?Object): void + declare export function isJSXSpreadChild(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeJSXSpreadChild) + declare export function assertJSXSpreadChild(node: ?Object, opts?: ?Object): void + declare export function isJSXIdentifier(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeJSXIdentifier) + declare export function assertJSXIdentifier(node: ?Object, opts?: ?Object): void + declare export function isJSXMemberExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeJSXMemberExpression) + declare export function assertJSXMemberExpression(node: ?Object, opts?: ?Object): void + declare export function isJSXNamespacedName(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeJSXNamespacedName) + declare export function assertJSXNamespacedName(node: ?Object, opts?: ?Object): void + declare export function isJSXOpeningElement(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeJSXOpeningElement) + declare export function assertJSXOpeningElement(node: ?Object, opts?: ?Object): void + declare export function isJSXSpreadAttribute(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeJSXSpreadAttribute) + declare export function assertJSXSpreadAttribute(node: ?Object, opts?: ?Object): void + declare export function isJSXText(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeJSXText) + declare export function assertJSXText(node: ?Object, opts?: ?Object): void + declare export function isJSXFragment(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeJSXFragment) + declare export function assertJSXFragment(node: ?Object, opts?: ?Object): void + declare export function isJSXOpeningFragment(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeJSXOpeningFragment) + declare export function assertJSXOpeningFragment(node: ?Object, opts?: ?Object): void + declare export function isJSXClosingFragment(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeJSXClosingFragment) + declare export function assertJSXClosingFragment(node: ?Object, opts?: ?Object): void + declare export function isNoop(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeNoop) + declare export function assertNoop(node: ?Object, opts?: ?Object): void + declare export function isPlaceholder(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodePlaceholder) + declare export function assertPlaceholder(node: ?Object, opts?: ?Object): void + declare export function isV8IntrinsicIdentifier(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeV8IntrinsicIdentifier) + declare export function assertV8IntrinsicIdentifier(node: ?Object, opts?: ?Object): void + declare export function isArgumentPlaceholder(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeArgumentPlaceholder) + declare export function assertArgumentPlaceholder(node: ?Object, opts?: ?Object): void + declare export function isBindExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeBindExpression) + declare export function assertBindExpression(node: ?Object, opts?: ?Object): void + declare export function isClassProperty(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeClassProperty) + declare export function assertClassProperty(node: ?Object, opts?: ?Object): void + declare export function isPipelineTopicExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodePipelineTopicExpression) + declare export function assertPipelineTopicExpression(node: ?Object, opts?: ?Object): void + declare export function isPipelineBareFunction(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodePipelineBareFunction) + declare export function assertPipelineBareFunction(node: ?Object, opts?: ?Object): void + declare export function isPipelinePrimaryTopicReference(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodePipelinePrimaryTopicReference) + declare export function assertPipelinePrimaryTopicReference(node: ?Object, opts?: ?Object): void + declare export function isClassPrivateProperty(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeClassPrivateProperty) + declare export function assertClassPrivateProperty(node: ?Object, opts?: ?Object): void + declare export function isClassPrivateMethod(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeClassPrivateMethod) + declare export function assertClassPrivateMethod(node: ?Object, opts?: ?Object): void + declare export function isImportAttribute(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeImportAttribute) + declare export function assertImportAttribute(node: ?Object, opts?: ?Object): void + declare export function isDecorator(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeDecorator) + declare export function assertDecorator(node: ?Object, opts?: ?Object): void + declare export function isDoExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeDoExpression) + declare export function assertDoExpression(node: ?Object, opts?: ?Object): void + declare export function isExportDefaultSpecifier(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeExportDefaultSpecifier) + declare export function assertExportDefaultSpecifier(node: ?Object, opts?: ?Object): void + declare export function isPrivateName(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodePrivateName) + declare export function assertPrivateName(node: ?Object, opts?: ?Object): void + declare export function isRecordExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeRecordExpression) + declare export function assertRecordExpression(node: ?Object, opts?: ?Object): void + declare export function isTupleExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTupleExpression) + declare export function assertTupleExpression(node: ?Object, opts?: ?Object): void + declare export function isDecimalLiteral(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeDecimalLiteral) + declare export function assertDecimalLiteral(node: ?Object, opts?: ?Object): void + declare export function isStaticBlock(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeStaticBlock) + declare export function assertStaticBlock(node: ?Object, opts?: ?Object): void + declare export function isTSParameterProperty(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSParameterProperty) + declare export function assertTSParameterProperty(node: ?Object, opts?: ?Object): void + declare export function isTSDeclareFunction(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSDeclareFunction) + declare export function assertTSDeclareFunction(node: ?Object, opts?: ?Object): void + declare export function isTSDeclareMethod(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSDeclareMethod) + declare export function assertTSDeclareMethod(node: ?Object, opts?: ?Object): void + declare export function isTSQualifiedName(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSQualifiedName) + declare export function assertTSQualifiedName(node: ?Object, opts?: ?Object): void + declare export function isTSCallSignatureDeclaration(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSCallSignatureDeclaration) + declare export function assertTSCallSignatureDeclaration(node: ?Object, opts?: ?Object): void + declare export function isTSConstructSignatureDeclaration(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSConstructSignatureDeclaration) + declare export function assertTSConstructSignatureDeclaration(node: ?Object, opts?: ?Object): void + declare export function isTSPropertySignature(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSPropertySignature) + declare export function assertTSPropertySignature(node: ?Object, opts?: ?Object): void + declare export function isTSMethodSignature(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSMethodSignature) + declare export function assertTSMethodSignature(node: ?Object, opts?: ?Object): void + declare export function isTSIndexSignature(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSIndexSignature) + declare export function assertTSIndexSignature(node: ?Object, opts?: ?Object): void + declare export function isTSAnyKeyword(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSAnyKeyword) + declare export function assertTSAnyKeyword(node: ?Object, opts?: ?Object): void + declare export function isTSBooleanKeyword(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSBooleanKeyword) + declare export function assertTSBooleanKeyword(node: ?Object, opts?: ?Object): void + declare export function isTSBigIntKeyword(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSBigIntKeyword) + declare export function assertTSBigIntKeyword(node: ?Object, opts?: ?Object): void + declare export function isTSIntrinsicKeyword(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSIntrinsicKeyword) + declare export function assertTSIntrinsicKeyword(node: ?Object, opts?: ?Object): void + declare export function isTSNeverKeyword(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSNeverKeyword) + declare export function assertTSNeverKeyword(node: ?Object, opts?: ?Object): void + declare export function isTSNullKeyword(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSNullKeyword) + declare export function assertTSNullKeyword(node: ?Object, opts?: ?Object): void + declare export function isTSNumberKeyword(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSNumberKeyword) + declare export function assertTSNumberKeyword(node: ?Object, opts?: ?Object): void + declare export function isTSObjectKeyword(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSObjectKeyword) + declare export function assertTSObjectKeyword(node: ?Object, opts?: ?Object): void + declare export function isTSStringKeyword(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSStringKeyword) + declare export function assertTSStringKeyword(node: ?Object, opts?: ?Object): void + declare export function isTSSymbolKeyword(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSSymbolKeyword) + declare export function assertTSSymbolKeyword(node: ?Object, opts?: ?Object): void + declare export function isTSUndefinedKeyword(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSUndefinedKeyword) + declare export function assertTSUndefinedKeyword(node: ?Object, opts?: ?Object): void + declare export function isTSUnknownKeyword(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSUnknownKeyword) + declare export function assertTSUnknownKeyword(node: ?Object, opts?: ?Object): void + declare export function isTSVoidKeyword(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSVoidKeyword) + declare export function assertTSVoidKeyword(node: ?Object, opts?: ?Object): void + declare export function isTSThisType(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSThisType) + declare export function assertTSThisType(node: ?Object, opts?: ?Object): void + declare export function isTSFunctionType(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSFunctionType) + declare export function assertTSFunctionType(node: ?Object, opts?: ?Object): void + declare export function isTSConstructorType(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSConstructorType) + declare export function assertTSConstructorType(node: ?Object, opts?: ?Object): void + declare export function isTSTypeReference(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSTypeReference) + declare export function assertTSTypeReference(node: ?Object, opts?: ?Object): void + declare export function isTSTypePredicate(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSTypePredicate) + declare export function assertTSTypePredicate(node: ?Object, opts?: ?Object): void + declare export function isTSTypeQuery(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSTypeQuery) + declare export function assertTSTypeQuery(node: ?Object, opts?: ?Object): void + declare export function isTSTypeLiteral(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSTypeLiteral) + declare export function assertTSTypeLiteral(node: ?Object, opts?: ?Object): void + declare export function isTSArrayType(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSArrayType) + declare export function assertTSArrayType(node: ?Object, opts?: ?Object): void + declare export function isTSTupleType(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSTupleType) + declare export function assertTSTupleType(node: ?Object, opts?: ?Object): void + declare export function isTSOptionalType(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSOptionalType) + declare export function assertTSOptionalType(node: ?Object, opts?: ?Object): void + declare export function isTSRestType(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSRestType) + declare export function assertTSRestType(node: ?Object, opts?: ?Object): void + declare export function isTSNamedTupleMember(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSNamedTupleMember) + declare export function assertTSNamedTupleMember(node: ?Object, opts?: ?Object): void + declare export function isTSUnionType(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSUnionType) + declare export function assertTSUnionType(node: ?Object, opts?: ?Object): void + declare export function isTSIntersectionType(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSIntersectionType) + declare export function assertTSIntersectionType(node: ?Object, opts?: ?Object): void + declare export function isTSConditionalType(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSConditionalType) + declare export function assertTSConditionalType(node: ?Object, opts?: ?Object): void + declare export function isTSInferType(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSInferType) + declare export function assertTSInferType(node: ?Object, opts?: ?Object): void + declare export function isTSParenthesizedType(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSParenthesizedType) + declare export function assertTSParenthesizedType(node: ?Object, opts?: ?Object): void + declare export function isTSTypeOperator(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSTypeOperator) + declare export function assertTSTypeOperator(node: ?Object, opts?: ?Object): void + declare export function isTSIndexedAccessType(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSIndexedAccessType) + declare export function assertTSIndexedAccessType(node: ?Object, opts?: ?Object): void + declare export function isTSMappedType(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSMappedType) + declare export function assertTSMappedType(node: ?Object, opts?: ?Object): void + declare export function isTSLiteralType(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSLiteralType) + declare export function assertTSLiteralType(node: ?Object, opts?: ?Object): void + declare export function isTSExpressionWithTypeArguments(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSExpressionWithTypeArguments) + declare export function assertTSExpressionWithTypeArguments(node: ?Object, opts?: ?Object): void + declare export function isTSInterfaceDeclaration(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSInterfaceDeclaration) + declare export function assertTSInterfaceDeclaration(node: ?Object, opts?: ?Object): void + declare export function isTSInterfaceBody(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSInterfaceBody) + declare export function assertTSInterfaceBody(node: ?Object, opts?: ?Object): void + declare export function isTSTypeAliasDeclaration(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSTypeAliasDeclaration) + declare export function assertTSTypeAliasDeclaration(node: ?Object, opts?: ?Object): void + declare export function isTSAsExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSAsExpression) + declare export function assertTSAsExpression(node: ?Object, opts?: ?Object): void + declare export function isTSTypeAssertion(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSTypeAssertion) + declare export function assertTSTypeAssertion(node: ?Object, opts?: ?Object): void + declare export function isTSEnumDeclaration(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSEnumDeclaration) + declare export function assertTSEnumDeclaration(node: ?Object, opts?: ?Object): void + declare export function isTSEnumMember(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSEnumMember) + declare export function assertTSEnumMember(node: ?Object, opts?: ?Object): void + declare export function isTSModuleDeclaration(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSModuleDeclaration) + declare export function assertTSModuleDeclaration(node: ?Object, opts?: ?Object): void + declare export function isTSModuleBlock(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSModuleBlock) + declare export function assertTSModuleBlock(node: ?Object, opts?: ?Object): void + declare export function isTSImportType(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSImportType) + declare export function assertTSImportType(node: ?Object, opts?: ?Object): void + declare export function isTSImportEqualsDeclaration(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSImportEqualsDeclaration) + declare export function assertTSImportEqualsDeclaration(node: ?Object, opts?: ?Object): void + declare export function isTSExternalModuleReference(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSExternalModuleReference) + declare export function assertTSExternalModuleReference(node: ?Object, opts?: ?Object): void + declare export function isTSNonNullExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSNonNullExpression) + declare export function assertTSNonNullExpression(node: ?Object, opts?: ?Object): void + declare export function isTSExportAssignment(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSExportAssignment) + declare export function assertTSExportAssignment(node: ?Object, opts?: ?Object): void + declare export function isTSNamespaceExportDeclaration(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSNamespaceExportDeclaration) + declare export function assertTSNamespaceExportDeclaration(node: ?Object, opts?: ?Object): void + declare export function isTSTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSTypeAnnotation) + declare export function assertTSTypeAnnotation(node: ?Object, opts?: ?Object): void + declare export function isTSTypeParameterInstantiation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSTypeParameterInstantiation) + declare export function assertTSTypeParameterInstantiation(node: ?Object, opts?: ?Object): void + declare export function isTSTypeParameterDeclaration(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSTypeParameterDeclaration) + declare export function assertTSTypeParameterDeclaration(node: ?Object, opts?: ?Object): void + declare export function isTSTypeParameter(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSTypeParameter) + declare export function assertTSTypeParameter(node: ?Object, opts?: ?Object): void + declare export function isExpression(node: ?Object, opts?: ?Object): boolean + declare export function assertExpression(node: ?Object, opts?: ?Object): void + declare export function isBinary(node: ?Object, opts?: ?Object): boolean + declare export function assertBinary(node: ?Object, opts?: ?Object): void + declare export function isScopable(node: ?Object, opts?: ?Object): boolean + declare export function assertScopable(node: ?Object, opts?: ?Object): void + declare export function isBlockParent(node: ?Object, opts?: ?Object): boolean + declare export function assertBlockParent(node: ?Object, opts?: ?Object): void + declare export function isBlock(node: ?Object, opts?: ?Object): boolean + declare export function assertBlock(node: ?Object, opts?: ?Object): void + declare export function isStatement(node: ?Object, opts?: ?Object): boolean + declare export function assertStatement(node: ?Object, opts?: ?Object): void + declare export function isTerminatorless(node: ?Object, opts?: ?Object): boolean + declare export function assertTerminatorless(node: ?Object, opts?: ?Object): void + declare export function isCompletionStatement(node: ?Object, opts?: ?Object): boolean + declare export function assertCompletionStatement(node: ?Object, opts?: ?Object): void + declare export function isConditional(node: ?Object, opts?: ?Object): boolean + declare export function assertConditional(node: ?Object, opts?: ?Object): void + declare export function isLoop(node: ?Object, opts?: ?Object): boolean + declare export function assertLoop(node: ?Object, opts?: ?Object): void + declare export function isWhile(node: ?Object, opts?: ?Object): boolean + declare export function assertWhile(node: ?Object, opts?: ?Object): void + declare export function isExpressionWrapper(node: ?Object, opts?: ?Object): boolean + declare export function assertExpressionWrapper(node: ?Object, opts?: ?Object): void + declare export function isFor(node: ?Object, opts?: ?Object): boolean + declare export function assertFor(node: ?Object, opts?: ?Object): void + declare export function isForXStatement(node: ?Object, opts?: ?Object): boolean + declare export function assertForXStatement(node: ?Object, opts?: ?Object): void + declare export function isFunction(node: ?Object, opts?: ?Object): boolean + declare export function assertFunction(node: ?Object, opts?: ?Object): void + declare export function isFunctionParent(node: ?Object, opts?: ?Object): boolean + declare export function assertFunctionParent(node: ?Object, opts?: ?Object): void + declare export function isPureish(node: ?Object, opts?: ?Object): boolean + declare export function assertPureish(node: ?Object, opts?: ?Object): void + declare export function isDeclaration(node: ?Object, opts?: ?Object): boolean + declare export function assertDeclaration(node: ?Object, opts?: ?Object): void + declare export function isPatternLike(node: ?Object, opts?: ?Object): boolean + declare export function assertPatternLike(node: ?Object, opts?: ?Object): void + declare export function isLVal(node: ?Object, opts?: ?Object): boolean + declare export function assertLVal(node: ?Object, opts?: ?Object): void + declare export function isTSEntityName(node: ?Object, opts?: ?Object): boolean + declare export function assertTSEntityName(node: ?Object, opts?: ?Object): void + declare export function isLiteral(node: ?Object, opts?: ?Object): boolean + declare export function assertLiteral(node: ?Object, opts?: ?Object): void + declare export function isImmutable(node: ?Object, opts?: ?Object): boolean + declare export function assertImmutable(node: ?Object, opts?: ?Object): void + declare export function isUserWhitespacable(node: ?Object, opts?: ?Object): boolean + declare export function assertUserWhitespacable(node: ?Object, opts?: ?Object): void + declare export function isMethod(node: ?Object, opts?: ?Object): boolean + declare export function assertMethod(node: ?Object, opts?: ?Object): void + declare export function isObjectMember(node: ?Object, opts?: ?Object): boolean + declare export function assertObjectMember(node: ?Object, opts?: ?Object): void + declare export function isProperty(node: ?Object, opts?: ?Object): boolean + declare export function assertProperty(node: ?Object, opts?: ?Object): void + declare export function isUnaryLike(node: ?Object, opts?: ?Object): boolean + declare export function assertUnaryLike(node: ?Object, opts?: ?Object): void + declare export function isPattern(node: ?Object, opts?: ?Object): boolean + declare export function assertPattern(node: ?Object, opts?: ?Object): void + declare export function isClass(node: ?Object, opts?: ?Object): boolean + declare export function assertClass(node: ?Object, opts?: ?Object): void + declare export function isModuleDeclaration(node: ?Object, opts?: ?Object): boolean + declare export function assertModuleDeclaration(node: ?Object, opts?: ?Object): void + declare export function isExportDeclaration(node: ?Object, opts?: ?Object): boolean + declare export function assertExportDeclaration(node: ?Object, opts?: ?Object): void + declare export function isModuleSpecifier(node: ?Object, opts?: ?Object): boolean + declare export function assertModuleSpecifier(node: ?Object, opts?: ?Object): void + declare export function isFlow(node: ?Object, opts?: ?Object): boolean + declare export function assertFlow(node: ?Object, opts?: ?Object): void + declare export function isFlowType(node: ?Object, opts?: ?Object): boolean + declare export function assertFlowType(node: ?Object, opts?: ?Object): void + declare export function isFlowBaseAnnotation(node: ?Object, opts?: ?Object): boolean + declare export function assertFlowBaseAnnotation(node: ?Object, opts?: ?Object): void + declare export function isFlowDeclaration(node: ?Object, opts?: ?Object): boolean + declare export function assertFlowDeclaration(node: ?Object, opts?: ?Object): void + declare export function isFlowPredicate(node: ?Object, opts?: ?Object): boolean + declare export function assertFlowPredicate(node: ?Object, opts?: ?Object): void + declare export function isEnumBody(node: ?Object, opts?: ?Object): boolean + declare export function assertEnumBody(node: ?Object, opts?: ?Object): void + declare export function isEnumMember(node: ?Object, opts?: ?Object): boolean + declare export function assertEnumMember(node: ?Object, opts?: ?Object): void + declare export function isJSX(node: ?Object, opts?: ?Object): boolean + declare export function assertJSX(node: ?Object, opts?: ?Object): void + declare export function isPrivate(node: ?Object, opts?: ?Object): boolean + declare export function assertPrivate(node: ?Object, opts?: ?Object): void + declare export function isTSTypeElement(node: ?Object, opts?: ?Object): boolean + declare export function assertTSTypeElement(node: ?Object, opts?: ?Object): void + declare export function isTSType(node: ?Object, opts?: ?Object): boolean + declare export function assertTSType(node: ?Object, opts?: ?Object): void + declare export function isTSBaseType(node: ?Object, opts?: ?Object): boolean + declare export function assertTSBaseType(node: ?Object, opts?: ?Object): void + declare export function isNumberLiteral(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeNumericLiteral) + declare export function assertNumberLiteral(node: ?Object, opts?: ?Object): void + declare export function isRegexLiteral(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeRegExpLiteral) + declare export function assertRegexLiteral(node: ?Object, opts?: ?Object): void + declare export function isRestProperty(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeRestElement) + declare export function assertRestProperty(node: ?Object, opts?: ?Object): void + declare export function isSpreadProperty(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeSpreadElement) + declare export function assertSpreadProperty(node: ?Object, opts?: ?Object): void + declare export var VISITOR_KEYS: { [type: string]: string[] } + declare export function assertNode(obj: any): void + declare export function createTypeAnnotationBasedOnTypeof(type: 'string' | 'number' | 'undefined' | 'boolean' | 'function' | 'object' | 'symbol'): BabelNodeTypeAnnotation + declare export function createUnionTypeAnnotation(types: Array<BabelNodeFlowType>): BabelNodeUnionTypeAnnotation + declare export function createFlowUnionType(types: Array<BabelNodeFlowType>): BabelNodeUnionTypeAnnotation + declare export function buildChildren(node: { children: Array<BabelNodeJSXText | BabelNodeJSXExpressionContainer | BabelNodeJSXSpreadChild | BabelNodeJSXElement | BabelNodeJSXFragment | BabelNodeJSXEmptyExpression> }): Array<BabelNodeJSXText | BabelNodeJSXExpressionContainer | BabelNodeJSXSpreadChild | BabelNodeJSXElement | BabelNodeJSXFragment> + declare export function clone<T>(n: T): T; + declare export function cloneDeep<T>(n: T): T; + declare export function cloneDeepWithoutLoc<T>(n: T): T; + declare export function cloneNode<T>(n: T, deep?: boolean, withoutLoc?: boolean): T; + declare export function cloneWithoutLoc<T>(n: T): T; declare type CommentTypeShorthand = 'leading' | 'inner' | 'trailing' - declare function addComment<T: Node>(node: T, type: CommentTypeShorthand, content: string, line?: boolean): T - declare function addComments<T: Node>(node: T, type: CommentTypeShorthand, comments: Array<Comment>): T - declare function inheritInnerComments(node: Node, parent: Node): void - declare function inheritLeadingComments(node: Node, parent: Node): void - declare function inheritsComments<T: Node>(node: T, parent: Node): void - declare function inheritTrailingComments(node: Node, parent: Node): void - declare function removeComments<T: Node>(node: T): T - declare function ensureBlock(node: BabelNode, key: string): BabelNodeBlockStatement - declare function toBindingIdentifierName(name?: ?string): string - declare function toBlock(node: BabelNodeStatement | BabelNodeExpression, parent?: BabelNodeFunction | null): BabelNodeBlockStatement - declare function toComputedKey(node: BabelNodeMethod | BabelNodeProperty, key?: BabelNodeExpression | BabelNodeIdentifier): BabelNodeExpression - declare function toExpression(node: BabelNodeExpressionStatement | BabelNodeExpression | BabelNodeClass | BabelNodeFunction): BabelNodeExpression - declare function toIdentifier(name?: ?string): string - declare function toKeyAlias(node: BabelNodeMethod | BabelNodeProperty, key?: BabelNode): string - declare function toStatement(node: BabelNodeStatement | BabelNodeClass | BabelNodeFunction | BabelNodeAssignmentExpression, ignore?: boolean): BabelNodeStatement | void - declare function valueToNode(value: any): BabelNodeExpression - declare function removeTypeDuplicates(types: Array<BabelNodeFlowType>): Array<BabelNodeFlowType> - declare function appendToMemberExpression(member: BabelNodeMemberExpression, append: BabelNode, computed?: boolean): BabelNodeMemberExpression - declare function inherits<T: Node>(child: T, parent: BabelNode | null | void): T - declare function prependToMemberExpression(member: BabelNodeMemberExpression, prepend: BabelNodeExpression): BabelNodeMemberExpression - declare function removeProperties<T>(n: T, opts: ?{}): void; - declare function removePropertiesDeep<T>(n: T, opts: ?{}): T; - declare function getBindingIdentifiers(node: BabelNode, duplicates: boolean, outerOnly?: boolean): { [key: string]: BabelNodeIdentifier | Array<BabelNodeIdentifier> } - declare function getOuterBindingIdentifiers(node: Node, duplicates: boolean): { [key: string]: BabelNodeIdentifier | Array<BabelNodeIdentifier> } + declare export function addComment<T: BabelNode>(node: T, type: CommentTypeShorthand, content: string, line?: boolean): T + declare export function addComments<T: BabelNode>(node: T, type: CommentTypeShorthand, comments: Array<Comment>): T + declare export function inheritInnerComments(node: BabelNode, parent: BabelNode): void + declare export function inheritLeadingComments(node: BabelNode, parent: BabelNode): void + declare export function inheritsComments<T: BabelNode>(node: T, parent: BabelNode): void + declare export function inheritTrailingComments(node: BabelNode, parent: BabelNode): void + declare export function removeComments<T: BabelNode>(node: T): T + declare export function ensureBlock(node: BabelNode, key: string): BabelNodeBlockStatement + declare export function toBindingIdentifierName(name?: ?string): string + declare export function toBlock(node: BabelNodeStatement | BabelNodeExpression, parent?: BabelNodeFunction | null): BabelNodeBlockStatement + declare export function toComputedKey(node: BabelNodeMethod | BabelNodeProperty, key?: BabelNodeExpression | BabelNodeIdentifier): BabelNodeExpression + declare export function toExpression(node: BabelNodeExpressionStatement | BabelNodeExpression | BabelNodeClass | BabelNodeFunction): BabelNodeExpression + declare export function toIdentifier(name?: ?string): string + declare export function toKeyAlias(node: BabelNodeMethod | BabelNodeProperty, key?: BabelNode): string + declare export function toStatement(node: BabelNodeStatement | BabelNodeClass | BabelNodeFunction | BabelNodeAssignmentExpression, ignore?: boolean): BabelNodeStatement | void + declare export function valueToNode(value: any): BabelNodeExpression + declare export function removeTypeDuplicates(types: Array<BabelNodeFlowType>): Array<BabelNodeFlowType> + declare export function appendToMemberExpression(member: BabelNodeMemberExpression, append: BabelNode, computed?: boolean): BabelNodeMemberExpression + declare export function inherits<T: BabelNode>(child: T, parent: BabelNode | null | void): T + declare export function prependToMemberExpression(member: BabelNodeMemberExpression, prepend: BabelNodeExpression): BabelNodeMemberExpression + declare export function removeProperties<T>(n: T, opts: ?{}): void; + declare export function removePropertiesDeep<T>(n: T, opts: ?{}): T; + declare export var getBindingIdentifiers: { + (node: BabelNode, duplicates?: boolean, outerOnly?: boolean): { [key: string]: BabelNodeIdentifier | Array<BabelNodeIdentifier> }, + keys: { [type: string]: string[] } + } + declare export function getOuterBindingIdentifiers(node: BabelNode, duplicates?: boolean): { [key: string]: BabelNodeIdentifier | Array<BabelNodeIdentifier> } declare type TraversalAncestors = Array<{ node: BabelNode, key: string, @@ -2450,26 +2457,26 @@ declare module "@babel/types" { enter?: TraversalHandler<T>, exit?: TraversalHandler<T>, }; - declare function traverse<T>(n: BabelNode, TraversalHandler<T> | TraversalHandlers<T>, state?: T): void; - declare function traverseFast<T>(n: Node, h: TraversalHandler<T>, state?: T): void; - declare function shallowEqual(actual: Object, expected: Object): boolean - declare function buildMatchMemberExpression(match: string, allowPartial?: boolean): (?BabelNode) => boolean - declare function is(type: string, n: BabelNode, opts: Object): boolean; - declare function isBinding(node: BabelNode, parent: BabelNode, grandparent?: BabelNode): boolean - declare function isBlockScoped(node: BabelNode): boolean - declare function isImmutable(node: BabelNode): boolean - declare function isLet(node: BabelNode): boolean - declare function isNode(node: ?Object): boolean - declare function isNodesEquivalent(a: any, b: any): boolean - declare function isPlaceholderType(placeholderType: string, targetType: string): boolean - declare function isReferenced(node: BabelNode, parent: BabelNode, grandparent?: BabelNode): boolean - declare function isScope(node: BabelNode, parent: BabelNode): boolean - declare function isSpecifierDefault(specifier: BabelNodeModuleSpecifier): boolean - declare function isType(nodetype: ?string, targetType: string): boolean - declare function isValidES3Identifier(name: string): boolean - declare function isValidES3Identifier(name: string): boolean - declare function isValidIdentifier(name: string): boolean - declare function isVar(node: BabelNode): boolean - declare function matchesPattern(node: ?BabelNode, match: string | Array<string>, allowPartial?: boolean): boolean - declare function validate(n: BabelNode, key: string, value: mixed): void; + declare export function traverse<T>(n: BabelNode, TraversalHandler<T> | TraversalHandlers<T>, state?: T): void; + declare export function traverseFast<T>(n: BabelNode, h: TraversalHandler<T>, state?: T): void; + declare export function shallowEqual(actual: Object, expected: Object): boolean + declare export function buildMatchMemberExpression(match: string, allowPartial?: boolean): (?BabelNode) => boolean + declare export function is(type: string, n: BabelNode, opts: Object): boolean; + declare export function isBinding(node: BabelNode, parent: BabelNode, grandparent?: BabelNode): boolean + declare export function isBlockScoped(node: BabelNode): boolean + declare export function isImmutable(node: BabelNode): boolean + declare export function isLet(node: BabelNode): boolean + declare export function isNode(node: ?Object): boolean + declare export function isNodesEquivalent(a: any, b: any): boolean + declare export function isPlaceholderType(placeholderType: string, targetType: string): boolean + declare export function isReferenced(node: BabelNode, parent: BabelNode, grandparent?: BabelNode): boolean + declare export function isScope(node: BabelNode, parent: BabelNode): boolean + declare export function isSpecifierDefault(specifier: BabelNodeModuleSpecifier): boolean + declare export function isType(nodetype: ?string, targetType: string): boolean + declare export function isValidES3Identifier(name: string): boolean + declare export function isValidES3Identifier(name: string): boolean + declare export function isValidIdentifier(name: string): boolean + declare export function isVar(node: BabelNode): boolean + declare export function matchesPattern(node: ?BabelNode, match: string | Array<string>, allowPartial?: boolean): boolean + declare export function validate(n: BabelNode, key: string, value: mixed): void; } diff --git a/tools/node_modules/@babel/core/node_modules/@babel/types/lib/modifications/flow/removeTypeDuplicates.js b/tools/node_modules/@babel/core/node_modules/@babel/types/lib/modifications/flow/removeTypeDuplicates.js index 580268399599ed..af2d6f05ff3689 100644 --- a/tools/node_modules/@babel/core/node_modules/@babel/types/lib/modifications/flow/removeTypeDuplicates.js +++ b/tools/node_modules/@babel/core/node_modules/@babel/types/lib/modifications/flow/removeTypeDuplicates.js @@ -7,6 +7,10 @@ exports.default = removeTypeDuplicates; var _generated = require("../../validators/generated"); +function getQualifiedName(node) { + return (0, _generated.isIdentifier)(node) ? node.name : `${node.id.name}.${getQualifiedName(node.qualification)}`; +} + function removeTypeDuplicates(nodes) { const generics = {}; const bases = {}; @@ -40,7 +44,7 @@ function removeTypeDuplicates(nodes) { } if ((0, _generated.isGenericTypeAnnotation)(node)) { - const name = node.id.name; + const name = getQualifiedName(node.id); if (generics[name]) { let existing = generics[name]; diff --git a/tools/node_modules/@babel/core/node_modules/@babel/types/lib/modifications/typescript/removeTypeDuplicates.js b/tools/node_modules/@babel/core/node_modules/@babel/types/lib/modifications/typescript/removeTypeDuplicates.js index 5eca7e1f488bf3..52f3dfa6bfc401 100644 --- a/tools/node_modules/@babel/core/node_modules/@babel/types/lib/modifications/typescript/removeTypeDuplicates.js +++ b/tools/node_modules/@babel/core/node_modules/@babel/types/lib/modifications/typescript/removeTypeDuplicates.js @@ -21,7 +21,7 @@ function removeTypeDuplicates(nodes) { continue; } - if ((0, _generated.isTSAnyKeyword)(node.type)) { + if ((0, _generated.isTSAnyKeyword)(node)) { return [node]; } diff --git a/tools/node_modules/@babel/core/node_modules/@babel/types/lib/retrievers/getBindingIdentifiers.js b/tools/node_modules/@babel/core/node_modules/@babel/types/lib/retrievers/getBindingIdentifiers.js index 189f4b8eb3be51..e0f321edafd984 100644 --- a/tools/node_modules/@babel/core/node_modules/@babel/types/lib/retrievers/getBindingIdentifiers.js +++ b/tools/node_modules/@babel/core/node_modules/@babel/types/lib/retrievers/getBindingIdentifiers.js @@ -28,7 +28,7 @@ function getBindingIdentifiers(node, duplicates, outerOnly) { continue; } - if ((0, _generated.isExportDeclaration)(id)) { + if ((0, _generated.isExportDeclaration)(id) && !(0, _generated.isExportAllDeclaration)(id)) { if ((0, _generated.isDeclaration)(id.declaration)) { search.push(id.declaration); } diff --git a/tools/node_modules/@babel/core/node_modules/@babel/types/lib/retrievers/getOuterBindingIdentifiers.js b/tools/node_modules/@babel/core/node_modules/@babel/types/lib/retrievers/getOuterBindingIdentifiers.js index 8e1e3cb200d864..369d38fa74505e 100644 --- a/tools/node_modules/@babel/core/node_modules/@babel/types/lib/retrievers/getOuterBindingIdentifiers.js +++ b/tools/node_modules/@babel/core/node_modules/@babel/types/lib/retrievers/getOuterBindingIdentifiers.js @@ -3,12 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true }); -exports.default = getOuterBindingIdentifiers; +exports.default = void 0; var _getBindingIdentifiers = _interopRequireDefault(require("./getBindingIdentifiers")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +var _default = getOuterBindingIdentifiers; +exports.default = _default; + function getOuterBindingIdentifiers(node, duplicates) { return (0, _getBindingIdentifiers.default)(node, duplicates, true); } \ No newline at end of file diff --git a/tools/node_modules/@babel/core/node_modules/@babel/types/lib/validators/generated/index.js b/tools/node_modules/@babel/core/node_modules/@babel/types/lib/validators/generated/index.js index 7978b63fa28492..3a4935b969867b 100644 --- a/tools/node_modules/@babel/core/node_modules/@babel/types/lib/validators/generated/index.js +++ b/tools/node_modules/@babel/core/node_modules/@babel/types/lib/validators/generated/index.js @@ -3933,7 +3933,7 @@ function isExpression(node, opts) { if (!node) return false; const nodeType = node.type; - if (nodeType === "Expression" || "ArrayExpression" === nodeType || "AssignmentExpression" === nodeType || "BinaryExpression" === nodeType || "CallExpression" === nodeType || "ConditionalExpression" === nodeType || "FunctionExpression" === nodeType || "Identifier" === nodeType || "StringLiteral" === nodeType || "NumericLiteral" === nodeType || "NullLiteral" === nodeType || "BooleanLiteral" === nodeType || "RegExpLiteral" === nodeType || "LogicalExpression" === nodeType || "MemberExpression" === nodeType || "NewExpression" === nodeType || "ObjectExpression" === nodeType || "SequenceExpression" === nodeType || "ParenthesizedExpression" === nodeType || "ThisExpression" === nodeType || "UnaryExpression" === nodeType || "UpdateExpression" === nodeType || "ArrowFunctionExpression" === nodeType || "ClassExpression" === nodeType || "MetaProperty" === nodeType || "Super" === nodeType || "TaggedTemplateExpression" === nodeType || "TemplateLiteral" === nodeType || "YieldExpression" === nodeType || "AwaitExpression" === nodeType || "Import" === nodeType || "BigIntLiteral" === nodeType || "OptionalMemberExpression" === nodeType || "OptionalCallExpression" === nodeType || "TypeCastExpression" === nodeType || "JSXElement" === nodeType || "JSXFragment" === nodeType || "BindExpression" === nodeType || "PipelinePrimaryTopicReference" === nodeType || "DoExpression" === nodeType || "RecordExpression" === nodeType || "TupleExpression" === nodeType || "DecimalLiteral" === nodeType || "TSAsExpression" === nodeType || "TSTypeAssertion" === nodeType || "TSNonNullExpression" === nodeType || nodeType === "Placeholder" && ("Expression" === node.expectedNode || "Identifier" === node.expectedNode || "StringLiteral" === node.expectedNode)) { + if ("ArrayExpression" === nodeType || "AssignmentExpression" === nodeType || "BinaryExpression" === nodeType || "CallExpression" === nodeType || "ConditionalExpression" === nodeType || "FunctionExpression" === nodeType || "Identifier" === nodeType || "StringLiteral" === nodeType || "NumericLiteral" === nodeType || "NullLiteral" === nodeType || "BooleanLiteral" === nodeType || "RegExpLiteral" === nodeType || "LogicalExpression" === nodeType || "MemberExpression" === nodeType || "NewExpression" === nodeType || "ObjectExpression" === nodeType || "SequenceExpression" === nodeType || "ParenthesizedExpression" === nodeType || "ThisExpression" === nodeType || "UnaryExpression" === nodeType || "UpdateExpression" === nodeType || "ArrowFunctionExpression" === nodeType || "ClassExpression" === nodeType || "MetaProperty" === nodeType || "Super" === nodeType || "TaggedTemplateExpression" === nodeType || "TemplateLiteral" === nodeType || "YieldExpression" === nodeType || "AwaitExpression" === nodeType || "Import" === nodeType || "BigIntLiteral" === nodeType || "OptionalMemberExpression" === nodeType || "OptionalCallExpression" === nodeType || "TypeCastExpression" === nodeType || "JSXElement" === nodeType || "JSXFragment" === nodeType || "BindExpression" === nodeType || "PipelinePrimaryTopicReference" === nodeType || "DoExpression" === nodeType || "RecordExpression" === nodeType || "TupleExpression" === nodeType || "DecimalLiteral" === nodeType || "TSAsExpression" === nodeType || "TSTypeAssertion" === nodeType || "TSNonNullExpression" === nodeType || nodeType === "Placeholder" && ("Expression" === node.expectedNode || "Identifier" === node.expectedNode || "StringLiteral" === node.expectedNode)) { if (typeof opts === "undefined") { return true; } else { @@ -3948,7 +3948,7 @@ function isBinary(node, opts) { if (!node) return false; const nodeType = node.type; - if (nodeType === "Binary" || "BinaryExpression" === nodeType || "LogicalExpression" === nodeType) { + if ("BinaryExpression" === nodeType || "LogicalExpression" === nodeType) { if (typeof opts === "undefined") { return true; } else { @@ -3963,7 +3963,7 @@ function isScopable(node, opts) { if (!node) return false; const nodeType = node.type; - if (nodeType === "Scopable" || "BlockStatement" === nodeType || "CatchClause" === nodeType || "DoWhileStatement" === nodeType || "ForInStatement" === nodeType || "ForStatement" === nodeType || "FunctionDeclaration" === nodeType || "FunctionExpression" === nodeType || "Program" === nodeType || "ObjectMethod" === nodeType || "SwitchStatement" === nodeType || "WhileStatement" === nodeType || "ArrowFunctionExpression" === nodeType || "ClassExpression" === nodeType || "ClassDeclaration" === nodeType || "ForOfStatement" === nodeType || "ClassMethod" === nodeType || "ClassPrivateMethod" === nodeType || "StaticBlock" === nodeType || "TSModuleBlock" === nodeType || nodeType === "Placeholder" && "BlockStatement" === node.expectedNode) { + if ("BlockStatement" === nodeType || "CatchClause" === nodeType || "DoWhileStatement" === nodeType || "ForInStatement" === nodeType || "ForStatement" === nodeType || "FunctionDeclaration" === nodeType || "FunctionExpression" === nodeType || "Program" === nodeType || "ObjectMethod" === nodeType || "SwitchStatement" === nodeType || "WhileStatement" === nodeType || "ArrowFunctionExpression" === nodeType || "ClassExpression" === nodeType || "ClassDeclaration" === nodeType || "ForOfStatement" === nodeType || "ClassMethod" === nodeType || "ClassPrivateMethod" === nodeType || "StaticBlock" === nodeType || "TSModuleBlock" === nodeType || nodeType === "Placeholder" && "BlockStatement" === node.expectedNode) { if (typeof opts === "undefined") { return true; } else { @@ -3978,7 +3978,7 @@ function isBlockParent(node, opts) { if (!node) return false; const nodeType = node.type; - if (nodeType === "BlockParent" || "BlockStatement" === nodeType || "CatchClause" === nodeType || "DoWhileStatement" === nodeType || "ForInStatement" === nodeType || "ForStatement" === nodeType || "FunctionDeclaration" === nodeType || "FunctionExpression" === nodeType || "Program" === nodeType || "ObjectMethod" === nodeType || "SwitchStatement" === nodeType || "WhileStatement" === nodeType || "ArrowFunctionExpression" === nodeType || "ForOfStatement" === nodeType || "ClassMethod" === nodeType || "ClassPrivateMethod" === nodeType || "StaticBlock" === nodeType || "TSModuleBlock" === nodeType || nodeType === "Placeholder" && "BlockStatement" === node.expectedNode) { + if ("BlockStatement" === nodeType || "CatchClause" === nodeType || "DoWhileStatement" === nodeType || "ForInStatement" === nodeType || "ForStatement" === nodeType || "FunctionDeclaration" === nodeType || "FunctionExpression" === nodeType || "Program" === nodeType || "ObjectMethod" === nodeType || "SwitchStatement" === nodeType || "WhileStatement" === nodeType || "ArrowFunctionExpression" === nodeType || "ForOfStatement" === nodeType || "ClassMethod" === nodeType || "ClassPrivateMethod" === nodeType || "StaticBlock" === nodeType || "TSModuleBlock" === nodeType || nodeType === "Placeholder" && "BlockStatement" === node.expectedNode) { if (typeof opts === "undefined") { return true; } else { @@ -3993,7 +3993,7 @@ function isBlock(node, opts) { if (!node) return false; const nodeType = node.type; - if (nodeType === "Block" || "BlockStatement" === nodeType || "Program" === nodeType || "TSModuleBlock" === nodeType || nodeType === "Placeholder" && "BlockStatement" === node.expectedNode) { + if ("BlockStatement" === nodeType || "Program" === nodeType || "TSModuleBlock" === nodeType || nodeType === "Placeholder" && "BlockStatement" === node.expectedNode) { if (typeof opts === "undefined") { return true; } else { @@ -4008,7 +4008,7 @@ function isStatement(node, opts) { if (!node) return false; const nodeType = node.type; - if (nodeType === "Statement" || "BlockStatement" === nodeType || "BreakStatement" === nodeType || "ContinueStatement" === nodeType || "DebuggerStatement" === nodeType || "DoWhileStatement" === nodeType || "EmptyStatement" === nodeType || "ExpressionStatement" === nodeType || "ForInStatement" === nodeType || "ForStatement" === nodeType || "FunctionDeclaration" === nodeType || "IfStatement" === nodeType || "LabeledStatement" === nodeType || "ReturnStatement" === nodeType || "SwitchStatement" === nodeType || "ThrowStatement" === nodeType || "TryStatement" === nodeType || "VariableDeclaration" === nodeType || "WhileStatement" === nodeType || "WithStatement" === nodeType || "ClassDeclaration" === nodeType || "ExportAllDeclaration" === nodeType || "ExportDefaultDeclaration" === nodeType || "ExportNamedDeclaration" === nodeType || "ForOfStatement" === nodeType || "ImportDeclaration" === nodeType || "DeclareClass" === nodeType || "DeclareFunction" === nodeType || "DeclareInterface" === nodeType || "DeclareModule" === nodeType || "DeclareModuleExports" === nodeType || "DeclareTypeAlias" === nodeType || "DeclareOpaqueType" === nodeType || "DeclareVariable" === nodeType || "DeclareExportDeclaration" === nodeType || "DeclareExportAllDeclaration" === nodeType || "InterfaceDeclaration" === nodeType || "OpaqueType" === nodeType || "TypeAlias" === nodeType || "EnumDeclaration" === nodeType || "TSDeclareFunction" === nodeType || "TSInterfaceDeclaration" === nodeType || "TSTypeAliasDeclaration" === nodeType || "TSEnumDeclaration" === nodeType || "TSModuleDeclaration" === nodeType || "TSImportEqualsDeclaration" === nodeType || "TSExportAssignment" === nodeType || "TSNamespaceExportDeclaration" === nodeType || nodeType === "Placeholder" && ("Statement" === node.expectedNode || "Declaration" === node.expectedNode || "BlockStatement" === node.expectedNode)) { + if ("BlockStatement" === nodeType || "BreakStatement" === nodeType || "ContinueStatement" === nodeType || "DebuggerStatement" === nodeType || "DoWhileStatement" === nodeType || "EmptyStatement" === nodeType || "ExpressionStatement" === nodeType || "ForInStatement" === nodeType || "ForStatement" === nodeType || "FunctionDeclaration" === nodeType || "IfStatement" === nodeType || "LabeledStatement" === nodeType || "ReturnStatement" === nodeType || "SwitchStatement" === nodeType || "ThrowStatement" === nodeType || "TryStatement" === nodeType || "VariableDeclaration" === nodeType || "WhileStatement" === nodeType || "WithStatement" === nodeType || "ClassDeclaration" === nodeType || "ExportAllDeclaration" === nodeType || "ExportDefaultDeclaration" === nodeType || "ExportNamedDeclaration" === nodeType || "ForOfStatement" === nodeType || "ImportDeclaration" === nodeType || "DeclareClass" === nodeType || "DeclareFunction" === nodeType || "DeclareInterface" === nodeType || "DeclareModule" === nodeType || "DeclareModuleExports" === nodeType || "DeclareTypeAlias" === nodeType || "DeclareOpaqueType" === nodeType || "DeclareVariable" === nodeType || "DeclareExportDeclaration" === nodeType || "DeclareExportAllDeclaration" === nodeType || "InterfaceDeclaration" === nodeType || "OpaqueType" === nodeType || "TypeAlias" === nodeType || "EnumDeclaration" === nodeType || "TSDeclareFunction" === nodeType || "TSInterfaceDeclaration" === nodeType || "TSTypeAliasDeclaration" === nodeType || "TSEnumDeclaration" === nodeType || "TSModuleDeclaration" === nodeType || "TSImportEqualsDeclaration" === nodeType || "TSExportAssignment" === nodeType || "TSNamespaceExportDeclaration" === nodeType || nodeType === "Placeholder" && ("Statement" === node.expectedNode || "Declaration" === node.expectedNode || "BlockStatement" === node.expectedNode)) { if (typeof opts === "undefined") { return true; } else { @@ -4023,7 +4023,7 @@ function isTerminatorless(node, opts) { if (!node) return false; const nodeType = node.type; - if (nodeType === "Terminatorless" || "BreakStatement" === nodeType || "ContinueStatement" === nodeType || "ReturnStatement" === nodeType || "ThrowStatement" === nodeType || "YieldExpression" === nodeType || "AwaitExpression" === nodeType) { + if ("BreakStatement" === nodeType || "ContinueStatement" === nodeType || "ReturnStatement" === nodeType || "ThrowStatement" === nodeType || "YieldExpression" === nodeType || "AwaitExpression" === nodeType) { if (typeof opts === "undefined") { return true; } else { @@ -4038,7 +4038,7 @@ function isCompletionStatement(node, opts) { if (!node) return false; const nodeType = node.type; - if (nodeType === "CompletionStatement" || "BreakStatement" === nodeType || "ContinueStatement" === nodeType || "ReturnStatement" === nodeType || "ThrowStatement" === nodeType) { + if ("BreakStatement" === nodeType || "ContinueStatement" === nodeType || "ReturnStatement" === nodeType || "ThrowStatement" === nodeType) { if (typeof opts === "undefined") { return true; } else { @@ -4053,7 +4053,7 @@ function isConditional(node, opts) { if (!node) return false; const nodeType = node.type; - if (nodeType === "Conditional" || "ConditionalExpression" === nodeType || "IfStatement" === nodeType) { + if ("ConditionalExpression" === nodeType || "IfStatement" === nodeType) { if (typeof opts === "undefined") { return true; } else { @@ -4068,7 +4068,7 @@ function isLoop(node, opts) { if (!node) return false; const nodeType = node.type; - if (nodeType === "Loop" || "DoWhileStatement" === nodeType || "ForInStatement" === nodeType || "ForStatement" === nodeType || "WhileStatement" === nodeType || "ForOfStatement" === nodeType) { + if ("DoWhileStatement" === nodeType || "ForInStatement" === nodeType || "ForStatement" === nodeType || "WhileStatement" === nodeType || "ForOfStatement" === nodeType) { if (typeof opts === "undefined") { return true; } else { @@ -4083,7 +4083,7 @@ function isWhile(node, opts) { if (!node) return false; const nodeType = node.type; - if (nodeType === "While" || "DoWhileStatement" === nodeType || "WhileStatement" === nodeType) { + if ("DoWhileStatement" === nodeType || "WhileStatement" === nodeType) { if (typeof opts === "undefined") { return true; } else { @@ -4098,7 +4098,7 @@ function isExpressionWrapper(node, opts) { if (!node) return false; const nodeType = node.type; - if (nodeType === "ExpressionWrapper" || "ExpressionStatement" === nodeType || "ParenthesizedExpression" === nodeType || "TypeCastExpression" === nodeType) { + if ("ExpressionStatement" === nodeType || "ParenthesizedExpression" === nodeType || "TypeCastExpression" === nodeType) { if (typeof opts === "undefined") { return true; } else { @@ -4113,7 +4113,7 @@ function isFor(node, opts) { if (!node) return false; const nodeType = node.type; - if (nodeType === "For" || "ForInStatement" === nodeType || "ForStatement" === nodeType || "ForOfStatement" === nodeType) { + if ("ForInStatement" === nodeType || "ForStatement" === nodeType || "ForOfStatement" === nodeType) { if (typeof opts === "undefined") { return true; } else { @@ -4128,7 +4128,7 @@ function isForXStatement(node, opts) { if (!node) return false; const nodeType = node.type; - if (nodeType === "ForXStatement" || "ForInStatement" === nodeType || "ForOfStatement" === nodeType) { + if ("ForInStatement" === nodeType || "ForOfStatement" === nodeType) { if (typeof opts === "undefined") { return true; } else { @@ -4143,7 +4143,7 @@ function isFunction(node, opts) { if (!node) return false; const nodeType = node.type; - if (nodeType === "Function" || "FunctionDeclaration" === nodeType || "FunctionExpression" === nodeType || "ObjectMethod" === nodeType || "ArrowFunctionExpression" === nodeType || "ClassMethod" === nodeType || "ClassPrivateMethod" === nodeType) { + if ("FunctionDeclaration" === nodeType || "FunctionExpression" === nodeType || "ObjectMethod" === nodeType || "ArrowFunctionExpression" === nodeType || "ClassMethod" === nodeType || "ClassPrivateMethod" === nodeType) { if (typeof opts === "undefined") { return true; } else { @@ -4158,7 +4158,7 @@ function isFunctionParent(node, opts) { if (!node) return false; const nodeType = node.type; - if (nodeType === "FunctionParent" || "FunctionDeclaration" === nodeType || "FunctionExpression" === nodeType || "ObjectMethod" === nodeType || "ArrowFunctionExpression" === nodeType || "ClassMethod" === nodeType || "ClassPrivateMethod" === nodeType) { + if ("FunctionDeclaration" === nodeType || "FunctionExpression" === nodeType || "ObjectMethod" === nodeType || "ArrowFunctionExpression" === nodeType || "ClassMethod" === nodeType || "ClassPrivateMethod" === nodeType) { if (typeof opts === "undefined") { return true; } else { @@ -4173,7 +4173,7 @@ function isPureish(node, opts) { if (!node) return false; const nodeType = node.type; - if (nodeType === "Pureish" || "FunctionDeclaration" === nodeType || "FunctionExpression" === nodeType || "StringLiteral" === nodeType || "NumericLiteral" === nodeType || "NullLiteral" === nodeType || "BooleanLiteral" === nodeType || "RegExpLiteral" === nodeType || "ArrowFunctionExpression" === nodeType || "BigIntLiteral" === nodeType || "DecimalLiteral" === nodeType || nodeType === "Placeholder" && "StringLiteral" === node.expectedNode) { + if ("FunctionDeclaration" === nodeType || "FunctionExpression" === nodeType || "StringLiteral" === nodeType || "NumericLiteral" === nodeType || "NullLiteral" === nodeType || "BooleanLiteral" === nodeType || "RegExpLiteral" === nodeType || "ArrowFunctionExpression" === nodeType || "BigIntLiteral" === nodeType || "DecimalLiteral" === nodeType || nodeType === "Placeholder" && "StringLiteral" === node.expectedNode) { if (typeof opts === "undefined") { return true; } else { @@ -4188,7 +4188,7 @@ function isDeclaration(node, opts) { if (!node) return false; const nodeType = node.type; - if (nodeType === "Declaration" || "FunctionDeclaration" === nodeType || "VariableDeclaration" === nodeType || "ClassDeclaration" === nodeType || "ExportAllDeclaration" === nodeType || "ExportDefaultDeclaration" === nodeType || "ExportNamedDeclaration" === nodeType || "ImportDeclaration" === nodeType || "DeclareClass" === nodeType || "DeclareFunction" === nodeType || "DeclareInterface" === nodeType || "DeclareModule" === nodeType || "DeclareModuleExports" === nodeType || "DeclareTypeAlias" === nodeType || "DeclareOpaqueType" === nodeType || "DeclareVariable" === nodeType || "DeclareExportDeclaration" === nodeType || "DeclareExportAllDeclaration" === nodeType || "InterfaceDeclaration" === nodeType || "OpaqueType" === nodeType || "TypeAlias" === nodeType || "EnumDeclaration" === nodeType || "TSDeclareFunction" === nodeType || "TSInterfaceDeclaration" === nodeType || "TSTypeAliasDeclaration" === nodeType || "TSEnumDeclaration" === nodeType || "TSModuleDeclaration" === nodeType || nodeType === "Placeholder" && "Declaration" === node.expectedNode) { + if ("FunctionDeclaration" === nodeType || "VariableDeclaration" === nodeType || "ClassDeclaration" === nodeType || "ExportAllDeclaration" === nodeType || "ExportDefaultDeclaration" === nodeType || "ExportNamedDeclaration" === nodeType || "ImportDeclaration" === nodeType || "DeclareClass" === nodeType || "DeclareFunction" === nodeType || "DeclareInterface" === nodeType || "DeclareModule" === nodeType || "DeclareModuleExports" === nodeType || "DeclareTypeAlias" === nodeType || "DeclareOpaqueType" === nodeType || "DeclareVariable" === nodeType || "DeclareExportDeclaration" === nodeType || "DeclareExportAllDeclaration" === nodeType || "InterfaceDeclaration" === nodeType || "OpaqueType" === nodeType || "TypeAlias" === nodeType || "EnumDeclaration" === nodeType || "TSDeclareFunction" === nodeType || "TSInterfaceDeclaration" === nodeType || "TSTypeAliasDeclaration" === nodeType || "TSEnumDeclaration" === nodeType || "TSModuleDeclaration" === nodeType || nodeType === "Placeholder" && "Declaration" === node.expectedNode) { if (typeof opts === "undefined") { return true; } else { @@ -4203,7 +4203,7 @@ function isPatternLike(node, opts) { if (!node) return false; const nodeType = node.type; - if (nodeType === "PatternLike" || "Identifier" === nodeType || "RestElement" === nodeType || "AssignmentPattern" === nodeType || "ArrayPattern" === nodeType || "ObjectPattern" === nodeType || nodeType === "Placeholder" && ("Pattern" === node.expectedNode || "Identifier" === node.expectedNode)) { + if ("Identifier" === nodeType || "RestElement" === nodeType || "AssignmentPattern" === nodeType || "ArrayPattern" === nodeType || "ObjectPattern" === nodeType || nodeType === "Placeholder" && ("Pattern" === node.expectedNode || "Identifier" === node.expectedNode)) { if (typeof opts === "undefined") { return true; } else { @@ -4218,7 +4218,7 @@ function isLVal(node, opts) { if (!node) return false; const nodeType = node.type; - if (nodeType === "LVal" || "Identifier" === nodeType || "MemberExpression" === nodeType || "RestElement" === nodeType || "AssignmentPattern" === nodeType || "ArrayPattern" === nodeType || "ObjectPattern" === nodeType || "TSParameterProperty" === nodeType || nodeType === "Placeholder" && ("Pattern" === node.expectedNode || "Identifier" === node.expectedNode)) { + if ("Identifier" === nodeType || "MemberExpression" === nodeType || "RestElement" === nodeType || "AssignmentPattern" === nodeType || "ArrayPattern" === nodeType || "ObjectPattern" === nodeType || "TSParameterProperty" === nodeType || nodeType === "Placeholder" && ("Pattern" === node.expectedNode || "Identifier" === node.expectedNode)) { if (typeof opts === "undefined") { return true; } else { @@ -4233,7 +4233,7 @@ function isTSEntityName(node, opts) { if (!node) return false; const nodeType = node.type; - if (nodeType === "TSEntityName" || "Identifier" === nodeType || "TSQualifiedName" === nodeType || nodeType === "Placeholder" && "Identifier" === node.expectedNode) { + if ("Identifier" === nodeType || "TSQualifiedName" === nodeType || nodeType === "Placeholder" && "Identifier" === node.expectedNode) { if (typeof opts === "undefined") { return true; } else { @@ -4248,7 +4248,7 @@ function isLiteral(node, opts) { if (!node) return false; const nodeType = node.type; - if (nodeType === "Literal" || "StringLiteral" === nodeType || "NumericLiteral" === nodeType || "NullLiteral" === nodeType || "BooleanLiteral" === nodeType || "RegExpLiteral" === nodeType || "TemplateLiteral" === nodeType || "BigIntLiteral" === nodeType || "DecimalLiteral" === nodeType || nodeType === "Placeholder" && "StringLiteral" === node.expectedNode) { + if ("StringLiteral" === nodeType || "NumericLiteral" === nodeType || "NullLiteral" === nodeType || "BooleanLiteral" === nodeType || "RegExpLiteral" === nodeType || "TemplateLiteral" === nodeType || "BigIntLiteral" === nodeType || "DecimalLiteral" === nodeType || nodeType === "Placeholder" && "StringLiteral" === node.expectedNode) { if (typeof opts === "undefined") { return true; } else { @@ -4263,7 +4263,7 @@ function isImmutable(node, opts) { if (!node) return false; const nodeType = node.type; - if (nodeType === "Immutable" || "StringLiteral" === nodeType || "NumericLiteral" === nodeType || "NullLiteral" === nodeType || "BooleanLiteral" === nodeType || "BigIntLiteral" === nodeType || "JSXAttribute" === nodeType || "JSXClosingElement" === nodeType || "JSXElement" === nodeType || "JSXExpressionContainer" === nodeType || "JSXSpreadChild" === nodeType || "JSXOpeningElement" === nodeType || "JSXText" === nodeType || "JSXFragment" === nodeType || "JSXOpeningFragment" === nodeType || "JSXClosingFragment" === nodeType || "DecimalLiteral" === nodeType || nodeType === "Placeholder" && "StringLiteral" === node.expectedNode) { + if ("StringLiteral" === nodeType || "NumericLiteral" === nodeType || "NullLiteral" === nodeType || "BooleanLiteral" === nodeType || "BigIntLiteral" === nodeType || "JSXAttribute" === nodeType || "JSXClosingElement" === nodeType || "JSXElement" === nodeType || "JSXExpressionContainer" === nodeType || "JSXSpreadChild" === nodeType || "JSXOpeningElement" === nodeType || "JSXText" === nodeType || "JSXFragment" === nodeType || "JSXOpeningFragment" === nodeType || "JSXClosingFragment" === nodeType || "DecimalLiteral" === nodeType || nodeType === "Placeholder" && "StringLiteral" === node.expectedNode) { if (typeof opts === "undefined") { return true; } else { @@ -4278,7 +4278,7 @@ function isUserWhitespacable(node, opts) { if (!node) return false; const nodeType = node.type; - if (nodeType === "UserWhitespacable" || "ObjectMethod" === nodeType || "ObjectProperty" === nodeType || "ObjectTypeInternalSlot" === nodeType || "ObjectTypeCallProperty" === nodeType || "ObjectTypeIndexer" === nodeType || "ObjectTypeProperty" === nodeType || "ObjectTypeSpreadProperty" === nodeType) { + if ("ObjectMethod" === nodeType || "ObjectProperty" === nodeType || "ObjectTypeInternalSlot" === nodeType || "ObjectTypeCallProperty" === nodeType || "ObjectTypeIndexer" === nodeType || "ObjectTypeProperty" === nodeType || "ObjectTypeSpreadProperty" === nodeType) { if (typeof opts === "undefined") { return true; } else { @@ -4293,7 +4293,7 @@ function isMethod(node, opts) { if (!node) return false; const nodeType = node.type; - if (nodeType === "Method" || "ObjectMethod" === nodeType || "ClassMethod" === nodeType || "ClassPrivateMethod" === nodeType) { + if ("ObjectMethod" === nodeType || "ClassMethod" === nodeType || "ClassPrivateMethod" === nodeType) { if (typeof opts === "undefined") { return true; } else { @@ -4308,7 +4308,7 @@ function isObjectMember(node, opts) { if (!node) return false; const nodeType = node.type; - if (nodeType === "ObjectMember" || "ObjectMethod" === nodeType || "ObjectProperty" === nodeType) { + if ("ObjectMethod" === nodeType || "ObjectProperty" === nodeType) { if (typeof opts === "undefined") { return true; } else { @@ -4323,7 +4323,7 @@ function isProperty(node, opts) { if (!node) return false; const nodeType = node.type; - if (nodeType === "Property" || "ObjectProperty" === nodeType || "ClassProperty" === nodeType || "ClassPrivateProperty" === nodeType) { + if ("ObjectProperty" === nodeType || "ClassProperty" === nodeType || "ClassPrivateProperty" === nodeType) { if (typeof opts === "undefined") { return true; } else { @@ -4338,7 +4338,7 @@ function isUnaryLike(node, opts) { if (!node) return false; const nodeType = node.type; - if (nodeType === "UnaryLike" || "UnaryExpression" === nodeType || "SpreadElement" === nodeType) { + if ("UnaryExpression" === nodeType || "SpreadElement" === nodeType) { if (typeof opts === "undefined") { return true; } else { @@ -4353,7 +4353,7 @@ function isPattern(node, opts) { if (!node) return false; const nodeType = node.type; - if (nodeType === "Pattern" || "AssignmentPattern" === nodeType || "ArrayPattern" === nodeType || "ObjectPattern" === nodeType || nodeType === "Placeholder" && "Pattern" === node.expectedNode) { + if ("AssignmentPattern" === nodeType || "ArrayPattern" === nodeType || "ObjectPattern" === nodeType || nodeType === "Placeholder" && "Pattern" === node.expectedNode) { if (typeof opts === "undefined") { return true; } else { @@ -4368,7 +4368,7 @@ function isClass(node, opts) { if (!node) return false; const nodeType = node.type; - if (nodeType === "Class" || "ClassExpression" === nodeType || "ClassDeclaration" === nodeType) { + if ("ClassExpression" === nodeType || "ClassDeclaration" === nodeType) { if (typeof opts === "undefined") { return true; } else { @@ -4383,7 +4383,7 @@ function isModuleDeclaration(node, opts) { if (!node) return false; const nodeType = node.type; - if (nodeType === "ModuleDeclaration" || "ExportAllDeclaration" === nodeType || "ExportDefaultDeclaration" === nodeType || "ExportNamedDeclaration" === nodeType || "ImportDeclaration" === nodeType) { + if ("ExportAllDeclaration" === nodeType || "ExportDefaultDeclaration" === nodeType || "ExportNamedDeclaration" === nodeType || "ImportDeclaration" === nodeType) { if (typeof opts === "undefined") { return true; } else { @@ -4398,7 +4398,7 @@ function isExportDeclaration(node, opts) { if (!node) return false; const nodeType = node.type; - if (nodeType === "ExportDeclaration" || "ExportAllDeclaration" === nodeType || "ExportDefaultDeclaration" === nodeType || "ExportNamedDeclaration" === nodeType) { + if ("ExportAllDeclaration" === nodeType || "ExportDefaultDeclaration" === nodeType || "ExportNamedDeclaration" === nodeType) { if (typeof opts === "undefined") { return true; } else { @@ -4413,7 +4413,7 @@ function isModuleSpecifier(node, opts) { if (!node) return false; const nodeType = node.type; - if (nodeType === "ModuleSpecifier" || "ExportSpecifier" === nodeType || "ImportDefaultSpecifier" === nodeType || "ImportNamespaceSpecifier" === nodeType || "ImportSpecifier" === nodeType || "ExportNamespaceSpecifier" === nodeType || "ExportDefaultSpecifier" === nodeType) { + if ("ExportSpecifier" === nodeType || "ImportDefaultSpecifier" === nodeType || "ImportNamespaceSpecifier" === nodeType || "ImportSpecifier" === nodeType || "ExportNamespaceSpecifier" === nodeType || "ExportDefaultSpecifier" === nodeType) { if (typeof opts === "undefined") { return true; } else { @@ -4428,7 +4428,7 @@ function isFlow(node, opts) { if (!node) return false; const nodeType = node.type; - if (nodeType === "Flow" || "AnyTypeAnnotation" === nodeType || "ArrayTypeAnnotation" === nodeType || "BooleanTypeAnnotation" === nodeType || "BooleanLiteralTypeAnnotation" === nodeType || "NullLiteralTypeAnnotation" === nodeType || "ClassImplements" === nodeType || "DeclareClass" === nodeType || "DeclareFunction" === nodeType || "DeclareInterface" === nodeType || "DeclareModule" === nodeType || "DeclareModuleExports" === nodeType || "DeclareTypeAlias" === nodeType || "DeclareOpaqueType" === nodeType || "DeclareVariable" === nodeType || "DeclareExportDeclaration" === nodeType || "DeclareExportAllDeclaration" === nodeType || "DeclaredPredicate" === nodeType || "ExistsTypeAnnotation" === nodeType || "FunctionTypeAnnotation" === nodeType || "FunctionTypeParam" === nodeType || "GenericTypeAnnotation" === nodeType || "InferredPredicate" === nodeType || "InterfaceExtends" === nodeType || "InterfaceDeclaration" === nodeType || "InterfaceTypeAnnotation" === nodeType || "IntersectionTypeAnnotation" === nodeType || "MixedTypeAnnotation" === nodeType || "EmptyTypeAnnotation" === nodeType || "NullableTypeAnnotation" === nodeType || "NumberLiteralTypeAnnotation" === nodeType || "NumberTypeAnnotation" === nodeType || "ObjectTypeAnnotation" === nodeType || "ObjectTypeInternalSlot" === nodeType || "ObjectTypeCallProperty" === nodeType || "ObjectTypeIndexer" === nodeType || "ObjectTypeProperty" === nodeType || "ObjectTypeSpreadProperty" === nodeType || "OpaqueType" === nodeType || "QualifiedTypeIdentifier" === nodeType || "StringLiteralTypeAnnotation" === nodeType || "StringTypeAnnotation" === nodeType || "SymbolTypeAnnotation" === nodeType || "ThisTypeAnnotation" === nodeType || "TupleTypeAnnotation" === nodeType || "TypeofTypeAnnotation" === nodeType || "TypeAlias" === nodeType || "TypeAnnotation" === nodeType || "TypeCastExpression" === nodeType || "TypeParameter" === nodeType || "TypeParameterDeclaration" === nodeType || "TypeParameterInstantiation" === nodeType || "UnionTypeAnnotation" === nodeType || "Variance" === nodeType || "VoidTypeAnnotation" === nodeType) { + if ("AnyTypeAnnotation" === nodeType || "ArrayTypeAnnotation" === nodeType || "BooleanTypeAnnotation" === nodeType || "BooleanLiteralTypeAnnotation" === nodeType || "NullLiteralTypeAnnotation" === nodeType || "ClassImplements" === nodeType || "DeclareClass" === nodeType || "DeclareFunction" === nodeType || "DeclareInterface" === nodeType || "DeclareModule" === nodeType || "DeclareModuleExports" === nodeType || "DeclareTypeAlias" === nodeType || "DeclareOpaqueType" === nodeType || "DeclareVariable" === nodeType || "DeclareExportDeclaration" === nodeType || "DeclareExportAllDeclaration" === nodeType || "DeclaredPredicate" === nodeType || "ExistsTypeAnnotation" === nodeType || "FunctionTypeAnnotation" === nodeType || "FunctionTypeParam" === nodeType || "GenericTypeAnnotation" === nodeType || "InferredPredicate" === nodeType || "InterfaceExtends" === nodeType || "InterfaceDeclaration" === nodeType || "InterfaceTypeAnnotation" === nodeType || "IntersectionTypeAnnotation" === nodeType || "MixedTypeAnnotation" === nodeType || "EmptyTypeAnnotation" === nodeType || "NullableTypeAnnotation" === nodeType || "NumberLiteralTypeAnnotation" === nodeType || "NumberTypeAnnotation" === nodeType || "ObjectTypeAnnotation" === nodeType || "ObjectTypeInternalSlot" === nodeType || "ObjectTypeCallProperty" === nodeType || "ObjectTypeIndexer" === nodeType || "ObjectTypeProperty" === nodeType || "ObjectTypeSpreadProperty" === nodeType || "OpaqueType" === nodeType || "QualifiedTypeIdentifier" === nodeType || "StringLiteralTypeAnnotation" === nodeType || "StringTypeAnnotation" === nodeType || "SymbolTypeAnnotation" === nodeType || "ThisTypeAnnotation" === nodeType || "TupleTypeAnnotation" === nodeType || "TypeofTypeAnnotation" === nodeType || "TypeAlias" === nodeType || "TypeAnnotation" === nodeType || "TypeCastExpression" === nodeType || "TypeParameter" === nodeType || "TypeParameterDeclaration" === nodeType || "TypeParameterInstantiation" === nodeType || "UnionTypeAnnotation" === nodeType || "Variance" === nodeType || "VoidTypeAnnotation" === nodeType) { if (typeof opts === "undefined") { return true; } else { @@ -4443,7 +4443,7 @@ function isFlowType(node, opts) { if (!node) return false; const nodeType = node.type; - if (nodeType === "FlowType" || "AnyTypeAnnotation" === nodeType || "ArrayTypeAnnotation" === nodeType || "BooleanTypeAnnotation" === nodeType || "BooleanLiteralTypeAnnotation" === nodeType || "NullLiteralTypeAnnotation" === nodeType || "ExistsTypeAnnotation" === nodeType || "FunctionTypeAnnotation" === nodeType || "GenericTypeAnnotation" === nodeType || "InterfaceTypeAnnotation" === nodeType || "IntersectionTypeAnnotation" === nodeType || "MixedTypeAnnotation" === nodeType || "EmptyTypeAnnotation" === nodeType || "NullableTypeAnnotation" === nodeType || "NumberLiteralTypeAnnotation" === nodeType || "NumberTypeAnnotation" === nodeType || "ObjectTypeAnnotation" === nodeType || "StringLiteralTypeAnnotation" === nodeType || "StringTypeAnnotation" === nodeType || "SymbolTypeAnnotation" === nodeType || "ThisTypeAnnotation" === nodeType || "TupleTypeAnnotation" === nodeType || "TypeofTypeAnnotation" === nodeType || "UnionTypeAnnotation" === nodeType || "VoidTypeAnnotation" === nodeType) { + if ("AnyTypeAnnotation" === nodeType || "ArrayTypeAnnotation" === nodeType || "BooleanTypeAnnotation" === nodeType || "BooleanLiteralTypeAnnotation" === nodeType || "NullLiteralTypeAnnotation" === nodeType || "ExistsTypeAnnotation" === nodeType || "FunctionTypeAnnotation" === nodeType || "GenericTypeAnnotation" === nodeType || "InterfaceTypeAnnotation" === nodeType || "IntersectionTypeAnnotation" === nodeType || "MixedTypeAnnotation" === nodeType || "EmptyTypeAnnotation" === nodeType || "NullableTypeAnnotation" === nodeType || "NumberLiteralTypeAnnotation" === nodeType || "NumberTypeAnnotation" === nodeType || "ObjectTypeAnnotation" === nodeType || "StringLiteralTypeAnnotation" === nodeType || "StringTypeAnnotation" === nodeType || "SymbolTypeAnnotation" === nodeType || "ThisTypeAnnotation" === nodeType || "TupleTypeAnnotation" === nodeType || "TypeofTypeAnnotation" === nodeType || "UnionTypeAnnotation" === nodeType || "VoidTypeAnnotation" === nodeType) { if (typeof opts === "undefined") { return true; } else { @@ -4458,7 +4458,7 @@ function isFlowBaseAnnotation(node, opts) { if (!node) return false; const nodeType = node.type; - if (nodeType === "FlowBaseAnnotation" || "AnyTypeAnnotation" === nodeType || "BooleanTypeAnnotation" === nodeType || "NullLiteralTypeAnnotation" === nodeType || "MixedTypeAnnotation" === nodeType || "EmptyTypeAnnotation" === nodeType || "NumberTypeAnnotation" === nodeType || "StringTypeAnnotation" === nodeType || "SymbolTypeAnnotation" === nodeType || "ThisTypeAnnotation" === nodeType || "VoidTypeAnnotation" === nodeType) { + if ("AnyTypeAnnotation" === nodeType || "BooleanTypeAnnotation" === nodeType || "NullLiteralTypeAnnotation" === nodeType || "MixedTypeAnnotation" === nodeType || "EmptyTypeAnnotation" === nodeType || "NumberTypeAnnotation" === nodeType || "StringTypeAnnotation" === nodeType || "SymbolTypeAnnotation" === nodeType || "ThisTypeAnnotation" === nodeType || "VoidTypeAnnotation" === nodeType) { if (typeof opts === "undefined") { return true; } else { @@ -4473,7 +4473,7 @@ function isFlowDeclaration(node, opts) { if (!node) return false; const nodeType = node.type; - if (nodeType === "FlowDeclaration" || "DeclareClass" === nodeType || "DeclareFunction" === nodeType || "DeclareInterface" === nodeType || "DeclareModule" === nodeType || "DeclareModuleExports" === nodeType || "DeclareTypeAlias" === nodeType || "DeclareOpaqueType" === nodeType || "DeclareVariable" === nodeType || "DeclareExportDeclaration" === nodeType || "DeclareExportAllDeclaration" === nodeType || "InterfaceDeclaration" === nodeType || "OpaqueType" === nodeType || "TypeAlias" === nodeType) { + if ("DeclareClass" === nodeType || "DeclareFunction" === nodeType || "DeclareInterface" === nodeType || "DeclareModule" === nodeType || "DeclareModuleExports" === nodeType || "DeclareTypeAlias" === nodeType || "DeclareOpaqueType" === nodeType || "DeclareVariable" === nodeType || "DeclareExportDeclaration" === nodeType || "DeclareExportAllDeclaration" === nodeType || "InterfaceDeclaration" === nodeType || "OpaqueType" === nodeType || "TypeAlias" === nodeType) { if (typeof opts === "undefined") { return true; } else { @@ -4488,7 +4488,7 @@ function isFlowPredicate(node, opts) { if (!node) return false; const nodeType = node.type; - if (nodeType === "FlowPredicate" || "DeclaredPredicate" === nodeType || "InferredPredicate" === nodeType) { + if ("DeclaredPredicate" === nodeType || "InferredPredicate" === nodeType) { if (typeof opts === "undefined") { return true; } else { @@ -4503,7 +4503,7 @@ function isEnumBody(node, opts) { if (!node) return false; const nodeType = node.type; - if (nodeType === "EnumBody" || "EnumBooleanBody" === nodeType || "EnumNumberBody" === nodeType || "EnumStringBody" === nodeType || "EnumSymbolBody" === nodeType) { + if ("EnumBooleanBody" === nodeType || "EnumNumberBody" === nodeType || "EnumStringBody" === nodeType || "EnumSymbolBody" === nodeType) { if (typeof opts === "undefined") { return true; } else { @@ -4518,7 +4518,7 @@ function isEnumMember(node, opts) { if (!node) return false; const nodeType = node.type; - if (nodeType === "EnumMember" || "EnumBooleanMember" === nodeType || "EnumNumberMember" === nodeType || "EnumStringMember" === nodeType || "EnumDefaultedMember" === nodeType) { + if ("EnumBooleanMember" === nodeType || "EnumNumberMember" === nodeType || "EnumStringMember" === nodeType || "EnumDefaultedMember" === nodeType) { if (typeof opts === "undefined") { return true; } else { @@ -4533,7 +4533,7 @@ function isJSX(node, opts) { if (!node) return false; const nodeType = node.type; - if (nodeType === "JSX" || "JSXAttribute" === nodeType || "JSXClosingElement" === nodeType || "JSXElement" === nodeType || "JSXEmptyExpression" === nodeType || "JSXExpressionContainer" === nodeType || "JSXSpreadChild" === nodeType || "JSXIdentifier" === nodeType || "JSXMemberExpression" === nodeType || "JSXNamespacedName" === nodeType || "JSXOpeningElement" === nodeType || "JSXSpreadAttribute" === nodeType || "JSXText" === nodeType || "JSXFragment" === nodeType || "JSXOpeningFragment" === nodeType || "JSXClosingFragment" === nodeType) { + if ("JSXAttribute" === nodeType || "JSXClosingElement" === nodeType || "JSXElement" === nodeType || "JSXEmptyExpression" === nodeType || "JSXExpressionContainer" === nodeType || "JSXSpreadChild" === nodeType || "JSXIdentifier" === nodeType || "JSXMemberExpression" === nodeType || "JSXNamespacedName" === nodeType || "JSXOpeningElement" === nodeType || "JSXSpreadAttribute" === nodeType || "JSXText" === nodeType || "JSXFragment" === nodeType || "JSXOpeningFragment" === nodeType || "JSXClosingFragment" === nodeType) { if (typeof opts === "undefined") { return true; } else { @@ -4548,7 +4548,7 @@ function isPrivate(node, opts) { if (!node) return false; const nodeType = node.type; - if (nodeType === "Private" || "ClassPrivateProperty" === nodeType || "ClassPrivateMethod" === nodeType || "PrivateName" === nodeType) { + if ("ClassPrivateProperty" === nodeType || "ClassPrivateMethod" === nodeType || "PrivateName" === nodeType) { if (typeof opts === "undefined") { return true; } else { @@ -4563,7 +4563,7 @@ function isTSTypeElement(node, opts) { if (!node) return false; const nodeType = node.type; - if (nodeType === "TSTypeElement" || "TSCallSignatureDeclaration" === nodeType || "TSConstructSignatureDeclaration" === nodeType || "TSPropertySignature" === nodeType || "TSMethodSignature" === nodeType || "TSIndexSignature" === nodeType) { + if ("TSCallSignatureDeclaration" === nodeType || "TSConstructSignatureDeclaration" === nodeType || "TSPropertySignature" === nodeType || "TSMethodSignature" === nodeType || "TSIndexSignature" === nodeType) { if (typeof opts === "undefined") { return true; } else { @@ -4578,7 +4578,7 @@ function isTSType(node, opts) { if (!node) return false; const nodeType = node.type; - if (nodeType === "TSType" || "TSAnyKeyword" === nodeType || "TSBooleanKeyword" === nodeType || "TSBigIntKeyword" === nodeType || "TSIntrinsicKeyword" === nodeType || "TSNeverKeyword" === nodeType || "TSNullKeyword" === nodeType || "TSNumberKeyword" === nodeType || "TSObjectKeyword" === nodeType || "TSStringKeyword" === nodeType || "TSSymbolKeyword" === nodeType || "TSUndefinedKeyword" === nodeType || "TSUnknownKeyword" === nodeType || "TSVoidKeyword" === nodeType || "TSThisType" === nodeType || "TSFunctionType" === nodeType || "TSConstructorType" === nodeType || "TSTypeReference" === nodeType || "TSTypePredicate" === nodeType || "TSTypeQuery" === nodeType || "TSTypeLiteral" === nodeType || "TSArrayType" === nodeType || "TSTupleType" === nodeType || "TSOptionalType" === nodeType || "TSRestType" === nodeType || "TSUnionType" === nodeType || "TSIntersectionType" === nodeType || "TSConditionalType" === nodeType || "TSInferType" === nodeType || "TSParenthesizedType" === nodeType || "TSTypeOperator" === nodeType || "TSIndexedAccessType" === nodeType || "TSMappedType" === nodeType || "TSLiteralType" === nodeType || "TSExpressionWithTypeArguments" === nodeType || "TSImportType" === nodeType) { + if ("TSAnyKeyword" === nodeType || "TSBooleanKeyword" === nodeType || "TSBigIntKeyword" === nodeType || "TSIntrinsicKeyword" === nodeType || "TSNeverKeyword" === nodeType || "TSNullKeyword" === nodeType || "TSNumberKeyword" === nodeType || "TSObjectKeyword" === nodeType || "TSStringKeyword" === nodeType || "TSSymbolKeyword" === nodeType || "TSUndefinedKeyword" === nodeType || "TSUnknownKeyword" === nodeType || "TSVoidKeyword" === nodeType || "TSThisType" === nodeType || "TSFunctionType" === nodeType || "TSConstructorType" === nodeType || "TSTypeReference" === nodeType || "TSTypePredicate" === nodeType || "TSTypeQuery" === nodeType || "TSTypeLiteral" === nodeType || "TSArrayType" === nodeType || "TSTupleType" === nodeType || "TSOptionalType" === nodeType || "TSRestType" === nodeType || "TSUnionType" === nodeType || "TSIntersectionType" === nodeType || "TSConditionalType" === nodeType || "TSInferType" === nodeType || "TSParenthesizedType" === nodeType || "TSTypeOperator" === nodeType || "TSIndexedAccessType" === nodeType || "TSMappedType" === nodeType || "TSLiteralType" === nodeType || "TSExpressionWithTypeArguments" === nodeType || "TSImportType" === nodeType) { if (typeof opts === "undefined") { return true; } else { @@ -4593,7 +4593,7 @@ function isTSBaseType(node, opts) { if (!node) return false; const nodeType = node.type; - if (nodeType === "TSBaseType" || "TSAnyKeyword" === nodeType || "TSBooleanKeyword" === nodeType || "TSBigIntKeyword" === nodeType || "TSIntrinsicKeyword" === nodeType || "TSNeverKeyword" === nodeType || "TSNullKeyword" === nodeType || "TSNumberKeyword" === nodeType || "TSObjectKeyword" === nodeType || "TSStringKeyword" === nodeType || "TSSymbolKeyword" === nodeType || "TSUndefinedKeyword" === nodeType || "TSUnknownKeyword" === nodeType || "TSVoidKeyword" === nodeType || "TSThisType" === nodeType || "TSLiteralType" === nodeType) { + if ("TSAnyKeyword" === nodeType || "TSBooleanKeyword" === nodeType || "TSBigIntKeyword" === nodeType || "TSIntrinsicKeyword" === nodeType || "TSNeverKeyword" === nodeType || "TSNullKeyword" === nodeType || "TSNumberKeyword" === nodeType || "TSObjectKeyword" === nodeType || "TSStringKeyword" === nodeType || "TSSymbolKeyword" === nodeType || "TSUndefinedKeyword" === nodeType || "TSUnknownKeyword" === nodeType || "TSVoidKeyword" === nodeType || "TSThisType" === nodeType || "TSLiteralType" === nodeType) { if (typeof opts === "undefined") { return true; } else { diff --git a/tools/node_modules/@babel/core/node_modules/@babel/types/lib/validators/isReferenced.js b/tools/node_modules/@babel/core/node_modules/@babel/types/lib/validators/isReferenced.js index 8fd1662348ce13..45b3a367809b70 100644 --- a/tools/node_modules/@babel/core/node_modules/@babel/types/lib/validators/isReferenced.js +++ b/tools/node_modules/@babel/core/node_modules/@babel/types/lib/validators/isReferenced.js @@ -22,13 +22,6 @@ function isReferenced(node, parent, grandparent) { case "ArrowFunctionExpression": return parent.body === node; - case "ExportSpecifier": - if (parent.source) { - return false; - } - - return parent.local === node; - case "PrivateName": return false; @@ -83,6 +76,13 @@ function isReferenced(node, parent, grandparent) { case "ExportDefaultSpecifier": return false; + case "ExportSpecifier": + if (grandparent == null ? void 0 : grandparent.source) { + return false; + } + + return parent.local === node; + case "ImportDefaultSpecifier": case "ImportNamespaceSpecifier": case "ImportSpecifier": diff --git a/tools/node_modules/@babel/core/node_modules/@babel/types/lib/validators/isValidIdentifier.js b/tools/node_modules/@babel/core/node_modules/@babel/types/lib/validators/isValidIdentifier.js index c1adb9afe0d25e..3fa6f98000b6ba 100644 --- a/tools/node_modules/@babel/core/node_modules/@babel/types/lib/validators/isValidIdentifier.js +++ b/tools/node_modules/@babel/core/node_modules/@babel/types/lib/validators/isValidIdentifier.js @@ -11,9 +11,7 @@ function isValidIdentifier(name, reserved = true) { if (typeof name !== "string") return false; if (reserved) { - if ((0, _helperValidatorIdentifier.isKeyword)(name) || (0, _helperValidatorIdentifier.isStrictReservedWord)(name)) { - return false; - } else if (name === "await") { + if ((0, _helperValidatorIdentifier.isKeyword)(name) || (0, _helperValidatorIdentifier.isStrictReservedWord)(name, true)) { return false; } } diff --git a/tools/node_modules/@babel/core/node_modules/@babel/types/package.json b/tools/node_modules/@babel/core/node_modules/@babel/types/package.json index 7a3a503ea30e5b..c4807b60d81bdc 100644 --- a/tools/node_modules/@babel/core/node_modules/@babel/types/package.json +++ b/tools/node_modules/@babel/core/node_modules/@babel/types/package.json @@ -1,6 +1,6 @@ { "name": "@babel/types", - "version": "7.12.7", + "version": "7.12.12", "description": "Babel Types is a Lodash-esque utility library for AST nodes", "author": "Sebastian McKenzie <sebmck@gmail.com>", "homepage": "https://babeljs.io/", @@ -14,22 +14,23 @@ "directory": "packages/babel-types" }, "main": "lib/index.js", - "types": "lib/index.d.ts", + "types": "lib/index-legacy.d.ts", "typesVersions": { ">=3.7": { - "lib/index.d.ts": [ - "lib/index-ts3.7.d.ts" + "lib/index-legacy.d.ts": [ + "lib/index.d.ts" ] } }, "dependencies": { - "@babel/helper-validator-identifier": "^7.10.4", + "@babel/helper-validator-identifier": "^7.12.11", "lodash": "^4.17.19", "to-fast-properties": "^2.0.0" }, "devDependencies": { - "@babel/generator": "7.12.5", - "@babel/parser": "7.12.7", + "@babel/generator": "7.12.11", + "@babel/parser": "7.12.11", + "@types/lodash": "^4.14.162", "chalk": "^4.1.0" } } \ No newline at end of file diff --git a/tools/node_modules/@babel/core/node_modules/@babel/types/scripts/generateTypeHelpers.js b/tools/node_modules/@babel/core/node_modules/@babel/types/scripts/generateTypeHelpers.js deleted file mode 100644 index bf0b036c189e74..00000000000000 --- a/tools/node_modules/@babel/core/node_modules/@babel/types/scripts/generateTypeHelpers.js +++ /dev/null @@ -1,29 +0,0 @@ -"use strict"; -const path = require("path"); -const chalk = require("chalk"); -const generateBuilders = require("./generators/generateBuilders"); -const generateValidators = require("./generators/generateValidators"); -const generateAsserts = require("./generators/generateAsserts"); -const generateConstants = require("./generators/generateConstants"); -const format = require("../../../scripts/utils/formatCode"); -const writeFile = require("../../../scripts/utils/writeFileAndMkDir"); - -const baseDir = path.join(__dirname, "../src"); - -console.log("Generating @babel/types dynamic functions"); - -const buildersFile = path.join(baseDir, "builders/generated/index.js"); -writeFile(buildersFile, format(generateBuilders(), buildersFile)); -console.log(` ${chalk.green("✔")} Generated builders`); - -const validatorsFile = path.join(baseDir, "validators/generated/index.js"); -writeFile(validatorsFile, format(generateValidators(), validatorsFile)); -console.log(` ${chalk.green("✔")} Generated validators`); - -const assertsFile = path.join(baseDir, "asserts/generated/index.js"); -writeFile(assertsFile, format(generateAsserts(), assertsFile)); -console.log(` ${chalk.green("✔")} Generated asserts`); - -const constantsFile = path.join(baseDir, "constants/generated/index.js"); -writeFile(constantsFile, format(generateConstants(), constantsFile)); -console.log(` ${chalk.green("✔")} Generated constants`); diff --git a/tools/node_modules/@babel/core/node_modules/@babel/types/scripts/generators/generateAsserts.js b/tools/node_modules/@babel/core/node_modules/@babel/types/scripts/generators/asserts.js similarity index 61% rename from tools/node_modules/@babel/core/node_modules/@babel/types/scripts/generators/generateAsserts.js rename to tools/node_modules/@babel/core/node_modules/@babel/types/scripts/generators/asserts.js index 26bdb8dccbed58..a517efb31a0d6c 100644 --- a/tools/node_modules/@babel/core/node_modules/@babel/types/scripts/generators/generateAsserts.js +++ b/tools/node_modules/@babel/core/node_modules/@babel/types/scripts/generators/asserts.js @@ -2,23 +2,30 @@ const definitions = require("../../lib/definitions"); function addAssertHelper(type) { - return `export function assert${type}(node: Object, opts?: Object = {}): void { + const result = + definitions.NODE_FIELDS[type] || definitions.FLIPPED_ALIAS_KEYS[type] + ? `node is t.${type}` + : "boolean"; + + return `export function assert${type}(node: object | null | undefined, opts?: object | null): asserts ${ + result === "boolean" ? "node" : result + } { assert("${type}", node, opts) } `; } module.exports = function generateAsserts() { - let output = `// @flow -/* + let output = `/* * This file is auto-generated! Do not modify it directly. * To re-generate run 'make build' */ import is from "../../validators/is"; +import type * as t from "../.."; -function assert(type: string, node: Object, opts?: Object): void { +function assert(type: string, node: any, opts?: any): void { if (!is(type, node, opts)) { throw new Error( - \`Expected type "\${type}" with option \${JSON.stringify((opts: any))}, \` + + \`Expected type "\${type}" with option \${JSON.stringify(opts)}, \` + \`but instead got "\${node.type}".\`, ); } @@ -34,7 +41,7 @@ function assert(type: string, node: Object, opts?: Object): void { Object.keys(definitions.DEPRECATED_KEYS).forEach(type => { const newType = definitions.DEPRECATED_KEYS[type]; - output += `export function assert${type}(node: Object, opts: Object): void { + output += `export function assert${type}(node: any, opts: any): void { console.trace("The node type ${type} has been renamed to ${newType}"); assert("${type}", node, opts); }\n`; diff --git a/tools/node_modules/@babel/core/node_modules/@babel/types/scripts/generators/ast-types.js b/tools/node_modules/@babel/core/node_modules/@babel/types/scripts/generators/ast-types.js new file mode 100644 index 00000000000000..98122665def8e9 --- /dev/null +++ b/tools/node_modules/@babel/core/node_modules/@babel/types/scripts/generators/ast-types.js @@ -0,0 +1,140 @@ +"use strict"; + +const t = require("../../"); +const stringifyValidator = require("../utils/stringifyValidator"); + +module.exports = function generateAstTypes() { + let code = `// NOTE: This file is autogenerated. Do not modify. +// See packages/babel-types/scripts/generators/ast-types.js for script used. + +interface BaseComment { + value: string; + start: number; + end: number; + loc: SourceLocation; + type: "CommentBlock" | "CommentLine"; +} + +export interface CommentBlock extends BaseComment { + type: "CommentBlock"; +} + +export interface CommentLine extends BaseComment { + type: "CommentLine"; +} + +export type Comment = CommentBlock | CommentLine; + +export interface SourceLocation { + start: { + line: number; + column: number; + }; + + end: { + line: number; + column: number; + }; +} + +interface BaseNode { + leadingComments: ReadonlyArray<Comment> | null; + innerComments: ReadonlyArray<Comment> | null; + trailingComments: ReadonlyArray<Comment> | null; + start: number | null; + end: number | null; + loc: SourceLocation | null; + type: Node["type"]; + extra?: Record<string, unknown>; +} + +export type CommentTypeShorthand = "leading" | "inner" | "trailing"; + +export type Node = ${t.TYPES.sort().join(" | ")};\n\n`; + + const deprecatedAlias = {}; + for (const type in t.DEPRECATED_KEYS) { + deprecatedAlias[t.DEPRECATED_KEYS[type]] = type; + } + for (const type in t.NODE_FIELDS) { + const fields = t.NODE_FIELDS[type]; + const fieldNames = sortFieldNames(Object.keys(t.NODE_FIELDS[type]), type); + const struct = []; + + fieldNames.forEach(fieldName => { + const field = fields[fieldName]; + // Future / annoying TODO: + // MemberExpression.property, ObjectProperty.key and ObjectMethod.key need special cases; either: + // - convert the declaration to chain() like ClassProperty.key and ClassMethod.key, + // - declare an alias type for valid keys, detect the case and reuse it here, + // - declare a disjoint union with, for example, ObjectPropertyBase, + // ObjectPropertyLiteralKey and ObjectPropertyComputedKey, and declare ObjectProperty + // as "ObjectPropertyBase & (ObjectPropertyLiteralKey | ObjectPropertyComputedKey)" + let typeAnnotation = stringifyValidator(field.validate, ""); + + if (isNullable(field) && !hasDefault(field)) { + typeAnnotation += " | null"; + } + + const alphaNumeric = /^\w+$/; + const optional = field.optional ? "?" : ""; + + if (t.isValidIdentifier(fieldName) || alphaNumeric.test(fieldName)) { + struct.push(`${fieldName}${optional}: ${typeAnnotation};`); + } else { + struct.push(`"${fieldName}"${optional}: ${typeAnnotation};`); + } + }); + + code += `export interface ${type} extends BaseNode { + type: "${type}"; + ${struct.join("\n ").trim()} +}\n\n`; + + if (deprecatedAlias[type]) { + code += `/** + * @deprecated Use \`${type}\` + */ +export interface ${deprecatedAlias[type]} extends BaseNode { + type: "${deprecatedAlias[type]}"; + ${struct.join("\n ").trim()} +}\n\n +`; + } + } + + for (const type in t.FLIPPED_ALIAS_KEYS) { + const types = t.FLIPPED_ALIAS_KEYS[type]; + code += `export type ${type} = ${types + .map(type => `${type}`) + .join(" | ")};\n`; + } + code += "\n"; + + code += "export interface Aliases {\n"; + for (const type in t.FLIPPED_ALIAS_KEYS) { + code += ` ${type}: ${type};\n`; + } + code += "}\n\n"; + + return code; +}; + +function hasDefault(field) { + return field.default != null; +} + +function isNullable(field) { + return field.optional || hasDefault(field); +} + +function sortFieldNames(fields, type) { + return fields.sort((fieldA, fieldB) => { + const indexA = t.BUILDER_KEYS[type].indexOf(fieldA); + const indexB = t.BUILDER_KEYS[type].indexOf(fieldB); + if (indexA === indexB) return fieldA < fieldB ? -1 : 1; + if (indexA === -1) return 1; + if (indexB === -1) return -1; + return indexA - indexB; + }); +} diff --git a/tools/node_modules/@babel/core/node_modules/@babel/types/scripts/generators/builders.js b/tools/node_modules/@babel/core/node_modules/@babel/types/scripts/generators/builders.js new file mode 100644 index 00000000000000..6a528fe0c33bbd --- /dev/null +++ b/tools/node_modules/@babel/core/node_modules/@babel/types/scripts/generators/builders.js @@ -0,0 +1,165 @@ +"use strict"; +const definitions = require("../../lib/definitions"); +const formatBuilderName = require("../utils/formatBuilderName"); +const lowerFirst = require("../utils/lowerFirst"); + +const t = require("../../"); +const stringifyValidator = require("../utils/stringifyValidator"); + +function areAllRemainingFieldsNullable(fieldName, fieldNames, fields) { + const index = fieldNames.indexOf(fieldName); + return fieldNames.slice(index).every(_ => isNullable(fields[_])); +} + +function hasDefault(field) { + return field.default != null; +} + +function isNullable(field) { + return field.optional || hasDefault(field); +} + +function sortFieldNames(fields, type) { + return fields.sort((fieldA, fieldB) => { + const indexA = t.BUILDER_KEYS[type].indexOf(fieldA); + const indexB = t.BUILDER_KEYS[type].indexOf(fieldB); + if (indexA === indexB) return fieldA < fieldB ? -1 : 1; + if (indexA === -1) return 1; + if (indexB === -1) return -1; + return indexA - indexB; + }); +} + +function generateBuilderArgs(type) { + const fields = t.NODE_FIELDS[type]; + const fieldNames = sortFieldNames(Object.keys(t.NODE_FIELDS[type]), type); + const builderNames = t.BUILDER_KEYS[type]; + + const args = []; + + fieldNames.forEach(fieldName => { + const field = fields[fieldName]; + // Future / annoying TODO: + // MemberExpression.property, ObjectProperty.key and ObjectMethod.key need special cases; either: + // - convert the declaration to chain() like ClassProperty.key and ClassMethod.key, + // - declare an alias type for valid keys, detect the case and reuse it here, + // - declare a disjoint union with, for example, ObjectPropertyBase, + // ObjectPropertyLiteralKey and ObjectPropertyComputedKey, and declare ObjectProperty + // as "ObjectPropertyBase & (ObjectPropertyLiteralKey | ObjectPropertyComputedKey)" + let typeAnnotation = stringifyValidator(field.validate, "t."); + + if (isNullable(field) && !hasDefault(field)) { + typeAnnotation += " | null"; + } + + if (builderNames.includes(fieldName)) { + const bindingIdentifierName = t.toBindingIdentifierName(fieldName); + if (areAllRemainingFieldsNullable(fieldName, builderNames, fields)) { + args.push( + `${bindingIdentifierName}${ + isNullable(field) ? "?:" : ":" + } ${typeAnnotation}` + ); + } else { + args.push( + `${bindingIdentifierName}: ${typeAnnotation}${ + isNullable(field) ? " | undefined" : "" + }` + ); + } + } + }); + + return args; +} + +module.exports = function generateBuilders(kind) { + return kind === "uppercase.js" + ? generateUppercaseBuilders() + : generateLowercaseBuilders(); +}; + +function generateLowercaseBuilders() { + let output = `/* + * This file is auto-generated! Do not modify it directly. + * To re-generate run 'make build' + */ +import builder from "../builder"; +import type * as t from "../.."; + +/* eslint-disable @typescript-eslint/no-unused-vars */ + +`; + + const reservedNames = new Set(["super", "import"]); + Object.keys(definitions.BUILDER_KEYS).forEach(type => { + const defArgs = generateBuilderArgs(type); + const formatedBuilderName = formatBuilderName(type); + const formatedBuilderNameLocal = reservedNames.has(formatedBuilderName) + ? `_${formatedBuilderName}` + : formatedBuilderName; + output += `${ + formatedBuilderNameLocal === formatedBuilderName ? "export " : "" + }function ${formatedBuilderNameLocal}(${defArgs.join( + ", " + )}): t.${type} { return builder("${type}", ...arguments); }\n`; + if (formatedBuilderNameLocal !== formatedBuilderName) { + output += `export { ${formatedBuilderNameLocal} as ${formatedBuilderName} };\n`; + } + + // This is needed for backwards compatibility. + // It should be removed in the next major version. + // JSXIdentifier -> jSXIdentifier + if (/^[A-Z]{2}/.test(type)) { + output += `export { ${formatedBuilderNameLocal} as ${lowerFirst( + type + )} }\n`; + } + }); + + Object.keys(definitions.DEPRECATED_KEYS).forEach(type => { + const newType = definitions.DEPRECATED_KEYS[type]; + const formatedBuilderName = formatBuilderName(type); + output += `/** @deprecated */ +function ${type}(...args: Array<any>): any { + console.trace("The node type ${type} has been renamed to ${newType}"); + return builder("${type}", ...args); +} +export { ${type} as ${formatedBuilderName} };\n`; + // This is needed for backwards compatibility. + // It should be removed in the next major version. + // JSXIdentifier -> jSXIdentifier + if (/^[A-Z]{2}/.test(type)) { + output += `export { ${type} as ${lowerFirst(type)} }\n`; + } + }); + + return output; +} + +function generateUppercaseBuilders() { + let output = `/* + * This file is auto-generated! Do not modify it directly. + * To re-generate run 'make build' + */ + +/** + * This file is written in JavaScript and not TypeScript because uppercase builders + * conflict with AST types. TypeScript reads the uppercase.d.ts file instead. + */ + + export {\n`; + + Object.keys(definitions.BUILDER_KEYS).forEach(type => { + const formatedBuilderName = formatBuilderName(type); + output += ` ${formatedBuilderName} as ${type},\n`; + }); + + Object.keys(definitions.DEPRECATED_KEYS).forEach(type => { + const formatedBuilderName = formatBuilderName(type); + output += ` ${formatedBuilderName} as ${type},\n`; + }); + + output += ` } from './index';\n`; + return output; +} diff --git a/tools/node_modules/@babel/core/node_modules/@babel/types/scripts/generators/generateConstants.js b/tools/node_modules/@babel/core/node_modules/@babel/types/scripts/generators/constants.js similarity index 94% rename from tools/node_modules/@babel/core/node_modules/@babel/types/scripts/generators/generateConstants.js rename to tools/node_modules/@babel/core/node_modules/@babel/types/scripts/generators/constants.js index 1e4d2cabaec4da..8e8b61c50bf0bb 100644 --- a/tools/node_modules/@babel/core/node_modules/@babel/types/scripts/generators/generateConstants.js +++ b/tools/node_modules/@babel/core/node_modules/@babel/types/scripts/generators/constants.js @@ -2,8 +2,7 @@ const definitions = require("../../lib/definitions"); module.exports = function generateConstants() { - let output = `// @flow -/* + let output = `/* * This file is auto-generated! Do not modify it directly. * To re-generate run 'make build' */ diff --git a/tools/node_modules/@babel/core/node_modules/@babel/types/scripts/generators/flow.js b/tools/node_modules/@babel/core/node_modules/@babel/types/scripts/generators/flow.js index 2a91703353db3a..8a0a7b2635511f 100644 --- a/tools/node_modules/@babel/core/node_modules/@babel/types/scripts/generators/flow.js +++ b/tools/node_modules/@babel/core/node_modules/@babel/types/scripts/generators/flow.js @@ -98,7 +98,7 @@ for (const type in t.NODE_FIELDS) { // Flow chokes on super() and import() :/ if (type !== "Super" && type !== "Import") { lines.push( - `declare function ${toFunctionName(type)}(${args.join( + `declare export function ${toFunctionName(type)}(${args.join( ", " )}): ${NODE_PREFIX}${type};` ); @@ -117,85 +117,90 @@ for (const typeName of t.TYPES) { const isDeprecated = !!t.DEPRECATED_KEYS[typeName]; const realName = isDeprecated ? t.DEPRECATED_KEYS[typeName] : typeName; - let decl = `declare function is${typeName}(node: ?Object, opts?: ?Object): boolean`; + let decl = `declare export function is${typeName}(node: ?Object, opts?: ?Object): boolean`; if (t.NODE_FIELDS[realName]) { decl += ` %checks (node instanceof ${NODE_PREFIX}${realName})`; } lines.push(decl); lines.push( - `declare function assert${typeName}(node: ?Object, opts?: ?Object): void` + `declare export function assert${typeName}(node: ?Object, opts?: ?Object): void` ); } lines.push( + `declare export var VISITOR_KEYS: { [type: string]: string[] }`, + // assert/ - `declare function assertNode(obj: any): void`, + `declare export function assertNode(obj: any): void`, // builders/ // eslint-disable-next-line max-len - `declare function createTypeAnnotationBasedOnTypeof(type: 'string' | 'number' | 'undefined' | 'boolean' | 'function' | 'object' | 'symbol'): ${NODE_PREFIX}TypeAnnotation`, + `declare export function createTypeAnnotationBasedOnTypeof(type: 'string' | 'number' | 'undefined' | 'boolean' | 'function' | 'object' | 'symbol'): ${NODE_PREFIX}TypeAnnotation`, // eslint-disable-next-line max-len - `declare function createUnionTypeAnnotation(types: Array<${NODE_PREFIX}FlowType>): ${NODE_PREFIX}UnionTypeAnnotation`, + `declare export function createUnionTypeAnnotation(types: Array<${NODE_PREFIX}FlowType>): ${NODE_PREFIX}UnionTypeAnnotation`, // eslint-disable-next-line max-len - `declare function createFlowUnionType(types: Array<${NODE_PREFIX}FlowType>): ${NODE_PREFIX}UnionTypeAnnotation`, + `declare export function createFlowUnionType(types: Array<${NODE_PREFIX}FlowType>): ${NODE_PREFIX}UnionTypeAnnotation`, // this smells like "internal API" // eslint-disable-next-line max-len - `declare function buildChildren(node: { children: Array<${NODE_PREFIX}JSXText | ${NODE_PREFIX}JSXExpressionContainer | ${NODE_PREFIX}JSXSpreadChild | ${NODE_PREFIX}JSXElement | ${NODE_PREFIX}JSXFragment | ${NODE_PREFIX}JSXEmptyExpression> }): Array<${NODE_PREFIX}JSXText | ${NODE_PREFIX}JSXExpressionContainer | ${NODE_PREFIX}JSXSpreadChild | ${NODE_PREFIX}JSXElement | ${NODE_PREFIX}JSXFragment>`, + `declare export function buildChildren(node: { children: Array<${NODE_PREFIX}JSXText | ${NODE_PREFIX}JSXExpressionContainer | ${NODE_PREFIX}JSXSpreadChild | ${NODE_PREFIX}JSXElement | ${NODE_PREFIX}JSXFragment | ${NODE_PREFIX}JSXEmptyExpression> }): Array<${NODE_PREFIX}JSXText | ${NODE_PREFIX}JSXExpressionContainer | ${NODE_PREFIX}JSXSpreadChild | ${NODE_PREFIX}JSXElement | ${NODE_PREFIX}JSXFragment>`, // clone/ - `declare function clone<T>(n: T): T;`, - `declare function cloneDeep<T>(n: T): T;`, - `declare function cloneDeepWithoutLoc<T>(n: T): T;`, - `declare function cloneNode<T>(n: T, deep?: boolean, withoutLoc?: boolean): T;`, - `declare function cloneWithoutLoc<T>(n: T): T;`, + `declare export function clone<T>(n: T): T;`, + `declare export function cloneDeep<T>(n: T): T;`, + `declare export function cloneDeepWithoutLoc<T>(n: T): T;`, + `declare export function cloneNode<T>(n: T, deep?: boolean, withoutLoc?: boolean): T;`, + `declare export function cloneWithoutLoc<T>(n: T): T;`, // comments/ `declare type CommentTypeShorthand = 'leading' | 'inner' | 'trailing'`, // eslint-disable-next-line max-len - `declare function addComment<T: Node>(node: T, type: CommentTypeShorthand, content: string, line?: boolean): T`, + `declare export function addComment<T: BabelNode>(node: T, type: CommentTypeShorthand, content: string, line?: boolean): T`, // eslint-disable-next-line max-len - `declare function addComments<T: Node>(node: T, type: CommentTypeShorthand, comments: Array<Comment>): T`, - `declare function inheritInnerComments(node: Node, parent: Node): void`, - `declare function inheritLeadingComments(node: Node, parent: Node): void`, - `declare function inheritsComments<T: Node>(node: T, parent: Node): void`, - `declare function inheritTrailingComments(node: Node, parent: Node): void`, - `declare function removeComments<T: Node>(node: T): T`, + `declare export function addComments<T: BabelNode>(node: T, type: CommentTypeShorthand, comments: Array<Comment>): T`, + `declare export function inheritInnerComments(node: BabelNode, parent: BabelNode): void`, + `declare export function inheritLeadingComments(node: BabelNode, parent: BabelNode): void`, + `declare export function inheritsComments<T: BabelNode>(node: T, parent: BabelNode): void`, + `declare export function inheritTrailingComments(node: BabelNode, parent: BabelNode): void`, + `declare export function removeComments<T: BabelNode>(node: T): T`, // converters/ - `declare function ensureBlock(node: ${NODE_PREFIX}, key: string): ${NODE_PREFIX}BlockStatement`, - `declare function toBindingIdentifierName(name?: ?string): string`, + `declare export function ensureBlock(node: ${NODE_PREFIX}, key: string): ${NODE_PREFIX}BlockStatement`, + `declare export function toBindingIdentifierName(name?: ?string): string`, // eslint-disable-next-line max-len - `declare function toBlock(node: ${NODE_PREFIX}Statement | ${NODE_PREFIX}Expression, parent?: ${NODE_PREFIX}Function | null): ${NODE_PREFIX}BlockStatement`, + `declare export function toBlock(node: ${NODE_PREFIX}Statement | ${NODE_PREFIX}Expression, parent?: ${NODE_PREFIX}Function | null): ${NODE_PREFIX}BlockStatement`, // eslint-disable-next-line max-len - `declare function toComputedKey(node: ${NODE_PREFIX}Method | ${NODE_PREFIX}Property, key?: ${NODE_PREFIX}Expression | ${NODE_PREFIX}Identifier): ${NODE_PREFIX}Expression`, + `declare export function toComputedKey(node: ${NODE_PREFIX}Method | ${NODE_PREFIX}Property, key?: ${NODE_PREFIX}Expression | ${NODE_PREFIX}Identifier): ${NODE_PREFIX}Expression`, // eslint-disable-next-line max-len - `declare function toExpression(node: ${NODE_PREFIX}ExpressionStatement | ${NODE_PREFIX}Expression | ${NODE_PREFIX}Class | ${NODE_PREFIX}Function): ${NODE_PREFIX}Expression`, - `declare function toIdentifier(name?: ?string): string`, + `declare export function toExpression(node: ${NODE_PREFIX}ExpressionStatement | ${NODE_PREFIX}Expression | ${NODE_PREFIX}Class | ${NODE_PREFIX}Function): ${NODE_PREFIX}Expression`, + `declare export function toIdentifier(name?: ?string): string`, // eslint-disable-next-line max-len - `declare function toKeyAlias(node: ${NODE_PREFIX}Method | ${NODE_PREFIX}Property, key?: ${NODE_PREFIX}): string`, + `declare export function toKeyAlias(node: ${NODE_PREFIX}Method | ${NODE_PREFIX}Property, key?: ${NODE_PREFIX}): string`, // toSequenceExpression relies on types that aren't declared in flow // eslint-disable-next-line max-len - `declare function toStatement(node: ${NODE_PREFIX}Statement | ${NODE_PREFIX}Class | ${NODE_PREFIX}Function | ${NODE_PREFIX}AssignmentExpression, ignore?: boolean): ${NODE_PREFIX}Statement | void`, - `declare function valueToNode(value: any): ${NODE_PREFIX}Expression`, + `declare export function toStatement(node: ${NODE_PREFIX}Statement | ${NODE_PREFIX}Class | ${NODE_PREFIX}Function | ${NODE_PREFIX}AssignmentExpression, ignore?: boolean): ${NODE_PREFIX}Statement | void`, + `declare export function valueToNode(value: any): ${NODE_PREFIX}Expression`, // modifications/ // eslint-disable-next-line max-len - `declare function removeTypeDuplicates(types: Array<${NODE_PREFIX}FlowType>): Array<${NODE_PREFIX}FlowType>`, + `declare export function removeTypeDuplicates(types: Array<${NODE_PREFIX}FlowType>): Array<${NODE_PREFIX}FlowType>`, // eslint-disable-next-line max-len - `declare function appendToMemberExpression(member: ${NODE_PREFIX}MemberExpression, append: ${NODE_PREFIX}, computed?: boolean): ${NODE_PREFIX}MemberExpression`, + `declare export function appendToMemberExpression(member: ${NODE_PREFIX}MemberExpression, append: ${NODE_PREFIX}, computed?: boolean): ${NODE_PREFIX}MemberExpression`, // eslint-disable-next-line max-len - `declare function inherits<T: Node>(child: T, parent: ${NODE_PREFIX} | null | void): T`, + `declare export function inherits<T: BabelNode>(child: T, parent: ${NODE_PREFIX} | null | void): T`, // eslint-disable-next-line max-len - `declare function prependToMemberExpression(member: ${NODE_PREFIX}MemberExpression, prepend: ${NODE_PREFIX}Expression): ${NODE_PREFIX}MemberExpression`, - `declare function removeProperties<T>(n: T, opts: ?{}): void;`, - `declare function removePropertiesDeep<T>(n: T, opts: ?{}): T;`, + `declare export function prependToMemberExpression(member: ${NODE_PREFIX}MemberExpression, prepend: ${NODE_PREFIX}Expression): ${NODE_PREFIX}MemberExpression`, + `declare export function removeProperties<T>(n: T, opts: ?{}): void;`, + `declare export function removePropertiesDeep<T>(n: T, opts: ?{}): T;`, // retrievers/ // eslint-disable-next-line max-len - `declare function getBindingIdentifiers(node: ${NODE_PREFIX}, duplicates: boolean, outerOnly?: boolean): { [key: string]: ${NODE_PREFIX}Identifier | Array<${NODE_PREFIX}Identifier> }`, + `declare export var getBindingIdentifiers: { + (node: ${NODE_PREFIX}, duplicates?: boolean, outerOnly?: boolean): { [key: string]: ${NODE_PREFIX}Identifier | Array<${NODE_PREFIX}Identifier> }, + keys: { [type: string]: string[] } + }`, // eslint-disable-next-line max-len - `declare function getOuterBindingIdentifiers(node: Node, duplicates: boolean): { [key: string]: ${NODE_PREFIX}Identifier | Array<${NODE_PREFIX}Identifier> }`, + `declare export function getOuterBindingIdentifiers(node: BabelNode, duplicates?: boolean): { [key: string]: ${NODE_PREFIX}Identifier | Array<${NODE_PREFIX}Identifier> }`, // traverse/ `declare type TraversalAncestors = Array<{ @@ -209,36 +214,36 @@ lines.push( exit?: TraversalHandler<T>, };`.replace(/(^|\n) {2}/g, "$1"), // eslint-disable-next-line - `declare function traverse<T>(n: BabelNode, TraversalHandler<T> | TraversalHandlers<T>, state?: T): void;`, - `declare function traverseFast<T>(n: Node, h: TraversalHandler<T>, state?: T): void;`, + `declare export function traverse<T>(n: BabelNode, TraversalHandler<T> | TraversalHandlers<T>, state?: T): void;`, + `declare export function traverseFast<T>(n: BabelNode, h: TraversalHandler<T>, state?: T): void;`, // utils/ // cleanJSXElementLiteralChild is not exported // inherit is not exported - `declare function shallowEqual(actual: Object, expected: Object): boolean`, + `declare export function shallowEqual(actual: Object, expected: Object): boolean`, // validators/ // eslint-disable-next-line max-len - `declare function buildMatchMemberExpression(match: string, allowPartial?: boolean): (?BabelNode) => boolean`, - `declare function is(type: string, n: BabelNode, opts: Object): boolean;`, - `declare function isBinding(node: BabelNode, parent: BabelNode, grandparent?: BabelNode): boolean`, - `declare function isBlockScoped(node: BabelNode): boolean`, - `declare function isImmutable(node: BabelNode): boolean`, - `declare function isLet(node: BabelNode): boolean`, - `declare function isNode(node: ?Object): boolean`, - `declare function isNodesEquivalent(a: any, b: any): boolean`, - `declare function isPlaceholderType(placeholderType: string, targetType: string): boolean`, - `declare function isReferenced(node: BabelNode, parent: BabelNode, grandparent?: BabelNode): boolean`, - `declare function isScope(node: BabelNode, parent: BabelNode): boolean`, - `declare function isSpecifierDefault(specifier: BabelNodeModuleSpecifier): boolean`, - `declare function isType(nodetype: ?string, targetType: string): boolean`, - `declare function isValidES3Identifier(name: string): boolean`, - `declare function isValidES3Identifier(name: string): boolean`, - `declare function isValidIdentifier(name: string): boolean`, - `declare function isVar(node: BabelNode): boolean`, + `declare export function buildMatchMemberExpression(match: string, allowPartial?: boolean): (?BabelNode) => boolean`, + `declare export function is(type: string, n: BabelNode, opts: Object): boolean;`, + `declare export function isBinding(node: BabelNode, parent: BabelNode, grandparent?: BabelNode): boolean`, + `declare export function isBlockScoped(node: BabelNode): boolean`, + `declare export function isImmutable(node: BabelNode): boolean`, + `declare export function isLet(node: BabelNode): boolean`, + `declare export function isNode(node: ?Object): boolean`, + `declare export function isNodesEquivalent(a: any, b: any): boolean`, + `declare export function isPlaceholderType(placeholderType: string, targetType: string): boolean`, + `declare export function isReferenced(node: BabelNode, parent: BabelNode, grandparent?: BabelNode): boolean`, + `declare export function isScope(node: BabelNode, parent: BabelNode): boolean`, + `declare export function isSpecifierDefault(specifier: BabelNodeModuleSpecifier): boolean`, + `declare export function isType(nodetype: ?string, targetType: string): boolean`, + `declare export function isValidES3Identifier(name: string): boolean`, + `declare export function isValidES3Identifier(name: string): boolean`, + `declare export function isValidIdentifier(name: string): boolean`, + `declare export function isVar(node: BabelNode): boolean`, // eslint-disable-next-line max-len - `declare function matchesPattern(node: ?BabelNode, match: string | Array<string>, allowPartial?: boolean): boolean`, - `declare function validate(n: BabelNode, key: string, value: mixed): void;` + `declare export function matchesPattern(node: ?BabelNode, match: string | Array<string>, allowPartial?: boolean): boolean`, + `declare export function validate(n: BabelNode, key: string, value: mixed): void;` ); for (const type in t.FLIPPED_ALIAS_KEYS) { diff --git a/tools/node_modules/@babel/core/node_modules/@babel/types/scripts/generators/generateBuilders.js b/tools/node_modules/@babel/core/node_modules/@babel/types/scripts/generators/generateBuilders.js deleted file mode 100644 index 5ca9f74643aabb..00000000000000 --- a/tools/node_modules/@babel/core/node_modules/@babel/types/scripts/generators/generateBuilders.js +++ /dev/null @@ -1,57 +0,0 @@ -"use strict"; -const definitions = require("../../lib/definitions"); -const formatBuilderName = require("../utils/formatBuilderName"); -const lowerFirst = require("../utils/lowerFirst"); - -module.exports = function generateBuilders() { - let output = `// @flow -/* - * This file is auto-generated! Do not modify it directly. - * To re-generate run 'make build' - */ -import builder from "../builder";\n\n`; - - const reservedNames = new Set(["super", "import"]); - Object.keys(definitions.BUILDER_KEYS).forEach(type => { - const formatedBuilderName = formatBuilderName(type); - const formatedBuilderNameLocal = reservedNames.has(formatedBuilderName) - ? `_${formatedBuilderName}` - : formatedBuilderName; - output += `${ - formatedBuilderNameLocal === formatedBuilderName ? "export " : "" - }function ${formatedBuilderNameLocal}(...args: Array<any>): Object { return builder("${type}", ...args); }\n`; - // This is needed for backwards compatibility. - // arrayExpression -> ArrayExpression - output += `export { ${formatedBuilderNameLocal} as ${type} };\n`; - if (formatedBuilderNameLocal !== formatedBuilderName) { - output += `export { ${formatedBuilderNameLocal} as ${formatedBuilderName} };\n`; - } - - // This is needed for backwards compatibility. - // It should be removed in the next major version. - // JSXIdentifier -> jSXIdentifier - if (/^[A-Z]{2}/.test(type)) { - output += `export { ${formatedBuilderNameLocal} as ${lowerFirst( - type - )} }\n`; - } - }); - - Object.keys(definitions.DEPRECATED_KEYS).forEach(type => { - const newType = definitions.DEPRECATED_KEYS[type]; - output += `export function ${type}(...args: Array<any>): Object { - console.trace("The node type ${type} has been renamed to ${newType}"); - return builder("${type}", ...args); -} -export { ${type} as ${formatBuilderName(type)} };\n`; - - // This is needed for backwards compatibility. - // It should be removed in the next major version. - // JSXIdentifier -> jSXIdentifier - if (/^[A-Z]{2}/.test(type)) { - output += `export { ${type} as ${lowerFirst(type)} }\n`; - } - }); - - return output; -}; diff --git a/tools/node_modules/@babel/core/node_modules/@babel/types/scripts/generators/typescript.js b/tools/node_modules/@babel/core/node_modules/@babel/types/scripts/generators/typescript-legacy.js similarity index 96% rename from tools/node_modules/@babel/core/node_modules/@babel/types/scripts/generators/typescript.js rename to tools/node_modules/@babel/core/node_modules/@babel/types/scripts/generators/typescript-legacy.js index 210124d829dff4..a77040681b91e6 100644 --- a/tools/node_modules/@babel/core/node_modules/@babel/types/scripts/generators/typescript.js +++ b/tools/node_modules/@babel/core/node_modules/@babel/types/scripts/generators/typescript-legacy.js @@ -1,17 +1,11 @@ "use strict"; -const t = require("../../"); +const t = require("../../lib"); const stringifyValidator = require("../utils/stringifyValidator"); const toFunctionName = require("../utils/toFunctionName"); -// For backward compat, we cannot use TS 3.7 syntax in published packages -const ts3_7 = process.argv.includes("--ts3.7"); - -// TypeScript 3.7: https://github.com/microsoft/TypeScript/pull/32695 will allow assert declarations -const asserts = ts3_7 ? assertion => `asserts ${assertion}` : () => `void`; - let code = `// NOTE: This file is autogenerated. Do not modify. -// See packages/babel-types/scripts/generators/typescript.js for script used. +// See packages/babel-types/scripts/generators/typescript-legacy.js for script used. interface BaseComment { value: string; @@ -146,15 +140,13 @@ for (const typeName of t.TYPES) { lines.push(`/** @deprecated Use \`assert${realName}\` */`); } lines.push( - `export function assert${typeName}(node: object | null | undefined, opts?: object | null): ${asserts( - result === "boolean" ? "node" : result - )};` + `export function assert${typeName}(node: object | null | undefined, opts?: object | null): void;` ); } lines.push( // assert/ - `export function assertNode(obj: any): ${asserts("obj is Node")}`, + `export function assertNode(obj: any): void`, // builders/ // eslint-disable-next-line max-len @@ -320,9 +312,7 @@ lines.push( // eslint-disable-next-line max-len `export function matchesPattern(node: Node | null | undefined, match: string | ReadonlyArray<string>, allowPartial?: boolean): node is MemberExpression`, // eslint-disable-next-line max-len - `export function validate<T extends Node, K extends keyof T>(n: Node | null | undefined, key: K, value: T[K]): ${asserts( - "n is T" - )}`, + `export function validate<T extends Node, K extends keyof T>(n: Node | null | undefined, key: K, value: T[K]): void;`, `export function validate(n: Node, key: string, value: any): void;` ); diff --git a/tools/node_modules/@babel/core/node_modules/@babel/types/scripts/generators/generateValidators.js b/tools/node_modules/@babel/core/node_modules/@babel/types/scripts/generators/validators.js similarity index 72% rename from tools/node_modules/@babel/core/node_modules/@babel/types/scripts/generators/generateValidators.js rename to tools/node_modules/@babel/core/node_modules/@babel/types/scripts/generators/validators.js index 1455f99e5b6713..c63d447bcdd244 100644 --- a/tools/node_modules/@babel/core/node_modules/@babel/types/scripts/generators/generateValidators.js +++ b/tools/node_modules/@babel/core/node_modules/@babel/types/scripts/generators/validators.js @@ -13,7 +13,7 @@ function addIsHelper(type, aliasKeys, deprecated) { const targetType = JSON.stringify(type); let aliasSource = ""; if (aliasKeys) { - aliasSource = " || " + joinComparisons(aliasKeys, "nodeType"); + aliasSource = joinComparisons(aliasKeys, "nodeType"); } let placeholderSource = ""; @@ -30,16 +30,26 @@ function addIsHelper(type, aliasKeys, deprecated) { if (placeholderTypes.length > 0) { placeholderSource = ' || nodeType === "Placeholder" && (' + - joinComparisons(placeholderTypes, "node.expectedNode") + + joinComparisons( + placeholderTypes, + "(node as t.Placeholder).expectedNode" + ) + ")"; } - return `export function is${type}(node: ?Object, opts?: Object): boolean { + const result = + definitions.NODE_FIELDS[type] || definitions.FLIPPED_ALIAS_KEYS[type] + ? `node is t.${type}` + : "boolean"; + + return `export function is${type}(node: object | null | undefined, opts?: object | null): ${result} { ${deprecated || ""} if (!node) return false; - const nodeType = node.type; - if (nodeType === ${targetType}${aliasSource}${placeholderSource}) { + const nodeType = (node as t.Node).type; + if (${ + aliasSource ? aliasSource : `nodeType === ${targetType}` + }${placeholderSource}) { if (typeof opts === "undefined") { return true; } else { @@ -53,12 +63,12 @@ function addIsHelper(type, aliasKeys, deprecated) { } module.exports = function generateValidators() { - let output = `// @flow -/* + let output = `/* * This file is auto-generated! Do not modify it directly. * To re-generate run 'make build' */ -import shallowEqual from "../../utils/shallowEqual";\n\n`; +import shallowEqual from "../../utils/shallowEqual"; +import type * as t from "../..";\n\n`; Object.keys(definitions.VISITOR_KEYS).forEach(type => { output += addIsHelper(type); diff --git a/tools/node_modules/@babel/core/node_modules/function-bind/.jscs.json b/tools/node_modules/@babel/core/node_modules/function-bind/.jscs.json deleted file mode 100644 index 8c4479480be70d..00000000000000 --- a/tools/node_modules/@babel/core/node_modules/function-bind/.jscs.json +++ /dev/null @@ -1,176 +0,0 @@ -{ - "es3": true, - - "additionalRules": [], - - "requireSemicolons": true, - - "disallowMultipleSpaces": true, - - "disallowIdentifierNames": [], - - "requireCurlyBraces": { - "allExcept": [], - "keywords": ["if", "else", "for", "while", "do", "try", "catch"] - }, - - "requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch", "function"], - - "disallowSpaceAfterKeywords": [], - - "disallowSpaceBeforeComma": true, - "disallowSpaceAfterComma": false, - "disallowSpaceBeforeSemicolon": true, - - "disallowNodeTypes": [ - "DebuggerStatement", - "ForInStatement", - "LabeledStatement", - "SwitchCase", - "SwitchStatement", - "WithStatement" - ], - - "requireObjectKeysOnNewLine": { "allExcept": ["sameLine"] }, - - "requireSpacesInAnonymousFunctionExpression": { "beforeOpeningRoundBrace": true, "beforeOpeningCurlyBrace": true }, - "requireSpacesInNamedFunctionExpression": { "beforeOpeningCurlyBrace": true }, - "disallowSpacesInNamedFunctionExpression": { "beforeOpeningRoundBrace": true }, - "requireSpacesInFunctionDeclaration": { "beforeOpeningCurlyBrace": true }, - "disallowSpacesInFunctionDeclaration": { "beforeOpeningRoundBrace": true }, - - "requireSpaceBetweenArguments": true, - - "disallowSpacesInsideParentheses": true, - - "disallowSpacesInsideArrayBrackets": true, - - "disallowQuotedKeysInObjects": { "allExcept": ["reserved"] }, - - "disallowSpaceAfterObjectKeys": true, - - "requireCommaBeforeLineBreak": true, - - "disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~", "!"], - "requireSpaceAfterPrefixUnaryOperators": [], - - "disallowSpaceBeforePostfixUnaryOperators": ["++", "--"], - "requireSpaceBeforePostfixUnaryOperators": [], - - "disallowSpaceBeforeBinaryOperators": [], - "requireSpaceBeforeBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="], - - "requireSpaceAfterBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="], - "disallowSpaceAfterBinaryOperators": [], - - "disallowImplicitTypeConversion": ["binary", "string"], - - "disallowKeywords": ["with", "eval"], - - "requireKeywordsOnNewLine": [], - "disallowKeywordsOnNewLine": ["else"], - - "requireLineFeedAtFileEnd": true, - - "disallowTrailingWhitespace": true, - - "disallowTrailingComma": true, - - "excludeFiles": ["node_modules/**", "vendor/**"], - - "disallowMultipleLineStrings": true, - - "requireDotNotation": { "allExcept": ["keywords"] }, - - "requireParenthesesAroundIIFE": true, - - "validateLineBreaks": "LF", - - "validateQuoteMarks": { - "escape": true, - "mark": "'" - }, - - "disallowOperatorBeforeLineBreak": [], - - "requireSpaceBeforeKeywords": [ - "do", - "for", - "if", - "else", - "switch", - "case", - "try", - "catch", - "finally", - "while", - "with", - "return" - ], - - "validateAlignedFunctionParameters": { - "lineBreakAfterOpeningBraces": true, - "lineBreakBeforeClosingBraces": true - }, - - "requirePaddingNewLinesBeforeExport": true, - - "validateNewlineAfterArrayElements": { - "maximum": 8 - }, - - "requirePaddingNewLinesAfterUseStrict": true, - - "disallowArrowFunctions": true, - - "disallowMultiLineTernary": true, - - "validateOrderInObjectKeys": "asc-insensitive", - - "disallowIdenticalDestructuringNames": true, - - "disallowNestedTernaries": { "maxLevel": 1 }, - - "requireSpaceAfterComma": { "allExcept": ["trailing"] }, - "requireAlignedMultilineParams": false, - - "requireSpacesInGenerator": { - "afterStar": true - }, - - "disallowSpacesInGenerator": { - "beforeStar": true - }, - - "disallowVar": false, - - "requireArrayDestructuring": false, - - "requireEnhancedObjectLiterals": false, - - "requireObjectDestructuring": false, - - "requireEarlyReturn": false, - - "requireCapitalizedConstructorsNew": { - "allExcept": ["Function", "String", "Object", "Symbol", "Number", "Date", "RegExp", "Error", "Boolean", "Array"] - }, - - "requireImportAlphabetized": false, - - "requireSpaceBeforeObjectValues": true, - "requireSpaceBeforeDestructuredValues": true, - - "disallowSpacesInsideTemplateStringPlaceholders": true, - - "disallowArrayDestructuringReturn": false, - - "requireNewlineBeforeSingleStatementsInIf": false, - - "disallowUnusedVariables": true, - - "requireSpacesInsideImportedObjectBraces": true, - - "requireUseStrict": true -} - diff --git a/tools/node_modules/@babel/core/node_modules/function-bind/README.md b/tools/node_modules/@babel/core/node_modules/function-bind/README.md deleted file mode 100644 index 81862a02cb940c..00000000000000 --- a/tools/node_modules/@babel/core/node_modules/function-bind/README.md +++ /dev/null @@ -1,48 +0,0 @@ -# function-bind - -<!-- - [![build status][travis-svg]][travis-url] - [![NPM version][npm-badge-svg]][npm-url] - [![Coverage Status][5]][6] - [![gemnasium Dependency Status][7]][8] - [![Dependency status][deps-svg]][deps-url] - [![Dev Dependency status][dev-deps-svg]][dev-deps-url] ---> - -<!-- [![browser support][11]][12] --> - -Implementation of function.prototype.bind - -## Example - -I mainly do this for unit tests I run on phantomjs. -PhantomJS does not have Function.prototype.bind :( - -```js -Function.prototype.bind = require("function-bind") -``` - -## Installation - -`npm install function-bind` - -## Contributors - - - Raynos - -## MIT Licenced - - [travis-svg]: https://travis-ci.org/Raynos/function-bind.svg - [travis-url]: https://travis-ci.org/Raynos/function-bind - [npm-badge-svg]: https://badge.fury.io/js/function-bind.svg - [npm-url]: https://npmjs.org/package/function-bind - [5]: https://coveralls.io/repos/Raynos/function-bind/badge.png - [6]: https://coveralls.io/r/Raynos/function-bind - [7]: https://gemnasium.com/Raynos/function-bind.png - [8]: https://gemnasium.com/Raynos/function-bind - [deps-svg]: https://david-dm.org/Raynos/function-bind.svg - [deps-url]: https://david-dm.org/Raynos/function-bind - [dev-deps-svg]: https://david-dm.org/Raynos/function-bind/dev-status.svg - [dev-deps-url]: https://david-dm.org/Raynos/function-bind#info=devDependencies - [11]: https://ci.testling.com/Raynos/function-bind.png - [12]: https://ci.testling.com/Raynos/function-bind diff --git a/tools/node_modules/@babel/core/node_modules/function-bind/implementation.js b/tools/node_modules/@babel/core/node_modules/function-bind/implementation.js deleted file mode 100644 index cc4daec1b080a1..00000000000000 --- a/tools/node_modules/@babel/core/node_modules/function-bind/implementation.js +++ /dev/null @@ -1,52 +0,0 @@ -'use strict'; - -/* eslint no-invalid-this: 1 */ - -var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible '; -var slice = Array.prototype.slice; -var toStr = Object.prototype.toString; -var funcType = '[object Function]'; - -module.exports = function bind(that) { - var target = this; - if (typeof target !== 'function' || toStr.call(target) !== funcType) { - throw new TypeError(ERROR_MESSAGE + target); - } - var args = slice.call(arguments, 1); - - var bound; - var binder = function () { - if (this instanceof bound) { - var result = target.apply( - this, - args.concat(slice.call(arguments)) - ); - if (Object(result) === result) { - return result; - } - return this; - } else { - return target.apply( - that, - args.concat(slice.call(arguments)) - ); - } - }; - - var boundLength = Math.max(0, target.length - args.length); - var boundArgs = []; - for (var i = 0; i < boundLength; i++) { - boundArgs.push('$' + i); - } - - bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder); - - if (target.prototype) { - var Empty = function Empty() {}; - Empty.prototype = target.prototype; - bound.prototype = new Empty(); - Empty.prototype = null; - } - - return bound; -}; diff --git a/tools/node_modules/@babel/core/node_modules/function-bind/index.js b/tools/node_modules/@babel/core/node_modules/function-bind/index.js deleted file mode 100644 index 3bb6b9609889f8..00000000000000 --- a/tools/node_modules/@babel/core/node_modules/function-bind/index.js +++ /dev/null @@ -1,5 +0,0 @@ -'use strict'; - -var implementation = require('./implementation'); - -module.exports = Function.prototype.bind || implementation; diff --git a/tools/node_modules/@babel/core/node_modules/function-bind/package.json b/tools/node_modules/@babel/core/node_modules/function-bind/package.json deleted file mode 100644 index 20a1727cbf8711..00000000000000 --- a/tools/node_modules/@babel/core/node_modules/function-bind/package.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "name": "function-bind", - "version": "1.1.1", - "description": "Implementation of Function.prototype.bind", - "keywords": [ - "function", - "bind", - "shim", - "es5" - ], - "author": "Raynos <raynos2@gmail.com>", - "repository": "git://github.com/Raynos/function-bind.git", - "main": "index", - "homepage": "https://github.com/Raynos/function-bind", - "contributors": [ - { - "name": "Raynos" - }, - { - "name": "Jordan Harband", - "url": "https://github.com/ljharb" - } - ], - "bugs": { - "url": "https://github.com/Raynos/function-bind/issues", - "email": "raynos2@gmail.com" - }, - "dependencies": {}, - "devDependencies": { - "@ljharb/eslint-config": "^12.2.1", - "covert": "^1.1.0", - "eslint": "^4.5.0", - "jscs": "^3.0.7", - "tape": "^4.8.0" - }, - "license": "MIT", - "scripts": { - "pretest": "npm run lint", - "test": "npm run tests-only", - "posttest": "npm run coverage -- --quiet", - "tests-only": "node test", - "coverage": "covert test/*.js", - "lint": "npm run jscs && npm run eslint", - "jscs": "jscs *.js */*.js", - "eslint": "eslint *.js */*.js" - }, - "testling": { - "files": "test/index.js", - "browsers": [ - "ie/8..latest", - "firefox/16..latest", - "firefox/nightly", - "chrome/22..latest", - "chrome/canary", - "opera/12..latest", - "opera/next", - "safari/5.1..latest", - "ipad/6.0..latest", - "iphone/6.0..latest", - "android-browser/4.2..latest" - ] - } -} diff --git a/tools/node_modules/@babel/core/node_modules/has/LICENSE-MIT b/tools/node_modules/@babel/core/node_modules/has/LICENSE-MIT deleted file mode 100644 index ae7014d385df3d..00000000000000 --- a/tools/node_modules/@babel/core/node_modules/has/LICENSE-MIT +++ /dev/null @@ -1,22 +0,0 @@ -Copyright (c) 2013 Thiago de Arruda - -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/@babel/core/node_modules/has/README.md b/tools/node_modules/@babel/core/node_modules/has/README.md deleted file mode 100644 index 635e3a4baab00b..00000000000000 --- a/tools/node_modules/@babel/core/node_modules/has/README.md +++ /dev/null @@ -1,18 +0,0 @@ -# has - -> Object.prototype.hasOwnProperty.call shortcut - -## Installation - -```sh -npm install --save has -``` - -## Usage - -```js -var has = require('has'); - -has({}, 'hasOwnProperty'); // false -has(Object.prototype, 'hasOwnProperty'); // true -``` diff --git a/tools/node_modules/@babel/core/node_modules/has/package.json b/tools/node_modules/@babel/core/node_modules/has/package.json deleted file mode 100644 index 7c4592f16de071..00000000000000 --- a/tools/node_modules/@babel/core/node_modules/has/package.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "name": "has", - "description": "Object.prototype.hasOwnProperty.call shortcut", - "version": "1.0.3", - "homepage": "https://github.com/tarruda/has", - "author": { - "name": "Thiago de Arruda", - "email": "tpadilha84@gmail.com" - }, - "contributors": [ - { - "name": "Jordan Harband", - "email": "ljharb@gmail.com", - "url": "http://ljharb.codes" - } - ], - "repository": { - "type": "git", - "url": "git://github.com/tarruda/has.git" - }, - "bugs": { - "url": "https://github.com/tarruda/has/issues" - }, - "license": "MIT", - "licenses": [ - { - "type": "MIT", - "url": "https://github.com/tarruda/has/blob/master/LICENSE-MIT" - } - ], - "main": "./src", - "dependencies": { - "function-bind": "^1.1.1" - }, - "devDependencies": { - "@ljharb/eslint-config": "^12.2.1", - "eslint": "^4.19.1", - "tape": "^4.9.0" - }, - "engines": { - "node": ">= 0.4.0" - }, - "scripts": { - "lint": "eslint .", - "pretest": "npm run lint", - "test": "tape test" - } -} diff --git a/tools/node_modules/@babel/core/node_modules/has/src/index.js b/tools/node_modules/@babel/core/node_modules/has/src/index.js deleted file mode 100644 index dd92dd9094edb0..00000000000000 --- a/tools/node_modules/@babel/core/node_modules/has/src/index.js +++ /dev/null @@ -1,5 +0,0 @@ -'use strict'; - -var bind = require('function-bind'); - -module.exports = bind.call(Function.call, Object.prototype.hasOwnProperty); diff --git a/tools/node_modules/@babel/core/node_modules/is-core-module/LICENSE b/tools/node_modules/@babel/core/node_modules/is-core-module/LICENSE deleted file mode 100644 index 2e502872a74234..00000000000000 --- a/tools/node_modules/@babel/core/node_modules/is-core-module/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014 Dave Justice - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/tools/node_modules/@babel/core/node_modules/is-core-module/README.md b/tools/node_modules/@babel/core/node_modules/is-core-module/README.md deleted file mode 100644 index 479d6d24c0f041..00000000000000 --- a/tools/node_modules/@babel/core/node_modules/is-core-module/README.md +++ /dev/null @@ -1,37 +0,0 @@ -# is-core-module <sup>[![Version Badge][2]][1]</sup> - -[![Build Status][3]][4] -[![dependency status][5]][6] -[![dev dependency status][7]][8] -[![License][license-image]][license-url] -[![Downloads][downloads-image]][downloads-url] - -[![npm badge][11]][1] - -Is this specifier a node.js core module? Optionally provide a node version to check; defaults to the current node version. - -## Example - -```js -var isCore = require('is-core-module'); -var assert = require('assert'); -assert(isCore('fs')); -assert(!isCore('butts')); -``` - -## Tests -Clone the repo, `npm install`, and run `npm test` - -[1]: https://npmjs.org/package/is-core-module -[2]: https://versionbadg.es/inspect-js/is-core-module.svg -[3]: https://travis-ci.com/inspect-js/is-core-module.svg -[4]: https://travis-ci.com/inspect-js/is-core-module -[5]: https://david-dm.org/inspect-js/is-core-module.svg -[6]: https://david-dm.org/inspect-js/is-core-module -[7]: https://david-dm.org/inspect-js/is-core-module/dev-status.svg -[8]: https://david-dm.org/inspect-js/is-core-module#info=devDependencies -[11]: https://nodei.co/npm/is-core-module.png?downloads=true&stars=true -[license-image]: https://img.shields.io/npm/l/is-core-module.svg -[license-url]: LICENSE -[downloads-image]: https://img.shields.io/npm/dm/is-core-module.svg -[downloads-url]: https://npm-stat.com/charts.html?package=is-core-module diff --git a/tools/node_modules/@babel/core/node_modules/is-core-module/core.json b/tools/node_modules/@babel/core/node_modules/is-core-module/core.json deleted file mode 100644 index 0238b61a4c71e4..00000000000000 --- a/tools/node_modules/@babel/core/node_modules/is-core-module/core.json +++ /dev/null @@ -1,83 +0,0 @@ -{ - "assert": true, - "assert/strict": ">= 15", - "async_hooks": ">= 8", - "buffer_ieee754": "< 0.9.7", - "buffer": true, - "child_process": true, - "cluster": true, - "console": true, - "constants": true, - "crypto": true, - "_debug_agent": ">= 1 && < 8", - "_debugger": "< 8", - "dgram": true, - "diagnostics_channel": ">= 15.1", - "dns": true, - "dns/promises": ">= 15", - "domain": ">= 0.7.12", - "events": true, - "freelist": "< 6", - "fs": true, - "fs/promises": [">= 10 && < 10.1", ">= 14"], - "_http_agent": ">= 0.11.1", - "_http_client": ">= 0.11.1", - "_http_common": ">= 0.11.1", - "_http_incoming": ">= 0.11.1", - "_http_outgoing": ">= 0.11.1", - "_http_server": ">= 0.11.1", - "http": true, - "http2": ">= 8.8", - "https": true, - "inspector": ">= 8.0.0", - "_linklist": "< 8", - "module": true, - "net": true, - "node-inspect/lib/_inspect": ">= 7.6.0 && < 12", - "node-inspect/lib/internal/inspect_client": ">= 7.6.0 && < 12", - "node-inspect/lib/internal/inspect_repl": ">= 7.6.0 && < 12", - "os": true, - "path": true, - "path/posix": ">= 15.3", - "path/win32": ">= 15.3", - "perf_hooks": ">= 8.5", - "process": ">= 1", - "punycode": true, - "querystring": true, - "readline": true, - "repl": true, - "smalloc": ">= 0.11.5 && < 3", - "_stream_duplex": ">= 0.9.4", - "_stream_transform": ">= 0.9.4", - "_stream_wrap": ">= 1.4.1", - "_stream_passthrough": ">= 0.9.4", - "_stream_readable": ">= 0.9.4", - "_stream_writable": ">= 0.9.4", - "stream": true, - "stream/promises": ">= 15", - "string_decoder": true, - "sys": [">= 0.6 && < 0.7", ">= 0.8"], - "timers": true, - "timers/promises": ">= 15", - "_tls_common": ">= 0.11.13", - "_tls_legacy": ">= 0.11.3 && < 10", - "_tls_wrap": ">= 0.11.3", - "tls": true, - "trace_events": ">= 10", - "tty": true, - "url": true, - "util": true, - "util/types": ">= 15.3", - "v8/tools/arguments": ">= 10 && < 12", - "v8/tools/codemap": [">= 4.4.0 && < 5", ">= 5.2.0 && < 12"], - "v8/tools/consarray": [">= 4.4.0 && < 5", ">= 5.2.0 && < 12"], - "v8/tools/csvparser": [">= 4.4.0 && < 5", ">= 5.2.0 && < 12"], - "v8/tools/logreader": [">= 4.4.0 && < 5", ">= 5.2.0 && < 12"], - "v8/tools/profile_view": [">= 4.4.0 && < 5", ">= 5.2.0 && < 12"], - "v8/tools/splaytree": [">= 4.4.0 && < 5", ">= 5.2.0 && < 12"], - "v8": ">= 1", - "vm": true, - "wasi": ">= 13.4 && < 13.5", - "worker_threads": ">= 11.7", - "zlib": true -} diff --git a/tools/node_modules/@babel/core/node_modules/is-core-module/index.js b/tools/node_modules/@babel/core/node_modules/is-core-module/index.js deleted file mode 100644 index f5a69cf765f56b..00000000000000 --- a/tools/node_modules/@babel/core/node_modules/is-core-module/index.js +++ /dev/null @@ -1,69 +0,0 @@ -'use strict'; - -var has = require('has'); - -function specifierIncluded(current, specifier) { - var nodeParts = current.split('.'); - var parts = specifier.split(' '); - var op = parts.length > 1 ? parts[0] : '='; - var versionParts = (parts.length > 1 ? parts[1] : parts[0]).split('.'); - - for (var i = 0; i < 3; ++i) { - var cur = parseInt(nodeParts[i] || 0, 10); - var ver = parseInt(versionParts[i] || 0, 10); - if (cur === ver) { - continue; // eslint-disable-line no-restricted-syntax, no-continue - } - if (op === '<') { - return cur < ver; - } - if (op === '>=') { - return cur >= ver; - } - return false; - } - return op === '>='; -} - -function matchesRange(current, range) { - var specifiers = range.split(/ ?&& ?/); - if (specifiers.length === 0) { - return false; - } - for (var i = 0; i < specifiers.length; ++i) { - if (!specifierIncluded(current, specifiers[i])) { - return false; - } - } - return true; -} - -function versionIncluded(nodeVersion, specifierValue) { - if (typeof specifierValue === 'boolean') { - return specifierValue; - } - - var current = typeof nodeVersion === 'undefined' - ? process.versions && process.versions.node && process.versions.node - : nodeVersion; - - if (typeof current !== 'string') { - throw new TypeError(typeof nodeVersion === 'undefined' ? 'Unable to determine current node version' : 'If provided, a valid node version is required'); - } - - if (specifierValue && typeof specifierValue === 'object') { - for (var i = 0; i < specifierValue.length; ++i) { - if (matchesRange(current, specifierValue[i])) { - return true; - } - } - return false; - } - return matchesRange(current, specifierValue); -} - -var data = require('./core.json'); - -module.exports = function isCore(x, nodeVersion) { - return has(data, x) && versionIncluded(nodeVersion, data[x]); -}; diff --git a/tools/node_modules/@babel/core/node_modules/is-core-module/package.json b/tools/node_modules/@babel/core/node_modules/is-core-module/package.json deleted file mode 100644 index 21341cc431a505..00000000000000 --- a/tools/node_modules/@babel/core/node_modules/is-core-module/package.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "name": "is-core-module", - "version": "2.2.0", - "description": "Is this specifier a node.js core module?", - "main": "index.js", - "exports": { - ".": [ - { - "default": "./index.js" - }, - "./index.js" - ], - "./package.json": "./package.json" - }, - "scripts": { - "prepublish": "safe-publish-latest", - "lint": "eslint .", - "pretest": "npm run lint", - "tests-only": "tape 'test/**/*.js'", - "test": "nyc npm run tests-only", - "posttest": "aud --production", - "version": "auto-changelog && git add CHANGELOG.md", - "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/inspect-js/is-core-module.git" - }, - "keywords": [ - "core", - "modules", - "module", - "npm", - "node", - "dependencies" - ], - "author": "Jordan Harband <ljharb@gmail.com>", - "funding": { - "url": "https://github.com/sponsors/ljharb" - }, - "license": "MIT", - "bugs": { - "url": "https://github.com/inspect-js/is-core-module/issues" - }, - "homepage": "https://github.com/inspect-js/is-core-module", - "dependencies": { - "has": "^1.0.3" - }, - "devDependencies": { - "@ljharb/eslint-config": "^17.3.0", - "aud": "^1.1.3", - "auto-changelog": "^2.2.1", - "eslint": "^7.14.0", - "nyc": "^10.3.2", - "safe-publish-latest": "^1.1.4", - "tape": "^5.0.1" - }, - "auto-changelog": { - "output": "CHANGELOG.md", - "template": "keepachangelog", - "unreleased": false, - "commitLimit": false, - "backfillLimit": false, - "hideCredit": true - } -} diff --git a/tools/node_modules/@babel/core/node_modules/path-parse/README.md b/tools/node_modules/@babel/core/node_modules/path-parse/README.md deleted file mode 100644 index 05097f86aef364..00000000000000 --- a/tools/node_modules/@babel/core/node_modules/path-parse/README.md +++ /dev/null @@ -1,42 +0,0 @@ -# path-parse [![Build Status](https://travis-ci.org/jbgutierrez/path-parse.svg?branch=master)](https://travis-ci.org/jbgutierrez/path-parse) - -> Node.js [`path.parse(pathString)`](https://nodejs.org/api/path.html#path_path_parse_pathstring) [ponyfill](https://ponyfill.com). - -## Install - -``` -$ npm install --save path-parse -``` - -## Usage - -```js -var pathParse = require('path-parse'); - -pathParse('/home/user/dir/file.txt'); -//=> { -// root : "/", -// dir : "/home/user/dir", -// base : "file.txt", -// ext : ".txt", -// name : "file" -// } -``` - -## API - -See [`path.parse(pathString)`](https://nodejs.org/api/path.html#path_path_parse_pathstring) docs. - -### pathParse(path) - -### pathParse.posix(path) - -The Posix specific version. - -### pathParse.win32(path) - -The Windows specific version. - -## License - -MIT © [Javier Blanco](http://jbgutierrez.info) diff --git a/tools/node_modules/@babel/core/node_modules/path-parse/index.js b/tools/node_modules/@babel/core/node_modules/path-parse/index.js deleted file mode 100644 index 3b7601fe494eed..00000000000000 --- a/tools/node_modules/@babel/core/node_modules/path-parse/index.js +++ /dev/null @@ -1,93 +0,0 @@ -'use strict'; - -var isWindows = process.platform === 'win32'; - -// Regex to split a windows path into three parts: [*, device, slash, -// tail] windows-only -var splitDeviceRe = - /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/; - -// Regex to split the tail part of the above into [*, dir, basename, ext] -var splitTailRe = - /^([\s\S]*?)((?:\.{1,2}|[^\\\/]+?|)(\.[^.\/\\]*|))(?:[\\\/]*)$/; - -var win32 = {}; - -// Function to split a filename into [root, dir, basename, ext] -function win32SplitPath(filename) { - // Separate device+slash from tail - var result = splitDeviceRe.exec(filename), - device = (result[1] || '') + (result[2] || ''), - tail = result[3] || ''; - // Split the tail into dir, basename and extension - var result2 = splitTailRe.exec(tail), - dir = result2[1], - basename = result2[2], - ext = result2[3]; - return [device, dir, basename, ext]; -} - -win32.parse = function(pathString) { - if (typeof pathString !== 'string') { - throw new TypeError( - "Parameter 'pathString' must be a string, not " + typeof pathString - ); - } - var allParts = win32SplitPath(pathString); - if (!allParts || allParts.length !== 4) { - throw new TypeError("Invalid path '" + pathString + "'"); - } - return { - root: allParts[0], - dir: allParts[0] + allParts[1].slice(0, -1), - base: allParts[2], - ext: allParts[3], - name: allParts[2].slice(0, allParts[2].length - allParts[3].length) - }; -}; - - - -// Split a filename into [root, dir, basename, ext], unix version -// 'root' is just a slash, or nothing. -var splitPathRe = - /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/; -var posix = {}; - - -function posixSplitPath(filename) { - return splitPathRe.exec(filename).slice(1); -} - - -posix.parse = function(pathString) { - if (typeof pathString !== 'string') { - throw new TypeError( - "Parameter 'pathString' must be a string, not " + typeof pathString - ); - } - var allParts = posixSplitPath(pathString); - if (!allParts || allParts.length !== 4) { - throw new TypeError("Invalid path '" + pathString + "'"); - } - allParts[1] = allParts[1] || ''; - allParts[2] = allParts[2] || ''; - allParts[3] = allParts[3] || ''; - - return { - root: allParts[0], - dir: allParts[0] + allParts[1].slice(0, -1), - base: allParts[2], - ext: allParts[3], - name: allParts[2].slice(0, allParts[2].length - allParts[3].length) - }; -}; - - -if (isWindows) - module.exports = win32.parse; -else /* posix */ - module.exports = posix.parse; - -module.exports.posix = posix.parse; -module.exports.win32 = win32.parse; diff --git a/tools/node_modules/@babel/core/node_modules/path-parse/package.json b/tools/node_modules/@babel/core/node_modules/path-parse/package.json deleted file mode 100644 index 21332bb14f8b7f..00000000000000 --- a/tools/node_modules/@babel/core/node_modules/path-parse/package.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "name": "path-parse", - "version": "1.0.6", - "description": "Node.js path.parse() ponyfill", - "main": "index.js", - "scripts": { - "test": "node test.js" - }, - "repository": { - "type": "git", - "url": "https://github.com/jbgutierrez/path-parse.git" - }, - "keywords": [ - "path", - "paths", - "file", - "dir", - "parse", - "built-in", - "util", - "utils", - "core", - "ponyfill", - "polyfill", - "shim" - ], - "author": "Javier Blanco <http://jbgutierrez.info>", - "license": "MIT", - "bugs": { - "url": "https://github.com/jbgutierrez/path-parse/issues" - }, - "homepage": "https://github.com/jbgutierrez/path-parse#readme" -} diff --git a/tools/node_modules/@babel/core/node_modules/resolve/index.js b/tools/node_modules/@babel/core/node_modules/resolve/index.js deleted file mode 100644 index 125d8146423596..00000000000000 --- a/tools/node_modules/@babel/core/node_modules/resolve/index.js +++ /dev/null @@ -1,6 +0,0 @@ -var async = require('./lib/async'); -async.core = require('./lib/core'); -async.isCore = require('./lib/is-core'); -async.sync = require('./lib/sync'); - -module.exports = async; diff --git a/tools/node_modules/@babel/core/node_modules/resolve/lib/async.js b/tools/node_modules/@babel/core/node_modules/resolve/lib/async.js deleted file mode 100644 index 29285079451b15..00000000000000 --- a/tools/node_modules/@babel/core/node_modules/resolve/lib/async.js +++ /dev/null @@ -1,299 +0,0 @@ -var fs = require('fs'); -var path = require('path'); -var caller = require('./caller'); -var nodeModulesPaths = require('./node-modules-paths'); -var normalizeOptions = require('./normalize-options'); -var isCore = require('is-core-module'); - -var realpathFS = fs.realpath && typeof fs.realpath.native === 'function' ? fs.realpath.native : fs.realpath; - -var defaultIsFile = function isFile(file, cb) { - fs.stat(file, function (err, stat) { - if (!err) { - return cb(null, stat.isFile() || stat.isFIFO()); - } - if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false); - return cb(err); - }); -}; - -var defaultIsDir = function isDirectory(dir, cb) { - fs.stat(dir, function (err, stat) { - if (!err) { - return cb(null, stat.isDirectory()); - } - if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false); - return cb(err); - }); -}; - -var defaultRealpath = function realpath(x, cb) { - realpathFS(x, function (realpathErr, realPath) { - if (realpathErr && realpathErr.code !== 'ENOENT') cb(realpathErr); - else cb(null, realpathErr ? x : realPath); - }); -}; - -var maybeRealpath = function maybeRealpath(realpath, x, opts, cb) { - if (opts && opts.preserveSymlinks === false) { - realpath(x, cb); - } else { - cb(null, x); - } -}; - -var getPackageCandidates = function getPackageCandidates(x, start, opts) { - var dirs = nodeModulesPaths(start, opts, x); - for (var i = 0; i < dirs.length; i++) { - dirs[i] = path.join(dirs[i], x); - } - return dirs; -}; - -module.exports = function resolve(x, options, callback) { - var cb = callback; - var opts = options; - if (typeof options === 'function') { - cb = opts; - opts = {}; - } - if (typeof x !== 'string') { - var err = new TypeError('Path must be a string.'); - return process.nextTick(function () { - cb(err); - }); - } - - opts = normalizeOptions(x, opts); - - var isFile = opts.isFile || defaultIsFile; - var isDirectory = opts.isDirectory || defaultIsDir; - var readFile = opts.readFile || fs.readFile; - var realpath = opts.realpath || defaultRealpath; - var packageIterator = opts.packageIterator; - - var extensions = opts.extensions || ['.js']; - var includeCoreModules = opts.includeCoreModules !== false; - var basedir = opts.basedir || path.dirname(caller()); - var parent = opts.filename || basedir; - - opts.paths = opts.paths || []; - - // ensure that `basedir` is an absolute path at this point, resolving against the process' current working directory - var absoluteStart = path.resolve(basedir); - - maybeRealpath( - realpath, - absoluteStart, - opts, - function (err, realStart) { - if (err) cb(err); - else init(realStart); - } - ); - - var res; - function init(basedir) { - if ((/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/).test(x)) { - res = path.resolve(basedir, x); - if (x === '.' || x === '..' || x.slice(-1) === '/') res += '/'; - if ((/\/$/).test(x) && res === basedir) { - loadAsDirectory(res, opts.package, onfile); - } else loadAsFile(res, opts.package, onfile); - } else if (includeCoreModules && isCore(x)) { - return cb(null, x); - } else loadNodeModules(x, basedir, function (err, n, pkg) { - if (err) cb(err); - else if (n) { - return maybeRealpath(realpath, n, opts, function (err, realN) { - if (err) { - cb(err); - } else { - cb(null, realN, pkg); - } - }); - } else { - var moduleError = new Error("Cannot find module '" + x + "' from '" + parent + "'"); - moduleError.code = 'MODULE_NOT_FOUND'; - cb(moduleError); - } - }); - } - - function onfile(err, m, pkg) { - if (err) cb(err); - else if (m) cb(null, m, pkg); - else loadAsDirectory(res, function (err, d, pkg) { - if (err) cb(err); - else if (d) { - maybeRealpath(realpath, d, opts, function (err, realD) { - if (err) { - cb(err); - } else { - cb(null, realD, pkg); - } - }); - } else { - var moduleError = new Error("Cannot find module '" + x + "' from '" + parent + "'"); - moduleError.code = 'MODULE_NOT_FOUND'; - cb(moduleError); - } - }); - } - - function loadAsFile(x, thePackage, callback) { - var loadAsFilePackage = thePackage; - var cb = callback; - if (typeof loadAsFilePackage === 'function') { - cb = loadAsFilePackage; - loadAsFilePackage = undefined; - } - - var exts = [''].concat(extensions); - load(exts, x, loadAsFilePackage); - - function load(exts, x, loadPackage) { - if (exts.length === 0) return cb(null, undefined, loadPackage); - var file = x + exts[0]; - - var pkg = loadPackage; - if (pkg) onpkg(null, pkg); - else loadpkg(path.dirname(file), onpkg); - - function onpkg(err, pkg_, dir) { - pkg = pkg_; - if (err) return cb(err); - if (dir && pkg && opts.pathFilter) { - var rfile = path.relative(dir, file); - var rel = rfile.slice(0, rfile.length - exts[0].length); - var r = opts.pathFilter(pkg, x, rel); - if (r) return load( - [''].concat(extensions.slice()), - path.resolve(dir, r), - pkg - ); - } - isFile(file, onex); - } - function onex(err, ex) { - if (err) return cb(err); - if (ex) return cb(null, file, pkg); - load(exts.slice(1), x, pkg); - } - } - } - - function loadpkg(dir, cb) { - if (dir === '' || dir === '/') return cb(null); - if (process.platform === 'win32' && (/^\w:[/\\]*$/).test(dir)) { - return cb(null); - } - if ((/[/\\]node_modules[/\\]*$/).test(dir)) return cb(null); - - maybeRealpath(realpath, dir, opts, function (unwrapErr, pkgdir) { - if (unwrapErr) return loadpkg(path.dirname(dir), cb); - var pkgfile = path.join(pkgdir, 'package.json'); - isFile(pkgfile, function (err, ex) { - // on err, ex is false - if (!ex) return loadpkg(path.dirname(dir), cb); - - readFile(pkgfile, function (err, body) { - if (err) cb(err); - try { var pkg = JSON.parse(body); } catch (jsonErr) {} - - if (pkg && opts.packageFilter) { - pkg = opts.packageFilter(pkg, pkgfile); - } - cb(null, pkg, dir); - }); - }); - }); - } - - function loadAsDirectory(x, loadAsDirectoryPackage, callback) { - var cb = callback; - var fpkg = loadAsDirectoryPackage; - if (typeof fpkg === 'function') { - cb = fpkg; - fpkg = opts.package; - } - - maybeRealpath(realpath, x, opts, function (unwrapErr, pkgdir) { - if (unwrapErr) return cb(unwrapErr); - var pkgfile = path.join(pkgdir, 'package.json'); - isFile(pkgfile, function (err, ex) { - if (err) return cb(err); - if (!ex) return loadAsFile(path.join(x, 'index'), fpkg, cb); - - readFile(pkgfile, function (err, body) { - if (err) return cb(err); - try { - var pkg = JSON.parse(body); - } catch (jsonErr) {} - - if (pkg && opts.packageFilter) { - pkg = opts.packageFilter(pkg, pkgfile); - } - - if (pkg && pkg.main) { - if (typeof pkg.main !== 'string') { - var mainError = new TypeError('package “' + pkg.name + '” `main` must be a string'); - mainError.code = 'INVALID_PACKAGE_MAIN'; - return cb(mainError); - } - if (pkg.main === '.' || pkg.main === './') { - pkg.main = 'index'; - } - loadAsFile(path.resolve(x, pkg.main), pkg, function (err, m, pkg) { - if (err) return cb(err); - if (m) return cb(null, m, pkg); - if (!pkg) return loadAsFile(path.join(x, 'index'), pkg, cb); - - var dir = path.resolve(x, pkg.main); - loadAsDirectory(dir, pkg, function (err, n, pkg) { - if (err) return cb(err); - if (n) return cb(null, n, pkg); - loadAsFile(path.join(x, 'index'), pkg, cb); - }); - }); - return; - } - - loadAsFile(path.join(x, '/index'), pkg, cb); - }); - }); - }); - } - - function processDirs(cb, dirs) { - if (dirs.length === 0) return cb(null, undefined); - var dir = dirs[0]; - - isDirectory(path.dirname(dir), isdir); - - function isdir(err, isdir) { - if (err) return cb(err); - if (!isdir) return processDirs(cb, dirs.slice(1)); - loadAsFile(dir, opts.package, onfile); - } - - function onfile(err, m, pkg) { - if (err) return cb(err); - if (m) return cb(null, m, pkg); - loadAsDirectory(dir, opts.package, ondir); - } - - function ondir(err, n, pkg) { - if (err) return cb(err); - if (n) return cb(null, n, pkg); - processDirs(cb, dirs.slice(1)); - } - } - function loadNodeModules(x, start, cb) { - var thunk = function () { return getPackageCandidates(x, start, opts); }; - processDirs( - cb, - packageIterator ? packageIterator(x, start, thunk, opts) : thunk() - ); - } -}; diff --git a/tools/node_modules/@babel/core/node_modules/resolve/lib/caller.js b/tools/node_modules/@babel/core/node_modules/resolve/lib/caller.js deleted file mode 100644 index b14a2804ae828a..00000000000000 --- a/tools/node_modules/@babel/core/node_modules/resolve/lib/caller.js +++ /dev/null @@ -1,8 +0,0 @@ -module.exports = function () { - // see https://code.google.com/p/v8/wiki/JavaScriptStackTraceApi - var origPrepareStackTrace = Error.prepareStackTrace; - Error.prepareStackTrace = function (_, stack) { return stack; }; - var stack = (new Error()).stack; - Error.prepareStackTrace = origPrepareStackTrace; - return stack[2].getFileName(); -}; diff --git a/tools/node_modules/@babel/core/node_modules/resolve/lib/core.js b/tools/node_modules/@babel/core/node_modules/resolve/lib/core.js deleted file mode 100644 index c417d23c5a8ff7..00000000000000 --- a/tools/node_modules/@babel/core/node_modules/resolve/lib/core.js +++ /dev/null @@ -1,53 +0,0 @@ -var current = (process.versions && process.versions.node && process.versions.node.split('.')) || []; - -function specifierIncluded(specifier) { - var parts = specifier.split(' '); - var op = parts.length > 1 ? parts[0] : '='; - var versionParts = (parts.length > 1 ? parts[1] : parts[0]).split('.'); - - for (var i = 0; i < 3; ++i) { - var cur = parseInt(current[i] || 0, 10); - var ver = parseInt(versionParts[i] || 0, 10); - if (cur === ver) { - continue; // eslint-disable-line no-restricted-syntax, no-continue - } - if (op === '<') { - return cur < ver; - } else if (op === '>=') { - return cur >= ver; - } else { - return false; - } - } - return op === '>='; -} - -function matchesRange(range) { - var specifiers = range.split(/ ?&& ?/); - if (specifiers.length === 0) { return false; } - for (var i = 0; i < specifiers.length; ++i) { - if (!specifierIncluded(specifiers[i])) { return false; } - } - return true; -} - -function versionIncluded(specifierValue) { - if (typeof specifierValue === 'boolean') { return specifierValue; } - if (specifierValue && typeof specifierValue === 'object') { - for (var i = 0; i < specifierValue.length; ++i) { - if (matchesRange(specifierValue[i])) { return true; } - } - return false; - } - return matchesRange(specifierValue); -} - -var data = require('./core.json'); - -var core = {}; -for (var mod in data) { // eslint-disable-line no-restricted-syntax - if (Object.prototype.hasOwnProperty.call(data, mod)) { - core[mod] = versionIncluded(data[mod]); - } -} -module.exports = core; diff --git a/tools/node_modules/@babel/core/node_modules/resolve/lib/core.json b/tools/node_modules/@babel/core/node_modules/resolve/lib/core.json deleted file mode 100644 index 226198f89b5ef0..00000000000000 --- a/tools/node_modules/@babel/core/node_modules/resolve/lib/core.json +++ /dev/null @@ -1,80 +0,0 @@ -{ - "assert": true, - "assert/strict": ">= 15", - "async_hooks": ">= 8", - "buffer_ieee754": "< 0.9.7", - "buffer": true, - "child_process": true, - "cluster": true, - "console": true, - "constants": true, - "crypto": true, - "_debug_agent": ">= 1 && < 8", - "_debugger": "< 8", - "dgram": true, - "diagnostics_channel": ">= 15.1", - "dns": true, - "dns/promises": ">= 15", - "domain": ">= 0.7.12", - "events": true, - "freelist": "< 6", - "fs": true, - "fs/promises": [">= 10 && < 10.1", ">= 14"], - "_http_agent": ">= 0.11.1", - "_http_client": ">= 0.11.1", - "_http_common": ">= 0.11.1", - "_http_incoming": ">= 0.11.1", - "_http_outgoing": ">= 0.11.1", - "_http_server": ">= 0.11.1", - "http": true, - "http2": ">= 8.8", - "https": true, - "inspector": ">= 8.0.0", - "_linklist": "< 8", - "module": true, - "net": true, - "node-inspect/lib/_inspect": ">= 7.6.0 && < 12", - "node-inspect/lib/internal/inspect_client": ">= 7.6.0 && < 12", - "node-inspect/lib/internal/inspect_repl": ">= 7.6.0 && < 12", - "os": true, - "path": true, - "perf_hooks": ">= 8.5", - "process": ">= 1", - "punycode": true, - "querystring": true, - "readline": true, - "repl": true, - "smalloc": ">= 0.11.5 && < 3", - "_stream_duplex": ">= 0.9.4", - "_stream_transform": ">= 0.9.4", - "_stream_wrap": ">= 1.4.1", - "_stream_passthrough": ">= 0.9.4", - "_stream_readable": ">= 0.9.4", - "_stream_writable": ">= 0.9.4", - "stream": true, - "stream/promises": ">= 15", - "string_decoder": true, - "sys": [">= 0.6 && < 0.7", ">= 0.8"], - "timers": true, - "timers/promises": ">= 15", - "_tls_common": ">= 0.11.13", - "_tls_legacy": ">= 0.11.3 && < 10", - "_tls_wrap": ">= 0.11.3", - "tls": true, - "trace_events": ">= 10", - "tty": true, - "url": true, - "util": true, - "v8/tools/arguments": ">= 10 && < 12", - "v8/tools/codemap": [">= 4.4.0 && < 5", ">= 5.2.0 && < 12"], - "v8/tools/consarray": [">= 4.4.0 && < 5", ">= 5.2.0 && < 12"], - "v8/tools/csvparser": [">= 4.4.0 && < 5", ">= 5.2.0 && < 12"], - "v8/tools/logreader": [">= 4.4.0 && < 5", ">= 5.2.0 && < 12"], - "v8/tools/profile_view": [">= 4.4.0 && < 5", ">= 5.2.0 && < 12"], - "v8/tools/splaytree": [">= 4.4.0 && < 5", ">= 5.2.0 && < 12"], - "v8": ">= 1", - "vm": true, - "wasi": ">= 13.4 && < 13.5", - "worker_threads": ">= 11.7", - "zlib": true -} diff --git a/tools/node_modules/@babel/core/node_modules/resolve/lib/is-core.js b/tools/node_modules/@babel/core/node_modules/resolve/lib/is-core.js deleted file mode 100644 index 537f5c782ffe55..00000000000000 --- a/tools/node_modules/@babel/core/node_modules/resolve/lib/is-core.js +++ /dev/null @@ -1,5 +0,0 @@ -var isCoreModule = require('is-core-module'); - -module.exports = function isCore(x) { - return isCoreModule(x); -}; diff --git a/tools/node_modules/@babel/core/node_modules/resolve/lib/node-modules-paths.js b/tools/node_modules/@babel/core/node_modules/resolve/lib/node-modules-paths.js deleted file mode 100644 index 2b43813a7a561b..00000000000000 --- a/tools/node_modules/@babel/core/node_modules/resolve/lib/node-modules-paths.js +++ /dev/null @@ -1,42 +0,0 @@ -var path = require('path'); -var parse = path.parse || require('path-parse'); - -var getNodeModulesDirs = function getNodeModulesDirs(absoluteStart, modules) { - var prefix = '/'; - if ((/^([A-Za-z]:)/).test(absoluteStart)) { - prefix = ''; - } else if ((/^\\\\/).test(absoluteStart)) { - prefix = '\\\\'; - } - - var paths = [absoluteStart]; - var parsed = parse(absoluteStart); - while (parsed.dir !== paths[paths.length - 1]) { - paths.push(parsed.dir); - parsed = parse(parsed.dir); - } - - return paths.reduce(function (dirs, aPath) { - return dirs.concat(modules.map(function (moduleDir) { - return path.resolve(prefix, aPath, moduleDir); - })); - }, []); -}; - -module.exports = function nodeModulesPaths(start, opts, request) { - var modules = opts && opts.moduleDirectory - ? [].concat(opts.moduleDirectory) - : ['node_modules']; - - if (opts && typeof opts.paths === 'function') { - return opts.paths( - request, - start, - function () { return getNodeModulesDirs(start, modules); }, - opts - ); - } - - var dirs = getNodeModulesDirs(start, modules); - return opts && opts.paths ? dirs.concat(opts.paths) : dirs; -}; diff --git a/tools/node_modules/@babel/core/node_modules/resolve/lib/normalize-options.js b/tools/node_modules/@babel/core/node_modules/resolve/lib/normalize-options.js deleted file mode 100644 index 4b56904eaea72b..00000000000000 --- a/tools/node_modules/@babel/core/node_modules/resolve/lib/normalize-options.js +++ /dev/null @@ -1,10 +0,0 @@ -module.exports = function (x, opts) { - /** - * This file is purposefully a passthrough. It's expected that third-party - * environments will override it at runtime in order to inject special logic - * into `resolve` (by manipulating the options). One such example is the PnP - * code path in Yarn. - */ - - return opts || {}; -}; diff --git a/tools/node_modules/@babel/core/node_modules/resolve/lib/sync.js b/tools/node_modules/@babel/core/node_modules/resolve/lib/sync.js deleted file mode 100644 index d5308c926e498b..00000000000000 --- a/tools/node_modules/@babel/core/node_modules/resolve/lib/sync.js +++ /dev/null @@ -1,192 +0,0 @@ -var isCore = require('is-core-module'); -var fs = require('fs'); -var path = require('path'); -var caller = require('./caller'); -var nodeModulesPaths = require('./node-modules-paths'); -var normalizeOptions = require('./normalize-options'); - -var realpathFS = fs.realpathSync && typeof fs.realpathSync.native === 'function' ? fs.realpathSync.native : fs.realpathSync; - -var defaultIsFile = function isFile(file) { - try { - var stat = fs.statSync(file); - } catch (e) { - if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) return false; - throw e; - } - return stat.isFile() || stat.isFIFO(); -}; - -var defaultIsDir = function isDirectory(dir) { - try { - var stat = fs.statSync(dir); - } catch (e) { - if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) return false; - throw e; - } - return stat.isDirectory(); -}; - -var defaultRealpathSync = function realpathSync(x) { - try { - return realpathFS(x); - } catch (realpathErr) { - if (realpathErr.code !== 'ENOENT') { - throw realpathErr; - } - } - return x; -}; - -var maybeRealpathSync = function maybeRealpathSync(realpathSync, x, opts) { - if (opts && opts.preserveSymlinks === false) { - return realpathSync(x); - } - return x; -}; - -var getPackageCandidates = function getPackageCandidates(x, start, opts) { - var dirs = nodeModulesPaths(start, opts, x); - for (var i = 0; i < dirs.length; i++) { - dirs[i] = path.join(dirs[i], x); - } - return dirs; -}; - -module.exports = function resolveSync(x, options) { - if (typeof x !== 'string') { - throw new TypeError('Path must be a string.'); - } - var opts = normalizeOptions(x, options); - - var isFile = opts.isFile || defaultIsFile; - var readFileSync = opts.readFileSync || fs.readFileSync; - var isDirectory = opts.isDirectory || defaultIsDir; - var realpathSync = opts.realpathSync || defaultRealpathSync; - var packageIterator = opts.packageIterator; - - var extensions = opts.extensions || ['.js']; - var includeCoreModules = opts.includeCoreModules !== false; - var basedir = opts.basedir || path.dirname(caller()); - var parent = opts.filename || basedir; - - opts.paths = opts.paths || []; - - // ensure that `basedir` is an absolute path at this point, resolving against the process' current working directory - var absoluteStart = maybeRealpathSync(realpathSync, path.resolve(basedir), opts); - - if ((/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/).test(x)) { - var res = path.resolve(absoluteStart, x); - if (x === '.' || x === '..' || x.slice(-1) === '/') res += '/'; - var m = loadAsFileSync(res) || loadAsDirectorySync(res); - if (m) return maybeRealpathSync(realpathSync, m, opts); - } else if (includeCoreModules && isCore(x)) { - return x; - } else { - var n = loadNodeModulesSync(x, absoluteStart); - if (n) return maybeRealpathSync(realpathSync, n, opts); - } - - var err = new Error("Cannot find module '" + x + "' from '" + parent + "'"); - err.code = 'MODULE_NOT_FOUND'; - throw err; - - function loadAsFileSync(x) { - var pkg = loadpkg(path.dirname(x)); - - if (pkg && pkg.dir && pkg.pkg && opts.pathFilter) { - var rfile = path.relative(pkg.dir, x); - var r = opts.pathFilter(pkg.pkg, x, rfile); - if (r) { - x = path.resolve(pkg.dir, r); // eslint-disable-line no-param-reassign - } - } - - if (isFile(x)) { - return x; - } - - for (var i = 0; i < extensions.length; i++) { - var file = x + extensions[i]; - if (isFile(file)) { - return file; - } - } - } - - function loadpkg(dir) { - if (dir === '' || dir === '/') return; - if (process.platform === 'win32' && (/^\w:[/\\]*$/).test(dir)) { - return; - } - if ((/[/\\]node_modules[/\\]*$/).test(dir)) return; - - var pkgfile = path.join(maybeRealpathSync(realpathSync, dir, opts), 'package.json'); - - if (!isFile(pkgfile)) { - return loadpkg(path.dirname(dir)); - } - - var body = readFileSync(pkgfile); - - try { - var pkg = JSON.parse(body); - } catch (jsonErr) {} - - if (pkg && opts.packageFilter) { - // v2 will pass pkgfile - pkg = opts.packageFilter(pkg, /*pkgfile,*/ dir); // eslint-disable-line spaced-comment - } - - return { pkg: pkg, dir: dir }; - } - - function loadAsDirectorySync(x) { - var pkgfile = path.join(maybeRealpathSync(realpathSync, x, opts), '/package.json'); - if (isFile(pkgfile)) { - try { - var body = readFileSync(pkgfile, 'UTF8'); - var pkg = JSON.parse(body); - } catch (e) {} - - if (pkg && opts.packageFilter) { - // v2 will pass pkgfile - pkg = opts.packageFilter(pkg, /*pkgfile,*/ x); // eslint-disable-line spaced-comment - } - - if (pkg && pkg.main) { - if (typeof pkg.main !== 'string') { - var mainError = new TypeError('package “' + pkg.name + '” `main` must be a string'); - mainError.code = 'INVALID_PACKAGE_MAIN'; - throw mainError; - } - if (pkg.main === '.' || pkg.main === './') { - pkg.main = 'index'; - } - try { - var m = loadAsFileSync(path.resolve(x, pkg.main)); - if (m) return m; - var n = loadAsDirectorySync(path.resolve(x, pkg.main)); - if (n) return n; - } catch (e) {} - } - } - - return loadAsFileSync(path.join(x, '/index')); - } - - function loadNodeModulesSync(x, start) { - var thunk = function () { return getPackageCandidates(x, start, opts); }; - var dirs = packageIterator ? packageIterator(x, start, thunk, opts) : thunk(); - - for (var i = 0; i < dirs.length; i++) { - var dir = dirs[i]; - if (isDirectory(path.dirname(dir))) { - var m = loadAsFileSync(dir); - if (m) return m; - var n = loadAsDirectorySync(dir); - if (n) return n; - } - } - } -}; diff --git a/tools/node_modules/@babel/core/node_modules/resolve/package.json b/tools/node_modules/@babel/core/node_modules/resolve/package.json deleted file mode 100644 index dfcfc497b34eaf..00000000000000 --- a/tools/node_modules/@babel/core/node_modules/resolve/package.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "name": "resolve", - "description": "resolve like require.resolve() on behalf of files asynchronously and synchronously", - "version": "1.19.0", - "repository": { - "type": "git", - "url": "git://github.com/browserify/resolve.git" - }, - "main": "index.js", - "keywords": [ - "resolve", - "require", - "node", - "module" - ], - "scripts": { - "prepublish": "safe-publish-latest && cp node_modules/is-core-module/core.json ./lib/", - "prelint": "eclint check '**/*'", - "lint": "eslint --ext=js,mjs .", - "pretests-only": "cd ./test/resolver/nested_symlinks && node mylib/sync && node mylib/async", - "tests-only": "tape test/*.js", - "pretest": "npm run lint", - "test": "npm run --silent tests-only", - "posttest": "npm run test:multirepo && aud --production", - "test:multirepo": "cd ./test/resolver/multirepo && npm install && npm test" - }, - "devDependencies": { - "@ljharb/eslint-config": "^17.2.0", - "array.prototype.map": "^1.0.2", - "aud": "^1.1.3", - "eclint": "^2.8.1", - "eslint": "^7.13.0", - "object-keys": "^1.1.1", - "safe-publish-latest": "^1.1.4", - "tap": "0.4.13", - "tape": "^5.0.1" - }, - "license": "MIT", - "author": { - "name": "James Halliday", - "email": "mail@substack.net", - "url": "http://substack.net" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - }, - "dependencies": { - "is-core-module": "^2.1.0", - "path-parse": "^1.0.6" - } -} diff --git a/tools/node_modules/@babel/core/node_modules/resolve/readme.markdown b/tools/node_modules/@babel/core/node_modules/resolve/readme.markdown deleted file mode 100644 index f742c38dd48df8..00000000000000 --- a/tools/node_modules/@babel/core/node_modules/resolve/readme.markdown +++ /dev/null @@ -1,250 +0,0 @@ -# resolve - -implements the [node `require.resolve()` -algorithm](https://nodejs.org/api/modules.html#modules_all_together) -such that you can `require.resolve()` on behalf of a file asynchronously and -synchronously - -[![build status](https://secure.travis-ci.org/browserify/resolve.png)](http://travis-ci.org/browserify/resolve) - -# example - -asynchronously resolve: - -```js -var resolve = require('resolve'); -resolve('tap', { basedir: __dirname }, function (err, res) { - if (err) console.error(err); - else console.log(res); -}); -``` - -``` -$ node example/async.js -/home/substack/projects/node-resolve/node_modules/tap/lib/main.js -``` - -synchronously resolve: - -```js -var resolve = require('resolve'); -var res = resolve.sync('tap', { basedir: __dirname }); -console.log(res); -``` - -``` -$ node example/sync.js -/home/substack/projects/node-resolve/node_modules/tap/lib/main.js -``` - -# methods - -```js -var resolve = require('resolve'); -``` - -For both the synchronous and asynchronous methods, errors may have any of the following `err.code` values: - -- `MODULE_NOT_FOUND`: the given path string (`id`) could not be resolved to a module -- `INVALID_BASEDIR`: the specified `opts.basedir` doesn't exist, or is not a directory -- `INVALID_PACKAGE_MAIN`: a `package.json` was encountered with an invalid `main` property (eg. not a string) - -## resolve(id, opts={}, cb) - -Asynchronously resolve the module path string `id` into `cb(err, res [, pkg])`, where `pkg` (if defined) is the data from `package.json`. - -options are: - -* opts.basedir - directory to begin resolving from - -* opts.package - `package.json` data applicable to the module being loaded - -* opts.extensions - array of file extensions to search in order - -* opts.includeCoreModules - set to `false` to exclude node core modules (e.g. `fs`) from the search - -* opts.readFile - how to read files asynchronously - -* opts.isFile - function to asynchronously test whether a file exists - -* opts.isDirectory - function to asynchronously test whether a directory exists - -* opts.realpath - function to asynchronously resolve a potential symlink to its real path - -* `opts.packageFilter(pkg, pkgfile, dir)` - transform the parsed package.json contents before looking at the "main" field - * pkg - package data - * pkgfile - path to package.json - * dir - directory for package.json - -* `opts.pathFilter(pkg, path, relativePath)` - transform a path within a package - * pkg - package data - * path - the path being resolved - * relativePath - the path relative from the package.json location - * returns - a relative path that will be joined from the package.json location - -* opts.paths - require.paths array to use if nothing is found on the normal `node_modules` recursive walk (probably don't use this) - - For advanced users, `paths` can also be a `opts.paths(request, start, opts)` function - * request - the import specifier being resolved - * start - lookup path - * getNodeModulesDirs - a thunk (no-argument function) that returns the paths using standard `node_modules` resolution - * opts - the resolution options - -* `opts.packageIterator(request, start, opts)` - return the list of candidate paths where the packages sources may be found (probably don't use this) - * request - the import specifier being resolved - * start - lookup path - * getPackageCandidates - a thunk (no-argument function) that returns the paths using standard `node_modules` resolution - * opts - the resolution options - -* opts.moduleDirectory - directory (or directories) in which to recursively look for modules. default: `"node_modules"` - -* opts.preserveSymlinks - if true, doesn't resolve `basedir` to real path before resolving. -This is the way Node resolves dependencies when executed with the [--preserve-symlinks](https://nodejs.org/api/all.html#cli_preserve_symlinks) flag. -**Note:** this property is currently `true` by default but it will be changed to -`false` in the next major version because *Node's resolution algorithm does not preserve symlinks by default*. - -default `opts` values: - -```js -{ - paths: [], - basedir: __dirname, - extensions: ['.js'], - includeCoreModules: true, - readFile: fs.readFile, - isFile: function isFile(file, cb) { - fs.stat(file, function (err, stat) { - if (!err) { - return cb(null, stat.isFile() || stat.isFIFO()); - } - if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false); - return cb(err); - }); - }, - isDirectory: function isDirectory(dir, cb) { - fs.stat(dir, function (err, stat) { - if (!err) { - return cb(null, stat.isDirectory()); - } - if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false); - return cb(err); - }); - }, - realpath: function realpath(file, cb) { - var realpath = typeof fs.realpath.native === 'function' ? fs.realpath.native : fs.realpath; - realpath(file, function (realPathErr, realPath) { - if (realPathErr && realPathErr.code !== 'ENOENT') cb(realPathErr); - else cb(null, realPathErr ? file : realPath); - }); - }, - moduleDirectory: 'node_modules', - preserveSymlinks: true -} -``` - -## resolve.sync(id, opts) - -Synchronously resolve the module path string `id`, returning the result and -throwing an error when `id` can't be resolved. - -options are: - -* opts.basedir - directory to begin resolving from - -* opts.extensions - array of file extensions to search in order - -* opts.includeCoreModules - set to `false` to exclude node core modules (e.g. `fs`) from the search - -* opts.readFile - how to read files synchronously - -* opts.isFile - function to synchronously test whether a file exists - -* opts.isDirectory - function to synchronously test whether a directory exists - -* opts.realpathSync - function to synchronously resolve a potential symlink to its real path - -* `opts.packageFilter(pkg, dir)` - transform the parsed package.json contents before looking at the "main" field - * pkg - package data - * dir - directory for package.json (Note: the second argument will change to "pkgfile" in v2) - -* `opts.pathFilter(pkg, path, relativePath)` - transform a path within a package - * pkg - package data - * path - the path being resolved - * relativePath - the path relative from the package.json location - * returns - a relative path that will be joined from the package.json location - -* opts.paths - require.paths array to use if nothing is found on the normal `node_modules` recursive walk (probably don't use this) - - For advanced users, `paths` can also be a `opts.paths(request, start, opts)` function - * request - the import specifier being resolved - * start - lookup path - * getNodeModulesDirs - a thunk (no-argument function) that returns the paths using standard `node_modules` resolution - * opts - the resolution options - -* `opts.packageIterator(request, start, opts)` - return the list of candidate paths where the packages sources may be found (probably don't use this) - * request - the import specifier being resolved - * start - lookup path - * getPackageCandidates - a thunk (no-argument function) that returns the paths using standard `node_modules` resolution - * opts - the resolution options - -* opts.moduleDirectory - directory (or directories) in which to recursively look for modules. default: `"node_modules"` - -* opts.preserveSymlinks - if true, doesn't resolve `basedir` to real path before resolving. -This is the way Node resolves dependencies when executed with the [--preserve-symlinks](https://nodejs.org/api/all.html#cli_preserve_symlinks) flag. -**Note:** this property is currently `true` by default but it will be changed to -`false` in the next major version because *Node's resolution algorithm does not preserve symlinks by default*. - -default `opts` values: - -```js -{ - paths: [], - basedir: __dirname, - extensions: ['.js'], - includeCoreModules: true, - readFileSync: fs.readFileSync, - isFile: function isFile(file) { - try { - var stat = fs.statSync(file); - } catch (e) { - if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) return false; - throw e; - } - return stat.isFile() || stat.isFIFO(); - }, - isDirectory: function isDirectory(dir) { - try { - var stat = fs.statSync(dir); - } catch (e) { - if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) return false; - throw e; - } - return stat.isDirectory(); - }, - realpathSync: function realpathSync(file) { - try { - var realpath = typeof fs.realpathSync.native === 'function' ? fs.realpathSync.native : fs.realpathSync; - return realpath(file); - } catch (realPathErr) { - if (realPathErr.code !== 'ENOENT') { - throw realPathErr; - } - } - return file; - }, - moduleDirectory: 'node_modules', - preserveSymlinks: true -} -``` - -# install - -With [npm](https://npmjs.org) do: - -```sh -npm install resolve -``` - -# license - -MIT diff --git a/tools/node_modules/@babel/core/package.json b/tools/node_modules/@babel/core/package.json index 5f93e494ea7963..93af09de9c2362 100644 --- a/tools/node_modules/@babel/core/package.json +++ b/tools/node_modules/@babel/core/package.json @@ -1,6 +1,6 @@ { "name": "@babel/core", - "version": "7.12.9", + "version": "7.12.10", "description": "Babel compiler core.", "main": "lib/index.js", "author": "Sebastian McKenzie <sebmck@gmail.com>", @@ -44,23 +44,22 @@ }, "dependencies": { "@babel/code-frame": "^7.10.4", - "@babel/generator": "^7.12.5", + "@babel/generator": "^7.12.10", "@babel/helper-module-transforms": "^7.12.1", "@babel/helpers": "^7.12.5", - "@babel/parser": "^7.12.7", + "@babel/parser": "^7.12.10", "@babel/template": "^7.12.7", - "@babel/traverse": "^7.12.9", - "@babel/types": "^7.12.7", + "@babel/traverse": "^7.12.10", + "@babel/types": "^7.12.10", "convert-source-map": "^1.7.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.1", "json5": "^2.1.2", "lodash": "^4.17.19", - "resolve": "^1.3.2", "semver": "^5.4.1", "source-map": "^0.5.0" }, "devDependencies": { - "@babel/helper-transform-fixture-test-runner": "7.12.1" + "@babel/helper-transform-fixture-test-runner": "7.12.10" } } \ No newline at end of file diff --git a/tools/node_modules/@babel/plugin-syntax-top-level-await/LICENSE b/tools/node_modules/@babel/plugin-syntax-top-level-await/LICENSE new file mode 100644 index 00000000000000..f31575ec773bb1 --- /dev/null +++ b/tools/node_modules/@babel/plugin-syntax-top-level-await/LICENSE @@ -0,0 +1,22 @@ +MIT License + +Copyright (c) 2014-present Sebastian McKenzie and other contributors + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/node_modules/@babel/plugin-syntax-top-level-await/README.md b/tools/node_modules/@babel/plugin-syntax-top-level-await/README.md new file mode 100644 index 00000000000000..476cb27d6bbb77 --- /dev/null +++ b/tools/node_modules/@babel/plugin-syntax-top-level-await/README.md @@ -0,0 +1,19 @@ +# @babel/plugin-syntax-top-level-await + +> Allow parsing of top-level await in modules + +See our website [@babel/plugin-syntax-top-level-await](https://babeljs.io/docs/en/next/babel-plugin-syntax-top-level-await.html) for more information. + +## Install + +Using npm: + +```sh +npm install --save-dev @babel/plugin-syntax-top-level-await +``` + +or using yarn: + +```sh +yarn add @babel/plugin-syntax-top-level-await --dev +``` diff --git a/tools/node_modules/@babel/plugin-syntax-top-level-await/lib/index.js b/tools/node_modules/@babel/plugin-syntax-top-level-await/lib/index.js new file mode 100644 index 00000000000000..a57cab715c0b45 --- /dev/null +++ b/tools/node_modules/@babel/plugin-syntax-top-level-await/lib/index.js @@ -0,0 +1,22 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _helperPluginUtils = require("@babel/helper-plugin-utils"); + +var _default = (0, _helperPluginUtils.declare)(api => { + api.assertVersion(7); + return { + name: "syntax-top-level-await", + + manipulateOptions(opts, parserOpts) { + parserOpts.plugins.push("topLevelAwait"); + } + + }; +}); + +exports.default = _default; \ No newline at end of file diff --git a/tools/node_modules/@babel/plugin-syntax-top-level-await/node_modules/@babel/helper-plugin-utils/LICENSE b/tools/node_modules/@babel/plugin-syntax-top-level-await/node_modules/@babel/helper-plugin-utils/LICENSE new file mode 100644 index 00000000000000..f31575ec773bb1 --- /dev/null +++ b/tools/node_modules/@babel/plugin-syntax-top-level-await/node_modules/@babel/helper-plugin-utils/LICENSE @@ -0,0 +1,22 @@ +MIT License + +Copyright (c) 2014-present Sebastian McKenzie and other contributors + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/node_modules/@babel/plugin-syntax-top-level-await/node_modules/@babel/helper-plugin-utils/README.md b/tools/node_modules/@babel/plugin-syntax-top-level-await/node_modules/@babel/helper-plugin-utils/README.md new file mode 100644 index 00000000000000..4e6303e08962a2 --- /dev/null +++ b/tools/node_modules/@babel/plugin-syntax-top-level-await/node_modules/@babel/helper-plugin-utils/README.md @@ -0,0 +1,19 @@ +# @babel/helper-plugin-utils + +> General utilities for plugins to use + +See our website [@babel/helper-plugin-utils](https://babeljs.io/docs/en/next/babel-helper-plugin-utils.html) for more information. + +## Install + +Using npm: + +```sh +npm install --save-dev @babel/helper-plugin-utils +``` + +or using yarn: + +```sh +yarn add @babel/helper-plugin-utils --dev +``` diff --git a/tools/node_modules/@babel/plugin-syntax-top-level-await/node_modules/@babel/helper-plugin-utils/lib/index.js b/tools/node_modules/@babel/plugin-syntax-top-level-await/node_modules/@babel/helper-plugin-utils/lib/index.js new file mode 100644 index 00000000000000..adb0656fa0e768 --- /dev/null +++ b/tools/node_modules/@babel/plugin-syntax-top-level-await/node_modules/@babel/helper-plugin-utils/lib/index.js @@ -0,0 +1,77 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.declare = declare; + +function declare(builder) { + return (api, options, dirname) => { + if (!api.assertVersion) { + api = Object.assign(copyApiObject(api), { + assertVersion(range) { + throwVersionError(range, api.version); + } + + }); + } + + return builder(api, options || {}, dirname); + }; +} + +function copyApiObject(api) { + let proto = null; + + if (typeof api.version === "string" && /^7\./.test(api.version)) { + proto = Object.getPrototypeOf(api); + + if (proto && (!has(proto, "version") || !has(proto, "transform") || !has(proto, "template") || !has(proto, "types"))) { + proto = null; + } + } + + return Object.assign({}, proto, api); +} + +function has(obj, key) { + return Object.prototype.hasOwnProperty.call(obj, key); +} + +function throwVersionError(range, version) { + if (typeof range === "number") { + if (!Number.isInteger(range)) { + throw new Error("Expected string or integer value."); + } + + range = `^${range}.0.0-0`; + } + + if (typeof range !== "string") { + throw new Error("Expected string or integer value."); + } + + const limit = Error.stackTraceLimit; + + if (typeof limit === "number" && limit < 25) { + Error.stackTraceLimit = 25; + } + + let err; + + if (version.slice(0, 2) === "7.") { + err = new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${version}". ` + `You'll need to update your @babel/core version.`); + } else { + err = new Error(`Requires Babel "${range}", but was loaded with "${version}". ` + `If you are sure you have a compatible version of @babel/core, ` + `it is likely that something in your build process is loading the ` + `wrong version. Inspect the stack trace of this error to look for ` + `the first entry that doesn't mention "@babel/core" or "babel-core" ` + `to see what is calling Babel.`); + } + + if (typeof limit === "number") { + Error.stackTraceLimit = limit; + } + + throw Object.assign(err, { + code: "BABEL_VERSION_UNSUPPORTED", + version, + range + }); +} \ No newline at end of file diff --git a/tools/node_modules/@babel/plugin-syntax-top-level-await/node_modules/@babel/helper-plugin-utils/package.json b/tools/node_modules/@babel/plugin-syntax-top-level-await/node_modules/@babel/helper-plugin-utils/package.json new file mode 100644 index 00000000000000..282d93f719fe54 --- /dev/null +++ b/tools/node_modules/@babel/plugin-syntax-top-level-await/node_modules/@babel/helper-plugin-utils/package.json @@ -0,0 +1,18 @@ +{ + "name": "@babel/helper-plugin-utils", + "version": "7.10.4", + "description": "General utilities for plugins to use", + "author": "Logan Smyth <loganfsmyth@gmail.com>", + "homepage": "https://babeljs.io/", + "license": "MIT", + "publishConfig": { + "access": "public" + }, + "repository": { + "type": "git", + "url": "https://github.com/babel/babel.git", + "directory": "packages/babel-helper-plugin-utils" + }, + "main": "lib/index.js", + "gitHead": "7fd40d86a0d03ff0e9c3ea16b29689945433d4df" +} diff --git a/tools/node_modules/@babel/plugin-syntax-top-level-await/package.json b/tools/node_modules/@babel/plugin-syntax-top-level-await/package.json new file mode 100644 index 00000000000000..33b3238ea86d98 --- /dev/null +++ b/tools/node_modules/@babel/plugin-syntax-top-level-await/package.json @@ -0,0 +1,27 @@ +{ + "name": "@babel/plugin-syntax-top-level-await", + "version": "7.12.1", + "description": "Allow parsing of top-level await in modules", + "repository": { + "type": "git", + "url": "https://github.com/babel/babel.git", + "directory": "packages/babel-plugin-syntax-top-level-await" + }, + "license": "MIT", + "publishConfig": { + "access": "public" + }, + "main": "lib/index.js", + "keywords": [ + "babel-plugin" + ], + "dependencies": { + "@babel/helper-plugin-utils": "^7.10.4" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + }, + "devDependencies": { + "@babel/core": "^7.12.1" + } +} \ No newline at end of file diff --git a/tools/node_modules/eslint/README.md b/tools/node_modules/eslint/README.md index 2fbe7ae7b38192..73a30990e50974 100644 --- a/tools/node_modules/eslint/README.md +++ b/tools/node_modules/eslint/README.md @@ -158,6 +158,7 @@ ESLint follows [semantic versioning](https://semver.org). However, due to the na * A bug fix in a rule that results in ESLint reporting more linting errors. * A new rule is created. * A new option to an existing rule that does not result in ESLint reporting more linting errors by default. + * A new addition to an existing rule to support a newly-added language feature (within the last 12 months) that will result in ESLint reporting more linting errors by default. * An existing rule is deprecated. * A new CLI capability is created. * New capabilities to the public API are added (new classes, new methods, new arguments to existing methods, etc.). @@ -262,7 +263,7 @@ The following companies, organizations, and individuals support ESLint's ongoing <p><a href="https://automattic.com"><img src="https://images.opencollective.com/photomatt/ff91f0b/logo.png" alt="Automattic" height="undefined"></a></p><h3>Gold Sponsors</h3> <p><a href="https://google.com/chrome"><img src="https://images.opencollective.com/chrome/dc55bd4/logo.png" alt="Chrome's Web Framework & Tools Performance Fund" height="96"></a> <a href="https://www.shopify.com"><img src="https://images.opencollective.com/shopify/e780cd4/logo.png" alt="Shopify" height="96"></a> <a href="https://www.salesforce.com"><img src="https://images.opencollective.com/salesforce/ca8f997/logo.png" alt="Salesforce" height="96"></a> <a href="https://www.airbnb.com/"><img src="https://images.opencollective.com/airbnb/d327d66/logo.png" alt="Airbnb" height="96"></a> <a href="https://aka.ms/microsoftfossfund"><img src="https://avatars1.githubusercontent.com/u/67931232?u=7fddc652a464d7151b97e8f108392af7d54fa3e8&v=4" alt="Microsoft FOSS Fund Sponsorships" height="96"></a></p><h3>Silver Sponsors</h3> <p><a href="https://liftoff.io/"><img src="https://images.opencollective.com/liftoff/5c4fa84/logo.png" alt="Liftoff" height="64"></a> <a href="https://www.ampproject.org/"><img src="https://images.opencollective.com/amp/c8a3b25/logo.png" alt="AMP Project" height="64"></a></p><h3>Bronze Sponsors</h3> -<p><a href="https://writersperhour.com"><img src="https://images.opencollective.com/writersperhour/5787d4b/logo.png" alt="Writers Per Hour" height="32"></a> <a href="https://www.betacalendars.com/printable-calendar"><img src="https://images.opencollective.com/betacalendars/9334b33/logo.png" alt="2021 calendar" height="32"></a> <a href="https://buy.fineproxy.org/eng/"><img src="https://images.opencollective.com/buy-fineproxy-org/b282e39/logo.png" alt="Buy.Fineproxy.Org" height="32"></a> <a href="https://www.veikkaajat.com"><img src="https://images.opencollective.com/veikkaajat/3777f94/logo.png" alt="Veikkaajat.com" height="32"></a> <a href="https://www.crosswordsolver.org/anagram-solver/"><img src="https://images.opencollective.com/anagram-solver/2666271/logo.png" alt="Anagram Solver" height="32"></a> <a href="null"><img src="https://images.opencollective.com/bugsnag-stability-monitoring/c2cef36/logo.png" alt="Bugsnag Stability Monitoring" height="32"></a> <a href="https://mixpanel.com"><img src="https://images.opencollective.com/mixpanel/cd682f7/logo.png" alt="Mixpanel" height="32"></a> <a href="https://www.vpsserver.com"><img src="https://images.opencollective.com/vpsservercom/logo.png" alt="VPS Server" height="32"></a> <a href="https://icons8.com"><img src="https://images.opencollective.com/icons8/7fa1641/logo.png" alt="Icons8: free icons, photos, illustrations, and music" height="32"></a> <a href="https://discordapp.com"><img src="https://images.opencollective.com/discordapp/7e3d9a9/logo.png" alt="Discord" height="32"></a> <a href="https://themeisle.com"><img src="https://images.opencollective.com/themeisle/d5592fe/logo.png" alt="ThemeIsle" height="32"></a> <a href="https://www.firesticktricks.com"><img src="https://images.opencollective.com/fire-stick-tricks/b8fbe2c/logo.png" alt="Fire Stick Tricks" height="32"></a></p> +<p><a href="https://streamat.se"><img src="https://images.opencollective.com/streamat/46890db/logo.png" alt="Streamat" height="32"></a> <a href="https://thestandarddaily.com/"><img src="https://images.opencollective.com/eric-watson/db4e598/avatar.png" alt="The Standard Daily" height="32"></a> <a href="https://writersperhour.com"><img src="https://images.opencollective.com/writersperhour/5787d4b/logo.png" alt="Writers Per Hour" height="32"></a> <a href="https://www.betacalendars.com/february-calendar.html"><img src="https://images.opencollective.com/betacalendars/9334b33/logo.png" alt="February 2021 calendar" height="32"></a> <a href="https://buy.fineproxy.org/eng/"><img src="https://images.opencollective.com/buy-fineproxy-org/b282e39/logo.png" alt="Buy.Fineproxy.Org" height="32"></a> <a href="https://www.crosswordsolver.org/anagram-solver/"><img src="https://images.opencollective.com/anagram-solver/2666271/logo.png" alt="Anagram Solver" height="32"></a> <a href="null"><img src="https://images.opencollective.com/bugsnag-stability-monitoring/c2cef36/logo.png" alt="Bugsnag Stability Monitoring" height="32"></a> <a href="https://mixpanel.com"><img src="https://images.opencollective.com/mixpanel/cd682f7/logo.png" alt="Mixpanel" height="32"></a> <a href="https://www.vpsserver.com"><img src="https://images.opencollective.com/vpsservercom/logo.png" alt="VPS Server" height="32"></a> <a href="https://icons8.com"><img src="https://images.opencollective.com/icons8/7fa1641/logo.png" alt="Icons8: free icons, photos, illustrations, and music" height="32"></a> <a href="https://discordapp.com"><img src="https://images.opencollective.com/discordapp/7e3d9a9/logo.png" alt="Discord" height="32"></a> <a href="https://themeisle.com"><img src="https://images.opencollective.com/themeisle/d5592fe/logo.png" alt="ThemeIsle" height="32"></a> <a href="https://www.firesticktricks.com"><img src="https://images.opencollective.com/fire-stick-tricks/b8fbe2c/logo.png" alt="Fire Stick Tricks" height="32"></a></p> <!--sponsorsend--> ## <a name="technology-sponsors"></a>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/init/config-initializer.js b/tools/node_modules/eslint/lib/init/config-initializer.js index f7d4cc7a171fe9..6f62e7db87e7f7 100644 --- a/tools/node_modules/eslint/lib/init/config-initializer.js +++ b/tools/node_modules/eslint/lib/init/config-initializer.js @@ -565,7 +565,8 @@ function promptUser() { { type: "toggle", name: "installESLint", - message(answers) { + message() { + const { answers } = this.state; const verb = semver.ltr(answers.localESLintVersion, answers.requiredESLintVersionRange) ? "upgrade" : "downgrade"; 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/complexity.js b/tools/node_modules/eslint/lib/rules/complexity.js index 7fc8bf9bc2ea8c..5d62c6ff44b8f1 100644 --- a/tools/node_modules/eslint/lib/rules/complexity.js +++ b/tools/node_modules/eslint/lib/rules/complexity.js @@ -153,7 +153,13 @@ module.exports = { IfStatement: increaseComplexity, SwitchCase: increaseSwitchComplexity, WhileStatement: increaseComplexity, - DoWhileStatement: increaseComplexity + DoWhileStatement: increaseComplexity, + + AssignmentExpression(node) { + if (astUtils.isLogicalAssignmentOperator(node.operator)) { + increaseComplexity(); + } + } }; } 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-extra-parens.js b/tools/node_modules/eslint/lib/rules/no-extra-parens.js index 8d358d23ad3b50..19c6fced79d4ff 100644 --- a/tools/node_modules/eslint/lib/rules/no-extra-parens.js +++ b/tools/node_modules/eslint/lib/rules/no-extra-parens.js @@ -895,6 +895,22 @@ module.exports = { } if (node.init) { + + if (node.init.type !== "VariableDeclaration") { + const firstToken = sourceCode.getFirstToken(node.init, astUtils.isNotOpeningParenToken); + + if ( + firstToken.value === "let" && + astUtils.isOpeningBracketToken( + sourceCode.getTokenAfter(firstToken, astUtils.isNotClosingParenToken) + ) + ) { + + // ForStatement#init expression cannot start with `let[`. + tokensToIgnore.add(firstToken); + } + } + startNewReportsBuffering(); if (hasExcessParens(node.init)) { 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<string, boolean>} [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<string, GlobalConf>} [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/@eslint/eslintrc/lib/config-array-factory.js b/tools/node_modules/eslint/node_modules/@eslint/eslintrc/lib/config-array-factory.js index 6494a041cb8dd0..c7ff6a09a93881 100644 --- a/tools/node_modules/eslint/node_modules/@eslint/eslintrc/lib/config-array-factory.js +++ b/tools/node_modules/eslint/node_modules/@eslint/eslintrc/lib/config-array-factory.js @@ -281,14 +281,15 @@ function loadESLintIgnoreFile(filePath) { * Creates an error to notify about a missing config to extend from. * @param {string} configName The name of the missing config. * @param {string} importerName The name of the config that imported the missing config + * @param {string} messageTemplate The text template to source error strings from. * @returns {Error} The error object to throw * @private */ -function configMissingError(configName, importerName) { +function configInvalidError(configName, importerName, messageTemplate) { return Object.assign( new Error(`Failed to load config "${configName}" to extend from.`), { - messageTemplate: "extend-config-missing", + messageTemplate, messageData: { configName, importerName } } ); @@ -809,7 +810,7 @@ class ConfigArrayFactory { }); } - throw configMissingError(extendName, ctx.name); + throw configInvalidError(extendName, ctx.name, "extend-config-missing"); } /** @@ -821,6 +822,11 @@ class ConfigArrayFactory { */ _loadExtendedPluginConfig(extendName, ctx) { const slashIndex = extendName.lastIndexOf("/"); + + if (slashIndex === -1) { + throw configInvalidError(extendName, ctx.filePath, "plugin-invalid"); + } + const pluginName = extendName.slice("plugin:".length, slashIndex); const configName = extendName.slice(slashIndex + 1); @@ -841,7 +847,7 @@ class ConfigArrayFactory { }); } - throw plugin.error || configMissingError(extendName, ctx.filePath); + throw plugin.error || configInvalidError(extendName, ctx.filePath, "extend-config-missing"); } /** @@ -874,7 +880,7 @@ class ConfigArrayFactory { } catch (error) { /* istanbul ignore else */ if (error && error.code === "MODULE_NOT_FOUND") { - throw configMissingError(extendName, ctx.filePath); + throw configInvalidError(extendName, ctx.filePath, "extend-config-missing"); } throw error; } diff --git a/tools/node_modules/eslint/node_modules/@eslint/eslintrc/package.json b/tools/node_modules/eslint/node_modules/@eslint/eslintrc/package.json index e33d83420dc0b7..20f43070c13d3e 100644 --- a/tools/node_modules/eslint/node_modules/@eslint/eslintrc/package.json +++ b/tools/node_modules/eslint/node_modules/@eslint/eslintrc/package.json @@ -14,7 +14,7 @@ "ignore": "^4.0.6", "import-fresh": "^3.2.1", "js-yaml": "^3.13.1", - "lodash": "^4.17.19", + "lodash": "^4.17.20", "minimatch": "^3.0.4", "strip-json-comments": "^3.1.1" }, @@ -65,5 +65,5 @@ "publish-release": "eslint-publish-release", "test": "mocha -R progress -c 'tests/lib/**/*.js'" }, - "version": "0.2.2" + "version": "0.3.0" } \ No newline at end of file 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@gmail.com> (sindresorhus.com) +Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (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/@babel/core/node_modules/function-bind/LICENSE b/tools/node_modules/eslint/node_modules/require-from-string/license similarity index 90% rename from tools/node_modules/@babel/core/node_modules/function-bind/LICENSE rename to tools/node_modules/eslint/node_modules/require-from-string/license index 62d6d237ff179b..1aeb74fd25e171 100644 --- a/tools/node_modules/@babel/core/node_modules/function-bind/LICENSE +++ b/tools/node_modules/eslint/node_modules/require-from-string/license @@ -1,4 +1,6 @@ -Copyright (c) 2013 Raynos. +The MIT License (MIT) + +Copyright (c) Vsevolod Strukchinsky <floatdrop@gmail.com> (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 @@ -17,4 +19,3 @@ 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..22a79962a1a2ee 100644 --- a/tools/node_modules/eslint/node_modules/table/README.md +++ b/tools/node_modules/eslint/node_modules/table/README.md @@ -1,7 +1,6 @@ <a name="table"></a> # Table -[![GitSpo Mentions](https://gitspo.com/badges/mentions/gajus/table?style=flat-square)](https://gitspo.com/mentions/gajus/table) [![Travis build status](http://img.shields.io/travis/gajus/table/master.svg?style=flat-square)](https://travis-ci.org/gajus/table) [![Coveralls](https://img.shields.io/coveralls/gajus/table.svg?style=flat-square)](https://coveralls.io/github/gajus/table) [![NPM version](http://img.shields.io/npm/v/table.svg?style=flat-square)](https://www.npmjs.org/package/table) @@ -56,8 +55,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 +487,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..10fc74ab93cfc1 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,20 @@ "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" + "singleLine": { + "typeof": "boolean" } - } + }, + "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..e17b964fe9be3c --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/dist/validators.js @@ -0,0 +1,1492 @@ +"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" + }, + "singleLine": { + "typeof": "boolean" + } + }, + "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")) || (key0 === "singleLine"))) { + 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++; + } + } + if (data.singleLine !== undefined) { + if (typeof data.singleLine != "boolean") { + const err2 = { + keyword: "typeof", + dataPath: dataPath + "/singleLine", + schemaPath: "#/properties/singleLine/typeof", + params: {}, + message: "should pass \"typeof\" keyword validation" + }; + if (vErrors === null) { + vErrors = [err2]; + } else { + vErrors.push(err2); + } + errors++; + } + } + } else { + const err3 = { + keyword: "type", + dataPath, + schemaPath: "#/type", + params: { + type: "object" + }, + message: "should be object" + }; + if (vErrors === null) { + vErrors = [err3]; + } else { + vErrors.push(err3); + } + 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/@babel/core/node_modules/path-parse/LICENSE b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/LICENSE similarity index 96% rename from tools/node_modules/@babel/core/node_modules/path-parse/LICENSE rename to tools/node_modules/eslint/node_modules/table/node_modules/ajv/LICENSE index 810f3dbea83b53..96ee719987f778 100644 --- a/tools/node_modules/@babel/core/node_modules/path-parse/LICENSE +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2015 Javier Blanco +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 @@ -19,3 +19,4 @@ 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..65368f5fe1f9c8 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/README.md @@ -0,0 +1,420 @@ +<img align="right" alt="Ajv logo" width="160" src="https://ajv.js.org/images/ajv_logo.png"> + +# 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 + +[<img src="https://www.poberezkin.com/images/mozilla.svg" width="45%">](https://www.mozilla.org)[<img src="https://ajv.js.org/images/gap.svg" width="9%">](https://opencollective.com/ajv)[<img src="https://ajv.js.org/images/reserved.svg" width="45%">](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) +- [Using in ES5 environment](#using-in-es5-environment) +- [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 + +[<img src="https://www.poberezkin.com/images/mozilla.png" width="240" height="68">](https://www.mozilla.org/en-US/moss/)     [<img src="https://www.poberezkin.com/images/openjs.png" width="220" height="68">](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. + +## <a name="sponsors"></a>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 + +<a href="https://opencollective.com/ajv"><img src="https://opencollective.com/ajv/individuals.svg?width=890"></a> + +<a href="https://opencollective.com/ajv/organization/0/website"><img src="https://opencollective.com/ajv/organization/0/avatar.svg"></a> +<a href="https://opencollective.com/ajv/organization/1/website"><img src="https://opencollective.com/ajv/organization/1/avatar.svg"></a> +<a href="https://opencollective.com/ajv/organization/2/website"><img src="https://opencollective.com/ajv/organization/2/avatar.svg"></a> +<a href="https://opencollective.com/ajv/organization/3/website"><img src="https://opencollective.com/ajv/organization/3/avatar.svg"></a> +<a href="https://opencollective.com/ajv/organization/4/website"><img src="https://opencollective.com/ajv/organization/4/avatar.svg"></a> +<a href="https://opencollective.com/ajv/organization/5/website"><img src="https://opencollective.com/ajv/organization/5/avatar.svg"></a> +<a href="https://opencollective.com/ajv/organization/6/website"><img src="https://opencollective.com/ajv/organization/6/avatar.svg"></a> +<a href="https://opencollective.com/ajv/organization/7/website"><img src="https://opencollective.com/ajv/organization/7/avatar.svg"></a> +<a href="https://opencollective.com/ajv/organization/8/website"><img src="https://opencollective.com/ajv/organization/8/avatar.svg"></a> +<a href="https://opencollective.com/ajv/organization/9/website"><img src="https://opencollective.com/ajv/organization/9/avatar.svg"></a> + +## 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 +``` + +## <a name="usage"></a>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<MyData> = { + 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<MyData>(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 +<script src="bundle/ajv7.min.js"></script> +<script> + ;(function () { + const Ajv = window.ajv7.default + const ajv = new Ajv() + })() +</script> +``` + +or to load the bundle that supports JSONSchema draft-2019-09: + +```html +<script src="bundle/ajv2019.min.js"></script> +<script> + ;(function () { + const Ajv = window.ajv2019.default + const ajv = new Ajv() + })() +</script> +``` + +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)). + +## Using in ES5 environment + +You need to: + +- recompile Typescript to ES5 target - it is set to 2018 in the bundled compiled code. +- generate ES5 validation code: + +```javascript +const ajv = new Ajv({code: {es5: true}}) +``` + +See [Advanced options](https://github.com/ajv-validator/ajv/blob/master/docs/api.md#advanced-options). + +## 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..fb97c64def071e --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/validate/iterate.js @@ -0,0 +1,108 @@ +"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 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_1.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, <string>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..032498f33b03b8 --- /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.3" +} \ 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/<img[^>]+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/@babel/core/node_modules/resolve/LICENSE b/tools/node_modules/eslint/node_modules/table/node_modules/json-schema-traverse/LICENSE similarity index 96% rename from tools/node_modules/@babel/core/node_modules/resolve/LICENSE rename to tools/node_modules/eslint/node_modules/table/node_modules/json-schema-traverse/LICENSE index ff4fce28af33a4..7f1543566f6abb 100644 --- a/tools/node_modules/@babel/core/node_modules/resolve/LICENSE +++ b/tools/node_modules/eslint/node_modules/table/node_modules/json-schema-traverse/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2012 James Halliday +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 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<sch.length; i++) + _traverse(opts, pre, post, sch[i], jsonPtr + '/' + key + '/' + i, rootSchema, jsonPtr, key, schema, i); + } + } else if (key in traverse.propsKeywords) { + if (sch && typeof sch == 'object') { + for (var prop in sch) + _traverse(opts, pre, post, sch[prop], jsonPtr + '/' + key + '/' + escapeJsonPtr(prop), rootSchema, jsonPtr, key, schema, prop); + } + } else if (key in traverse.keywords || (opts.allKeys && !(key in traverse.skipKeywords))) { + _traverse(opts, pre, post, sch, jsonPtr + '/' + key, rootSchema, jsonPtr, key, schema); + } + } + post(schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex); + } +} + + +function escapeJsonPtr(str) { + return str.replace(/~/g, '~0').replace(/\//g, '~1'); +} diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/json-schema-traverse/package.json b/tools/node_modules/eslint/node_modules/table/node_modules/json-schema-traverse/package.json new file mode 100644 index 00000000000000..98fee959b778b7 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/json-schema-traverse/package.json @@ -0,0 +1,47 @@ +{ + "author": { + "name": "Evgeny Poberezkin" + }, + "bugs": { + "url": "https://github.com/epoberezkin/json-schema-traverse/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Traverse JSON Schema passing each schema object to callback", + "devDependencies": { + "eslint": "^7.3.1", + "mocha": "^8.0.1", + "nyc": "^15.0.0", + "pre-commit": "^1.2.2" + }, + "homepage": "https://github.com/epoberezkin/json-schema-traverse#readme", + "keywords": [ + "JSON-Schema", + "traverse", + "iterate" + ], + "license": "MIT", + "main": "index.js", + "name": "json-schema-traverse", + "nyc": { + "exclude": [ + "**/spec/**", + "node_modules" + ], + "reporter": [ + "lcov", + "text-summary" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/epoberezkin/json-schema-traverse.git" + }, + "scripts": { + "eslint": "eslint index.js spec", + "test": "npm run eslint && nyc npm run test-spec", + "test-spec": "mocha spec -R spec" + }, + "types": "index.d.ts", + "version": "1.0.0" +} \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/package.json b/tools/node_modules/eslint/node_modules/table/package.json index 73c461c4025328..892f772a2f312a 100644 --- a/tools/node_modules/eslint/node_modules/table/package.json +++ b/tools/node_modules/eslint/node_modules/table/package.json @@ -9,7 +9,7 @@ }, "bundleDependencies": false, "dependencies": { - "ajv": "^6.12.4", + "ajv": "^7.0.2", "lodash": "^4.17.20", "slice-ansi": "^4.0.0", "string-width": "^4.2.0" @@ -17,30 +17,31 @@ "deprecated": false, "description": "Formats data into a string table.", "devDependencies": { - "@babel/cli": "^7.10.5", - "@babel/core": "^7.11.4", - "@babel/node": "^7.10.5", - "@babel/plugin-transform-flow-strip-types": "^7.10.4", - "@babel/preset-env": "^7.11.0", - "@babel/register": "^7.10.5", - "ajv-cli": "^3.2.1", - "ajv-keywords": "^3.5.2", + "@babel/cli": "^7.12.10", + "@babel/core": "^7.12.10", + "@babel/node": "^7.12.10", + "@babel/plugin-transform-flow-strip-types": "^7.12.10", + "@babel/preset-env": "^7.12.11", + "@babel/register": "^7.12.10", + "ajv-cli": "^4.0.1", + "ajv-keywords": "^4.0.0", "babel-plugin-istanbul": "^6.0.0", "babel-plugin-lodash": "^3.3.4", - "babel-plugin-transform-export-default-name": "^2.0.4", + "babel-plugin-transform-export-default-name": "^2.1.0", "chai": "^4.2.0", "chalk": "^4.1.0", "coveralls": "^3.1.0", - "eslint": "^7.7.0", - "eslint-config-canonical": "^23.0.1", - "flow-bin": "^0.132.0", + "eslint": "^7.16.0", + "eslint-config-canonical": "^25.0.0", + "flow-bin": "^0.141.0", "flow-copy-source": "^2.0.9", "gitdown": "^3.1.3", - "husky": "^4.2.5", - "mocha": "^8.1.3", + "husky": "^4.3.6", + "js-beautify": "^1.13.0", + "mocha": "^8.2.1", "nyc": "^15.1.0", - "semantic-release": "^17.1.1", - "sinon": "^9.0.3" + "semantic-release": "^17.3.1", + "sinon": "^9.2.2" }, "engines": { "node": ">=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.7" } \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/uri-js/README.md b/tools/node_modules/eslint/node_modules/uri-js/README.md index 3dbe4054f2577a..43e648bbad5c85 100755 --- a/tools/node_modules/eslint/node_modules/uri-js/README.md +++ b/tools/node_modules/eslint/node_modules/uri-js/README.md @@ -97,6 +97,8 @@ URI.js supports inserting custom [scheme](http://en.wikipedia.org/wiki/URI_schem * http \[[RFC 2616](http://www.ietf.org/rfc/rfc2616.txt)\] * https \[[RFC 2818](http://www.ietf.org/rfc/rfc2818.txt)\] +* ws \[[RFC 6455](http://www.ietf.org/rfc/rfc6455.txt)\] +* wss \[[RFC 6455](http://www.ietf.org/rfc/rfc6455.txt)\] * mailto \[[RFC 6068](http://www.ietf.org/rfc/rfc6068.txt)\] * urn \[[RFC 2141](http://www.ietf.org/rfc/rfc2141.txt)\] * urn:uuid \[[RFC 4122](http://www.ietf.org/rfc/rfc4122.txt)\] @@ -156,7 +158,7 @@ URI.js supports inserting custom [scheme](http://en.wikipedia.org/wiki/URI_schem //returns: //{ // scheme : "urn", - // nid : "example", + // nid : "uuid", // uuid : "f81d4fae-7dec-11d0-a765-00a0c91e6bf6", //} diff --git a/tools/node_modules/eslint/node_modules/uri-js/dist/es5/uri.all.js b/tools/node_modules/eslint/node_modules/uri-js/dist/es5/uri.all.js index 47f42f8aa16696..0706116fef7e30 100755 --- a/tools/node_modules/eslint/node_modules/uri-js/dist/es5/uri.all.js +++ b/tools/node_modules/eslint/node_modules/uri-js/dist/es5/uri.all.js @@ -1,4 +1,4 @@ -/** @license URI.js v4.4.0 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */ +/** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'], factory) : diff --git a/tools/node_modules/eslint/node_modules/uri-js/dist/es5/uri.all.min.js b/tools/node_modules/eslint/node_modules/uri-js/dist/es5/uri.all.min.js index 09edffb7ccbb63..fcd845862d917f 100755 --- a/tools/node_modules/eslint/node_modules/uri-js/dist/es5/uri.all.min.js +++ b/tools/node_modules/eslint/node_modules/uri-js/dist/es5/uri.all.min.js @@ -1,3 +1,3 @@ -/** @license URI.js v4.4.0 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */ +/** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */ !function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r(e.URI=e.URI||{})}(this,function(e){"use strict";function r(){for(var e=arguments.length,r=Array(e),n=0;n<e;n++)r[n]=arguments[n];if(r.length>1){r[0]=r[0].slice(0,-1);for(var t=r.length-1,o=1;o<t;++o)r[o]=r[o].slice(1,-1);return r[t]=r[t].slice(1),r.join("")}return r[0]}function n(e){return"(?:"+e+")"}function t(e){return e===undefined?"undefined":null===e?"null":Object.prototype.toString.call(e).split(" ").pop().split("]").shift().toLowerCase()}function o(e){return e.toUpperCase()}function a(e){return e!==undefined&&null!==e?e instanceof Array?e:"number"!=typeof e.length||e.split||e.setInterval||e.call?[e]:Array.prototype.slice.call(e):[]}function i(e,r){var n=e;if(r)for(var t in r)n[t]=r[t];return n}function u(e){var t=r("[0-9]","[A-Fa-f]"),o=n(n("%[EFef]"+t+"%"+t+t+"%"+t+t)+"|"+n("%[89A-Fa-f]"+t+"%"+t+t)+"|"+n("%"+t+t)),a="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",i=r("[\\:\\/\\?\\#\\[\\]\\@]",a),u=e?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",s=e?"[\\uE000-\\uF8FF]":"[]",f=r("[A-Za-z]","[0-9]","[\\-\\.\\_\\~]",u),c=n(n("25[0-5]")+"|"+n("2[0-4][0-9]")+"|"+n("1[0-9][0-9]")+"|"+n("0?[1-9][0-9]")+"|0?0?[0-9]"),p=n(c+"\\."+c+"\\."+c+"\\."+c),h=n(t+"{1,4}"),d=n(n(h+"\\:"+h)+"|"+p),l=n(n(h+"\\:")+"{6}"+d),m=n("\\:\\:"+n(h+"\\:")+"{5}"+d),g=n(n(h)+"?\\:\\:"+n(h+"\\:")+"{4}"+d),v=n(n(n(h+"\\:")+"{0,1}"+h)+"?\\:\\:"+n(h+"\\:")+"{3}"+d),E=n(n(n(h+"\\:")+"{0,2}"+h)+"?\\:\\:"+n(h+"\\:")+"{2}"+d),C=n(n(n(h+"\\:")+"{0,3}"+h)+"?\\:\\:"+h+"\\:"+d),y=n(n(n(h+"\\:")+"{0,4}"+h)+"?\\:\\:"+d),S=n(n(n(h+"\\:")+"{0,5}"+h)+"?\\:\\:"+h),A=n(n(n(h+"\\:")+"{0,6}"+h)+"?\\:\\:"),D=n([l,m,g,v,E,C,y,S,A].join("|")),w=n(n(f+"|"+o)+"+");return{NOT_SCHEME:new RegExp(r("[^]","[A-Za-z]","[0-9]","[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(r("[^\\%\\:]",f,a),"g"),NOT_HOST:new RegExp(r("[^\\%\\[\\]\\:]",f,a),"g"),NOT_PATH:new RegExp(r("[^\\%\\/\\:\\@]",f,a),"g"),NOT_PATH_NOSCHEME:new RegExp(r("[^\\%\\/\\@]",f,a),"g"),NOT_QUERY:new RegExp(r("[^\\%]",f,a,"[\\:\\@\\/\\?]",s),"g"),NOT_FRAGMENT:new RegExp(r("[^\\%]",f,a,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(r("[^]",f,a),"g"),UNRESERVED:new RegExp(f,"g"),OTHER_CHARS:new RegExp(r("[^\\%]",f,i),"g"),PCT_ENCODED:new RegExp(o,"g"),IPV4ADDRESS:new RegExp("^("+p+")$"),IPV6ADDRESS:new RegExp("^\\[?("+D+")"+n(n("\\%25|\\%(?!"+t+"{2})")+"("+w+")")+"?\\]?$")}}function s(e){throw new RangeError(H[e])}function f(e,r){for(var n=[],t=e.length;t--;)n[t]=r(e[t]);return n}function c(e,r){var n=e.split("@"),t="";return n.length>1&&(t=n[0]+"@",e=n[1]),e=e.replace(j,"."),t+f(e.split("."),r).join(".")}function p(e){for(var r=[],n=0,t=e.length;n<t;){var o=e.charCodeAt(n++);if(o>=55296&&o<=56319&&n<t){var a=e.charCodeAt(n++);56320==(64512&a)?r.push(((1023&o)<<10)+(1023&a)+65536):(r.push(o),n--)}else r.push(o)}return r}function h(e){var r=e.charCodeAt(0);return r<16?"%0"+r.toString(16).toUpperCase():r<128?"%"+r.toString(16).toUpperCase():r<2048?"%"+(r>>6|192).toString(16).toUpperCase()+"%"+(63&r|128).toString(16).toUpperCase():"%"+(r>>12|224).toString(16).toUpperCase()+"%"+(r>>6&63|128).toString(16).toUpperCase()+"%"+(63&r|128).toString(16).toUpperCase()}function d(e){for(var r="",n=0,t=e.length;n<t;){var o=parseInt(e.substr(n+1,2),16);if(o<128)r+=String.fromCharCode(o),n+=3;else if(o>=194&&o<224){if(t-n>=6){var a=parseInt(e.substr(n+4,2),16);r+=String.fromCharCode((31&o)<<6|63&a)}else r+=e.substr(n,6);n+=6}else if(o>=224){if(t-n>=9){var i=parseInt(e.substr(n+4,2),16),u=parseInt(e.substr(n+7,2),16);r+=String.fromCharCode((15&o)<<12|(63&i)<<6|63&u)}else r+=e.substr(n,9);n+=9}else r+=e.substr(n,3),n+=3}return r}function l(e,r){function n(e){var n=d(e);return n.match(r.UNRESERVED)?n:e}return e.scheme&&(e.scheme=String(e.scheme).replace(r.PCT_ENCODED,n).toLowerCase().replace(r.NOT_SCHEME,"")),e.userinfo!==undefined&&(e.userinfo=String(e.userinfo).replace(r.PCT_ENCODED,n).replace(r.NOT_USERINFO,h).replace(r.PCT_ENCODED,o)),e.host!==undefined&&(e.host=String(e.host).replace(r.PCT_ENCODED,n).toLowerCase().replace(r.NOT_HOST,h).replace(r.PCT_ENCODED,o)),e.path!==undefined&&(e.path=String(e.path).replace(r.PCT_ENCODED,n).replace(e.scheme?r.NOT_PATH:r.NOT_PATH_NOSCHEME,h).replace(r.PCT_ENCODED,o)),e.query!==undefined&&(e.query=String(e.query).replace(r.PCT_ENCODED,n).replace(r.NOT_QUERY,h).replace(r.PCT_ENCODED,o)),e.fragment!==undefined&&(e.fragment=String(e.fragment).replace(r.PCT_ENCODED,n).replace(r.NOT_FRAGMENT,h).replace(r.PCT_ENCODED,o)),e}function m(e){return e.replace(/^0*(.*)/,"$1")||"0"}function g(e,r){var n=e.match(r.IPV4ADDRESS)||[],t=T(n,2),o=t[1];return o?o.split(".").map(m).join("."):e}function v(e,r){var n=e.match(r.IPV6ADDRESS)||[],t=T(n,3),o=t[1],a=t[2];if(o){for(var i=o.toLowerCase().split("::").reverse(),u=T(i,2),s=u[0],f=u[1],c=f?f.split(":").map(m):[],p=s.split(":").map(m),h=r.IPV4ADDRESS.test(p[p.length-1]),d=h?7:8,l=p.length-d,v=Array(d),E=0;E<d;++E)v[E]=c[E]||p[l+E]||"";h&&(v[d-1]=g(v[d-1],r));var C=v.reduce(function(e,r,n){if(!r||"0"===r){var t=e[e.length-1];t&&t.index+t.length===n?t.length++:e.push({index:n,length:1})}return e},[]),y=C.sort(function(e,r){return r.length-e.length})[0],S=void 0;if(y&&y.length>1){var A=v.slice(0,y.index),D=v.slice(y.index+y.length);S=A.join(":")+"::"+D.join(":")}else S=v.join(":");return a&&(S+="%"+a),S}return e}function E(e){var r=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{},n={},t=!1!==r.iri?R:F;"suffix"===r.reference&&(e=(r.scheme?r.scheme+":":"")+"//"+e);var o=e.match(K);if(o){W?(n.scheme=o[1],n.userinfo=o[3],n.host=o[4],n.port=parseInt(o[5],10),n.path=o[6]||"",n.query=o[7],n.fragment=o[8],isNaN(n.port)&&(n.port=o[5])):(n.scheme=o[1]||undefined,n.userinfo=-1!==e.indexOf("@")?o[3]:undefined,n.host=-1!==e.indexOf("//")?o[4]:undefined,n.port=parseInt(o[5],10),n.path=o[6]||"",n.query=-1!==e.indexOf("?")?o[7]:undefined,n.fragment=-1!==e.indexOf("#")?o[8]:undefined,isNaN(n.port)&&(n.port=e.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?o[4]:undefined)),n.host&&(n.host=v(g(n.host,t),t)),n.scheme!==undefined||n.userinfo!==undefined||n.host!==undefined||n.port!==undefined||n.path||n.query!==undefined?n.scheme===undefined?n.reference="relative":n.fragment===undefined?n.reference="absolute":n.reference="uri":n.reference="same-document",r.reference&&"suffix"!==r.reference&&r.reference!==n.reference&&(n.error=n.error||"URI is not a "+r.reference+" reference.");var a=J[(r.scheme||n.scheme||"").toLowerCase()];if(r.unicodeSupport||a&&a.unicodeSupport)l(n,t);else{if(n.host&&(r.domainHost||a&&a.domainHost))try{n.host=B.toASCII(n.host.replace(t.PCT_ENCODED,d).toLowerCase())}catch(i){n.error=n.error||"Host's domain name can not be converted to ASCII via punycode: "+i}l(n,F)}a&&a.parse&&a.parse(n,r)}else n.error=n.error||"URI can not be parsed.";return n}function C(e,r){var n=!1!==r.iri?R:F,t=[];return e.userinfo!==undefined&&(t.push(e.userinfo),t.push("@")),e.host!==undefined&&t.push(v(g(String(e.host),n),n).replace(n.IPV6ADDRESS,function(e,r,n){return"["+r+(n?"%25"+n:"")+"]"})),"number"!=typeof e.port&&"string"!=typeof e.port||(t.push(":"),t.push(String(e.port))),t.length?t.join(""):undefined}function y(e){for(var r=[];e.length;)if(e.match(X))e=e.replace(X,"");else if(e.match(ee))e=e.replace(ee,"/");else if(e.match(re))e=e.replace(re,"/"),r.pop();else if("."===e||".."===e)e="";else{var n=e.match(ne);if(!n)throw new Error("Unexpected dot segment condition");var t=n[0];e=e.slice(t.length),r.push(t)}return r.join("")}function S(e){var r=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{},n=r.iri?R:F,t=[],o=J[(r.scheme||e.scheme||"").toLowerCase()];if(o&&o.serialize&&o.serialize(e,r),e.host)if(n.IPV6ADDRESS.test(e.host));else if(r.domainHost||o&&o.domainHost)try{e.host=r.iri?B.toUnicode(e.host):B.toASCII(e.host.replace(n.PCT_ENCODED,d).toLowerCase())}catch(u){e.error=e.error||"Host's domain name can not be converted to "+(r.iri?"Unicode":"ASCII")+" via punycode: "+u}l(e,n),"suffix"!==r.reference&&e.scheme&&(t.push(e.scheme),t.push(":"));var a=C(e,r);if(a!==undefined&&("suffix"!==r.reference&&t.push("//"),t.push(a),e.path&&"/"!==e.path.charAt(0)&&t.push("/")),e.path!==undefined){var i=e.path;r.absolutePath||o&&o.absolutePath||(i=y(i)),a===undefined&&(i=i.replace(/^\/\//,"/%2F")),t.push(i)}return e.query!==undefined&&(t.push("?"),t.push(e.query)),e.fragment!==undefined&&(t.push("#"),t.push(e.fragment)),t.join("")}function A(e,r){var n=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{},t=arguments[3],o={};return t||(e=E(S(e,n),n),r=E(S(r,n),n)),n=n||{},!n.tolerant&&r.scheme?(o.scheme=r.scheme,o.userinfo=r.userinfo,o.host=r.host,o.port=r.port,o.path=y(r.path||""),o.query=r.query):(r.userinfo!==undefined||r.host!==undefined||r.port!==undefined?(o.userinfo=r.userinfo,o.host=r.host,o.port=r.port,o.path=y(r.path||""),o.query=r.query):(r.path?("/"===r.path.charAt(0)?o.path=y(r.path):(e.userinfo===undefined&&e.host===undefined&&e.port===undefined||e.path?e.path?o.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+r.path:o.path=r.path:o.path="/"+r.path,o.path=y(o.path)),o.query=r.query):(o.path=e.path,r.query!==undefined?o.query=r.query:o.query=e.query),o.userinfo=e.userinfo,o.host=e.host,o.port=e.port),o.scheme=e.scheme),o.fragment=r.fragment,o}function D(e,r,n){var t=i({scheme:"null"},n);return S(A(E(e,t),E(r,t),t,!0),t)}function w(e,r){return"string"==typeof e?e=S(E(e,r),r):"object"===t(e)&&(e=E(S(e,r),r)),e}function b(e,r,n){return"string"==typeof e?e=S(E(e,n),n):"object"===t(e)&&(e=S(e,n)),"string"==typeof r?r=S(E(r,n),n):"object"===t(r)&&(r=S(r,n)),e===r}function x(e,r){return e&&e.toString().replace(r&&r.iri?R.ESCAPE:F.ESCAPE,h)}function O(e,r){return e&&e.toString().replace(r&&r.iri?R.PCT_ENCODED:F.PCT_ENCODED,d)}function N(e){return"boolean"==typeof e.secure?e.secure:"wss"===String(e.scheme).toLowerCase()}function I(e){var r=d(e);return r.match(he)?r:e}var F=u(!1),R=u(!0),T=function(){function e(e,r){var n=[],t=!0,o=!1,a=undefined;try{for(var i,u=e[Symbol.iterator]();!(t=(i=u.next()).done)&&(n.push(i.value),!r||n.length!==r);t=!0);}catch(s){o=!0,a=s}finally{try{!t&&u["return"]&&u["return"]()}finally{if(o)throw a}}return n}return function(r,n){if(Array.isArray(r))return r;if(Symbol.iterator in Object(r))return e(r,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),_=function(e){if(Array.isArray(e)){for(var r=0,n=Array(e.length);r<e.length;r++)n[r]=e[r];return n}return Array.from(e)},P=2147483647,q=/^xn--/,U=/[^\0-\x7E]/,j=/[\x2E\u3002\uFF0E\uFF61]/g,H={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},z=Math.floor,L=String.fromCharCode,$=function(e){return String.fromCodePoint.apply(String,_(e))},M=function(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:36},V=function(e,r){return e+22+75*(e<26)-((0!=r)<<5)},k=function(e,r,n){var t=0;for(e=n?z(e/700):e>>1,e+=z(e/r);e>455;t+=36)e=z(e/35);return z(t+36*e/(e+38))},Z=function(e){var r=[],n=e.length,t=0,o=128,a=72,i=e.lastIndexOf("-");i<0&&(i=0);for(var u=0;u<i;++u)e.charCodeAt(u)>=128&&s("not-basic"),r.push(e.charCodeAt(u));for(var f=i>0?i+1:0;f<n;){for(var c=t,p=1,h=36;;h+=36){f>=n&&s("invalid-input");var d=M(e.charCodeAt(f++));(d>=36||d>z((P-t)/p))&&s("overflow"),t+=d*p;var l=h<=a?1:h>=a+26?26:h-a;if(d<l)break;var m=36-l;p>z(P/m)&&s("overflow"),p*=m}var g=r.length+1;a=k(t-c,g,0==c),z(t/g)>P-o&&s("overflow"),o+=z(t/g),t%=g,r.splice(t++,0,o)}return String.fromCodePoint.apply(String,r)},G=function(e){var r=[];e=p(e);var n=e.length,t=128,o=0,a=72,i=!0,u=!1,f=undefined;try{for(var c,h=e[Symbol.iterator]();!(i=(c=h.next()).done);i=!0){var d=c.value;d<128&&r.push(L(d))}}catch(U){u=!0,f=U}finally{try{!i&&h["return"]&&h["return"]()}finally{if(u)throw f}}var l=r.length,m=l;for(l&&r.push("-");m<n;){var g=P,v=!0,E=!1,C=undefined;try{for(var y,S=e[Symbol.iterator]();!(v=(y=S.next()).done);v=!0){var A=y.value;A>=t&&A<g&&(g=A)}}catch(U){E=!0,C=U}finally{try{!v&&S["return"]&&S["return"]()}finally{if(E)throw C}}var D=m+1;g-t>z((P-o)/D)&&s("overflow"),o+=(g-t)*D,t=g;var w=!0,b=!1,x=undefined;try{for(var O,N=e[Symbol.iterator]();!(w=(O=N.next()).done);w=!0){var I=O.value;if(I<t&&++o>P&&s("overflow"),I==t){for(var F=o,R=36;;R+=36){var T=R<=a?1:R>=a+26?26:R-a;if(F<T)break;var _=F-T,q=36-T;r.push(L(V(T+_%q,0))),F=z(_/q)}r.push(L(V(F,0))),a=k(o,D,m==l),o=0,++m}}}catch(U){b=!0,x=U}finally{try{!w&&N["return"]&&N["return"]()}finally{if(b)throw x}}++o,++t}return r.join("")},Q=function(e){return c(e,function(e){return q.test(e)?Z(e.slice(4).toLowerCase()):e})},Y=function(e){return c(e,function(e){return U.test(e)?"xn--"+G(e):e})},B={version:"2.1.0",ucs2:{decode:p,encode:$},decode:Z,encode:G,toASCII:Y,toUnicode:Q},J={},K=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,W="".match(/(){0}/)[1]===undefined,X=/^\.\.?\//,ee=/^\/\.(\/|$)/,re=/^\/\.\.(\/|$)/,ne=/^\/?(?:.|\n)*?(?=\/|$)/,te={scheme:"http",domainHost:!0,parse:function(e,r){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e},serialize:function(e,r){var n="https"===String(e.scheme).toLowerCase();return e.port!==(n?443:80)&&""!==e.port||(e.port=undefined),e.path||(e.path="/"),e}},oe={scheme:"https",domainHost:te.domainHost,parse:te.parse,serialize:te.serialize},ae={scheme:"ws",domainHost:!0,parse:function(e,r){var n=e;return n.secure=N(n),n.resourceName=(n.path||"/")+(n.query?"?"+n.query:""),n.path=undefined,n.query=undefined,n},serialize:function(e,r){if(e.port!==(N(e)?443:80)&&""!==e.port||(e.port=undefined),"boolean"==typeof e.secure&&(e.scheme=e.secure?"wss":"ws",e.secure=undefined),e.resourceName){var n=e.resourceName.split("?"),t=T(n,2),o=t[0],a=t[1];e.path=o&&"/"!==o?o:undefined,e.query=a,e.resourceName=undefined}return e.fragment=undefined,e}},ie={scheme:"wss",domainHost:ae.domainHost,parse:ae.parse,serialize:ae.serialize},ue={},se="[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]",fe="[0-9A-Fa-f]",ce=n(n("%[EFef][0-9A-Fa-f]%"+fe+fe+"%"+fe+fe)+"|"+n("%[89A-Fa-f][0-9A-Fa-f]%"+fe+fe)+"|"+n("%"+fe+fe)),pe=r("[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",'[\\"\\\\]'),he=new RegExp(se,"g"),de=new RegExp(ce,"g"),le=new RegExp(r("[^]","[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]","[\\.]",'[\\"]',pe),"g"),me=new RegExp(r("[^]",se,"[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]"),"g"),ge=me,ve={scheme:"mailto",parse:function(e,r){var n=e,t=n.to=n.path?n.path.split(","):[];if(n.path=undefined,n.query){for(var o=!1,a={},i=n.query.split("&"),u=0,s=i.length;u<s;++u){var f=i[u].split("=");switch(f[0]){case"to":for(var c=f[1].split(","),p=0,h=c.length;p<h;++p)t.push(c[p]);break;case"subject":n.subject=O(f[1],r);break;case"body":n.body=O(f[1],r);break;default:o=!0,a[O(f[0],r)]=O(f[1],r)}}o&&(n.headers=a)}n.query=undefined;for(var d=0,l=t.length;d<l;++d){var m=t[d].split("@");if(m[0]=O(m[0]),r.unicodeSupport)m[1]=O(m[1],r).toLowerCase();else try{m[1]=B.toASCII(O(m[1],r).toLowerCase())}catch(g){n.error=n.error||"Email address's domain name can not be converted to ASCII via punycode: "+g}t[d]=m.join("@")}return n},serialize:function(e,r){var n=e,t=a(e.to);if(t){for(var i=0,u=t.length;i<u;++i){var s=String(t[i]),f=s.lastIndexOf("@"),c=s.slice(0,f).replace(de,I).replace(de,o).replace(le,h),p=s.slice(f+1);try{p=r.iri?B.toUnicode(p):B.toASCII(O(p,r).toLowerCase())}catch(g){n.error=n.error||"Email address's domain name can not be converted to "+(r.iri?"Unicode":"ASCII")+" via punycode: "+g}t[i]=c+"@"+p}n.path=t.join(",")}var d=e.headers=e.headers||{};e.subject&&(d.subject=e.subject),e.body&&(d.body=e.body);var l=[];for(var m in d)d[m]!==ue[m]&&l.push(m.replace(de,I).replace(de,o).replace(me,h)+"="+d[m].replace(de,I).replace(de,o).replace(ge,h));return l.length&&(n.query=l.join("&")),n}},Ee=/^([^\:]+)\:(.*)/,Ce={scheme:"urn",parse:function(e,r){var n=e.path&&e.path.match(Ee),t=e;if(n){var o=r.scheme||t.scheme||"urn",a=n[1].toLowerCase(),i=n[2],u=o+":"+(r.nid||a),s=J[u];t.nid=a,t.nss=i,t.path=undefined,s&&(t=s.parse(t,r))}else t.error=t.error||"URN can not be parsed.";return t},serialize:function(e,r){var n=r.scheme||e.scheme||"urn",t=e.nid,o=n+":"+(r.nid||t),a=J[o];a&&(e=a.serialize(e,r));var i=e,u=e.nss;return i.path=(t||r.nid)+":"+u,i}},ye=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,Se={scheme:"urn:uuid",parse:function(e,r){var n=e;return n.uuid=n.nss,n.nss=undefined,r.tolerant||n.uuid&&n.uuid.match(ye)||(n.error=n.error||"UUID is not valid."),n},serialize:function(e,r){var n=e;return n.nss=(e.uuid||"").toLowerCase(),n}};J[te.scheme]=te,J[oe.scheme]=oe,J[ae.scheme]=ae,J[ie.scheme]=ie,J[ve.scheme]=ve,J[Ce.scheme]=Ce,J[Se.scheme]=Se,e.SCHEMES=J,e.pctEncChar=h,e.pctDecChars=d,e.parse=E,e.removeDotSegments=y,e.serialize=S,e.resolveComponents=A,e.resolve=D,e.normalize=w,e.equal=b,e.escapeComponent=x,e.unescapeComponent=O,Object.defineProperty(e,"__esModule",{value:!0})}); //# sourceMappingURL=uri.all.min.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/uri-js/package.json b/tools/node_modules/eslint/node_modules/uri-js/package.json index 5d55c3598416c5..b97f667a234ea6 100755 --- a/tools/node_modules/eslint/node_modules/uri-js/package.json +++ b/tools/node_modules/eslint/node_modules/uri-js/package.json @@ -16,7 +16,7 @@ "babel-cli": "^6.26.0", "babel-plugin-external-helpers": "^6.22.0", "babel-preset-latest": "^6.24.1", - "mocha": "^3.2.0", + "mocha": "^8.2.1", "mocha-qunit-ui": "^0.1.3", "rollup": "^0.41.6", "rollup-plugin-babel": "^2.7.1", @@ -78,5 +78,5 @@ "test": "mocha -u mocha-qunit-ui dist/es5/uri.all.js tests/tests.js" }, "types": "dist/es5/uri.all.d.ts", - "version": "4.4.0" + "version": "4.4.1" } \ No newline at end of file diff --git a/tools/node_modules/eslint/package.json b/tools/node_modules/eslint/package.json index 707c2d7e12fa64..dda9992ee81177 100644 --- a/tools/node_modules/eslint/package.json +++ b/tools/node_modules/eslint/package.json @@ -12,7 +12,7 @@ "bundleDependencies": false, "dependencies": { "@babel/code-frame": "^7.0.0", - "@eslint/eslintrc": "^0.2.2", + "@eslint/eslintrc": "^0.3.0", "ajv": "^6.10.0", "chalk": "^4.0.0", "cross-spawn": "^7.0.2", @@ -37,7 +37,7 @@ "js-yaml": "^3.13.1", "json-stable-stringify-without-jsonify": "^1.0.1", "levn": "^0.4.1", - "lodash": "^4.17.19", + "lodash": "^4.17.20", "minimatch": "^3.0.4", "natural-compare": "^1.4.0", "optionator": "^0.9.1", @@ -154,5 +154,5 @@ "test:cli": "mocha", "webpack": "node Makefile.js webpack" }, - "version": "7.16.0" + "version": "7.18.0" } \ No newline at end of file diff --git a/tools/update-babel-eslint.sh b/tools/update-babel-eslint.sh index d6de6d25e1d212..b64b8f25d32f7c 100755 --- a/tools/update-babel-eslint.sh +++ b/tools/update-babel-eslint.sh @@ -13,7 +13,7 @@ mkdir babel-eslint-tmp cd babel-eslint-tmp || exit npm init --yes -npm install --global-style --no-bin-links --production --no-package-lock @babel/core @babel/eslint-parser@latest @babel/plugin-syntax-class-properties@latest +npm install --global-style --no-bin-links --production --no-package-lock @babel/core @babel/eslint-parser@latest @babel/plugin-syntax-class-properties@latest @babel/plugin-syntax-top-level-await@latest # Use dmn to remove some unneeded files. npx dmn@2.2.2 -f clean