diff --git a/index.js b/index.js index 3731210..a49a278 100644 --- a/index.js +++ b/index.js @@ -1,25 +1,5 @@ /** - * @typedef {import('hast').Root} Root - * @typedef {import('hast-util-raw').Options} RawOptions - * @typedef {import('hast-util-raw')} DoNotTouchAsThisImportIncludesRawInTree + * @typedef {import('./lib/index.js').Options} Options */ -/** - * @typedef {Omit} Options - */ - -import {raw} from 'hast-util-raw' - -/** - * Plugin to parse the tree again (and raw nodes). - * Keeping positional info OK. ๐Ÿ™Œ - * - * @type {import('unified').Plugin<[Options?] | Array, Root>} - */ -export default function rehypeRaw(options = {}) { - return (tree, file) => { - // Assume that when a root was given, itโ€™s also returned. - const result = /** @type {Root} */ (raw(tree, {...options, file})) - return result - } -} +export {default} from './lib/index.js' diff --git a/lib/index.js b/lib/index.js new file mode 100644 index 0000000..3731210 --- /dev/null +++ b/lib/index.js @@ -0,0 +1,25 @@ +/** + * @typedef {import('hast').Root} Root + * @typedef {import('hast-util-raw').Options} RawOptions + * @typedef {import('hast-util-raw')} DoNotTouchAsThisImportIncludesRawInTree + */ + +/** + * @typedef {Omit} Options + */ + +import {raw} from 'hast-util-raw' + +/** + * Plugin to parse the tree again (and raw nodes). + * Keeping positional info OK. ๐Ÿ™Œ + * + * @type {import('unified').Plugin<[Options?] | Array, Root>} + */ +export default function rehypeRaw(options = {}) { + return (tree, file) => { + // Assume that when a root was given, itโ€™s also returned. + const result = /** @type {Root} */ (raw(tree, {...options, file})) + return result + } +} diff --git a/package.json b/package.json index 4ee28c4..029db3e 100644 --- a/package.json +++ b/package.json @@ -26,6 +26,7 @@ "main": "index.js", "types": "index.d.ts", "files": [ + "lib/", "index.d.ts", "index.js" ],