@@ -3,19 +3,20 @@ import fs from 'fs'
3
3
import notifier from 'update-notifier'
4
4
import supportsColor from 'supports-color'
5
5
import meow from 'meow'
6
- import engine from 'unified-engine'
7
- import unified from 'unified'
8
- import markdown from 'remark-parse'
9
- import html from 'rehype-parse'
10
- import frontmatter from 'remark-frontmatter'
11
- import mdx from 'remark-mdx'
12
- import english from 'retext-english'
13
- import remark2retext from 'remark-retext'
14
- import rehype2retext from 'rehype-retext'
15
- import defaultReporter from 'vfile-reporter'
16
- import equality from 'retext-equality'
17
- import profanities from 'retext-profanities'
18
- import diff from 'unified-diff'
6
+ import { engine } from 'unified-engine'
7
+ import { unified } from 'unified'
8
+ import rehypeParse from 'rehype-parse'
9
+ import remarkParse from 'remark-parse'
10
+ import remarkFrontmatter from 'remark-frontmatter'
11
+ import remarkGfm from 'remark-gfm'
12
+ import remarkMdx from 'remark-mdx'
13
+ import retextEnglish from 'retext-english'
14
+ import remarkRetext from 'remark-retext'
15
+ import rehypeRetext from 'rehype-retext'
16
+ import vfileReporter from 'vfile-reporter'
17
+ import retextEquality from 'retext-equality'
18
+ import retextProfanities from 'retext-profanities'
19
+ import unifiedDiff from 'unified-diff'
19
20
import { filter } from './filter.js'
20
21
21
22
const pack = JSON . parse (
@@ -63,6 +64,7 @@ var cli = meow(
63
64
' $ alex'
64
65
] . join ( '\n' ) ,
65
66
{
67
+ importMeta : import . meta,
66
68
flags : {
67
69
version : { type : 'boolean' , alias : 'v' } ,
68
70
help : { type : 'boolean' , alias : 'h' } ,
@@ -110,7 +112,7 @@ engine(
110
112
rcName : '.alexrc' ,
111
113
packageField : 'alex' ,
112
114
color : supportsColor . stderr ,
113
- reporter : cli . flags . reporter || defaultReporter ,
115
+ reporter : cli . flags . reporter || vfileReporter ,
114
116
reporterOptions : {
115
117
verbose : cli . flags . why
116
118
} ,
@@ -129,24 +131,25 @@ engine(
129
131
function transform ( options ) {
130
132
var settings = options || { }
131
133
var plugins = [
132
- english ,
133
- [ profanities , { sureness : settings . profanitySureness } ] ,
134
- [ equality , { noBinary : settings . noBinary } ]
134
+ retextEnglish ,
135
+ [ retextProfanities , { sureness : settings . profanitySureness } ] ,
136
+ [ retextEquality , { noBinary : settings . noBinary } ]
135
137
]
136
138
137
139
if ( cli . flags . html ) {
138
- plugins = [ html , [ rehype2retext , unified ( ) . use ( { plugins : plugins } ) ] ]
140
+ plugins = [ rehypeParse , [ rehypeRetext , unified ( ) . use ( { plugins : plugins } ) ] ]
139
141
} else if ( cli . flags . mdx ) {
140
142
plugins = [
141
- markdown ,
142
- mdx ,
143
- [ remark2retext , unified ( ) . use ( { plugins : plugins } ) ]
143
+ remarkParse ,
144
+ remarkMdx ,
145
+ [ remarkRetext , unified ( ) . use ( { plugins : plugins } ) ]
144
146
]
145
147
} else if ( ! cli . flags . text ) {
146
148
plugins = [
147
- markdown ,
148
- [ frontmatter , [ 'yaml' , 'toml' ] ] ,
149
- [ remark2retext , unified ( ) . use ( { plugins : plugins } ) ]
149
+ remarkParse ,
150
+ remarkGfm ,
151
+ [ remarkFrontmatter , [ 'yaml' , 'toml' ] ] ,
152
+ [ remarkRetext , unified ( ) . use ( { plugins : plugins } ) ]
150
153
]
151
154
}
152
155
@@ -155,7 +158,7 @@ function transform(options) {
155
158
// Hard to check.
156
159
/* c8 ignore next 3 */
157
160
if ( cli . flags . diff ) {
158
- plugins . push ( diff )
161
+ plugins . push ( unifiedDiff )
159
162
}
160
163
161
164
return { plugins : plugins }
0 commit comments