mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 05:35:13 +00:00
parent
ae32ca42fa
commit
99129216ee
@ -88,7 +88,7 @@ function advancedGet (obj = {}, query = '') {
|
||||
const v = get(i, l)
|
||||
|
||||
if (!v) {
|
||||
return
|
||||
return false
|
||||
}
|
||||
|
||||
if (
|
||||
@ -99,6 +99,8 @@ function advancedGet (obj = {}, query = '') {
|
||||
) {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
})
|
||||
|
||||
if (result.length === 1) {
|
||||
|
@ -385,8 +385,11 @@ function normalizeConfig (_options: CliConfiguration) {
|
||||
overrideProp(options.server, 'timing', { total: true, ...options.server.timing })
|
||||
}
|
||||
|
||||
overrideProp(options, 'serverMiddleware', Array.isArray(options.serverMiddleware) ? options.serverMiddleware : Object.entries(options.serverMiddleware)
|
||||
.map(([path, handler]) => ({ path, handler }))
|
||||
overrideProp(options, 'serverMiddleware',
|
||||
Array.isArray(options.serverMiddleware)
|
||||
? options.serverMiddleware
|
||||
: Object.entries(options.serverMiddleware)
|
||||
.map(([path, handler]) => ({ path, handler }))
|
||||
)
|
||||
|
||||
// Generate staticAssets
|
||||
|
@ -329,7 +329,7 @@ export default class Generator {
|
||||
// If crawler activated and called from generateRoutes()
|
||||
if (this.options.generate.crawler && this.options.render.ssr) {
|
||||
const possibleTrailingSlash = this.options.router.trailingSlash ? '/' : ''
|
||||
parse(html).querySelectorAll('a').map((el) => {
|
||||
parse(html).querySelectorAll('a').forEach((el) => {
|
||||
const sanitizedHref = (el.getAttribute('href') || '')
|
||||
.replace(this.options.router.base, '/')
|
||||
.replace(/\/+$/, '')
|
||||
|
@ -15,7 +15,7 @@ export default async function renderAndGetWindow (
|
||||
loadedCallback,
|
||||
loadingTimeout = 2000,
|
||||
globals
|
||||
}: Options
|
||||
}: Partial<Options> = {}
|
||||
) {
|
||||
const jsdom = await import('jsdom')
|
||||
.then(m => m.default || m)
|
||||
|
@ -117,17 +117,21 @@ export const sortRoutes = function sortRoutes (routes: NuxtRouteConfig[]) {
|
||||
// If a.length >= b.length
|
||||
if (i === _b.length - 1 && res === 0) {
|
||||
// unless * found sort by level, then alphabetically
|
||||
res = _a[i] === '*' ? -1 : (
|
||||
_a.length === _b.length ? a.path.localeCompare(b.path) : (_a.length - _b.length)
|
||||
)
|
||||
res = _a[i] === '*'
|
||||
? -1
|
||||
: (
|
||||
_a.length === _b.length ? a.path.localeCompare(b.path) : (_a.length - _b.length)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
if (res === 0) {
|
||||
// unless * found sort by level, then alphabetically
|
||||
res = _a[i - 1] === '*' && _b[i] ? 1 : (
|
||||
_a.length === _b.length ? a.path.localeCompare(b.path) : (_a.length - _b.length)
|
||||
)
|
||||
res = _a[i - 1] === '*' && _b[i]
|
||||
? 1
|
||||
: (
|
||||
_a.length === _b.length ? a.path.localeCompare(b.path) : (_a.length - _b.length)
|
||||
)
|
||||
}
|
||||
return res
|
||||
})
|
||||
|
@ -5,7 +5,7 @@ function contains (arr, val) {
|
||||
return arr && arr.includes(val)
|
||||
}
|
||||
|
||||
const atPrefix = new RegExp('^@', 'g')
|
||||
const atPrefix = /^@/g
|
||||
|
||||
function readDir (dirName) {
|
||||
if (!fs.existsSync(dirName)) {
|
||||
@ -95,10 +95,7 @@ function containsPattern (arr, val) {
|
||||
)
|
||||
}
|
||||
|
||||
const scopedModuleRegex = new RegExp(
|
||||
'@[a-zA-Z0-9][\\w-.]+/[a-zA-Z0-9][\\w-.]+([a-zA-Z0-9./]+)?',
|
||||
'g'
|
||||
)
|
||||
const scopedModuleRegex = /@[a-zA-Z0-9][\\w-.]+\/[a-zA-Z0-9][\\w-.]+([a-zA-Z0-9./]+)?/g
|
||||
|
||||
function getModuleName (request, includeAbsolutePaths) {
|
||||
let req = request
|
||||
|
@ -192,7 +192,8 @@ function getOutput (ctx: WebpackConfigContext): Configuration['output'] {
|
||||
path: resolve(options.buildDir, 'dist', ctx.isServer ? 'server' : 'client'),
|
||||
filename: fileName(ctx, 'app'),
|
||||
chunkFilename: fileName(ctx, 'chunk'),
|
||||
publicPath: isUrl(options.build.publicPath) ? options.build.publicPath
|
||||
publicPath: isUrl(options.build.publicPath)
|
||||
? options.build.publicPath
|
||||
: urlJoin(options.router.base, options.build.publicPath)
|
||||
}
|
||||
}
|
||||
|
@ -153,7 +153,7 @@ export default class PostcssConfig {
|
||||
const plugin = this.nuxt.resolver.requireModule(p)
|
||||
const opts = plugins[p]
|
||||
if (opts === false) {
|
||||
return // Disabled
|
||||
return false // Disabled
|
||||
}
|
||||
return plugin(opts)
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user