A repo for my personal website
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Switch to no modules build type

+42 -30
+1 -1
build.bat
··· 1 1 @echo off 2 - wasm-pack build --target web 2 + wasm-pack build --target no-modules 3 3 del pkg\.gitignore 4 4 pause
+5 -4
index.html
··· 12 12 <script src="scripts/modernizr.js"></script> 13 13 </head> 14 14 <body> 15 - <script type="module"> 16 - import init from './pkg/cbf_site.js'; 15 + <script src="pkg/cbf_site.js"></script> 16 + <script> 17 + const init = wasm_bindgen; 17 18 18 19 async function run() { 19 - await init(); 20 + await wasm_bindgen('./pkg/cbf_site.wasm'); 20 21 } 21 22 22 - run() 23 + run(); 23 24 </script> 24 25 </body> 25 26 </html>
+15 -12
pkg/cbf_site.d.ts
··· 1 - /* tslint:disable */ 2 - /* eslint-disable */ 3 - /** 4 - * @param {string} name 5 - */ 6 - export function greet(name: string): void; 7 - /** 8 - */ 9 - export function main(): void; 1 + declare namespace wasm_bindgen { 2 + /* tslint:disable */ 3 + /* eslint-disable */ 4 + /** 5 + * @param {string} name 6 + */ 7 + export function greet(name: string): void; 8 + /** 9 + */ 10 + export function main(): void; 11 + 12 + } 10 13 11 - export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; 14 + declare type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; 12 15 13 - export interface InitOutput { 16 + declare interface InitOutput { 14 17 readonly memory: WebAssembly.Memory; 15 18 readonly greet: (a: number, b: number) => void; 16 19 readonly main: () => void; ··· 28 31 * 29 32 * @returns {Promise<InitOutput>} 30 33 */ 31 - export default function init (module_or_path?: InitInput | Promise<InitInput>): Promise<InitOutput>; 34 + declare function wasm_bindgen (module_or_path?: InitInput | Promise<InitInput>): Promise<InitOutput>;
+19 -10
pkg/cbf_site.js
··· 1 - 2 - let wasm; 1 + let wasm_bindgen; 2 + (function() { 3 + const __exports = {}; 4 + let wasm; 3 5 4 - const heap = new Array(32).fill(undefined); 6 + const heap = new Array(32).fill(undefined); 5 7 6 - heap.push(undefined, null, true, false); 8 + heap.push(undefined, null, true, false); 7 9 8 10 function getObject(idx) { return heap[idx]; } 9 11 ··· 103 105 /** 104 106 * @param {string} name 105 107 */ 106 - export function greet(name) { 108 + __exports.greet = function(name) { 107 109 var ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); 108 110 var len0 = WASM_VECTOR_LEN; 109 111 wasm.greet(ptr0, len0); 110 - } 112 + }; 111 113 112 114 /** 113 115 */ 114 - export function main() { 116 + __exports.main = function() { 115 117 wasm.main(); 116 - } 118 + }; 117 119 118 120 function isLikeNone(x) { 119 121 return x === undefined || x === null; ··· 160 162 161 163 async function init(input) { 162 164 if (typeof input === 'undefined') { 163 - input = new URL('cbf_site_bg.wasm', import.meta.url); 165 + let src; 166 + if (typeof document === 'undefined') { 167 + src = location.href; 168 + } else { 169 + src = document.currentScript.src; 170 + } 171 + input = src.replace(/\.js$/, '_bg.wasm'); 164 172 } 165 173 const imports = {}; 166 174 imports.wbg = {}; ··· 255 263 return wasm; 256 264 } 257 265 258 - export default init; 266 + wasm_bindgen = Object.assign(init, __exports); 259 267 268 + })();
+2 -3
pkg/package.json
··· 15 15 "cbf_site.js", 16 16 "cbf_site.d.ts" 17 17 ], 18 - "module": "cbf_site.js", 19 - "types": "cbf_site.d.ts", 20 - "sideEffects": false 18 + "browser": "cbf_site.js", 19 + "types": "cbf_site.d.ts" 21 20 }