@@ -14,23 +14,34 @@ import * as utils from './utils';
14
14
*
15
15
* Can check out and build the source from a Git `ref` or build from the source
16
16
* at `path`. By default, checks out the latest revision from GitHub.
17
+ *
18
+ * The embedded compiler will be built as dart snapshot by default, or pure node
19
+ * js if the `js` option is `true`.
17
20
*/
18
21
export async function getEmbeddedCompiler (
19
- js ?: boolean ,
20
- options ?: { ref : string } | { path : string } ,
22
+ options ?:
23
+ | {
24
+ ref ?: string ;
25
+ js ?: boolean ;
26
+ }
27
+ | {
28
+ path : string ;
29
+ js ?: boolean ;
30
+ } ,
21
31
) : Promise < void > {
32
+ const js = options ?. js ?? false ;
22
33
const repo = 'dart-sass' ;
23
34
24
35
let source : string ;
25
- if ( ! options || 'ref' in options ) {
36
+ if ( options !== undefined && 'path' in options ) {
37
+ source = options . path ;
38
+ } else {
26
39
utils . fetchRepo ( {
27
40
repo,
28
41
outPath : 'build' ,
29
42
ref : options ?. ref ?? 'main' ,
30
43
} ) ;
31
44
source = p . join ( 'build' , repo ) ;
32
- } else {
33
- source = options . path ;
34
45
}
35
46
36
47
// Make sure the compiler sees the same version of the language repo that the
@@ -43,7 +54,7 @@ export async function getEmbeddedCompiler(
43
54
await utils . link ( languageInHost , languageInCompiler ) ;
44
55
}
45
56
46
- buildDartSassEmbedded ( source , js ?? false ) ;
57
+ buildDartSassEmbedded ( source , js ) ;
47
58
48
59
const jsModulePath = p . resolve ( 'node_modules/sass' ) ;
49
60
const dartModulePath = p . resolve ( p . join ( 'node_modules' , compilerModule ) ) ;
0 commit comments