Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: remove external from config (#4355)
* chore: remove external from config * simplify named imports * nits * fix: mark fsevents as external * fix: set interop to default * Revert "fix: mark fsevents as external" This reverts commit 4a5fa73. * chore: bump chokidar * simplify alias plugin params * Revert "Revert "fix: mark fsevents as external"" This reverts commit 2ef6c5b. * add bogus types for fsevents * exclude fsevents from import linting * add back comment * bump typescript * re-use env var Co-authored-by: Lukas Taegert-Atkinson <lukastaegert@users.noreply.github.com>
- Loading branch information
1 parent
d1079a3
commit 2256dcd
Showing
7 changed files
with
78 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
let fsEvents: unknown; | ||
import type FsEvents from 'fsevents'; | ||
|
||
let fsEvents: typeof FsEvents; | ||
let fsEventsImportError: Error | undefined; | ||
|
||
export async function loadFsEvents(): Promise<void> { | ||
const moduleName = 'fsevents'; | ||
|
||
try { | ||
({ default: fsEvents } = await import(moduleName)); | ||
({ default: fsEvents } = await import('fsevents')); | ||
} catch (err: any) { | ||
fsEventsImportError = err; | ||
} | ||
} | ||
|
||
// A call to this function will be injected into the chokidar code | ||
export function getFsEvents(): unknown { | ||
export function getFsEvents(): typeof FsEvents { | ||
if (fsEventsImportError) throw fsEventsImportError; | ||
return fsEvents; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// 'fsevents' (which also has typings included) is an optional dependency installed on macOS, | ||
// and not installed on linux/windows. this will provide (bogus) type information for | ||
// linux/windows, and overwrite (replace) the types coming with the 'fsevents' module on macOS | ||
declare module 'fsevents' { | ||
export default {}; | ||
} |