chore: update to use @nuxt/eslint-config (#24209)

Co-authored-by: Damian Głowala <damian.glowala.rebkow@gmail.com>
This commit is contained in:
Daniel Roe 2023-11-09 18:01:13 +01:00 committed by GitHub
parent c3cf55d963
commit c1ddb359e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
72 changed files with 596 additions and 365 deletions

View File

@ -1,23 +1,19 @@
{
"$schema": "https://json.schemastore.org/eslintrc",
"ignorePatterns": [
"dist",
"public",
"node_modules",
"packages/schema/schema",
"**/*.tmpl.*",
"sw.js"
"packages/schema/schema"
],
"$schema": "https://json.schemastore.org/eslintrc",
"globals": {
"NodeJS": true,
"$fetch": true
},
"plugins": [
"jsdoc",
"no-only-tests"
],
"plugins": ["jsdoc", "import", "unicorn", "no-only-tests"],
"extends": [
"plugin:jsdoc/recommended",
"@nuxtjs/eslint-config-typescript",
"@nuxt/eslint-config",
"plugin:import/typescript"
],
"rules": {
@ -30,16 +26,49 @@
"no-only-tests/no-only-tests": "error",
"unicorn/prefer-node-protocol": "error",
"no-console": "warn",
"vue/multi-word-component-names": "off",
"vue/one-component-per-file": "off",
"vue/require-default-prop": "off",
"vue/no-multiple-template-root": "off",
"vue/no-v-model-argument": "off",
// Vue stylistic rules from `@antfu/eslint-config`
"vue/array-bracket-spacing": ["error", "never"],
"vue/arrow-spacing": ["error", { "after": true, "before": true }],
"vue/block-spacing": ["error", "always"],
"vue/block-tag-newline": [
"error",
{
"multiline": "always",
"singleline": "always"
}
],
"vue/brace-style": ["error", "stroustrup", { "allowSingleLine": true }],
"vue/comma-dangle": ["error", "always-multiline"],
"vue/comma-spacing": ["error", { "after": true, "before": false }],
"vue/comma-style": ["error", "last"],
"vue/html-comment-content-spacing": [
"error",
"always",
{
"exceptions": ["-"]
}
],
"vue/key-spacing": ["error", { "afterColon": true, "beforeColon": false }],
"vue/keyword-spacing": ["error", { "after": true, "before": true }],
"vue/object-curly-newline": "off",
"vue/object-curly-spacing": ["error", "always"],
"vue/object-property-newline": [
"error",
{ "allowMultiplePropertiesPerLine": true }
],
"vue/operator-linebreak": ["error", "before"],
"vue/padding-line-between-blocks": ["error", "always"],
"vue/quote-props": ["error", "consistent-as-needed"],
"vue/space-in-parens": ["error", "never"],
"vue/template-curly-spacing": "error",
"jsdoc/require-jsdoc": "off",
"jsdoc/require-param": "off",
"jsdoc/require-returns": "off",
"jsdoc/require-param-type": "off",
"no-redeclare": "off",
"import/order": [
"error",
{
@ -103,36 +132,25 @@
"jsdoc/check-tag-names": [
"error",
{
"definedTags": [
"__NO_SIDE_EFFECTS__"
]
"definedTags": ["__NO_SIDE_EFFECTS__"]
}
]
},
"overrides": [
{
"files": [
"packages/schema/**"
],
"files": ["packages/schema/**"],
"rules": {
"jsdoc/no-undefined-types": "off",
"jsdoc/valid-types": "off",
"jsdoc/check-tag-names": [
"error",
{
"definedTags": [
"experimental"
]
"definedTags": ["experimental"]
}
]
}
},
{
"files": [
"packages/nuxt/src/app/**",
"test/**",
"**/runtime/**"
],
"files": ["packages/nuxt/src/app/**", "test/**", "**/runtime/**"],
"rules": {
"no-console": "off"
}

View File

@ -40,9 +40,9 @@
"magic-string": "^0.30.5"
},
"devDependencies": {
"@nuxt/eslint-config": "^0.2.0",
"@nuxt/test-utils": "3.8.1",
"@nuxt/webpack-builder": "workspace:*",
"@nuxtjs/eslint-config-typescript": "12.1.0",
"@types/fs-extra": "11.0.4",
"@types/node": "20.9.0",
"@types/semver": "7.5.5",
@ -54,6 +54,7 @@
"eslint-plugin-import": "2.29.0",
"eslint-plugin-jsdoc": "46.8.2",
"eslint-plugin-no-only-tests": "3.1.0",
"eslint-plugin-unicorn": "^49.0.0",
"execa": "8.0.1",
"fs-extra": "11.1.1",
"globby": "13.2.2",

View File

@ -1,3 +1,4 @@
/* eslint-disable no-var */
declare global {
var __NUXT_PREPATHS__: string[] | string | undefined
var __NUXT_PATHS__: string[] | string | undefined

View File

@ -57,6 +57,7 @@ function getRequireCacheItem (id: string) {
try {
return _require.cache[id]
} catch (e) {
// ignore issues accessing require.cache
}
}
@ -105,13 +106,16 @@ export function importModule (id: string, opts: RequireModuleOptions = {}) {
export function tryImportModule (id: string, opts: RequireModuleOptions = {}) {
try {
return importModule(id, opts).catch(() => undefined)
} catch {}
} catch {
// intentionally empty as this is a `try-` function
}
}
/** @deprecated Do not use CJS utils */
export function tryRequireModule (id: string, opts: RequireModuleOptions = {}) {
try {
return requireModule(id, opts)
} catch (e) {
} catch {
// intentionally empty as this is a `try-` function
}
}

View File

@ -10,7 +10,9 @@ import { interopDefault, resolvePath } from 'mlly'
export async function tryResolveModule (id: string, url: string | string[] = import.meta.url) {
try {
return await resolvePath(id, { url })
} catch { }
} catch {
// intentionally empty as this is a `try-` function
}
}
export async function importModule (id: string, url: string | string[] = import.meta.url) {
@ -21,5 +23,7 @@ export async function importModule (id: string, url: string | string[] = import.
export function tryImportModule (id: string, url = import.meta.url) {
try {
return importModule(id, url).catch(() => undefined)
} catch { }
} catch {
// intentionally empty as this is a `try-` function
}
}

View File

@ -1,5 +1,5 @@
import type { NuxtConfig } from 'nuxt/schema'
import type { DefineConfig, InputConfig, UserInputConfig, ConfigLayerMeta } from 'c12'
import type { ConfigLayerMeta, DefineConfig } from 'c12'
export { NuxtConfig } from 'nuxt/schema'
export interface DefineNuxtConfig extends DefineConfig<NuxtConfig, ConfigLayerMeta> {}

View File

@ -1,3 +1,4 @@
/* eslint-disable no-var */
declare global {
var __NUXT_VERSION__: string
var __NUXT_PREPATHS__: string[] | string | undefined

View File

@ -1,8 +1,17 @@
<template>
<Suspense @resolve="onResolve">
<ErrorComponent v-if="error" :error="error" />
<IslandRenderer v-else-if="islandContext" :context="islandContext" />
<component :is="SingleRenderer" v-else-if="SingleRenderer" />
<ErrorComponent
v-if="error"
:error="error"
/>
<IslandRenderer
v-else-if="islandContext"
:context="islandContext"
/>
<component
:is="SingleRenderer"
v-else-if="SingleRenderer"
/>
<AppComponent v-else />
</Suspense>
</template>

View File

@ -32,18 +32,24 @@ export function reloadNuxtApp (options: ReloadNuxtAppOptions = {}) {
let handledPath: Record<string, any> = {}
try {
handledPath = destr(sessionStorage.getItem('nuxt:reload') || '{}')
} catch {}
} catch {
// fail gracefully if we can't access sessionStorage
}
if (options.force || handledPath?.path !== path || handledPath?.expires < Date.now()) {
try {
sessionStorage.setItem('nuxt:reload', JSON.stringify({ path, expires: Date.now() + (options.ttl ?? 10000) }))
} catch {}
} catch {
// fail gracefully if we can't access sessionStorage
}
if (options.persistState) {
try {
// TODO: handle serializing/deserializing complex states as JSON: https://github.com/nuxt/nuxt/pull/19205
sessionStorage.setItem('nuxt:reload:state', JSON.stringify({ state: useNuxtApp().payload.state }))
} catch {}
} catch {
// fail gracefully if we can't access sessionStorage
}
}
if (window.location.pathname !== path) {

View File

@ -159,7 +159,7 @@ export const navigateTo = (to: RouteLocationRaw | undefined | null, options?: Na
const fullPath = typeof to === 'string' || isExternal ? toPath : router.resolve(to).fullPath || '/'
const location = isExternal ? toPath : joinURL(useRuntimeConfig().app.baseURL, fullPath)
async function redirect (response: any) {
const redirect = async function (response: any) {
// TODO: consider deprecating in favour of `app:rendered` and removing
await nuxtApp.callHook('app:redirected')
const encodedLoc = location.replace(/"/g, '%22')

View File

@ -55,7 +55,7 @@ export function updateAppConfig (appConfig: DeepPartial<AppConfig>) {
// HMR Support
if (import.meta.dev) {
function applyHMR (newConfig: AppConfig) {
const applyHMR = (newConfig: AppConfig) => {
const appConfig = useAppConfig()
if (newConfig && appConfig) {
deepAssign(appConfig, newConfig)

View File

@ -250,7 +250,7 @@ export function createNuxtApp (options: CreateOptions) {
nuxtApp.hook = nuxtApp.hooks.hook
if (import.meta.server) {
async function contextCaller (hooks: HookCallback[], args: any[]) {
const contextCaller = async function (hooks: HookCallback[], args: any[]) {
for (const hook of hooks) {
await nuxtApp.runWithContext(() => hook(...args))
}

View File

@ -12,7 +12,9 @@ export default defineNuxtPlugin({
sessionStorage.removeItem('nuxt:reload:state')
Object.assign(nuxtApp.payload.state, destr<Record<string, any>>(state)?.state)
}
} catch {}
} catch {
// don't throw an error if we have issues reading sessionStorage
}
}
}
})

View File

@ -529,7 +529,9 @@ function spaLoadingTemplate (nuxt: Nuxt) {
if (existsSync(spaLoadingTemplate)) {
return readFileSync(spaLoadingTemplate, 'utf-8')
}
} catch {}
} catch {
// fall through if we have issues reading the file
}
if (nuxt.options.spaLoadingTemplate === true) {
return defaultSpaLoadingTemplate({})

View File

@ -18,12 +18,12 @@ import { renderToString as _renderToString } from 'vue/server-renderer'
import { hash } from 'ohash'
import { renderSSRHead } from '@unhead/ssr'
import type { HeadEntryOptions } from '@unhead/schema'
import type { Link, Script, Style } from '@unhead/vue'
import { createServerHead } from '@unhead/vue'
import { defineRenderHandler, getRouteRules, useRuntimeConfig, useStorage } from '#internal/nitro'
import { useNitroApp } from '#internal/nitro/app'
import type { Link, Script, Style } from '@unhead/vue'
import { createServerHead } from '@unhead/vue'
// @ts-expect-error virtual file
import unheadPlugins from '#internal/unhead-plugins.mjs'
// eslint-disable-next-line import/no-restricted-paths

View File

@ -138,7 +138,7 @@ export const schemaTemplate: NuxtTemplate<TemplateContext> = {
filename: 'types/schema.d.ts',
getContents: async ({ nuxt }) => {
const moduleInfo = nuxt.options._installedModules.map(m => ({
...m.meta || {},
...m.meta,
importName: m.entryPath || m.meta?.name
})).filter(m => m.configKey && m.name && !adHocModules.includes(m.name))

View File

@ -1,3 +1,4 @@
/* eslint-disable vue/multi-word-component-names */
import { defineComponent } from 'vue'
import type { PropType, SetupContext } from 'vue'
import { useHead } from '@unhead/vue'

View File

@ -275,7 +275,7 @@ export default defineNuxtModule({
updateRouteConfig = () => nitro.updateConfig({ routeRules: defu(inlineRules, nitro.options._config.routeRules) })
})
async function updatePage (path: string) {
const updatePage = async function updatePage (path: string) {
const glob = pageToGlobMap[path]
const code = path in nuxt.vfs ? nuxt.vfs[path] : await readFile(path!, 'utf-8')
try {

View File

@ -62,7 +62,9 @@ export const definePageMeta = (meta: PageMeta): void => {
// don't warn if it's being used in a route component
return
}
} catch {}
} catch {
// ignore any errors with accessing current instance or route
}
warnRuntimeUsage('definePageMeta')
}
}

View File

@ -59,6 +59,8 @@ function _getHashElementScrollMarginTop (selector: string): number {
if (elem) {
return parseFloat(getComputedStyle(elem).scrollMarginTop)
}
} catch {}
} catch {
// ignore any errors parsing scrollMarginTop
}
return 0
}

View File

@ -1,3 +1,5 @@
<!-- eslint-disable vue/multi-word-component-names -->
<template>
<b style="color: #00C58E">
From Nuxt 3

View File

@ -1,3 +1,5 @@
<!-- eslint-disable vue/multi-word-component-names -->
<template>
<b style="color: #00C58E">
From Nuxt 3

View File

@ -3,6 +3,7 @@
Awesome Component count: {{ count }}
</div>
</template>
<script setup lang="ts">
defineProps<{
count?: number

View File

@ -3,5 +3,6 @@
This is Same name component!
</div>
</template>
<script setup>
</script>

View File

@ -1,3 +1,5 @@
<!-- eslint-disable vue/multi-word-component-names -->
<template>
<div>
Island defined with suffix

View File

@ -2,7 +2,7 @@
export * from './dist/index'
import type { DefineNuxtConfig } from 'nuxt/config'
import type { SchemaDefinition, RuntimeConfig } from 'nuxt/schema'
import type { RuntimeConfig, SchemaDefinition } from 'nuxt/schema'
import type { H3Event } from 'h3'
import type { NuxtIslandContext, NuxtIslandResponse, NuxtRenderHTMLContext } from './dist/core/runtime/nitro/renderer'

View File

@ -9,8 +9,8 @@ export default defineUntypedSchema({
nitro: {
routeRules: {
$resolve: async (val, get) => ({
...await get('routeRules') || {},
...val || {}
...await get('routeRules'),
...val
})
}
},

View File

@ -25,7 +25,7 @@ export default defineUntypedSchema({
'import.meta.dev': await get('dev'),
'process.test': isTest,
'import.meta.test': isTest,
...val || {}
...val
})
},
resolve: {
@ -61,7 +61,7 @@ export default defineUntypedSchema({
$resolve: async (val, get) => {
return {
isCustomElement: (await get('vue')).compilerOptions?.isCustomElement,
...(val || {})
...val
}
}
},

View File

@ -236,28 +236,27 @@ class ScopedVarsCollector {
const NUXT_IMPORT_RE = /nuxt|#app|#imports/
export function detectImportNames (code: string, composableMeta: Record<string, { source?: string | RegExp }>) {
const imports = findStaticImports(code)
const names = new Set<string>()
for (const i of imports) {
if (NUXT_IMPORT_RE.test(i.specifier)) { continue }
function addName (name: string) {
function addName (name: string, specifier: string) {
const source = composableMeta[name]?.source
if (source && matchWithStringOrRegex(i.specifier, source)) {
if (source && matchWithStringOrRegex(specifier, source)) {
return
}
names.add(name)
}
for (const i of findStaticImports(code)) {
if (NUXT_IMPORT_RE.test(i.specifier)) { continue }
const { namedImports, defaultImport, namespacedImport } = parseStaticImport(i)
for (const name in namedImports || {}) {
addName(namedImports![name])
addName(namedImports![name], i.specifier)
}
if (defaultImport) {
addName(defaultImport)
addName(defaultImport, i.specifier)
}
if (namespacedImport) {
addName(namespacedImport)
addName(namespacedImport, i.specifier)
}
}
return names

View File

@ -18,15 +18,15 @@ importers:
.:
devDependencies:
'@nuxt/eslint-config':
specifier: ^0.2.0
version: 0.2.0(eslint@8.53.0)
'@nuxt/test-utils':
specifier: 3.8.1
version: 3.8.1(playwright-core@1.39.0)(vitest@0.33.0)(vue@3.3.8)
'@nuxt/webpack-builder':
specifier: workspace:*
version: link:packages/webpack
'@nuxtjs/eslint-config-typescript':
specifier: 12.1.0
version: 12.1.0(eslint@8.53.0)(typescript@5.2.2)
'@types/fs-extra':
specifier: 11.0.4
version: 11.0.4
@ -53,13 +53,16 @@ importers:
version: 8.53.0
eslint-plugin-import:
specifier: 2.29.0
version: 2.29.0(@typescript-eslint/parser@6.8.0)(eslint-import-resolver-typescript@3.6.1)(eslint@8.53.0)
version: 2.29.0(@typescript-eslint/parser@6.8.0)(eslint@8.53.0)
eslint-plugin-jsdoc:
specifier: 46.8.2
version: 46.8.2(eslint@8.53.0)
eslint-plugin-no-only-tests:
specifier: 3.1.0
version: 3.1.0
eslint-plugin-unicorn:
specifier: ^49.0.0
version: 49.0.0(eslint@8.53.0)
execa:
specifier: 8.0.1
version: 8.0.1
@ -1914,6 +1917,21 @@ packages:
- xml2js
dev: false
/@nuxt/eslint-config@0.2.0(eslint@8.53.0):
resolution: {integrity: sha512-NeJX8TLcnNAjQFiDs3XhP+9CHKK8jaKsP7eUyCSrQdgY7nqWe7VJx64lwzx5FTT4cW3RHMEyH+Y0qzLGYYoa/A==}
peerDependencies:
eslint: ^8.48.0
dependencies:
'@rushstack/eslint-patch': 1.5.1
'@typescript-eslint/eslint-plugin': 6.8.0(@typescript-eslint/parser@6.8.0)(eslint@8.53.0)(typescript@5.2.2)
'@typescript-eslint/parser': 6.8.0(eslint@8.53.0)(typescript@5.2.2)
eslint: 8.53.0
eslint-plugin-vue: 9.17.0(eslint@8.53.0)
typescript: 5.2.2
transitivePeerDependencies:
- supports-color
dev: true
/@nuxt/friendly-errors-webpack-plugin@2.5.2(webpack@5.89.0):
resolution: {integrity: sha512-LLc+90lnxVbpKkMqk5z1EWpXoODhc6gRkqqXJCInJwF5xabHAE7biFvbULfvTRmtaTzAaP8IV4HQDLUgeAUTTw==}
engines: {node: '>=8.0.0', npm: '>=5.0.0'}
@ -1983,46 +2001,6 @@ packages:
resolution: {integrity: sha512-5gc02Pu1HycOVUWJ8aYsWeeXcSTPe8iX8+KIrhyEtEoOSkY0eMBuo0ssljB8wALuEmepv31DlYe5gpiRwkjESA==}
dev: false
/@nuxtjs/eslint-config-typescript@12.1.0(eslint@8.53.0)(typescript@5.2.2):
resolution: {integrity: sha512-l2fLouDYwdAvCZEEw7wGxOBj+i8TQcHFu3zMPTLqKuv1qu6WcZIr0uztkbaa8ND1uKZ9YPqKx6UlSOjM4Le69Q==}
peerDependencies:
eslint: ^8.48.0
dependencies:
'@nuxtjs/eslint-config': 12.0.0(@typescript-eslint/parser@6.8.0)(eslint-import-resolver-typescript@3.6.1)(eslint@8.53.0)
'@typescript-eslint/eslint-plugin': 6.8.0(@typescript-eslint/parser@6.8.0)(eslint@8.53.0)(typescript@5.2.2)
'@typescript-eslint/parser': 6.8.0(eslint@8.53.0)(typescript@5.2.2)
eslint: 8.53.0
eslint-import-resolver-typescript: 3.6.1(@typescript-eslint/parser@6.8.0)(eslint-plugin-import@2.29.0)(eslint@8.53.0)
eslint-plugin-import: 2.29.0(@typescript-eslint/parser@6.8.0)(eslint-import-resolver-typescript@3.6.1)(eslint@8.53.0)
eslint-plugin-vue: 9.17.0(eslint@8.53.0)
transitivePeerDependencies:
- eslint-import-resolver-node
- eslint-import-resolver-webpack
- supports-color
- typescript
dev: true
/@nuxtjs/eslint-config@12.0.0(@typescript-eslint/parser@6.8.0)(eslint-import-resolver-typescript@3.6.1)(eslint@8.53.0):
resolution: {integrity: sha512-ewenelo75x0eYEUK+9EBXjc/OopQCvdkmYmlZuoHq5kub/vtiRpyZ/autppwokpHUq8tiVyl2ejMakoiHiDTrg==}
peerDependencies:
eslint: ^8.23.0
dependencies:
eslint: 8.53.0
eslint-config-standard: 17.1.0(eslint-plugin-import@2.29.0)(eslint-plugin-n@15.7.0)(eslint-plugin-promise@6.1.1)(eslint@8.53.0)
eslint-plugin-import: 2.29.0(@typescript-eslint/parser@6.8.0)(eslint-import-resolver-typescript@3.6.1)(eslint@8.53.0)
eslint-plugin-n: 15.7.0(eslint@8.53.0)
eslint-plugin-node: 11.1.0(eslint@8.53.0)
eslint-plugin-promise: 6.1.1(eslint@8.53.0)
eslint-plugin-unicorn: 44.0.2(eslint@8.53.0)
eslint-plugin-vue: 9.17.0(eslint@8.53.0)
local-pkg: 0.4.3
transitivePeerDependencies:
- '@typescript-eslint/parser'
- eslint-import-resolver-typescript
- eslint-import-resolver-webpack
- supports-color
dev: true
/@one-ini/wasm@0.1.1:
resolution: {integrity: sha512-XuySG1E38YScSJoMlqovLru4KTUNSjgVTIjyh7qMX6aNN5HY5Ct5LhRJdxO79JtTzKfzV/bnWpz+zquYrISsvw==}
dev: true
@ -2296,6 +2274,10 @@ packages:
picomatch: 2.3.1
rollup: 3.29.4
/@rushstack/eslint-patch@1.5.1:
resolution: {integrity: sha512-6i/8UoL0P5y4leBIGzvkZdS85RDMG9y1ihZzmTZQ5LdHUYmZ7pKFoj8X0236s3lusPs1Fa5HTQUpwI+UfTcmeA==}
dev: true
/@sigstore/bundle@2.1.0:
resolution: {integrity: sha512-89uOo6yh/oxaU8AeOUnVrTdVMcGk9Q1hJa7Hkvalc6G3Z3CupWk4Xe9djSgJm9fMkH69s0P0cVHUoKSOemLdng==}
engines: {node: ^16.14.0 || >=18.0.0}
@ -2470,8 +2452,8 @@ packages:
dependencies:
undici-types: 5.26.5
/@types/normalize-package-data@2.4.3:
resolution: {integrity: sha512-ehPtgRgaULsFG8x0NeYJvmyH1hmlfsNLujHe9dQEia/7MAJYdzMSi19JtchUHjmBA6XC/75dK55mzZH+RyieSg==}
/@types/normalize-package-data@2.4.4:
resolution: {integrity: sha512-37i+OaWTh9qeK4LSHPsyRC7NahnGotNuZvjLSgcPzblpHB3rrCJxAOgI5gCdKm7coonsaX1Of0ILiTcnZjbfxA==}
dev: true
/@types/pify@5.0.4:
@ -2787,7 +2769,7 @@ packages:
vite: 4.5.0
vue: 3.3.8
dependencies:
vite: 4.5.0(@types/node@20.8.10)
vite: 4.5.0(@types/node@20.9.0)
vue: 3.3.8(typescript@5.2.2)
/@vitest/expect@0.33.0:
@ -3592,6 +3574,7 @@ packages:
resolution: {integrity: sha512-qwVpFEHNfhYJIzNRBvd2C1kyo6jz3ZSMPyyuR47OPdiKWlbYnZNyDWuyR175qDnAJLiCo5fBBqPb3RiXgWlkOQ==}
dependencies:
semver: 7.5.4
dev: false
/bundle-name@3.0.0:
resolution: {integrity: sha512-PKA4BeSvBpQKQ8iPOGCSiell+N8P+Tf1DlwqmYhpe2gAhKPHn8EYOxVT+ShuGmhg8lN8XiSlS80yiExKXrURlw==}
@ -4610,21 +4593,6 @@ packages:
resolution: {integrity: sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==}
engines: {node: '>=12'}
/eslint-config-standard@17.1.0(eslint-plugin-import@2.29.0)(eslint-plugin-n@15.7.0)(eslint-plugin-promise@6.1.1)(eslint@8.53.0):
resolution: {integrity: sha512-IwHwmaBNtDK4zDHQukFDW5u/aTb8+meQWZvNFWkiGmbWjD6bqyuSSBxxXKkCftCUzc1zwCH2m/baCNDLGmuO5Q==}
engines: {node: '>=12.0.0'}
peerDependencies:
eslint: ^8.0.1
eslint-plugin-import: ^2.25.2
eslint-plugin-n: '^15.0.0 || ^16.0.0 '
eslint-plugin-promise: ^6.0.0
dependencies:
eslint: 8.53.0
eslint-plugin-import: 2.29.0(@typescript-eslint/parser@6.8.0)(eslint-import-resolver-typescript@3.6.1)(eslint@8.53.0)
eslint-plugin-n: 15.7.0(eslint@8.53.0)
eslint-plugin-promise: 6.1.1(eslint@8.53.0)
dev: true
/eslint-import-resolver-node@0.3.9:
resolution: {integrity: sha512-WFj2isz22JahUv+B788TlO3N6zL3nNJGU8CcZbPZvVEkBPaJdCV4vy5wyghty5ROFbCRnm132v8BScu5/1BQ8g==}
dependencies:
@ -4635,30 +4603,7 @@ packages:
- supports-color
dev: true
/eslint-import-resolver-typescript@3.6.1(@typescript-eslint/parser@6.8.0)(eslint-plugin-import@2.29.0)(eslint@8.53.0):
resolution: {integrity: sha512-xgdptdoi5W3niYeuQxKmzVDTATvLYqhpwmykwsh7f6HIOStGWEIL9iqZgQDF9u9OEzrRwR8no5q2VT+bjAujTg==}
engines: {node: ^14.18.0 || >=16.0.0}
peerDependencies:
eslint: '*'
eslint-plugin-import: '*'
dependencies:
debug: 4.3.4
enhanced-resolve: 5.15.0
eslint: 8.53.0
eslint-module-utils: 2.8.0(@typescript-eslint/parser@6.8.0)(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.1)(eslint@8.53.0)
eslint-plugin-import: 2.29.0(@typescript-eslint/parser@6.8.0)(eslint-import-resolver-typescript@3.6.1)(eslint@8.53.0)
fast-glob: 3.3.1
get-tsconfig: 4.7.2
is-core-module: 2.13.1
is-glob: 4.0.3
transitivePeerDependencies:
- '@typescript-eslint/parser'
- eslint-import-resolver-node
- eslint-import-resolver-webpack
- supports-color
dev: true
/eslint-module-utils@2.8.0(@typescript-eslint/parser@6.8.0)(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.1)(eslint@8.53.0):
/eslint-module-utils@2.8.0(@typescript-eslint/parser@6.8.0)(eslint-import-resolver-node@0.3.9)(eslint@8.53.0):
resolution: {integrity: sha512-aWajIYfsqCKRDgUfjEXNN/JlrzauMuSEy5sbd7WXbtW3EH6A6MpwEh42c7qD+MqQo9QMJ6fWLAeIJynx0g6OAw==}
engines: {node: '>=4'}
peerDependencies:
@ -4683,34 +4628,11 @@ packages:
debug: 3.2.7
eslint: 8.53.0
eslint-import-resolver-node: 0.3.9
eslint-import-resolver-typescript: 3.6.1(@typescript-eslint/parser@6.8.0)(eslint-plugin-import@2.29.0)(eslint@8.53.0)
transitivePeerDependencies:
- supports-color
dev: true
/eslint-plugin-es@3.0.1(eslint@8.53.0):
resolution: {integrity: sha512-GUmAsJaN4Fc7Gbtl8uOBlayo2DqhwWvEzykMHSCZHU3XdJ+NSzzZcVhXh3VxX5icqQ+oQdIEawXX8xkR3mIFmQ==}
engines: {node: '>=8.10.0'}
peerDependencies:
eslint: '>=4.19.1'
dependencies:
eslint: 8.53.0
eslint-utils: 2.1.0
regexpp: 3.2.0
dev: true
/eslint-plugin-es@4.1.0(eslint@8.53.0):
resolution: {integrity: sha512-GILhQTnjYE2WorX5Jyi5i4dz5ALWxBIdQECVQavL6s7cI76IZTDWleTHkxz/QT3kvcs2QlGHvKLYsSlPOlPXnQ==}
engines: {node: '>=8.10.0'}
peerDependencies:
eslint: '>=4.19.1'
dependencies:
eslint: 8.53.0
eslint-utils: 2.1.0
regexpp: 3.2.0
dev: true
/eslint-plugin-import@2.29.0(@typescript-eslint/parser@6.8.0)(eslint-import-resolver-typescript@3.6.1)(eslint@8.53.0):
/eslint-plugin-import@2.29.0(@typescript-eslint/parser@6.8.0)(eslint@8.53.0):
resolution: {integrity: sha512-QPOO5NO6Odv5lpoTkddtutccQjysJuFxoPS7fAHO+9m9udNHvTCPSAMW9zGAYj8lAIdr40I8yPCdUYrncXtrwg==}
engines: {node: '>=4'}
peerDependencies:
@ -4729,7 +4651,7 @@ packages:
doctrine: 2.1.0
eslint: 8.53.0
eslint-import-resolver-node: 0.3.9
eslint-module-utils: 2.8.0(@typescript-eslint/parser@6.8.0)(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.1)(eslint@8.53.0)
eslint-module-utils: 2.8.0(@typescript-eslint/parser@6.8.0)(eslint-import-resolver-node@0.3.9)(eslint@8.53.0)
hasown: 2.0.0
is-core-module: 2.13.1
is-glob: 4.0.3
@ -4765,71 +4687,30 @@ packages:
- supports-color
dev: true
/eslint-plugin-n@15.7.0(eslint@8.53.0):
resolution: {integrity: sha512-jDex9s7D/Qial8AGVIHq4W7NswpUD5DPDL2RH8Lzd9EloWUuvUkHfv4FRLMipH5q2UtyurorBkPeNi1wVWNh3Q==}
engines: {node: '>=12.22.0'}
peerDependencies:
eslint: '>=7.0.0'
dependencies:
builtins: 5.0.1
eslint: 8.53.0
eslint-plugin-es: 4.1.0(eslint@8.53.0)
eslint-utils: 3.0.0(eslint@8.53.0)
ignore: 5.2.4
is-core-module: 2.13.1
minimatch: 3.1.2
resolve: 1.22.8
semver: 7.5.4
dev: true
/eslint-plugin-no-only-tests@3.1.0:
resolution: {integrity: sha512-Lf4YW/bL6Un1R6A76pRZyE1dl1vr31G/ev8UzIc/geCgFWyrKil8hVjYqWVKGB/UIGmb6Slzs9T0wNezdSVegw==}
engines: {node: '>=5.0.0'}
dev: true
/eslint-plugin-node@11.1.0(eslint@8.53.0):
resolution: {integrity: sha512-oUwtPJ1W0SKD0Tr+wqu92c5xuCeQqB3hSCHasn/ZgjFdA9iDGNkNf2Zi9ztY7X+hNuMib23LNGRm6+uN+KLE3g==}
engines: {node: '>=8.10.0'}
/eslint-plugin-unicorn@49.0.0(eslint@8.53.0):
resolution: {integrity: sha512-0fHEa/8Pih5cmzFW5L7xMEfUTvI9WKeQtjmKpTUmY+BiFCDxkxrTdnURJOHKykhtwIeyYsxnecbGvDCml++z4Q==}
engines: {node: '>=16'}
peerDependencies:
eslint: '>=5.16.0'
dependencies:
eslint: 8.53.0
eslint-plugin-es: 3.0.1(eslint@8.53.0)
eslint-utils: 2.1.0
ignore: 5.2.4
minimatch: 3.1.2
resolve: 1.22.8
semver: 6.3.1
dev: true
/eslint-plugin-promise@6.1.1(eslint@8.53.0):
resolution: {integrity: sha512-tjqWDwVZQo7UIPMeDReOpUgHCmCiH+ePnVT+5zVapL0uuHnegBUs2smM13CzOs2Xb5+MHMRFTs9v24yjba4Oig==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies:
eslint: ^7.0.0 || ^8.0.0
dependencies:
eslint: 8.53.0
dev: true
/eslint-plugin-unicorn@44.0.2(eslint@8.53.0):
resolution: {integrity: sha512-GLIDX1wmeEqpGaKcnMcqRvMVsoabeF0Ton0EX4Th5u6Kmf7RM9WBl705AXFEsns56ESkEs0uyelLuUTvz9Tr0w==}
engines: {node: '>=14.18'}
peerDependencies:
eslint: '>=8.23.1'
eslint: '>=8.52.0'
dependencies:
'@babel/helper-validator-identifier': 7.22.20
'@eslint-community/eslint-utils': 4.4.0(eslint@8.53.0)
ci-info: 3.9.0
clean-regexp: 1.0.0
eslint: 8.53.0
eslint-utils: 3.0.0(eslint@8.53.0)
esquery: 1.5.0
indent-string: 4.0.0
is-builtin-module: 3.2.1
lodash: 4.17.21
jsesc: 3.0.2
pluralize: 8.0.0
read-pkg-up: 7.0.1
regexp-tree: 0.1.27
safe-regex: 2.1.1
regjsparser: 0.10.0
semver: 7.5.4
strip-indent: 3.0.0
dev: true
@ -4866,33 +4747,6 @@ packages:
esrecurse: 4.3.0
estraverse: 5.3.0
/eslint-utils@2.1.0:
resolution: {integrity: sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==}
engines: {node: '>=6'}
dependencies:
eslint-visitor-keys: 1.3.0
dev: true
/eslint-utils@3.0.0(eslint@8.53.0):
resolution: {integrity: sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==}
engines: {node: ^10.0.0 || ^12.0.0 || >= 14.0.0}
peerDependencies:
eslint: '>=5'
dependencies:
eslint: 8.53.0
eslint-visitor-keys: 2.1.0
dev: true
/eslint-visitor-keys@1.3.0:
resolution: {integrity: sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==}
engines: {node: '>=4'}
dev: true
/eslint-visitor-keys@2.1.0:
resolution: {integrity: sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==}
engines: {node: '>=10'}
dev: true
/eslint-visitor-keys@3.4.3:
resolution: {integrity: sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
@ -6048,11 +5902,22 @@ packages:
engines: {node: '>=12.0.0'}
dev: true
/jsesc@0.5.0:
resolution: {integrity: sha512-uZz5UnB7u4T9LvwmFqXii7pZSouaRPorGs5who1Ip7VO0wxanFvBL7GkM6dTHlgX+jhBApRetaWpnDabOeTcnA==}
hasBin: true
dev: true
/jsesc@2.5.2:
resolution: {integrity: sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==}
engines: {node: '>=4'}
hasBin: true
/jsesc@3.0.2:
resolution: {integrity: sha512-xKqzzWXDttJuOcawBt4KnKHHIf5oQ/Cxax+0PWFG+DFDgHNAdi+TXECADI+RYiFUMmx8792xsMbbgXj4CwnP4g==}
engines: {node: '>=6'}
hasBin: true
dev: true
/json-buffer@3.0.1:
resolution: {integrity: sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==}
@ -7997,7 +7862,7 @@ packages:
resolution: {integrity: sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg==}
engines: {node: '>=8'}
dependencies:
'@types/normalize-package-data': 2.4.3
'@types/normalize-package-data': 2.4.4
normalize-package-data: 2.5.0
parse-json: 5.2.0
type-fest: 0.6.0
@ -8065,9 +7930,11 @@ packages:
set-function-name: 2.0.1
dev: true
/regexpp@3.2.0:
resolution: {integrity: sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==}
engines: {node: '>=8'}
/regjsparser@0.10.0:
resolution: {integrity: sha512-qx+xQGZVsy55CH0a1hiVwHmqjLryfh7wQyF5HO07XJ9f7dQMY/gPQHhlyDkIzJKC+x2fUCpCcUODUUUFrm7SHA==}
hasBin: true
dependencies:
jsesc: 0.5.0
dev: true
/require-directory@2.1.1:
@ -8208,12 +8075,6 @@ packages:
is-regex: 1.1.4
dev: true
/safe-regex@2.1.1:
resolution: {integrity: sha512-rx+x8AMzKb5Q5lQ95Zoi6ZbJqwCLkqi3XuJXp5P3rT8OEc6sZCJG5AE5dU3lsgRr/F4Bs31jSlVN+j5KrsGu9A==}
dependencies:
regexp-tree: 0.1.27
dev: true
/safer-buffer@2.1.2:
resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==}

View File

@ -1,3 +1,5 @@
<!-- eslint-disable vue/multi-word-component-names -->
<script setup lang="ts">
import { setResponseHeader } from 'h3'

View File

@ -1,5 +1,4 @@
<script setup>
async function getData () { }
await getData()

View File

@ -5,7 +5,11 @@ const templateRef = ref<HTMLElement[] | null>(null)
<template>
<div>
<div v-for="item in list" ref="templateRef" :key="item">
<div
v-for="item in list"
ref="templateRef"
:key="item"
>
{{ item }}
</div>
</div>

View File

@ -1,8 +1,14 @@
<template>
<div v-bind="$attrs" class="multi-root-node-count">
<div
v-bind="$attrs"
class="multi-root-node-count"
>
{{ count }}
</div>
<button class="multi-root-node-button" @click="add">
<button
class="multi-root-node-button"
@click="add"
>
add 1 to count
</button>
</template>

View File

@ -1,8 +1,14 @@
<template>
<div v-bind="$attrs" class="multi-root-node-script-count">
<div
v-bind="$attrs"
class="multi-root-node-script-count"
>
{{ count }}
</div>
<button class="multi-root-node-script-button" @click="add">
<button
class="multi-root-node-script-button"
@click="add"
>
add 1 to count
</button>
</template>

View File

@ -9,19 +9,33 @@
{{ count }}
</div>
{{ headers['custom-head'] }}
<slot name="test" :count="count" />
<slot
name="test"
:count="count"
/>
<p>hello world !!!</p>
<slot v-for="(t, index) in 3" name="hello" :t="t">
<slot
v-for="(t, index) in 3"
name="hello"
:t="t"
>
<div :key="t">
fallback slot -- index: {{ index }}
</div>
</slot>
<slot v-for="(t, index) in ['fall', 'back']" name="fallback" :t="t">
<slot
v-for="(t, index) in ['fall', 'back']"
name="fallback"
:t="t"
>
<div :key="t">
{{ t }} slot -- index: {{ index }}
</div>
<div :key="t" class="fallback-slot-content">
<div
:key="t"
class="fallback-slot-content"
>
wonderful fallback
</div>
</slot>

View File

@ -6,7 +6,10 @@
<div class="count">
{{ count }}
</div>
<button class="add-count" @click="count++">
<button
class="add-count"
@click="count++"
>
add count
</button>
</div>

View File

@ -6,7 +6,10 @@
<div class="count">
{{ count }}
</div>
<button class="add-count" @click="count++">
<button
class="add-count"
@click="count++"
>
add count
</button>
</div>

View File

@ -1,3 +1,5 @@
<!-- eslint-disable vue/no-multiple-template-root -->
<template>
<div />
<slot />

View File

@ -6,16 +6,28 @@
<div class="big-block">
page
</div>
<NuxtLink id="big-page-1" to="/big-page-1">
<NuxtLink
id="big-page-1"
to="/big-page-1"
>
to big page 1
</NuxtLink>
<NuxtLink id="big-page-2" to="/big-page-2">
<NuxtLink
id="big-page-2"
to="/big-page-2"
>
to big page 2
</NuxtLink>
<NuxtLink id="big-page-2-test-test" to="/big-page-2?test=test">
<NuxtLink
id="big-page-2-test-test"
to="/big-page-2?test=test"
>
to big page 2 with ?test=test
</NuxtLink>
<NuxtLink id="big-page-2-test-super-test" to="/big-page-2?test=super-test">
<NuxtLink
id="big-page-2-test-super-test"
to="/big-page-2?test=super-test"
>
to big page 2 with ?test=super-test
</NuxtLink>
</div>

View File

@ -1,3 +1,5 @@
<!-- eslint-disable vue/multi-word-component-names -->
<script setup lang="ts">
import { setResponseHeader } from 'h3'

View File

@ -103,7 +103,7 @@ export default defineNuxtConfig({
name: 'internal-' + page.name,
path: withoutLeadingSlash(page.path),
meta: {
...page.meta || {},
...page.meta,
layout: undefined,
_layout: page.meta?.layout
}

View File

@ -1,8 +1,17 @@
<template>
<div>
<img src="~/assets/logo.svg" class="h-20 mb-4">
<img src="/public.svg" class="h-20 mb-4">
<img :src="logo" class="h-20 mb-4">
<img
src="~/assets/logo.svg"
class="h-20 mb-4"
>
<img
src="/public.svg"
class="h-20 mb-4"
>
<img
:src="logo"
class="h-20 mb-4"
>
</div>
</template>

View File

@ -3,7 +3,11 @@
Hello World
<div id="locator-for-playwright">
<!-- single child -->
<NuxtClientFallback fallback-tag="span" class="break-in-ssr" fallback="this failed to render">
<NuxtClientFallback
fallback-tag="span"
class="break-in-ssr"
fallback="this failed to render"
>
<BreakInSetup />
</NuxtClientFallback>
<!-- multi child -->
@ -14,7 +18,10 @@
<!-- don't render if one child fails in ssr -->
<NuxtClientFallback>
<BreakInSetup />
<SugarCounter id="sugar-counter" :multiplier="multiplier" />
<SugarCounter
id="sugar-counter"
:multiplier="multiplier"
/>
</NuxtClientFallback>
<!-- nested children fails -->
<NuxtClientFallback>
@ -50,7 +57,10 @@
</template>
</NuxtClientFallback>
</div>
<button id="increment-count" @click="multiplier++">
<button
id="increment-count"
@click="multiplier++"
>
increment count
</button>
</div>

View File

@ -1,7 +1,11 @@
<template>
<div>
<ClientBinding />
<ClientScript ref="clientScript" class="client-only-script" foo="bar" />
<ClientScript
ref="clientScript"
class="client-only-script"
foo="bar"
/>
<ClientSetupScript
ref="clientSetupScript"
class="client-only-script-setup"
@ -27,35 +31,63 @@
<ClientMultiRootNodeScript class="multi-root-node-script" />
<!-- ensure components with a single single child are correctly rendered -->
<ClientStringChildStateful ref="stringStatefulComp" class="string-stateful" />
<ClientStringChildStateful
ref="stringStatefulComp"
class="string-stateful"
/>
<ClientStringChildStatefulScript
ref="stringStatefulScriptComp"
class="string-stateful-script"
/>
<ClientNoState class="no-state" />
<!-- ensure directives are correctly passed -->
<ClientStringChildStateful v-show="show" class="string-stateful-should-be-hidden" />
<ClientSetupScript v-show="show" class="client-script-should-be-hidden" foo="bar" />
<ClientStringChildStateful
v-show="show"
class="string-stateful-should-be-hidden"
/>
<ClientSetupScript
v-show="show"
class="client-script-should-be-hidden"
foo="bar"
/>
<ClientStringChildStatefulScript
v-show="show"
class="string-stateful-script-should-be-hidden"
/>
<ClientNoState v-show="show" class="no-state-hidden" />
<ClientNoState
v-show="show"
class="no-state-hidden"
/>
<button class="test-ref-1" @click="stringStatefulComp.add">
<button
class="test-ref-1"
@click="stringStatefulComp.add"
>
increment count
</button>
<button class="test-ref-2" @click="stringStatefulScriptComp.add">
<button
class="test-ref-2"
@click="stringStatefulScriptComp.add"
>
increment count
</button>
<button class="test-ref-3" @click="clientScript.add">
<button
class="test-ref-3"
@click="clientScript.add"
>
increment count
</button>
<button class="test-ref-4" @click="clientSetupScript.add">
<button
class="test-ref-4"
@click="clientSetupScript.add"
>
increment count
</button>
<button id="show-all" @click="show = true">
<button
id="show-all"
@click="show = true"
>
Show all
</button>
</div>

View File

@ -1,7 +1,13 @@
<template>
<div>
<ClientOnlyScript class="client-only-script" foo="bar" />
<LazyClientOnlySetupScript class="lazy-client-only-script-setup" foo="hello" />
<ClientOnlyScript
class="client-only-script"
foo="bar"
/>
<LazyClientOnlySetupScript
class="lazy-client-only-script-setup"
foo="hello"
/>
</div>
</template>

View File

@ -33,7 +33,10 @@ export default defineNuxtComponent({
<div>
<Head>
<Title>Using a dynamic component</Title>
<Meta http-equiv="content-security-policy" content="default-src https" />
<Meta
http-equiv="content-security-policy"
content="default-src https"
/>
</Head>
</div>
</template>

View File

@ -23,22 +23,42 @@
<NuxtLink to="/">
Link
</NuxtLink>
<NuxtLink id="islands" to="/islands">
<NuxtLink
id="islands"
to="/islands"
>
islands
</NuxtLink>
<NuxtLink id="to-immediate-remove-unmounted" to="/useAsyncData/immediate-remove-unmounted">
<NuxtLink
id="to-immediate-remove-unmounted"
to="/useAsyncData/immediate-remove-unmounted"
>
Immediate remove unmounted
</NuxtLink>
<NuxtLink to="/chunk-error" :prefetch="false">
<NuxtLink
to="/chunk-error"
:prefetch="false"
>
Chunk error
</NuxtLink>
<NuxtLink id="to-client-only-components" to="/client-only-components">
<NuxtLink
id="to-client-only-components"
to="/client-only-components"
>
createClientOnly()
</NuxtLink>
<NuxtLink id="middleware-abort-non-fatal" to="/middleware-abort-non-fatal" :prefetch="false">
<NuxtLink
id="middleware-abort-non-fatal"
to="/middleware-abort-non-fatal"
:prefetch="false"
>
Middleware abort navigation
</NuxtLink>
<NuxtLink id="middleware-abort-non-fatal-error" to="/middleware-abort-non-fatal?error=someerror" :prefetch="false">
<NuxtLink
id="middleware-abort-non-fatal-error"
to="/middleware-abort-non-fatal?error=someerror"
:prefetch="false"
>
Middleware abort navigation with error
</NuxtLink>
Some value: {{ someValue }}
@ -54,8 +74,15 @@
<Spin>Test</Spin>
<component :is="`test${'-'.toString()}global`" />
<component :is="`with${'-'.toString()}suffix`" />
<ClientWrapped ref="clientRef" style="color: red;" class="client-only" />
<ServerOnlyComponent class="server-only" style="background-color: gray;" />
<ClientWrapped
ref="clientRef"
style="color: red;"
class="client-only"
/>
<ServerOnlyComponent
class="server-only"
style="background-color: gray;"
/>
<NuxtLink to="/big-page-1">
to big 1
</NuxtLink>

View File

@ -6,6 +6,7 @@ if (!isSameApp) {
throw new Error('💀')
}
</script>
<template>
<div>
This should be false: {{ $wasVueAppInstanceWronglyPreserved }}

View File

@ -1,3 +1,5 @@
<!-- eslint-disable vue/no-multiple-template-root -->
<template>
Just some text
</template>

View File

@ -1,3 +1,4 @@
<!-- eslint-disable vue/no-multiple-template-root -->
<template>
<div>Multiple</div>
<div>elements</div>

View File

@ -1,3 +1,5 @@
<!-- eslint-disable vue/no-multiple-template-root -->
<template>
<div>Multiple</div>
<div>elements</div>

View File

@ -16,18 +16,37 @@ const count = ref(0)
<div>
Pure island component:
<div class="box">
<NuxtIsland name="PureComponent" :props="islandProps" />
<NuxtIsland name="PureComponent" :props="islandProps" />
<NuxtIsland
name="PureComponent"
:props="islandProps"
/>
<NuxtIsland
name="PureComponent"
:props="islandProps"
/>
</div>
<button id="increase-pure-component" @click="islandProps.number++">
<button
id="increase-pure-component"
@click="islandProps.number++"
>
Increase
</button>
<hr>
Route island component:
<div v-if="routeIslandVisible" class="box">
<NuxtIsland name="RouteComponent" :context="{ url: '/test' }" />
<div
v-if="routeIslandVisible"
class="box"
>
<NuxtIsland
name="RouteComponent"
:context="{ url: '/test' }"
/>
</div>
<button v-else id="show-route" @click="routeIslandVisible = true">
<button
v-else
id="show-route"
@click="routeIslandVisible = true"
>
Show
</button>
@ -40,7 +59,10 @@ const count = ref(0)
<div>
Async component (1000ms):
<div>
<NuxtIsland name="LongAsyncComponent" :props="{ count }">
<NuxtIsland
name="LongAsyncComponent"
:props="{ count }"
>
<div>Interactive testing slot</div>
<div id="first-sugar-counter">
<SugarCounter :multiplier="testCount" />
@ -56,18 +78,28 @@ const count = ref(0)
</div>
</template>
</NuxtIsland>
<button id="update-server-components" @click="count++">
<button
id="update-server-components"
@click="count++"
>
add +1 to count
</button>
</div>
</div>
<div>
<p>Island with props mounted client side</p>
<button id="show-island" @click="showIslandSlot = true">
<button
id="show-island"
@click="showIslandSlot = true"
>
Show Interactive island
</button>
<div id="island-mounted-client-side">
<NuxtIsland v-if="showIslandSlot" name="LongAsyncComponent" :props="{ count }">
<NuxtIsland
v-if="showIslandSlot"
name="LongAsyncComponent"
:props="{ count }"
>
<div>Interactive testing slot post SSR</div>
<SugarCounter :multiplier="testCount" />
</NuxtIsland>

View File

@ -6,7 +6,10 @@ definePageMeta({
<template>
<div>
<NuxtLayout name="with-props" some-prop="some prop was passed">
<NuxtLayout
name="with-props"
some-prop="some prop was passed"
>
<div>
some page content
</div>

View File

@ -7,10 +7,16 @@ const route = useRoute('nested-foo-bar')
<div>nested/[foo]/[bar].vue</div>
<div>foo: {{ route.params.foo }}</div>
<div>bar: {{ route.params.bar }}</div>
<NuxtLink id="user-test" to="/nested/foo/user-test">
<NuxtLink
id="user-test"
to="/nested/foo/user-test"
>
to /nested/foo/user-test
</NuxtLink>
<NuxtLink id="test" to="/nested/foo/test">
<NuxtLink
id="test"
to="/nested/foo/test"
>
to /nested/foo/test
</NuxtLink>
</div>

View File

@ -8,10 +8,16 @@ const route = useRoute('nested-foo-user-group')
<div>foo: {{ route.params.foo }}</div>
<div>group: {{ route.params.group }}</div>
<NuxtLink id="user-test" to="/nested/foo/user-test">
<NuxtLink
id="user-test"
to="/nested/foo/user-test"
>
to /nested/foo/user-test
</NuxtLink>
<NuxtLink id="test" to="/nested/foo/test">
<NuxtLink
id="test"
to="/nested/foo/test"
>
to /nested/foo/test
</NuxtLink>
</div>

View File

@ -34,9 +34,19 @@ const windowState = computed(() => {
</ClientOnly>
</div>
<ul>
<li v-for="(link, index) in links" :key="index">
<LinkWithTrailingSlash :to="link" class="link-with-trailing-slash">
<LinkWithTrailingSlash v-slot="{ href }" custom :to="link">
<li
v-for="(link, index) in links"
:key="index"
>
<LinkWithTrailingSlash
:to="link"
class="link-with-trailing-slash"
>
<LinkWithTrailingSlash
v-slot="{ href }"
custom
:to="link"
>
{{ href }}
</LinkWithTrailingSlash>
</LinkWithTrailingSlash>
@ -44,9 +54,19 @@ const windowState = computed(() => {
</ul>
<hr>
<ul>
<li v-for="(link, index) in links" :key="index">
<LinkWithoutTrailingSlash :to="link" class="link-without-trailing-slash">
<LinkWithoutTrailingSlash v-slot="{ href }" custom :to="link">
<li
v-for="(link, index) in links"
:key="index"
>
<LinkWithoutTrailingSlash
:to="link"
class="link-without-trailing-slash"
>
<LinkWithoutTrailingSlash
v-slot="{ href }"
custom
:to="link"
>
{{ href }}
</LinkWithoutTrailingSlash>
</LinkWithoutTrailingSlash>
@ -54,9 +74,19 @@ const windowState = computed(() => {
</ul>
<hr>
<ul>
<li v-for="(link, index) in links" :key="index">
<NuxtLink :to="link" class="nuxt-link">
<NuxtLink v-slot="{ href }" custom :to="link">
<li
v-for="(link, index) in links"
:key="index"
>
<NuxtLink
:to="link"
class="nuxt-link"
>
<NuxtLink
v-slot="{ href }"
custom
:to="link"
>
{{ href }}
</NuxtLink>
</NuxtLink>
@ -64,9 +94,19 @@ const windowState = computed(() => {
</ul>
<hr>
<ul>
<li v-for="(link, index) in links" :key="index">
<RouterLink :to="link" class="router-link">
<RouterLink v-slot="{ href }" custom :to="link">
<li
v-for="(link, index) in links"
:key="index"
>
<RouterLink
:to="link"
class="router-link"
>
<RouterLink
v-slot="{ href }"
custom
:to="link"
>
{{ href }}
</RouterLink>
</RouterLink>

View File

@ -1,6 +1,6 @@
<template>
<div>
<NuxtLink :to="{ name: 'prefetch-server-components'}">
<NuxtLink :to="{ name: 'prefetch-server-components' }">
Server components page
</NuxtLink>
</div>

View File

@ -1,15 +1,27 @@
<template>
<div>
<NuxtLink to="/" prefetched-class="prefetched">
<NuxtLink
to="/"
prefetched-class="prefetched"
>
Home
</NuxtLink>
<NuxtLink to="/random/a" prefetched-class="prefetched">
<NuxtLink
to="/random/a"
prefetched-class="prefetched"
>
Random (A)
</NuxtLink>
<NuxtLink to="/random/b" prefetched-class="prefetched">
<NuxtLink
to="/random/b"
prefetched-class="prefetched"
>
Random (B)
</NuxtLink>
<NuxtLink to="/random/c" prefetched-class="prefetched">
<NuxtLink
to="/random/c"
prefetched-class="prefetched"
>
Random (C)
</NuxtLink>
<ServerOnlyComponent />
@ -24,7 +36,10 @@
Here are some random numbers for you:
<ul>
<li v-for="n in randomNumbers" :key="n">
<li
v-for="n in randomNumbers"
:key="n"
>
{{ n }}
</li>
</ul>

View File

@ -9,18 +9,27 @@ const lazy = useRoute().query.lazy === 'true'
</script>
<template>
<div ref="page" class="end-page">
<div
ref="page"
class="end-page"
>
End page
<pre>{{ mountedHTML }}</pre>
<section id="fallback">
<AsyncServerComponent :lazy="lazy" :count="42">
<AsyncServerComponent
:lazy="lazy"
:count="42"
>
<template #fallback>
Loading server component
</template>
</AsyncServerComponent>
</section>
<section id="no-fallback">
<AsyncServerComponent :lazy="lazy" :count="42" />
<AsyncServerComponent
:lazy="lazy"
:count="42"
/>
</section>
</div>
</template>

View File

@ -24,13 +24,23 @@ definePageMeta({
<div style="display: flex; flex-direction: row; gap: 10vw;">
<div>
<h1>With extended layout</h1>
<NuxtLink v-for="link in links" :key="link" :to="link" style="display: block;">
<NuxtLink
v-for="link in links"
:key="link"
:to="link"
style="display: block;"
>
{{ link }}
</NuxtLink>
</div>
<div>
<h1>With custom layout</h1>
<NuxtLink v-for="link in links" :key="link" :to="`${link}?layout=custom`" style="display: block;">
<NuxtLink
v-for="link in links"
:key="link"
:to="`${link}?layout=custom`"
style="display: block;"
>
{{ link }}
</NuxtLink>
</div>

View File

@ -6,6 +6,7 @@ useClientOnlyComposable()
// can only run client side, should be tree shaken from server build
setTitleToPink()
</script>
<template>
<div>
<h1>Tree Shake Example</h1>

View File

@ -4,10 +4,16 @@
<div id="immediate-data">
{{ data === null ? "null" : data }}
</div>
<button id="execute-btn" @click="execute">
<button
id="execute-btn"
@click="execute"
>
execute
</button>
<NuxtLink id="to-index" to="/">
<NuxtLink
id="to-index"
to="/"
>
index
</NuxtLink>
</div>

View File

@ -35,5 +35,4 @@ if (data.value!.count !== initial + 1) {
if (data.value!.count !== data2.value!.count) {
throw new Error('AsyncData not synchronised')
}
</script>

View File

@ -17,6 +17,7 @@ function useLegacyVueUseHead () {
useLegacyUseHead()
useLegacyVueUseHead()
</script>
<template>
<div>
<h1>VueUse head polyfill test</h1>

View File

@ -7,6 +7,7 @@ if (import.meta.client) {
console.log('Running With Layout2 Page Setup')
}
</script>
<template>
<div id="with-layout2">
<div>with-layout2.vue</div>

View File

@ -1,12 +1,21 @@
<template>
<div>
<button class="swap-layout" @click="swapLayout">
<button
class="swap-layout"
@click="swapLayout"
>
swap layout
</button>
<button class="log-foo" @click="logFoo">
<button
class="log-foo"
@click="logFoo"
>
log foo
</button>
<button class="log-hello" @click="logHello">
<button
class="log-hello"
@click="logHello"
>
log hello
</button>
<NuxtLayout ref="layout" />

View File

@ -2,10 +2,16 @@
<div>
<NuxtPage ref="page" />
<button id="log-hello" @click="logHello">
<button
id="log-hello"
@click="logHello"
>
hello
</button>
<button id="log-foo" @click="logFoo">
<button
id="log-foo"
@click="logFoo"
>
foo
</button>
</div>

View File

@ -3,14 +3,16 @@
<p>
hello
</p>
<NuxtLink id="to-foo" to="/wrapper-expose/page">
<NuxtLink
id="to-foo"
to="/wrapper-expose/page"
>
to foo
</NuxtLink>
</div>
</template>
<script setup lang="ts">
function hello () {
console.log('world')
}

View File

@ -1,14 +1,16 @@
<template>
<div>
<p>foo</p>
<NuxtLink id="to-hello" to="/wrapper-expose/page/another">
<NuxtLink
id="to-hello"
to="/wrapper-expose/page/another"
>
to hello
</NuxtLink>
</div>
</template>
<script setup lang="ts">
function foo () {
console.log('bar')
}

View File

@ -1,9 +1,11 @@
<template>
<component :is="showIt" :name="name" />
<component
:is="showIt"
:name="name"
/>
</template>
<script>
export default defineNuxtComponent({
props: {
template: {

View File

@ -48,13 +48,27 @@ const Interactive = h({
<div>
<Helloworld id="hello-world" />
<ComponentDefinedInSetup id="component-defined-in-setup" />
<button id="increment-count" @click="count++">
<button
id="increment-count"
@click="count++"
>
{{ count }}
</button>
<template v-if="!pending">
<Name id="name" template="<div>I am the Name.ts component</div>" />
<show-template id="show-template" :template="data?.templateString ?? ''" name="John" />
<Interactive id="interactive" lastname="Doe" firstname="John" />
<Name
id="name"
template="<div>I am the Name.ts component</div>"
/>
<show-template
id="show-template"
:template="data?.templateString ?? ''"
name="John"
/>
<Interactive
id="interactive"
lastname="Doe"
firstname="John"
/>
</template>
</div>
</template>