{"action":"created","issue":{"url":"https://api.github.com/repos/power-assert-js/power-assert/issues/24","labels_url":"https://api.github.com/repos/power-assert-js/power-assert/issues/24/labels{/name}","comments_url":"https://api.github.com/repos/power-assert-js/power-assert/issues/24/comments","events_url":"https://api.github.com/repos/power-assert-js/power-assert/issues/24/events","html_url":"https://github.com/power-assert-js/power-assert/issues/24","id":102257441,"number":24,"title":"Are all dependencies required at runtime?","user":{"login":"matthewwithanm","id":126263,"avatar_url":"https://avatars.githubusercontent.com/u/126263?v=3","gravatar_id":"","url":"https://api.github.com/users/matthewwithanm","html_url":"https://github.com/matthewwithanm","followers_url":"https://api.github.com/users/matthewwithanm/followers","following_url":"https://api.github.com/users/matthewwithanm/following{/other_user}","gists_url":"https://api.github.com/users/matthewwithanm/gists{/gist_id}","starred_url":"https://api.github.com/users/matthewwithanm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matthewwithanm/subscriptions","organizations_url":"https://api.github.com/users/matthewwithanm/orgs","repos_url":"https://api.github.com/users/matthewwithanm/repos","events_url":"https://api.github.com/users/matthewwithanm/events{/privacy}","received_events_url":"https://api.github.com/users/matthewwithanm/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-08-20T23:02:33Z","updated_at":"2015-08-21T06:01:20Z","closed_at":null,"body":"I have some tests that I'd like to run both in node and the browser. The tests are compiled using Babel (with babel/register to run in node, and with webpack's Babel loader for the browser).\r\n\r\nMy assumption was that I could just add babel-plugin-espower to my .babelrc plugins in order to apply the transformation for both cases. This worked, however, the browser build is including power-assert's dependencies, including acorn (some of which are causing webpack to generate build warnings). I think I understand why this is happening; my tests require power-assert, so naturally the dependencies are getting bundled.\r\n\r\nSo my question is, are all of the dependencies necessary at run time or are they just required for the transform? (If just for the transform is there a recommended way to omit them?)\r\n\r\nI hope this is the right forum for this question! Thanks so much for such an awesome project!"},"comment":{"url":"https://api.github.com/repos/power-assert-js/power-assert/issues/comments/133297896","html_url":"https://github.com/power-assert-js/power-assert/issues/24#issuecomment-133297896","issue_url":"https://api.github.com/repos/power-assert-js/power-assert/issues/24","id":133297896,"user":{"login":"twada","id":19881,"avatar_url":"https://avatars.githubusercontent.com/u/19881?v=3","gravatar_id":"","url":"https://api.github.com/users/twada","html_url":"https://github.com/twada","followers_url":"https://api.github.com/users/twada/followers","following_url":"https://api.github.com/users/twada/following{/other_user}","gists_url":"https://api.github.com/users/twada/gists{/gist_id}","starred_url":"https://api.github.com/users/twada/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/twada/subscriptions","organizations_url":"https://api.github.com/users/twada/orgs","repos_url":"https://api.github.com/users/twada/repos","events_url":"https://api.github.com/users/twada/events{/privacy}","received_events_url":"https://api.github.com/users/twada/received_events","type":"User","site_admin":false},"created_at":"2015-08-21T06:01:20Z","updated_at":"2015-08-21T06:01:20Z","body":"Hi @matthewwithanm, thank you for your question!\r\n\r\n\r\n> My assumption was that I could just add babel-plugin-espower to my .babelrc plugins in order to apply the transformation for both cases. This worked, however, the browser build is including power-assert's dependencies, including acorn (some of which are causing webpack to generate build warnings). I think I understand why this is happening; my tests require power-assert, so naturally the dependencies are getting bundled.\r\n\r\nYes. You are right.\r\n\r\n\r\n> So my question is, are all of the dependencies necessary at run time or are they just required for the transform? (If just for the transform is there a recommended way to omit them?)\r\n\r\nThe answer is, \"All of the dependencies necessary\".\r\n\r\nThat's due to my design decision. In transformation phase, instrumentors (including [babel-plugin-espower](https://github.com/power-assert-js/babel-plugin-espower)) transforms assertion expressions by AST level so it should store original expression into code.\r\n\r\nAt runtime, [power-assert-formatter](https://github.com/power-assert-js/power-assert-formatter) parses them back by using acorn, calculate locations, then maps captured values in diagram form.\r\n\r\n\r\n> some of which are causing webpack to generate build warnings\r\n\r\nAh webpack... Maybe you need to add some webpack loaders to surpress warnings, but you may not want that.\r\nOnce I changed bundled parser from esprima to acorn to support ES6 syntax. Recently esprima 2.5 supports ES6. So it's time to estimate esprima again.\r\n\r\n\r\n> I hope this is the right forum for this question!\r\n\r\nYes. Currently here is the only channel for questions.\r\n\r\n\r\n> Thanks so much for such an awesome project!\r\n\r\nThank you for using power-assert!\r\n"}}