mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-28 19:00:35 +01:00
fix: opt in to import.meta.* properties (#1561)
Co-authored-by: Benjamin Canac <canacb1@gmail.com>
This commit is contained in:
@@ -12,7 +12,7 @@ export async function fetchComponentMeta (name: string) {
|
|||||||
// Store promise to avoid multiple calls
|
// Store promise to avoid multiple calls
|
||||||
|
|
||||||
// add to nitro prerender
|
// add to nitro prerender
|
||||||
if (process.server) {
|
if (import.meta.server) {
|
||||||
const event = useRequestEvent()
|
const event = useRequestEvent()
|
||||||
event.node.res.setHeader(
|
event.node.res.setHeader(
|
||||||
'x-nitro-prerender',
|
'x-nitro-prerender',
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ export async function fetchContentExampleCode (name?: string) {
|
|||||||
if (state.value[name]) { return state.value[name] }
|
if (state.value[name]) { return state.value[name] }
|
||||||
|
|
||||||
// add to nitro prerender
|
// add to nitro prerender
|
||||||
if (process.server) {
|
if (import.meta.server) {
|
||||||
const event = useRequestEvent()
|
const event = useRequestEvent()
|
||||||
event.node.res.setHeader(
|
event.node.res.setHeader(
|
||||||
'x-nitro-prerender',
|
'x-nitro-prerender',
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ function createPrettierWorkerApi (worker: Worker): SimplePrettier {
|
|||||||
export default defineNuxtPlugin({
|
export default defineNuxtPlugin({
|
||||||
async setup () {
|
async setup () {
|
||||||
let prettier: SimplePrettier
|
let prettier: SimplePrettier
|
||||||
if (process.server) {
|
if (import.meta.server) {
|
||||||
const prettierModule = await import('prettier')
|
const prettierModule = await import('prettier')
|
||||||
prettier = {
|
prettier = {
|
||||||
format (source, options = {
|
format (source, options = {
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ export default defineNuxtPlugin({
|
|||||||
`
|
`
|
||||||
})
|
})
|
||||||
|
|
||||||
if (process.client) {
|
if (import.meta.client) {
|
||||||
watch(root, () => {
|
watch(root, () => {
|
||||||
window.localStorage.setItem('nuxt-ui-root', root.value)
|
window.localStorage.setItem('nuxt-ui-root', root.value)
|
||||||
})
|
})
|
||||||
@@ -31,7 +31,7 @@ export default defineNuxtPlugin({
|
|||||||
appConfig.ui.primary = window.localStorage.getItem('nuxt-ui-primary') || appConfig.ui.primary
|
appConfig.ui.primary = window.localStorage.getItem('nuxt-ui-primary') || appConfig.ui.primary
|
||||||
appConfig.ui.gray = window.localStorage.getItem('nuxt-ui-gray') || appConfig.ui.gray
|
appConfig.ui.gray = window.localStorage.getItem('nuxt-ui-gray') || appConfig.ui.gray
|
||||||
}
|
}
|
||||||
if (process.server) {
|
if (import.meta.server) {
|
||||||
useHead({
|
useHead({
|
||||||
script: [
|
script: [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { ref, computed, onMounted } from 'vue'
|
|||||||
import type {} from '@vueuse/shared'
|
import type {} from '@vueuse/shared'
|
||||||
|
|
||||||
export const _useShortcuts = () => {
|
export const _useShortcuts = () => {
|
||||||
const macOS = computed(() => process.client && navigator && navigator.userAgent && navigator.userAgent.match(/Macintosh;/))
|
const macOS = computed(() => import.meta.client && navigator && navigator.userAgent && navigator.userAgent.match(/Macintosh;/))
|
||||||
|
|
||||||
const metaSymbol = ref(' ')
|
const metaSymbol = ref(' ')
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ ${Object.entries(gray || colors.cool).map(([key, value]) => `--color-gray-${key}
|
|||||||
}
|
}
|
||||||
|
|
||||||
// SPA mode
|
// SPA mode
|
||||||
if (process.client && nuxtApp.isHydrating && !nuxtApp.payload.serverRendered) {
|
if (import.meta.client && nuxtApp.isHydrating && !nuxtApp.payload.serverRendered) {
|
||||||
const style = document.createElement('style')
|
const style = document.createElement('style')
|
||||||
|
|
||||||
style.innerHTML = root.value
|
style.innerHTML = root.value
|
||||||
|
|||||||
Reference in New Issue
Block a user