{ "id": "155042", "key": "TIMOB-20487", "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": "20884", "name": "Release 8.2.1", "archived": false, "released": true, "releaseDate": "2019-10-25" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2019-10-01T17:43:50.000+0000", "created": "2016-02-19T23:01:20.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [ "commonJS", "engSchedule", "ios", "require" ], "versions": [ { "id": "20827", "name": "Release 8.2.0", "archived": false, "released": true, "releaseDate": "2019-09-19" }, { "id": "20845", "name": "Release 8.1.1", "archived": false, "released": true, "releaseDate": "2019-08-29" } ], "issuelinks": [ { "id": "50711", "type": { "id": "10001", "name": "Cloners", "inward": "is cloned into", "outward": "is cloned from" }, "inwardIssue": { "id": "155195", "key": "AC-675", "fields": { "summary": "Commonjs modules are overwriting module.exports.id 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" } }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } }, { "id": "57845", "type": { "id": "10002", "name": "Duplicate", "inward": "is duplicated by", "outward": "duplicates" }, "outwardIssue": { "id": "173437", "key": "TIMOB-26963", "fields": { "summary": "iOS: Require'ing a JSON file appends file path to resulting JSON string ", "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": "None", "id": "6" }, "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": "2019-10-01T17:43:50.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": [], "description": "I've run into an issue that only shows up when I am deploying to iOS hardware w/o liveview. \r\n\r\n{code:java}\r\nvar x = require(\"some_commonjs_module\");\r\n{code}\r\n\r\nIf I run this code w/ liveview turned on, the only properties of x are the ones that are in the module. However, if I run this without liveview (hardware or simulator), I get two extra properties: id and uri.\r\n\r\nThis is causing an issue because I am using _.defaults and now it thinks I have those properties that I expected to be undefined.\r\n\r\nIs this a known feature/bug of require or a new issue?\r\n", "attachment": [], "flagged": false, "summary": "Extra properties after requiring commonjs modules", "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": "iOS", "comment": { "comments": [ { "id": "377422", "author": { "name": "sfeather", "key": "sfeather", "displayName": "Stephen Feather", "active": true, "timeZone": "America/New_York" }, "body": "From the commonJS module 1.1 specs:\r\n\r\nid is required\r\n{code}\r\nThe \"module\" object must have a read-only, don't delete \"id\" property that is the top-level \"id\" of the module. \r\nThe \"id\" property must be such that require(module.id) will return the exports object from which the module.id originated. \r\n(That is to say module.id can be passed to another module, and requiring that must return the original module\r\n{code}\r\n\r\nuri is optional\r\n{code}\r\nThe \"module\" object may have a \"uri\" String that is the fully-qualified URI to the resource from which the module was created. \r\nThe \"uri\" property must not exist in a sandbox.\r\n{code}\r\n\r\nI expect id to exist.", "updateAuthor": { "name": "sfeather", "key": "sfeather", "displayName": "Stephen Feather", "active": true, "timeZone": "America/New_York" }, "created": "2016-02-20T01:51:41.000+0000", "updated": "2016-02-20T01:51:41.000+0000" }, { "id": "377789", "author": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "body": "Hello [~brentonhouse], Was the guide from [~sfeather] helpful? If you are still facing the problem, Would you please provide full steps of how to regenerate the issue. Please provide the necessary code, platform information and steps to follow. Thanks. Also here is [CommonJS wiki|http://wiki.commonjs.org/wiki/Modules/1.1.1]. Thanks.", "updateAuthor": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "created": "2016-02-24T17:41:43.000+0000", "updated": "2016-02-24T17:42:28.000+0000" }, { "id": "377793", "author": { "name": "brentonhouse", "key": "brentonhouse", "displayName": "Brenton House", "active": true, "timeZone": "America/Chicago" }, "body": "Thanks [~sfeather]! I may be misunderstanding the spec but I thought that the id and uri properties were on module, not on module.exports? I was under the assumption that the id and uri properties were at the same level as exports (i.e. module.id, module.uri, module.exports)", "updateAuthor": { "name": "brentonhouse", "key": "brentonhouse", "displayName": "Brenton House", "active": true, "timeZone": "America/Chicago" }, "created": "2016-02-24T17:53:25.000+0000", "updated": "2016-02-24T17:54:04.000+0000" }, { "id": "377927", "author": { "name": "brentonhouse", "key": "brentonhouse", "displayName": "Brenton House", "active": true, "timeZone": "America/Chicago" }, "body": "[~sdarda] - Why is this marked as fixed? I don't see any commits or activity that would indicate it was worked on.", "updateAuthor": { "name": "brentonhouse", "key": "brentonhouse", "displayName": "Brenton House", "active": true, "timeZone": "America/Chicago" }, "created": "2016-02-25T21:07:57.000+0000", "updated": "2016-02-25T21:07:57.000+0000" }, { "id": "420919", "author": { "name": "brentonhouse", "key": "brentonhouse", "displayName": "Brenton House", "active": true, "timeZone": "America/Chicago" }, "body": "Any update on this? I also notice that you are exporting the uri property as well (which will overwrite any exported property named uri). I think the priority of this might need to get bumped up with the recent emphasis on making everything more compatible with the nodejs module exports.\r\n\r\nMaybe you could change the properties to __uri and __id so as to remove possible conflicts with exported properties.\r\n\r\nThanks!", "updateAuthor": { "name": "brentonhouse", "key": "brentonhouse", "displayName": "Brenton House", "active": true, "timeZone": "America/Chicago" }, "created": "2017-06-05T17:24:08.000+0000", "updated": "2017-06-05T17:24:08.000+0000" }, { "id": "451380", "author": { "name": "bhouse", "key": "bhouse", "displayName": "Brenton House", "active": true, "timeZone": "America/Chicago" }, "body": "I've created a test project to demonstrate this:\r\n\r\n1. npm install @brentonhouse/timob-20487\r\n2. put this code in a node.js javascript file and and alloy.js: require('timob-20487');\r\n\r\n\r\nIn Node.js it will give you the correct output of:\r\n\r\n\r\n{code:java}\r\ntest1: {\r\n \"id\": \"abc\",\r\n \"firstName\": \"my first name\",\r\n \"lastName\": \"my last name\"\r\n}\r\n\r\n{code}\r\n\r\nBut in Titanium, it will give you the incorrect output of:\r\n\r\n\r\n{code:java}\r\n test1: {\r\n \"id\": \"node_modules/@brentonhouse/timob-20487/test1.js\",\r\n \"firstName\": \"my first name\",\r\n \"lastName\": \"my last name\",\r\n \"uri\": \"app://node_modules/@brentonhouse/timob-20487/test1.js\"\r\n } \r\n{code}\r\n\r\n", "updateAuthor": { "name": "bhouse", "key": "bhouse", "displayName": "Brenton House", "active": true, "timeZone": "America/Chicago" }, "created": "2019-09-14T18:29:58.000+0000", "updated": "2019-09-14T18:51:38.000+0000" }, { "id": "451400", "author": { "name": "bhouse", "key": "bhouse", "displayName": "Brenton House", "active": true, "timeZone": "America/Chicago" }, "body": "PR: https://github.com/appcelerator/titanium_mobile/pull/10929", "updateAuthor": { "name": "bhouse", "key": "bhouse", "displayName": "Brenton House", "active": true, "timeZone": "America/Chicago" }, "created": "2019-09-16T16:00:15.000+0000", "updated": "2019-09-16T16:00:15.000+0000" }, { "id": "451593", "author": { "name": "ssekhri", "key": "ssekhri", "displayName": "Satyam Sekhri", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Kindly create PR on the 8_2_X branch as well.", "updateAuthor": { "name": "ssekhri", "key": "ssekhri", "displayName": "Satyam Sekhri", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-09-23T23:21:21.000+0000", "updated": "2019-09-23T23:21:21.000+0000" }, { "id": "451740", "author": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~ssekhri], 8_2_X backport : https://github.com/appcelerator/titanium_mobile/pull/11250", "updateAuthor": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-10-01T15:36:27.000+0000", "updated": "2019-10-01T15:36:27.000+0000" }, { "id": "451743", "author": { "name": "ssekhri", "key": "ssekhri", "displayName": "Satyam Sekhri", "active": true, "timeZone": "America/Los_Angeles" }, "body": "FR Passed on both 8_2_X and master branch. Appropriate fields available for the required common js module.", "updateAuthor": { "name": "ssekhri", "key": "ssekhri", "displayName": "Satyam Sekhri", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-10-01T17:38:51.000+0000", "updated": "2019-10-01T17:38:51.000+0000" }, { "id": "451744", "author": { "name": "ssekhri", "key": "ssekhri", "displayName": "Satyam Sekhri", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Verified On:\r\nMac OS: 10.14.5\r\nSDK: 8.2.1.v20191001063013\r\nAppc CLI: 7.1.1\r\nJDK: 1.8.0_162\r\nNode: 10.5.0\r\nStudio: 5.1.4.201909061933\r\nXcode: 11.0\r\nDevice: iPhone X(13.0)", "updateAuthor": { "name": "ssekhri", "key": "ssekhri", "displayName": "Satyam Sekhri", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-10-01T17:43:50.000+0000", "updated": "2019-10-01T17:43:50.000+0000" } ], "maxResults": 13, "total": 13, "startAt": 0 } } }