Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[regression][8.2.1+] JSON.stringify of parsed nodes array fails with "inputs.get is not a function" #1502

Closed
AviVahl opened this issue Jan 6, 2021 · 4 comments · Fixed by #1504

Comments

@AviVahl
Copy link

AviVahl commented Jan 6, 2021

const postcss = require('postcss');

const root = postcss.parse(`
.cls {
  color: orange;
}`);

JSON.stringify(root.nodes[0].nodes);

works with v8.2.0. started throwing since v8.2.1 (v8.2.2 also throws).

when the above is executed, Declaration.toJSON throws:

TypeError: inputs.get is not a function
    at Declaration.toJSON (/home/avi/projects/postcss-crash/node_modules/postcss/lib/node.js:194:30)
    at JSON.stringify (<anonymous>)
    at Object.<anonymous> (/home/avi/projects/postcss-crash/t.js:8:18)
@AviVahl
Copy link
Author

AviVahl commented Jan 6, 2021

Possibly regressed by #1488

@ai
Copy link
Member

ai commented Jan 7, 2021

/cc @mischnic

@ai
Copy link
Member

ai commented Jan 7, 2021

This fix was released in 8.2.3.

@AviVahl
Copy link
Author

AviVahl commented Jan 7, 2021

Iissue is fixed on my end. Thanks. 👍
I did have to adjust our es5 transpilation (we're using postcss in the browser) to account for spreading of iterables:
fixed.inputs = [...inputs.keys()].map(input => input.toJSON())

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants