Skip to content

Commit d57eff7

Browse files
authored
generate AST first (#9587)
Co-authored-by: Rich Harris <[email protected]>
1 parent 1003acc commit d57eff7

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

playgrounds/sandbox/run.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,29 +34,29 @@ for (const generate of ['client', 'server']) {
3434
const input = `${cwd}/input/${file}`;
3535
const source = fs.readFileSync(input, 'utf-8');
3636

37-
const compiled = compile(source, {
38-
filename: input,
39-
generate,
40-
runes: argv.runes
41-
});
42-
4337
const output_js = `${cwd}/output/${generate}/${file}.js`;
4438
const output_css = `${cwd}/output/${generate}/${file}.css`;
4539

4640
mkdirp(path.dirname(output_js));
4741

48-
fs.writeFileSync(output_js, compiled.js.code);
49-
if (compiled.css) {
50-
fs.writeFileSync(output_css, compiled.css.code);
51-
}
52-
5342
if (generate === 'client') {
5443
const ast = parse(source, {
5544
modern: true
5645
});
5746

5847
fs.writeFileSync(`${cwd}/output/${file}.json`, JSON.stringify(ast, null, '\t'));
5948
}
49+
50+
const compiled = compile(source, {
51+
filename: input,
52+
generate,
53+
runes: argv.runes
54+
});
55+
56+
fs.writeFileSync(output_js, compiled.js.code);
57+
if (compiled.css) {
58+
fs.writeFileSync(output_css, compiled.css.code);
59+
}
6060
}
6161

6262
for (const file of js_modules) {

0 commit comments

Comments
 (0)