How to use the consola.debug function in consola

To help you get started, we’ve selected a few consola examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nuxt / nuxt.js / packages / builder / src / builder.js View on Github external
async resolveRoutes ({ templateVars }) {
    consola.debug('Generating routes...')
    const { routeNameSplitter, trailingSlash } = this.options.router

    if (this._defaultPage) {
      templateVars.router.routes = createRoutes({
        files: ['index.vue'],
        srcDir: this.template.dir + '/pages',
        routeNameSplitter,
        trailingSlash
      })
    } else if (this._nuxtPages) {
      // Use nuxt.js createRoutes bases on pages/
      const files = {}
      const ext = new RegExp(`\\.(${this.supportedExtensions.join('|')})$`)
      for (const page of await this.resolveFiles(this.options.dir.pages)) {
        const key = page.replace(ext, '')
        // .vue file takes precedence over other extensions
github nuxt / nuxt.js / packages / utils / src / locking.js View on Github external
return async function lockRelease () {
    try {
      await fs.remove(lockPath)
      lockPaths.delete(lockPath)

      // release as last so the lockPath is still removed
      // when it fails on a compromised lock
      await release()
    } catch (e) {
      if (!lockWasCompromised || !e.message.includes('already released')) {
        consola.debug(e)
        return
      }

      // proper-lockfile doesnt remove lockDir when lock is compromised
      // removing it here could cause the 'other' process to throw an error
      // as well, but in our case its much more likely the lock was
      // compromised due to mtime update timeouts
      const lockDir = `${lockPath}.lock`
      if (await fs.exists(lockDir)) {
        await fs.remove(lockDir)
      }
    }
  }
}
github nuxt / nuxt.js / lib / core / renderer.js View on Github external
async renderRoute(url, context = {}) {
    /* istanbul ignore if */
    if (!this.isReady) {
      await waitFor(1000)
      return this.renderRoute(url, context)
    }

    // Log rendered url
    consola.debug(`Rendering url ${url}`)

    // Add url and isSever to the context
    context.url = url

    // Basic response if SSR is disabled or spa data provided
    const spa = context.spa || (context.res && context.res.spa)
    const ENV = this.options.env

    if (this.noSSR || spa) {
      const {
        HTML_ATTRS,
        BODY_ATTRS,
        HEAD,
        BODY_SCRIPTS,
        getPreloadFiles
      } = await this.metaRenderer.render(context)
github nuxt / nuxt.js / packages / builder / src / builder.js View on Github external
async generateRoutesAndFiles () {
    consola.debug('Generating nuxt files')

    this.plugins = Array.from(await this.normalizePlugins())

    const templateContext = this.createTemplateContext()

    await Promise.all([
      this.resolveLayouts(templateContext),
      this.resolveRoutes(templateContext),
      this.resolveStore(templateContext),
      this.resolveMiddleware(templateContext)
    ])

    this.addOptionalTemplates(templateContext)

    await this.resolveCustomTemplates(templateContext)
github nuxt / press / distributions / blueprint / src / blueprint.js View on Github external
async copyFile ({ src, dst }) {
    if (!path.isAbsolute(dst)) {
      dst = path.join(this.nuxt.options.buildDir, dst)
    }

    try {
      consola.debug(`${this.constructor.name}: Copying '${path.relative(this.nuxt.options.srcDir, src)}' to '${path.relative(this.nuxt.options.buildDir, dst)}'`)

      await ensureDir(path.dirname(dst))
      await copyFile(src, dst, fs.constants.COPYFILE_FICLONE)
      return dst
    } catch (err) {
      consola.error(`${this.constructor.name}: An error occured while copying ${path.relative(this.nuxt.options.srcDir, src)}' to '${path.relative(this.nuxt.options.buildDir, dst)}'\n`, err)
      return false
    }
  }
github nuxt / nuxt.js / lib / core / nuxt.js View on Github external
async callHook(name, ...args) {
    if (!this._hooks[name]) {
      return
    }
    consola.debug(`Call ${name} hooks (${this._hooks[name].length})`)
    try {
      await sequence(this._hooks[name], fn => fn(...args))
    } catch (err) {
      consola.error(err)
      this.callHook('error', err)
    }
  }
github nuxt / blueprints / src / blueprint.js View on Github external
async copyFile ({ src, dst }) {
    if (!src) {
      return
    }

    if (!path.isAbsolute(dst)) {
      dst = path.join(this.nuxt.options.buildDir, dst)
    }

    try {
      consola.debug(`${this.constructor.name}: Copying '${path.relative(this.nuxt.options.srcDir, src)}' to '${path.relative(this.nuxt.options.buildDir, dst)}'`)

      await ensureDir(path.dirname(dst))
      await copyFile(src, dst, fs.constants.COPYFILE_FICLONE)
      return dst
    } catch (err) {
      consola.error(`${this.constructor.name}: An error occured while copying '${path.relative(this.nuxt.options.srcDir, src)}' to '${path.relative(this.nuxt.options.buildDir, dst)}'\n`, err)
      return false
    }
  }