[TIMOB-19834] Support ES6 for Titanium Application Development
GitHub Issue | n/a |
---|---|
Type | Epic |
Priority | None |
Status | In Progress |
Resolution | Unresolved |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | n/a |
Labels | Q2, cb-tooling, roadmap2018 |
Reporter | Bert Grantges |
Assignee | Christopher Williams |
Created | 2015-10-30T16:35:06.000+0000 |
Updated | 2020-01-28T15:18:29.000+0000 |
Description
ES6 is the new standard for JavaScript that introduces a ton of feature improvements to the language structure. These include Classes, Generators, Modules, syntax improvements and much much more!
Areas of Focus will be:
* Titanium
* Alloy
* Arrow (should work now with Node 4.x+ support but need to verify)
Yes please.
JS native Classes and Template Strings / Interpolation on Ti Classic would make dreams come true.
So I think here are a few "layers" where we're broken for ES6 - Does the JS engine support ES6? -- TiCore on iOS does not, jsCore does (so basically you need to edit your tiapp.xml to switch over). Android v8 as of our Ti 6+ does. I believe Windows' JSCore port always has. - Does our CLI build choke on ES6? -- Currently, yes - when we parse JS files, scan for Ti API usage, and minify we fail. This is because we use Uglify which *still* doesn't support ES6. Moving to babel would fix that. - Does our encryption choke on ES6? -- Not sure, but probably. - Does Alloy choke on ES6? -- I haven't tested, but am 100% sure it does. Again this is due to using uglify to parse JS files and transforms the AST. This can now be done with babel instead. Not sure of the extent of the changes.
Current state: - Alloy - should be ok. - Studio will flag ES6+ syntax as an error. I have a feature branch to update the parser and handed it off to Kondal quite some time ago. I don't believe there's been any progress: TISTUD-8764 - Liveview overrides the global L function causing issues when in strict mode on iOS. Ewan would prefer the L function to not be read-only. I'd prefer it be "overriden" in it's require hijacking. In any case, I think usage of the global L function with Liveview on iOS may be silently failing now anyhow. (the assignment to a read-one global should just be silently failing, so Liveview's modified version shouldn't get registered right now): TIMOB-25790 - Debugging is fine. - Minification should be fine - Hyperloop needs work to support ES6 syntax itself: TIMOB-25057. I am currently working on this, though expanding to enums/etc has forced me to make large changes that are probably best suited for Hyperloop 4.x - Angular - does it's own thing. We need some way to handle who does the transpilation/packaging (it versus SDK). This is also relevant to Gary's PR for rollup:https://github.com/appcelerator/node-titanium-sdk/pull/24 - CommonJS modules are built individually, but generally are using ES5 syntax in a single file. I created a template project that used rollup to transpile and package to a single file quite some time ago (2 years?) because old SDK versions only handled single-file commonJS modules, but I don't recall if any modules actively updated to it.