Skip to content

Commit

Permalink
Use ESM
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Aug 4, 2021
1 parent df9f645 commit f902763
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 38 deletions.
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
.DS_Store
*.log
coverage/
dist/
node_modules/
.DS_Store
*.log
yarn.lock
1 change: 0 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
coverage/
dist/
*.md
8 changes: 5 additions & 3 deletions src/index.js → index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ let warningIssued

const defaults = {2: {before: 2}}

export default function (options) {
export default function remarkHeadingGap(options) {
const data = this.data()
const gaps = {...defaults, ...options}
const headingGap = {join: [betweenHeading]}

/* istanbul ignore next - old remark. */
// Old remark.
/* c8 ignore next 11 */
if (
!warningIssued &&
this.Compiler &&
Expand All @@ -20,7 +21,8 @@ export default function (options) {
)
}

/* istanbul ignore next - other extensions */
// Other extensions
/* c8 ignore next */
if (!data.toMarkdownExtensions) data.toMarkdownExtensions = []

data.toMarkdownExtensions.push(headingGap)
Expand Down
31 changes: 6 additions & 25 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,13 @@
"Ben Briggs <beneb.info@gmail.com> (http://beneb.info)",
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"
],
"main": "dist/index.js",
"module": "src/index.js",
"sideEffects": false,
"type": "module",
"main": "index.js",
"files": [
"dist",
"src/index.js"
"index.js"
],
"devDependencies": {
"@babel/cli": "^7.0.0",
"@babel/core": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"@babel/register": "^7.0.0",
"babel-plugin-add-module-exports": "^1.0.0",
"c8": "^7.0.0",
"prettier": "^2.0.0",
"remark": "^13.0.0",
Expand All @@ -48,21 +43,10 @@
"xo": "^0.37.0"
},
"scripts": {
"prepublishOnly": "npm run compile",
"format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix",
"compile": "babel src --out-dir dist --ignore src/**/__tests__",
"test-api": "node --conditions development test/index.js",
"test-coverage": "c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 --reporter lcov npm run test-api",
"test": "npm run compile && npm run format && npm run test-coverage"
},
"browserslist": "> 2.5%, node 6",
"babel": {
"presets": [
"@babel/preset-env"
],
"plugins": [
"add-module-exports"
]
"test": "npm run format && npm run test-coverage"
},
"prettier": {
"tabWidth": 2,
Expand All @@ -73,10 +57,7 @@
"trailingComma": "none"
},
"xo": {
"prettier": true,
"rules": {
"import/no-anonymous-default-export": "off"
}
"prettier": true
},
"#": "this plugin is currently not turned on while remark is updating",
"remarkConfig": {
Expand Down
12 changes: 6 additions & 6 deletions test/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
const fs = require('fs')
const path = require('path')
const test = require('tape')
const remark = require('remark')
const plugin = require('../dist/index.js')
import fs from 'fs'
import path from 'path'
import test from 'tape'
import remark from 'remark'
import plugin from '../index.js'

const base = path.join(__dirname, 'fixtures')
const base = path.join('test', 'fixtures')

const specs = {}

Expand Down

0 comments on commit f902763

Please sign in to comment.