JS backend: add LibraryUtils.writeMetadata
~ add moduleId to metadata