File tree 3 files changed +16
-14
lines changed 3 files changed +16
-14
lines changed Original file line number Diff line number Diff line change 5
5
*/
6
6
7
7
/**
8
- * @typedef Dictionary
9
- * A hunspell dictionary.
10
- * @property {Uint8Array } aff
11
- * Data for the affix file (defines the language, keyboard, flags, and more).
12
- * @property {Uint8Array } dic
13
- * Data for the dictionary file (contains words and flags applying to those words).
14
- *
15
8
* @callback DictionaryCallback
16
9
* Dictionary function.
17
10
* @param {DictionaryOnLoad } onload
32
25
*
33
26
* Note: `void` included until TS infers it.
34
27
*
28
+ * @typedef Dictionary
29
+ * A hunspell dictionary.
30
+ * @property {Uint8Array } aff
31
+ * Data for the affix file (defines the language, keyboard, flags, and more).
32
+ * @property {Uint8Array } dic
33
+ * Data for the dictionary file (contains words and flags applying to those words).
34
+ *
35
35
* @typedef Options
36
36
* Configuration.
37
- * @property {Dictionary | DictionaryCallback } dictionary
37
+ * @property {DictionaryCallback | Dictionary } dictionary
38
38
* Dictionary (required);
39
39
* result of importing one of the dictionaries in `wooorm/dictionaries`.
40
40
* @property {ReadonlyArray<string> | null | undefined } [ignore]
Original file line number Diff line number Diff line change 48
48
},
49
49
"devDependencies" : {
50
50
"@types/node" : " ^20.0.0" ,
51
- "c8" : " ^8.0.0" ,
52
- "dictionary-en" : " ^3.0.0" ,
53
- "dictionary-en-v4" : " npm:dictionary-en@^4.0.0" ,
51
+ "c8" : " ^9.0.0" ,
52
+ "dictionary-en" : " ^4.0.0" ,
54
53
"prettier" : " ^3.0.0" ,
55
54
"remark-cli" : " ^11.0.0" ,
56
55
"remark-preset-wooorm" : " ^9.0.0" ,
Original file line number Diff line number Diff line change 1
1
import assert from 'node:assert/strict'
2
2
import test from 'node:test'
3
3
import dictionaryEn from 'dictionary-en'
4
- import dictionaryEnV4 from 'dictionary-en-v4'
5
4
import { retext } from 'retext'
6
5
import retextEmoji from 'retext-emoji'
7
6
import retextSpell from 'retext-spell'
@@ -79,9 +78,13 @@ test('retextSpell', async function (t) {
79
78
] )
80
79
} )
81
80
82
- await t . test ( 'should work with newer dictionary versions ' , async function ( ) {
81
+ await t . test ( 'should work with dictionary callbacks ' , async function ( ) {
83
82
const file = await retext ( )
84
- . use ( retextSpell , dictionaryEnV4 )
83
+ . use ( retextSpell , function ( onload ) {
84
+ setTimeout ( function ( ) {
85
+ onload ( undefined , dictionaryEn )
86
+ } , 10 )
87
+ } )
85
88
. process ( 'kolor' )
86
89
87
90
assert . deepEqual ( file . messages . map ( String ) , [
You can’t perform that action at this time.
0 commit comments