{"action":"created","comment":{"url":"https://api.github.com/repos/hypothesis/h/pulls/comments/27245306","id":27245306,"diff_hunk":"@@ -93,50 +76,81 @@ setupStreamer = [\n     $http.defaults.headers.common['X-Client-Id'] = clientId\n ]\n \n-module = angular.module('h', imports)\n+module.exports = angular.module('h', [\n+  'bootstrap'\n+  'ngAnimate'\n+  'ngResource'\n+  'ngRoute'\n+  'ngSanitize'\n+  'ngTagsInput'\n+  'toastr'\n+])\n+\n .config(configureDocument)\n .config(configureLocation)\n .config(configureRoutes)\n .config(configureTemplates)\n \n-unless mocha? # Crude method of detecting test environment.\n-  module.run(setupCrossFrame)\n-  module.run(setupStreamer)\n-  module.run(setupHost)\n-\n-require('./vendor/annotator.auth.js')\n-require('./annotator/monkey')\n-\n-require('./controllers')\n-\n-require('./directives')\n-require('./directives/annotation')\n-require('./directives/deep-count')\n-require('./directives/markdown')\n-require('./directives/privacy')\n-require('./directives/simple-search')\n-require('./directives/status-button')\n-require('./directives/thread-filter')\n-require('./directives/thread')\n-\n-require('./filters')\n-require('./searchfilters')\n-\n-require('./services')\n-require('./annotation-mapper-service')\n-require('./annotation-ui-service')\n-require('./auth-service')\n-require('./cross-frame-service')\n-require('./host-service')\n-require('./flash-service')\n-require('./permissions-service')\n-require('./local-storage-service')\n-require('./store-service')\n-require('./threading-service')\n-\n-require('./streamsearch')\n-\n-require('./annotation-sync')\n-require('./annotation-ui-sync')\n-require('./bridge')\n-require('./discovery')\n+.controller('AppController', require('./app-controller'))\n+.controller('AnnotationController', require('./annotation-controller'))\n+.controller('AnnotationUIController', require('./annotation-ui-controller'))\n+.controller('StreamController', require('./stream-controller'))\n+.controller('WidgetController', require('./widget-controller'))\n+\n+.directive('annotation', require('./directive/annotation'))\n+.directive('deepCount', require('./directive/deep-count'))\n+.directive('formInput', require('./directive/form-input'))\n+.directive('formValidate', require('./directive/form-validate'))\n+.directive('markdown', require('./directive/markdown'))\n+.directive('privacy', require('./directive/privacy'))\n+.directive('repeatAnim', require('./directive/repeat-anim'))\n+.directive('simpleSearch', require('./directive/simple-search'))\n+.directive('statusButton', require('./directive/status-button'))\n+.directive('thread', require('./directive/thread'))\n+.directive('threadFilter', require('./directive/thread-filter'))\n+.directive('whenscrolled', require('./directive/whenscrolled'))\n+.directive('match', require('./directive/match'))\n+.directive('tabbable', require('./directive/tabbable'))\n+.directive('tabReveal', require('./directive/tab-reveal'))\n+\n+.filter('converter', require('./filter/converter'))\n+.filter('moment', require('./filter/moment'))\n+.filter('persona', require('./filter/persona'))\n+.filter('urlencode', require('./filter/urlencode'))\n+\n+.provider('identity', require('./identity'))\n+.provider('session', require('./session'))\n+\n+.service('annotator', -> new Annotator(angular.element('<div>')))\n+.service('annotationMapper', require('./annotation-mapper'))\n+.service('annotationUI', require('./annotation-ui'))\n+.service('auth', require('./auth'))\n+.service('bridge', require('./bridge'))\n+.service('crossframe', require('./cross-frame'))\n+.service('drafts', require('./drafts'))\n+.service('flash', require('./flash'))\n+.service('formRespond', require('./form-respond'))\n+.service('host', require('./host'))\n+.service('localStorage', require('./local-storage'))\n+.service('permissions', require('./permissions'))\n+.service('pulse', require('./pulse'))\n+.service('queryParser', require('./query-parser'))\n+.service('render', require('./render'))\n+.service('searchFilter', require('./search-filter'))\n+.service('store', require('./store'))\n+.service('streamFilter', require('./stream-filter'))\n+.service('streamer', require('./streamer'))\n+.service('tags', require('./tags'))\n+.service('time', require('./time'))\n+.service('threading', require('./threading'))\n+.service('unicode', require('./unicode'))\n+.service('viewFilter', require('./view-filter'))\n+\n+.value('xsrf', token: null)\n+.value('AnnotationSync', require('./annotation-sync'))\n+.value('AnnotationUISync', require('./annotation-ui-sync'))\n+.value('Discovery', require('./discovery'))\n+\n+.run(setupCrossFrame)","path":"h/static/scripts/app.coffee","position":167,"original_position":167,"commit_id":"afcdd05288b3320d5f15be3971c9607994417d94","original_commit_id":"afcdd05288b3320d5f15be3971c9607994417d94","user":{"login":"tilgovi","id":20818,"avatar_url":"https://avatars.githubusercontent.com/u/20818?v=3","gravatar_id":"","url":"https://api.github.com/users/tilgovi","html_url":"https://github.com/tilgovi","followers_url":"https://api.github.com/users/tilgovi/followers","following_url":"https://api.github.com/users/tilgovi/following{/other_user}","gists_url":"https://api.github.com/users/tilgovi/gists{/gist_id}","starred_url":"https://api.github.com/users/tilgovi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tilgovi/subscriptions","organizations_url":"https://api.github.com/users/tilgovi/orgs","repos_url":"https://api.github.com/users/tilgovi/repos","events_url":"https://api.github.com/users/tilgovi/events{/privacy}","received_events_url":"https://api.github.com/users/tilgovi/received_events","type":"User","site_admin":false},"body":"As far as I know. Seems to work!\nOn Mar 26, 2015 9:55 AM, \"Nick Stenning\" <notifications@github.com> wrote:\n\n> In h/static/scripts/app.coffee\n> <https://github.com/hypothesis/h/pull/2092#discussion_r27232152>:\n>\n> > +.service('searchFilter', require('./search-filter'))\n> > +.service('store', require('./store'))\n> > +.service('streamFilter', require('./stream-filter'))\n> > +.service('streamer', require('./streamer'))\n> > +.service('tags', require('./tags'))\n> > +.service('time', require('./time'))\n> > +.service('threading', require('./threading'))\n> > +.service('unicode', require('./unicode'))\n> > +.service('viewFilter', require('./view-filter'))\n> > +\n> > +.value('xsrf', token: null)\n> > +.value('AnnotationSync', require('./annotation-sync'))\n> > +.value('AnnotationUISync', require('./annotation-ui-sync'))\n> > +.value('Discovery', require('./discovery'))\n> > +\n> > +.run(setupCrossFrame)\n>\n> Just double checking: this is no longer conditional on being in the test\n> environment because the tests no longer load the tested services through\n> this angular module.\n>\n> —\n> Reply to this email directly or view it on GitHub\n> <https://github.com/hypothesis/h/pull/2092/files#r27232152>.\n>\n","created_at":"2015-03-26T19:04:33Z","updated_at":"2015-03-26T19:04:33Z","html_url":"https://github.com/hypothesis/h/pull/2092#discussion_r27245306","pull_request_url":"https://api.github.com/repos/hypothesis/h/pulls/2092","_links":{"self":{"href":"https://api.github.com/repos/hypothesis/h/pulls/comments/27245306"},"html":{"href":"https://github.com/hypothesis/h/pull/2092#discussion_r27245306"},"pull_request":{"href":"https://api.github.com/repos/hypothesis/h/pulls/2092"}}},"pull_request":{"url":"https://api.github.com/repos/hypothesis/h/pulls/2092","id":31956790,"html_url":"https://github.com/hypothesis/h/pull/2092","diff_url":"https://github.com/hypothesis/h/pull/2092.diff","patch_url":"https://github.com/hypothesis/h/pull/2092.patch","issue_url":"https://api.github.com/repos/hypothesis/h/issues/2092","number":2092,"state":"open","locked":false,"title":"Improve packaging, bundling and module boilerplate","user":{"login":"tilgovi","id":20818,"avatar_url":"https://avatars.githubusercontent.com/u/20818?v=3","gravatar_id":"","url":"https://api.github.com/users/tilgovi","html_url":"https://github.com/tilgovi","followers_url":"https://api.github.com/users/tilgovi/followers","following_url":"https://api.github.com/users/tilgovi/following{/other_user}","gists_url":"https://api.github.com/users/tilgovi/gists{/gist_id}","starred_url":"https://api.github.com/users/tilgovi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tilgovi/subscriptions","organizations_url":"https://api.github.com/users/tilgovi/orgs","repos_url":"https://api.github.com/users/tilgovi/repos","events_url":"https://api.github.com/users/tilgovi/events{/privacy}","received_events_url":"https://api.github.com/users/tilgovi/received_events","type":"User","site_admin":false},"body":"Prevent negative interactions with module systems present in injected\r\npages and refactor browserify interactions with angular to increase\r\nCommonJS accessibility / legibility and isolate angular module system\r\nboilerplate.\r\n\r\n- Avoid issues due to mis-detected module environments\r\n\r\n  - In the injection script, load only Annotator and jQuery in the\r\n    global scope and then both removed with `noConflict()`. Both are\r\n    loaded with browserify-shim, which prevents jQuery from registering\r\n    itself against require.js, if present (fix #2026).\r\n\r\n  - Be explicit about registration of common cross-frame components.\r\n\r\n    - Lift angular glue into app.coffee. Individual components are\r\n      exported as CommonJS modules.\r\n\r\n    - Lift Annotator glue into bootstrap.js (renamed hypothesis.js).\r\n\r\n- Break the helpers bundle up and create services and directives.\r\n\r\n  - formHelpers -> {formInput, formValidate, formRespond}\r\n  - stringHelpers -> unicode\r\n  - tagHelpers -> tags\r\n  - timeHelpers -> time\r\n  - uiHelpers -> {tabbable, tabReveal}\r\n\r\n- Rename all services, dropping the -service suffix, to match their\r\n  injected names. This is consistent with how directives are being\r\n  treated, and controllers as well (controllers are registered and\r\n  injected done with the \"Controller\" suffix).\r\n\r\n- Move Annotator subclasses into the annotator subdirectory. This\r\n  change avoids having `Annotator.Host` clash with the `host`\r\n  service and makes it easy to glob dependencies in assets.yaml to\r\n  minimally rebuild either the app or the inject.\r\n\r\n- Split up directives.coffee, services.coffee, filters.coffee, and\r\n  controllers.coffee.","created_at":"2015-03-25T19:22:41Z","updated_at":"2015-03-26T19:04:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5cd176bc12887f32d87cc78c175ecd1622ea86a7","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/hypothesis/h/pulls/2092/commits","review_comments_url":"https://api.github.com/repos/hypothesis/h/pulls/2092/comments","review_comment_url":"https://api.github.com/repos/hypothesis/h/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hypothesis/h/issues/2092/comments","statuses_url":"https://api.github.com/repos/hypothesis/h/statuses/afcdd05288b3320d5f15be3971c9607994417d94","head":{"label":"hypothesis:2026-module-isolate-env","ref":"2026-module-isolate-env","sha":"afcdd05288b3320d5f15be3971c9607994417d94","user":{"login":"hypothesis","id":1243215,"avatar_url":"https://avatars.githubusercontent.com/u/1243215?v=3","gravatar_id":"","url":"https://api.github.com/users/hypothesis","html_url":"https://github.com/hypothesis","followers_url":"https://api.github.com/users/hypothesis/followers","following_url":"https://api.github.com/users/hypothesis/following{/other_user}","gists_url":"https://api.github.com/users/hypothesis/gists{/gist_id}","starred_url":"https://api.github.com/users/hypothesis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hypothesis/subscriptions","organizations_url":"https://api.github.com/users/hypothesis/orgs","repos_url":"https://api.github.com/users/hypothesis/repos","events_url":"https://api.github.com/users/hypothesis/events{/privacy}","received_events_url":"https://api.github.com/users/hypothesis/received_events","type":"Organization","site_admin":false},"repo":{"id":3910945,"name":"h","full_name":"hypothesis/h","owner":{"login":"hypothesis","id":1243215,"avatar_url":"https://avatars.githubusercontent.com/u/1243215?v=3","gravatar_id":"","url":"https://api.github.com/users/hypothesis","html_url":"https://github.com/hypothesis","followers_url":"https://api.github.com/users/hypothesis/followers","following_url":"https://api.github.com/users/hypothesis/following{/other_user}","gists_url":"https://api.github.com/users/hypothesis/gists{/gist_id}","starred_url":"https://api.github.com/users/hypothesis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hypothesis/subscriptions","organizations_url":"https://api.github.com/users/hypothesis/orgs","repos_url":"https://api.github.com/users/hypothesis/repos","events_url":"https://api.github.com/users/hypothesis/events{/privacy}","received_events_url":"https://api.github.com/users/hypothesis/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hypothesis/h","description":"The Internet, peer reviewed.","fork":false,"url":"https://api.github.com/repos/hypothesis/h","forks_url":"https://api.github.com/repos/hypothesis/h/forks","keys_url":"https://api.github.com/repos/hypothesis/h/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hypothesis/h/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hypothesis/h/teams","hooks_url":"https://api.github.com/repos/hypothesis/h/hooks","issue_events_url":"https://api.github.com/repos/hypothesis/h/issues/events{/number}","events_url":"https://api.github.com/repos/hypothesis/h/events","assignees_url":"https://api.github.com/repos/hypothesis/h/assignees{/user}","branches_url":"https://api.github.com/repos/hypothesis/h/branches{/branch}","tags_url":"https://api.github.com/repos/hypothesis/h/tags","blobs_url":"https://api.github.com/repos/hypothesis/h/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hypothesis/h/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hypothesis/h/git/refs{/sha}","trees_url":"https://api.github.com/repos/hypothesis/h/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hypothesis/h/statuses/{sha}","languages_url":"https://api.github.com/repos/hypothesis/h/languages","stargazers_url":"https://api.github.com/repos/hypothesis/h/stargazers","contributors_url":"https://api.github.com/repos/hypothesis/h/contributors","subscribers_url":"https://api.github.com/repos/hypothesis/h/subscribers","subscription_url":"https://api.github.com/repos/hypothesis/h/subscription","commits_url":"https://api.github.com/repos/hypothesis/h/commits{/sha}","git_commits_url":"https://api.github.com/repos/hypothesis/h/git/commits{/sha}","comments_url":"https://api.github.com/repos/hypothesis/h/comments{/number}","issue_comment_url":"https://api.github.com/repos/hypothesis/h/issues/comments{/number}","contents_url":"https://api.github.com/repos/hypothesis/h/contents/{+path}","compare_url":"https://api.github.com/repos/hypothesis/h/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hypothesis/h/merges","archive_url":"https://api.github.com/repos/hypothesis/h/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hypothesis/h/downloads","issues_url":"https://api.github.com/repos/hypothesis/h/issues{/number}","pulls_url":"https://api.github.com/repos/hypothesis/h/pulls{/number}","milestones_url":"https://api.github.com/repos/hypothesis/h/milestones{/number}","notifications_url":"https://api.github.com/repos/hypothesis/h/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hypothesis/h/labels{/name}","releases_url":"https://api.github.com/repos/hypothesis/h/releases{/id}","created_at":"2012-04-02T19:56:59Z","updated_at":"2015-03-26T16:54:58Z","pushed_at":"2015-03-26T16:34:54Z","git_url":"git://github.com/hypothesis/h.git","ssh_url":"git@github.com:hypothesis/h.git","clone_url":"https://github.com/hypothesis/h.git","svn_url":"https://github.com/hypothesis/h","homepage":"https://hypothes.is/","size":45513,"stargazers_count":398,"watchers_count":398,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":100,"mirror_url":null,"open_issues_count":160,"forks":100,"open_issues":160,"watchers":398,"default_branch":"master"}},"base":{"label":"hypothesis:master","ref":"master","sha":"cc25824fefa446cb265b78d95672c923b6aab4b1","user":{"login":"hypothesis","id":1243215,"avatar_url":"https://avatars.githubusercontent.com/u/1243215?v=3","gravatar_id":"","url":"https://api.github.com/users/hypothesis","html_url":"https://github.com/hypothesis","followers_url":"https://api.github.com/users/hypothesis/followers","following_url":"https://api.github.com/users/hypothesis/following{/other_user}","gists_url":"https://api.github.com/users/hypothesis/gists{/gist_id}","starred_url":"https://api.github.com/users/hypothesis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hypothesis/subscriptions","organizations_url":"https://api.github.com/users/hypothesis/orgs","repos_url":"https://api.github.com/users/hypothesis/repos","events_url":"https://api.github.com/users/hypothesis/events{/privacy}","received_events_url":"https://api.github.com/users/hypothesis/received_events","type":"Organization","site_admin":false},"repo":{"id":3910945,"name":"h","full_name":"hypothesis/h","owner":{"login":"hypothesis","id":1243215,"avatar_url":"https://avatars.githubusercontent.com/u/1243215?v=3","gravatar_id":"","url":"https://api.github.com/users/hypothesis","html_url":"https://github.com/hypothesis","followers_url":"https://api.github.com/users/hypothesis/followers","following_url":"https://api.github.com/users/hypothesis/following{/other_user}","gists_url":"https://api.github.com/users/hypothesis/gists{/gist_id}","starred_url":"https://api.github.com/users/hypothesis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hypothesis/subscriptions","organizations_url":"https://api.github.com/users/hypothesis/orgs","repos_url":"https://api.github.com/users/hypothesis/repos","events_url":"https://api.github.com/users/hypothesis/events{/privacy}","received_events_url":"https://api.github.com/users/hypothesis/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hypothesis/h","description":"The Internet, peer reviewed.","fork":false,"url":"https://api.github.com/repos/hypothesis/h","forks_url":"https://api.github.com/repos/hypothesis/h/forks","keys_url":"https://api.github.com/repos/hypothesis/h/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hypothesis/h/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hypothesis/h/teams","hooks_url":"https://api.github.com/repos/hypothesis/h/hooks","issue_events_url":"https://api.github.com/repos/hypothesis/h/issues/events{/number}","events_url":"https://api.github.com/repos/hypothesis/h/events","assignees_url":"https://api.github.com/repos/hypothesis/h/assignees{/user}","branches_url":"https://api.github.com/repos/hypothesis/h/branches{/branch}","tags_url":"https://api.github.com/repos/hypothesis/h/tags","blobs_url":"https://api.github.com/repos/hypothesis/h/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hypothesis/h/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hypothesis/h/git/refs{/sha}","trees_url":"https://api.github.com/repos/hypothesis/h/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hypothesis/h/statuses/{sha}","languages_url":"https://api.github.com/repos/hypothesis/h/languages","stargazers_url":"https://api.github.com/repos/hypothesis/h/stargazers","contributors_url":"https://api.github.com/repos/hypothesis/h/contributors","subscribers_url":"https://api.github.com/repos/hypothesis/h/subscribers","subscription_url":"https://api.github.com/repos/hypothesis/h/subscription","commits_url":"https://api.github.com/repos/hypothesis/h/commits{/sha}","git_commits_url":"https://api.github.com/repos/hypothesis/h/git/commits{/sha}","comments_url":"https://api.github.com/repos/hypothesis/h/comments{/number}","issue_comment_url":"https://api.github.com/repos/hypothesis/h/issues/comments{/number}","contents_url":"https://api.github.com/repos/hypothesis/h/contents/{+path}","compare_url":"https://api.github.com/repos/hypothesis/h/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hypothesis/h/merges","archive_url":"https://api.github.com/repos/hypothesis/h/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hypothesis/h/downloads","issues_url":"https://api.github.com/repos/hypothesis/h/issues{/number}","pulls_url":"https://api.github.com/repos/hypothesis/h/pulls{/number}","milestones_url":"https://api.github.com/repos/hypothesis/h/milestones{/number}","notifications_url":"https://api.github.com/repos/hypothesis/h/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hypothesis/h/labels{/name}","releases_url":"https://api.github.com/repos/hypothesis/h/releases{/id}","created_at":"2012-04-02T19:56:59Z","updated_at":"2015-03-26T16:54:58Z","pushed_at":"2015-03-26T16:34:54Z","git_url":"git://github.com/hypothesis/h.git","ssh_url":"git@github.com:hypothesis/h.git","clone_url":"https://github.com/hypothesis/h.git","svn_url":"https://github.com/hypothesis/h","homepage":"https://hypothes.is/","size":45513,"stargazers_count":398,"watchers_count":398,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":100,"mirror_url":null,"open_issues_count":160,"forks":100,"open_issues":160,"watchers":398,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hypothesis/h/pulls/2092"},"html":{"href":"https://github.com/hypothesis/h/pull/2092"},"issue":{"href":"https://api.github.com/repos/hypothesis/h/issues/2092"},"comments":{"href":"https://api.github.com/repos/hypothesis/h/issues/2092/comments"},"review_comments":{"href":"https://api.github.com/repos/hypothesis/h/pulls/2092/comments"},"review_comment":{"href":"https://api.github.com/repos/hypothesis/h/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hypothesis/h/pulls/2092/commits"},"statuses":{"href":"https://api.github.com/repos/hypothesis/h/statuses/afcdd05288b3320d5f15be3971c9607994417d94"}}}}