Skip to content

Commit 4db68a1

Browse files
authored
Merge pull request #2339 from sass/merge-main
Merge origin/main into feature.color-4
2 parents fb7ba8f + 8f8467a commit 4db68a1

File tree

165 files changed

+10954
-565
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

165 files changed

+10954
-565
lines changed

.github/dependabot.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,12 @@ updates:
1010
- "/.github/util/*/"
1111
schedule:
1212
interval: "weekly"
13+
- package-ecosystem: "npm"
14+
directories:
15+
- "/"
16+
- "/package"
17+
- "/pkg/sass-parser"
18+
ignore:
19+
dependency-name: "sass"
20+
schedule:
21+
interval: "weekly"

.github/util/initialize/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ runs:
3131
- run: npm install
3232
shell: ${{ runner.os == 'Windows' && 'powershell' || 'bash' }}
3333

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

3737
# This composite action requires bash, but bash is not available on windows-arm64 runner.

.github/workflows/release.yml

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ jobs:
102102
run: dart run grinder protobuf pkg-pub-deploy
103103
env: {PUB_CREDENTIALS: "${{ secrets.PUB_CREDENTIALS }}"}
104104

105-
deploy_sub_packages:
106-
name: Deploy Sub-Packages
105+
deploy_sass_api:
106+
name: Deploy sass_api
107107
runs-on: ubuntu-latest
108108
needs: [deploy_pub]
109109

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

115115
- name: Deploy
116-
run: dart run grinder deploy-sub-packages
116+
run: dart run grinder deploy-sass-api
117117
env:
118118
PUB_CREDENTIALS: "${{ secrets.PUB_CREDENTIALS }}"
119119
GH_TOKEN: "${{ secrets.GH_TOKEN }}"
120120
GH_USER: sassbot
121121

122+
deploy_sass_parser:
123+
name: Deploy sass-parser
124+
runs-on: ubuntu-latest
125+
needs: [deploy_npm]
126+
127+
steps:
128+
- uses: actions/checkout@v4
129+
with:
130+
token: ${{ secrets.GH_TOKEN }}
131+
# Set up .npmrc file to publish to npm
132+
- uses: actions/setup-node@v4
133+
with:
134+
version: 'lts/*'
135+
check-latest: true
136+
registry-url: 'https://registry.npmjs.org'
137+
138+
# The repo package has a file dependency, but the released version needs
139+
# a real dependency on the released version of Sass.
140+
- run: npm install sass@${{ steps.version.outputs.version }}
141+
142+
- run: npm publish
143+
env:
144+
NODE_AUTH_TOKEN: '${{ secrets.NPM_TOKEN }}'
145+
146+
- name: Get version
147+
id: version
148+
run: |
149+
echo "version=$(jq .version pkg/sass-parser/package.json)" | tee --append "$GITHUB_OUTPUT"
150+
- run: git tag sass-parser/${{ steps.version.outputs.version }}
151+
- run: git push --tag
152+
122153
deploy_homebrew:
123154
name: Deploy Homebrew
124155
runs-on: ubuntu-latest

.github/workflows/test.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,3 +311,78 @@ jobs:
311311
run: dart run test -p chrome -j 2
312312
env:
313313
CHROME_EXECUTABLE: chrome
314+
315+
sass_parser_tests:
316+
name: "sass-parser Tests | Dart ${{ matrix.dart_channel }} | Node ${{ matrix.node-version }}"
317+
runs-on: ubuntu-latest
318+
319+
strategy:
320+
fail-fast: false
321+
matrix:
322+
dart_channel: [stable]
323+
node-version: ['lts/*']
324+
include:
325+
# Test older LTS versions
326+
#
327+
# TODO: Test on lts/-2 and lts/-3 once they support
328+
# `structuredClone()` (that is, once they're v18 or later).
329+
- os: ubuntu-latest
330+
dart_channel: stable
331+
node-version: lts/-1
332+
# Test LTS version with dart dev channel
333+
- os: ubuntu-latest
334+
dart_channel: dev
335+
node-version: 'lts/*'
336+
337+
steps:
338+
- uses: actions/checkout@v4
339+
- uses: ./.github/util/initialize
340+
with:
341+
dart-sdk: ${{ matrix.dart_channel }}
342+
github-token: ${{ github.token }}
343+
node-version: ${{ matrix.node-version }}
344+
345+
- run: dart run grinder pkg-npm-dev
346+
env: {UPDATE_SASS_SASS_REPO: false}
347+
- run: npm install
348+
working-directory: pkg/sass-parser/
349+
- name: Run tests
350+
run: npm test
351+
working-directory: pkg/sass-parser/
352+
353+
sass_parser_static_analysis:
354+
name: "sass-parser Static Analysis"
355+
runs-on: ubuntu-latest
356+
357+
steps:
358+
- uses: actions/checkout@v4
359+
- uses: actions/setup-node@v4
360+
with: {node-version: 'lts/*'}
361+
- uses: ./.github/util/initialize
362+
with: {github-token: "${{ github.token }}"}
363+
364+
- run: dart run grinder pkg-npm-dev
365+
env: {UPDATE_SASS_SASS_REPO: false}
366+
- run: npm install
367+
working-directory: build/npm/
368+
- run: npm install
369+
working-directory: pkg/sass-parser/
370+
- name: Run static analysis
371+
run: npm run check
372+
working-directory: pkg/sass-parser/
373+
374+
# TODO - postcss/postcss#1958: Enable this once PostCSS doesn't have TypeDoc
375+
# warnings.
376+
377+
# sass_parser_typedoc:
378+
# name: "sass-parser Typedoc"
379+
# runs-on: ubuntu-latest
380+
#
381+
# steps:
382+
# - uses: actions/checkout@v4
383+
# - uses: actions/setup-node@v4
384+
# with: {node-version: 'lts/*'}
385+
# - run: npm install
386+
# working-directory: pkg/sass-parser/
387+
# - run: npm run typedoc
388+
# working-directory: pkg/sass-parser/

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@ pubspec.lock
1212
package-lock.json
1313
/benchmark/source
1414
node_modules/
15+
dist/
1516
/doc/api
1617
/pkg/*/doc/api
18+
/pkg/sass-parser/doc
1719

1820
# Generated protocol buffer files.
1921
*.pb*.dart

CHANGELOG.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,12 @@
125125
`darken()`, `transaprentize()`, `fade-out()`, `opacify()`, and `fade-in()`
126126
functions should be replaced by `color.adjust()` or `color.scale()`.
127127

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

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

191197
## 1.78.0
192198

199+
* The `meta.feature-exists` function is now deprecated. This deprecation is
200+
named `feature-exists`.
201+
202+
* Fix a crash when using `@at-root` without any queries or children in the
203+
indented syntax.
204+
205+
### JS API
206+
207+
* Backport the deprecation options (`fatalDeprecations`, `futureDeprecations`,
208+
and `silenceDeprecations`) to the legacy JS API. The legacy JS API is itself
209+
deprecated, and you should move off of it if possible, but this will allow
210+
users of bundlers and other tools that are still using the legacy API to
211+
still control deprecation warnings.
212+
213+
* Fix a bug where accessing `SourceSpan.url` would crash when a relative URL was
214+
passed to the Sass API.
215+
193216
### Embedded Sass
194217

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

230+
* Fix a race condition where the embedded host could fail to shut down if it was
231+
closed around the same time a new compilation was started.
232+
233+
* Fix a bug where parse-time deprecation warnings could not be controlled by
234+
the deprecation options in some circumstances.
235+
207236
## 1.77.8
208237

209238
* No user-visible changes.

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ A [Dart][dart] implementation of [Sass][sass]. **Sass makes CSS fun**.
33
<table>
44
<tr>
55
<td>
6-
<img width="118px" alt="Sass logo" src="https://rawgit.com/sass/sass-site/master/source/assets/img/logos/logo.svg" />
6+
<img width="118px" alt="Sass logo" src="https://rawgit.com/sass/sass-site/main/source/assets/img/logos/logo.svg" />
77
</td>
88
<td valign="middle">
99
<a href="https://www.npmjs.com/package/sass"><img width="100%" alt="npm statistics" src="https://nodei.co/npm/sass.png?downloads=true"></a>
@@ -14,6 +14,8 @@ A [Dart][dart] implementation of [Sass][sass]. **Sass makes CSS fun**.
1414
<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>
1515
</td>
1616
<td>
17+
<a href="https://front-end.social/@sass"><img alt="@[email protected] on Fediverse" src="https://img.shields.io/mastodon/follow/110159358073946175?domain=https%3A%2F%2Ffront-end.social"></a>
18+
<br>
1719
<a href="https://twitter.com/SassCSS"><img alt="@SassCSS on Twitter" src="https://img.shields.io/twitter/follow/SassCSS?label=%40SassCSS&style=social"></a>
1820
<br>
1921
<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>
@@ -201,7 +203,7 @@ files, you'll need to pass a [custom importer] to [`compileString()`] or
201203

202204
[`compile()`]: https://sass-lang.com/documentation/js-api/functions/compile
203205
[`compileAsync()`]: https://sass-lang.com/documentation/js-api/functions/compileAsync
204-
[custom importer]: https://sass-lang.com/documentation/js-api/interfaces/StringOptionsWithImporter#importer
206+
[custom importer]: https://sass-lang.com/documentation/js-api/interfaces/stringoptions/#importer
205207
[`compileString()`]: https://sass-lang.com/documentation/js-api/functions/compileString
206208
[`compileStringAsync()`]: https://sass-lang.com/documentation/js-api/functions/compileStringAsync
207209
[legacy API]: #legacy-javascript-api

bin/sass.dart

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import 'package:sass/src/executable/watch.dart';
1515
import 'package:sass/src/import_cache.dart';
1616
import 'package:sass/src/importer/filesystem.dart';
1717
import 'package:sass/src/io.dart';
18-
import 'package:sass/src/logger/deprecation_processing.dart';
1918
import 'package:sass/src/stylesheet_graph.dart';
2019
import 'package:sass/src/utils.dart';
2120
import 'package:sass/src/embedded/executable.dart'
@@ -48,16 +47,11 @@ Future<void> main(List<String> args) async {
4847
var graph = StylesheetGraph(ImportCache(
4948
importers: [...options.pkgImporters, FilesystemImporter.noLoadPath],
5049
loadPaths: options.loadPaths,
51-
// This logger is only used for handling fatal/future deprecations
52-
// during parsing, and is re-used across parses, so we don't want to
53-
// limit repetition. A separate DeprecationHandlingLogger is created for
54-
// each compilation, which will limit repetition if verbose is not
55-
// passed in addition to handling fatal/future deprecations.
56-
logger: DeprecationProcessingLogger(options.logger,
57-
silenceDeprecations: options.silenceDeprecations,
58-
fatalDeprecations: options.fatalDeprecations,
59-
futureDeprecations: options.futureDeprecations,
60-
limitRepetition: false)));
50+
logger: ImportCache.wrapLogger(
51+
options.logger,
52+
options.silenceDeprecations,
53+
options.fatalDeprecations,
54+
options.futureDeprecations)));
6155
if (options.watch) {
6256
await watch(options, graph);
6357
return;

lib/sass.dart

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,9 @@ CompileResult compileToResult(String path,
120120
logger: logger,
121121
importCache: ImportCache(
122122
importers: importers,
123-
logger: logger ?? Logger.stderr(color: color),
123+
logger: ImportCache.wrapLogger(logger, silenceDeprecations,
124+
fatalDeprecations, futureDeprecations,
125+
color: color),
124126
loadPaths: loadPaths,
125127
packageConfig: packageConfig),
126128
functions: functions,
@@ -222,7 +224,9 @@ CompileResult compileStringToResult(String source,
222224
logger: logger,
223225
importCache: ImportCache(
224226
importers: importers,
225-
logger: logger ?? Logger.stderr(color: color),
227+
logger: ImportCache.wrapLogger(logger, silenceDeprecations,
228+
fatalDeprecations, futureDeprecations,
229+
color: color),
226230
packageConfig: packageConfig,
227231
loadPaths: loadPaths),
228232
functions: functions,
@@ -261,7 +265,9 @@ Future<CompileResult> compileToResultAsync(String path,
261265
logger: logger,
262266
importCache: AsyncImportCache(
263267
importers: importers,
264-
logger: logger ?? Logger.stderr(color: color),
268+
logger: AsyncImportCache.wrapLogger(logger, silenceDeprecations,
269+
fatalDeprecations, futureDeprecations,
270+
color: color),
265271
loadPaths: loadPaths,
266272
packageConfig: packageConfig),
267273
functions: functions,
@@ -304,7 +310,9 @@ Future<CompileResult> compileStringToResultAsync(String source,
304310
logger: logger,
305311
importCache: AsyncImportCache(
306312
importers: importers,
307-
logger: logger ?? Logger.stderr(color: color),
313+
logger: AsyncImportCache.wrapLogger(logger, silenceDeprecations,
314+
fatalDeprecations, futureDeprecations,
315+
color: color),
308316
packageConfig: packageConfig,
309317
loadPaths: loadPaths),
310318
functions: functions,

lib/src/ast/sass/expression.dart

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,20 @@ import '../../value.dart';
1313
import '../../visitor/interface/expression.dart';
1414
import '../sass.dart';
1515

16+
// Note: despite not defining any methods here, this has to be a concrete class
17+
// so we can expose its accept() function to the JS parser.
18+
1619
/// A SassScript expression in a Sass syntax tree.
1720
///
1821
/// {@category AST}
1922
/// {@category Parsing}
2023
@sealed
21-
abstract interface class Expression implements SassNode {
24+
abstract class Expression implements SassNode {
2225
/// Calls the appropriate visit method on [visitor].
2326
T accept<T>(ExpressionVisitor<T> visitor);
2427

28+
Expression();
29+
2530
/// Parses an expression from [contents].
2631
///
2732
/// If passed, [url] is the name of the file from which [contents] comes.

0 commit comments

Comments
 (0)