This repository has been archived by the owner on Oct 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
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
c53c591
commit 39640c3
Showing
65 changed files
with
258 additions
and
2 deletions.
There are no files selected for viewing
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,30 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Rockstar in WASM</title> | ||
<style> | ||
textarea, pre { | ||
width: 100%; | ||
font-family: Consolas, monospace; | ||
border: 1px solid #000; | ||
min-height: 100px; | ||
font-size: 16px; | ||
padding: 8px; | ||
box-sizing: border-box; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<h1>A Rockstar Interpreter in WASM</h1> | ||
<h2>Source:</h2> | ||
<textarea id="source">shout "hello world" | ||
</textarea> | ||
<input id="runButton" type="button" value="Run" /> | ||
<h2>Output:</h2> | ||
<pre id="output"></pre> | ||
</pre> | ||
<script src="wasm.js" type="module"> | ||
|
||
</script> | ||
</body> | ||
</html> |
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,24 @@ | ||
import { dotnet } from '/wasm/wwwroot/_framework/dotnet.js' | ||
|
||
const { setModuleImports, getAssemblyExports, getConfig } = await dotnet | ||
.withDiagnosticTracing(false) | ||
.withApplicationArgumentsFromQuery() | ||
.create(); | ||
|
||
const config = getConfig(); | ||
const exports = await getAssemblyExports(config.mainAssemblyName); | ||
await dotnet.run(); | ||
var runButton = document.getElementById("runButton"); | ||
var sourceTextArea = document.getElementById("source"); | ||
var outputPre = document.getElementById("output"); | ||
|
||
runButton.addEventListener("click", function() { | ||
var source = sourceTextArea.value; | ||
console.log(source); | ||
try { | ||
var result = exports.Rockstar.Wasm.RockstarRunner.Run(source); | ||
outputPre.innerText = result; | ||
} catch(e) { | ||
outputPre.innerText = e; | ||
} | ||
}); |
42 changes: 42 additions & 0 deletions
42
codewithrockstar.com/wasm/Rockstar.Wasm.runtimeconfig.json
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,42 @@ | ||
{ | ||
"runtimeOptions": { | ||
"tfm": "net8.0", | ||
"includedFrameworks": [ | ||
{ | ||
"name": "Microsoft.NETCore.App", | ||
"version": "8.0.7" | ||
} | ||
], | ||
"wasmHostProperties": { | ||
"perHostConfig": [ | ||
{ | ||
"name": "browser", | ||
"host": "browser" | ||
} | ||
] | ||
}, | ||
"configProperties": { | ||
"Microsoft.Extensions.DependencyInjection.VerifyOpenGenericServiceTrimmability": true, | ||
"System.AggressiveAttributeTrimming": true, | ||
"System.ComponentModel.TypeConverter.EnableUnsafeBinaryFormatterInDesigntimeLicenseContextSerialization": false, | ||
"System.Diagnostics.Debugger.IsSupported": false, | ||
"System.Diagnostics.Tracing.EventSource.IsSupported": false, | ||
"System.Globalization.Invariant": true, | ||
"System.Globalization.PredefinedCulturesOnly": true, | ||
"System.Net.Http.EnableActivityPropagation": false, | ||
"System.Reflection.Metadata.MetadataUpdater.IsSupported": false, | ||
"System.Reflection.NullabilityInfoContext.IsSupported": false, | ||
"System.Resources.ResourceManager.AllowCustomResourceTypes": false, | ||
"System.Resources.UseSystemResourceKeys": true, | ||
"System.Runtime.InteropServices.BuiltInComInterop.IsSupported": false, | ||
"System.Runtime.InteropServices.EnableConsumingManagedCodeFromNativeHosting": false, | ||
"System.Runtime.InteropServices.EnableCppCLIHostActivation": false, | ||
"System.Runtime.InteropServices.Marshalling.EnableGeneratedComInterfaceComImportInterop": false, | ||
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false, | ||
"System.StartupHookProvider.IsSupported": false, | ||
"System.Text.Encoding.EnableUnsafeUTF7Encoding": false, | ||
"System.Text.Json.JsonSerializer.IsReflectionEnabledByDefault": false, | ||
"System.Threading.Thread.EnableAutoreleasePool": 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"wasmHostProperties": { | ||
"perHostConfig": [ | ||
{ | ||
"name": "browser", | ||
"host": "browser" | ||
} | ||
] | ||
} | ||
} |
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,44 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<configuration> | ||
<system.webServer> | ||
<staticContent> | ||
<remove fileExtension=".blat" /> | ||
<remove fileExtension=".dat" /> | ||
<remove fileExtension=".dll" /> | ||
<remove fileExtension=".webcil" /> | ||
<remove fileExtension=".json" /> | ||
<remove fileExtension=".wasm" /> | ||
<remove fileExtension=".woff" /> | ||
<remove fileExtension=".woff2" /> | ||
<mimeMap fileExtension=".blat" mimeType="application/octet-stream" /> | ||
<mimeMap fileExtension=".dll" mimeType="application/octet-stream" /> | ||
<mimeMap fileExtension=".webcil" mimeType="application/octet-stream" /> | ||
<mimeMap fileExtension=".dat" mimeType="application/octet-stream" /> | ||
<mimeMap fileExtension=".json" mimeType="application/json" /> | ||
<mimeMap fileExtension=".wasm" mimeType="application/wasm" /> | ||
<mimeMap fileExtension=".woff" mimeType="application/font-woff" /> | ||
<mimeMap fileExtension=".woff2" mimeType="application/font-woff" /> | ||
</staticContent> | ||
<httpCompression> | ||
<dynamicTypes> | ||
<add mimeType="application/octet-stream" enabled="true" /> | ||
<add mimeType="application/wasm" enabled="true" /> | ||
</dynamicTypes> | ||
</httpCompression> | ||
<rewrite> | ||
<rules> | ||
<rule name="Serve subdir"> | ||
<match url=".*" /> | ||
<action type="Rewrite" url="wwwroot\{R:0}" /> | ||
</rule> | ||
<rule name="SPA fallback routing" stopProcessing="true"> | ||
<match url=".*" /> | ||
<conditions logicalGrouping="MatchAll"> | ||
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> | ||
</conditions> | ||
<action type="Rewrite" url="wwwroot\" /> | ||
</rule> | ||
</rules> | ||
</rewrite> | ||
</system.webServer> | ||
</configuration> |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+2.6 KB
codewithrockstar.com/wasm/wwwroot/_framework/System.Collections.wasm.br
Binary file not shown.
Binary file added
BIN
+2.91 KB
codewithrockstar.com/wasm/wwwroot/_framework/System.Collections.wasm.gz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+8.27 KB
codewithrockstar.com/wasm/wwwroot/_framework/System.Diagnostics.TraceSource.wasm
Binary file not shown.
Binary file added
BIN
+3.59 KB
codewithrockstar.com/wasm/wwwroot/_framework/System.Diagnostics.TraceSource.wasm.br
Binary file not shown.
Binary file added
BIN
+4 KB
codewithrockstar.com/wasm/wwwroot/_framework/System.Diagnostics.TraceSource.wasm.gz
Binary file not shown.
Binary file added
BIN
+4.27 KB
codewithrockstar.com/wasm/wwwroot/_framework/System.Linq.Expressions.wasm
Binary file not shown.
Binary file added
BIN
+1.41 KB
codewithrockstar.com/wasm/wwwroot/_framework/System.Linq.Expressions.wasm.br
Binary file not shown.
Binary file added
BIN
+1.59 KB
codewithrockstar.com/wasm/wwwroot/_framework/System.Linq.Expressions.wasm.gz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+945 KB
codewithrockstar.com/wasm/wwwroot/_framework/System.Private.CoreLib.wasm
Binary file not shown.
Binary file added
BIN
+314 KB
codewithrockstar.com/wasm/wwwroot/_framework/System.Private.CoreLib.wasm.br
Binary file not shown.
Binary file added
BIN
+380 KB
codewithrockstar.com/wasm/wwwroot/_framework/System.Private.CoreLib.wasm.gz
Binary file not shown.
Binary file added
BIN
+28.8 KB
codewithrockstar.com/wasm/wwwroot/_framework/System.Runtime.InteropServices.JavaScript.wasm
Binary file not shown.
Binary file added
BIN
+11.8 KB
...ithrockstar.com/wasm/wwwroot/_framework/System.Runtime.InteropServices.JavaScript.wasm.br
Binary file not shown.
Binary file added
BIN
+13.5 KB
...ithrockstar.com/wasm/wwwroot/_framework/System.Runtime.InteropServices.JavaScript.wasm.gz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+213 KB
codewithrockstar.com/wasm/wwwroot/_framework/System.Text.RegularExpressions.wasm
Binary file not shown.
Binary file added
BIN
+83.7 KB
codewithrockstar.com/wasm/wwwroot/_framework/System.Text.RegularExpressions.wasm.br
Binary file not shown.
Binary file added
BIN
+100 KB
codewithrockstar.com/wasm/wwwroot/_framework/System.Text.RegularExpressions.wasm.gz
Binary file not shown.
34 changes: 34 additions & 0 deletions
34
codewithrockstar.com/wasm/wwwroot/_framework/blazor.boot.json
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,34 @@ | ||
{ | ||
"mainAssemblyName": "Rockstar.Wasm", | ||
"resources": { | ||
"hash": "sha256-SpSq2QbwQmg/j1y5jWzff4XQm6/EFalxfte3cDJuIkM=", | ||
"jsModuleNative": { | ||
"dotnet.native.8.0.7.xhyoor67pm.js": "sha256-1k6bcrS4MgkZNRphPacvYZq5VfAhOqAIEwrGJUzyydA=" | ||
}, | ||
"jsModuleRuntime": { | ||
"dotnet.runtime.8.0.7.urcsr75yt5.js": "sha256-soZyw6XWXOLKhA26AOyzSpCP5cAsw1wvhdPHSYNTMfQ=" | ||
}, | ||
"wasmNative": { | ||
"dotnet.native.wasm": "sha256-nPJc70WzLZNN2jkBuF9OUu4AmCh8yOJK7yypx/UFvAo=" | ||
}, | ||
"assembly": { | ||
"netstandard.wasm": "sha256-uq25ZvhoKtVHJOv9ajFhuamTvw38wLURg2hmblDtnm0=", | ||
"Pegasus.Common.wasm": "sha256-xSlRrX2nMn5SrIR3xGrPOzgDC+qXmmspahL0S6RY4MY=", | ||
"Rockstar.Engine.wasm": "sha256-yyLKXaRoxjW49q2i98AzgYLPqYSn8t+9qsD6BgyYjoY=", | ||
"Rockstar.Wasm.wasm": "sha256-vKqdP1BwvIYMwlRbchBr6sVRd5IvFeDWl/H6EN2YejE=", | ||
"System.Collections.wasm": "sha256-RZKT1wortBCb29GdjtlJA6uYPylFAZKkmIn9/UFU64w=", | ||
"System.Console.wasm": "sha256-yz+imPPmqM1nwL65iUzBOQcfnvZnGkdxvM55Ev5IvSU=", | ||
"System.Diagnostics.TraceSource.wasm": "sha256-qCITXq4k5eMAtY/TJygflctfz+WbYV07bqAqXoLgBkc=", | ||
"System.Linq.Expressions.wasm": "sha256-m+NHI0HBpQfOUXdOAbjX+k14QfOQmn5t+HiHlz1gXek=", | ||
"System.Linq.wasm": "sha256-69JfjMpq/LvToz/SaVAfbnoXB3LHL5vAda12x0N2L0o=", | ||
"System.Private.CoreLib.wasm": "sha256-eBSqHYAMWFJL0GeqqkeBujF9lXNFbveAKHTIi4xfC0Q=", | ||
"System.Runtime.InteropServices.JavaScript.wasm": "sha256-7/0IqBEqaX1BeMKtgJQ1x3hmHk5BaCC9VSdGhqpaOSc=", | ||
"System.Runtime.wasm": "sha256-q87HuWRNfdsIyuU7imlbeOP9FFklpguqVVClpS0ZqtA=", | ||
"System.Text.RegularExpressions.wasm": "sha256-qBclGbmt/JTu9aSXE2bRLQxI8tiJ86zDyAj7ZZdiTMo=" | ||
} | ||
}, | ||
"cacheBootResources": true, | ||
"debugLevel": 0, | ||
"linkerEnabled": true, | ||
"globalizationMode": "invariant" | ||
} |
Binary file not shown.
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
17 changes: 17 additions & 0 deletions
17
codewithrockstar.com/wasm/wwwroot/_framework/dotnet.native.8.0.7.xhyoor67pm.js
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file added
BIN
+29.4 KB
codewithrockstar.com/wasm/wwwroot/_framework/dotnet.native.8.0.7.xhyoor67pm.js.br
Binary file not shown.
Binary file added
BIN
+33.9 KB
codewithrockstar.com/wasm/wwwroot/_framework/dotnet.native.8.0.7.xhyoor67pm.js.gz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
4 changes: 4 additions & 0 deletions
4
codewithrockstar.com/wasm/wwwroot/_framework/dotnet.runtime.8.0.7.urcsr75yt5.js
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file added
BIN
+53.1 KB
codewithrockstar.com/wasm/wwwroot/_framework/dotnet.runtime.8.0.7.urcsr75yt5.js.br
Binary file not shown.
Binary file added
BIN
+63.8 KB
codewithrockstar.com/wasm/wwwroot/_framework/dotnet.runtime.8.0.7.urcsr75yt5.js.gz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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,29 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Rockstar.Wasm</title> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
</head> | ||
<body> | ||
<textarea rows="20" cols="72" id="source">shout "hello world" | ||
shout 1 + 2 + 3 | ||
shout "foo" plus "bar"</textarea> | ||
<br /> | ||
<button id="run">Run</button> | ||
<pre id="output"></pre> | ||
<script type="module"> | ||
import { RunRockstarProgram } from './main.js'; | ||
const textarea = document.getElementById('source'); | ||
document.getElementById("run").addEventListener('click', () => { | ||
let source = document.getElementById('source').value; | ||
try { | ||
let result = RunRockstarProgram(source); | ||
document.getElementById('output').textContent = result; | ||
} catch (err) { | ||
document.getElementById('output').textContent = err; | ||
} | ||
}); | ||
</script> | ||
</body> | ||
</html> |
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,15 @@ | ||
import { dotnet } from './_framework/dotnet.js' | ||
|
||
const { setModuleImports, getAssemblyExports, getConfig } = await dotnet | ||
.withDiagnosticTracing(false) | ||
.withApplicationArgumentsFromQuery() | ||
.create(); | ||
|
||
const config = getConfig(); | ||
const exports = await getAssemblyExports(config.mainAssemblyName); | ||
console.log(exports); | ||
await dotnet.run(); | ||
|
||
export function RunRockstarProgram(source) { | ||
return exports.Rockstar.Wasm.RockstarRunner.Run(source); | ||
} |