Skip to content

Commit a7403e6

Browse files
committed
Delete source maps when source files are deleted in watch mode
Closes #2613
1 parent 6878709 commit a7403e6

File tree

8 files changed

+46
-5
lines changed

8 files changed

+46
-5
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## 1.91.1
2+
3+
### Command-Line Interface
4+
5+
* In `--watch` mode, delete the source map when the associated source file is
6+
deleted.
7+
18
## 1.91.0
29

310
* **Potentially breaking change:** `meta.inspect()` (as well as other systems

lib/src/executable/watch.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,10 @@ final class _Watcher {
166166
var url = _canonicalize(path);
167167

168168
if (_graph.nodes.containsKey(url)) {
169-
if (_destinationFor(path) case var destination?) _delete(destination);
169+
if (_destinationFor(path) case var destination?) {
170+
_delete(destination);
171+
_delete("$destination.map");
172+
}
170173
}
171174

172175
var downstream = _graph.remove(FilesystemImporter.cwd, url);

pkg/sass-parser/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.4.27
2+
3+
* No user-visible changes.
4+
15
## 0.4.26
26

37
* No user-visible changes.

pkg/sass-parser/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sass-parser",
3-
"version": "0.4.26",
3+
"version": "0.4.27-dev",
44
"description": "A PostCSS-compatible wrapper of the official Sass parser",
55
"repository": "sass/sass",
66
"author": "Google Inc.",

pkg/sass_api/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 15.9.1
2+
3+
* No user-visible changes.
4+
15
## 15.9.0
26

37
* No user-visible changes.

pkg/sass_api/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ name: sass_api
22
# Note: Every time we add a new Sass AST node, we need to bump the *major*
33
# version because it's a breaking change for anyone who's implementing the
44
# visitor interface(s).
5-
version: 15.9.0
5+
version: 15.9.1-dev
66
description: Additional APIs for Dart Sass.
77
homepage: https://github.com/sass/dart-sass
88

99
environment:
1010
sdk: ">=3.6.0 <4.0.0"
1111

1212
dependencies:
13-
sass: 1.91.0
13+
sass: 1.91.1-dev
1414

1515
dev_dependencies:
1616
dartdoc: ^8.0.14

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: sass
2-
version: 1.91.0
2+
version: 1.91.1-dev
33
description: A Sass implementation in Dart.
44
homepage: https://github.com/sass/dart-sass
55

test/cli/shared/watch.dart

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -976,6 +976,29 @@ void sharedTests(Future<TestProcess> runSass(Iterable<String> arguments)) {
976976

977977
await d.dir("dir", [d.nothing("out.css")]).validate();
978978
});
979+
980+
test("and deletes the source map", () async {
981+
await d.file("test.scss", "a {b: c}").create();
982+
983+
var sass = await watch(["--source-map", "test.scss:out.css"]);
984+
await expectLater(
985+
sass.stdout,
986+
emits(endsWith('Compiled test.scss to out.css.')),
987+
);
988+
await expectLater(sass.stdout, _watchingForChanges);
989+
await tickIfPoll();
990+
991+
d.file("test.scss").io.deleteSync();
992+
await expectLater(
993+
sass.stdout,
994+
emitsInOrder([
995+
'Deleted out.css.',
996+
'Deleted out.css.map.',
997+
]));
998+
await sass.kill();
999+
1000+
await d.nothing("out.css").validate();
1001+
});
9791002
});
9801003

9811004
test("creates a new CSS file when a Sass file is added", () async {

0 commit comments

Comments
 (0)