Skip to content

Commit

Permalink
Use ESM
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Aug 5, 2021
1 parent eabe488 commit c02f672
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 23 deletions.
12 changes: 4 additions & 8 deletions index.js
@@ -1,12 +1,8 @@
'use strict'
import syntax from 'micromark-extension-frontmatter'
import fromMarkdown from 'mdast-util-frontmatter/from-markdown.js'
import toMarkdown from 'mdast-util-frontmatter/to-markdown.js'

var syntax = require('micromark-extension-frontmatter')
var fromMarkdown = require('mdast-util-frontmatter/from-markdown')
var toMarkdown = require('mdast-util-frontmatter/to-markdown')

module.exports = frontmatter

function frontmatter(options) {
export default function remarkFrontmatter(options) {
var data = this.data()
add('micromarkExtensions', syntax(options))
add('fromMarkdownExtensions', fromMarkdown(options))
Expand Down
9 changes: 6 additions & 3 deletions package.json
Expand Up @@ -26,11 +26,12 @@
"Lars Trieloff <lars@trieloff.net>",
"Max Kueng <me@maxkueng.com>"
],
"sideEffects": false,
"type": "module",
"main": "index.js",
"files": [
"index.js",
"types/index.d.ts"
"index.js"
],
"types": "types/index.d.ts",
"dependencies": {
"mdast-util-frontmatter": "^0.2.0",
"micromark-extension-frontmatter": "^0.2.0"
Expand Down Expand Up @@ -67,6 +68,8 @@
"prettier": true,
"esnext": false,
"rules": {
"no-var": "off",
"prefer-arrow-callback": "off",
"unicorn/no-array-callback-reference": "off",
"unicorn/prefer-optional-catch-binding": "off",
"guard-for-in": "off"
Expand Down
22 changes: 10 additions & 12 deletions test/index.js
@@ -1,14 +1,12 @@
'use strict'

var fs = require('fs')
var path = require('path')
var test = require('tape')
var vfile = require('to-vfile')
var unified = require('unified')
var remark = require('remark')
var not = require('not')
var hidden = require('is-hidden')
var frontmatter = require('..')
import fs from 'fs'
import path from 'path'
import test from 'tape'
import vfile from 'to-vfile'
import unified from 'unified'
import remark from 'remark'
import not from 'not'
import hidden from 'is-hidden'
import frontmatter from '../index.js'

var join = path.join
var read = fs.readFileSync
Expand Down Expand Up @@ -66,7 +64,7 @@ test('frontmatter()', function (t) {
})

test('fixtures', function (t) {
var base = join(__dirname, 'fixtures')
var base = join('test', 'fixtures')
var entries = dir(base).filter(not(hidden))

t.plan(entries.length)
Expand Down

0 comments on commit c02f672

Please sign in to comment.