Postcss: v8 regression: at-rule parser throws on broken syntax

Created on 16 Sep 2020  路  3Comments  路  Source: postcss/postcss

At Stylable, we use postcss together with postcss-safe-parser.
When upgrading to v8, the following at-rule:
@custom-selector :--pongo div span Comp:

Started throwing the following:

TypeError: Cannot read property 'line' of null
    at SafeParser.atrule (/home/avi/projects/stylable/node_modules/postcss/lib/parser.js:362:21)
    at SafeParser.parse (/home/avi/projects/stylable/node_modules/postcss/lib/parser.js:51:16)
    at Object.safeParse [as default] (/home/avi/projects/stylable/node_modules/postcss-safe-parser/lib/safe-parse.js:9:10)
    at Object.safeParse (/home/avi/projects/stylable/packages/core/src/parser.ts:14:22)

I realize the syntax is broken... we're using postcss-safe-parser so we can provide completions.

Exception can be reproduced in the Node REPL as well using just postcss:

[avi@localhost stylable]$ node
Welcome to Node.js v14.11.0.
Type ".help" for more information.
> require('postcss-safe-parser')('@custom-selector :--pongo div span Comp:')
Uncaught TypeError: Cannot read property 'line' of null
    at SafeParser.atrule (/home/avi/projects/stylable/node_modules/postcss/lib/parser.js:362:21)
    at SafeParser.parse (/home/avi/projects/stylable/node_modules/postcss/lib/parser.js:51:16)
    at safeParse (/home/avi/projects/stylable/node_modules/postcss-safe-parser/lib/safe-parse.js:9:10)
> 

Most helpful comment

Yeap. postcss-safe-parser should process anything.

I will fix it tomorrow.

All 3 comments

Yeap. postcss-safe-parser should process anything.

I will fix it tomorrow.

The fix was released in 8.0.4

Was this page helpful?
0 / 5 - 0 ratings

Related issues

azat-io picture azat-io  路  3Comments

AdeSupriyadi picture AdeSupriyadi  路  3Comments

jedmao picture jedmao  路  9Comments

StephenEsser picture StephenEsser  路  9Comments

sydneyitguy picture sydneyitguy  路  5Comments