titanium-sdk icon indicating copy to clipboard operation
titanium-sdk copied to clipboard

feat(android): implement top-level-await and native import support

Open garymathews opened this issue 4 years ago • 4 comments

  • Implement support for top-level-await
  • Javascript is now parsed and executed as a module, including imported modules
    • This provides native export support
  • Removed wrapping of modules as workaround for module execution context
  • import has been implemented natively, although it currently still piggybacks off our require implementation as it parses paths and handles native modules well
  • Remove lots of redundant code from previous module loading implementation
  • Updated V8 to 8.7.220.29
    • Compile using C++14 as a requirement for new changes in v8.h
TODO
  • [x] Fix core JS methods (console.log, setTimeout, etc...)
  • [x] ~Modernize our runtime/common/src/js/*.js files~
  • [x] Create destructor to clean-up moduleContexts
  • [x] Remove unused runAsScript
  • [x] Tidy exceptions from module
  • [x] Fix reference to internal data types (Object, String, etc...)
  • [ ] Update node-titanium-sdk to allow for native import/export and top-level-await support

TIMOB-28286

garymathews avatar Dec 15 '20 21:12 garymathews

Warnings
:warning: This PR has milestone set to 10.1.0, but the version defined in package.json is 10.0.0 Please either: - Update the milestone on the PR - Update the version in package.json - Hold the PR to be merged later after a release and version bump on this branch
:warning:

:mag: Can't find junit reports at ./junit.*.xml, skipping generating JUnit Report.

Messages
:book: :fist: The commits in this PR match our conventions! Feel free to Rebase and Merge this PR when ready.

Generated by :no_entry_sign: dangerJS against c07991ad88de0ccac46677f6b5f13a6a8ef0f2ee

build avatar Dec 15 '20 22:12 build

So, this is very much related to #11693 - we're hitting the same basic code path.

My PR attempts to move iOS to match Android's require/Module implementation and move all JS code into a new ti.kernel.js that we load on both platforms. (So startup becomes more like Android's 2-pass system where you load the kernel/kroll.js equivalent to bootstrap the Module code and then use that to load ti.main.js).

sgtcoolguy avatar Dec 18 '20 15:12 sgtcoolguy

@garymathews Can we break out the V8 update/C++14 change to a separate PR we can land earlier? I assume that'd be fairly straight-forward to do and CR to get landed. Also, I'd expect that this will keep shifting as a target since we're going to want to ensure the absolute latest stable V8 release prior to feature freeze (which I'd anticipate would like end up 8.8 for this cycle?)

sgtcoolguy avatar Jan 14 '21 17:01 sgtcoolguy

@garymathews Is there a possibility to finish this pull request? 😇 It would be an amazing improvement!

hansemannn avatar Mar 21 '22 13:03 hansemannn