-
Notifications
You must be signed in to change notification settings - Fork 143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide default export from the main module #860
Provide default export from the main module #860
Conversation
Because WasmThemis 0.13.X has been using CommonJS modules, various transpilers interepreted import themis from 'wasm-themis'; as a valid way to import WasmThemis stuff under "themis" namespace in genuine ES6 code. The "correct" way to do this is as follows: import * as themis from 'wasm-themis'; but we need to make sure that the previous form still works. It's awkward, but when did "it looks awful" was an arguments against making a breaking change?
"index.ts" exports all Secure Cell variations individually and this file is not really used anywhere else. File structure of WasmThemis is implementation detail. You're not supposed to peek into it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
|
||
// And of course export all public things individually. | ||
|
||
export { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wat?) I need to go on some nodejs/es6 courses and learn how works new imports in javascript world....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not like I have much clue myself, lol, I'm just reading the MDN:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏
export { SecureCellSeal } from "./secure_cell_seal"; | ||
export { SecureCellTokenProtect } from "./secure_cell_token_protect"; | ||
export { SecureCellContextImprint } from "./secure_cell_context_imprint"; | ||
export { ThemisError, ThemisErrorCode } from "./themis_error"; | ||
export { | ||
import { SecureCellSeal } from "./secure_cell_seal"; | ||
import { SecureCellTokenProtect } from "./secure_cell_token_protect"; | ||
import { SecureCellContextImprint } from "./secure_cell_context_imprint"; | ||
import { ThemisError, ThemisErrorCode } from "./themis_error"; | ||
import { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unexpected :)
Because WasmThemis 0.13.X has been using CommonJS modules, various transpilers interpreted
as a valid way to import WasmThemis stuff under
themis
namespace in genuine ES6 code. (For example, WasmThemis example with webpack is written like that.)The "correct" way to do this is as follows:
but we need to make sure that the previous form still works.
Exporting things twice is awkward, but when did “it looks awful” was a valid argument against making a breaking change?
(While we're here, drop unnecessary
secure_cell.ts
file.index.ts
exports all Secure Cell variations individually and this file is not really used anywhere else. File structure of WasmThemis is implementation detail (except forlibthemis.wasm
location, I guess). You're not supposed to peek into it.)Checklist
Example projects and code samples are up-to-date(they already use this form)Changelog is updated(should not have changed in the first place)