-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use esbuild. Add node.js support. Update emcc. (#6)
* Use esbuild. Add node.js support. Update emcc. * Include typings in package. Remove outdated types * Correct path to exported types * Fix node.js example
- Loading branch information
Showing
47 changed files
with
10,268 additions
and
25,220 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
node_modules | ||
__pycache__ | ||
|
||
build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
const fs = require("fs"); | ||
const esbuild = require("esbuild"); | ||
const { copy } = require("esbuild-plugin-copy"); | ||
|
||
// release esm/mjs | ||
esbuild | ||
.build({ | ||
entryPoints: ["src/index.js"], | ||
outdir: "dist", | ||
outExtension: { | ||
".js": ".mjs", | ||
}, | ||
bundle: true, | ||
sourcemap: true, | ||
minify: true, | ||
splitting: true, | ||
format: "esm", | ||
platform: "neutral", | ||
external: ["module"], | ||
plugins: [ | ||
copy({ | ||
resolveFrom: "cwd", | ||
assets: { | ||
from: ["./src/generated/libavoid.wasm"], | ||
to: ["./dist", "./examples/dist"], | ||
}, | ||
watch: true, | ||
}), | ||
], | ||
}) | ||
.then(() => { | ||
fs.copyFile("./dist/index.mjs", "./examples/dist/index.mjs", (err) => { | ||
if (err) throw err; | ||
}); | ||
fs.copyFile( | ||
"./dist/index.mjs.map", | ||
"./examples/dist/index.mjs.map", | ||
(err) => { | ||
if (err) throw err; | ||
} | ||
); | ||
}) | ||
.catch(() => process.exit(1)); | ||
|
||
// debug esm / mjs | ||
esbuild | ||
.build({ | ||
entryPoints: ["examples/debug-src/index.js"], | ||
outdir: "examples/debug-dist", | ||
outExtension: { | ||
".js": ".mjs", | ||
}, | ||
bundle: true, | ||
minify: false, | ||
splitting: true, | ||
format: "esm", | ||
platform: "neutral", | ||
external: ["module"], | ||
plugins: [ | ||
copy({ | ||
resolveFrom: "cwd", | ||
assets: { | ||
from: [ | ||
"./examples/debug-src/generated/libavoid.wasm", | ||
"./examples/debug-src/generated/libavoid.wasm.map", | ||
], | ||
to: ["./examples/debug-dist"], | ||
}, | ||
watch: true, | ||
}), | ||
], | ||
}) | ||
.catch(() => process.exit(1)); | ||
|
||
// release cjs | ||
// esbuild | ||
// .build({ | ||
// entryPoints: ['src/index.js'], | ||
// outdir: 'dist', | ||
// outExtension: { | ||
// '.js': '.cjs' | ||
// }, | ||
// bundle: true, | ||
// sourcemap: true, | ||
// minify: true, | ||
// platform: 'node', | ||
// target: ['node10.4'] | ||
// }) | ||
// .catch(() => process.exit(1)); |
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.