Skip to content

infinite loop protection #298

Open
@danielroe

Description

@danielroe

Describe the feature

Discovered in nuxt/nuxt#27130, it's possible to create an infinite loop when getters call console.log, which is true for Vue.

Reproduction: https://codepen.io/danielroe/pen/GRaqZOj?editors=1111

import { consola } from "consola"

consola.wrapConsole()

const scaryObject = {
  get value () {
    console.warn('Do not access me!', scaryObject)
  }
}

consola.log(scaryObject)

I wonder if it would be worth trying to add protection against this kind of thing? Maybe JSON.stringify could be called lazily?

Additional information

  • Would you be willing to help implement this feature?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions