{ "id": "169246", "key": "ALOY-1574", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "11113", "key": "ALOY", "name": "Alloy", "projectCategory": { "id": "10400", "description": "Tools for developing applications", "name": "Tooling" } }, "fixVersions": [ { "id": "19928", "name": "Alloy 1.10.4", "archived": false, "released": true, "releaseDate": "2017-09-20" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2017-09-21T01:00:31.000+0000", "created": "2017-08-02T15:54:56.000+0000", "epic": { "id": 152521, "key": "TIMOB-19834", "name": "Support ES6 for Titanium Application Development", "summary": "Support ES6 for Titanium Application Development", "color": { "key": "color_1" }, "done": false }, "priority": { "name": "High", "id": "2" }, "labels": [], "versions": [], "issuelinks": [ { "id": "55539", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "167217", "key": "TIMOB-24610", "fields": { "summary": "Support ES6 by transpiling to ES5 via new tiapp.xml \"transpile\" property", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "priority": { "name": "Medium", "id": "3" }, "issuetype": { "id": "2", "description": "A new feature of the product, which has yet to be developed.", "name": "New Feature", "subtask": false } } } }, { "id": "55538", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "151662", "key": "ALOY-1312", "fields": { "summary": "Upgrade Alloy to ES6 ", "status": { "description": "A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.", "name": "Resolved", "id": "5", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "priority": { "name": "High", "id": "2" }, "issuetype": { "id": "4", "description": "An improvement or enhancement to an existing feature or task.", "name": "Improvement", "subtask": false } } } } ], "assignee": { "name": "fmiao", "key": "fmiao", "displayName": "Feon Sua Xin Miao", "active": true, "timeZone": "America/Vancouver" }, "updated": "2018-01-29T15:52:57.000+0000", "status": { "description": "A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.", "name": "Resolved", "id": "5", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "13604", "name": "Tooling", "description": "Items related to Alloy tooling and workflow" } ], "description": "If you add imports or exports to an alloy controller, we can now parse the code and handle it in our use of babel/babylon instead of uglify. BUT, we don't \"hoist\" the imports/exports to the top of the generated code, so it can become embedded underneath a function which is invalid ES6 code. imports and exports must be \"moved\" up to the global top-level or else the code is invalid.\r\n\r\ni.e.\r\n{code:javascript}\r\nimport 'foo' from 'bar';\r\nexport const foo = Math.sqrt(2);\r\n{code}\r\nOn a related note, we don't really \"handle\" ES6 imports/exports anyways down the line, but that's another ticket we can address in titanium CLI/build to just use babel transpilation to generate requires out of them (until the wider JS community has settled how to handle module vs script difference and imports/exports)", "attachment": [], "flagged": false, "summary": "Unable to use ES6 import/exports in alloy controllers due to bad code generation", "creator": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "subtasks": [], "reporter": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "environment": null, "closedSprints": [ { "id": 945, "state": "closed", "name": "2017 Sprint 18 Tooling", "startDate": "2017-08-27T21:14:41.095Z", "endDate": "2017-09-10T21:14:00.000Z", "completeDate": "2017-09-10T21:23:47.718Z", "originBoardId": 219 }, { "id": 949, "state": "closed", "name": "2017 Sprint 19 Tooling", "startDate": "2017-09-10T21:25:25.151Z", "endDate": "2017-09-24T21:25:00.000Z", "completeDate": "2017-09-25T17:50:29.468Z", "originBoardId": 219 }, { "id": 940, "state": "closed", "name": "2017 Sprint 17 Tooling", "startDate": "2017-08-13T23:08:06.803Z", "endDate": "2017-08-27T23:08:00.000Z", "completeDate": "2017-08-27T21:14:05.511Z", "originBoardId": 219 } ], "comment": { "comments": [ { "id": "428009", "author": { "name": "fmiao", "key": "fmiao", "displayName": "Feon Sua Xin Miao", "active": true, "timeZone": "America/Vancouver" }, "body": "PR: https://github.com/appcelerator/alloy/pull/850\r\n\r\nAlloy compile should be able to parse import/export without error.\r\n*Import*\r\n1. Default import, i.e. {{import test from '/test/hello';}}\r\n2. Namespace import, i.e. {{import * as test from '/test/hello';}}\r\n3. Named imports, i.e. {{import \\{ a, b \\} from '/test/hello';}}\r\n4. Empty import, i.e. {{import '/test/hellot';}}\r\n\r\n*Export*\r\n1. Inline Named exports , i.e. {{export const sqrt = Math.sqrt;}}\r\n\r\n*Note*\r\nDefault export, i.e. {{export default 'abc';}}, is not supported in controller.", "updateAuthor": { "name": "fmiao", "key": "fmiao", "displayName": "Feon Sua Xin Miao", "active": true, "timeZone": "America/Vancouver" }, "created": "2017-09-18T11:23:06.000+0000", "updated": "2017-09-18T11:23:06.000+0000" } ], "maxResults": 1, "total": 1, "startAt": 0 } } }