Skip to content

Commit 279ae54

Browse files
committed
Return to default Quarto preview server
1 parent 13d3032 commit 279ae54

File tree

6 files changed

+18
-1249
lines changed

6 files changed

+18
-1249
lines changed
Lines changed: 13 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import svelte from 'rollup-plugin-svelte';
22
import commonjs from '@rollup/plugin-commonjs';
33
import resolve from '@rollup/plugin-node-resolve';
4-
// import livereload from 'rollup-plugin-livereload';
54
import { terser } from 'rollup-plugin-terser';
65
import css from 'rollup-plugin-css-only';
76

@@ -11,35 +10,21 @@ const path = require('node:path');
1110
// this is false when we run rollup with -w/--watch (never presently)
1211
const production = !process.env.ROLLUP_WATCH;
1312

14-
// function serve() {
15-
// let server;
16-
17-
// function toExit() {
18-
// if (server) server.kill(0);
19-
// }
20-
21-
// return {
22-
// writeBundle() {
23-
// if (server) return;
24-
// server = require('child_process').spawn('npm', ['run', 'start', '--', '--dev'], {
25-
// stdio: ['ignore', 'inherit', 'inherit'],
26-
// shell: true
27-
// });
28-
29-
// process.on('SIGTERM', toExit);
30-
// process.on('exit', toExit);
31-
// }
32-
// };
33-
// }
34-
3513
// get quarto project output directory and list of inputs
36-
// const quartoOutDir = process.env.QUARTO_PROJECT_OUTPUT_DIR;
37-
const quartoOutDir = fs.readFileSync('.sverto/.sverto-outdir', 'utf8')
38-
const svelteFiles = fs.readFileSync('.sverto/.sverto-imports', 'utf8')
14+
const quartoOutDir = fs.readFileSync('.sverto/.sverto-outdir', 'utf8');
15+
16+
const svelteImportListPath = '.sverto/.sverto-imports';
17+
18+
// skip svelte compilation if there's nothing to compile
19+
if (!fs.existsSync(svelteImportListPath)) {
20+
console.log("ℹ No Svelte imports to process; skipping compilation");
21+
process.exit();
22+
}
23+
24+
// get the list of unique imports to compile
25+
const svelteFiles = fs.readFileSync(svelteImportListPath, 'utf8')
3926
.split("\n")
4027
.filter(d => d !== "");
41-
42-
// remove duplicate svelte components (being used by several qmds)
4328
const uniqueSvelteFiles = [... new Set(svelteFiles)]
4429

4530
// we export an array of rollup configs: one for each input svelte file
@@ -71,11 +56,6 @@ export default uniqueSvelteFiles.map(
7156
dedupe: ["svelte"]
7257
}),
7358
commonjs(),
74-
// !production && serve(),
75-
// !production && livereload("public"),
7659
production && terser()
77-
]//,
78-
// watch: {
79-
// clearScreen: false
80-
// }
60+
]
8161
}));

docs/_extensions/sverto/rollup.config.js

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import svelte from 'rollup-plugin-svelte';
22
import commonjs from '@rollup/plugin-commonjs';
33
import resolve from '@rollup/plugin-node-resolve';
4-
// import livereload from 'rollup-plugin-livereload';
54
import { terser } from 'rollup-plugin-terser';
65
import css from 'rollup-plugin-css-only';
76

@@ -11,34 +10,9 @@ const path = require('node:path');
1110
// this is false when we run rollup with -w/--watch (never presently)
1211
const production = !process.env.ROLLUP_WATCH;
1312

14-
console.log("Svelte compile running from " + process.cwd())
15-
16-
// function serve() {
17-
// let server;
18-
19-
// function toExit() {
20-
// if (server) server.kill(0);
21-
// }
22-
23-
// return {
24-
// writeBundle() {
25-
// if (server) return;
26-
// server = require('child_process').spawn('npm', ['run', 'start', '--', '--dev'], {
27-
// stdio: ['ignore', 'inherit', 'inherit'],
28-
// shell: true
29-
// });
30-
31-
// process.on('SIGTERM', toExit);
32-
// process.on('exit', toExit);
33-
// }
34-
// };
35-
// }
36-
3713
// get quarto project output directory and list of inputs
38-
// const quartoOutDir = process.env.QUARTO_PROJECT_OUTPUT_DIR;
3914
const quartoOutDir = fs.readFileSync('.sverto/.sverto-outdir', 'utf8');
4015

41-
let svelteConfig = {};
4216
const svelteImportListPath = '.sverto/.sverto-imports';
4317

4418
// skip svelte compilation if there's nothing to compile
@@ -82,11 +56,6 @@ export default uniqueSvelteFiles.map(
8256
dedupe: ["svelte"]
8357
}),
8458
commonjs(),
85-
// !production && serve(),
86-
// !production && livereload("public"),
8759
production && terser()
88-
]//,
89-
// watch: {
90-
// clearScreen: false
91-
// }
60+
]
9261
}));

0 commit comments

Comments
 (0)