repl: use Rollup 1.x

pull/2210/head
Conduitry 6 years ago
parent 328db0920f
commit 78cb0183fb

@ -14,7 +14,7 @@ self.addEventListener('message', async event => {
version === 'local' ?
'/repl/local?file=compiler.js' :
`https://unpkg.com/svelte@${version}/compiler.js`,
`https://unpkg.com/rollup@0.68/dist/rollup.browser.js`
`https://unpkg.com/rollup@1/dist/rollup.browser.js`
);
fulfil();
@ -62,7 +62,6 @@ function fetch_if_uncached(url) {
async function getBundle(mode, cache, lookup) {
let bundle;
let error;
const all_warnings = [];
const new_cache = {};
@ -106,7 +105,7 @@ async function getBundle(mode, cache, lookup) {
: svelte.compile(code, Object.assign({
generate: mode,
format: 'esm',
name: name,
name,
filename: name + '.svelte'
}, commonCompilerOptions));
@ -124,6 +123,7 @@ async function getBundle(mode, cache, lookup) {
return result.js;
}
}],
inlineDynamicImports: true,
onwarn(warning) {
all_warnings.push({
message: warning.message
@ -131,7 +131,7 @@ async function getBundle(mode, cache, lookup) {
}
});
} catch (error) {
return { error, bundle: null, cache: new_cache, warnings: all_warnings }
return { error, bundle: null, cache: new_cache, warnings: all_warnings };
}
return { bundle, cache: new_cache, error: null, warnings: all_warnings };
@ -168,7 +168,7 @@ async function bundle(components) {
let uid = 1;
const dom_result = await dom.bundle.generate({
const dom_result = (await dom.bundle.generate({
format: 'iife',
name: 'SvelteComponent',
globals: id => {
@ -177,7 +177,7 @@ async function bundle(components) {
return name;
},
sourcemap: true
});
})).output[0];
if (token !== currentToken) return;
@ -195,16 +195,16 @@ async function bundle(components) {
if (token !== currentToken) return;
const ssr_result = ssr
? await ssr.bundle.generate({
? (await ssr.bundle.generate({
format: 'iife',
name: 'SvelteComponent',
globals: id => import_map.get(id),
sourcemap: true
})
})).output[0]
: null;
return {
imports: dom.bundle.imports,
imports: dom_result.imports,
import_map,
dom: dom_result,
ssr: ssr_result,

Loading…
Cancel
Save