Skip to content

Commit

Permalink
Use ESM
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Jul 30, 2021
1 parent 09375c8 commit f9bceeb
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 18 deletions.
12 changes: 5 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
'use strict'
import h from 'hastscript'
import select from 'hast-util-select'
import from from 'hast-util-from-selector'

var h = require('hastscript')
var $ = require('hast-util-select').select
var from = require('hast-util-from-selector')

module.exports = meta
const $ = select.select

var fbBase = 'https://www.facebook.com/'

Expand Down Expand Up @@ -33,7 +31,7 @@ var generators = [
twitterCreator
]

function meta(options) {
export default function meta(options) {
return transform

function transform(tree, file) {
Expand Down
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
"contributors": [
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"
],
"sideEffects": false,
"type": "module",
"main": "index.js",
"files": [
"index.js"
],
Expand Down Expand Up @@ -64,8 +67,9 @@
},
"xo": {
"prettier": true,
"esnext": false,
"rules": {
"no-var": "off",
"prefer-arrow-callback": "off",
"unicorn/no-fn-reference-in-iterator": "off"
}
},
Expand Down
16 changes: 6 additions & 10 deletions test.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
'use strict'

var test = require('tape')
var rehype = require('rehype')
var doc = require('rehype-document')
var meta = require('.')
import test from 'tape'
import rehype from 'rehype'
import doc from 'rehype-document'
import meta from './index.js'

test('rehype-meta', function (t) {
t.test('basics', function (st) {
Expand Down Expand Up @@ -770,8 +768,7 @@ test('rehype-meta', function (t) {
'NYC'
],
image: {
url:
'https://static01.nyt.com/images/2019/12/02/autossell/mta-promo-image/mta-crop-facebookJumbo.jpg',
url: 'https://static01.nyt.com/images/2019/12/02/autossell/mta-promo-image/mta-crop-facebookJumbo.jpg',
alt: 'M.T.A. map designed in 1979',
width: '1050',
height: '550'
Expand Down Expand Up @@ -857,8 +854,7 @@ test('rehype-meta', function (t) {
'wedges'
],
image: {
url:
'https://hostthetoast.com/wp-content/uploads/2014/06/Salt-and-Vinegar-Potatoes-6.jpg',
url: 'https://hostthetoast.com/wp-content/uploads/2014/06/Salt-and-Vinegar-Potatoes-6.jpg',
width: '670',
height: '1012'
},
Expand Down

0 comments on commit f9bceeb

Please sign in to comment.