@es-joy/jsdoccomment
Advanced tools
Comparing version 0.41.0 to 0.42.0
# CHANGES for `@es-joy/jsdoccomment` | ||
## 0.42.0 | ||
- feat: expand argument for `parseComment` to accept a comment token string (@typhonrt) | ||
- chore: update devDeps. | ||
## 0.41.0 | ||
@@ -4,0 +9,0 @@ |
@@ -8,2 +8,3 @@ export { visitorKeys as jsdocTypeVisitorKeys } from "jsdoc-type-pratt-parser"; | ||
export { default as toCamelCase } from "./toCamelCase.js"; | ||
export { default as parseInlineTags } from "./parseInlineTags.js"; | ||
export { default as estreeToString } from "./estreeToString.js"; | ||
@@ -10,0 +11,0 @@ export type InlineTag = import('./commentParserToESTree.js').JsdocInlineTagNoType & { |
@@ -26,10 +26,11 @@ export function hasSeeWithLink(spec: import('comment-parser').Spec): boolean; | ||
/** | ||
* Accepts a comment token and converts it into `comment-parser` AST. | ||
* @param {{value: string}} commentNode | ||
* Accepts a comment token or complete comment string and converts it into | ||
* `comment-parser` AST. | ||
* @param {string | {value: string}} commentOrNode | ||
* @param {string} [indent] Whitespace | ||
* @returns {import('./index.js').JsdocBlockWithInline} | ||
*/ | ||
export function parseComment(commentNode: { | ||
export function parseComment(commentOrNode: string | { | ||
value: string; | ||
}, indent?: string | undefined): import('./index.js').JsdocBlockWithInline; | ||
//# sourceMappingURL=parseComment.d.ts.map |
{ | ||
"name": "@es-joy/jsdoccomment", | ||
"version": "0.41.0", | ||
"version": "0.42.0", | ||
"author": "Brett Zamir <brettz9@yahoo.com>", | ||
@@ -34,14 +34,2 @@ "contributors": [], | ||
], | ||
"scripts": { | ||
"tsc": "tsc", | ||
"open": "open ./coverage/lcov-report/index.html", | ||
"prepublishOnly": "pnpm i && npm run build", | ||
"build": "npm run rollup && tsc -p tsconfig-prod.json", | ||
"rollup": "rollup -c", | ||
"eslint": "eslint --ext=js,cjs,md,html .", | ||
"lint": "npm run eslint --", | ||
"mocha": "mocha --require chai/register-expect.js", | ||
"c8": "c8 npm run mocha", | ||
"test": "npm run lint && npm run build && npm run c8" | ||
}, | ||
"repository": { | ||
@@ -64,18 +52,18 @@ "type": "git", | ||
"devDependencies": { | ||
"@babel/core": "^7.23.3", | ||
"@babel/core": "^7.23.9", | ||
"@babel/plugin-syntax-class-properties": "^7.12.13", | ||
"@babel/preset-env": "^7.23.3", | ||
"@babel/preset-env": "^7.23.9", | ||
"@brettz9/eslint-plugin": "^1.0.4", | ||
"@rollup/plugin-babel": "^6.0.4", | ||
"@types/chai": "^4.3.10", | ||
"@types/eslint": "^8.44.7", | ||
"@types/chai": "^4.3.11", | ||
"@types/eslint": "^8.56.2", | ||
"@types/esquery": "^1.5.3", | ||
"@types/estraverse": "^5.1.6", | ||
"@types/estraverse": "^5.1.7", | ||
"@types/estree": "^1.0.5", | ||
"@types/mocha": "^10.0.4", | ||
"@typescript-eslint/types": "^6.10.0", | ||
"c8": "^8.0.1", | ||
"chai": "^4.3.10", | ||
"eslint": "^8.53.0", | ||
"eslint-config-ash-nazg": "35.1.0", | ||
"@types/mocha": "^10.0.6", | ||
"@typescript-eslint/types": "^6.20.0", | ||
"c8": "^9.1.0", | ||
"chai": "^5.0.3", | ||
"eslint": "^8.56.0", | ||
"eslint-config-ash-nazg": "35.3.0", | ||
"eslint-config-standard": "^17.1.0", | ||
@@ -86,6 +74,6 @@ "eslint-plugin-array-func": "^4.0.0", | ||
"eslint-plugin-html": "^7.1.0", | ||
"eslint-plugin-import": "^2.29.0", | ||
"eslint-plugin-jsdoc": "^46.8.2", | ||
"eslint-plugin-import": "^2.29.1", | ||
"eslint-plugin-jsdoc": "^48.0.4", | ||
"eslint-plugin-markdown": "^3.0.1", | ||
"eslint-plugin-n": "^16.3.0", | ||
"eslint-plugin-n": "^16.6.2", | ||
"eslint-plugin-no-unsanitized": "^4.0.2", | ||
@@ -95,9 +83,20 @@ "eslint-plugin-no-use-extend-native": "^0.5.0", | ||
"eslint-plugin-sonarjs": "^0.23.0", | ||
"eslint-plugin-unicorn": "^49.0.0", | ||
"espree": "^9.6.1", | ||
"eslint-plugin-unicorn": "^50.0.1", | ||
"espree": "^10.0.0", | ||
"estraverse": "^5.3.0", | ||
"mocha": "^10.2.0", | ||
"rollup": "^4.3.0", | ||
"typescript": "^5.2.2" | ||
"rollup": "^4.9.6", | ||
"typescript": "^5.3.3" | ||
}, | ||
"scripts": { | ||
"tsc": "tsc", | ||
"open": "open ./coverage/lcov-report/index.html", | ||
"build": "npm run rollup && tsc -p tsconfig-prod.json", | ||
"rollup": "rollup -c", | ||
"eslint": "eslint --ext=js,cjs,md,html .", | ||
"lint": "npm run eslint --", | ||
"mocha": "mocha --require chai/register-expect.js", | ||
"c8": "c8 npm run mocha", | ||
"test": "npm run lint && npm run build && npm run c8" | ||
} | ||
} | ||
} |
@@ -51,2 +51,4 @@ /** | ||
export {default as parseInlineTags} from './parseInlineTags.js'; | ||
export * from './commentParserToESTree.js'; | ||
@@ -53,0 +55,0 @@ |
@@ -144,13 +144,32 @@ /* eslint-disable prefer-named-capture-group -- Temporary */ | ||
/** | ||
* Accepts a comment token and converts it into `comment-parser` AST. | ||
* @param {{value: string}} commentNode | ||
* Accepts a comment token or complete comment string and converts it into | ||
* `comment-parser` AST. | ||
* @param {string | {value: string}} commentOrNode | ||
* @param {string} [indent] Whitespace | ||
* @returns {import('./index.js').JsdocBlockWithInline} | ||
*/ | ||
const parseComment = (commentNode, indent = '') => { | ||
// Preserve JSDoc block start/end indentation. | ||
const [block] = commentParser(`${indent}/*${commentNode.value}*/`, { | ||
// @see https://github.com/yavorskiy/comment-parser/issues/21 | ||
tokenizers: getTokenizers() | ||
}); | ||
const parseComment = (commentOrNode, indent = '') => { | ||
let block; | ||
switch (typeof commentOrNode) { | ||
case 'string': | ||
// Preserve JSDoc block start/end indentation. | ||
[block] = commentParser(`${indent}${commentOrNode}`, { | ||
// @see https://github.com/yavorskiy/comment-parser/issues/21 | ||
tokenizers: getTokenizers() | ||
}); | ||
break; | ||
case 'object': | ||
// Preserve JSDoc block start/end indentation. | ||
[block] = commentParser(`${indent}/*${commentOrNode.value}*/`, { | ||
// @see https://github.com/yavorskiy/comment-parser/issues/21 | ||
tokenizers: getTokenizers() | ||
}); | ||
break; | ||
default: | ||
throw new TypeError(`'commentOrNode' is not a string or object.`); | ||
} | ||
return parseInlineTags(block); | ||
@@ -157,0 +176,0 @@ }; |
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
114712
37
2700