@parcel/utils 2.10.1 → 2.10.3

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/lib/index.js CHANGED
@@ -34122,10 +34122,68 @@ $d40641aebeaeaf52$exports.isSupported = $cbe30b46bc6aa037$exports.stdout;
34122
34122
  $d40641aebeaeaf52$exports.stderr.isSupported = $cbe30b46bc6aa037$exports.stderr;
34123
34123
 
34124
34124
 
34125
- async function $f48a8d35082f1415$export$2e2bcd8739ae039(diagnostic, options, terminalWidth) {
34125
+ var $61f5f8a503b978c7$var$e = {
34126
+ "": [
34127
+ "<em>",
34128
+ "</em>"
34129
+ ],
34130
+ _: [
34131
+ "<strong>",
34132
+ "</strong>"
34133
+ ],
34134
+ "*": [
34135
+ "<strong>",
34136
+ "</strong>"
34137
+ ],
34138
+ "~": [
34139
+ "<s>",
34140
+ "</s>"
34141
+ ],
34142
+ "\n": [
34143
+ "<br />"
34144
+ ],
34145
+ " ": [
34146
+ "<br />"
34147
+ ],
34148
+ "-": [
34149
+ "<hr />"
34150
+ ]
34151
+ };
34152
+ function $61f5f8a503b978c7$var$n(e) {
34153
+ return e.replace(RegExp("^" + (e.match(/^(\t| )+/) || "")[0], "gm"), "");
34154
+ }
34155
+ function $61f5f8a503b978c7$var$r(e) {
34156
+ return (e + "").replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
34157
+ }
34158
+ function $61f5f8a503b978c7$export$2e2bcd8739ae039(a, c) {
34159
+ var o, l, g, s, p, u = /((?:^|\n+)(?:\n---+|\* \*(?: \*)+)\n)|(?:^``` *(\w*)\n([\s\S]*?)\n```$)|((?:(?:^|\n+)(?:\t| {2,}).+)+\n*)|((?:(?:^|\n)([>*+-]|\d+\.)\s+.*)+)|(?:!\[([^\]]*?)\]\(([^)]+?)\))|(\[)|(\](?:\(([^)]+?)\))?)|(?:(?:^|\n+)([^\s].*)\n(-{3,}|={3,})(?:\n+|$))|(?:(?:^|\n+)(#{1,6})\s*(.+)(?:\n+|$))|(?:`([^`].*?)`)|( \n\n*|\n{2,}|__|\*\*|[_*]|~~)/gm, m = [], h = "", i = c || {}, d = 0;
34160
+ function f(n) {
34161
+ var r = $61f5f8a503b978c7$var$e[n[1] || ""], t = m[m.length - 1] == n;
34162
+ return r ? r[1] ? (t ? m.pop() : m.push(n), r[0 | t]) : r[0] : n;
34163
+ }
34164
+ function $() {
34165
+ for(var e = ""; m.length;)e += f(m[m.length - 1]);
34166
+ return e;
34167
+ }
34168
+ for(a = a.replace(/^\[(.+?)\]:\s*(.+)$/gm, function(e, n, r) {
34169
+ return i[n.toLowerCase()] = r, "";
34170
+ }).replace(/^\n+|\n+$/g, ""); g = u.exec(a);)l = a.substring(d, g.index), d = u.lastIndex, o = g[0], l.match(/[^\\](\\\\)*\\$/) || ((p = g[3] || g[4]) ? o = '<pre class="code ' + (g[4] ? "poetry" : g[2].toLowerCase()) + '"><code' + (g[2] ? ' class="language-' + g[2].toLowerCase() + '"' : "") + ">" + $61f5f8a503b978c7$var$n($61f5f8a503b978c7$var$r(p).replace(/^\n+|\n+$/g, "")) + "</code></pre>" : (p = g[6]) ? (p.match(/\./) && (g[5] = g[5].replace(/^\d+/gm, "")), s = $61f5f8a503b978c7$export$2e2bcd8739ae039($61f5f8a503b978c7$var$n(g[5].replace(/^\s*[>*+.-]/gm, ""))), ">" == p ? p = "blockquote" : (p = p.match(/\./) ? "ol" : "ul", s = s.replace(/^(.*)(\n|$)/gm, "<li>$1</li>")), o = "<" + p + ">" + s + "</" + p + ">") : g[8] ? o = '<img src="' + $61f5f8a503b978c7$var$r(g[8]) + '" alt="' + $61f5f8a503b978c7$var$r(g[7]) + '">' : g[10] ? (h = h.replace("<a>", '<a href="' + $61f5f8a503b978c7$var$r(g[11] || i[l.toLowerCase()]) + '">'), o = $() + "</a>") : g[9] ? o = "<a>" : g[12] || g[14] ? o = "<" + (p = "h" + (g[14] ? g[14].length : g[13] > "=" ? 1 : 2)) + ">" + $61f5f8a503b978c7$export$2e2bcd8739ae039(g[12] || g[15], i) + "</" + p + ">" : g[16] ? o = "<code>" + $61f5f8a503b978c7$var$r(g[16]) + "</code>" : (g[17] || g[1]) && (o = f(g[17] || "--"))), h += l, h += o;
34171
+ return (h + a.substring(d) + $()).replace(/^\n+|\n+$/g, "");
34172
+ }
34173
+
34174
+
34175
+ async function $f48a8d35082f1415$export$2e2bcd8739ae039(diagnostic, options, terminalWidth, format = "ansi") {
34126
34176
  let { origin: origin, message: message, stack: stack, codeFrames: codeFrames, hints: hints, skipFormatting: skipFormatting, documentationURL: documentationURL } = diagnostic;
34177
+ const md = format === "ansi" ? (0, ($parcel$interopDefault($eJUMF$parcelmarkdownansi))) : (0, $61f5f8a503b978c7$export$2e2bcd8739ae039);
34178
+ const terminalLink = format === "ansi" ? (0, (/*@__PURE__*/$parcel$interopDefault($d40641aebeaeaf52$exports))) : // eslint-disable-next-line no-unused-vars
34179
+ (text, url)=>`<a href="${url}">${text}</a>`;
34180
+ const chalk = format === "ansi" ? (0, ($parcel$interopDefault($eJUMF$chalk))) : {
34181
+ gray: {
34182
+ underline: (v)=>`<span style="color: grey; text-decoration: underline;">${v}</span>`
34183
+ }
34184
+ };
34127
34185
  let result = {
34128
- message: (0, ($parcel$interopDefault($eJUMF$parcelmarkdownansi)))(`**${origin !== null && origin !== void 0 ? origin : "unknown"}**: `) + (skipFormatting ? message : (0, ($parcel$interopDefault($eJUMF$parcelmarkdownansi)))(message)),
34186
+ message: md(`**${origin !== null && origin !== void 0 ? origin : "unknown"}**: `) + (skipFormatting ? message : md(message)),
34129
34187
  stack: "",
34130
34188
  codeframe: "",
34131
34189
  frames: [],
@@ -34150,7 +34208,7 @@ async function $f48a8d35082f1415$export$2e2bcd8739ae039(diagnostic, options, ter
34150
34208
  if (typeof filePath !== "string") location = "";
34151
34209
  else if (highlights.length === 0) location = filePath;
34152
34210
  else location = `${filePath}:${highlights[0].start.line}:${highlights[0].start.column}`;
34153
- result.codeframe += location ? (0, ($parcel$interopDefault($eJUMF$chalk))).gray.underline(location) + "\n" : "";
34211
+ result.codeframe += location ? chalk.gray.underline(location) + "\n" : "";
34154
34212
  result.codeframe += formattedCodeFrame;
34155
34213
  if (codeFrame !== codeFrames[codeFrames.length - 1]) result.codeframe += "\n\n";
34156
34214
  result.frames.push({
@@ -34160,9 +34218,9 @@ async function $f48a8d35082f1415$export$2e2bcd8739ae039(diagnostic, options, ter
34160
34218
  }
34161
34219
  if (stack != null) result.stack = stack;
34162
34220
  if (Array.isArray(hints) && hints.length) result.hints = hints.map((h)=>{
34163
- return (0, ($parcel$interopDefault($eJUMF$parcelmarkdownansi)))(h);
34221
+ return md(h);
34164
34222
  });
34165
- if (documentationURL != null) result.documentation = (0, (/*@__PURE__*/$parcel$interopDefault($d40641aebeaeaf52$exports)))("Learn more", documentationURL, {
34223
+ if (documentationURL != null) result.documentation = terminalLink("Learn more", documentationURL, {
34166
34224
  fallback: (text, url)=>`${text}: ${url}`
34167
34225
  });
34168
34226
  return result;