Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/lib/libfetchfs.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

addToLibrary({
$FETCHFS__deps: ['wasmfs_create_fetch_backend'],
$FETCHFS__export: true,
$FETCHFS: {
createBackend(opts) {
return withStackSave(
Expand Down
1 change: 1 addition & 0 deletions src/lib/libicasefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

addToLibrary({
$ICASEFS__deps: ['wasmfs_create_icase_backend'],
$ICASEFS__export: true,
$ICASEFS: {
createBackend(opts) {
if (typeof opts.backend === 'undefined') {
Expand Down
1 change: 1 addition & 0 deletions src/lib/libidbfs.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ addToLibrary({
$IDBFS_DB_STORE_NAME: 'FILE_DATA',
}),
$IDBFS__postset: () => addAtExit('IDBFS.quit();'),
$IDBFS__export: true,
$IDBFS: {
dbs: new Map(),
indexedDB: () => {
Expand Down
1 change: 1 addition & 0 deletions src/lib/libjsfilefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

addToLibrary({
$JSFILEFS__deps: ['wasmfs_create_js_file_backend'],
$JSFILEFS__export: true,
$JSFILEFS: {
createBackend(opts) {
return _wasmfs_create_js_file_backend();
Expand Down
3 changes: 3 additions & 0 deletions src/lib/libnodefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
*/

addToLibrary({
#if !LibraryManager.has('libnoderawfs.js')
$NODEFS__export: true,
#endif

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this depend on noderawfs?

#if WASMFS
$NODEFS__deps: ['wasmfs_create_node_backend'],
$NODEFS: {
Expand Down
1 change: 1 addition & 0 deletions src/lib/libopfs.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

addToLibrary({
$OPFS__deps: ['wasmfs_create_opfs_backend'],
$OPFS__export: true,
$OPFS: {
createBackend(opts) {
return _wasmfs_create_opfs_backend();
Expand Down
1 change: 1 addition & 0 deletions src/lib/libproxyfs.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*/

addToLibrary({
$PROXYFS__export: true,
$PROXYFS: {
mount(mount) {
return PROXYFS.createNode(null, '/', mount.opts.fs.lstat(mount.opts.root).mode, 0);
Expand Down
1 change: 1 addition & 0 deletions src/lib/libworkerfs.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ addToLibrary({
$WORKERFS_DIR_MODE: cDefs.S_IFDIR | cDefs.S_IRWXUGO,
$WORKERFS_FILE_MODE: cDefs.S_IFREG | cDefs.S_IRWXUGO,
}),
$WORKERFS__export: true,
$WORKERFS: {
reader: null,
mount(mount) {
Expand Down
28 changes: 17 additions & 11 deletions test/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -8712,18 +8712,24 @@ def test_memprof_requirements(self):
''')
self.do_runf('hello_world.c', 'able to run memprof', cflags=['--memoryprofiler', '--pre-js=pre.js', '-sINCOMING_MODULE_JS_API=onRuntimeInitialized'])

@no_wasmfs('depends on MEMFS which WASMFS does not have')
@no_modularize_instance('uses Module object directly')
@no_wasmfs('IDBFS is not yet supported in WasmFS')
def test_fs_dict(self):
self.set_setting('FORCE_FILESYSTEM')
create_file('pre.js', '''
Module.preRun = () => {
out(typeof MEMFS);
out(typeof IDBFS);
out(typeof NODEFS);
};
''')
self.cflags += ['-lidbfs.js', '-lnodefs.js', '--pre-js', 'pre.js', '-sINCOMING_MODULE_JS_API=preRun']
self.do_run('int main() { return 0; }', 'object\nobject\nobject')
self.do_run('''
#include <emscripten/em_asm.h>

int main() {
EM_ASM({
out(typeof Module['IDBFS']);
out(typeof Module['NODEFS']);
out(typeof Module['PROXYFS']);
out(typeof Module['WORKERFS']);
});
return 0;
}
''', 'object\nobject\nobject\nobject',
cflags=['-sFORCE_FILESYSTEM', '-sENVIRONMENT=web,worker,node',
'-lidbfs.js', '-lnodefs.js', '-lproxyfs.js', '-lworkerfs.js'])

@no_wasmfs('depends on MEMFS which WASMFS does not have')
def test_fs_dict_none(self):
Expand Down
Loading