Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F4440537
build.js
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
938 B
Referenced Files
None
Subscribers
None
build.js
View Options
export
function
buildWasm
({
types
,
funcs
,
exports
})
{
const
str
=
s
=>
[
s
.
length
,
...
Buffer
.
from
(
s
)];
const
section
=
(
id
,
data
)
=>
[
id
,
data
.
length
,
...
data
];
return
new
Uint8Array
([
0x00
,
0x61
,
0x73
,
0x6d
,
// magic
0x01
,
0x00
,
0x00
,
0x00
,
// version
...
section
(
0x01
,
[
// types
types
.
length
,
...
types
.
flatMap
(([
params
,
results
])
=>
[
0x60
,
params
.
length
,
...
params
,
results
.
length
,
...
results
])
]),
...
section
(
0x03
,
[
// funcs -> type index
funcs
.
length
,
...
funcs
.
map
((
_
,
i
)
=>
i
)
]),
...
section
(
0x07
,
[
// exports
exports
.
length
,
...
exports
.
flatMap
(([
name
,
kind
,
idx
])
=>
[...
str
(
name
),
kind
,
idx
])
]),
...
section
(
0x0a
,
[
funcs
.
length
,
...
funcs
.
flatMap
(({
locals
=
[],
body
})
=>
{
const
code
=
[
locals
.
length
,
...
body
,
0x0b
];
return
[
code
.
length
,
...
code
];
})
])
]);
}
File Metadata
Details
Attached
Mime Type
application/javascript
Expires
Sat, May 2, 8:39 AM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
541838
Default Alt Text
build.js (938 B)
Attached To
Mode
rANT Ant
Attached
Detach File
Event Timeline
Log In to Comment