publish additional js/flatbuffers.mjs to npm to support ESModules in node (#4504)

This commit is contained in:
Paul Taylor 2017-12-01 14:18:43 -08:00 committed by Wouter van Oortmerssen
parent 53a897731e
commit 0e8a21854c
2 changed files with 7 additions and 3 deletions

1
.gitignore vendored
View File

@ -81,3 +81,4 @@ android/build/
samples/android/.externalNativeBuild/ samples/android/.externalNativeBuild/
samples/android/.gradle/ samples/android/.gradle/
samples/android/build/ samples/android/build/
js/flatbuffers.mjs

View File

@ -2,14 +2,17 @@
"name": "flatbuffers", "name": "flatbuffers",
"version": "1.8.0", "version": "1.8.0",
"description": "Memory Efficient Serialization Library", "description": "Memory Efficient Serialization Library",
"files": ["js/flatbuffers.js"], "files": ["js/flatbuffers.js", "js/flatbuffers.mjs"],
"main": "js/flatbuffers.js", "main": "js/flatbuffers",
"module": "js/flatbuffers.mjs",
"directories": { "directories": {
"doc": "docs", "doc": "docs",
"test": "tests" "test": "tests"
}, },
"scripts": { "scripts": {
"test": "tests/JavaScriptTest.sh" "test": "tests/JavaScriptTest.sh",
"append-esm-export": "sed \"s/this.flatbuffers = flatbuffers;/export { flatbuffers };/\" js/flatbuffers.js >> js/flatbuffers.mjs",
"prepublishOnly": "npm run append-esm-export"
}, },
"repository": { "repository": {
"type": "git", "type": "git",