This commit is contained in:
2025-06-26 03:35:15 +00:00
parent 56fa52fd80
commit 59f287112f
2193 changed files with 289518 additions and 3540 deletions

View File

@@ -0,0 +1,113 @@
'use strict';
var inspect = require('object-inspect');
var $TypeError = require('es-errors/type');
/*
* This function traverses the list returning the node corresponding to the given key.
*
* That node is also moved to the head of the list, so that if it's accessed again we don't need to traverse the whole list.
* By doing so, all the recently used nodes can be accessed relatively quickly.
*/
/** @type {import('./list.d.ts').listGetNode} */
// eslint-disable-next-line consistent-return
var listGetNode = function (list, key, isDelete) {
/** @type {typeof list | NonNullable<(typeof list)['next']>} */
var prev = list;
/** @type {(typeof list)['next']} */
var curr;
// eslint-disable-next-line eqeqeq
for (; (curr = prev.next) != null; prev = curr) {
if (curr.key === key) {
prev.next = curr.next;
if (!isDelete) {
// eslint-disable-next-line no-extra-parens
curr.next = /** @type {NonNullable<typeof list.next>} */ (list.next);
list.next = curr; // eslint-disable-line no-param-reassign
}
return curr;
}
}
};
/** @type {import('./list.d.ts').listGet} */
var listGet = function (objects, key) {
if (!objects) {
return void undefined;
}
var node = listGetNode(objects, key);
return node && node.value;
};
/** @type {import('./list.d.ts').listSet} */
var listSet = function (objects, key, value) {
var node = listGetNode(objects, key);
if (node) {
node.value = value;
} else {
// Prepend the new node to the beginning of the list
objects.next = /** @type {import('./list.d.ts').ListNode<typeof value, typeof key>} */ ({ // eslint-disable-line no-param-reassign, no-extra-parens
key: key,
next: objects.next,
value: value
});
}
};
/** @type {import('./list.d.ts').listHas} */
var listHas = function (objects, key) {
if (!objects) {
return false;
}
return !!listGetNode(objects, key);
};
/** @type {import('./list.d.ts').listDelete} */
// eslint-disable-next-line consistent-return
var listDelete = function (objects, key) {
if (objects) {
return listGetNode(objects, key, true);
}
};
/** @type {import('.')} */
module.exports = function getSideChannelList() {
/** @typedef {ReturnType<typeof getSideChannelList>} Channel */
/** @typedef {Parameters<Channel['get']>[0]} K */
/** @typedef {Parameters<Channel['set']>[1]} V */
/** @type {import('./list.d.ts').RootNode<V, K> | undefined} */ var $o;
/** @type {Channel} */
var channel = {
assert: function (key) {
if (!channel.has(key)) {
throw new $TypeError('Side channel does not contain ' + inspect(key));
}
},
'delete': function (key) {
var root = $o && $o.next;
var deletedNode = listDelete($o, key);
if (deletedNode && root && root === deletedNode) {
$o = void undefined;
}
return !!deletedNode;
},
get: function (key) {
return listGet($o, key);
},
has: function (key) {
return listHas($o, key);
},
set: function (key, value) {
if (!$o) {
// Initialize the linked list as an empty node, so that we don't have to special-case handling of the first node: we can always refer to it as (previous node).next, instead of something like (list).head
$o = {
next: void undefined
};
}
// eslint-disable-next-line no-extra-parens
listSet(/** @type {NonNullable<typeof $o>} */ ($o), key, value);
}
};
// @ts-expect-error TODO: figure out why this is erroring
return channel;
};

View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2012-2019 Paul Miller (https://paulmillr.com), Elan Shanker
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.

View File

@@ -0,0 +1,4 @@
'use strict';
/** @type {import('./range')} */
module.exports = RangeError;

View File

@@ -0,0 +1,10 @@
1 (npm) S 0 1 1 34816 1 4210944 11112 0 0 0 45 8 0 0 20 0 10 0 330296 1089871872 11809 18446744073709551615 4194304 29343848 140726436642896 0 0 0 0 4096 2072112895 0 0 0 17 0 0 0 0 0 0 31441000 31537208 37314560 140726436650815 140726436650847 140726436650847 140726436650986 0
15 (sh) S 1 1 1 34816 1 4210688 115 0 0 0 0 0 0 0 20 0 1 0 330372 4399104 187 18446744073709551615 94374393548800 94374393655428 140722913272992 0 0 0 0 0 65538 0 0 0 17 0 0 0 0 0 0 94374395756424 94374395761184 94374404673536 140722913278928 140722913278959 140722913278959 140722913284080 0
16 (node) S 15 1 1 34816 1 4210688 6930 103 0 0 32 2 0 0 20 0 10 0 330373 1068478464 8412 18446744073709551615 4194304 29343848 140727228046064 0 0 0 0 4096 134300162 0 0 0 17 1 0 0 1 0 0 31441000 31537208 52584448 140727228050313 140727228050383 140727228050383 140727228055530 0
27 (sh) S 16 1 1 34816 1 4210688 111 0 0 0 0 0 0 0 20 0 1 0 330410 4399104 193 18446744073709551615 94848235986944 94848236093572 140727019991184 0 0 0 0 0 65538 0 0 0 17 1 0 0 0 0 0 94848238194568 94848238199328 94848261660672 140727019998122 140727019998165 140727019998165 140727020003312 0
28 (node) S 27 1 1 34816 1 4210688 3576 268 0 0 12 2 0 0 20 0 10 0 330411 930213888 6760 18446744073709551615 4194304 29343848 140726559664992 0 0 0 0 4096 134300162 0 0 0 17 1 0 0 0 0 0 31441000 31537208 32591872 140726559669117 140726559669199 140726559669199 140726559674346 0
39 (node) S 28 1 1 34816 1 4210688 47517 0 0 0 151 9 0 0 20 0 6 0 330427 985739264 31859 18446744073709551615 4194304 29343848 140737324503920 0 0 0 0 4096 134234626 0 0 0 17 0 0 0 0 0 0 31441000 31537208 51585024 140737324510060 140737324510159 140737324510159 140737324515306 0
45 (bash) S 0 45 45 34817 50 4210944 752 256 0 0 2 0 0 0 20 0 1 0 331039 18628608 789 18446744073709551615 4194304 5242124 140724425887696 0 0 0 65536 3670020 1266777851 0 0 0 17 1 0 0 0 0 0 7341384 7388228 30310400 140724425891678 140724425891683 140724425891683 140724425891822 0
cat: /proc/50/stat: No such file or directory
cat: /proc/51/stat: No such file or directory
52 (xargs) S 45 50 45 34817 50 4210688 179 661 0 0 0 0 0 0 20 0 1 0 331544 4608000 346 18446744073709551615 94587588550656 94587588614028 140735223856048 0 0 0 0 0 2560 0 0 0 17 1 0 0 0 0 0 94587590711464 94587590713504 94587603169280 140735223861006 140735223861035 140735223861035 140735223861225 0

View File

@@ -0,0 +1,72 @@
"use strict";
var Buffer = require("safer-buffer").Buffer;
// Single-byte codec. Needs a 'chars' string parameter that contains 256 or 128 chars that
// correspond to encoded bytes (if 128 - then lower half is ASCII).
exports._sbcs = SBCSCodec;
function SBCSCodec(codecOptions, iconv) {
if (!codecOptions)
throw new Error("SBCS codec is called without the data.")
// Prepare char buffer for decoding.
if (!codecOptions.chars || (codecOptions.chars.length !== 128 && codecOptions.chars.length !== 256))
throw new Error("Encoding '"+codecOptions.type+"' has incorrect 'chars' (must be of len 128 or 256)");
if (codecOptions.chars.length === 128) {
var asciiString = "";
for (var i = 0; i < 128; i++)
asciiString += String.fromCharCode(i);
codecOptions.chars = asciiString + codecOptions.chars;
}
this.decodeBuf = Buffer.from(codecOptions.chars, 'ucs2');
// Encoding buffer.
var encodeBuf = Buffer.alloc(65536, iconv.defaultCharSingleByte.charCodeAt(0));
for (var i = 0; i < codecOptions.chars.length; i++)
encodeBuf[codecOptions.chars.charCodeAt(i)] = i;
this.encodeBuf = encodeBuf;
}
SBCSCodec.prototype.encoder = SBCSEncoder;
SBCSCodec.prototype.decoder = SBCSDecoder;
function SBCSEncoder(options, codec) {
this.encodeBuf = codec.encodeBuf;
}
SBCSEncoder.prototype.write = function(str) {
var buf = Buffer.alloc(str.length);
for (var i = 0; i < str.length; i++)
buf[i] = this.encodeBuf[str.charCodeAt(i)];
return buf;
}
SBCSEncoder.prototype.end = function() {
}
function SBCSDecoder(options, codec) {
this.decodeBuf = codec.decodeBuf;
}
SBCSDecoder.prototype.write = function(buf) {
// Strings are immutable in JS -> we use ucs2 buffer to speed up computations.
var decodeBuf = this.decodeBuf;
var newBuf = Buffer.alloc(buf.length*2);
var idx1 = 0, idx2 = 0;
for (var i = 0; i < buf.length; i++) {
idx1 = buf[i]*2; idx2 = i*2;
newBuf[idx2] = decodeBuf[idx1];
newBuf[idx2+1] = decodeBuf[idx1+1];
}
return newBuf.toString('ucs2');
}
SBCSDecoder.prototype.end = function() {
}

View File

@@ -0,0 +1,12 @@
/*!
* mime-db
* Copyright(c) 2014 Jonathan Ong
* Copyright(c) 2015-2022 Douglas Christopher Wilson
* MIT Licensed
*/
/**
* Module exports.
*/
module.exports = require('./db.json')

View File

@@ -0,0 +1,541 @@
1.54.0 / 2025-03-17
===================
* Update mime type for DCM format (#362)
* mark application/octet-stream as compressible (#163)
* Fix typo in application/x-zip-compressed mimetype (#359)
* Add mime-type for Jupyter notebooks (#282)
* Add Google Drive MIME types (#311)
* Add .blend file type (#338)
* Add support for the FBX file extension (#342)
* Add Adobe DNG file (#340)
* Add Procreate Brush and Brush Set file Types (#339)
* Add support for Procreate Dreams (#341)
* replace got with undici (#352)
* Added extensions list for model/step (#293)
* Add m4b as a type of audio/mp4 (#357)
* windows 11 application/x-zip-compressed (#346)
* add dotLottie mime type (#351)
* Add some MS-related extensions and types (#336)
1.53.0 / 2024-07-12
===================
* Add extension `.sql` to `application/sql`
* Add extensions `.aac` and `.adts` to `audio/aac`
* Add extensions `.js` and `.mjs` to `text/javascript`
* Add extensions for `application/mp4` from IANA
* Add extensions from IANA for more MIME types
* Add Microsoft app installer types and extensions
* Add new upstream MIME types
* Fix extensions for `text/markdown` to match IANA
* Remove extension `.mjs` from `application/javascript`
* Remove obsolete MIME types from IANA data
1.52.0 / 2022-02-21
===================
* Add extensions from IANA for more `image/*` types
* Add extension `.asc` to `application/pgp-keys`
* Add extensions to various XML types
* Add new upstream MIME types
1.51.0 / 2021-11-08
===================
* Add new upstream MIME types
* Mark `image/vnd.microsoft.icon` as compressible
* Mark `image/vnd.ms-dds` as compressible
1.50.0 / 2021-09-15
===================
* Add deprecated iWorks mime types and extensions
* Add new upstream MIME types
1.49.0 / 2021-07-26
===================
* Add extension `.trig` to `application/trig`
* Add new upstream MIME types
1.48.0 / 2021-05-30
===================
* Add extension `.mvt` to `application/vnd.mapbox-vector-tile`
* Add new upstream MIME types
* Mark `text/yaml` as compressible
1.47.0 / 2021-04-01
===================
* Add new upstream MIME types
* Remove ambiguous extensions from IANA for `application/*+xml` types
* Update primary extension to `.es` for `application/ecmascript`
1.46.0 / 2021-02-13
===================
* Add extension `.amr` to `audio/amr`
* Add extension `.m4s` to `video/iso.segment`
* Add extension `.opus` to `audio/ogg`
* Add new upstream MIME types
1.45.0 / 2020-09-22
===================
* Add `application/ubjson` with extension `.ubj`
* Add `image/avif` with extension `.avif`
* Add `image/ktx2` with extension `.ktx2`
* Add extension `.dbf` to `application/vnd.dbf`
* Add extension `.rar` to `application/vnd.rar`
* Add extension `.td` to `application/urc-targetdesc+xml`
* Add new upstream MIME types
* Fix extension of `application/vnd.apple.keynote` to be `.key`
1.44.0 / 2020-04-22
===================
* Add charsets from IANA
* Add extension `.cjs` to `application/node`
* Add new upstream MIME types
1.43.0 / 2020-01-05
===================
* Add `application/x-keepass2` with extension `.kdbx`
* Add extension `.mxmf` to `audio/mobile-xmf`
* Add extensions from IANA for `application/*+xml` types
* Add new upstream MIME types
1.42.0 / 2019-09-25
===================
* Add `image/vnd.ms-dds` with extension `.dds`
* Add new upstream MIME types
* Remove compressible from `multipart/mixed`
1.41.0 / 2019-08-30
===================
* Add new upstream MIME types
* Add `application/toml` with extension `.toml`
* Mark `font/ttf` as compressible
1.40.0 / 2019-04-20
===================
* Add extensions from IANA for `model/*` types
* Add `text/mdx` with extension `.mdx`
1.39.0 / 2019-04-04
===================
* Add extensions `.siv` and `.sieve` to `application/sieve`
* Add new upstream MIME types
1.38.0 / 2019-02-04
===================
* Add extension `.nq` to `application/n-quads`
* Add extension `.nt` to `application/n-triples`
* Add new upstream MIME types
* Mark `text/less` as compressible
1.37.0 / 2018-10-19
===================
* Add extensions to HEIC image types
* Add new upstream MIME types
1.36.0 / 2018-08-20
===================
* Add Apple file extensions from IANA
* Add extensions from IANA for `image/*` types
* Add new upstream MIME types
1.35.0 / 2018-07-15
===================
* Add extension `.owl` to `application/rdf+xml`
* Add new upstream MIME types
- Removes extension `.woff` from `application/font-woff`
1.34.0 / 2018-06-03
===================
* Add extension `.csl` to `application/vnd.citationstyles.style+xml`
* Add extension `.es` to `application/ecmascript`
* Add new upstream MIME types
* Add `UTF-8` as default charset for `text/turtle`
* Mark all XML-derived types as compressible
1.33.0 / 2018-02-15
===================
* Add extensions from IANA for `message/*` types
* Add new upstream MIME types
* Fix some incorrect OOXML types
* Remove `application/font-woff2`
1.32.0 / 2017-11-29
===================
* Add new upstream MIME types
* Update `text/hjson` to registered `application/hjson`
* Add `text/shex` with extension `.shex`
1.31.0 / 2017-10-25
===================
* Add `application/raml+yaml` with extension `.raml`
* Add `application/wasm` with extension `.wasm`
* Add new `font` type from IANA
* Add new upstream font extensions
* Add new upstream MIME types
* Add extensions for JPEG-2000 images
1.30.0 / 2017-08-27
===================
* Add `application/vnd.ms-outlook`
* Add `application/x-arj`
* Add extension `.mjs` to `application/javascript`
* Add glTF types and extensions
* Add new upstream MIME types
* Add `text/x-org`
* Add VirtualBox MIME types
* Fix `source` records for `video/*` types that are IANA
* Update `font/opentype` to registered `font/otf`
1.29.0 / 2017-07-10
===================
* Add `application/fido.trusted-apps+json`
* Add extension `.wadl` to `application/vnd.sun.wadl+xml`
* Add new upstream MIME types
* Add `UTF-8` as default charset for `text/css`
1.28.0 / 2017-05-14
===================
* Add new upstream MIME types
* Add extension `.gz` to `application/gzip`
* Update extensions `.md` and `.markdown` to be `text/markdown`
1.27.0 / 2017-03-16
===================
* Add new upstream MIME types
* Add `image/apng` with extension `.apng`
1.26.0 / 2017-01-14
===================
* Add new upstream MIME types
* Add extension `.geojson` to `application/geo+json`
1.25.0 / 2016-11-11
===================
* Add new upstream MIME types
1.24.0 / 2016-09-18
===================
* Add `audio/mp3`
* Add new upstream MIME types
1.23.0 / 2016-05-01
===================
* Add new upstream MIME types
* Add extension `.3gpp` to `audio/3gpp`
1.22.0 / 2016-02-15
===================
* Add `text/slim`
* Add extension `.rng` to `application/xml`
* Add new upstream MIME types
* Fix extension of `application/dash+xml` to be `.mpd`
* Update primary extension to `.m4a` for `audio/mp4`
1.21.0 / 2016-01-06
===================
* Add Google document types
* Add new upstream MIME types
1.20.0 / 2015-11-10
===================
* Add `text/x-suse-ymp`
* Add new upstream MIME types
1.19.0 / 2015-09-17
===================
* Add `application/vnd.apple.pkpass`
* Add new upstream MIME types
1.18.0 / 2015-09-03
===================
* Add new upstream MIME types
1.17.0 / 2015-08-13
===================
* Add `application/x-msdos-program`
* Add `audio/g711-0`
* Add `image/vnd.mozilla.apng`
* Add extension `.exe` to `application/x-msdos-program`
1.16.0 / 2015-07-29
===================
* Add `application/vnd.uri-map`
1.15.0 / 2015-07-13
===================
* Add `application/x-httpd-php`
1.14.0 / 2015-06-25
===================
* Add `application/scim+json`
* Add `application/vnd.3gpp.ussd+xml`
* Add `application/vnd.biopax.rdf+xml`
* Add `text/x-processing`
1.13.0 / 2015-06-07
===================
* Add nginx as a source
* Add `application/x-cocoa`
* Add `application/x-java-archive-diff`
* Add `application/x-makeself`
* Add `application/x-perl`
* Add `application/x-pilot`
* Add `application/x-redhat-package-manager`
* Add `application/x-sea`
* Add `audio/x-m4a`
* Add `audio/x-realaudio`
* Add `image/x-jng`
* Add `text/mathml`
1.12.0 / 2015-06-05
===================
* Add `application/bdoc`
* Add `application/vnd.hyperdrive+json`
* Add `application/x-bdoc`
* Add extension `.rtf` to `text/rtf`
1.11.0 / 2015-05-31
===================
* Add `audio/wav`
* Add `audio/wave`
* Add extension `.litcoffee` to `text/coffeescript`
* Add extension `.sfd-hdstx` to `application/vnd.hydrostatix.sof-data`
* Add extension `.n-gage` to `application/vnd.nokia.n-gage.symbian.install`
1.10.0 / 2015-05-19
===================
* Add `application/vnd.balsamiq.bmpr`
* Add `application/vnd.microsoft.portable-executable`
* Add `application/x-ns-proxy-autoconfig`
1.9.1 / 2015-04-19
==================
* Remove `.json` extension from `application/manifest+json`
- This is causing bugs downstream
1.9.0 / 2015-04-19
==================
* Add `application/manifest+json`
* Add `application/vnd.micro+json`
* Add `image/vnd.zbrush.pcx`
* Add `image/x-ms-bmp`
1.8.0 / 2015-03-13
==================
* Add `application/vnd.citationstyles.style+xml`
* Add `application/vnd.fastcopy-disk-image`
* Add `application/vnd.gov.sk.xmldatacontainer+xml`
* Add extension `.jsonld` to `application/ld+json`
1.7.0 / 2015-02-08
==================
* Add `application/vnd.gerber`
* Add `application/vnd.msa-disk-image`
1.6.1 / 2015-02-05
==================
* Community extensions ownership transferred from `node-mime`
1.6.0 / 2015-01-29
==================
* Add `application/jose`
* Add `application/jose+json`
* Add `application/json-seq`
* Add `application/jwk+json`
* Add `application/jwk-set+json`
* Add `application/jwt`
* Add `application/rdap+json`
* Add `application/vnd.gov.sk.e-form+xml`
* Add `application/vnd.ims.imsccv1p3`
1.5.0 / 2014-12-30
==================
* Add `application/vnd.oracle.resource+json`
* Fix various invalid MIME type entries
- `application/mbox+xml`
- `application/oscp-response`
- `application/vwg-multiplexed`
- `audio/g721`
1.4.0 / 2014-12-21
==================
* Add `application/vnd.ims.imsccv1p2`
* Fix various invalid MIME type entries
- `application/vnd-acucobol`
- `application/vnd-curl`
- `application/vnd-dart`
- `application/vnd-dxr`
- `application/vnd-fdf`
- `application/vnd-mif`
- `application/vnd-sema`
- `application/vnd-wap-wmlc`
- `application/vnd.adobe.flash-movie`
- `application/vnd.dece-zip`
- `application/vnd.dvb_service`
- `application/vnd.micrografx-igx`
- `application/vnd.sealed-doc`
- `application/vnd.sealed-eml`
- `application/vnd.sealed-mht`
- `application/vnd.sealed-ppt`
- `application/vnd.sealed-tiff`
- `application/vnd.sealed-xls`
- `application/vnd.sealedmedia.softseal-html`
- `application/vnd.sealedmedia.softseal-pdf`
- `application/vnd.wap-slc`
- `application/vnd.wap-wbxml`
- `audio/vnd.sealedmedia.softseal-mpeg`
- `image/vnd-djvu`
- `image/vnd-svf`
- `image/vnd-wap-wbmp`
- `image/vnd.sealed-png`
- `image/vnd.sealedmedia.softseal-gif`
- `image/vnd.sealedmedia.softseal-jpg`
- `model/vnd-dwf`
- `model/vnd.parasolid.transmit-binary`
- `model/vnd.parasolid.transmit-text`
- `text/vnd-a`
- `text/vnd-curl`
- `text/vnd.wap-wml`
* Remove example template MIME types
- `application/example`
- `audio/example`
- `image/example`
- `message/example`
- `model/example`
- `multipart/example`
- `text/example`
- `video/example`
1.3.1 / 2014-12-16
==================
* Fix missing extensions
- `application/json5`
- `text/hjson`
1.3.0 / 2014-12-07
==================
* Add `application/a2l`
* Add `application/aml`
* Add `application/atfx`
* Add `application/atxml`
* Add `application/cdfx+xml`
* Add `application/dii`
* Add `application/json5`
* Add `application/lxf`
* Add `application/mf4`
* Add `application/vnd.apache.thrift.compact`
* Add `application/vnd.apache.thrift.json`
* Add `application/vnd.coffeescript`
* Add `application/vnd.enphase.envoy`
* Add `application/vnd.ims.imsccv1p1`
* Add `text/csv-schema`
* Add `text/hjson`
* Add `text/markdown`
* Add `text/yaml`
1.2.0 / 2014-11-09
==================
* Add `application/cea`
* Add `application/dit`
* Add `application/vnd.gov.sk.e-form+zip`
* Add `application/vnd.tmd.mediaflex.api+xml`
* Type `application/epub+zip` is now IANA-registered
1.1.2 / 2014-10-23
==================
* Rebuild database for `application/x-www-form-urlencoded` change
1.1.1 / 2014-10-20
==================
* Mark `application/x-www-form-urlencoded` as compressible.
1.1.0 / 2014-09-28
==================
* Add `application/font-woff2`
1.0.3 / 2014-09-25
==================
* Fix engine requirement in package
1.0.2 / 2014-09-25
==================
* Add `application/coap-group+json`
* Add `application/dcd`
* Add `application/vnd.apache.thrift.binary`
* Add `image/vnd.tencent.tap`
* Mark all JSON-derived types as compressible
* Update `text/vtt` data
1.0.1 / 2014-08-30
==================
* Fix extension ordering
1.0.0 / 2014-08-30
==================
* Add `application/atf`
* Add `application/merge-patch+json`
* Add `multipart/x-mixed-replace`
* Add `source: 'apache'` metadata
* Add `source: 'iana'` metadata
* Remove badly-assumed charset data

View File

@@ -0,0 +1,3 @@
export default function isPromise(obj) {
return !!obj && (typeof obj === 'object' || typeof obj === 'function') && typeof obj.then === 'function';
}

View File

@@ -0,0 +1,3 @@
declare function hasOwn<O, K extends PropertyKey, V = unknown>(o: O, p: K): o is O & Record<K, V>;
export = hasOwn;

View File

@@ -0,0 +1,962 @@
// Copied from `@types/prettier`
// https://github.com/DefinitelyTyped/DefinitelyTyped/blob/5bb07fc4b087cb7ee91084afa6fe750551a7bbb1/types/prettier/index.d.ts
// Minimum TypeScript Version: 4.2
// Add `export {}` here to shut off automatic exporting from index.d.ts. There
// are quite a few utility types here that don't need to be shipped with the
// exported module.
export {};
import { builders, printer, utils } from "./doc.js";
export namespace doc {
export { builders, printer, utils };
}
// This utility is here to handle the case where you have an explicit union
// between string literals and the generic string type. It would normally
// resolve out to just the string type, but this generic LiteralUnion maintains
// the intellisense of the original union.
//
// It comes from this issue: microsoft/TypeScript#29729:
// https://github.com/microsoft/TypeScript/issues/29729#issuecomment-700527227
export type LiteralUnion<T extends U, U = string> =
| T
| (Pick<U, never> & { _?: never | undefined });
export type AST = any;
export type Doc = doc.builders.Doc;
// The type of elements that make up the given array T.
type ArrayElement<T> = T extends Array<infer E> ? E : never;
// A union of the properties of the given object that are arrays.
type ArrayProperties<T> = {
[K in keyof T]: NonNullable<T[K]> extends readonly any[] ? K : never;
}[keyof T];
// A union of the properties of the given array T that can be used to index it.
// If the array is a tuple, then that's going to be the explicit indices of the
// array, otherwise it's going to just be number.
type IndexProperties<T extends { length: number }> =
IsTuple<T> extends true ? Exclude<Partial<T>["length"], T["length"]> : number;
// Effectively performing T[P], except that it's telling TypeScript that it's
// safe to do this for tuples, arrays, or objects.
type IndexValue<T, P> = T extends any[]
? P extends number
? T[P]
: never
: P extends keyof T
? T[P]
: never;
// Determines if an object T is an array like string[] (in which case this
// evaluates to false) or a tuple like [string] (in which case this evaluates to
// true).
// eslint-disable-next-line @typescript-eslint/no-unused-vars
type IsTuple<T> = T extends []
? true
: T extends [infer First, ...infer Remain]
? IsTuple<Remain>
: false;
type CallProperties<T> = T extends any[] ? IndexProperties<T> : keyof T;
type IterProperties<T> = T extends any[]
? IndexProperties<T>
: ArrayProperties<T>;
type CallCallback<T, U> = (path: AstPath<T>, index: number, value: any) => U;
type EachCallback<T> = (
path: AstPath<ArrayElement<T>>,
index: number,
value: any,
) => void;
type MapCallback<T, U> = (
path: AstPath<ArrayElement<T>>,
index: number,
value: any,
) => U;
// https://github.com/prettier/prettier/blob/next/src/common/ast-path.js
export class AstPath<T = any> {
constructor(value: T);
get key(): string | null;
get index(): number | null;
get node(): T;
get parent(): T | null;
get grandparent(): T | null;
get isInArray(): boolean;
get siblings(): T[] | null;
get next(): T | null;
get previous(): T | null;
get isFirst(): boolean;
get isLast(): boolean;
get isRoot(): boolean;
get root(): T;
get ancestors(): T[];
stack: T[];
callParent<U>(callback: (path: this) => U, count?: number): U;
/**
* @deprecated Please use `AstPath#key` or `AstPath#index`
*/
getName(): PropertyKey | null;
/**
* @deprecated Please use `AstPath#node` or `AstPath#siblings`
*/
getValue(): T;
getNode(count?: number): T | null;
getParentNode(count?: number): T | null;
match(
...predicates: Array<
(node: any, name: string | null, number: number | null) => boolean
>
): boolean;
// For each of the tree walk functions (call, each, and map) this provides 5
// strict type signatures, along with a fallback at the end if you end up
// calling more than 5 properties deep. This helps a lot with typing because
// for the majority of cases you're calling fewer than 5 properties, so the
// tree walk functions have a clearer understanding of what you're doing.
//
// Note that resolving these types is somewhat complicated, and it wasn't
// even supported until TypeScript 4.2 (before it would just say that the
// type instantiation was excessively deep and possibly infinite).
call<U>(callback: CallCallback<T, U>): U;
call<U, P1 extends CallProperties<T>>(
callback: CallCallback<IndexValue<T, P1>, U>,
prop1: P1,
): U;
call<U, P1 extends keyof T, P2 extends CallProperties<T[P1]>>(
callback: CallCallback<IndexValue<IndexValue<T, P1>, P2>, U>,
prop1: P1,
prop2: P2,
): U;
call<
U,
P1 extends keyof T,
P2 extends CallProperties<T[P1]>,
P3 extends CallProperties<IndexValue<T[P1], P2>>,
>(
callback: CallCallback<
IndexValue<IndexValue<IndexValue<T, P1>, P2>, P3>,
U
>,
prop1: P1,
prop2: P2,
prop3: P3,
): U;
call<
U,
P1 extends keyof T,
P2 extends CallProperties<T[P1]>,
P3 extends CallProperties<IndexValue<T[P1], P2>>,
P4 extends CallProperties<IndexValue<IndexValue<T[P1], P2>, P3>>,
>(
callback: CallCallback<
IndexValue<IndexValue<IndexValue<IndexValue<T, P1>, P2>, P3>, P4>,
U
>,
prop1: P1,
prop2: P2,
prop3: P3,
prop4: P4,
): U;
call<U, P extends PropertyKey>(
callback: CallCallback<any, U>,
prop1: P,
prop2: P,
prop3: P,
prop4: P,
...props: P[]
): U;
each(callback: EachCallback<T>): void;
each<P1 extends IterProperties<T>>(
callback: EachCallback<IndexValue<T, P1>>,
prop1: P1,
): void;
each<P1 extends keyof T, P2 extends IterProperties<T[P1]>>(
callback: EachCallback<IndexValue<IndexValue<T, P1>, P2>>,
prop1: P1,
prop2: P2,
): void;
each<
P1 extends keyof T,
P2 extends IterProperties<T[P1]>,
P3 extends IterProperties<IndexValue<T[P1], P2>>,
>(
callback: EachCallback<IndexValue<IndexValue<IndexValue<T, P1>, P2>, P3>>,
prop1: P1,
prop2: P2,
prop3: P3,
): void;
each<
P1 extends keyof T,
P2 extends IterProperties<T[P1]>,
P3 extends IterProperties<IndexValue<T[P1], P2>>,
P4 extends IterProperties<IndexValue<IndexValue<T[P1], P2>, P3>>,
>(
callback: EachCallback<
IndexValue<IndexValue<IndexValue<IndexValue<T, P1>, P2>, P3>, P4>
>,
prop1: P1,
prop2: P2,
prop3: P3,
prop4: P4,
): void;
each(
callback: EachCallback<any[]>,
prop1: PropertyKey,
prop2: PropertyKey,
prop3: PropertyKey,
prop4: PropertyKey,
...props: PropertyKey[]
): void;
map<U>(callback: MapCallback<T, U>): U[];
map<U, P1 extends IterProperties<T>>(
callback: MapCallback<IndexValue<T, P1>, U>,
prop1: P1,
): U[];
map<U, P1 extends keyof T, P2 extends IterProperties<T[P1]>>(
callback: MapCallback<IndexValue<IndexValue<T, P1>, P2>, U>,
prop1: P1,
prop2: P2,
): U[];
map<
U,
P1 extends keyof T,
P2 extends IterProperties<T[P1]>,
P3 extends IterProperties<IndexValue<T[P1], P2>>,
>(
callback: MapCallback<IndexValue<IndexValue<IndexValue<T, P1>, P2>, P3>, U>,
prop1: P1,
prop2: P2,
prop3: P3,
): U[];
map<
U,
P1 extends keyof T,
P2 extends IterProperties<T[P1]>,
P3 extends IterProperties<IndexValue<T[P1], P2>>,
P4 extends IterProperties<IndexValue<IndexValue<T[P1], P2>, P3>>,
>(
callback: MapCallback<
IndexValue<IndexValue<IndexValue<IndexValue<T, P1>, P2>, P3>, P4>,
U
>,
prop1: P1,
prop2: P2,
prop3: P3,
prop4: P4,
): U[];
map<U>(
callback: MapCallback<any[], U>,
prop1: PropertyKey,
prop2: PropertyKey,
prop3: PropertyKey,
prop4: PropertyKey,
...props: PropertyKey[]
): U[];
}
/** @deprecated `FastPath` was renamed to `AstPath` */
export type FastPath<T = any> = AstPath<T>;
export type BuiltInParser = (text: string, options?: any) => AST;
export type BuiltInParserName =
| "acorn"
| "angular"
| "babel-flow"
| "babel-ts"
| "babel"
| "css"
| "espree"
| "flow"
| "glimmer"
| "graphql"
| "html"
| "json-stringify"
| "json"
| "json5"
| "jsonc"
| "less"
| "lwc"
| "markdown"
| "mdx"
| "meriyah"
| "mjml"
| "scss"
| "typescript"
| "vue"
| "yaml";
export type BuiltInParsers = Record<BuiltInParserName, BuiltInParser>;
/**
* For use in `.prettierrc.js`, `.prettierrc.ts`, `.prettierrc.cjs`, `.prettierrc.cts`, `prettierrc.mjs`, `prettierrc.mts`, `prettier.config.js`, `prettier.config.ts`, `prettier.config.cjs`, `prettier.config.cts`, `prettier.config.mjs`, `prettier.config.mts`
*/
export interface Config extends Options {
overrides?: Array<{
files: string | string[];
excludeFiles?: string | string[];
options?: Options;
}>;
}
export interface Options extends Partial<RequiredOptions> {}
export interface RequiredOptions extends doc.printer.Options {
/**
* Print semicolons at the ends of statements.
* @default true
*/
semi: boolean;
/**
* Use single quotes instead of double quotes.
* @default false
*/
singleQuote: boolean;
/**
* Use single quotes in JSX.
* @default false
*/
jsxSingleQuote: boolean;
/**
* Print trailing commas wherever possible.
* @default "all"
*/
trailingComma: "none" | "es5" | "all";
/**
* Print spaces between brackets in object literals.
* @default true
*/
bracketSpacing: boolean;
/**
* How to wrap object literals.
* @default "preserve"
*/
objectWrap: "preserve" | "collapse";
/**
* Put the `>` of a multi-line HTML (HTML, JSX, Vue, Angular) element at the end of the last line instead of being
* alone on the next line (does not apply to self closing elements).
* @default false
*/
bracketSameLine: boolean;
/**
* Format only a segment of a file.
* @default 0
*/
rangeStart: number;
/**
* Format only a segment of a file.
* @default Number.POSITIVE_INFINITY
*/
rangeEnd: number;
/**
* Specify which parser to use.
*/
parser: LiteralUnion<BuiltInParserName>;
/**
* Specify the input filepath. This will be used to do parser inference.
*/
filepath: string;
/**
* Prettier can restrict itself to only format files that contain a special comment, called a pragma, at the top of the file.
* This is very useful when gradually transitioning large, unformatted codebases to prettier.
* @default false
*/
requirePragma: boolean;
/**
* Prettier can insert a special @format marker at the top of files specifying that
* the file has been formatted with prettier. This works well when used in tandem with
* the --require-pragma option. If there is already a docblock at the top of
* the file then this option will add a newline to it with the @format marker.
* @default false
*/
insertPragma: boolean;
/**
* Prettier can allow individual files to opt out of formatting if they contain a special comment, called a pragma, at the top of the file.
* @default false
*/
checkIgnorePragma: boolean;
/**
* By default, Prettier will wrap markdown text as-is since some services use a linebreak-sensitive renderer.
* In some cases you may want to rely on editor/viewer soft wrapping instead, so this option allows you to opt out.
* @default "preserve"
*/
proseWrap: "always" | "never" | "preserve";
/**
* Include parentheses around a sole arrow function parameter.
* @default "always"
*/
arrowParens: "avoid" | "always";
/**
* Provide ability to support new languages to prettier.
*/
plugins: Array<string | URL | Plugin>;
/**
* How to handle whitespaces in HTML.
* @default "css"
*/
htmlWhitespaceSensitivity: "css" | "strict" | "ignore";
/**
* Which end of line characters to apply.
* @default "lf"
*/
endOfLine: "auto" | "lf" | "crlf" | "cr";
/**
* Change when properties in objects are quoted.
* @default "as-needed"
*/
quoteProps: "as-needed" | "consistent" | "preserve";
/**
* Whether or not to indent the code inside <script> and <style> tags in Vue files.
* @default false
*/
vueIndentScriptAndStyle: boolean;
/**
* Control whether Prettier formats quoted code embedded in the file.
* @default "auto"
*/
embeddedLanguageFormatting: "auto" | "off";
/**
* Enforce single attribute per line in HTML, Vue and JSX.
* @default false
*/
singleAttributePerLine: boolean;
/**
* Where to print operators when binary expressions wrap lines.
* @default "end"
*/
experimentalOperatorPosition: "start" | "end";
/**
* Use curious ternaries, with the question mark after the condition, instead
* of on the same line as the consequent.
* @default false
*/
experimentalTernaries: boolean;
/**
* Put the `>` of a multi-line JSX element at the end of the last line instead of being alone on the next line.
* @default false
* @deprecated use bracketSameLine instead
*/
jsxBracketSameLine?: boolean;
/**
* Arbitrary additional values on an options object are always allowed.
*/
[_: string]: unknown;
}
export interface ParserOptions<T = any> extends RequiredOptions {
locStart: (node: T) => number;
locEnd: (node: T) => number;
originalText: string;
}
export interface Plugin<T = any> {
languages?: SupportLanguage[] | undefined;
parsers?: { [parserName: string]: Parser<T> } | undefined;
printers?: { [astFormat: string]: Printer<T> } | undefined;
options?: SupportOptions | undefined;
defaultOptions?: Partial<RequiredOptions> | undefined;
}
export interface Parser<T = any> {
parse: (text: string, options: ParserOptions<T>) => T | Promise<T>;
astFormat: string;
hasPragma?: ((text: string) => boolean) | undefined;
hasIgnorePragma?: ((text: string) => boolean) | undefined;
locStart: (node: T) => number;
locEnd: (node: T) => number;
preprocess?:
| ((text: string, options: ParserOptions<T>) => string)
| undefined;
}
export interface Printer<T = any> {
print(
path: AstPath<T>,
options: ParserOptions<T>,
print: (path: AstPath<T>) => Doc,
args?: unknown,
): Doc;
embed?:
| ((
path: AstPath,
options: Options,
) =>
| ((
textToDoc: (text: string, options: Options) => Promise<Doc>,
print: (
selector?: string | number | Array<string | number> | AstPath,
) => Doc,
path: AstPath,
options: Options,
) => Promise<Doc | undefined> | Doc | undefined)
| Doc
| null)
| undefined;
preprocess?:
| ((ast: T, options: ParserOptions<T>) => T | Promise<T>)
| undefined;
insertPragma?: (text: string) => string;
/**
* @returns `null` if you want to remove this node
* @returns `void` if you want to use modified `cloned`
* @returns anything if you want to replace the node with it
*/
massageAstNode?:
| ((original: any, cloned: any, parent: any) => any)
| undefined;
hasPrettierIgnore?: ((path: AstPath<T>) => boolean) | undefined;
canAttachComment?: ((node: T) => boolean) | undefined;
isBlockComment?: ((node: T) => boolean) | undefined;
willPrintOwnComments?: ((path: AstPath<T>) => boolean) | undefined;
printComment?:
| ((commentPath: AstPath<T>, options: ParserOptions<T>) => Doc)
| undefined;
/**
* By default, Prettier searches all object properties (except for a few predefined ones) of each node recursively.
* This function can be provided to override that behavior.
* @param node The node whose children should be returned.
* @param options Current options.
* @returns `[]` if the node has no children or `undefined` to fall back on the default behavior.
*/
getCommentChildNodes?:
| ((node: T, options: ParserOptions<T>) => T[] | undefined)
| undefined;
handleComments?:
| {
ownLine?:
| ((
commentNode: any,
text: string,
options: ParserOptions<T>,
ast: T,
isLastComment: boolean,
) => boolean)
| undefined;
endOfLine?:
| ((
commentNode: any,
text: string,
options: ParserOptions<T>,
ast: T,
isLastComment: boolean,
) => boolean)
| undefined;
remaining?:
| ((
commentNode: any,
text: string,
options: ParserOptions<T>,
ast: T,
isLastComment: boolean,
) => boolean)
| undefined;
}
| undefined;
getVisitorKeys?:
| ((node: T, nonTraversableKeys: Set<string>) => string[])
| undefined;
}
export interface CursorOptions extends Options {
/**
* Specify where the cursor is.
*/
cursorOffset: number;
}
export interface CursorResult {
formatted: string;
cursorOffset: number;
}
/**
* `format` is used to format text using Prettier. [Options](https://prettier.io/docs/options) may be provided to override the defaults.
*/
export function format(source: string, options?: Options): Promise<string>;
/**
* `check` checks to see if the file has been formatted with Prettier given those options and returns a `Boolean`.
* This is similar to the `--list-different` parameter in the CLI and is useful for running Prettier in CI scenarios.
*/
export function check(source: string, options?: Options): Promise<boolean>;
/**
* `formatWithCursor` both formats the code, and translates a cursor position from unformatted code to formatted code.
* This is useful for editor integrations, to prevent the cursor from moving when code is formatted.
*
* The `cursorOffset` option should be provided, to specify where the cursor is.
*/
export function formatWithCursor(
source: string,
options: CursorOptions,
): Promise<CursorResult>;
export interface ResolveConfigOptions {
/**
* If set to `false`, all caching will be bypassed.
*/
useCache?: boolean | undefined;
/**
* Pass directly the path of the config file if you don't wish to search for it.
*/
config?: string | URL | undefined;
/**
* If set to `true` and an `.editorconfig` file is in your project,
* Prettier will parse it and convert its properties to the corresponding prettier configuration.
* This configuration will be overridden by `.prettierrc`, etc. Currently,
* the following EditorConfig properties are supported:
* - indent_style
* - indent_size/tab_width
* - max_line_length
*/
editorconfig?: boolean | undefined;
}
/**
* `resolveConfig` can be used to resolve configuration for a given source file,
* passing its path or url as the first argument. The config search will start at
* the directory of the file location and continue to search up the directory.
*
* A promise is returned which will resolve to:
*
* - An options object, providing a [config file](https://prettier.io/docs/configuration) was found.
* - `null`, if no file was found.
*
* The promise will be rejected if there was an error parsing the configuration file.
*/
export function resolveConfig(
fileUrlOrPath: string | URL,
options?: ResolveConfigOptions,
): Promise<Options | null>;
/**
* `resolveConfigFile` can be used to find the path of the Prettier configuration file,
* that will be used when resolving the config (i.e. when calling `resolveConfig`).
*
* A promise is returned which will resolve to:
*
* - The path of the configuration file.
* - `null`, if no file was found.
*
* The promise will be rejected if there was an error parsing the configuration file.
*/
export function resolveConfigFile(
fileUrlOrPath?: string | URL,
): Promise<string | null>;
/**
* As you repeatedly call `resolveConfig`, the file system structure will be cached for performance. This function will clear the cache.
* Generally this is only needed for editor integrations that know that the file system has changed since the last format took place.
*/
export function clearConfigCache(): Promise<void>;
export interface SupportLanguage {
name: string;
parsers: BuiltInParserName[] | string[];
group?: string | undefined;
tmScope?: string | undefined;
aceMode?: string | undefined;
codemirrorMode?: string | undefined;
codemirrorMimeType?: string | undefined;
aliases?: string[] | undefined;
extensions?: string[] | undefined;
filenames?: string[] | undefined;
linguistLanguageId?: number | undefined;
vscodeLanguageIds?: string[] | undefined;
interpreters?: string[] | undefined;
isSupported?: ((options: { filepath: string }) => boolean) | undefined;
}
export interface SupportOptionRange {
start: number;
end: number;
step: number;
}
export type SupportOptionType =
| "int"
| "string"
| "boolean"
| "choice"
| "path";
export type CoreCategoryType =
| "Config"
| "Editor"
| "Format"
| "Other"
| "Output"
| "Global"
| "Special";
export interface BaseSupportOption<Type extends SupportOptionType> {
readonly name?: string | undefined;
/**
* Usually you can use {@link CoreCategoryType}
*/
category: string;
/**
* The type of the option.
*
* When passing a type other than the ones listed below, the option is
* treated as taking any string as argument, and `--option <${type}>` will
* be displayed in --help.
*/
type: Type;
/**
* Indicate that the option is deprecated.
*
* Use a string to add an extra message to --help for the option,
* for example to suggest a replacement option.
*/
deprecated?: true | string | undefined;
/**
* Description to be displayed in --help. If omitted, the option won't be
* shown at all in --help.
*/
description?: string | undefined;
}
export interface IntSupportOption extends BaseSupportOption<"int"> {
default?: number | undefined;
array?: false | undefined;
range?: SupportOptionRange | undefined;
}
export interface IntArraySupportOption extends BaseSupportOption<"int"> {
default?: Array<{ value: number[] }> | undefined;
array: true;
}
export interface StringSupportOption extends BaseSupportOption<"string"> {
default?: string | undefined;
array?: false | undefined;
}
export interface StringArraySupportOption extends BaseSupportOption<"string"> {
default?: Array<{ value: string[] }> | undefined;
array: true;
}
export interface BooleanSupportOption extends BaseSupportOption<"boolean"> {
default?: boolean | undefined;
array?: false | undefined;
description: string;
oppositeDescription?: string | undefined;
}
export interface BooleanArraySupportOption
extends BaseSupportOption<"boolean"> {
default?: Array<{ value: boolean[] }> | undefined;
array: true;
}
export interface ChoiceSupportOption<Value = any>
extends BaseSupportOption<"choice"> {
default?: Value | Array<{ value: Value }> | undefined;
description: string;
choices: Array<{
value: Value;
description: string;
}>;
}
export interface PathSupportOption extends BaseSupportOption<"path"> {
default?: string | undefined;
array?: false | undefined;
}
export interface PathArraySupportOption extends BaseSupportOption<"path"> {
default?: Array<{ value: string[] }> | undefined;
array: true;
}
export type SupportOption =
| IntSupportOption
| IntArraySupportOption
| StringSupportOption
| StringArraySupportOption
| BooleanSupportOption
| BooleanArraySupportOption
| ChoiceSupportOption
| PathSupportOption
| PathArraySupportOption;
export interface SupportOptions extends Record<string, SupportOption> {}
export interface SupportInfo {
languages: SupportLanguage[];
options: SupportOption[];
}
export interface FileInfoOptions {
ignorePath?: string | URL | (string | URL)[] | undefined;
withNodeModules?: boolean | undefined;
plugins?: Array<string | URL | Plugin> | undefined;
resolveConfig?: boolean | undefined;
}
export interface FileInfoResult {
ignored: boolean;
inferredParser: string | null;
}
export function getFileInfo(
file: string | URL,
options?: FileInfoOptions,
): Promise<FileInfoResult>;
export interface SupportInfoOptions {
plugins?: Array<string | URL | Plugin> | undefined;
showDeprecated?: boolean | undefined;
}
/**
* Returns an object representing the parsers, languages and file types Prettier supports for the current version.
*/
export function getSupportInfo(
options?: SupportInfoOptions,
): Promise<SupportInfo>;
/**
* `version` field in `package.json`
*/
export const version: string;
// https://github.com/prettier/prettier/blob/next/src/utils/public.js
export namespace util {
interface SkipOptions {
backwards?: boolean | undefined;
}
type Quote = "'" | '"';
function getMaxContinuousCount(text: string, searchString: string): number;
function getStringWidth(text: string): number;
function getAlignmentSize(
text: string,
tabWidth: number,
startIndex?: number | undefined,
): number;
function getIndentSize(value: string, tabWidth: number): number;
function skipNewline(
text: string,
startIndex: number | false,
options?: SkipOptions | undefined,
): number | false;
function skipInlineComment(
text: string,
startIndex: number | false,
): number | false;
function skipTrailingComment(
text: string,
startIndex: number | false,
): number | false;
function skipTrailingComment(
text: string,
startIndex: number | false,
): number | false;
function hasNewline(
text: string,
startIndex: number,
options?: SkipOptions | undefined,
): boolean;
function hasNewlineInRange(
text: string,
startIndex: number,
endIndex: number,
): boolean;
function hasSpaces(
text: string,
startIndex: number,
options?: SkipOptions | undefined,
): boolean;
function getNextNonSpaceNonCommentCharacterIndex(
text: string,
startIndex: number,
): number | false;
function getNextNonSpaceNonCommentCharacter(
text: string,
startIndex: number,
): string;
function isNextLineEmpty(text: string, startIndex: number): boolean;
function isPreviousLineEmpty(text: string, startIndex: number): boolean;
function makeString(
rawText: string,
enclosingQuote: Quote,
unescapeUnnecessaryEscapes?: boolean | undefined,
): string;
function skip(
characters: string | RegExp,
): (
text: string,
startIndex: number | false,
options?: SkipOptions,
) => number | false;
const skipWhitespace: (
text: string,
startIndex: number | false,
options?: SkipOptions,
) => number | false;
const skipSpaces: (
text: string,
startIndex: number | false,
options?: SkipOptions,
) => number | false;
const skipToLineEnd: (
text: string,
startIndex: number | false,
options?: SkipOptions,
) => number | false;
const skipEverythingButNewLine: (
text: string,
startIndex: number | false,
options?: SkipOptions,
) => number | false;
function addLeadingComment(node: any, comment: any): void;
function addDanglingComment(node: any, comment: any, marker: any): void;
function addTrailingComment(node: any, comment: any): void;
function getPreferredQuote(
text: string,
preferredQuoteOrPreferSingleQuote: Quote | boolean,
): Quote;
}