@@ -58,25 +58,36 @@ export async function dartCompile(
5858 */
5959export interface DartCommandOptions {
6060 /**
61- * Override the dart-sass install directory.
61+ * Override the path to the dart-sass install directory.
6262 * Used for testing with non-standard paths (spaces, accented characters).
6363 */
64- installDir ?: string ;
64+ sassPath ?: string ;
6565}
6666
6767/**
6868 * Resolve the dart-sass command and its base arguments.
6969 *
70- * On Windows, calls dart.exe + sass.snapshot directly to avoid .bat file
71- * issues: Deno quoting bugs (#13997), cmd.exe encoding (#14267), and
72- * enterprise .bat blocking (#6651).
70+ * On Windows, calls dart.exe + sass.snapshot directly instead of going
71+ * through sass.bat. The bundled sass.bat is a thin wrapper generated by
72+ * dart_cli_pkg that just runs:
73+ * "%SCRIPTPATH%\src\dart.exe" "%SCRIPTPATH%\src\sass.snapshot" %arguments%
74+ *
75+ * Template source:
76+ * https://github.com/google/dart_cli_pkg/blob/main/lib/src/templates/standalone/executable.bat.mustache
77+ * Upstream issue to ship standalone .exe instead of .bat + dart.exe:
78+ * https://github.com/google/dart_cli_pkg/issues/67
79+ *
80+ * Bypassing sass.bat avoids multiple .bat file issues on Windows:
81+ * - Deno quoting bugs with spaced paths (#13997)
82+ * - cmd.exe OEM code page misreading UTF-8 accented paths (#14267)
83+ * - Enterprise group policy blocking .bat execution (#6651)
7384 */
7485function resolveSassCommand ( options ?: DartCommandOptions ) : {
7586 cmd : string ;
7687 baseArgs : string [ ] ;
7788} {
78- const installDir = options ?. installDir ;
79- if ( installDir == null ) {
89+ const sassPath = options ?. sassPath ;
90+ if ( sassPath == null ) {
8091 const dartOverrideCmd = Deno . env . get ( "QUARTO_DART_SASS" ) ;
8192 if ( dartOverrideCmd ) {
8293 if ( ! existsSync ( dartOverrideCmd ) ) {
@@ -89,7 +100,7 @@ function resolveSassCommand(options?: DartCommandOptions): {
89100 }
90101 }
91102
92- const sassDir = installDir ?? architectureToolsPath ( "dart-sass" ) ;
103+ const sassDir = sassPath ?? architectureToolsPath ( "dart-sass" ) ;
93104
94105 if ( isWindows ) {
95106 return {
0 commit comments