import { pathToFileURL } from 'node:url' import { join } from 'node:path' import fs from 'node:fs' import type { Component } from '@nuxt/schema' import { parseURL } from 'ufo' import { createUnplugin } from 'unplugin' import MagicString from 'magic-string' import { ELEMENT_NODE, parse, walk } from 'ultrahtml' import { hash } from 'ohash' import { resolvePath } from '@nuxt/kit' import { isVue } from '../core/utils' interface ServerOnlyComponentTransformPluginOptions { getComponents: () => Component[] /** * passed down to `NuxtTeleportSsrClient` * should be done only in dev mode as we use build:manifest result in production */ rootDir?: string isDev?: boolean /** * allow using `nuxt-client` attribute on components */ selectiveClient?: boolean } interface ComponentChunkOptions { getComponents: () => Component[] buildDir: string } const SCRIPT_RE = /]*>/g const HAS_SLOT_OR_CLIENT_RE = /(]*>)|(nuxt-client)/ const TEMPLATE_RE = /