{ "id": "83591", "key": "TIMOB-6573", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "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": [ { "id": "12090", "description": "", "name": "Sprint 2011-50", "archived": true, "released": true, "releaseDate": "2011-12-19" }, { "id": "12580", "description": "Dual Runtime 1.8.0", "name": "Release 1.8.0.1", "archived": true, "released": true, "releaseDate": "2011-12-22" }, { "id": "12593", "name": "Release 2.0.0", "archived": false, "released": true, "releaseDate": "2012-03-30" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2011-12-13T14:05:49.000+0000", "created": "2011-12-12T10:53:40.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "parity" ], "versions": [ { "id": "12580", "description": "Dual Runtime 1.8.0", "name": "Release 1.8.0.1", "archived": true, "released": true, "releaseDate": "2011-12-22" } ], "issuelinks": [ { "id": "14148", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "83371", "key": "TIMOB-6458", "fields": { "summary": "iOS: CommonJS - native JavaScript modules for iOS encounter errors when referencing classes/objects in the Ti namespace", "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": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2012-03-04T22:08:00.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": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "From the Titans mailing list:\r\n\r\nUsing the CommonJS module \"underscore\" (available at http://documentcloud.github.com/underscore/) does not properly export when using {{require()}}. The relevant snippet from the code seems to be:\r\n\r\n{code:title=underscore.js}\r\n if (typeof exports !== 'undefined') {\r\n if (typeof module !== 'undefined' && module.exports) {\r\n exports = module.exports = _;\r\n }\r\n exports._ = _;\r\n } else if (typeof define === 'function' && define.amd) {\r\n // Register as a named module with AMD.\r\n define('underscore', function() {\r\n return _;\r\n });\r\n } else {\r\n // Exported as a string, for Closure Compiler \"advanced\" mode.\r\n root['_'] = _;\r\n }\r\n{code}\r\n\r\nAnd the developer is trying the following:\r\n\r\n{code}\r\nvar _ = require('underscore')._;\r\n{code}\r\n\r\nThis is leading to the following error:\r\n\r\n{code}\r\n[ERROR] Script Error = -[KrollCallback countByEnumeratingWithState:objects:count:]: unrecognized selector sent to instance 0x8c27fb0.\r\n{code}", "attachment": [], "flagged": false, "summary": "iOS: Some modules designed for CommonJS not exporting, even with the \"export\" variable set", "creator": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "175786", "author": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "This issue may be related to TIMOB-6458, TIMOB-6457, and our other require processing mechanisms. While performing work on require() these other issues should be examined (but maybe not resolved yet).", "updateAuthor": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-12-12T10:59:01.000+0000", "updated": "2011-12-12T10:59:01.000+0000" }, { "id": "175800", "author": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Note to self: This is because, for some reason, evaluating the module is returning a KrollCallback, not an NSDictionary.", "updateAuthor": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-12-12T11:56:05.000+0000", "updated": "2011-12-12T11:56:05.000+0000" }, { "id": "175804", "author": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Android is compliant with 1.1 CommonJS spec, which might give some clues as to the nature of this bug:\r\n\r\nhttp://wiki.commonjs.org/wiki/Modules/1.1", "updateAuthor": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-12-12T12:16:26.000+0000", "updated": "2011-12-12T12:16:26.000+0000" }, { "id": "175872", "author": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Adding test code, just to test not only the module is generated, but it's usable as well. Note that this sample test defines _ to be the module/function itself, so we can inspect the read-only URI and id properties.\r\n{code}\r\n\r\nvar _ = require('underscore');\r\nvar stooges = [{name : 'curly', age : 25}, {name : 'moe', age : 21}, {name : 'larry', age : 23}];\r\nvar youngest = _(stooges).chain()\r\n .sortBy(function(stooge){ return stooge.age; })\r\n .map(function(stooge){ return stooge.name + ' is ' + stooge.age; })\r\n .first()\r\n .value();\r\n\r\nTi.API.debug(youngest);\r\nTi.API.debug(_.uri);\r\n\r\n{code}\r\n\r\nTurns out these are unrelated to linked issues, but the link is still useful.", "updateAuthor": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-12-12T18:12:42.000+0000", "updated": "2011-12-12T18:12:42.000+0000" }, { "id": "176088", "author": { "name": "nhuynh", "key": "nhuynh", "displayName": "Natalie Huynh", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Tested with 1.8.0.1.v20111214093905 on \r\nSimulator 5.0\r\niPhone 4 (5.0.1)\r\niPod 3g (4.0.2)\r\niPad 1 (4.3.5)\r\nReturns:\r\n: [INFO] moe is 21\r\n: [INFO] app://underscore.js", "updateAuthor": { "name": "nhuynh", "key": "nhuynh", "displayName": "Natalie Huynh", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-12-14T11:11:42.000+0000", "updated": "2011-12-14T11:11:42.000+0000" } ], "maxResults": 5, "total": 5, "startAt": 0 } } }