mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
This test is about `eval` But it also used a non-static middleware `matchers` config, which is going to break once we are more strict about this and throw a build error.
35 lines
932 B
JavaScript
35 lines
932 B
JavaScript
import { notUsingEval, usingEval } from '../../lib/utils'
|
|
import {
|
|
usingWebAssemblyCompile,
|
|
usingWebAssemblyInstantiate,
|
|
usingWebAssemblyInstantiateWithBuffer,
|
|
} from '../../lib/wasm'
|
|
|
|
export default async function handler(request) {
|
|
const useCase = request.nextUrl.searchParams.get('case')
|
|
|
|
if (useCase === 'using-eval') {
|
|
return Response.json(await usingEval())
|
|
}
|
|
|
|
if (useCase === 'not-using-eval') {
|
|
return Response.json(await notUsingEval())
|
|
}
|
|
|
|
if (useCase === 'using-webassembly-compile') {
|
|
return Response.json(await usingWebAssemblyCompile(9))
|
|
}
|
|
|
|
if (useCase === 'using-webassembly-instantiate') {
|
|
return Response.json(await usingWebAssemblyInstantiate(9))
|
|
}
|
|
|
|
if (useCase === 'using-webassembly-instantiate-with-buffer') {
|
|
return Response.json(await usingWebAssemblyInstantiateWithBuffer(9))
|
|
}
|
|
|
|
return Response.json({ ok: true })
|
|
}
|
|
|
|
export const config = { runtime: 'edge' }
|