Skip to content

Commit 7ee2113

Browse files
committed
chore: apply nodenext module resolution
1 parent db0178c commit 7ee2113

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+172
-156
lines changed

docs/zhlint.es.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/hypers/hexo.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ParsedStatus } from './types'
1+
import { ParsedStatus } from './types.js'
22

33
// {% x y %}z{% endx %}
44
// \{\% ([^ ]+?) [^\%]*?\%\} ([^ ]+?) [^\%]*?

src/hypers/ignore.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { IgnoredCase } from '../ignore'
2-
import { ParsedStatus } from './types'
1+
import { IgnoredCase } from '../ignore.js'
2+
import { ParsedStatus } from './types.js'
33

44
const ignoredCaseMatcher =
55
/^(?:(?<prefix>.+?)-,)?(?<textStart>.+?)(?:,(?<textEnd>.+?))?(?:,-(?<suffix>.+?))?$/

src/hypers/md.ts

+8-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,14 @@ import gfm from 'remark-gfm'
44
import frontmatter from 'remark-frontmatter'
55
import * as Ast from 'mdast'
66
import { Node, Position } from 'unist'
7-
import { isRawMark, Mark, MarkSideType, MarkType, RawMark } from '../parser'
8-
import { Block, ParsedStatus } from './types'
7+
import {
8+
isRawMark,
9+
Mark,
10+
MarkSideType,
11+
MarkType,
12+
RawMark
13+
} from '../parser/index.js'
14+
import { Block, ParsedStatus } from './types.js'
915

1016
// Position related
1117

src/hypers/types.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import type { IgnoredCase } from '../ignore'
2-
import type { Mark, MutableParseResult } from '../parser'
1+
import type { IgnoredCase } from '../ignore.js'
2+
import type { Mark, MutableParseResult } from '../parser/index.js'
33

44
export type ParserIgnoredCase = {
55
name: string

src/hypers/vuepress.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ParsedStatus } from './types'
1+
import { ParsedStatus } from './types.js'
22

33
// TODO: ::: tips 提示...
44
//

src/ignore.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { env } from './report'
1+
import { env } from './report.js'
22

33
// Ref: https://github.com/WICG/ScrollToTextFragment
44
export type IgnoredCase = {

src/index.ts

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
export { run, runWithConfig } from './run'
2-
export { report } from './report'
3-
export { readRc } from './rc'
1+
export { run, runWithConfig } from './run.js'
2+
export { report } from './report.js'
3+
export { readRc } from './rc/index.js'
44

5-
export type { Result } from './run'
6-
export type { Options } from './options'
7-
export type { Config } from './rc'
8-
export type { Validation, ValidationTarget } from './report'
9-
export type { IgnoredCase } from './ignore'
10-
export type { ParsedStatus, Block, ParserIgnoredCase } from './hypers/types'
5+
export type { Result } from './run.js'
6+
export type { Options } from './options.js'
7+
export type { Config } from './rc/index.js'
8+
export type { Validation, ValidationTarget } from './report.js'
9+
export type { IgnoredCase } from './ignore.js'
10+
export type { ParsedStatus, Block, ParserIgnoredCase } from './hypers/types.js'
1111
export type {
1212
Handler,
1313
Token,
@@ -17,4 +17,4 @@ export type {
1717
SingleTokenType,
1818
Mark,
1919
MarkType
20-
} from './parser'
20+
} from './parser/index.js'

src/join.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { IgnoredMark } from './ignore'
2-
import { Validation, ValidationTarget } from './report'
1+
import { IgnoredMark } from './ignore.js'
2+
import { Validation, ValidationTarget } from './report.js'
33
import {
44
MutableGroupToken as GroupToken,
55
MutableToken as Token
6-
} from './parser'
6+
} from './parser/index.js'
77

88
const isInRange = (start: number, end: number, mark: IgnoredMark) => {
99
return start <= mark.end && end >= mark.start

src/options.ts

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { ParsedStatus } from './hypers/types'
2-
import { IgnoredCase } from './ignore'
3-
import { Options as RuleOptions } from './rules/util'
1+
import { ParsedStatus } from './hypers/types.js'
2+
import { IgnoredCase } from './ignore.js'
3+
import { Options as RuleOptions } from './rules/util.js'
44

55
export type Options = {
66
logger?: Console
@@ -18,15 +18,15 @@ export type NormalizedOptions = {
1818
ignoredCases: IgnoredCase[]
1919
}
2020

21-
import ignore, { parseIngoredCase } from './hypers/ignore'
22-
import hexo from './hypers/hexo'
23-
import vuepress from './hypers/vuepress'
24-
import md from './hypers/md'
21+
import ignore, { parseIngoredCase } from './hypers/ignore.js'
22+
import hexo from './hypers/hexo.js'
23+
import vuepress from './hypers/vuepress.js'
24+
import md from './hypers/md.js'
2525

26-
import { defaultConfig as defaultRules } from './rules'
26+
import { defaultConfig as defaultRules } from './rules/index.js'
2727

28-
import { env } from './report'
29-
import { Config } from './rc'
28+
import { env } from './report.js'
29+
import { Config } from './rc/index.js'
3030

3131
const hyperParseInfo = [
3232
{ name: 'ignore', value: ignore },

src/parser/char.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { CharType } from './types'
1+
import { CharType } from './types.js'
22

33
/**
44
* NOTE:

src/parser/index.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
export * from './types'
2-
export { ParseResult, MutableParseResult } from './parse'
3-
export { Handler } from './travel'
1+
export * from './types.js'
2+
export { ParseResult, MutableParseResult } from './parse.js'
3+
export { Handler } from './travel.js'
44

5-
export { checkCharType } from './char'
6-
export { parse, toMutableResult } from './parse'
7-
export { travel } from './travel'
5+
export { checkCharType } from './char.js'
6+
export { parse, toMutableResult } from './parse.js'
7+
export { travel } from './travel.js'

src/parser/parse.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { Validation } from '../report'
2-
import { checkCharType } from './char'
1+
import { Validation } from '../report.js'
2+
import { checkCharType } from './char.js'
33
import {
44
CharType,
55
isLetterType,
@@ -14,7 +14,7 @@ import {
1414
MutableToken,
1515
Token,
1616
GroupToken
17-
} from './types'
17+
} from './types.js'
1818
import {
1919
handleLetter,
2020
handlePunctuation,
@@ -28,8 +28,8 @@ import {
2828
initNewStatus,
2929
isShorthand,
3030
handleErrors
31-
} from './util'
32-
import { Options as RuleOptions } from '../rules/util'
31+
} from './util.js'
32+
import { Options as RuleOptions } from '../rules/util.js'
3333

3434
export type ParseStatus = {
3535
lastToken?: Token

src/parser/travel.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { MutableGroupToken, GroupToken, MutableToken, Token } from './types'
1+
import { MutableGroupToken, GroupToken, MutableToken, Token } from './types.js'
22

33
export type Handler = (
44
token: MutableToken | Token,

src/parser/types.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* - Tokens
1010
*/
1111

12-
import { Validation } from '../report'
12+
import { Validation } from '../report.js'
1313

1414
// Char
1515

src/parser/util.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { ValidationTarget } from '../report'
2-
import { checkCharType } from './char'
1+
import { ValidationTarget } from '../report.js'
2+
import { checkCharType } from './char.js'
33
import {
44
BRACKET_NOT_CLOSED,
55
BRACKET_NOT_OPEN,
66
QUOTATION_NOT_CLOSED,
77
QUOTATION_NOT_OPEN
8-
} from './messages'
8+
} from './messages.js'
99
import {
1010
CharType,
1111
SHORTHAND_CHARS,
@@ -26,8 +26,8 @@ import {
2626
SinglePunctuationType,
2727
isBracketType,
2828
isQuotationType
29-
} from './types'
30-
import { ParseStatus } from './parse'
29+
} from './types.js'
30+
import { ParseStatus } from './parse.js'
3131

3232
export const handlePunctuation = (
3333
i: number,

src/rc/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { Options } from '../options'
1+
import { Options } from '../options.js'
22

33
import { resolve } from 'path'
44
import fs from 'fs'
55

6-
import { env } from '../report'
6+
import { env } from '../report.js'
77

88
// to walk around https://github.com/davidmyersdev/vite-plugin-node-polyfills/issues/82
99
const { existsSync, readFileSync } = fs || {}

src/replace-block.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { ParsedBlock } from './hypers/types'
1+
import type { ParsedBlock } from './hypers/types.js'
22

33
export type Piece = ParsedBlock | NonBlock
44

src/report.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
checkCharType,
55
isFullwidthPunctuationType,
66
isHalfwidthPunctuationType
7-
} from './parser'
7+
} from './parser/index.js'
88

99
export const env: {
1010
stdout: NodeJS.WritableStream

src/rules/case-abbrs.ts

+8-3
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,19 @@
77
* - the point is rever the trailing dot
88
*/
99

10-
import { CharType, Handler, MutableGroupToken, MutableToken } from '../parser'
11-
import { ValidationTarget } from '../report'
10+
import {
11+
CharType,
12+
Handler,
13+
MutableGroupToken,
14+
MutableToken
15+
} from '../parser/index.js'
16+
import { ValidationTarget } from '../report.js'
1217
import {
1318
findTokenAfter,
1419
findTokenBefore,
1520
Options,
1621
removeValidationOnTarget
17-
} from './util'
22+
} from './util.js'
1823

1924
const defaultSkippedAbbrs = [
2025
'Mr.',

src/rules/case-html-entity.ts

+8-3
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,20 @@
77
* - to match `&<half-width-content>;`
88
*/
99

10-
import { CharType, Handler, MutableGroupToken, MutableToken } from '../parser'
11-
import { ValidationTarget } from '../report'
10+
import {
11+
CharType,
12+
Handler,
13+
MutableGroupToken,
14+
MutableToken
15+
} from '../parser/index.js'
16+
import { ValidationTarget } from '../report.js'
1217
import {
1318
findWrappersBetween,
1419
findNonCodeVisibleTokenAfter,
1520
findTokenAfter,
1621
Options,
1722
removeValidationOnTarget
18-
} from './util'
23+
} from './util.js'
1924

2025
const generateHandler = (options: Options): Handler => {
2126
options

src/rules/case-linebreak.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77

88
// TODO: better blockquote and indentation handling in markdown
99

10-
import { Handler, MutableToken } from '../parser'
11-
import { ValidationTarget } from '../report'
12-
import { Options, removeValidationOnTarget } from './util'
10+
import { Handler, MutableToken } from '../parser/index.js'
11+
import { ValidationTarget } from '../report.js'
12+
import { Options, removeValidationOnTarget } from './util.js'
1313

1414
const generateHandler = (options: Options): Handler => {
1515
// do nothing

src/rules/case-pure-western.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ import {
1414
MutableToken,
1515
GroupTokenType,
1616
isFullwidthType
17-
} from '../parser'
18-
import { ValidationTarget } from '../report'
19-
import { Options, removeValidationOnTarget } from './util'
17+
} from '../parser/index.js'
18+
import { ValidationTarget } from '../report.js'
19+
import { Options, removeValidationOnTarget } from './util.js'
2020

2121
const findNonWestern = (group: MutableGroupToken): boolean => {
2222
return group.some((token) => {

src/rules/case-zh-units.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ import {
1111
Handler,
1212
MutableGroupToken,
1313
MutableToken
14-
} from '../parser'
15-
import { ValidationTarget } from '../report'
14+
} from '../parser/index.js'
15+
import { ValidationTarget } from '../report.js'
1616
import {
1717
findWrappersBetween,
1818
findNonCodeVisibleTokenAfter,
1919
findNonCodeVisibleTokenBefore,
2020
Options,
2121
removeValidationOnTarget
22-
} from './util'
22+
} from './util.js'
2323

2424
const defaultSkippedZhUnits = `年月日天号时分秒`
2525

src/rules/index.ts

+16-16
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
import { Handler } from '../parser'
2-
import { Options } from './util'
1+
import { Handler } from '../parser/index.js'
2+
import { Options } from './util.js'
33

4-
import genSpaceTrimGenerateHandler from './space-trim'
4+
import genSpaceTrimGenerateHandler from './space-trim.js'
55

6-
import genPunctuationWidthHandler from './punctuation-width'
7-
import genPunctuationUnificationHandler from './punctuation-unification'
6+
import genPunctuationWidthHandler from './punctuation-width.js'
7+
import genPunctuationUnificationHandler from './punctuation-unification.js'
88

9-
import genAbbrsHandler from './case-abbrs'
9+
import genAbbrsHandler from './case-abbrs.js'
1010

11-
import genSpaceOfHyperMarkHandler from './space-hyper-mark'
12-
import genSpaceOfCodeHandler from './space-code'
13-
import genSpaceOfLetterHandler from './space-letter'
14-
import genSpaceOfPunctuationHandler from './space-punctuation'
15-
import genSpaceOfQuotationHandler from './space-quotation'
16-
import genSpaceOfBracketHandler from './space-bracket'
11+
import genSpaceOfHyperMarkHandler from './space-hyper-mark.js'
12+
import genSpaceOfCodeHandler from './space-code.js'
13+
import genSpaceOfLetterHandler from './space-letter.js'
14+
import genSpaceOfPunctuationHandler from './space-punctuation.js'
15+
import genSpaceOfQuotationHandler from './space-quotation.js'
16+
import genSpaceOfBracketHandler from './space-bracket.js'
1717

18-
import genLinebreakHandler from './case-linebreak'
19-
import genZhUnitsHandler from './case-zh-units'
20-
import genHtmlEntityHandler from './case-html-entity'
18+
import genLinebreakHandler from './case-linebreak.js'
19+
import genZhUnitsHandler from './case-zh-units.js'
20+
import genHtmlEntityHandler from './case-html-entity.js'
2121

22-
import genSkipPureWesternHandler from './case-pure-western'
22+
import genSkipPureWesternHandler from './case-pure-western.js'
2323

2424
const generateHandlers = (options: Options): Handler[] => {
2525
return [

src/rules/punctuation-unification.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
* - unifiedPunctuation: "traditional" | "simplified" | Record<string, boolean | string[]> & { default: boolean }
99
*/
1010

11-
import { GroupTokenType, Handler, MutableToken } from '../parser'
12-
import { PUNCTUATION_UNIFICATION } from './messages'
13-
import { checkEndValue, checkStartValue, checkValue, Options } from './util'
11+
import { GroupTokenType, Handler, MutableToken } from '../parser/index.js'
12+
import { PUNCTUATION_UNIFICATION } from './messages.js'
13+
import { checkEndValue, checkStartValue, checkValue, Options } from './util.js'
1414

1515
const defaultUnifiedMap: Record<string, string[]> = {
1616
// U+2047 DOUBLE QUESTION MARK, U+203C DOUBLE EXCLAMATION MARK

0 commit comments

Comments
 (0)