Skip to content

Commit 5591a84

Browse files
authored
Merge pull request #2556 from sass/merge-main
Merge branch 'main' of github.com:sass/dart-sass into feature.v2
2 parents 499e140 + 0050f4e commit 5591a84

Some content is hidden

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

68 files changed

+1953
-348
lines changed

.github/workflows/build-linux.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ jobs:
1010

1111
runs-on: ubuntu-latest
1212

13+
permissions:
14+
attestations: write
15+
id-token: write
16+
1317
strategy:
1418
fail-fast: false
1519
matrix:
@@ -127,6 +131,12 @@ jobs:
127131
dart run grinder pkg-standalone-${{ matrix.target }}
128132
EOF
129133
134+
- name: Generate artifact attestation
135+
if: github.ref_type == 'tag'
136+
uses: actions/attest-build-provenance@v2
137+
with:
138+
subject-path: build/*.tar.gz
139+
130140
- name: Upload Artifact
131141
uses: actions/upload-artifact@v4
132142
with:

.github/workflows/build-macos.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ jobs:
1010

1111
runs-on: ${{ matrix.runner }}
1212

13+
permissions:
14+
attestations: write
15+
id-token: write
16+
1317
strategy:
1418
fail-fast: false
1519
matrix:
@@ -28,6 +32,12 @@ jobs:
2832
- name: Build
2933
run: dart run grinder pkg-standalone-macos-${{ matrix.arch }}
3034

35+
- name: Generate artifact attestation
36+
if: github.ref_type == 'tag'
37+
uses: actions/attest-build-provenance@v2
38+
with:
39+
subject-path: build/*.tar.gz
40+
3141
- name: Upload Artifact
3242
uses: actions/upload-artifact@v4
3343
with:

.github/workflows/build-windows.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ jobs:
1010

1111
runs-on: ${{ matrix.runner }}
1212

13+
permissions:
14+
attestations: write
15+
id-token: write
16+
1317
strategy:
1418
fail-fast: false
1519
matrix:
@@ -30,6 +34,12 @@ jobs:
3034
- name: Build
3135
run: dart run grinder pkg-standalone-windows-${{ matrix.arch }}
3236

37+
- name: Generate artifact attestation
38+
if: github.ref_type == 'tag'
39+
uses: actions/attest-build-provenance@v2
40+
with:
41+
subject-path: build/*.zip
42+
3343
- name: Upload Artifact
3444
uses: actions/upload-artifact@v4
3545
with:

.github/workflows/ci.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
name: Double-check
1616
runs-on: ubuntu-latest
1717
needs: [test]
18-
if: "startsWith(github.ref, 'refs/tags/') && github.event.repository.fork == false"
18+
if: "github.ref_type == 'tag' && github.event.repository.fork == false"
1919

2020
steps:
2121
- uses: actions/checkout@v4
@@ -27,14 +27,16 @@ jobs:
2727

2828
test_vendor:
2929
needs: [double_check]
30-
if: "startsWith(github.ref, 'refs/tags/') && github.event.repository.fork == false"
30+
if: "github.ref_type == 'tag' && github.event.repository.fork == false"
3131
uses: ./.github/workflows/test-vendor.yml
3232
secrets: inherit
3333

3434
release:
3535
needs: [test_vendor]
36-
if: "startsWith(github.ref, 'refs/tags/') && github.event.repository.fork == false"
36+
if: "github.ref_type == 'tag' && github.event.repository.fork == false"
3737
permissions:
38+
attestations: write
3839
contents: write
40+
id-token: write
3941
uses: ./.github/workflows/release.yml
4042
secrets: inherit

.github/workflows/release.yml

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,23 @@ on:
55

66
jobs:
77
build_linux:
8+
permissions:
9+
attestations: write
10+
id-token: write
811
uses: ./.github/workflows/build-linux.yml
912
secrets: inherit
1013

1114
build_macos:
15+
permissions:
16+
attestations: write
17+
id-token: write
1218
uses: ./.github/workflows/build-macos.yml
1319
secrets: inherit
1420

1521
build_windows:
22+
permissions:
23+
attestations: write
24+
id-token: write
1625
uses: ./.github/workflows/build-windows.yml
1726
secrets: inherit
1827

@@ -45,10 +54,9 @@ jobs:
4554
uses: actions/download-artifact@v4
4655

4756
- name: Release
48-
uses: softprops/action-gh-release@v2
49-
with:
50-
files: |
51-
build-*/*
57+
run: gh release upload ${{ github.ref_name }} build-*/* --repo ${{ github.repository }}
58+
env:
59+
GH_TOKEN: ${{ github.token }}
5260

5361
deploy_npm:
5462
name: Deploy npm
@@ -131,7 +139,7 @@ jobs:
131139
# a real dependency on the released version of Sass.
132140
- name: Get Dart Sass version
133141
id: dart-sass-version
134-
run: echo "version=${GITHUB_REF##*/}" | tee --append "$GITHUB_OUTPUT"
142+
run: echo "version=${{ github.ref_name }}" | tee --append "$GITHUB_OUTPUT"
135143
- run: npm install sass@${{ steps.dart-sass-version.outputs.version }}
136144
working-directory: pkg/sass-parser/
137145

@@ -190,7 +198,7 @@ jobs:
190198

191199
- name: Get version
192200
id: version
193-
run: echo "version=${GITHUB_REF##*/}" | tee --append "$GITHUB_OUTPUT"
201+
run: echo "version=${{ github.ref_name }}" | tee --append "$GITHUB_OUTPUT"
194202

195203
- name: Wait for npm registry's CDN to catch up on replications
196204
run: sleep 600
@@ -219,7 +227,7 @@ jobs:
219227
- name: Get version
220228
id: version
221229
run: |
222-
echo "version=${GITHUB_REF##*/}" | tee --append "$GITHUB_OUTPUT"
230+
echo "version=${{ github.ref_name }}" | tee --append "$GITHUB_OUTPUT"
223231
echo "protocol_version=$(curl -fsSL -H "Authorization: Bearer ${{ github.token }}" https://raw.githubusercontent.com/sass/sass/HEAD/spec/EMBEDDED_PROTOCOL_VERSION)" | tee --append "$GITHUB_OUTPUT"
224232
225233
- name: Update version

CHANGELOG.md

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,26 @@
3838
available through the expanded `sass_api` package, since that package also
3939
exposes the selector AST that it returns.
4040

41-
## 1.85.2-dev
41+
## 1.86.1
4242

43-
* No user-visible changes.
43+
* Improve the performance of `file:` URL case canonicalization on Windows and
44+
Mac OS.
45+
46+
## 1.86.0
47+
48+
* Add support for `%` as an expression in its own right. It will still be parsed
49+
as the modulo operator when between two other expressions, but in any other
50+
context it will be an expression whose value is the unquoted string `%`.
51+
52+
* Consider `attr()` to be a special number function that can be used as a
53+
channel in color functions.
54+
55+
* Deprecate user-defined functions named `type()` so that we can eventually
56+
support the new CSS `type()` function.
57+
58+
### Dart API
59+
60+
* Increase the minimum Dart SDK to 3.6.0.
4461

4562
## 1.85.1
4663

lib/src/deprecation.dart

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ enum Deprecation {
1515
// DO NOT EDIT. This section was generated from the language repo.
1616
// See tool/grind/generate_deprecations.dart for details.
1717
//
18-
// Checksum: f34f224d924705c05c56bfc57a398706597f6c64
18+
// Checksum: cd61dac9558368fdb6f4221bb23d917003b61610
1919

2020
/// Deprecation for passing a string directly to meta.call().
2121
callString('call-string',
@@ -125,6 +125,13 @@ enum Deprecation {
125125
description:
126126
'Global built-in functions that are available in sass: modules.'),
127127

128+
/// Deprecation for functions named "type".
129+
typeFunction(
130+
'type-function',
131+
deprecatedIn: '1.86.0',
132+
description: 'Functions named "type".',
133+
),
134+
128135
// END AUTOGENERATED CODE
129136

130137
/// Used for deprecations coming from user-authored code.

lib/src/io.dart

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,8 @@ String canonicalize(String path) => _couldBeCaseInsensitive
3030

3131
/// Returns `path` with the case updated to match the path's case on disk.
3232
///
33-
/// This only updates `path`'s basename. It always returns `path` as-is on
34-
/// operating systems other than Windows or Mac OS, since they almost never use
35-
/// case-insensitive filesystems.
33+
/// This always returns `path` as-is on operating systems other than Windows or
34+
/// Mac OS, since they almost never use case-insensitive filesystems.
3635
String _realCasePath(String path) {
3736
// TODO(nweiz): Use an SDK function for this when dart-lang/sdk#35370 and/or
3837
// nodejs/node#24942 are fixed, or at least use FFI functions.
@@ -47,14 +46,33 @@ String _realCasePath(String path) {
4746
}
4847
}
4948

50-
String helper(String path) {
49+
String helper(String path, [String? realPath]) {
5150
var dirname = p.dirname(path);
5251
if (dirname == path) return path;
5352

5453
return _realCaseCache.putIfAbsent(path, () {
54+
// If the path isn't a symlink, we can use the libraries' `realpath()`
55+
// functions to get its actual basename much more efficiently than listing
56+
// all its siblings.
57+
if (!linkExists(path)) {
58+
// Don't recompute the real path if it was already computed for a child
59+
// and we haven't seen any symlinks between that child and this directory.
60+
String realPathNonNull;
61+
try {
62+
realPathNonNull = realPath ?? realpath(path);
63+
} on FileSystemException {
64+
// If we can't get the realpath, that probably means the file doesn't
65+
// exist. Rather than throwing an error about symlink resolution,
66+
// return the non-existent path and let it throw whatever use-time
67+
// error it's going to throw.
68+
return path;
69+
}
70+
return p.join(helper(dirname, p.dirname(realPathNonNull)),
71+
p.basename(realPathNonNull));
72+
}
73+
5574
var realDirname = helper(dirname);
5675
var basename = p.basename(path);
57-
5876
try {
5977
var matches = listDir(realDirname)
6078
.where(

lib/src/io/interface.dart

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ bool fileExists(String path) => throw '';
6161
/// Returns whether a dir at [path] exists.
6262
bool dirExists(String path) => throw '';
6363

64+
/// Returns whether a symbolic link at [path] exists.
65+
bool linkExists(String path) => throw '';
66+
6467
/// Ensures that a directory exists at [path], creating it and its ancestors if
6568
/// necessary.
6669
void ensureDir(String path) => throw '';
@@ -71,6 +74,10 @@ void ensureDir(String path) => throw '';
7174
/// beneath [path] as well.
7275
Iterable<String> listDir(String path, {bool recursive = false}) => throw '';
7376

77+
/// Returns the resolved physical path of [path] on disk, with symbolic links
78+
/// resolved and with the same case as the physical file.
79+
String realpath(String path) => throw '';
80+
7481
/// Returns the modification time of the file at [path].
7582
DateTime modificationTime(String path) => throw '';
7683

lib/src/io/js.dart

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,21 @@ bool dirExists(String path) {
181181
});
182182
}
183183

184+
bool linkExists(String path) {
185+
if (!isNodeJs) {
186+
throw UnsupportedError("linkExists() is only supported on Node.js");
187+
}
188+
return _systemErrorToFileSystemException(() {
189+
try {
190+
return fs.lstatSync(path).isSymbolicLink();
191+
} catch (error) {
192+
var systemError = error as JsSystemError;
193+
if (systemError.code == 'ENOENT') return false;
194+
rethrow;
195+
}
196+
});
197+
}
198+
184199
void ensureDir(String path) {
185200
if (!isNodeJs) {
186201
throw UnsupportedError("ensureDir() is only supported on Node.js");
@@ -220,6 +235,13 @@ Iterable<String> listDir(String path, {bool recursive = false}) {
220235
});
221236
}
222237

238+
String realpath(String path) {
239+
if (!isNodeJs) {
240+
throw UnsupportedError("listDir() is only supported on Node.js");
241+
}
242+
return _systemErrorToFileSystemException(() => fs.realpathSync.native(path));
243+
}
244+
223245
DateTime modificationTime(String path) {
224246
if (!isNodeJs) {
225247
throw UnsupportedError("modificationTime() is only supported on Node.js");

0 commit comments

Comments
 (0)