{"action":"created","issue":{"url":"https://api.github.com/repos/systemjs/builder/issues/377","labels_url":"https://api.github.com/repos/systemjs/builder/issues/377/labels{/name}","comments_url":"https://api.github.com/repos/systemjs/builder/issues/377/comments","events_url":"https://api.github.com/repos/systemjs/builder/issues/377/events","html_url":"https://github.com/systemjs/builder/pull/377","id":114218921,"number":377,"title":"Added baseURL and clone of global.System.map in builder.js / executeConfigFile","user":{"login":"typhonrt","id":311473,"avatar_url":"https://avatars.githubusercontent.com/u/311473?v=3","gravatar_id":"","url":"https://api.github.com/users/typhonrt","html_url":"https://github.com/typhonrt","followers_url":"https://api.github.com/users/typhonrt/followers","following_url":"https://api.github.com/users/typhonrt/following{/other_user}","gists_url":"https://api.github.com/users/typhonrt/gists{/gist_id}","starred_url":"https://api.github.com/users/typhonrt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/typhonrt/subscriptions","organizations_url":"https://api.github.com/users/typhonrt/orgs","repos_url":"https://api.github.com/users/typhonrt/repos","events_url":"https://api.github.com/users/typhonrt/events{/privacy}","received_events_url":"https://api.github.com/users/typhonrt/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-10-30T07:46:18Z","updated_at":"2015-10-30T15:13:46Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/systemjs/builder/pulls/377","html_url":"https://github.com/systemjs/builder/pull/377","diff_url":"https://github.com/systemjs/builder/pull/377.diff","patch_url":"https://github.com/systemjs/builder/pull/377.patch"},"body":"Added baseURL and clone of global.System.map to configSystem which is necessary to support access to normalized map paths in further adding mapped paths via additional config loading during the build process. In executeConfigFile the global.System is temporarily rewritten to only expose the config method. This pull request adds `baseURL` and a clone of `global.System.map`.\r\n\r\nThis allows the ability to create additional mapped paths which access the current normalized paths for dependencies handled by JSPM / SystemJS. An example of an additional config file (`config-app-paths.js`) in my framework TyphonJS which uses this change is:\r\n\r\n```\r\n/**\r\n * Loads mapped paths for TyphonJS in the browser and via Gulp / Node.js allowing normalized\r\n * dependencies to be used in defining further mapped paths.\r\n */\r\nvar System = System || global.System;\r\n\r\n// Debug for testing\r\nconsole.log('Config-App-Paths - 0 - System.baseURL: ' +System.baseURL);\r\nconsole.log('Config-App-Paths - 1 - System.map: ' +JSON.stringify(System.map));\r\n\r\nvar pathParseCore = System.map['typhon-core-parse'];\r\nvar pathParsePremium = System.map['typhon-premium-parse'];\r\n\r\nSystem.config(\r\n{\r\n   map:\r\n   {\r\n      'appconfig': 'config/production-config.js',\r\n      ...\r\n      'typhonUser': pathParsePremium +'/src/control/user/TyphonUser.js',\r\n      'typhonUserCollection': pathParseCore +'/src/collections/ParseUsers.js',\r\n   }\r\n});\r\n```\r\n\r\nThe Gulp task to kick off SystemJS Builder looks like this:\r\n```\r\n   var builder = new jspm.Builder('./config.js');\r\n\r\n   builder.loadConfig('./config/config-app-paths.js').then(function()\r\n   {\r\n      ...\r\n   }\r\n```\r\n\r\nIt should be noted that when running in the browser the full System instance is available. During the build process this is not available therefore adding a copy of baseURL and map is rather useful. \r\n\r\nAdding this change to Builder also resolves my feature request for uninstalling silent:\r\nhttps://github.com/jspm/jspm-cli/issues/1220"},"comment":{"url":"https://api.github.com/repos/systemjs/builder/issues/comments/152551728","html_url":"https://github.com/systemjs/builder/pull/377#issuecomment-152551728","issue_url":"https://api.github.com/repos/systemjs/builder/issues/377","id":152551728,"user":{"login":"typhonrt","id":311473,"avatar_url":"https://avatars.githubusercontent.com/u/311473?v=3","gravatar_id":"","url":"https://api.github.com/users/typhonrt","html_url":"https://github.com/typhonrt","followers_url":"https://api.github.com/users/typhonrt/followers","following_url":"https://api.github.com/users/typhonrt/following{/other_user}","gists_url":"https://api.github.com/users/typhonrt/gists{/gist_id}","starred_url":"https://api.github.com/users/typhonrt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/typhonrt/subscriptions","organizations_url":"https://api.github.com/users/typhonrt/orgs","repos_url":"https://api.github.com/users/typhonrt/repos","events_url":"https://api.github.com/users/typhonrt/events{/privacy}","received_events_url":"https://api.github.com/users/typhonrt/received_events","type":"User","site_admin":false},"created_at":"2015-10-30T15:13:46Z","updated_at":"2015-10-30T15:13:46Z","body":"I'm all for having access to the full loader if there isn't any particular reason for limiting access via Builder as it's available in the browser after all. It would be great to get this in an update \"soonish\" as it provides a nice workflow for loading extra mapped paths which include normalized dependency paths. IE I'll be posting a Backbone-Parse demos repo over the weekend which will use it and include it in a tutorial if available. Thanks for taking a look!"}}