mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-31 20:28:09 +01:00
fix(unplugin): invalid url schema on windows (#2899)
This commit is contained in:
committed by
GitHub
parent
4c5a4fb526
commit
9b4694f8d9
@@ -1,5 +1,5 @@
|
|||||||
import type { UnpluginOptions } from 'unplugin'
|
import type { UnpluginOptions } from 'unplugin'
|
||||||
import { join, normalize } from 'pathe'
|
import { normalize } from 'pathe'
|
||||||
import { resolvePathSync } from 'mlly'
|
import { resolvePathSync } from 'mlly'
|
||||||
import MagicString from 'magic-string'
|
import MagicString from 'magic-string'
|
||||||
|
|
||||||
@@ -9,7 +9,7 @@ import { runtimeDir } from '../unplugin'
|
|||||||
* This plugin normalises Nuxt environment (#imports) and `import.meta.client` within the Nuxt UI components.
|
* This plugin normalises Nuxt environment (#imports) and `import.meta.client` within the Nuxt UI components.
|
||||||
*/
|
*/
|
||||||
export default function NuxtEnvironmentPlugin() {
|
export default function NuxtEnvironmentPlugin() {
|
||||||
const stubPath = resolvePathSync(join(runtimeDir, 'vue/stubs'), { extensions: ['.ts', '.mjs', '.js'] })
|
const stubPath = resolvePathSync('../runtime/vue/stubs', { extensions: ['.ts', '.mjs', '.js'], url: import.meta.url })
|
||||||
|
|
||||||
return {
|
return {
|
||||||
name: 'nuxt:ui',
|
name: 'nuxt:ui',
|
||||||
|
|||||||
@@ -15,9 +15,9 @@ import type { UnpluginOptions } from 'unplugin'
|
|||||||
export default function PluginsPlugin(options: NuxtUIOptions) {
|
export default function PluginsPlugin(options: NuxtUIOptions) {
|
||||||
const plugins = globSync(['**/*', '!*.d.ts'], { cwd: join(runtimeDir, 'plugins'), absolute: true })
|
const plugins = globSync(['**/*', '!*.d.ts'], { cwd: join(runtimeDir, 'plugins'), absolute: true })
|
||||||
|
|
||||||
plugins.unshift(resolvePathSync(join(runtimeDir, 'vue/plugins/head'), { extensions: ['.ts', '.mjs', '.js'] }))
|
plugins.unshift(resolvePathSync('../runtime/vue/plugins/head', { extensions: ['.ts', '.mjs', '.js'], url: import.meta.url }))
|
||||||
if (options.colorMode) {
|
if (options.colorMode) {
|
||||||
plugins.push(resolvePathSync(join(runtimeDir, 'vue/plugins/color-mode'), { extensions: ['.ts', '.mjs', '.js'] }))
|
plugins.push(resolvePathSync('../runtime/vue/plugins/color-mode', { extensions: ['.ts', '.mjs', '.js'], url: import.meta.url }))
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { fileURLToPath } from 'node:url'
|
import { fileURLToPath } from 'node:url'
|
||||||
|
|
||||||
import { join } from 'pathe'
|
import { join, normalize } from 'pathe'
|
||||||
import { createUnplugin } from 'unplugin'
|
import { createUnplugin } from 'unplugin'
|
||||||
import AutoImport from 'unplugin-auto-import'
|
import AutoImport from 'unplugin-auto-import'
|
||||||
import { defu } from 'defu'
|
import { defu } from 'defu'
|
||||||
@@ -41,7 +41,7 @@ export interface NuxtUIOptions extends Omit<ModuleOptions, 'fonts' | 'colorMode'
|
|||||||
colorMode?: boolean
|
colorMode?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export const runtimeDir = fileURLToPath(new URL('./runtime', import.meta.url))
|
export const runtimeDir = normalize(fileURLToPath(new URL('./runtime', import.meta.url)))
|
||||||
|
|
||||||
export const NuxtUIPlugin = createUnplugin<NuxtUIOptions | undefined>((_options = {}, meta) => {
|
export const NuxtUIPlugin = createUnplugin<NuxtUIOptions | undefined>((_options = {}, meta) => {
|
||||||
const options = defu(_options, { fonts: false, devtools: { enabled: false } }, defaultOptions)
|
const options = defu(_options, { fonts: false, devtools: { enabled: false } }, defaultOptions)
|
||||||
|
|||||||
Reference in New Issue
Block a user