feat(nuxt): update devdependency nitropack to v2.5.1 (#21696)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
This commit is contained in:
Daniel Roe 2023-06-22 10:38:26 +01:00 committed by GitHub
parent 36ad75c269
commit be3f6f7018
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 598 additions and 590 deletions

View File

@ -43,7 +43,7 @@
"@types/lodash-es": "4.17.7", "@types/lodash-es": "4.17.7",
"@types/semver": "7.5.0", "@types/semver": "7.5.0",
"lodash-es": "4.17.21", "lodash-es": "4.17.21",
"nitropack": "2.4.1", "nitropack": "2.5.1",
"unbuild": "latest", "unbuild": "latest",
"vite": "4.3.9", "vite": "4.3.9",
"vitest": "0.32.2", "vitest": "0.32.2",

View File

@ -80,7 +80,7 @@
"local-pkg": "^0.4.3", "local-pkg": "^0.4.3",
"magic-string": "^0.30.0", "magic-string": "^0.30.0",
"mlly": "^1.4.0", "mlly": "^1.4.0",
"nitropack": "^2.4.1", "nitropack": "^2.5.1",
"nuxi": "workspace:../nuxi", "nuxi": "workspace:../nuxi",
"nypm": "^0.2.1", "nypm": "^0.2.1",
"ofetch": "^1.1.1", "ofetch": "^1.1.1",

View File

@ -11,10 +11,10 @@ const props = defineProps({
// Deliberately prevent reactive update when error is cleared // Deliberately prevent reactive update when error is cleared
// eslint-disable-next-line vue/no-setup-props-destructure // eslint-disable-next-line vue/no-setup-props-destructure
const { error } = props const _error = props.error
// TODO: extract to a separate utility // TODO: extract to a separate utility
const stacktrace = (error.stack || '') const stacktrace = (_error.stack || '')
.split('\n') .split('\n')
.splice(1) .splice(1)
.map((line) => { .map((line) => {
@ -31,12 +31,12 @@ const stacktrace = (error.stack || '')
}).map(i => `<span class="stack${i.internal ? ' internal' : ''}">${i.text}</span>`).join('\n') }).map(i => `<span class="stack${i.internal ? ' internal' : ''}">${i.text}</span>`).join('\n')
// Error page props // Error page props
const statusCode = Number(error.statusCode || 500) const statusCode = Number(_error.statusCode || 500)
const is404 = statusCode === 404 const is404 = statusCode === 404
const statusMessage = error.statusMessage ?? (is404 ? 'Page Not Found' : 'Internal Server Error') const statusMessage = _error.statusMessage ?? (is404 ? 'Page Not Found' : 'Internal Server Error')
const description = error.message || error.toString() const description = _error.message || _error.toString()
const stack = process.dev && !is404 ? error.description || `<pre>${stacktrace}</pre>` : undefined const stack = process.dev && !is404 ? _error.description || `<pre>${stacktrace}</pre>` : undefined
// TODO: Investigate side-effect issue with imports // TODO: Investigate side-effect issue with imports
const _Error404 = defineAsyncComponent(() => import('@nuxt/ui-templates/templates/error-404.vue').then(r => r.default || r)) const _Error404 = defineAsyncComponent(() => import('@nuxt/ui-templates/templates/error-404.vue').then(r => r.default || r))

View File

@ -6,14 +6,14 @@ export function baseURL (): string {
} }
export function buildAssetsDir (): string { export function buildAssetsDir (): string {
return useRuntimeConfig().app.buildAssetsDir return useRuntimeConfig().app.buildAssetsDir as string
} }
export function buildAssetsURL (...path: string[]): string { export function buildAssetsURL (...path: string[]): string {
return joinURL(publicAssetsURL(), useRuntimeConfig().app.buildAssetsDir, ...path) return joinURL(publicAssetsURL(), buildAssetsDir(), ...path)
} }
export function publicAssetsURL (...path: string[]): string { export function publicAssetsURL (...path: string[]): string {
const publicBase = useRuntimeConfig().app.cdnURL || useRuntimeConfig().app.baseURL const publicBase = useRuntimeConfig().app.cdnURL as string || useRuntimeConfig().app.baseURL
return path.length ? joinURL(publicBase, ...path) : publicBase return path.length ? joinURL(publicBase, ...path) : publicBase
} }

View File

@ -1,7 +1,7 @@
/// <reference types="nitropack" /> /// <reference types="nitropack" />
export * from './dist/index' export * from './dist/index'
import type { SchemaDefinition } from 'nuxt/schema' import type { SchemaDefinition, RuntimeConfig } from 'nuxt/schema'
import type { NuxtIslandContext, NuxtIslandResponse, NuxtRenderHTMLContext } from './dist/core/runtime/nitro/renderer' import type { NuxtIslandContext, NuxtIslandResponse, NuxtRenderHTMLContext } from './dist/core/runtime/nitro/renderer'
declare global { declare global {
@ -10,6 +10,8 @@ declare global {
} }
declare module 'nitropack' { declare module 'nitropack' {
interface NitroRuntimeConfigApp extends RuntimeConfig['app'] {}
interface NitroRuntimeConfig extends RuntimeConfig {}
interface NitroRouteConfig { interface NitroRouteConfig {
ssr?: boolean ssr?: boolean
experimentalNoScripts?: boolean experimentalNoScripts?: boolean

View File

@ -36,7 +36,7 @@
"esbuild-loader": "3.0.1", "esbuild-loader": "3.0.1",
"h3": "1.7.0", "h3": "1.7.0",
"ignore": "5.2.4", "ignore": "5.2.4",
"nitropack": "2.4.1", "nitropack": "2.5.1",
"unbuild": "latest", "unbuild": "latest",
"unctx": "2.3.1", "unctx": "2.3.1",
"vite": "4.3.9", "vite": "4.3.9",

File diff suppressed because it is too large Load Diff

View File

@ -35,10 +35,10 @@ describe.skipIf(process.env.SKIP_BUNDLE_SIZE === 'true' || process.env.ECOSYSTEM
it('default server bundle size', async () => { it('default server bundle size', async () => {
stats.server = await analyzeSizes(['**/*.mjs', '!node_modules'], serverDir) stats.server = await analyzeSizes(['**/*.mjs', '!node_modules'], serverDir)
expect.soft(roundToKilobytes(stats.server.totalBytes)).toMatchInlineSnapshot('"62.2k"') expect.soft(roundToKilobytes(stats.server.totalBytes)).toMatchInlineSnapshot('"63.9k"')
const modules = await analyzeSizes('node_modules/**/*', serverDir) const modules = await analyzeSizes('node_modules/**/*', serverDir)
expect.soft(roundToKilobytes(modules.totalBytes)).toMatchInlineSnapshot('"2297k"') expect.soft(roundToKilobytes(modules.totalBytes)).toMatchInlineSnapshot('"2328k"')
const packages = modules.files const packages = modules.files
.filter(m => m.endsWith('package.json')) .filter(m => m.endsWith('package.json'))
@ -59,30 +59,32 @@ describe.skipIf(process.env.SKIP_BUNDLE_SIZE === 'true' || process.env.ECOSYSTEM
"@vue/server-renderer", "@vue/server-renderer",
"@vue/shared", "@vue/shared",
"cookie-es", "cookie-es",
"debug",
"defu", "defu",
"destr", "destr",
"devalue", "devalue",
"estree-walker", "estree-walker",
"h3", "h3",
"h3/node_modules/destr", "has-flag",
"hookable", "hookable",
"http-graceful-shutdown",
"iron-webcrypto", "iron-webcrypto",
"klona", "klona",
"ms",
"node-fetch-native", "node-fetch-native",
"ofetch", "ofetch",
"ofetch/node_modules/destr",
"ohash", "ohash",
"pathe", "pathe",
"radix3", "radix3",
"scule", "scule",
"source-map-js", "source-map-js",
"supports-color",
"ufo", "ufo",
"uncrypto", "uncrypto",
"unctx", "unctx",
"unenv", "unenv",
"unhead", "unhead",
"unstorage", "unstorage",
"unstorage/node_modules/destr",
"vue", "vue",
"vue-bundle-renderer", "vue-bundle-renderer",
] ]