chore: put wasm blob to root of the package

This commit is contained in:
alina 🌸 2024-03-04 05:16:38 +03:00
parent fbf5c8f4bc
commit 399336fa4a
Signed by: teidesu
SSH key fingerprint: SHA256:uNeCpw6aTSU4aIObXLvHfLkDa82HWH9EiOj9AXOIRpI
6 changed files with 5 additions and 5 deletions

View file

@ -1,6 +1,6 @@
module.exports = ({ path: { join }, fs, outDir, packageDir }) => ({
esmOnlyDirectives: true,
final() {
fs.cpSync(join(packageDir, 'lib/mtcute.wasm'), join(outDir, 'mtcute.wasm'))
fs.cpSync(join(packageDir, 'mtcute.wasm'), join(outDir, 'mtcute.wasm'))
},
})

View file

@ -12,4 +12,4 @@ COPY wasm.h Makefile /src/
RUN make
FROM scratch AS binaries
COPY --from=build /src/mtcute.wasm /
COPY --from=build /src/mtcute.wasm ../

View file

@ -43,7 +43,7 @@ ifneq ($(OS),Windows_NT)
endif
endif
OUT := mtcute.wasm
OUT := ../mtcute.wasm
$(OUT): $(SOURCES)
$(CC) $(CFLAGS) -I . -I utils -o $@ $^

View file

@ -14,7 +14,7 @@
},
"exports": {
".": "./src/index.ts",
"./mtcute.wasm": "./lib/mtcute.wasm"
"./mtcute.wasm": "./mtcute.wasm"
},
"distOnlyFields": {
"exports": {

View file

@ -1,7 +1,7 @@
import { initSync } from '../src/index.js'
export async function initWasm() {
const url = new URL('../lib/mtcute.wasm', import.meta.url)
const url = new URL('../mtcute.wasm', import.meta.url)
if (import.meta.env.TEST_ENV === 'node' || import.meta.env.TEST_ENV === 'bun') {
const fs = await import('fs/promises')