8000 Fix CSS import bug (#1633) · duelnet/dart-sass@c66ea3f · GitHub
[go: up one dir, main page]

Skip to content

Commit c66ea3f

Browse files
authored
Fix CSS import bug (sass#1633)
1 parent 4181d0d commit c66ea3f

File tree

7 files changed

+34
-20
lines changed

7 files changed

+34
-20
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
## 1.49.8
22

3+
* Fixed a bug where some plain CSS imports would not be emitted.
4+
35
### JS API
46

57
* Fix a bug where inspecting the Sass module in the Node.js console crashed on

lib/src/node/compile.dart

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ NodeCompileResult compile(String path, [CompileOptions? options]) {
4747
ascii: ascii),
4848
importers: options?.importers?.map(_parseImporter),
4949
functions: _parseFunctions(options?.functions).cast());
50-
return _convertResult(result, includeSourceContents: options?.sourceMapIncludeSources ?? false);
50+
return _convertResult(result,
51+
includeSourceContents: options?.sourceMapIncludeSources ?? false);
5152
} on SassException catch (error, stackTrace) {
5253
throwNodeException(error, color: color, ascii: ascii, trace: stackTrace);
5354
}
@@ -76,7 +77,8 @@ NodeCompileResult compileString(String text, [CompileStringOptions? options]) {
7677
importer: options?.importer.andThen(_parseImporter) ??
7778
(options?.url == null ? NoOpImporter() : null),
7879
functions: _parseFunctions(options?.functions).cast());
79-
return _convertResult(result, includeSourceContents: options?.sourceMapIncludeSources ?? false);
80+
return _convertResult(result,
81+
includeSourceContents: options?.sourceMapIncludeSources ?? false);
8082
} on SassException catch (error, stackTrace) {
8183
throwNodeException(error, color: color, ascii: ascii, trace: stackTrace);
8284
}
@@ -102,7 +104,8 @@ Promise compileAsync(String path, [CompileOptions? options]) {
102104
importers: options?.importers
103105
?.map((importer) => _parseAsyncImporter(importer)),
104106
functions: _parseFunctions(options?.functions, asynch: true));
105-
return _convertResult(result, includeSourceContents: options?.sourceMapIncludeSources ?? false);
107+
return _convertResult(result,
108+
includeSourceContents: options?.sourceMapIncludeSources ?? false);
106109
}()), color: color, ascii: ascii);
107110
}
108111

@@ -131,13 +134,16 @@ Promise compileStringAsync(String text, [CompileStringOptions? options]) {
131134
.andThen((importer) => _parseAsyncImporter(importer)) ??
132135
(options?.url == null ? NoOpImporter() : null),
133136
functions: _parseFunctions(options?.functions, asynch: true));
134-
return _convertResult(result, includeSourceContents: options?.sourceMapIncludeSources ?? false);
137+
return _convertResult(result,
138+
includeSourceContents: options?.sourceMapIncludeSources ?? false);
135139
}()), color: color, ascii: ascii);
136140
}
137141

138142
/// Converts a Dart [CompileResult] into a JS API [NodeCompileResult].
139-
NodeCompileResult _convertResult(CompileResult result, {required bool includeSourceContents}) {
140-
var sourceMap = result.sourceMap?.toJson(includeSourceContents: includeSourceContents);
143+
NodeCompileResult _convertResult(CompileResult result,
144+
{required bool includeSourceContents}) {
145+
var sourceMap =
146+
result.sourceMap?.toJson(includeSourceContents: includeSourceContents);
141147
if (sourceMap is Map<String, dynamic> && !sourceMap.containsKey('sources')) {
142148
// Dart's source map library can omit the sources key, but JS's type
143149
// declaration doesn't allow that.

lib/src/visitor/async_evaluate.dart

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1526,10 +1526,12 @@ class _EvaluateVisitor
15261526

15271527
_importer = oldImporter;
15281528
_stylesheet = oldStylesheet;
1529-
_root = oldRoot;
1530-
_parent = oldParent;
1531-
_endOfImports = oldEndOfImports;
1532-
_outOfOrderImports = oldOutOfOrderImports;
1529+
if (loadsUserDefinedModules) {
1530+
_root = oldRoot;
1531+
_parent = oldParent;
1532+
_endOfImports = oldEndOfImports;
1533+
_outOfOrderImports = oldOutOfOrderImports;
1534+
}
15331535
_configuration = oldConfiguration;
15341536
_inDependency = oldInDependency;
15351537
});
@@ -1539,7 +1541,6 @@ class _EvaluateVisitor
15391541
// CSS from modules used by [stylesheet].
15401542
var module = environment.toDummyModule();
15411543
_environment.importForwards(module);
1542-
15431544
if (loadsUserDefinedModules) {
15441545
if (module.transitivelyContainsCss) {
15451546
// If any transitively used module contains extensions, we need to

lib/src/visitor/evaluate.dart

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// DO NOT EDIT. This file was generated from async_evaluate.dart.
66
// See tool/grind/synchronize.dart for details.
77
//
8-
// Checksum: c1d303225e5cac5e32dd32a4eed30a71a35b390c
8+
// Checksum: d0af88db460da6528bdfeef34eb85baac00f9435
99
//
1010
// ignore_for_file: unused_import
1111

@@ -1526,10 +1526,12 @@ class _EvaluateVisitor
15261526

15271527
_importer = oldImporter;
15281528
_stylesheet = oldStylesheet;
1529-
_root = oldRoot;
1530-
_parent = oldParent;
1531-
_endOfImports = oldEndOfImports;
1532-
_outOfOrderImports = oldOutOfOrderImports;
1529+
if (loadsUserDefinedModules) {
1530+
_root = oldRoot;
1531+
_parent = oldParent;
1532+
_endOfImports = oldEndOfImports;
1533+
_outOfOrderImports = oldOutOfOrderImports;
1534+
}
15331535
_configuration = oldConfiguration;
15341536
_inDependency = oldInDependency;
15351537
});
@@ -1539,7 +1541,6 @@ class _EvaluateVisitor
15391541
// CSS from modules used by [stylesheet].
15401542
var module = environment.toDummyModule();
15411543
_environment.importForwards(module);
1542-
15431544
if (loadsUserDefinedModules) {
15441545
if (module.transitivelyContainsCss) {
15451546
// If any transitively used module contains extensions, we need to

pkg/sass_api/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 1.0.0-beta.37
2+
3+
* No user-visible changes.
4+
15
## 1.0.0-beta.36
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: 1.0.0-beta.36
5+
version: 1.0.0-beta.37
66
description: Additional APIs for Dart Sass.
77
homepage: https://github.com/sass/dart-sass
88

99
environment:
1010
sdk: '>=2.12.0 <3.0.0'
1111

1212
dependencies:
13-
sass: 1.49.7
13+
sass: 1.49.8
1414

1515
dependency_overrides:
1616
sass: {path: ../..}

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.49.8-dev
2+
version: 1.49.8
33
description: A Sass implementation in Dart.
44
homepage: https://github.com/sass/dart-sass
55

0 commit comments

Comments
 (0)
0