-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b4e297e
commit bc2d65e
Showing
11 changed files
with
510 additions
and
703 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,76 +1,93 @@ | ||
import svelte from 'rollup-plugin-svelte'; | ||
import commonjs from '@rollup/plugin-commonjs'; | ||
import resolve from '@rollup/plugin-node-resolve'; | ||
import livereload from 'rollup-plugin-livereload'; | ||
import { terser } from 'rollup-plugin-terser'; | ||
import css from 'rollup-plugin-css-only'; | ||
import svelte from "rollup-plugin-svelte"; | ||
import commonjs from "@rollup/plugin-commonjs"; | ||
import resolve from "@rollup/plugin-node-resolve"; | ||
import livereload from "rollup-plugin-livereload"; | ||
import { terser } from "rollup-plugin-terser"; | ||
import css from "rollup-plugin-css-only"; | ||
import json from "@rollup/plugin-json"; | ||
|
||
const production = !process.env.ROLLUP_WATCH; | ||
|
||
function serve() { | ||
let server; | ||
let server; | ||
|
||
function toExit() { | ||
if (server) server.kill(0); | ||
} | ||
function toExit() { | ||
if (server) server.kill(0); | ||
} | ||
|
||
return { | ||
writeBundle() { | ||
if (server) return; | ||
server = require('child_process').spawn('npm', ['run', 'start', '--', '--dev'], { | ||
stdio: ['ignore', 'inherit', 'inherit'], | ||
shell: true | ||
}); | ||
return { | ||
writeBundle() { | ||
if (server) return; | ||
server = require("child_process").spawn( | ||
"npm", | ||
["run", "start", "--", "--dev"], | ||
{ | ||
stdio: ["ignore", "inherit", "inherit"], | ||
shell: true, | ||
} | ||
); | ||
|
||
process.on('SIGTERM', toExit); | ||
process.on('exit', toExit); | ||
} | ||
}; | ||
process.on("SIGTERM", toExit); | ||
process.on("exit", toExit); | ||
}, | ||
}; | ||
} | ||
|
||
export default { | ||
input: 'src/main.js', | ||
output: { | ||
sourcemap: true, | ||
format: 'iife', | ||
name: 'app', | ||
file: 'public/build/bundle.js' | ||
}, | ||
plugins: [ | ||
svelte({ | ||
compilerOptions: { | ||
// enable run-time checks when not in production | ||
dev: !production | ||
} | ||
}), | ||
// we'll extract any component CSS out into | ||
// a separate file - better for performance | ||
css({ output: 'bundle.css' }), | ||
export default [ | ||
{ | ||
input: "src/other.js", | ||
output: { | ||
sourcemap: true, | ||
format: "iife", | ||
name: "app", | ||
file: "public/build/other.js", | ||
}, | ||
plugins: [json()], | ||
}, | ||
{ | ||
input: "src/main.js", | ||
output: { | ||
sourcemap: true, | ||
format: "iife", | ||
name: "app", | ||
file: "public/build/bundle.js", | ||
}, | ||
plugins: [ | ||
svelte({ | ||
compilerOptions: { | ||
// enable run-time checks when not in production | ||
dev: !production, | ||
}, | ||
}), | ||
// we'll extract any component CSS out into | ||
// a separate file - better for performance | ||
css({ output: "bundle.css" }), | ||
|
||
// If you have external dependencies installed from | ||
// npm, you'll most likely need these plugins. In | ||
// some cases you'll need additional configuration - | ||
// consult the documentation for details: | ||
// https://github.com/rollup/plugins/tree/master/packages/commonjs | ||
resolve({ | ||
browser: true, | ||
dedupe: ['svelte'] | ||
}), | ||
commonjs(), | ||
// If you have external dependencies installed from | ||
// npm, you'll most likely need these plugins. In | ||
// some cases you'll need additional configuration - | ||
// consult the documentation for details: | ||
// https://github.com/rollup/plugins/tree/master/packages/commonjs | ||
resolve({ | ||
browser: true, | ||
dedupe: ["svelte"], | ||
}), | ||
commonjs(), | ||
|
||
// In dev mode, call `npm run start` once | ||
// the bundle has been generated | ||
!production && serve(), | ||
// In dev mode, call `npm run start` once | ||
// the bundle has been generated | ||
!production && serve(), | ||
|
||
// Watch the `public` directory and refresh the | ||
// browser on changes when not in production | ||
!production && livereload('public'), | ||
// Watch the `public` directory and refresh the | ||
// browser on changes when not in production | ||
!production && livereload("public"), | ||
|
||
// If we're building for production (npm run build | ||
// instead of npm run dev), minify | ||
production && terser() | ||
], | ||
watch: { | ||
clearScreen: false | ||
} | ||
}; | ||
// If we're building for production (npm run build | ||
// instead of npm run dev), minify | ||
production && terser(), | ||
], | ||
watch: { | ||
clearScreen: false, | ||
}, | ||
}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import * as Entry from "../../eyg/build/dev/javascript/eyg/dist/eyg/entry.mjs"; | ||
import * as Encode from "../../eyg/build/dev/javascript/eyg/dist/eyg/ast/encode.mjs"; | ||
|
||
// Roll up adds a default object that breaks matchings | ||
import data from "../public/saved.json"; | ||
// This is not generic has because we have the server or maybe not. this is the arbitrary script pull | ||
// let target = new URL(document.currentScript.src).hash.slice(1); | ||
// console.log(target, Analysis); | ||
|
||
(async function name() { | ||
const source = Encode.from_json(data); | ||
const initial = Entry.interpret_client(source, "counter"); | ||
console.log(initial); | ||
const { default: next } = await import("../public/saved.json"); | ||
console.log(Encode.from_json(data)); | ||
})(); | ||
|
||
// Started doing this because the code gen was troublesome, also in code gen we will nee to pull in the loader | ||
// here we have can use the already existing gleam .run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import gleam/io | ||
import gleam/string | ||
import eyg/ast/encode | ||
import eyg/ast/expression as e | ||
import eyg/interpreter/effectful | ||
// TODO need an effectful version that allows us to access stuff here | ||
import eyg/interpreter/tail_call | ||
import gleam/javascript/array | ||
import eyg/interpreter/interpreter as r | ||
import eyg/analysis | ||
import eyg/typer | ||
import eyg/typer/monotype as t | ||
import eyg/editor/editor | ||
|
||
fn update(page, interrupt, display, on_click) { | ||
|
||
io.debug(page) | ||
display(page) | ||
|
||
} | ||
|
||
|
||
fn b(args) { | ||
Ok(r.Binary("done")) | ||
} | ||
// uses default builtin that need moving out of effectful | ||
// has an entry point key should eventually be a hash | ||
// maybe rename interpret standard | ||
// builtin is always the same but env things are passed in | ||
// All the runtime stuff is in gleam terms | ||
// TODO are there any gleam helpers to turn tuples into things | ||
pub fn interpret_client(source, key, display, on_click) { | ||
io.debug("hooo") | ||
let init = e.access(e.access(source, key), "init") | ||
io.debug(init) | ||
let #(typed, typer) = analysis.infer(init, t.Unbound(-1), []) | ||
io.debug("---- typed") | ||
let #(xtyped, typer) = typer.expand_providers(typed, typer, []) | ||
// assert Ok(term) = effectful.eval(editor.untype(xtyped)) | ||
// io.debug(term) | ||
|> io.debug | ||
// effectful.eval_call(r.BuiltinFn(b), term, effectful.real_log) | ||
// |> io.debug | ||
// // TODO make an AST the requires rendering | ||
// term | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters