diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f33f26a8..c246b03e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -72,6 +72,12 @@ jobs: npm run build npm run test npm run build:production + if [ "/output/ignored/" != "$(cat public/frame.html | grep '/\1/;')" ]; then + echo "client/public/frame.html's 'base' element refers to the wrong path" + echo "Run 'npm run base:production' in the 'client' dir, and push the update as a commit" + echo "CI will fail until then" + exit 1 + fi - name: Build client assets if: github.event_name == 'release' diff --git a/CHANGELOG.md b/CHANGELOG.md index 36d46714..107b1972 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,16 @@ Notable changes to this project are documented in this file. The format is based ## [Unreleased] +Breaking changes: + +New features: + +Bugfixes: + +Other improvements: + +## [v2022-02-25.1](https://github.com/purescript/trypurescript/releases/tag/v2022-02-25.1) + Breaking changes: - Update compiler to v0.14.7 (#271 by @JordanMartinez) diff --git a/README.md b/README.md index 0ffda87b..6dfe478c 100644 --- a/README.md +++ b/README.md @@ -96,15 +96,15 @@ ln -s "$PWD/output" "$PWD/../client/public/js/output" cd client npm install -# Use `build:dev` if you are using a local Try PureScript server, e.g. you -# followed the instructions in step 1. +# Use `build:dev` and `base:dev` if you are using a local Try PureScript server, +# e.g. you followed the instructions in step 1. # -# Use `build:production` if you would like to test the client against the production -# Try PureScript server. +# Use `build:production` and `base:production` if you would like +# to test the client against the production Try PureScript server. npm run build:(dev|production) +npm run base:(dev|production) -cd public -npx http-server # Try PureScript is now available on localhost:8080 +npm run serve # Try PureScript is now available on localhost:8080 ``` ### 4. Choosing a Tag diff --git a/RELEASE.md b/RELEASE.md index 8f264c9e..55430624 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -39,3 +39,21 @@ Update the package set by doing the following: ``` $ spago ls packages | cut -f 1 -d ' ' | xargs spago install ``` + +4. If any packages need NPM dependencies, you can try adding their shims to the import map in `client/public/frame.html` + - Open up the `generator.jspm.io` URL in the comment + - Use the 'Add Dependency' search bar to find the NPM dependency + - If it exists but doesn't exist in that CDN, you can try another one or [open an issue on `jspm/project`](https://github.com/jspm/project#issue-queue-for-the-jspm-cdn) + - Update the version to the one you need once added + - If needed, include other files from that dependency + - Copy and paste the content into the `client/public/frame.html` file + - Ensure `es-module-shims` has version `1.5.5` or greater. + +5. If `es-module-shims` releases a new version, you can calculate its SHA-384 via + + ```console + $ ESM_VERSION=1.5.5 + $ curl -L -o es-module-shims.js "https://ga.jspm.io/npm:es-module-shims@$ESM_VERSION/dist/es-module-shims.js" + $ echo "sha384-$(openssl dgst -sha384 -binary es-module-shims.js | openssl base64 -A)" + $ rm es-module-shims.js + ``` diff --git a/client/config/dev/Try.Config.purs b/client/config/dev/Try.Config.purs index e81be3b2..598d3358 100644 --- a/client/config/dev/Try.Config.purs +++ b/client/config/dev/Try.Config.purs @@ -2,9 +2,6 @@ module Try.Config where import Prelude -loaderUrl :: String -loaderUrl = "js/output" - compileUrl :: String compileUrl = "http://localhost:8081" diff --git a/client/config/prod/Try.Config.purs b/client/config/prod/Try.Config.purs index 936b4b10..9a353f08 100644 --- a/client/config/prod/Try.Config.purs +++ b/client/config/prod/Try.Config.purs @@ -2,9 +2,6 @@ module Try.Config where import Prelude -loaderUrl :: String -loaderUrl = "https://compile.purescript.org/output" - compileUrl :: String compileUrl = "https://compile.purescript.org" diff --git a/client/package.json b/client/package.json index fc071535..7a325df7 100644 --- a/client/package.json +++ b/client/package.json @@ -3,12 +3,18 @@ "private": true, "scripts": { "clean": "rimraf output", + "base:dev": "node setBase.mjs \"dev\"", + "base:production": "node setBase.mjs \"prod\"", "test": "spago test --path config/dev/Try.Config.purs", "build": "spago build --path config/dev/Try.Config.purs", "build:dev": "spago bundle-app --path config/dev/Try.Config.purs --to public/js/index.js", - "build:production": "spago bundle-app --path config/prod/Try.Config.purs --purs-args '--censor-lib --strict' --to public/js/index.js" + "build:production": "spago bundle-app --path config/prod/Try.Config.purs --purs-args '--censor-lib --strict' --to public/js/index.js", + "serve": "http-server public/ -o / --cors=\"Access-Control-Allow-Origin: *\" -c-1", + "serve:dev": "npm run build:dev && npm run base:dev && npm run serve", + "serve:production": "npm run build:production && npm run base:production && npm run serve" }, "devDependencies": { + "http-server": "^14.1.0", "purescript": "^0.13.6", "purescript-psa": "^0.7.3", "rimraf": "^2.5.4", diff --git a/client/public/frame.html b/client/public/frame.html index ba347939..6b91dc85 100644 --- a/client/public/frame.html +++ b/client/public/frame.html @@ -5,9 +5,49 @@ - + + + + + + + + + + -
+
diff --git a/client/public/js/frame.js b/client/public/js/frame.js index f0d0a6ff..0efe6dfe 100644 --- a/client/public/js/frame.js +++ b/client/public/js/frame.js @@ -1,42 +1,18 @@ (function() { - function evalSources(sources) { - var modules = {}; - function dirname(str) { - var ix = str.lastIndexOf("/"); - return ix < 0 ? "" : str.slice(0, ix); - } - function resolvePath(a, b) { - if (b[0] === "." && b[1] === "/") { - return dirname(a) + b.slice(1); - } - if (b[0] === "." && b[1] === "." && b[2] === "/") { - return dirname(dirname(a)) + b.slice(2); - } - return b; - } - return function load(name) { - if (modules[name]) { - return modules[name].exports; - } - function require(path) { - return load(resolvePath(name, path)); - } - var module = modules[name] = { exports: {} }; - new Function("module", "exports", "require", sources[name])(module, module.exports, require); - return module.exports; - }; - } - var parent; document.addEventListener("DOMContentLoaded", function() { window.addEventListener("message", function(event) { parent = event.source; parent.postMessage("trypurescript", "*"); - var file = evalSources(event.data)(""); - if (file.main && typeof file.main === "function") { - file.main(); - } + const code = ` + ${event.data.code} + main(); + `; + const scriptEl = document.createElement("script"); + scriptEl.type = "module"; + scriptEl.appendChild(document.createTextNode(code)); + document.body.appendChild(scriptEl); }, { once: true }); }, { once: true }); diff --git a/client/setBase.mjs b/client/setBase.mjs new file mode 100644 index 00000000..25583195 --- /dev/null +++ b/client/setBase.mjs @@ -0,0 +1,28 @@ +#!/usr/bin/env node + +import path from "path"; +import fs from "fs"; +import process from "process"; + +const filePath = path.join("public", "frame.html"); + +// PureScript generates JS with the following import lines: +// `import * as Data_Foo from "../Data.Foo/index.js" +// To remap `../Data.Foo/index.js` to `output/Data.Foo/index.js` +// we append `/ignored/`. +// +// This: `/output/ignored/../Data.Foo/index.js` +// becomes: `/output/Data.Foo/index.js` +const prodPath = "/output/ignored/" +const devPath = "/js/output/ignored/" + +const environment = process.argv[2] || "dev"; +const baseHref = environment === "prod" ? prodPath : devPath; + +const frameHtml = fs.readFileSync(filePath, "utf-8"); +const newHtml = frameHtml + .split("\n") + .map((line) => line.replace(/^( * do let anns = Array.mapMaybe (toAnnotation MarkerWarning) warnings_ _ <- H.query _editor unit $ H.tell $ Editor.SetAnnotations anns pure unit - case eitherSources of - Right sources -> do - let eventData = Object.insert "" (JS js) sources - H.liftAff $ makeAff \f -> do - runEffectFn3 setupIFrame eventData (f (Right unit)) (f (Left $ Aff.error "Could not load iframe")) - mempty - H.modify_ _ { compiled = Just (Right res) } - Left err -> do - H.liftEffect teardownIFrame - H.liftEffect $ error err - H.modify_ _ { compiled = Just (Left err) } + let + eventData = { code: js } + H.liftEffect teardownIFrame + H.liftAff $ makeAff \f -> do + runEffectFn3 setupIFrame eventData (f (Right unit)) (f (Left $ Aff.error "Could not load iframe")) + mempty + H.modify_ _ { compiled = Just (Right res) } HandleEditor (Editor.TextChanged text) -> do _ <- H.fork $ handleAction $ Cache text diff --git a/client/src/Try/Loader.purs b/client/src/Try/Loader.purs deleted file mode 100644 index 9d38695f..00000000 --- a/client/src/Try/Loader.purs +++ /dev/null @@ -1,143 +0,0 @@ -module Try.Loader - ( Loader - , makeLoader - , runLoader - ) where - -import Prelude - -import Control.Bind (bindFlipped) -import Control.Monad.Except (ExceptT, throwError) -import Control.Parallel (parTraverse) -import Data.Array (foldMap) -import Data.Array as Array -import Data.Array.NonEmpty as NonEmpty -import Data.Maybe (Maybe(..), fromMaybe) -import Data.Newtype (unwrap) -import Data.String (Pattern(..), joinWith) -import Data.String as String -import Data.String.Regex (Regex) -import Data.String.Regex as Regex -import Data.String.Regex.Flags (noFlags) -import Data.String.Regex.Unsafe (unsafeRegex) -import Data.Tuple (Tuple(..)) -import Effect (Effect) -import Effect.Aff (Aff) -import Effect.Class (liftEffect) -import Effect.Ref (Ref) -import Effect.Ref as Ref -import Effect.Unsafe (unsafePerformEffect) -import Foreign.Object (Object) -import Foreign.Object as Object -import Try.API as API -import Try.Shim (shims) -import Try.Types (JS(..)) - -type Module = - { name :: String - , path :: Maybe String - , deps :: Array Dependency - , src :: JS - } - -type Dependency = - { name :: String - , path :: Maybe String - } - -requireRegex :: Regex -requireRegex = unsafeRegex """^(?:const|var)\s+\S+\s*=\s*require\(["']([^"']*)["']\)""" noFlags - -dirname :: String -> String -dirname path = fromMaybe "" do - ix <- String.lastIndexOf (Pattern "/") path - pure $ String.take ix path - -resolvePath :: String -> String -> Maybe String -resolvePath a b - | String.take 2 b == "./" = Just $ dirname a <> String.drop 1 b - | String.take 3 b == "../" = Just $ dirname (dirname a) <> String.drop 2 b - | otherwise = Nothing - -parseDeps :: String -> JS -> Array Dependency -parseDeps current = Array.mapMaybe go <<< String.split (Pattern "\n") <<< unwrap - where - go :: String -> Maybe Dependency - go line = do - match <- Regex.match requireRegex line - requirePath <- join $ NonEmpty.index match 1 - pure $ case resolvePath current requirePath of - Just path -> - { name: path - , path: String.stripPrefix (Pattern "/") path - } - _ -> - { name: requirePath - , path: Nothing - } - -newtype Loader = Loader (JS -> ExceptT String Aff (Object JS)) - -runLoader :: Loader -> JS -> ExceptT String Aff (Object JS) -runLoader (Loader k) = k - -makeLoader :: String -> Loader -makeLoader rootPath = Loader (go Object.empty <<< parseDeps "") - where - moduleCache :: Ref (Object Module) - moduleCache = unsafePerformEffect (Ref.new Object.empty) - - putModule :: String -> Module -> Effect Unit - putModule a b = Ref.modify_ (Object.insert a b) moduleCache - - getModule :: String -> Effect (Maybe Module) - getModule a = Object.lookup a <$> Ref.read moduleCache - - load :: Dependency -> ExceptT String Aff Module - load { name, path } = do - cached <- liftEffect $ getModule name - case cached of - Just mod -> pure mod - Nothing -> do - mod <- - case path of - Just path' -> do - srcStr <- API.get (rootPath <> "/" <> path') - let src = JS $ srcStr <> "\n//# sourceURL=" <> path' - pure { name, path, deps: parseDeps name src, src } - Nothing -> case Object.lookup name shims of - Just shim -> do - srcStr <- API.get shim.url - let - src = JS $ srcStr <> "\n//# sourceURL=" <> shim.url - deps = { name: _, path: Nothing } <$> shim.deps - pure { name, path, deps, src } - Nothing -> - throwError (missingFFIDep name) - liftEffect $ putModule name mod - pure mod - - missingFFIDep :: String -> String - missingFFIDep name = - joinWith "\n" $ - [ "Compilation succeeded, but the following FFI dependency is missing:" - , " - " <> name - , "" - , "We don't provide FFI shims for all libraries; for example, Node libraries are not supported on Try PureScript." - , "If you would like to suggest a new FFI shim be supported, please open an issue." - ] - - go :: Object JS -> Array Dependency -> ExceptT String Aff (Object JS) - go ms [] = pure ms - go ms deps = do - modules <- parTraverse load deps - let - ms' = - modules - # map (\{ name, src } -> Tuple name src) - # Object.fromFoldable - # Object.union ms - modules - # bindFlipped _.deps - # Array.nubBy (comparing _.name) - # go ms' diff --git a/client/src/Try/Shim.purs b/client/src/Try/Shim.purs deleted file mode 100644 index b6608b78..00000000 --- a/client/src/Try/Shim.purs +++ /dev/null @@ -1,39 +0,0 @@ -module Try.Shim where - -import Data.Tuple (Tuple(..)) -import Foreign.Object (Object) -import Foreign.Object as Object - -type Shim = - { url :: String - , deps :: Array String - } - -shims :: Object Shim -shims = Object.fromFoldable - [ Tuple "react" - { url: "https://unpkg.com/react@16.13.1/umd/react.development.js" - , deps: [] - } - , Tuple "react-dom" - { url: "https://unpkg.com/react-dom@16.13.1/umd/react-dom.development.js" - , deps: [ "react" ] - } - , Tuple "react-dom/server" - { url: "https://unpkg.com/react-dom@16.13.1/umd/react-dom-server.browser.development.js" - , deps: [ "react" ] - } - , Tuple "big-integer" - { url: "https://unpkg.com/big-integer@1.6.48/BigInteger.min.js" - , deps: [] - } - , Tuple "decimal.js" - { url: "https://unpkg.com/decimal.js@10.2.0/decimal.min.js" - , deps: [] - } - , Tuple "uuid" - { url: "https://cdnjs.cloudflare.com/ajax/libs/uuid/8.1.0/uuid.min.js" - , deps: [] - } - ] - diff --git a/server/Main.hs b/server/Main.hs index c3beddab..8434aa32 100644 --- a/server/Main.hs +++ b/server/Main.hs @@ -80,6 +80,7 @@ buildMakeActions codegenRef = progress readCacheDb writeCacheDb + writePackageJson outputPrimDocs where getInputTimestampsAndHashes :: P.ModuleName -> Make.Make (Either Make.RebuildPolicy (M.Map FilePath (UTCTime, Make.Make Cache.ContentHash))) @@ -110,6 +111,9 @@ buildMakeActions codegenRef = writeCacheDb :: Cache.CacheDb -> Make.Make () writeCacheDb _ = pure () + writePackageJson :: Make.Make () + writePackageJson = pure () + outputPrimDocs :: Make.Make () outputPrimDocs = pure () diff --git a/stack.yaml b/stack.yaml index ebed98dc..4be775d7 100644 --- a/stack.yaml +++ b/stack.yaml @@ -3,9 +3,11 @@ packages: - "." extra-deps: - - purescript-0.14.7 - - purescript-cst-0.5.0.0 + - purescript-0.15.2 - language-javascript-0.7.0.0 + - monoidal-containers-0.6.2.0 + - process-1.6.13.1 + - Cabal-3.2.1.0 flags: aeson-pretty: diff --git a/stack.yaml.lock b/stack.yaml.lock index 51ea3ced..05765018 100644 --- a/stack.yaml.lock +++ b/stack.yaml.lock @@ -5,19 +5,12 @@ packages: - completed: - hackage: purescript-0.14.7@sha256:8ae1f75de055c63d9dc43e646c98b92cca860ac7fc74b65c11d8e5007abfc37c,18677 + hackage: purescript-0.15.2@sha256:c269f5e8ca70a49e45345d9d1e60c47c32b5bd1e87073224cefd22f5273ce164,20150 pantry-tree: - size: 135286 - sha256: 11941b228ff6e91d4c565a7bfb9a0aabe10797a3cbae9336a44798adb7aeb74f + size: 148972 + sha256: 4526fbe5158eedb966b56626873bdc5a46fd0ab9cd8835c35d48365f5e9caa87 original: - hackage: purescript-0.14.7 -- completed: - hackage: purescript-cst-0.5.0.0@sha256:ac1935d9aa9cd99ec388255b35943b277b08bb5e36bf72ebb781b70e50862b6d,3851 - pantry-tree: - size: 3018 - sha256: 2ecc0a787d279fd0eb9e511cf1854d71c3ecc088054049614137fa27945bcd7f - original: - hackage: purescript-cst-0.5.0.0 + hackage: purescript-0.15.2 - completed: hackage: language-javascript-0.7.0.0@sha256:3eab0262b8ac5621936a4beab6a0f97d0e00a63455a8b0e3ac1547b4088dae7d,3898 pantry-tree: @@ -25,6 +18,27 @@ packages: sha256: b0f28d836cb3fbde203fd7318a896c3a20acd8653a905e1950ae2d9a64bccebf original: hackage: language-javascript-0.7.0.0 +- completed: + hackage: monoidal-containers-0.6.2.0@sha256:124941d70df5e2928b4c6db605a1d0464e68c2c6b02e426db24a40194d43821d,2219 + pantry-tree: + size: 569 + sha256: 07ceac751866bad09af45df7d0ae97420d659221e8a0d85407705dcda1f6e89b + original: + hackage: monoidal-containers-0.6.2.0 +- completed: + hackage: process-1.6.13.1@sha256:c8bb8b7c993ff72d771381b3b56852dd154bce51880a24789c11f57b0688d353,2963 + pantry-tree: + size: 1543 + sha256: 58117b15fa330c79b3bca6b29c65f815e45840f79cc0915d3434f25e54ac8fa5 + original: + hackage: process-1.6.13.1 +- completed: + hackage: Cabal-3.2.1.0@sha256:8743076ec022296f9771d962000c9ca3a0fe02e68c37b992c63e382a675f791d,27482 + pantry-tree: + size: 41224 + sha256: 92682a2aab8d967de341acff88525376eb9a31f53f094e0878c51c2886564f3a + original: + hackage: Cabal-3.2.1.0 snapshots: - completed: size: 586286 diff --git a/staging/packages.dhall b/staging/packages.dhall index f921381a..f9039b01 100644 --- a/staging/packages.dhall +++ b/staging/packages.dhall @@ -1,5 +1,5 @@ let upstream = - https://github.com/purescript/package-sets/releases/download/psc-0.14.5-20220224/packages.dhall - sha256:67cc3d4f0e8fb72bb1413ba94ddd72a3ceb0783eb725e3b22ad7568b3b581163 + https://github.com/purescript/package-sets/releases/download/psc-0.15.2-20220531/packages.dhall + sha256:278d3608439187e51136251ebf12fabda62d41ceb4bec9769312a08b56f853e3 in upstream diff --git a/staging/spago.dhall b/staging/spago.dhall index 21495641..168c1740 100644 --- a/staging/spago.dhall +++ b/staging/spago.dhall @@ -1,20 +1,21 @@ { name = "try-purescript-server" , dependencies = - [ "abides" - , "ace" + [ "ace" , "aff" , "aff-bus" , "aff-coroutines" , "aff-promise" , "aff-retry" , "affjax" - , "amazons" + , "affjax-node" + , "affjax-web" , "ansi" , "argonaut" , "argonaut-codecs" , "argonaut-core" , "argonaut-generic" , "argonaut-traversals" + , "argparse-basic" , "arraybuffer" , "arraybuffer-builder" , "arraybuffer-types" @@ -23,49 +24,21 @@ , "ask" , "assert" , "avar" - , "aws-encryption-sdk" - , "aws-sdk-basic" , "b64" , "barlow-lens" - , "basic-auth" , "bifunctors" , "bigints" - , "bip39" - , "biscotti-cookie" - , "biscotti-session" , "bower-json" - , "boxes" - , "bucketchain" - , "bucketchain-basic-auth" - , "bucketchain-conditional" - , "bucketchain-cors" - , "bucketchain-csrf" - , "bucketchain-header-utils" - , "bucketchain-health" - , "bucketchain-history-api-fallback" - , "bucketchain-logger" - , "bucketchain-secure" - , "bucketchain-simple-api" - , "bucketchain-sslify" - , "bucketchain-static" - , "bytestrings" , "call-by-name" , "canvas" , "canvas-action" , "cartesian" , "catenable-lists" , "channel" - , "channel-stream" , "checked-exceptions" - , "cheerio" - , "cirru-parser" - , "classnames" - , "clipboardy" , "codec" , "codec-argonaut" , "colors" - , "concur-core" - , "concur-react" , "concurrent-queues" , "console" , "const" @@ -73,43 +46,27 @@ , "control" , "convertable-options" , "coroutines" - , "crypto" , "css" - , "cssom" , "datetime" + , "datetime-parsing" , "debug" , "decimals" - , "dexie" , "dissect" , "distributive" , "dodo-printer" - , "dom-filereader" , "dom-indexed" - , "dotenv" - , "downloadjs" - , "drawing" , "droplet" , "dynamic-buffer" - , "easy-ffi" , "effect" , "either" - , "elasticsearch" - , "elmish" - , "elmish-enzyme" - , "elmish-hooks" - , "elmish-html" , "email-validate" , "encoding" , "enums" - , "envparse" - , "errors" , "exceptions" , "exists" , "exitcodes" , "expect-inferred" - , "express" , "fast-vect" - , "ffi-foreign" , "filterable" , "fixed-points" , "fixed-precision" @@ -117,13 +74,11 @@ , "float32" , "foldable-traversable" , "foreign" - , "foreign-generic" , "foreign-object" + , "foreign-readwrite" , "fork" , "form-urlencoded" - , "format" , "formatters" - , "framer-motion" , "free" , "freeap" , "freet" @@ -131,41 +86,30 @@ , "functors" , "fuzzy" , "gen" + , "generate-values" , "geometry-plane" , "github-actions-toolkit" - , "gl-matrix" - , "gomtang-basic" - , "grain" - , "grain-router" - , "grain-virtualized" - , "graphql-client" - , "graphqlclient" , "graphs" - , "grid-reactors" , "group" , "halogen" - , "halogen-bootstrap4" , "halogen-css" , "halogen-formless" , "halogen-hooks" , "halogen-hooks-extra" - , "halogen-select" , "halogen-store" , "halogen-storybook" , "halogen-subscriptions" - , "halogen-svg-elems" , "halogen-vdom" + , "halogen-vdom-string-renderer" , "heckin" , "heterogeneous" , "heterogeneous-extrablatt" - , "homogeneous" , "http-methods" , "httpure" - , "httpure-contrib-biscotti" + , "httpurple" , "identity" - , "identy" , "indexed-monad" - , "inflection" + , "int64" , "integers" , "interpolate" , "invariant" @@ -175,24 +119,20 @@ , "js-uri" , "justifill" , "jwt" - , "kafkajs" + , "language-cst-parser" , "lazy" , "lcg" , "leibniz" + , "linalg" , "lists" - , "literals" , "logging" - , "longs" , "machines" - , "makkori" - , "math" , "matrices" , "matryoshka" , "maybe" , "media-types" , "metadata" , "midi" - , "milkis" , "minibench" , "mmorph" , "monad-control" @@ -202,8 +142,6 @@ , "monoidal" , "morello" , "motsunabe" - , "mysql" - , "nano-id" , "naturals" , "nested-functor" , "newtype" @@ -211,17 +149,14 @@ , "node-child-process" , "node-fs" , "node-fs-aff" - , "node-he" , "node-http" , "node-net" , "node-path" - , "node-postgres" , "node-process" , "node-readline" - , "node-sqlite3" , "node-streams" + , "node-streams-aff" , "node-url" - , "nodemailer" , "nonempty" , "now" , "npm-package-json" @@ -229,29 +164,18 @@ , "numbers" , "open-folds" , "open-memoize" - , "open-mkdirp-aff" , "open-pairing" - , "option" , "options" - , "options-extra" - , "optparse" , "ordered-collections" , "ordered-set" , "orders" - , "owoify" , "pairs" , "parallel" , "parsing" , "parsing-dataview" - , "parsing-expect" - , "parsing-repetition" - , "parsing-replace" - , "parsing-validation" , "partial" , "pathy" - , "payload" - , "phaser" - , "phoenix" + , "pha" , "pipes" , "point-free" , "polymorphic-vectors" @@ -259,19 +183,16 @@ , "precise" , "precise-datetime" , "prelude" - , "prettier" , "prettier-printer" - , "pretty-logs" , "profunctor" , "profunctor-lenses" - , "promises" , "protobuf" , "ps-cst" , "psa-utils" , "psc-ide" , "psci-support" + , "qualified-do" , "quantities" - , "queue" , "quickcheck" , "quickcheck-combinators" , "quickcheck-laws" @@ -279,24 +200,12 @@ , "quotient" , "random" , "rationals" - , "rave" , "react" , "react-basic" - , "react-basic-classic" - , "react-basic-dnd" , "react-basic-dom" - , "react-basic-emotion" - , "react-basic-hooks" , "react-dom" - , "react-enzyme" - , "react-halo" - , "react-queue" - , "react-testing-library" , "read" , "record" - , "record-extra" - , "record-extra-srghma" - , "redux-devtools" , "refined" , "refs" , "remotedata" @@ -307,93 +216,58 @@ , "ring-modules" , "routing" , "routing-duplex" - , "row-extra" , "run" - , "run-external-state" - , "rxps" , "safe-coerce" , "safely" - , "scrypt" , "selection-foldable" , "semirings" - , "server-sent-events" - , "setimmediate" , "signal" - , "simple-ajax" , "simple-emitter" - , "simple-i18n" - , "simple-json" - , "simple-jwt" - , "simple-ulid" , "sized-matrices" , "sized-vectors" , "slug" - , "snabbdom" - , "sodium" , "soundfonts" , "sparse-matrices" , "sparse-polynomials" , "spec" , "spec-discovery" - , "spec-mocha" , "spec-quickcheck" - , "spork" + , "ssrs" , "st" , "strictlypositiveint" , "string-parsers" , "strings" , "strings-extra" , "stringutils" - , "subcategory" , "substitute" - , "subtlecrypto" - , "suggest" - , "sunde" , "supply" - , "systemd-journald" , "tailrec" , "test-unit" - , "text-encoding" , "thermite" , "thermite-dom" , "these" - , "toppokki" , "transformers" , "tree-rose" , "tuples" - , "turf" , "two-or-more" , "type-equality" - , "typedenv" , "typelevel" - , "typelevel-arithmetic" , "typelevel-lists" , "typelevel-peano" , "typelevel-prelude" , "typelevel-rows" , "uint" - , "ulid" - , "undefinable" - , "undefined" - , "undefined-is-not-a-problem" - , "undefined-or" + , "uncurried-transformers" , "unfoldable" , "unicode" - , "unordered-collections" - , "unorm" + , "unlift" , "unsafe-coerce" , "unsafe-reference" - , "untagged-to-tagged" - , "untagged-union" , "uri" - , "url-regex-safe" - , "uuid" , "validation" , "variant" , "vectorfield" - , "veither" , "versions" - , "vexceptt" , "web-clipboard" , "web-cssom" , "web-dom" @@ -404,22 +278,19 @@ , "web-fetch" , "web-file" , "web-html" + , "web-page-visibility" + , "web-pointerevents" , "web-promise" - , "web-resize-observer" , "web-socket" - , "web-speech" , "web-storage" , "web-streams" , "web-touchevents" , "web-uievents" - , "web-url" + , "web-workers" , "web-xhr" - , "which" - , "yaml-next" - , "yargs" - , "zeta" - , "zeta-extra" - , "zipperarray" + , "yoga-fetch" + , "yoga-json" + , "yoga-postgres" ] , packages = ./packages.dhall , sources = [ "src/**/*.purs" ] diff --git a/staging/src/TryPureScript.js b/staging/src/TryPureScript.js index 98800074..e3fce1af 100644 --- a/staging/src/TryPureScript.js +++ b/staging/src/TryPureScript.js @@ -1,12 +1,14 @@ -"use strict"; - -exports.setInnerHTML = function(html) { +export function setInnerHTML(html) { return function() { - document.body.innerHTML += html; + const el = document.getElementById("main"); + if (!el) { + throw new Error("Error with TryPureScript. The 'client/public/frame.html' file should have an element with id: \"main\""); + } + el.innerHTML += html; }; -}; +} -exports.withConsoleImpl = function(f) { +export function withConsoleImpl(f) { return function() { var oldLog = console.log; var oldError = console.error; @@ -34,4 +36,4 @@ exports.withConsoleImpl = function(f) { return lines; }; -}; +} diff --git a/trypurescript.cabal b/trypurescript.cabal index 9894408a..0e54ac31 100644 --- a/trypurescript.cabal +++ b/trypurescript.cabal @@ -27,7 +27,6 @@ executable trypurescript Glob -any, scotty -any, purescript, - purescript-cst, containers -any, http-types -any, transformers -any,