Skip to content

Commit

Permalink
Use ESM
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Aug 2, 2021
1 parent 125caa9 commit 75258b8
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 25 deletions.
8 changes: 2 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
'use strict'
import hastUtilRaw from 'hast-util-raw'

var hastUtilRaw = require('hast-util-raw')

module.exports = rehypeRaw

function rehypeRaw(options) {
export default function rehypeRaw(options) {
return transform
function transform(tree, file) {
return hastUtilRaw(tree, file, options)
Expand Down
15 changes: 9 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@
"contributors": [
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"
],
"types": "types/index.d.ts",
"sideEffects": false,
"type": "module",
"main": "index.js",
"files": [
"index.js",
"types/index.d.ts"
"index.js"
],
"dependencies": {
"hast-util-raw": "^6.1.0"
},
"devDependencies": {
"c8": "^7.0.0",
"dtslint": "^4.0.0",
"prettier": "^2.0.0",
"rehype-stringify": "^8.0.0",
"remark-cli": "^9.0.0",
Expand All @@ -46,8 +46,7 @@
"format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix",
"test-api": "node --conditions development test.js",
"test-coverage": "c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 --reporter lcov npm run test-api",
"test-types": "dtslint types",
"test": "npm run format && npm run test-coverage && npm run test-types"
"test": "npm run format && npm run test-coverage"
},
"prettier": {
"tabWidth": 2,
Expand All @@ -60,6 +59,10 @@
"xo": {
"prettier": true,
"esnext": false,
"rules": {
"no-var": "off",
"prefer-arrow-callback": "off"
},
"ignores": [
"types/"
]
Expand Down
24 changes: 11 additions & 13 deletions test.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
'use strict'
import test from 'tape'
import unified from 'unified'
import remarkParse from 'remark-parse'
import remarkRehype from 'remark-rehype'
import rehypeStringify from 'rehype-stringify'
import rehypeRaw from './index.js'

var test = require('tape')
var unified = require('unified')
var parse = require('remark-parse')
var remark2rehype = require('remark-rehype')
var stringify = require('rehype-stringify')
var raw = require('.')

test('integration', function (t) {
test('rehypeRaw', function (t) {
unified()
.use(parse)
.use(remark2rehype, {allowDangerousHtml: true})
.use(raw)
.use(stringify)
.use(remarkParse)
.use(remarkRehype, {allowDangerousHtml: true})
.use(rehypeRaw)
.use(rehypeStringify)
.process(
[
'<div class="note">',
Expand Down

0 comments on commit 75258b8

Please sign in to comment.