Skip to content
6 changes: 0 additions & 6 deletions apps/svelte.dev/src/routes/(authed)/playground/+page.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@ export function load({ url }) {
const example = query.get('example');
const version = query.get('version');
const vim = query.get('vim');

// redirect to v2 REPL if appropriate
if (version && /^[^>]?[12]/.test(version)) {
redirect(302, `https://v2.svelte.dev/repl?${query}`);
}

const id = gist || example || 'hello-world';
// we need to filter out null values
const q = new URLSearchParams();
Expand Down
4 changes: 4 additions & 0 deletions packages/repl/src/lib/Editor/Editor.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
const transaction = setDiagnostics(editor_view.state, workspace.diagnostics);
editor_view.dispatch(transaction);
});

$effect(() => {
console.log('compiled', workspace.current_compiled);
});
</script>

<svelte:window
Expand Down
4 changes: 4 additions & 0 deletions packages/repl/src/lib/Output/Viewer.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@
}
});

$effect(() => {
console.log('error', error);
});

async function apply_bundle(bundle: BundleResult | null) {
if (!bundle) return;

Expand Down
4 changes: 3 additions & 1 deletion packages/repl/src/lib/Repl.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,9 @@
let runtime_error: Error | null = $state(null);
let status_visible = $state(false);
let status_timeout: NodeJS.Timeout | undefined = undefined;

$effect(() => {
console.log(runtime_error);
});
const bundler = BROWSER
? new Bundler({
svelte_version: svelteVersion,
Expand Down
2 changes: 1 addition & 1 deletion packages/repl/src/lib/workers/bundler/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ async function bundle(
return new component(options);
}
export function unmount(component) {
component.$destroy();
component.${svelte.VERSION.split('.')[0] < '3' ? 'destroy' : '$destroy'}();
styles.forEach(style => style.remove());
}
export function untrack(fn) {
Expand Down
8 changes: 6 additions & 2 deletions packages/repl/src/lib/workers/npm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,12 @@ export async function load_svelte(version: string) {
? 'compiler.js'
: version.startsWith('4.')
? 'compiler.cjs'
: 'compiler/index.js';

: version.startsWith('1.0') || version.startsWith('1.1.')
? 'dist/svelte.js'
: version.startsWith('2.')
? 'compiler/svelte.js'
: 'compiler/index.js';
console.log(pkg.contents);
const compiler = pkg.contents[entry].text;

(0, eval)(compiler + `\n//# sourceURL=${entry}@` + version);
Expand Down