Skip to content

Commit

Permalink
Merge branch 'master' into fix/229
Browse files Browse the repository at this point in the history
  • Loading branch information
scripthunter7 committed Oct 25, 2023
2 parents 191d735 + ba6dfd8 commit da12d41
Show file tree
Hide file tree
Showing 82 changed files with 7,084 additions and 1,461 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/build.yml
Expand Up @@ -5,8 +5,7 @@ on:
pull_request:

env:
PRIMARY_NODEJS_VERSION: 16
REPORTER: "min"
PRIMARY_NODEJS_VERSION: 18

jobs:
lint:
Expand All @@ -33,7 +32,7 @@ jobs:
node-version: ${{ env.PRIMARY_NODEJS_VERSION }}
cache: "npm"
- run: npm ci
- run: npm run bundle-and-test
- run: npm run bundle-and-test -- -- --reporter min

unit-tests:
name: Unit tests
Expand All @@ -47,6 +46,8 @@ jobs:
- 12.20.0
- 14.13.0
- 16
- 18
- 20

steps:
- uses: actions/checkout@v2
Expand All @@ -56,10 +57,9 @@ jobs:
node-version: ${{ matrix.node_version }}
cache: "npm"
- run: npm ci
- run: npm run test
- run: npm run test -- --reporter min
if: ${{ matrix.node_version != '10' }}
- run: npm run esm-to-cjs-and-test

- run: npm run esm-to-cjs-and-test -- -- --reporter min
- run: npm run coverage
if: ${{ matrix.node_version == env.PRIMARY_NODEJS_VERSION }}
- name: Coveralls parallel
Expand Down
60 changes: 60 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,63 @@
## next

- Added support for the [`@container`](https://drafts.csswg.org/css-contain-3/#container-rule) at-rule
- Added support for the [`@starting-style`](https://drafts.csswg.org/css-transitions-2/#defining-before-change-style) at-rule
- Added support for the [`@scope`](https://drafts.csswg.org/css-cascade-6/#scoped-styles) at-rule
- Added support for the [`@layer`](https://drafts.csswg.org/css-cascade-5/#at-layer) at-rule
- Added support for `layer`, `layer()` and `supports()` in the `@media` at-rule (according to [the @import rule](https://drafts.csswg.org/css-cascade-5/#at-import) in Cascading and Inheritance 5)
- Added `Layer` and `LayerList` node types
- Bumped `mdn/data` to `2.1.0`
- Added `<dashed-ident>` to generic types
- Added `TokenStream#lookupTypeNonSC()` method
- Fixed initialization when `Object.prototype` is extended or polluted (#262)
- Fixed `speak` syntax patch (#241)
- Fixed crash on parse error when custom `line` or `offset` is specified via options (#251)
- Changed `parseWithFallback()` to rollback `tokenIndex` before calling a fallback
- Changed `Block` to not include `{` and `}`
- Changed `Atrule` and `Rule` to include `{` and `}` for a block
- Changed `Ratio` parsing:
- Left and right parts contain nodes instead of strings
- Both left and right parts of a ratio can now be any number; validation of number range is no longer within the parser's scope.
- Both parts can now be functions. Although not explicitly mentioned in the specification, mathematical functions can replace numbers, addressing potential use cases (#162).
- As per the [CSS Values and Units Level 4](https://drafts.csswg.org/css-values-4/#ratios) specification, the right part of `Ratio` can be omitted. While this can't be a parser output (which would produce a `Number` node), it's feasible during `Ratio` node construction or transformation.
- Changes to query-related at-rules:
- Added new node types:
- [`Feature`](./docs/ast.md#feature): represents features like `(feature)` and `(feature: value)`, fundamental for both `@media` and `@container` at-rules
- [`FeatureRange`](./docs/ast.md#featurerange): represents [features in a range context](https://www.w3.org/TR/mediaqueries-4/#mq-range-context)
- [`FeatureFunction`](./docs/ast.md#featurefunction): represents functional features such as `@supports`'s `selector()` or `@container`'s `style()`
- [`Condition`](./docs/ast.md#condition): used across all query-like at-rules, encapsulating queries with features and the `not`, `and`, and `or` operators
- [`GeneralEnclosure`](./docs/ast.md#condition): represents the [`<general-enclosed>`](https://www.w3.org/TR/mediaqueries-4/#typedef-general-enclosed) production, which caters to unparsed parentheses or functional expressions
> Note: All new nodes include a `kind` property to define the at-rule type. Supported kinds are `media`, `supports`, and `container`.

- Added support for functions for features and features in a range context, e.g. `(width: calc(100cm / 6))`
- Added a `condition` value for the parser's context option to parse queries. Use the `kind` option to specify the condition type, e.g., `parse('...', { context: 'condition', kind: 'media' })`.
- Introduced a `features` section in the syntax configuration for defining functional features of at-rules. Expand definitions using the `fork()` method. The current definition is as follows:
```js
features: {
supports: { selector() { /* ... */ } },
container: { style() { /* ... */ } }
}
```
- Changes for `@media` at-rule:
- Enhanced prelude parsing for complex queries. Parentheses with errors will be parsed as `GeneralEnclosed`.
- Added support for features in a range context, e.g. `(width > 100px)` or `(100px < height < 400px)`
- Transitioned from `MediaFeature` node type to the `Feature` node type with `kind: "media"`.
- Changed `MediaQuery` node structure into the following form:
```ts
type MediaQuery = {
type: "MediaQuery";
modifier: string | null; // e.g. "not", "only", etc.
mediaType: string | null; // e.g. "all", "screen", etc.
condition: Condition | null;
}
```
- Changes for `@supports` at-rule:
- Enhanced prelude parsing for complex queries. Parentheses with errors will be parsed as `GeneralEnclosed`.
- Added support for features in a range context, e.g. `(width > 100px)` or `(100px < height < 400px)`
- Added `SupportsDeclaration` node type to encapsulate a declaration in a query, replacing `Parentheses`.
- Parsing now employs `Condition` or `SupportsDeclaration` nodes of kind `supports` instead of `Parentheses`.
- Added support for the [`selector()`](https://drafts.csswg.org/css-conditional-4/#at-supports-ext) feature via the `FeatureFunction` node (configured in `features.supports.selector`).
## 2.3.1 (December 14, 2022)
- Added `:host`, `:host()` and `:host-context()` pseudo class support (#216)
Expand Down

0 comments on commit da12d41

Please sign in to comment.