Skip to content

feat: only add vue-demi for vueuse<=11 #7

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions app/layouts/default.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
import { getVersionsBatch } from 'fast-npm-meta'
import semver from 'semver'

// todo: type
const versions = useSessionStorage<any>('versions', [])
const versions = useSessionStorage<any[]>('versions', [])

const loadingVersions = shallowRef(false)

Expand Down
3 changes: 2 additions & 1 deletion app/pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import type { OutputModes } from '@vue/repl'
import type { ShallowRef } from 'vue'
import { mergeImportMap, Repl, useStore, useVueImportMap } from '@vue/repl'
import MonacoEditor from '@vue/repl/monaco-editor'
import semver from 'semver'

const showOutput = useRouteQuery<string, boolean>('showOutput', 'false', { transform: {
get(value) {
Expand Down Expand Up @@ -46,7 +47,7 @@ function generateVueUseImportCDNs() {

const importMap = computed(() => {
return mergeImportMap(builtinImportMap.value, {
imports: Object.fromEntries([...generateVueUseImportCDNs(), ['vue-demi', 'https://cdn.jsdelivr.net/npm/vue-demi@0.14.10/lib/index.mjs']]),
imports: Object.fromEntries([...generateVueUseImportCDNs(), ...(semver.valid(vueuseVersion.value) && semver.major(vueuseVersion.value) <= 11 ? [['vue-demi', 'https://cdn.jsdelivr.net/npm/vue-demi@0.14.10/lib/index.mjs']] : [])]),
})
})

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"scripts": {
"build": "nuxt build",
"dev": "nuxt dev",
"typecheck": "nuxt typecheck",
"generate": "nuxt generate",
"preview": "nuxt preview",
"postinstall": "nuxt prepare",
Expand Down