Skip to content

Commit 4d4dfab

Browse files
committed
fix(types): update paths to support module nodenext
1 parent d8a4aaf commit 4d4dfab

File tree

11 files changed

+31
-85
lines changed

11 files changed

+31
-85
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@
149149
"tsx": "4.19.2",
150150
"typescript": "5.7.3",
151151
"unzipper": "0.12.3",
152-
"vite": "6.0.10"
152+
"vite": "6.0.11"
153153
},
154154
"ava": {
155155
"environmentVariables": {

pnpm-lock.yaml

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/globals/marked.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ _marked.use(
4242
}
4343
}
4444
)
45-
46-
export let marked = (globalThis.marked = _marked)
45+
export let marked = (globalThis.marked = _marked) as typeof _marked
4746

4847
const _md = (markdown: string, containerClasses = "p-5 prose dark:prose-dark"):string => {
4948
let html = ''
@@ -59,4 +58,4 @@ const _md = (markdown: string, containerClasses = "p-5 prose dark:prose-dark"):s
5958
return html
6059
}
6160

62-
export let md = (globalThis.md = _md)
61+
export let md = (globalThis.md = _md) as typeof _md

src/target/app.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3534,4 +3534,4 @@ global.notify = async options => {
35343534
options = { title: options }
35353535
}
35363536
await sendWait(Channel.NOTIFY, options)
3537-
}
3537+
}

src/types/globals.d.ts

Lines changed: 3 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,10 @@
1-
type ReadFileOptions = Parameters<typeof readFile>[1]
1+
type ReadFileOptions = Parameters<typeof import('node:fs/promises').readFile>[1]
22

33
export type EnsureReadFile = (path: string, defaultContent?: string, options?: ReadFileOptions) => Promise<string>
44

55
export type EnsureReadJson =
6-
<T>(path: string, defaultContent: T, options?: Parameters<typeof readJson>[1]) => Promise<T>
6+
<T>(path: string, defaultContent: T, options?: Parameters<typeof import('fs-extra').readJson>[1]) => Promise<T>
77

8-
export type Md = (markdown: string, containerClasses?: string) => string
9-
10-
11-
interface Renderer {
12-
code(code: string, language: string | undefined, isEscaped: boolean): string
13-
blockquote(quote: string): string
14-
html(html: string): string
15-
heading(text: string, level: number, raw: string, slugger: any): string
16-
hr(): string
17-
list(body: string, ordered: boolean, start: number): string
18-
listitem(text: string, task: boolean, checked: boolean): string
19-
checkbox(checked: boolean): string
20-
paragraph(text: string): string
21-
table(header: string, body: string): string
22-
tablerow(content: string): string
23-
tablecell(content: string, flags: { header: boolean; align: string | null }): string
24-
strong(text: string): string
25-
em(text: string): string
26-
codespan(text: string): string
27-
br(): string
28-
del(text: string): string
29-
link(href: string, title: string | null, text: string): string
30-
image(href: string, title: string | null, text: string): string
31-
text(text: string): string
32-
}
33-
34-
interface Hooks {
35-
preprocess(markdown: string): string
36-
postprocess(html: string): string
37-
options?: MarkedOptions
38-
}
39-
40-
interface Tokenizer {
41-
space(src: string): Token | undefined
42-
code(src: string): Token | undefined
43-
fences(src: string): Token | undefined
44-
heading(src: string): Token | undefined
45-
hr(src: string): Token | undefined
46-
blockquote(src: string): Token | undefined
47-
list(src: string): Token | undefined
48-
html(src: string): Token | undefined
49-
def(src: string): Token | undefined
50-
table(src: string): Token | undefined
51-
lheading(src: string): Token | undefined
52-
paragraph(src: string): Token | undefined
53-
text(src: string): Token | undefined
54-
escape(src: string): Token | undefined
55-
tag(src: string): Token | undefined
56-
link(src: string): Token | undefined
57-
reflink(src: string, links: any): Token | undefined
58-
emStrong(src: string, maskedSrc: string, prevChar: string): Token | undefined
59-
}
608

619
declare global {
6210
//process
@@ -156,7 +104,7 @@ declare global {
156104
var compile: typeof import('handlebars').compile
157105

158106
//marked
159-
var md: Md
107+
var md: typeof import('../globals/marked').md
160108
var marked: typeof import('marked').marked
161109
//uuid
162110
var uuid: typeof import('node:crypto').randomUUID

src/types/index.d.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import "./globals.d.ts"
2-
import type { GlobalsApi } from "../globals/index.ts"
32
import type { AppApi } from "./kitapp.ts"
43
import type { KitApi, Run } from "./kit.ts"
54
import type { PackagesApi } from "./packages.ts"
65
import type { PlatformApi } from "./platform.ts"
76
import type { ProAPI } from "./pro.ts"
87

9-
export type GlobalApi = Omit<GlobalsApi, "path"> &
8+
export type GlobalApi =
109
KitApi &
1110
PackagesApi &
1211
PlatformApi &
@@ -18,7 +17,7 @@ declare global {
1817
interface Global extends GlobalApi {}
1918
}
2019

21-
export * from "./core"
22-
export * from "../core/utils"
20+
export type * from "./core.d.ts"
21+
export type * from "../core/utils.d.ts"
2322

2423
export default kit

src/types/io.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { EventEmitter } from "events"
1+
import { EventEmitter } from "node:events"
22
export declare enum EventType {
33
EVENT_KEY_PRESSED = 4,
44
EVENT_KEY_RELEASED = 5,

src/types/kit.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ import type {
1717
Script,
1818
Shortcut,
1919
Flags,
20-
} from "./core"
21-
import { ChannelHandler } from "./core"
20+
} from "./core.js"
21+
import { ChannelHandler } from "./core.js"
2222
import type { ConfigOptions, Options } from "quick-score"
2323

2424
export interface Arg {

src/types/kitapp.d.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ import type { editor } from "./editor.api"
33

44
import {
55
type Key,
6-
Key as CoreKeyEnum,
6+
type Key as CoreKeyEnum,
77
Channel,
88
Mode,
99
type statuses,
1010
type PROMPT as PROMPT_OBJECT,
11-
} from "../core/enum"
11+
} from "../core/enum.js"
1212

1313
import type { AppDb } from "../core/db.js"
1414

@@ -24,12 +24,12 @@ import {
2424
type ScoredChoice,
2525
type Script,
2626
type Shortcut,
27-
} from "./core"
27+
} from "./core.js"
2828
import type {
2929
BrowserWindowConstructorOptions,
3030
Display,
3131
Rectangle,
32-
} from "./electron"
32+
} from "./electron.js"
3333

3434
import type { Trash } from "./packages"
3535
import type { marked } from "../globals/marked.ts"
@@ -38,11 +38,11 @@ import type {
3838
UiohookKeyboardEvent,
3939
UiohookMouseEvent,
4040
UiohookWheelEvent,
41-
} from "./io"
42-
import type { FileSearchOptions } from "./platform"
41+
} from "./io.js"
42+
import type { FileSearchOptions } from "./platform.js"
4343
import { ReadStream, WriteStream } from "node:fs"
44-
import type { NotificationConstructorOptions } from "./notify"
45-
import type { ShebangConfig } from "../core/shebang"
44+
import type { NotificationConstructorOptions } from "./notify.js"
45+
import type { ShebangConfig } from "../core/shebang.js"
4646

4747
export type Status = (typeof statuses)[number]
4848

src/types/platform.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import type { ProcessInfo } from './core'
2-
import type { Display, Point } from './electron'
1+
import type { ProcessInfo } from './core.js'
2+
import type { Display, Point } from './electron.js'
33
import type { BrowserContextOptions, Page, PageScreenshotOptions } from 'playwright'
44

55
type PlayAudioFile = (path: string, options?: any) => Promise<string>

0 commit comments

Comments
 (0)