From 3ab8ba68b3c6db9b267a6d75d37c18c43f15330f Mon Sep 17 00:00:00 2001 From: Richard Harris Date: Sun, 17 Mar 2019 16:51:19 -0400 Subject: [PATCH 1/2] rebundle when files are created/renamed --- site/src/components/Repl/Input/ComponentSelector.svelte | 4 +++- site/src/components/Repl/index.svelte | 9 +++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/site/src/components/Repl/Input/ComponentSelector.svelte b/site/src/components/Repl/Input/ComponentSelector.svelte index 7933306b0a..6c30c34eba 100644 --- a/site/src/components/Repl/Input/ComponentSelector.svelte +++ b/site/src/components/Repl/Input/ComponentSelector.svelte @@ -5,7 +5,7 @@ export let handle_select; - const { components, selected, request_focus } = getContext('REPL'); + const { components, selected, request_focus, rebundle } = getContext('REPL'); let editing = null; @@ -35,6 +35,8 @@ // focus the editor, but wait a beat (so key events aren't misdirected) setTimeout(request_focus); + + rebundle(); } function remove(component) { diff --git a/site/src/components/Repl/index.svelte b/site/src/components/Repl/index.svelte index aa9a9fed93..1a750cceb2 100644 --- a/site/src/components/Repl/index.svelte +++ b/site/src/components/Repl/index.svelte @@ -59,11 +59,17 @@ let module_editor; let output; + function rebundle() { + workers.bundler.postMessage({ type: 'bundle', components: $components }); + } + setContext('REPL', { components, selected, bundle, + rebundle, + navigate: item => { const match = /^(.+)\.(\w+)$/.exec(item.filename); if (!match) return; // ??? @@ -93,8 +99,7 @@ // recompile selected component output.update($selected); - // regenerate bundle (TODO do this in a separate worker?) - workers.bundler.postMessage({ type: 'bundle', components: $components }); + rebundle(); dispatch('change', { components: $components From 13002b611d84a3e1c19e16473cc5fa4553f9b5fe Mon Sep 17 00:00:00 2001 From: Richard Harris Date: Sun, 17 Mar 2019 17:22:19 -0400 Subject: [PATCH 2/2] recompile when options change --- .../Repl/Output/CompilerOptions.svelte | 20 +++++++------- site/src/components/Repl/Output/index.svelte | 20 +++++--------- site/src/components/Repl/index.svelte | 27 ++++++++++++++----- 3 files changed, 38 insertions(+), 29 deletions(-) diff --git a/site/src/components/Repl/Output/CompilerOptions.svelte b/site/src/components/Repl/Output/CompilerOptions.svelte index 278f7aa275..75f7301aa7 100644 --- a/site/src/components/Repl/Output/CompilerOptions.svelte +++ b/site/src/components/Repl/Output/CompilerOptions.svelte @@ -1,5 +1,7 @@