summaryrefslogtreecommitdiffstats
path: root/Tools/wasm
diff options
context:
space:
mode:
authorHood Chatham <roberthoodchatham@gmail.com>2024-11-16 01:44:05 (GMT)
committerGitHub <noreply@github.com>2024-11-16 01:44:05 (GMT)
commit544b001b233ac57dfce17587ffbd10a70abe3ab0 (patch)
tree3ec744784f67dd4318dfdb339e7684e763c10928 /Tools/wasm
parentd6bcc154e93a0a20ab97187d3e8b726fffb14f8f (diff)
downloadcpython-544b001b233ac57dfce17587ffbd10a70abe3ab0.zip
cpython-544b001b233ac57dfce17587ffbd10a70abe3ab0.tar.gz
cpython-544b001b233ac57dfce17587ffbd10a70abe3ab0.tar.bz2
gh-126691: Remove --with-emscripten-target (#126787)
This unifies the code for nodejs and the code for the browser. After this commit, the browser example doesn't work; this will be fixed in a subsequent update.
Diffstat (limited to 'Tools/wasm')
-rw-r--r--Tools/wasm/README.md6
-rw-r--r--Tools/wasm/emscripten/node_pre.js10
2 files changed, 8 insertions, 8 deletions
diff --git a/Tools/wasm/README.md b/Tools/wasm/README.md
index 4c9a643..3f4211f 100644
--- a/Tools/wasm/README.md
+++ b/Tools/wasm/README.md
@@ -21,12 +21,6 @@ https://github.com/psf/webassembly for more information.
### Build
-For now the build system has two target flavors. The ``Emscripten/browser``
-target (``--with-emscripten-target=browser``) is optimized for browsers.
-It comes with a reduced and preloaded stdlib without tests and threading
-support. The ``Emscripten/node`` target has threading enabled and can
-access the file system directly.
-
To cross compile to the ``wasm32-emscripten`` platform you need
[the Emscripten compiler toolchain](https://emscripten.org/),
a Python interpreter, and an installation of Node version 18 or newer. Emscripten
diff --git a/Tools/wasm/emscripten/node_pre.js b/Tools/wasm/emscripten/node_pre.js
index 3490d3c..54b09dc 100644
--- a/Tools/wasm/emscripten/node_pre.js
+++ b/Tools/wasm/emscripten/node_pre.js
@@ -1,9 +1,15 @@
// If process is undefined, we're not running in the node runtime let it go I
// guess?
if (typeof process !== "undefined") {
- const nodeVersion = Number(process.versions.node.split('.',1)[0]);
+ const nodeVersion = Number(process.versions.node.split(".", 1)[0]);
if (nodeVersion < 18) {
- process.stderr.write(`Node version must be >= 18, got version ${process.version}\n`);
+ process.stderr.write(
+ `Node version must be >= 18, got version ${process.version}\n`,
+ );
process.exit(1);
}
+ Module.preRun = () => {
+ FS.mkdirTree("/lib/");
+ FS.mount(NODEFS, { root: __dirname + "/lib/" }, "/lib/");
+ };
}