Skip to content

Commit 23ff19d

Browse files
authored
Merge branch 'main' into if
2 parents 80af1c0 + 8818d93 commit 23ff19d

File tree

8 files changed

+42
-55
lines changed

8 files changed

+42
-55
lines changed

.github/workflows/release.yml

+5-4
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,11 @@ jobs:
127127
check-latest: true
128128
registry-url: 'https://registry.npmjs.org'
129129

130+
- name: Get version
131+
id: version
132+
run: |
133+
echo "version=$(jq .version pkg/sass-parser/package.json)" | tee --append "$GITHUB_OUTPUT"
134+
130135
# The repo package has a file dependency, but the released version needs
131136
# a real dependency on the released version of Sass.
132137
- run: npm install sass@${{ steps.version.outputs.version }}
@@ -137,10 +142,6 @@ jobs:
137142
NODE_AUTH_TOKEN: '${{ secrets.NPM_TOKEN }}'
138143
working-directory: pkg/sass-parser/
139144

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

pkg/sass-parser/CHANGELOG.md

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
## 0.4.9
22

3+
* Add support for parsing the `@include` rule.
4+
5+
* Add support for parsing declarations.
6+
37
* Add support for parsing the `@if` and `@else` rules.
48

59
## 0.4.8
610

7-
Add support for parsing the `@include` rule.
8-
9-
Add support for parsing the `@mixin` rule.
11+
* Add support for parsing the `@mixin` rule.
1012

11-
Add support for parsing the `@return` rule.
13+
* Add support for parsing the `@return` rule.
1214

1315
## 0.4.7
1416

pkg/sass-parser/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
},
3333
"dependencies": {
3434
"postcss": ">=8.4.41 <8.5.0",
35-
"sass": "file:../../build/npm"
35+
"sass": "^1.83.1"
3636
},
3737
"devDependencies": {
3838
"@types/jest": "^29.5.12",

pubspec.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ dev_dependencies:
4141
analyzer: ^6.8.0
4242
archive: ^3.1.2
4343
crypto: ^3.0.0
44-
dart_style: ^3.0.0
4544
dartdoc: ^8.0.14
4645
grinder: ^0.9.0
4746
node_preamble: ^2.0.2

test/double_check_test.dart

+21-18
Original file line numberDiff line numberDiff line change
@@ -14,33 +14,24 @@ import 'package:pub_semver/pub_semver.dart';
1414
import 'package:pubspec_parse/pubspec_parse.dart';
1515
import 'package:test/test.dart';
1616

17+
import 'package:sass/src/util/map.dart';
18+
1719
import '../tool/grind/generate_deprecations.dart' as deprecations;
1820
import '../tool/grind/synchronize.dart' as synchronize;
1921

2022
/// Tests that double-check that everything in the repo looks sensible.
2123
void main() {
2224
group("up-to-date generated", () {
2325
group("synchronized file:", () {
24-
synchronize.sources.forEach((sourcePath, targetPath) {
25-
test(targetPath, () {
26-
if (File(targetPath).readAsStringSync() !=
27-
synchronize.synchronizeFile(sourcePath)) {
28-
fail("$targetPath is out-of-date.\n"
29-
"Run `dart run grinder` to update it.");
30-
}
31-
});
32-
});
33-
});
34-
35-
test("deprecations", () {
36-
var inputText = File(deprecations.yamlPath).readAsStringSync();
37-
var outputText = File(deprecations.dartPath).readAsStringSync();
38-
var checksum = sha1.convert(utf8.encode(inputText));
39-
if (!outputText.contains('// Checksum: $checksum')) {
40-
fail('${deprecations.dartPath} is out-of-date.\n'
41-
'Run `dart run grinder` to update it.');
26+
for (var (sourcePath, targetPath) in synchronize.sources.pairs) {
27+
test(targetPath, () => _assertChecksumMatches(sourcePath, targetPath));
4228
}
4329
});
30+
31+
test(
32+
"deprecations",
33+
() => _assertChecksumMatches(
34+
deprecations.yamlPath, deprecations.dartPath));
4435
},
4536
// Windows sees different bytes than other OSes, possibly because of
4637
// newline normalization issues.
@@ -182,3 +173,15 @@ void _checkVersionIncrementsAlong(
182173
"at its major version as well");
183174
}
184175
}
176+
177+
/// Throws an error if the checksum in [outputPath] doesn't match the hash of
178+
/// the contents of [inputPath].
179+
void _assertChecksumMatches(String inputPath, String outputPath) {
180+
var inputText = File(inputPath).readAsStringSync();
181+
var outputText = File(outputPath).readAsStringSync();
182+
var checksum = sha1.convert(utf8.encode(inputText));
183+
if (!outputText.contains('// Checksum: $checksum')) {
184+
fail('$outputPath is out-of-date.\n'
185+
'Run `dart run grinder` to update it.');
186+
}
187+
}

tool/assert-formatted.sh

-13
This file was deleted.

tool/grind/generate_deprecations.dart

+3-7
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ import 'dart:convert';
66
import 'dart:io';
77

88
import 'package:crypto/crypto.dart';
9-
import 'package:dart_style/dart_style.dart';
109
import 'package:grinder/grinder.dart';
11-
import 'package:pub_semver/pub_semver.dart';
1210
import 'package:yaml/yaml.dart';
1311

1412
import 'utils.dart';
@@ -23,10 +21,9 @@ final _blockRegex =
2321
@Depends(updateLanguageRepo)
2422
void deprecations() {
2523
var yamlFile = File(yamlPath);
26-
var dartFile = File(dartPath);
2724
var yamlText = yamlFile.readAsStringSync();
2825
var data = loadYaml(yamlText, sourceUrl: yamlFile.uri) as Map;
29-
var dartText = dartFile.readAsStringSync();
26+
var dartText = File(dartPath).readAsStringSync();
3027
var buffer = StringBuffer('''// START AUTOGENERATED CODE
3128
//
3229
// DO NOT EDIT. This section was generated from the language repo.
@@ -79,7 +76,6 @@ void deprecations() {
7976
fail("Couldn't find block for generated code in lib/src/deprecation.dart");
8077
}
8178
var newCode = dartText.replaceFirst(_blockRegex, buffer.toString());
82-
dartFile.writeAsStringSync(DartFormatter(
83-
languageVersion: Version.parse(Platform.version.split(' ').first))
84-
.format(newCode));
79+
File(dartPath).writeAsStringSync(newCode);
80+
DartFmt.format(dartPath);
8581
}

tool/grind/synchronize.dart

+6-7
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,11 @@ import 'package:analyzer/dart/ast/token.dart';
1313
import 'package:analyzer/dart/ast/visitor.dart';
1414
import 'package:collection/collection.dart';
1515
import 'package:crypto/crypto.dart';
16-
import 'package:dart_style/dart_style.dart';
1716
import 'package:grinder/grinder.dart';
1817
import 'package:path/path.dart' as p;
19-
import 'package:pub_semver/pub_semver.dart';
2018
import 'package:source_span/source_span.dart';
2119

20+
import 'package:sass/src/util/map.dart';
2221
import 'package:sass/src/util/nullable.dart';
2322

2423
/// The files to compile to synchronous versions.
@@ -47,8 +46,10 @@ final _sharedClasses = const ['EvaluateResult'];
4746
/// to a synchronous equivalent.
4847
@Task('Compile async code to synchronous code.')
4948
void synchronize() {
50-
sources.forEach((source, target) =>
51-
File(target).writeAsStringSync(synchronizeFile(source)));
49+
for (var (source, target) in sources.pairs) {
50+
File(target).writeAsStringSync(synchronizeFile(source));
51+
DartFmt.format(target);
52+
}
5253
}
5354

5455
/// Returns the result of synchronizing [source].
@@ -59,9 +60,7 @@ String synchronizeFile(String source) {
5960
parseFile(path: source, featureSet: FeatureSet.latestLanguageVersion())
6061
.unit
6162
.accept(visitor);
62-
return DartFormatter(
63-
languageVersion: Version.parse(Platform.version.split(' ').first))
64-
.format(visitor.result);
63+
return visitor.result;
6564
}
6665

6766
/// The visitor that traverses the asynchronous parse tree and converts it to

0 commit comments

Comments
 (0)