mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-31 07:40:33 +00:00
refactor(nuxi,schema): move loading template into schema (#22336)
This commit is contained in:
parent
e2c7edd479
commit
9741f267be
@ -46,7 +46,7 @@ export default defineNuxtCommand({
|
|||||||
let currentHandler: RequestListener | undefined
|
let currentHandler: RequestListener | undefined
|
||||||
let loadingMessage = 'Nuxt is starting...'
|
let loadingMessage = 'Nuxt is starting...'
|
||||||
const loadingHandler: RequestListener = async (_req, res) => {
|
const loadingHandler: RequestListener = async (_req, res) => {
|
||||||
const { loading: loadingTemplate } = await importModule('@nuxt/ui-templates', config.modulesDir)
|
const loadingTemplate = config.devServer.loadingTemplate ?? await importModule('@nuxt/ui-templates', config.modulesDir).then(r => r.loading)
|
||||||
res.setHeader('Content-Type', 'text/html; charset=UTF-8')
|
res.setHeader('Content-Type', 'text/html; charset=UTF-8')
|
||||||
res.statusCode = 503 // Service Unavailable
|
res.statusCode = 503 // Service Unavailable
|
||||||
res.end(loadingTemplate({ loading: loadingMessage }))
|
res.end(loadingTemplate({ loading: loadingMessage }))
|
||||||
|
@ -56,7 +56,7 @@
|
|||||||
"@nuxt/kit": "workspace:../kit",
|
"@nuxt/kit": "workspace:../kit",
|
||||||
"@nuxt/schema": "workspace:../schema",
|
"@nuxt/schema": "workspace:../schema",
|
||||||
"@nuxt/telemetry": "^2.3.2",
|
"@nuxt/telemetry": "^2.3.2",
|
||||||
"@nuxt/ui-templates": "^1.2.0",
|
"@nuxt/ui-templates": "^1.2.1",
|
||||||
"@nuxt/vite-builder": "workspace:../vite",
|
"@nuxt/vite-builder": "workspace:../vite",
|
||||||
"@unhead/ssr": "^1.1.32",
|
"@unhead/ssr": "^1.1.32",
|
||||||
"@unhead/vue": "^1.1.32",
|
"@unhead/vue": "^1.1.32",
|
||||||
|
@ -49,6 +49,7 @@
|
|||||||
"webpack-dev-middleware": "6.1.1"
|
"webpack-dev-middleware": "6.1.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@nuxt/ui-templates": "^1.2.1",
|
||||||
"defu": "^6.1.2",
|
"defu": "^6.1.2",
|
||||||
"hookable": "^5.5.3",
|
"hookable": "^5.5.3",
|
||||||
"pathe": "^1.1.1",
|
"pathe": "^1.1.1",
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { defineUntypedSchema } from 'untyped'
|
import { defineUntypedSchema } from 'untyped'
|
||||||
|
import { loading as loadingTemplate } from '@nuxt/ui-templates'
|
||||||
|
|
||||||
export default defineUntypedSchema({
|
export default defineUntypedSchema({
|
||||||
devServer: {
|
devServer: {
|
||||||
@ -36,5 +37,12 @@ export default defineUntypedSchema({
|
|||||||
* dev server with the full URL (for module and internal use).
|
* dev server with the full URL (for module and internal use).
|
||||||
*/
|
*/
|
||||||
url: 'http://localhost:3000',
|
url: 'http://localhost:3000',
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Template to show a loading screen
|
||||||
|
*
|
||||||
|
* @type {(data: { loading?: string }) => string}
|
||||||
|
*/
|
||||||
|
loadingTemplate: loadingTemplate
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -347,8 +347,8 @@ importers:
|
|||||||
specifier: ^2.3.2
|
specifier: ^2.3.2
|
||||||
version: 2.3.2
|
version: 2.3.2
|
||||||
'@nuxt/ui-templates':
|
'@nuxt/ui-templates':
|
||||||
specifier: ^1.2.0
|
specifier: ^1.2.1
|
||||||
version: 1.2.0
|
version: 1.2.1
|
||||||
'@nuxt/vite-builder':
|
'@nuxt/vite-builder':
|
||||||
specifier: workspace:*
|
specifier: workspace:*
|
||||||
version: link:../vite
|
version: link:../vite
|
||||||
@ -521,6 +521,9 @@ importers:
|
|||||||
|
|
||||||
packages/schema:
|
packages/schema:
|
||||||
dependencies:
|
dependencies:
|
||||||
|
'@nuxt/ui-templates':
|
||||||
|
specifier: ^1.2.1
|
||||||
|
version: 1.2.1
|
||||||
defu:
|
defu:
|
||||||
specifier: ^6.1.2
|
specifier: ^6.1.2
|
||||||
version: 6.1.2
|
version: 6.1.2
|
||||||
@ -2075,8 +2078,8 @@ packages:
|
|||||||
rc9: 2.1.1
|
rc9: 2.1.1
|
||||||
std-env: 3.3.3
|
std-env: 3.3.3
|
||||||
|
|
||||||
/@nuxt/ui-templates@1.2.0:
|
/@nuxt/ui-templates@1.2.1:
|
||||||
resolution: {integrity: sha512-MSZza7dxccNb/p7nuzGF8/m4POaFpHzVhNdR7f4xahOpH7Ja02lFeYR+rHtoHIJC0yym4qriqv0mQ+Qf/R61bQ==}
|
resolution: {integrity: sha512-Nt1nTkPsji/X8z/BCqUgb8uADs+kT0FZboVDwyCdMlCgjEQKrAZUlunKXGywa6ssz4/RohGmvuB1cFre6dSKXQ==}
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/@nuxtjs/eslint-config-typescript@12.0.0(eslint@8.45.0)(typescript@5.0.4):
|
/@nuxtjs/eslint-config-typescript@12.0.0(eslint@8.45.0)(typescript@5.0.4):
|
||||||
|
Loading…
Reference in New Issue
Block a user