-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
23 additions
and
2 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+1 MB
.yarn/cache/@rollup-rollup-win32-arm64-msvc-npm-4.12.0-c2287b809a-10.zip
Binary file not shown.
Binary file added
BIN
+1.12 MB
.yarn/cache/@rollup-rollup-win32-x64-msvc-npm-4.12.0-b21d4991d2-10.zip
Binary file not shown.
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,7 +1,12 @@ | ||
import { createRequire } from "node:module"; | ||
import { normalizeImportPath } from "./path.js"; | ||
|
||
const require = createRequire(import.meta.url); | ||
|
||
/** | ||
* Dead simple wrapper around import function to make it possible to mock it in the tests | ||
* @param path | ||
*/ | ||
export const importWrapper = async (path: string) => { | ||
return import(path); | ||
return import(normalizeImportPath(require.resolve(path))); | ||
}; |
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,9 @@ | ||
import { pathToFileURL } from "node:url"; | ||
|
||
/** | ||
* The function appends `file:///` protocol to the absolute paths on Windows due to ES modules imports specifics | ||
* @param path | ||
*/ | ||
export const normalizeImportPath = (path: string) => { | ||
return pathToFileURL(path).href; | ||
}; |