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 ### 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. * Fix Sass npm package types for TS 4.7+ Node16 and NodeNext module resolution.
## 1.53.0 ## 1.53.0

View File

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

View File

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

View File

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