Add charset option to js-api (#1732)

This commit is contained in:
なつき 2022-07-06 13:41:51 -07:00 committed by GitHub
parent 2299632ddf
commit b99ad4ba14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 2 deletions

View File

@ -2,6 +2,8 @@
### JS API
* Add a `charset` option that controls whether or not Sass emits a
`@charset`/BOM for non-ASCII stylesheets.
* Fix Sass npm package types for TS 4.7+ Node16 and NodeNext module resolution.
## 1.53.0

View File

@ -230,7 +230,8 @@ Future<CompileResult> compileToResultAsync(String path,
OutputStyle? style,
bool quietDeps = false,
bool verbose = false,
bool sourceMap = false}) =>
bool sourceMap = false,
bool charset = true}) =>
c.compileAsync(path,
logger: logger,
importCache: AsyncImportCache(
@ -242,7 +243,8 @@ Future<CompileResult> compileToResultAsync(String path,
style: style,
quietDeps: quietDeps,
verbose: verbose,
sourceMap: sourceMap);
sourceMap: sourceMap,
charset: charset);
/// Like [compileStringToResult], except it runs asynchronously.
///

View File

@ -42,6 +42,7 @@ NodeCompileResult compile(String path, [CompileOptions? options]) {
quietDeps: options?.quietDeps ?? false,
style: _parseOutputStyle(options?.style),
verbose: options?.verbose ?? false,
charset: options?.charset ?? true,
sourceMap: options?.sourceMap ?? false,
logger: NodeToDartLogger(options?.logger, Logger.stderr(color: color),
ascii: ascii),
@ -70,6 +71,7 @@ NodeCompileResult compileString(String text, [CompileStringOptions? options]) {
quietDeps: options?.quietDeps ?? false,
style: _parseOutputStyle(options?.style),
verbose: options?.verbose ?? false,
charset: options?.charset ?? true,
sourceMap: options?.sourceMap ?? false,
logger: NodeToDartLogger(options?.logger, Logger.stderr(color: color),
ascii: ascii),
@ -98,6 +100,7 @@ Promise compileAsync(String path, [CompileOptions? options]) {
quietDeps: options?.quietDeps ?? false,
style: _parseOutputStyle(options?.style),
verbose: options?.verbose ?? false,
charset: options?.charset ?? true,
sourceMap: options?.sourceMap ?? false,
logger: NodeToDartLogger(options?.logger, Logger.stderr(color: color),
ascii: ascii),
@ -125,6 +128,7 @@ Promise compileStringAsync(String text, [CompileStringOptions? options]) {
quietDeps: options?.quietDeps ?? false,
style: _parseOutputStyle(options?.style),
verbose: options?.verbose ?? false,
charset: options?.charset ?? true,
sourceMap: options?.sourceMap ?? false,
logger: NodeToDartLogger(options?.logger, Logger.stderr(color: color),
ascii: ascii),

View File

@ -17,6 +17,7 @@ class CompileOptions {
external bool? get quietDeps;
external String? get style;
external bool? get verbose;
external bool? get charset;
external bool? get sourceMap;
external bool? get sourceMapIncludeSources;
external NodeLogger? get logger;