{"action":"closed","number":764,"pull_request":{"url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/pulls/764","id":75861967,"html_url":"https://github.com/appcelerator/titanium_mobile_windows/pull/764","diff_url":"https://github.com/appcelerator/titanium_mobile_windows/pull/764.diff","patch_url":"https://github.com/appcelerator/titanium_mobile_windows/pull/764.patch","issue_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/issues/764","number":764,"state":"closed","locked":false,"title":"Fix another broken require case where multiple relative requires in same file failed.","user":{"login":"sgtcoolguy","id":3252,"avatar_url":"https://avatars.githubusercontent.com/u/3252?v=3","gravatar_id":"","url":"https://api.github.com/users/sgtcoolguy","html_url":"https://github.com/sgtcoolguy","followers_url":"https://api.github.com/users/sgtcoolguy/followers","following_url":"https://api.github.com/users/sgtcoolguy/following{/other_user}","gists_url":"https://api.github.com/users/sgtcoolguy/gists{/gist_id}","starred_url":"https://api.github.com/users/sgtcoolguy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sgtcoolguy/subscriptions","organizations_url":"https://api.github.com/users/sgtcoolguy/orgs","repos_url":"https://api.github.com/users/sgtcoolguy/repos","events_url":"https://api.github.com/users/sgtcoolguy/events{/privacy}","received_events_url":"https://api.github.com/users/sgtcoolguy/received_events","type":"User","site_admin":false},"body":"Follow-on to #750 \r\n\r\nThe common mocha suite was still broken because it had two relative requires in the same file. The use of the __TI_REQUIRED__ hack would only work for a single require because the property lived off the global, so after the first require it got removed and we lost state. It needed to be able to be dealt with recursively. I instead move it to a currentDir__ field on GlobalObject in the C++ code, mimicking what we do for iOS.\r\n\r\nNote that this is a hack that works for now, but a real proper Node-style require implementation requires more than what we're doing now. They generate a Module object after the path is resolved holding the resolved filename and a pointer to the parent Module. They then generate a require function that is hooked within the context of that module. When they load the module from source, they wrap it in a way that they can pass in more arguments than we currently provide: filename, dirname, parent, the custom require for that context.\r\n\r\nBasically it allows them to recursively do requires where you take the parent context to know how to resolve. Their cache also holds module objects and returns back module.exports from require calls (where we just hold the exports object itself in the cache).\r\n\r\nWe should consider fixing our implementation to be closer to theirs. Instead of doing that magic eval string we do, we need to generate a function we can call with actual args and pass in the various pieces. Our Android implementation follows much closer to theirs.\r\n\r\nMost of the magic for Node is here: \r\n- https://github.com/nodejs/node/blob/master/lib/module.js\r\n- https://github.com/nodejs/node/blob/master/lib/internal/module.js\r\n- https://github.com/nodejs/node/blob/1a21524b6908892e2d0a79cbb4241aee78530c09/lib/internal/bootstrap_node.js\r\n\r\nSee also: https://nodejs.org/dist/latest-v6.x/docs/api/modules.html#modules_the_module_wrapper\r\n","created_at":"2016-06-30T17:50:42Z","updated_at":"2016-07-01T03:54:38Z","closed_at":"2016-07-01T03:54:38Z","merged_at":"2016-07-01T03:54:38Z","merge_commit_sha":"73e7aa1b6f29a1ca1d368aa525ffdeb2814c13c7","assignee":{"login":"infosia","id":1661068,"avatar_url":"https://avatars.githubusercontent.com/u/1661068?v=3","gravatar_id":"","url":"https://api.github.com/users/infosia","html_url":"https://github.com/infosia","followers_url":"https://api.github.com/users/infosia/followers","following_url":"https://api.github.com/users/infosia/following{/other_user}","gists_url":"https://api.github.com/users/infosia/gists{/gist_id}","starred_url":"https://api.github.com/users/infosia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/infosia/subscriptions","organizations_url":"https://api.github.com/users/infosia/orgs","repos_url":"https://api.github.com/users/infosia/repos","events_url":"https://api.github.com/users/infosia/events{/privacy}","received_events_url":"https://api.github.com/users/infosia/received_events","type":"User","site_admin":false},"assignees":[{"login":"infosia","id":1661068,"avatar_url":"https://avatars.githubusercontent.com/u/1661068?v=3","gravatar_id":"","url":"https://api.github.com/users/infosia","html_url":"https://github.com/infosia","followers_url":"https://api.github.com/users/infosia/followers","following_url":"https://api.github.com/users/infosia/following{/other_user}","gists_url":"https://api.github.com/users/infosia/gists{/gist_id}","starred_url":"https://api.github.com/users/infosia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/infosia/subscriptions","organizations_url":"https://api.github.com/users/infosia/orgs","repos_url":"https://api.github.com/users/infosia/repos","events_url":"https://api.github.com/users/infosia/events{/privacy}","received_events_url":"https://api.github.com/users/infosia/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/milestones/1","html_url":"https://github.com/appcelerator/titanium_mobile_windows/milestones/6.0.0","labels_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/milestones/1/labels","id":1798930,"number":1,"title":"6.0.0","description":"","creator":{"login":"sgtcoolguy","id":3252,"avatar_url":"https://avatars.githubusercontent.com/u/3252?v=3","gravatar_id":"","url":"https://api.github.com/users/sgtcoolguy","html_url":"https://github.com/sgtcoolguy","followers_url":"https://api.github.com/users/sgtcoolguy/followers","following_url":"https://api.github.com/users/sgtcoolguy/following{/other_user}","gists_url":"https://api.github.com/users/sgtcoolguy/gists{/gist_id}","starred_url":"https://api.github.com/users/sgtcoolguy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sgtcoolguy/subscriptions","organizations_url":"https://api.github.com/users/sgtcoolguy/orgs","repos_url":"https://api.github.com/users/sgtcoolguy/repos","events_url":"https://api.github.com/users/sgtcoolguy/events{/privacy}","received_events_url":"https://api.github.com/users/sgtcoolguy/received_events","type":"User","site_admin":false},"open_issues":0,"closed_issues":11,"state":"open","created_at":"2016-05-31T14:23:05Z","updated_at":"2016-07-01T03:54:38Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/pulls/764/commits","review_comments_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/pulls/764/comments","review_comment_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/pulls/comments{/number}","comments_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/issues/764/comments","statuses_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/statuses/c435301583eefefd1afa69645ab531583a9cba87","head":{"label":"sgtcoolguy:require","ref":"require","sha":"c435301583eefefd1afa69645ab531583a9cba87","user":{"login":"sgtcoolguy","id":3252,"avatar_url":"https://avatars.githubusercontent.com/u/3252?v=3","gravatar_id":"","url":"https://api.github.com/users/sgtcoolguy","html_url":"https://github.com/sgtcoolguy","followers_url":"https://api.github.com/users/sgtcoolguy/followers","following_url":"https://api.github.com/users/sgtcoolguy/following{/other_user}","gists_url":"https://api.github.com/users/sgtcoolguy/gists{/gist_id}","starred_url":"https://api.github.com/users/sgtcoolguy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sgtcoolguy/subscriptions","organizations_url":"https://api.github.com/users/sgtcoolguy/orgs","repos_url":"https://api.github.com/users/sgtcoolguy/repos","events_url":"https://api.github.com/users/sgtcoolguy/events{/privacy}","received_events_url":"https://api.github.com/users/sgtcoolguy/received_events","type":"User","site_admin":false},"repo":{"id":33495035,"name":"titanium_mobile_windows","full_name":"sgtcoolguy/titanium_mobile_windows","owner":{"login":"sgtcoolguy","id":3252,"avatar_url":"https://avatars.githubusercontent.com/u/3252?v=3","gravatar_id":"","url":"https://api.github.com/users/sgtcoolguy","html_url":"https://github.com/sgtcoolguy","followers_url":"https://api.github.com/users/sgtcoolguy/followers","following_url":"https://api.github.com/users/sgtcoolguy/following{/other_user}","gists_url":"https://api.github.com/users/sgtcoolguy/gists{/gist_id}","starred_url":"https://api.github.com/users/sgtcoolguy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sgtcoolguy/subscriptions","organizations_url":"https://api.github.com/users/sgtcoolguy/orgs","repos_url":"https://api.github.com/users/sgtcoolguy/repos","events_url":"https://api.github.com/users/sgtcoolguy/events{/privacy}","received_events_url":"https://api.github.com/users/sgtcoolguy/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sgtcoolguy/titanium_mobile_windows","description":"Windows platform for Titanium Mobile","fork":true,"url":"https://api.github.com/repos/sgtcoolguy/titanium_mobile_windows","forks_url":"https://api.github.com/repos/sgtcoolguy/titanium_mobile_windows/forks","keys_url":"https://api.github.com/repos/sgtcoolguy/titanium_mobile_windows/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sgtcoolguy/titanium_mobile_windows/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sgtcoolguy/titanium_mobile_windows/teams","hooks_url":"https://api.github.com/repos/sgtcoolguy/titanium_mobile_windows/hooks","issue_events_url":"https://api.github.com/repos/sgtcoolguy/titanium_mobile_windows/issues/events{/number}","events_url":"https://api.github.com/repos/sgtcoolguy/titanium_mobile_windows/events","assignees_url":"https://api.github.com/repos/sgtcoolguy/titanium_mobile_windows/assignees{/user}","branches_url":"https://api.github.com/repos/sgtcoolguy/titanium_mobile_windows/branches{/branch}","tags_url":"https://api.github.com/repos/sgtcoolguy/titanium_mobile_windows/tags","blobs_url":"https://api.github.com/repos/sgtcoolguy/titanium_mobile_windows/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sgtcoolguy/titanium_mobile_windows/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sgtcoolguy/titanium_mobile_windows/git/refs{/sha}","trees_url":"https://api.github.com/repos/sgtcoolguy/titanium_mobile_windows/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sgtcoolguy/titanium_mobile_windows/statuses/{sha}","languages_url":"https://api.github.com/repos/sgtcoolguy/titanium_mobile_windows/languages","stargazers_url":"https://api.github.com/repos/sgtcoolguy/titanium_mobile_windows/stargazers","contributors_url":"https://api.github.com/repos/sgtcoolguy/titanium_mobile_windows/contributors","subscribers_url":"https://api.github.com/repos/sgtcoolguy/titanium_mobile_windows/subscribers","subscription_url":"https://api.github.com/repos/sgtcoolguy/titanium_mobile_windows/subscription","commits_url":"https://api.github.com/repos/sgtcoolguy/titanium_mobile_windows/commits{/sha}","git_commits_url":"https://api.github.com/repos/sgtcoolguy/titanium_mobile_windows/git/commits{/sha}","comments_url":"https://api.github.com/repos/sgtcoolguy/titanium_mobile_windows/comments{/number}","issue_comment_url":"https://api.github.com/repos/sgtcoolguy/titanium_mobile_windows/issues/comments{/number}","contents_url":"https://api.github.com/repos/sgtcoolguy/titanium_mobile_windows/contents/{+path}","compare_url":"https://api.github.com/repos/sgtcoolguy/titanium_mobile_windows/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sgtcoolguy/titanium_mobile_windows/merges","archive_url":"https://api.github.com/repos/sgtcoolguy/titanium_mobile_windows/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sgtcoolguy/titanium_mobile_windows/downloads","issues_url":"https://api.github.com/repos/sgtcoolguy/titanium_mobile_windows/issues{/number}","pulls_url":"https://api.github.com/repos/sgtcoolguy/titanium_mobile_windows/pulls{/number}","milestones_url":"https://api.github.com/repos/sgtcoolguy/titanium_mobile_windows/milestones{/number}","notifications_url":"https://api.github.com/repos/sgtcoolguy/titanium_mobile_windows/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sgtcoolguy/titanium_mobile_windows/labels{/name}","releases_url":"https://api.github.com/repos/sgtcoolguy/titanium_mobile_windows/releases{/id}","deployments_url":"https://api.github.com/repos/sgtcoolguy/titanium_mobile_windows/deployments","created_at":"2015-04-06T17:29:12Z","updated_at":"2016-01-12T17:09:16Z","pushed_at":"2016-06-30T17:37:41Z","git_url":"git://github.com/sgtcoolguy/titanium_mobile_windows.git","ssh_url":"git@github.com:sgtcoolguy/titanium_mobile_windows.git","clone_url":"https://github.com/sgtcoolguy/titanium_mobile_windows.git","svn_url":"https://github.com/sgtcoolguy/titanium_mobile_windows","homepage":null,"size":62181,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"appcelerator:master","ref":"master","sha":"ff6c5e75e4372a9c1d034bf201f711712c2fa4fd","user":{"login":"appcelerator","id":82188,"avatar_url":"https://avatars.githubusercontent.com/u/82188?v=3","gravatar_id":"","url":"https://api.github.com/users/appcelerator","html_url":"https://github.com/appcelerator","followers_url":"https://api.github.com/users/appcelerator/followers","following_url":"https://api.github.com/users/appcelerator/following{/other_user}","gists_url":"https://api.github.com/users/appcelerator/gists{/gist_id}","starred_url":"https://api.github.com/users/appcelerator/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/appcelerator/subscriptions","organizations_url":"https://api.github.com/users/appcelerator/orgs","repos_url":"https://api.github.com/users/appcelerator/repos","events_url":"https://api.github.com/users/appcelerator/events{/privacy}","received_events_url":"https://api.github.com/users/appcelerator/received_events","type":"Organization","site_admin":false},"repo":{"id":27684398,"name":"titanium_mobile_windows","full_name":"appcelerator/titanium_mobile_windows","owner":{"login":"appcelerator","id":82188,"avatar_url":"https://avatars.githubusercontent.com/u/82188?v=3","gravatar_id":"","url":"https://api.github.com/users/appcelerator","html_url":"https://github.com/appcelerator","followers_url":"https://api.github.com/users/appcelerator/followers","following_url":"https://api.github.com/users/appcelerator/following{/other_user}","gists_url":"https://api.github.com/users/appcelerator/gists{/gist_id}","starred_url":"https://api.github.com/users/appcelerator/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/appcelerator/subscriptions","organizations_url":"https://api.github.com/users/appcelerator/orgs","repos_url":"https://api.github.com/users/appcelerator/repos","events_url":"https://api.github.com/users/appcelerator/events{/privacy}","received_events_url":"https://api.github.com/users/appcelerator/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/appcelerator/titanium_mobile_windows","description":"Windows platform for Titanium Mobile","fork":false,"url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows","forks_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/forks","keys_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/keys{/key_id}","collaborators_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/teams","hooks_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/hooks","issue_events_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/issues/events{/number}","events_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/events","assignees_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/assignees{/user}","branches_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/branches{/branch}","tags_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/tags","blobs_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/git/refs{/sha}","trees_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/git/trees{/sha}","statuses_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/statuses/{sha}","languages_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/languages","stargazers_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/stargazers","contributors_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/contributors","subscribers_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/subscribers","subscription_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/subscription","commits_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/commits{/sha}","git_commits_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/git/commits{/sha}","comments_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/comments{/number}","issue_comment_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/issues/comments{/number}","contents_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/contents/{+path}","compare_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/compare/{base}...{head}","merges_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/merges","archive_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/downloads","issues_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/issues{/number}","pulls_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/pulls{/number}","milestones_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/milestones{/number}","notifications_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/labels{/name}","releases_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/releases{/id}","deployments_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/deployments","created_at":"2014-12-07T20:55:18Z","updated_at":"2016-05-15T20:18:01Z","pushed_at":"2016-07-01T03:54:38Z","git_url":"git://github.com/appcelerator/titanium_mobile_windows.git","ssh_url":"git@github.com:appcelerator/titanium_mobile_windows.git","clone_url":"https://github.com/appcelerator/titanium_mobile_windows.git","svn_url":"https://github.com/appcelerator/titanium_mobile_windows","homepage":null,"size":67958,"stargazers_count":11,"watchers_count":11,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":13,"mirror_url":null,"open_issues_count":4,"forks":13,"open_issues":4,"watchers":11,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/pulls/764"},"html":{"href":"https://github.com/appcelerator/titanium_mobile_windows/pull/764"},"issue":{"href":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/issues/764"},"comments":{"href":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/issues/764/comments"},"review_comments":{"href":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/pulls/764/comments"},"review_comment":{"href":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/pulls/764/commits"},"statuses":{"href":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/statuses/c435301583eefefd1afa69645ab531583a9cba87"}},"merged":true,"mergeable":null,"mergeable_state":"unknown","merged_by":{"login":"infosia","id":1661068,"avatar_url":"https://avatars.githubusercontent.com/u/1661068?v=3","gravatar_id":"","url":"https://api.github.com/users/infosia","html_url":"https://github.com/infosia","followers_url":"https://api.github.com/users/infosia/followers","following_url":"https://api.github.com/users/infosia/following{/other_user}","gists_url":"https://api.github.com/users/infosia/gists{/gist_id}","starred_url":"https://api.github.com/users/infosia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/infosia/subscriptions","organizations_url":"https://api.github.com/users/infosia/orgs","repos_url":"https://api.github.com/users/infosia/repos","events_url":"https://api.github.com/users/infosia/events{/privacy}","received_events_url":"https://api.github.com/users/infosia/received_events","type":"User","site_admin":false},"comments":3,"review_comments":0,"commits":1,"additions":49,"deletions":29,"changed_files":5}}
{"actor":{"display_login":"infosia"}}