prettier 2.0.5 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +0 -0
- package/README.md +0 -0
- package/bin-prettier.js +12317 -50112
- package/doc.js +1867 -258
- package/esm/parser-angular.mjs +46 -0
- package/esm/parser-babel.mjs +1 -0
- package/esm/parser-espree.mjs +1 -0
- package/esm/parser-flow.mjs +1 -0
- package/esm/parser-glimmer.mjs +1 -0
- package/esm/parser-graphql.mjs +1 -0
- package/esm/parser-html.mjs +113 -0
- package/esm/parser-markdown.mjs +19 -0
- package/esm/parser-meriyah.mjs +1 -0
- package/esm/parser-postcss.mjs +1 -0
- package/esm/parser-typescript.mjs +1 -0
- package/esm/parser-yaml.mjs +15 -0
- package/esm/standalone.mjs +55 -0
- package/index.js +33352 -27419
- package/package.json +8 -5
- package/parser-angular.js +13 -617
- package/parser-babel.js +1 -1
- package/parser-espree.js +1 -0
- package/parser-flow.js +1 -1
- package/parser-glimmer.js +1 -1
- package/parser-graphql.js +1 -1
- package/parser-html.js +15 -15
- package/parser-markdown.js +4 -4
- package/parser-meriyah.js +1 -0
- package/parser-postcss.js +1 -8
- package/parser-typescript.js +1 -14
- package/parser-yaml.js +12 -13
- package/standalone.js +51 -32919
- package/third-party.js +5678 -7676
package/doc.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(
|
|
3
|
-
typeof define === 'function' && define.amd ? define(
|
|
4
|
-
(global = global || self,
|
|
5
|
-
}(this, (function (
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.doc = factory());
|
|
5
|
+
}(this, (function () { 'use strict';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* @param {Doc[]} parts
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
39
|
/**
|
|
40
|
-
* @param {number} n
|
|
40
|
+
* @param {number | string} n
|
|
41
41
|
* @param {Doc} contents
|
|
42
42
|
* @returns Doc
|
|
43
43
|
*/
|
|
@@ -295,10 +295,10 @@
|
|
|
295
295
|
};
|
|
296
296
|
|
|
297
297
|
var isFullwidthCodePoint_1 = isFullwidthCodePoint;
|
|
298
|
-
var
|
|
299
|
-
isFullwidthCodePoint_1.default =
|
|
298
|
+
var _default = isFullwidthCodePoint;
|
|
299
|
+
isFullwidthCodePoint_1.default = _default;
|
|
300
300
|
|
|
301
|
-
var emojiRegex = function
|
|
301
|
+
var emojiRegex = function () {
|
|
302
302
|
// https://mths.be/emoji
|
|
303
303
|
return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g;
|
|
304
304
|
};
|
|
@@ -338,30 +338,1672 @@
|
|
|
338
338
|
|
|
339
339
|
var stringWidth_1 = stringWidth; // TODO: remove this in the next major version
|
|
340
340
|
|
|
341
|
-
var
|
|
342
|
-
stringWidth_1.default =
|
|
341
|
+
var _default$1 = stringWidth;
|
|
342
|
+
stringWidth_1.default = _default$1;
|
|
343
343
|
|
|
344
|
-
|
|
344
|
+
var escapeStringRegexp = string => {
|
|
345
|
+
if (typeof string !== 'string') {
|
|
346
|
+
throw new TypeError('Expected a string');
|
|
347
|
+
} // Escape characters with special meaning either inside or outside character sets.
|
|
348
|
+
// Use a simple backslash escape when it’s always valid, and a \unnnn escape when the simpler form would be disallowed by Unicode patterns’ stricter grammar.
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
return string.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&').replace(/-/g, '\\x2d');
|
|
352
|
+
};
|
|
353
|
+
|
|
354
|
+
var getLast = arr => arr[arr.length - 1];
|
|
355
|
+
|
|
356
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
357
|
+
if (source == null) return {};
|
|
358
|
+
var target = {};
|
|
359
|
+
var sourceKeys = Object.keys(source);
|
|
360
|
+
var key, i;
|
|
361
|
+
|
|
362
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
363
|
+
key = sourceKeys[i];
|
|
364
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
365
|
+
target[key] = source[key];
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
return target;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
function _taggedTemplateLiteral(strings, raw) {
|
|
372
|
+
if (!raw) {
|
|
373
|
+
raw = strings.slice(0);
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
return Object.freeze(Object.defineProperties(strings, {
|
|
377
|
+
raw: {
|
|
378
|
+
value: Object.freeze(raw)
|
|
379
|
+
}
|
|
380
|
+
}));
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
var global$1 = typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {};
|
|
384
|
+
|
|
385
|
+
// based off https://github.com/defunctzombie/node-process/blob/master/browser.js
|
|
386
|
+
|
|
387
|
+
function defaultSetTimout() {
|
|
388
|
+
throw new Error('setTimeout has not been defined');
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
function defaultClearTimeout() {
|
|
392
|
+
throw new Error('clearTimeout has not been defined');
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
var cachedSetTimeout = defaultSetTimout;
|
|
396
|
+
var cachedClearTimeout = defaultClearTimeout;
|
|
397
|
+
|
|
398
|
+
if (typeof global$1.setTimeout === 'function') {
|
|
399
|
+
cachedSetTimeout = setTimeout;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
if (typeof global$1.clearTimeout === 'function') {
|
|
403
|
+
cachedClearTimeout = clearTimeout;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
function runTimeout(fun) {
|
|
407
|
+
if (cachedSetTimeout === setTimeout) {
|
|
408
|
+
//normal enviroments in sane situations
|
|
409
|
+
return setTimeout(fun, 0);
|
|
410
|
+
} // if setTimeout wasn't available but was latter defined
|
|
411
|
+
|
|
412
|
+
|
|
413
|
+
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
|
|
414
|
+
cachedSetTimeout = setTimeout;
|
|
415
|
+
return setTimeout(fun, 0);
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
try {
|
|
419
|
+
// when when somebody has screwed with setTimeout but no I.E. maddness
|
|
420
|
+
return cachedSetTimeout(fun, 0);
|
|
421
|
+
} catch (e) {
|
|
422
|
+
try {
|
|
423
|
+
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
|
|
424
|
+
return cachedSetTimeout.call(null, fun, 0);
|
|
425
|
+
} catch (e) {
|
|
426
|
+
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
|
|
427
|
+
return cachedSetTimeout.call(this, fun, 0);
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
function runClearTimeout(marker) {
|
|
433
|
+
if (cachedClearTimeout === clearTimeout) {
|
|
434
|
+
//normal enviroments in sane situations
|
|
435
|
+
return clearTimeout(marker);
|
|
436
|
+
} // if clearTimeout wasn't available but was latter defined
|
|
437
|
+
|
|
438
|
+
|
|
439
|
+
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
|
|
440
|
+
cachedClearTimeout = clearTimeout;
|
|
441
|
+
return clearTimeout(marker);
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
try {
|
|
445
|
+
// when when somebody has screwed with setTimeout but no I.E. maddness
|
|
446
|
+
return cachedClearTimeout(marker);
|
|
447
|
+
} catch (e) {
|
|
448
|
+
try {
|
|
449
|
+
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
|
|
450
|
+
return cachedClearTimeout.call(null, marker);
|
|
451
|
+
} catch (e) {
|
|
452
|
+
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
|
|
453
|
+
// Some versions of I.E. have different rules for clearTimeout vs setTimeout
|
|
454
|
+
return cachedClearTimeout.call(this, marker);
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
var queue = [];
|
|
460
|
+
var draining = false;
|
|
461
|
+
var currentQueue;
|
|
462
|
+
var queueIndex = -1;
|
|
463
|
+
|
|
464
|
+
function cleanUpNextTick() {
|
|
465
|
+
if (!draining || !currentQueue) {
|
|
466
|
+
return;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
draining = false;
|
|
470
|
+
|
|
471
|
+
if (currentQueue.length) {
|
|
472
|
+
queue = currentQueue.concat(queue);
|
|
473
|
+
} else {
|
|
474
|
+
queueIndex = -1;
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
if (queue.length) {
|
|
478
|
+
drainQueue();
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
function drainQueue() {
|
|
483
|
+
if (draining) {
|
|
484
|
+
return;
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
var timeout = runTimeout(cleanUpNextTick);
|
|
488
|
+
draining = true;
|
|
489
|
+
var len = queue.length;
|
|
490
|
+
|
|
491
|
+
while (len) {
|
|
492
|
+
currentQueue = queue;
|
|
493
|
+
queue = [];
|
|
494
|
+
|
|
495
|
+
while (++queueIndex < len) {
|
|
496
|
+
if (currentQueue) {
|
|
497
|
+
currentQueue[queueIndex].run();
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
queueIndex = -1;
|
|
502
|
+
len = queue.length;
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
currentQueue = null;
|
|
506
|
+
draining = false;
|
|
507
|
+
runClearTimeout(timeout);
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
function nextTick(fun) {
|
|
511
|
+
var args = new Array(arguments.length - 1);
|
|
512
|
+
|
|
513
|
+
if (arguments.length > 1) {
|
|
514
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
515
|
+
args[i - 1] = arguments[i];
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
queue.push(new Item(fun, args));
|
|
520
|
+
|
|
521
|
+
if (queue.length === 1 && !draining) {
|
|
522
|
+
runTimeout(drainQueue);
|
|
523
|
+
}
|
|
524
|
+
} // v8 likes predictible objects
|
|
525
|
+
|
|
526
|
+
function Item(fun, array) {
|
|
527
|
+
this.fun = fun;
|
|
528
|
+
this.array = array;
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
Item.prototype.run = function () {
|
|
532
|
+
this.fun.apply(null, this.array);
|
|
533
|
+
};
|
|
534
|
+
|
|
535
|
+
var title = 'browser';
|
|
536
|
+
var platform = 'browser';
|
|
537
|
+
var browser = true;
|
|
538
|
+
var env = {};
|
|
539
|
+
var argv = [];
|
|
540
|
+
var version = ''; // empty string to avoid regexp issues
|
|
541
|
+
|
|
542
|
+
var versions = {};
|
|
543
|
+
var release = {};
|
|
544
|
+
var config = {};
|
|
545
|
+
|
|
546
|
+
function noop() {}
|
|
547
|
+
|
|
548
|
+
var on = noop;
|
|
549
|
+
var addListener = noop;
|
|
550
|
+
var once = noop;
|
|
551
|
+
var off = noop;
|
|
552
|
+
var removeListener = noop;
|
|
553
|
+
var removeAllListeners = noop;
|
|
554
|
+
var emit = noop;
|
|
555
|
+
function binding(name) {
|
|
556
|
+
throw new Error('process.binding is not supported');
|
|
557
|
+
}
|
|
558
|
+
function cwd() {
|
|
559
|
+
return '/';
|
|
560
|
+
}
|
|
561
|
+
function chdir(dir) {
|
|
562
|
+
throw new Error('process.chdir is not supported');
|
|
563
|
+
}
|
|
564
|
+
function umask() {
|
|
565
|
+
return 0;
|
|
566
|
+
} // from https://github.com/kumavis/browser-process-hrtime/blob/master/index.js
|
|
567
|
+
|
|
568
|
+
var performance = global$1.performance || {};
|
|
569
|
+
|
|
570
|
+
var performanceNow = performance.now || performance.mozNow || performance.msNow || performance.oNow || performance.webkitNow || function () {
|
|
571
|
+
return new Date().getTime();
|
|
572
|
+
}; // generate timestamp or delta
|
|
573
|
+
// see http://nodejs.org/api/process.html#process_process_hrtime
|
|
574
|
+
|
|
575
|
+
|
|
576
|
+
function hrtime(previousTimestamp) {
|
|
577
|
+
var clocktime = performanceNow.call(performance) * 1e-3;
|
|
578
|
+
var seconds = Math.floor(clocktime);
|
|
579
|
+
var nanoseconds = Math.floor(clocktime % 1 * 1e9);
|
|
580
|
+
|
|
581
|
+
if (previousTimestamp) {
|
|
582
|
+
seconds = seconds - previousTimestamp[0];
|
|
583
|
+
nanoseconds = nanoseconds - previousTimestamp[1];
|
|
584
|
+
|
|
585
|
+
if (nanoseconds < 0) {
|
|
586
|
+
seconds--;
|
|
587
|
+
nanoseconds += 1e9;
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
return [seconds, nanoseconds];
|
|
592
|
+
}
|
|
593
|
+
var startTime = new Date();
|
|
594
|
+
function uptime() {
|
|
595
|
+
var currentTime = new Date();
|
|
596
|
+
var dif = currentTime - startTime;
|
|
597
|
+
return dif / 1000;
|
|
598
|
+
}
|
|
599
|
+
var process = {
|
|
600
|
+
nextTick: nextTick,
|
|
601
|
+
title: title,
|
|
602
|
+
browser: browser,
|
|
603
|
+
env: env,
|
|
604
|
+
argv: argv,
|
|
605
|
+
version: version,
|
|
606
|
+
versions: versions,
|
|
607
|
+
on: on,
|
|
608
|
+
addListener: addListener,
|
|
609
|
+
once: once,
|
|
610
|
+
off: off,
|
|
611
|
+
removeListener: removeListener,
|
|
612
|
+
removeAllListeners: removeAllListeners,
|
|
613
|
+
emit: emit,
|
|
614
|
+
binding: binding,
|
|
615
|
+
cwd: cwd,
|
|
616
|
+
chdir: chdir,
|
|
617
|
+
umask: umask,
|
|
618
|
+
hrtime: hrtime,
|
|
619
|
+
platform: platform,
|
|
620
|
+
release: release,
|
|
621
|
+
config: config,
|
|
622
|
+
uptime: uptime
|
|
623
|
+
};
|
|
624
|
+
|
|
625
|
+
const debug = typeof process === 'object' && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error('SEMVER', ...args) : () => {};
|
|
626
|
+
var debug_1 = debug;
|
|
627
|
+
|
|
628
|
+
// Note: this is the semver.org version of the spec that it implements
|
|
629
|
+
// Not necessarily the package version of this code.
|
|
630
|
+
const SEMVER_SPEC_VERSION = '2.0.0';
|
|
631
|
+
const MAX_LENGTH = 256;
|
|
632
|
+
const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER ||
|
|
633
|
+
/* istanbul ignore next */
|
|
634
|
+
9007199254740991; // Max safe segment length for coercion.
|
|
635
|
+
|
|
636
|
+
const MAX_SAFE_COMPONENT_LENGTH = 16;
|
|
637
|
+
var constants = {
|
|
638
|
+
SEMVER_SPEC_VERSION,
|
|
639
|
+
MAX_LENGTH,
|
|
640
|
+
MAX_SAFE_INTEGER,
|
|
641
|
+
MAX_SAFE_COMPONENT_LENGTH
|
|
642
|
+
};
|
|
643
|
+
|
|
644
|
+
function createCommonjsModule(fn, basedir, module) {
|
|
645
|
+
return module = {
|
|
646
|
+
path: basedir,
|
|
647
|
+
exports: {},
|
|
648
|
+
require: function (path, base) {
|
|
649
|
+
return commonjsRequire(path, (base === undefined || base === null) ? module.path : base);
|
|
650
|
+
}
|
|
651
|
+
}, fn(module, module.exports), module.exports;
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
function commonjsRequire () {
|
|
655
|
+
throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
var re_1 = createCommonjsModule(function (module, exports) {
|
|
659
|
+
const {
|
|
660
|
+
MAX_SAFE_COMPONENT_LENGTH
|
|
661
|
+
} = constants;
|
|
662
|
+
exports = module.exports = {}; // The actual regexps go on exports.re
|
|
663
|
+
|
|
664
|
+
const re = exports.re = [];
|
|
665
|
+
const src = exports.src = [];
|
|
666
|
+
const t = exports.t = {};
|
|
667
|
+
let R = 0;
|
|
668
|
+
|
|
669
|
+
const createToken = (name, value, isGlobal) => {
|
|
670
|
+
const index = R++;
|
|
671
|
+
debug_1(index, value);
|
|
672
|
+
t[name] = index;
|
|
673
|
+
src[index] = value;
|
|
674
|
+
re[index] = new RegExp(value, isGlobal ? 'g' : undefined);
|
|
675
|
+
}; // The following Regular Expressions can be used for tokenizing,
|
|
676
|
+
// validating, and parsing SemVer version strings.
|
|
677
|
+
// ## Numeric Identifier
|
|
678
|
+
// A single `0`, or a non-zero digit followed by zero or more digits.
|
|
679
|
+
|
|
680
|
+
|
|
681
|
+
createToken('NUMERICIDENTIFIER', '0|[1-9]\\d*');
|
|
682
|
+
createToken('NUMERICIDENTIFIERLOOSE', '[0-9]+'); // ## Non-numeric Identifier
|
|
683
|
+
// Zero or more digits, followed by a letter or hyphen, and then zero or
|
|
684
|
+
// more letters, digits, or hyphens.
|
|
685
|
+
|
|
686
|
+
createToken('NONNUMERICIDENTIFIER', '\\d*[a-zA-Z-][a-zA-Z0-9-]*'); // ## Main Version
|
|
687
|
+
// Three dot-separated numeric identifiers.
|
|
688
|
+
|
|
689
|
+
createToken('MAINVERSION', "(".concat(src[t.NUMERICIDENTIFIER], ")\\.") + "(".concat(src[t.NUMERICIDENTIFIER], ")\\.") + "(".concat(src[t.NUMERICIDENTIFIER], ")"));
|
|
690
|
+
createToken('MAINVERSIONLOOSE', "(".concat(src[t.NUMERICIDENTIFIERLOOSE], ")\\.") + "(".concat(src[t.NUMERICIDENTIFIERLOOSE], ")\\.") + "(".concat(src[t.NUMERICIDENTIFIERLOOSE], ")")); // ## Pre-release Version Identifier
|
|
691
|
+
// A numeric identifier, or a non-numeric identifier.
|
|
692
|
+
|
|
693
|
+
createToken('PRERELEASEIDENTIFIER', "(?:".concat(src[t.NUMERICIDENTIFIER], "|").concat(src[t.NONNUMERICIDENTIFIER], ")"));
|
|
694
|
+
createToken('PRERELEASEIDENTIFIERLOOSE', "(?:".concat(src[t.NUMERICIDENTIFIERLOOSE], "|").concat(src[t.NONNUMERICIDENTIFIER], ")")); // ## Pre-release Version
|
|
695
|
+
// Hyphen, followed by one or more dot-separated pre-release version
|
|
696
|
+
// identifiers.
|
|
697
|
+
|
|
698
|
+
createToken('PRERELEASE', "(?:-(".concat(src[t.PRERELEASEIDENTIFIER], "(?:\\.").concat(src[t.PRERELEASEIDENTIFIER], ")*))"));
|
|
699
|
+
createToken('PRERELEASELOOSE', "(?:-?(".concat(src[t.PRERELEASEIDENTIFIERLOOSE], "(?:\\.").concat(src[t.PRERELEASEIDENTIFIERLOOSE], ")*))")); // ## Build Metadata Identifier
|
|
700
|
+
// Any combination of digits, letters, or hyphens.
|
|
701
|
+
|
|
702
|
+
createToken('BUILDIDENTIFIER', '[0-9A-Za-z-]+'); // ## Build Metadata
|
|
703
|
+
// Plus sign, followed by one or more period-separated build metadata
|
|
704
|
+
// identifiers.
|
|
705
|
+
|
|
706
|
+
createToken('BUILD', "(?:\\+(".concat(src[t.BUILDIDENTIFIER], "(?:\\.").concat(src[t.BUILDIDENTIFIER], ")*))")); // ## Full Version String
|
|
707
|
+
// A main version, followed optionally by a pre-release version and
|
|
708
|
+
// build metadata.
|
|
709
|
+
// Note that the only major, minor, patch, and pre-release sections of
|
|
710
|
+
// the version string are capturing groups. The build metadata is not a
|
|
711
|
+
// capturing group, because it should not ever be used in version
|
|
712
|
+
// comparison.
|
|
713
|
+
|
|
714
|
+
createToken('FULLPLAIN', "v?".concat(src[t.MAINVERSION]).concat(src[t.PRERELEASE], "?").concat(src[t.BUILD], "?"));
|
|
715
|
+
createToken('FULL', "^".concat(src[t.FULLPLAIN], "$")); // like full, but allows v1.2.3 and =1.2.3, which people do sometimes.
|
|
716
|
+
// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty
|
|
717
|
+
// common in the npm registry.
|
|
718
|
+
|
|
719
|
+
createToken('LOOSEPLAIN', "[v=\\s]*".concat(src[t.MAINVERSIONLOOSE]).concat(src[t.PRERELEASELOOSE], "?").concat(src[t.BUILD], "?"));
|
|
720
|
+
createToken('LOOSE', "^".concat(src[t.LOOSEPLAIN], "$"));
|
|
721
|
+
createToken('GTLT', '((?:<|>)?=?)'); // Something like "2.*" or "1.2.x".
|
|
722
|
+
// Note that "x.x" is a valid xRange identifer, meaning "any version"
|
|
723
|
+
// Only the first item is strictly required.
|
|
724
|
+
|
|
725
|
+
createToken('XRANGEIDENTIFIERLOOSE', "".concat(src[t.NUMERICIDENTIFIERLOOSE], "|x|X|\\*"));
|
|
726
|
+
createToken('XRANGEIDENTIFIER', "".concat(src[t.NUMERICIDENTIFIER], "|x|X|\\*"));
|
|
727
|
+
createToken('XRANGEPLAIN', "[v=\\s]*(".concat(src[t.XRANGEIDENTIFIER], ")") + "(?:\\.(".concat(src[t.XRANGEIDENTIFIER], ")") + "(?:\\.(".concat(src[t.XRANGEIDENTIFIER], ")") + "(?:".concat(src[t.PRERELEASE], ")?").concat(src[t.BUILD], "?") + ")?)?");
|
|
728
|
+
createToken('XRANGEPLAINLOOSE', "[v=\\s]*(".concat(src[t.XRANGEIDENTIFIERLOOSE], ")") + "(?:\\.(".concat(src[t.XRANGEIDENTIFIERLOOSE], ")") + "(?:\\.(".concat(src[t.XRANGEIDENTIFIERLOOSE], ")") + "(?:".concat(src[t.PRERELEASELOOSE], ")?").concat(src[t.BUILD], "?") + ")?)?");
|
|
729
|
+
createToken('XRANGE', "^".concat(src[t.GTLT], "\\s*").concat(src[t.XRANGEPLAIN], "$"));
|
|
730
|
+
createToken('XRANGELOOSE', "^".concat(src[t.GTLT], "\\s*").concat(src[t.XRANGEPLAINLOOSE], "$")); // Coercion.
|
|
731
|
+
// Extract anything that could conceivably be a part of a valid semver
|
|
732
|
+
|
|
733
|
+
createToken('COERCE', "".concat('(^|[^\\d])' + '(\\d{1,').concat(MAX_SAFE_COMPONENT_LENGTH, "})") + "(?:\\.(\\d{1,".concat(MAX_SAFE_COMPONENT_LENGTH, "}))?") + "(?:\\.(\\d{1,".concat(MAX_SAFE_COMPONENT_LENGTH, "}))?") + "(?:$|[^\\d])");
|
|
734
|
+
createToken('COERCERTL', src[t.COERCE], true); // Tilde ranges.
|
|
735
|
+
// Meaning is "reasonably at or greater than"
|
|
736
|
+
|
|
737
|
+
createToken('LONETILDE', '(?:~>?)');
|
|
738
|
+
createToken('TILDETRIM', "(\\s*)".concat(src[t.LONETILDE], "\\s+"), true);
|
|
739
|
+
exports.tildeTrimReplace = '$1~';
|
|
740
|
+
createToken('TILDE', "^".concat(src[t.LONETILDE]).concat(src[t.XRANGEPLAIN], "$"));
|
|
741
|
+
createToken('TILDELOOSE', "^".concat(src[t.LONETILDE]).concat(src[t.XRANGEPLAINLOOSE], "$")); // Caret ranges.
|
|
742
|
+
// Meaning is "at least and backwards compatible with"
|
|
743
|
+
|
|
744
|
+
createToken('LONECARET', '(?:\\^)');
|
|
745
|
+
createToken('CARETTRIM', "(\\s*)".concat(src[t.LONECARET], "\\s+"), true);
|
|
746
|
+
exports.caretTrimReplace = '$1^';
|
|
747
|
+
createToken('CARET', "^".concat(src[t.LONECARET]).concat(src[t.XRANGEPLAIN], "$"));
|
|
748
|
+
createToken('CARETLOOSE', "^".concat(src[t.LONECARET]).concat(src[t.XRANGEPLAINLOOSE], "$")); // A simple gt/lt/eq thing, or just "" to indicate "any version"
|
|
749
|
+
|
|
750
|
+
createToken('COMPARATORLOOSE', "^".concat(src[t.GTLT], "\\s*(").concat(src[t.LOOSEPLAIN], ")$|^$"));
|
|
751
|
+
createToken('COMPARATOR', "^".concat(src[t.GTLT], "\\s*(").concat(src[t.FULLPLAIN], ")$|^$")); // An expression to strip any whitespace between the gtlt and the thing
|
|
752
|
+
// it modifies, so that `> 1.2.3` ==> `>1.2.3`
|
|
753
|
+
|
|
754
|
+
createToken('COMPARATORTRIM', "(\\s*)".concat(src[t.GTLT], "\\s*(").concat(src[t.LOOSEPLAIN], "|").concat(src[t.XRANGEPLAIN], ")"), true);
|
|
755
|
+
exports.comparatorTrimReplace = '$1$2$3'; // Something like `1.2.3 - 1.2.4`
|
|
756
|
+
// Note that these all use the loose form, because they'll be
|
|
757
|
+
// checked against either the strict or loose comparator form
|
|
758
|
+
// later.
|
|
759
|
+
|
|
760
|
+
createToken('HYPHENRANGE', "^\\s*(".concat(src[t.XRANGEPLAIN], ")") + "\\s+-\\s+" + "(".concat(src[t.XRANGEPLAIN], ")") + "\\s*$");
|
|
761
|
+
createToken('HYPHENRANGELOOSE', "^\\s*(".concat(src[t.XRANGEPLAINLOOSE], ")") + "\\s+-\\s+" + "(".concat(src[t.XRANGEPLAINLOOSE], ")") + "\\s*$"); // Star ranges basically just allow anything at all.
|
|
762
|
+
|
|
763
|
+
createToken('STAR', '(<|>)?=?\\s*\\*'); // >=0.0.0 is like a star
|
|
764
|
+
|
|
765
|
+
createToken('GTE0', '^\\s*>=\\s*0\.0\.0\\s*$');
|
|
766
|
+
createToken('GTE0PRE', '^\\s*>=\\s*0\.0\.0-0\\s*$');
|
|
767
|
+
});
|
|
768
|
+
|
|
769
|
+
const numeric = /^[0-9]+$/;
|
|
770
|
+
|
|
771
|
+
const compareIdentifiers = (a, b) => {
|
|
772
|
+
const anum = numeric.test(a);
|
|
773
|
+
const bnum = numeric.test(b);
|
|
774
|
+
|
|
775
|
+
if (anum && bnum) {
|
|
776
|
+
a = +a;
|
|
777
|
+
b = +b;
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
|
|
781
|
+
};
|
|
782
|
+
|
|
783
|
+
const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a);
|
|
784
|
+
|
|
785
|
+
var identifiers = {
|
|
786
|
+
compareIdentifiers,
|
|
787
|
+
rcompareIdentifiers
|
|
788
|
+
};
|
|
789
|
+
|
|
790
|
+
const {
|
|
791
|
+
MAX_LENGTH: MAX_LENGTH$1,
|
|
792
|
+
MAX_SAFE_INTEGER: MAX_SAFE_INTEGER$1
|
|
793
|
+
} = constants;
|
|
794
|
+
const {
|
|
795
|
+
re,
|
|
796
|
+
t
|
|
797
|
+
} = re_1;
|
|
798
|
+
const {
|
|
799
|
+
compareIdentifiers: compareIdentifiers$1
|
|
800
|
+
} = identifiers;
|
|
801
|
+
|
|
802
|
+
class SemVer {
|
|
803
|
+
constructor(version, options) {
|
|
804
|
+
if (!options || typeof options !== 'object') {
|
|
805
|
+
options = {
|
|
806
|
+
loose: !!options,
|
|
807
|
+
includePrerelease: false
|
|
808
|
+
};
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
if (version instanceof SemVer) {
|
|
812
|
+
if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) {
|
|
813
|
+
return version;
|
|
814
|
+
} else {
|
|
815
|
+
version = version.version;
|
|
816
|
+
}
|
|
817
|
+
} else if (typeof version !== 'string') {
|
|
818
|
+
throw new TypeError("Invalid Version: ".concat(version));
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
if (version.length > MAX_LENGTH$1) {
|
|
822
|
+
throw new TypeError("version is longer than ".concat(MAX_LENGTH$1, " characters"));
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
debug_1('SemVer', version, options);
|
|
826
|
+
this.options = options;
|
|
827
|
+
this.loose = !!options.loose; // this isn't actually relevant for versions, but keep it so that we
|
|
828
|
+
// don't run into trouble passing this.options around.
|
|
829
|
+
|
|
830
|
+
this.includePrerelease = !!options.includePrerelease;
|
|
831
|
+
const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
|
|
832
|
+
|
|
833
|
+
if (!m) {
|
|
834
|
+
throw new TypeError("Invalid Version: ".concat(version));
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
this.raw = version; // these are actually numbers
|
|
838
|
+
|
|
839
|
+
this.major = +m[1];
|
|
840
|
+
this.minor = +m[2];
|
|
841
|
+
this.patch = +m[3];
|
|
842
|
+
|
|
843
|
+
if (this.major > MAX_SAFE_INTEGER$1 || this.major < 0) {
|
|
844
|
+
throw new TypeError('Invalid major version');
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
if (this.minor > MAX_SAFE_INTEGER$1 || this.minor < 0) {
|
|
848
|
+
throw new TypeError('Invalid minor version');
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
if (this.patch > MAX_SAFE_INTEGER$1 || this.patch < 0) {
|
|
852
|
+
throw new TypeError('Invalid patch version');
|
|
853
|
+
} // numberify any prerelease numeric ids
|
|
854
|
+
|
|
855
|
+
|
|
856
|
+
if (!m[4]) {
|
|
857
|
+
this.prerelease = [];
|
|
858
|
+
} else {
|
|
859
|
+
this.prerelease = m[4].split('.').map(id => {
|
|
860
|
+
if (/^[0-9]+$/.test(id)) {
|
|
861
|
+
const num = +id;
|
|
862
|
+
|
|
863
|
+
if (num >= 0 && num < MAX_SAFE_INTEGER$1) {
|
|
864
|
+
return num;
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
return id;
|
|
869
|
+
});
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
this.build = m[5] ? m[5].split('.') : [];
|
|
873
|
+
this.format();
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
format() {
|
|
877
|
+
this.version = "".concat(this.major, ".").concat(this.minor, ".").concat(this.patch);
|
|
878
|
+
|
|
879
|
+
if (this.prerelease.length) {
|
|
880
|
+
this.version += "-".concat(this.prerelease.join('.'));
|
|
881
|
+
}
|
|
882
|
+
|
|
883
|
+
return this.version;
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
toString() {
|
|
887
|
+
return this.version;
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
compare(other) {
|
|
891
|
+
debug_1('SemVer.compare', this.version, this.options, other);
|
|
892
|
+
|
|
893
|
+
if (!(other instanceof SemVer)) {
|
|
894
|
+
if (typeof other === 'string' && other === this.version) {
|
|
895
|
+
return 0;
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
other = new SemVer(other, this.options);
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
if (other.version === this.version) {
|
|
902
|
+
return 0;
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
return this.compareMain(other) || this.comparePre(other);
|
|
906
|
+
}
|
|
907
|
+
|
|
908
|
+
compareMain(other) {
|
|
909
|
+
if (!(other instanceof SemVer)) {
|
|
910
|
+
other = new SemVer(other, this.options);
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
return compareIdentifiers$1(this.major, other.major) || compareIdentifiers$1(this.minor, other.minor) || compareIdentifiers$1(this.patch, other.patch);
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
comparePre(other) {
|
|
917
|
+
if (!(other instanceof SemVer)) {
|
|
918
|
+
other = new SemVer(other, this.options);
|
|
919
|
+
} // NOT having a prerelease is > having one
|
|
920
|
+
|
|
921
|
+
|
|
922
|
+
if (this.prerelease.length && !other.prerelease.length) {
|
|
923
|
+
return -1;
|
|
924
|
+
} else if (!this.prerelease.length && other.prerelease.length) {
|
|
925
|
+
return 1;
|
|
926
|
+
} else if (!this.prerelease.length && !other.prerelease.length) {
|
|
927
|
+
return 0;
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
let i = 0;
|
|
931
|
+
|
|
932
|
+
do {
|
|
933
|
+
const a = this.prerelease[i];
|
|
934
|
+
const b = other.prerelease[i];
|
|
935
|
+
debug_1('prerelease compare', i, a, b);
|
|
936
|
+
|
|
937
|
+
if (a === undefined && b === undefined) {
|
|
938
|
+
return 0;
|
|
939
|
+
} else if (b === undefined) {
|
|
940
|
+
return 1;
|
|
941
|
+
} else if (a === undefined) {
|
|
942
|
+
return -1;
|
|
943
|
+
} else if (a === b) {
|
|
944
|
+
continue;
|
|
945
|
+
} else {
|
|
946
|
+
return compareIdentifiers$1(a, b);
|
|
947
|
+
}
|
|
948
|
+
} while (++i);
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
compareBuild(other) {
|
|
952
|
+
if (!(other instanceof SemVer)) {
|
|
953
|
+
other = new SemVer(other, this.options);
|
|
954
|
+
}
|
|
955
|
+
|
|
956
|
+
let i = 0;
|
|
957
|
+
|
|
958
|
+
do {
|
|
959
|
+
const a = this.build[i];
|
|
960
|
+
const b = other.build[i];
|
|
961
|
+
debug_1('prerelease compare', i, a, b);
|
|
962
|
+
|
|
963
|
+
if (a === undefined && b === undefined) {
|
|
964
|
+
return 0;
|
|
965
|
+
} else if (b === undefined) {
|
|
966
|
+
return 1;
|
|
967
|
+
} else if (a === undefined) {
|
|
968
|
+
return -1;
|
|
969
|
+
} else if (a === b) {
|
|
970
|
+
continue;
|
|
971
|
+
} else {
|
|
972
|
+
return compareIdentifiers$1(a, b);
|
|
973
|
+
}
|
|
974
|
+
} while (++i);
|
|
975
|
+
} // preminor will bump the version up to the next minor release, and immediately
|
|
976
|
+
// down to pre-release. premajor and prepatch work the same way.
|
|
977
|
+
|
|
978
|
+
|
|
979
|
+
inc(release, identifier) {
|
|
980
|
+
switch (release) {
|
|
981
|
+
case 'premajor':
|
|
982
|
+
this.prerelease.length = 0;
|
|
983
|
+
this.patch = 0;
|
|
984
|
+
this.minor = 0;
|
|
985
|
+
this.major++;
|
|
986
|
+
this.inc('pre', identifier);
|
|
987
|
+
break;
|
|
988
|
+
|
|
989
|
+
case 'preminor':
|
|
990
|
+
this.prerelease.length = 0;
|
|
991
|
+
this.patch = 0;
|
|
992
|
+
this.minor++;
|
|
993
|
+
this.inc('pre', identifier);
|
|
994
|
+
break;
|
|
995
|
+
|
|
996
|
+
case 'prepatch':
|
|
997
|
+
// If this is already a prerelease, it will bump to the next version
|
|
998
|
+
// drop any prereleases that might already exist, since they are not
|
|
999
|
+
// relevant at this point.
|
|
1000
|
+
this.prerelease.length = 0;
|
|
1001
|
+
this.inc('patch', identifier);
|
|
1002
|
+
this.inc('pre', identifier);
|
|
1003
|
+
break;
|
|
1004
|
+
// If the input is a non-prerelease version, this acts the same as
|
|
1005
|
+
// prepatch.
|
|
1006
|
+
|
|
1007
|
+
case 'prerelease':
|
|
1008
|
+
if (this.prerelease.length === 0) {
|
|
1009
|
+
this.inc('patch', identifier);
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
this.inc('pre', identifier);
|
|
1013
|
+
break;
|
|
1014
|
+
|
|
1015
|
+
case 'major':
|
|
1016
|
+
// If this is a pre-major version, bump up to the same major version.
|
|
1017
|
+
// Otherwise increment major.
|
|
1018
|
+
// 1.0.0-5 bumps to 1.0.0
|
|
1019
|
+
// 1.1.0 bumps to 2.0.0
|
|
1020
|
+
if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
|
|
1021
|
+
this.major++;
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
this.minor = 0;
|
|
1025
|
+
this.patch = 0;
|
|
1026
|
+
this.prerelease = [];
|
|
1027
|
+
break;
|
|
1028
|
+
|
|
1029
|
+
case 'minor':
|
|
1030
|
+
// If this is a pre-minor version, bump up to the same minor version.
|
|
1031
|
+
// Otherwise increment minor.
|
|
1032
|
+
// 1.2.0-5 bumps to 1.2.0
|
|
1033
|
+
// 1.2.1 bumps to 1.3.0
|
|
1034
|
+
if (this.patch !== 0 || this.prerelease.length === 0) {
|
|
1035
|
+
this.minor++;
|
|
1036
|
+
}
|
|
1037
|
+
|
|
1038
|
+
this.patch = 0;
|
|
1039
|
+
this.prerelease = [];
|
|
1040
|
+
break;
|
|
1041
|
+
|
|
1042
|
+
case 'patch':
|
|
1043
|
+
// If this is not a pre-release version, it will increment the patch.
|
|
1044
|
+
// If it is a pre-release it will bump up to the same patch version.
|
|
1045
|
+
// 1.2.0-5 patches to 1.2.0
|
|
1046
|
+
// 1.2.0 patches to 1.2.1
|
|
1047
|
+
if (this.prerelease.length === 0) {
|
|
1048
|
+
this.patch++;
|
|
1049
|
+
}
|
|
1050
|
+
|
|
1051
|
+
this.prerelease = [];
|
|
1052
|
+
break;
|
|
1053
|
+
// This probably shouldn't be used publicly.
|
|
1054
|
+
// 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
|
|
1055
|
+
|
|
1056
|
+
case 'pre':
|
|
1057
|
+
if (this.prerelease.length === 0) {
|
|
1058
|
+
this.prerelease = [0];
|
|
1059
|
+
} else {
|
|
1060
|
+
let i = this.prerelease.length;
|
|
1061
|
+
|
|
1062
|
+
while (--i >= 0) {
|
|
1063
|
+
if (typeof this.prerelease[i] === 'number') {
|
|
1064
|
+
this.prerelease[i]++;
|
|
1065
|
+
i = -2;
|
|
1066
|
+
}
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1069
|
+
if (i === -1) {
|
|
1070
|
+
// didn't increment anything
|
|
1071
|
+
this.prerelease.push(0);
|
|
1072
|
+
}
|
|
1073
|
+
}
|
|
1074
|
+
|
|
1075
|
+
if (identifier) {
|
|
1076
|
+
// 1.2.0-beta.1 bumps to 1.2.0-beta.2,
|
|
1077
|
+
// 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0
|
|
1078
|
+
if (this.prerelease[0] === identifier) {
|
|
1079
|
+
if (isNaN(this.prerelease[1])) {
|
|
1080
|
+
this.prerelease = [identifier, 0];
|
|
1081
|
+
}
|
|
1082
|
+
} else {
|
|
1083
|
+
this.prerelease = [identifier, 0];
|
|
1084
|
+
}
|
|
1085
|
+
}
|
|
1086
|
+
|
|
1087
|
+
break;
|
|
1088
|
+
|
|
1089
|
+
default:
|
|
1090
|
+
throw new Error("invalid increment argument: ".concat(release));
|
|
1091
|
+
}
|
|
1092
|
+
|
|
1093
|
+
this.format();
|
|
1094
|
+
this.raw = this.version;
|
|
1095
|
+
return this;
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
}
|
|
1099
|
+
|
|
1100
|
+
var semver = SemVer;
|
|
1101
|
+
|
|
1102
|
+
const compare = (a, b, loose) => new semver(a, loose).compare(new semver(b, loose));
|
|
1103
|
+
|
|
1104
|
+
var compare_1 = compare;
|
|
1105
|
+
|
|
1106
|
+
const lt = (a, b, loose) => compare_1(a, b, loose) < 0;
|
|
1107
|
+
|
|
1108
|
+
var lt_1 = lt;
|
|
1109
|
+
|
|
1110
|
+
const gte = (a, b, loose) => compare_1(a, b, loose) >= 0;
|
|
1111
|
+
|
|
1112
|
+
var gte_1 = gte;
|
|
1113
|
+
|
|
1114
|
+
var arrayify = (object, keyName) => Object.entries(object).map(([key, value]) => Object.assign({
|
|
1115
|
+
[keyName]: key
|
|
1116
|
+
}, value));
|
|
1117
|
+
|
|
1118
|
+
var name = "prettier";
|
|
1119
|
+
var version$1 = "2.2.0";
|
|
1120
|
+
var description = "Prettier is an opinionated code formatter";
|
|
1121
|
+
var bin = "./bin/prettier.js";
|
|
1122
|
+
var repository = "prettier/prettier";
|
|
1123
|
+
var homepage = "https://prettier.io";
|
|
1124
|
+
var author = "James Long";
|
|
1125
|
+
var license = "MIT";
|
|
1126
|
+
var main = "./index.js";
|
|
1127
|
+
var browser$1 = "./standalone.js";
|
|
1128
|
+
var unpkg = "./standalone.js";
|
|
1129
|
+
var engines = {
|
|
1130
|
+
node: ">=10.13.0"
|
|
1131
|
+
};
|
|
1132
|
+
var files = [
|
|
1133
|
+
"index.js",
|
|
1134
|
+
"standalone.js",
|
|
1135
|
+
"src",
|
|
1136
|
+
"bin"
|
|
1137
|
+
];
|
|
1138
|
+
var dependencies = {
|
|
1139
|
+
"@angular/compiler": "10.2.3",
|
|
1140
|
+
"@babel/code-frame": "7.10.4",
|
|
1141
|
+
"@babel/parser": "7.12.5",
|
|
1142
|
+
"@glimmer/syntax": "0.66.0",
|
|
1143
|
+
"@iarna/toml": "2.2.5",
|
|
1144
|
+
"@typescript-eslint/typescript-estree": "4.8.1",
|
|
1145
|
+
"angular-estree-parser": "2.2.1",
|
|
1146
|
+
"angular-html-parser": "1.7.1",
|
|
1147
|
+
camelcase: "6.2.0",
|
|
1148
|
+
chalk: "4.1.0",
|
|
1149
|
+
"ci-info": "watson/ci-info#f43f6a1cefff47fb361c88cf4b943fdbcaafe540",
|
|
1150
|
+
"cjk-regex": "2.0.0",
|
|
1151
|
+
cosmiconfig: "7.0.0",
|
|
1152
|
+
dashify: "2.0.0",
|
|
1153
|
+
diff: "5.0.0",
|
|
1154
|
+
editorconfig: "0.15.3",
|
|
1155
|
+
"editorconfig-to-prettier": "0.2.0",
|
|
1156
|
+
"escape-string-regexp": "4.0.0",
|
|
1157
|
+
espree: "7.3.0",
|
|
1158
|
+
esutils: "2.0.3",
|
|
1159
|
+
"fast-glob": "3.2.4",
|
|
1160
|
+
"fast-json-stable-stringify": "2.1.0",
|
|
1161
|
+
"find-parent-dir": "0.3.0",
|
|
1162
|
+
"flow-parser": "0.138.0",
|
|
1163
|
+
"get-stdin": "8.0.0",
|
|
1164
|
+
globby: "11.0.1",
|
|
1165
|
+
graphql: "15.4.0",
|
|
1166
|
+
"html-element-attributes": "2.3.0",
|
|
1167
|
+
"html-styles": "1.0.0",
|
|
1168
|
+
"html-tag-names": "1.1.5",
|
|
1169
|
+
"html-void-elements": "1.0.5",
|
|
1170
|
+
ignore: "4.0.6",
|
|
1171
|
+
"jest-docblock": "26.0.0",
|
|
1172
|
+
json5: "2.1.3",
|
|
1173
|
+
leven: "3.1.0",
|
|
1174
|
+
"lines-and-columns": "1.1.6",
|
|
1175
|
+
"linguist-languages": "7.12.1",
|
|
1176
|
+
lodash: "4.17.20",
|
|
1177
|
+
mem: "8.0.0",
|
|
1178
|
+
meriyah: "3.1.6",
|
|
1179
|
+
minimatch: "3.0.4",
|
|
1180
|
+
minimist: "1.2.5",
|
|
1181
|
+
"n-readlines": "1.0.1",
|
|
1182
|
+
outdent: "0.7.1",
|
|
1183
|
+
"parse-srcset": "ikatyang/parse-srcset#54eb9c1cb21db5c62b4d0e275d7249516df6f0ee",
|
|
1184
|
+
"please-upgrade-node": "3.2.0",
|
|
1185
|
+
"postcss-less": "3.1.4",
|
|
1186
|
+
"postcss-media-query-parser": "0.2.3",
|
|
1187
|
+
"postcss-scss": "2.1.1",
|
|
1188
|
+
"postcss-selector-parser": "2.2.3",
|
|
1189
|
+
"postcss-values-parser": "2.0.1",
|
|
1190
|
+
"regexp-util": "1.2.2",
|
|
1191
|
+
"remark-footnotes": "2.0.0",
|
|
1192
|
+
"remark-math": "3.0.1",
|
|
1193
|
+
"remark-parse": "8.0.3",
|
|
1194
|
+
resolve: "1.19.0",
|
|
1195
|
+
semver: "7.3.2",
|
|
1196
|
+
"string-width": "4.2.0",
|
|
1197
|
+
typescript: "4.1.2",
|
|
1198
|
+
"unicode-regex": "3.0.0",
|
|
1199
|
+
unified: "9.2.0",
|
|
1200
|
+
vnopts: "1.0.2",
|
|
1201
|
+
"yaml-unist-parser": "1.3.1"
|
|
1202
|
+
};
|
|
1203
|
+
var devDependencies = {
|
|
1204
|
+
"@babel/core": "7.12.3",
|
|
1205
|
+
"@babel/preset-env": "7.12.1",
|
|
1206
|
+
"@babel/types": "7.12.6",
|
|
1207
|
+
"@glimmer/reference": "0.66.0",
|
|
1208
|
+
"@rollup/plugin-alias": "3.1.1",
|
|
1209
|
+
"@rollup/plugin-babel": "5.2.1",
|
|
1210
|
+
"@rollup/plugin-commonjs": "16.0.0",
|
|
1211
|
+
"@rollup/plugin-json": "4.1.0",
|
|
1212
|
+
"@rollup/plugin-node-resolve": "10.0.0",
|
|
1213
|
+
"@rollup/plugin-replace": "2.3.4",
|
|
1214
|
+
"@types/estree": "0.0.45",
|
|
1215
|
+
"@types/node": "14.14.0",
|
|
1216
|
+
"@typescript-eslint/types": "4.8.1",
|
|
1217
|
+
"babel-jest": "26.6.3",
|
|
1218
|
+
"babel-loader": "8.2.1",
|
|
1219
|
+
benchmark: "2.1.4",
|
|
1220
|
+
"builtin-modules": "3.1.0",
|
|
1221
|
+
"cross-env": "7.0.2",
|
|
1222
|
+
cspell: "4.2.2",
|
|
1223
|
+
eslint: "7.13.0",
|
|
1224
|
+
"eslint-config-prettier": "6.15.0",
|
|
1225
|
+
"eslint-formatter-friendly": "7.0.0",
|
|
1226
|
+
"eslint-plugin-import": "2.22.1",
|
|
1227
|
+
"eslint-plugin-jest": "24.1.3",
|
|
1228
|
+
"eslint-plugin-prettier-internal-rules": "file:scripts/tools/eslint-plugin-prettier-internal-rules",
|
|
1229
|
+
"eslint-plugin-react": "7.21.5",
|
|
1230
|
+
"eslint-plugin-unicorn": "23.0.0",
|
|
1231
|
+
execa: "4.1.0",
|
|
1232
|
+
jest: "26.6.3",
|
|
1233
|
+
"jest-snapshot-serializer-ansi": "1.0.0",
|
|
1234
|
+
"jest-snapshot-serializer-raw": "1.1.0",
|
|
1235
|
+
"jest-watch-typeahead": "0.6.1",
|
|
1236
|
+
"npm-run-all": "4.1.5",
|
|
1237
|
+
"path-browserify": "1.0.1",
|
|
1238
|
+
prettier: "2.1.2",
|
|
1239
|
+
rimraf: "3.0.2",
|
|
1240
|
+
rollup: "2.33.3",
|
|
1241
|
+
"rollup-plugin-node-globals": "1.4.0",
|
|
1242
|
+
"rollup-plugin-terser": "7.0.2",
|
|
1243
|
+
shelljs: "0.8.4",
|
|
1244
|
+
"snapshot-diff": "0.8.1",
|
|
1245
|
+
"strip-ansi": "6.0.0",
|
|
1246
|
+
"synchronous-promise": "2.0.15",
|
|
1247
|
+
tempy: "1.0.0",
|
|
1248
|
+
"terser-webpack-plugin": "5.0.3",
|
|
1249
|
+
webpack: "5.5.1"
|
|
1250
|
+
};
|
|
1251
|
+
var scripts = {
|
|
1252
|
+
prepublishOnly: "echo \"Error: must publish from dist/\" && exit 1",
|
|
1253
|
+
"prepare-release": "yarn && yarn build && yarn test:dist",
|
|
1254
|
+
test: "jest",
|
|
1255
|
+
"test:dev-package": "cross-env INSTALL_PACKAGE=1 jest",
|
|
1256
|
+
"test:dist": "cross-env NODE_ENV=production jest",
|
|
1257
|
+
"test:dist-standalone": "cross-env NODE_ENV=production TEST_STANDALONE=1 jest",
|
|
1258
|
+
"test:integration": "jest tests_integration",
|
|
1259
|
+
"perf:repeat": "yarn && yarn build && cross-env NODE_ENV=production node ./dist/bin-prettier.js --debug-repeat ${PERF_REPEAT:-1000} --loglevel debug ${PERF_FILE:-./index.js} > /dev/null",
|
|
1260
|
+
"perf:repeat-inspect": "yarn && yarn build && cross-env NODE_ENV=production node --inspect-brk ./dist/bin-prettier.js --debug-repeat ${PERF_REPEAT:-1000} --loglevel debug ${PERF_FILE:-./index.js} > /dev/null",
|
|
1261
|
+
"perf:benchmark": "yarn && yarn build && cross-env NODE_ENV=production node ./dist/bin-prettier.js --debug-benchmark --loglevel debug ${PERF_FILE:-./index.js} > /dev/null",
|
|
1262
|
+
lint: "run-p lint:*",
|
|
1263
|
+
"lint:typecheck": "tsc",
|
|
1264
|
+
"lint:eslint": "cross-env EFF_NO_LINK_RULES=true eslint . --format friendly",
|
|
1265
|
+
"lint:changelog": "node ./scripts/lint-changelog.js",
|
|
1266
|
+
"lint:prettier": "prettier . \"!test*\" --check",
|
|
1267
|
+
"lint:dist": "eslint --no-eslintrc --no-ignore --env=es6,browser --parser-options=ecmaVersion:2018 \"dist/!(bin-prettier|index|third-party).js\"",
|
|
1268
|
+
"lint:spellcheck": "cspell \"**/*\" \".github/**/*\"",
|
|
1269
|
+
"lint:deps": "node ./scripts/check-deps.js",
|
|
1270
|
+
fix: "run-s fix:eslint fix:prettier",
|
|
1271
|
+
"fix:eslint": "yarn lint:eslint --fix",
|
|
1272
|
+
"fix:prettier": "yarn lint:prettier --write",
|
|
1273
|
+
build: "node --max-old-space-size=3072 ./scripts/build/build.js",
|
|
1274
|
+
"build-docs": "node ./scripts/build-docs.js"
|
|
1275
|
+
};
|
|
1276
|
+
var require$$3 = {
|
|
1277
|
+
name: name,
|
|
1278
|
+
version: version$1,
|
|
1279
|
+
description: description,
|
|
1280
|
+
bin: bin,
|
|
1281
|
+
repository: repository,
|
|
1282
|
+
homepage: homepage,
|
|
1283
|
+
author: author,
|
|
1284
|
+
license: license,
|
|
1285
|
+
main: main,
|
|
1286
|
+
browser: browser$1,
|
|
1287
|
+
unpkg: unpkg,
|
|
1288
|
+
engines: engines,
|
|
1289
|
+
files: files,
|
|
1290
|
+
dependencies: dependencies,
|
|
1291
|
+
devDependencies: devDependencies,
|
|
1292
|
+
scripts: scripts
|
|
1293
|
+
};
|
|
1294
|
+
|
|
1295
|
+
var lib = createCommonjsModule(function (module, exports) {
|
|
1296
|
+
|
|
1297
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1298
|
+
value: true
|
|
1299
|
+
}); // In the absence of a WeakSet or WeakMap implementation, don't break, but don't cache either.
|
|
1300
|
+
|
|
1301
|
+
function noop() {
|
|
1302
|
+
var args = [];
|
|
1303
|
+
|
|
1304
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1305
|
+
args[_i] = arguments[_i];
|
|
1306
|
+
}
|
|
1307
|
+
}
|
|
1308
|
+
|
|
1309
|
+
function createWeakMap() {
|
|
1310
|
+
if (typeof WeakMap !== 'undefined') {
|
|
1311
|
+
return new WeakMap();
|
|
1312
|
+
} else {
|
|
1313
|
+
return fakeSetOrMap();
|
|
1314
|
+
}
|
|
1315
|
+
}
|
|
1316
|
+
/**
|
|
1317
|
+
* Creates and returns a no-op implementation of a WeakMap / WeakSet that never stores anything.
|
|
1318
|
+
*/
|
|
1319
|
+
|
|
1320
|
+
|
|
1321
|
+
function fakeSetOrMap() {
|
|
1322
|
+
return {
|
|
1323
|
+
add: noop,
|
|
1324
|
+
delete: noop,
|
|
1325
|
+
get: noop,
|
|
1326
|
+
set: noop,
|
|
1327
|
+
has: function (k) {
|
|
1328
|
+
return false;
|
|
1329
|
+
}
|
|
1330
|
+
};
|
|
1331
|
+
} // Safe hasOwnProperty
|
|
1332
|
+
|
|
1333
|
+
|
|
1334
|
+
var hop = Object.prototype.hasOwnProperty;
|
|
1335
|
+
|
|
1336
|
+
var has = function (obj, prop) {
|
|
1337
|
+
return hop.call(obj, prop);
|
|
1338
|
+
}; // Copy all own enumerable properties from source to target
|
|
1339
|
+
|
|
1340
|
+
|
|
1341
|
+
function extend(target, source) {
|
|
1342
|
+
for (var prop in source) {
|
|
1343
|
+
if (has(source, prop)) {
|
|
1344
|
+
target[prop] = source[prop];
|
|
1345
|
+
}
|
|
1346
|
+
}
|
|
1347
|
+
|
|
1348
|
+
return target;
|
|
1349
|
+
}
|
|
1350
|
+
|
|
1351
|
+
var reLeadingNewline = /^[ \t]*(?:\r\n|\r|\n)/;
|
|
1352
|
+
var reTrailingNewline = /(?:\r\n|\r|\n)[ \t]*$/;
|
|
1353
|
+
var reStartsWithNewlineOrIsEmpty = /^(?:[\r\n]|$)/;
|
|
1354
|
+
var reDetectIndentation = /(?:\r\n|\r|\n)([ \t]*)(?:[^ \t\r\n]|$)/;
|
|
1355
|
+
var reOnlyWhitespaceWithAtLeastOneNewline = /^[ \t]*[\r\n][ \t\r\n]*$/;
|
|
1356
|
+
|
|
1357
|
+
function _outdentArray(strings, firstInterpolatedValueSetsIndentationLevel, options) {
|
|
1358
|
+
// If first interpolated value is a reference to outdent,
|
|
1359
|
+
// determine indentation level from the indentation of the interpolated value.
|
|
1360
|
+
var indentationLevel = 0;
|
|
1361
|
+
var match = strings[0].match(reDetectIndentation);
|
|
1362
|
+
|
|
1363
|
+
if (match) {
|
|
1364
|
+
indentationLevel = match[1].length;
|
|
1365
|
+
}
|
|
1366
|
+
|
|
1367
|
+
var reSource = "(\\r\\n|\\r|\\n).{0," + indentationLevel + "}";
|
|
1368
|
+
var reMatchIndent = new RegExp(reSource, 'g');
|
|
1369
|
+
|
|
1370
|
+
if (firstInterpolatedValueSetsIndentationLevel) {
|
|
1371
|
+
strings = strings.slice(1);
|
|
1372
|
+
}
|
|
1373
|
+
|
|
1374
|
+
var newline = options.newline,
|
|
1375
|
+
trimLeadingNewline = options.trimLeadingNewline,
|
|
1376
|
+
trimTrailingNewline = options.trimTrailingNewline;
|
|
1377
|
+
var normalizeNewlines = typeof newline === 'string';
|
|
1378
|
+
var l = strings.length;
|
|
1379
|
+
var outdentedStrings = strings.map(function (v, i) {
|
|
1380
|
+
// Remove leading indentation from all lines
|
|
1381
|
+
v = v.replace(reMatchIndent, '$1'); // Trim a leading newline from the first string
|
|
1382
|
+
|
|
1383
|
+
if (i === 0 && trimLeadingNewline) {
|
|
1384
|
+
v = v.replace(reLeadingNewline, '');
|
|
1385
|
+
} // Trim a trailing newline from the last string
|
|
1386
|
+
|
|
1387
|
+
|
|
1388
|
+
if (i === l - 1 && trimTrailingNewline) {
|
|
1389
|
+
v = v.replace(reTrailingNewline, '');
|
|
1390
|
+
} // Normalize newlines
|
|
1391
|
+
|
|
1392
|
+
|
|
1393
|
+
if (normalizeNewlines) {
|
|
1394
|
+
v = v.replace(/\r\n|\n|\r/g, function (_) {
|
|
1395
|
+
return newline;
|
|
1396
|
+
});
|
|
1397
|
+
}
|
|
1398
|
+
|
|
1399
|
+
return v;
|
|
1400
|
+
});
|
|
1401
|
+
return outdentedStrings;
|
|
1402
|
+
}
|
|
1403
|
+
|
|
1404
|
+
function concatStringsAndValues(strings, values) {
|
|
1405
|
+
var ret = '';
|
|
1406
|
+
|
|
1407
|
+
for (var i = 0, l = strings.length; i < l; i++) {
|
|
1408
|
+
ret += strings[i];
|
|
1409
|
+
|
|
1410
|
+
if (i < l - 1) {
|
|
1411
|
+
ret += values[i];
|
|
1412
|
+
}
|
|
1413
|
+
}
|
|
1414
|
+
|
|
1415
|
+
return ret;
|
|
1416
|
+
}
|
|
1417
|
+
|
|
1418
|
+
function isTemplateStringsArray(v) {
|
|
1419
|
+
return has(v, 'raw') && has(v, 'length');
|
|
1420
|
+
}
|
|
1421
|
+
/**
|
|
1422
|
+
* It is assumed that opts will not change. If this is a problem, clone your options object and pass the clone to
|
|
1423
|
+
* makeInstance
|
|
1424
|
+
* @param options
|
|
1425
|
+
* @return {outdent}
|
|
1426
|
+
*/
|
|
1427
|
+
|
|
1428
|
+
|
|
1429
|
+
function createInstance(options) {
|
|
1430
|
+
/** Cache of pre-processed template literal arrays */
|
|
1431
|
+
var arrayAutoIndentCache = createWeakMap();
|
|
1432
|
+
/**
|
|
1433
|
+
* Cache of pre-processed template literal arrays, where first interpolated value is a reference to outdent,
|
|
1434
|
+
* before interpolated values are injected.
|
|
1435
|
+
*/
|
|
1436
|
+
|
|
1437
|
+
var arrayFirstInterpSetsIndentCache = createWeakMap();
|
|
1438
|
+
|
|
1439
|
+
function outdent(stringsOrOptions) {
|
|
1440
|
+
var values = [];
|
|
1441
|
+
|
|
1442
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
1443
|
+
values[_i - 1] = arguments[_i];
|
|
1444
|
+
}
|
|
1445
|
+
/* tslint:enable:no-shadowed-variable */
|
|
1446
|
+
|
|
1447
|
+
|
|
1448
|
+
if (isTemplateStringsArray(stringsOrOptions)) {
|
|
1449
|
+
var strings = stringsOrOptions; // Is first interpolated value a reference to outdent, alone on its own line, without any preceding non-whitespace?
|
|
1450
|
+
|
|
1451
|
+
var firstInterpolatedValueSetsIndentationLevel = (values[0] === outdent || values[0] === defaultOutdent) && reOnlyWhitespaceWithAtLeastOneNewline.test(strings[0]) && reStartsWithNewlineOrIsEmpty.test(strings[1]); // Perform outdentation
|
|
1452
|
+
|
|
1453
|
+
var cache = firstInterpolatedValueSetsIndentationLevel ? arrayFirstInterpSetsIndentCache : arrayAutoIndentCache;
|
|
1454
|
+
var renderedArray = cache.get(strings);
|
|
1455
|
+
|
|
1456
|
+
if (!renderedArray) {
|
|
1457
|
+
renderedArray = _outdentArray(strings, firstInterpolatedValueSetsIndentationLevel, options);
|
|
1458
|
+
cache.set(strings, renderedArray);
|
|
1459
|
+
}
|
|
1460
|
+
/** If no interpolated values, skip concatenation step */
|
|
1461
|
+
|
|
1462
|
+
|
|
1463
|
+
if (values.length === 0) {
|
|
1464
|
+
return renderedArray[0];
|
|
1465
|
+
}
|
|
1466
|
+
/** Concatenate string literals with interpolated values */
|
|
1467
|
+
|
|
1468
|
+
|
|
1469
|
+
var rendered = concatStringsAndValues(renderedArray, firstInterpolatedValueSetsIndentationLevel ? values.slice(1) : values);
|
|
1470
|
+
return rendered;
|
|
1471
|
+
} else {
|
|
1472
|
+
// Create and return a new instance of outdent with the given options
|
|
1473
|
+
return createInstance(extend(extend({}, options), stringsOrOptions || {}));
|
|
1474
|
+
}
|
|
1475
|
+
}
|
|
1476
|
+
|
|
1477
|
+
var fullOutdent = extend(outdent, {
|
|
1478
|
+
string: function (str) {
|
|
1479
|
+
return _outdentArray([str], false, options)[0];
|
|
1480
|
+
}
|
|
1481
|
+
});
|
|
1482
|
+
return fullOutdent;
|
|
1483
|
+
}
|
|
1484
|
+
|
|
1485
|
+
var defaultOutdent = createInstance({
|
|
1486
|
+
trimLeadingNewline: true,
|
|
1487
|
+
trimTrailingNewline: true
|
|
1488
|
+
});
|
|
1489
|
+
exports.outdent = defaultOutdent; // Named exports. Simple and preferred.
|
|
1490
|
+
// import outdent from 'outdent';
|
|
1491
|
+
|
|
1492
|
+
exports.default = defaultOutdent;
|
|
1493
|
+
|
|
1494
|
+
{
|
|
1495
|
+
// In webpack harmony-modules environments, module.exports is read-only,
|
|
1496
|
+
// so we fail gracefully.
|
|
1497
|
+
try {
|
|
1498
|
+
module.exports = defaultOutdent;
|
|
1499
|
+
Object.defineProperty(defaultOutdent, '__esModule', {
|
|
1500
|
+
value: true
|
|
1501
|
+
});
|
|
1502
|
+
defaultOutdent.default = defaultOutdent;
|
|
1503
|
+
defaultOutdent.outdent = defaultOutdent;
|
|
1504
|
+
} catch (e) {}
|
|
1505
|
+
}
|
|
1506
|
+
});
|
|
345
1507
|
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
1508
|
+
function _templateObject6() {
|
|
1509
|
+
const data = _taggedTemplateLiteral(["\n Require either '@prettier' or '@format' to be present in the file's first docblock comment\n in order for it to be formatted.\n "]);
|
|
1510
|
+
|
|
1511
|
+
_templateObject6 = function () {
|
|
1512
|
+
return data;
|
|
1513
|
+
};
|
|
1514
|
+
|
|
1515
|
+
return data;
|
|
1516
|
+
}
|
|
1517
|
+
|
|
1518
|
+
function _templateObject5() {
|
|
1519
|
+
const data = _taggedTemplateLiteral(["\n Format code starting at a given character offset.\n The range will extend backwards to the start of the first line containing the selected statement.\n This option cannot be used with --cursor-offset.\n "]);
|
|
1520
|
+
|
|
1521
|
+
_templateObject5 = function () {
|
|
1522
|
+
return data;
|
|
1523
|
+
};
|
|
1524
|
+
|
|
1525
|
+
return data;
|
|
1526
|
+
}
|
|
1527
|
+
|
|
1528
|
+
function _templateObject4() {
|
|
1529
|
+
const data = _taggedTemplateLiteral(["\n Format code ending at a given character offset (exclusive).\n The range will extend forwards to the end of the selected statement.\n This option cannot be used with --cursor-offset.\n "]);
|
|
1530
|
+
|
|
1531
|
+
_templateObject4 = function () {
|
|
1532
|
+
return data;
|
|
1533
|
+
};
|
|
1534
|
+
|
|
1535
|
+
return data;
|
|
1536
|
+
}
|
|
1537
|
+
|
|
1538
|
+
function _templateObject3() {
|
|
1539
|
+
const data = _taggedTemplateLiteral(["\n Custom directory that contains prettier plugins in node_modules subdirectory.\n Overrides default behavior when plugins are searched relatively to the location of Prettier.\n Multiple values are accepted.\n "]);
|
|
1540
|
+
|
|
1541
|
+
_templateObject3 = function () {
|
|
1542
|
+
return data;
|
|
1543
|
+
};
|
|
1544
|
+
|
|
1545
|
+
return data;
|
|
1546
|
+
}
|
|
1547
|
+
|
|
1548
|
+
function _templateObject2() {
|
|
1549
|
+
const data = _taggedTemplateLiteral(["\n Maintain existing\n (mixed values within one file are normalised by looking at what's used after the first line)\n "]);
|
|
1550
|
+
|
|
1551
|
+
_templateObject2 = function () {
|
|
1552
|
+
return data;
|
|
1553
|
+
};
|
|
1554
|
+
|
|
1555
|
+
return data;
|
|
1556
|
+
}
|
|
1557
|
+
|
|
1558
|
+
function _templateObject() {
|
|
1559
|
+
const data = _taggedTemplateLiteral(["\n Print (to stderr) where a cursor at the given position would move to after formatting.\n This option cannot be used with --range-start and --range-end.\n "]);
|
|
1560
|
+
|
|
1561
|
+
_templateObject = function () {
|
|
1562
|
+
return data;
|
|
1563
|
+
};
|
|
1564
|
+
|
|
1565
|
+
return data;
|
|
1566
|
+
}
|
|
1567
|
+
|
|
1568
|
+
const {
|
|
1569
|
+
outdent
|
|
1570
|
+
} = lib;
|
|
1571
|
+
const CATEGORY_CONFIG = "Config";
|
|
1572
|
+
const CATEGORY_EDITOR = "Editor";
|
|
1573
|
+
const CATEGORY_FORMAT = "Format";
|
|
1574
|
+
const CATEGORY_OTHER = "Other";
|
|
1575
|
+
const CATEGORY_OUTPUT = "Output";
|
|
1576
|
+
const CATEGORY_GLOBAL = "Global";
|
|
1577
|
+
const CATEGORY_SPECIAL = "Special";
|
|
1578
|
+
/**
|
|
1579
|
+
* @typedef {Object} OptionInfo
|
|
1580
|
+
* @property {string} [since] - available since version
|
|
1581
|
+
* @property {string} category
|
|
1582
|
+
* @property {'int' | 'boolean' | 'choice' | 'path'} type
|
|
1583
|
+
* @property {boolean} [array] - indicate it's an array of the specified type
|
|
1584
|
+
* @property {OptionValueInfo} [default]
|
|
1585
|
+
* @property {OptionRangeInfo} [range] - for type int
|
|
1586
|
+
* @property {string} description
|
|
1587
|
+
* @property {string} [deprecated] - deprecated since version
|
|
1588
|
+
* @property {OptionRedirectInfo} [redirect] - redirect deprecated option
|
|
1589
|
+
* @property {(value: any) => boolean} [exception]
|
|
1590
|
+
* @property {OptionChoiceInfo[]} [choices] - for type choice
|
|
1591
|
+
* @property {string} [cliName]
|
|
1592
|
+
* @property {string} [cliCategory]
|
|
1593
|
+
* @property {string} [cliDescription]
|
|
1594
|
+
*
|
|
1595
|
+
* @typedef {number | boolean | string} OptionValue
|
|
1596
|
+
* @typedef {OptionValue | [{ value: OptionValue[] }] | Array<{ since: string, value: OptionValue}>} OptionValueInfo
|
|
1597
|
+
*
|
|
1598
|
+
* @typedef {Object} OptionRedirectInfo
|
|
1599
|
+
* @property {string} option
|
|
1600
|
+
* @property {OptionValue} value
|
|
1601
|
+
*
|
|
1602
|
+
* @typedef {Object} OptionRangeInfo
|
|
1603
|
+
* @property {number} start - recommended range start
|
|
1604
|
+
* @property {number} end - recommended range end
|
|
1605
|
+
* @property {number} step - recommended range step
|
|
1606
|
+
*
|
|
1607
|
+
* @typedef {Object} OptionChoiceInfo
|
|
1608
|
+
* @property {boolean | string} value - boolean for the option that is originally boolean type
|
|
1609
|
+
* @property {string} description
|
|
1610
|
+
* @property {string} [since] - undefined if available since the first version of the option
|
|
1611
|
+
* @property {string} [deprecated] - deprecated since version
|
|
1612
|
+
* @property {OptionValueInfo} [redirect] - redirect deprecated value
|
|
1613
|
+
*/
|
|
1614
|
+
|
|
1615
|
+
/** @type {{ [name: string]: OptionInfo }} */
|
|
1616
|
+
|
|
1617
|
+
const options = {
|
|
1618
|
+
cursorOffset: {
|
|
1619
|
+
since: "1.4.0",
|
|
1620
|
+
category: CATEGORY_SPECIAL,
|
|
1621
|
+
type: "int",
|
|
1622
|
+
default: -1,
|
|
1623
|
+
range: {
|
|
1624
|
+
start: -1,
|
|
1625
|
+
end: Infinity,
|
|
1626
|
+
step: 1
|
|
1627
|
+
},
|
|
1628
|
+
description: outdent(_templateObject()),
|
|
1629
|
+
cliCategory: CATEGORY_EDITOR
|
|
1630
|
+
},
|
|
1631
|
+
endOfLine: {
|
|
1632
|
+
since: "1.15.0",
|
|
1633
|
+
category: CATEGORY_GLOBAL,
|
|
1634
|
+
type: "choice",
|
|
1635
|
+
default: [{
|
|
1636
|
+
since: "1.15.0",
|
|
1637
|
+
value: "auto"
|
|
1638
|
+
}, {
|
|
1639
|
+
since: "2.0.0",
|
|
1640
|
+
value: "lf"
|
|
1641
|
+
}],
|
|
1642
|
+
description: "Which end of line characters to apply.",
|
|
1643
|
+
choices: [{
|
|
1644
|
+
value: "lf",
|
|
1645
|
+
description: "Line Feed only (\\n), common on Linux and macOS as well as inside git repos"
|
|
1646
|
+
}, {
|
|
1647
|
+
value: "crlf",
|
|
1648
|
+
description: "Carriage Return + Line Feed characters (\\r\\n), common on Windows"
|
|
1649
|
+
}, {
|
|
1650
|
+
value: "cr",
|
|
1651
|
+
description: "Carriage Return character only (\\r), used very rarely"
|
|
1652
|
+
}, {
|
|
1653
|
+
value: "auto",
|
|
1654
|
+
description: outdent(_templateObject2())
|
|
1655
|
+
}]
|
|
1656
|
+
},
|
|
1657
|
+
filepath: {
|
|
1658
|
+
since: "1.4.0",
|
|
1659
|
+
category: CATEGORY_SPECIAL,
|
|
1660
|
+
type: "path",
|
|
1661
|
+
description: "Specify the input filepath. This will be used to do parser inference.",
|
|
1662
|
+
cliName: "stdin-filepath",
|
|
1663
|
+
cliCategory: CATEGORY_OTHER,
|
|
1664
|
+
cliDescription: "Path to the file to pretend that stdin comes from."
|
|
1665
|
+
},
|
|
1666
|
+
insertPragma: {
|
|
1667
|
+
since: "1.8.0",
|
|
1668
|
+
category: CATEGORY_SPECIAL,
|
|
1669
|
+
type: "boolean",
|
|
1670
|
+
default: false,
|
|
1671
|
+
description: "Insert @format pragma into file's first docblock comment.",
|
|
1672
|
+
cliCategory: CATEGORY_OTHER
|
|
1673
|
+
},
|
|
1674
|
+
parser: {
|
|
1675
|
+
since: "0.0.10",
|
|
1676
|
+
category: CATEGORY_GLOBAL,
|
|
1677
|
+
type: "choice",
|
|
1678
|
+
default: [{
|
|
1679
|
+
since: "0.0.10",
|
|
1680
|
+
value: "babylon"
|
|
1681
|
+
}, {
|
|
1682
|
+
since: "1.13.0",
|
|
1683
|
+
value: undefined
|
|
1684
|
+
}],
|
|
1685
|
+
description: "Which parser to use.",
|
|
1686
|
+
exception: value => typeof value === "string" || typeof value === "function",
|
|
1687
|
+
choices: [{
|
|
1688
|
+
value: "flow",
|
|
1689
|
+
description: "Flow"
|
|
1690
|
+
}, {
|
|
1691
|
+
value: "babel",
|
|
1692
|
+
since: "1.16.0",
|
|
1693
|
+
description: "JavaScript"
|
|
1694
|
+
}, {
|
|
1695
|
+
value: "babel-flow",
|
|
1696
|
+
since: "1.16.0",
|
|
1697
|
+
description: "Flow"
|
|
1698
|
+
}, {
|
|
1699
|
+
value: "babel-ts",
|
|
1700
|
+
since: "2.0.0",
|
|
1701
|
+
description: "TypeScript"
|
|
1702
|
+
}, {
|
|
1703
|
+
value: "typescript",
|
|
1704
|
+
since: "1.4.0",
|
|
1705
|
+
description: "TypeScript"
|
|
1706
|
+
}, {
|
|
1707
|
+
value: "espree",
|
|
1708
|
+
since: "2.2.0",
|
|
1709
|
+
description: "JavaScript"
|
|
1710
|
+
}, {
|
|
1711
|
+
value: "meriyah",
|
|
1712
|
+
since: "2.2.0",
|
|
1713
|
+
description: "JavaScript"
|
|
1714
|
+
}, {
|
|
1715
|
+
value: "css",
|
|
1716
|
+
since: "1.7.1",
|
|
1717
|
+
description: "CSS"
|
|
1718
|
+
}, {
|
|
1719
|
+
value: "less",
|
|
1720
|
+
since: "1.7.1",
|
|
1721
|
+
description: "Less"
|
|
1722
|
+
}, {
|
|
1723
|
+
value: "scss",
|
|
1724
|
+
since: "1.7.1",
|
|
1725
|
+
description: "SCSS"
|
|
1726
|
+
}, {
|
|
1727
|
+
value: "json",
|
|
1728
|
+
since: "1.5.0",
|
|
1729
|
+
description: "JSON"
|
|
1730
|
+
}, {
|
|
1731
|
+
value: "json5",
|
|
1732
|
+
since: "1.13.0",
|
|
1733
|
+
description: "JSON5"
|
|
1734
|
+
}, {
|
|
1735
|
+
value: "json-stringify",
|
|
1736
|
+
since: "1.13.0",
|
|
1737
|
+
description: "JSON.stringify"
|
|
1738
|
+
}, {
|
|
1739
|
+
value: "graphql",
|
|
1740
|
+
since: "1.5.0",
|
|
1741
|
+
description: "GraphQL"
|
|
1742
|
+
}, {
|
|
1743
|
+
value: "markdown",
|
|
1744
|
+
since: "1.8.0",
|
|
1745
|
+
description: "Markdown"
|
|
1746
|
+
}, {
|
|
1747
|
+
value: "mdx",
|
|
1748
|
+
since: "1.15.0",
|
|
1749
|
+
description: "MDX"
|
|
1750
|
+
}, {
|
|
1751
|
+
value: "vue",
|
|
1752
|
+
since: "1.10.0",
|
|
1753
|
+
description: "Vue"
|
|
1754
|
+
}, {
|
|
1755
|
+
value: "yaml",
|
|
1756
|
+
since: "1.14.0",
|
|
1757
|
+
description: "YAML"
|
|
1758
|
+
}, {
|
|
1759
|
+
value: "glimmer",
|
|
1760
|
+
since: null,
|
|
1761
|
+
description: "Handlebars"
|
|
1762
|
+
}, {
|
|
1763
|
+
value: "html",
|
|
1764
|
+
since: "1.15.0",
|
|
1765
|
+
description: "HTML"
|
|
1766
|
+
}, {
|
|
1767
|
+
value: "angular",
|
|
1768
|
+
since: "1.15.0",
|
|
1769
|
+
description: "Angular"
|
|
1770
|
+
}, {
|
|
1771
|
+
value: "lwc",
|
|
1772
|
+
since: "1.17.0",
|
|
1773
|
+
description: "Lightning Web Components"
|
|
1774
|
+
}]
|
|
1775
|
+
},
|
|
1776
|
+
plugins: {
|
|
1777
|
+
since: "1.10.0",
|
|
1778
|
+
type: "path",
|
|
1779
|
+
array: true,
|
|
1780
|
+
default: [{
|
|
1781
|
+
value: []
|
|
1782
|
+
}],
|
|
1783
|
+
category: CATEGORY_GLOBAL,
|
|
1784
|
+
description: "Add a plugin. Multiple plugins can be passed as separate `--plugin`s.",
|
|
1785
|
+
exception: value => typeof value === "string" || typeof value === "object",
|
|
1786
|
+
cliName: "plugin",
|
|
1787
|
+
cliCategory: CATEGORY_CONFIG
|
|
1788
|
+
},
|
|
1789
|
+
pluginSearchDirs: {
|
|
1790
|
+
since: "1.13.0",
|
|
1791
|
+
type: "path",
|
|
1792
|
+
array: true,
|
|
1793
|
+
default: [{
|
|
1794
|
+
value: []
|
|
1795
|
+
}],
|
|
1796
|
+
category: CATEGORY_GLOBAL,
|
|
1797
|
+
description: outdent(_templateObject3()),
|
|
1798
|
+
exception: value => typeof value === "string" || typeof value === "object",
|
|
1799
|
+
cliName: "plugin-search-dir",
|
|
1800
|
+
cliCategory: CATEGORY_CONFIG
|
|
1801
|
+
},
|
|
1802
|
+
printWidth: {
|
|
1803
|
+
since: "0.0.0",
|
|
1804
|
+
category: CATEGORY_GLOBAL,
|
|
1805
|
+
type: "int",
|
|
1806
|
+
default: 80,
|
|
1807
|
+
description: "The line length where Prettier will try wrap.",
|
|
1808
|
+
range: {
|
|
1809
|
+
start: 0,
|
|
1810
|
+
end: Infinity,
|
|
1811
|
+
step: 1
|
|
1812
|
+
}
|
|
1813
|
+
},
|
|
1814
|
+
rangeEnd: {
|
|
1815
|
+
since: "1.4.0",
|
|
1816
|
+
category: CATEGORY_SPECIAL,
|
|
1817
|
+
type: "int",
|
|
1818
|
+
default: Infinity,
|
|
1819
|
+
range: {
|
|
1820
|
+
start: 0,
|
|
1821
|
+
end: Infinity,
|
|
1822
|
+
step: 1
|
|
1823
|
+
},
|
|
1824
|
+
description: outdent(_templateObject4()),
|
|
1825
|
+
cliCategory: CATEGORY_EDITOR
|
|
1826
|
+
},
|
|
1827
|
+
rangeStart: {
|
|
1828
|
+
since: "1.4.0",
|
|
1829
|
+
category: CATEGORY_SPECIAL,
|
|
1830
|
+
type: "int",
|
|
1831
|
+
default: 0,
|
|
1832
|
+
range: {
|
|
1833
|
+
start: 0,
|
|
1834
|
+
end: Infinity,
|
|
1835
|
+
step: 1
|
|
1836
|
+
},
|
|
1837
|
+
description: outdent(_templateObject5()),
|
|
1838
|
+
cliCategory: CATEGORY_EDITOR
|
|
1839
|
+
},
|
|
1840
|
+
requirePragma: {
|
|
1841
|
+
since: "1.7.0",
|
|
1842
|
+
category: CATEGORY_SPECIAL,
|
|
1843
|
+
type: "boolean",
|
|
1844
|
+
default: false,
|
|
1845
|
+
description: outdent(_templateObject6()),
|
|
1846
|
+
cliCategory: CATEGORY_OTHER
|
|
1847
|
+
},
|
|
1848
|
+
tabWidth: {
|
|
1849
|
+
type: "int",
|
|
1850
|
+
category: CATEGORY_GLOBAL,
|
|
1851
|
+
default: 2,
|
|
1852
|
+
description: "Number of spaces per indentation level.",
|
|
1853
|
+
range: {
|
|
1854
|
+
start: 0,
|
|
1855
|
+
end: Infinity,
|
|
1856
|
+
step: 1
|
|
1857
|
+
}
|
|
1858
|
+
},
|
|
1859
|
+
useTabs: {
|
|
1860
|
+
since: "1.0.0",
|
|
1861
|
+
category: CATEGORY_GLOBAL,
|
|
1862
|
+
type: "boolean",
|
|
1863
|
+
default: false,
|
|
1864
|
+
description: "Indent with tabs instead of spaces."
|
|
1865
|
+
},
|
|
1866
|
+
embeddedLanguageFormatting: {
|
|
1867
|
+
since: "2.1.0",
|
|
1868
|
+
category: CATEGORY_GLOBAL,
|
|
1869
|
+
type: "choice",
|
|
1870
|
+
default: [{
|
|
1871
|
+
since: "2.1.0",
|
|
1872
|
+
value: "auto"
|
|
1873
|
+
}],
|
|
1874
|
+
description: "Control how Prettier formats quoted code embedded in the file.",
|
|
1875
|
+
choices: [{
|
|
1876
|
+
value: "auto",
|
|
1877
|
+
description: "Format embedded code if Prettier can automatically identify it."
|
|
1878
|
+
}, {
|
|
1879
|
+
value: "off",
|
|
1880
|
+
description: "Never automatically format embedded code."
|
|
1881
|
+
}]
|
|
349
1882
|
}
|
|
1883
|
+
};
|
|
1884
|
+
var coreOptions = {
|
|
1885
|
+
CATEGORY_CONFIG,
|
|
1886
|
+
CATEGORY_EDITOR,
|
|
1887
|
+
CATEGORY_FORMAT,
|
|
1888
|
+
CATEGORY_OTHER,
|
|
1889
|
+
CATEGORY_OUTPUT,
|
|
1890
|
+
CATEGORY_GLOBAL,
|
|
1891
|
+
CATEGORY_SPECIAL,
|
|
1892
|
+
options
|
|
1893
|
+
};
|
|
350
1894
|
|
|
351
|
-
|
|
1895
|
+
const semver$1 = {
|
|
1896
|
+
compare: compare_1,
|
|
1897
|
+
lt: lt_1,
|
|
1898
|
+
gte: gte_1
|
|
352
1899
|
};
|
|
1900
|
+
const currentVersion = require$$3.version;
|
|
1901
|
+
const coreOptions$1 = coreOptions.options;
|
|
1902
|
+
/**
|
|
1903
|
+
* Strings in `plugins` and `pluginSearchDirs` are handled by a wrapped version
|
|
1904
|
+
* of this function created by `withPlugins`. Don't pass them here directly.
|
|
1905
|
+
* @param {object} param0
|
|
1906
|
+
* @param {(string | object)[]=} param0.plugins Strings are resolved by `withPlugins`.
|
|
1907
|
+
* @param {string[]=} param0.pluginSearchDirs Added by `withPlugins`.
|
|
1908
|
+
* @param {boolean=} param0.showUnreleased
|
|
1909
|
+
* @param {boolean=} param0.showDeprecated
|
|
1910
|
+
* @param {boolean=} param0.showInternal
|
|
1911
|
+
*/
|
|
353
1912
|
|
|
354
|
-
|
|
1913
|
+
function getSupportInfo({
|
|
1914
|
+
plugins = [],
|
|
1915
|
+
showUnreleased = false,
|
|
1916
|
+
showDeprecated = false,
|
|
1917
|
+
showInternal = false
|
|
1918
|
+
} = {}) {
|
|
1919
|
+
// pre-release version is smaller than the normal version in semver,
|
|
1920
|
+
// we need to treat it as the normal one so as to test new features.
|
|
1921
|
+
const version = currentVersion.split("-", 1)[0];
|
|
1922
|
+
const languages = plugins.reduce((all, plugin) => all.concat(plugin.languages || []), []).filter(filterSince);
|
|
1923
|
+
const options = arrayify(Object.assign({}, ...plugins.map(({
|
|
1924
|
+
options
|
|
1925
|
+
}) => options), coreOptions$1), "name").filter(option => filterSince(option) && filterDeprecated(option)).sort((a, b) => a.name === b.name ? 0 : a.name < b.name ? -1 : 1).map(mapInternal).map(option => {
|
|
1926
|
+
option = Object.assign({}, option);
|
|
1927
|
+
|
|
1928
|
+
if (Array.isArray(option.default)) {
|
|
1929
|
+
option.default = option.default.length === 1 ? option.default[0].value : option.default.filter(filterSince).sort((info1, info2) => semver$1.compare(info2.since, info1.since))[0].value;
|
|
1930
|
+
}
|
|
355
1931
|
|
|
356
|
-
|
|
1932
|
+
if (Array.isArray(option.choices)) {
|
|
1933
|
+
option.choices = option.choices.filter(option => filterSince(option) && filterDeprecated(option));
|
|
1934
|
+
|
|
1935
|
+
if (option.name === "parser") {
|
|
1936
|
+
collectParsersFromLanguages(option, languages, plugins);
|
|
1937
|
+
}
|
|
1938
|
+
}
|
|
357
1939
|
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
1940
|
+
const pluginDefaults = plugins.filter(plugin => plugin.defaultOptions && plugin.defaultOptions[option.name] !== undefined).reduce((reduced, plugin) => {
|
|
1941
|
+
reduced[plugin.name] = plugin.defaultOptions[option.name];
|
|
1942
|
+
return reduced;
|
|
1943
|
+
}, {});
|
|
1944
|
+
return Object.assign({}, option, {
|
|
1945
|
+
pluginDefaults
|
|
1946
|
+
});
|
|
1947
|
+
});
|
|
1948
|
+
return {
|
|
1949
|
+
languages,
|
|
1950
|
+
options
|
|
1951
|
+
};
|
|
1952
|
+
|
|
1953
|
+
function filterSince(object) {
|
|
1954
|
+
return showUnreleased || !("since" in object) || object.since && semver$1.gte(version, object.since);
|
|
361
1955
|
}
|
|
362
1956
|
|
|
363
|
-
|
|
1957
|
+
function filterDeprecated(object) {
|
|
1958
|
+
return showDeprecated || !("deprecated" in object) || object.deprecated && semver$1.lt(version, object.deprecated);
|
|
1959
|
+
}
|
|
1960
|
+
|
|
1961
|
+
function mapInternal(object) {
|
|
1962
|
+
if (showInternal) {
|
|
1963
|
+
return object;
|
|
1964
|
+
}
|
|
1965
|
+
|
|
1966
|
+
const newObject = _objectWithoutPropertiesLoose(object, ["cliName", "cliCategory", "cliDescription"]);
|
|
1967
|
+
|
|
1968
|
+
return newObject;
|
|
1969
|
+
}
|
|
1970
|
+
}
|
|
1971
|
+
|
|
1972
|
+
function collectParsersFromLanguages(option, languages, plugins) {
|
|
1973
|
+
const existingValues = new Set(option.choices.map(choice => choice.value));
|
|
1974
|
+
|
|
1975
|
+
for (const language of languages) {
|
|
1976
|
+
if (language.parsers) {
|
|
1977
|
+
for (const value of language.parsers) {
|
|
1978
|
+
if (!existingValues.has(value)) {
|
|
1979
|
+
existingValues.add(value);
|
|
1980
|
+
const plugin = plugins.find(plugin => plugin.parsers && plugin.parsers[value]);
|
|
1981
|
+
let description = language.name;
|
|
1982
|
+
|
|
1983
|
+
if (plugin && plugin.name) {
|
|
1984
|
+
description += " (plugin: ".concat(plugin.name, ")");
|
|
1985
|
+
}
|
|
1986
|
+
|
|
1987
|
+
option.choices.push({
|
|
1988
|
+
value,
|
|
1989
|
+
description
|
|
1990
|
+
});
|
|
1991
|
+
}
|
|
1992
|
+
}
|
|
1993
|
+
}
|
|
1994
|
+
}
|
|
364
1995
|
}
|
|
1996
|
+
|
|
1997
|
+
var support = {
|
|
1998
|
+
getSupportInfo
|
|
1999
|
+
};
|
|
2000
|
+
|
|
2001
|
+
const {
|
|
2002
|
+
getSupportInfo: getSupportInfo$1
|
|
2003
|
+
} = support;
|
|
2004
|
+
const notAsciiRegex = /[^\x20-\x7F]/;
|
|
2005
|
+
|
|
2006
|
+
const getPenultimate = arr => arr[arr.length - 2];
|
|
365
2007
|
/**
|
|
366
2008
|
* @typedef {{backwards?: boolean}} SkipOptions
|
|
367
2009
|
*/
|
|
@@ -377,6 +2019,8 @@
|
|
|
377
2019
|
const backwards = opts && opts.backwards; // Allow `skip` functions to be threaded together without having
|
|
378
2020
|
// to check for failures (did someone say monads?).
|
|
379
2021
|
|
|
2022
|
+
/* istanbul ignore next */
|
|
2023
|
+
|
|
380
2024
|
if (index === false) {
|
|
381
2025
|
return false;
|
|
382
2026
|
}
|
|
@@ -431,7 +2075,7 @@
|
|
|
431
2075
|
* @type {(text: string, index: number | false, opts?: SkipOptions) => number | false}
|
|
432
2076
|
*/
|
|
433
2077
|
|
|
434
|
-
const skipEverythingButNewLine = skip(/[^\r
|
|
2078
|
+
const skipEverythingButNewLine = skip(/[^\n\r]/);
|
|
435
2079
|
/**
|
|
436
2080
|
* @param {string} text
|
|
437
2081
|
* @param {number | false} index
|
|
@@ -439,6 +2083,7 @@
|
|
|
439
2083
|
*/
|
|
440
2084
|
|
|
441
2085
|
function skipInlineComment(text, index) {
|
|
2086
|
+
/* istanbul ignore next */
|
|
442
2087
|
if (index === false) {
|
|
443
2088
|
return false;
|
|
444
2089
|
}
|
|
@@ -461,6 +2106,7 @@
|
|
|
461
2106
|
|
|
462
2107
|
|
|
463
2108
|
function skipTrailingComment(text, index) {
|
|
2109
|
+
/* istanbul ignore next */
|
|
464
2110
|
if (index === false) {
|
|
465
2111
|
return false;
|
|
466
2112
|
}
|
|
@@ -492,6 +2138,9 @@
|
|
|
492
2138
|
const atIndex = text.charAt(index);
|
|
493
2139
|
|
|
494
2140
|
if (backwards) {
|
|
2141
|
+
// We already replace `\r\n` with `\n` before parsing
|
|
2142
|
+
|
|
2143
|
+
/* istanbul ignore next */
|
|
495
2144
|
if (text.charAt(index - 1) === "\r" && atIndex === "\n") {
|
|
496
2145
|
return index - 2;
|
|
497
2146
|
}
|
|
@@ -500,6 +2149,9 @@
|
|
|
500
2149
|
return index - 1;
|
|
501
2150
|
}
|
|
502
2151
|
} else {
|
|
2152
|
+
// We already replace `\r\n` with `\n` before parsing
|
|
2153
|
+
|
|
2154
|
+
/* istanbul ignore next */
|
|
503
2155
|
if (atIndex === "\r" && text.charAt(index + 1) === "\n") {
|
|
504
2156
|
return index + 2;
|
|
505
2157
|
}
|
|
@@ -654,7 +2306,10 @@
|
|
|
654
2306
|
function getNextNonSpaceNonCommentCharacter(text, node, locEnd) {
|
|
655
2307
|
return text.charAt( // @ts-ignore => TBD: can return false, should we define a fallback?
|
|
656
2308
|
getNextNonSpaceNonCommentCharacterIndex(text, node, locEnd));
|
|
657
|
-
}
|
|
2309
|
+
} // Not using, but it's public utils
|
|
2310
|
+
|
|
2311
|
+
/* istanbul ignore next */
|
|
2312
|
+
|
|
658
2313
|
/**
|
|
659
2314
|
* @param {string} text
|
|
660
2315
|
* @param {number} index
|
|
@@ -668,163 +2323,6 @@
|
|
|
668
2323
|
const idx = skipSpaces(text, opts.backwards ? index - 1 : index, opts);
|
|
669
2324
|
return idx !== index;
|
|
670
2325
|
}
|
|
671
|
-
/**
|
|
672
|
-
* @param {{range?: [number, number], start?: number}} node
|
|
673
|
-
* @param {number} index
|
|
674
|
-
*/
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
function setLocStart(node, index) {
|
|
678
|
-
if (node.range) {
|
|
679
|
-
node.range[0] = index;
|
|
680
|
-
} else {
|
|
681
|
-
node.start = index;
|
|
682
|
-
}
|
|
683
|
-
}
|
|
684
|
-
/**
|
|
685
|
-
* @param {{range?: [number, number], end?: number}} node
|
|
686
|
-
* @param {number} index
|
|
687
|
-
*/
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
function setLocEnd(node, index) {
|
|
691
|
-
if (node.range) {
|
|
692
|
-
node.range[1] = index;
|
|
693
|
-
} else {
|
|
694
|
-
node.end = index;
|
|
695
|
-
}
|
|
696
|
-
}
|
|
697
|
-
|
|
698
|
-
const PRECEDENCE = {};
|
|
699
|
-
[["|>"], ["??"], ["||"], ["&&"], ["|"], ["^"], ["&"], ["==", "===", "!=", "!=="], ["<", ">", "<=", ">=", "in", "instanceof"], [">>", "<<", ">>>"], ["+", "-"], ["*", "/", "%"], ["**"]].forEach((tier, i) => {
|
|
700
|
-
tier.forEach(op => {
|
|
701
|
-
PRECEDENCE[op] = i;
|
|
702
|
-
});
|
|
703
|
-
});
|
|
704
|
-
|
|
705
|
-
function getPrecedence(op) {
|
|
706
|
-
return PRECEDENCE[op];
|
|
707
|
-
}
|
|
708
|
-
|
|
709
|
-
const equalityOperators = {
|
|
710
|
-
"==": true,
|
|
711
|
-
"!=": true,
|
|
712
|
-
"===": true,
|
|
713
|
-
"!==": true
|
|
714
|
-
};
|
|
715
|
-
const multiplicativeOperators = {
|
|
716
|
-
"*": true,
|
|
717
|
-
"/": true,
|
|
718
|
-
"%": true
|
|
719
|
-
};
|
|
720
|
-
const bitshiftOperators = {
|
|
721
|
-
">>": true,
|
|
722
|
-
">>>": true,
|
|
723
|
-
"<<": true
|
|
724
|
-
};
|
|
725
|
-
|
|
726
|
-
function shouldFlatten(parentOp, nodeOp) {
|
|
727
|
-
if (getPrecedence(nodeOp) !== getPrecedence(parentOp)) {
|
|
728
|
-
return false;
|
|
729
|
-
} // ** is right-associative
|
|
730
|
-
// x ** y ** z --> x ** (y ** z)
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
if (parentOp === "**") {
|
|
734
|
-
return false;
|
|
735
|
-
} // x == y == z --> (x == y) == z
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
if (equalityOperators[parentOp] && equalityOperators[nodeOp]) {
|
|
739
|
-
return false;
|
|
740
|
-
} // x * y % z --> (x * y) % z
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
if (nodeOp === "%" && multiplicativeOperators[parentOp] || parentOp === "%" && multiplicativeOperators[nodeOp]) {
|
|
744
|
-
return false;
|
|
745
|
-
} // x * y / z --> (x * y) / z
|
|
746
|
-
// x / y * z --> (x / y) * z
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
if (nodeOp !== parentOp && multiplicativeOperators[nodeOp] && multiplicativeOperators[parentOp]) {
|
|
750
|
-
return false;
|
|
751
|
-
} // x << y << z --> (x << y) << z
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
if (bitshiftOperators[parentOp] && bitshiftOperators[nodeOp]) {
|
|
755
|
-
return false;
|
|
756
|
-
}
|
|
757
|
-
|
|
758
|
-
return true;
|
|
759
|
-
}
|
|
760
|
-
|
|
761
|
-
function isBitwiseOperator(operator) {
|
|
762
|
-
return !!bitshiftOperators[operator] || operator === "|" || operator === "^" || operator === "&";
|
|
763
|
-
} // Tests if an expression starts with `{`, or (if forbidFunctionClassAndDoExpr
|
|
764
|
-
// holds) `function`, `class`, or `do {}`. Will be overzealous if there's
|
|
765
|
-
// already necessary grouping parentheses.
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
function startsWithNoLookaheadToken(node, forbidFunctionClassAndDoExpr) {
|
|
769
|
-
node = getLeftMost(node);
|
|
770
|
-
|
|
771
|
-
switch (node.type) {
|
|
772
|
-
case "FunctionExpression":
|
|
773
|
-
case "ClassExpression":
|
|
774
|
-
case "DoExpression":
|
|
775
|
-
return forbidFunctionClassAndDoExpr;
|
|
776
|
-
|
|
777
|
-
case "ObjectExpression":
|
|
778
|
-
return true;
|
|
779
|
-
|
|
780
|
-
case "MemberExpression":
|
|
781
|
-
case "OptionalMemberExpression":
|
|
782
|
-
return startsWithNoLookaheadToken(node.object, forbidFunctionClassAndDoExpr);
|
|
783
|
-
|
|
784
|
-
case "TaggedTemplateExpression":
|
|
785
|
-
if (node.tag.type === "FunctionExpression") {
|
|
786
|
-
// IIFEs are always already parenthesized
|
|
787
|
-
return false;
|
|
788
|
-
}
|
|
789
|
-
|
|
790
|
-
return startsWithNoLookaheadToken(node.tag, forbidFunctionClassAndDoExpr);
|
|
791
|
-
|
|
792
|
-
case "CallExpression":
|
|
793
|
-
case "OptionalCallExpression":
|
|
794
|
-
if (node.callee.type === "FunctionExpression") {
|
|
795
|
-
// IIFEs are always already parenthesized
|
|
796
|
-
return false;
|
|
797
|
-
}
|
|
798
|
-
|
|
799
|
-
return startsWithNoLookaheadToken(node.callee, forbidFunctionClassAndDoExpr);
|
|
800
|
-
|
|
801
|
-
case "ConditionalExpression":
|
|
802
|
-
return startsWithNoLookaheadToken(node.test, forbidFunctionClassAndDoExpr);
|
|
803
|
-
|
|
804
|
-
case "UpdateExpression":
|
|
805
|
-
return !node.prefix && startsWithNoLookaheadToken(node.argument, forbidFunctionClassAndDoExpr);
|
|
806
|
-
|
|
807
|
-
case "BindExpression":
|
|
808
|
-
return node.object && startsWithNoLookaheadToken(node.object, forbidFunctionClassAndDoExpr);
|
|
809
|
-
|
|
810
|
-
case "SequenceExpression":
|
|
811
|
-
return startsWithNoLookaheadToken(node.expressions[0], forbidFunctionClassAndDoExpr);
|
|
812
|
-
|
|
813
|
-
case "TSAsExpression":
|
|
814
|
-
return startsWithNoLookaheadToken(node.expression, forbidFunctionClassAndDoExpr);
|
|
815
|
-
|
|
816
|
-
default:
|
|
817
|
-
return false;
|
|
818
|
-
}
|
|
819
|
-
}
|
|
820
|
-
|
|
821
|
-
function getLeftMost(node) {
|
|
822
|
-
if (node.left) {
|
|
823
|
-
return getLeftMost(node.left);
|
|
824
|
-
}
|
|
825
|
-
|
|
826
|
-
return node;
|
|
827
|
-
}
|
|
828
2326
|
/**
|
|
829
2327
|
* @param {string} value
|
|
830
2328
|
* @param {number} tabWidth
|
|
@@ -866,7 +2364,7 @@
|
|
|
866
2364
|
}
|
|
867
2365
|
|
|
868
2366
|
return getAlignmentSize( // All the leading whitespaces
|
|
869
|
-
value.slice(lastNewlineIndex + 1).match(/^[
|
|
2367
|
+
value.slice(lastNewlineIndex + 1).match(/^[\t ]*/)[0], tabWidth);
|
|
870
2368
|
}
|
|
871
2369
|
/**
|
|
872
2370
|
* @typedef {'"' | "'"} Quote
|
|
@@ -950,7 +2448,7 @@
|
|
|
950
2448
|
function makeString(rawContent, enclosingQuote, unescapeUnnecessaryEscapes) {
|
|
951
2449
|
const otherQuote = enclosingQuote === '"' ? "'" : '"'; // Matches _any_ escape and unescaped quotes (both single and double).
|
|
952
2450
|
|
|
953
|
-
const regex = /\\([\s
|
|
2451
|
+
const regex = /\\([\S\s])|(["'])/g; // Escape and unescape single and double quotes as needed to be able to
|
|
954
2452
|
// enclose `rawContent` with `enclosingQuote`.
|
|
955
2453
|
|
|
956
2454
|
const newContent = rawContent.replace(regex, (match, escaped, quote) => {
|
|
@@ -974,7 +2472,7 @@
|
|
|
974
2472
|
// Adapted from https://github.com/eslint/eslint/blob/de0b4ad7bd820ade41b1f606008bea68683dc11a/lib/rules/no-useless-escape.js#L27
|
|
975
2473
|
|
|
976
2474
|
|
|
977
|
-
return unescapeUnnecessaryEscapes && /^[
|
|
2475
|
+
return unescapeUnnecessaryEscapes && /^[^\n\r"'0-7\\bfnrt-vx\u2028\u2029]$/.test(escaped) ? escaped : "\\" + escaped;
|
|
978
2476
|
});
|
|
979
2477
|
return enclosingQuote + newContent + enclosingQuote;
|
|
980
2478
|
}
|
|
@@ -1050,15 +2548,6 @@
|
|
|
1050
2548
|
return stringWidth_1(text);
|
|
1051
2549
|
}
|
|
1052
2550
|
|
|
1053
|
-
function hasIgnoreComment(path) {
|
|
1054
|
-
const node = path.getValue();
|
|
1055
|
-
return hasNodeIgnoreComment(node);
|
|
1056
|
-
}
|
|
1057
|
-
|
|
1058
|
-
function hasNodeIgnoreComment(node) {
|
|
1059
|
-
return node && (node.comments && node.comments.length > 0 && node.comments.some(comment => isNodeIgnoreComment(comment) && !comment.unignore) || node.prettierIgnore);
|
|
1060
|
-
}
|
|
1061
|
-
|
|
1062
2551
|
function isNodeIgnoreComment(comment) {
|
|
1063
2552
|
return comment.value.trim() === "prettier-ignore";
|
|
1064
2553
|
}
|
|
@@ -1070,6 +2559,8 @@
|
|
|
1070
2559
|
// We already "print" it via the raw text, we don't need to re-print it as a
|
|
1071
2560
|
// comment
|
|
1072
2561
|
|
|
2562
|
+
/* istanbul ignore next */
|
|
2563
|
+
|
|
1073
2564
|
if (node.type === "JSXText") {
|
|
1074
2565
|
comment.printed = true;
|
|
1075
2566
|
}
|
|
@@ -1081,9 +2572,14 @@
|
|
|
1081
2572
|
addCommentHelper(node, comment);
|
|
1082
2573
|
}
|
|
1083
2574
|
|
|
1084
|
-
function addDanglingComment(node, comment) {
|
|
2575
|
+
function addDanglingComment(node, comment, marker) {
|
|
1085
2576
|
comment.leading = false;
|
|
1086
2577
|
comment.trailing = false;
|
|
2578
|
+
|
|
2579
|
+
if (marker) {
|
|
2580
|
+
comment.marker = marker;
|
|
2581
|
+
}
|
|
2582
|
+
|
|
1087
2583
|
addCommentHelper(node, comment);
|
|
1088
2584
|
}
|
|
1089
2585
|
|
|
@@ -1093,22 +2589,6 @@
|
|
|
1093
2589
|
addCommentHelper(node, comment);
|
|
1094
2590
|
}
|
|
1095
2591
|
|
|
1096
|
-
function isWithinParentArrayProperty(path, propertyName) {
|
|
1097
|
-
const node = path.getValue();
|
|
1098
|
-
const parent = path.getParentNode();
|
|
1099
|
-
|
|
1100
|
-
if (parent == null) {
|
|
1101
|
-
return false;
|
|
1102
|
-
}
|
|
1103
|
-
|
|
1104
|
-
if (!Array.isArray(parent[propertyName])) {
|
|
1105
|
-
return false;
|
|
1106
|
-
}
|
|
1107
|
-
|
|
1108
|
-
const key = path.getName();
|
|
1109
|
-
return parent[propertyName][key] === node;
|
|
1110
|
-
}
|
|
1111
|
-
|
|
1112
2592
|
function replaceEndOfLineWith(text, replacement) {
|
|
1113
2593
|
const parts = [];
|
|
1114
2594
|
|
|
@@ -1123,14 +2603,46 @@
|
|
|
1123
2603
|
return parts;
|
|
1124
2604
|
}
|
|
1125
2605
|
|
|
2606
|
+
function inferParserByLanguage(language, options) {
|
|
2607
|
+
const {
|
|
2608
|
+
languages
|
|
2609
|
+
} = getSupportInfo$1({
|
|
2610
|
+
plugins: options.plugins
|
|
2611
|
+
});
|
|
2612
|
+
const matched = languages.find(({
|
|
2613
|
+
name
|
|
2614
|
+
}) => name.toLowerCase() === language) || languages.find(({
|
|
2615
|
+
aliases
|
|
2616
|
+
}) => Array.isArray(aliases) && aliases.includes(language)) || languages.find(({
|
|
2617
|
+
extensions
|
|
2618
|
+
}) => Array.isArray(extensions) && extensions.includes(".".concat(language)));
|
|
2619
|
+
return matched && matched.parsers[0];
|
|
2620
|
+
}
|
|
2621
|
+
|
|
2622
|
+
function isFrontMatterNode(node) {
|
|
2623
|
+
return node && node.type === "front-matter";
|
|
2624
|
+
}
|
|
2625
|
+
|
|
2626
|
+
function getShebang(text) {
|
|
2627
|
+
if (!text.startsWith("#!")) {
|
|
2628
|
+
return "";
|
|
2629
|
+
}
|
|
2630
|
+
|
|
2631
|
+
const index = text.indexOf("\n");
|
|
2632
|
+
|
|
2633
|
+
if (index === -1) {
|
|
2634
|
+
return text;
|
|
2635
|
+
}
|
|
2636
|
+
|
|
2637
|
+
return text.slice(0, index);
|
|
2638
|
+
}
|
|
2639
|
+
|
|
1126
2640
|
var util = {
|
|
2641
|
+
inferParserByLanguage,
|
|
1127
2642
|
replaceEndOfLineWith,
|
|
1128
2643
|
getStringWidth,
|
|
1129
2644
|
getMaxContinuousCount,
|
|
1130
2645
|
getMinNotPresentContinuousCount,
|
|
1131
|
-
getPrecedence,
|
|
1132
|
-
shouldFlatten,
|
|
1133
|
-
isBitwiseOperator,
|
|
1134
2646
|
getPenultimate,
|
|
1135
2647
|
getLast,
|
|
1136
2648
|
getNextNonSpaceNonCommentCharacterIndexWithStartIndex,
|
|
@@ -1150,22 +2662,18 @@
|
|
|
1150
2662
|
hasNewline,
|
|
1151
2663
|
hasNewlineInRange,
|
|
1152
2664
|
hasSpaces,
|
|
1153
|
-
setLocStart,
|
|
1154
|
-
setLocEnd,
|
|
1155
|
-
startsWithNoLookaheadToken,
|
|
1156
2665
|
getAlignmentSize,
|
|
1157
2666
|
getIndentSize,
|
|
1158
2667
|
getPreferredQuote,
|
|
1159
2668
|
printString,
|
|
1160
2669
|
printNumber,
|
|
1161
|
-
hasIgnoreComment,
|
|
1162
|
-
hasNodeIgnoreComment,
|
|
1163
2670
|
isNodeIgnoreComment,
|
|
1164
2671
|
makeString,
|
|
1165
2672
|
addLeadingComment,
|
|
1166
2673
|
addDanglingComment,
|
|
1167
2674
|
addTrailingComment,
|
|
1168
|
-
|
|
2675
|
+
isFrontMatterNode,
|
|
2676
|
+
getShebang
|
|
1169
2677
|
};
|
|
1170
2678
|
|
|
1171
2679
|
function guessEndOfLine(text) {
|
|
@@ -1191,9 +2699,33 @@
|
|
|
1191
2699
|
}
|
|
1192
2700
|
}
|
|
1193
2701
|
|
|
2702
|
+
function countEndOfLineChars(text, eol) {
|
|
2703
|
+
let regex;
|
|
2704
|
+
/* istanbul ignore else */
|
|
2705
|
+
|
|
2706
|
+
if (eol === "\n") {
|
|
2707
|
+
regex = /\n/g;
|
|
2708
|
+
} else if (eol === "\r") {
|
|
2709
|
+
regex = /\r/g;
|
|
2710
|
+
} else if (eol === "\r\n") {
|
|
2711
|
+
regex = /\r\n/g;
|
|
2712
|
+
} else {
|
|
2713
|
+
throw new Error("Unexpected \"eol\" ".concat(JSON.stringify(eol), "."));
|
|
2714
|
+
}
|
|
2715
|
+
|
|
2716
|
+
const endOfLines = text.match(regex);
|
|
2717
|
+
return endOfLines ? endOfLines.length : 0;
|
|
2718
|
+
}
|
|
2719
|
+
|
|
2720
|
+
function normalizeEndOfLine(text) {
|
|
2721
|
+
return text.replace(/\r\n?/g, "\n");
|
|
2722
|
+
}
|
|
2723
|
+
|
|
1194
2724
|
var endOfLine = {
|
|
1195
2725
|
guessEndOfLine,
|
|
1196
|
-
convertEndOfLineToChars
|
|
2726
|
+
convertEndOfLineToChars,
|
|
2727
|
+
countEndOfLineChars,
|
|
2728
|
+
normalizeEndOfLine
|
|
1197
2729
|
};
|
|
1198
2730
|
|
|
1199
2731
|
const {
|
|
@@ -1227,16 +2759,30 @@
|
|
|
1227
2759
|
}, options);
|
|
1228
2760
|
}
|
|
1229
2761
|
|
|
1230
|
-
function makeAlign(
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
}
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
2762
|
+
function makeAlign(indent, n, options) {
|
|
2763
|
+
if (n === -Infinity) {
|
|
2764
|
+
return indent.root || rootIndent();
|
|
2765
|
+
}
|
|
2766
|
+
|
|
2767
|
+
if (n < 0) {
|
|
2768
|
+
return generateInd(indent, {
|
|
2769
|
+
type: "dedent"
|
|
2770
|
+
}, options);
|
|
2771
|
+
}
|
|
2772
|
+
|
|
2773
|
+
if (!n) {
|
|
2774
|
+
return indent;
|
|
2775
|
+
}
|
|
2776
|
+
|
|
2777
|
+
if (n.type === "root") {
|
|
2778
|
+
return Object.assign({}, indent, {
|
|
2779
|
+
root: indent
|
|
2780
|
+
});
|
|
2781
|
+
}
|
|
2782
|
+
|
|
2783
|
+
const alignType = typeof n === "string" ? "stringAlign" : "numberAlign";
|
|
2784
|
+
return generateInd(indent, {
|
|
2785
|
+
type: alignType,
|
|
1240
2786
|
n
|
|
1241
2787
|
}, options);
|
|
1242
2788
|
}
|
|
@@ -1333,12 +2879,12 @@
|
|
|
1333
2879
|
|
|
1334
2880
|
let trimCount = 0; // Trim whitespace at the end of line
|
|
1335
2881
|
|
|
1336
|
-
while (out.length > 0 && typeof out[out.length - 1] === "string" && out[out.length - 1].match(/^[
|
|
2882
|
+
while (out.length > 0 && typeof out[out.length - 1] === "string" && out[out.length - 1].match(/^[\t ]*$/)) {
|
|
1337
2883
|
trimCount += out.pop().length;
|
|
1338
2884
|
}
|
|
1339
2885
|
|
|
1340
2886
|
if (out.length && typeof out[out.length - 1] === "string") {
|
|
1341
|
-
const trimmed = out[out.length - 1].replace(/[
|
|
2887
|
+
const trimmed = out[out.length - 1].replace(/[\t ]*$/, "");
|
|
1342
2888
|
trimCount += out[out.length - 1].length - trimmed.length;
|
|
1343
2889
|
out[out.length - 1] = trimmed;
|
|
1344
2890
|
}
|
|
@@ -1735,6 +3281,13 @@
|
|
|
1735
3281
|
|
|
1736
3282
|
break;
|
|
1737
3283
|
}
|
|
3284
|
+
} // Flush remaining line-suffix contents at the end of the document, in case
|
|
3285
|
+
// there is no new line after the line-suffix.
|
|
3286
|
+
|
|
3287
|
+
|
|
3288
|
+
if (cmds.length === 0 && lineSuffix.length) {
|
|
3289
|
+
cmds.push(...lineSuffix.reverse());
|
|
3290
|
+
lineSuffix = [];
|
|
1738
3291
|
}
|
|
1739
3292
|
}
|
|
1740
3293
|
|
|
@@ -1761,6 +3314,11 @@
|
|
|
1761
3314
|
printDocToString
|
|
1762
3315
|
};
|
|
1763
3316
|
|
|
3317
|
+
const {
|
|
3318
|
+
literalline: literalline$1,
|
|
3319
|
+
concat: concat$2
|
|
3320
|
+
} = docBuilders; // Using a unique object to compare by reference.
|
|
3321
|
+
|
|
1764
3322
|
const traverseDocOnExitStackMarker = {};
|
|
1765
3323
|
|
|
1766
3324
|
function traverseDoc(doc, onEnter, onExit, shouldTraverseConditionalGroups) {
|
|
@@ -1774,20 +3332,12 @@
|
|
|
1774
3332
|
continue;
|
|
1775
3333
|
}
|
|
1776
3334
|
|
|
1777
|
-
let shouldRecurse = true;
|
|
1778
|
-
|
|
1779
|
-
if (onEnter) {
|
|
1780
|
-
if (onEnter(doc) === false) {
|
|
1781
|
-
shouldRecurse = false;
|
|
1782
|
-
}
|
|
1783
|
-
}
|
|
1784
|
-
|
|
1785
3335
|
if (onExit) {
|
|
1786
|
-
docsStack.push(doc);
|
|
1787
|
-
docsStack.push(traverseDocOnExitStackMarker);
|
|
3336
|
+
docsStack.push(doc, traverseDocOnExitStackMarker);
|
|
1788
3337
|
}
|
|
1789
3338
|
|
|
1790
|
-
if (
|
|
3339
|
+
if ( // Should Recurse
|
|
3340
|
+
!onEnter || onEnter(doc) !== false) {
|
|
1791
3341
|
// When there are multiple parts to process,
|
|
1792
3342
|
// the parts need to be pushed onto the stack in reverse order,
|
|
1793
3343
|
// so that they are processed in the original order
|
|
@@ -1965,16 +3515,34 @@
|
|
|
1965
3515
|
return mapDoc(doc, removeLinesFn);
|
|
1966
3516
|
}
|
|
1967
3517
|
|
|
1968
|
-
function
|
|
3518
|
+
function getInnerParts(doc) {
|
|
3519
|
+
let {
|
|
3520
|
+
parts
|
|
3521
|
+
} = doc;
|
|
3522
|
+
let lastPart; // Avoid a falsy element like ""
|
|
3523
|
+
|
|
3524
|
+
for (let i = doc.parts.length; i > 0 && !lastPart; i--) {
|
|
3525
|
+
lastPart = parts[i - 1];
|
|
3526
|
+
}
|
|
3527
|
+
|
|
3528
|
+
if (lastPart.type === "group") {
|
|
3529
|
+
parts = lastPart.contents.parts;
|
|
3530
|
+
}
|
|
3531
|
+
|
|
3532
|
+
return parts;
|
|
3533
|
+
}
|
|
3534
|
+
|
|
3535
|
+
function stripTrailingHardline(doc, withInnerParts = false) {
|
|
1969
3536
|
// HACK remove ending hardline, original PR: #1984
|
|
1970
3537
|
if (doc.type === "concat" && doc.parts.length !== 0) {
|
|
1971
|
-
const
|
|
3538
|
+
const parts = withInnerParts ? getInnerParts(doc) : doc.parts;
|
|
3539
|
+
const lastPart = parts[parts.length - 1];
|
|
1972
3540
|
|
|
1973
3541
|
if (lastPart.type === "concat") {
|
|
1974
3542
|
if (lastPart.parts.length === 2 && lastPart.parts[0].hard && lastPart.parts[1].type === "break-parent") {
|
|
1975
3543
|
return {
|
|
1976
3544
|
type: "concat",
|
|
1977
|
-
parts:
|
|
3545
|
+
parts: parts.slice(0, -1)
|
|
1978
3546
|
};
|
|
1979
3547
|
}
|
|
1980
3548
|
|
|
@@ -1988,6 +3556,49 @@
|
|
|
1988
3556
|
return doc;
|
|
1989
3557
|
}
|
|
1990
3558
|
|
|
3559
|
+
function normalizeParts(parts) {
|
|
3560
|
+
const newParts = [];
|
|
3561
|
+
const restParts = parts.filter(Boolean);
|
|
3562
|
+
|
|
3563
|
+
while (restParts.length !== 0) {
|
|
3564
|
+
const part = restParts.shift();
|
|
3565
|
+
|
|
3566
|
+
if (!part) {
|
|
3567
|
+
continue;
|
|
3568
|
+
}
|
|
3569
|
+
|
|
3570
|
+
if (part.type === "concat") {
|
|
3571
|
+
restParts.unshift(...part.parts);
|
|
3572
|
+
continue;
|
|
3573
|
+
}
|
|
3574
|
+
|
|
3575
|
+
if (newParts.length !== 0 && typeof newParts[newParts.length - 1] === "string" && typeof part === "string") {
|
|
3576
|
+
newParts[newParts.length - 1] += part;
|
|
3577
|
+
continue;
|
|
3578
|
+
}
|
|
3579
|
+
|
|
3580
|
+
newParts.push(part);
|
|
3581
|
+
}
|
|
3582
|
+
|
|
3583
|
+
return newParts;
|
|
3584
|
+
}
|
|
3585
|
+
|
|
3586
|
+
function normalizeDoc(doc) {
|
|
3587
|
+
return mapDoc(doc, currentDoc => {
|
|
3588
|
+
if (!currentDoc.parts) {
|
|
3589
|
+
return currentDoc;
|
|
3590
|
+
}
|
|
3591
|
+
|
|
3592
|
+
return Object.assign({}, currentDoc, {
|
|
3593
|
+
parts: normalizeParts(currentDoc.parts)
|
|
3594
|
+
});
|
|
3595
|
+
});
|
|
3596
|
+
}
|
|
3597
|
+
|
|
3598
|
+
function replaceNewlinesWithLiterallines(doc) {
|
|
3599
|
+
return mapDoc(doc, currentDoc => typeof currentDoc === "string" && currentDoc.includes("\n") ? concat$2(currentDoc.split(/(\n)/g).map((v, i) => i % 2 === 0 ? v : literalline$1)) : currentDoc);
|
|
3600
|
+
}
|
|
3601
|
+
|
|
1991
3602
|
var docUtils = {
|
|
1992
3603
|
isEmpty,
|
|
1993
3604
|
willBreak,
|
|
@@ -1997,7 +3608,10 @@
|
|
|
1997
3608
|
mapDoc,
|
|
1998
3609
|
propagateBreaks,
|
|
1999
3610
|
removeLines,
|
|
2000
|
-
stripTrailingHardline
|
|
3611
|
+
stripTrailingHardline,
|
|
3612
|
+
normalizeParts,
|
|
3613
|
+
normalizeDoc,
|
|
3614
|
+
replaceNewlinesWithLiterallines
|
|
2001
3615
|
};
|
|
2002
3616
|
|
|
2003
3617
|
function flattenDoc(doc) {
|
|
@@ -2115,23 +3729,18 @@
|
|
|
2115
3729
|
|
|
2116
3730
|
};
|
|
2117
3731
|
|
|
3732
|
+
/**
|
|
3733
|
+
* @typedef {import("./doc-builders").Doc} Doc
|
|
3734
|
+
*/
|
|
3735
|
+
|
|
3736
|
+
|
|
2118
3737
|
var document = {
|
|
2119
3738
|
builders: docBuilders,
|
|
2120
3739
|
printer: docPrinter,
|
|
2121
3740
|
utils: docUtils,
|
|
2122
3741
|
debug: docDebug
|
|
2123
3742
|
};
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
var document_3 = document.utils;
|
|
2127
|
-
var document_4 = document.debug;
|
|
2128
|
-
|
|
2129
|
-
exports.builders = document_1;
|
|
2130
|
-
exports.debug = document_4;
|
|
2131
|
-
exports.default = document;
|
|
2132
|
-
exports.printer = document_2;
|
|
2133
|
-
exports.utils = document_3;
|
|
2134
|
-
|
|
2135
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3743
|
+
|
|
3744
|
+
return document;
|
|
2136
3745
|
|
|
2137
3746
|
})));
|