Download next.js/packages/next/src/build/webpack/loaders/next-middleware-wasm-loader.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 600 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/packages/next/src/build/webpack/loaders/next-middleware-wasm-loader.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/next.js/packages/next/src/build/webpack/loaders/next-middleware-wasm-loader.ts
-
curl -L -o next-middleware-wasm-loader.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/packages/next/src/build/webpack/loaders/next-middleware-wasm-loader.ts
600 Bytes
| import { getModuleBuildInfo } from './get-module-build-info' | |
| import crypto from 'crypto' | |
| function sha1(source: string | Buffer) { | |
| return crypto.createHash('sha1').update(source).digest('hex') | |
| } | |
| export default function MiddlewareWasmLoader(this: any, source: Buffer) { | |
| const name = `wasm_${sha1(source)}` | |
| const filePath = `edge-chunks/${name}.wasm` | |
| const buildInfo = getModuleBuildInfo(this._module) | |
| buildInfo.nextWasmMiddlewareBinding = { filePath: `server/${filePath}`, name } | |
| this.emitFile(`/${filePath}`, source, null) | |
| return `module.exports = ${name};` | |
| } | |
| export const raw = true | |