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.3.0
to
1.3.2
+8
-0
CHANGELOG.md

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

### [1.3.1](https://github.com/hosseinmd/prettier-plugin-jsdoc/compare/v1.3.0...v1.3.1) (2025-01-03)
### Bug Fixes
* add package manager ([ffafd40](https://github.com/hosseinmd/prettier-plugin-jsdoc/commit/ffafd40cde8c8becee16ae1bc7a5cbe2cd2e42c8))
* provide correct types path in conditional exports ([#222](https://github.com/hosseinmd/prettier-plugin-jsdoc/issues/222)) ([7a884b6](https://github.com/hosseinmd/prettier-plugin-jsdoc/commit/7a884b6d51c0aea75d0c8b4c7faf642d925367ac))
## [1.2.0](https://github.com/hosseinmd/prettier-plugin-jsdoc/compare/v1.1.1...v1.2.0) (2023-12-22)

@@ -7,0 +15,0 @@

+1
-1

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

const paragraph = await stringyfy(ast, "", mdAst);
return `${intention}> ${paragraph
return `\n\n> ${paragraph
.trim()

@@ -217,0 +217,0 @@ .replace(/(\n+)/g, `$1${intention}> `)}`;

@@ -598,3 +598,3 @@ (function (global, factory) {

const paragraph = await stringyfy(ast, "", mdAst);
return `${intention}> ${paragraph
return `\n\n> ${paragraph
.trim()

@@ -1084,3 +1084,3 @@ .replace(/(\n+)/g, `$1${intention}> `)}`;

let { description } = tag;
description = description.replace(/[\s]*Default[\s]*is[\s]*`.*`\.?$/, "");
description = description.replace(/(?:\s*Default\s+is\s+`.*?`\.?)+/g, "");
if (description && !/[.\n]$/.test(description)) {

@@ -1087,0 +1087,0 @@ description += ".";

@@ -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,e.BSearch,e.mdastUtilFromMarkdown,e.parserBabel,e.parserFlow,e.parserTypescript)}(this,(function(e,t,n,r,a,s,i,o){"use strict";function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=c(r),p=c(s),d=c(i),u=c(o);const g="abstract",f="borrows",m="callback",h="category",y="class",j="constant",b="default",$="defaultValue",w="deprecated",S="description",v="example",x="extends",W="external",k="file",D="fires",L="function",P="ignore",T="license",C="member",A="memberof",O="module",E="namespace",F="overload",I="override",M="param",_="privateRemarks",z="property",R="remarks",q="returns",U="since",K="throws",V="todo",G="type",B="typedef",H="satisfies",J="yields",N={tag:"this_is_for_space",name:"",optional:!1,type:"",description:"",source:[],problems:[]},Y={arg:M,argument:M,const:j,constructor:y,desc:S,emits:D,examples:v,exception:K,fileoverview:k,func:L,host:W,method:L,overview:k,params:M,prop:z,return:q,var:C,virtual:g,yield:J,hidden:P},Q=[b,$],X=[f,h,w,S,v,x,T,O,E,F,I,_,R,q,U,K,V,J,k,...Q],Z=[f,f,w,S,v,P,T,O,E,F,I,_,R,U,V,k],ee=[f,...Q,A,O,"see"],te=[f,h,S,v,_,R,U,V],ne=[x,M,z,q,K,G,H,B,J],re=[m,B],ae=[...re,G,z,M,q,J,K],se={[R]:1,[_]:2,providesModule:3,[O]:4,[T]:5,flow:6,async:7,private:8,[P]:9,[A]:10,version:11,[k]:12,author:13,[w]:14,[U]:15,[h]:16,[S]:17,[v]:18,[g]:19,augments:20,[j]:21,[b]:22,[$]:23,[W]:24,[F]:25,[D]:26,template:27,typeParam:28,[L]:29,[E]:30,[f]:31,[y]:32,[x]:33,[C]:34,[B]:35,[G]:36,[H]:37,[z]:38,[m]:39,[M]:40,[J]:41,[q]:42,[K]:43,other:44,see:45,[V]:46};function ie(e,t){return(e.match(new RegExp(t,"g"))||[]).length}function oe(e){return e?e.match(/^https?:\/\//i)?e:e.startsWith("- ")?e.slice(0,2)+oe(e.slice(2)):e[0].toUpperCase()+e.slice(1):e}async function ce(e,t,r){const{printWidth:a,jsdocKeepUnParseAbleExampleIndent:s}=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 s="";const i=a-4;s=e.trim().startsWith("{")?await n.format(e||"",{...r,parser:"json",printWidth:i}):await n.format(e||"",{...r,printWidth:i}),e=s.replace(/(^|\n)/g,`\n${t}`)}catch(n){e=(e=`\n${e.split("\n").map((e=>`${t}${s?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&&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,s){if(!t)return t;const{printWidth:i}=r,{tagStringLength:o=0,beginningSpace:c}=s,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,a,s)=>{for(const t of l)if(void 0!==t.index&&t.index<=s+1&&s+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=oe(t)),t=`${o?`${"!".repeat(o-1)}?`:""}${t.startsWith("```")?"\n":""}${t}`;let d=0;t=t.replace(new RegExp(`\\n[ ]{${c.length}}`,"g"),"\n");const u=a.fromMarkdown(t);let g=await async function t(a,s,o){return Array.isArray(a.children)?(await Promise.all(a.children.map((async(n,c)=>{switch(n.type){case"listItem":{let e=`\n${s}- `;if("number"==typeof a.start){const t=c+(a.start??1);e=`\n${s}${t}. `}const r=s+" ".repeat(e.length-1);return`${e}${(await t(n,r,a)).trim()}`}case"list":{let r="";return e!==S&&"root"===a.type&&c===a.children.length-1&&(r="\n"),`\n${await t(n,s,a)}${r}`}case"paragraph":{const a=await t(n,s,o);return n.costumeType===de?a:`\n\n${a.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=oe(t)),r.jsdocDescriptionWithDot&&(t=t.replace(/([\w\p{L}])$/u,"$1."));let a=function(e,t,n){let r=e.trim();if(!r)return r;let a="";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),a+=r.substring(0,e),r=r.substring(e+1),r&&(r=`${n}${r}`,r=`\n${r}`)}return a+=r,`${n}${a}`}(t,i,s);return a=a.replace(/{@(link|linkcode|linkplain)([_]+)}/g,((e,t,r)=>{const a=n[0];return a.length===r.length?(n.shift(),`{@${t} ${a}}`):e})),a})).join("\\\n")}`}case"strong":return`**${await t(n,s,a)}**`;case"emphasis":return`_${await t(n,s,a)}_`;case"heading":return`\n\n${s}${"#".repeat(n.depth)} ${await t(n,s,a)}`;case"link":case"image":return`[${await t(n,s,a)}](${n.url})`;case"linkReference":return`[${await t(n,s,a)}][${n.label}]`;case"definition":return`\n\n[${n.label}]: ${n.url}`;case"blockquote":{const e=await t(n,"",a);return`${s}> ${e.trim().replace(/(\n+)/g,`$1${s}> `)}`}}return t(n,s,a)})))).join(""):async function(e,t,a){if("inlineCode"===e.type)return`\`${e.value}\``;if("code"===e.type){let n=e.value||"",a=t;if(n)if(e.lang){const a=(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()),s=a?.includes(r.parser)?r.parser:a?.[0]||e.lang;n=await ce(n,t,{...r,parser:s,jsdocKeepUnParseAbleExampleIndent:!0})}else r.jsdocPreferCodeFences||(a=t+" ".repeat(4)),n=await ce(n,a,{...r,jsdocKeepUnParseAbleExampleIndent:!0});const s=r.jsdocPreferCodeFences||!!e.lang;return n=s?n:n.trimEnd(),n?s?`\n\n${a}\`\`\`${e.lang||""}${n}\`\`\``:`\n${n}`:""}if(e.value===de&&(a&&(a.costumeType=de),p.length>0)){let a=p?.[d]||"";return d++,a&&(a=(await n.format(a,{...r,parser:"markdown"})).trim()),`${a?`\n\n${t}${a.split("\n").join(`\n${t}`)}`:e.value}`}return"break"===e.type?"\\\n":e.value||e.title||e.alt||""}(a,s,o)}(u,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},a,s,i,o,c,l)=>{let p="\n";if(r===N.tag)return p;const{printWidth:d,jsdocSpaces:u,jsdocVerticalAlignment:g,jsdocDescriptionTag:f,tsdoc:m,useTabs:h,tabWidth:y,jsdocSeparateTagGroups:j}=i,b=" ".repeat(u);let $=0,w=0,x=0,W=0;g&&ne.includes(r)&&(r?$+=o-r.length:o&&(W+=o+b.length),n?w+=c-n.length:c&&(W+=c+b.length),e?x+=l-e.length:l&&(W=l+b.length));const k=r!==S||f;if(k&&(p+=`@${r}${" ".repeat($||0)}`),n){p+=b+(()=>{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(w)}if(e&&(p+=`${b}${e}${" ".repeat(x)}`),r!==v||m){if(t){let e="";if(k&&(p+=b+" ".repeat(W)),ee.includes(r)||!se[r])e=t;else{const[,n]=/^\s*(\S+)/.exec(t)||["",""],a=r===S||[v,R,_].includes(r)&&m?"":" ";e=r!==S&&p.length+n.length>d||[R,_].includes(r)?`\n${a}`+await ue(r,t,i,{beginningSpace:a}):await ue(r,t,i,{tagStringLength:p.length-1,beginningSpace:a})}j&&(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(y);p+=(await ce(t,n,i)).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[S,v,V].includes(e)&&!t?"\n":""}({tag:r,isEndTag:a===s.length-1}),p},{name:fe,tag:me,type:he,description:ye}=t.tokenizers,je=(e,r)=>async function(a,s,i){let o=i??s;const c=(le(r,o)?.parse||e)(a,o);o={...o,printWidth:o.jsdocPrintWidth??o.printWidth};const p="auto"===o.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 a=t["\r"],s=t["\r\n"],i=t["\n"],o=Math.max(a,s,i);return i===o?"lf":s===o?"crlf":"cr"}(a):o.endOfLine;return o={...o,endOfLine:"lf"},await Promise.all(c.comments.map((async e=>{if(!we(e))return;const r=(s=c.tokens,i=e,l.default.eq(s,i,((e,t)=>e.loc.start.line===t.loc.start.line?e.loc.start.column-t.loc.start.column:e.loc.start.line-t.loc.start.line)));var s,i;const d=function(e,t){let n;try{const r=e.tokens[t+1]?.type;if("object"!=typeof r)return;if("function"===r.label){let r=1;const a=e.tokens.slice(t+4),s=a.findIndex((({type:e})=>"string"!=typeof e&&("("===e.label?r++:")"===e.label&&r--,0===r)));n=a.slice(0,s+1)}if("const"===r.label){let r=1,a=e.tokens.slice(t+1);const s=a.findIndex((({type:e})=>"object"==typeof e&&"("===e.label));a=a.slice(s+1);const i=a.findIndex((({type:e})=>"string"!=typeof e&&("("===e.label?r++:")"===e.label&&r--,0===r))),o=a[i+1];"object"==typeof o?.type&&"=>"===o.type.label&&(n=a.slice(0,i+1))}return n?.filter((({type:e})=>"object"==typeof e&&"name"===e.label)).map((({value:e})=>e))}catch{}return}(c,r),u=e.value;e.value=e.value.replace(/^([*]+)/g,"*");const g=`/*${e.value.replace(/\r\n?/g,"\n")}*/`;if(!/^\/\*\*[\s\S]+?\*\/$/.test(g))return;const f=t.parse(g,{spacing:"preserve",tokenizers:[me(),e=>pe(e.tag)?e:he("preserve")(e),fe(),ye("preserve")]})[0];if(e.value="",!f)return;!function(e){e.tags=e.tags.map((({tag:e,type:t,name:n,description:r,default:a,...s})=>{e=e||"",t=t||"",n=n||"",r=r||"",a=a?.trim();const i=e.indexOf("{");-1!==i&&"}"===e[e.length-1]&&(t=e.slice(i+1,-1)+" "+t,e=e.slice(0,i));const o=(e=e.trim()).toLowerCase(),c=Se.findIndex((([e])=>e.toLowerCase()===o));return c>=0?e=Se[c][0]:o in Y&&(e=Y[o]),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:a,...s}}))}(f),function(e){let t=e.description||"";e.description="",e.tags=e.tags.filter((({description:e,tag:n})=>n.toLowerCase()!==S||(e.trim()&&(t+="\n\n"+e),!1))),t&&e.tags.unshift({tag:S,description:t,name:void 0,type:void 0,source:[],optional:!1,problems:[]})}(f);const m=function(e,t,n){const r=t.split(/\r\n?|\n/g)[e.loc.start.line-1];let a=0,s=0;for(let t=e.loc.start.column-1;t>=0;t--){const e=r[t];if(" "===e)a++;else{if("\t"!==e)break;s++}}return n.printWidth-(a+s*n.tabWidth)-" * ".length}(e,a,o);let h=0,y=0,j=0,b=f.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})));b=be(b,d,o),o.jsdocSeparateReturnsFromParam&&(b=b.flatMap(((e,t)=>e.tag===q&&b[t-1]?.tag===M?[N,e]:[e]))),o.jsdocAddDefaultToDescription&&(b=b.map(ve)),b=await Promise.all(b.map(xe).map((async({type:e,...t})=>(e&&(e=await async function(e,t){try{const r="type name = ";let a=e,s=!1;return a.startsWith("...")&&(s=!0,a=`(${a.slice(3)})[]`),a=await n.format(`${r}${a}`,{...t,parser:"typescript",plugins:[],filepath:"file.ts"}),a=a.slice(r.length),a=a.replace(/^\s*/g,"").replace(/[;\n]*$/g,"").replace(/^\|/g,"").trim(),s&&(a="..."+a.replace(/\[\s*\]$/,"")),a}catch(t){return e}}(e,{...o,printWidth:m})),{...t,type:e})))).then((e=>e.map((({type:e,name:t,description:n,tag:r,...a})=>(ne.includes(r)&&(h=Math.max(h,r.length),y=Math.max(y,e.length),j=Math.max(j,t.length)),{type:e,name:t,description:n,tag:r,...a}))))),o.jsdocSeparateTagGroups&&(b=b.flatMap(((e,t)=>{const n=b[t-1];return n&&n.tag!==S&&n.tag!==v&&n.tag!==N.tag&&e.tag!==N.tag&&n.tag!==e.tag?[N,e]:[e]})));const $=b.filter((({description:e,tag:t})=>!(!e&&te.includes(t))));for(const[t,n]of $.entries()){const r=await ge(n,t,$,{...o,printWidth:m},h,y,j);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 `}(u,e.value,o)),"cr"===p?e.value=e.value.replace(/\n/g,"\r"):"crlf"===p&&(e.value=e.value.replace(/\n/g,"\r\n"))}))),c.comments=c.comments.filter((e=>!(we(e)&&!e.value))),c};function be(e,t,n){let r=!1,a=!1;return e=e.reduce(((e,t)=>((0===e.length||re.includes(t.tag)&&r)&&(r=!1,e.push([])),ae.includes(t.tag)&&(r=!0),e[e.length-1].push(t),e)),[]).flatMap(((e,r,s)=>(e.sort(((e,r)=>{if(t&&t.length>1&&e.tag===M&&r.tag===M){const n=t.indexOf(e.name),a=t.indexOf(r.name);return n>-1&&a>-1?n-a:0}return $e(e.tag,n)-$e(r.tag,n)})),s.length-1!==r&&e.push(N),r>0&&e[0]?.tag&&!re.includes(e[0].tag)&&(a=!0),e))),a?be(e,t,n):e}function $e(e,t){if(e===S&&!t.jsdocDescriptionTag)return-1;let n;return n=void 0!==t.jsdocTagsOrder?.[e]?t.jsdocTagsOrder[e]:se[e],void 0===n?se.other:n}function we(e){return"CommentBlock"===e.type||"Block"===e.type}const Se=Object.entries(se);function ve(e){if(e.optional&&e.default){let{description:t}=e;return t=t.replace(/[\s]*Default[\s]*is[\s]*`.*`\.?$/,""),t&&!/[.\n]$/.test(t)&&(t+="."),t+=` Default is \`${e.default}\``,{...e,description:t.trim()}}return e}function xe({name:e,optional:t,default:n,tag:r,type:a,source:s,description:i,...o}){if(pe(r)){const t=(s.find((e=>e.source.includes(`@${r}`)))?.source||"").match(/@default(Value)? (\[.*]|{.*}|\(.*\)|'.*'|".*"|`.*`| \w+)( ((?!\*\/).+))?/),n=t?.[2]||"",o=t?.[4]||"";t&&(a=n,e="",i=o)}else t&&(e?e=n?`[${e}=${n}]`:`[${e}]`:a=`${a} | undefined`);return{...o,tag:r,name:e,description:i,optional:t,type:a,source:s,default:n}}const We={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:[{since:"1.1.0",value:"singleLine",description:"Should compact single line comment, if possible"},{since:"1.1.0",value:"multiline",description:"Should compact multi line comment"},{since:"1.1.0",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:[{since:"0.3.39",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."}},ke={jsdocSpaces:We.jsdocSpaces.default,jsdocPrintWidth:We.jsdocPrintWidth.default,jsdocDescriptionWithDot:We.jsdocDescriptionWithDot.default,jsdocDescriptionTag:We.jsdocDescriptionTag.default,jsdocVerticalAlignment:We.jsdocVerticalAlignment.default,jsdocKeepUnParseAbleExampleIndent:We.jsdocKeepUnParseAbleExampleIndent.default,jsdocSingleLineComment:We.jsdocSingleLineComment.default,jsdocCommentLineStrategy:We.jsdocCommentLineStrategy.default,jsdocSeparateReturnsFromParam:We.jsdocSeparateReturnsFromParam.default,jsdocSeparateTagGroups:We.jsdocSeparateTagGroups.default,jsdocCapitalizeDescription:We.jsdocCapitalizeDescription.default,jsdocAddDefaultToDescription:We.jsdocAddDefaultToDescription.default,jsdocPreferCodeFences:We.jsdocPreferCodeFences.default,tsdoc:We.tsdoc.default,jsdocLineWrappingStyle:We.jsdocLineWrappingStyle.default,jsdocTagsOrder:We.jsdocTagsOrder.default},De={get babel(){return Le(p.default.parsers.babel,"babel")},get"babel-flow"(){return Le(p.default.parsers["babel-flow"],"babel-flow")},get"babel-ts"(){return Le(p.default.parsers["babel-ts"],"babel-ts")},get flow(){return Le(d.default.parsers.flow,"flow")},get typescript(){return Le(u.default.parsers.typescript,"typescript")},get"jsdoc-parser"(){return Le(p.default.parsers["babel-ts"],"babel-ts")}};function Le(e,t){const n=je(e.parse,t),r=(s,i)=>{!function(e){e.jsdocTagsOrder&&(e.jsdocTagsOrder=JSON.parse(e.jsdocTagsOrder));if(e.jsdocCommentLineStrategy)return;e.jsdocSingleLineComment?e.jsdocCommentLineStrategy="singleLine":e.jsdocCommentLineStrategy="multiline"}(i);const o=le(t,i);if(!o)return e.preprocess?e.preprocess(s,i):s;const c=o.preprocess||e.preprocess;return Object.assign(a,{...a,...o,preprocess:r,parse:n}),c?c(s,i):s},a={...e,preprocess:r,parse:n};return a}e.defaultOptions=ke,e.options=We,e.parsers=De,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,e.BSearch,e.mdastUtilFromMarkdown,e.parserBabel,e.parserFlow,e.parserTypescript)}(this,(function(e,t,n,r,a,s,i,o){"use strict";function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=c(r),p=c(s),d=c(i),u=c(o);const g="abstract",f="borrows",m="callback",h="category",y="class",j="constant",b="default",$="defaultValue",w="deprecated",S="description",v="example",x="extends",W="external",k="file",D="fires",L="function",P="ignore",T="license",C="member",A="memberof",O="module",E="namespace",F="overload",I="override",M="param",_="privateRemarks",z="property",R="remarks",q="returns",U="since",K="throws",V="todo",G="type",B="typedef",H="satisfies",J="yields",N={tag:"this_is_for_space",name:"",optional:!1,type:"",description:"",source:[],problems:[]},Y={arg:M,argument:M,const:j,constructor:y,desc:S,emits:D,examples:v,exception:K,fileoverview:k,func:L,host:W,method:L,overview:k,params:M,prop:z,return:q,var:C,virtual:g,yield:J,hidden:P},Q=[b,$],X=[f,h,w,S,v,x,T,O,E,F,I,_,R,q,U,K,V,J,k,...Q],Z=[f,f,w,S,v,P,T,O,E,F,I,_,R,U,V,k],ee=[f,...Q,A,O,"see"],te=[f,h,S,v,_,R,U,V],ne=[x,M,z,q,K,G,H,B,J],re=[m,B],ae=[...re,G,z,M,q,J,K],se={[R]:1,[_]:2,providesModule:3,[O]:4,[T]:5,flow:6,async:7,private:8,[P]:9,[A]:10,version:11,[k]:12,author:13,[w]:14,[U]:15,[h]:16,[S]:17,[v]:18,[g]:19,augments:20,[j]:21,[b]:22,[$]:23,[W]:24,[F]:25,[D]:26,template:27,typeParam:28,[L]:29,[E]:30,[f]:31,[y]:32,[x]:33,[C]:34,[B]:35,[G]:36,[H]:37,[z]:38,[m]:39,[M]:40,[J]:41,[q]:42,[K]:43,other:44,see:45,[V]:46};function ie(e,t){return(e.match(new RegExp(t,"g"))||[]).length}function oe(e){return e?e.match(/^https?:\/\//i)?e:e.startsWith("- ")?e.slice(0,2)+oe(e.slice(2)):e[0].toUpperCase()+e.slice(1):e}async function ce(e,t,r){const{printWidth:a,jsdocKeepUnParseAbleExampleIndent:s}=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 s="";const i=a-4;s=e.trim().startsWith("{")?await n.format(e||"",{...r,parser:"json",printWidth:i}):await n.format(e||"",{...r,printWidth:i}),e=s.replace(/(^|\n)/g,`\n${t}`)}catch(n){e=(e=`\n${e.split("\n").map((e=>`${t}${s?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&&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,s){if(!t)return t;const{printWidth:i}=r,{tagStringLength:o=0,beginningSpace:c}=s,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,a,s)=>{for(const t of l)if(void 0!==t.index&&t.index<=s+1&&s+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=oe(t)),t=`${o?`${"!".repeat(o-1)}?`:""}${t.startsWith("```")?"\n":""}${t}`;let d=0;t=t.replace(new RegExp(`\\n[ ]{${c.length}}`,"g"),"\n");const u=a.fromMarkdown(t);let g=await async function t(a,s,o){return Array.isArray(a.children)?(await Promise.all(a.children.map((async(n,c)=>{switch(n.type){case"listItem":{let e=`\n${s}- `;if("number"==typeof a.start){const t=c+(a.start??1);e=`\n${s}${t}. `}const r=s+" ".repeat(e.length-1);return`${e}${(await t(n,r,a)).trim()}`}case"list":{let r="";return e!==S&&"root"===a.type&&c===a.children.length-1&&(r="\n"),`\n${await t(n,s,a)}${r}`}case"paragraph":{const a=await t(n,s,o);return n.costumeType===de?a:`\n\n${a.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=oe(t)),r.jsdocDescriptionWithDot&&(t=t.replace(/([\w\p{L}])$/u,"$1."));let a=function(e,t,n){let r=e.trim();if(!r)return r;let a="";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),a+=r.substring(0,e),r=r.substring(e+1),r&&(r=`${n}${r}`,r=`\n${r}`)}return a+=r,`${n}${a}`}(t,i,s);return a=a.replace(/{@(link|linkcode|linkplain)([_]+)}/g,((e,t,r)=>{const a=n[0];return a.length===r.length?(n.shift(),`{@${t} ${a}}`):e})),a})).join("\\\n")}`}case"strong":return`**${await t(n,s,a)}**`;case"emphasis":return`_${await t(n,s,a)}_`;case"heading":return`\n\n${s}${"#".repeat(n.depth)} ${await t(n,s,a)}`;case"link":case"image":return`[${await t(n,s,a)}](${n.url})`;case"linkReference":return`[${await t(n,s,a)}][${n.label}]`;case"definition":return`\n\n[${n.label}]: ${n.url}`;case"blockquote":return`\n\n> ${(await t(n,"",a)).trim().replace(/(\n+)/g,`$1${s}> `)}`}return t(n,s,a)})))).join(""):async function(e,t,a){if("inlineCode"===e.type)return`\`${e.value}\``;if("code"===e.type){let n=e.value||"",a=t;if(n)if(e.lang){const a=(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()),s=a?.includes(r.parser)?r.parser:a?.[0]||e.lang;n=await ce(n,t,{...r,parser:s,jsdocKeepUnParseAbleExampleIndent:!0})}else r.jsdocPreferCodeFences||(a=t+" ".repeat(4)),n=await ce(n,a,{...r,jsdocKeepUnParseAbleExampleIndent:!0});const s=r.jsdocPreferCodeFences||!!e.lang;return n=s?n:n.trimEnd(),n?s?`\n\n${a}\`\`\`${e.lang||""}${n}\`\`\``:`\n${n}`:""}if(e.value===de&&(a&&(a.costumeType=de),p.length>0)){let a=p?.[d]||"";return d++,a&&(a=(await n.format(a,{...r,parser:"markdown"})).trim()),`${a?`\n\n${t}${a.split("\n").join(`\n${t}`)}`:e.value}`}return"break"===e.type?"\\\n":e.value||e.title||e.alt||""}(a,s,o)}(u,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},a,s,i,o,c,l)=>{let p="\n";if(r===N.tag)return p;const{printWidth:d,jsdocSpaces:u,jsdocVerticalAlignment:g,jsdocDescriptionTag:f,tsdoc:m,useTabs:h,tabWidth:y,jsdocSeparateTagGroups:j}=i,b=" ".repeat(u);let $=0,w=0,x=0,W=0;g&&ne.includes(r)&&(r?$+=o-r.length:o&&(W+=o+b.length),n?w+=c-n.length:c&&(W+=c+b.length),e?x+=l-e.length:l&&(W=l+b.length));const k=r!==S||f;if(k&&(p+=`@${r}${" ".repeat($||0)}`),n){p+=b+(()=>{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(w)}if(e&&(p+=`${b}${e}${" ".repeat(x)}`),r!==v||m){if(t){let e="";if(k&&(p+=b+" ".repeat(W)),ee.includes(r)||!se[r])e=t;else{const[,n]=/^\s*(\S+)/.exec(t)||["",""],a=r===S||[v,R,_].includes(r)&&m?"":" ";e=r!==S&&p.length+n.length>d||[R,_].includes(r)?`\n${a}`+await ue(r,t,i,{beginningSpace:a}):await ue(r,t,i,{tagStringLength:p.length-1,beginningSpace:a})}j&&(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(y);p+=(await ce(t,n,i)).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[S,v,V].includes(e)&&!t?"\n":""}({tag:r,isEndTag:a===s.length-1}),p},{name:fe,tag:me,type:he,description:ye}=t.tokenizers,je=(e,r)=>async function(a,s,i){let o=i??s;const c=(le(r,o)?.parse||e)(a,o);o={...o,printWidth:o.jsdocPrintWidth??o.printWidth};const p="auto"===o.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 a=t["\r"],s=t["\r\n"],i=t["\n"],o=Math.max(a,s,i);return i===o?"lf":s===o?"crlf":"cr"}(a):o.endOfLine;return o={...o,endOfLine:"lf"},await Promise.all(c.comments.map((async e=>{if(!we(e))return;const r=(s=c.tokens,i=e,l.default.eq(s,i,((e,t)=>e.loc.start.line===t.loc.start.line?e.loc.start.column-t.loc.start.column:e.loc.start.line-t.loc.start.line)));var s,i;const d=function(e,t){let n;try{const r=e.tokens[t+1]?.type;if("object"!=typeof r)return;if("function"===r.label){let r=1;const a=e.tokens.slice(t+4),s=a.findIndex((({type:e})=>"string"!=typeof e&&("("===e.label?r++:")"===e.label&&r--,0===r)));n=a.slice(0,s+1)}if("const"===r.label){let r=1,a=e.tokens.slice(t+1);const s=a.findIndex((({type:e})=>"object"==typeof e&&"("===e.label));a=a.slice(s+1);const i=a.findIndex((({type:e})=>"string"!=typeof e&&("("===e.label?r++:")"===e.label&&r--,0===r))),o=a[i+1];"object"==typeof o?.type&&"=>"===o.type.label&&(n=a.slice(0,i+1))}return n?.filter((({type:e})=>"object"==typeof e&&"name"===e.label)).map((({value:e})=>e))}catch{}return}(c,r),u=e.value;e.value=e.value.replace(/^([*]+)/g,"*");const g=`/*${e.value.replace(/\r\n?/g,"\n")}*/`;if(!/^\/\*\*[\s\S]+?\*\/$/.test(g))return;const f=t.parse(g,{spacing:"preserve",tokenizers:[me(),e=>pe(e.tag)?e:he("preserve")(e),fe(),ye("preserve")]})[0];if(e.value="",!f)return;!function(e){e.tags=e.tags.map((({tag:e,type:t,name:n,description:r,default:a,...s})=>{e=e||"",t=t||"",n=n||"",r=r||"",a=a?.trim();const i=e.indexOf("{");-1!==i&&"}"===e[e.length-1]&&(t=e.slice(i+1,-1)+" "+t,e=e.slice(0,i));const o=(e=e.trim()).toLowerCase(),c=Se.findIndex((([e])=>e.toLowerCase()===o));return c>=0?e=Se[c][0]:o in Y&&(e=Y[o]),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:a,...s}}))}(f),function(e){let t=e.description||"";e.description="",e.tags=e.tags.filter((({description:e,tag:n})=>n.toLowerCase()!==S||(e.trim()&&(t+="\n\n"+e),!1))),t&&e.tags.unshift({tag:S,description:t,name:void 0,type:void 0,source:[],optional:!1,problems:[]})}(f);const m=function(e,t,n){const r=t.split(/\r\n?|\n/g)[e.loc.start.line-1];let a=0,s=0;for(let t=e.loc.start.column-1;t>=0;t--){const e=r[t];if(" "===e)a++;else{if("\t"!==e)break;s++}}return n.printWidth-(a+s*n.tabWidth)-" * ".length}(e,a,o);let h=0,y=0,j=0,b=f.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})));b=be(b,d,o),o.jsdocSeparateReturnsFromParam&&(b=b.flatMap(((e,t)=>e.tag===q&&b[t-1]?.tag===M?[N,e]:[e]))),o.jsdocAddDefaultToDescription&&(b=b.map(ve)),b=await Promise.all(b.map(xe).map((async({type:e,...t})=>(e&&(e=await async function(e,t){try{const r="type name = ";let a=e,s=!1;return a.startsWith("...")&&(s=!0,a=`(${a.slice(3)})[]`),a=await n.format(`${r}${a}`,{...t,parser:"typescript",plugins:[],filepath:"file.ts"}),a=a.slice(r.length),a=a.replace(/^\s*/g,"").replace(/[;\n]*$/g,"").replace(/^\|/g,"").trim(),s&&(a="..."+a.replace(/\[\s*\]$/,"")),a}catch(t){return e}}(e,{...o,printWidth:m})),{...t,type:e})))).then((e=>e.map((({type:e,name:t,description:n,tag:r,...a})=>(ne.includes(r)&&(h=Math.max(h,r.length),y=Math.max(y,e.length),j=Math.max(j,t.length)),{type:e,name:t,description:n,tag:r,...a}))))),o.jsdocSeparateTagGroups&&(b=b.flatMap(((e,t)=>{const n=b[t-1];return n&&n.tag!==S&&n.tag!==v&&n.tag!==N.tag&&e.tag!==N.tag&&n.tag!==e.tag?[N,e]:[e]})));const $=b.filter((({description:e,tag:t})=>!(!e&&te.includes(t))));for(const[t,n]of $.entries()){const r=await ge(n,t,$,{...o,printWidth:m},h,y,j);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 `}(u,e.value,o)),"cr"===p?e.value=e.value.replace(/\n/g,"\r"):"crlf"===p&&(e.value=e.value.replace(/\n/g,"\r\n"))}))),c.comments=c.comments.filter((e=>!(we(e)&&!e.value))),c};function be(e,t,n){let r=!1,a=!1;return e=e.reduce(((e,t)=>((0===e.length||re.includes(t.tag)&&r)&&(r=!1,e.push([])),ae.includes(t.tag)&&(r=!0),e[e.length-1].push(t),e)),[]).flatMap(((e,r,s)=>(e.sort(((e,r)=>{if(t&&t.length>1&&e.tag===M&&r.tag===M){const n=t.indexOf(e.name),a=t.indexOf(r.name);return n>-1&&a>-1?n-a:0}return $e(e.tag,n)-$e(r.tag,n)})),s.length-1!==r&&e.push(N),r>0&&e[0]?.tag&&!re.includes(e[0].tag)&&(a=!0),e))),a?be(e,t,n):e}function $e(e,t){if(e===S&&!t.jsdocDescriptionTag)return-1;let n;return n=void 0!==t.jsdocTagsOrder?.[e]?t.jsdocTagsOrder[e]:se[e],void 0===n?se.other:n}function we(e){return"CommentBlock"===e.type||"Block"===e.type}const Se=Object.entries(se);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 xe({name:e,optional:t,default:n,tag:r,type:a,source:s,description:i,...o}){if(pe(r)){const t=(s.find((e=>e.source.includes(`@${r}`)))?.source||"").match(/@default(Value)? (\[.*]|{.*}|\(.*\)|'.*'|".*"|`.*`| \w+)( ((?!\*\/).+))?/),n=t?.[2]||"",o=t?.[4]||"";t&&(a=n,e="",i=o)}else t&&(e?e=n?`[${e}=${n}]`:`[${e}]`:a=`${a} | undefined`);return{...o,tag:r,name:e,description:i,optional:t,type:a,source:s,default:n}}const We={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:[{since:"1.1.0",value:"singleLine",description:"Should compact single line comment, if possible"},{since:"1.1.0",value:"multiline",description:"Should compact multi line comment"},{since:"1.1.0",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:[{since:"0.3.39",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."}},ke={jsdocSpaces:We.jsdocSpaces.default,jsdocPrintWidth:We.jsdocPrintWidth.default,jsdocDescriptionWithDot:We.jsdocDescriptionWithDot.default,jsdocDescriptionTag:We.jsdocDescriptionTag.default,jsdocVerticalAlignment:We.jsdocVerticalAlignment.default,jsdocKeepUnParseAbleExampleIndent:We.jsdocKeepUnParseAbleExampleIndent.default,jsdocSingleLineComment:We.jsdocSingleLineComment.default,jsdocCommentLineStrategy:We.jsdocCommentLineStrategy.default,jsdocSeparateReturnsFromParam:We.jsdocSeparateReturnsFromParam.default,jsdocSeparateTagGroups:We.jsdocSeparateTagGroups.default,jsdocCapitalizeDescription:We.jsdocCapitalizeDescription.default,jsdocAddDefaultToDescription:We.jsdocAddDefaultToDescription.default,jsdocPreferCodeFences:We.jsdocPreferCodeFences.default,tsdoc:We.tsdoc.default,jsdocLineWrappingStyle:We.jsdocLineWrappingStyle.default,jsdocTagsOrder:We.jsdocTagsOrder.default},De={get babel(){return Le(p.default.parsers.babel,"babel")},get"babel-flow"(){return Le(p.default.parsers["babel-flow"],"babel-flow")},get"babel-ts"(){return Le(p.default.parsers["babel-ts"],"babel-ts")},get flow(){return Le(d.default.parsers.flow,"flow")},get typescript(){return Le(u.default.parsers.typescript,"typescript")},get"jsdoc-parser"(){return Le(p.default.parsers["babel-ts"],"babel-ts")}};function Le(e,t){const n=je(e.parse,t),r=(s,i)=>{!function(e){e.jsdocTagsOrder&&(e.jsdocTagsOrder=JSON.parse(e.jsdocTagsOrder));if(e.jsdocCommentLineStrategy)return;e.jsdocSingleLineComment?e.jsdocCommentLineStrategy="singleLine":e.jsdocCommentLineStrategy="multiline"}(i);const o=le(t,i);if(!o)return e.preprocess?e.preprocess(s,i):s;const c=o.preprocess||e.preprocess;return Object.assign(a,{...a,...o,preprocess:r,parse:n}),c?c(s,i):s},a={...e,preprocess:r,parse:n};return a}e.defaultOptions=ke,e.options=We,e.parsers=De,Object.defineProperty(e,"__esModule",{value:!0})}));

@@ -348,3 +348,3 @@ import { parse, tokenizers } from "comment-parser";

let { description } = tag;
description = description.replace(/[\s]*Default[\s]*is[\s]*`.*`\.?$/, "");
description = description.replace(/(?:\s*Default\s+is\s+`.*?`\.?)+/g, "");
if (description && !/[.\n]$/.test(description)) {

@@ -351,0 +351,0 @@ description += ".";

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

@@ -9,3 +9,3 @@ "private": false,

".": {
"types": "./dist/types.d.ts",
"types": "./dist/index.d.ts",
"default": "./dist/index.js"

@@ -79,3 +79,4 @@ }

"node": ">=14.13.1 || >=16.0.0"
}
},
"packageManager": "yarn@1.22.22"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet