{"action":"created","comment":{"url":"https://api.github.com/repos/google/chicago-brick/pulls/comments/70639686","id":70639686,"diff_hunk":"@@ -46,29 +46,31 @@ const read = (path) => {\n \n const evalModule = (contents, name, layoutGeometry, network, game, state) => {\n   let classes = {};\n+  // A fake require that first checks to see if the require is one of our\n+  // per-invocation dependencies. If so, uses that. Otherwise, delegates to\n+  // normal require.\n+  let fakeRequireInstance = fakeRequire.createEnvironment({\n+    network,\n+    game,\n+    state,\n+    wallGeometry: new geometry.Polygon(layoutGeometry.points.map((p) => {\n+      return {\n+        x: p.x - layoutGeometry.extents.x,\n+        y: p.y - layoutGeometry.extents.y\n+      };\n+    })),\n+    debug: debugFactory('wall:module:' + name),\n+    globalWallGeometry: wallGeometry.getGeo(),\n+    \n+    // The main registration function.\n+    register: function(server, client) {\n+      classes.server = server;\n+      classes.client = client;\n+    },\n+  });\n   let sandbox = {\n-    // A fake require that first checks to see if the require is one of our\n-    // per-invocation dependencies. If so, uses that. Otherwise, delegates to\n-    // normal require.\n-    require: fakeRequire.createEnvironment({\n-      network,\n-      game,\n-      state,\n-      wallGeometry: new geometry.Polygon(layoutGeometry.points.map((p) => {\n-        return {\n-          x: p.x - layoutGeometry.extents.x,\n-          y: p.y - layoutGeometry.extents.y\n-        };\n-      })),\n-      debug: debugFactory('wall:module:' + name),\n-      globalWallGeometry: wallGeometry.getGeo(),\n-      \n-      // The main registration function.\n-      register: function(server, client) {\n-        classes.server = server;\n-        classes.client = client;\n-      },\n-    })\n+    require: fakeRequireInstance,\n+    serverRequire: fakeRequireInstance","path":"server/modules/module_def.js","position":50,"original_position":50,"commit_id":"f3e1402a1e9d132b3f0088f365259ca510df77df","original_commit_id":"f3e1402a1e9d132b3f0088f365259ca510df77df","user":{"login":"applmak","id":2245625,"avatar_url":"https://avatars.githubusercontent.com/u/2245625?v=3","gravatar_id":"","url":"https://api.github.com/users/applmak","html_url":"https://github.com/applmak","followers_url":"https://api.github.com/users/applmak/followers","following_url":"https://api.github.com/users/applmak/following{/other_user}","gists_url":"https://api.github.com/users/applmak/gists{/gist_id}","starred_url":"https://api.github.com/users/applmak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/applmak/subscriptions","organizations_url":"https://api.github.com/users/applmak/orgs","repos_url":"https://api.github.com/users/applmak/repos","events_url":"https://api.github.com/users/applmak/events{/privacy}","received_events_url":"https://api.github.com/users/applmak/received_events","type":"User","site_admin":false},"body":"> Does this mean a file that mixes client and server code should use let foo = serverRequire(...) for things only needed on the server?\r\n\r\nYes, and this is currently the default, due to the demands of the 'register' function (and single entrypoint).\r\n\r\n> But, since we now have multi-file modules, if the server code is in a separate file require or serverRequire can be used.\r\n\r\nYes, I think so.","created_at":"2016-07-13T14:48:14Z","updated_at":"2016-07-13T14:48:14Z","html_url":"https://github.com/google/chicago-brick/pull/96#discussion_r70639686","pull_request_url":"https://api.github.com/repos/google/chicago-brick/pulls/96","_links":{"self":{"href":"https://api.github.com/repos/google/chicago-brick/pulls/comments/70639686"},"html":{"href":"https://github.com/google/chicago-brick/pull/96#discussion_r70639686"},"pull_request":{"href":"https://api.github.com/repos/google/chicago-brick/pulls/96"}}},"pull_request":{"url":"https://api.github.com/repos/google/chicago-brick/pulls/96","id":77183207,"html_url":"https://github.com/google/chicago-brick/pull/96","diff_url":"https://github.com/google/chicago-brick/pull/96.diff","patch_url":"https://github.com/google/chicago-brick/pull/96.patch","issue_url":"https://api.github.com/repos/google/chicago-brick/issues/96","number":96,"state":"open","locked":false,"title":"Allow files required by modules to export symbols.","user":{"login":"applmak","id":2245625,"avatar_url":"https://avatars.githubusercontent.com/u/2245625?v=3","gravatar_id":"","url":"https://api.github.com/users/applmak","html_url":"https://github.com/applmak","followers_url":"https://api.github.com/users/applmak/followers","following_url":"https://api.github.com/users/applmak/following{/other_user}","gists_url":"https://api.github.com/users/applmak/gists{/gist_id}","starred_url":"https://api.github.com/users/applmak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/applmak/subscriptions","organizations_url":"https://api.github.com/users/applmak/orgs","repos_url":"https://api.github.com/users/applmak/repos","events_url":"https://api.github.com/users/applmak/events{/privacy}","received_events_url":"https://api.github.com/users/applmak/received_events","type":"User","site_admin":false},"body":"Without this change, we can technically require other files, but those files can't expose any symbols, which is totally useless!\r\n\r\nMulti-file modules are 100% working after this, but I think there's only 1 last wonky bit in the server before we are really done.","created_at":"2016-07-12T20:11:20Z","updated_at":"2016-07-13T14:48:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d11cc09a4bab8b8172555fb9e1305c8579407307","assignee":{"login":"iatkinson","id":4923410,"avatar_url":"https://avatars.githubusercontent.com/u/4923410?v=3","gravatar_id":"","url":"https://api.github.com/users/iatkinson","html_url":"https://github.com/iatkinson","followers_url":"https://api.github.com/users/iatkinson/followers","following_url":"https://api.github.com/users/iatkinson/following{/other_user}","gists_url":"https://api.github.com/users/iatkinson/gists{/gist_id}","starred_url":"https://api.github.com/users/iatkinson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iatkinson/subscriptions","organizations_url":"https://api.github.com/users/iatkinson/orgs","repos_url":"https://api.github.com/users/iatkinson/repos","events_url":"https://api.github.com/users/iatkinson/events{/privacy}","received_events_url":"https://api.github.com/users/iatkinson/received_events","type":"User","site_admin":false},"assignees":[{"login":"iatkinson","id":4923410,"avatar_url":"https://avatars.githubusercontent.com/u/4923410?v=3","gravatar_id":"","url":"https://api.github.com/users/iatkinson","html_url":"https://github.com/iatkinson","followers_url":"https://api.github.com/users/iatkinson/followers","following_url":"https://api.github.com/users/iatkinson/following{/other_user}","gists_url":"https://api.github.com/users/iatkinson/gists{/gist_id}","starred_url":"https://api.github.com/users/iatkinson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iatkinson/subscriptions","organizations_url":"https://api.github.com/users/iatkinson/orgs","repos_url":"https://api.github.com/users/iatkinson/repos","events_url":"https://api.github.com/users/iatkinson/events{/privacy}","received_events_url":"https://api.github.com/users/iatkinson/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/google/chicago-brick/pulls/96/commits","review_comments_url":"https://api.github.com/repos/google/chicago-brick/pulls/96/comments","review_comment_url":"https://api.github.com/repos/google/chicago-brick/pulls/comments{/number}","comments_url":"https://api.github.com/repos/google/chicago-brick/issues/96/comments","statuses_url":"https://api.github.com/repos/google/chicago-brick/statuses/f3e1402a1e9d132b3f0088f365259ca510df77df","head":{"label":"google:module-serving-2","ref":"module-serving-2","sha":"f3e1402a1e9d132b3f0088f365259ca510df77df","user":{"login":"google","id":1342004,"avatar_url":"https://avatars.githubusercontent.com/u/1342004?v=3","gravatar_id":"","url":"https://api.github.com/users/google","html_url":"https://github.com/google","followers_url":"https://api.github.com/users/google/followers","following_url":"https://api.github.com/users/google/following{/other_user}","gists_url":"https://api.github.com/users/google/gists{/gist_id}","starred_url":"https://api.github.com/users/google/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/google/subscriptions","organizations_url":"https://api.github.com/users/google/orgs","repos_url":"https://api.github.com/users/google/repos","events_url":"https://api.github.com/users/google/events{/privacy}","received_events_url":"https://api.github.com/users/google/received_events","type":"Organization","site_admin":false},"repo":{"id":50162607,"name":"chicago-brick","full_name":"google/chicago-brick","owner":{"login":"google","id":1342004,"avatar_url":"https://avatars.githubusercontent.com/u/1342004?v=3","gravatar_id":"","url":"https://api.github.com/users/google","html_url":"https://github.com/google","followers_url":"https://api.github.com/users/google/followers","following_url":"https://api.github.com/users/google/following{/other_user}","gists_url":"https://api.github.com/users/google/gists{/gist_id}","starred_url":"https://api.github.com/users/google/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/google/subscriptions","organizations_url":"https://api.github.com/users/google/orgs","repos_url":"https://api.github.com/users/google/repos","events_url":"https://api.github.com/users/google/events{/privacy}","received_events_url":"https://api.github.com/users/google/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/google/chicago-brick","description":"Software that displays content on a multi-node video wall.","fork":false,"url":"https://api.github.com/repos/google/chicago-brick","forks_url":"https://api.github.com/repos/google/chicago-brick/forks","keys_url":"https://api.github.com/repos/google/chicago-brick/keys{/key_id}","collaborators_url":"https://api.github.com/repos/google/chicago-brick/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/google/chicago-brick/teams","hooks_url":"https://api.github.com/repos/google/chicago-brick/hooks","issue_events_url":"https://api.github.com/repos/google/chicago-brick/issues/events{/number}","events_url":"https://api.github.com/repos/google/chicago-brick/events","assignees_url":"https://api.github.com/repos/google/chicago-brick/assignees{/user}","branches_url":"https://api.github.com/repos/google/chicago-brick/branches{/branch}","tags_url":"https://api.github.com/repos/google/chicago-brick/tags","blobs_url":"https://api.github.com/repos/google/chicago-brick/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/google/chicago-brick/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/google/chicago-brick/git/refs{/sha}","trees_url":"https://api.github.com/repos/google/chicago-brick/git/trees{/sha}","statuses_url":"https://api.github.com/repos/google/chicago-brick/statuses/{sha}","languages_url":"https://api.github.com/repos/google/chicago-brick/languages","stargazers_url":"https://api.github.com/repos/google/chicago-brick/stargazers","contributors_url":"https://api.github.com/repos/google/chicago-brick/contributors","subscribers_url":"https://api.github.com/repos/google/chicago-brick/subscribers","subscription_url":"https://api.github.com/repos/google/chicago-brick/subscription","commits_url":"https://api.github.com/repos/google/chicago-brick/commits{/sha}","git_commits_url":"https://api.github.com/repos/google/chicago-brick/git/commits{/sha}","comments_url":"https://api.github.com/repos/google/chicago-brick/comments{/number}","issue_comment_url":"https://api.github.com/repos/google/chicago-brick/issues/comments{/number}","contents_url":"https://api.github.com/repos/google/chicago-brick/contents/{+path}","compare_url":"https://api.github.com/repos/google/chicago-brick/compare/{base}...{head}","merges_url":"https://api.github.com/repos/google/chicago-brick/merges","archive_url":"https://api.github.com/repos/google/chicago-brick/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/google/chicago-brick/downloads","issues_url":"https://api.github.com/repos/google/chicago-brick/issues{/number}","pulls_url":"https://api.github.com/repos/google/chicago-brick/pulls{/number}","milestones_url":"https://api.github.com/repos/google/chicago-brick/milestones{/number}","notifications_url":"https://api.github.com/repos/google/chicago-brick/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/google/chicago-brick/labels{/name}","releases_url":"https://api.github.com/repos/google/chicago-brick/releases{/id}","deployments_url":"https://api.github.com/repos/google/chicago-brick/deployments","created_at":"2016-01-22T06:32:09Z","updated_at":"2016-07-12T16:32:45Z","pushed_at":"2016-07-12T20:11:21Z","git_url":"git://github.com/google/chicago-brick.git","ssh_url":"git@github.com:google/chicago-brick.git","clone_url":"https://github.com/google/chicago-brick.git","svn_url":"https://github.com/google/chicago-brick","homepage":"","size":556,"stargazers_count":36,"watchers_count":36,"language":"JavaScript","has_issues":true,"has_downloads":false,"has_wiki":false,"has_pages":true,"forks_count":5,"mirror_url":null,"open_issues_count":23,"forks":5,"open_issues":23,"watchers":36,"default_branch":"master"}},"base":{"label":"google:master","ref":"master","sha":"614b01adfb5165b6e4979304098ad2721a5eb0c7","user":{"login":"google","id":1342004,"avatar_url":"https://avatars.githubusercontent.com/u/1342004?v=3","gravatar_id":"","url":"https://api.github.com/users/google","html_url":"https://github.com/google","followers_url":"https://api.github.com/users/google/followers","following_url":"https://api.github.com/users/google/following{/other_user}","gists_url":"https://api.github.com/users/google/gists{/gist_id}","starred_url":"https://api.github.com/users/google/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/google/subscriptions","organizations_url":"https://api.github.com/users/google/orgs","repos_url":"https://api.github.com/users/google/repos","events_url":"https://api.github.com/users/google/events{/privacy}","received_events_url":"https://api.github.com/users/google/received_events","type":"Organization","site_admin":false},"repo":{"id":50162607,"name":"chicago-brick","full_name":"google/chicago-brick","owner":{"login":"google","id":1342004,"avatar_url":"https://avatars.githubusercontent.com/u/1342004?v=3","gravatar_id":"","url":"https://api.github.com/users/google","html_url":"https://github.com/google","followers_url":"https://api.github.com/users/google/followers","following_url":"https://api.github.com/users/google/following{/other_user}","gists_url":"https://api.github.com/users/google/gists{/gist_id}","starred_url":"https://api.github.com/users/google/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/google/subscriptions","organizations_url":"https://api.github.com/users/google/orgs","repos_url":"https://api.github.com/users/google/repos","events_url":"https://api.github.com/users/google/events{/privacy}","received_events_url":"https://api.github.com/users/google/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/google/chicago-brick","description":"Software that displays content on a multi-node video wall.","fork":false,"url":"https://api.github.com/repos/google/chicago-brick","forks_url":"https://api.github.com/repos/google/chicago-brick/forks","keys_url":"https://api.github.com/repos/google/chicago-brick/keys{/key_id}","collaborators_url":"https://api.github.com/repos/google/chicago-brick/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/google/chicago-brick/teams","hooks_url":"https://api.github.com/repos/google/chicago-brick/hooks","issue_events_url":"https://api.github.com/repos/google/chicago-brick/issues/events{/number}","events_url":"https://api.github.com/repos/google/chicago-brick/events","assignees_url":"https://api.github.com/repos/google/chicago-brick/assignees{/user}","branches_url":"https://api.github.com/repos/google/chicago-brick/branches{/branch}","tags_url":"https://api.github.com/repos/google/chicago-brick/tags","blobs_url":"https://api.github.com/repos/google/chicago-brick/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/google/chicago-brick/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/google/chicago-brick/git/refs{/sha}","trees_url":"https://api.github.com/repos/google/chicago-brick/git/trees{/sha}","statuses_url":"https://api.github.com/repos/google/chicago-brick/statuses/{sha}","languages_url":"https://api.github.com/repos/google/chicago-brick/languages","stargazers_url":"https://api.github.com/repos/google/chicago-brick/stargazers","contributors_url":"https://api.github.com/repos/google/chicago-brick/contributors","subscribers_url":"https://api.github.com/repos/google/chicago-brick/subscribers","subscription_url":"https://api.github.com/repos/google/chicago-brick/subscription","commits_url":"https://api.github.com/repos/google/chicago-brick/commits{/sha}","git_commits_url":"https://api.github.com/repos/google/chicago-brick/git/commits{/sha}","comments_url":"https://api.github.com/repos/google/chicago-brick/comments{/number}","issue_comment_url":"https://api.github.com/repos/google/chicago-brick/issues/comments{/number}","contents_url":"https://api.github.com/repos/google/chicago-brick/contents/{+path}","compare_url":"https://api.github.com/repos/google/chicago-brick/compare/{base}...{head}","merges_url":"https://api.github.com/repos/google/chicago-brick/merges","archive_url":"https://api.github.com/repos/google/chicago-brick/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/google/chicago-brick/downloads","issues_url":"https://api.github.com/repos/google/chicago-brick/issues{/number}","pulls_url":"https://api.github.com/repos/google/chicago-brick/pulls{/number}","milestones_url":"https://api.github.com/repos/google/chicago-brick/milestones{/number}","notifications_url":"https://api.github.com/repos/google/chicago-brick/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/google/chicago-brick/labels{/name}","releases_url":"https://api.github.com/repos/google/chicago-brick/releases{/id}","deployments_url":"https://api.github.com/repos/google/chicago-brick/deployments","created_at":"2016-01-22T06:32:09Z","updated_at":"2016-07-12T16:32:45Z","pushed_at":"2016-07-12T20:11:21Z","git_url":"git://github.com/google/chicago-brick.git","ssh_url":"git@github.com:google/chicago-brick.git","clone_url":"https://github.com/google/chicago-brick.git","svn_url":"https://github.com/google/chicago-brick","homepage":"","size":556,"stargazers_count":36,"watchers_count":36,"language":"JavaScript","has_issues":true,"has_downloads":false,"has_wiki":false,"has_pages":true,"forks_count":5,"mirror_url":null,"open_issues_count":23,"forks":5,"open_issues":23,"watchers":36,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/google/chicago-brick/pulls/96"},"html":{"href":"https://github.com/google/chicago-brick/pull/96"},"issue":{"href":"https://api.github.com/repos/google/chicago-brick/issues/96"},"comments":{"href":"https://api.github.com/repos/google/chicago-brick/issues/96/comments"},"review_comments":{"href":"https://api.github.com/repos/google/chicago-brick/pulls/96/comments"},"review_comment":{"href":"https://api.github.com/repos/google/chicago-brick/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/google/chicago-brick/pulls/96/commits"},"statuses":{"href":"https://api.github.com/repos/google/chicago-brick/statuses/f3e1402a1e9d132b3f0088f365259ca510df77df"}}}}
{"actor":{"display_login":"applmak"}}