This repository was archived by the owner on Jul 6, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +19
-12
lines changed Expand file tree Collapse file tree 4 files changed +19
-12
lines changed Original file line number Diff line number Diff line change 11import type { Plugin } from 'aleph/types.d.ts'
22
33export default < Plugin > {
4- name : 'wasm -loader' ,
4+ name : 'json -loader' ,
55 setup : aleph => {
6- aleph . onLoad ( / \. w a s m $ / i, async ( { specifier } ) => {
6+ aleph . onLoad ( / \. j s o n $ / i, async ( { specifier } ) => {
77 const { content } = await aleph . fetchModule ( specifier )
88 return {
9- code : [
10- `const wasmBytes = new Uint8Array([${ content . join ( ',' ) } ])` ,
11- 'const wasmModule = new WebAssembly.Module(wasmBytes)' ,
12- 'const { exports } = new WebAssembly.Instance(wasmModule)' ,
13- 'export default exports' ,
14- ] . join ( '\n' )
9+ code : `export default = ` + new TextDecoder ( ) . decode ( content )
1510 }
1611 } )
1712 }
Original file line number Diff line number Diff line change 1+ {}
Original file line number Diff line number Diff line change 1- import type { APIHandler } from 'aleph/types.d.ts'
1+ import type { APIHandler , APIContext } from 'aleph/types.d.ts'
2+ import data from './data.json'
23
3- export const handler : APIHandler = ( { response } ) => {
4+ const create = async (
5+ { response } : APIContext ,
6+ db : string ,
7+ ) => {
48 const count = parseInt ( localStorage . getItem ( 'count' ) || '0' )
5- response . json ( { count } )
9+ response . json ( { count, db : db , data } )
610}
11+
12+ const requestWithMongo = ( handler : typeof create ) : APIHandler =>
13+ async ( context ) => {
14+ await handler ( context , "mongo" )
15+ }
16+
17+ export const handler : APIHandler = requestWithMongo ( create )
Original file line number Diff line number Diff line change 11/** `VERSION` managed by https://deno.land/x/publish */
2- export const VERSION = '0.3.0-beta.14 '
2+ export const VERSION = '0.3.0-beta.15 '
33
44/** `prepublish` will be invoked before publish */
55export async function prepublish ( version : string ) : Promise < boolean > {
You can’t perform that action at this time.
0 commit comments