1 line
34 KiB
Text
1 line
34 KiB
Text
|
|
{"version":3,"file":"getJsdocProcessorPlugin.cjs","names":["_jsdocUtils","require","_jsdoccomment","espree","_interopRequireWildcard","_htmlEntities","_nodeFs","_nodePath","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","version","JSON","parse","readFileSync","join","__dirname","likelyNestedJSDocIndentSpace","preTagSpaceLength","firstLinePrefixLength","hasCaptionRegex","escapeStringRegexp","str","replaceAll","countChars","ch","match","RegExp","length","getLinesCols","text","matchLines","colDelta","slice","lastIndexOf","getJsdocProcessorPlugin","options","allowedLanguagesToProcess","captionRequired","checkDefaults","checkExamples","checkParams","checkProperties","exampleCodeRegex","matchingFileName","matchingFileNameDefaults","matchingFileNameParams","matchingFileNameProperties","paddedIndent","parser","undefined","rejectExampleCodeRegex","sourceType","exampleCodeRegExp","rejectExampleCodeRegExp","getRegexFromString","otherInfo","extraMessages","getTextsAndFileNames","jsdoc","jsFileName","commentLineCols","textsAndFileNames","checkSource","cols","defaultFileName","ext","filename","lines","skipInit","source","sources","tag","line","targetTagName","push","nonJSPrefacingCols","nonJSPrefacingLines","string","addSourceInfo","src","file","number","codeStartLine","codeStartCol","_","code","test","String","fromCodePoint","Number","parseInt","decode","level","targetSource","getFilenameInfo","includes","replace","filenameInfo","forEachPreferredTag","description","trim","getTagDescription","tagName","getPreferredTagName","hasTag","matchingFilenameInfo","column","message","ruleId","severity","matches","exec","groups","language","toLowerCase","startingIndex","lastStringCount","exampleCode","lastIndex","n0","n1","index","preMatch","preMatchLines","nonJSPreface","nonJSPrefaceLineCount","idx","indexOf","charsInLastLine","global","meta","name","processors","examples","postprocess","jsMessages","messages","entries","msg","endColumn","endLine","fatal","messageText","fix","codeCtxLine","codeCtxColumn","startLine","startCol","ret","concat","preprocess","ast","parseForESLint","comment","ecmaVersion","jsdocComments","comments","filter","value","map","start","range","textToStart","parseComment","flatMap","error","console","log","supportsAutofix","exports"],"sources":["../src/getJsdocProcessorPlugin.js"],"sourcesContent":["import {\n forEachPreferredTag,\n getPreferredTagName,\n getRegexFromString,\n getTagDescription,\n hasTag,\n} from './jsdocUtils.js';\nimport {\n parseComment,\n} from '@es-joy/jsdoccomment';\nimport * as espree from 'espree';\nimport {\n decode,\n} from 'html-entities';\nimport {\n readFileSync,\n} from 'node:fs';\nimport {\n join,\n} from 'node:path';\n/**\n * @import {\n * Integer,\n * JsdocBlockWithInline,\n * } from './iterateJsdoc.js';\n * @import {\n * ESLint,\n * Linter,\n * } from 'eslint';\n */\n\nconst {\n version,\n} = JSON.parse(\n readFileSync(join(import.meta.dirname, '../package.json'), 'utf8'),\n);\n\n// const zeroBasedLineIndexAdjust = -1;\nconst likelyNestedJSDocIndentSpace = 1;\nconst preTagSpaceLength = 1;\n\n// If a space is present, we should ignore it\nconst firstLinePrefixLength = preTagSpaceLength;\n\nconst hasCaptionRegex = /^\\s*<caption>([\\s\\S]*?)<\\/caption>/v;\n\n/**\n * @param {string} str\n * @returns {string}\n */\nconst escapeStringRegexp = (str) => {\n return str.replaceAll(/[.*+?^$\\{\\}\\(\\)\\|\\[\\]\\\\]/gv, '\\\\$&');\n};\n\n/**\n * @param {string} str\n * @param {string} ch\n * @returns {Integer}\n */\nconst countChars = (str, ch) => {\n return (str.match(new RegExp(escapeStringRegexp(ch), 'gv')) || []).length;\n};\n\n/**\n * @param {string} text\n * @returns {[\n * Integer,\n * Integer\n * ]}\n */\nconst getLinesCols = (text) => {\n const matchLines = countChars(text, '\\n');\n\n const colDelta = matchLines ?\n text.slice(text.lastIndexOf('\\n') + 1).length :\n text.length;\n\n return [\n matchLines, colDelta,\n ];\n};\n\n/**\
|