Skip to content

Commit 995b360

Browse files
committed
Change to use CJS again
1 parent 18c2be5 commit 995b360

File tree

4 files changed

+12
-14
lines changed

4 files changed

+12
-14
lines changed

example.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { remark } from 'remark'
2-
import find from './index.js'
1+
var remark = require('remark')
2+
var find = require('./index.js')
33

44
remark()
55
.use(function () {

index.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
* Finds first node for which function returns true when passed node as argument.
1616
*/
1717

18-
import { visit } from 'unist-util-visit'
19-
import iteratee from 'lodash.iteratee'
18+
var visit = require('unist-util-visit')
19+
var iteratee = require('lodash.iteratee')
2020

2121
/**
2222
* Unist node finder utility.
@@ -29,7 +29,7 @@ import iteratee from 'lodash.iteratee'
2929
* The first node that matches condition, or undefined if no node matches.
3030
* @type {<V extends Node>(tree: Node, condition: TestStr | TestObj | TestFn) => V | undefined}
3131
*/
32-
function find (tree, condition) {
32+
module.exports = function find (tree, condition) {
3333
if (!tree) throw new Error('unist-util-find requires a tree to search')
3434
if (!condition) throw new Error('unist-util-find requires a condition')
3535

@@ -45,5 +45,3 @@ function find (tree, condition) {
4545

4646
return result
4747
}
48-
49-
export default find

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"engines": {
2020
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
2121
},
22-
"type": "module",
22+
"type": "commonjs",
2323
"keywords": [
2424
"unist",
2525
"remark",
@@ -37,13 +37,13 @@
3737
"@types/lodash.iteratee": "^4.7.7",
3838
"@types/unist": "^2.0.6",
3939
"release-it": "^15.11.0",
40-
"remark": "^14.0.1",
41-
"standard": "^16.0.4",
40+
"remark": "^13.0.0",
41+
"standard": "^8.0.0",
4242
"tape": "^5.3.1",
4343
"typescript": "^4.6.4"
4444
},
4545
"dependencies": {
4646
"lodash.iteratee": "^4.7.0",
47-
"unist-util-visit": "^4.1.0"
47+
"unist-util-visit": "^2.0.0"
4848
}
4949
}

test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import test from 'tape'
2-
import { remark } from 'remark'
3-
import find from './index.js'
1+
var test = require('tape')
2+
var remark = require('remark')
3+
var find = require('./index.js')
44

55
test('unist-find', function (t) {
66
const tree = remark().parse('Some _emphasis_, **strongness**, and `code`.')

0 commit comments

Comments
 (0)