Giter Club home page Giter Club logo

cli-table3's People

Contributors

boneskull avatar cschanaj avatar dabh avatar danielruf avatar dependabot-preview[bot] avatar dependabot-support avatar dependabot[bot] avatar elaichenkov avatar gantman avatar itsnickbarry avatar jamestalmage avatar jj avatar ludofischer avatar macieklad avatar mmurphy avatar philkunz avatar rishi8094 avatar shazron avatar speedytwenty avatar turbo87 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

cli-table3's Issues

`tb.toString()` performance

Hello, I found that when the number of rows is huge, I start to have some performance problems.

I have 1763 rows (5 columns) and it takes me 4473.023ms to run toString method, I want to know if there is a way to improve the performance ?

Thank you!

output error

My code:

const table2 = new Table({style:{head:[],border:[]}});

table2.push(
  [{rowSpan:5,content:1},{rowSpan:3,content:1},{colSpan: 5, content: 1}],
  [{colSpan: 5, content: 1}],
  [1,1,1,1,1],
  [1,1,1,1,1,1],
  [1,1,1,1,1,1]
)

console.log(table2.toString())

output:

┌───┬───┬───────────────────┐
│ 1 │ 1 │ 1                 │
│   │   ├───────────────────┤
│   │   │ 1                 │
│   │   ├───├───┬───┬───┬───┬───┤
│   │   │ 1 │ 1 │ 1 │ 1 │ 1 │   │
│   ├───┼───┼───┼───┼───┼───┤
│   │ 1 │ 1 │ 1 │ 1 │ 1 │ 1 │
│   ├───┼───┼───┼───┼───┼───┤
│   │ 1 │ 1 │ 1 │ 1 │ 1 │ 1 │
└───┴───┴───┴───┴───┴───┴───┘

image

Link as hyperlink in terminal doesn't render correctly

Hey there, I tried all versions of cli-table i-e cli-table1, cli-table2 & cli-table3. All of them doesn't render the link properly.

This is the library i'm using terminal-link: Create clickable links in the terminal When i log it without cli-table3 it renders the link correctly. But when used inside the columns of cli-table it doesn't render it and mess up the table borders. (Check the pic)

What do you think can be an issue? I think cli-table is encoding the column's content which mess up the encoding provided by terminal-link?

(90m should suppose to be the link) I'm using iterm2

image

npm update?

Hello,

I've noticed that there was a fix with emojis in the table when I experimented with the source. Will this change be pushed to npm? Thanks!

Is it possible to display colors in Jenkins

I am using ANSI color plugin, and it gives several options like xterm, css, vga and gnome-terminal. But I am getting no colors on it using any of these options. I can easily get colors in strings using escape characters like "\x1b{33m".
image

Update to cli-tabe3 for shyim/ssh-host-manager

Steps to complete

  • Go to and fork the following repository: https://github.com/shyim/ssh-host-manager
  • Once forked, open the project in your editor of choice, and search the project for the string cli-table2
  • Change all of these references to cli-table3, particularly ensuring that the dependency in `package.json is updated to read:
"cli-table3": "^0.5.0",
  • Open a pull request to the original repository
  • Add a comment here linking to your PR

You can use the following copy as the title and description of your pull request:

Title

Updates dependency cli-table2 to cli-table3

Description

This PR updates the cli-table2 dependency to cli-table3, which fixes one of the npm audit warnings :)

cli-table2 (like cli-table itself) is no longer maintained. In jamestalmage/cli-table2#43 a couple of people have offered to take over maintenance but the current maintainer did not respond so as a result the project was forked to cli-table/cli-table3.

Additional row added when using `rowSpan`

Hello,

my initialization code:

const statesTable = new Table({
  head: ['ID', 'value', 'effects', 'Qs', 'Q result'],
  colWidths: [6, 19, 10, 10, 19]
});

here're my rows:

[
  [
    {
      "rowSpan": 2,
      "content": "s_1"
    },
    {
      "rowSpan": 2,
      "content": "\"foo\""
    },
    "e_25",
    "map\nmap*\nmutate",
    "\"foo\""
  ],
  [
    "e_26",
    "map\npipe*",
    "\"foo\""
  ]
]

And the result is:
image

So, I'm wondering if I'm missing something. It looks like the empty cell on the second row shouldn't be there.

Failing unit test

I tried to clone the project and run test in my local. But I got several tests are failing.
Im using MacOs with zsh command line

Screen Shot 2020-12-05 at 00 36 42
Screen Shot 2020-12-05 at 00 36 33

[Bug/Question] Cross tables typing

Problem:

This code snippet produce such error from Typescript:

const resultTable = new Table({
  head: ['', 'Assets ', 'Entries']
});

resultTable.push(
   { 'Previous values': [`100`, `200`] },
   { 'Normalized values': [`10`, `100`] }
);
Type 'string[]' is not assignable to type '(string & Cell[]) | (number & Cell[]) | (false & Cell[]) | (true & Cell[]) | (CellOptions & Cell[])'.
  Type 'string[]' is not assignable to type 'CellOptions & Cell[]'.
    Property 'content' is missing in type 'string[]' but required in type 'CellOptions'.ts(2322)

According to the documentation about cross table this code should be absolutely valid https://github.com/cli-table/cli-table3#cross-tables.

Could you check the typing for that case or maybe I'm wrong?

Environment

Typescript: 3.8.3
cli-table3: 0.6.0

Align headers

Thank you for keeping this project active.

It would be great if headers could use same defaults that Cell can take. My current want is to center align a header when a cell text is longer than the heading:

Screen Shot 2019-04-15 at 11 59 02 AM

Example:

const foo = new Table({
  head: ['foo'],
}) as HorizontalTable;

foo.push(['something longer than the head']);

console.log(foo.toString());

I'd like something along these lines:

const foo = new Table({
  head: [{ content: 'foo', hAlign: 'center' }],
}) as HorizontalTable;

foo.push(['something longer than the head']);

console.log(foo.toString());

which would get me:

Screen Shot 2019-04-15 at 12 01 58 PM

Merge with tty-table

HI guys,

I'm quite curious about this project, because I've been maintaining a backwards compatible alternative to cli-table that has possibly resolved some of the issues that would have caused you to fork its fork: cli-table2.

I see this chain of forks (cli-table/cli-table2/cli-table3) as a humorous, but sad microcosm of open source on Github. Feel free to cherry pick any of my source to apply it towards cli-table3, or perhaps you could create a tty-table2, tty-table3, etc like you have with cli-table here.

Also, headhunting the dependents of your parent forks via PR is a novel move. Nice.

Add ability to set wordWrap: break-word to always wrap newlines at arbitrary break points

I essentially want the same functionality as css' overflow-wrap: break-word;

Note wordWrap: true does nothing here because there are no \n chars in my string.

My current table code:

const Table = require('cli-table3')

let table = new Table({
  'colWidths': [3, 36],
})

table.push([
  '✔',
  'stdout_specfile_display_spec_with_a_really_long_name_that_never_has_a_line_break_or_new_line.js',
])


console.log(table.toString())

Console output

Screen Shot 2019-09-13 at 5 45 16 PM

I want to pass some option like: wordWrap: 'break-word to the TableOptions and/or CellOptions so that I get this output from the code above

WHAT I WANT OUTPUT

Screen Shot 2019-09-13 at 5 48 49 PM

Can I do this myself? Yes. Is it a PITA? Yes. 😞

Finding the points to insert newlines would be more convenient from within this library since it already is calculating how to wrapWords and knows the width of the columns/rows already.

chore: migration from cli-table2 to cli-table3

Looks like node 4 and 5 don't work

Opened a PR on json2csv and got the following error report from the maintainer:
zemirco/json2csv#302

Looks like node 4 and 5 don't work due to Block-scoped declarations (let, const, function, class) not yet supported outside strict mode.

Also color shows up in Node 8 and 9 but not in 6 and 7. We are testing against the > output without the colors, so tests fail in 8 and 9.

zemirco/json2csv#302 (comment)

TypeScript complains on table.push()

TypeScript complains on table.push().

Here is a test code:

import Table from "cli-table3"
const table = new Table({
  head: ["H1", "H2"]
})
table.push(["c1", "c2"])
console.log(table.toString())

Here is an error message:

tsc

src/t0-test.ts:6:1 - error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '((...items: Cell[][]) => number) | ((...items: VerticalTableRow[]) => number) | ((...items: CrossTableRow[]) => number)' has no compatible call signatures.

6 table.push(["c1", "c2"])
  ~~~~~~~~~~~~~~~~~~~~~~~~

That code possible to compile and run with ts-ignore comment:
It will works:

// @ts-ignore
table.push(["c1", "c2"])

TypeScript version: 3.1.2
tsconfig.json:

{
  "compilerOptions": {
    "target": "es6",
    "module": "commonjs",
    "lib": ["es2017"],
    "sourceMap": true,
    "outDir": "./dist",
    "strict": true,
    "moduleResolution": "node",
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "esModuleInterop": true
  },
  "include": ["src/**/*"]
}

Dynamic Tables?

Can you create a Dynamic Tables so you can change something (in the array) and then reprint it without the table showing twice?

default text align

Hi,
Could we have an default option for the cell's text align please ?
... I mean instead of manually wrapping all the cell contents.

Thanks!

tests aren't run?

Hi, I was going to send a PR, but it seems the tests aren't actually being run. Instead, the code only gets linted:

$ jest --color
 PASS   lint  test/cell-test.js
 PASS   lint  test/table-layout-test.js
 PASS   lint  test/utils-test.js
 PASS   lint  src/cell.js
 PASS   lint  src/utils.js
 PASS   lint  examples/col-and-row-span-examples.js
 PASS   lint  test/layout-manager-test.js
 PASS   lint  test/original-cli-table-index-tests.js
 PASS   lint  src/layout-manager.js
 PASS   lint  examples/basic-usage-examples.js
 PASS   lint  test/verify-legacy-compatibility-test.js
 PASS   lint  lib/print-example.js
 PASS   lint  test/table-test.js
 PASS   lint  test/original-cli-table-newlines-test.js
 PASS   lint  src/table.js
 PASS   lint  scripts/print-examples.js
 PASS   lint  test/example-tests.js
 PASS   lint  scripts/update-docs.js

Test Suites: 18 passed, 18 total
Tests:       18 passed, 18 total
Snapshots:   0 total
Time:        2.037s
Ran all test suites.
✨  Done in 3.57s.

The last known good changeset I could find was 907b392.

In this revision:

$ jest --color
 PASS  test/example-tests.js
 PASS  test/cell-test.js
 PASS  test/verify-legacy-compatibility-test.js
 PASS  test/table-layout-test.js
 PASS  test/utils-test.js
 PASS  test/original-cli-table-index-tests.js
 PASS  test/table-test.js
 PASS  test/layout-manager-test.js
 PASS  test/original-cli-table-newlines-test.js

Test Suites: 9 passed, 9 total
Tests:       1 skipped, 243 passed, 244 total
Snapshots:   0 total
Time:        1.448s
Ran all test suites.
✨  Done in 2.45s.

Update projects depending on cli-table2

We should probably use @Turbo87 message he used for npm/npm#20955 as it clearly explains the situation. I am thinking that, if you are going to open a PR against one of the repos below, open a separate issue for it, and once the PR has merged, remove it from the list here? Thoughts?

This PR updates the cli-table2 dependency to cli-table3, which fixes one of the npm audit warnings :)

cli-table2 (like cli-table itself) is no longer maintained. In jamestalmage/cli-table2#43 a couple of people have offered to take over maintenance but the current maintainer did not respond so as a result the project was forked to https://github.com/cli-table/cli-table3.

Fix the union "Table" type definition

While I was working on the issue #28, after updating the code for the new version of cli-table, typescript threw at me the following error for the push method of the Table type.

Cannot invoke an expression whose type lacks a call signature. Type '((...items: Cell[][]) => number) | ((...items: VerticalTableRow[]) => number) | ((...items: CrossTableRow[]) => number)' has no compatible call signatures.

The problem

The method was called with proper signature, but it still throws the error.

The solution

It seems that the "Table" union type definition was created incorrectly, as Typescript prefers to wrap the generics with a single type instead of creating new ones for them.

I created a pull request for the suggested solution #53

ChainAlert: new npm maintainer has published version 0.6.1 of package cli-table3

Dear cli-table3 maintainers,
Thank you for your contribution to the open-source community.

This issue was automatically created to inform you a new npm maintainer has published version 0.6.1 of cli-table3.

New Maintainers:

Our service monitors the open-source ecosystem and informs popular packages' owners in case of potentially harmful activity.
If you find this behavior legitimate, kindly close and ignore this issue. Read more

badge

CellOptions padding does not override TableOptions padding when set to 0

If you try to override padding-left or padding-right TableOptions style with a CellOptions style with 'padding-left': 0 or 'padding-right': 0 there is no effect.

The 0 values in the cell also do not override the default padding in cli-table3.

The padding-left and padding-right set to 0 does work fine in the TableOptions however. The bug is only in overriding the Table options

const Table = require('cli-table3')

let table = new Table({
  'style': {
    'padding-left': 1, // default Table option is padding 1
  },
})

table.push([
  {
    content: 'a',
    'style': {
      'padding-left': 5,  // padding 5 👍 	
    },
  },
  {
    content: 'b',
    'style': {
      'padding-left': 1, // padding 1 👍 	
    },
  },
  {
    content: 'c',
    'style': {
      'padding-left': 0,  // padding 0 :(  no effect 	
    },
  },
  {
    content: 'd',
    'style': {
      'padding-left': -1,  // padding -1 kind of has 0 padding 
						   // but then has to offset with colWidths 2 to work
    },
  },
])

console.log(table.toString())

Resulting table:

Screen Shot 2019-09-13 at 3 36 21 PM

The tests do not cover a 0 case of padding here:

it('if set will override tableOptions.style', function() {

This line is culprit:

targetObj[nameA] = objA[nameA] || objA[nameB] || objB[nameA] || objB[nameB];

When padding-left in the Cell style options is a positive number (2) this is evaluating out as:

obj.paddingLeft = 
  cellStyleObj.paddingLeft ||      // evaluates to undefined
  cellStyleObj[padding-left] ||    // evaluates to 2
  tableStyleObj.paddingLeft ||     // evaluates to undefined
  tableStyleObj.[padding-left]     // evaluates to 1

// paddingLeft = 2 yay!!

When padding-left in the Cell style options is 0 this is evaluating out as:

obj.paddingLeft = 
  cellStyleObj.paddingLeft ||    // evaluates to undefined
  cellStyleObj[padding-left] ||  // evaluates to 0
  tableStyleObj.paddingLeft ||   // evaluates to undefined
  tableStyleObj.[padding-left]   // evaluates to 1

// paddingLeft = 1 oh no!!

I would love to submit a PR, but honestly I have no idea if I will have the time. Hopefully this is helpful!

Update to cli-table3 for mateodelnorte/servicebus-trace

Steps to complete

  • Go to and fork the following repository: https://github.com/mateodelnorte/servicebus-trace
  • Once forked, open the project in your editor of choice, and search the project for the string cli-table2
  • Change all of these references to cli-table3, particularly ensuring that the dependency in `package.json is updated to read:
"cli-table3": "^0.5.0",
  • Open a pull request to the original repository
  • Add a comment here linking to your PR

You can use the following copy as the title and description of your pull request:

Title

Updates dependency cli-table2 to cli-table3

Description

This PR updates the cli-table2 dependency to cli-table3, which fixes one of the npm audit warnings :)

cli-table2 (like cli-table itself) is no longer maintained. In jamestalmage/cli-table2#43 a couple of people have offered to take over maintenance but the current maintainer did not respond so as a result the project was forked to cli-table/cli-table3.

RowSpan extra column

My intention is to produce a table that looks like this:

┌────┬────┬────┐
│ A1 │ B1 │ C1 │
│    ├────┼────┤
│    │ B2 │ C2 │
│    │    ├────┤
│    │    │ C3 │ 
└────┴────┴────┘

For some reason, it looks like this:

┌────┬────┬────┐
│ A1 │ B1 │ C1 │
│    ├────┼────┤
│    │ B2 │ C2 │
│    │    ├────├────┤
│    │    │ C3 │    │
└────┴────┴────┴────┘
    const tbl = new Table();
    tbl.push([ { rowSpan: 3, content: 'A1' }, 'B1', 'C1'], 
             [ { rowSpan: 2, content: 'B2' }, 'C2'],
             ['C3']);
    console.log(tbl.toString());

I can remove the extra column in this example by making the third row an empty array, but I do need to display 'C3'.

I saw PR 187, so I thought it is already fixed. I verified that I have the code, but still getting that extra column.

Any new releases?

The library it's not updated anymore... node.js 6 is not maintained anymore and there are fixes that haven't been released yet.

Random Coloumns

Description:
Random Columns are generated on the 2 last lines.
Is this error from my code or something internally in the lib?

Code:

let table = new Table(({
    head: ['Time', 'Mon', 'Tues', 'Wed', 'Thur', 'Fri']
}))

let period = ['Library', '.Net SK B1\nCG Lab VG B2\nDBMS SV B3', '.Net GC', 'TOC VP', 'DBMS SV', 'CG Lab VG B1\nDBMS SV B2\n.Net SK B3', 'IMP BP', 'CG YC','ID', 'DBMS SV B1\n.Net SK B2', 'CG LAB B3 VG', 'CG (TUT) YC', 'Club Activity', 'Mentor Meet'];

table.push(
    ['09:00 to 10:00', period[0], period[0], period[0], {rowSpan:3,content:period[1],vAlign:'center'}, period[2]],
    ['10:00 to 11:00', period[3], period[3], period[4], {rowSpan:3,content:period[5],vAlign:'center'}],
    ['11:00 to 12:00', period[6], period[7], period[3]],
    ['12:00 to 01:00', period[0], period[8], period[6], period[6]],
    ['01:00 to 02:00', {colSpan: 5, content: 'Lunch', hAlign: 'center'}],
    ['02:00 to 03:00', {rowSpan:3,content:period[9],vAlign:'center'},{rowSpan:3,content:period[10],vAlign:'center'}, period[3], period[2], period[4]],
    ['03:00 to 04:00', period[10], period[7], period[6]],
    ['04:00 to 05:00', period[3], period[11], period[12]]
);

console.log(table.toString())

Output:
image

optional dependency colors apparently corrupted by maintainer

I have reported this upstream in laravel-mix but also wanted to report it here. Given that colors is an optional dependency it may be best to simply remove it from this project. I read that colors and faker npm projects were both corrupted:

see https://www.bleepingcomputer.com/news/security/dev-corrupts-npm-libs-colors-and-faker-breaking-thousands-of-apps/

At the very least I would say ensure that this package specifies version 1.4.0 to prevent folks from downloading the corrupted version.

RangeError: Invalid string length

Full error:

RangeError: Invalid string length
    at Array.join (<anonymous>)
    at Table.toString (/Users/.../node_modules/cli-table3/src/table.js:59:19)

The table is pretty long, but I do need it. I'm wondering if there's something this library can do about this error. This comment in an atom editor issue seemed to have some useful info.

Here's the table as a text file:

range_error_invalid_string_length.txt

[Edit: Also, if this library can't deal with that error, what the longest a string can be?]

colors.js zalgo "bug" breaking dependents

Please check Marak/colors.js#289 for all details.

Looks like the color package is deliberately broken so all dependencies break on update.

Would it be possible for now to update the package.json file to lock the colors package to the last stable version: 1.4.0 ?

Ugly output

Why do I get such ugly output?

Using: Ubuntu 16.04
Tmux: 2.1
Env: ssh user@prodenv

Screen Shot 2020-11-07 at 8 29 15 AM

My technical skills has reached a limit and I don't know how to solve this issue, any tips / pointers in the right direction to configure my setup correctly is all I need.

Help is appreciated!

Set width of table based on terminal width

Hi,

Is it possible to have a dynamic width table based on the width of the terminal? I see that column widths are optional but this doesn't format the table as expected as pushes data outside of the bounds and setting a column width with a terminal that is too small pushes the data out of bounds:

Column width unset:
image

Column width set:
image

Now if i set the column width but make the terminal smaller than the total width:
image

Thank you.

Add option to remove empty cells

Would it be possible to have an option that removes empty cells and returns a table like this?

┌────────────────────┬───────────────────────┬────────────────┐
│       Guilds       │       Channels        │  Aprox. Users  │
├────────────────────┼───────────────────────┼────────────────┤
│        137         │         4,838         │    295,012     │
├────────────────────┼───────────────────────┼────────────────┤
│   Messages sent    │   Messages received   │ Commands used  │
├────────────────────┼───────────────────────┼────────────────┤
│         25         │          190          │     9,756      │
├────────────────────┼───────────────────────┼────────────────┤
│Highlights triggered│       Mentions        │     Shard      │
├────────────────────┼───────────────────────┼────────────────┤
│      100,356       │           0           │  not sharded   │
├────────────────────┼───────────────────────┼────────────────┤
│       Uptime       │   Uptime Percentage   │  Memory Used   │
├────────────────────┼───────────────────────┼────────────────┤
│     3 minutes      │5092369/5117552 [100%] │   819.63 MB    │
├────────────────────┼───────────────────────┼────────────────┤
│     CPU Usage      │       CPU Speed       │  OS Platform   │
├────────────────────┼───────────────────────┼────────────────┤
│       0.61%        │         2100          │     linux      │
├────────────────────┼───────────────────────┼────────────────┤
│      OS Arch       │       OS Uptime       │OS Load Average │
├────────────────────┼───────────────────────┼────────────────┤
│        x64         │        14 days        │       0s       │
├────────────────────┼───────────────────────┼────────────────┤
│ Discord.js Version │     Klasa Version     │  Node Version  │
├────────────────────┼───────────────────────┼────────────────┤
│     12.0.0-dev     │       0.5.0-dev       │  Node v11.9.0  │
├────────────────────┼───────────────────────┼────────────────┘
│     Listeners      │       Provider        │
├────────────────────┼───────────────────────┤
│    31/Infinity     │       rethinkdb       │
└────────────────────┴───────────────────────┘

Instead of like this

┌────────────────────┬───────────────────────┬────────────────┐
│       Guilds       │       Channels        │  Aprox. Users  │
├────────────────────┼───────────────────────┼────────────────┤
│        137         │         4,838         │    295,012     │
├────────────────────┼───────────────────────┼────────────────┤
│   Messages sent    │   Messages received   │ Commands used  │
├────────────────────┼───────────────────────┼────────────────┤
│         25         │          190          │     9,756      │
├────────────────────┼───────────────────────┼────────────────┤
│Highlights triggered│       Mentions        │     Shard      │
├────────────────────┼───────────────────────┼────────────────┤
│      100,356       │           0           │  not sharded   │
├────────────────────┼───────────────────────┼────────────────┤
│       Uptime       │   Uptime Percentage   │  Memory Used   │
├────────────────────┼───────────────────────┼────────────────┤
│     3 minutes      │5092369/5117552 [100%] │   819.63 MB    │
├────────────────────┼───────────────────────┼────────────────┤
│     CPU Usage      │       CPU Speed       │  OS Platform   │
├────────────────────┼───────────────────────┼────────────────┤
│       0.61%        │         2100          │     linux      │
├────────────────────┼───────────────────────┼────────────────┤
│      OS Arch       │       OS Uptime       │OS Load Average │
├────────────────────┼───────────────────────┼────────────────┤
│        x64         │        14 days        │       0s       │
├────────────────────┼───────────────────────┼────────────────┤
│ Discord.js Version │     Klasa Version     │  Node Version  │
├────────────────────┼───────────────────────┼────────────────┤
│     12.0.0-dev     │       0.5.0-dev       │  Node v11.9.0  │
├────────────────────┼───────────────────────┼────────────────┤
│     Listeners      │       Provider        │                │
├────────────────────┼───────────────────────┤                │
│    31/Infinity     │       rethinkdb       │                │
└────────────────────┴───────────────────────┴────────────────┘

Version 0.6.1 dies with "JavaScript heap out of memory"

Hi there,

Thanks for your continuous effort to maintain this library! We got an automatic update to version 0.6.1 today, which we get as transitive dependency of the jscpd library.

From 0.6.1 on our build starts to fail with "JavaScript heap out of memory". The whole error message goes like this:

07:50:37  FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
07:50:37  1: 0xafedf0 node::Abort() [node]
07:50:37  2: 0xa1814d node::FatalError(char const*, char const*) [node]
07:50:37  3: 0xce792e v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node]
07:50:37  4: 0xce7ca7 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node]
07:50:37  5: 0xeb1685  [node]
07:50:37  6: 0xec081d v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node]
07:50:37  7: 0xec399c v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node]
07:50:37  8: 0xe85f25 v8::internal::Factory::AllocateRaw(int, v8::internal::AllocationType, v8::internal::AllocationAlignment) [node]
07:50:37  9: 0xe80e29 v8::internal::FactoryBase<v8::internal::Factory>::AllocateRawArray(int, v8::internal::AllocationType) [node]
07:50:37  10: 0xe80ee5 v8::internal::FactoryBase<v8::internal::Factory>::NewFixedArrayWithFiller(v8::internal::Handle<v8::internal::Map>, int, v8::internal::Handle<v8::internal::Oddball>, v8::internal::AllocationType) [node]
07:50:37  11: 0x103a755  [node]
07:50:37  12: 0x1099ad5  [node]
07:50:37  13: 0x109f9a5 v8::internal::FastKeyAccumulator::GetKeys(v8::internal::GetKeysConversion) [node]
07:50:37  14: 0x11f0116 v8::internal::Runtime_ForInEnumerate(int, unsigned long*, v8::internal::Isolate*) [node]
07:50:37  15: 0x15c9eb9  [node]
07:50:37  Aborted (core dumped)
07:50:37  [06:50:34] '<anonymous>' errored after 1.1 min
07:50:37  [06:50:34] Error: Command failed: npx jscpd --config jscpd.json src
07:50:37  
07:50:37  <--- Last few GCs --->
07:50:37  
07:50:37  [4037119:0x6805550]    63743 ms: Scavenge 4041.5 (4114.7) -> 4040.7 (4124.7) MB, 15.1 / 0.0 ms  (average mu = 0.618, current mu = 0.351) allocation failure 
07:50:37  [4037119:0x6805550]    63788 ms: Scavenge 4047.4 (4124.7) -> 4045.2 (4126.0) MB, 30.3 / 0.0 ms  (average mu = 0.618, current mu = 0.351) allocation failure 
07:50:37  [4037119:0x6805550]    65472 ms: Scavenge 4048.4 (4126.0) -> 4046.9 (4146.0) MB, 1674.8 / 0.0 ms  (average mu = 0.618, current mu = 0.351) allocation failure 
07:50:37  
07:50:37  
07:50:37  <--- JS stacktrace --->
07:50:37  
07:50:37  FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
07:50:37   1: 0xafedf0 node::Abort() [node]
07:50:37   2: 0xa1814d node::FatalError(char const*, char const*) [node]
07:50:37   3: 0xce792e v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node]
07:50:37   4: 0xce7ca7 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node]
07:50:37   5: 0xeb1685  [node]
07:50:37   6: 0xec081d v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node]
07:50:37   7: 0xec399c v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node]
07:50:37   8: 0xe85f25 v8::internal::Factory::AllocateRaw(int, v8::internal::AllocationType, v8::internal::AllocationAlignment) [node]
07:50:37   9: 0xe80e29 v8::internal::FactoryBase<v8::internal::Factory>::AllocateRawArray(int, v8::internal::AllocationType) [node]
07:50:37  10: 0xe80ee5 v8::internal::FactoryBase<v8::internal::Factory>::NewFixedArrayWithFiller(v8::internal::Handle<v8::internal::Map>, int, v8::internal::Handle<v8::internal::Oddball>, v8::internal::AllocationType) [node]
07:50:37  11: 0x103a755  [node]
07:50:37  12: 0x1099ad5  [node]
07:50:37  13: 0x109f9a5 v8::internal::FastKeyAccumulator::GetKeys(v8::internal::GetKeysConversion) [node]
07:50:37  14: 0x11f0116 v8::internal::Runtime_ForInEnumerate(int, unsigned long*, v8::internal::Isolate*) [node]
07:50:37  15: 0x15c9eb9  [node]
07:50:37  Aborted (core dumped)
07:50:37  
07:50:37      at ChildProcess.exithandler (node:child_process:397:12)
07:50:37      at ChildProcess.emit (node:events:394:28)
07:50:37      at ChildProcess.emit (node:domain:537:15)
07:50:37      at maybeClose (node:internal/child_process:1067:16)
07:50:37      at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
07:50:37      at Process.callbackTrampoline (node:internal/async_hooks:130:17)
07:50:37  [06:50:34] 'lint' errored after 1.1 min

Now when you downgrade again to 0.6.0, it starts to work again. The strange thing is also that the console output seems to be totally screwed. See for yourself here:

image

Maybe you find some time to have a look? Thank you so much :-)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.