{"action":"created","comment":{"url":"https://api.github.com/repos/webpack/webpack/pulls/comments/243975127","pull_request_review_id":187869672,"id":243975127,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI0Mzk3NTEyNw==","diff_hunk":"@@ -17,32 +21,50 @@ const path = require(\"path\");\n  * @returns {string} relative path in request style\n  */\n const absoluteToRequest = (context, maybeAbsolutePath) => {\n-\tif (/^\\/.*\\/$/.test(maybeAbsolutePath)) {\n-\t\t// this 'path' is actually a regexp generated by dynamic requires.\n-\t\t// Don't treat it as an absolute path.\n-\t\treturn maybeAbsolutePath;\n+\tif (maybeAbsolutePath[0] === \"/\") {\n+\t\tif (\n+\t\t\tmaybeAbsolutePath.length > 1 &&\n+\t\t\tmaybeAbsolutePath[maybeAbsolutePath.length - 1] === \"/\"\n+\t\t) {\n+\t\t\t// this 'path' is actually a regexp generated by dynamic requires.\n+\t\t\t// Don't treat it as an absolute path.\n+\t\t\treturn maybeAbsolutePath;\n+\t\t}\n+\n+\t\tconst querySplitPos = maybeAbsolutePath.indexOf(\"?\");\n+\t\tlet resource =\n+\t\t\tquerySplitPos === -1\n+\t\t\t\t? maybeAbsolutePath\n+\t\t\t\t: maybeAbsolutePath.slice(0, querySplitPos);\n+\t\tresource = path.posix.relative(context, resource);\n+\t\tif (!resource.startsWith(\"../\")) {\n+\t\t\tresource = \"./\" + resource;\n+\t\t}\n+\t\treturn querySplitPos === -1\n+\t\t\t? resource\n+\t\t\t: resource + maybeAbsolutePath.slice(querySplitPos);\n \t}\n-\tif (/^[a-zA-Z]:\\\\/.test(maybeAbsolutePath)) {\n-\t\tconst splitPath = maybeAbsolutePath.split(\"?\", 2);","path":"lib/util/identifier.js","position":43,"original_position":43,"commit_id":"2143bd6519d17ad0ec66038870958dda9dbd2ae9","original_commit_id":"2143bd6519d17ad0ec66038870958dda9dbd2ae9","user":{"login":"sokra","id":1365881,"node_id":"MDQ6VXNlcjEzNjU4ODE=","avatar_url":"https://avatars0.githubusercontent.com/u/1365881?v=4","gravatar_id":"","url":"https://api.github.com/users/sokra","html_url":"https://github.com/sokra","followers_url":"https://api.github.com/users/sokra/followers","following_url":"https://api.github.com/users/sokra/following{/other_user}","gists_url":"https://api.github.com/users/sokra/gists{/gist_id}","starred_url":"https://api.github.com/users/sokra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sokra/subscriptions","organizations_url":"https://api.github.com/users/sokra/orgs","repos_url":"https://api.github.com/users/sokra/repos","events_url":"https://api.github.com/users/sokra/events{/privacy}","received_events_url":"https://api.github.com/users/sokra/received_events","type":"User","site_admin":false},"body":"This code was actually buggy. Split with limit throws away all parts after the second match. This was not intended...","created_at":"2018-12-26T10:16:20Z","updated_at":"2018-12-26T10:16:24Z","html_url":"https://github.com/webpack/webpack/pull/8547#discussion_r243975127","pull_request_url":"https://api.github.com/repos/webpack/webpack/pulls/8547","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/webpack/webpack/pulls/comments/243975127"},"html":{"href":"https://github.com/webpack/webpack/pull/8547#discussion_r243975127"},"pull_request":{"href":"https://api.github.com/repos/webpack/webpack/pulls/8547"}}},"pull_request":{"url":"https://api.github.com/repos/webpack/webpack/pulls/8547","id":240680238,"node_id":"MDExOlB1bGxSZXF1ZXN0MjQwNjgwMjM4","html_url":"https://github.com/webpack/webpack/pull/8547","diff_url":"https://github.com/webpack/webpack/pull/8547.diff","patch_url":"https://github.com/webpack/webpack/pull/8547.patch","issue_url":"https://api.github.com/repos/webpack/webpack/issues/8547","number":8547,"state":"open","locked":false,"title":"Optimize absoluteToRequest","user":{"login":"Connormiha","id":4091305,"node_id":"MDQ6VXNlcjQwOTEzMDU=","avatar_url":"https://avatars1.githubusercontent.com/u/4091305?v=4","gravatar_id":"","url":"https://api.github.com/users/Connormiha","html_url":"https://github.com/Connormiha","followers_url":"https://api.github.com/users/Connormiha/followers","following_url":"https://api.github.com/users/Connormiha/following{/other_user}","gists_url":"https://api.github.com/users/Connormiha/gists{/gist_id}","starred_url":"https://api.github.com/users/Connormiha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Connormiha/subscriptions","organizations_url":"https://api.github.com/users/Connormiha/orgs","repos_url":"https://api.github.com/users/Connormiha/repos","events_url":"https://api.github.com/users/Connormiha/events{/privacy}","received_events_url":"https://api.github.com/users/Connormiha/received_events","type":"User","site_admin":false},"body":"<!-- Thanks for submitting a pull request! Please provide enough information so that others can review your pull request. -->\r\n<!-- Explain the **motivation** for making this change. What existing problem does the pull request solve? -->\r\n<!-- Try to link to an open issue for more information. -->\r\nI decomposed function `absoluteToRequest` to avoid needless regexp checks in performance reason.\r\n\r\n<!-- In addition to that please answer these questions: -->\r\n\r\n**What kind of change does this PR introduce?**\r\nRefactoring\r\n<!-- E.g. a bugfix, feature, refactoring, build related change, etc… -->\r\n\r\n**Did you add tests for your changes?**\r\nI added a few tests before refactoring.\r\n<!-- Note that we won't merge your changes if you don't add tests -->\r\n\r\n**Does this PR introduce a breaking change?**\r\nNo\r\n<!-- If this PR introduces a breaking change, please describe the impact and a migration path for existing applications. -->\r\n\r\n**What needs to be documented once your changes are merged?**\r\n\r\n<!-- List all the information that needs to be added to the documentation after merge -->\r\n<!-- When your changes are merged you will be asked to contribute this to the documentation -->\r\n","created_at":"2018-12-23T12:47:00Z","updated_at":"2018-12-26T10:16:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":"33997b225d97d391cf849b087e2578691bce67bc","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":572709861,"node_id":"MDU6TGFiZWw1NzI3MDk4NjE=","url":"https://api.github.com/repos/webpack/webpack/labels/PR:%20CI-not-ok","name":"PR: CI-not-ok","color":"d93f0b","default":false},{"id":689140390,"node_id":"MDU6TGFiZWw2ODkxNDAzOTA=","url":"https://api.github.com/repos/webpack/webpack/labels/PR:%20next","name":"PR: next","color":"8b32d3","default":false},{"id":572817412,"node_id":"MDU6TGFiZWw1NzI4MTc0MTI=","url":"https://api.github.com/repos/webpack/webpack/labels/PR:%20review-outdated","name":"PR: review-outdated","color":"d93f0b","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/webpack/webpack/pulls/8547/commits","review_comments_url":"https://api.github.com/repos/webpack/webpack/pulls/8547/comments","review_comment_url":"https://api.github.com/repos/webpack/webpack/pulls/comments{/number}","comments_url":"https://api.github.com/repos/webpack/webpack/issues/8547/comments","statuses_url":"https://api.github.com/repos/webpack/webpack/statuses/2143bd6519d17ad0ec66038870958dda9dbd2ae9","head":{"label":"Connormiha:optimize-absolute-to-path","ref":"optimize-absolute-to-path","sha":"2143bd6519d17ad0ec66038870958dda9dbd2ae9","user":{"login":"Connormiha","id":4091305,"node_id":"MDQ6VXNlcjQwOTEzMDU=","avatar_url":"https://avatars1.githubusercontent.com/u/4091305?v=4","gravatar_id":"","url":"https://api.github.com/users/Connormiha","html_url":"https://github.com/Connormiha","followers_url":"https://api.github.com/users/Connormiha/followers","following_url":"https://api.github.com/users/Connormiha/following{/other_user}","gists_url":"https://api.github.com/users/Connormiha/gists{/gist_id}","starred_url":"https://api.github.com/users/Connormiha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Connormiha/subscriptions","organizations_url":"https://api.github.com/users/Connormiha/orgs","repos_url":"https://api.github.com/users/Connormiha/repos","events_url":"https://api.github.com/users/Connormiha/events{/privacy}","received_events_url":"https://api.github.com/users/Connormiha/received_events","type":"User","site_admin":false},"repo":{"id":84652043,"node_id":"MDEwOlJlcG9zaXRvcnk4NDY1MjA0Mw==","name":"webpack","full_name":"Connormiha/webpack","private":false,"owner":{"login":"Connormiha","id":4091305,"node_id":"MDQ6VXNlcjQwOTEzMDU=","avatar_url":"https://avatars1.githubusercontent.com/u/4091305?v=4","gravatar_id":"","url":"https://api.github.com/users/Connormiha","html_url":"https://github.com/Connormiha","followers_url":"https://api.github.com/users/Connormiha/followers","following_url":"https://api.github.com/users/Connormiha/following{/other_user}","gists_url":"https://api.github.com/users/Connormiha/gists{/gist_id}","starred_url":"https://api.github.com/users/Connormiha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Connormiha/subscriptions","organizations_url":"https://api.github.com/users/Connormiha/orgs","repos_url":"https://api.github.com/users/Connormiha/repos","events_url":"https://api.github.com/users/Connormiha/events{/privacy}","received_events_url":"https://api.github.com/users/Connormiha/received_events","type":"User","site_admin":false},"html_url":"https://github.com/Connormiha/webpack","description":"A bundler for javascript and friends. Packs many modules into a few bundled assets. Code Splitting allows to load parts for the application on demand. Through \"loaders,\" modules can be CommonJs, AMD, ES6 modules, CSS, Images, JSON, Coffeescript, LESS, ... and your custom stuff.","fork":true,"url":"https://api.github.com/repos/Connormiha/webpack","forks_url":"https://api.github.com/repos/Connormiha/webpack/forks","keys_url":"https://api.github.com/repos/Connormiha/webpack/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Connormiha/webpack/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Connormiha/webpack/teams","hooks_url":"https://api.github.com/repos/Connormiha/webpack/hooks","issue_events_url":"https://api.github.com/repos/Connormiha/webpack/issues/events{/number}","events_url":"https://api.github.com/repos/Connormiha/webpack/events","assignees_url":"https://api.github.com/repos/Connormiha/webpack/assignees{/user}","branches_url":"https://api.github.com/repos/Connormiha/webpack/branches{/branch}","tags_url":"https://api.github.com/repos/Connormiha/webpack/tags","blobs_url":"https://api.github.com/repos/Connormiha/webpack/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Connormiha/webpack/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Connormiha/webpack/git/refs{/sha}","trees_url":"https://api.github.com/repos/Connormiha/webpack/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Connormiha/webpack/statuses/{sha}","languages_url":"https://api.github.com/repos/Connormiha/webpack/languages","stargazers_url":"https://api.github.com/repos/Connormiha/webpack/stargazers","contributors_url":"https://api.github.com/repos/Connormiha/webpack/contributors","subscribers_url":"https://api.github.com/repos/Connormiha/webpack/subscribers","subscription_url":"https://api.github.com/repos/Connormiha/webpack/subscription","commits_url":"https://api.github.com/repos/Connormiha/webpack/commits{/sha}","git_commits_url":"https://api.github.com/repos/Connormiha/webpack/git/commits{/sha}","comments_url":"https://api.github.com/repos/Connormiha/webpack/comments{/number}","issue_comment_url":"https://api.github.com/repos/Connormiha/webpack/issues/comments{/number}","contents_url":"https://api.github.com/repos/Connormiha/webpack/contents/{+path}","compare_url":"https://api.github.com/repos/Connormiha/webpack/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Connormiha/webpack/merges","archive_url":"https://api.github.com/repos/Connormiha/webpack/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Connormiha/webpack/downloads","issues_url":"https://api.github.com/repos/Connormiha/webpack/issues{/number}","pulls_url":"https://api.github.com/repos/Connormiha/webpack/pulls{/number}","milestones_url":"https://api.github.com/repos/Connormiha/webpack/milestones{/number}","notifications_url":"https://api.github.com/repos/Connormiha/webpack/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Connormiha/webpack/labels{/name}","releases_url":"https://api.github.com/repos/Connormiha/webpack/releases{/id}","deployments_url":"https://api.github.com/repos/Connormiha/webpack/deployments","created_at":"2017-03-11T13:31:18Z","updated_at":"2017-03-11T13:31:24Z","pushed_at":"2018-12-26T10:14:02Z","git_url":"git://github.com/Connormiha/webpack.git","ssh_url":"git@github.com:Connormiha/webpack.git","clone_url":"https://github.com/Connormiha/webpack.git","svn_url":"https://github.com/Connormiha/webpack","homepage":"https://webpack.js.org","size":19725,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"webpack:next","ref":"next","sha":"a49c417988c99a8a9db381c71d7edfa46d557d10","user":{"login":"webpack","id":2105791,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIxMDU3OTE=","avatar_url":"https://avatars2.githubusercontent.com/u/2105791?v=4","gravatar_id":"","url":"https://api.github.com/users/webpack","html_url":"https://github.com/webpack","followers_url":"https://api.github.com/users/webpack/followers","following_url":"https://api.github.com/users/webpack/following{/other_user}","gists_url":"https://api.github.com/users/webpack/gists{/gist_id}","starred_url":"https://api.github.com/users/webpack/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/webpack/subscriptions","organizations_url":"https://api.github.com/users/webpack/orgs","repos_url":"https://api.github.com/users/webpack/repos","events_url":"https://api.github.com/users/webpack/events{/privacy}","received_events_url":"https://api.github.com/users/webpack/received_events","type":"Organization","site_admin":false},"repo":{"id":3678731,"node_id":"MDEwOlJlcG9zaXRvcnkzNjc4NzMx","name":"webpack","full_name":"webpack/webpack","private":false,"owner":{"login":"webpack","id":2105791,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIxMDU3OTE=","avatar_url":"https://avatars2.githubusercontent.com/u/2105791?v=4","gravatar_id":"","url":"https://api.github.com/users/webpack","html_url":"https://github.com/webpack","followers_url":"https://api.github.com/users/webpack/followers","following_url":"https://api.github.com/users/webpack/following{/other_user}","gists_url":"https://api.github.com/users/webpack/gists{/gist_id}","starred_url":"https://api.github.com/users/webpack/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/webpack/subscriptions","organizations_url":"https://api.github.com/users/webpack/orgs","repos_url":"https://api.github.com/users/webpack/repos","events_url":"https://api.github.com/users/webpack/events{/privacy}","received_events_url":"https://api.github.com/users/webpack/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/webpack/webpack","description":"A bundler for javascript and friends. Packs many modules into a few bundled assets. Code Splitting allows for loading parts of the application on demand. Through \"loaders\", modules can be CommonJs, AMD, ES6 modules, CSS, Images, JSON, Coffeescript, LESS, ... and your custom stuff.","fork":false,"url":"https://api.github.com/repos/webpack/webpack","forks_url":"https://api.github.com/repos/webpack/webpack/forks","keys_url":"https://api.github.com/repos/webpack/webpack/keys{/key_id}","collaborators_url":"https://api.github.com/repos/webpack/webpack/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/webpack/webpack/teams","hooks_url":"https://api.github.com/repos/webpack/webpack/hooks","issue_events_url":"https://api.github.com/repos/webpack/webpack/issues/events{/number}","events_url":"https://api.github.com/repos/webpack/webpack/events","assignees_url":"https://api.github.com/repos/webpack/webpack/assignees{/user}","branches_url":"https://api.github.com/repos/webpack/webpack/branches{/branch}","tags_url":"https://api.github.com/repos/webpack/webpack/tags","blobs_url":"https://api.github.com/repos/webpack/webpack/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/webpack/webpack/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/webpack/webpack/git/refs{/sha}","trees_url":"https://api.github.com/repos/webpack/webpack/git/trees{/sha}","statuses_url":"https://api.github.com/repos/webpack/webpack/statuses/{sha}","languages_url":"https://api.github.com/repos/webpack/webpack/languages","stargazers_url":"https://api.github.com/repos/webpack/webpack/stargazers","contributors_url":"https://api.github.com/repos/webpack/webpack/contributors","subscribers_url":"https://api.github.com/repos/webpack/webpack/subscribers","subscription_url":"https://api.github.com/repos/webpack/webpack/subscription","commits_url":"https://api.github.com/repos/webpack/webpack/commits{/sha}","git_commits_url":"https://api.github.com/repos/webpack/webpack/git/commits{/sha}","comments_url":"https://api.github.com/repos/webpack/webpack/comments{/number}","issue_comment_url":"https://api.github.com/repos/webpack/webpack/issues/comments{/number}","contents_url":"https://api.github.com/repos/webpack/webpack/contents/{+path}","compare_url":"https://api.github.com/repos/webpack/webpack/compare/{base}...{head}","merges_url":"https://api.github.com/repos/webpack/webpack/merges","archive_url":"https://api.github.com/repos/webpack/webpack/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/webpack/webpack/downloads","issues_url":"https://api.github.com/repos/webpack/webpack/issues{/number}","pulls_url":"https://api.github.com/repos/webpack/webpack/pulls{/number}","milestones_url":"https://api.github.com/repos/webpack/webpack/milestones{/number}","notifications_url":"https://api.github.com/repos/webpack/webpack/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/webpack/webpack/labels{/name}","releases_url":"https://api.github.com/repos/webpack/webpack/releases{/id}","deployments_url":"https://api.github.com/repos/webpack/webpack/deployments","created_at":"2012-03-10T10:08:14Z","updated_at":"2018-12-26T09:23:40Z","pushed_at":"2018-12-26T10:14:06Z","git_url":"git://github.com/webpack/webpack.git","ssh_url":"git@github.com:webpack/webpack.git","clone_url":"https://github.com/webpack/webpack.git","svn_url":"https://github.com/webpack/webpack","homepage":"https://webpack.js.org","size":20095,"stargazers_count":46047,"watchers_count":46047,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5825,"mirror_url":null,"archived":false,"open_issues_count":495,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":5825,"open_issues":495,"watchers":46047,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/webpack/webpack/pulls/8547"},"html":{"href":"https://github.com/webpack/webpack/pull/8547"},"issue":{"href":"https://api.github.com/repos/webpack/webpack/issues/8547"},"comments":{"href":"https://api.github.com/repos/webpack/webpack/issues/8547/comments"},"review_comments":{"href":"https://api.github.com/repos/webpack/webpack/pulls/8547/comments"},"review_comment":{"href":"https://api.github.com/repos/webpack/webpack/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/webpack/webpack/pulls/8547/commits"},"statuses":{"href":"https://api.github.com/repos/webpack/webpack/statuses/2143bd6519d17ad0ec66038870958dda9dbd2ae9"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"sokra"}}