Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(repl): Rollup v4 #546

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 26 additions & 27 deletions packages/repl/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,43 +48,42 @@
"svelte": "^3.54.0 || ^4.0.0-next.0 || ^4.0.0"
},
"devDependencies": {
"@fontsource/fira-mono": "^5.0.3",
"@sveltejs/adapter-static": "^2.0.2",
"@sveltejs/kit": "^1.20.5",
"@sveltejs/package": "^2.1.0",
"@types/marked": "^5.0.0",
"publint": "^0.1.12",
"svelte": "^4.0.0",
"svelte-check": "^3.4.4",
"tslib": "^2.6.0",
"typescript": "^5.1.3",
"vite": "^4.3.9"
"@fontsource/fira-mono": "^5.0.8",
"@sveltejs/adapter-static": "^2.0.3",
"@sveltejs/kit": "^1.27.6",
"@sveltejs/package": "^2.2.3",
"publint": "^0.2.6",
"svelte": "^4.2.8",
"svelte-check": "^3.6.2",
"tslib": "^2.6.2",
"typescript": "^5.3.2",
"vite": "^4.5.0"
},
"dependencies": {
"@codemirror/autocomplete": "^6.8.1",
"@codemirror/commands": "^6.2.4",
"@codemirror/lang-css": "^6.2.0",
"@codemirror/lang-javascript": "^6.1.9",
"@codemirror/autocomplete": "^6.11.1",
"@codemirror/commands": "^6.3.2",
"@codemirror/lang-css": "^6.2.1",
"@codemirror/lang-javascript": "^6.2.1",
"@codemirror/lang-json": "^6.0.1",
"@codemirror/lang-markdown": "^6.2.0",
"@codemirror/language": "^6.8.0",
"@codemirror/lint": "^6.3.0",
"@codemirror/state": "^6.2.1",
"@codemirror/view": "^6.14.0",
"@codemirror/lang-markdown": "^6.2.3",
"@codemirror/language": "^6.9.3",
"@codemirror/lint": "^6.4.2",
"@codemirror/state": "^6.3.2",
"@codemirror/view": "^6.22.1",
"@jridgewell/sourcemap-codec": "^1.4.15",
"@lezer/highlight": "^1.1.6",
"@neocodemirror/svelte": "0.0.15",
"@lezer/highlight": "^1.2.0",
"@neocodemirror/svelte": "0.0.17",
"@replit/codemirror-lang-svelte": "^6.0.0",
"@replit/codemirror-vim": "^6.0.14",
"@replit/codemirror-vim": "^6.1.0",
"@rich_harris/svelte-split-pane": "^1.1.1",
"@rollup/browser": "^3.25.3",
"@rollup/browser": "^4.6.1",
"@sveltejs/site-kit": "5.2.2",
"acorn": "^8.9.0",
"acorn": "^8.11.2",
"codemirror": "^6.0.1",
"esm-env": "^1.0.0",
"estree-walker": "^3.0.3",
"marked": "^5.1.0",
"marked": "^11.0.0",
"resolve.exports": "^2.0.2",
"svelte-json-tree": "^2.0.0"
"svelte-json-tree": "^2.2.0"
}
}
2 changes: 1 addition & 1 deletion packages/repl/src/lib/Bundler.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export default class Bundler {
this.worker.postMessage({
uid,
type: 'bundle',
files,
files
});

uid += 1;
Expand Down
5 changes: 3 additions & 2 deletions packages/repl/src/lib/CodeMirror.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -260,10 +260,11 @@
lintOptions: { delay: 200 },
autocomplete,
extensions,
instanceStore: cmInstance
instanceStore: cmInstance,
documentId: 'id'
}}
on:codemirror:textChange={({ detail: value }) => {
code = value;
code = value ?? '';
dispatch('change', { value: code });
}}
>
Expand Down
4 changes: 2 additions & 2 deletions packages/repl/src/lib/Output/Output.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
}

if (file.type === 'md') {
markdown = marked(file.source);
markdown = await marked(file.source);
return;
}

Expand All @@ -71,7 +71,7 @@
if (/(js|json)/.test(selected.type)) return;

if (selected.type === 'md') {
markdown = marked(selected.source);
markdown = await marked(selected.source);
return;
}

Expand Down
8 changes: 6 additions & 2 deletions packages/repl/src/lib/workers/bundler/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/// <reference lib="webworker" />

import '../patch_window.js';

import { sleep } from '$lib/utils.js';
import { rollup } from '@rollup/browser';
import { DEV } from 'esm-env';
Expand All @@ -22,7 +23,7 @@ let svelte_url;
/** @type {number} */
let current_id;

/** @type {(...arg: never) => void} */
/** @type {(...arg: any[]) => void} */
let fulfil_ready;
const ready = new Promise((f) => {
fulfil_ready = f;
Expand Down Expand Up @@ -273,6 +274,7 @@ async function get_bundle(uid, mode, cache, local_files_lookup) {
// importing from another file in REPL
if (local_files_lookup.has(importee) && (!importer || local_files_lookup.has(importer)))
return importee;

if (local_files_lookup.has(importee + '.js')) return importee + '.js';
if (local_files_lookup.has(importee + '.json')) return importee + '.json';

Expand Down Expand Up @@ -405,7 +407,9 @@ async function get_bundle(uid, mode, cache, local_files_lookup) {
'process.env.NODE_ENV': JSON.stringify('production')
})
],
inlineDynamicImports: true,
output: {
inlineDynamicImports: true
},
onwarn(warning) {
all_warnings.push({
message: warning.message
Expand Down
1 change: 1 addition & 0 deletions packages/repl/src/lib/workers/patch_window.js
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
self.window = self; // hack for magic-sring and rollup inline sourcemaps
self.window.btoa = self.btoa; // hack to get rollup rolling
2 changes: 1 addition & 1 deletion packages/repl/src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
</script>

<main>
<Repl vim bind:this={repl} showAst autocomplete={true} previewTheme="dark" />
<Repl bind:this={repl} showAst autocomplete={true} previewTheme="dark" />
</main>

<style>
Expand Down
3 changes: 3 additions & 0 deletions packages/repl/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ const config = {
resolve: {
dedupe: ['@codemirror/state', '@codemirror/language', '@codemirror/view']
},
optimizeDeps: {
exclude: ['@rollup/browser']
},
server: {
fs: {
strict: false
Expand Down
Loading