Skip to content

Commit

Permalink
fix(browseify): existsSync error
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon-He95 committed Mar 21, 2024
1 parent edeb0dc commit 4c037fc
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 13 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
},
"dependencies": {
"htmlparser2": "^8.0.1",
"lazy-js-utils": "^0.0.37",
"lazy-js-utils": "workspace:^",
"qrcode": "^1.5.1",
"spark-md5": "^3.0.2"
},
Expand Down
12 changes: 2 additions & 10 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/node/useNodeWorker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { isArray } from '../is/isArray'
import { isStr } from '../is/isStr'
import { parallel } from '../js/parallel'
import type { IShellMessage, NodeWorkerPayload } from '../types'
import { existsSync } from 'node:fs'
import fs from 'node:fs'

type NodeWorkReturn<T> = T extends {
params: string[]
Expand Down Expand Up @@ -33,7 +33,7 @@ export async function useNodeWorker<T extends NodeWorkerPayload | string>(
__dirname,
'../node_modules/lazy-js-utils/dist/worker/useNodeWorkerThread.mjs',
)
if (!existsSync(url)) {
if (!fs.existsSync(url)) {
url = path.resolve(__dirname, './worker/useNodeWorkerThread.mjs')
}
}
Expand Down
24 changes: 24 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
declare global {
interface Window {
webkitRequestAnimationFrame: (callback: FrameRequestCallback) => number
mozRequestAnimationFrame: (callback: FrameRequestCallback) => number
msRequestAnimationFrame: (callback: FrameRequestCallback) => number
oRequestAnimationFrame: (callback: FrameRequestCallback) => number
webkitCancelAnimationFrame: (handle: number) => void
mozCancelAnimationFrame: (handle: number) => void
oCancelAnimationFrame: (handle: number) => void
msCancelAnimationFrame: (handle: number) => void
webkitIndexedDB: IDBFactory
mozIndexedDB: IDBFactory
msIndexedDB: IDBFactory
indexedDB: IDBFactory
SpeechRecognition: any
webkitSpeechRecognition: any
}
interface Navigator {
webkitGetUserMedia: () => void
mozGetUserMedia: () => void
msGetUserMedia: () => void
getUserMedia: () => void
}
}
export type Redirect = 'follow' | 'error' | 'manual'
export type Cache =
| 'default'
Expand Down

0 comments on commit 4c037fc

Please sign in to comment.