fix: opt in to import.meta.* properties (#1561)

Co-authored-by: Benjamin Canac <canacb1@gmail.com>
This commit is contained in:
Daniel Roe
2024-03-25 16:57:58 +00:00
committed by GitHub
parent ae58d5c2b9
commit cc62e345eb
6 changed files with 7 additions and 7 deletions

View File

@@ -12,7 +12,7 @@ export async function fetchComponentMeta (name: string) {
// Store promise to avoid multiple calls
// add to nitro prerender
if (process.server) {
if (import.meta.server) {
const event = useRequestEvent()
event.node.res.setHeader(
'x-nitro-prerender',

View File

@@ -11,7 +11,7 @@ export async function fetchContentExampleCode (name?: string) {
if (state.value[name]) { return state.value[name] }
// add to nitro prerender
if (process.server) {
if (import.meta.server) {
const event = useRequestEvent()
event.node.res.setHeader(
'x-nitro-prerender',

View File

@@ -44,7 +44,7 @@ function createPrettierWorkerApi (worker: Worker): SimplePrettier {
export default defineNuxtPlugin({
async setup () {
let prettier: SimplePrettier
if (process.server) {
if (import.meta.server) {
const prettierModule = await import('prettier')
prettier = {
format (source, options = {

View File

@@ -23,7 +23,7 @@ export default defineNuxtPlugin({
`
})
if (process.client) {
if (import.meta.client) {
watch(root, () => {
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.gray = window.localStorage.getItem('nuxt-ui-gray') || appConfig.ui.gray
}
if (process.server) {
if (import.meta.server) {
useHead({
script: [
{

View File

@@ -3,7 +3,7 @@ import { ref, computed, onMounted } from 'vue'
import type {} from '@vueuse/shared'
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(' ')

View File

@@ -41,7 +41,7 @@ ${Object.entries(gray || colors.cool).map(([key, value]) => `--color-gray-${key}
}
// SPA mode
if (process.client && nuxtApp.isHydrating && !nuxtApp.payload.serverRendered) {
if (import.meta.client && nuxtApp.isHydrating && !nuxtApp.payload.serverRendered) {
const style = document.createElement('style')
style.innerHTML = root.value