Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// If app.html is defined, set the template path to the user template
if (options.appTemplatePath === undefined) {
options.appTemplatePath = path.resolve(options.buildDir, 'views/app.template.html')
if (fs.existsSync(path.join(options.srcDir, 'app.html'))) {
options.appTemplatePath = path.join(options.srcDir, 'app.html')
}
} else {
options.appTemplatePath = path.resolve(options.srcDir, options.appTemplatePath)
}
options.build.publicPath = options.build.publicPath.replace(/([^/])$/, '$1/')
options.build._publicPath = options.build._publicPath.replace(/([^/])$/, '$1/')
// Ignore publicPath on dev
if (options.dev && isUrl(options.build.publicPath)) {
options.build.publicPath = options.build._publicPath
}
// If store defined, update store options to true unless explicitly disabled
if (
options.store !== false &&
fs.existsSync(path.join(options.srcDir, options.dir.store)) &&
fs.readdirSync(path.join(options.srcDir, options.dir.store))
.find(filename => filename !== 'README.md' && filename[0] !== '.')
) {
options.store = true
}
// SPA loadingIndicator
if (options.loadingIndicator) {
// Normalize loadingIndicator
constructor (nuxt) {
this.nuxt = nuxt
this.options = nuxt.options
this.globals = determineGlobals(nuxt.options.globalName, nuxt.options.globals)
this.publicPath = isUrl(this.options.build.publicPath)
? this.options.build._publicPath
: this.options.build.publicPath
// Runtime shared resources
this.resources = {}
// Will be set after listen
this.listeners = []
// Create new connect instance
this.app = connect()
// Close hook
this.nuxt.hook('close', () => this.close())
// devMiddleware placeholder
constructor (nuxt, builder) {
this.nuxt = nuxt
this.options = nuxt.options
this.builder = builder
// Set variables
this.staticRoutes = path.resolve(this.options.srcDir, this.options.dir.static)
this.srcBuiltPath = path.resolve(this.options.buildDir, 'dist', 'client')
this.distPath = this.options.generate.dir
this.distNuxtPath = path.join(
this.distPath,
isUrl(this.options.build.publicPath) ? '' : this.options.build.publicPath
)
}