Skip to content

Commit 6dd7037

Browse files
committed
Make js a key of options
1 parent 1c2638b commit 6dd7037

File tree

2 files changed

+24
-9
lines changed

2 files changed

+24
-9
lines changed

tool/get-embedded-compiler.ts

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,33 @@ import * as utils from './utils';
1414
*
1515
* Can check out and build the source from a Git `ref` or build from the source
1616
* 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`.
1720
*/
1821
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+
},
2131
): Promise<void> {
2232
const repo = 'dart-sass';
2333

2434
let source: string;
25-
if (!options || 'ref' in options) {
35+
if (options !== undefined && 'path' in options) {
36+
source = options.path;
37+
} else {
2638
utils.fetchRepo({
2739
repo,
2840
outPath: 'build',
2941
ref: options?.ref ?? 'main',
3042
});
3143
source = p.join('build', repo);
32-
} else {
33-
source = options.path;
3444
}
3545

3646
// Make sure the compiler sees the same version of the language repo that the
@@ -43,7 +53,8 @@ export async function getEmbeddedCompiler(
4353
await utils.link(languageInHost, languageInCompiler);
4454
}
4555

46-
buildDartSassEmbedded(source, js ?? false);
56+
const js = options?.js ?? false;
57+
buildDartSassEmbedded(source, js);
4758

4859
const jsModulePath = p.resolve('node_modules/sass');
4960
const dartModulePath = p.resolve(p.join('node_modules', compilerModule));

tool/init.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,19 @@ void (async () => {
5959

6060
if (!argv['skip-compiler']) {
6161
if (argv['compiler-ref']) {
62-
await getEmbeddedCompiler(argv['compiler-js'], {
62+
await getEmbeddedCompiler({
6363
ref: argv['compiler-ref'],
64+
js: argv['compiler-js'],
6465
});
6566
} else if (argv['compiler-path']) {
66-
await getEmbeddedCompiler(argv['compiler-js'], {
67+
await getEmbeddedCompiler({
6768
path: argv['compiler-path'],
69+
js: argv['compiler-js'],
6870
});
6971
} else {
70-
await getEmbeddedCompiler(argv['compiler-js']);
72+
await getEmbeddedCompiler({
73+
js: argv['compiler-js'],
74+
});
7175
}
7276
}
7377

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy