Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

prettier-plugin-jsdoc

Package Overview
Dependencies
Maintainers
1
Versions
105
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prettier-plugin-jsdoc - npm Package Compare versions

Comparing version
1.5.0
to
1.7.0
+15
-0
CHANGELOG.md

@@ -5,2 +5,17 @@ # Changelog

## [1.6.0](https://github.com/hosseinmd/prettier-plugin-jsdoc/compare/v1.5.0...v1.6.0) (2025-11-28)
### Features
* add balance to jsdocLineWrappingStyle ([7fd5182](https://github.com/hosseinmd/prettier-plugin-jsdoc/commit/7fd51824abcc3d37cff47a2084459d1b9220c7a0))
* add jsdocEmptyCommentStrategy option to handle empty JSDoc comments ("keep"| "remove") "remove" is default ([86e7ebb](https://github.com/hosseinmd/prettier-plugin-jsdoc/commit/86e7ebb11f320fc8195ffe4544b26203efb126f8))
### Bug Fixes
* async plugin like tailwind ([48d56aa](https://github.com/hosseinmd/prettier-plugin-jsdoc/commit/48d56aaa647e627e7b6981621457aba6aba41bf5))
* printWidth ([d84dcc5](https://github.com/hosseinmd/prettier-plugin-jsdoc/commit/d84dcc596d6409f53a7d7e82b5c8b8db7fbc3d5e))
* support [@this](https://github.com/this) tag ([6663384](https://github.com/hosseinmd/prettier-plugin-jsdoc/commit/666338444c400a3f88cdbf84bf0b85128017cebe))
## [1.4.0](https://github.com/hosseinmd/prettier-plugin-jsdoc/compare/v1.3.3...v1.4.0) (2025-10-29)

@@ -7,0 +22,0 @@

+59
-7

@@ -43,2 +43,3 @@ import { format } from "prettier";

const { tagStringLength = 0, beginningSpace } = formatOptions;
const originalText = text;
text = text.replace(/^(\d+)[-][\s|]+/g, "$1. ");

@@ -175,9 +176,60 @@ text = text.replace(/\n+(\s*\d+)[-][\s]+/g, "\n$1. ");

});
_paragraph = _paragraph.replace(/\s+/g, " ");
if (options.jsdocCapitalizeDescription &&
!TAGS_PEV_FORMATE_DESCRIPTION.includes(tag))
_paragraph = capitalizer(_paragraph);
if (options.jsdocDescriptionWithDot)
_paragraph = _paragraph.replace(/([\w\p{L}])$/u, "$1.");
let result = breakDescriptionToLines(_paragraph, printWidth, intention);
const applyCapitalization = (text) => {
const shouldCapitalize = options.jsdocCapitalizeDescription &&
!TAGS_PEV_FORMATE_DESCRIPTION.includes(tag);
return shouldCapitalize ? capitalizer(text) : text;
};
const applyTrailingDot = (text) => {
return options.jsdocDescriptionWithDot
? text.replace(/([\w\p{L}])$/u, "$1.")
: text;
};
const applyStandardFormatting = (text) => {
return applyTrailingDot(applyCapitalization(text));
};
const joinWithIndentation = (lines) => {
const indentedLines = lines.map((line) => `${intention}${line}`);
return indentedLines.join("\n");
};
const applyGreedyWrapping = (text) => {
const singleLine = text.replace(/\s+/g, " ");
const formatted = applyStandardFormatting(singleLine);
return breakDescriptionToLines(formatted, printWidth, intention);
};
const isBalanceMode = options.jsdocLineWrappingStyle === "balance";
const originalHasLineBreaks = originalText.includes("\n");
const shouldTryBalanceMode = isBalanceMode && originalHasLineBreaks;
let result;
if (shouldTryBalanceMode) {
const originalLines = originalText
.split("\n")
.map((line) => line.trim())
.filter((line) => line.length > 0);
const effectiveMaxWidth = tag === DESCRIPTION && tagStringLength > 0
? printWidth - tagStringLength
: printWidth - intention.length;
const allLinesFit = originalLines.every((line) => line.length <= effectiveMaxWidth);
const hasMultipleLines = originalLines.length > 1;
if (allLinesFit && hasMultipleLines) {
const formattedLines = originalLines.map((line, index) => {
const isFirstLine = index === 0;
const isLastLine = index === originalLines.length - 1;
let formatted = line;
if (isFirstLine) {
formatted = applyCapitalization(formatted);
}
if (isLastLine) {
formatted = applyTrailingDot(formatted);
}
return formatted;
});
result = joinWithIndentation(formattedLines);
}
else {
result = applyGreedyWrapping(_paragraph);
}
}
else {
result = applyGreedyWrapping(_paragraph);
}
result = result.replace(/{@(link|linkcode|linkplain)([_]+)}/g, (original, tag, underline) => {

@@ -184,0 +236,0 @@ const link = links[0];

@@ -153,2 +153,13 @@ import prettier from "prettier";

};
readonly jsdocEmptyCommentStrategy: {
readonly name: "jsdocEmptyCommentStrategy";
readonly type: "choice";
readonly choices: {
value: any;
description: string;
}[];
readonly category: "jsdoc";
readonly default: "remove";
readonly description: "How to handle empty JSDoc comment blocks";
};
};

@@ -204,3 +215,4 @@ declare const defaultOptions: JsdocOptions;

};
export { options, parsers, defaultOptions };
declare const name = "prettier-plugin-jsdoc";
export { name, options, parsers, defaultOptions };
export type Options = Partial<JsdocOptions>;

@@ -128,2 +128,6 @@ import { getParser } from "./parser.js";

},
{
value: "balance",
description: `Preserve existing line breaks if lines are shorter than print width, otherwise use greedy wrapping`,
},
],

@@ -169,2 +173,19 @@ category: "jsdoc",

},
jsdocEmptyCommentStrategy: {
name: "jsdocEmptyCommentStrategy",
type: "choice",
choices: [
{
value: "remove",
description: "Remove empty JSDoc comment blocks",
},
{
value: "keep",
description: "Keep empty JSDoc comment blocks",
},
],
category: "jsdoc",
default: "remove",
description: "How to handle empty JSDoc comment blocks",
},
};

@@ -192,2 +213,3 @@ const defaultOptions = {

jsdocNamedImportLineSplitting: options.jsdocNamedImportLineSplitting.default,
jsdocEmptyCommentStrategy: options.jsdocEmptyCommentStrategy.default,
};

@@ -246,3 +268,4 @@ const parsers = {

}
export { options, parsers, defaultOptions };
const name = "prettier-plugin-jsdoc";
export { name, options, parsers, defaultOptions };
function normalizeOptions(options) {

@@ -249,0 +272,0 @@ if (options.jsdocTagsOrder) {

@@ -52,2 +52,3 @@ (function (global, factory) {

const TEMPLATE = "template";
const THIS = "this";
const THROWS = "throws";

@@ -111,2 +112,3 @@ const TODO = "todo";

SINCE,
THIS,
THROWS,

@@ -161,2 +163,3 @@ TODO,

RETURNS,
THIS,
THROWS,

@@ -175,2 +178,3 @@ TYPE,

RETURNS,
THIS,
YIELDS,

@@ -220,2 +224,3 @@ THROWS,

[CALLBACK]: 39,
[THIS]: 39.5,
[PARAM]: 40,

@@ -381,10 +386,8 @@ [YIELDS]: 41,

plugin.name &&
plugin.name !== "prettier-plugin-jsdoc" &&
plugin.parsers &&
!("jsdoc-parser" in plugin.parsers) &&
plugin.parsers.hasOwnProperty(parserName));
});
return !tsPlugin ||
tsPlugin.name === "prettier-plugin-jsdoc" ||
tsPlugin.parsers?.hasOwnProperty("jsdoc-parser")
? undefined
: tsPlugin.parsers?.[parserName];
return !tsPlugin ? undefined : tsPlugin.parsers?.[parserName];
};

@@ -430,2 +433,3 @@ const isDefaultTag = (tag) => TAGS_DEFAULT.includes(tag);

const { tagStringLength = 0, beginningSpace } = formatOptions;
const originalText = text;
text = text.replace(/^(\d+)[-][\s|]+/g, "$1. ");

@@ -562,9 +566,60 @@ text = text.replace(/\n+(\s*\d+)[-][\s]+/g, "\n$1. ");

});
_paragraph = _paragraph.replace(/\s+/g, " ");
if (options.jsdocCapitalizeDescription &&
!TAGS_PEV_FORMATE_DESCRIPTION.includes(tag))
_paragraph = capitalizer(_paragraph);
if (options.jsdocDescriptionWithDot)
_paragraph = _paragraph.replace(/([\w\p{L}])$/u, "$1.");
let result = breakDescriptionToLines(_paragraph, printWidth, intention);
const applyCapitalization = (text) => {
const shouldCapitalize = options.jsdocCapitalizeDescription &&
!TAGS_PEV_FORMATE_DESCRIPTION.includes(tag);
return shouldCapitalize ? capitalizer(text) : text;
};
const applyTrailingDot = (text) => {
return options.jsdocDescriptionWithDot
? text.replace(/([\w\p{L}])$/u, "$1.")
: text;
};
const applyStandardFormatting = (text) => {
return applyTrailingDot(applyCapitalization(text));
};
const joinWithIndentation = (lines) => {
const indentedLines = lines.map((line) => `${intention}${line}`);
return indentedLines.join("\n");
};
const applyGreedyWrapping = (text) => {
const singleLine = text.replace(/\s+/g, " ");
const formatted = applyStandardFormatting(singleLine);
return breakDescriptionToLines(formatted, printWidth, intention);
};
const isBalanceMode = options.jsdocLineWrappingStyle === "balance";
const originalHasLineBreaks = originalText.includes("\n");
const shouldTryBalanceMode = isBalanceMode && originalHasLineBreaks;
let result;
if (shouldTryBalanceMode) {
const originalLines = originalText
.split("\n")
.map((line) => line.trim())
.filter((line) => line.length > 0);
const effectiveMaxWidth = tag === DESCRIPTION && tagStringLength > 0
? printWidth - tagStringLength
: printWidth - intention.length;
const allLinesFit = originalLines.every((line) => line.length <= effectiveMaxWidth);
const hasMultipleLines = originalLines.length > 1;
if (allLinesFit && hasMultipleLines) {
const formattedLines = originalLines.map((line, index) => {
const isFirstLine = index === 0;
const isLastLine = index === originalLines.length - 1;
let formatted = line;
if (isFirstLine) {
formatted = applyCapitalization(formatted);
}
if (isLastLine) {
formatted = applyTrailingDot(formatted);
}
return formatted;
});
result = joinWithIndentation(formattedLines);
}
else {
result = applyGreedyWrapping(_paragraph);
}
}
else {
result = applyGreedyWrapping(_paragraph);
}
result = result.replace(/{@(link|linkcode|linkplain)([_]+)}/g, (original, tag, underline) => {

@@ -751,9 +806,13 @@ const link = links[0];

const prettierParse = findPluginByParser(parserName, options)?.parse || originalParse;
const ast = prettierParse(text, options);
const ast = (await prettierParse(text, options));
options = {
...options,
printWidth: options.jsdocPrintWidth ?? options.printWidth,
jsdocEmptyCommentStrategy: options.jsdocEmptyCommentStrategy ?? "remove",
};
const eol = options.endOfLine === "auto" ? detectEndOfLine(text) : options.endOfLine;
options = { ...options, endOfLine: "lf" };
if (!ast.comments) {
ast.comments = [];
}
await Promise.all(ast.comments.map(async (comment) => {

@@ -882,3 +941,5 @@ if (!isBlockComment(comment))

}));
ast.comments = ast.comments.filter((comment) => !(isBlockComment(comment) && !comment.value));
if (options.jsdocEmptyCommentStrategy === "remove") {
ast.comments = ast.comments.filter((comment) => !(isBlockComment(comment) && !comment.value));
}
return ast;

@@ -1343,2 +1404,6 @@ };

},
{
value: "balance",
description: `Preserve existing line breaks if lines are shorter than print width, otherwise use greedy wrapping`,
},
],

@@ -1384,2 +1449,19 @@ category: "jsdoc",

},
jsdocEmptyCommentStrategy: {
name: "jsdocEmptyCommentStrategy",
type: "choice",
choices: [
{
value: "remove",
description: "Remove empty JSDoc comment blocks",
},
{
value: "keep",
description: "Keep empty JSDoc comment blocks",
},
],
category: "jsdoc",
default: "remove",
description: "How to handle empty JSDoc comment blocks",
},
};

@@ -1407,2 +1489,3 @@ const defaultOptions = {

jsdocNamedImportLineSplitting: options.jsdocNamedImportLineSplitting.default,
jsdocEmptyCommentStrategy: options.jsdocEmptyCommentStrategy.default,
};

@@ -1461,2 +1544,3 @@ const parsers = {

}
const name = "prettier-plugin-jsdoc";
function normalizeOptions(options) {

@@ -1478,2 +1562,3 @@ if (options.jsdocTagsOrder) {

exports.defaultOptions = defaultOptions;
exports.name = name;
exports.options = options;

@@ -1480,0 +1565,0 @@ exports.parsers = parsers;

+1
-1

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("comment-parser"),require("prettier"),require("binary-searching"),require("mdast-util-from-markdown"),require("prettier/plugins/babel"),require("prettier/plugins/flow"),require("prettier/plugins/typescript")):"function"==typeof define&&define.amd?define(["exports","comment-parser","prettier","binary-searching","mdast-util-from-markdown","prettier/plugins/babel","prettier/plugins/flow","prettier/plugins/typescript"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).sayHello={},e.commentParser,e.prettier,null,e.mdastUtilFromMarkdown,e.parserBabel,e.parserFlow,e.parserTypescript)}(this,(function(e,t,n,r,s,a,o,i){"use strict";function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=c(a),p=c(o),d=c(i);const u="abstract",m="borrows",g="callback",f="category",h="class",j="constant",y="default",$="defaultValue",b="deprecated",w="description",S="example",v="extends",I="external",x="file",L="fires",P="function",W="ignore",C="import",D="license",T="member",k="memberof",A="module",O="namespace",F="overload",E="override",M="param",R="privateRemarks",_="property",z="remarks",N="returns",U="since",q="throws",K="todo",V="type",G="typedef",B="satisfies",H="yields",J={tag:"this_is_for_space",name:"",optional:!1,type:"",description:"",source:[],problems:[]},Y={arg:M,argument:M,const:j,constructor:h,desc:w,emits:L,examples:S,exception:q,fileoverview:x,func:P,host:I,method:P,overview:x,params:M,prop:_,return:N,var:T,virtual:u,yield:H,hidden:W},Q=[y,$],X=[m,f,b,w,S,v,D,C,A,O,F,E,R,z,N,U,q,K,H,x,...Q],Z=[m,m,b,w,S,W,C,D,A,O,F,E,R,z,U,K,x],ee=[m,...Q,C,k,A,"see"],te=[m,f,w,S,C,R,z,U,K],ne=[v,M,_,N,q,V,B,G,H],re=[g,G],se=[...re,V,_,M,N,H,q],ae={[C]:0,[z]:1,[R]:2,providesModule:3,[A]:4,[D]:5,flow:6,async:7,private:8,[W]:9,[k]:10,version:11,[x]:12,author:13,[b]:14,[U]:15,[f]:16,[w]:17,[S]:18,[u]:19,augments:20,[j]:21,[y]:22,[$]:23,[I]:24,[F]:25,[L]:26,template:27,typeParam:28,[P]:29,[O]:30,[m]:31,[h]:32,[v]:33,[T]:34,[G]:35,[V]:36,[B]:37,[_]:38,[g]:39,[M]:40,[H]:41,[N]:42,[q]:43,other:44,see:45,[K]:46};function oe(e,t){return(e.match(new RegExp(t,"g"))||[]).length}function ie(e){return e?e.match(/^https?:\/\//i)?e:e.startsWith("- ")?e.slice(0,2)+ie(e.slice(2)):e[0].toUpperCase()+e.slice(1):e}async function ce(e,t,r){const{printWidth:s,jsdocKeepUnParseAbleExampleIndent:a}=r;e.split("\n").slice(1).every((e=>!e.trim()||e.startsWith(t)))&&(e=e.replace(new RegExp(`\n${t.replace(/[\t]/g,"[\\t]")}`,"g"),"\n"));try{let a="";const o=s-4;a=e.trim().startsWith("{")?await n.format(e||"",{...r,parser:"json",printWidth:o}):await n.format(e||"",{...r,printWidth:o}),e=a.replace(/(^|\n)/g,`\n${t}`)}catch(n){e=(e=`\n${e.split("\n").map((e=>`${t}${a?e:e.trim()}`)).join("\n")}\n`).replace(/^\n[\s]+\n/g,"\n")}return e}const le=(e,t)=>{const n=t.plugins.find((t=>"object"==typeof t&&null!==t&&!(t instanceof URL)&&t.name&&t.parsers&&t.parsers.hasOwnProperty(e)));return!n||"prettier-plugin-jsdoc"===n.name||n.parsers?.hasOwnProperty("jsdoc-parser")?void 0:n.parsers?.[e]},pe=e=>Q.includes(e),de="2@^5!~#sdE!_TABLE";async function ue(e,t,r,a){if(!t)return t;const{printWidth:o}=r,{tagStringLength:i=0,beginningSpace:c}=a,l=[...(t=(t=t.replace(/^(\d+)[-][\s|]+/g,"$1. ")).replace(/\n+(\s*\d+)[-][\s]+/g,"\n$1. ")).matchAll(/```\S*?\n[\s\S]+?```/gm),...t.matchAll(/^\r?\n^(?:(?:(?:[ ]{4}|\t).*(?:\r?\n|$))+)/gm)],p=[];t=t.replace(/((\n|^)\|[\s\S]*?)((\n[^|])|$)/g,((e,t,n,r,s,a)=>{for(const t of l)if(void 0!==t.index&&t.index<=a+1&&a+e.length+1<=t.index+t[0].length)return e;return e=r?e.slice(0,-1):e,p.push(e),`\n\n${de}\n\n${r?r.slice(1):""}`})),r.jsdocCapitalizeDescription&&!ee.includes(e)&&(t=ie(t)),t=`${i?`${"!".repeat(i-1)}?`:""}${t.startsWith("```")?"\n":""}${t}`;let d=0;t=t.replace(new RegExp(`\\n[ ]{${c.length}}`,"g"),"\n");const u=s.fromMarkdown(t);let m=await async function t(s,a,i){return Array.isArray(s.children)?(await Promise.all(s.children.map((async(n,c)=>{switch(n.type){case"listItem":{let e=`\n${a}- `;if("number"==typeof s.start){const t=c+(s.start??1);e=`\n${a}${t}. `}const r=a+" ".repeat(e.length-1);return`${e}${(await t(n,r,s)).trim()}`}case"list":{let r="";return e!==w&&"root"===s.type&&c===s.children.length-1&&(r="\n"),`\n${await t(n,a,s)}${r}`}case"paragraph":{const s=await t(n,a,i);return n.costumeType===de?s:`\n\n${s.split("\\\n").map((t=>{const n=[];t=t.replace(/{@(link|linkcode|linkplain)[\s](([^{}])*)}/g,((e,t,r)=>(n.push(r),`{@${t}${"_".repeat(r.length)}}`))),t=t.replace(/\s+/g," "),r.jsdocCapitalizeDescription&&!ee.includes(e)&&(t=ie(t)),r.jsdocDescriptionWithDot&&(t=t.replace(/([\w\p{L}])$/u,"$1."));let s=function(e,t,n){let r=e.trim();if(!r)return r;let s="";for(;r.length>t;){let e=r.lastIndexOf(" ",r.startsWith("\n")?t+1:t);e<=n.length&&(e=r.indexOf(" ",n.length+1)),-1===e&&(e=r.length),s+=r.substring(0,e),r=r.substring(e+1),r&&(r=`${n}${r}`,r=`\n${r}`)}return s+=r,`${n}${s}`}(t,o,a);return s=s.replace(/{@(link|linkcode|linkplain)([_]+)}/g,((e,t,r)=>{const s=n[0];return s.length===r.length?(n.shift(),`{@${t} ${s}}`):e})),s})).join("\\\n")}`}case"strong":return`**${await t(n,a,s)}**`;case"emphasis":return`_${await t(n,a,s)}_`;case"heading":return`\n\n${a}${"#".repeat(n.depth)} ${await t(n,a,s)}`;case"link":case"image":return`[${await t(n,a,s)}](${n.url})`;case"linkReference":return`[${await t(n,a,s)}][${n.label}]`;case"definition":return`\n\n[${n.label}]: ${n.url}`;case"blockquote":return`\n\n> ${(await t(n,"",s)).trim().replace(/(\n+)/g,`$1${a}> `)}`}return t(n,a,s)})))).join(""):async function(e,t,s){if("inlineCode"===e.type)return`\`${e.value}\``;if("code"===e.type){let n=e.value||"",s=t;if(n)if(e.lang){const s=(e=>{switch(e){case"js":case"javascript":case"jsx":return["babel","babel-flow","vue"];case"ts":case"typescript":case"tsx":return["typescript","babel-ts","angular"];case"json":case"css":return["css"];case"less":return["less"];case"scss":return["scss"];case"html":return["html"];case"yaml":return["yaml"];default:return["babel"]}})(e.lang.toLowerCase()),a=s?.includes(r.parser)?r.parser:s?.[0]||e.lang;n=await ce(n,t,{...r,parser:a,jsdocKeepUnParseAbleExampleIndent:!0})}else r.jsdocPreferCodeFences||(s=t+" ".repeat(4)),n=await ce(n,s,{...r,jsdocKeepUnParseAbleExampleIndent:!0});const a=r.jsdocPreferCodeFences||!!e.lang;return n=a?n:n.trimEnd(),n?a?`\n\n${s}\`\`\`${e.lang||""}${n}\`\`\``:`\n${n}`:""}if(e.value===de&&(s&&(s.costumeType=de),p.length>0)){let s=p?.[d]||"";return d++,s&&(s=(await n.format(s,{...r,parser:"markdown"})).trim()),`${s?`\n\n${t}${s.split("\n").join(`\n${t}`)}`:e.value}`}return"break"===e.type?"\\\n":e.value||e.title||e.alt||""}(s,a,i)}(u,c,null);return m=m.replace(/^[\s\n]+/g,""),m=m.replace(/^([!]+\?)/g,""),m}const me=async({name:e,description:t,type:n,tag:r},s,a,o,i,c,l)=>{let p="\n";if(r===J.tag)return p;const{printWidth:d,jsdocSpaces:u,jsdocVerticalAlignment:m,jsdocDescriptionTag:g,tsdoc:f,useTabs:h,tabWidth:j,jsdocSeparateTagGroups:y}=o,$=" ".repeat(u);let b=0,v=0,I=0,x=0;m&&ne.includes(r)&&(r?b+=i-r.length:i&&(x+=i+$.length),n?v+=c-n.length:c&&(x+=c+$.length),e?I+=l-e.length:l&&(x=l+$.length));const L=r!==w||g;if(L&&(p+=`@${r}${" ".repeat(b||0)}`),n){p+=$+(()=>{if(!pe(r))return`{${n}}`;if("[]"===n)return"[ ]";if("{}"===n)return"{ }";return/^{.*[A-z0-9_]+ ?:.*}$/.test(n)?n.replace(/; ([A-z0-9_])/g,", $1"):n})()+" ".repeat(v)}if(e&&(p+=`${$}${e}${" ".repeat(I)}`),r!==S||f){if(t){let e="";if(L&&(p+=$+" ".repeat(x)),ee.includes(r)||void 0===ae[r])e=t;else{const[,n]=/^\s*(\S+)/.exec(t)||["",""],s=r===w||[S,z,R].includes(r)&&f?"":" ";e=r!==w&&p.length+n.length>d||[z,R].includes(r)?`\n${s}`+await ue(r,t,o,{beginningSpace:s}):await ue(r,t,o,{tagStringLength:p.length-1,beginningSpace:s})}y&&(e=e.trimEnd()),p+=e.startsWith("\n")?e.replace(/^\n[\s]+\n/g,"\n"):e.trimStart()}}else{const e=t.match(/<caption>([\s\S]*?)<\/caption>/i);e&&(t=t.replace(e[0],""),p=`${p} ${e[0]}`);const n=h?"\t":" ".repeat(j);p+=(await ce(t,n,o)).replace(new RegExp(`^\\n${n.replace(/[\t]/g,"[\\t]").replace(/[^S\r\n]/g,"[^S\\r\\n]")}\\n`),"").trimEnd()}return p+=function({tag:e,isEndTag:t}){return[w,S,K].includes(e)&&!t?"\n":""}({tag:r,isEndTag:s===a.length-1}),p},{name:ge,tag:fe,type:he,description:je}=t.tokenizers,ye=(e,r)=>async function(s,a,o){let i=o??a;const c=(le(r,i)?.parse||e)(s,i);i={...i,printWidth:i.jsdocPrintWidth??i.printWidth};const l="auto"===i.endOfLine?function(e){const t={"\r":0,"\r\n":0,"\n":0},n=/\r\n?|\n/g;let r;for(;r=n.exec(e);)t[r[0]]++;const s=t["\r"],a=t["\r\n"],o=t["\n"],i=Math.max(s,a,o);return o===i?"lf":a===i?"crlf":"cr"}(s):i.endOfLine;return i={...i,endOfLine:"lf"},await Promise.all(c.comments.map((async e=>{if(!we(e))return;const r=function(e,t){try{const n=e.split("\n");let r=0;for(let e=0;e<t.loc.end.line-1;e++)r+=n[e].length+1;r+=t.loc.end.column;const s=e.slice(r),a=s.match(/^\s*function\s+\w*\s*\(([^)]*)\)/);if(a){const e=a[1];return e.split(",").map((e=>{const t=e.trim(),n=t.indexOf(":");return(n>-1?t.slice(0,n):t).split(/\s+/)[0].replace(/[{}[\]]/g,"")})).filter((e=>e&&"..."!==e))}const o=s.match(/^\s*(?:const|let|var)\s+\w+\s*=\s*\(([^)]*)\)\s*=>/);if(o){const e=o[1];return e.split(",").map((e=>{const t=e.trim(),n=t.indexOf(":");return(n>-1?t.slice(0,n):t).split(/\s+/)[0].replace(/[{}[\]]/g,"")})).filter((e=>e&&"..."!==e))}const i=s.match(/^\s*(\w+)\s*\(([^)]*)\)/);if(i){const e=i[2];return e.split(",").map((e=>{const t=e.trim(),n=t.indexOf(":");return(n>-1?t.slice(0,n):t).split(/\s+/)[0].replace(/[{}[\]]/g,"")})).filter((e=>e&&"..."!==e))}return}catch(e){return}}(s,e),a=e.value;e.value=e.value.replace(/^([*]+)/g,"*");const o=`/*${e.value.replace(/\r\n?/g,"\n")}*/`;if(!/^\/\*\*[\s\S]+?\*\/$/.test(o))return;const c=t.parse(o,{spacing:"preserve",tokenizers:[fe(),e=>pe(e.tag)?e:he("preserve")(e),ge(),je("preserve")]})[0];if(e.value="",!c)return;!function(e){e.tags=e.tags.map((({tag:e,type:t,name:n,description:r,default:s,...a})=>{e=e||"",t=t||"",n=n||"",r=r||"",s=s?.trim();const o=e.indexOf("{");-1!==o&&"}"===e[e.length-1]&&(t=e.slice(o+1,-1)+" "+t,e=e.slice(0,o));const i=(e=e.trim()).toLowerCase(),c=Se.findIndex((([e])=>e.toLowerCase()===i));return c>=0?e=Se[c][0]:i in Y&&(e=Y[i]),t=t.trim(),(n=n.trim())&&X.includes(e)&&(r=`${n} ${r}`,n=""),t&&Z.includes(e)&&(r=`{${t}} ${r}`,t=""),{tag:e,type:t,name:n,description:r,default:s,...a}}))}(c),function(e){let t=e.description||"";e.description="",e.tags=e.tags.filter((({description:e,tag:n})=>n.toLowerCase()!==w||(e.trim()&&(t+="\n\n"+e),!1))),t&&e.tags.unshift({tag:w,description:t,name:void 0,type:void 0,source:[],optional:!1,problems:[]})}(c);const p=function(e,t,n){const r=t.split(/\r\n?|\n/g)[e.loc.start.line-1];let s=0,a=0;for(let t=e.loc.start.column-1;t>=0;t--){const e=r[t];if(" "===e)s++;else{if("\t"!==e)break;a++}}return n.printWidth-(s+a*n.tabWidth)-" * ".length}(e,s,i);let d=0,u=0,m=0,g=c.tags.map((({type:e,optional:t,...n})=>(e&&(e=e.replace(/[=]$/,(()=>(t=!0,""))),e=function(e,t){const n=[];let r=e.replace(/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/g,(e=>(n.push(e),`String$${n.length-1}$`)));return r.includes("`")?e:(r=t(r),r.replace(/String\$(\d+)\$/g,((e,t)=>n[t])))}(e,(e=>{e=(e=(e=(e=e.trim()).replace(/\.</g,"<")).replace(/\*/g," any ")).replace(/^\?\s*(\w+)$/,"$1 | null").replace(/^(\w+)\s*\?$/,"$1 | null");let t=!0;for(;t;)t=!1,e=e.replace(/(^|[^$\w\xA0-\uFFFF])Array\s*<((?:[^<>=]|=>|=(?!>)|<(?:[^<>=]|=>|=(?!>))+>)+)>/g,((e,n,r)=>(t=!0,`${n}(${r})[]`)));return e}))),{...n,type:e,optional:t})));g=$e(g,r,i),i.jsdocSeparateReturnsFromParam&&(g=g.flatMap(((e,t)=>e.tag===N&&g[t-1]?.tag===M?[J,e]:[e]))),i.jsdocAddDefaultToDescription&&(g=g.map(ve)),g=await Promise.all(g.map(Ie).map((async({type:e,...t})=>(e&&(e=await async function(e,t){try{const r="type name = ";let s=e,a=!1;return s.startsWith("...")&&(a=!0,s=`(${s.slice(3)})[]`),s=await n.format(`${r}${s}`,{...t,parser:"typescript",plugins:[],filepath:"file.ts"}),s=s.slice(r.length),s=s.replace(/^\s*/g,"").replace(/[;\n]*$/g,"").replace(/^\|/g,"").trim(),a&&(s="..."+s.replace(/\[\s*\]$/,"")),s}catch(t){return e}}(e,{...i,printWidth:p})),{...t,type:e})))).then((e=>e.map((({type:e,name:t,description:n,tag:r,...s})=>(ne.includes(r)&&(d=Math.max(d,r.length),u=Math.max(u,e.length),m=Math.max(m,t.length)),{type:e,name:t,description:n,tag:r,...s}))))),i.jsdocSeparateTagGroups&&(g=g.flatMap(((e,t)=>{const n=g[t-1];return n&&n.tag!==w&&n.tag!==S&&n.tag!==J.tag&&e.tag!==J.tag&&n.tag!==e.tag?[J,e]:[e]})));const f=g.filter((({description:e,tag:t})=>!(!e&&te.includes(t))));for(const[t,n]of f.entries()){const r=await me(n,t,f,{...i,printWidth:p},d,u,m);e.value+=r}e.value=e.value.trimEnd(),e.value&&(e.value=function(e,t,n){return"singleLine"===n.jsdocCommentLineStrategy&&0===oe(t.trim(),"\n")||"keep"===n.jsdocCommentLineStrategy&&0===oe(e,"\n")?`* ${t.trim()} `:`*${t.replace(/(\n(?!$))/g,"\n * ")}\n `}(a,e.value,i)),"cr"===l?e.value=e.value.replace(/\n/g,"\r"):"crlf"===l&&(e.value=e.value.replace(/\n/g,"\r\n"))}))),c.comments=c.comments.filter((e=>!(we(e)&&!e.value))),c};function $e(e,t,n){let r=!1,s=!1;const a={},o={},i=e.reduce(((e,t)=>{if((0===e.length||re.includes(t.tag)&&r)&&(r=!1,e.push([])),se.includes(t.tag)&&(r=!0),n.jsdocFormatImports&&t.tag===C){const r=function(e){const t=e.description.match(/([^\s\\,\\{\\}]+)?(?:[^\\{\\}]*)\{?([^\\{\\}]*)?\}?(?:\s+from\s+)[\\'\\"](\S+)[\\'\\"]/s);if(!t)return null;const n=t[1]||"",r=t[2]||"",s=t[3]||"",a=r.matchAll(/([^\s\\,\\{\\}]+)(?:\s+as\s+)?([^\s\\,\\{\\}]+)?/g),o=[];for(const e of a)o.push({name:e[1],alias:e[2]});return{spec:e,src:s,namedImports:o,defaultImport:n}}(t);if(r)if(n.jsdocMergeImports){if(a[r.src])return a[r.src].push(r),e;a[r.src]=[r]}else xe(r,n),o[r.spec.description]=r.src}return e[e.length-1].push(t),e}),[]);return n.jsdocFormatImports&&n.jsdocMergeImports&&Object.keys(a).forEach((e=>{const t=a[e],r=t[0].spec,{defaultImport:s,namedImports:i}=t.reduce(((e,t)=>(e.namedImports.push(...t.namedImports),t.defaultImport&&(e.defaultImport=t.defaultImport),e)),{namedImports:[],defaultImport:void 0});xe({src:e,defaultImport:s,namedImports:i,spec:r},n),o[r.description]=e})),e=i.flatMap(((e,r,a)=>(e.sort(((e,r)=>{if(t&&t.length>1&&e.tag===M&&r.tag===M){const n=t.indexOf(e.name),s=t.indexOf(r.name);return n>-1&&s>-1?n-s:0}if(n.jsdocFormatImports&&e.tag===C&&r.tag===C){const t=o[e.description]??e.description,n=o[r.description]??e.description,s=t.startsWith(".")?1:0,a=n.startsWith(".")?1:0;return s===a?t.localeCompare(n):s-a}return be(e.tag,n)-be(r.tag,n)})),a.length-1!==r&&e.push(J),r>0&&e[0]?.tag&&!re.includes(e[0].tag)&&(s=!0),e))),s?$e(e,t,n):e}function be(e,t){if(e===w&&!t.jsdocDescriptionTag)return-1;let n;return n=void 0!==t.jsdocTagsOrder?.[e]?t.jsdocTagsOrder[e]:ae[e],void 0===n?ae.other:n}function we(e){return"CommentBlock"===e.type||"Block"===e.type}const Se=Object.entries(ae);function ve(e){if(e.optional&&e.default){let{description:t}=e;return t=t.replace(/(?:\s*Default\s+is\s+`.*?`\.?)+/g,""),t&&!/[.\n]$/.test(t)&&(t+="."),t+=` Default is \`${e.default}\``,{...e,description:t.trim()}}return e}function Ie({name:e,optional:t,default:n,tag:r,type:s,source:a,description:o,...i}){if(pe(r)){const t=(a.find((e=>e.source.includes(`@${r}`)))?.source||"").match(/@default(Value)? (\[.*]|{.*}|\(.*\)|'.*'|".*"|`.*`| \w+)( ((?!\*\/).+))?/),n=t?.[2]||"",i=t?.[4]||"";t&&(s=n,e="",o=i)}else t&&(e?e=n?`[${e}=${n}]`:`[${e}]`:s=`${s} | undefined`);return{...i,tag:r,name:e,description:o,optional:t,type:s,source:a,default:n}}function xe(e,t){const{defaultImport:n,namedImports:r,src:s,spec:a}=e;r.sort(((e,t)=>(e.alias??e.name).localeCompare(t.alias??t.name)));const o=[];if(n&&o.push(n),r.length>0){const e=t.jsdocNamedImportLineSplitting&&r.length>1,n=r.map((t=>{const n=t.alias?`${t.name} as ${t.alias}`:`${t.name}`;return e?` ${n}`:n})).join(e?",\n":", "),s=e?`{\n${n}\n}`:t.jsdocNamedImportPadding?`{ ${n} }`:`{${n}}`;o.push(s)}a.description=`${o.join(", ")} from "${s}"`}const Le={jsdocSpaces:{name:"jsdocSpaces",type:"int",category:"jsdoc",default:1,description:"How many spaces will be used to separate tag elements."},jsdocDescriptionWithDot:{name:"jsdocDescriptionWithDot",type:"boolean",category:"jsdoc",default:!1,description:"Should dot be inserted at the end of description"},jsdocDescriptionTag:{name:"jsdocDescriptionTag",type:"boolean",category:"jsdoc",default:!1,description:"Should description tag be used"},jsdocVerticalAlignment:{name:"jsdocVerticalAlignment",type:"boolean",category:"jsdoc",default:!1,description:"Should tags, types, names and description be aligned"},jsdocKeepUnParseAbleExampleIndent:{name:"jsdocKeepUnParseAbleExampleIndent",type:"boolean",category:"jsdoc",default:!1,description:"Should unParseAble example (pseudo code or no js code) keep its indentation"},jsdocSingleLineComment:{name:"jsdocSingleLineComment",type:"boolean",category:"jsdoc",deprecated:"use jsdocCommentLineStrategy instead will be remove on v2",default:!0,description:"Should compact single line comment"},jsdocCommentLineStrategy:{name:"jsdocCommentLineStrategy",type:"choice",choices:[{value:"singleLine",description:"Should compact single line comment, if possible"},{value:"multiline",description:"Should compact multi line comment"},{value:"keep",description:"Should keep original line comment"}],category:"jsdoc",default:"singleLine",description:"How comments line should be"},jsdocSeparateReturnsFromParam:{name:"jsdocSeparateReturnsFromParam",type:"boolean",category:"jsdoc",default:!1,description:"Add an space between last @param and @returns"},jsdocSeparateTagGroups:{name:"jsdocSeparateTagGroups",type:"boolean",category:"jsdoc",default:!1,description:"Add an space between tag groups"},jsdocCapitalizeDescription:{name:"jsdocCapitalizeDescription",type:"boolean",category:"jsdoc",default:!0,description:"Should capitalize first letter of description"},tsdoc:{name:"tsdoc",type:"boolean",category:"jsdoc",default:!1,description:"Should format as tsdoc"},jsdocPrintWidth:{name:"jsdocPrintWidth",type:"int",category:"jsdoc",default:void 0,description:"If You don't set value to jsdocPrintWidth, the printWidth will be use as jsdocPrintWidth."},jsdocAddDefaultToDescription:{name:"jsdocAddDefaultToDescription",type:"boolean",category:"jsdoc",default:!0,description:"Add Default value of a param to end description"},jsdocPreferCodeFences:{name:"jsdocPreferCodeFences",type:"boolean",category:"jsdoc",default:!1,description:'Prefer to render code blocks using "fences" (triple backticks). If not set, blocks without a language tag will be rendered with a four space indentation.'},jsdocLineWrappingStyle:{name:"jsdocLineWrappingStyle",type:"choice",choices:[{value:"greedy",description:"Lines wrap as soon as they reach the print width"}],category:"jsdoc",default:"greedy",description:"Strategy for wrapping lines for the given print width. More options may be added in the future."},jsdocTagsOrder:{name:"jsdocTagsOrder",type:"string",category:"jsdoc",default:void 0,description:"How many spaces will be used to separate tag elements."},jsdocMergeImports:{name:"jsdocMergeImports",type:"boolean",category:"jsdoc",default:!0,description:"Merge all imports tags in the same block from the same source into one tag"},jsdocNamedImportPadding:{name:"jsdocNamedImportPadding",type:"boolean",category:"jsdoc",default:!1,description:"Whether or not to pad brackets for single line named imports"},jsdocNamedImportLineSplitting:{name:"jsdocNamedImportLineSplitting",type:"boolean",category:"jsdoc",default:!0,description:"Split import tags with multiple named imports into multiple lines"},jsdocFormatImports:{name:"jsdocFormatImports",type:"boolean",category:"jsdoc",default:!0,description:"Format import tags"}},Pe={jsdocSpaces:Le.jsdocSpaces.default,jsdocPrintWidth:Le.jsdocPrintWidth.default,jsdocDescriptionWithDot:Le.jsdocDescriptionWithDot.default,jsdocDescriptionTag:Le.jsdocDescriptionTag.default,jsdocVerticalAlignment:Le.jsdocVerticalAlignment.default,jsdocKeepUnParseAbleExampleIndent:Le.jsdocKeepUnParseAbleExampleIndent.default,jsdocSingleLineComment:Le.jsdocSingleLineComment.default,jsdocCommentLineStrategy:Le.jsdocCommentLineStrategy.default,jsdocSeparateReturnsFromParam:Le.jsdocSeparateReturnsFromParam.default,jsdocSeparateTagGroups:Le.jsdocSeparateTagGroups.default,jsdocCapitalizeDescription:Le.jsdocCapitalizeDescription.default,jsdocAddDefaultToDescription:Le.jsdocAddDefaultToDescription.default,jsdocPreferCodeFences:Le.jsdocPreferCodeFences.default,tsdoc:Le.tsdoc.default,jsdocLineWrappingStyle:Le.jsdocLineWrappingStyle.default,jsdocTagsOrder:Le.jsdocTagsOrder.default,jsdocFormatImports:Le.jsdocFormatImports.default,jsdocNamedImportPadding:Le.jsdocNamedImportPadding.default,jsdocMergeImports:Le.jsdocMergeImports.default,jsdocNamedImportLineSplitting:Le.jsdocNamedImportLineSplitting.default},We={get babel(){return Ce(l.default.parsers.babel,"babel")},get"babel-flow"(){return Ce(l.default.parsers["babel-flow"],"babel-flow")},get"babel-ts"(){return Ce(l.default.parsers["babel-ts"],"babel-ts")},get flow(){return Ce(p.default.parsers.flow,"flow")},get typescript(){return Ce(d.default.parsers.typescript,"typescript")},get"jsdoc-parser"(){return Ce(l.default.parsers["babel-ts"],"babel-ts")}};function Ce(e,t){const n=ye(e.parse,t),r=(a,o)=>{!function(e){e.jsdocTagsOrder&&(e.jsdocTagsOrder=JSON.parse(e.jsdocTagsOrder));if(e.jsdocCommentLineStrategy)return;e.jsdocSingleLineComment?e.jsdocCommentLineStrategy="singleLine":e.jsdocCommentLineStrategy="multiline"}(o);const i=le(t,o);if(!i)return e.preprocess?e.preprocess(a,o):a;const c=i.preprocess||e.preprocess;return Object.assign(s,{...s,...i,preprocess:r,parse:n}),c?c(a,o):a},s={...e,preprocess:r,parse:n};return s}e.defaultOptions=Pe,e.options=Le,e.parsers=We,Object.defineProperty(e,"__esModule",{value:!0})}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("comment-parser"),require("prettier"),require("binary-searching"),require("mdast-util-from-markdown"),require("prettier/plugins/babel"),require("prettier/plugins/flow"),require("prettier/plugins/typescript")):"function"==typeof define&&define.amd?define(["exports","comment-parser","prettier","binary-searching","mdast-util-from-markdown","prettier/plugins/babel","prettier/plugins/flow","prettier/plugins/typescript"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).sayHello={},e.commentParser,e.prettier,null,e.mdastUtilFromMarkdown,e.parserBabel,e.parserFlow,e.parserTypescript)}(this,(function(e,t,n,r,s,a,o,i){"use strict";function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=c(a),p=c(o),d=c(i);const u="abstract",m="borrows",g="callback",f="category",h="class",j="constant",y="default",$="defaultValue",b="deprecated",w="description",S="example",v="extends",I="external",C="file",x="fires",L="function",P="ignore",W="import",k="license",D="member",T="memberof",A="module",E="namespace",O="overload",F="override",M="param",R="privateRemarks",_="property",z="remarks",N="returns",U="since",q="this",K="throws",V="todo",G="type",H="typedef",B="satisfies",J="yields",Y={tag:"this_is_for_space",name:"",optional:!1,type:"",description:"",source:[],problems:[]},Q={arg:M,argument:M,const:j,constructor:h,desc:w,emits:x,examples:S,exception:K,fileoverview:C,func:L,host:I,method:L,overview:C,params:M,prop:_,return:N,var:D,virtual:u,yield:J,hidden:P},X=[y,$],Z=[m,f,b,w,S,v,k,W,A,E,O,F,R,z,N,U,q,K,V,J,C,...X],ee=[m,m,b,w,S,P,W,k,A,E,O,F,R,z,U,V,C],te=[m,...X,W,T,A,"see"],ne=[m,f,w,S,W,R,z,U,V],re=[v,M,_,N,q,K,G,B,H,J],se=[g,H],ae=[...se,G,_,M,N,q,J,K],oe={[W]:0,[z]:1,[R]:2,providesModule:3,[A]:4,[k]:5,flow:6,async:7,private:8,[P]:9,[T]:10,version:11,[C]:12,author:13,[b]:14,[U]:15,[f]:16,[w]:17,[S]:18,[u]:19,augments:20,[j]:21,[y]:22,[$]:23,[I]:24,[O]:25,[x]:26,template:27,typeParam:28,[L]:29,[E]:30,[m]:31,[h]:32,[v]:33,[D]:34,[H]:35,[G]:36,[B]:37,[_]:38,[g]:39,[q]:39.5,[M]:40,[J]:41,[N]:42,[K]:43,other:44,see:45,[V]:46};function ie(e,t){return(e.match(new RegExp(t,"g"))||[]).length}function ce(e){return e?e.match(/^https?:\/\//i)?e:e.startsWith("- ")?e.slice(0,2)+ce(e.slice(2)):e[0].toUpperCase()+e.slice(1):e}async function le(e,t,r){const{printWidth:s,jsdocKeepUnParseAbleExampleIndent:a}=r;e.split("\n").slice(1).every((e=>!e.trim()||e.startsWith(t)))&&(e=e.replace(new RegExp(`\n${t.replace(/[\t]/g,"[\\t]")}`,"g"),"\n"));try{let a="";const o=s-4;a=e.trim().startsWith("{")?await n.format(e||"",{...r,parser:"json",printWidth:o}):await n.format(e||"",{...r,printWidth:o}),e=a.replace(/(^|\n)/g,`\n${t}`)}catch(n){e=(e=`\n${e.split("\n").map((e=>`${t}${a?e:e.trim()}`)).join("\n")}\n`).replace(/^\n[\s]+\n/g,"\n")}return e}const pe=(e,t)=>{const n=t.plugins.find((t=>"object"==typeof t&&null!==t&&!(t instanceof URL)&&t.name&&"prettier-plugin-jsdoc"!==t.name&&t.parsers&&!("jsdoc-parser"in t.parsers)&&t.parsers.hasOwnProperty(e)));return n?n.parsers?.[e]:void 0},de=e=>X.includes(e),ue="2@^5!~#sdE!_TABLE";async function me(e,t,r,a){if(!t)return t;const{printWidth:o}=r,{tagStringLength:i=0,beginningSpace:c}=a,l=t,p=[...(t=(t=t.replace(/^(\d+)[-][\s|]+/g,"$1. ")).replace(/\n+(\s*\d+)[-][\s]+/g,"\n$1. ")).matchAll(/```\S*?\n[\s\S]+?```/gm),...t.matchAll(/^\r?\n^(?:(?:(?:[ ]{4}|\t).*(?:\r?\n|$))+)/gm)],d=[];t=t.replace(/((\n|^)\|[\s\S]*?)((\n[^|])|$)/g,((e,t,n,r,s,a)=>{for(const t of p)if(void 0!==t.index&&t.index<=a+1&&a+e.length+1<=t.index+t[0].length)return e;return e=r?e.slice(0,-1):e,d.push(e),`\n\n${ue}\n\n${r?r.slice(1):""}`})),r.jsdocCapitalizeDescription&&!te.includes(e)&&(t=ce(t)),t=`${i?`${"!".repeat(i-1)}?`:""}${t.startsWith("```")?"\n":""}${t}`;let u=0;t=t.replace(new RegExp(`\\n[ ]{${c.length}}`,"g"),"\n");const m=s.fromMarkdown(t);let g=await async function t(s,a,c){return Array.isArray(s.children)?(await Promise.all(s.children.map((async(n,p)=>{switch(n.type){case"listItem":{let e=`\n${a}- `;if("number"==typeof s.start){const t=p+(s.start??1);e=`\n${a}${t}. `}const r=a+" ".repeat(e.length-1);return`${e}${(await t(n,r,s)).trim()}`}case"list":{let r="";return e!==w&&"root"===s.type&&p===s.children.length-1&&(r="\n"),`\n${await t(n,a,s)}${r}`}case"paragraph":{const s=await t(n,a,c);return n.costumeType===ue?s:`\n\n${s.split("\\\n").map((t=>{const n=[];t=t.replace(/{@(link|linkcode|linkplain)[\s](([^{}])*)}/g,((e,t,r)=>(n.push(r),`{@${t}${"_".repeat(r.length)}}`)));const s=t=>r.jsdocCapitalizeDescription&&!te.includes(e)?ce(t):t,c=e=>r.jsdocDescriptionWithDot?e.replace(/([\w\p{L}])$/u,"$1."):e,p=e=>function(e,t,n){let r=e.trim();if(!r)return r;let s="";for(;r.length>t;){let e=r.lastIndexOf(" ",r.startsWith("\n")?t+1:t);e<=n.length&&(e=r.indexOf(" ",n.length+1)),-1===e&&(e=r.length),s+=r.substring(0,e),r=r.substring(e+1),r&&(r=`${n}${r}`,r=`\n${r}`)}return s+=r,`${n}${s}`}((e=>c(s(e)))(e.replace(/\s+/g," ")),o,a),d="balance"===r.jsdocLineWrappingStyle,u=l.includes("\n");let m;if(d&&u){const n=l.split("\n").map((e=>e.trim())).filter((e=>e.length>0)),r=e===w&&i>0?o-i:o-a.length,d=n.every((e=>e.length<=r)),u=n.length>1;if(d&&u){const e=n.map(((e,t)=>{const r=0===t,a=t===n.length-1;let o=e;return r&&(o=s(o)),a&&(o=c(o)),o}));m=e.map((e=>`${a}${e}`)).join("\n")}else m=p(t)}else m=p(t);return m=m.replace(/{@(link|linkcode|linkplain)([_]+)}/g,((e,t,r)=>{const s=n[0];return s.length===r.length?(n.shift(),`{@${t} ${s}}`):e})),m})).join("\\\n")}`}case"strong":return`**${await t(n,a,s)}**`;case"emphasis":return`_${await t(n,a,s)}_`;case"heading":return`\n\n${a}${"#".repeat(n.depth)} ${await t(n,a,s)}`;case"link":case"image":return`[${await t(n,a,s)}](${n.url})`;case"linkReference":return`[${await t(n,a,s)}][${n.label}]`;case"definition":return`\n\n[${n.label}]: ${n.url}`;case"blockquote":return`\n\n> ${(await t(n,"",s)).trim().replace(/(\n+)/g,`$1${a}> `)}`}return t(n,a,s)})))).join(""):async function(e,t,s){if("inlineCode"===e.type)return`\`${e.value}\``;if("code"===e.type){let n=e.value||"",s=t;if(n)if(e.lang){const s=(e=>{switch(e){case"js":case"javascript":case"jsx":return["babel","babel-flow","vue"];case"ts":case"typescript":case"tsx":return["typescript","babel-ts","angular"];case"json":case"css":return["css"];case"less":return["less"];case"scss":return["scss"];case"html":return["html"];case"yaml":return["yaml"];default:return["babel"]}})(e.lang.toLowerCase()),a=s?.includes(r.parser)?r.parser:s?.[0]||e.lang;n=await le(n,t,{...r,parser:a,jsdocKeepUnParseAbleExampleIndent:!0})}else r.jsdocPreferCodeFences||(s=t+" ".repeat(4)),n=await le(n,s,{...r,jsdocKeepUnParseAbleExampleIndent:!0});const a=r.jsdocPreferCodeFences||!!e.lang;return n=a?n:n.trimEnd(),n?a?`\n\n${s}\`\`\`${e.lang||""}${n}\`\`\``:`\n${n}`:""}if(e.value===ue&&(s&&(s.costumeType=ue),d.length>0)){let s=d?.[u]||"";return u++,s&&(s=(await n.format(s,{...r,parser:"markdown"})).trim()),`${s?`\n\n${t}${s.split("\n").join(`\n${t}`)}`:e.value}`}return"break"===e.type?"\\\n":e.value||e.title||e.alt||""}(s,a,c)}(m,c,null);return g=g.replace(/^[\s\n]+/g,""),g=g.replace(/^([!]+\?)/g,""),g}const ge=async({name:e,description:t,type:n,tag:r},s,a,o,i,c,l)=>{let p="\n";if(r===Y.tag)return p;const{printWidth:d,jsdocSpaces:u,jsdocVerticalAlignment:m,jsdocDescriptionTag:g,tsdoc:f,useTabs:h,tabWidth:j,jsdocSeparateTagGroups:y}=o,$=" ".repeat(u);let b=0,v=0,I=0,C=0;m&&re.includes(r)&&(r?b+=i-r.length:i&&(C+=i+$.length),n?v+=c-n.length:c&&(C+=c+$.length),e?I+=l-e.length:l&&(C=l+$.length));const x=r!==w||g;if(x&&(p+=`@${r}${" ".repeat(b||0)}`),n){p+=$+(()=>{if(!de(r))return`{${n}}`;if("[]"===n)return"[ ]";if("{}"===n)return"{ }";return/^{.*[A-z0-9_]+ ?:.*}$/.test(n)?n.replace(/; ([A-z0-9_])/g,", $1"):n})()+" ".repeat(v)}if(e&&(p+=`${$}${e}${" ".repeat(I)}`),r!==S||f){if(t){let e="";if(x&&(p+=$+" ".repeat(C)),te.includes(r)||void 0===oe[r])e=t;else{const[,n]=/^\s*(\S+)/.exec(t)||["",""],s=r===w||[S,z,R].includes(r)&&f?"":" ";e=r!==w&&p.length+n.length>d||[z,R].includes(r)?`\n${s}`+await me(r,t,o,{beginningSpace:s}):await me(r,t,o,{tagStringLength:p.length-1,beginningSpace:s})}y&&(e=e.trimEnd()),p+=e.startsWith("\n")?e.replace(/^\n[\s]+\n/g,"\n"):e.trimStart()}}else{const e=t.match(/<caption>([\s\S]*?)<\/caption>/i);e&&(t=t.replace(e[0],""),p=`${p} ${e[0]}`);const n=h?"\t":" ".repeat(j);p+=(await le(t,n,o)).replace(new RegExp(`^\\n${n.replace(/[\t]/g,"[\\t]").replace(/[^S\r\n]/g,"[^S\\r\\n]")}\\n`),"").trimEnd()}return p+=function({tag:e,isEndTag:t}){return[w,S,V].includes(e)&&!t?"\n":""}({tag:r,isEndTag:s===a.length-1}),p},{name:fe,tag:he,type:je,description:ye}=t.tokenizers,$e=(e,r)=>async function(s,a,o){let i=o??a;const c=pe(r,i)?.parse||e,l=await c(s,i);i={...i,printWidth:i.jsdocPrintWidth??i.printWidth,jsdocEmptyCommentStrategy:i.jsdocEmptyCommentStrategy??"remove"};const p="auto"===i.endOfLine?function(e){const t={"\r":0,"\r\n":0,"\n":0},n=/\r\n?|\n/g;let r;for(;r=n.exec(e);)t[r[0]]++;const s=t["\r"],a=t["\r\n"],o=t["\n"],i=Math.max(s,a,o);return o===i?"lf":a===i?"crlf":"cr"}(s):i.endOfLine;return i={...i,endOfLine:"lf"},l.comments||(l.comments=[]),await Promise.all(l.comments.map((async e=>{if(!Se(e))return;const r=function(e,t){try{const n=e.split("\n");let r=0;for(let e=0;e<t.loc.end.line-1;e++)r+=n[e].length+1;r+=t.loc.end.column;const s=e.slice(r),a=s.match(/^\s*function\s+\w*\s*\(([^)]*)\)/);if(a){const e=a[1];return e.split(",").map((e=>{const t=e.trim(),n=t.indexOf(":");return(n>-1?t.slice(0,n):t).split(/\s+/)[0].replace(/[{}[\]]/g,"")})).filter((e=>e&&"..."!==e))}const o=s.match(/^\s*(?:const|let|var)\s+\w+\s*=\s*\(([^)]*)\)\s*=>/);if(o){const e=o[1];return e.split(",").map((e=>{const t=e.trim(),n=t.indexOf(":");return(n>-1?t.slice(0,n):t).split(/\s+/)[0].replace(/[{}[\]]/g,"")})).filter((e=>e&&"..."!==e))}const i=s.match(/^\s*(\w+)\s*\(([^)]*)\)/);if(i){const e=i[2];return e.split(",").map((e=>{const t=e.trim(),n=t.indexOf(":");return(n>-1?t.slice(0,n):t).split(/\s+/)[0].replace(/[{}[\]]/g,"")})).filter((e=>e&&"..."!==e))}return}catch(e){return}}(s,e),a=e.value;e.value=e.value.replace(/^([*]+)/g,"*");const o=`/*${e.value.replace(/\r\n?/g,"\n")}*/`;if(!/^\/\*\*[\s\S]+?\*\/$/.test(o))return;const c=t.parse(o,{spacing:"preserve",tokenizers:[he(),e=>de(e.tag)?e:je("preserve")(e),fe(),ye("preserve")]})[0];if(e.value="",!c)return;!function(e){e.tags=e.tags.map((({tag:e,type:t,name:n,description:r,default:s,...a})=>{e=e||"",t=t||"",n=n||"",r=r||"",s=s?.trim();const o=e.indexOf("{");-1!==o&&"}"===e[e.length-1]&&(t=e.slice(o+1,-1)+" "+t,e=e.slice(0,o));const i=(e=e.trim()).toLowerCase(),c=ve.findIndex((([e])=>e.toLowerCase()===i));return c>=0?e=ve[c][0]:i in Q&&(e=Q[i]),t=t.trim(),(n=n.trim())&&Z.includes(e)&&(r=`${n} ${r}`,n=""),t&&ee.includes(e)&&(r=`{${t}} ${r}`,t=""),{tag:e,type:t,name:n,description:r,default:s,...a}}))}(c),function(e){let t=e.description||"";e.description="",e.tags=e.tags.filter((({description:e,tag:n})=>n.toLowerCase()!==w||(e.trim()&&(t+="\n\n"+e),!1))),t&&e.tags.unshift({tag:w,description:t,name:void 0,type:void 0,source:[],optional:!1,problems:[]})}(c);const l=function(e,t,n){const r=t.split(/\r\n?|\n/g)[e.loc.start.line-1];let s=0,a=0;for(let t=e.loc.start.column-1;t>=0;t--){const e=r[t];if(" "===e)s++;else{if("\t"!==e)break;a++}}return n.printWidth-(s+a*n.tabWidth)-" * ".length}(e,s,i);let d=0,u=0,m=0,g=c.tags.map((({type:e,optional:t,...n})=>(e&&(e=e.replace(/[=]$/,(()=>(t=!0,""))),e=function(e,t){const n=[];let r=e.replace(/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/g,(e=>(n.push(e),`String$${n.length-1}$`)));return r.includes("`")?e:(r=t(r),r.replace(/String\$(\d+)\$/g,((e,t)=>n[t])))}(e,(e=>{e=(e=(e=(e=e.trim()).replace(/\.</g,"<")).replace(/\*/g," any ")).replace(/^\?\s*(\w+)$/,"$1 | null").replace(/^(\w+)\s*\?$/,"$1 | null");let t=!0;for(;t;)t=!1,e=e.replace(/(^|[^$\w\xA0-\uFFFF])Array\s*<((?:[^<>=]|=>|=(?!>)|<(?:[^<>=]|=>|=(?!>))+>)+)>/g,((e,n,r)=>(t=!0,`${n}(${r})[]`)));return e}))),{...n,type:e,optional:t})));g=be(g,r,i),i.jsdocSeparateReturnsFromParam&&(g=g.flatMap(((e,t)=>e.tag===N&&g[t-1]?.tag===M?[Y,e]:[e]))),i.jsdocAddDefaultToDescription&&(g=g.map(Ie)),g=await Promise.all(g.map(Ce).map((async({type:e,...t})=>(e&&(e=await async function(e,t){try{const r="type name = ";let s=e,a=!1;return s.startsWith("...")&&(a=!0,s=`(${s.slice(3)})[]`),s=await n.format(`${r}${s}`,{...t,parser:"typescript",plugins:[],filepath:"file.ts"}),s=s.slice(r.length),s=s.replace(/^\s*/g,"").replace(/[;\n]*$/g,"").replace(/^\|/g,"").trim(),a&&(s="..."+s.replace(/\[\s*\]$/,"")),s}catch(t){return e}}(e,{...i,printWidth:l})),{...t,type:e})))).then((e=>e.map((({type:e,name:t,description:n,tag:r,...s})=>(re.includes(r)&&(d=Math.max(d,r.length),u=Math.max(u,e.length),m=Math.max(m,t.length)),{type:e,name:t,description:n,tag:r,...s}))))),i.jsdocSeparateTagGroups&&(g=g.flatMap(((e,t)=>{const n=g[t-1];return n&&n.tag!==w&&n.tag!==S&&n.tag!==Y.tag&&e.tag!==Y.tag&&n.tag!==e.tag?[Y,e]:[e]})));const f=g.filter((({description:e,tag:t})=>!(!e&&ne.includes(t))));for(const[t,n]of f.entries()){const r=await ge(n,t,f,{...i,printWidth:l},d,u,m);e.value+=r}e.value=e.value.trimEnd(),e.value&&(e.value=function(e,t,n){return"singleLine"===n.jsdocCommentLineStrategy&&0===ie(t.trim(),"\n")||"keep"===n.jsdocCommentLineStrategy&&0===ie(e,"\n")?`* ${t.trim()} `:`*${t.replace(/(\n(?!$))/g,"\n * ")}\n `}(a,e.value,i)),"cr"===p?e.value=e.value.replace(/\n/g,"\r"):"crlf"===p&&(e.value=e.value.replace(/\n/g,"\r\n"))}))),"remove"===i.jsdocEmptyCommentStrategy&&(l.comments=l.comments.filter((e=>!(Se(e)&&!e.value)))),l};function be(e,t,n){let r=!1,s=!1;const a={},o={},i=e.reduce(((e,t)=>{if((0===e.length||se.includes(t.tag)&&r)&&(r=!1,e.push([])),ae.includes(t.tag)&&(r=!0),n.jsdocFormatImports&&t.tag===W){const r=function(e){const t=e.description.match(/([^\s\\,\\{\\}]+)?(?:[^\\{\\}]*)\{?([^\\{\\}]*)?\}?(?:\s+from\s+)[\\'\\"](\S+)[\\'\\"]/s);if(!t)return null;const n=t[1]||"",r=t[2]||"",s=t[3]||"",a=r.matchAll(/([^\s\\,\\{\\}]+)(?:\s+as\s+)?([^\s\\,\\{\\}]+)?/g),o=[];for(const e of a)o.push({name:e[1],alias:e[2]});return{spec:e,src:s,namedImports:o,defaultImport:n}}(t);if(r)if(n.jsdocMergeImports){if(a[r.src])return a[r.src].push(r),e;a[r.src]=[r]}else xe(r,n),o[r.spec.description]=r.src}return e[e.length-1].push(t),e}),[]);return n.jsdocFormatImports&&n.jsdocMergeImports&&Object.keys(a).forEach((e=>{const t=a[e],r=t[0].spec,{defaultImport:s,namedImports:i}=t.reduce(((e,t)=>(e.namedImports.push(...t.namedImports),t.defaultImport&&(e.defaultImport=t.defaultImport),e)),{namedImports:[],defaultImport:void 0});xe({src:e,defaultImport:s,namedImports:i,spec:r},n),o[r.description]=e})),e=i.flatMap(((e,r,a)=>(e.sort(((e,r)=>{if(t&&t.length>1&&e.tag===M&&r.tag===M){const n=t.indexOf(e.name),s=t.indexOf(r.name);return n>-1&&s>-1?n-s:0}if(n.jsdocFormatImports&&e.tag===W&&r.tag===W){const t=o[e.description]??e.description,n=o[r.description]??e.description,s=t.startsWith(".")?1:0,a=n.startsWith(".")?1:0;return s===a?t.localeCompare(n):s-a}return we(e.tag,n)-we(r.tag,n)})),a.length-1!==r&&e.push(Y),r>0&&e[0]?.tag&&!se.includes(e[0].tag)&&(s=!0),e))),s?be(e,t,n):e}function we(e,t){if(e===w&&!t.jsdocDescriptionTag)return-1;let n;return n=void 0!==t.jsdocTagsOrder?.[e]?t.jsdocTagsOrder[e]:oe[e],void 0===n?oe.other:n}function Se(e){return"CommentBlock"===e.type||"Block"===e.type}const ve=Object.entries(oe);function Ie(e){if(e.optional&&e.default){let{description:t}=e;return t=t.replace(/(?:\s*Default\s+is\s+`.*?`\.?)+/g,""),t&&!/[.\n]$/.test(t)&&(t+="."),t+=` Default is \`${e.default}\``,{...e,description:t.trim()}}return e}function Ce({name:e,optional:t,default:n,tag:r,type:s,source:a,description:o,...i}){if(de(r)){const t=(a.find((e=>e.source.includes(`@${r}`)))?.source||"").match(/@default(Value)? (\[.*]|{.*}|\(.*\)|'.*'|".*"|`.*`| \w+)( ((?!\*\/).+))?/),n=t?.[2]||"",i=t?.[4]||"";t&&(s=n,e="",o=i)}else t&&(e?e=n?`[${e}=${n}]`:`[${e}]`:s=`${s} | undefined`);return{...i,tag:r,name:e,description:o,optional:t,type:s,source:a,default:n}}function xe(e,t){const{defaultImport:n,namedImports:r,src:s,spec:a}=e;r.sort(((e,t)=>(e.alias??e.name).localeCompare(t.alias??t.name)));const o=[];if(n&&o.push(n),r.length>0){const e=t.jsdocNamedImportLineSplitting&&r.length>1,n=r.map((t=>{const n=t.alias?`${t.name} as ${t.alias}`:`${t.name}`;return e?` ${n}`:n})).join(e?",\n":", "),s=e?`{\n${n}\n}`:t.jsdocNamedImportPadding?`{ ${n} }`:`{${n}}`;o.push(s)}a.description=`${o.join(", ")} from "${s}"`}const Le={jsdocSpaces:{name:"jsdocSpaces",type:"int",category:"jsdoc",default:1,description:"How many spaces will be used to separate tag elements."},jsdocDescriptionWithDot:{name:"jsdocDescriptionWithDot",type:"boolean",category:"jsdoc",default:!1,description:"Should dot be inserted at the end of description"},jsdocDescriptionTag:{name:"jsdocDescriptionTag",type:"boolean",category:"jsdoc",default:!1,description:"Should description tag be used"},jsdocVerticalAlignment:{name:"jsdocVerticalAlignment",type:"boolean",category:"jsdoc",default:!1,description:"Should tags, types, names and description be aligned"},jsdocKeepUnParseAbleExampleIndent:{name:"jsdocKeepUnParseAbleExampleIndent",type:"boolean",category:"jsdoc",default:!1,description:"Should unParseAble example (pseudo code or no js code) keep its indentation"},jsdocSingleLineComment:{name:"jsdocSingleLineComment",type:"boolean",category:"jsdoc",deprecated:"use jsdocCommentLineStrategy instead will be remove on v2",default:!0,description:"Should compact single line comment"},jsdocCommentLineStrategy:{name:"jsdocCommentLineStrategy",type:"choice",choices:[{value:"singleLine",description:"Should compact single line comment, if possible"},{value:"multiline",description:"Should compact multi line comment"},{value:"keep",description:"Should keep original line comment"}],category:"jsdoc",default:"singleLine",description:"How comments line should be"},jsdocSeparateReturnsFromParam:{name:"jsdocSeparateReturnsFromParam",type:"boolean",category:"jsdoc",default:!1,description:"Add an space between last @param and @returns"},jsdocSeparateTagGroups:{name:"jsdocSeparateTagGroups",type:"boolean",category:"jsdoc",default:!1,description:"Add an space between tag groups"},jsdocCapitalizeDescription:{name:"jsdocCapitalizeDescription",type:"boolean",category:"jsdoc",default:!0,description:"Should capitalize first letter of description"},tsdoc:{name:"tsdoc",type:"boolean",category:"jsdoc",default:!1,description:"Should format as tsdoc"},jsdocPrintWidth:{name:"jsdocPrintWidth",type:"int",category:"jsdoc",default:void 0,description:"If You don't set value to jsdocPrintWidth, the printWidth will be use as jsdocPrintWidth."},jsdocAddDefaultToDescription:{name:"jsdocAddDefaultToDescription",type:"boolean",category:"jsdoc",default:!0,description:"Add Default value of a param to end description"},jsdocPreferCodeFences:{name:"jsdocPreferCodeFences",type:"boolean",category:"jsdoc",default:!1,description:'Prefer to render code blocks using "fences" (triple backticks). If not set, blocks without a language tag will be rendered with a four space indentation.'},jsdocLineWrappingStyle:{name:"jsdocLineWrappingStyle",type:"choice",choices:[{value:"greedy",description:"Lines wrap as soon as they reach the print width"},{value:"balance",description:"Preserve existing line breaks if lines are shorter than print width, otherwise use greedy wrapping"}],category:"jsdoc",default:"greedy",description:"Strategy for wrapping lines for the given print width. More options may be added in the future."},jsdocTagsOrder:{name:"jsdocTagsOrder",type:"string",category:"jsdoc",default:void 0,description:"How many spaces will be used to separate tag elements."},jsdocMergeImports:{name:"jsdocMergeImports",type:"boolean",category:"jsdoc",default:!0,description:"Merge all imports tags in the same block from the same source into one tag"},jsdocNamedImportPadding:{name:"jsdocNamedImportPadding",type:"boolean",category:"jsdoc",default:!1,description:"Whether or not to pad brackets for single line named imports"},jsdocNamedImportLineSplitting:{name:"jsdocNamedImportLineSplitting",type:"boolean",category:"jsdoc",default:!0,description:"Split import tags with multiple named imports into multiple lines"},jsdocFormatImports:{name:"jsdocFormatImports",type:"boolean",category:"jsdoc",default:!0,description:"Format import tags"},jsdocEmptyCommentStrategy:{name:"jsdocEmptyCommentStrategy",type:"choice",choices:[{value:"remove",description:"Remove empty JSDoc comment blocks"},{value:"keep",description:"Keep empty JSDoc comment blocks"}],category:"jsdoc",default:"remove",description:"How to handle empty JSDoc comment blocks"}},Pe={jsdocSpaces:Le.jsdocSpaces.default,jsdocPrintWidth:Le.jsdocPrintWidth.default,jsdocDescriptionWithDot:Le.jsdocDescriptionWithDot.default,jsdocDescriptionTag:Le.jsdocDescriptionTag.default,jsdocVerticalAlignment:Le.jsdocVerticalAlignment.default,jsdocKeepUnParseAbleExampleIndent:Le.jsdocKeepUnParseAbleExampleIndent.default,jsdocSingleLineComment:Le.jsdocSingleLineComment.default,jsdocCommentLineStrategy:Le.jsdocCommentLineStrategy.default,jsdocSeparateReturnsFromParam:Le.jsdocSeparateReturnsFromParam.default,jsdocSeparateTagGroups:Le.jsdocSeparateTagGroups.default,jsdocCapitalizeDescription:Le.jsdocCapitalizeDescription.default,jsdocAddDefaultToDescription:Le.jsdocAddDefaultToDescription.default,jsdocPreferCodeFences:Le.jsdocPreferCodeFences.default,tsdoc:Le.tsdoc.default,jsdocLineWrappingStyle:Le.jsdocLineWrappingStyle.default,jsdocTagsOrder:Le.jsdocTagsOrder.default,jsdocFormatImports:Le.jsdocFormatImports.default,jsdocNamedImportPadding:Le.jsdocNamedImportPadding.default,jsdocMergeImports:Le.jsdocMergeImports.default,jsdocNamedImportLineSplitting:Le.jsdocNamedImportLineSplitting.default,jsdocEmptyCommentStrategy:Le.jsdocEmptyCommentStrategy.default},We={get babel(){return ke(l.default.parsers.babel,"babel")},get"babel-flow"(){return ke(l.default.parsers["babel-flow"],"babel-flow")},get"babel-ts"(){return ke(l.default.parsers["babel-ts"],"babel-ts")},get flow(){return ke(p.default.parsers.flow,"flow")},get typescript(){return ke(d.default.parsers.typescript,"typescript")},get"jsdoc-parser"(){return ke(l.default.parsers["babel-ts"],"babel-ts")}};function ke(e,t){const n=$e(e.parse,t),r=(a,o)=>{!function(e){e.jsdocTagsOrder&&(e.jsdocTagsOrder=JSON.parse(e.jsdocTagsOrder));if(e.jsdocCommentLineStrategy)return;e.jsdocSingleLineComment?e.jsdocCommentLineStrategy="singleLine":e.jsdocCommentLineStrategy="multiline"}(o);const i=pe(t,o);if(!i)return e.preprocess?e.preprocess(a,o):a;const c=i.preprocess||e.preprocess;return Object.assign(s,{...s,...i,preprocess:r,parse:n}),c?c(a,o):a},s={...e,preprocess:r,parse:n};return s}e.defaultOptions=Pe,e.name="prettier-plugin-jsdoc",e.options=Le,e.parsers=We,Object.defineProperty(e,"__esModule",{value:!0})}));

@@ -11,9 +11,13 @@ import { parse, tokenizers } from "comment-parser";

const prettierParse = findPluginByParser(parserName, options)?.parse || originalParse;
const ast = prettierParse(text, options);
const ast = (await prettierParse(text, options));
options = {
...options,
printWidth: options.jsdocPrintWidth ?? options.printWidth,
jsdocEmptyCommentStrategy: options.jsdocEmptyCommentStrategy ?? "remove",
};
const eol = options.endOfLine === "auto" ? detectEndOfLine(text) : options.endOfLine;
options = { ...options, endOfLine: "lf" };
if (!ast.comments) {
ast.comments = [];
}
await Promise.all(ast.comments.map(async (comment) => {

@@ -142,3 +146,5 @@ if (!isBlockComment(comment))

}));
ast.comments = ast.comments.filter((comment) => !(isBlockComment(comment) && !comment.value));
if (options.jsdocEmptyCommentStrategy === "remove") {
ast.comments = ast.comments.filter((comment) => !(isBlockComment(comment) && !comment.value));
}
return ast;

@@ -145,0 +151,0 @@ };

@@ -73,2 +73,3 @@ declare const TAGS_SYNONYMS: {

callback: number;
this: number;
param: number;

@@ -75,0 +76,0 @@ yields: number;

@@ -1,2 +0,2 @@

import { ABSTRACT, ASYNC, AUGMENTS, AUTHOR, BORROWS, CALLBACK, CATEGORY, CLASS, CONSTANT, DEFAULT, DEFAULT_VALUE, DEPRECATED, DESCRIPTION, EXAMPLE, EXTENDS, EXTERNAL, FILE, FIRES, FLOW, FUNCTION, IGNORE, IMPORT, LICENSE, MEMBER, MEMBEROF, MODULE, NAMESPACE, OVERLOAD, OVERRIDE, PARAM, PRIVATE, PRIVATE_REMARKS, PROPERTY, PROVIDES_MODULE, REMARKS, RETURNS, SEE, SINCE, TEMPLATE, THROWS, TODO, TYPE, SATISFIES, TYPE_PARAM, TYPEDEF, VERSION, YIELDS, } from "./tags.js";
import { ABSTRACT, ASYNC, AUGMENTS, AUTHOR, BORROWS, CALLBACK, CATEGORY, CLASS, CONSTANT, DEFAULT, DEFAULT_VALUE, DEPRECATED, DESCRIPTION, EXAMPLE, EXTENDS, EXTERNAL, FILE, FIRES, FLOW, FUNCTION, IGNORE, IMPORT, LICENSE, MEMBER, MEMBEROF, MODULE, NAMESPACE, OVERLOAD, OVERRIDE, PARAM, PRIVATE, PRIVATE_REMARKS, PROPERTY, PROVIDES_MODULE, REMARKS, RETURNS, SEE, SINCE, TEMPLATE, THIS, THROWS, TODO, TYPE, SATISFIES, TYPE_PARAM, TYPEDEF, VERSION, YIELDS, } from "./tags.js";
const TAGS_SYNONYMS = {

@@ -42,2 +42,3 @@ arg: PARAM,

SINCE,
THIS,
THROWS,

@@ -92,2 +93,3 @@ TODO,

RETURNS,
THIS,
THROWS,

@@ -104,2 +106,3 @@ TYPE,

RETURNS,
THIS,
THROWS,

@@ -118,2 +121,3 @@ TYPE,

RETURNS,
THIS,
YIELDS,

@@ -163,2 +167,3 @@ THROWS,

[CALLBACK]: 39,
[THIS]: 39.5,
[PARAM]: 40,

@@ -165,0 +170,0 @@ [YIELDS]: 41,

@@ -41,2 +41,3 @@ import { Spec } from "comment-parser";

declare const TEMPLATE = "template";
declare const THIS = "this";
declare const THROWS = "throws";

@@ -51,2 +52,2 @@ declare const TODO = "todo";

declare const SPACE_TAG_DATA: Spec;
export { ABSTRACT, ASYNC, AUGMENTS, AUTHOR, BORROWS, CALLBACK, CATEGORY, CLASS, CONSTANT, DEFAULT, DEFAULT_VALUE, DEPRECATED, DESCRIPTION, EXAMPLE, EXTENDS, EXTERNAL, FILE, FIRES, FLOW, FUNCTION, IGNORE, IMPORT, LICENSE, MEMBER, MEMBEROF, MODULE, NAMESPACE, OVERLOAD, OVERRIDE, PARAM, PRIVATE_REMARKS, PRIVATE, PROPERTY, PROVIDES_MODULE, REMARKS, RETURNS, SEE, SINCE, TEMPLATE, THROWS, TODO, TYPE, TYPE_PARAM, TYPEDEF, SATISFIES, VERSION, YIELDS, SPACE_TAG_DATA, };
export { ABSTRACT, ASYNC, AUGMENTS, AUTHOR, BORROWS, CALLBACK, CATEGORY, CLASS, CONSTANT, DEFAULT, DEFAULT_VALUE, DEPRECATED, DESCRIPTION, EXAMPLE, EXTENDS, EXTERNAL, FILE, FIRES, FLOW, FUNCTION, IGNORE, IMPORT, LICENSE, MEMBER, MEMBEROF, MODULE, NAMESPACE, OVERLOAD, OVERRIDE, PARAM, PRIVATE_REMARKS, PRIVATE, PROPERTY, PROVIDES_MODULE, REMARKS, RETURNS, SEE, SINCE, TEMPLATE, THIS, THROWS, TODO, TYPE, TYPE_PARAM, TYPEDEF, SATISFIES, VERSION, YIELDS, SPACE_TAG_DATA, };

@@ -40,2 +40,3 @@ const ABSTRACT = "abstract";

const TEMPLATE = "template";
const THIS = "this";
const THROWS = "throws";

@@ -58,3 +59,3 @@ const TODO = "todo";

};
export { ABSTRACT, ASYNC, AUGMENTS, AUTHOR, BORROWS, CALLBACK, CATEGORY, CLASS, CONSTANT, DEFAULT, DEFAULT_VALUE, DEPRECATED, DESCRIPTION, EXAMPLE, EXTENDS, EXTERNAL, FILE, FIRES, FLOW, FUNCTION, IGNORE, IMPORT, LICENSE, MEMBER, MEMBEROF, MODULE, NAMESPACE, OVERLOAD, OVERRIDE, PARAM, PRIVATE_REMARKS, PRIVATE, PROPERTY, PROVIDES_MODULE, REMARKS, RETURNS, SEE, SINCE, TEMPLATE, THROWS, TODO, TYPE, TYPE_PARAM, TYPEDEF, SATISFIES, VERSION, YIELDS, SPACE_TAG_DATA, };
export { ABSTRACT, ASYNC, AUGMENTS, AUTHOR, BORROWS, CALLBACK, CATEGORY, CLASS, CONSTANT, DEFAULT, DEFAULT_VALUE, DEPRECATED, DESCRIPTION, EXAMPLE, EXTENDS, EXTERNAL, FILE, FIRES, FLOW, FUNCTION, IGNORE, IMPORT, LICENSE, MEMBER, MEMBEROF, MODULE, NAMESPACE, OVERLOAD, OVERRIDE, PARAM, PRIVATE_REMARKS, PRIVATE, PROPERTY, PROVIDES_MODULE, REMARKS, RETURNS, SEE, SINCE, TEMPLATE, THIS, THROWS, TODO, TYPE, TYPE_PARAM, TYPEDEF, SATISFIES, VERSION, YIELDS, SPACE_TAG_DATA, };
//# sourceMappingURL=tags.js.map

@@ -17,3 +17,3 @@ import { ParserOptions } from "prettier";

tsdoc: boolean;
jsdocLineWrappingStyle: "greedy";
jsdocLineWrappingStyle: "greedy" | "balance";
jsdocTagsOrder?: Record<string, number>;

@@ -24,2 +24,3 @@ jsdocFormatImports: boolean;

jsdocNamedImportLineSplitting: boolean;
jsdocEmptyCommentStrategy: "remove" | "keep";
}

@@ -26,0 +27,0 @@ export interface AllOptions extends ParserOptions, JsdocOptions {

@@ -168,10 +168,8 @@ import { format } from "prettier";

plugin.name &&
plugin.name !== "prettier-plugin-jsdoc" &&
plugin.parsers &&
!("jsdoc-parser" in plugin.parsers) &&
plugin.parsers.hasOwnProperty(parserName));
});
return !tsPlugin ||
tsPlugin.name === "prettier-plugin-jsdoc" ||
tsPlugin.parsers?.hasOwnProperty("jsdoc-parser")
? undefined
: tsPlugin.parsers?.[parserName];
return !tsPlugin ? undefined : tsPlugin.parsers?.[parserName];
};

@@ -178,0 +176,0 @@ const isDefaultTag = (tag) => TAGS_DEFAULT.includes(tag);

{
"name": "prettier-plugin-jsdoc",
"version": "1.5.0",
"version": "1.7.0",
"description": "A Prettier plugin to format JSDoc comments.",

@@ -74,3 +74,4 @@ "private": false,

"comment-parser": "^1.4.0",
"mdast-util-from-markdown": "^2.0.0"
"mdast-util-from-markdown": "^2.0.0",
"prettier-plugin-tailwindcss": "^0.7.1"
},

@@ -77,0 +78,0 @@ "engines": {

+23
-11

@@ -44,2 +44,4 @@ [![NPM](https://nodei.co/npm/prettier-plugin-jsdoc.png)](https://nodei.co/npm/prettier-plugin-jsdoc/)

**Important:** When using multiple plugins, add `prettier-plugin-jsdoc` to the **end** of the plugins list.
`.prettierrc`:

@@ -53,2 +55,10 @@

With other plugins:
```json
{
"plugins": [..., "prettier-plugin-jsdoc"]
}
```
`prettier.config.js`:

@@ -59,3 +69,3 @@

plugins: ["prettier-plugin-jsdoc"],
}
};
```

@@ -190,4 +200,4 @@

| Key | Type | Default | Description |
| :---------------------------------- | :-------------------------------- | :----------- | ----------------------------------------------------------------------------------------------- |
| Key | Type | Default | Description |
| :---------------------------------- | :-------------------------------- | :----------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `jsdocSpaces` | Number | 1 |

@@ -200,9 +210,10 @@ | `jsdocDescriptionWithDot` | Boolean | false |

| `jsdocCapitalizeDescription` | Boolean | true |
| `jsdocSeparateReturnsFromParam` | Boolean | false | Adds a space between last `@param` and `@returns` |
| `jsdocSeparateTagGroups` | Boolean | false | Adds a space between tag groups |
| `jsdocPreferCodeFences` | Boolean | false | Always fence code blocks (surround them by triple backticks) |
| `tsdoc` | Boolean | false | See [TSDoc](#tsdoc) |
| `jsdocPrintWidth` | Number | undefined | If you don't set the value to `jsdocPrintWidth`, `printWidth` will be used as `jsdocPrintWidth` |
| `jsdocLineWrappingStyle` | String | "greedy" | "greedy": lines wrap as soon as they reach `printWidth` |
| `jsdocTagsOrder` | String (object) | undefined | See [Custom Tags Order](doc/CUSTOM_TAGS_ORDER.md) |
| `jsdocSeparateReturnsFromParam` | Boolean | false | Adds a space between last `@param` and `@returns` |
| `jsdocSeparateTagGroups` | Boolean | false | Adds a space between tag groups |
| `jsdocPreferCodeFences` | Boolean | false | Always fence code blocks (surround them by triple backticks) |
| `jsdocEmptyCommentStrategy` | ("remove","keep") | "remove" | How to handle empty JSDoc comment blocks |
| `tsdoc` | Boolean | false | See [TSDoc](#tsdoc) |
| `jsdocPrintWidth` | Number | undefined | If you don't set the value to `jsdocPrintWidth`, `printWidth` will be used as `jsdocPrintWidth` |
| `jsdocLineWrappingStyle` | String | "greedy" | "greedy": lines wrap as soon as they reach `printWidth`. "balance": preserve existing line breaks if lines are shorter than `printWidth`, otherwise use greedy wrapping |
| `jsdocTagsOrder` | String (object) | undefined | See [Custom Tags Order](doc/CUSTOM_TAGS_ORDER.md) |

@@ -234,6 +245,7 @@ ### TSDoc

3. Install project dependencies:
```sh
yarn install
```
4. Make changes and make sure that tests pass:

@@ -240,0 +252,0 @@ ```js

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet