postcss / postcss-selector-parser

A CSS selector parser, integrates with postcss but does not require it.
MIT License
205 stars 48 forks source link

update dependencies #268

Closed romainmenke closed 1 year ago

romainmenke commented 1 year ago
alexander-akait commented 1 year ago

Also I think we can avoid using util-deprecate, it is just small ternary, less deps = less size

romainmenke commented 1 year ago

I was able to create a minimal repro of what was changed in nodejs for util.deprecate.

import util from 'util';

process.throwDeprecation = true;

const obsoleteFunction = util.deprecate(() => {
    // Do something here.
}, 'obsoleteFunction() is deprecated. Use newShinyFunction() instead.');

try {
    obsoleteFunction();
} catch (err) {
    // node12
    console.log('caught');
}

In node12 the try / catch just works. In later versions it doesn't.

I was able to work around this by not throwing on deprecations and listening via another method :

function waitForWarning() {
    return new Promise((resolve) => {
        process.once('warning', (err) => {
            resolve(err);
        });
    });
}
romainmenke commented 1 year ago

Also I think we can avoid using util-deprecate, it is just small ternary, less deps = less size

Is it possible this was added for when the package is used in browsers? Removing it might be a breaking change.

alexander-akait commented 1 year ago

Is it possible this was added for when the package is used in browsers? Removing it might be a breaking change.

I mean we can copy/paste this code, because it is very simple package

romainmenke commented 1 year ago

Is it possible this was added for when the package is used in browsers? Removing it might be a breaking change.

I mean we can copy/paste this code, because it is very simple package

Maybe best to do this in a follow up PR? I would have to figure out how to conditionally do require('util') only in nodejs environments and no idea how to do that (yet).

alexander-akait commented 1 year ago

Maybe best to do this in a follow up PR?

:+1:

alexander-akait commented 1 year ago

Thank you