-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8944 from jolicode/feat/fix-vercel-and-wasm
feat(vercel): add wrapper for generated wasm, adapt vercel middleware with new wrapper
- Loading branch information
Showing
5 changed files
with
87 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"name": "@redirection.io/redirectionio", | ||
"collaborators": [ | ||
"Joel Wurtz <jwurtz@redirection.io>" | ||
], | ||
"description": "Redirection IO Library to handle matching rule, redirect and filtering headers and body.", | ||
"version": "2.11.8", | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/redirectionio/libredirectionio" | ||
}, | ||
"files": [ | ||
"wasm/redirectionio.d.ts", | ||
"wasm/redirectionio.js", | ||
"wasm/redirectionio_bg.js", | ||
"wasm/redirectionio_bg.wasm", | ||
"wasm/redirectionio_bg.wasm.d.ts", | ||
"redirectionio.js", | ||
"redirectionio.d.ts" | ||
], | ||
"module": "redirectionio.js", | ||
"types": "redirectionio.d.ts" | ||
} |
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,3 @@ | ||
export * from './wasm/redirectionio'; | ||
|
||
export function init(instantiate?: () => Promise<WebAssembly.Instance>): Promise<void>; |
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,36 @@ | ||
import * as redirectionio from './wasm/redirectionio_bg.js'; | ||
import wasmModule from './wasm/redirectionio_bg.wasm?module'; | ||
|
||
export * from './wasm/redirectionio_bg.js'; | ||
|
||
function getImports() { | ||
const imports = {"./redirectionio_bg.js": {}}; | ||
|
||
for (const functionName of Object.keys(redirectionio)) { | ||
if (functionName.startsWith("__") && functionName !== "__wbg_set_wasm") { | ||
imports["./redirectionio_bg.js"][functionName] = redirectionio[functionName]; | ||
} | ||
} | ||
|
||
return imports; | ||
} | ||
|
||
let loadedModule = null; | ||
|
||
export async function init(instantiate) { | ||
if (loadedModule) { | ||
return; | ||
} | ||
|
||
if (!instantiate) { | ||
instantiate = async () => { | ||
return await WebAssembly.instantiate(wasmModule, getImports()); | ||
}; | ||
} | ||
|
||
const module = await instantiate(); | ||
|
||
redirectionio.__wbg_set_wasm(module.exports); | ||
loadedModule = module; | ||
redirectionio.init_log(); | ||
} |
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,21 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "es5", | ||
"module": "commonjs", | ||
"lib": [ | ||
"es2020", | ||
"DOM" | ||
], | ||
"allowJs": true, | ||
"skipLibCheck": true, | ||
"strict": true, | ||
"noEmit": true, | ||
"strictNullChecks": true, | ||
"esModuleInterop": true, | ||
"moduleResolution": "bundler", | ||
"resolveJsonModule": true, | ||
"isolatedModules": true, | ||
"jsx": "preserve", | ||
"incremental": true | ||
} | ||
} |