{"action":"opened","issue":{"url":"https://api.github.com/repos/systemjs/systemjs/issues/375","labels_url":"https://api.github.com/repos/systemjs/systemjs/issues/375/labels{/name}","comments_url":"https://api.github.com/repos/systemjs/systemjs/issues/375/comments","events_url":"https://api.github.com/repos/systemjs/systemjs/issues/375/events","html_url":"https://github.com/systemjs/systemjs/issues/375","id":62523925,"number":375,"title":"System register extension uses hidden moduleRecords variable","user":{"login":"jbe456","id":4415696,"avatar_url":"https://avatars.githubusercontent.com/u/4415696?v=3","gravatar_id":"","url":"https://api.github.com/users/jbe456","html_url":"https://github.com/jbe456","followers_url":"https://api.github.com/users/jbe456/followers","following_url":"https://api.github.com/users/jbe456/following{/other_user}","gists_url":"https://api.github.com/users/jbe456/gists{/gist_id}","starred_url":"https://api.github.com/users/jbe456/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbe456/subscriptions","organizations_url":"https://api.github.com/users/jbe456/orgs","repos_url":"https://api.github.com/users/jbe456/repos","events_url":"https://api.github.com/users/jbe456/events{/privacy}","received_events_url":"https://api.github.com/users/jbe456/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-03-17T21:36:40Z","updated_at":"2015-03-17T21:36:40Z","closed_at":null,"body":"In `System`, there is already a `moduleRecords` variable which is accessible through :\r\n```\r\nSystem._loader.moduleRecords\r\n``` \r\n\r\nBut in `extension-register.js`, you use a custom local `moduleRecords` variable:\r\n```\r\n  // module binding records\r\n  var moduleRecords = {};\r\n  function getOrCreateModuleRecord(name) {\r\n    return moduleRecords[name] || (moduleRecords[name] = {\r\n      name: name,\r\n      dependencies: [],\r\n      exports: {}, // start from an empty module and extend\r\n      importers: []\r\n    })\r\n  }\r\n```\r\n\r\nVersus you should do the same as in `es6-module-loader`:\r\n```\r\n  // custom module records for binding graph\r\n  // store linking module records in a separate table\r\n  function getOrCreateModuleRecord(name, loader) {\r\n    var moduleRecords = loader.moduleRecords;\r\n    return moduleRecords[name] || (moduleRecords[name] = {\r\n      name: name,\r\n      dependencies: [],\r\n      module: new Module(), // start from an empty module and extend\r\n      importers: []\r\n    });\r\n  }\r\n```\r\n\r\nOtherwise it breaks the `delete` for example:\r\n```\r\n// 26.3.3.3\r\n    'delete': function(name) {\r\n      var loader = this._loader;\r\n      delete loader.importPromises[name];\r\n      delete loader.moduleRecords[name];\r\n      return loader.modules[name] ? delete loader.modules[name] : false;\r\n    }\r\n```"}}