Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function createConsola () {
// Log level
let level = env.debug ? 4 : 3
if (process.env.CONSOLA_LEVEL) {
level = parseInt(process.env.CONSOLA_LEVEL) || level
}
// Create new consola instance
const consola = new Consola({
level,
reporters: [
(env.ci || env.test)
? new BasicReporter()
: new FancyReporter()
]
})
// Expose constructors
consola.Consola = Consola
consola.BasicReporter = BasicReporter
consola.FancyReporter = FancyReporter
consola.JSONReporter = JSONReporter
consola.WinstonReporter = WinstonReporter
return consola
}
buildDir: '.nuxt',
nuxtDir,
nuxtAppDir: path.resolve(nuxtDir, 'lib', 'app'),
modulesDir: ['node_modules'], // ~> relative to options.rootDir
// Ignore
ignorePrefix: '-',
ignore: [
'**/*.test.*',
'**/*.spec.*'
],
extensions: [],
build: {
quiet: Boolean(env.ci || env.test),
analyze: false,
profile: process.argv.includes('--profile'),
extractCSS: false,
cssSourceMap: undefined,
ssr: undefined,
parallel: false,
cache: false,
publicPath: '/_nuxt/',
filenames: {
// { isDev, isClient, isServer }
app: ({ isDev }) => isDev ? '[name].js' : '[chunkhash].js',
chunk: ({ isDev }) => isDev ? '[name].js' : '[chunkhash].js',
css: ({ isDev }) => isDev ? '[name].js' : '[contenthash].css',
img: ({ isDev }) => isDev ? '[path][name].[ext]' : 'img/[hash:7].[ext]',
font: ({ isDev }) => isDev ? '[path][name].[ext]' : 'fonts/[hash:7].[ext]',
video: ({ isDev }) => isDev ? '[path][name].[ext]' : 'videos/[hash:7].[ext]'
export default () => ({
quiet: Boolean(env.ci || env.test),
analyze: false,
profile: process.argv.includes('--profile'),
extractCSS: false,
crossorigin: undefined,
cssSourceMap: undefined,
ssr: undefined,
parallel: false,
cache: false,
standalone: false,
publicPath: '/_nuxt/',
filenames: {
// { isDev, isClient, isServer }
app: ({ isDev, isModern }) => isDev ? `${isModern ? 'modern-' : ''}[name].js` : '[chunkhash].js',
chunk: ({ isDev, isModern }) => isDev ? `${isModern ? 'modern-' : ''}[name].js` : '[chunkhash].js',
css: ({ isDev }) => isDev ? '[name].css' : '[contenthash].css',
img: ({ isDev }) => isDev ? '[path][name].[ext]' : 'img/[hash:7].[ext]',
setupFilesAfterEnv: ['./test/utils/setup'],
coverageDirectory: './coverage',
collectCoverageFrom: [
'packages/**/*.js',
'!**/blueprint/**',
'!**/test/**'
],
moduleNameMapper: {
"@/(.*)$": "/test/$1",
"~/(.*)$": "/src/$1",
// TODO: enable this again when we re-introduce a build step
"^pressModule$": false && stdEnv.ci ? "/" : "/distributions/nuxt-press/src"
},
transform: {
'^.+\\.js$': 'babel-jest',
'^.+\\.vue$': 'vue-jest'
},
moduleFileExtensions: [
'js',
'json'
],
reporters: [
'default',
// ['jest-junit', { outputDirectory: 'reports/junit' }]
]
import { template } from 'lodash'
import webpack from 'webpack'
import CopyWebpackPlugin from 'copy-webpack-plugin'
import VueLoaderPlugin from 'vue-loader/lib/plugin'
import { createRenderer } from 'vue-server-renderer'
import stdEnv from 'std-env'
const renderer = createRenderer()
export { default as getPort } from 'get-port'
export function _import (moduleName) {
return import(moduleName).then(m => m.default || m)
}
export const useDist = stdEnv.test && stdEnv.ci
export function getVueMetaPath (browser) {
if (useDist) {
return path.resolve(__dirname, `../..${browser ? '/dist/vue-meta.min.js' : ''}`)
}
process.server = !browser
return path.resolve(__dirname, `../../src`)
}
export function webpackRun (config) {
const compiler = webpack(config)
return new Promise((resolve, reject) => {
compiler.run((err, stats) => {
if (err) {
export function getCacheLoader(
isServer: boolean,
cacheOptions?: {},
): Loader | null {
if (env.ci || env.test) {
return null;
}
return {
loader: require.resolve('cache-loader'),
options: Object.assign(
{
cacheIdentifier: `cache-loader:${cacheLoaderVersion}${isServer}`,
},
cacheOptions,
),
};
}