From b51a3757e9b43811f516271a4f109cbc2dd6bbc7 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Fri, 28 Jun 2024 15:05:24 +0200 Subject: [PATCH] Refactor `package.json` --- package.json | 44 +++++++++++++++++++++++++++++--------------- test/index.js | 6 ++---- 2 files changed, 31 insertions(+), 19 deletions(-) diff --git a/package.json b/package.json index 3698b99..3c735f7 100644 --- a/package.json +++ b/package.json @@ -1,28 +1,45 @@ { "name": "rehype-starry-night", - "type": "module", "version": "1.0.2", - "description": "syntaxhighlight using starry-night", - "homepage": "https://github.com/y-nk/rehype-starry-night", + "description": "rehype plugin to highlight code with `starry-night`", + "license": "MIT", "keywords": [ - "rehype", + "hast", + "highlight", + "html", + "night", "plugin", + "rehype", + "rehype-plugin", "starry-night", + "starry", "syntax", - "hightlight" + "unified" ], - "author": "Julien Barbay ", - "license": "MIT", "repository": "rehypejs/rehype-starry-night", - "main": "index.js", + "bugs": "https://github.com/rehypejs/rehype-starry-night/issues", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "author": "Julien Barbay ", + "contributors": [ + "Julien Barbay ", + "Titus Wormer (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "exports": "./index.js", "files": [ - "./index.js" + "lib/", + "index.d.ts", + "index.js" ], "dependencies": { + "@types/hast": "^3.0.0", "@wooorm/starry-night": "^3.0.0", "hast-util-to-string": "^3.0.0", "levenshtein-edit-distance": "^3.0.0", - "remark-rehype": "^11.1.0", "unist-util-visit-parents": "^6.0.0", "vfile": "^6.0.0" }, @@ -44,6 +61,7 @@ "scripts": { "build": "tsc --build --clean && tsc --build && type-coverage", "format": "remark . --frail --output --quiet && prettier . --log-level warn --write && xo --fix", + "prepack": "npm run build && npm run format", "test": "npm run build && npm run format && npm run test-coverage", "test-api": "node --conditions development test/index.js", "test-coverage": "c8 --100 --check-coverage --reporter lcov npm run test-api" @@ -59,11 +77,7 @@ "remarkConfig": { "plugins": [ "remark-preset-wooorm", - "remark-api", - [ - "remark-lint-no-html", - false - ] + "remark-api" ] }, "typeCoverage": { diff --git a/test/index.js b/test/index.js index a23cdc6..a98c95a 100644 --- a/test/index.js +++ b/test/index.js @@ -5,17 +5,15 @@ import test from 'node:test' import {common} from '@wooorm/starry-night' import sourceTsx from '@wooorm/starry-night/source.tsx' import rehypeParse from 'rehype-parse' +import rehypeStarryNight from 'rehype-starry-night' import rehypeStringify from 'rehype-stringify' import {read, write} from 'to-vfile' import {unified} from 'unified' import {VFile} from 'vfile' -import rehypeStarryNight from '../index.js' - -// To do: export map and import self. test('rehypeStarryNight', async function (t) { await t.test('should expose the public api', async function () { - assert.deepEqual(Object.keys(await import('../index.js')).sort(), [ + assert.deepEqual(Object.keys(await import('rehype-starry-night')).sort(), [ 'default' ]) })