prettier-plugin-jsdoc
Advanced tools
+7
-0
@@ -5,2 +5,9 @@ # Changelog | ||
| ## [1.2.0](https://github.com/hosseinmd/prettier-plugin-jsdoc/compare/v1.1.1...v1.2.0) (2023-12-22) | ||
| ### Features | ||
| * add jsdocTagsOrder ([9f637aa](https://github.com/hosseinmd/prettier-plugin-jsdoc/commit/9f637aad8fc51cbb01af9349cc428a6c3dae91e9)) | ||
| ### [1.1.1](https://github.com/hosseinmd/prettier-plugin-jsdoc/compare/v1.1.0...v1.1.1) (2023-10-07) | ||
@@ -7,0 +14,0 @@ |
+104
-97
| import prettier from "prettier"; | ||
| import { JsdocOptions } from "./types.js"; | ||
| declare const options: { | ||
| jsdocSpaces: { | ||
| name: string; | ||
| type: "int"; | ||
| category: string; | ||
| default: number; | ||
| description: string; | ||
| readonly jsdocSpaces: { | ||
| readonly name: "jsdocSpaces"; | ||
| readonly type: "int"; | ||
| readonly category: "jsdoc"; | ||
| readonly default: 1; | ||
| readonly description: "How many spaces will be used to separate tag elements."; | ||
| }; | ||
| jsdocDescriptionWithDot: { | ||
| name: string; | ||
| type: "boolean"; | ||
| category: string; | ||
| default: false; | ||
| description: string; | ||
| readonly jsdocDescriptionWithDot: { | ||
| readonly name: "jsdocDescriptionWithDot"; | ||
| readonly type: "boolean"; | ||
| readonly category: "jsdoc"; | ||
| readonly default: false; | ||
| readonly description: "Should dot be inserted at the end of description"; | ||
| }; | ||
| jsdocDescriptionTag: { | ||
| name: string; | ||
| type: "boolean"; | ||
| category: string; | ||
| default: false; | ||
| description: string; | ||
| readonly jsdocDescriptionTag: { | ||
| readonly name: "jsdocDescriptionTag"; | ||
| readonly type: "boolean"; | ||
| readonly category: "jsdoc"; | ||
| readonly default: false; | ||
| readonly description: "Should description tag be used"; | ||
| }; | ||
| jsdocVerticalAlignment: { | ||
| name: string; | ||
| type: "boolean"; | ||
| category: string; | ||
| default: false; | ||
| description: string; | ||
| readonly jsdocVerticalAlignment: { | ||
| readonly name: "jsdocVerticalAlignment"; | ||
| readonly type: "boolean"; | ||
| readonly category: "jsdoc"; | ||
| readonly default: false; | ||
| readonly description: "Should tags, types, names and description be aligned"; | ||
| }; | ||
| jsdocKeepUnParseAbleExampleIndent: { | ||
| name: string; | ||
| type: "boolean"; | ||
| category: string; | ||
| default: false; | ||
| description: string; | ||
| readonly jsdocKeepUnParseAbleExampleIndent: { | ||
| readonly name: "jsdocKeepUnParseAbleExampleIndent"; | ||
| readonly type: "boolean"; | ||
| readonly category: "jsdoc"; | ||
| readonly default: false; | ||
| readonly description: "Should unParseAble example (pseudo code or no js code) keep its indentation"; | ||
| }; | ||
| jsdocSingleLineComment: { | ||
| name: string; | ||
| type: "boolean"; | ||
| category: string; | ||
| deprecated: string; | ||
| default: true; | ||
| description: string; | ||
| readonly jsdocSingleLineComment: { | ||
| readonly name: "jsdocSingleLineComment"; | ||
| readonly type: "boolean"; | ||
| readonly category: "jsdoc"; | ||
| readonly deprecated: "use jsdocCommentLineStrategy instead will be remove on v2"; | ||
| readonly default: true; | ||
| readonly description: "Should compact single line comment"; | ||
| }; | ||
| jsdocCommentLineStrategy: { | ||
| name: string; | ||
| type: "choice"; | ||
| choices: { | ||
| since: string; | ||
| value: string; | ||
| readonly jsdocCommentLineStrategy: { | ||
| readonly name: "jsdocCommentLineStrategy"; | ||
| readonly type: "choice"; | ||
| readonly choices: { | ||
| since?: string | undefined; | ||
| value: any; | ||
| description: string; | ||
| }[]; | ||
| category: string; | ||
| default: string; | ||
| description: string; | ||
| readonly category: "jsdoc"; | ||
| readonly default: "singleLine"; | ||
| readonly description: "How comments line should be"; | ||
| }; | ||
| jsdocSeparateReturnsFromParam: { | ||
| name: string; | ||
| type: "boolean"; | ||
| category: string; | ||
| default: false; | ||
| description: string; | ||
| readonly jsdocSeparateReturnsFromParam: { | ||
| readonly name: "jsdocSeparateReturnsFromParam"; | ||
| readonly type: "boolean"; | ||
| readonly category: "jsdoc"; | ||
| readonly default: false; | ||
| readonly description: "Add an space between last @param and @returns"; | ||
| }; | ||
| jsdocSeparateTagGroups: { | ||
| name: string; | ||
| type: "boolean"; | ||
| category: string; | ||
| default: false; | ||
| description: string; | ||
| readonly jsdocSeparateTagGroups: { | ||
| readonly name: "jsdocSeparateTagGroups"; | ||
| readonly type: "boolean"; | ||
| readonly category: "jsdoc"; | ||
| readonly default: false; | ||
| readonly description: "Add an space between tag groups"; | ||
| }; | ||
| jsdocCapitalizeDescription: { | ||
| name: string; | ||
| type: "boolean"; | ||
| category: string; | ||
| default: true; | ||
| description: string; | ||
| readonly jsdocCapitalizeDescription: { | ||
| readonly name: "jsdocCapitalizeDescription"; | ||
| readonly type: "boolean"; | ||
| readonly category: "jsdoc"; | ||
| readonly default: true; | ||
| readonly description: "Should capitalize first letter of description"; | ||
| }; | ||
| tsdoc: { | ||
| name: string; | ||
| type: "boolean"; | ||
| category: string; | ||
| default: false; | ||
| description: string; | ||
| readonly tsdoc: { | ||
| readonly name: "tsdoc"; | ||
| readonly type: "boolean"; | ||
| readonly category: "jsdoc"; | ||
| readonly default: false; | ||
| readonly description: "Should format as tsdoc"; | ||
| }; | ||
| jsdocPrintWidth: { | ||
| name: string; | ||
| type: "int"; | ||
| category: string; | ||
| default: any; | ||
| description: string; | ||
| readonly jsdocPrintWidth: { | ||
| readonly name: "jsdocPrintWidth"; | ||
| readonly type: "int"; | ||
| readonly category: "jsdoc"; | ||
| readonly default: undefined; | ||
| readonly description: "If You don't set value to jsdocPrintWidth, the printWidth will be use as jsdocPrintWidth."; | ||
| }; | ||
| jsdocAddDefaultToDescription: { | ||
| name: string; | ||
| type: "boolean"; | ||
| category: string; | ||
| default: true; | ||
| description: string; | ||
| readonly jsdocAddDefaultToDescription: { | ||
| readonly name: "jsdocAddDefaultToDescription"; | ||
| readonly type: "boolean"; | ||
| readonly category: "jsdoc"; | ||
| readonly default: true; | ||
| readonly description: "Add Default value of a param to end description"; | ||
| }; | ||
| jsdocPreferCodeFences: { | ||
| name: string; | ||
| type: "boolean"; | ||
| category: string; | ||
| default: false; | ||
| description: string; | ||
| readonly jsdocPreferCodeFences: { | ||
| readonly name: "jsdocPreferCodeFences"; | ||
| readonly type: "boolean"; | ||
| readonly category: "jsdoc"; | ||
| readonly default: false; | ||
| readonly 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: string; | ||
| type: "choice"; | ||
| choices: { | ||
| since: string; | ||
| value: string; | ||
| readonly jsdocLineWrappingStyle: { | ||
| readonly name: "jsdocLineWrappingStyle"; | ||
| readonly type: "choice"; | ||
| readonly choices: { | ||
| since?: string | undefined; | ||
| value: any; | ||
| description: string; | ||
| }[]; | ||
| category: string; | ||
| default: string; | ||
| description: string; | ||
| readonly category: "jsdoc"; | ||
| readonly default: "greedy"; | ||
| readonly description: "Strategy for wrapping lines for the given print width. More options may be added in the future."; | ||
| }; | ||
| readonly jsdocTagsOrder: { | ||
| readonly name: "jsdocTagsOrder"; | ||
| readonly type: "string"; | ||
| readonly category: "jsdoc"; | ||
| readonly default: undefined; | ||
| readonly description: "How many spaces will be used to separate tag elements."; | ||
| }; | ||
| }; | ||
@@ -121,0 +128,0 @@ declare const defaultOptions: JsdocOptions; |
+16
-10
@@ -137,2 +137,9 @@ import { getParser } from "./parser.js"; | ||
| }, | ||
| jsdocTagsOrder: { | ||
| name: "jsdocTagsOrder", | ||
| type: "string", | ||
| category: "jsdoc", | ||
| default: undefined, | ||
| description: "How many spaces will be used to separate tag elements.", | ||
| }, | ||
| }; | ||
@@ -145,17 +152,13 @@ const defaultOptions = { | ||
| jsdocVerticalAlignment: options.jsdocVerticalAlignment.default, | ||
| jsdocKeepUnParseAbleExampleIndent: options.jsdocKeepUnParseAbleExampleIndent | ||
| .default, | ||
| jsdocKeepUnParseAbleExampleIndent: options.jsdocKeepUnParseAbleExampleIndent.default, | ||
| jsdocSingleLineComment: options.jsdocSingleLineComment.default, | ||
| jsdocCommentLineStrategy: options.jsdocCommentLineStrategy | ||
| .default, | ||
| jsdocSeparateReturnsFromParam: options.jsdocSeparateReturnsFromParam | ||
| .default, | ||
| jsdocCommentLineStrategy: options.jsdocCommentLineStrategy.default, | ||
| jsdocSeparateReturnsFromParam: options.jsdocSeparateReturnsFromParam.default, | ||
| jsdocSeparateTagGroups: options.jsdocSeparateTagGroups.default, | ||
| jsdocCapitalizeDescription: options.jsdocCapitalizeDescription | ||
| .default, | ||
| jsdocAddDefaultToDescription: options.jsdocAddDefaultToDescription | ||
| .default, | ||
| jsdocCapitalizeDescription: options.jsdocCapitalizeDescription.default, | ||
| jsdocAddDefaultToDescription: options.jsdocAddDefaultToDescription.default, | ||
| jsdocPreferCodeFences: options.jsdocPreferCodeFences.default, | ||
| tsdoc: options.tsdoc.default, | ||
| jsdocLineWrappingStyle: options.jsdocLineWrappingStyle.default, | ||
| jsdocTagsOrder: options.jsdocTagsOrder.default, | ||
| }; | ||
@@ -216,2 +219,5 @@ const parsers = { | ||
| function normalizeOptions(options) { | ||
| if (options.jsdocTagsOrder) { | ||
| options.jsdocTagsOrder = JSON.parse(options.jsdocTagsOrder); | ||
| } | ||
| if (options.jsdocCommentLineStrategy) { | ||
@@ -218,0 +224,0 @@ return; |
+76
-63
@@ -171,49 +171,50 @@ (function (global, factory) { | ||
| ]; | ||
| const TAGS_ORDER = [ | ||
| REMARKS, | ||
| PRIVATE_REMARKS, | ||
| PROVIDES_MODULE, | ||
| MODULE, | ||
| LICENSE, | ||
| FLOW, | ||
| ASYNC, | ||
| PRIVATE, | ||
| IGNORE, | ||
| MEMBEROF, | ||
| VERSION, | ||
| FILE, | ||
| AUTHOR, | ||
| DEPRECATED, | ||
| SINCE, | ||
| CATEGORY, | ||
| DESCRIPTION, | ||
| EXAMPLE, | ||
| ABSTRACT, | ||
| AUGMENTS, | ||
| CONSTANT, | ||
| ...TAGS_DEFAULT, | ||
| EXTERNAL, | ||
| OVERLOAD, | ||
| FIRES, | ||
| TEMPLATE, | ||
| TYPE_PARAM, | ||
| FUNCTION, | ||
| NAMESPACE, | ||
| BORROWS, | ||
| CLASS, | ||
| EXTENDS, | ||
| MEMBER, | ||
| TYPEDEF, | ||
| TYPE, | ||
| SATISFIES, | ||
| PROPERTY, | ||
| CALLBACK, | ||
| PARAM, | ||
| YIELDS, | ||
| RETURNS, | ||
| THROWS, | ||
| "other", | ||
| SEE, | ||
| TODO, | ||
| ]; | ||
| const TAGS_ORDER = { | ||
| [REMARKS]: 1, | ||
| [PRIVATE_REMARKS]: 2, | ||
| [PROVIDES_MODULE]: 3, | ||
| [MODULE]: 4, | ||
| [LICENSE]: 5, | ||
| [FLOW]: 6, | ||
| [ASYNC]: 7, | ||
| [PRIVATE]: 8, | ||
| [IGNORE]: 9, | ||
| [MEMBEROF]: 10, | ||
| [VERSION]: 11, | ||
| [FILE]: 12, | ||
| [AUTHOR]: 13, | ||
| [DEPRECATED]: 14, | ||
| [SINCE]: 15, | ||
| [CATEGORY]: 16, | ||
| [DESCRIPTION]: 17, | ||
| [EXAMPLE]: 18, | ||
| [ABSTRACT]: 19, | ||
| [AUGMENTS]: 20, | ||
| [CONSTANT]: 21, | ||
| [DEFAULT]: 22, | ||
| [DEFAULT_VALUE]: 23, | ||
| [EXTERNAL]: 24, | ||
| [OVERLOAD]: 25, | ||
| [FIRES]: 26, | ||
| [TEMPLATE]: 27, | ||
| [TYPE_PARAM]: 28, | ||
| [FUNCTION]: 29, | ||
| [NAMESPACE]: 30, | ||
| [BORROWS]: 31, | ||
| [CLASS]: 32, | ||
| [EXTENDS]: 33, | ||
| [MEMBER]: 34, | ||
| [TYPEDEF]: 35, | ||
| [TYPE]: 36, | ||
| [SATISFIES]: 37, | ||
| [PROPERTY]: 38, | ||
| [CALLBACK]: 39, | ||
| [PARAM]: 40, | ||
| [YIELDS]: 41, | ||
| [RETURNS]: 42, | ||
| [THROWS]: 43, | ||
| other: 44, | ||
| [SEE]: 45, | ||
| [TODO]: 46, | ||
| }; | ||
@@ -703,3 +704,3 @@ function convertToModernType(oldType) { | ||
| if (TAGS_PEV_FORMATE_DESCRIPTION.includes(tag) || | ||
| !TAGS_ORDER.includes(tag)) { | ||
| !TAGS_ORDER[tag]) { | ||
| descriptionString = description; | ||
@@ -928,4 +929,10 @@ } | ||
| } | ||
| const index = TAGS_ORDER.indexOf(tag); | ||
| return index === -1 ? TAGS_ORDER.indexOf("other") : index; | ||
| let index; | ||
| if (options.jsdocTagsOrder?.[tag] !== undefined) { | ||
| index = options.jsdocTagsOrder[tag]; | ||
| } | ||
| else { | ||
| index = TAGS_ORDER[tag]; | ||
| } | ||
| return index === undefined ? TAGS_ORDER.other : index; | ||
| } | ||
@@ -953,3 +960,3 @@ function isBlockComment(comment) { | ||
| } | ||
| const TAGS_ORDER_LOWER = TAGS_ORDER.map((tagOrder) => tagOrder.toLowerCase()); | ||
| const TAGS_ORDER_ENTRIES = Object.entries(TAGS_ORDER); | ||
| function normalizeTags(parsed) { | ||
@@ -969,5 +976,5 @@ parsed.tags = parsed.tags.map(({ tag, type, name, description, default: _default, ...rest }) => { | ||
| const lower = tag.toLowerCase(); | ||
| const tagIndex = TAGS_ORDER_LOWER.indexOf(lower); | ||
| const tagIndex = TAGS_ORDER_ENTRIES.findIndex(([key]) => key.toLowerCase() === lower); | ||
| if (tagIndex >= 0) { | ||
| tag = TAGS_ORDER[tagIndex]; | ||
| tag = TAGS_ORDER_ENTRIES[tagIndex][0]; | ||
| } | ||
@@ -1263,2 +1270,9 @@ else if (lower in TAGS_SYNONYMS) { | ||
| }, | ||
| jsdocTagsOrder: { | ||
| name: "jsdocTagsOrder", | ||
| type: "string", | ||
| category: "jsdoc", | ||
| default: undefined, | ||
| description: "How many spaces will be used to separate tag elements.", | ||
| }, | ||
| }; | ||
@@ -1271,17 +1285,13 @@ const defaultOptions = { | ||
| jsdocVerticalAlignment: options.jsdocVerticalAlignment.default, | ||
| jsdocKeepUnParseAbleExampleIndent: options.jsdocKeepUnParseAbleExampleIndent | ||
| .default, | ||
| jsdocKeepUnParseAbleExampleIndent: options.jsdocKeepUnParseAbleExampleIndent.default, | ||
| jsdocSingleLineComment: options.jsdocSingleLineComment.default, | ||
| jsdocCommentLineStrategy: options.jsdocCommentLineStrategy | ||
| .default, | ||
| jsdocSeparateReturnsFromParam: options.jsdocSeparateReturnsFromParam | ||
| .default, | ||
| jsdocCommentLineStrategy: options.jsdocCommentLineStrategy.default, | ||
| jsdocSeparateReturnsFromParam: options.jsdocSeparateReturnsFromParam.default, | ||
| jsdocSeparateTagGroups: options.jsdocSeparateTagGroups.default, | ||
| jsdocCapitalizeDescription: options.jsdocCapitalizeDescription | ||
| .default, | ||
| jsdocAddDefaultToDescription: options.jsdocAddDefaultToDescription | ||
| .default, | ||
| jsdocCapitalizeDescription: options.jsdocCapitalizeDescription.default, | ||
| jsdocAddDefaultToDescription: options.jsdocAddDefaultToDescription.default, | ||
| jsdocPreferCodeFences: options.jsdocPreferCodeFences.default, | ||
| tsdoc: options.tsdoc.default, | ||
| jsdocLineWrappingStyle: options.jsdocLineWrappingStyle.default, | ||
| jsdocTagsOrder: options.jsdocTagsOrder.default, | ||
| }; | ||
@@ -1341,2 +1351,5 @@ const parsers = { | ||
| function normalizeOptions(options) { | ||
| if (options.jsdocTagsOrder) { | ||
| options.jsdocTagsOrder = JSON.parse(options.jsdocTagsOrder); | ||
| } | ||
| if (options.jsdocCommentLineStrategy) { | ||
@@ -1343,0 +1356,0 @@ return; |
@@ -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="deprecated",$="description",w="example",S="extends",v="external",x="file",W="fires",k="function",D="ignore",L="license",P="member",C="memberof",A="module",T="namespace",E="overload",F="override",O="param",I="privateRemarks",M="property",_="remarks",z="returns",R="since",q="throws",U="todo",K="type",V="typedef",G="satisfies",B="yields",H={tag:"this_is_for_space",name:"",optional:!1,type:"",description:"",source:[],problems:[]},Y={arg:O,argument:O,const:j,constructor:y,desc:$,emits:W,examples:w,exception:q,fileoverview:x,func:k,host:v,method:k,overview:x,params:O,prop:M,return:z,var:P,virtual:g,yield:B,hidden:D},J=["default","defaultValue"],N=[f,h,b,$,w,S,L,A,T,E,F,I,_,z,R,q,U,B,x,...J],Q=[f,f,b,$,w,D,L,A,T,E,F,I,_,R,U,x],X=[f,...J,C,A,"see"],Z=[f,h,$,w,I,_,R,U],ee=[S,O,M,z,q,K,G,V,B],te=[m,V],ne=[...te,K,M,O,z,B,q],re=[_,I,"providesModule",A,L,"flow","async","private",D,C,"version",x,"author",b,R,h,$,w,g,"augments",j,...J,v,E,W,"template","typeParam",k,T,f,y,S,P,V,K,G,M,m,O,B,z,q,"other","see",U];function ae(e,t){return(e.match(new RegExp(t,"g"))||[]).length}function se(e){return e?e.match(/^https?:\/\//i)?e:e.startsWith("- ")?e.slice(0,2)+se(e.slice(2)):e[0].toUpperCase()+e.slice(1):e}async function ie(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 oe=(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]},ce=e=>J.includes(e),le="2@^5!~#sdE!_TABLE";async function pe(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${le}\n\n${r?r.slice(1):""}`})),r.jsdocCapitalizeDescription&&!X.includes(e)&&(t=se(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!==$&&"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===le?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&&!X.includes(e)&&(t=se(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 ie(n,t,{...r,parser:s,jsdocKeepUnParseAbleExampleIndent:!0})}else r.jsdocPreferCodeFences||(a=t+" ".repeat(4)),n=await ie(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===le&&(a&&(a.costumeType=le),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 de=async({name:e,description:t,type:n,tag:r},a,s,i,o,c,l)=>{let p="\n";if(r===H.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 S=0,v=0,x=0,W=0;g&&ee.includes(r)&&(r?S+=o-r.length:o&&(W+=o+b.length),n?v+=c-n.length:c&&(W+=c+b.length),e?x+=l-e.length:l&&(W=l+b.length));const k=r!==$||f;if(k&&(p+=`@${r}${" ".repeat(S||0)}`),n){p+=b+(()=>{if(!ce(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+=`${b}${e}${" ".repeat(x)}`),r!==w||m){if(t){let e="";if(k&&(p+=b+" ".repeat(W)),X.includes(r)||!re.includes(r))e=t;else{const[,n]=/^\s*(\S+)/.exec(t)||["",""],a=r===$||[w,_,I].includes(r)&&m?"":" ";e=r!==$&&p.length+n.length>d||[_,I].includes(r)?`\n${a}`+await pe(r,t,i,{beginningSpace:a}):await pe(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 ie(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[$,w,U].includes(e)&&!t?"\n":""}({tag:r,isEndTag:a===s.length-1}),p},{name:ue,tag:ge,type:fe,description:me}=t.tokenizers,he=(e,r)=>async function(a,s,i){let o=i??s;const c=(oe(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(!be(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:[ge(),e=>ce(e.tag)?e:fe("preserve")(e),ue(),me("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=$e.indexOf(o);return c>=0?e=re[c]:o in Y&&(e=Y[o]),t=t.trim(),(n=n.trim())&&N.includes(e)&&(r=`${n} ${r}`,n=""),t&&Q.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()!==$||(e.trim()&&(t+="\n\n"+e),!1))),t&&e.tags.unshift({tag:$,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=ye(b,d,o),o.jsdocSeparateReturnsFromParam&&(b=b.flatMap(((e,t)=>e.tag===z&&b[t-1]?.tag===O?[H,e]:[e]))),o.jsdocAddDefaultToDescription&&(b=b.map(we)),b=await Promise.all(b.map(Se).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})=>(ee.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!==$&&n.tag!==w&&n.tag!==H.tag&&e.tag!==H.tag&&n.tag!==e.tag?[H,e]:[e]})));const S=b.filter((({description:e,tag:t})=>!(!e&&Z.includes(t))));for(const[t,n]of S.entries()){const r=await de(n,t,S,{...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===ae(t.trim(),"\n")||"keep"===n.jsdocCommentLineStrategy&&0===ae(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=>!(be(e)&&!e.value))),c};function ye(e,t,n){let r=!1,a=!1;return e=e.reduce(((e,t)=>((0===e.length||te.includes(t.tag)&&r)&&(r=!1,e.push([])),ne.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===O&&r.tag===O){const n=t.indexOf(e.name),a=t.indexOf(r.name);return n>-1&&a>-1?n-a:0}return je(e.tag,n)-je(r.tag,n)})),s.length-1!==r&&e.push(H),r>0&&e[0]?.tag&&!te.includes(e[0].tag)&&(a=!0),e))),a?ye(e,t,n):e}function je(e,t){if(e===$&&!t.jsdocDescriptionTag)return-1;const n=re.indexOf(e);return-1===n?re.indexOf("other"):n}function be(e){return"CommentBlock"===e.type||"Block"===e.type}const $e=re.map((e=>e.toLowerCase()));function we(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 Se({name:e,optional:t,default:n,tag:r,type:a,source:s,description:i,...o}){if(ce(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 ve={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."}},xe={jsdocSpaces:ve.jsdocSpaces.default,jsdocPrintWidth:ve.jsdocPrintWidth.default,jsdocDescriptionWithDot:ve.jsdocDescriptionWithDot.default,jsdocDescriptionTag:ve.jsdocDescriptionTag.default,jsdocVerticalAlignment:ve.jsdocVerticalAlignment.default,jsdocKeepUnParseAbleExampleIndent:ve.jsdocKeepUnParseAbleExampleIndent.default,jsdocSingleLineComment:ve.jsdocSingleLineComment.default,jsdocCommentLineStrategy:ve.jsdocCommentLineStrategy.default,jsdocSeparateReturnsFromParam:ve.jsdocSeparateReturnsFromParam.default,jsdocSeparateTagGroups:ve.jsdocSeparateTagGroups.default,jsdocCapitalizeDescription:ve.jsdocCapitalizeDescription.default,jsdocAddDefaultToDescription:ve.jsdocAddDefaultToDescription.default,jsdocPreferCodeFences:ve.jsdocPreferCodeFences.default,tsdoc:ve.tsdoc.default,jsdocLineWrappingStyle:ve.jsdocLineWrappingStyle.default},We={get babel(){return ke(p.default.parsers.babel,"babel")},get"babel-flow"(){return ke(p.default.parsers["babel-flow"],"babel-flow")},get"babel-ts"(){return ke(p.default.parsers["babel-ts"],"babel-ts")},get flow(){return ke(d.default.parsers.flow,"flow")},get typescript(){return ke(u.default.parsers.typescript,"typescript")},get"jsdoc-parser"(){return ke(p.default.parsers["babel-ts"],"babel-ts")}};function ke(e,t){const n=he(e.parse,t),r=(s,i)=>{!function(e){if(e.jsdocCommentLineStrategy)return;e.jsdocSingleLineComment?e.jsdocCommentLineStrategy="singleLine":e.jsdocCommentLineStrategy="multiline"}(i);const o=oe(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=xe,e.options=ve,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,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})})); |
+11
-5
@@ -192,4 +192,10 @@ import { parse, tokenizers } from "comment-parser"; | ||
| } | ||
| const index = TAGS_ORDER.indexOf(tag); | ||
| return index === -1 ? TAGS_ORDER.indexOf("other") : index; | ||
| let index; | ||
| if (options.jsdocTagsOrder?.[tag] !== undefined) { | ||
| index = options.jsdocTagsOrder[tag]; | ||
| } | ||
| else { | ||
| index = TAGS_ORDER[tag]; | ||
| } | ||
| return index === undefined ? TAGS_ORDER.other : index; | ||
| } | ||
@@ -217,3 +223,3 @@ function isBlockComment(comment) { | ||
| } | ||
| const TAGS_ORDER_LOWER = TAGS_ORDER.map((tagOrder) => tagOrder.toLowerCase()); | ||
| const TAGS_ORDER_ENTRIES = Object.entries(TAGS_ORDER); | ||
| function normalizeTags(parsed) { | ||
@@ -233,5 +239,5 @@ parsed.tags = parsed.tags.map(({ tag, type, name, description, default: _default, ...rest }) => { | ||
| const lower = tag.toLowerCase(); | ||
| const tagIndex = TAGS_ORDER_LOWER.indexOf(lower); | ||
| const tagIndex = TAGS_ORDER_ENTRIES.findIndex(([key]) => key.toLowerCase() === lower); | ||
| if (tagIndex >= 0) { | ||
| tag = TAGS_ORDER[tagIndex]; | ||
| tag = TAGS_ORDER_ENTRIES[tagIndex][0]; | ||
| } | ||
@@ -238,0 +244,0 @@ else if (lower in TAGS_SYNONYMS) { |
+48
-1
@@ -32,3 +32,50 @@ declare const TAGS_SYNONYMS: { | ||
| declare const TAGS_GROUP_CONDITION: string[]; | ||
| declare const TAGS_ORDER: string[]; | ||
| declare const TAGS_ORDER: { | ||
| remarks: number; | ||
| privateRemarks: number; | ||
| providesModule: number; | ||
| module: number; | ||
| license: number; | ||
| flow: number; | ||
| async: number; | ||
| private: number; | ||
| ignore: number; | ||
| memberof: number; | ||
| version: number; | ||
| file: number; | ||
| author: number; | ||
| deprecated: number; | ||
| since: number; | ||
| category: number; | ||
| description: number; | ||
| example: number; | ||
| abstract: number; | ||
| augments: number; | ||
| constant: number; | ||
| default: number; | ||
| defaultValue: number; | ||
| external: number; | ||
| overload: number; | ||
| fires: number; | ||
| template: number; | ||
| typeParam: number; | ||
| function: number; | ||
| namespace: number; | ||
| borrows: number; | ||
| class: number; | ||
| extends: number; | ||
| member: number; | ||
| typedef: number; | ||
| type: number; | ||
| satisfies: number; | ||
| property: number; | ||
| callback: number; | ||
| param: number; | ||
| yields: number; | ||
| returns: number; | ||
| throws: number; | ||
| other: number; | ||
| see: number; | ||
| todo: number; | ||
| }; | ||
| export { TAGS_PEV_FORMATE_DESCRIPTION, TAGS_DESCRIPTION_NEEDED, TAGS_NAMELESS, TAGS_GROUP_HEAD, TAGS_GROUP_CONDITION, TAGS_ORDER, TAGS_SYNONYMS, TAGS_TYPE_NEEDED, TAGS_TYPELESS, TAGS_VERTICALLY_ALIGN_ABLE, TAGS_DEFAULT, }; |
+48
-47
@@ -114,50 +114,51 @@ import { ABSTRACT, ASYNC, AUGMENTS, AUTHOR, BORROWS, CALLBACK, CATEGORY, CLASS, CONSTANT, DEFAULT, DEFAULT_VALUE, DEPRECATED, DESCRIPTION, EXAMPLE, EXTENDS, EXTERNAL, FILE, FIRES, FLOW, FUNCTION, IGNORE, 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"; | ||
| ]; | ||
| const TAGS_ORDER = [ | ||
| REMARKS, | ||
| PRIVATE_REMARKS, | ||
| PROVIDES_MODULE, | ||
| MODULE, | ||
| LICENSE, | ||
| FLOW, | ||
| ASYNC, | ||
| PRIVATE, | ||
| IGNORE, | ||
| MEMBEROF, | ||
| VERSION, | ||
| FILE, | ||
| AUTHOR, | ||
| DEPRECATED, | ||
| SINCE, | ||
| CATEGORY, | ||
| DESCRIPTION, | ||
| EXAMPLE, | ||
| ABSTRACT, | ||
| AUGMENTS, | ||
| CONSTANT, | ||
| ...TAGS_DEFAULT, | ||
| EXTERNAL, | ||
| OVERLOAD, | ||
| FIRES, | ||
| TEMPLATE, | ||
| TYPE_PARAM, | ||
| FUNCTION, | ||
| NAMESPACE, | ||
| BORROWS, | ||
| CLASS, | ||
| EXTENDS, | ||
| MEMBER, | ||
| TYPEDEF, | ||
| TYPE, | ||
| SATISFIES, | ||
| PROPERTY, | ||
| CALLBACK, | ||
| PARAM, | ||
| YIELDS, | ||
| RETURNS, | ||
| THROWS, | ||
| "other", | ||
| SEE, | ||
| TODO, | ||
| ]; | ||
| const TAGS_ORDER = { | ||
| [REMARKS]: 1, | ||
| [PRIVATE_REMARKS]: 2, | ||
| [PROVIDES_MODULE]: 3, | ||
| [MODULE]: 4, | ||
| [LICENSE]: 5, | ||
| [FLOW]: 6, | ||
| [ASYNC]: 7, | ||
| [PRIVATE]: 8, | ||
| [IGNORE]: 9, | ||
| [MEMBEROF]: 10, | ||
| [VERSION]: 11, | ||
| [FILE]: 12, | ||
| [AUTHOR]: 13, | ||
| [DEPRECATED]: 14, | ||
| [SINCE]: 15, | ||
| [CATEGORY]: 16, | ||
| [DESCRIPTION]: 17, | ||
| [EXAMPLE]: 18, | ||
| [ABSTRACT]: 19, | ||
| [AUGMENTS]: 20, | ||
| [CONSTANT]: 21, | ||
| [DEFAULT]: 22, | ||
| [DEFAULT_VALUE]: 23, | ||
| [EXTERNAL]: 24, | ||
| [OVERLOAD]: 25, | ||
| [FIRES]: 26, | ||
| [TEMPLATE]: 27, | ||
| [TYPE_PARAM]: 28, | ||
| [FUNCTION]: 29, | ||
| [NAMESPACE]: 30, | ||
| [BORROWS]: 31, | ||
| [CLASS]: 32, | ||
| [EXTENDS]: 33, | ||
| [MEMBER]: 34, | ||
| [TYPEDEF]: 35, | ||
| [TYPE]: 36, | ||
| [SATISFIES]: 37, | ||
| [PROPERTY]: 38, | ||
| [CALLBACK]: 39, | ||
| [PARAM]: 40, | ||
| [YIELDS]: 41, | ||
| [RETURNS]: 42, | ||
| [THROWS]: 43, | ||
| other: 44, | ||
| [SEE]: 45, | ||
| [TODO]: 46, | ||
| }; | ||
| export { TAGS_PEV_FORMATE_DESCRIPTION, TAGS_DESCRIPTION_NEEDED, TAGS_NAMELESS, TAGS_GROUP_HEAD, TAGS_GROUP_CONDITION, TAGS_ORDER, TAGS_SYNONYMS, TAGS_TYPE_NEEDED, TAGS_TYPELESS, TAGS_VERTICALLY_ALIGN_ABLE, TAGS_DEFAULT, }; | ||
| //# sourceMappingURL=roles.js.map |
@@ -74,3 +74,3 @@ import { formatDescription, descriptionEndLine, } from "./descriptionFormatter.js"; | ||
| if (TAGS_PEV_FORMATE_DESCRIPTION.includes(tag) || | ||
| !TAGS_ORDER.includes(tag)) { | ||
| !TAGS_ORDER[tag]) { | ||
| descriptionString = description; | ||
@@ -77,0 +77,0 @@ } |
+1
-0
@@ -18,2 +18,3 @@ import { ParserOptions } from "prettier"; | ||
| jsdocLineWrappingStyle: "greedy"; | ||
| jsdocTagsOrder?: Record<string, number>; | ||
| } | ||
@@ -20,0 +21,0 @@ export interface AllOptions extends ParserOptions, JsdocOptions { |
+1
-1
| { | ||
| "name": "prettier-plugin-jsdoc", | ||
| "version": "1.1.1", | ||
| "version": "1.3.0", | ||
| "description": "A Prettier plugin to format JSDoc comments.", | ||
@@ -5,0 +5,0 @@ "private": false, |
+1
-0
@@ -200,2 +200,3 @@ [](https://nodei.co/npm/prettier-plugin-jsdoc/) | ||
| | jsdocLineWrappingStyle | String | "greedy" | "greedy": Lines wrap as soon as they reach the print width | | ||
| | jsdocTagsOrder | String (object) | "undefined" | [Custom Tags Order](doc/CUSTOM_TAGS_ORDER.md) | | ||
@@ -202,0 +203,0 @@ Full up to date list and description of options can be found in Prettier help. First install plugin then run Prettier with "--help" option. |
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
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
228806
3.29%3141
2.65%263
0.38%