Platform agnostic #19

Merged
teidesu merged 25 commits from platform-agnostic into master 2024-03-07 05:54:20 +03:00
5 changed files with 7 additions and 27 deletions
Showing only changes of commit 9420f155b2 - Show all commits

View file

@ -7,6 +7,7 @@
"./index.ts", "./index.ts",
], ],
"references": [ "references": [
{ "path": "../core" } { "path": "../core" },
{ "path": "../node" }
] ]
} }

View file

@ -8,6 +8,7 @@
"./fake-tls.ts", "./fake-tls.ts",
], ],
"references": [ "references": [
{ "path": "../core" } { "path": "../core" },
{ "path": "../node" }
] ]
} }

View file

@ -1,5 +1,3 @@
// ^^ because of this._socket. we know it's not null, almost everywhere, but TS doesn't
// eslint-disable-next-line @typescript-eslint/ban-ts-comment // eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error // @ts-expect-error
import { normalize } from 'ip6' import { normalize } from 'ip6'

View file

@ -7,8 +7,7 @@
"./index.ts" "./index.ts"
], ],
"references": [ "references": [
{ { "path": "../core" },
"path": "../core" { "path": "../node" }
}
] ]
} }

View file

@ -1,22 +1,3 @@
// /* eslint-disable no-console */ module.exports = () => ({
// import * cp from 'child_process'
// import * as fs from 'fs'
// import { join } from 'path'
// const root = new URL('.', import.meta.url).pathname
module.exports = ({ path: { join }, fs, outDir, packageDir, transformFile }) => ({
esmOnlyDirectives: true, esmOnlyDirectives: true,
final() {
const fixWasmPath = (path) => {
transformFile(join(outDir, path), (data) => data.replace('../lib/mtcute.wasm', '../mtcute.wasm'))
}
fixWasmPath('cjs/init.js')
fixWasmPath('cjs/init.web.js')
fixWasmPath('esm/init.js')
fixWasmPath('esm/init.web.js')
fs.cpSync(join(packageDir, 'lib/mtcute.wasm'), join(outDir, 'mtcute.wasm'))
},
}) })