Skip to content

Commit

Permalink
feat: wasm webcontainer
Browse files Browse the repository at this point in the history
  • Loading branch information
o-az committed Sep 11, 2024
1 parent 3202ad7 commit 6cdd3cd
Show file tree
Hide file tree
Showing 30 changed files with 3,464 additions and 202 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,16 @@ The upgradability of contracts on other chains, connections, token configuration
| [`evm`](./evm) | [EVM] smart contract stack | [Solidity] |
| [`app`](./app) | [app.union.build] | [TypeScript] [Svelte] |
| [`site`](./site) | [union.build] | [TypeScript] [Astro] |
| [`TypeScript SDK`](./typescript-sdk) | TypeScript SDK for interacting with Union | [TypeScript] |

## Quickstart

Install [Nix] to _[reproducibly build](https://en.wikipedia.org/wiki/Reproducible_builds) any component_, and to enter a dev shell with _all dependencies_:
```

```sh
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install
```

_(Note that some components can only be built on Linux. If you are using macOS, we recommend using [OrbStack] to easily set up a [NixOS] VM within two minutes. Most Union developers use macOS with [OrbStack], and there is no need to install Nix inside of the [NixOS] VM.)_

You can now _reproducibly_ build any of Union's components from source:
Expand All @@ -60,7 +63,7 @@ nix flake show

The result of whatever you build will be in `result/`

You can now also enter our dev shell, which has all of the dependencies (`cargo`, `rustc`, `node`, `go`, etc.) you need to work on any component:
You can now also enter our dev shell, which has all of the dependencies (`cargo`, `rustc`, `node`, `go`, etc.) you need to work on any component:
_(Don't worry, this will not affect your system outside of this repo)_

```sh
Expand Down
5 changes: 5 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@
"*.ts",
"*.mts",
"*.js",
"*.mjs",
"*.cjs",
"*.jsx",
"*.tsx",
"*.vue",
"*.css",
"*.d.ts",
"*.json",
"*.jsonc",
Expand Down Expand Up @@ -64,6 +66,7 @@
"*.tsx",
"*.d.ts",
"*.vue",
"*.css",
"*.json",
"*.jsonc",
"*.astro",
Expand Down Expand Up @@ -110,6 +113,7 @@
"*.ts",
"*.mts",
"*.js",
"*.mjs",
"*.cjs",
"*.jsx",
"*.tsx",
Expand Down Expand Up @@ -215,6 +219,7 @@
"*.ts",
"*.mts",
"*.js",
"*.mjs",
"*.cjs",
"*.jsx",
"*.tsx",
Expand Down
1 change: 1 addition & 0 deletions docs/.npmrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ auto-install-peers=true
enable-pre-post-scripts=true
strict-peer-dependencies=false
node-options="--no-warnings"
@jsr:registry=https://npm.jsr.io
3 changes: 3 additions & 0 deletions docs/_headers
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/*
Cross-Origin-Embedder-Policy: require-corp
Cross-Origin-Opener-Policy: same-origin
19 changes: 16 additions & 3 deletions docs/astro.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { loadEnv } from "vite"
import vue from "@astrojs/vue"
import svelte from "@astrojs/svelte"
import sitemap from "@astrojs/sitemap"
import tailwind from "@astrojs/tailwind"
Expand Down Expand Up @@ -27,7 +28,17 @@ export default defineConfig({
},
trailingSlash: "ignore",
markdown: markdownConfiguration,
server: _ => ({ port: Number(PORT) }),
server: _ => ({
port: Number(PORT),
/**
* required for webcointainer
* @see https://webcontainers.io/guides/quickstart
*/
headers: {
"Cross-Origin-Embedder-Policy": "require-corp",
"Cross-Origin-Opener-Policy": "same-origin"
}
}),
devToolbar: { enabled: ENABLE_DEV_TOOLBAR === "true" },
prefetch: { prefetchAll: true, defaultStrategy: "viewport" },
redirects: { "/logo": "/union-logo.zip" },
Expand Down Expand Up @@ -115,7 +126,7 @@ export default defineConfig({
},
{
label: "API",
collapsed: true,
collapsed: false,
autogenerate: {
directory: "/integrations/api"
}
Expand All @@ -139,17 +150,19 @@ export default defineConfig({
],
plugins: [starlightLinksValidator(), starlightHeadingBadges()],
customCss: [
"./src/styles/index.css",
"./src/styles/fonts.css",
"./src/styles/tailwind.css",
"./src/styles/starlight.css",
"./node_modules/katex/dist/katex.min.css"
]
}),
sitemap(),
tailwind({
applyBaseStyles: false,
configFile: "tailwind.config.ts"
}),
svelte(),
sitemap()
vue({ jsx: true, devtools: true })
]
})
2 changes: 1 addition & 1 deletion docs/docs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
{
packages = {
docs = mkCi false (unstablePkgs.buildNpmPackage {
npmDepsHash = "sha256-qpW7fsNOEi/dnb9QdXgIrhZguy4xgFGScLgp4cPJQls=";
npmDepsHash = "sha256-3Ip3T+Kfc5X2gZ/KzgLWTtfnQf7lCK+CsoTKwAB9ynw=";
src = ./.;
srcs = [ ./. ./../evm/. ./../networks/genesis/. ./../versions/. ];
sourceRoot = "docs";
Expand Down
9 changes: 6 additions & 3 deletions docs/ec.config.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { pluginLineNumbers } from "@expressive-code/plugin-line-numbers";
import { pluginCollapsibleSections } from "@expressive-code/plugin-collapsible-sections";

/** @type {import('@astrojs/starlight/expressive-code').StarlightExpressiveCodeOptions} */
Expand All @@ -8,9 +9,11 @@ export default {
showCopyToClipboardButton: true,
removeCommentsWhenCopyingTerminalFrames: true,
},
styleOverrides: {},
defaultProps: {
showLineNumbers: false,
},
useStarlightUiThemeColors: true,
useStarlightDarkModeSwitch: true,
themes: ["starlight-dark", "starlight-light"],
plugins: [pluginCollapsibleSections()],
themes: ["houston", "starlight-light"],
plugins: [pluginCollapsibleSections(), pluginLineNumbers()],
};
Loading

0 comments on commit 6cdd3cd

Please sign in to comment.