Updates Emscripten types with new MODULARIZE API#44590
Updates Emscripten types with new MODULARIZE API#44590sandersn merged 2 commits intoDefinitelyTyped:masterfrom lourd:emscripten-factory-types
Conversation
This corresponds with the changes to Emscripten in emscripten-core/emscripten#10697, creating a type for the new Promise-based API of the factory function generated when using `MODULARIZE`. Removes the obsolete `then` method from EmscriptenModule and separates the type for the factory function generated when using the `MODULARIZE` build option from the rest of the `EmscriptenModule` interface. This will make it easier to extend the interface. Also removes the global `Module` variable declaration as this is not applicable for every application. This was not ideal as it left a very generic variable name in the global scope for any application that used Emscripten, regardless of whether there was actually a global variable. This now leaves it up to the user to declare their module instance as appropriate for them. Fixes the reference in sql.js, using the EmscriptenModule interface directly.
|
@lourd Thank you for submitting this PR! Code ReviewsBecause this PR edits multiple packages, it can be merged once it's reviewed by a DT maintainer. Status
Once every item on this list is checked, I'll ask you for permission to merge and publish the changes. Diagnostic Information: What the bot saw about this PR{
"type": "info",
"now": "-",
"pr_number": 44590,
"author": "lourd",
"owners": [
"zakki",
"periklis",
"kbumsik",
"Hozuki",
"ffflorian"
],
"dangerLevel": "MultiplePackagesEdited",
"headCommitAbbrOid": "cdce35b",
"headCommitOid": "cdce35b4d471b29711ba7fee186c95d52c18cea4",
"mergeIsRequested": false,
"stalenessInDays": 6,
"lastCommitDate": "2020-05-09T00:21:06.000Z",
"lastCommentDate": "2020-05-15T17:21:38.000Z",
"reviewLink": "https://github.com/DefinitelyTyped/DefinitelyTyped/pull/44590/files",
"hasMergeConflict": false,
"authorIsOwner": false,
"isFirstContribution": false,
"popularityLevel": "Well-liked by everyone",
"anyPackageIsNew": false,
"packages": [
"emscripten",
"sql.js"
],
"files": [
{
"filePath": "types/emscripten/emscripten-tests.ts",
"kind": "test",
"package": "emscripten"
},
{
"filePath": "types/emscripten/index.d.ts",
"kind": "definition",
"package": "emscripten"
},
{
"filePath": "types/sql.js/module.d.ts",
"kind": "definition",
"package": "sql.js"
}
],
"hasDismissedReview": false,
"travisResult": "pass",
"lastReviewDate": "2020-05-09T01:23:28.000Z",
"reviewersWithStaleReviews": [],
"approvalFlags": 2,
"isChangesRequested": false
} |
|
🔔 @zakki @periklis @kbumsik @hozuki @ffflorian - please review this PR in the next few days. Be sure to explicitly select |
|
🔔 @zakki @periklis @kbumsik @hozuki @ffflorian - please review this PR in the next few days. Be sure to explicitly select |
|
👋 Hi there! I’ve run some quick measurements against master and your PR. These metrics should help the humans reviewing this PR gauge whether it might negatively affect compile times or editor responsiveness for users who install these typings. Let’s review the numbers, shall we? emscripten/v*Comparison details for emscripten/* 📊
It looks like nothing changed too much. I won’t post performance data again unless it gets worse. sql.js/v*Comparison details for sql.js/* 📊
It looks like nothing changed too much. I won’t post performance data again unless it gets worse. |
There was a problem hiding this comment.
Thanks for improving @types/emscripten!
I glad to see then() is finally removed. While reading emscripten-core/emscripten#10697 I am surprised by the amount of effort just to make it a real promise. That's much more than I'd imagine. Thanks so much!
I also like the idea of removing Module in favor of EmscriptenModuleFactory. LGTM.
hozuki
left a comment
There was a problem hiding this comment.
The sql.js part has the same type reference as before. As long as emscripten's definitions are correct, sql.js' def works too.
|
@lourd emscripten-core/emscripten#10697 is merged. Is this PR ready to go? If not, which version is it waiting on, and where can I go to check whether that version has been released? |
|
@sandersn The PR is merged but it is not released yet. Specifically it is waiting for 1.39.16 and the current release is 1.39.15. You can check it here: https://github.com/emscripten-core/emscripten/releases |
|
1.39.16 was just released this morning, this should be good to go! |
|
I just published |
|
Just mentioning emscripten-core/emscripten#10271 to keep track of it. |
* Updates Emscripten types with new `MODULARIZE` API This corresponds with the changes to Emscripten in emscripten-core/emscripten#10697, creating a type for the new Promise-based API of the factory function generated when using `MODULARIZE`. Removes the obsolete `then` method from EmscriptenModule and separates the type for the factory function generated when using the `MODULARIZE` build option from the rest of the `EmscriptenModule` interface. This will make it easier to extend the interface. Also removes the global `Module` variable declaration as this is not applicable for every application. This was not ideal as it left a very generic variable name in the global scope for any application that used Emscripten, regardless of whether there was actually a global variable. This now leaves it up to the user to declare their module instance as appropriate for them. Fixes the reference in sql.js, using the EmscriptenModule interface directly. * Runs prettier on the emscripten types
Don't merge until the new release of Emscripten has been cut
This corresponds with the changes to Emscripten in emscripten-core/emscripten#10697,
creating a type for the new Promise-based API of the factory function
generated when using
MODULARIZE.Removes the obsolete
thenmethod from EmscriptenModule and separatesthe type for the factory function generated when using the
MODULARIZEbuild option from the rest of the
EmscriptenModuleinterface. Thiswill make it easier to extend the interface.
Also removes the global
Modulevariable declaration as this is notapplicable for every application. This was not ideal as it left a very
generic variable name in the global scope for any application that used
Emscripten, regardless of whether there was actually a global variable.
This now leaves it up to the user to declare their module instance as
appropriate for them.
Fixes the reference in sql.js, using the EmscriptenModule interface
directly.
npm test.)npm run lint package-name(ortscif notslint.jsonis present).