Skip to content

Commit

Permalink
fix lot of errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Zwiterrion committed Feb 8, 2024
1 parent aa4b413 commit e5a687a
Show file tree
Hide file tree
Showing 9 changed files with 88 additions and 23 deletions.
19 changes: 11 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,25 @@ ENV PATH="/root/.cargo/bin:${PATH}"
# Add wasm-unknown-unknown target
RUN rustup target add wasm32-unknown-unknown

# RUN apt-get install binaryen

ARG TARGETPLATFORM
RUN if [ "$TARGETPLATFORM" = "linux/arm64" ]; then \
wget https://github.com/tinygo-org/tinygo/releases/download/v0.30.0/tinygo_0.30.0_arm64.deb; \
dpkg -i tinygo_0.27.0_arm64.deb; \
curl -L -O "https://github.com/extism/js-pdk/releases/download/v1.0.0-rc6/extism-js-aarch64-linux-v1.0.0-rc6.gz"; \
dpkg -i tinygo_0.30.0_arm64.deb; \
# curl -L -O "https://github.com/extism/js-pdk/releases/download/v1.0.0-rc6/extism-js-aarch64-linux-v1.0.0-rc6.gz"; \
else \
wget https://github.com/tinygo-org/tinygo/releases/download/v0.30.0/tinygo_0.30.0_amd64.deb; \
dpkg -i tinygo_0.27.0_amd64.deb; \
curl -L -O "https://github.com/extism/js-pdk/releases/download/v1.0.0-rc6/extism-js-x86_64-linux-v1.0.0-rc6.gz"; \
dpkg -i tinygo_0.30.0_amd64.deb; \
# curl -L -O "https://github.com/extism/js-pdk/releases/download/v1.0.0-rc6/extism-js-x86_64-linux-v1.0.0-rc6.gz"; \
fi

RUN gunzip extism-js*.gz
RUN mv extism-js-* /usr/local/bin/extism-js
RUN chmod +x /usr/local/bin/extism-js
# RUN gunzip extism-js*.gz
# RUN mv extism-js-* /usr/local/bin/extism-js
# RUN chmod +x /usr/local/bin/extism-js

RUN apt-get install binaryen
COPY install.sh install.sh
RUN sh install.sh

RUN curl https://get.wasmer.io -sSfL | sh

Expand Down
54 changes: 54 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
set -e

OS=''
case `uname` in
Darwin*) OS="macos" ;;
Linux*) OS="linux" ;;
*) echo "unknown os: $OSTYPE" && exit 1 ;;
esac

ARCH=`uname -m`
case "$ARCH" in
ix86*|x86_64*) ARCH="x86_64" ;;
arm64*|aarch64*) ARCH="aarch64" ;;
*) echo "unknown arch: $ARCH" && exit 1 ;;
esac

export TAG="v1.0.0-rc6"
export BINARYEN_TAG="version_116"

curl -L -O "https://github.com/extism/js-pdk/releases/download/$TAG/extism-js-$ARCH-$OS-$TAG.gz"

gunzip extism-js*.gz
mv extism-js-* /usr/local/bin/extism-js
chmod +x /usr/local/bin/extism-js

if ! which "wasm-merge" > /dev/null; then
echo "Installing wasm-merge..."

# binaryen use arm64 instead where as extism-js uses aarch64 for release file naming
case "$ARCH" in
aarch64*) ARCH="arm64" ;;
esac

# matches the case where the user installs extism-pdk in a Linux-based Docker image running on mac m1
# binaryen didn't have arm64 release file for linux
if [ $ARCH = "arm64" ] && [ $OS = "linux" ]; then
ARCH="x86_64"
fi

echo "https://github.com/WebAssembly/binaryen/releases/download/$BINARYEN_TAG/binaryen-$BINARYEN_TAG-$ARCH-$OS.tar.gz"

curl -L -O "https://github.com/WebAssembly/binaryen/releases/download/$BINARYEN_TAG/binaryen-$BINARYEN_TAG-$ARCH-$OS.tar.gz"
tar xf "binaryen-$BINARYEN_TAG-$ARCH-$OS.tar.gz"
mv "binaryen-$BINARYEN_TAG"/ binaryen/
mkdir /usr/local/binaryen
mv binaryen/bin/wasm-merge /usr/local/binaryen/wasm-merge
ln -s /usr/local/binaryen/wasm-merge /usr/local/bin/wasm-merge

mv binaryen/bin/wasm-opt /usr/local/binaryen/wasm-opt
ln -s /usr/local/binaryen/wasm-opt /usr/local/bin/wasm-opt

else
echo "wasm-merge already installed"
fi
Binary file modified server/templates/rust.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion server/templates/rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ edition = "2021"
wasi = false

[dependencies]
extism-pdk = "0.1.1"
extism-pdk = "1.0.1"
serde = "1.0.152"
serde_json = "1.0.91"

Expand Down
1 change: 0 additions & 1 deletion server/templates/rust/build.sh

This file was deleted.

1 change: 0 additions & 1 deletion server/templates/rust/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
mod types;

use extism_pdk::*;
use std::collections::HashMap;

#[plugin_fn]
pub fn execute(Json(_context): Json<types::WasmAccessValidatorContext>) -> FnResult<Json<types::WasmAccessValidatorResponse>> {
Expand Down
16 changes: 10 additions & 6 deletions ui/src/FileManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,16 @@ function File({ newFilename, filename, content, ext, onClick, ...props }) {
'lib.rs',
'main.go',
'esbuild.js',
'config.js'
].includes(filename) && < i className='fa-solid fa-times me-2'
onClick={e => {
e.stopPropagation()
props.removeFile(filename)
}} />}
'config.js',
'stderr.log',
'stdout.log'
].includes(filename) && <span className='me-2' onClick={e => {
e.stopPropagation()
props.removeFile(filename)
}} >
<i className='fa-solid fa-times'
/>
</span>}
</div>}
</button>
}
Expand Down
6 changes: 4 additions & 2 deletions ui/src/TabsManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,10 +227,12 @@ function TabButton({ filename, onClick, selected, closeTab }) {
}}
onClick={onClick}>
{filename}
<i className='fa-solid fa-times fa-sm ms-1' onClick={e => {
<span className='ms-1' onClick={e => {
e.stopPropagation();
closeTab(filename)
}} />
}} >
<i className='fa-solid fa-times fa-sm' />
</span>
</button>
}

Expand Down
12 changes: 8 additions & 4 deletions ui/src/Terminal.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,14 @@ function Terminal({ sizeTerminal, toggleResizingTerminal, changeTerminalSize, se
<span>Terminal</span>
</div>
<div className='d-flex align-items-center'>
<i className='fa-solid ban fa-sm me-3' style={{ cursor: 'pointer' }}
onClick={() => setContent('')} />
<i className='fa-solid fa-times fa-sm' style={{ cursor: 'pointer' }}
onClick={() => changeTerminalSize(0)} />
<span className='me-3' onClick={() => setContent('')} >
<i className='fa-solid fa-ban fa-sm' style={{ cursor: 'pointer' }}
/>
</span>
<span onClick={() => changeTerminalSize(0)} >
<i className='fa-solid fa-times fa-sm' style={{ cursor: 'pointer' }}
/>
</span>
</div>
</div>

Expand Down

0 comments on commit e5a687a

Please sign in to comment.