diff --git a/src/aff/affix.ts b/src/aff/affix.ts index d5f8b8a..2de5d74 100644 --- a/src/aff/affix.ts +++ b/src/aff/affix.ts @@ -3,9 +3,9 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ import { iterate } from "iterare" -import { CONSTANTS as C } from "../constants" -import { re } from "../util" -import type { Aff, Flag, Flags } from "./index" +import { CONSTANTS as C } from "../constants.js" +import { re } from "../util.js" +import type { Aff, Flag, Flags } from "./index.js" /** Base class for the {@link Prefix}/{@link Suffix} classes. Won't work by itself. */ export abstract class Affix { diff --git a/src/aff/casing.ts b/src/aff/casing.ts index cf40aa3..b0b379e 100644 --- a/src/aff/casing.ts +++ b/src/aff/casing.ts @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -import { CapType } from "../constants" +import { CapType } from "../constants.js" import { isLowercased, isTitlecased, @@ -11,7 +11,7 @@ import { replaceRange, titlecase, uppercase -} from "../util" +} from "../util.js" /** * A class containing casing-related algorithms for a language. This is a diff --git a/src/aff/compound-pattern.ts b/src/aff/compound-pattern.ts index f98d240..0794085 100644 --- a/src/aff/compound-pattern.ts +++ b/src/aff/compound-pattern.ts @@ -2,8 +2,8 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -import type { AffixForm } from "../lookup/forms" -import type { Flag } from "./index" +import type { AffixForm } from "../lookup/forms.js" +import type { Flag } from "./index.js" /** * A pattern for checking if a pair of {@link AffixForm}s are a valid diff --git a/src/aff/compound-rule.ts b/src/aff/compound-rule.ts index da0cc82..96f1a2b 100644 --- a/src/aff/compound-rule.ts +++ b/src/aff/compound-rule.ts @@ -3,9 +3,9 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ import { iterate } from "iterare" -import { intersect, product, re } from "../util" -import type { Aff, Flags, FlagSet } from "./index" -import type { Flag } from "./types" +import { intersect, product, re } from "../util.js" +import type { Aff, Flags, FlagSet } from "./index.js" +import type { Flag } from "./types.js" // TODO: make this not use a weird regex matching system // I couldn't exactly wrap my brain around how to avoid using regex here diff --git a/src/aff/conv-table.ts b/src/aff/conv-table.ts index e2a3bf2..2fcfd0e 100644 --- a/src/aff/conv-table.ts +++ b/src/aff/conv-table.ts @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -import { re } from "../util" +import { re } from "../util.js" /** * A table of conversions (either input to output, or output to input) for diff --git a/src/aff/index.ts b/src/aff/index.ts index 26ae6c7..41b893e 100644 --- a/src/aff/index.ts +++ b/src/aff/index.ts @@ -3,17 +3,17 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ import { iterate } from "iterare" -import { CONSTANTS as C } from "../constants" -import type { Reader } from "../reader" -import { Trie } from "../trie" -import { escapeRegExp, re, reverse, split } from "../util" -import { Prefix, Suffix } from "./affix" -import { Casing, GermanCasing, TurkicCasing } from "./casing" -import { CompoundPattern } from "./compound-pattern" -import { CompoundRule } from "./compound-rule" -import { ConvTable } from "./conv-table" -import { PhonetTable } from "./phonet-table" -import { RepPattern } from "./rep-pattern" +import { CONSTANTS as C } from "../constants.js" +import type { Reader } from "../reader.js" +import { Trie } from "../trie.js" +import { escapeRegExp, re, reverse, split } from "../util.js" +import { Prefix, Suffix } from "./affix.js" +import { Casing, GermanCasing, TurkicCasing } from "./casing.js" +import { CompoundPattern } from "./compound-pattern.js" +import { CompoundRule } from "./compound-rule.js" +import { ConvTable } from "./conv-table.js" +import { PhonetTable } from "./phonet-table.js" +import { RepPattern } from "./rep-pattern.js" import type { AffData, CharacterMap, diff --git a/src/aff/phonet-table.ts b/src/aff/phonet-table.ts index 4acea31..0b690cf 100644 --- a/src/aff/phonet-table.ts +++ b/src/aff/phonet-table.ts @@ -2,8 +2,8 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -import { CONSTANTS as C } from "../constants" -import { re, uppercase } from "../util" +import { CONSTANTS as C } from "../constants.js" +import { re, uppercase } from "../util.js" // TODO: use homegrown metaphone implementation (maybe) diff --git a/src/aff/rep-pattern.ts b/src/aff/rep-pattern.ts index 2499aa4..2161384 100644 --- a/src/aff/rep-pattern.ts +++ b/src/aff/rep-pattern.ts @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -import { re, replaceRange } from "../util" +import { re, replaceRange } from "../util.js" /** * A replacement pattern describes a pattern and its replacement, with the diff --git a/src/aff/types.d.ts b/src/aff/types.d.ts index 6fd97ed..1ae6e84 100644 --- a/src/aff/types.d.ts +++ b/src/aff/types.d.ts @@ -2,13 +2,13 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -import type { Trie } from "../trie" -import type { Affix, Prefix, Suffix } from "./affix" -import type { CompoundPattern } from "./compound-pattern" -import type { CompoundRule } from "./compound-rule" -import type { ConvTable } from "./conv-table" -import type { PhonetTable } from "./phonet-table" -import type { RepPattern } from "./rep-pattern" +import type { Trie } from "../trie.js" +import type { Affix, Prefix, Suffix } from "./affix.js" +import type { CompoundPattern } from "./compound-pattern.js" +import type { CompoundRule } from "./compound-rule.js" +import type { ConvTable } from "./conv-table.js" +import type { PhonetTable } from "./phonet-table.js" +import type { RepPattern } from "./rep-pattern.js" /** * A flag is just a string label for some special property. This may mark a diff --git a/src/dic/index.ts b/src/dic/index.ts index a8a454b..e237b12 100644 --- a/src/dic/index.ts +++ b/src/dic/index.ts @@ -3,10 +3,10 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ import { iterate } from "iterare" -import type { Aff, Flag } from "../aff" -import { CapType, CONSTANTS as C } from "../constants" -import type { Reader } from "../reader" -import { Word } from "./word" +import type { Aff, Flag } from "../aff/index.js" +import { CapType, CONSTANTS as C } from "../constants.js" +import type { Reader } from "../reader.js" +import { Word } from "./word.js" export { Word } diff --git a/src/dic/word.ts b/src/dic/word.ts index bce25d4..25ee189 100644 --- a/src/dic/word.ts +++ b/src/dic/word.ts @@ -3,11 +3,11 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ import { iterate } from "iterare" -import type { Aff, Flag, Flags, FlagSet } from "../aff" -import type { Prefix, Suffix } from "../aff/affix" -import { RepPattern } from "../aff/rep-pattern" -import { CapType, CONSTANTS as C } from "../constants" -import { split } from "../util" +import type { Prefix, Suffix } from "../aff/affix.js" +import type { Aff, Flag, Flags, FlagSet } from "../aff/index.js" +import { RepPattern } from "../aff/rep-pattern.js" +import { CapType, CONSTANTS as C } from "../constants.js" +import { split } from "../util.js" /** A word as found in a {@link Dic} instance's index. */ export class Word { diff --git a/src/index.ts b/src/index.ts index 9871190..bb9d04c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -3,16 +3,16 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ import { iterate } from "iterare" -import { Aff, OverridableAffData } from "./aff/index" -import { decoder } from "./constants" -import { Dic, Word } from "./dic/index" -import { Lookup } from "./lookup" -import { Reader } from "./reader" -import { Suggest } from "./suggest" -import { concat } from "./util" - -export type { AffData, Flag, Flags, FlagSet, OverridableAffData } from "./aff" -export type { LookupResult } from "./lookup" +import { Aff, OverridableAffData } from "./aff/index.js" +import { decoder } from "./constants.js" +import { Dic, Word } from "./dic/index.js" +import { Lookup } from "./lookup/index.js" +import { Reader } from "./reader.js" +import { Suggest } from "./suggest/index.js" +import { concat } from "./util.js" + +export type { AffData, Flag, Flags, FlagSet, OverridableAffData } from "./aff/index.js" +export type { LookupResult } from "./lookup/index.js" export interface EspellsInitOpts { /** Source of a `.aff` affix file. */ diff --git a/src/lookup/affixes.ts b/src/lookup/affixes.ts index 2e8f2cb..84220e3 100644 --- a/src/lookup/affixes.ts +++ b/src/lookup/affixes.ts @@ -2,13 +2,13 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -import { CapType, CompoundPos } from "../constants" -import type { Word } from "../dic" -import { includes, lowercase } from "../util" -import { decompose } from "./decompose" -import type { AffixForm } from "./forms" -import { LKFlags } from "./lk-flags" -import type { LKWord } from "./lk-word" +import { CapType, CompoundPos } from "../constants.js" +import type { Word } from "../dic/index.js" +import { includes, lowercase } from "../util.js" +import { decompose } from "./decompose.js" +import type { AffixForm } from "./forms.js" +import { LKFlags } from "./lk-flags.js" +import type { LKWord } from "./lk-word.js" /** * Yields the allowed {@link AffixForm}s for this word, as in all ways the diff --git a/src/lookup/compounds.ts b/src/lookup/compounds.ts index 4a44c70..529e572 100644 --- a/src/lookup/compounds.ts +++ b/src/lookup/compounds.ts @@ -2,16 +2,16 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -import type { Flags } from "../aff" -import type { CompoundRule } from "../aff/compound-rule" -import { CapType, CompoundPos } from "../constants" -import { Word } from "../dic" -import { replchars } from "../permutations" -import { any, isTriplet, isUppercased } from "../util" -import { affixForms } from "./affixes" -import { AffixForm } from "./forms" -import { LKFlags } from "./lk-flags" -import type { LKWord } from "./lk-word" +import type { CompoundRule } from "../aff/compound-rule.js" +import type { Flags } from "../aff/index.js" +import { CapType, CompoundPos } from "../constants.js" +import { Word } from "../dic/index.js" +import { replchars } from "../permutations.js" +import { any, isTriplet, isUppercased } from "../util.js" +import { affixForms } from "./affixes.js" +import { AffixForm } from "./forms.js" +import { LKFlags } from "./lk-flags.js" +import type { LKWord } from "./lk-word.js" /** * A hypothesis of how a compound word may be constructed, using an array diff --git a/src/lookup/decompose.ts b/src/lookup/decompose.ts index 5583a87..7e0f8d0 100644 --- a/src/lookup/decompose.ts +++ b/src/lookup/decompose.ts @@ -2,12 +2,12 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -import type { Aff } from "../aff" -import { CompoundPos } from "../constants" -import { concat, reverse } from "../util" -import { AffixForm } from "./forms" -import type { LKFlags } from "./lk-flags" -import type { LKWord } from "./lk-word" +import type { Aff } from "../aff/index.js" +import { CompoundPos } from "../constants.js" +import { concat, reverse } from "../util.js" +import { AffixForm } from "./forms.js" +import type { LKFlags } from "./lk-flags.js" +import type { LKWord } from "./lk-word.js" export const enum AffixType { PREFIX, diff --git a/src/lookup/forms.ts b/src/lookup/forms.ts index e73036d..a37c990 100644 --- a/src/lookup/forms.ts +++ b/src/lookup/forms.ts @@ -2,10 +2,10 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -import type { Prefix, Suffix } from "../aff/affix" -import type { Word } from "../dic/word" -import { concat } from "../util" -import { LKWord } from "./lk-word" +import type { Prefix, Suffix } from "../aff/affix.js" +import type { Word } from "../dic/word.js" +import { concat } from "../util.js" +import { LKWord } from "./lk-word.js" export interface AffixFormOpts { /** Outermost prefix. */ diff --git a/src/lookup/index.ts b/src/lookup/index.ts index 4bf6d84..4f11acd 100644 --- a/src/lookup/index.ts +++ b/src/lookup/index.ts @@ -3,14 +3,14 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ import { iterate } from "iterare" -import type { Aff } from "../aff" -import { CapType, CONSTANTS as C } from "../constants" -import type { Dic } from "../dic" -import { any, includes } from "../util" -import { affixForms as affixes } from "./affixes" -import { compoundForms as compounds } from "./compounds" -import { breakWord } from "./decompose" -import { LKWord } from "./lk-word" +import type { Aff } from "../aff/index.js" +import { CapType, CONSTANTS as C } from "../constants.js" +import type { Dic } from "../dic/index.js" +import { any, includes } from "../util.js" +import { affixForms as affixes } from "./affixes.js" +import { compoundForms as compounds } from "./compounds.js" +import { breakWord } from "./decompose.js" +import { LKWord } from "./lk-word.js" /** The resulting data returned from executing a lookup. */ export interface LookupResult { diff --git a/src/lookup/lk-flags.ts b/src/lookup/lk-flags.ts index 92c2f27..53ad9cd 100644 --- a/src/lookup/lk-flags.ts +++ b/src/lookup/lk-flags.ts @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -import type { Flags } from "../aff" +import type { Flags } from "../aff/index.js" export type LKFlagsOpts = { prefix?: Flags; suffix?: Flags; forbidden?: Flags } diff --git a/src/lookup/lk-word.ts b/src/lookup/lk-word.ts index e7011c1..43e17ec 100644 --- a/src/lookup/lk-word.ts +++ b/src/lookup/lk-word.ts @@ -2,9 +2,9 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -import type { Aff } from "../aff" -import type { CapType, CompoundPos } from "../constants" -import type { Dic } from "../dic" +import type { Aff } from "../aff/index.js" +import type { CapType, CompoundPos } from "../constants.js" +import type { Dic } from "../dic/index.js" /** * A word (a string) wrapped with metadata. Can be iterated, and will diff --git a/src/permutations.ts b/src/permutations.ts index 9a294cf..2319b32 100644 --- a/src/permutations.ts +++ b/src/permutations.ts @@ -2,10 +2,10 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -import type { CharacterMap } from "./aff" -import type { RepPattern } from "./aff/rep-pattern" -import { CONSTANTS as C } from "./constants" -import { replaceRange, uppercase } from "./util" +import type { CharacterMap } from "./aff/index.js" +import type { RepPattern } from "./aff/rep-pattern.js" +import { CONSTANTS as C } from "./constants.js" +import { replaceRange, uppercase } from "./util.js" /** * Uses a {@link Aff}'s {@link RepPattern} table to yield replaced diff --git a/src/reader.ts b/src/reader.ts index 2a00541..35f5a95 100644 --- a/src/reader.ts +++ b/src/reader.ts @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -import { decoder } from "./constants" +import { decoder } from "./constants.js" /** Wrapper for manipulating a document separated by lines. */ export class Reader { diff --git a/src/suggest/index.ts b/src/suggest/index.ts index 9707806..37fd7c2 100644 --- a/src/suggest/index.ts +++ b/src/suggest/index.ts @@ -3,11 +3,11 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ import { iterate } from "iterare" -import type { Aff } from "../aff" -import { CapType, CONSTANTS as C, GOOD_EDITS, SuggestionKind } from "../constants" -import type { Dic } from "../dic" -import type { Word } from "../dic/word" -import type { Lookup } from "../lookup" +import type { Aff } from "../aff/index.js" +import { CapType, CONSTANTS as C, GOOD_EDITS, SuggestionKind } from "../constants.js" +import type { Dic } from "../dic/index.js" +import type { Word } from "../dic/word.js" +import type { Lookup } from "../lookup/index.js" import { badchar, badcharkey, @@ -20,11 +20,11 @@ import { replchars, swapchar, twowords -} from "../permutations" -import { intersect, limit, lowercase, uppercase } from "../util" -import { NgramSuggestionBuilder } from "./ngram" -import { PhonetSuggestionBuilder } from "./phonet" -import { MultiWordSuggestion, Suggestion } from "./suggestion" +} from "../permutations.js" +import { intersect, limit, lowercase, uppercase } from "../util.js" +import { NgramSuggestionBuilder } from "./ngram.js" +import { PhonetSuggestionBuilder } from "./phonet.js" +import { MultiWordSuggestion, Suggestion } from "./suggestion.js" /** * Represents a {@link Suggest} function that "handles" potential diff --git a/src/suggest/ngram.ts b/src/suggest/ngram.ts index 4e4de51..6a270a2 100644 --- a/src/suggest/ngram.ts +++ b/src/suggest/ngram.ts @@ -3,16 +3,16 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ import { iterate } from "iterare" -import { CONSTANTS as C } from "../constants" -import type { Word } from "../dic/word" -import { lowercase } from "../util" +import { CONSTANTS as C } from "../constants.js" +import type { Word } from "../dic/word.js" +import { lowercase } from "../util.js" import { preciseAffixScore, rootScore, roughAffixScore, ScoresList, scoreThreshold -} from "./scores" +} from "./scores.js" export class NgramSuggestionBuilder { /** The "root" scores for potential suggestions for a misspelling. */ diff --git a/src/suggest/phonet.ts b/src/suggest/phonet.ts index c4d2019..617c6cb 100644 --- a/src/suggest/phonet.ts +++ b/src/suggest/phonet.ts @@ -2,11 +2,11 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -import type { PhonetTable } from "../aff/phonet-table" -import { CONSTANTS as C } from "../constants" -import type { Word } from "../dic/word" -import { lowercase, ngram } from "../util" -import { finalScore, rootScore, ScoresList } from "./scores" +import type { PhonetTable } from "../aff/phonet-table.js" +import { CONSTANTS as C } from "../constants.js" +import type { Word } from "../dic/word.js" +import { lowercase, ngram } from "../util.js" +import { finalScore, rootScore, ScoresList } from "./scores.js" /** * Builder for phonetic suggestions. diff --git a/src/suggest/scores.ts b/src/suggest/scores.ts index dcd5706..1755d22 100644 --- a/src/suggest/scores.ts +++ b/src/suggest/scores.ts @@ -3,8 +3,14 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ import { iterate } from "iterare" -import { PriorityList } from "../plist" -import { commonCharacters, lcslen, leftCommonSubstring, lowercase, ngram } from "../util" +import { PriorityList } from "../plist.js" +import { + commonCharacters, + lcslen, + leftCommonSubstring, + lowercase, + ngram +} from "../util.js" /** An entry in a {@link ScoresList}. */ export type ScoreEntry = [number, ...T] diff --git a/src/suggest/suggestion.ts b/src/suggest/suggestion.ts index fdf0baf..edee74a 100644 --- a/src/suggest/suggestion.ts +++ b/src/suggest/suggestion.ts @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -import type { SuggestionKind } from "../constants" +import type { SuggestionKind } from "../constants.js" /** The object that the {@link Suggest} class uses internally for tracking suggestions. */ export class Suggestion { diff --git a/src/util.ts b/src/util.ts index 30abc82..37acd6a 100644 --- a/src/util.ts +++ b/src/util.ts @@ -3,7 +3,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ import { iterate } from "iterare" -import { CONSTANTS as C } from "./constants" +import { CONSTANTS as C } from "./constants.js" /** * Creates a `RegExp` using a string template. Supports flags.