Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge origin/main into feature.color-4 #2339

Merged
merged 38 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
54eef34
Fix a race condition where isolates could be spawned after kill (#2306)
ntkme Aug 12, 2024
4a739d1
Force SourceSpan.url to be absolute in the JS API (#2298)
nex3 Aug 12, 2024
aaadd3f
Fix mistakes in dartdoc (#2309)
stof Aug 16, 2024
386445b
Fix duplicated isolates for the same compilation id (#2308)
ntkme Aug 16, 2024
9d45fad
Remove some dead, incorrect code (#2310)
nex3 Aug 16, 2024
72ef6a2
Fix empty `@at-root` in the indented syntax (#2311)
nex3 Aug 19, 2024
280f95c
Deprecate the `feature-exists` function (#2235)
stof Aug 20, 2024
9379d85
Bump bufbuild/buf-setup-action in /.github/util/initialize (#2313)
dependabot[bot] Aug 21, 2024
a236460
Fix flaky shutdown (#2312)
ntkme Aug 21, 2024
f0a0182
docs: Fix link to custom importer (#2315)
eliot-akira Aug 21, 2024
c3cccef
Bump dartdoc from 8.0.7 to 8.0.8 (#2300)
dependabot[bot] Aug 21, 2024
eb6c19e
Initial implementation of a PostCSS-compatible parser JS API (#2304)
nex3 Aug 22, 2024
2bf3ae0
Fix a comment (#2316)
ntkme Aug 22, 2024
798cd7c
Update pubspec.yaml (#2321)
ntkme Aug 26, 2024
9f82850
Ignore new `unreachable_switch_default` warning. (#2318)
stereotype441 Aug 26, 2024
a7f623d
Bump bufbuild/buf-setup-action in /.github/util/initialize (#2319)
dependabot[bot] Aug 30, 2024
56a4237
Delete unreachable `default` clause. (#2323)
stereotype441 Aug 30, 2024
b1d5f98
Backport deprecation API to legacy JS API (#2293)
jathak Sep 3, 2024
90a70ef
Fix failing double check test for sass-parser (#2330)
jathak Sep 3, 2024
88568af
Bump bufbuild/buf-setup-action in /.github/util/initialize (#2328)
dependabot[bot] Sep 4, 2024
3111100
Fix the sass-parser types to work with the latest PostCSS (#2331)
nex3 Sep 4, 2024
a42925c
Try to fix `sass-parser` release (#2332)
nex3 Sep 4, 2024
e1a8060
Add support for `@at-root` rules
nex3 Aug 13, 2024
6123b22
Add support for `@debug` rules
nex3 Aug 14, 2024
0df0a86
Add support for `@each` rules
nex3 Aug 17, 2024
3544cef
Add support for `@error` rules
nex3 Aug 17, 2024
b60577e
Add support for `@extend` rules
nex3 Aug 17, 2024
21819c3
Add support for `@for` rules
nex3 Aug 20, 2024
7784231
Add support for loud comments
nex3 Aug 22, 2024
5dff2e8
Merge pull request #2317 from sass/more-statements
nex3 Sep 5, 2024
717867b
Add a future global-builtin deprecation (#2336)
jathak Sep 5, 2024
cf918bc
Add support for `@media`
nex3 Aug 23, 2024
d9e854a
Add support for silent comments
nex3 Aug 23, 2024
6848763
Merge pull request #2337 from sass/even-more-statements
nex3 Sep 7, 2024
05e1691
Bump bufbuild/buf-setup-action in /.github/util/initialize (#2338)
dependabot[bot] Sep 10, 2024
519ce69
Merge branch 'main' of github.com:sass/dart-sass into feature.color-4
nex3 Sep 11, 2024
4fa5a02
Use a `file:` dependency for sass-parser -> sass (#2340)
nex3 Sep 11, 2024
8f8467a
Merge branch 'main' of github.com:sass/dart-sass into merge-main
nex3 Sep 11, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,12 @@ updates:
- "/.github/util/*/"
schedule:
interval: "weekly"
- package-ecosystem: "npm"
directories:
- "/"
- "/package"
- "/pkg/sass-parser"
ignore:
dependency-name: "sass"
schedule:
interval: "weekly"
2 changes: 1 addition & 1 deletion .github/util/initialize/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ runs:
- run: npm install
shell: ${{ runner.os == 'Windows' && 'powershell' || 'bash' }}

- uses: bufbuild/buf-setup-action@v1.35.1
- uses: bufbuild/buf-setup-action@v1.40.1
with: {github_token: "${{ inputs.github-token }}"}

# This composite action requires bash, but bash is not available on windows-arm64 runner.
Expand Down
37 changes: 34 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ jobs:
run: dart run grinder protobuf pkg-pub-deploy
env: {PUB_CREDENTIALS: "${{ secrets.PUB_CREDENTIALS }}"}

deploy_sub_packages:
name: Deploy Sub-Packages
deploy_sass_api:
name: Deploy sass_api
runs-on: ubuntu-latest
needs: [deploy_pub]

Expand All @@ -113,12 +113,43 @@ jobs:
with: {github-token: "${{ github.token }}"}

- name: Deploy
run: dart run grinder deploy-sub-packages
run: dart run grinder deploy-sass-api
env:
PUB_CREDENTIALS: "${{ secrets.PUB_CREDENTIALS }}"
GH_TOKEN: "${{ secrets.GH_TOKEN }}"
GH_USER: sassbot

deploy_sass_parser:
name: Deploy sass-parser
runs-on: ubuntu-latest
needs: [deploy_npm]

steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GH_TOKEN }}
# Set up .npmrc file to publish to npm
- uses: actions/setup-node@v4
with:
version: 'lts/*'
check-latest: true
registry-url: 'https://registry.npmjs.org'

# The repo package has a file dependency, but the released version needs
# a real dependency on the released version of Sass.
- run: npm install sass@${{ steps.version.outputs.version }}

- run: npm publish
env:
NODE_AUTH_TOKEN: '${{ secrets.NPM_TOKEN }}'

- name: Get version
id: version
run: |
echo "version=$(jq .version pkg/sass-parser/package.json)" | tee --append "$GITHUB_OUTPUT"
- run: git tag sass-parser/${{ steps.version.outputs.version }}
- run: git push --tag

deploy_homebrew:
name: Deploy Homebrew
runs-on: ubuntu-latest
Expand Down
75 changes: 75 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -311,3 +311,78 @@ jobs:
run: dart run test -p chrome -j 2
env:
CHROME_EXECUTABLE: chrome

sass_parser_tests:
name: "sass-parser Tests | Dart ${{ matrix.dart_channel }} | Node ${{ matrix.node-version }}"
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
dart_channel: [stable]
node-version: ['lts/*']
include:
# Test older LTS versions
#
# TODO: Test on lts/-2 and lts/-3 once they support
# `structuredClone()` (that is, once they're v18 or later).
- os: ubuntu-latest
dart_channel: stable
node-version: lts/-1
# Test LTS version with dart dev channel
- os: ubuntu-latest
dart_channel: dev
node-version: 'lts/*'

steps:
- uses: actions/checkout@v4
- uses: ./.github/util/initialize
with:
dart-sdk: ${{ matrix.dart_channel }}
github-token: ${{ github.token }}
node-version: ${{ matrix.node-version }}

- run: dart run grinder pkg-npm-dev
env: {UPDATE_SASS_SASS_REPO: false}
- run: npm install
working-directory: pkg/sass-parser/
- name: Run tests
run: npm test
working-directory: pkg/sass-parser/

sass_parser_static_analysis:
name: "sass-parser Static Analysis"
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with: {node-version: 'lts/*'}
- uses: ./.github/util/initialize
with: {github-token: "${{ github.token }}"}

- run: dart run grinder pkg-npm-dev
env: {UPDATE_SASS_SASS_REPO: false}
- run: npm install
working-directory: build/npm/
- run: npm install
working-directory: pkg/sass-parser/
- name: Run static analysis
run: npm run check
working-directory: pkg/sass-parser/

# TODO - postcss/postcss#1958: Enable this once PostCSS doesn't have TypeDoc
# warnings.

# sass_parser_typedoc:
# name: "sass-parser Typedoc"
# runs-on: ubuntu-latest
#
# steps:
# - uses: actions/checkout@v4
# - uses: actions/setup-node@v4
# with: {node-version: 'lts/*'}
# - run: npm install
# working-directory: pkg/sass-parser/
# - run: npm run typedoc
# working-directory: pkg/sass-parser/
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ pubspec.lock
package-lock.json
/benchmark/source
node_modules/
dist/
/doc/api
/pkg/*/doc/api
/pkg/sass-parser/doc

# Generated protocol buffer files.
*.pb*.dart
29 changes: 29 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,12 @@
`darken()`, `transaprentize()`, `fade-out()`, `opacify()`, and `fade-in()`
functions should be replaced by `color.adjust()` or `color.scale()`.

* Add a `global-builtin` future deprecation, which can be opted-into with the
`--future-deprecation` flag or the `futureDeprecations` option in the JS or
Dart API. This emits warnings when any global built-in functions that are
now available in `sass:` modules are called. It will become active by default
in an upcoming release alongside the `@import` deprecation.

### Dart API

* Added a `ColorSpace` class which represents the various color spaces defined
Expand Down Expand Up @@ -190,6 +196,23 @@

## 1.78.0

* The `meta.feature-exists` function is now deprecated. This deprecation is
named `feature-exists`.

* Fix a crash when using `@at-root` without any queries or children in the
indented syntax.

### JS API

* Backport the deprecation options (`fatalDeprecations`, `futureDeprecations`,
and `silenceDeprecations`) to the legacy JS API. The legacy JS API is itself
deprecated, and you should move off of it if possible, but this will allow
users of bundlers and other tools that are still using the legacy API to
still control deprecation warnings.

* Fix a bug where accessing `SourceSpan.url` would crash when a relative URL was
passed to the Sass API.

### Embedded Sass

* Explicitly expose a `sass` executable from the `sass-embedded` npm package.
Expand All @@ -204,6 +227,12 @@
* Fix an edge case where the Dart VM could hang when shutting down when requests
were in flight.

* Fix a race condition where the embedded host could fail to shut down if it was
closed around the same time a new compilation was started.

* Fix a bug where parse-time deprecation warnings could not be controlled by
the deprecation options in some circumstances.

## 1.77.8

* No user-visible changes.
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ A [Dart][dart] implementation of [Sass][sass]. **Sass makes CSS fun**.
<table>
<tr>
<td>
<img width="118px" alt="Sass logo" src="https://rawgit.com/sass/sass-site/master/source/assets/img/logos/logo.svg" />
<img width="118px" alt="Sass logo" src="https://rawgit.com/sass/sass-site/main/source/assets/img/logos/logo.svg" />
</td>
<td valign="middle">
<a href="https://www.npmjs.com/package/sass"><img width="100%" alt="npm statistics" src="https://nodei.co/npm/sass.png?downloads=true"></a>
Expand All @@ -14,6 +14,8 @@ A [Dart][dart] implementation of [Sass][sass]. **Sass makes CSS fun**.
<a href="https://github.com/sass/dart-sass/actions"><img alt="GitHub actions build status" src="https://github.com/sass/dart-sass/workflows/CI/badge.svg"></a>
</td>
<td>
<a href="https://front-end.social/@sass"><img alt="@sass@front-end.social on Fediverse" src="https://img.shields.io/mastodon/follow/110159358073946175?domain=https%3A%2F%2Ffront-end.social"></a>
<br>
<a href="https://twitter.com/SassCSS"><img alt="@SassCSS on Twitter" src="https://img.shields.io/twitter/follow/SassCSS?label=%40SassCSS&style=social"></a>
<br>
<a href="https://stackoverflow.com/questions/tagged/sass"><img alt="stackoverflow" src="https://img.shields.io/stackexchange/stackoverflow/t/sass?label=Sass%20questions&logo=stackoverflow&style=social"></a>
Expand Down Expand Up @@ -201,7 +203,7 @@ files, you'll need to pass a [custom importer] to [`compileString()`] or

[`compile()`]: https://sass-lang.com/documentation/js-api/functions/compile
[`compileAsync()`]: https://sass-lang.com/documentation/js-api/functions/compileAsync
[custom importer]: https://sass-lang.com/documentation/js-api/interfaces/StringOptionsWithImporter#importer
[custom importer]: https://sass-lang.com/documentation/js-api/interfaces/stringoptions/#importer
[`compileString()`]: https://sass-lang.com/documentation/js-api/functions/compileString
[`compileStringAsync()`]: https://sass-lang.com/documentation/js-api/functions/compileStringAsync
[legacy API]: #legacy-javascript-api
Expand Down
16 changes: 5 additions & 11 deletions bin/sass.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import 'package:sass/src/executable/watch.dart';
import 'package:sass/src/import_cache.dart';
import 'package:sass/src/importer/filesystem.dart';
import 'package:sass/src/io.dart';
import 'package:sass/src/logger/deprecation_processing.dart';
import 'package:sass/src/stylesheet_graph.dart';
import 'package:sass/src/utils.dart';
import 'package:sass/src/embedded/executable.dart'
Expand Down Expand Up @@ -48,16 +47,11 @@ Future<void> main(List<String> args) async {
var graph = StylesheetGraph(ImportCache(
importers: [...options.pkgImporters, FilesystemImporter.noLoadPath],
loadPaths: options.loadPaths,
// This logger is only used for handling fatal/future deprecations
// during parsing, and is re-used across parses, so we don't want to
// limit repetition. A separate DeprecationHandlingLogger is created for
// each compilation, which will limit repetition if verbose is not
// passed in addition to handling fatal/future deprecations.
logger: DeprecationProcessingLogger(options.logger,
silenceDeprecations: options.silenceDeprecations,
fatalDeprecations: options.fatalDeprecations,
futureDeprecations: options.futureDeprecations,
limitRepetition: false)));
logger: ImportCache.wrapLogger(
options.logger,
options.silenceDeprecations,
options.fatalDeprecations,
options.futureDeprecations)));
if (options.watch) {
await watch(options, graph);
return;
Expand Down
16 changes: 12 additions & 4 deletions lib/sass.dart
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,9 @@ CompileResult compileToResult(String path,
logger: logger,
importCache: ImportCache(
importers: importers,
logger: logger ?? Logger.stderr(color: color),
logger: ImportCache.wrapLogger(logger, silenceDeprecations,
fatalDeprecations, futureDeprecations,
color: color),
loadPaths: loadPaths,
packageConfig: packageConfig),
functions: functions,
Expand Down Expand Up @@ -222,7 +224,9 @@ CompileResult compileStringToResult(String source,
logger: logger,
importCache: ImportCache(
importers: importers,
logger: logger ?? Logger.stderr(color: color),
logger: ImportCache.wrapLogger(logger, silenceDeprecations,
fatalDeprecations, futureDeprecations,
color: color),
packageConfig: packageConfig,
loadPaths: loadPaths),
functions: functions,
Expand Down Expand Up @@ -261,7 +265,9 @@ Future<CompileResult> compileToResultAsync(String path,
logger: logger,
importCache: AsyncImportCache(
importers: importers,
logger: logger ?? Logger.stderr(color: color),
logger: AsyncImportCache.wrapLogger(logger, silenceDeprecations,
fatalDeprecations, futureDeprecations,
color: color),
loadPaths: loadPaths,
packageConfig: packageConfig),
functions: functions,
Expand Down Expand Up @@ -304,7 +310,9 @@ Future<CompileResult> compileStringToResultAsync(String source,
logger: logger,
importCache: AsyncImportCache(
importers: importers,
logger: logger ?? Logger.stderr(color: color),
logger: AsyncImportCache.wrapLogger(logger, silenceDeprecations,
fatalDeprecations, futureDeprecations,
color: color),
packageConfig: packageConfig,
loadPaths: loadPaths),
functions: functions,
Expand Down
7 changes: 6 additions & 1 deletion lib/src/ast/sass/expression.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,20 @@ import '../../value.dart';
import '../../visitor/interface/expression.dart';
import '../sass.dart';

// Note: despite not defining any methods here, this has to be a concrete class
// so we can expose its accept() function to the JS parser.

/// A SassScript expression in a Sass syntax tree.
///
/// {@category AST}
/// {@category Parsing}
@sealed
abstract interface class Expression implements SassNode {
abstract class Expression implements SassNode {
/// Calls the appropriate visit method on [visitor].
T accept<T>(ExpressionVisitor<T> visitor);

Expression();

/// Parses an expression from [contents].
///
/// If passed, [url] is the name of the file from which [contents] comes.
Expand Down
5 changes: 4 additions & 1 deletion lib/src/ast/sass/expression/binary_operation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import 'list.dart';
/// A binary operator, as in `1 + 2` or `$this and $other`.
///
/// {@category AST}
final class BinaryOperationExpression implements Expression {
final class BinaryOperationExpression extends Expression {
/// The operator being invoked.
final BinaryOperator operator;

Expand Down Expand Up @@ -111,6 +111,9 @@ final class BinaryOperationExpression implements Expression {
///
/// {@category AST}
enum BinaryOperator {
// Note: When updating these operators, also update
// pkg/sass-parser/lib/src/expression/binary-operation.ts.

/// The Microsoft equals operator, `=`.
singleEquals('single equals', '=', 0),

Expand Down
2 changes: 1 addition & 1 deletion lib/src/ast/sass/expression/boolean.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import '../expression.dart';
/// A boolean literal, `true` or `false`.
///
/// {@category AST}
final class BooleanExpression implements Expression {
final class BooleanExpression extends Expression {
/// The value of this expression.
final bool value;

Expand Down
2 changes: 1 addition & 1 deletion lib/src/ast/sass/expression/color.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import '../expression.dart';
/// A color literal.
///
/// {@category AST}
final class ColorExpression implements Expression {
final class ColorExpression extends Expression {
/// The value of this color.
final SassColor value;

Expand Down
4 changes: 2 additions & 2 deletions lib/src/ast/sass/expression/function.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import '../reference.dart';
/// interpolation.
///
/// {@category AST}
final class FunctionExpression
implements Expression, CallableInvocation, SassReference {
final class FunctionExpression extends Expression
implements CallableInvocation, SassReference {
/// The namespace of the function being invoked, or `null` if it's invoked
/// without a namespace.
final String? namespace;
Expand Down
2 changes: 1 addition & 1 deletion lib/src/ast/sass/expression/if.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import '../../../visitor/interface/expression.dart';
/// evaluated.
///
/// {@category AST}
final class IfExpression implements Expression, CallableInvocation {
final class IfExpression extends Expression implements CallableInvocation {
/// The declaration of `if()`, as though it were a normal function.
static final declaration = ArgumentDeclaration.parse(
r"@function if($condition, $if-true, $if-false) {");
Expand Down
Loading