Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export default async function NuxtStack(options) {
const stack = Object.assign({}, defaults.stack, this.options.stack, options)
const config = inject(getDefaultNuxtConfig(), this.options)
const unshift = config(insert("unshift"), true)
const push = config(insert("push"), true)
const assign = config(assoc)
// Defaults
assign("cache", true)
assign("hardSource", true)
// Styles
if (isNotFalse(stack.normalizeCSS)) unshift("css", "normalize.css")
push("css", this.options.styles)
// Head: Language
assign("head.htmlAttrs.lang", stack.lang)
// Head: Preconnect Links
}
if (typeof options.rootDir !== 'string') {
options.rootDir = rootDir
}
// Nuxt Mode
options.mode =
(argv.spa && 'spa') || (argv.universal && 'universal') || options.mode
// Server options
options.server = defaultsDeep({
port: argv.port || undefined,
host: argv.hostname || undefined,
socket: argv['unix-socket'] || undefined
}, options.server || {}, getDefaultNuxtConfig().server)
return options
}
constructor (options = {}) {
super(consola)
// Assign options and apply defaults
this.options = getNuxtConfig(options)
// Create instance of core components
this.resolver = new Resolver(this)
this.moduleContainer = new ModuleContainer(this)
// Deprecated hooks
this.deprecateHooks({
'render:context': 'render:routeContext',
'render:routeContext': 'vue-renderer:afterRender',
showReady: 'webpack:done' // Workaround to deprecate showReady
})
// Add Legacy aliases
defineAlias(this, this.resolver, ['resolveAlias', 'resolvePath'])
this.showReady = () => { this.callHook('webpack:done') }
get publicPath() {
return isUrl(this.options.build.publicPath)
? NuxtConfig.build.publicPath
: this.options.build.publicPath
}