Giter VIP home page Giter VIP logo

Comments (12)

shellscape avatar shellscape commented on August 18, 2024 1

The last time I saw these types of errors, it was on v2. I'm really at a loss as to what could be causing errors on your end that don't appear on mine. I suggested the screen share so I could show that I wasn't making it up haha.

So I've managed to reproduce this, kind of. Something about parsing the font values on line 3 first, causes the 1/-1 value to fail. If I put any other parse in front of that, it works fine. So it's something about that value that's throwing things out of whack. I'll have to look into it further to see whats up. This is going to be a tough one to track down.

from postcss-values-parser.

shellscape avatar shellscape commented on August 18, 2024 1

Here's the culprit:

const operRegex = new RegExp(`([/|*}])`, 'g');

That little 'g'

from postcss-values-parser.

shellscape avatar shellscape commented on August 18, 2024 1

Fixed in b6bcc5a. Thanks for working through this one with me.

from postcss-values-parser.

bartveneman avatar bartveneman commented on August 18, 2024

If you're looking for more exotic font stuff, this is what I use to test projectwallace/css-analyzer: https://github.com/projectwallace/css-analyzer/blob/7dc6a0d7e093f408d5fd2e7db7da405fd5b2043d/test/analyzer/values/input.css#L145-L172

from postcss-values-parser.

shellscape avatar shellscape commented on August 18, 2024

Thanks for the issue. This is a weird one as it's not throwing an error for me - when I run that reproduction, I get a root node with the following in root.nodes:

[ Word {
    raws: { before: '', after: '' },
    value: 'normal',
    type: 'word',
    isColor: false,
    isHex: false,
    isVariable: false,
    parent:
     Root {
       raws: [Object],
       type: 'root',
       nodes: [Circular],
       source: [Object] },
    source: { start: [Object], input: [Input], end: [Object] } },
  Word {
    raws: { before: ' ', after: '' },
    value: 'normal',
    type: 'word',
    isColor: false,
    isHex: false,
    isVariable: false,
    parent:
     Root {
       raws: [Object],
       type: 'root',
       nodes: [Circular],
       source: [Object] },
    source: { start: [Object], input: [Input], end: [Object] } },
  Numeric {
    raws: { before: ' ', after: '' },
    value: '1',
    type: 'numeric',
    unit: 'em',
    parent:
     Root {
       raws: [Object],
       type: 'root',
       nodes: [Circular],
       source: [Object] },
    source: { start: [Object], input: [Input], end: [Object] } },
  Operator {
    raws: { before: '', after: '' },
    value: '/',
    type: 'operator',
    parent:
     Root {
       raws: [Object],
       type: 'root',
       nodes: [Circular],
       source: [Object] },
    source: { start: [Object], input: [Input], end: [Object] } },
  Numeric {
    raws: { before: '', after: '' },
    value: '1',
    type: 'numeric',
    unit: '',
    parent:
     Root {
       raws: [Object],
       type: 'root',
       nodes: [Circular],
       source: [Object] },
    source: { start: [Object], input: [Input], end: [Object] } },
  Quoted {
    raws: { before: ' ', after: '' },
    value: '\'Source Sans Pro\'',
    type: 'quoted',
    quote: '\'',
    parent:
     Root {
       raws: [Object],
       type: 'root',
       nodes: [Circular],
       source: [Object] },
    source: { start: [Object], input: [Input], end: [Object] } },
  Punctuation {
    raws: { before: '', after: '' },
    value: ',',
    type: 'punctuation',
    parent:
     Root {
       raws: [Object],
       type: 'root',
       nodes: [Circular],
       source: [Object] },
    source: { start: [Object], input: [Input], end: [Object] } },
  Word {
    raws: { before: ' ', after: '' },
    value: 'serif',
    type: 'word',
    isColor: false,
    isHex: false,
    isVariable: false,
    parent:
     Root {
       raws: [Object],
       type: 'root',
       nodes: [Circular],
       source: [Object] },
    source: { start: [Object], input: [Input], end: [Object] } } ]

Any chance you have a sticky 2.x version lingering about?

from postcss-values-parser.

bartveneman avatar bartveneman commented on August 18, 2024

Ah, found a better way to reproduce:

parse(`normal normal 1em/1 'Source Sans Pro', serif`).walk(node => {
	console.log(node)
})

// throw this.input.error('Unknown word', tokens[0][2], tokens[0][3]);

Perhaps I shouldn't be using the .walk method anymore?

from postcss-values-parser.

bartveneman avatar bartveneman commented on August 18, 2024

I also found that it throws errors on the following values:

grid-columns: 1/-1
font: 1em/ 1 serif

It does not throw when I add spacing around the /, so I'm starting to suspect that spacing around / could be at play here.

from postcss-values-parser.

shellscape avatar shellscape commented on August 18, 2024

OK something is going on in your environment. I've tried every example/repro you've posted here and every single one of them is working for me in a fresh environment. Would it help if I put up a small repo with them all to show them working?

I still suspect you have an old version of postcss-values-parser being loaded.

from postcss-values-parser.

bartveneman avatar bartveneman commented on August 18, 2024

I cooked up a tiny repo for testing purposes: https://github.com/bartveneman/postcss-values-parser-v3.0.0-beta.2-testcase

from postcss-values-parser.

shellscape avatar shellscape commented on August 18, 2024

Thanks for doing that. I went through all of the test cases in index.js and all of them worked for me. The only difference between my setup and yours is I'm on Node 10.13.0. Could you have an old version of postcss-values-parser installed globally that is somehow taking precedence?

If you'd like to, we could setup a Google Hangout and do a screen share to try and figure this out.

from postcss-values-parser.

bartveneman avatar bartveneman commented on August 18, 2024

I checked, but there is no global/other version for postcss-values-parser than the one in my package.json and package-lock.json. Is this error specific for v2?

from postcss-values-parser.

bartveneman avatar bartveneman commented on August 18, 2024

Amazing, glad you were able to find it. Up to v3.0.0! 😁

from postcss-values-parser.

Related Issues (20)

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.