-
Notifications
You must be signed in to change notification settings - Fork 0
chore(deps): bump vite-plus to v0.2.2 #29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,3 @@ | ||
| @jsr:registry=https://npm.jsr.io | ||
| # vite-plus preview build registry bridge (auto-added by vp) | ||
| registry=https://registry-bridge.viteplus.dev/ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| <template> | ||
| <SkeletonBlock class="h-8 w-40 rounded" /> | ||
| <ul class="ms-3 list-disc my-4 ps-6 marker:color-[--border-hover]"> | ||
| <li class="mb-1" v-for="_n in 5"> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| <SkeletonBlock class="h-7 w-full max-w-2xl rounded" /> | ||
| </li> | ||
| </ul> | ||
|
|
||
| <SkeletonBlock class="h-5 w-5/6 max-w-2xl rounded" /> | ||
| <SkeletonBlock class="h-5 w-3/4 max-w-2xl rounded" /> | ||
| </template> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,38 @@ | ||
| import type { ChangelogInfo } from '~~/shared/types/changelog' | ||
|
|
||
| const KEY = 'changelog:has:info' | ||
|
|
||
| export function usePackageChangelog( | ||
| packageName: MaybeRefOrGetter<string | null | undefined>, | ||
| packageName: MaybeRefOrGetter<string>, | ||
| version?: MaybeRefOrGetter<string | null | undefined>, | ||
| ) { | ||
| return useLazyFetch<ChangelogInfo | null>(() => { | ||
| const name = toValue(packageName) | ||
| if (!name) return 'data:application/json,null' // returns null | ||
| const ver = toValue(version) | ||
| return `/api/changelog/info/${name}/v/${ver || 'latest'}` | ||
| }) | ||
| } | ||
|
|
||
| /** | ||
| * check whether the current package & version has changelogs | ||
| * @param setState with `useState` also set the state of `changelog:info` (currently only for packageHeader) | ||
| */ | ||
| export function usePackageHasChangelog( | ||
| packageName: MaybeRefOrGetter<string>, | ||
| version?: MaybeRefOrGetter<string | null | undefined>, | ||
| setState?: boolean, | ||
| ) { | ||
|
Comment on lines
5
to
+24
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When export function usePackageChangelog(
packageName: MaybeRefOrGetter<string | null | undefined>,
version?: MaybeRefOrGetter<string | null | undefined>,
) {
return useLazyFetch<ChangelogInfo | null>(() => {
const name = toValue(packageName)
if (!name) return null
const ver = toValue(version)
return '/api/changelog/info/' + name + '/v/' + (ver || 'latest')
})
}
/**
* check whether the current package & version has changelogs
* @param setState with `useState` also set the state of `changelog:info` (currently only for packageHeader)
*/
export function usePackageHasChangelog(
packageName: MaybeRefOrGetter<string | null | undefined>,
version?: MaybeRefOrGetter<string | null | undefined>,
setState?: boolean,
) { |
||
| const { data } = usePackageChangelog(packageName, version) | ||
| const hasChangelog = computed(() => data.value?.type == 'md' || data.value?.type == 'release') | ||
| if (setState) { | ||
| useState(KEY, () => hasChangelog) | ||
| } | ||
| return hasChangelog | ||
| } | ||
|
|
||
| /** | ||
| * get whether current package has changelog via `useState` (is needed for command pallette) | ||
| */ | ||
| export function usePackageHasChangelogFromState() { | ||
| return useState<boolean>(KEY) | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using
$tdirectly inside the<script setup>block will throw aReferenceError: $t is not definedat runtime because global template helpers are not automatically bound to the script scope. Instead, use theuseI18ncomposable to retrieve thetfunction.