{ "id": "155148", "key": "TIMOB-20472", "fields": { "issuetype": { "id": "2", "description": "A new feature of the product, which has yet to be developed.", "name": "New Feature", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [], "resolution": { "id": "3", "description": "The problem is a duplicate of an existing issue.", "name": "Duplicate" }, "resolutiondate": "2016-07-25T13:18:51.000+0000", "created": "2016-02-26T03:20:25.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [], "versions": [], "issuelinks": [ { "id": "57020", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "172628", "key": "TIMOB-26570", "fields": { "summary": "Node compatibility and developer experience", "status": { "description": "The issue is open and ready for the assignee to start work on it.", "name": "Open", "id": "1", "statusCategory": { "id": 2, "key": "new", "colorName": "blue-gray", "name": "To Do" } }, "priority": { "name": "High", "id": "2" }, "issuetype": { "id": "6", "description": "gh.issue.epic.desc", "name": "Epic", "subtask": false } } } }, { "id": "50977", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "124137", "key": "TIMOB-16078", "fields": { "summary": "Implement full NodeJS require specs so we can use NPM for modules", "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": "Critical", "id": "1" }, "issuetype": { "id": "2", "description": "A new feature of the product, which has yet to be developed.", "name": "New Feature", "subtask": false } } } }, { "id": "51719", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "160270", "key": "TIMOB-23382", "fields": { "summary": "Parity: Cannot require directory as done in NodeJS", "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": "Critical", "id": "1" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "updated": "2018-11-16T15:41:44.000+0000", "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" } }, "components": [ { "id": "10207", "name": "Tooling" } ], "description": "{quote}As a developer,\r\nI want to be able to use NPM to install modules and libraries,\r\nSo that I can install packages such as bluebird, lodash, or custom libraries from NPM in my application.{quote}\r\n\r\nUnless I am missing something here, at compile time, you know all the libraries that could possibly be referenced. For all static includes, i.e. require(\"lodash\") or require(\"../mylib\"), you could easily map and change the requires to the correct path before packaging the app.\r\n\r\nDynamic requires, i.e. require(myvar + \"mylib\") would require a bit more effort such as creating a function that could lookup the desired library at runtime and use that with the relative folder to find it in a list of libraries in the app (assuming the list was generated at compile time.)\r\n\r\nYou could also look in the package.json files at compile time to see if there is a main referenced. Support for index.js could also be added at compile time.\r\n\r\nI've tried a few of the methods such as ti-commonjs which look for things at runtime, but the performance hit from those was far too great.", "attachment": [], "flagged": false, "summary": "Allow require to find modules in node_modules, etc", "creator": { "name": "brentonhouse", "key": "brentonhouse", "displayName": "Brenton House", "active": true, "timeZone": "America/Chicago" }, "subtasks": [], "reporter": { "name": "brentonhouse", "key": "brentonhouse", "displayName": "Brenton House", "active": true, "timeZone": "America/Chicago" }, "environment": null, "comment": { "comments": [ { "id": "379156", "author": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "Related to TIMOB-16078", "updateAuthor": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2016-03-08T10:35:30.000+0000", "updated": "2016-03-08T10:35:30.000+0000" }, { "id": "379157", "author": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "Also see https://github.com/tonylukasavage/ti-commonjs", "updateAuthor": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2016-03-08T10:36:43.000+0000", "updated": "2016-03-08T10:36:43.000+0000" }, { "id": "379673", "author": { "name": "brentonhouse", "key": "brentonhouse", "displayName": "Brenton House", "active": true, "timeZone": "America/Chicago" }, "body": "Implemented in Adamantium now: https://github.com/mobilehero/adamantium/blob/next/1.7.35/adamantium/features/support-for-nodejs-style-require.md\r\n\r\nI am not sure many of my new \"features\" I should work at creating PR's for. If it doesn't fit in with the Appc way of doing things, I can just keep it in my fork. If it really is something that has a possibility of being integrated into Alloy, then I will do the legwork of creating a PR and tests. Thanks!", "updateAuthor": { "name": "brentonhouse", "key": "brentonhouse", "displayName": "Brenton House", "active": true, "timeZone": "America/Chicago" }, "created": "2016-03-14T17:01:39.000+0000", "updated": "2016-03-14T17:01:39.000+0000" }, { "id": "379729", "author": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "[~cbarber] this might be an interesting user story to consider for the refactored build process?", "updateAuthor": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2016-03-15T09:27:19.000+0000", "updated": "2016-03-15T09:27:19.000+0000" }, { "id": "379754", "author": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "body": "[~fokkezb] Isn't this a runtime thing? You can put a {{node_modules}} directory in your project today and it will get bundled. The thing is {{require()}} will not resolve it. That's more of an SDK/runtime issue than a tooling issue. We need to fix {{require()}} on all platforms to properly resolve modules and support the {{node_modules}} directory.\r\n\r\nBTW, am I the only one that doesn't like having \"node\" stuff in Titanium?", "updateAuthor": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "created": "2016-03-15T15:42:16.000+0000", "updated": "2016-03-15T15:42:16.000+0000" }, { "id": "379761", "author": { "name": "brentonhouse", "key": "brentonhouse", "displayName": "Brenton House", "active": true, "timeZone": "America/Chicago" }, "body": "[~cbarber] lol! node love you even if the feeling isn't reciprocal! The change I made resolves most `require()` calls at compile time and the remainder at runtime. Yes, ideally, the change would go into the SDK but I am able to get a working solution by altering just Alloy. My reasoning for the change is I often want to use nodejs packages in Titanium without having to modify them to get them to work. Also, it is nice to be able to use the same coding styles across Titanium/Alloy and Node.js. I really blame it all on you guys anyway, as I probably wouldn't be nearly as deep into Node.js if it wasn't for Appccelerator!", "updateAuthor": { "name": "brentonhouse", "key": "brentonhouse", "displayName": "Brenton House", "active": true, "timeZone": "America/Chicago" }, "created": "2016-03-15T16:56:15.000+0000", "updated": "2016-03-15T16:56:15.000+0000" }, { "id": "379835", "author": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "[~cbarber] This indeed is a workaround for TIMOB-16078. I've pushed to get that done for a long time and I agree that would be highly preferable over solving it in Alloy. I actually think our Windows implementation does follow the NodeJS specs btw.\r\n\r\nI get requests to support NodeJS require every week. A great example is how we have to modify our Alloy built-in moment.js every time we update it in order for it to be able to find its localisations. It's libraries like these that people die to use in Alloy.\r\n\r\nThis should be seen entirely separate from the question if we should provide shims for NodeJS APIs. It's first-most about being able to use libraries distributed via NPM. Of course once that works, people can choose to load in libraries that shim {{process}}, {{os}}, {{path}} etc themselves. We might not actually need to provide that ourselves.", "updateAuthor": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2016-03-16T08:42:46.000+0000", "updated": "2016-03-16T08:42:46.000+0000" }, { "id": "379879", "author": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "body": "Things like filesystem, network, etc do not have a standard. Titanium invented an API. Years later, Node.js invented an API. Node.js won. Node.js is the standard.\r\n\r\nSo is the goal to turn Titanium into Node.js for mobile?\r\n\r\n", "updateAuthor": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "created": "2016-03-16T15:21:33.000+0000", "updated": "2016-03-16T15:21:33.000+0000" }, { "id": "379989", "author": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "CommonJS and the NodeJS compliant {{require()}} is the standard that this ticket is about, with the goal to allow developers to drop in JS libraries without the need to (as we do with Moment) modify them.\r\n\r\nThe Node.js API are a different story. Literally as in ticket, but with this one resolved we might not even need to since the community could create those (or use the ones [~brentonhouse] and [~tlukasavage] made)", "updateAuthor": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2016-03-17T15:40:11.000+0000", "updated": "2016-03-17T15:40:11.000+0000" }, { "id": "391405", "author": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "body": "Duplicate of TIMOB-16078, which will be in 6.0.0", "updateAuthor": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "created": "2016-07-25T13:18:51.000+0000", "updated": "2016-07-25T13:18:51.000+0000" }, { "id": "414646", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket as duplicate with reference to the above comments.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-03-21T22:54:59.000+0000", "updated": "2017-03-21T22:54:59.000+0000" } ], "maxResults": 11, "total": 11, "startAt": 0 } } }