{"action":"created","issue":{"url":"https://api.github.com/repos/aurelia/bundler/issues/151","repository_url":"https://api.github.com/repos/aurelia/bundler","labels_url":"https://api.github.com/repos/aurelia/bundler/issues/151/labels{/name}","comments_url":"https://api.github.com/repos/aurelia/bundler/issues/151/comments","events_url":"https://api.github.com/repos/aurelia/bundler/issues/151/events","html_url":"https://github.com/aurelia/bundler/issues/151","id":196289738,"number":151,"title":"Bug in bundling resources of private npm packages (containing @)","user":{"login":"genadis","id":6747147,"avatar_url":"https://avatars.githubusercontent.com/u/6747147?v=3","gravatar_id":"","url":"https://api.github.com/users/genadis","html_url":"https://github.com/genadis","followers_url":"https://api.github.com/users/genadis/followers","following_url":"https://api.github.com/users/genadis/following{/other_user}","gists_url":"https://api.github.com/users/genadis/gists{/gist_id}","starred_url":"https://api.github.com/users/genadis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/genadis/subscriptions","organizations_url":"https://api.github.com/users/genadis/orgs","repos_url":"https://api.github.com/users/genadis/repos","events_url":"https://api.github.com/users/genadis/events{/privacy}","received_events_url":"https://api.github.com/users/genadis/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"ahmedshuhel","id":868075,"avatar_url":"https://avatars.githubusercontent.com/u/868075?v=3","gravatar_id":"","url":"https://api.github.com/users/ahmedshuhel","html_url":"https://github.com/ahmedshuhel","followers_url":"https://api.github.com/users/ahmedshuhel/followers","following_url":"https://api.github.com/users/ahmedshuhel/following{/other_user}","gists_url":"https://api.github.com/users/ahmedshuhel/gists{/gist_id}","starred_url":"https://api.github.com/users/ahmedshuhel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ahmedshuhel/subscriptions","organizations_url":"https://api.github.com/users/ahmedshuhel/orgs","repos_url":"https://api.github.com/users/ahmedshuhel/repos","events_url":"https://api.github.com/users/ahmedshuhel/events{/privacy}","received_events_url":"https://api.github.com/users/ahmedshuhel/received_events","type":"User","site_admin":false},"assignees":[{"login":"ahmedshuhel","id":868075,"avatar_url":"https://avatars.githubusercontent.com/u/868075?v=3","gravatar_id":"","url":"https://api.github.com/users/ahmedshuhel","html_url":"https://github.com/ahmedshuhel","followers_url":"https://api.github.com/users/ahmedshuhel/followers","following_url":"https://api.github.com/users/ahmedshuhel/following{/other_user}","gists_url":"https://api.github.com/users/ahmedshuhel/gists{/gist_id}","starred_url":"https://api.github.com/users/ahmedshuhel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ahmedshuhel/subscriptions","organizations_url":"https://api.github.com/users/ahmedshuhel/orgs","repos_url":"https://api.github.com/users/ahmedshuhel/repos","events_url":"https://api.github.com/users/ahmedshuhel/events{/privacy}","received_events_url":"https://api.github.com/users/ahmedshuhel/received_events","type":"User","site_admin":false}],"milestone":null,"comments":2,"created_at":"2016-12-18T18:09:33Z","updated_at":"2016-12-20T00:20:38Z","closed_at":null,"body":"<!--\r\nBUGS: Please use this template.\r\n\r\nSUPPORT REQUESTS/QUESTIONS: If you have a support request or question please\r\nsubmit them to StackOverflow using the tags aurelia and aurelia-framework\r\nhttp://stackoverflow.com/questions/tagged/aurelia\r\nor the Aurelia Gitter https://gitter.im/aurelia/discuss\r\n\r\nBlue Spire offers paid support agreements. Further information regarding paid support\r\nmay be obtained by emailing support@bluespire.com\r\n\r\nFuture support requests submitted here will be closed.\r\n\r\nThe HTML comments below are for your reference, and are not displayed\r\nwhen your issue is submitted, feel free to leave them.\r\n\r\nChoose one of the two headings, delete the other.\r\n-->\r\n**I'm submitting a bug report**\r\n\r\n* **Library Version:**\r\n0.5.0\r\n\r\n\r\n**Please tell us about your environment:**\r\n* **Operating System:**\r\nWindows 10\r\n\r\n* **Node Version:**\r\n6.2.0\r\n<!--\r\nMinimum supported Node version is latest Node 4.x LTS\r\nrun `node -v`\r\n-->\r\n\r\n* **NPM Version:**\r\n3.8.9\r\n<!--\r\nMinimum supported NPM version is 3.x\r\nrun `npm -v`\r\n-->\r\n\r\n* **JSPM OR Webpack AND Version**\r\nJSPM 0.16.47\r\n<!--\r\nIf using JSPM\r\nrun `jspm -v`\r\nIf using Webpack\r\nrun `webpack --help | grep webpack`\r\n-->\r\n\r\n\r\n* **Language:**\r\nESNext\r\n\r\n\r\n**Current behavior:**\r\n\r\nadding resource of private npm package to bundle configuration, for example:\r\n```js\r\n[\r\n    @example/my-package,\r\n    @example/my-package/my.resource.css!text   // this line throws the error\r\n]\r\n```\r\n\r\nthrows exception: \"Error: A version conflict was found among the module names specified in the configuration for...\"\r\n\r\nThe error is thrown because the [getFullModuleName](https://github.com/aurelia/bundler/blob/master/lib/bundler.js#L206) does not match correctly private packages.\r\n\r\nFirst the package tries to exact match, so this works for something like `@example/my-package`, but if you try to add a resource like `@example/my-package/my.resource.css!text`, exact match wont work and the [cleanName](https://github.com/aurelia/bundler/blob/master/lib/bundler.js#L207) function is used to clean the module name.\r\n\r\nThe result of running the `cleanName` function on ` @example/my-package/my.resource.css!text ` is empty string and no match is found.\r\n\r\nTo reproduce, from command line:\r\n```\r\nnode -e \"console.log('@example/package/my.resource.css!text'.replace(/^.*:/, '').replace(/@.*$/, ''));\"\r\n```\r\n\r\n<!--\r\nIf the current behavior is a bug, please provide the steps to reproduce and, if possible, a minimal demo of the\r\nproblem along with a runnable gist, if possible.\r\nTo create a runnable gist, go to https://gist.run/?id=7542e061bc940cde506b&sha=6821c521a6c7bae6f59a36fb8628ecd1032b2d10\r\nThen click \"Fork to Public Gist\".\r\nCreate your gist, then finally click \"Update Gist.\" Include a link to the gist.run below.\r\n-->\r\n\r\n* **What is the expected behavior?**\r\n\r\n`@example/my-package/my.resource.css!text` should match `@example/my-package` module.\r\n\r\n* **What is the motivation / use case for changing the behavior?**\r\n\r\nbundling of private npm repositories with resources.\r\nConsider a repo that contains number of css styles (themes) in addition to the js code.\r\nThe user of the repo want's to chose the required style for his project and bundle it as part of the application."},"comment":{"url":"https://api.github.com/repos/aurelia/bundler/issues/comments/268117517","html_url":"https://github.com/aurelia/bundler/issues/151#issuecomment-268117517","issue_url":"https://api.github.com/repos/aurelia/bundler/issues/151","id":268117517,"user":{"login":"genadis","id":6747147,"avatar_url":"https://avatars.githubusercontent.com/u/6747147?v=3","gravatar_id":"","url":"https://api.github.com/users/genadis","html_url":"https://github.com/genadis","followers_url":"https://api.github.com/users/genadis/followers","following_url":"https://api.github.com/users/genadis/following{/other_user}","gists_url":"https://api.github.com/users/genadis/gists{/gist_id}","starred_url":"https://api.github.com/users/genadis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/genadis/subscriptions","organizations_url":"https://api.github.com/users/genadis/orgs","repos_url":"https://api.github.com/users/genadis/repos","events_url":"https://api.github.com/users/genadis/events{/privacy}","received_events_url":"https://api.github.com/users/genadis/received_events","type":"User","site_admin":false},"created_at":"2016-12-20T00:20:38Z","updated_at":"2016-12-20T00:20:38Z","body":"@ahmedshuhel Thank you for quick response \r\n\r\nI already did (actually I'm giving jspm install do the dirty work, but usually check the map: [] of the generated config.js for correctness if there are issues)\r\n\r\n\r\nBelow I've posted the configuration I'm using. But first allow me to point out that I have the same package in the public npm called `encapsulated-mdl` which works just fine. And the private package when configured with `bitbucket` worked for me as well. The issue started when I switched to private npm.\r\n\r\nFor example in my map I have the following:\r\n```\r\nmap: [\r\n\"@annoto/mdl\": \"npm:@annoto/mdl@1.2.6\",\r\n //...\r\n]\r\n```\r\n@annoto/mdl has no dependencies so it's the only record in the map.\r\n\r\nIn the project I have a directory for the package:\r\n```\r\njspm_packages\r\n   -- npm\r\n      -- @annoto\r\n         -- mdl@1.2.6\r\n           -- material.js\r\n           -- material.cyan-blue.min.css\r\n           -- material.deep_orange-pink.min.css\r\n           -- ....\r\n``` \r\n\r\nWhen the bundle configuration includes only this:\r\n```\r\n\"includes\": [\r\n        \"@annoto/mdl\",\r\n        // ...\r\n]\r\n```\r\n(I have the package.json of the @annoto/mdl configured correctly to point to material.js as the main)\r\n\r\nAll is good because the getFullModuleName function of the bundler has an exact match of the module [here: Line 189](https://github.com/aurelia/bundler/blob/master/lib/bundler.ts#L189).\r\n\r\nWhen I try adding a css:\r\n```\r\n\"includes\": [\r\n        \"@annoto/mdl\",\r\n        \"@annoto/mdl/material.cyan-blue.min.css!text\", \r\n        // ...\r\n]\r\n```\r\nI get the mentioned error. As I've pointed out, I believe it is because of the cleanName `let cleanName = (n: string) => n.replace(/^.*:/, '').replace(/@.*$/, '');`  [on Line 188](https://github.com/aurelia/bundler/blob/master/lib/bundler.ts#L188).\r\n\r\nI understand it's purpose is to clean the versions of the module which use the `@` character, but as a side effect it deletes the private module name as well as it starts with `@` returning empty string for all private modules. It should recognize that if `@` is the first character it is private module and not a version indicator and not clean it.\r\n\r\nThanks!\r\n"}}
{"actor":{"display_login":"genadis"}}