Activities

regevbr

regevbr posted a new bug report

consola โ€ข

bug missing typescript definitions for reporters

Version

v2.11.3

Reproduction link

https://example.com

Steps to reproduce

import { Consola, FancyReporter } from 'consola';
will produce an error as there is no exported member FancyReporter

What is expected ?

to have proper detentions for the entire library

What is actually happening?

typescript error

AlexXanderGrib

AlexXanderGrib posted a new question

consola โ€ข

Wrong autocomplete while using as CommonJS module in VSCode

The code:

const consola = require('consola')

consola. // *CTRL+Space*
Autocomlete
BrowserReporter
Consola
default

Instead of

Autocoplete
log
mock
mockTypes
pause
โ€ฆ

Please fix the typing

pi0

pi0 posted a new question

consola โ€ข

[typescript] const consola = require('consola') type is wrong

Ref: #80

Fix a typing issue that causes this to throw a typing error on consola.green:

// @ts-check

const consola = require('consola')

consola.green('foo')

Workaround:

// globals.d.ts

import { Consola } from 'consola'

declare module 'consola' {
  export = new Consola()
}
asasas333

asasas333 posted a new bug report

consola โ€ข

bug Export assignment error in consola.d.ts

Version

v2.11.2

Reproduction link

https://jsfiddle.net/6hj9wd35/

Steps to reproduce

Run a project with latest version

What is expected ?

Remove incorrect export, line 98
https://github.com/nuxt/consola/commit/5c22d8cd4624e3bbd7294b9eba09f131ed786332

What is actually happening?

An export assignment cannot be used in a module with other exported elements.

asasas333

asasas333 posted a new question

consola โ€ข

nuxt:typescript: export assignment error in consola.d.ts
ERROR in ./node_modules/consola/types/consola.d.ts(98,1):                                                          nuxt:typescript 11:30:28
   96 | export default consolaGlobalInstance
   97 | 
 > 98 | export = consolaGlobalInstance
      | ^
   99 | 
โ„น Version: typescript 3.7.4                                                                                                                                nuxt:typescript 11:30:28
โ„น Time: 15081ms                                                                                                                                            nuxt:typescript 11:30:28
โ„น Waiting for file changes                                                                                                                                                 11:30:28
โ„น Memory usage: 638 MB (RSS: 1.23 GB) 
Ckeyang

Ckeyang posted a new question

consola โ€ข

An export assignment cannot be used in a module with other exported elements

how to solve this problem
ERROR in D:/web/test-nuxt-ts/nodemodules/consola/types/consola.d.ts ERROR in D:/web/test-nuxt-ts/nodemodules/consola/types/consola.d.ts(98,1):
98:1 An export assignment cannot be used in a module with other exported elements.
96 | export default consolaGlobalInstance
97 |

98 | export = consolaGlobalInstance
| ^
99 |

FATAL Nuxt build error

AcerFeng

AcerFeng posted a new question

consola โ€ข

Typescript:An export assignment cannot be used in a module with other exported elements.
ERROR in f:/web/explorer/node_modules/consola/types/consola.d.ts
ERROR in f:/web/explorer/node_modules/consola/types/consola.d.ts(98,1):
98:1 An export assignment cannot be used in a module with other exported elements.
    96 | export default consolaGlobalInstance
    97 | 
  > 98 | export = consolaGlobalInstance
       | ^
    99 | 

 FATAL  Nuxt build error                                                                                                                                                                             15:42:59

  at WebpackBundler.webpackCompile (node_modules\@nuxt\webpack\dist\webpack.js:5326:21)
  at process._tickCallback (internal/process/next_tick.js:68:7)


   โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
   โ”‚                             โ”‚
   โ”‚   โœ– Nuxt Fatal Error        โ”‚
   โ”‚                             โ”‚
   โ”‚   Error: Nuxt build error   โ”‚
   โ”‚                             โ”‚
   โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] generate: `nuxt generate`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] generate script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
jjelev

jjelev posted a new question

consola โ€ข

Typescript definitions use reserved export keyword
ERROR  ERROR in ./node_modules/consola/types/consola.d.ts(98,1):                                                          nuxt:typescript 11:30:28
98:1 An export assignment cannot be used in a module with other exported elements.
    96 | export default consolaGlobalInstance
    97 | 
  > 98 | export = consolaGlobalInstance
       | ^
    99 | 

โ„น Version: typescript 3.7.4                                                                                                                                nuxt:typescript 11:30:28
โ„น Time: 15081ms                                                                                                                                            nuxt:typescript 11:30:28
โ„น Waiting for file changes                                                                                                                                                 11:30:28
โ„น Memory usage: 638 MB (RSS: 1.23 GB)    
baadc0de

baadc0de posted a new bug report

consola โ€ข

bug consola does not work under AudioWorkletGlobalScope

Version

v2.11.2

Reproduction link

https://codesandbox.io/s/gracious-mendel-uw0vh

Steps to reproduce

Functions like setTimeout and clearTimeout are not defined on https://developer.mozilla.org/en-US/docs/Web/API/AudioWorkletGlobalScope

Logging with consola uses these functions in order to throttle logging. It should be possible to disable the throttling or have consola disable throttling if these functions are not available.

Creating a worklet.js file with the following code:
console.log({setTimeout: typeof setTimeout, clearTimeout: typeof clearTimeout})

And another file, index.js with the following:
new AudioContext().audioWorklet.addModule("/worklet.js")

Outputs
{setTimeout: "undefined", clearTimeout: "undefined"}

What is expected ?

Consola to log without a crash

What is actually happening?

Consola code crashes

krzkaczor

krzkaczor posted a new bug report

consola โ€ข

bug Fancy reporter hides nested structures

Version

v2.10.0

Reproduction link

https://repl.it/repls/RealDarkredOolanguage

Steps to reproduce

Create deeply (4 levels) nested object and try to log it.

What is expected ?

Whole object gets logged in the console.

What is actually happening?

Object is collapsed and part of it becomes simply [Object] hiding important info.

Additional comments?

This could be a configurable behaviour but I strongly belive that by default everything should be visible.

bat79a

bat79a posted a new bug report

consola โ€ข

bug nuxt-link openn an error : consola.info is not a function

Version

v2.10.0

Reproduction link

https://jsfiddle.net/boilerplate/vue

Steps to reproduce

Hello.

I have installed consola in my project and when I click on a nuxt-link who must display a log via Middleware I have an error : consola.info is not a function

If I refresh the page with my browser the log works well.

PS : an other project with nuxt 2.5.0 and consola 2.5.7 was working well

  • My middleware/log-router.js file
const consola = require('consola')

export default function (context) {
  consola.info('--> Info | request ' + context.route.fullPath + ' launched')
}
  • My nuxt.config.js file
export default {
  ...
  router: {
    // Run the middleware/log-router.js on every page
    middleware: 'log-router'
  }
}

Capture dโ€™eฬcran 2019-10-10 aฬ€ 10.51.32.png

What is expected ?

Log a message

What is actually happening?

Blank page with error.

  • Page :
    consola.info is not a function
    An error occurred while rendering the page. Check developer tools console for details.

  • Console :
    vendors.app.js:11254 error TypeError: consola.info is not a function
    at app.js:3989
    at promisify (app.js:3422)
    at middlewareSeries (app.js:3401)
    at Vue.callMiddleware (app.js:943)
    at Vue._callee4$ (app.js:1069)
    at tryCatch (commons.app.js:6116)
    at Generator.invoke as _invoke
    at Generator.prototype.<computed> as next
    at asyncGeneratorStep (commons.app.js:31)
    at _next (commons.app.js:53)
    log @ vendors.app.js:11254
    _log @ vendors.app.js:11166
    logFn @ vendors.app.js:11160 logFn @ vendors.app.js:11084 push../.nuxt/client.js.vueWEBPACKIMPORTEDMODULE18.default.config.errorHandler @ app.js:680
    globalHandleError @ app.js:3101
    _callee4$ @ app.js:1319
    tryCatch @ commons.app.js:6116
    invoke @ commons.app.js:6342
    prototype.<computed> @ commons.app.js:6168
    asyncGeneratorStep @ commons.app.js:31
    _next @ commons.app.js:53
    Promise.then (async)
    asyncGeneratorStep @ commons.app.js:41
    _next @ commons.app.js:53
    (anonymous) @ commons.app.js:60
    (anonymous) @ commons.app.js:49
    _render @ app.js:1342
    render @ app.js:947
    iterator @ commons.app.js:10678
    step @ commons.app.js:10452
    (anonymous) @ commons.app.js:10453
    (anonymous) @ commons.app.js:10699
    _callee3$ @ app.js:805
    tryCatch @ commons.app.js:6116
    invoke @ commons.app.js:6342
    prototype.<computed> @ commons.app.js:6168
    asyncGeneratorStep @ commons.app.js:31
    _next @ commons.app.js:53
    (anonymous) @ commons.app.js:60
    (anonymous) @ commons.app.js:49
    loadAsyncComponents @ app.js:842 loadAsyncComponents @ app.js:736 iterator @ commons.app.js:10678 step @ commons.app.js:10452 step @ commons.app.js:10456 runQueue @ commons.app.js:10460 confirmTransition @ commons.app.js:10707 transitionTo @ commons.app.js:10609 push @ commons.app.js:10919 push @ commons.app.js:11300 handler @ commons.app.js:9174 invokeWithErrorHandling @ commons.app.js:13255 invoker @ commons.app.js:13580 original.wrapper @ commons.app.js:18303
    Show 14 more frames

pimlie

pimlie posted a new question

consola โ€ข

Spam not logged without trailing call

The repeated X times is only triggered with a trailing consola call. If you dont have a trailing consola call the spam message doesnt get printed.

See https://jsfiddle.net/6pvqxy1k/1/ for an example, without the END call the (repeated 4 times) message will never be printed

phamhoaithuong

phamhoaithuong posted a new question

consola โ€ข

Err Creating a new instance

import consola from 'consola'

const logger = consola.create({
// level: 4,
reporters: new consola.JSONReporter() ,
defaults: {
additionalColor: 'white'
}
})

Error TS2339 (TS) Property 'JSONReporter' does not exist on type 'Consola'.
Error TS2322 (TS) Type '{ additionalColor: string; }' is not assignable to type 'ConsolaLogObject'.
Object literal may only specify known properties, and 'additionalColor' does not exist in type 'ConsolaLogObject'.
i'm using code in document, but it have error. i don't nkow how to fix it. pls help me, thanks you very much.

mathieutu

mathieutu posted a new bug report

consola โ€ข

bug Doesn't handle native console string substitutions.

Version

v2.10.0

Reproduction link

https://codesandbox.io/embed/fervent-pine-su2ty

Steps to reproduce

Hi folks,

Consola is not handling the native string substitutions of console.
https://developer.mozilla.org/en-US/docs/Web/API/console#Using_string_substitutions

This leads to issues when when using wrapConsole method in code bases where you don't control logs.

Example: there is a problem with all the react errors.

Here an example before/after the wrap:

- Warning: Received `true` for a non-boolean attribute `secondary`.
+ Warning: Received `%s` for a non-boolean attribute `%s`.

- If you want to write it to the DOM, pass a string instead: secondary="true" or secondary={value.toString()}.
+ If you want to write it to the DOM, pass a string instead: %s="%s" or %s={value.toString()}.%s true secondary secondary true secondary 
    in h1 (created by App)
    in div (created by App)
    in App

For me, consola should have the same api than console, to be able to replace it properly.

How can we handle that?

Thanks for your work,
Matt'.

What is expected ?

Consola should have at least the same api and features than console.

What is actually happening?

Features from console are missing in consola (browser and node).

MANJUSAK

MANJUSAK posted a new question

consola โ€ข

The project is almost an example of js. Can you provide an example of ts? thank you very much

The project is almost an example of js. Can you provide an example of ts? thank you very much

MANJUSAK

MANJUSAK posted a new question

consola โ€ข

Best to give a TS example

The project is almost an example of js. Can you provide an example of ts? thank you very much

parth444

parth444 posted a new bug report

consola โ€ข

bug SyntaxError: Unexpected token ... on node 6.10.3

Version

v2.9.0

Reproduction link

[No link needed](No link needed)

Steps to reproduce

Create a file test.js and add following line:

var consola = require('consola');

What is expected ?

No errors when running on node 6.10.3

What is actually happening?

(function (exports, require, module, __filename, __dirname) { "use strict";function _interopDefault(u){return u&&"object"==typeof u&&"default"in u?u.default:u}var util=_int
eropDefault(require("util")),path=require("path"),fs=require("fs"),os=_interopDefault(require("os")),commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=t
ypeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function createCommonjsModule(u,e){return u(e={exports:{}},e.exports),e.exports}funct
ion getCjsExportFromNamespace(u){return u&&u.default||u}var vendors=[{name:"AppVeyor",constant:"APPVEYOR",env:"APPVEYOR",pr:"APPVEYOR_PULL_REQUEST_NUMBER"},{name:"Bamboo",c
onstant:"BAMBOO",env:"bamboo_planKey"},{name:"Bitbucket Pipelines",constant:"BITBUCKET",env:"BITBUCKET_COMMIT"},{name:"Bitrise",constant:"BITRISE",env:"BITRISE_IO",pr:"BITR
ISE_PULL_REQUEST"},{name:"Buddy",constant:"BUDDY",env:"BUDDY_WORKSPACE_ID",pr:"BUDD
SyntaxError: Unexpected token ...
    at createScript (vm.js:56:10)
    at Object.runInThisContext (vm.js:97:10)
    at Module._compile (module.js:542:28)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (C:\Users\Default\Desktop\test.js:1:77)
parth444

parth444 posted a new question

consola โ€ข

SyntaxError: Unexpected token ... on node 6.10.3

Version
2.9.0

Steps to reproduce
Create a file test.js and add following line:

var consola = require('consola');

What is expected ?
No errors when running on node 6.10.3

What is actually happening?

(function (exports, require, module, __filename, __dirname) { "use strict";function _interopDefault(u){return u&&"object"==typeof u&&"default"in u?u.default:u}var util=_int
eropDefault(require("util")),path=require("path"),fs=require("fs"),os=_interopDefault(require("os")),commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=t
ypeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function createCommonjsModule(u,e){return u(e={exports:{}},e.exports),e.exports}funct
ion getCjsExportFromNamespace(u){return u&&u.default||u}var vendors=[{name:"AppVeyor",constant:"APPVEYOR",env:"APPVEYOR",pr:"APPVEYOR_PULL_REQUEST_NUMBER"},{name:"Bamboo",c
onstant:"BAMBOO",env:"bamboo_planKey"},{name:"Bitbucket Pipelines",constant:"BITBUCKET",env:"BITBUCKET_COMMIT"},{name:"Bitrise",constant:"BITRISE",env:"BITRISE_IO",pr:"BITR
ISE_PULL_REQUEST"},{name:"Buddy",constant:"BUDDY",env:"BUDDY_WORKSPACE_ID",pr:"BUDD
SyntaxError: Unexpected token ...
    at createScript (vm.js:56:10)
    at Object.runInThisContext (vm.js:97:10)
    at Module._compile (module.js:542:28)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (C:\Users\Default\Desktop\test.js:1:77)
parth444

parth444 posted a new question

consola โ€ข

SyntaxError: Unexpected token ... for node 6.10.3

Version
2.9.0

Steps to reproduce
Create test.js and add:

var consola = require('consola');

What is expected ?
No errors when running node 6.10.3

What is actually happening?

(function (exports, require, module, __filename, __dirname) { "use strict";function _interopDefault(u){return u&&"object"==typeof u&&"default"in u?u.default:u}var util=_int
eropDefault(require("util")),path=require("path"),fs=require("fs"),os=_interopDefault(require("os")),commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=t
ypeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function createCommonjsModule(u,e){return u(e={exports:{}},e.exports),e.exports}funct
ion getCjsExportFromNamespace(u){return u&&u.default||u}var vendors=[{name:"AppVeyor",constant:"APPVEYOR",env:"APPVEYOR",pr:"APPVEYOR_PULL_REQUEST_NUMBER"},{name:"Bamboo",c
onstant:"BAMBOO",env:"bamboo_planKey"},{name:"Bitbucket Pipelines",constant:"BITBUCKET",env:"BITBUCKET_COMMIT"},{name:"Bitrise",constant:"BITRISE",env:"BITRISE_IO",pr:"BITR
ISE_PULL_REQUEST"},{name:"Buddy",constant:"BUDDY",env:"BUDDY_WORKSPACE_ID",pr:"BUDD
SyntaxError: Unexpected token ...
    at createScript (vm.js:56:10)
    at Object.runInThisContext (vm.js:97:10)
    at Module._compile (module.js:542:28)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (C:\Users\Default\Desktop\test.js:1:77)
duyleekun

duyleekun posted a new bug report

consola โ€ข

bug Incorrect cmty link in issue template

Version

2.8.1

Reproduction link

https://github.com/nuxt/consola/issues/new

Steps to reproduce

What is expected ?

https://cmty.app/nuxt/issues/new?type=bug-report&repo=consola

What is actually happening?

https://nuxtjs.cmty.io/issues/new