35 |
43 |
44 | setCode(code)}
47 | highlight={code => highlight(code, goSyntax, 'go')}
48 | padding={10}
49 | style={{
50 | fontFamily: '"Fira code", "Fira Mono", monospace',
51 | fontSize: 12
52 | }}
53 | />
54 |
55 |
56 |
59 |
60 |
68 |
75 |
76 |
77 |
78 | )
79 | }
80 |
81 | export default Index
82 |
--------------------------------------------------------------------------------
/postcss.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | plugins: {
3 | tailwindcss: {},
4 | autoprefixer: {}
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/public/FiraCode-Regular.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zackradisic/go-playground-wasm/9b10f9789f531bc56185be71e57ff94ef9383983/public/FiraCode-Regular.woff
--------------------------------------------------------------------------------
/public/FiraCode-Regular.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zackradisic/go-playground-wasm/9b10f9789f531bc56185be71e57ff94ef9383983/public/FiraCode-Regular.woff2
--------------------------------------------------------------------------------
/public/stdlib.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zackradisic/go-playground-wasm/9b10f9789f531bc56185be71e57ff94ef9383983/public/stdlib.zip
--------------------------------------------------------------------------------
/public/wasm.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zackradisic/go-playground-wasm/9b10f9789f531bc56185be71e57ff94ef9383983/public/wasm.wasm
--------------------------------------------------------------------------------
/styles/global.css:
--------------------------------------------------------------------------------
1 | /* ./styles/globals.css */
2 | @tailwind base;
3 | @tailwind components;
4 | @tailwind utilities;
5 | html,
6 | body,
7 | body > div:first-child,
8 | div#__next,
9 | div#__next > div {
10 | height: 100%;
11 | }
12 | /*
13 | @font-face {
14 | font-family: 'Fira Code';
15 | src: url('woff2/FiraCode-Light.woff2') format('woff2'),
16 | url("woff/FiraCode-Light.woff") format("woff");
17 | font-weight: 300;
18 | font-style: normal;
19 | } */
20 |
21 | @font-face {
22 | font-family: 'Fira Code';
23 | src: url('/FiraCode-Regular.woff2') format('woff2'),
24 | url("/FiraCode-Regular.woff") format("woff");
25 | font-weight: 400;
26 | font-style: normal;
27 | }
28 | /*
29 | @font-face {
30 | font-family: 'Fira Code';
31 | src: url('woff2/FiraCode-Medium.woff2') format('woff2'),
32 | url("woff/FiraCode-Medium.woff") format("woff");
33 | font-weight: 500;
34 | font-style: normal;
35 | }
36 |
37 | @font-face {
38 | font-family: 'Fira Code';
39 | src: url('woff2/FiraCode-SemiBold.woff2') format('woff2'),
40 | url("woff/FiraCode-SemiBold.woff") format("woff");
41 | font-weight: 600;
42 | font-style: normal;
43 | }
44 |
45 | @font-face {
46 | font-family: 'Fira Code';
47 | src: url('woff2/FiraCode-Bold.woff2') format('woff2'),
48 | url("woff/FiraCode-Bold.woff") format("woff");
49 | font-weight: 700;
50 | font-style: normal;
51 | }
52 |
53 | @font-face {
54 | font-family: 'Fira Code VF';
55 | src: url('woff2/FiraCode-VF.woff2') format('woff2-variations'),
56 | url('woff/FiraCode-VF.woff') format('woff-variations');
57 | font-weight: 300 700;
58 | font-style: normal;
59 | } */
60 |
--------------------------------------------------------------------------------
/tailwind.config.js:
--------------------------------------------------------------------------------
1 | const colors = require('tailwindcss/colors')
2 |
3 | module.exports = {
4 | purge: ['**/*.tsx'],
5 | mode: 'jit',
6 | darkMode: false, // or 'media' or 'class'
7 | theme: {
8 | extend: {
9 | colors: {
10 | orange: colors.orange,
11 | coolGray: colors.coolGray,
12 | blueGray: colors.blueGray
13 | }
14 | },
15 | fontFamily: {
16 | sans: ['Fira code', 'Fira Mono', 'monospace']
17 | }
18 | },
19 | variants: {
20 | extend: {}
21 | },
22 | plugins: [require('@tailwindcss/aspect-ratio')]
23 | }
24 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "allowJs": true,
4 | "alwaysStrict": true,
5 | "esModuleInterop": true,
6 | "forceConsistentCasingInFileNames": true,
7 | "isolatedModules": true,
8 | "jsx": "preserve",
9 | "lib": ["dom", "es2017"],
10 | "module": "esnext",
11 | "moduleResolution": "node",
12 | "noEmit": true,
13 | "noFallthroughCasesInSwitch": true,
14 | "noUnusedLocals": true,
15 | "noUnusedParameters": true,
16 | "resolveJsonModule": true,
17 | "skipLibCheck": true,
18 | "strict": true,
19 | "target": "esnext",
20 | "baseUrl": ".",
21 | "paths": {
22 | "@styles*": ["styles*"],
23 | "@components*": ["components*"],
24 | "@type*": ["type*"],
25 | "@utils*": ["utils*"]
26 | }
27 | },
28 | "exclude": ["node_modules", "goscript/"],
29 | "include": ["**/*.ts", "**/*.tsx"]
30 | }
31 |
--------------------------------------------------------------------------------
/type/types.ts:
--------------------------------------------------------------------------------
1 | export type WasmRunFn = (pathPtr: number) => number
2 | export type WasmAlloc = (size: number) => number
3 | export type WasmDealloc = (ptr: number) => number
4 |
--------------------------------------------------------------------------------