Skip to content

Commit f11274d

Browse files
committed
tidy up
1 parent 0b52b35 commit f11274d

File tree

16 files changed

+31
-141
lines changed

16 files changed

+31
-141
lines changed

apps/svelte.dev/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
"d3-geo": "^3.1.0",
3939
"d3-geo-projection": "^4.0.0",
4040
"do-not-zip": "^1.0.0",
41-
"editor": "workspace:*",
4241
"flexsearch": "^0.7.43",
4342
"flru": "^1.0.2",
4443
"port-authority": "^2.0.1",

apps/svelte.dev/src/lib/tutorial/adapters/rollup/index.svelte.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@ import Bundler from '@sveltejs/repl/bundler';
33
import * as yootils from 'yootils';
44
import type { Adapter } from '$lib/tutorial';
55
import type { File, Item } from '@sveltejs/repl/workspace';
6+
import type { BundleResult } from '@sveltejs/repl';
67

78
/** Rollup bundler singleton */
89
let bundler: Bundler;
910

1011
export const state = new (class RollupState {
1112
progress = $state.raw({ value: 0, text: 'initialising' });
12-
bundle = $state.raw<any>(null);
13+
bundle = $state.raw<BundleResult | null>(null);
1314
})();
1415

1516
/**

apps/svelte.dev/src/routes/(authed)/playground/[id]/+page.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import { browser } from '$app/environment';
55
import { afterNavigate, goto, replaceState } from '$app/navigation';
66
import type { Gist } from '$lib/db/types';
7-
import Repl from '@sveltejs/repl';
7+
import { Repl } from '@sveltejs/repl';
88
import { theme } from '@sveltejs/site-kit/state';
99
import { mapbox_setup } from '../../../../config.js';
1010
import AppControls from './AppControls.svelte';

apps/svelte.dev/src/routes/(authed)/playground/[id]/AppControls.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import ModalDropdown from '$lib/components/ModalDropdown.svelte';
1010
import SecondaryNav from '$lib/components/SecondaryNav.svelte';
1111
import type { File } from '@sveltejs/repl/workspace';
12-
import type Repl from '@sveltejs/repl';
12+
import type { Repl } from '@sveltejs/repl';
1313
1414
interface Props {
1515
examples: Array<{ title: string; examples: any[] }>;

apps/svelte.dev/src/routes/(authed)/playground/[id]/embed/+page.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import { browser } from '$app/environment';
33
import { afterNavigate, replaceState } from '$app/navigation';
44
import { theme } from '@sveltejs/site-kit/state';
5-
import Repl from '@sveltejs/repl';
5+
import { Repl } from '@sveltejs/repl';
66
import { mapbox_setup } from '../../../../../config.js';
77
import { page } from '$app/state';
88
import { decode_and_decompress_text } from '../gzip.js';

packages/repl/package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424
"homepage": "https://github.com/sveltejs/svelte.dev/tree/main/packages/repl/#readme",
2525
"exports": {
2626
".": {
27-
"types": "./src/lib/Repl.svelte",
28-
"svelte": "./src/lib/Repl.svelte",
29-
"default": "./src/lib/Repl.svelte"
27+
"types": "./src/lib/public.d.ts",
28+
"svelte": "./src/lib/index.ts",
29+
"default": "./src/lib/index.ts"
3030
},
3131
"./bundler": {
3232
"types": "./src/lib/Bundler.ts",
@@ -93,7 +93,6 @@
9393
"@sveltejs/svelte-json-tree": "^2.2.1",
9494
"acorn": "^8.11.3",
9595
"codemirror": "^6.0.1",
96-
"editor": "workspace:*",
9796
"esm-env": "^1.0.0",
9897
"esrap": "^1.2.2",
9998
"locate-character": "^3.0.0",

packages/repl/src/lib/Output/Viewer.svelte

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
import srcdoc_styles from './srcdoc/styles.css?raw';
1212
import ErrorOverlay from './ErrorOverlay.svelte';
1313
import type { CompileError } from 'svelte/compiler';
14-
import type { Bundle } from '../types';
1514
import type { Writable } from 'svelte/store';
15+
import type { BundleResult } from '$lib/public';
1616
1717
export let error: Error | null;
1818
/** status by Bundler class instance */
@@ -27,12 +27,12 @@
2727
export let injectedCSS = '';
2828
export let theme: 'light' | 'dark';
2929
/** A store containing the current bundle result. Takes precedence over REPL context, if set */
30-
export let bundle: Readable<Bundle | null> | undefined = undefined;
30+
export let bundle: Writable<BundleResult | null> | undefined = undefined;
3131
/** Called everytime a log is pushed. If this is set, the built-in console coming with the Viewer isn't shown */
3232
export let onLog: ((logs: Log[]) => void) | undefined = undefined;
3333
3434
const context = get_repl_context();
35-
bundle = bundle ?? context.bundle;
35+
bundle ??= context.bundle;
3636
3737
let logs: Log[] = [];
3838
let log_group_stack: Log[][] = [];
@@ -101,7 +101,7 @@
101101
102102
$: if (ready) proxy?.iframe_command('set_theme', { theme });
103103
104-
async function apply_bundle($bundle: Bundle | null | undefined) {
104+
async function apply_bundle($bundle: BundleResult | null | undefined) {
105105
if (!$bundle) return;
106106
107107
try {

packages/repl/src/lib/Repl.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import { set_repl_context } from './context.js';
1010
import { Workspace, type File } from './Workspace.svelte.js';
1111
import Editor from './Editor/Editor.svelte';
12-
import type { Bundle, ReplContext } from './types.js';
12+
import type { ReplContext } from './types.js';
1313
1414
interface Props {
1515
svelteVersion?: string;
@@ -100,7 +100,7 @@
100100
const result = await bundler!.bundle(workspace.files as File[], {
101101
tailwind: workspace.tailwind
102102
});
103-
if (token === current_token) $bundle = result as Bundle;
103+
if (token === current_token) $bundle = result;
104104
}
105105
106106
async function migrate() {

packages/repl/src/lib/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default as Repl } from './Repl.svelte';

packages/repl/src/lib/public.d.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import type { OutputChunk, RollupError } from '@rollup/browser';
2+
3+
export interface BundleResult {
4+
uid: number;
5+
error: (RollupError & CompileError) | null;
6+
client: OutputChunk | null; // TODO
7+
server: OutputChunk | null; // TODO
8+
tailwind: string | null;
9+
imports: string[];
10+
}
11+
12+
export * from './index';

0 commit comments

Comments
 (0)