{"action":"created","comment":{"url":"https://api.github.com/repos/nodejs/node/pulls/comments/167584841","pull_request_review_id":95823151,"id":167584841,"diff_hunk":"@@ -1,17 +1,55 @@\n 'use strict';\n \n const {\n+  setImportModuleDynamicallyCallback,\n   setInitializeImportMetaObjectCallback\n } = internalBinding('module_wrap');\n \n+const { getURLFromFilePath } = require('internal/url');\n+const Loader = require('internal/loader/Loader');\n+const path = require('path');\n+const { URL } = require('url');\n+\n+function normalizeReferrerURL(referrer) {\n+  if (typeof referrer === 'string' && path.isAbsolute(referrer)) {\n+    return getURLFromFilePath(referrer).href;\n+  }\n+  return new URL(referrer).href;\n+}\n+\n function initializeImportMetaObject(wrap, meta) {\n   meta.url = wrap.url;\n }\n \n-function setupModules() {\n+let loaderResolve, loaderReject;","path":"lib/internal/process/modules.js","position":25,"original_position":25,"commit_id":"5855e5ca839100fb8fb23d4b878e46ef61dc1708","original_commit_id":"5855e5ca839100fb8fb23d4b878e46ef61dc1708","user":{"login":"devsnek","id":5952481,"avatar_url":"https://avatars3.githubusercontent.com/u/5952481?v=4","gravatar_id":"","url":"https://api.github.com/users/devsnek","html_url":"https://github.com/devsnek","followers_url":"https://api.github.com/users/devsnek/followers","following_url":"https://api.github.com/users/devsnek/following{/other_user}","gists_url":"https://api.github.com/users/devsnek/gists{/gist_id}","starred_url":"https://api.github.com/users/devsnek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/devsnek/subscriptions","organizations_url":"https://api.github.com/users/devsnek/orgs","repos_url":"https://api.github.com/users/devsnek/repos","events_url":"https://api.github.com/users/devsnek/events{/privacy}","received_events_url":"https://api.github.com/users/devsnek/received_events","type":"User","site_admin":false},"body":"could also just use createPromise/promiseReject/promiseResolve, no?","created_at":"2018-02-12T15:14:47Z","updated_at":"2018-02-12T15:14:47Z","html_url":"https://github.com/nodejs/node/pull/18728#discussion_r167584841","pull_request_url":"https://api.github.com/repos/nodejs/node/pulls/18728","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/nodejs/node/pulls/comments/167584841"},"html":{"href":"https://github.com/nodejs/node/pull/18728#discussion_r167584841"},"pull_request":{"href":"https://api.github.com/repos/nodejs/node/pulls/18728"}},"in_reply_to_id":167581676},"pull_request":{"url":"https://api.github.com/repos/nodejs/node/pulls/18728","id":168555804,"html_url":"https://github.com/nodejs/node/pull/18728","diff_url":"https://github.com/nodejs/node/pull/18728.diff","patch_url":"https://github.com/nodejs/node/pull/18728.patch","issue_url":"https://api.github.com/repos/nodejs/node/issues/18728","number":18728,"state":"open","locked":false,"title":"esm: Add support for pjson cache and main without extensions","user":{"login":"guybedford","id":598730,"avatar_url":"https://avatars1.githubusercontent.com/u/598730?v=4","gravatar_id":"","url":"https://api.github.com/users/guybedford","html_url":"https://github.com/guybedford","followers_url":"https://api.github.com/users/guybedford/followers","following_url":"https://api.github.com/users/guybedford/following{/other_user}","gists_url":"https://api.github.com/users/guybedford/gists{/gist_id}","starred_url":"https://api.github.com/users/guybedford/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guybedford/subscriptions","organizations_url":"https://api.github.com/users/guybedford/orgs","repos_url":"https://api.github.com/users/guybedford/repos","events_url":"https://api.github.com/users/guybedford/events{/privacy}","received_events_url":"https://api.github.com/users/guybedford/received_events","type":"User","site_admin":false},"body":"I've pulled out the refactorings from #18392 that aren't directly related to the package.json flag, in particular two features:\r\n\r\n1. Ensuring that `node --experimental-modules module-without-an-extension` works as a special case. This is necessary for ensuring backwards-compatibility with NodeJS bin workflows. But extensions are still not permitted in dependencies.\r\n2. Adding a package.json cache to the C++ resolver code. As mentioned previously the goal here is to ultimately share the cache with the CommonJS resolver, but for now at least this is a first step and better than having no cache as we do currently.\r\n\r\nReview much appreciated especially with the C++ code.\r\n\r\nHopefully this shouldn't be too controversial allowing these useful features to not be blocked by progress on #18392.\r\n\r\n##### Checklist\r\n<!-- Remove items that do not apply. For completed items, change [ ] to [x]. -->\r\n\r\n- [x] `make -j4 test` (UNIX), or `vcbuild test` (Windows) passes\r\n- [x] tests and/or benchmarks are included\r\n- [x] documentation is changed or added\r\n- [x] commit message follows [commit guidelines](https://github.com/nodejs/node/blob/master/doc/guides/contributing/pull-requests.md#commit-message-guidelines)\r\n\r\n##### Affected core subsystem(s)\r\n<!-- Provide affected core subsystem(s) (like doc, cluster, crypto, etc). -->\r\nesmodules","created_at":"2018-02-12T11:34:28Z","updated_at":"2018-02-12T15:14:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f5f36b28c93452a76f1cce17a4ad5ccbf5f5d123","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":690799345,"url":"https://api.github.com/repos/nodejs/node/labels/ES%20Modules","name":"ES Modules","color":"0052cc","default":false},{"id":281232761,"url":"https://api.github.com/repos/nodejs/node/labels/lib%20/%20src","name":"lib / src","color":"fad8c7","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/nodejs/node/pulls/18728/commits","review_comments_url":"https://api.github.com/repos/nodejs/node/pulls/18728/comments","review_comment_url":"https://api.github.com/repos/nodejs/node/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nodejs/node/issues/18728/comments","statuses_url":"https://api.github.com/repos/nodejs/node/statuses/5855e5ca839100fb8fb23d4b878e46ef61dc1708","head":{"label":"guybedford:esm-resolve-refactor-cache","ref":"esm-resolve-refactor-cache","sha":"5855e5ca839100fb8fb23d4b878e46ef61dc1708","user":{"login":"guybedford","id":598730,"avatar_url":"https://avatars1.githubusercontent.com/u/598730?v=4","gravatar_id":"","url":"https://api.github.com/users/guybedford","html_url":"https://github.com/guybedford","followers_url":"https://api.github.com/users/guybedford/followers","following_url":"https://api.github.com/users/guybedford/following{/other_user}","gists_url":"https://api.github.com/users/guybedford/gists{/gist_id}","starred_url":"https://api.github.com/users/guybedford/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guybedford/subscriptions","organizations_url":"https://api.github.com/users/guybedford/orgs","repos_url":"https://api.github.com/users/guybedford/repos","events_url":"https://api.github.com/users/guybedford/events{/privacy}","received_events_url":"https://api.github.com/users/guybedford/received_events","type":"User","site_admin":false},"repo":{"id":102259337,"name":"node","full_name":"guybedford/node","owner":{"login":"guybedford","id":598730,"avatar_url":"https://avatars1.githubusercontent.com/u/598730?v=4","gravatar_id":"","url":"https://api.github.com/users/guybedford","html_url":"https://github.com/guybedford","followers_url":"https://api.github.com/users/guybedford/followers","following_url":"https://api.github.com/users/guybedford/following{/other_user}","gists_url":"https://api.github.com/users/guybedford/gists{/gist_id}","starred_url":"https://api.github.com/users/guybedford/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guybedford/subscriptions","organizations_url":"https://api.github.com/users/guybedford/orgs","repos_url":"https://api.github.com/users/guybedford/repos","events_url":"https://api.github.com/users/guybedford/events{/privacy}","received_events_url":"https://api.github.com/users/guybedford/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/guybedford/node","description":"Node.js JavaScript runtime :sparkles::turtle::rocket::sparkles:","fork":true,"url":"https://api.github.com/repos/guybedford/node","forks_url":"https://api.github.com/repos/guybedford/node/forks","keys_url":"https://api.github.com/repos/guybedford/node/keys{/key_id}","collaborators_url":"https://api.github.com/repos/guybedford/node/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/guybedford/node/teams","hooks_url":"https://api.github.com/repos/guybedford/node/hooks","issue_events_url":"https://api.github.com/repos/guybedford/node/issues/events{/number}","events_url":"https://api.github.com/repos/guybedford/node/events","assignees_url":"https://api.github.com/repos/guybedford/node/assignees{/user}","branches_url":"https://api.github.com/repos/guybedford/node/branches{/branch}","tags_url":"https://api.github.com/repos/guybedford/node/tags","blobs_url":"https://api.github.com/repos/guybedford/node/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/guybedford/node/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/guybedford/node/git/refs{/sha}","trees_url":"https://api.github.com/repos/guybedford/node/git/trees{/sha}","statuses_url":"https://api.github.com/repos/guybedford/node/statuses/{sha}","languages_url":"https://api.github.com/repos/guybedford/node/languages","stargazers_url":"https://api.github.com/repos/guybedford/node/stargazers","contributors_url":"https://api.github.com/repos/guybedford/node/contributors","subscribers_url":"https://api.github.com/repos/guybedford/node/subscribers","subscription_url":"https://api.github.com/repos/guybedford/node/subscription","commits_url":"https://api.github.com/repos/guybedford/node/commits{/sha}","git_commits_url":"https://api.github.com/repos/guybedford/node/git/commits{/sha}","comments_url":"https://api.github.com/repos/guybedford/node/comments{/number}","issue_comment_url":"https://api.github.com/repos/guybedford/node/issues/comments{/number}","contents_url":"https://api.github.com/repos/guybedford/node/contents/{+path}","compare_url":"https://api.github.com/repos/guybedford/node/compare/{base}...{head}","merges_url":"https://api.github.com/repos/guybedford/node/merges","archive_url":"https://api.github.com/repos/guybedford/node/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/guybedford/node/downloads","issues_url":"https://api.github.com/repos/guybedford/node/issues{/number}","pulls_url":"https://api.github.com/repos/guybedford/node/pulls{/number}","milestones_url":"https://api.github.com/repos/guybedford/node/milestones{/number}","notifications_url":"https://api.github.com/repos/guybedford/node/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/guybedford/node/labels{/name}","releases_url":"https://api.github.com/repos/guybedford/node/releases{/id}","deployments_url":"https://api.github.com/repos/guybedford/node/deployments","created_at":"2017-09-03T11:18:55Z","updated_at":"2017-09-03T11:19:32Z","pushed_at":"2018-02-12T14:50:28Z","git_url":"git://github.com/guybedford/node.git","ssh_url":"git@github.com:guybedford/node.git","clone_url":"https://github.com/guybedford/node.git","svn_url":"https://github.com/guybedford/node","homepage":"https://nodejs.org","size":337597,"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":1,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"nodejs:master","ref":"master","sha":"ba944b16972c4b248e946d4bacb2141e5ef7eba9","user":{"login":"nodejs","id":9950313,"avatar_url":"https://avatars3.githubusercontent.com/u/9950313?v=4","gravatar_id":"","url":"https://api.github.com/users/nodejs","html_url":"https://github.com/nodejs","followers_url":"https://api.github.com/users/nodejs/followers","following_url":"https://api.github.com/users/nodejs/following{/other_user}","gists_url":"https://api.github.com/users/nodejs/gists{/gist_id}","starred_url":"https://api.github.com/users/nodejs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nodejs/subscriptions","organizations_url":"https://api.github.com/users/nodejs/orgs","repos_url":"https://api.github.com/users/nodejs/repos","events_url":"https://api.github.com/users/nodejs/events{/privacy}","received_events_url":"https://api.github.com/users/nodejs/received_events","type":"Organization","site_admin":false},"repo":{"id":27193779,"name":"node","full_name":"nodejs/node","owner":{"login":"nodejs","id":9950313,"avatar_url":"https://avatars3.githubusercontent.com/u/9950313?v=4","gravatar_id":"","url":"https://api.github.com/users/nodejs","html_url":"https://github.com/nodejs","followers_url":"https://api.github.com/users/nodejs/followers","following_url":"https://api.github.com/users/nodejs/following{/other_user}","gists_url":"https://api.github.com/users/nodejs/gists{/gist_id}","starred_url":"https://api.github.com/users/nodejs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nodejs/subscriptions","organizations_url":"https://api.github.com/users/nodejs/orgs","repos_url":"https://api.github.com/users/nodejs/repos","events_url":"https://api.github.com/users/nodejs/events{/privacy}","received_events_url":"https://api.github.com/users/nodejs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/nodejs/node","description":"Node.js JavaScript runtime :sparkles::turtle::rocket::sparkles:","fork":false,"url":"https://api.github.com/repos/nodejs/node","forks_url":"https://api.github.com/repos/nodejs/node/forks","keys_url":"https://api.github.com/repos/nodejs/node/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nodejs/node/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nodejs/node/teams","hooks_url":"https://api.github.com/repos/nodejs/node/hooks","issue_events_url":"https://api.github.com/repos/nodejs/node/issues/events{/number}","events_url":"https://api.github.com/repos/nodejs/node/events","assignees_url":"https://api.github.com/repos/nodejs/node/assignees{/user}","branches_url":"https://api.github.com/repos/nodejs/node/branches{/branch}","tags_url":"https://api.github.com/repos/nodejs/node/tags","blobs_url":"https://api.github.com/repos/nodejs/node/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nodejs/node/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nodejs/node/git/refs{/sha}","trees_url":"https://api.github.com/repos/nodejs/node/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nodejs/node/statuses/{sha}","languages_url":"https://api.github.com/repos/nodejs/node/languages","stargazers_url":"https://api.github.com/repos/nodejs/node/stargazers","contributors_url":"https://api.github.com/repos/nodejs/node/contributors","subscribers_url":"https://api.github.com/repos/nodejs/node/subscribers","subscription_url":"https://api.github.com/repos/nodejs/node/subscription","commits_url":"https://api.github.com/repos/nodejs/node/commits{/sha}","git_commits_url":"https://api.github.com/repos/nodejs/node/git/commits{/sha}","comments_url":"https://api.github.com/repos/nodejs/node/comments{/number}","issue_comment_url":"https://api.github.com/repos/nodejs/node/issues/comments{/number}","contents_url":"https://api.github.com/repos/nodejs/node/contents/{+path}","compare_url":"https://api.github.com/repos/nodejs/node/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nodejs/node/merges","archive_url":"https://api.github.com/repos/nodejs/node/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nodejs/node/downloads","issues_url":"https://api.github.com/repos/nodejs/node/issues{/number}","pulls_url":"https://api.github.com/repos/nodejs/node/pulls{/number}","milestones_url":"https://api.github.com/repos/nodejs/node/milestones{/number}","notifications_url":"https://api.github.com/repos/nodejs/node/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nodejs/node/labels{/name}","releases_url":"https://api.github.com/repos/nodejs/node/releases{/id}","deployments_url":"https://api.github.com/repos/nodejs/node/deployments","created_at":"2014-11-26T19:57:11Z","updated_at":"2018-02-12T14:22:23Z","pushed_at":"2018-02-12T14:55:42Z","git_url":"git://github.com/nodejs/node.git","ssh_url":"git@github.com:nodejs/node.git","clone_url":"https://github.com/nodejs/node.git","svn_url":"https://github.com/nodejs/node","homepage":"https://nodejs.org","size":348882,"stargazers_count":45434,"watchers_count":45434,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":9526,"mirror_url":null,"archived":false,"open_issues_count":788,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":9526,"open_issues":788,"watchers":45434,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nodejs/node/pulls/18728"},"html":{"href":"https://github.com/nodejs/node/pull/18728"},"issue":{"href":"https://api.github.com/repos/nodejs/node/issues/18728"},"comments":{"href":"https://api.github.com/repos/nodejs/node/issues/18728/comments"},"review_comments":{"href":"https://api.github.com/repos/nodejs/node/pulls/18728/comments"},"review_comment":{"href":"https://api.github.com/repos/nodejs/node/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nodejs/node/pulls/18728/commits"},"statuses":{"href":"https://api.github.com/repos/nodejs/node/statuses/5855e5ca839100fb8fb23d4b878e46ef61dc1708"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"devsnek"}}