New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@homer0/prettier-plugin-jsdoc

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@homer0/prettier-plugin-jsdoc - npm Package Compare versions

Comparing version
10.0.1
to
11.0.0
+40
eslint.config.js
import { defineConfig } from 'eslint/config';
import { createConfig } from '@homer0/eslint-plugin/create';
export default defineConfig([
createConfig({
importUrl: import.meta.url,
ignores: ['tests/**'],
configs: ['node-with-prettier', 'jsdoc'],
esm: true,
addTsParser: false,
extraneousDependencies: {
devFiles: ['vitest.*.config.js'],
},
languageOptions: {
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
},
},
}),
{
ignores: ['tests/e2e/fixtures/*.js'],
},
createConfig({
importUrl: import.meta.url,
files: 'all-inside:./tests',
configs: ['node-with-prettier', 'tests'],
esm: true,
addTsParser: false,
languageOptions: {
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
},
},
rules: {
'no-use-before-define': 'off',
},
}),
]);
onlyBuiltDependencies:
- esbuild
- unrs-resolver
+23
-0

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

# [11.0.0](https://github.com/homer0/prettier-plugin-jsdoc/compare/10.0.1...11.0.0) (2025-12-05)
### Bug Fixes
* add export for src ([13bb020](https://github.com/homer0/prettier-plugin-jsdoc/commit/13bb0203f7bc3c7dc718b73fb2cae1a9871bb863))
* add exports to the package.json ([ed40962](https://github.com/homer0/prettier-plugin-jsdoc/commit/ed40962159603ccccc4bbc95c48bcf239af4310b))
* add missing extensions ([e9b5e62](https://github.com/homer0/prettier-plugin-jsdoc/commit/e9b5e62ccf5f49503988386055f56c0050d6921d))
* add module export ([64da4e9](https://github.com/homer0/prettier-plugin-jsdoc/commit/64da4e96d9cfea36144f39eebf9f726a30f35422))
* avoid destructuring parsers imports ([791b868](https://github.com/homer0/prettier-plugin-jsdoc/commit/791b868ba30a9568c2900d00d32e75d2a9d58a7f))
* drop Node v18 ([206743f](https://github.com/homer0/prettier-plugin-jsdoc/commit/206743f871ca56dc15859e49530ae9d41d335925))
* migrate package to ESM ([c4d8b1e](https://github.com/homer0/prettier-plugin-jsdoc/commit/c4d8b1eb01e9bc09283bcb314b70262c607e1649))
* update all dependencies ([d80ccce](https://github.com/homer0/prettier-plugin-jsdoc/commit/d80ccce86514110ad9a19e71fbf9aa5014bff06b))
* update to eslint v9 and solve all reported issues ([b22a929](https://github.com/homer0/prettier-plugin-jsdoc/commit/b22a9297ab9c9922f494add4e919a701e2c85ba0))
* use fileURLToPath instead of __dirname ([cccf688](https://github.com/homer0/prettier-plugin-jsdoc/commit/cccf688e92d19a88031664bda6da30ada76214b1))
### BREAKING CHANGES
* This package is now ESM only.
* Node v18 is not longer supported. Node v20.19 is the minimum
required version now.
## [10.0.1](https://github.com/homer0/prettier-plugin-jsdoc/compare/10.0.0...10.0.1) (2025-12-03)

@@ -2,0 +25,0 @@

+21
-14
{
"name": "@homer0/prettier-plugin-jsdoc",
"description": "A Prettier plugin to format JSDoc blocks",
"version": "10.0.1",
"version": "11.0.0",
"repository": "homer0/prettier-plugin-jsdoc",
"author": "Leonardo Apiwan (@homer0) <me@homer0.com>",
"license": "MIT",
"packageManager": "pnpm@10.11.0",
"keywords": [

@@ -18,3 +19,10 @@ "jsdoc",

},
"type": "commonjs",
"type": "module",
"main": "./src/index.js",
"module": "./src/index.js",
"exports": {
".": "./src/index.js",
"./src/*.js": "./src/*.js",
"./package.json": "./package.json"
},
"dependencies": {

@@ -25,17 +33,17 @@ "comment-parser": "^1.4.1",

"devDependencies": {
"@commitlint/cli": "^19.8.0",
"@commitlint/config-conventional": "^19.8.0",
"@homer0/eslint-plugin": "^12.0.8",
"@homer0/prettier-config": "^1.1.3",
"@commitlint/cli": "^20.1.0",
"@commitlint/config-conventional": "^20.0.0",
"@homer0/eslint-plugin": "^14.2.2",
"@homer0/prettier-config": "^2.0.0",
"@semantic-release/changelog": "^6.0.3",
"@semantic-release/git": "^10.0.1",
"eslint": "^8.57.1",
"@vitest/coverage-istanbul": "^4.0.15",
"eslint": "^9.39.1",
"husky": "^9.1.7",
"is-ci": "^4.1.0",
"jest": "^29.7.0",
"jest-environment-node": "^29.7.0",
"leasot": "^14.4.0",
"lint-staged": "^15.5.0",
"prettier": "^3.7.3",
"semantic-release": "^24.2.3"
"lint-staged": "^16.2.7",
"prettier": "^3.7.4",
"semantic-release": "^25.0.2",
"vitest": "^4.0.15"
},

@@ -47,5 +55,4 @@ "peerDependencies": {

"engines": {
"node": ">=18.17"
"node": ">=20"
},
"main": "src/index.js",
"scripts": {

@@ -52,0 +59,0 @@ "prepare": "./utils/scripts/prepare",

+33
-23

@@ -45,5 +45,9 @@ # 𝍌 JSDoc plugin for Prettier

```js
const config = require('@homer0/prettier-config');
import config from '@homer0/prettier-config';
// You may need to add the type attribute, depending on your env and the config being imported:
//
// import config from '@homer0/prettier-config' with { type: 'json' };
//
module.exports = {
export default {
...config,

@@ -54,3 +58,3 @@ plugins: [

],
};
}
```

@@ -954,9 +958,9 @@

```js
const { get, override } = require('@homer0/prettier-plugin-jsdoc/src/fns/app');
const { loadFns } = require('@homer0/prettier-plugin-jsdoc/src/loader');
const { getPlugin } = require('@homer0/prettier-plugin-jsdoc/src/fns/getPlugin');
import { get, override } from '@homer0/prettier-plugin-jsdoc/src/fns/app.js';
import { loadFns } from '@homer0/prettier-plugin-jsdoc/src/loader.js';
import { getPlugin } from '@homer0/prettier-plugin-jsdoc/src/fns/getPlugin.js';
loadFns();
module.exports = get(getPlugin)();
export default get(getPlugin)();
```

@@ -967,6 +971,6 @@

1. `get` is the access to the dependency injection container, you pass the reference of an original function and it will return either the function or an override.
2. `loadFns` is a utility function that `require`s all the functions of the plugin and loads them on the dependency injection container.
2. `loadFns` is a utility function that `import`s all the functions of the plugin and loads them on the dependency injection container.
3. `getPlugin` basically connects all the functions and returns the plugin definition.
Now, in order to modify a function we need to import the original and use `override` before the call to `getPlugin`.
After that, to modify a function, we need to import the original and use `override` before the call to `getPlugin`.

@@ -976,7 +980,7 @@ Let's say you want to add the synonym `params` to `param` (if the plugin finds `@params` it will be converted to `@param`):

```js
const { get, override } = require('@homer0/prettier-plugin-jsdoc/src/fns/app');
const { loadFns } = require('@homer0/prettier-plugin-jsdoc/src/loader');
const { getPlugin } = require('@homer0/prettier-plugin-jsdoc/src/fns/getPlugin');
import { get, override } from '@homer0/prettier-plugin-jsdoc/src/fns/app.js';
import { loadFns } from '@homer0/prettier-plugin-jsdoc/src/loader.js';
import { getPlugin } from '@homer0/prettier-plugin-jsdoc/src/fns/getPlugin.js';
// + We add the `require` for the original function.
const { getTagsSynonyms } = require('@homer0/prettier-plugin-jsdoc/src/fns/constants');
import { getTagsSynonyms } from '@homer0/prettier-plugin-jsdoc/src/fns/constants.js';

@@ -994,3 +998,3 @@ loadFns();

module.exports = get(getPlugin)();
export default get(getPlugin)();
```

@@ -1103,5 +1107,5 @@

I use [Jest](https://jestjs.io) to test the project, both with unit tests and functional tests.
I use [Vitest](https://vitest.dev/) to test the project, both with unit tests and functional tests.
The configurations files are `.jestrc-e2e` and `.jestrc-unit`, and the test files are located on `/tests`.
The configurations files are `vitest.e2e.config` and `vitest.unit.config`, and the test files are located on `/tests`.

@@ -1113,5 +1117,5 @@ In the case of the functional tests, there's a special environment on `./tests/utils` that loads and parses a list of fixture files in order to save them on the global object. In reality, there's only one test file for the functional tests, the one that reads the global object and dynamically generates the `it(...)`: `index.e2e.js`.

I use [ESlint](https://eslint.org) with [my own custom configuration](https://www.npmjs.com/package/@homer0/eslint-plugin) to validate all the JS code. The configuration file for the project code is on `./.eslintrc` and the one for the tests is on `./tests/.eslintrc`. There's also an `./.eslintignore` to exclude some files on the process. The script that runs it is on `./utils/scripts/lint-all`.
I use [ESlint](https://eslint.org) with [my own custom configuration](https://www.npmjs.com/package/@homer0/eslint-plugin) to validate all the JS code. The configuration file for the project code is on `./eslint.config.js`. The script that runs it is on `./utils/scripts/lint-all`.
For formatting I use [Prettier](https://prettier.io) with [my custom configuration](https://www.npmjs.com/package/@homer0/prettier-config) and this same plugin. The configuration file for the project code is on `./.prettierrc`.
For formatting I use [Prettier](https://prettier.io) with [my custom configuration](https://www.npmjs.com/package/@homer0/prettier-config), and this plugin. The configuration file for the project code is on `./.prettierrc.js`.

@@ -1144,3 +1148,3 @@ ### To-Dos

- The `module.exports` defines the plugin options for that specific case.
- The `module.exports` defines the plugin options for that specific case. And yes, even though this is now an ESM only project, the fixtures still use `module.exports` for the options, and that's fine, because they are not modules.
- `only: true` is not a plugin option, but will make the test runner ignore all the other tests, and only run the one you specify.

@@ -1155,8 +1159,14 @@ - Below `//# input` you can put any number of comment blocks, in the state you would expect the plugin to pick them.

Let's start with the fact that I really like the functionality of Prettier, but I really dislike their philosophy. I understand what they are trying to achieve and it makes sense, but "just use it the way I tell you" doesn't seem like a valid solution to me.
Let's start with the fact that I really like the functionality of Prettier, but I really dislike their philosophy. I understand what they are trying to achieve, and it makes sense, but "just use it the way I tell you to" doesn't seem like a valid solution to me.
Ok, there won't accept options requests? that's perfect, it doesn't make sense to just add _"one more"_... but it would be great if it could be open to be extended. The only way to do it is with a plugin, which means an extra parsing.
Ok, they won't accept options requests? that's perfect, it doesn't make sense to just add _"one more"_... but it would be great if it could be open to be extended, but the only way to do that is with a plugin, which means an extra parsing.
Enough rant; I started using Prettier a couple of weeks ago and being a huge fan of JSDoc, I wanted to use it to format JSDoc blocks too, something I've doing, for sometime now, using a Node script that I was trying to make into a VSCode plugin :P.
Enough rant; I started using Prettier a couple of weeks ago and being a huge fan of JSDoc, I wanted to use it to format JSDoc blocks too, something I've doing using a Node script that I was trying to make into a VSCode plugin :P.
I found [prettier-plugin-jsdoc](https://github.com/hosseinmd/prettier-plugin-jsdoc/) by [@hosseinmd](https://github.com/hosseinmd), but it (currently) doesn't cover most of the cases I wanted (like columns creations), it's written in TypeScript (which I don't like very much) and if I were to fork and send PRs, it could've taken forever (you can see the commits for this package), and it seemed like the perfect opportunity to try [Ramda](https://ramdajs.com) and functional programming... so I started a new one.
I found [prettier-plugin-jsdoc](https://github.com/hosseinmd/prettier-plugin-jsdoc/) by [@hosseinmd](https://github.com/hosseinmd), but it (currently) doesn't cover most of the cases I wanted (like columns creations), it's written in TypeScript (which I don't like very much) and if I were to fork and send PRs, it could've taken forever (you can see the commits for this package), also, it seemed like the perfect opportunity to try [Ramda](https://ramdajs.com) and functional programming... so I started a new one.
> 5 years later...
>
> - HUGE fan of TypeScript, for a couple of years now.
> - I hate reading the Ramda code in here.
> - Still hate Prettier philosophy.

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

const path = require('path');
import path from 'node:path';
import { createRequire } from 'node:module';
/**

@@ -8,7 +10,7 @@ * The actual dependency injection container. The keys will be the original functions, and

*/
const container = new Map();
export const container = new Map();
/**
* This secret exists so when {@link registerModule} gets called with a raw
* `module.exports`, it can safely skip a provider, as providers created with
* {@link provider} have this secret as a property.
* {@link createProvider} have this secret as a property.
*

@@ -23,3 +25,3 @@ * @type {symbol}

*/
const register = (originalFn) => {
export const register = (originalFn) => {
container.set(originalFn, originalFn);

@@ -34,3 +36,3 @@ };

*/
const override = (originalFn, fn) => {
export const override = (originalFn, fn) => {
container.set(originalFn, fn);

@@ -45,3 +47,3 @@ };

*/
const get = (originalFn) => container.get(originalFn) || originalFn;
export const get = (originalFn) => container.get(originalFn) || originalFn;
/**

@@ -62,3 +64,3 @@ * Registers a list or a dictionary of functions for a module. The idea of this function

*/
const registerModule = (id, fns) => {
export const registerModule = (id, fns) => {
const useFns = Array.isArray(fns) ? fns : Object.values(fns);

@@ -85,3 +87,3 @@ useFns

*/
const provider = (id, fns) => {
export const createProvider = (id, fns) => {
/**

@@ -96,3 +98,19 @@ * The function that when executed will take care of registering the module.

};
/**
* Creates a "module provider": a function that when called, it will execute
* {@link registerModule}.
* The idea of the providers is that they can be executed on runtime, or on a
* "registration step".
*
* @param {string} id
* The ID of the module.
* @param {Function[] | Object.<string, Function>} fns
* The list or dictionary of functions.
* @returns {Function}
* @deprecated
* Use `createProvider` instead.
*/
export const provider = createProvider;
/**
* Loads a list of files, takes their `provider` export (if present) and executes it.

@@ -104,9 +122,11 @@ *

*/
const loadProviders = (directoryPath, list) => {
export const loadProviders = (directoryPath, list) => {
const require = createRequire(import.meta.url);
list
.map((modName) => {
// eslint-disable-next-line global-require, import/no-dynamic-require
// eslint-disable-next-line import-x/no-dynamic-require
const { provider: modProvider } = require(
path.join(directoryPath, `${modName}.js`),
);
return modProvider;

@@ -119,9 +139,1 @@ })

};
module.exports.register = register;
module.exports.override = override;
module.exports.get = get;
module.exports.container = container;
module.exports.registerModule = registerModule;
module.exports.provider = provider;
module.exports.loadProviders = loadProviders;

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

const { provider } = require('./app');
import { createProvider } from './app.js';

@@ -15,3 +15,3 @@ /**

*/
const getTagsSynonyms = () => ({
export const getTagsSynonyms = () => ({
virtual: 'abstract',

@@ -47,3 +47,3 @@ extends: 'augments',

*/
const getTagsWithDescriptionAsName = () => [
export const getTagsWithDescriptionAsName = () => [
'author',

@@ -74,3 +74,3 @@ 'classdesc',

*/
const getTagsThatRequireColumns = () => ['template'];
export const getTagsThatRequireColumns = () => ['template'];
/**

@@ -84,3 +84,9 @@ * This is almost the same as {@link getTagsWithDescriptionAsName}; the difference here is

*/
const getTagsWithNameAsDescription = () => ['see', 'borrows', 'yields', 'todo', 'since'];
export const getTagsWithNameAsDescription = () => [
'see',
'borrows',
'yields',
'todo',
'since',
];
/**

@@ -92,3 +98,3 @@ * There are certain tags which description cannot be converted into sentences (upper case

*/
const getTagsWithDescriptionThatCannotBeSentences = () => ['since'];
export const getTagsWithDescriptionThatCannotBeSentences = () => ['since'];
/**

@@ -99,3 +105,3 @@ * Gets the list of languages the plugin supports.

*/
const getSupportedLanguages = () => [
export const getSupportedLanguages = () => [
{

@@ -247,9 +253,9 @@ linguistLanguageId: 183,

module.exports.getTagsSynonyms = getTagsSynonyms;
module.exports.getTagsWithDescriptionAsName = getTagsWithDescriptionAsName;
module.exports.getTagsThatRequireColumns = getTagsThatRequireColumns;
module.exports.getTagsWithDescriptionThatCannotBeSentences =
getTagsWithDescriptionThatCannotBeSentences;
module.exports.getTagsWithNameAsDescription = getTagsWithNameAsDescription;
module.exports.getSupportedLanguages = getSupportedLanguages;
module.exports.provider = provider('constants', module.exports);
export const provider = createProvider('constants', {
getTagsSynonyms,
getTagsWithDescriptionAsName,
getTagsThatRequireColumns,
getTagsWithDescriptionThatCannotBeSentences,
getTagsWithNameAsDescription,
getSupportedLanguages,
});

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

const R = require('ramda');
const { findTagIndex } = require('./utils');
const { get, provider } = require('./app');
import * as R from 'ramda';
import { findTagIndex } from './utils.js';
import { get, createProvider } from './app.js';

@@ -23,3 +23,3 @@ /**

*/
const formatAccessTag = R.curry((tags, options) => {
export const formatAccessTag = R.curry((tags, options) => {
const useFindTagIndex = get(findTagIndex);

@@ -98,3 +98,4 @@ const indexes = tags.reduce(

module.exports.formatAccessTag = formatAccessTag;
module.exports.provider = provider('formatAccessTag', module.exports);
export const provider = createProvider('formatAccessTag', {
formatAccessTag,
});

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

const R = require('ramda');
const { isMatch, replaceDotOnTypeGeneric } = require('./utils');
const { get, provider } = require('./app');
import * as R from 'ramda';
import { isMatch, replaceDotOnTypeGeneric } from './utils.js';
import { get, createProvider } from './app.js';
/**

@@ -23,3 +23,3 @@ * @typedef {import('../types').PJPTypesOptions} PJPTypesOptions

*/
const processType = R.curry((options, type) =>
export const processType = R.curry((options, type) =>
R.compose(

@@ -50,8 +50,9 @@ R.when(

*/
const formatArrays = R.curry((type, options) =>
export const formatArrays = R.curry((type, options) =>
R.when(get(isMatch)(/Array\s*\.?\s*</), get(processType)(options))(type),
);
module.exports.formatArrays = formatArrays;
module.exports.processType = processType;
module.exports.provider = provider('formatArrays', module.exports);
export const provider = createProvider('formatArrays', {
formatArrays,
processType,
});

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

const R = require('ramda');
const { ensureArray, joinIfNotEmpty, appendIfNotPresent } = require('./utils');
const { get, provider } = require('./app');
import * as R from 'ramda';
import { ensureArray, joinIfNotEmpty, appendIfNotPresent } from './utils.js';
import { get, createProvider } from './app.js';

@@ -41,3 +41,3 @@ /**

*/
const findTag = R.curry((targetTag, matchHandlerFn, unmatchHandlerFn, step) => {
export const findTag = R.curry((targetTag, matchHandlerFn, unmatchHandlerFn, step) => {
const targetTags = get(ensureArray)(targetTag);

@@ -72,3 +72,3 @@ return (acc, tag, index) => {

*/
const processTag = (descriptionProperty, saveIndex = false) => {
export const processTag = (descriptionProperty, saveIndex = false) => {
const descriptionProperties = get(ensureArray)(descriptionProperty);

@@ -112,3 +112,3 @@ const generateDescription = R.compose(

*/
const formatDescription = R.curry((block, options) => {
export const formatDescription = R.curry((block, options) => {
/**

@@ -181,5 +181,6 @@ * A handler for when a tag wasn't match; it just pushes it to the accumulator.

module.exports.formatDescription = formatDescription;
module.exports.findTag = findTag;
module.exports.processTag = processTag;
module.exports.provider = provider('formatDescription', module.exports);
export const provider = createProvider('formatDescription', {
formatDescription,
findTag,
processTag,
});

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

const R = require('ramda');
const { isMatch, replaceDotOnTypeGeneric } = require('./utils');
const { get, provider } = require('./app');
import * as R from 'ramda';
import { isMatch, replaceDotOnTypeGeneric } from './utils.js';
import { get, createProvider } from './app.js';

@@ -24,3 +24,3 @@ /**

*/
const processType = R.curry((options, type) =>
export const processType = R.curry((options, type) =>
R.when(

@@ -45,8 +45,9 @@ R.always(options.jsdocFormatDotForArraysAndObjects),

*/
const formatObjects = R.curry((type, options) =>
export const formatObjects = R.curry((type, options) =>
R.when(get(isMatch)(/Object\s*\.?\s*</i), get(processType)(options))(type),
);
module.exports.formatObjects = formatObjects;
module.exports.processType = processType;
module.exports.provider = provider('formatObjects', module.exports);
export const provider = createProvider('formatObjects', {
formatObjects,
processType,
});

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

const R = require('ramda');
const { get, provider } = require('./app');
import * as R from 'ramda';
import { get, createProvider } from './app.js';

@@ -34,3 +34,3 @@ /**

*/
const getFormatter = (padding, quote) =>
export const getFormatter = (padding, quote) =>
R.compose(

@@ -53,3 +53,3 @@ R.trim,

*/
const getReducer = (options) => {
export const getReducer = (options) => {
const quote = options.jsdocUseSingleQuotesForStringLiterals ? "'" : '"';

@@ -67,3 +67,4 @@ const padding = ' '.repeat(options.jsdocSpacesBetweenStringLiterals);

*/
const extractLiterals = (type) => R.match(/['"][\w\|\-\s'"]+['"](?: +)?(?:$|\|)/g, type);
export const extractLiterals = (type) =>
R.match(/['"][\w\|\-\s'"]+['"](?: +)?(?:$|\|)/g, type);
/**

@@ -83,3 +84,3 @@ * Formats the styling of string literals inside a type. If the type doesn't use string

*/
const formatStringLiterals = R.curry((type, options) =>
export const formatStringLiterals = R.curry((type, options) =>
R.compose(

@@ -92,6 +93,7 @@ (literals) =>

module.exports.formatStringLiterals = formatStringLiterals;
module.exports.getFormatter = getFormatter;
module.exports.getReducer = getReducer;
module.exports.extractLiterals = extractLiterals;
module.exports.provider = provider('formatStringLiterals', module.exports);
export const provider = createProvider('formatStringLiterals', {
formatStringLiterals,
getFormatter,
getReducer,
extractLiterals,
});

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

const R = require('ramda');
const { formatAccessTag } = require('./formatAccessTag');
const { replaceTagsSynonyms } = require('./replaceTagsSynonyms');
const { sortTags } = require('./sortTags');
const { trimTagsProperties } = require('./trimTagsProperties');
const { formatTagsDescription } = require('./formatTagsDescription');
const { get, provider } = require('./app');
import * as R from 'ramda';
import { formatAccessTag } from './formatAccessTag.js';
import { replaceTagsSynonyms } from './replaceTagsSynonyms.js';
import { sortTags } from './sortTags.js';
import { trimTagsProperties } from './trimTagsProperties.js';
import { formatTagsDescription } from './formatTagsDescription.js';
import { get, createProvider } from './app.js';

@@ -27,3 +27,3 @@ /**

*/
const formatTags = R.curry((tags, options) => {
export const formatTags = R.curry((tags, options) => {
const fns = [

@@ -46,3 +46,4 @@ get(formatTagsDescription),

module.exports.formatTags = formatTags;
module.exports.provider = provider('formatTags', module.exports);
export const provider = createProvider('formatTags', {
formatTags,
});

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

const R = require('ramda');
const {
import * as R from 'ramda';
import {
getTagsWithDescriptionAsName,
getTagsWithNameAsDescription,
} = require('./constants');
const { isTag, hasValidProperty } = require('./utils');
const { get, provider } = require('./app');
} from './constants.js';
import { isTag, hasValidProperty } from './utils.js';
import { get, createProvider } from './app.js';

@@ -45,3 +45,3 @@ /**

*/
const joinProperties = R.curry((propA, propB, prop, tag) => {
export const joinProperties = R.curry((propA, propB, prop, tag) => {
const cleanProp = prop === propA ? propB : propA;

@@ -72,3 +72,3 @@ const valA = tag[propA];

*/
const addLinkToDescription = (tag) => ({
export const addLinkToDescription = (tag) => ({
...tag,

@@ -88,3 +88,3 @@ type: '',

*/
const formatTagsDescription = (tags) => {
export const formatTagsDescription = (tags) => {
const useIsTag = get(isTag);

@@ -115,5 +115,6 @@ const useJoinProperties = get(joinProperties);

module.exports.formatTagsDescription = formatTagsDescription;
module.exports.joinProperties = joinProperties;
module.exports.addLinkToDescription = addLinkToDescription;
module.exports.provider = provider('formatTagsDescription', module.exports);
export const provider = createProvider('formatTagsDescription', {
formatTagsDescription,
joinProperties,
addLinkToDescription,
});

@@ -1,10 +0,9 @@

const R = require('ramda');
const { hasValidProperty, composeWithPromise } = require('./utils');
const { formatTSTypes } = require('./formatTSTypes');
const { formatStringLiterals } = require('./formatStringLiterals');
const { formatArrays } = require('./formatArrays');
const { formatObjects } = require('./formatObjects');
const { formatTypeAsCode } = require('./formatTypeAsCode');
const { get, provider } = require('./app');
const { reduceWithPromise } = require('./utils');
import * as R from 'ramda';
import { hasValidProperty, composeWithPromise, reduceWithPromise } from './utils.js';
import { formatTSTypes } from './formatTSTypes.js';
import { formatStringLiterals } from './formatStringLiterals.js';
import { formatArrays } from './formatArrays.js';
import { formatObjects } from './formatObjects.js';
import { formatTypeAsCode } from './formatTypeAsCode.js';
import { get, createProvider } from './app.js';

@@ -34,3 +33,3 @@ /**

*/
const getTypeFormatter = (options, column) => {
export const getTypeFormatter = (options, column) => {
const fns = [];

@@ -72,3 +71,3 @@ if (options.jsdocUseTypeScriptTypesCasing) {

*/
const formatTagType = R.curry((formatter, tag) =>
export const formatTagType = R.curry((formatter, tag) =>
get(composeWithPromise)((type) => ({ ...tag, type }), formatter, R.prop('type'))(tag),

@@ -92,3 +91,3 @@ );

*/
const formatTagsTypes = R.curry(async (tags, options, column) => {
export const formatTagsTypes = R.curry(async (tags, options, column) => {
const hasValidPropertyFn = get(hasValidProperty)('type');

@@ -106,5 +105,6 @@ const getTypeFormatterFn = get(getTypeFormatter)(options, column);

module.exports.formatTagsTypes = formatTagsTypes;
module.exports.getTypeFormatter = getTypeFormatter;
module.exports.formatTagType = formatTagType;
module.exports.provider = provider('formatTagsTypes', module.exports);
export const provider = createProvider('formatTagsTypes', {
formatTagsTypes,
getTypeFormatter,
formatTagType,
});

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

const R = require('ramda');
const { capitalize, ensureArray } = require('./utils');
const { get, provider } = require('./app');
import * as R from 'ramda';
import { capitalize, ensureArray } from './utils.js';
import { get, createProvider } from './app.js';

@@ -33,3 +33,3 @@ /**

*/
const getFormatter = (type, modifier) =>
export const getFormatter = (type, modifier) =>
R.compose(

@@ -52,3 +52,3 @@ (types) =>

*/
const formatTSTypes = (type) => {
export const formatTSTypes = (type) => {
const useGetFormatter = get(getFormatter);

@@ -61,4 +61,5 @@ return R.compose(

module.exports.formatTSTypes = formatTSTypes;
module.exports.getFormatter = getFormatter;
module.exports.provider = provider('formatTSTypes', module.exports);
export const provider = createProvider('formatTSTypes', {
formatTSTypes,
getFormatter,
});

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

const { format } = require('prettier');
const R = require('ramda');
const { isMatch } = require('./utils');
const { get, provider } = require('./app');
import { format } from 'prettier';
import * as R from 'ramda';
import { isMatch } from './utils.js';
import { get, createProvider } from './app.js';

@@ -32,3 +32,3 @@ /**

*/
const formatPrettyType = R.curry(async (options, column, type) => {
export const formatPrettyType = R.curry(async (options, column, type) => {
let result;

@@ -45,3 +45,3 @@ try {

result = newType.substring(prefix.length).trim().replace(/;$/, '');
} catch (ignore) {
} catch {
result = type;

@@ -70,8 +70,9 @@ }

*/
const formatTypeAsCode = R.curry((type, options, column) =>
export const formatTypeAsCode = R.curry((type, options, column) =>
R.when(get(isMatch)(/[\{&<\.\|]/), get(formatPrettyType)(options, column), type),
);
module.exports.formatTypeAsCode = formatTypeAsCode;
module.exports.formatPrettyType = formatPrettyType;
module.exports.provider = provider('formatTypeAsCode', module.exports);
export const provider = createProvider('formatTypeAsCode', {
formatTypeAsCode,
formatPrettyType,
});

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

const { get, provider } = require('./app');
import { get, createProvider } from './app.js';

@@ -13,3 +13,3 @@ /**

*/
const getOptions = () => ({
export const getOptions = () => ({
jsdocPluginEnabled: {

@@ -357,3 +357,3 @@ type: 'boolean',

*/
const getDefaultOptions = () =>
export const getDefaultOptions = () =>
Object.entries(get(getOptions)()).reduce(

@@ -367,4 +367,5 @@ (acc, [key, value]) => ({

module.exports.getOptions = getOptions;
module.exports.getDefaultOptions = getDefaultOptions;
module.exports.provider = provider('getOptions', module.exports);
export const provider = createProvider('getOptions', {
getOptions,
getDefaultOptions,
});

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

const babelParser = require('prettier/plugins/babel');
const flowParser = require('prettier/plugins/flow');
const tsParser = require('prettier/plugins/typescript');
const R = require('ramda');
const { parse: commentParser } = require('comment-parser');
const { isMatch, composeWithPromise, reduceWithPromise } = require('./utils');
const { formatDescription } = require('./formatDescription');
const { formatTags } = require('./formatTags');
const { formatTagsTypes } = require('./formatTagsTypes');
const { prepareTags } = require('./prepareTags');
const { render } = require('./render');
const { get, provider } = require('./app');
import babelParsers from 'prettier/parser-babel';
import flowParsers from 'prettier/parser-flow';
import tsParsers from 'prettier/parser-typescript';
import * as R from 'ramda';
import { parse as commentParser } from 'comment-parser';
import { isMatch, composeWithPromise, reduceWithPromise } from './utils.js';
import { formatDescription } from './formatDescription.js';
import { formatTags } from './formatTags.js';
import { formatTagsTypes } from './formatTagsTypes.js';
import { prepareTags } from './prepareTags.js';
import { render } from './render.js';
import { get, createProvider } from './app.js';
/**

@@ -26,3 +26,3 @@ * @typedef {import('../types').PrettierParser} PrettierParser

*/
const isComment = (node) =>
export const isComment = (node) =>
R.compose(R.includes(R.__, ['CommentBlock', 'Block']), R.prop('type'))(node);

@@ -53,3 +53,3 @@

*/
const matchesBlock = (node) =>
export const matchesBlock = (node) =>
R.compose(

@@ -75,3 +75,3 @@ get(isMatch)(/\/\*\*[\s\S]+?\*\//),

*/
const generateCommentData = (comment) => {
export const generateCommentData = (comment) => {
const {

@@ -109,3 +109,3 @@ loc: {

*/
const hasIgnoreTag = (info) =>
export const hasIgnoreTag = (info) =>
R.compose(

@@ -122,3 +122,3 @@ R.any(R.propSatisfies(R.equals('prettierignore'), 'tag')),

*/
const hasNoTags = (info) =>
export const hasNoTags = (info) =>
R.compose(R.equals(0), R.path(['block', 'tags', 'length']))(info);

@@ -137,3 +137,3 @@

*/
const shouldIgnoreComment = R.curry((options, info) =>
export const shouldIgnoreComment = R.curry((options, info) =>
R.allPass([

@@ -175,17 +175,19 @@ R.anyPass([get(hasNoTags), get(hasIgnoreTag)]),

*/
const processComments = R.curry(async (options, nodes, formatterFn, processorFn) => {
const useNodes = nodes.filter(R.allPass([get(isComment), get(matchesBlock)]));
const shouldIgnoreFn = shouldIgnoreComment(options);
const generateCommentDataFn = get(generateCommentData);
return get(reduceWithPromise)(useNodes, async (node) => {
const info = generateCommentDataFn(node);
const formatted = await formatterFn(info);
const shouldIgnore = await shouldIgnoreFn(formatted);
if (shouldIgnore) {
return formatted;
}
export const processComments = R.curry(
async (options, nodes, formatterFn, processorFn) => {
const useNodes = nodes.filter(R.allPass([get(isComment), get(matchesBlock)]));
const shouldIgnoreFn = shouldIgnoreComment(options);
const generateCommentDataFn = get(generateCommentData);
return get(reduceWithPromise)(useNodes, async (node) => {
const info = generateCommentDataFn(node);
const formatted = await formatterFn(info);
const shouldIgnore = await shouldIgnoreFn(formatted);
if (shouldIgnore) {
return formatted;
}
return processorFn(formatted);
});
});
return processorFn(formatted);
});
},
);

@@ -205,3 +207,3 @@ /**

*/
const formatCommentBlock = R.curry((options, info) =>
export const formatCommentBlock = R.curry((options, info) =>
R.compose(

@@ -227,3 +229,3 @@ R.mergeRight(info),

*/
const formatCommentTags = R.curry((options, info) =>
export const formatCommentTags = R.curry((options, info) =>
get(composeWithPromise)(

@@ -252,3 +254,3 @@ R.assocPath(['block', 'tags'], R.__, info),

*/
const prepareCommentTags = R.curry((options, info) =>
export const prepareCommentTags = R.curry((options, info) =>
get(composeWithPromise)(

@@ -275,3 +277,3 @@ R.assocPath(['block', 'tags'], R.__, info),

*/
const getRenderer = (options) => {
export const getRenderer = (options) => {
const renderer = get(render)(options);

@@ -307,3 +309,3 @@ return (column, block) => {

*/
const createParser =
export const createParser =
(originalParser, checkExtendOption) => async (text, parsers, options) => {

@@ -349,3 +351,3 @@ const ast = originalParser(text, parsers, options);

*/
const extendParser = R.curry((parser, checkExtendOption) => ({
export const extendParser = R.curry((parser, checkExtendOption) => ({
...parser,

@@ -363,22 +365,22 @@ parse: get(createParser)(parser.parse, checkExtendOption),

*/
const getParsers = (checkExtendOption) => {
export const getParsers = (checkExtendOption) => {
const useExtendParser = get(extendParser)(R.__, checkExtendOption);
return {
get babel() {
return useExtendParser(babelParser.parsers.babel);
return useExtendParser(babelParsers.parsers.babel);
},
get typescript() {
return useExtendParser(tsParser.parsers.typescript);
return useExtendParser(tsParsers.parsers.typescript);
},
/* istanbul ignore next */
get 'babel-flow'() {
return useExtendParser(babelParser.parsers['babel-flow']);
return useExtendParser(babelParsers.parsers['babel-flow']);
},
/* istanbul ignore next */
get 'babel-ts'() {
return useExtendParser(babelParser.parsers['babel-ts']);
return useExtendParser(babelParsers.parsers['babel-ts']);
},
/* istanbul ignore next */
get flow() {
return useExtendParser(flowParser.parsers.flow);
return useExtendParser(flowParsers.parsers.flow);
},

@@ -388,16 +390,17 @@ };

module.exports.getParsers = getParsers;
module.exports.createParser = createParser;
module.exports.isComment = isComment;
module.exports.matchesBlock = matchesBlock;
module.exports.generateCommentData = generateCommentData;
module.exports.hasIgnoreTag = hasIgnoreTag;
module.exports.hasNoTags = hasNoTags;
module.exports.shouldIgnoreComment = shouldIgnoreComment;
module.exports.processComments = processComments;
module.exports.formatCommentBlock = formatCommentBlock;
module.exports.formatCommentTags = formatCommentTags;
module.exports.prepareCommentTags = prepareCommentTags;
module.exports.getRenderer = getRenderer;
module.exports.extendParser = extendParser;
module.exports.provider = provider('getParsers', module.exports);
export const provider = createProvider('getParsers', {
isComment,
matchesBlock,
generateCommentData,
hasIgnoreTag,
hasNoTags,
shouldIgnoreComment,
processComments,
formatCommentBlock,
formatCommentTags,
prepareCommentTags,
getRenderer,
createParser,
extendParser,
getParsers,
});

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

const { getSupportedLanguages } = require('./constants');
const { getParsers } = require('./getParsers');
const { getOptions, getDefaultOptions } = require('./getOptions');
const { get, provider } = require('./app');
import { getSupportedLanguages } from './constants.js';
import { getParsers } from './getParsers.js';
import { getOptions, getDefaultOptions } from './getOptions.js';
import { get, createProvider } from './app.js';

@@ -34,3 +34,3 @@ /**

*/
const getPlugin = (checkExtendOption) => ({
export const getPlugin = (checkExtendOption) => ({
languages: get(getSupportedLanguages)(),

@@ -42,3 +42,4 @@ options: get(getOptions)(),

module.exports.getPlugin = getPlugin;
module.exports.provider = provider('getPlugin', module.exports);
export const provider = createProvider('getPlugin', {
getPlugin,
});

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

const { format } = require('prettier');
const R = require('ramda');
const { isTag, prefixLines, splitLinesAndClean, reduceWithPromise } = require('./utils');
const { get, provider } = require('./app');
import { format } from 'prettier';
import * as R from 'ramda';
import { isTag, prefixLines, splitLinesAndClean, reduceWithPromise } from './utils.js';
import { get, createProvider } from './app.js';

@@ -29,3 +29,3 @@ /**

*/
const formatExample = async (options, column, example) => {
export const formatExample = async (options, column, example) => {
let code;

@@ -44,3 +44,3 @@ let indent;

});
} catch (ignore) {
} catch {
code = example;

@@ -67,3 +67,3 @@ indent = options.jsdocIndentUnformattedExamples;

*/
const splitExamples = async (options, column, example) => {
export const splitExamples = async (options, column, example) => {
const splitLinesAndCleanFn = get(splitLinesAndClean);

@@ -97,3 +97,3 @@ const splitEndFn = splitLinesAndCleanFn(/<\s*\/\s*caption\s*>/i);

*/
const formatExampleTag = R.curry(async (options, column, tag) => {
export const formatExampleTag = R.curry(async (options, column, tag) => {
let examples;

@@ -131,10 +131,11 @@ if (tag.description.match(/<\s*caption\s*>/i)) {

*/
const prepareExampleTag = R.curry((tag, options, column) =>
export const prepareExampleTag = R.curry((tag, options, column) =>
R.when(get(isTag)('example'), get(formatExampleTag)(options, column), tag),
);
module.exports.prepareExampleTag = prepareExampleTag;
module.exports.formatExample = formatExample;
module.exports.splitExamples = splitExamples;
module.exports.formatExampleTag = formatExampleTag;
module.exports.provider = provider('prepareExampleTag', module.exports);
export const provider = createProvider('prepareExampleTag', {
prepareExampleTag,
formatExample,
splitExamples,
formatExampleTag,
});

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

const R = require('ramda');
const { ensureSentence, hasValidProperty, isTag } = require('./utils');
const {
import * as R from 'ramda';
import { ensureSentence, hasValidProperty, isTag } from './utils.js';
import {
getTagsWithNameAsDescription,
getTagsWithDescriptionThatCannotBeSentences,
} = require('./constants');
const { get, provider } = require('./app');
} from './constants.js';
import { get, createProvider } from './app.js';

@@ -25,3 +25,3 @@ /**

*/
const makePropertyIntoSentence = R.curry((property, tag) =>
export const makePropertyIntoSentence = R.curry((property, tag) =>
R.compose(R.assoc(property, R.__, tag), get(ensureSentence), R.prop(property))(tag),

@@ -36,3 +36,3 @@ );

*/
const prepareTagDescription = (tag) => {
export const prepareTagDescription = (tag) => {
const useHasValidProperty = get(hasValidProperty);

@@ -63,3 +63,5 @@ const useIsStag = get(isTag);

module.exports.prepareTagDescription = prepareTagDescription;
module.exports.provider = provider('prepareTagDescription', module.exports);
export const provider = createProvider('prepareTagDescription', {
prepareTagDescription,
makePropertyIntoSentence,
});

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

const R = require('ramda');
const { get, provider } = require('./app');
import * as R from 'ramda';
import { get, createProvider } from './app.js';

@@ -15,3 +15,3 @@ /**

*/
const formatNameForOptionalTag = (tag) => ({
export const formatNameForOptionalTag = (tag) => ({
...tag,

@@ -27,7 +27,8 @@ name: tag.default ? `[${tag.name}=${tag.default}]` : `[${tag.name}]`,

*/
const prepareTagName = (tag) =>
export const prepareTagName = (tag) =>
R.when(R.prop('optional'), get(formatNameForOptionalTag), tag);
module.exports.prepareTagName = prepareTagName;
module.exports.formatNameForOptionalTag = formatNameForOptionalTag;
module.exports.provider = provider('prepareTagName', module.exports);
export const provider = createProvider('prepareTagName', {
prepareTagName,
formatNameForOptionalTag,
});

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

const R = require('ramda');
const { prepareExampleTag } = require('./prepareExampleTag');
const { prepareTagDescription } = require('./prepareTagDescription');
const { prepareTagName } = require('./prepareTagName');
const { get, provider } = require('./app');
const { composeWithPromise, reduceWithPromise } = require('./utils');
import * as R from 'ramda';
import { prepareExampleTag } from './prepareExampleTag.js';
import { prepareTagDescription } from './prepareTagDescription.js';
import { prepareTagName } from './prepareTagName.js';
import { get, createProvider } from './app.js';
import { composeWithPromise, reduceWithPromise } from './utils.js';

@@ -31,3 +31,3 @@ /**

*/
const prepareTags = R.curry(async (tags, options, column) => {
export const prepareTags = R.curry(async (tags, options, column) => {
const fns = [get(prepareTagName)];

@@ -47,3 +47,4 @@

module.exports.prepareTags = prepareTags;
module.exports.provider = provider('prepareTags', module.exports);
export const provider = createProvider('prepareTags', {
prepareTags,
});

@@ -1,13 +0,10 @@

const R = require('ramda');
const { splitText } = require('./splitText');
const { isTag, ensureSentence } = require('./utils');
const { renderExampleTag } = require('./renderExampleTag');
const { renderTagInLine } = require('./renderTagInLine');
const { renderTagInColumns } = require('./renderTagInColumns');
const { renderTagOriginal } = require('./renderTagOriginal');
const {
getTagsWithNameAsDescription,
getTagsThatRequireColumns,
} = require('./constants');
const { get, provider } = require('./app');
import * as R from 'ramda';
import { splitText } from './splitText.js';
import { isTag, ensureSentence } from './utils.js';
import { renderExampleTag } from './renderExampleTag.js';
import { renderTagInLine } from './renderTagInLine.js';
import { renderTagInColumns } from './renderTagInColumns.js';
import { renderTagOriginal } from './renderTagOriginal.js';
import { getTagsWithNameAsDescription, getTagsThatRequireColumns } from './constants.js';
import { get, createProvider } from './app.js';

@@ -76,3 +73,3 @@ /**

*/
const renderTagsInLines = (width, options, tags) => {
export const renderTagsInLines = (width, options, tags) => {
const useIsTag = get(isTag);

@@ -109,3 +106,3 @@ return R.compose(

*/
const renderTagsInColumns = (columnsWidth, fullWidth, options, tags) => {
export const renderTagsInColumns = (columnsWidth, fullWidth, options, tags) => {
const useIsTag = get(isTag);

@@ -148,3 +145,3 @@ return R.compose(

*/
const tryToRenderTagsInColumns = (tagsData, width, options, tags) => {
export const tryToRenderTagsInColumns = (tagsData, width, options, tags) => {
const useIsTag = get(isTag);

@@ -191,3 +188,3 @@ return R.compose(

*/
const getLengthsData = (tags, options) =>
export const getLengthsData = (tags, options) =>
tags.reduce(

@@ -263,3 +260,3 @@ (acc, tag) => {

*/
const calculateColumnsWidth = (options, data, width) => {
export const calculateColumnsWidth = (options, data, width) => {
const {

@@ -300,3 +297,3 @@ jsdocMinSpacesBetweenTagAndType,

*/
const getTagsData = (lengthByTag, width, options) => {
export const getTagsData = (lengthByTag, width, options) => {
const tagsWithNameAsDesc = get(getTagsWithNameAsDescription)();

@@ -344,3 +341,3 @@ const tagsThatRequireColumns = get(getTagsThatRequireColumns)();

*/
const render = R.curry((options, column, block) => {
export const render = R.curry((options, column, block) => {
const prefix = `${' '.repeat(column)} * `;

@@ -400,9 +397,10 @@ const usePrintWidth = options.jsdocPrintWidth || options.printWidth;

module.exports.render = render;
module.exports.renderTagsInLines = renderTagsInLines;
module.exports.renderTagsInColumns = renderTagsInColumns;
module.exports.tryToRenderTagsInColumns = tryToRenderTagsInColumns;
module.exports.getLengthsData = getLengthsData;
module.exports.calculateColumnsWidth = calculateColumnsWidth;
module.exports.getTagsData = getTagsData;
module.exports.provider = provider('render', module.exports);
export const provider = createProvider('render', {
render,
renderTagsInLines,
renderTagsInColumns,
tryToRenderTagsInColumns,
getLengthsData,
calculateColumnsWidth,
getTagsData,
});

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

const R = require('ramda');
const { splitText } = require('./splitText');
const { get, provider } = require('./app');
import * as R from 'ramda';
import { splitText } from './splitText.js';
import { get, createProvider } from './app.js';

@@ -33,3 +33,3 @@ /**

*/
const renderExample = R.curry((width, options, example) => {
export const renderExample = R.curry((width, options, example) => {
const lines = [];

@@ -65,3 +65,3 @@ if (example.caption) {

*/
const renderExampleTag = R.curry((tag, width, options) => {
export const renderExampleTag = R.curry((tag, width, options) => {
const lines = [

@@ -84,4 +84,5 @@ `@${tag.tag}`,

module.exports.renderExampleTag = renderExampleTag;
module.exports.renderExample = renderExample;
module.exports.provider = provider('renderExampleTag', module.exports);
export const provider = createProvider('renderExampleTag', {
renderExampleTag,
renderExample,
});

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

const R = require('ramda');
const { splitText } = require('./splitText');
const { get, provider } = require('./app');
import * as R from 'ramda';
import { splitText } from './splitText.js';
import { get, createProvider } from './app.js';

@@ -24,3 +24,9 @@ /**

*/
const renderRest = (column, hasName, nameColumnWidth, nameLines, descriptionLines) => {
export const renderRest = (
column,
hasName,
nameColumnWidth,
nameLines,
descriptionLines,
) => {
const result = [];

@@ -64,3 +70,3 @@ const limit = Math.max(nameLines.length, descriptionLines.length);

*/
const renderTagInColumns = R.curry(
export const renderTagInColumns = R.curry(
(tagColumnWidth, typeColumnWidth, nameColumnWidth, descriptionColumnWidth, tag) => {

@@ -102,4 +108,5 @@ const useSplitText = get(splitText);

module.exports.renderTagInColumns = renderTagInColumns;
module.exports.renderRest = renderRest;
module.exports.provider = provider('renderTagInColumns', module.exports);
export const provider = createProvider('renderTagInColumns', {
renderTagInColumns,
renderRest,
});

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

const R = require('ramda');
const { splitText } = require('./splitText');
const { get, provider } = require('./app');
import * as R from 'ramda';
import { splitText } from './splitText.js';
import { get, createProvider } from './app.js';

@@ -27,3 +27,3 @@ /**

*/
const renderTagInLine = R.curry((width, typePadding, namePadding, tag) => {
export const renderTagInLine = R.curry((width, typePadding, namePadding, tag) => {
const tagHeader = `@${tag.tag}`;

@@ -78,3 +78,4 @@ const useNamePadding = ' '.repeat(namePadding);

module.exports.renderTagInLine = renderTagInLine;
module.exports.provider = provider('renderTagInLine', module.exports);
export const provider = createProvider('renderTagInLine', {
renderTagInLine,
});

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

const R = require('ramda');
const { provider } = require('./app');
import * as R from 'ramda';
import { createProvider } from './app.js';

@@ -20,3 +20,3 @@ /**

*/
const renderTagOriginal = R.curry((tag) => {
export const renderTagOriginal = R.curry((tag) => {
const lines = tag.source.reduce((acc, src) => {

@@ -32,3 +32,4 @@ const raw = src.source.trim();

module.exports.renderTagOriginal = renderTagOriginal;
module.exports.provider = provider('renderTagOriginal', module.exports);
export const provider = createProvider('renderTagOriginal', {
renderTagOriginal,
});

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

const R = require('ramda');
const { getTagsSynonyms } = require('./constants');
const { get, provider } = require('./app');
import * as R from 'ramda';
import { getTagsSynonyms } from './constants.js';
import { get, createProvider } from './app.js';

@@ -15,3 +15,3 @@ /**

*/
const replaceTagsSynonyms = (tags) => {
export const replaceTagsSynonyms = (tags) => {
const synonyms = get(getTagsSynonyms)();

@@ -27,3 +27,4 @@ return R.map(

module.exports.replaceTagsSynonyms = replaceTagsSynonyms;
module.exports.provider = provider('replaceTagsSynonyms', module.exports);
export const provider = createProvider('replaceTagsSynonyms', {
replaceTagsSynonyms,
});

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

const R = require('ramda');
const { getIndexOrFallback } = require('./utils');
const { get, provider } = require('./app');
import * as R from 'ramda';
import { getIndexOrFallback } from './utils.js';
import { get, createProvider } from './app.js';

@@ -17,3 +17,3 @@ /**

*/
const createSorter = (ref) => {
export const createSorter = (ref) => {
const useGetIndexOrFallback = get(getIndexOrFallback);

@@ -32,8 +32,9 @@ const fallback = useGetIndexOrFallback(ref, ref.length, 'other');

*/
const sortTags = R.curry((tags, options) =>
export const sortTags = R.curry((tags, options) =>
R.sort(get(createSorter)(options.jsdocTagsOrder))(tags),
);
module.exports.sortTags = sortTags;
module.exports.createSorter = createSorter;
module.exports.provider = provider('sortTags', module.exports);
export const provider = createProvider('sortTags', {
sortTags,
createSorter,
});

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

const R = require('ramda');
const {
import * as R from 'ramda';
import {
ensureArray,

@@ -7,4 +7,4 @@ replaceLastItem,

isTableRow,
} = require('./utils');
const { get, provider } = require('./app');
} from './utils.js';
import { get, createProvider } from './app.js';

@@ -36,3 +36,3 @@ /**

*/
const splitLineBreaks = (text) =>
export const splitLineBreaks = (text) =>
R.compose(

@@ -55,3 +55,3 @@ get(limitAdjacentRepetitions)(R.equals('\n'), ADJACENT_LINEBREAKS_LIMIT),

*/
const reduceWordsList = (list, word) =>
export const reduceWordsList = (list, word) =>
R.concat(

@@ -79,3 +79,3 @@ list,

*/
const reduceSentences = R.curry((length, list, word, index) => {
export const reduceSentences = R.curry((length, list, word, index) => {
let newList;

@@ -106,3 +106,3 @@ if (word === '\n') {

*/
const reduceText = (text, line) => {
export const reduceText = (text, line) => {
const useLine = line.trim();

@@ -128,3 +128,3 @@ let newText;

*/
const splitText = (text, length) => {
export const splitText = (text, length) => {
const useIsTableRow = get(isTableRow);

@@ -186,7 +186,8 @@ const linesList = text.split('\n');

module.exports.splitText = splitText;
module.exports.splitLineBreaks = splitLineBreaks;
module.exports.reduceWordsList = reduceWordsList;
module.exports.reduceSentences = reduceSentences;
module.exports.reduceText = reduceText;
module.exports.provider = provider('splitText', module.exports);
export const provider = createProvider('splitText', {
splitText,
splitLineBreaks,
reduceWordsList,
reduceSentences,
reduceText,
});

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

const { provider } = require('./app');
import { createProvider } from './app.js';

@@ -14,3 +14,3 @@ /**

*/
const trimTagsProperties = (tags) => {
export const trimTagsProperties = (tags) => {
const knownProperties = ['type', 'name', 'description'];

@@ -28,3 +28,4 @@ return tags.map((tag) =>

module.exports.trimTagsProperties = trimTagsProperties;
module.exports.provider = provider('trimTagsProperties', module.exports);
export const provider = createProvider('trimTagsProperties', {
trimTagsProperties,
});

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

const R = require('ramda');
const { get, provider } = require('./app');
import * as R from 'ramda';
import { get, createProvider } from './app.js';

@@ -15,3 +15,3 @@ /**

*/
const ensureArray = (obj) => R.unless(R.is(Array), R.of(Array), obj);
export const ensureArray = (obj) => R.unless(R.is(Array), R.of(Array), obj);

@@ -33,3 +33,3 @@ /**

*/
const findTagIndex = R.curry((targetTag, propName, step) => {
export const findTagIndex = R.curry((targetTag, propName, step) => {
const targetTags = get(ensureArray)(targetTag);

@@ -57,3 +57,3 @@ return (acc, tag, index) => {

*/
const isTag = R.curry((targetTag, tag) => {
export const isTag = R.curry((targetTag, tag) => {
const targetTags = get(ensureArray)(targetTag);

@@ -75,3 +75,3 @@ return R.propSatisfies(R.includes(R.__, targetTags), 'tag', tag);

*/
const appendIfNotPresent = R.curry((item, list) =>
export const appendIfNotPresent = R.curry((item, list) =>
R.unless(R.includes(item), R.append(item), list),

@@ -92,3 +92,3 @@ );

*/
const joinIfNotEmpty = R.curry((glue, str) =>
export const joinIfNotEmpty = R.curry((glue, str) =>
R.pipe(R.reject(R.isEmpty), R.join(glue))(str),

@@ -109,3 +109,3 @@ );

*/
const replaceLastItem = R.curry((item, list) =>
export const replaceLastItem = R.curry((item, list) =>
R.compose(R.append(item), R.dropLast(1))(list),

@@ -120,3 +120,3 @@ );

*/
const hasItems = (item) => R.compose(R.gt(R.__, 0), R.length)(item);
export const hasItems = (item) => R.compose(R.gt(R.__, 0), R.length)(item);

@@ -137,3 +137,3 @@ /**

*/
const isMatch = R.curry((expression, str) =>
export const isMatch = R.curry((expression, str) =>
R.compose(get(hasItems), R.match(expression))(str),

@@ -157,3 +157,3 @@ );

*/
const replaceAdjacent = R.curry((expression, replacement, text) => {
export const replaceAdjacent = R.curry((expression, replacement, text) => {
let useText = text;

@@ -186,3 +186,3 @@ let match = useText.match(expression);

*/
const replaceDotOnTypeGeneric = R.curry((targetType, useDot, type) => {
export const replaceDotOnTypeGeneric = R.curry((targetType, useDot, type) => {
const useReplaceAdjacent = get(replaceAdjacent);

@@ -202,3 +202,3 @@ return R.ifElse(

*/
const capitalize = (str) =>
export const capitalize = (str) =>
R.compose(R.join(''), R.juxt([R.compose(R.toUpper, R.head), R.tail]))(str);

@@ -219,3 +219,3 @@

*/
const getIndexOrFallback = R.curry((list, fallback, item) =>
export const getIndexOrFallback = R.curry((list, fallback, item) =>
R.compose(R.when(R.equals(-1), R.always(fallback)), R.indexOf(item))(list),

@@ -254,3 +254,3 @@ );

*/
const limitAdjacentRepetitions = R.curry((pred, limit, list) =>
export const limitAdjacentRepetitions = R.curry((pred, limit, list) =>
R.compose(

@@ -293,3 +293,3 @@ R.prop('list'),

*/
const hasValidProperty = R.curry((property, obj) =>
export const hasValidProperty = R.curry((property, obj) =>
R.propSatisfies(R.complement(R.either(R.isEmpty, R.isNil)), property)(obj),

@@ -310,3 +310,3 @@ );

*/
const prefixLines = R.curry((prefix, text) =>
export const prefixLines = R.curry((prefix, text) =>
R.compose(R.join('\n'), R.map(R.concat(prefix)), R.split('\n'), R.trim())(text),

@@ -327,3 +327,3 @@ );

*/
const splitLinesAndClean = R.curry((splitter, text) =>
export const splitLinesAndClean = R.curry((splitter, text) =>
R.compose(R.reject(R.isEmpty), R.map(R.trim), R.split(splitter))(text),

@@ -338,3 +338,3 @@ );

*/
const isURL = (text) =>
export const isURL = (text) =>
isMatch(

@@ -350,3 +350,3 @@ /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/i,

*/
const isTableRow = (text) => isMatch(/^\s*\|.*?\|\s*$/, text);
export const isTableRow = (text) => isMatch(/^\s*\|.*?\|\s*$/, text);

@@ -359,3 +359,3 @@ /**

*/
const ensureSentence = (text) =>
export const ensureSentence = (text) =>
R.when(

@@ -380,3 +380,3 @@ R.allPass([R.complement(get(isURL)), get(isMatch)(/[\w\.]\s*$/)]),

*/
const composeWithPromise = (...args) =>
export const composeWithPromise = (...args) =>
R.composeWith((f, val) => {

@@ -410,3 +410,3 @@ if (val && val.then) {

*/
const reduceWithPromise = (items, fn) =>
export const reduceWithPromise = (items, fn) =>
items.reduce(

@@ -422,22 +422,23 @@ (accPromise, item) =>

module.exports.ensureArray = ensureArray;
module.exports.findTagIndex = findTagIndex;
module.exports.isTag = isTag;
module.exports.appendIfNotPresent = appendIfNotPresent;
module.exports.joinIfNotEmpty = joinIfNotEmpty;
module.exports.replaceLastItem = replaceLastItem;
module.exports.hasItems = hasItems;
module.exports.isMatch = isMatch;
module.exports.replaceDotOnTypeGeneric = replaceDotOnTypeGeneric;
module.exports.capitalize = capitalize;
module.exports.getIndexOrFallback = getIndexOrFallback;
module.exports.limitAdjacentRepetitions = limitAdjacentRepetitions;
module.exports.hasValidProperty = hasValidProperty;
module.exports.prefixLines = prefixLines;
module.exports.splitLinesAndClean = splitLinesAndClean;
module.exports.isURL = isURL;
module.exports.isTableRow = isTableRow;
module.exports.ensureSentence = ensureSentence;
module.exports.composeWithPromise = composeWithPromise;
module.exports.reduceWithPromise = reduceWithPromise;
module.exports.provider = provider('utils', module.exports);
export const provider = createProvider('utils', {
ensureArray,
findTagIndex,
isTag,
appendIfNotPresent,
joinIfNotEmpty,
replaceLastItem,
hasItems,
isMatch,
replaceDotOnTypeGeneric,
capitalize,
getIndexOrFallback,
limitAdjacentRepetitions,
hasValidProperty,
prefixLines,
splitLinesAndClean,
isURL,
isTableRow,
ensureSentence,
composeWithPromise,
reduceWithPromise,
});

@@ -1,7 +0,8 @@

const { get } = require('./fns/app');
const { getPlugin } = require('./fns/getPlugin');
const { loadFns } = require('./loader');
import { get } from './fns/app.js';
import { getPlugin } from './fns/getPlugin.js';
import { loadFns } from './loader.js';
loadFns();
module.exports = get(getPlugin)(true);
const plugin = get(getPlugin)(true);
export default plugin;

@@ -1,8 +0,10 @@

const path = require('path');
const { loadProviders } = require('./fns/app');
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { loadProviders } from './fns/app.js';
/**
* Loads and registers the providers of all the plugin functions.
*/
const loadFns = () => {
loadProviders(path.join(__dirname, 'fns'), [
export const loadFns = () => {
const currentDir = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '.');
loadProviders(path.join(currentDir, 'fns'), [
'formatAccessTag',

@@ -36,3 +38,1 @@ 'formatArrays',

};
module.exports.loadFns = loadFns;

@@ -5,7 +5,5 @@ // =========================================

/* eslint-disable jsdoc/valid-types */
/**
* @typedef {PrettierParser['parse']} PrettierParseFn
*/
/* eslint-enable jsdoc/valid-types */

@@ -207,3 +205,2 @@ /**

// eslint-disable-next-line
export {};