Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function getPageFiles({dir, config, isClient, entrypoint}) {
let result = []
if(entrypoint) {
if(isClient) {
result = glob.sync(`pages(_app|_error).+(${config.pageExtensions.join('|')})`, { cwd: dir, absolute: true })
} else {
result = glob.sync(`pages(_document|_app|_error).+(${config.pageExtensions.join('|')})`, { cwd: dir, absolute: true })
}
result = [...result, ...glob.sync(entrypoint, { cwd: dir, absolute: true })]
} else {
result = glob.sync(`pages/**/${isClient ? '!(_document)' : ''}*.+(${config.pageExtensions.join('|')})`, { cwd: dir, absolute: true })
}
const appPath = path.join(dir, 'pages', '_app.js')
if(!result.some((item) => item === appPath)) {
result.push(require.resolve('next/dist/pages/_app.js'))
}
const errorPath = path.join(dir, 'pages', '_error.js')
if(!result.some((item) => item === errorPath)) {
result.push(require.resolve('next/dist/pages/_error.js'))
}
function getPageFiles({dir, config, isClient, entrypoint}) {
let result = []
if(entrypoint) {
if(isClient) {
result = glob.sync(`pages(_app|_error).+(${config.pageExtensions.join('|')})`, { cwd: dir, absolute: true })
} else {
result = glob.sync(`pages(_document|_app|_error).+(${config.pageExtensions.join('|')})`, { cwd: dir, absolute: true })
}
result = [...result, ...glob.sync(entrypoint, { cwd: dir, absolute: true })]
} else {
result = glob.sync(`pages/**/${isClient ? '!(_document)' : ''}*.+(${config.pageExtensions.join('|')})`, { cwd: dir, absolute: true })
}
const appPath = path.join(dir, 'pages', '_app.js')
if(!result.some((item) => item === appPath)) {
result.push(require.resolve('next/dist/pages/_app.js'))
}
const errorPath = path.join(dir, 'pages', '_error.js')
if(!result.some((item) => item === errorPath)) {
result.push(require.resolve('next/dist/pages/_error.js'))
}
if(!isClient) {
const documentPath = path.join(dir, 'pages', '_document.js')
if(!result.some((item) => item === documentPath)) {
function getPageFiles({dir, config, isClient, entrypoint}) {
let result = []
if(entrypoint) {
if(isClient) {
result = glob.sync(`pages(_app|_error).+(${config.pageExtensions.join('|')})`, { cwd: dir, absolute: true })
} else {
result = glob.sync(`pages(_document|_app|_error).+(${config.pageExtensions.join('|')})`, { cwd: dir, absolute: true })
}
result = [...result, ...glob.sync(entrypoint, { cwd: dir, absolute: true })]
} else {
result = glob.sync(`pages/**/${isClient ? '!(_document)' : ''}*.+(${config.pageExtensions.join('|')})`, { cwd: dir, absolute: true })
}
const appPath = path.join(dir, 'pages', '_app.js')
if(!result.some((item) => item === appPath)) {
result.push(require.resolve('next/dist/pages/_app.js'))
}
const errorPath = path.join(dir, 'pages', '_error.js')
if(!result.some((item) => item === errorPath)) {
result.push(require.resolve('next/dist/pages/_error.js'))
}
if(!isClient) {
function getPageFiles({dir, config, isClient, entrypoint}) {
let result = []
if(entrypoint) {
if(isClient) {
result = glob.sync(`pages(_app|_error).+(${config.pageExtensions.join('|')})`, { cwd: dir, absolute: true })
} else {
result = glob.sync(`pages(_document|_app|_error).+(${config.pageExtensions.join('|')})`, { cwd: dir, absolute: true })
}
result = [...result, ...glob.sync(entrypoint, { cwd: dir, absolute: true })]
} else {
result = glob.sync(`pages/**/${isClient ? '!(_document)' : ''}*.+(${config.pageExtensions.join('|')})`, { cwd: dir, absolute: true })
}
const appPath = path.join(dir, 'pages', '_app.js')
if(!result.some((item) => item === appPath)) {
result.push(require.resolve('next/dist/pages/_app.js'))
}
const errorPath = path.join(dir, 'pages', '_error.js')
if(!result.some((item) => item === errorPath)) {
result.push(require.resolve('next/dist/pages/_error.js'))
}
if(!isClient) {
const documentPath = path.join(dir, 'pages', '_document.js')
if(!result.some((item) => item === documentPath)) {
result.push(require.resolve('next/dist/pages/_document.js'))
}