retext-stringify
Advanced tools
Comparing version
@@ -1,4 +0,6 @@ | ||
/** @type {Plugin} */ | ||
export default function retextStringify(): void | import('unified').Transformer | ||
export type Plugin = import('unified').Plugin<[]> | ||
export type Node = import('unist').Node | ||
// This wrapper exists because JS in TS can’t export a `@type` of a function. | ||
import type {Root} from 'nlcst' | ||
import type {Plugin} from 'unified' | ||
declare const retextStringify: Plugin<void[], Root, string> | ||
export default retextStringify |
20
index.js
@@ -1,19 +0,3 @@ | ||
/** | ||
* @typedef {import('unified').Plugin<[]>} Plugin | ||
* @typedef {import('unist').Node} Node | ||
*/ | ||
import retextStringify from './lib/index.js' | ||
import {toString} from 'nlcst-to-string' | ||
/** @type {Plugin} */ | ||
export default function retextStringify() { | ||
Object.assign(this, {Compiler}) | ||
} | ||
/** | ||
* @param {Node} tree | ||
* @returns {string} | ||
*/ | ||
function Compiler(tree) { | ||
return toString(tree) | ||
} | ||
export default retextStringify |
{ | ||
"name": "retext-stringify", | ||
"version": "3.0.0", | ||
"version": "3.1.0", | ||
"description": "retext plugin to serialize prose", | ||
@@ -38,2 +38,3 @@ "license": "MIT", | ||
"files": [ | ||
"lib/", | ||
"index.d.ts", | ||
@@ -43,3 +44,3 @@ "index.js" | ||
"dependencies": { | ||
"@types/unist": "^2.0.0", | ||
"@types/nlcst": "^1.0.0", | ||
"nlcst-to-string": "^3.0.0", | ||
@@ -49,3 +50,3 @@ "unified": "^10.0.0" | ||
"scripts": { | ||
"build": "rimraf \"*.d.ts\" && tsc && type-coverage" | ||
"build": "rimraf \"lib/**/*.d.ts\" && tsc && type-coverage" | ||
}, | ||
@@ -52,0 +53,0 @@ "xo": false, |
7381
4.19%6
50%22
10%+ Added
- Removed