-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: export xxhashBase64Url from wasm (#5203)
* fix: export xxhashBase64Url from wasm * fix: set js_name for xxhash_base64_url function from wasm --------- Co-authored-by: Lukas Taegert-Atkinson <lukastaegert@users.noreply.github.com>
- Loading branch information
1 parent
d8b31a2
commit ee0639e
Showing
8 changed files
with
44 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
// eslint-disable-next-line import/no-unresolved | ||
export { parse, xxhash_base64_url as xxhashBase64Url } from '../../wasm/bindings_wasm.js'; | ||
export { parse, xxhashBase64Url } from '../../wasm/bindings_wasm.js'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
const { parse, xxhashBase64Url } = require('./wasm-node/bindings_wasm.js'); | ||
|
||
exports.parse = parse; | ||
exports.xxhashBase64Url = xxhashBase64Url; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import fs from 'node:fs/promises'; | ||
import path from 'node:path'; | ||
import url from 'node:url'; | ||
|
||
const __dirname = path.dirname(url.fileURLToPath(import.meta.url)); | ||
const NATIVE_JS_PATH = path.resolve(__dirname, '../native.js'); | ||
const NATIVE_WASM_JS_PATH = path.resolve(__dirname, '../native.wasm.js'); | ||
|
||
const [nativeJsContent, nativeWasmJsContent] = await Promise.all([ | ||
fs.readFile(NATIVE_JS_PATH, 'utf8'), | ||
fs.readFile(NATIVE_WASM_JS_PATH, 'utf8') | ||
]); | ||
|
||
const nativeJsExportsMatches = nativeJsContent.matchAll(/exports\.(\w+)\s*=/g); | ||
const notFoundExports = []; | ||
for (const match of nativeJsExportsMatches) { | ||
const exportName = match[1]; | ||
if (!nativeWasmJsContent.includes(`exports.${exportName}`)) { | ||
notFoundExports.push(exportName); | ||
} | ||
} | ||
|
||
if (notFoundExports.length > 0) { | ||
throw new Error( | ||
`${JSON.stringify( | ||
notFoundExports.join(',') | ||
)} was exported from native.js but not exported from native.wasm.js.` | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters