mirror of
https://github.com/danbulant/markdown-wasm
synced 2026-07-05 11:10:45 +00:00
updates wasmc config to enable several emcc debug features in debug mode and updated build product config
This commit is contained in:
parent
dc0823ce38
commit
ecc956f8a2
1 changed files with 36 additions and 20 deletions
56
wasmc.js
56
wasmc.js
|
|
@ -2,8 +2,6 @@ const package = require("./package.json")
|
||||||
const outdir = debug ? builddir : "dist"
|
const outdir = debug ? builddir : "dist"
|
||||||
|
|
||||||
const m = {
|
const m = {
|
||||||
name: "markdown",
|
|
||||||
out: outdir + "/markdown.js",
|
|
||||||
jsentry: "src/md.js",
|
jsentry: "src/md.js",
|
||||||
sources: [
|
sources: [
|
||||||
"src/wlib.c",
|
"src/wlib.c",
|
||||||
|
|
@ -13,31 +11,49 @@ const m = {
|
||||||
"src/fmt_html.c",
|
"src/fmt_html.c",
|
||||||
// "src/fmt_json.c",
|
// "src/fmt_json.c",
|
||||||
],
|
],
|
||||||
cflags: debug ? ["-DDEBUG=1"] : [],
|
cflags: [
|
||||||
|
"-DMD4C_USE_UTF8",
|
||||||
|
].concat(debug ? [
|
||||||
|
// debug flags
|
||||||
|
"-DDEBUG=1",
|
||||||
|
"-DASSERTIONS=1", // emcc
|
||||||
|
"-DSAFE_HEAP=1", // emcc
|
||||||
|
"-DSTACK_OVERFLOW_CHECK=1", // emcc
|
||||||
|
"-DDEMANGLE_SUPPORT=1", // emcc
|
||||||
|
] : [
|
||||||
|
// release flags
|
||||||
|
]),
|
||||||
constants: {
|
constants: {
|
||||||
VERSION: package.version,
|
VERSION: package.version,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// —————————————————————————————————————————————————
|
||||||
|
// products
|
||||||
|
|
||||||
if (!debug) {
|
// embedded wasm, ES module, nodejs-specific compression
|
||||||
// generic js module
|
// Suitable for using or bundling as a library targeting nodejs only
|
||||||
module({...m})
|
|
||||||
|
|
||||||
// node cjs module
|
|
||||||
module({ ...m,
|
|
||||||
name: "markdown-node",
|
|
||||||
out: outdir + "/markdown.node.js",
|
|
||||||
target: "node",
|
|
||||||
embed: true,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// node es module
|
|
||||||
module({ ...m,
|
module({ ...m,
|
||||||
name: "markdown-es",
|
name: "markdown-node",
|
||||||
out: outdir + "/markdown.es.js",
|
out: outdir + "/markdown.node.js",
|
||||||
format: "es",
|
|
||||||
target: "node",
|
target: "node",
|
||||||
embed: true,
|
embed: true,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if (!debug) {
|
||||||
|
// sideloaded wasm, universal js library, exports API at global["markdown"] as a fallback
|
||||||
|
// Suitable as a runtime library in browsers
|
||||||
|
module({ ...m,
|
||||||
|
name: "markdown",
|
||||||
|
out: outdir + "/markdown.js",
|
||||||
|
})
|
||||||
|
|
||||||
|
// embedded wasm, ES module
|
||||||
|
// Suitable for bundling as a library intended for browsers
|
||||||
|
module({ ...m,
|
||||||
|
name: "markdown-es",
|
||||||
|
out: outdir + "/markdown.es.js",
|
||||||
|
outwasm: outdir + "/markdown.wasm",
|
||||||
|
format: "es",
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue