-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: determine local Svelte version more reliably (#12350)
* fix: determine local Svelte version more reliably * fix CI * DRY out * fix * lint * gah * oops * lint
- Loading branch information
1 parent
356dc30
commit 835ebf6
Showing
6 changed files
with
45 additions
and
23 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@sveltejs/kit': patch | ||
--- | ||
|
||
fix: determine local Svelte version more reliably |
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
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,19 @@ | ||
import * as imr from 'import-meta-resolve'; | ||
import { pathToFileURL } from 'node:url'; | ||
|
||
/** | ||
* Resolve a dependency relative to the current working directory, | ||
* rather than relative to this package | ||
* @param {string} dependency | ||
*/ | ||
export function resolve_peer_dependency(dependency) { | ||
try { | ||
// @ts-expect-error the types are wrong | ||
const resolved = imr.resolve(dependency, pathToFileURL(process.cwd() + '/dummy.js')); | ||
return import(resolved); | ||
} catch { | ||
throw new Error( | ||
`Could not resolve peer dependency "${dependency}" relative to your project — please install it and try again.` | ||
); | ||
} | ||
} |
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