Skip to content

Conversation

@renovate
Copy link
Contributor

@renovate renovate bot commented Oct 29, 2024

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
postcss-selector-parser 2.2.37.1.1 age adoption passing confidence

Release Notes

postcss/postcss-selector-parser (postcss-selector-parser)

v7.1.1

Compare Source

  • perf: replace startsWith with strict equality (#​308)
  • fix(types): add walkUniversal declaration (#​311)

v7.1.0

Compare Source

  • feat: insert(Before|After) support multiple new node

v7.0.0

Compare Source

  • Feat: make insertions during iteration safe (major)

v6.1.2

Compare Source

  • Fixed: erroneous trailing combinators in pseudos

v6.1.1

Compare Source

  • Fixed: improve typings of constructor helpers (#​292)

v6.1.0

Compare Source

  • Feature: add sourceIndex to Selector nodes (#​290)

v6.0.16

Compare Source

  • Fixed: add missing index argument to each/walk callback types (#​289)

v6.0.15

Compare Source

  • Fixed: Node#prev and Node#next type for the first/last node

v6.0.14

Compare Source

  • Fixed: type definitions

v6.0.13

Compare Source

  • Fixed: throw on unexpected pipe symbols

v6.0.12

Compare Source

  • Fixed: clone arguments should be optional

v6.0.11

Compare Source

  • Fixed: parse attribute case insensitivity flag

v6.0.10

Compare Source

  • Fixed: isPseudoElement() supports :first-letter and :first-line

v6.0.9

Compare Source

  • Fixed: Combinator.raws property type

v6.0.8

Compare Source

  • Fixed: reduced size

v6.0.7

Compare Source

  • Fixed: parse animation percents

v6.0.6

Compare Source

  • Fixed: parse quoted attributes containing a newline correctly

v6.0.5

Compare Source

  • Perf: rework unesc for a 63+% performance boost

v6.0.4

Compare Source

  • Fixed: ts errors

v6.0.3

Compare Source

  • Fixed: replace node built-in "util" module with "util-deprecate"
  • Fixed: handle uppercase pseudo elements
  • Fixed: do not create invalid combinator before comment

v6.0.2

Compare Source

  • Fixed an issue with parsing and stringifying an empty attribute value

v6.0.1

Compare Source

  • Fixed: add missing index argument to each/walk callback types (#​289)

v6.0.0

Compare Source

  • Updated: cssesc to 3.0.0 (major)
  • Fixed: Issues with escaped id and class selectors

v5.0.0

Compare Source

  • Allow escaped dot within class name.
  • Update PostCSS to 7.0.7 (patch)

v4.0.0

Compare Source

This release has BREAKING CHANGES that were required to fix bugs regarding values with escape sequences. Please read carefully.

  • Identifiers with escapes - CSS escape sequences are now hidden from the public API by default.
    The normal value of a node like a class name or ID, or an aspect of a node such as attribute
    selector's value, is unescaped. Escapes representing Non-ascii characters are unescaped into
    unicode characters. For example: bu\tton, .\31 00, #i\2764\FE0Fu, [attr="value is \"quoted\""]
    will parse respectively to the values button, 100, i❤️u, value is "quoted".
    The original escape sequences for these values can be found in the corresponding property name
    in node.raws. Where possible, deprecation warnings were added, but the nature
    of escape handling makes it impossible to detect what is escaped or not. Our expectation is
    that most users are neither expecting nor handling escape sequences in their use of this library,
    and so for them, this is a bug fix. Users who are taking care to handle escapes correctly can
    now update their code to remove the escape handling and let us do it for them.

  • Mutating values with escapes - When you make an update to a node property that has escape handling
    The value is assumed to be unescaped, and any special characters are escaped automatically and
    the corresponding raws value is immediately updated. This can result in changes to the original
    escape format. Where the exact value of the escape sequence is important there are methods that
    allow both values to be set in conjunction. There are a number of new convenience methods for
    manipulating values that involve escapes, especially for attributes values where the quote mark
    is involved. See #​133 for an extensive
    write-up on these changes.

Upgrade/API Example

In 3.x there was no unescape handling and internal consistency of several properties was the caller's job to maintain. It was very easy for the developer
to create a CSS file that did not parse correctly when some types of values
were in use.

const selectorParser = require("postcss-selector-parser");
let attr = selectorParser.attribute({attribute: "id", operator: "=", value: "a-value"});
attr.value; // => "a-value"
attr.toString(); // => [id=a-value]
// Add quotes to an attribute's value.
// All these values have to be set by the caller to be consistent:
// no internal consistency is maintained.
attr.raws.unquoted = attr.value
attr.value = "'" + attr.value + "'";
attr.value; // => "'a-value'"
attr.quoted = true;
attr.toString();  // => "[id='a-value']"

In 4.0 there is a convenient API for setting and mutating values
that may need escaping. Especially for attributes.

const selectorParser = require("postcss-selector-parser");

// The constructor requires you specify the exact escape sequence
let className = selectorParser.className({value: "illegal class name", raws: {value: "illegal\\ class\\ name"}});
className.toString(); // => '.illegal\\ class\\ name'

// So it's better to set the value as a property
className = selectorParser.className();
// Most properties that deal with identifiers work like this
className.value = "escape for me";
className.value; // => 'escape for me'
className.toString(); // => '.escape\\ for\\ me'

// emoji and all non-ascii are escaped to ensure it works in every css file.
className.value = "😱🦄😍";
className.value; // => '😱🦄😍'
className.toString(); // => '.\\1F631\\1F984\\1F60D'

// you can control the escape sequence if you want, or do bad bad things
className.setPropertyAndEscape('value', 'xxxx', 'yyyy');
className.value; // => "xxxx"
className.toString(); // => ".yyyy"

// Pass a value directly through to the css output without escaping it. 
className.setPropertyWithoutEscape('value', '$REPLACE_ME$');
className.value; // => "$REPLACE_ME$"
className.toString(); // => ".$REPLACE_ME$"

// The biggest changes are to the Attribute class
// passing quoteMark explicitly is required to avoid a deprecation warning.
let attr = selectorParser.attribute({attribute: "id", operator: "=", value: "a-value", quoteMark: null});
attr.toString(); // => "[id=a-value]"
// Get the value with quotes on it and any necessary escapes.
// This is the same as reading attr.value in 3.x.
attr.getQuotedValue(); // => "a-value";
attr.quoteMark; // => null

// Add quotes to an attribute's value.
attr.quoteMark = "'"; // This is all that's required.
attr.toString(); // => "[id='a-value']"
attr.quoted; // => true
// The value is still the same, only the quotes have changed.
attr.value; // => a-value
attr.getQuotedValue(); // => "'a-value'";

// deprecated assignment, no warning because there's no escapes
attr.value = "new-value";
// no quote mark is needed so it is removed
attr.getQuotedValue(); // => "new-value";

// deprecated assignment, 
attr.value = "\"a 'single quoted' value\"";
// > (node:27859) DeprecationWarning: Assigning an attribute a value containing characters that might need to be escaped is deprecated. Call attribute.setValue() instead.
attr.getQuotedValue(); // => '"a \'single quoted\' value"';
// quote mark inferred from first and last characters.
attr.quoteMark; // => '"'

// setValue takes options to make manipulating the value simple.
attr.setValue('foo', {smart: true});
// foo doesn't require any escapes or quotes.
attr.toString(); // => '[id=foo]'
attr.quoteMark; // => null 

// An explicit quote mark can be specified
attr.setValue('foo', {quoteMark: '"'});
attr.toString(); // => '[id="foo"]'

// preserves quote mark by default
attr.setValue('bar');
attr.toString(); // => '[id="bar"]'
attr.quoteMark = null;
attr.toString(); // => '[id=bar]'

// with no arguments, it preserves quote mark even when it's not a great idea
attr.setValue('a value \n that should be quoted');
attr.toString(); // => '[id=a\\ value\\ \\A\\ that\\ should\\ be\\ quoted]'

// smart preservation with a specified default
attr.setValue('a value \n that should be quoted', {smart: true, preferCurrentQuoteMark: true, quoteMark: "'"});
// => "[id='a value \\A  that should be quoted']"
attr.quoteMark = '"';
// => '[id="a value \\A  that should be quoted"]'

// this keeps double quotes because it wants to quote the value and the existing value has double quotes.
attr.setValue('this should be quoted', {smart: true, preferCurrentQuoteMark: true, quoteMark: "'"});
// => '[id="this should be quoted"]'

// picks single quotes because the value has double quotes
attr.setValue('a "double quoted" value', {smart: true, preferCurrentQuoteMark: true, quoteMark: "'"});
// => "[id='a "double quoted" value']"

// setPropertyAndEscape lets you do anything you want. Even things that are a bad idea and illegal.
attr.setPropertyAndEscape('value', 'xxxx', 'the password is 42');
attr.value; // => "xxxx"
attr.toString(); // => "[id=the password is 42]"

// Pass a value directly through to the css output without escaping it. 
attr.setPropertyWithoutEscape('value', '$REPLACEMENT$');
attr.value; // => "$REPLACEMENT$"
attr.toString(); // => "[id=$REPLACEMENT$]"

v3.1.2

Compare Source

  • Fix: Removed dot-prop dependency since it's no longer written in es5.

v3.1.1

Compare Source

  • Fix: typescript definitions weren't in the published package.

v3.1.0

Compare Source

  • Fixed numerous bugs in attribute nodes relating to the handling of comments
    and whitespace. There's significant changes to attrNode.spaces and attrNode.raws since the 3.0.0 release.
  • Added Attribute#offsetOf(part) to get the offset location of
    attribute parts like "operator" and "value". This is most
    often added to Attribute#sourceIndex for error reporting.

v3.0.0

Compare Source

Breaking changes

  • Some tweaks to the tokenizer/attribute selector parsing mean that whitespace
    locations might be slightly different to the 2.x code.
  • Better attribute selector parsing with more validation; postcss-selector-parser
    no longer uses regular expressions to parse attribute selectors.
  • Added an async API (thanks to @​jacobp100); the default process API is now
    async, and the sync API is now accessed through processSync instead.
  • process() and processSync() now return a string instead of the Processor
    instance.
  • Tweaks handling of Less interpolation (thanks to @​jwilsson).
  • Removes support for Node 0.12.

Other changes

  • ast() and astSync() methods have been added to the Processor. These
    return the Root node of the selectors after processing them.
  • transform() and transformSync() methods have been added to the
    Processor. These return the value returned by the processor callback
    after processing the selectors.
  • Set the parent when inserting a node (thanks to @​chriseppstein).
  • Correctly adjust indices when using insertBefore/insertAfter (thanks to @​tivac).
  • Fixes handling of namespaces with qualified tag selectors.
  • process, ast and transform (and their sync variants) now accept a
    postcss rule node. When provided, better errors are generated and selector
    processing is automatically set back to the rule selector (unless the updateSelector option is set to false.)
  • Now more memory efficient when tokenizing selectors.
Upgrade hints

The pattern of:

rule.selector = processor.process(rule.selector).result.toString();

is now:

processor.processSync(rule)


Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate renovate bot added the dependency Dependency Upgrade label Oct 29, 2024
@github-actions
Copy link
Contributor

github-actions bot commented Oct 29, 2024

Size Change: +41.9 kB (+0.31%)

Total Size: 13.5 MB

Filename Size Change
./dist/prettier/plugins/postcss.js 174 kB +19.4 kB (+12.57%) ⚠️
./dist/prettier/plugins/postcss.mjs 174 kB +19.4 kB (+12.6%) ⚠️
./dist/prettier/THIRD-PARTY-NOTICES.md 347 kB +3.03 kB (+0.88%)
ℹ️ View Unchanged
Filename Size
./dist/plugin-hermes 4.1 kB
./dist/plugin-hermes/index.d.ts 89 B
./dist/plugin-hermes/index.mjs 1.26 MB
./dist/plugin-hermes/LICENSE 1.06 kB
./dist/plugin-hermes/package.json 900 B
./dist/plugin-hermes/README.md 1.26 kB
./dist/plugin-hermes/THIRD-PARTY-NOTICES.md 19.8 kB
./dist/plugin-oxc 4.1 kB
./dist/plugin-oxc/index.browser.mjs 2.73 MB
./dist/plugin-oxc/index.d.ts 106 B
./dist/plugin-oxc/index.mjs 456 kB
./dist/plugin-oxc/LICENSE 1.06 kB
./dist/plugin-oxc/package.json 1.01 kB
./dist/plugin-oxc/README.md 1.34 kB
./dist/plugin-oxc/THIRD-PARTY-NOTICES.md 15.4 kB
./dist/prettier 4.1 kB
./dist/prettier/bin 4.1 kB
./dist/prettier/bin/prettier.cjs 2.57 kB
./dist/prettier/doc.d.ts 7.42 kB
./dist/prettier/doc.js 61.6 kB
./dist/prettier/doc.mjs 57.5 kB
./dist/prettier/index.cjs 40.5 kB
./dist/prettier/index.d.ts 27.6 kB
./dist/prettier/index.mjs 623 kB
./dist/prettier/internal 4.1 kB
./dist/prettier/internal/experimental-cli-worker.mjs 91.4 kB
./dist/prettier/internal/experimental-cli.mjs 444 kB
./dist/prettier/internal/legacy-cli.mjs 186 kB
./dist/prettier/LICENSE 1.06 kB
./dist/prettier/package.json 6.54 kB
./dist/prettier/plugins 4.1 kB
./dist/prettier/plugins/acorn.d.ts 109 B
./dist/prettier/plugins/acorn.js 154 kB
./dist/prettier/plugins/acorn.mjs 154 kB
./dist/prettier/plugins/angular.d.ts 177 B
./dist/prettier/plugins/angular.js 95.4 kB
./dist/prettier/plugins/angular.mjs 94.7 kB
./dist/prettier/plugins/babel.d.ts 419 B
./dist/prettier/plugins/babel.js 321 kB
./dist/prettier/plugins/babel.mjs 321 kB
./dist/prettier/plugins/estree.d.ts 11 B
./dist/prettier/plugins/estree.js 210 kB
./dist/prettier/plugins/estree.mjs 209 kB
./dist/prettier/plugins/flow.d.ts 90 B
./dist/prettier/plugins/flow.js 699 kB
./dist/prettier/plugins/flow.mjs 698 kB
./dist/prettier/plugins/glimmer.d.ts 93 B
./dist/prettier/plugins/glimmer.js 140 kB
./dist/prettier/plugins/glimmer.mjs 139 kB
./dist/prettier/plugins/graphql.d.ts 93 B
./dist/prettier/plugins/graphql.js 45.7 kB
./dist/prettier/plugins/graphql.mjs 45 kB
./dist/prettier/plugins/html.d.ts 155 B
./dist/prettier/plugins/html.js 169 kB
./dist/prettier/plugins/html.mjs 169 kB
./dist/prettier/plugins/markdown.d.ts 127 B
./dist/prettier/plugins/markdown.js 295 kB
./dist/prettier/plugins/markdown.mjs 294 kB
./dist/prettier/plugins/meriyah.d.ts 93 B
./dist/prettier/plugins/meriyah.js 125 kB
./dist/prettier/plugins/meriyah.mjs 124 kB
./dist/prettier/plugins/postcss.d.ts 121 B
./dist/prettier/plugins/typescript.d.ts 96 B
./dist/prettier/plugins/typescript.js 896 kB
./dist/prettier/plugins/typescript.mjs 895 kB
./dist/prettier/plugins/yaml.d.ts 90 B
./dist/prettier/plugins/yaml.js 123 kB
./dist/prettier/plugins/yaml.mjs 122 kB
./dist/prettier/README.md 3.4 kB
./dist/prettier/standalone.d.ts 1.36 kB
./dist/prettier/standalone.js 95.8 kB
./dist/prettier/standalone.mjs 95.6 kB

compressed-size-action

@renovate renovate bot force-pushed the renovate/postcss-selector-parser-7.x branch from bef174e to 08d1bee Compare January 11, 2025 16:39
@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 11, 2025

Open in StackBlitz

yarn add https://pkg.pr.new/@prettier/[email protected]
yarn add https://pkg.pr.new/@prettier/[email protected]
yarn add https://pkg.pr.new/[email protected]

commit: 528bb6c

@renovate renovate bot force-pushed the renovate/postcss-selector-parser-7.x branch from 08d1bee to 8cc8466 Compare February 7, 2025 16:36
@fisker fisker self-assigned this Feb 20, 2025
@renovate renovate bot force-pushed the renovate/postcss-selector-parser-7.x branch from 8cc8466 to b6efb66 Compare February 20, 2025 16:01
@fisker fisker force-pushed the renovate/postcss-selector-parser-7.x branch from b6efb66 to 7cf2a5c Compare July 14, 2025 14:43
@netlify
Copy link

netlify bot commented Jul 14, 2025

Deploy Preview for prettier ready!

Name Link
🔨 Latest commit 528bb6c
🔍 Latest deploy log https://app.netlify.com/projects/prettier/deploys/695fe502df218c00085485be
😎 Deploy Preview https://deploy-preview-16806--prettier.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@renovate renovate bot force-pushed the renovate/postcss-selector-parser-7.x branch from 7cf2a5c to 11b580f Compare July 14, 2025 14:45
@renovate renovate bot force-pushed the renovate/postcss-selector-parser-7.x branch 2 times, most recently from bc013ca to 69062e0 Compare August 13, 2025 12:28
@renovate renovate bot force-pushed the renovate/postcss-selector-parser-7.x branch from 69062e0 to 4c54ed2 Compare August 19, 2025 14:29
@renovate renovate bot force-pushed the renovate/postcss-selector-parser-7.x branch from 4c54ed2 to 4d8dd75 Compare August 31, 2025 10:00
@renovate renovate bot changed the title chore(deps): update dependency postcss-selector-parser to v7 Update dependency postcss-selector-parser to v7 Sep 24, 2025
@renovate renovate bot force-pushed the renovate/postcss-selector-parser-7.x branch from 4d8dd75 to 61a500f Compare September 25, 2025 13:58
@renovate renovate bot changed the title Update dependency postcss-selector-parser to v7 chore(deps): update dependency postcss-selector-parser to v7 Oct 12, 2025
@renovate renovate bot force-pushed the renovate/postcss-selector-parser-7.x branch from 61a500f to e210fad Compare October 21, 2025 09:42
@renovate renovate bot force-pushed the renovate/postcss-selector-parser-7.x branch from e210fad to 40e3959 Compare November 10, 2025 19:36
@renovate renovate bot changed the title chore(deps): update dependency postcss-selector-parser to v7 Update dependency postcss-selector-parser to v7 Nov 17, 2025
@renovate renovate bot force-pushed the renovate/postcss-selector-parser-7.x branch from 40e3959 to 890a4f1 Compare November 18, 2025 09:54
@renovate renovate bot changed the title Update dependency postcss-selector-parser to v7 chore(deps): update dependency postcss-selector-parser to v7 Nov 18, 2025
@renovate renovate bot force-pushed the renovate/postcss-selector-parser-7.x branch from 890a4f1 to e01702c Compare November 27, 2025 14:55
@renovate renovate bot changed the title chore(deps): update dependency postcss-selector-parser to v7 Update dependency postcss-selector-parser to v7 Dec 1, 2025
@renovate renovate bot force-pushed the renovate/postcss-selector-parser-7.x branch from e01702c to f595f30 Compare December 3, 2025 17:15
@renovate renovate bot force-pushed the renovate/postcss-selector-parser-7.x branch from f595f30 to 9a4e097 Compare December 31, 2025 16:50
@renovate renovate bot force-pushed the renovate/postcss-selector-parser-7.x branch from 9a4e097 to 528bb6c Compare January 8, 2026 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependency Dependency Upgrade

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants