Merge branch 'main' into patch-21

This commit is contained in:
Michael Brevard 2024-06-19 16:28:41 +03:00 committed by GitHub
commit 0919a82a75
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
37 changed files with 240 additions and 575 deletions

View File

@ -4,6 +4,7 @@ on:
push:
branches:
- main
- 3.x
- 2.x
permissions:
@ -16,7 +17,7 @@ concurrency:
jobs:
update:
if: github.repository_owner == 'nuxt' && !contains(github.event.head_commit.message, 'v3.')
if: github.repository_owner == 'nuxt' && !contains(github.event.head_commit.message, 'v3.') && !contains(github.event.head_commit.message, 'v4.')
runs-on: ubuntu-latest
steps:

View File

@ -11,7 +11,7 @@ permissions: {}
jobs:
release:
if: github.repository == 'nuxt/nuxt' && startsWith(github.event.head_commit.message, 'v3.')
if: github.repository == 'nuxt/nuxt' && (startsWith(github.event.head_commit.message, 'v3.') || startsWith(github.event.head_commit.message, 'v4.'))
permissions:
id-token: write
runs-on: ubuntu-latest

View File

@ -448,10 +448,11 @@ const importName = genSafeVariableName
Four experimental features are no longer configurable in Nuxt 4:
* `treeshakeClientOnly` will be `true` (default since v3.0)
* `configSchema` will be `true` (default since v3.3)
* `polyfillVueUseHead` will be `false` (default since v3.4)
* `respectNoSSRHeader` will be `false` (default since v3.4)
* `experimental.treeshakeClientOnly` will be `true` (default since v3.0)
* `experimental.configSchema` will be `true` (default since v3.3)
* `experimental.polyfillVueUseHead` will be `false` (default since v3.4)
* `experimental.respectNoSSRHeader` will be `false` (default since v3.4)
* `vite.devBundler` is no longer configurable - it will use `vite-node` by default
##### Reasons for Change

View File

@ -128,8 +128,6 @@ See [@unhead/schema](https://github.com/unjs/unhead/blob/main/packages/schema/sr
Reactivity is supported on all properties, by providing a computed value, a getter, or a reactive object.
It's recommended to use getters (`() => value`) over computed (`computed(() => value)`).
::code-group
```vue twoslash [useHead]

View File

@ -392,7 +392,7 @@ The page now applies the `slide-left` transition when going to the next id and `
## Transition with NuxtPage
When `<NuxtPage />` is used in `app.vue`, transition-props can be passed directly as a component props to activate global transition.
When `<NuxtPage />` is used in `app.vue`, transitions can be configured with the `transition` prop to activate transitions globally.
```vue [app.vue]
<template>

View File

@ -227,7 +227,7 @@ Combined with the `lazy` option, this can be useful for data that is not needed
const articles = await useFetch('/api/article')
/* This call will only be performed on the client */
const { pending, data: posts } = useFetch('/api/comments', {
const { pending, data: comments } = useFetch('/api/comments', {
lazy: true,
server: false
})

View File

@ -61,6 +61,6 @@ modules/
:read-more{to="/docs/guide/going-further/modules"}
::tip{icon="i-ph-video-duotone" to="https://vueschool.io/lessons/creating-your-first-module-from-scratch" target="_blank"}
::tip{icon="i-ph-video-duotone" to="https://vueschool.io/lessons/creating-your-first-module-from-scratch?friend=nuxt" target="_blank"}
Watch Vue School video about Nuxt private modules.
::

View File

@ -30,7 +30,7 @@ This will create a `my-module` project with all the boilerplate necessary to dev
Learn how to perform basic tasks with the module starter.
::tip{icon="i-ph-video-duotone" to="https://vueschool.io/lessons/navigating-the-official-starter-template" target="_blank"}
::tip{icon="i-ph-video-duotone" to="https://vueschool.io/lessons/navigating-the-official-starter-template?friend=nuxt" target="_blank"}
Watch Vue School video about Nuxt module starter template.
::
@ -259,7 +259,7 @@ export default defineNuxtModule({
When you need to handle more complex configuration alterations, you should consider using [defu](https://github.com/unjs/defu).
::tip{icon="i-ph-video-duotone" to="https://vueschool.io/lessons/extending-and-altering-nuxt-configuration-and-options" target="_blank"}
::tip{icon="i-ph-video-duotone" to="https://vueschool.io/lessons/extending-and-altering-nuxt-configuration-and-options?friend=nuxt" target="_blank"}
Watch Vue School video about altering Nuxt configuration.
::
@ -296,7 +296,7 @@ Be careful not to expose any sensitive module configuration on the public runtim
:read-more{to="/docs/guide/going-further/runtime-config"}
::tip{icon="i-ph-video-duotone" to="https://vueschool.io/lessons/passing-and-exposing-module-options" target="_blank"}
::tip{icon="i-ph-video-duotone" to="https://vueschool.io/lessons/passing-and-exposing-module-options?friend=nuxt" target="_blank"}
Watch Vue School video about passing and exposing Nuxt module options.
::
@ -523,7 +523,7 @@ export default defineNuxtModule({
:read-more{to="/docs/api/advanced/hooks"}
::tip{icon="i-ph-video-duotone" to="https://vueschool.io/lessons/nuxt-lifecycle-hooks" target="_blank"}
::tip{icon="i-ph-video-duotone" to="https://vueschool.io/lessons/nuxt-lifecycle-hooks?friend=nuxt" target="_blank"}
Watch Vue School video about using Nuxt lifecycle hooks in modules.
::
@ -749,7 +749,7 @@ The module starter comes with a default set of tools and configurations (e.g. ES
[Nuxt Module ecosystem](/modules) represents more than 15 million monthly NPM downloads and provides extended functionalities and integrations with all sort of tools. You can be part of this ecosystem!
::tip{icon="i-ph-video-duotone" to="https://vueschool.io/lessons/exploring-nuxt-modules-ecosystem-and-module-types" target="_blank"}
::tip{icon="i-ph-video-duotone" to="https://vueschool.io/lessons/exploring-nuxt-modules-ecosystem-and-module-types?friend=nuxt" target="_blank"}
Watch Vue School video about Nuxt module types.
::

View File

@ -211,7 +211,7 @@ Type of path to resolve. If set to `'file'`, the function will try to resolve a
Creates resolver relative to base path.
::tip{icon="i-ph-video-duotone" to="https://vueschool.io/lessons/resolving-paths-and-injecting-assets-to-the-app" target="_blank"}
::tip{icon="i-ph-video-duotone" to="https://vueschool.io/lessons/resolving-paths-and-injecting-assets-to-the-app?friend=nuxt" target="_blank"}
Watch Vue School video about createResolver.
::

View File

@ -18,7 +18,7 @@ These functions are designed for registering your own utils, composables and Vue
Nuxt auto-imports helper functions, composables and Vue APIs to use across your application without explicitly importing them. Based on the directory structure, every Nuxt application can also use auto-imports for its own composables and plugins. Composables or plugins can use these functions.
::tip{icon="i-ph-video-duotone" to="https://vueschool.io/lessons/expanding-nuxt-s-auto-imports" target="_blank"}
::tip{icon="i-ph-video-duotone" to="https://vueschool.io/lessons/expanding-nuxt-s-auto-imports?friend=nuxt" target="_blank"}
Watch Vue School video about Auto-imports Nuxt Kit utilities.
::

View File

@ -10,7 +10,7 @@ links:
Components are the building blocks of your Nuxt application. They are reusable Vue instances that can be used to create a user interface. In Nuxt, components from the components directory are automatically imported by default. However, if you need to import components from an alternative directory or wish to selectively import them as needed, `@nuxt/kit` provides the `addComponentsDir` and `addComponent` methods. These utils allow you to customize the component configuration to better suit your needs.
::tip{icon="i-ph-video-duotone" to="https://vueschool.io/lessons/injecting-components-and-component-directories" target="_blank"}
::tip{icon="i-ph-video-duotone" to="https://vueschool.io/lessons/injecting-components-and-component-directories?friend=nuxt" target="_blank"}
Watch Vue School video about injecting components.
::

View File

@ -12,7 +12,7 @@ links:
In Nuxt 3, routes are automatically generated based on the structure of the files in the `pages` directory. However, there may be scenarios where you'd want to customize these routes. For instance, you might need to add a route for a dynamic page not generated by Nuxt, remove an existing route, or modify the configuration of a route. For such customizations, Nuxt 3 offers the `extendPages` feature, which allows you to extend and alter the pages configuration.
::tip{icon="i-ph-video-duotone" to="https://vueschool.io/lessons/extend-and-alter-nuxt-pages" target="_blank"}
::tip{icon="i-ph-video-duotone" to="https://vueschool.io/lessons/extend-and-alter-nuxt-pages?friend=nuxt" target="_blank"}
Watch Vue School video about extendPages.
::
@ -71,7 +71,7 @@ Nuxt is powered by the [Nitro](https://nitro.unjs.io) server engine. With Nitro,
You can read more about Nitro route rules in the [Nitro documentation](https://nitro.unjs.io/guide/routing#route-rules).
::
::tip{icon="i-ph-video-duotone" to="https://vueschool.io/lessons/adding-route-rules-and-route-middlewares" target="_blank"}
::tip{icon="i-ph-video-duotone" to="https://vueschool.io/lessons/adding-route-rules-and-route-middlewares?friend=nuxt" target="_blank"}
Watch Vue School video about adding route rules and route middelwares.
::
@ -192,7 +192,7 @@ Route middlewares can be also defined in plugins via [`addRouteMiddleware`](/doc
Read more about route middlewares in the [Route middleware documentation](/docs/getting-started/routing#route-middleware).
::
::tip{icon="i-ph-video-duotone" to="https://vueschool.io/lessons/adding-route-rules-and-route-middlewares" target="_blank"}
::tip{icon="i-ph-video-duotone" to="https://vueschool.io/lessons/adding-route-rules-and-route-middlewares?friend=nuxt" target="_blank"}
Watch Vue School video about adding route rules and route middelwares.
::

View File

@ -14,7 +14,7 @@ Plugins are self-contained code that usually add app-level functionality to Vue.
Registers a Nuxt plugin and to the plugins array.
::tip{icon="i-ph-video-duotone" to="https://vueschool.io/lessons/injecting-plugins" target="_blank"}
::tip{icon="i-ph-video-duotone" to="https://vueschool.io/lessons/injecting-plugins?friend=nuxt" target="_blank"}
Watch Vue School video about addPlugin.
::
@ -114,7 +114,7 @@ export default defineNuxtPlugin((nuxtApp) => {
Adds a template and registers as a nuxt plugin. This is useful for plugins that need to generate code at build time.
::tip{icon="i-ph-video-duotone" to="https://vueschool.io/lessons/injecting-plugin-templates" target="_blank"}
::tip{icon="i-ph-video-duotone" to="https://vueschool.io/lessons/injecting-plugin-templates?friend=nuxt" target="_blank"}
Watch Vue School video about addPluginTemplate.
::

View File

@ -54,7 +54,7 @@
"@testing-library/vue": "8.1.0",
"@types/eslint__js": "8.42.3",
"@types/fs-extra": "11.0.4",
"@types/node": "20.14.2",
"@types/node": "20.14.5",
"@types/semver": "7.5.8",
"@unhead/schema": "1.9.13",
"@vitejs/plugin-vue": "5.0.4",
@ -93,7 +93,7 @@
"vue-router": "4.3.3",
"vue-tsc": "2.0.21"
},
"packageManager": "pnpm@9.3.0",
"packageManager": "pnpm@9.4.0",
"engines": {
"node": "^16.10.0 || >=18.0.0"
},

View File

@ -12,5 +12,4 @@ export default defineBuildConfig({
'vite',
'h3',
],
failOnWarn: false,
})

View File

@ -36,7 +36,6 @@
"ignore": "^5.3.1",
"jiti": "^1.21.6",
"klona": "^2.0.6",
"knitwork": "^1.1.0",
"mlly": "^1.7.1",
"pathe": "^1.1.2",
"pkg-types": "^1.1.1",
@ -49,9 +48,7 @@
},
"devDependencies": {
"@types/hash-sum": "1.0.2",
"@types/lodash-es": "4.17.12",
"@types/semver": "7.5.8",
"lodash-es": "4.17.21",
"nitropack": "2.9.6",
"unbuild": "latest",
"vite": "5.3.1",

View File

@ -29,23 +29,6 @@ export async function checkNuxtCompatibility (constraints: NuxtCompatibility, nu
}
}
// Bridge compatibility check
if (isNuxt2(nuxt)) {
const bridgeRequirement = constraints.bridge
const hasBridge = !!(nuxt.options as any).bridge
if (bridgeRequirement === true && !hasBridge) {
issues.push({
name: 'bridge',
message: 'Nuxt bridge is required',
})
} else if (bridgeRequirement === false && hasBridge) {
issues.push({
name: 'bridge',
message: 'Nuxt bridge is not supported',
})
}
}
// Builder compatibility check
if (constraints.builder && typeof nuxt.options.builder === 'string') {
const currentBuilder = builderMap[nuxt.options.builder] || nuxt.options.builder

View File

@ -35,4 +35,3 @@ export {
} from './internal/cjs'
export type { ResolveModuleOptions, RequireModuleOptions } from './internal/cjs'
export { tryResolveModule } from './internal/esm'
export * from './internal/template'

View File

@ -1,47 +0,0 @@
import { promises as fsp } from 'node:fs'
// TODO: swap out when https://github.com/lodash/lodash/pull/5649 is merged
import { template as lodashTemplate } from 'lodash-es'
import { genDynamicImport, genImport, genSafeVariableName } from 'knitwork'
import type { NuxtTemplate } from '@nuxt/schema'
import { logger } from '../logger'
import { toArray } from '../utils'
/** @deprecated */
// TODO: Remove support for compiling ejs templates in v4
export async function compileTemplate<T> (template: NuxtTemplate<T>, ctx: any) {
const data = { ...ctx, options: template.options }
if (template.src) {
try {
const srcContents = await fsp.readFile(template.src, 'utf-8')
return lodashTemplate(srcContents, {})(data)
} catch (err) {
logger.error('Error compiling template: ', template)
throw err
}
}
if (template.getContents) {
return template.getContents(data)
}
throw new Error('Invalid template: ' + JSON.stringify(template))
}
/** @deprecated */
const serialize = (data: any) => JSON.stringify(data, null, 2).replace(/"\{(.+)\}"(?=,?$)/gm, r => JSON.parse(r).replace(/^\{(.*)\}$/, '$1'))
/** @deprecated */
const importSources = (sources: string | string[], { lazy = false } = {}) => {
return toArray(sources).map((src) => {
const safeVariableName = genSafeVariableName(src)
if (lazy) {
return `const ${safeVariableName} = ${genDynamicImport(src, { comment: `webpackChunkName: ${JSON.stringify(src)}` })}`
}
return genImport(src, safeVariableName)
}).join('\n')
}
/** @deprecated */
const importName = genSafeVariableName
/** @deprecated */
export const templateUtils = { serialize, importName, importSources }

View File

@ -1,7 +1,6 @@
import type { NuxtTemplate } from '@nuxt/schema'
import { join, parse, relative } from 'pathe'
import { kebabCase } from 'scule'
import { isNuxt2 } from './compatibility'
import { useNuxt } from './context'
import { logger } from './logger'
import { addTemplate } from './template'
@ -11,21 +10,6 @@ export function addLayout (this: any, template: NuxtTemplate | string, name?: st
const { filename, src } = addTemplate(template)
const layoutName = kebabCase(name || parse(filename).name).replace(/["']/g, '')
if (isNuxt2(nuxt)) {
// Nuxt 2 adds layouts in options
const layout = (nuxt.options as any).layouts[layoutName]
if (layout) {
return logger.warn(
`Not overriding \`${layoutName}\` (provided by \`${layout}\`) with \`${src || filename}\`.`,
)
}
(nuxt.options as any).layouts[layoutName] = `./${filename}`
if (name === 'error') {
this.addErrorLayout(filename)
}
return
}
// Nuxt 3 adds layouts on app
nuxt.hook('app:templates', (app) => {
if (layoutName in app.layouts) {

View File

@ -1,13 +1,10 @@
import { promises as fsp } from 'node:fs'
import { performance } from 'node:perf_hooks'
import { defu } from 'defu'
import { applyDefaults } from 'untyped'
import { dirname } from 'pathe'
import type { ModuleDefinition, ModuleOptions, ModuleSetupReturn, Nuxt, NuxtModule, NuxtOptions, ResolvedNuxtTemplate } from '@nuxt/schema'
import type { ModuleDefinition, ModuleOptions, ModuleSetupReturn, Nuxt, NuxtModule, NuxtOptions } from '@nuxt/schema'
import { logger } from '../logger'
import { nuxtCtx, tryUseNuxt, useNuxt } from '../context'
import { checkNuxtCompatibility, isNuxt2 } from '../compatibility'
import { compileTemplate, templateUtils } from '../internal/template'
import { tryUseNuxt, useNuxt } from '../context'
import { checkNuxtCompatibility } from '../compatibility'
/**
* Define a Nuxt module, automatically merging defaults with user provided options, installing
@ -58,9 +55,6 @@ export function defineNuxtModule<OptionsT extends ModuleOptions> (definition: Mo
}
}
// Prepare
nuxt2Shims(nuxt)
// Resolve module and options
const _options = await getOptions(inlineOptions, nuxt)
@ -100,53 +94,3 @@ export function defineNuxtModule<OptionsT extends ModuleOptions> (definition: Mo
return normalizedModule as NuxtModule<OptionsT>
}
// -- Nuxt 2 compatibility shims --
const NUXT2_SHIMS_KEY = '__nuxt2_shims_key__'
function nuxt2Shims (nuxt: Nuxt) {
// Avoid duplicate install and only apply to Nuxt2
if (!isNuxt2(nuxt) || nuxt[NUXT2_SHIMS_KEY as keyof Nuxt]) { return }
nuxt[NUXT2_SHIMS_KEY as keyof Nuxt] = true
// Allow using nuxt.hooks
// @ts-expect-error Nuxt 2 extends hookable
nuxt.hooks = nuxt
// Allow using useNuxt()
if (!nuxtCtx.tryUse()) {
nuxtCtx.set(nuxt)
nuxt.hook('close', () => nuxtCtx.unset())
}
// Support virtual templates with getContents() by writing them to .nuxt directory
let virtualTemplates: ResolvedNuxtTemplate[]
// @ts-expect-error Nuxt 2 hook
nuxt.hook('builder:prepared', (_builder, buildOptions) => {
virtualTemplates = buildOptions.templates.filter((t: any) => t.getContents)
for (const template of virtualTemplates) {
buildOptions.templates.splice(buildOptions.templates.indexOf(template), 1)
}
})
// @ts-expect-error Nuxt 2 hook
nuxt.hook('build:templates', async (templates) => {
const context = {
nuxt,
utils: templateUtils,
app: {
dir: nuxt.options.srcDir,
extensions: nuxt.options.extensions,
plugins: nuxt.options.plugins,
templates: [
...templates.templatesFiles,
...virtualTemplates,
],
templateVars: templates.templateVars,
},
}
for await (const template of virtualTemplates) {
const contents = await compileTemplate({ ...template, src: '' }, context)
await fsp.mkdir(dirname(template.dst), { recursive: true })
await fsp.writeFile(template.dst, contents)
}
})
}

View File

@ -2,7 +2,6 @@ import { existsSync, promises as fsp, lstatSync } from 'node:fs'
import type { ModuleMeta, Nuxt, NuxtConfig, NuxtModule } from '@nuxt/schema'
import { dirname, isAbsolute, join, resolve } from 'pathe'
import { defu } from 'defu'
import { isNuxt2 } from '../compatibility'
import { useNuxt } from '../context'
import { requireModule } from '../internal/cjs'
import { importModule } from '../internal/esm'
@ -27,12 +26,7 @@ export async function installModule<
}
// Call module
const res = (
isNuxt2()
// @ts-expect-error Nuxt 2 `moduleContainer` is not typed
? await nuxtModule.call(nuxt.moduleContainer, inlineOptions, nuxt)
: await nuxtModule(inlineOptions, nuxt)
) ?? {}
const res = await nuxtModule(inlineOptions, nuxt) ?? {}
if (res === false /* setup aborted */) {
return
}

View File

@ -2,18 +2,11 @@ import type { NuxtHooks, NuxtMiddleware } from '@nuxt/schema'
import type { NitroRouteConfig } from 'nitropack'
import { defu } from 'defu'
import { useNuxt } from './context'
import { isNuxt2 } from './compatibility'
import { logger } from './logger'
import { toArray } from './utils'
export function extendPages (cb: NuxtHooks['pages:extend']) {
const nuxt = useNuxt()
if (isNuxt2(nuxt)) {
// @ts-expect-error TODO: Nuxt 2 hook
nuxt.hook('build:extendRoutes', cb)
} else {
nuxt.hook('pages:extend', cb)
}
useNuxt().hook('pages:extend', cb)
}
export interface ExtendRouteRulesOptions {

View File

@ -543,7 +543,10 @@ function clearNuxtDataByKey (nuxtApp: NuxtApp, key: string): void {
}
if (key in nuxtApp._asyncDataPromises) {
(nuxtApp._asyncDataPromises[key] as any).cancelled = true
if (nuxtApp._asyncDataPromises[key]) {
(nuxtApp._asyncDataPromises[key] as any).cancelled = true
}
nuxtApp._asyncDataPromises[key] = undefined
}
}

View File

@ -1,7 +1,7 @@
import { promises as fsp, mkdirSync, writeFileSync } from 'node:fs'
import { dirname, join, relative, resolve } from 'pathe'
import { defu } from 'defu'
import { compileTemplate as _compileTemplate, findPath, logger, normalizePlugin, normalizeTemplate, resolveAlias, resolveFiles, resolvePath, templateUtils } from '@nuxt/kit'
import { findPath, logger, normalizePlugin, normalizeTemplate, resolveAlias, resolveFiles, resolvePath } from '@nuxt/kit'
import type { Nuxt, NuxtApp, NuxtPlugin, NuxtTemplate, ResolvedNuxtTemplate } from 'nuxt/schema'
import * as defaultTemplates from './templates'
@ -53,9 +53,7 @@ export async function generateApp (nuxt: Nuxt, app: NuxtApp, options: { filter?:
}
// Compile templates into vfs
// TODO: remove utils in v4
const templateContext = { utils: templateUtils, nuxt, app }
const compileTemplate = nuxt.options.experimental.compileTemplate ? _compileTemplate : futureCompileTemplate
const templateContext = { nuxt, app }
const writes: Array<() => void> = []
const changedTemplates: Array<ResolvedNuxtTemplate<any>> = []
@ -113,7 +111,7 @@ export async function generateApp (nuxt: Nuxt, app: NuxtApp, options: { filter?:
}
/** @internal */
async function futureCompileTemplate<T> (template: NuxtTemplate<T>, ctx: { nuxt: Nuxt, app: NuxtApp, utils?: unknown }) {
async function compileTemplate<T> (template: NuxtTemplate<T>, ctx: { nuxt: Nuxt, app: NuxtApp, utils?: unknown }) {
delete ctx.utils
if (template.src) {

View File

@ -46,7 +46,7 @@
"@vue/compiler-sfc": "3.4.29",
"@vue/language-core": "2.0.21",
"c12": "1.11.1",
"esbuild-loader": "4.1.0",
"esbuild-loader": "4.2.0",
"h3": "1.11.1",
"ignore": "5.3.1",
"nitropack": "2.9.6",

View File

@ -26,8 +26,6 @@ export default defineUntypedSchema({
* app: 'app'
* },
* experimental: {
* compileTemplate: true,
* templateUtils: true,
* relativeWatchPaths: true,
* resetAsyncDataToUndefined: true,
* defaults: {
@ -475,31 +473,6 @@ export default defineUntypedSchema({
*/
clientNodeCompat: false,
/**
* Whether to use `lodash.template` to compile Nuxt templates.
*
* This flag will be removed with the release of v4 and exists only for
* advance testing within Nuxt v3.12+ or in [the nightly release channel](/docs/guide/going-further/nightly-release-channel).
*/
compileTemplate: {
async $resolve (val, get) {
return val ?? ((await get('future') as Record<string, unknown>).compatibilityVersion !== 4)
},
},
/**
* Whether to provide a legacy `templateUtils` object (with `serialize`,
* `importName` and `importSources`) when compiling Nuxt templates.
*
* This flag will be removed with the release of v4 and exists only for
* advance testing within Nuxt v3.12+ or in [the nightly release channel](/docs/guide/going-further/nightly-release-channel).
*/
templateUtils: {
async $resolve (val, get) {
return val ?? ((await get('future') as Record<string, unknown>).compatibilityVersion !== 4)
},
},
/**
* Whether to provide relative paths in the `builder:watch` hook.
*

View File

@ -101,12 +101,6 @@ export interface ViteConfig extends Omit<ViteUserConfig, 'publicDir'> {
*/
vueJsx?: VueJsxPluginOptions
/**
* Bundler for dev time server-side rendering.
* @default 'vite-node'
*/
devBundler?: 'vite-node' | 'legacy'
/**
* Warmup vite entrypoint caches on dev startup.
*/

View File

@ -1,8 +1,8 @@
import { runInNewContext } from 'node:vm'
import { join, resolve } from 'node:path'
import { fileURLToPath } from 'node:url'
import { promises as fsp } from 'node:fs'
import type { Plugin } from 'vite'
import { template } from 'lodash-es'
import genericMessages from '../templates/messages.json'
const templatesRoot = fileURLToPath(new URL('..', import.meta.url))
@ -15,6 +15,8 @@ export const DevRenderingPlugin = () => {
async transformIndexHtml (html: string, context) {
const page = context.originalUrl || '/'
if (page.endsWith('.png')) { return }
if (page === '/') {
const templateNames = await fsp.readdir(r('templates'))
const serializedData = JSON.stringify({ templateNames })
@ -25,11 +27,19 @@ export const DevRenderingPlugin = () => {
const messages = JSON.parse(await fsp.readFile(r(page, 'messages.json'), 'utf-8'))
return template(contents, {
interpolate: /\{\{\{?([\s\S]+?)\}?\}\}/g,
})({
messages: { ...genericMessages, ...messages },
})
const chunks = contents.split(/\{{2,3}[^{}]+\}{2,3}/g)
let templateString = chunks.shift()
for (const expression of contents.matchAll(/\{{2,3}([^{}]+)\}{2,3}/g)) {
const value = runInNewContext(expression[1].trim(), {
messages: { ...genericMessages, ...messages },
})
templateString += `${value}${chunks.shift()}`
}
if (chunks.length > 0) {
templateString += chunks.join('')
}
return templateString
},
}
}

View File

@ -20,7 +20,6 @@
},
"devDependencies": {
"@types/html-minifier": "4.0.5",
"@types/lodash-es": "4.17.12",
"@unocss/reset": "0.61.0",
"critters": "0.0.22",
"execa": "9.2.0",
@ -28,7 +27,6 @@
"html-minifier": "4.0.0",
"jiti": "1.21.6",
"knitwork": "1.1.0",
"lodash-es": "4.17.21",
"pathe": "1.1.2",
"prettier": "3.3.2",
"scule": "1.3.0",

View File

@ -1,265 +0,0 @@
import { pathToFileURL } from 'node:url'
import { existsSync } from 'node:fs'
import { builtinModules } from 'node:module'
import { isAbsolute, normalize, resolve } from 'pathe'
import type * as vite from 'vite'
import type { isExternal } from 'externality'
import { genDynamicImport, genObjectFromRawEntries } from 'knitwork'
import fse from 'fs-extra'
import { debounce } from 'perfect-debounce'
import { isIgnored, logger } from '@nuxt/kit'
import { hashId, isCSS, uniq } from './utils'
import { createIsExternal } from './utils/external'
import { writeManifest } from './manifest'
import type { ViteBuildContext } from './vite'
interface TransformChunk {
id: string
code: string
deps: string[]
parents: string[]
}
interface SSRTransformResult {
code: string
map: object
deps: string[]
dynamicDeps: string[]
}
interface TransformOptions {
viteServer: vite.ViteDevServer
isExternal(id: string): ReturnType<typeof isExternal>
}
async function transformRequest (opts: TransformOptions, id: string) {
// Virtual modules start with `\0`
if (id && id.startsWith('/@id/__x00__')) {
id = '\0' + id.slice('/@id/__x00__'.length)
}
if (id && id.startsWith('/@id/')) {
id = id.slice('/@id/'.length)
}
if (id && !id.startsWith('/@fs/') && id.startsWith('/')) {
// Relative to the root directory
const resolvedPath = resolve(opts.viteServer.config.root, '.' + id)
if (existsSync(resolvedPath)) {
id = resolvedPath
}
}
// On Windows, we prefix absolute paths with `/@fs/` to skip node resolution algorithm
id = id.replace(/^\/?(?=\w:)/, '/@fs/')
// Remove query and @fs/ for external modules
const externalId = id.replace(/\?v=\w+$|^\/@fs/, '')
if (await opts.isExternal(externalId)) {
const path = builtinModules.includes(externalId.split('node:').pop()!)
? externalId
: isAbsolute(externalId) ? pathToFileURL(externalId).href : externalId
return {
code: `(global, module, _, exports, importMeta, ssrImport, ssrDynamicImport, ssrExportAll) =>
${genDynamicImport(path, { wrapper: false })}
.then(r => {
if (r.default && r.default.__esModule)
r = r.default
exports.default = r.default
ssrExportAll(r)
})
.catch(e => {
console.error(e)
throw new Error(${JSON.stringify(`[vite dev] Error loading external "${id}".`)})
})`,
deps: [],
dynamicDeps: [],
}
}
// Transform
const res: SSRTransformResult = await opts.viteServer.transformRequest(id, { ssr: true }).catch((err) => {
logger.warn(`[SSR] Error transforming ${id}:`, err)
// console.error(err)
}) as SSRTransformResult || { code: '', map: {}, deps: [], dynamicDeps: [] }
// Wrap into a vite module
const code = `async function (global, module, exports, __vite_ssr_exports__, __vite_ssr_import_meta__, __vite_ssr_import__, __vite_ssr_dynamic_import__, __vite_ssr_exportAll__) {
${res.code || '/* empty */'};
}`
return { code, deps: res.deps || [], dynamicDeps: res.dynamicDeps || [] }
}
async function transformRequestRecursive (opts: TransformOptions, id: string, parent = '<entry>', chunks: Record<string, TransformChunk> = {}) {
if (chunks[id]) {
chunks[id].parents.push(parent)
return
}
const res = await transformRequest(opts, id)
const deps = uniq([...res.deps, ...res.dynamicDeps])
chunks[id] = {
id,
code: res.code,
deps,
parents: [parent],
} as TransformChunk
for (const dep of deps) {
await transformRequestRecursive(opts, dep, id, chunks)
}
return Object.values(chunks)
}
async function bundleRequest (opts: TransformOptions, entryURL: string) {
const chunks = (await transformRequestRecursive(opts, entryURL))!
const listIds = (ids: string[]) => ids.map(id => `// - ${id} (${hashId(id)})`).join('\n')
const chunksCode = chunks.map(chunk => `
// --------------------
// Request: ${chunk.id}
// Parents: \n${listIds(chunk.parents)}
// Dependencies: \n${listIds(chunk.deps)}
// --------------------
const ${hashId(chunk.id + '-' + chunk.code)} = ${chunk.code}
`).join('\n')
const manifestCode = `const __modules__ = ${
genObjectFromRawEntries(chunks.map(chunk => [chunk.id, hashId(chunk.id + '-' + chunk.code)]))
}`
// https://github.com/vitejs/vite/blob/main/packages/vite/src/node/ssr/ssrModuleLoader.ts
const ssrModuleLoader = `
const __pendingModules__ = new Map()
const __pendingImports__ = new Map()
const __ssrContext__ = { global: globalThis }
function __ssrLoadModule__(url, urlStack = []) {
const pendingModule = __pendingModules__.get(url)
if (pendingModule) { return pendingModule }
const modulePromise = __instantiateModule__(url, urlStack)
__pendingModules__.set(url, modulePromise)
modulePromise.catch(() => { __pendingModules__.delete(url) })
.finally(() => { __pendingModules__.delete(url) })
return modulePromise
}
async function __instantiateModule__(url, urlStack) {
const mod = __modules__[url]
if (mod.stubModule) { return mod.stubModule }
const stubModule = { [Symbol.toStringTag]: 'Module' }
Object.defineProperty(stubModule, '__esModule', { value: true })
mod.stubModule = stubModule
// https://vitejs.dev/guide/api-hmr.html
const importMeta = { url, hot: { accept() {}, prune() {}, dispose() {}, invalidate() {}, decline() {}, on() {} } }
urlStack = urlStack.concat(url)
const isCircular = url => urlStack.includes(url)
const pendingDeps = []
const ssrImport = async (dep) => {
// TODO: Handle externals if dep[0] !== '.' | '/'
if (!isCircular(dep) && !__pendingImports__.get(dep)?.some(isCircular)) {
pendingDeps.push(dep)
if (pendingDeps.length === 1) {
__pendingImports__.set(url, pendingDeps)
}
await __ssrLoadModule__(dep, urlStack)
if (pendingDeps.length === 1) {
__pendingImports__.delete(url)
} else {
pendingDeps.splice(pendingDeps.indexOf(dep), 1)
}
}
return __modules__[dep].stubModule
}
function ssrDynamicImport (dep) {
// TODO: Handle dynamic import starting with . relative to url
return ssrImport(dep)
}
function ssrExportAll(sourceModule) {
for (const key in sourceModule) {
if (key !== 'default') {
try {
Object.defineProperty(stubModule, key, {
enumerable: true,
configurable: true,
get() { return sourceModule[key] }
})
} catch (_err) { }
}
}
}
const cjsModule = {
get exports () {
return stubModule.default
},
set exports (v) {
stubModule.default = v
},
}
await mod(
__ssrContext__.global,
cjsModule,
stubModule.default,
stubModule,
importMeta,
ssrImport,
ssrDynamicImport,
ssrExportAll
)
return stubModule
}
`
const code = [
chunksCode,
manifestCode,
ssrModuleLoader,
`export default await __ssrLoadModule__(${JSON.stringify(entryURL)})`,
].join('\n\n')
return {
code,
ids: chunks.map(i => i.id),
}
}
export async function initViteDevBundler (ctx: ViteBuildContext, onBuild: () => Promise<any>) {
const viteServer = ctx.ssrServer!
const options: TransformOptions = {
viteServer,
isExternal: createIsExternal(viteServer, ctx.nuxt.options.rootDir, ctx.nuxt.options.modulesDir),
}
// Build and watch
const _doBuild = async () => {
const start = Date.now()
const { code, ids } = await bundleRequest(options, ctx.entry)
await fse.writeFile(resolve(ctx.nuxt.options.buildDir, 'dist/server/server.mjs'), code, 'utf-8')
// Have CSS in the manifest to prevent FOUC on dev SSR
const manifestIds: string[] = []
for (const i of ids) {
if (isCSS(i)) {
manifestIds.push(i.slice(1))
}
}
await writeManifest(ctx, manifestIds)
const time = (Date.now() - start)
logger.success(`Vite server built in ${time}ms`)
await onBuild()
}
const doBuild = debounce(_doBuild)
// Initial build
await _doBuild()
// Watch
viteServer.watcher.on('all', (_event, file) => {
file = normalize(file) // Fix windows paths
if (file.indexOf(ctx.nuxt.options.buildDir) === 0 || isIgnored(file)) { return }
doBuild()
})
// ctx.nuxt.hook('builder:watch', () => doBuild())
ctx.nuxt.hook('app:templatesGenerated', () => doBuild())
}

View File

@ -163,10 +163,5 @@ export async function buildServer (ctx: ViteBuildContext) {
// Initialize plugins
await viteServer.pluginContainer.buildStart({})
if (ctx.config.devBundler !== 'legacy') {
await initViteNodeServer(ctx)
} else {
logger.info('Vite server using legacy server bundler...')
await import('./dev-bundler').then(r => r.initViteDevBundler(ctx, onBuild))
}
await initViteNodeServer(ctx)
}

View File

@ -29,8 +29,7 @@ export interface ViteBuildContext {
}
export const bundle: NuxtBuilder['bundle'] = async (nuxt) => {
const useAsyncEntry = nuxt.options.experimental.asyncEntry ||
(nuxt.options.vite.devBundler === 'vite-node' && nuxt.options.dev)
const useAsyncEntry = nuxt.options.experimental.asyncEntry || nuxt.options.dev
const entry = await resolvePath(resolve(nuxt.options.appDir, useAsyncEntry ? 'entry.async' : 'entry'))
let allowDirs = [

View File

@ -32,7 +32,7 @@
"css-minimizer-webpack-plugin": "^7.0.0",
"cssnano": "^7.0.2",
"defu": "^6.1.4",
"esbuild-loader": "^4.1.0",
"esbuild-loader": "^4.2.0",
"escape-string-regexp": "^5.0.0",
"estree-walker": "^3.0.3",
"file-loader": "^6.2.0",

View File

@ -31,7 +31,7 @@ importers:
version: link:packages/kit
'@nuxt/test-utils':
specifier: 3.13.1
version: 3.13.1(@testing-library/vue@8.1.0(@vue/compiler-sfc@3.4.29)(vue@3.4.29(typescript@5.4.5)))(@vue/test-utils@2.4.6)(h3@1.11.1)(happy-dom@14.12.0)(magicast@0.3.4)(nitropack@2.9.6(encoding@0.1.13)(magicast@0.3.4))(playwright-core@1.44.1)(vite@5.3.1(@types/node@20.14.2)(sass@1.69.4)(terser@5.27.0))(vitest@1.6.0(@types/node@20.14.2)(happy-dom@14.12.0)(sass@1.69.4)(terser@5.27.0))(vue-router@4.3.3(vue@3.4.29(typescript@5.4.5)))(vue@3.4.29(typescript@5.4.5))
version: 3.13.1(@testing-library/vue@8.1.0(@vue/compiler-sfc@3.4.29)(vue@3.4.29(typescript@5.4.5)))(@vue/test-utils@2.4.6)(h3@1.11.1)(happy-dom@14.12.0)(magicast@0.3.4)(nitropack@2.9.6(encoding@0.1.13)(magicast@0.3.4))(playwright-core@1.44.1)(vite@5.3.1(@types/node@20.14.5)(sass@1.69.4)(terser@5.27.0))(vitest@1.6.0(@types/node@20.14.5)(happy-dom@14.12.0)(sass@1.69.4)(terser@5.27.0))(vue-router@4.3.3(vue@3.4.29(typescript@5.4.5)))(vue@3.4.29(typescript@5.4.5))
'@nuxt/webpack-builder':
specifier: workspace:*
version: link:packages/webpack
@ -45,8 +45,8 @@ importers:
specifier: 11.0.4
version: 11.0.4
'@types/node':
specifier: 20.14.2
version: 20.14.2
specifier: 20.14.5
version: 20.14.5
'@types/semver':
specifier: 7.5.8
version: 7.5.8
@ -55,10 +55,10 @@ importers:
version: 1.9.13
'@vitejs/plugin-vue':
specifier: 5.0.4
version: 5.0.4(vite@5.3.1(@types/node@20.14.2)(sass@1.69.4)(terser@5.27.0))(vue@3.4.29(typescript@5.4.5))
version: 5.0.4(vite@5.3.1(@types/node@20.14.5)(sass@1.69.4)(terser@5.27.0))(vue@3.4.29(typescript@5.4.5))
'@vitest/coverage-v8':
specifier: 1.6.0
version: 1.6.0(vitest@1.6.0(@types/node@20.14.2)(happy-dom@14.12.0)(sass@1.69.4)(terser@5.27.0))
version: 1.6.0(vitest@1.6.0(@types/node@20.14.5)(happy-dom@14.12.0)(sass@1.69.4)(terser@5.27.0))
'@vue/test-utils':
specifier: 2.4.6
version: 2.4.6
@ -145,10 +145,10 @@ importers:
version: 1.5.3
vitest:
specifier: 1.6.0
version: 1.6.0(@types/node@20.14.2)(happy-dom@14.12.0)(sass@1.69.4)(terser@5.27.0)
version: 1.6.0(@types/node@20.14.5)(happy-dom@14.12.0)(sass@1.69.4)(terser@5.27.0)
vitest-environment-nuxt:
specifier: 1.0.0
version: 1.0.0(@testing-library/vue@8.1.0(@vue/compiler-sfc@3.4.29)(vue@3.4.29(typescript@5.4.5)))(@vue/test-utils@2.4.6)(h3@1.11.1)(happy-dom@14.12.0)(magicast@0.3.4)(nitropack@2.9.6(encoding@0.1.13)(magicast@0.3.4))(playwright-core@1.44.1)(vite@5.3.1(@types/node@20.14.2)(sass@1.69.4)(terser@5.27.0))(vitest@1.6.0(@types/node@20.14.2)(happy-dom@14.12.0)(sass@1.69.4)(terser@5.27.0))(vue-router@4.3.3(vue@3.4.29(typescript@5.4.5)))(vue@3.4.29(typescript@5.4.5))
version: 1.0.0(@testing-library/vue@8.1.0(@vue/compiler-sfc@3.4.29)(vue@3.4.29(typescript@5.4.5)))(@vue/test-utils@2.4.6)(h3@1.11.1)(happy-dom@14.12.0)(magicast@0.3.4)(nitropack@2.9.6(encoding@0.1.13)(magicast@0.3.4))(playwright-core@1.44.1)(vite@5.3.1(@types/node@20.14.5)(sass@1.69.4)(terser@5.27.0))(vitest@1.6.0(@types/node@20.14.5)(happy-dom@14.12.0)(sass@1.69.4)(terser@5.27.0))(vue-router@4.3.3(vue@3.4.29(typescript@5.4.5)))(vue@3.4.29(typescript@5.4.5))
vue:
specifier: 3.4.29
version: 3.4.29(typescript@5.4.5)
@ -191,9 +191,6 @@ importers:
klona:
specifier: ^2.0.6
version: 2.0.6
knitwork:
specifier: ^1.1.0
version: 1.1.0
mlly:
specifier: ^1.7.1
version: 1.7.1
@ -225,15 +222,9 @@ importers:
'@types/hash-sum':
specifier: 1.0.2
version: 1.0.2
'@types/lodash-es':
specifier: 4.17.12
version: 4.17.12
'@types/semver':
specifier: 7.5.8
version: 7.5.8
lodash-es:
specifier: 4.17.21
version: 4.17.21
nitropack:
specifier: 2.9.6
version: 2.9.6(encoding@0.1.13)(magicast@0.3.4)
@ -242,10 +233,10 @@ importers:
version: 2.0.0(sass@1.69.4)(typescript@5.4.5)
vite:
specifier: 5.3.1
version: 5.3.1(@types/node@20.14.2)(sass@1.69.4)(terser@5.27.0)
version: 5.3.1(@types/node@20.14.5)(sass@1.69.4)(terser@5.27.0)
vitest:
specifier: 1.6.0
version: 1.6.0(@types/node@20.14.2)(happy-dom@14.12.0)(sass@1.69.4)(terser@5.27.0)
version: 1.6.0(@types/node@20.14.5)(happy-dom@14.12.0)(sass@1.69.4)(terser@5.27.0)
webpack:
specifier: 5.92.0
version: 5.92.0
@ -517,10 +508,10 @@ importers:
version: 1.9.13
'@vitejs/plugin-vue':
specifier: 5.0.4
version: 5.0.4(vite@5.3.1(@types/node@20.14.2)(sass@1.69.4)(terser@5.27.0))(vue@3.4.29(typescript@5.4.5))
version: 5.0.4(vite@5.3.1(@types/node@20.14.5)(sass@1.69.4)(terser@5.27.0))(vue@3.4.29(typescript@5.4.5))
'@vitejs/plugin-vue-jsx':
specifier: 4.0.0
version: 4.0.0(vite@5.3.1(@types/node@20.14.2)(sass@1.69.4)(terser@5.27.0))(vue@3.4.29(typescript@5.4.5))
version: 4.0.0(vite@5.3.1(@types/node@20.14.5)(sass@1.69.4)(terser@5.27.0))(vue@3.4.29(typescript@5.4.5))
'@vue/compiler-core':
specifier: 3.4.29
version: 3.4.29
@ -534,8 +525,8 @@ importers:
specifier: 1.11.1
version: 1.11.1(magicast@0.3.4)
esbuild-loader:
specifier: 4.1.0
version: 4.1.0(webpack@5.92.0)
specifier: 4.2.0
version: 4.2.0(webpack@5.92.0)
h3:
specifier: 1.11.1
version: 1.11.1
@ -559,7 +550,7 @@ importers:
version: 1.9.0
vite:
specifier: 5.3.1
version: 5.3.1(@types/node@20.14.2)(sass@1.69.4)(terser@5.27.0)
version: 5.3.1(@types/node@20.14.5)(sass@1.69.4)(terser@5.27.0)
vue:
specifier: 3.4.29
version: 3.4.29(typescript@5.4.5)
@ -584,9 +575,6 @@ importers:
'@types/html-minifier':
specifier: 4.0.5
version: 4.0.5
'@types/lodash-es':
specifier: 4.17.12
version: 4.17.12
'@unocss/reset':
specifier: 0.61.0
version: 0.61.0
@ -608,9 +596,6 @@ importers:
knitwork:
specifier: 1.1.0
version: 1.1.0
lodash-es:
specifier: 4.17.21
version: 4.17.21
pathe:
specifier: 1.1.2
version: 1.1.2
@ -622,10 +607,10 @@ importers:
version: 1.3.0
unocss:
specifier: 0.61.0
version: 0.61.0(@unocss/webpack@0.60.4(rollup@4.18.0)(webpack@5.92.0(esbuild@0.21.5)))(postcss@8.4.38)(rollup@4.18.0)(vite@5.3.1(@types/node@20.14.2)(sass@1.69.4)(terser@5.27.0))
version: 0.61.0(postcss@8.4.38)(rollup@4.18.0)(vite@5.3.1(@types/node@20.14.5)(sass@1.69.4)(terser@5.27.0))
vite:
specifier: 5.3.1
version: 5.3.1(@types/node@20.14.2)(sass@1.69.4)(terser@5.27.0)
version: 5.3.1(@types/node@20.14.5)(sass@1.69.4)(terser@5.27.0)
packages/vite:
dependencies:
@ -637,10 +622,10 @@ importers:
version: 5.0.7(rollup@4.18.0)
'@vitejs/plugin-vue':
specifier: ^5.0.4
version: 5.0.4(vite@5.3.1(@types/node@20.14.2)(sass@1.69.4)(terser@5.27.0))(vue@3.4.29(typescript@5.4.5))
version: 5.0.4(vite@5.3.1(@types/node@20.14.5)(sass@1.69.4)(terser@5.27.0))(vue@3.4.29(typescript@5.4.5))
'@vitejs/plugin-vue-jsx':
specifier: ^4.0.0
version: 4.0.0(vite@5.3.1(@types/node@20.14.2)(sass@1.69.4)(terser@5.27.0))(vue@3.4.29(typescript@5.4.5))
version: 4.0.0(vite@5.3.1(@types/node@20.14.5)(sass@1.69.4)(terser@5.27.0))(vue@3.4.29(typescript@5.4.5))
autoprefixer:
specifier: ^10.4.19
version: 10.4.19(postcss@8.4.38)
@ -721,13 +706,13 @@ importers:
version: 1.10.1
vite:
specifier: 5.3.1
version: 5.3.1(@types/node@20.14.2)(sass@1.69.4)(terser@5.27.0)
version: 5.3.1(@types/node@20.14.5)(sass@1.69.4)(terser@5.27.0)
vite-node:
specifier: ^1.6.0
version: 1.6.0(@types/node@20.14.2)(sass@1.69.4)(terser@5.27.0)
version: 1.6.0(@types/node@20.14.5)(sass@1.69.4)(terser@5.27.0)
vite-plugin-checker:
specifier: ^0.6.4
version: 0.6.4(eslint@9.5.0)(optionator@0.9.3)(typescript@5.4.5)(vite@5.3.1(@types/node@20.14.2)(sass@1.69.4)(terser@5.27.0))(vue-tsc@2.0.21(typescript@5.4.5))
version: 0.6.4(eslint@9.5.0)(optionator@0.9.3)(typescript@5.4.5)(vite@5.3.1(@types/node@20.14.5)(sass@1.69.4)(terser@5.27.0))(vue-tsc@2.0.21(typescript@5.4.5))
vue-bundle-renderer:
specifier: ^2.1.0
version: 2.1.0
@ -778,8 +763,8 @@ importers:
specifier: ^6.1.4
version: 6.1.4
esbuild-loader:
specifier: ^4.1.0
version: 4.1.0(webpack@5.92.0)
specifier: ^4.2.0
version: 4.2.0(webpack@5.92.0)
escape-string-regexp:
specifier: ^5.0.0
version: 5.0.0
@ -986,7 +971,7 @@ importers:
version: 0.7.0(rollup@4.18.0)(vue-router@4.3.3(vue@3.4.29(typescript@5.4.5)))(vue@3.4.29(typescript@5.4.5))
vitest:
specifier: 1.6.0
version: 1.6.0(@types/node@20.14.2)(happy-dom@14.12.0)(sass@1.69.4)(terser@5.27.0)
version: 1.6.0(@types/node@20.14.5)(happy-dom@14.12.0)(sass@1.69.4)(terser@5.27.0)
vue:
specifier: 3.4.29
version: 3.4.29(typescript@5.4.5)
@ -2562,6 +2547,9 @@ packages:
'@types/node@20.14.2':
resolution: {integrity: sha512-xyu6WAMVwv6AKFLB+e/7ySZVr/0zLCzOa7rSpq6jNwpqOrUbcACDWC+53d4n2QHOnDou0fbIsg8wZu/sxrnI4Q==}
'@types/node@20.14.5':
resolution: {integrity: sha512-aoRR+fJkZT2l0aGOJhuA8frnCSoNX6W7U2mpNq63+BxBIj5BQFt8rHy627kijCmm63ijdSdwvGgpUsU6MBsZZA==}
'@types/normalize-package-data@2.4.4':
resolution: {integrity: sha512-37i+OaWTh9qeK4LSHPsyRC7NahnGotNuZvjLSgcPzblpHB3rrCJxAOgI5gCdKm7coonsaX1Of0ILiTcnZjbfxA==}
@ -4080,8 +4068,8 @@ packages:
es-module-lexer@1.3.1:
resolution: {integrity: sha512-JUFAyicQV9mXc3YRxPnDlrfBKpqt6hUYzz9/boprUJHs4e4KVr3XwOF70doO6gwXUor6EWZJAyWAfKki84t20Q==}
esbuild-loader@4.1.0:
resolution: {integrity: sha512-543TtIvqbqouEMlOHg4xKoDQkmdImlwIpyAIgpUtDPvMuklU/c2k+Qt2O3VeDBgAwozxmlEbjOzV+F8CZ0g+Bw==}
esbuild-loader@4.2.0:
resolution: {integrity: sha512-BhwHchuDknxIa69AqOPeZh2fIFqj2AzZKC1E3RBRvXSuyk5drsqMrwsgYZJufX41yrauLYjDM3KBmruoGl1NWQ==}
peerDependencies:
webpack: ^4.40.0 || ^5.0.0
@ -8308,7 +8296,7 @@ snapshots:
'@jest/schemas': 29.6.3
'@types/istanbul-lib-coverage': 2.0.5
'@types/istanbul-reports': 3.0.3
'@types/node': 20.14.2
'@types/node': 20.14.5
'@types/yargs': 17.0.28
chalk: 4.1.2
@ -8726,7 +8714,7 @@ snapshots:
rc9: 2.1.2
std-env: 3.7.0
'@nuxt/test-utils@3.13.1(@testing-library/vue@8.1.0(@vue/compiler-sfc@3.4.29)(vue@3.4.29(typescript@5.4.5)))(@vue/test-utils@2.4.6)(h3@1.11.1)(happy-dom@14.12.0)(magicast@0.3.4)(nitropack@2.9.6(encoding@0.1.13)(magicast@0.3.4))(playwright-core@1.44.1)(vite@5.3.1(@types/node@20.14.2)(sass@1.69.4)(terser@5.27.0))(vitest@1.6.0(@types/node@20.14.2)(happy-dom@14.12.0)(sass@1.69.4)(terser@5.27.0))(vue-router@4.3.3(vue@3.4.29(typescript@5.4.5)))(vue@3.4.29(typescript@5.4.5))':
'@nuxt/test-utils@3.13.1(@testing-library/vue@8.1.0(@vue/compiler-sfc@3.4.29)(vue@3.4.29(typescript@5.4.5)))(@vue/test-utils@2.4.6)(h3@1.11.1)(happy-dom@14.12.0)(magicast@0.3.4)(nitropack@2.9.6(encoding@0.1.13)(magicast@0.3.4))(playwright-core@1.44.1)(vite@5.3.1(@types/node@20.14.5)(sass@1.69.4)(terser@5.27.0))(vitest@1.6.0(@types/node@20.14.5)(happy-dom@14.12.0)(sass@1.69.4)(terser@5.27.0))(vue-router@4.3.3(vue@3.4.29(typescript@5.4.5)))(vue@3.4.29(typescript@5.4.5))':
dependencies:
'@nuxt/kit': link:packages/kit
'@nuxt/schema': link:packages/schema
@ -8752,8 +8740,8 @@ snapshots:
ufo: 1.5.3
unenv: 1.9.0
unplugin: 1.10.1
vite: 5.3.1(@types/node@20.14.2)(sass@1.69.4)(terser@5.27.0)
vitest-environment-nuxt: 1.0.0(@testing-library/vue@8.1.0(@vue/compiler-sfc@3.4.29)(vue@3.4.29(typescript@5.4.5)))(@vue/test-utils@2.4.6)(h3@1.11.1)(happy-dom@14.12.0)(magicast@0.3.4)(nitropack@2.9.6(encoding@0.1.13)(magicast@0.3.4))(playwright-core@1.44.1)(vite@5.3.1(@types/node@20.14.2)(sass@1.69.4)(terser@5.27.0))(vitest@1.6.0(@types/node@20.14.2)(happy-dom@14.12.0)(sass@1.69.4)(terser@5.27.0))(vue-router@4.3.3(vue@3.4.29(typescript@5.4.5)))(vue@3.4.29(typescript@5.4.5))
vite: 5.3.1(@types/node@20.14.5)(sass@1.69.4)(terser@5.27.0)
vitest-environment-nuxt: 1.0.0(@testing-library/vue@8.1.0(@vue/compiler-sfc@3.4.29)(vue@3.4.29(typescript@5.4.5)))(@vue/test-utils@2.4.6)(h3@1.11.1)(happy-dom@14.12.0)(magicast@0.3.4)(nitropack@2.9.6(encoding@0.1.13)(magicast@0.3.4))(playwright-core@1.44.1)(vite@5.3.1(@types/node@20.14.5)(sass@1.69.4)(terser@5.27.0))(vitest@1.6.0(@types/node@20.14.5)(happy-dom@14.12.0)(sass@1.69.4)(terser@5.27.0))(vue-router@4.3.3(vue@3.4.29(typescript@5.4.5)))(vue@3.4.29(typescript@5.4.5))
vue: 3.4.29(typescript@5.4.5)
vue-router: 4.3.3(vue@3.4.29(typescript@5.4.5))
optionalDependencies:
@ -8761,7 +8749,7 @@ snapshots:
'@vue/test-utils': 2.4.6
happy-dom: 14.12.0
playwright-core: 1.44.1
vitest: 1.6.0(@types/node@20.14.2)(happy-dom@14.12.0)(sass@1.69.4)(terser@5.27.0)
vitest: 1.6.0(@types/node@20.14.5)(happy-dom@14.12.0)(sass@1.69.4)(terser@5.27.0)
transitivePeerDependencies:
- magicast
@ -9156,14 +9144,14 @@ snapshots:
'@types/clean-css@4.2.11':
dependencies:
'@types/node': 20.14.2
'@types/node': 20.14.5
source-map: 0.6.1
'@types/clear@0.1.4': {}
'@types/connect@3.4.37':
dependencies:
'@types/node': 20.14.2
'@types/node': 20.14.5
'@types/debug@4.1.12':
dependencies:
@ -9210,7 +9198,7 @@ snapshots:
'@types/http-proxy@1.17.14':
dependencies:
'@types/node': 20.14.2
'@types/node': 20.14.5
'@types/istanbul-lib-coverage@2.0.5': {}
@ -9226,7 +9214,7 @@ snapshots:
'@types/jsonfile@6.1.2':
dependencies:
'@types/node': 20.14.2
'@types/node': 20.14.5
'@types/lodash-es@4.17.12':
dependencies:
@ -9242,12 +9230,16 @@ snapshots:
'@types/node-sass@4.11.6':
dependencies:
'@types/node': 20.14.2
'@types/node': 20.14.5
'@types/node@20.14.2':
dependencies:
undici-types: 5.26.5
'@types/node@20.14.5':
dependencies:
undici-types: 5.26.5
'@types/normalize-package-data@2.4.4': {}
'@types/pify@5.0.4': {}
@ -9309,13 +9301,13 @@ snapshots:
'@types/webpack-sources@3.2.1':
dependencies:
'@types/node': 20.14.2
'@types/node': 20.14.5
'@types/source-list-map': 0.1.4
source-map: 0.7.4
'@types/webpack@4.41.34':
dependencies:
'@types/node': 20.14.2
'@types/node': 20.14.5
'@types/tapable': 1.0.10
'@types/uglify-js': 3.17.3
'@types/webpack-sources': 3.2.1
@ -9466,6 +9458,16 @@ snapshots:
transitivePeerDependencies:
- rollup
'@unocss/astro@0.61.0(rollup@4.18.0)(vite@5.3.1(@types/node@20.14.5)(sass@1.69.4)(terser@5.27.0))':
dependencies:
'@unocss/core': 0.61.0
'@unocss/reset': 0.61.0
'@unocss/vite': 0.61.0(rollup@4.18.0)(vite@5.3.1(@types/node@20.14.5)(sass@1.69.4)(terser@5.27.0))
optionalDependencies:
vite: 5.3.1(@types/node@20.14.5)(sass@1.69.4)(terser@5.27.0)
transitivePeerDependencies:
- rollup
'@unocss/cli@0.60.4(rollup@4.18.0)':
dependencies:
'@ampproject/remapping': 2.3.0
@ -9775,6 +9777,22 @@ snapshots:
transitivePeerDependencies:
- rollup
'@unocss/vite@0.61.0(rollup@4.18.0)(vite@5.3.1(@types/node@20.14.5)(sass@1.69.4)(terser@5.27.0))':
dependencies:
'@ampproject/remapping': 2.3.0
'@rollup/pluginutils': 5.1.0(rollup@4.18.0)
'@unocss/config': 0.61.0
'@unocss/core': 0.61.0
'@unocss/inspector': 0.61.0
'@unocss/scope': 0.61.0
'@unocss/transformer-directives': 0.61.0
chokidar: 3.6.0
fast-glob: 3.3.2
magic-string: 0.30.10
vite: 5.3.1(@types/node@20.14.5)(sass@1.69.4)(terser@5.27.0)
transitivePeerDependencies:
- rollup
'@unocss/webpack@0.60.4(rollup@4.18.0)(webpack@5.92.0(esbuild@0.21.5))':
dependencies:
'@ampproject/remapping': 2.3.0
@ -9808,12 +9826,12 @@ snapshots:
- encoding
- supports-color
'@vitejs/plugin-vue-jsx@4.0.0(vite@5.3.1(@types/node@20.14.2)(sass@1.69.4)(terser@5.27.0))(vue@3.4.29(typescript@5.4.5))':
'@vitejs/plugin-vue-jsx@4.0.0(vite@5.3.1(@types/node@20.14.5)(sass@1.69.4)(terser@5.27.0))(vue@3.4.29(typescript@5.4.5))':
dependencies:
'@babel/core': 7.24.7
'@babel/plugin-transform-typescript': 7.24.7(@babel/core@7.24.7)
'@vue/babel-plugin-jsx': 1.2.2(@babel/core@7.24.7)
vite: 5.3.1(@types/node@20.14.2)(sass@1.69.4)(terser@5.27.0)
vite: 5.3.1(@types/node@20.14.5)(sass@1.69.4)(terser@5.27.0)
vue: 3.4.29(typescript@5.4.5)
transitivePeerDependencies:
- supports-color
@ -9823,7 +9841,12 @@ snapshots:
vite: 5.3.1(@types/node@20.14.2)(sass@1.69.4)(terser@5.27.0)
vue: 3.4.29(typescript@5.4.5)
'@vitest/coverage-v8@1.6.0(vitest@1.6.0(@types/node@20.14.2)(happy-dom@14.12.0)(sass@1.69.4)(terser@5.27.0))':
'@vitejs/plugin-vue@5.0.4(vite@5.3.1(@types/node@20.14.5)(sass@1.69.4)(terser@5.27.0))(vue@3.4.29(typescript@5.4.5))':
dependencies:
vite: 5.3.1(@types/node@20.14.5)(sass@1.69.4)(terser@5.27.0)
vue: 3.4.29(typescript@5.4.5)
'@vitest/coverage-v8@1.6.0(vitest@1.6.0(@types/node@20.14.5)(happy-dom@14.12.0)(sass@1.69.4)(terser@5.27.0))':
dependencies:
'@ampproject/remapping': 2.3.0
'@bcoe/v8-coverage': 0.2.3
@ -9838,7 +9861,7 @@ snapshots:
std-env: 3.7.0
strip-literal: 2.1.0
test-exclude: 6.0.0
vitest: 1.6.0(@types/node@20.14.2)(happy-dom@14.12.0)(sass@1.69.4)(terser@5.27.0)
vitest: 1.6.0(@types/node@20.14.5)(happy-dom@14.12.0)(sass@1.69.4)(terser@5.27.0)
transitivePeerDependencies:
- supports-color
@ -11165,9 +11188,9 @@ snapshots:
es-module-lexer@1.3.1: {}
esbuild-loader@4.1.0(webpack@5.92.0):
esbuild-loader@4.2.0(webpack@5.92.0):
dependencies:
esbuild: 0.20.2
esbuild: 0.21.5
get-tsconfig: 4.7.3
loader-utils: 2.0.4
webpack: 5.92.0
@ -12314,7 +12337,7 @@ snapshots:
jest-util@29.7.0:
dependencies:
'@jest/types': 29.6.3
'@types/node': 20.14.2
'@types/node': 20.14.5
chalk: 4.1.2
ci-info: 3.9.0
graceful-fs: 4.2.11
@ -12322,13 +12345,13 @@ snapshots:
jest-worker@27.5.1:
dependencies:
'@types/node': 20.14.2
'@types/node': 20.14.5
merge-stream: 2.0.0
supports-color: 8.1.1
jest-worker@29.7.0:
dependencies:
'@types/node': 20.14.2
'@types/node': 20.14.5
jest-util: 29.7.0
merge-stream: 2.0.0
supports-color: 8.1.1
@ -14898,6 +14921,35 @@ snapshots:
- rollup
- supports-color
unocss@0.61.0(postcss@8.4.38)(rollup@4.18.0)(vite@5.3.1(@types/node@20.14.5)(sass@1.69.4)(terser@5.27.0)):
dependencies:
'@unocss/astro': 0.61.0(rollup@4.18.0)(vite@5.3.1(@types/node@20.14.5)(sass@1.69.4)(terser@5.27.0))
'@unocss/cli': 0.61.0(rollup@4.18.0)
'@unocss/core': 0.61.0
'@unocss/extractor-arbitrary-variants': 0.61.0
'@unocss/postcss': 0.61.0(postcss@8.4.38)
'@unocss/preset-attributify': 0.61.0
'@unocss/preset-icons': 0.61.0
'@unocss/preset-mini': 0.61.0
'@unocss/preset-tagify': 0.61.0
'@unocss/preset-typography': 0.61.0
'@unocss/preset-uno': 0.61.0
'@unocss/preset-web-fonts': 0.61.0
'@unocss/preset-wind': 0.61.0
'@unocss/reset': 0.61.0
'@unocss/transformer-attributify-jsx': 0.61.0
'@unocss/transformer-attributify-jsx-babel': 0.61.0
'@unocss/transformer-compile-class': 0.61.0
'@unocss/transformer-directives': 0.61.0
'@unocss/transformer-variant-group': 0.61.0
'@unocss/vite': 0.61.0(rollup@4.18.0)(vite@5.3.1(@types/node@20.14.5)(sass@1.69.4)(terser@5.27.0))
optionalDependencies:
vite: 5.3.1(@types/node@20.14.5)(sass@1.69.4)(terser@5.27.0)
transitivePeerDependencies:
- postcss
- rollup
- supports-color
unplugin-vue-router@0.7.0(rollup@4.18.0)(vue-router@4.3.3(vue@3.4.29(typescript@5.4.5)))(vue@3.4.29(typescript@5.4.5)):
dependencies:
'@babel/types': 7.24.7
@ -15051,7 +15103,24 @@ snapshots:
- supports-color
- terser
vite-plugin-checker@0.6.4(eslint@9.5.0)(optionator@0.9.3)(typescript@5.4.5)(vite@5.3.1(@types/node@20.14.2)(sass@1.69.4)(terser@5.27.0))(vue-tsc@2.0.21(typescript@5.4.5)):
vite-node@1.6.0(@types/node@20.14.5)(sass@1.69.4)(terser@5.27.0):
dependencies:
cac: 6.7.14
debug: 4.3.4
pathe: 1.1.2
picocolors: 1.0.0
vite: 5.3.1(@types/node@20.14.5)(sass@1.69.4)(terser@5.27.0)
transitivePeerDependencies:
- '@types/node'
- less
- lightningcss
- sass
- stylus
- sugarss
- supports-color
- terser
vite-plugin-checker@0.6.4(eslint@9.5.0)(optionator@0.9.3)(typescript@5.4.5)(vite@5.3.1(@types/node@20.14.5)(sass@1.69.4)(terser@5.27.0))(vue-tsc@2.0.21(typescript@5.4.5)):
dependencies:
'@babel/code-frame': 7.24.7
ansi-escapes: 4.3.2
@ -15064,7 +15133,7 @@ snapshots:
semver: 7.6.2
strip-ansi: 6.0.1
tiny-invariant: 1.3.1
vite: 5.3.1(@types/node@20.14.2)(sass@1.69.4)(terser@5.27.0)
vite: 5.3.1(@types/node@20.14.5)(sass@1.69.4)(terser@5.27.0)
vscode-languageclient: 7.0.0
vscode-languageserver: 7.0.0
vscode-languageserver-textdocument: 1.0.11
@ -15119,9 +15188,20 @@ snapshots:
sass: 1.69.4
terser: 5.27.0
vitest-environment-nuxt@1.0.0(@testing-library/vue@8.1.0(@vue/compiler-sfc@3.4.29)(vue@3.4.29(typescript@5.4.5)))(@vue/test-utils@2.4.6)(h3@1.11.1)(happy-dom@14.12.0)(magicast@0.3.4)(nitropack@2.9.6(encoding@0.1.13)(magicast@0.3.4))(playwright-core@1.44.1)(vite@5.3.1(@types/node@20.14.2)(sass@1.69.4)(terser@5.27.0))(vitest@1.6.0(@types/node@20.14.2)(happy-dom@14.12.0)(sass@1.69.4)(terser@5.27.0))(vue-router@4.3.3(vue@3.4.29(typescript@5.4.5)))(vue@3.4.29(typescript@5.4.5)):
vite@5.3.1(@types/node@20.14.5)(sass@1.69.4)(terser@5.27.0):
dependencies:
'@nuxt/test-utils': 3.13.1(@testing-library/vue@8.1.0(@vue/compiler-sfc@3.4.29)(vue@3.4.29(typescript@5.4.5)))(@vue/test-utils@2.4.6)(h3@1.11.1)(happy-dom@14.12.0)(magicast@0.3.4)(nitropack@2.9.6(encoding@0.1.13)(magicast@0.3.4))(playwright-core@1.44.1)(vite@5.3.1(@types/node@20.14.2)(sass@1.69.4)(terser@5.27.0))(vitest@1.6.0(@types/node@20.14.2)(happy-dom@14.12.0)(sass@1.69.4)(terser@5.27.0))(vue-router@4.3.3(vue@3.4.29(typescript@5.4.5)))(vue@3.4.29(typescript@5.4.5))
esbuild: 0.21.5
postcss: 8.4.38
rollup: 4.18.0
optionalDependencies:
'@types/node': 20.14.5
fsevents: 2.3.3
sass: 1.69.4
terser: 5.27.0
vitest-environment-nuxt@1.0.0(@testing-library/vue@8.1.0(@vue/compiler-sfc@3.4.29)(vue@3.4.29(typescript@5.4.5)))(@vue/test-utils@2.4.6)(h3@1.11.1)(happy-dom@14.12.0)(magicast@0.3.4)(nitropack@2.9.6(encoding@0.1.13)(magicast@0.3.4))(playwright-core@1.44.1)(vite@5.3.1(@types/node@20.14.5)(sass@1.69.4)(terser@5.27.0))(vitest@1.6.0(@types/node@20.14.5)(happy-dom@14.12.0)(sass@1.69.4)(terser@5.27.0))(vue-router@4.3.3(vue@3.4.29(typescript@5.4.5)))(vue@3.4.29(typescript@5.4.5)):
dependencies:
'@nuxt/test-utils': 3.13.1(@testing-library/vue@8.1.0(@vue/compiler-sfc@3.4.29)(vue@3.4.29(typescript@5.4.5)))(@vue/test-utils@2.4.6)(h3@1.11.1)(happy-dom@14.12.0)(magicast@0.3.4)(nitropack@2.9.6(encoding@0.1.13)(magicast@0.3.4))(playwright-core@1.44.1)(vite@5.3.1(@types/node@20.14.5)(sass@1.69.4)(terser@5.27.0))(vitest@1.6.0(@types/node@20.14.5)(happy-dom@14.12.0)(sass@1.69.4)(terser@5.27.0))(vue-router@4.3.3(vue@3.4.29(typescript@5.4.5)))(vue@3.4.29(typescript@5.4.5))
transitivePeerDependencies:
- '@cucumber/cucumber'
- '@jest/globals'
@ -15174,6 +15254,40 @@ snapshots:
- supports-color
- terser
vitest@1.6.0(@types/node@20.14.5)(happy-dom@14.12.0)(sass@1.69.4)(terser@5.27.0):
dependencies:
'@vitest/expect': 1.6.0
'@vitest/runner': 1.6.0
'@vitest/snapshot': 1.6.0
'@vitest/spy': 1.6.0
'@vitest/utils': 1.6.0
acorn-walk: 8.3.2
chai: 4.3.10
debug: 4.3.4
execa: 8.0.1
local-pkg: 0.5.0
magic-string: 0.30.10
pathe: 1.1.2
picocolors: 1.0.0
std-env: 3.7.0
strip-literal: 2.1.0
tinybench: 2.5.1
tinypool: 0.8.4
vite: 5.3.1(@types/node@20.14.5)(sass@1.69.4)(terser@5.27.0)
vite-node: 1.6.0(@types/node@20.14.5)(sass@1.69.4)(terser@5.27.0)
why-is-node-running: 2.2.2
optionalDependencies:
'@types/node': 20.14.5
happy-dom: 14.12.0
transitivePeerDependencies:
- less
- lightningcss
- sass
- stylus
- sugarss
- supports-color
- terser
void-elements@3.1.0: {}
vscode-jsonrpc@6.0.0: {}

View File

@ -11,7 +11,7 @@ async function main () {
const config = await loadChangelogConfig(process.cwd(), {})
const commits = await getLatestCommits().then(commits => commits.filter(
c => config.types[c.type] && !(c.type === 'chore' && c.scope === 'deps' && !c.isBreaking),
c => config.types[c.type] && !(c.type === 'chore' && c.scope === 'deps'),
))
const bumpType = await determineBumpType() || 'patch'

View File

@ -2602,7 +2602,7 @@ describe('Node.js compatibility for client-side', () => {
expect(await page.innerHTML('body')).toContain('CWD: [available]')
await page.close()
})
}, 20_000)
}, 30_000)
function normaliseIslandResult (result: NuxtIslandResponse) {
return {