{"action":"created","comment":{"url":"https://api.github.com/repos/nodejs/node/pulls/comments/213560715","pull_request_review_id":150420320,"id":213560715,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxMzU2MDcxNQ==","diff_hunk":"@@ -888,12 +888,29 @@ by the [module wrapper][]. To access it, require the `Module` module:\n const builtin = require('module').builtinModules;\n ```\n \n+### module.createRequireFunction(filename)\n+<!-- YAML\n+added: REPLACEME\n+-->\n+\n+* `filename` {string|URL} Filename for relative importing\n+* Returns: {[`require`][]} Require function\n+\n+<!-- eslint-skip -->\n+```js\n+// create a require function which will resolve relative\n+// to the current ES Module file\n+import Module from 'module';\n+const require = Module.createRequireFunction(new URL(import.meta.url));\n+```\n+","path":"doc/api/modules.md","position":19,"original_position":19,"commit_id":"a26ddc06832d8af8908224c51f600f94da037767","original_commit_id":"a26ddc06832d8af8908224c51f600f94da037767","user":{"login":"mcollina","id":52195,"node_id":"MDQ6VXNlcjUyMTk1","avatar_url":"https://avatars0.githubusercontent.com/u/52195?v=4","gravatar_id":"","url":"https://api.github.com/users/mcollina","html_url":"https://github.com/mcollina","followers_url":"https://api.github.com/users/mcollina/followers","following_url":"https://api.github.com/users/mcollina/following{/other_user}","gists_url":"https://api.github.com/users/mcollina/gists{/gist_id}","starred_url":"https://api.github.com/users/mcollina/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mcollina/subscriptions","organizations_url":"https://api.github.com/users/mcollina/orgs","repos_url":"https://api.github.com/users/mcollina/repos","events_url":"https://api.github.com/users/mcollina/events{/privacy}","received_events_url":"https://api.github.com/users/mcollina/received_events","type":"User","site_admin":false},"body":"Can you also add an example using cjs and require? This is useful outside of ESM.","created_at":"2018-08-29T06:41:25Z","updated_at":"2018-08-29T06:42:46Z","html_url":"https://github.com/nodejs/node/pull/19360#discussion_r213560715","pull_request_url":"https://api.github.com/repos/nodejs/node/pulls/19360","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/nodejs/node/pulls/comments/213560715"},"html":{"href":"https://github.com/nodejs/node/pull/19360#discussion_r213560715"},"pull_request":{"href":"https://api.github.com/repos/nodejs/node/pulls/19360"}},"in_reply_to_id":195779396},"pull_request":{"url":"https://api.github.com/repos/nodejs/node/pulls/19360","id":175114331,"node_id":"MDExOlB1bGxSZXF1ZXN0MTc1MTE0MzMx","html_url":"https://github.com/nodejs/node/pull/19360","diff_url":"https://github.com/nodejs/node/pull/19360.diff","patch_url":"https://github.com/nodejs/node/pull/19360.patch","issue_url":"https://api.github.com/repos/nodejs/node/issues/19360","number":19360,"state":"open","locked":false,"title":"module: add createRequireFunction method","user":{"login":"devsnek","id":5952481,"node_id":"MDQ6VXNlcjU5NTI0ODE=","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":"useful method for all sorts of stuff such as relative require from project root or whatever else you can come up with\r\n\r\n##### Checklist\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","created_at":"2018-03-14T23:43:46Z","updated_at":"2018-08-29T06:42:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c70834b8306ae691b54b75450f98eef80b9485ed","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":155435814,"node_id":"MDU6TGFiZWwxNTU0MzU4MTQ=","url":"https://api.github.com/repos/nodejs/node/labels/module","name":"module","color":"fbca04","default":false},{"id":169485478,"node_id":"MDU6TGFiZWwxNjk0ODU0Nzg=","url":"https://api.github.com/repos/nodejs/node/labels/semver-minor","name":"semver-minor","color":"fef2c0","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/nodejs/node/pulls/19360/commits","review_comments_url":"https://api.github.com/repos/nodejs/node/pulls/19360/comments","review_comment_url":"https://api.github.com/repos/nodejs/node/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nodejs/node/issues/19360/comments","statuses_url":"https://api.github.com/repos/nodejs/node/statuses/a26ddc06832d8af8908224c51f600f94da037767","head":{"label":"devsnek:feature/module-makerequire","ref":"feature/module-makerequire","sha":"a26ddc06832d8af8908224c51f600f94da037767","user":{"login":"devsnek","id":5952481,"node_id":"MDQ6VXNlcjU5NTI0ODE=","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},"repo":{"id":86208251,"node_id":"MDEwOlJlcG9zaXRvcnk4NjIwODI1MQ==","name":"node","full_name":"devsnek/node","owner":{"login":"devsnek","id":5952481,"node_id":"MDQ6VXNlcjU5NTI0ODE=","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},"private":false,"html_url":"https://github.com/devsnek/node","description":"Node.js JavaScript runtime :sparkles::turtle::rocket::sparkles:","fork":true,"url":"https://api.github.com/repos/devsnek/node","forks_url":"https://api.github.com/repos/devsnek/node/forks","keys_url":"https://api.github.com/repos/devsnek/node/keys{/key_id}","collaborators_url":"https://api.github.com/repos/devsnek/node/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/devsnek/node/teams","hooks_url":"https://api.github.com/repos/devsnek/node/hooks","issue_events_url":"https://api.github.com/repos/devsnek/node/issues/events{/number}","events_url":"https://api.github.com/repos/devsnek/node/events","assignees_url":"https://api.github.com/repos/devsnek/node/assignees{/user}","branches_url":"https://api.github.com/repos/devsnek/node/branches{/branch}","tags_url":"https://api.github.com/repos/devsnek/node/tags","blobs_url":"https://api.github.com/repos/devsnek/node/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/devsnek/node/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/devsnek/node/git/refs{/sha}","trees_url":"https://api.github.com/repos/devsnek/node/git/trees{/sha}","statuses_url":"https://api.github.com/repos/devsnek/node/statuses/{sha}","languages_url":"https://api.github.com/repos/devsnek/node/languages","stargazers_url":"https://api.github.com/repos/devsnek/node/stargazers","contributors_url":"https://api.github.com/repos/devsnek/node/contributors","subscribers_url":"https://api.github.com/repos/devsnek/node/subscribers","subscription_url":"https://api.github.com/repos/devsnek/node/subscription","commits_url":"https://api.github.com/repos/devsnek/node/commits{/sha}","git_commits_url":"https://api.github.com/repos/devsnek/node/git/commits{/sha}","comments_url":"https://api.github.com/repos/devsnek/node/comments{/number}","issue_comment_url":"https://api.github.com/repos/devsnek/node/issues/comments{/number}","contents_url":"https://api.github.com/repos/devsnek/node/contents/{+path}","compare_url":"https://api.github.com/repos/devsnek/node/compare/{base}...{head}","merges_url":"https://api.github.com/repos/devsnek/node/merges","archive_url":"https://api.github.com/repos/devsnek/node/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/devsnek/node/downloads","issues_url":"https://api.github.com/repos/devsnek/node/issues{/number}","pulls_url":"https://api.github.com/repos/devsnek/node/pulls{/number}","milestones_url":"https://api.github.com/repos/devsnek/node/milestones{/number}","notifications_url":"https://api.github.com/repos/devsnek/node/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/devsnek/node/labels{/name}","releases_url":"https://api.github.com/repos/devsnek/node/releases{/id}","deployments_url":"https://api.github.com/repos/devsnek/node/deployments","created_at":"2017-03-26T04:48:23Z","updated_at":"2018-08-28T15:48:19Z","pushed_at":"2018-08-28T17:05:23Z","git_url":"git://github.com/devsnek/node.git","ssh_url":"git@github.com:devsnek/node.git","clone_url":"https://github.com/devsnek/node.git","svn_url":"https://github.com/devsnek/node","homepage":"https://nodejs.org","size":351580,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"nodejs:master","ref":"master","sha":"9acf4c54927c14fde72d60824f9e1b47d30b74f2","user":{"login":"nodejs","id":9950313,"node_id":"MDEyOk9yZ2FuaXphdGlvbjk5NTAzMTM=","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,"node_id":"MDEwOlJlcG9zaXRvcnkyNzE5Mzc3OQ==","name":"node","full_name":"nodejs/node","owner":{"login":"nodejs","id":9950313,"node_id":"MDEyOk9yZ2FuaXphdGlvbjk5NTAzMTM=","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-08-29T06:02:47Z","pushed_at":"2018-08-29T06:40:29Z","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":404311,"stargazers_count":52757,"watchers_count":52757,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":11172,"mirror_url":null,"archived":false,"open_issues_count":866,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":11172,"open_issues":866,"watchers":52757,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nodejs/node/pulls/19360"},"html":{"href":"https://github.com/nodejs/node/pull/19360"},"issue":{"href":"https://api.github.com/repos/nodejs/node/issues/19360"},"comments":{"href":"https://api.github.com/repos/nodejs/node/issues/19360/comments"},"review_comments":{"href":"https://api.github.com/repos/nodejs/node/pulls/19360/comments"},"review_comment":{"href":"https://api.github.com/repos/nodejs/node/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nodejs/node/pulls/19360/commits"},"statuses":{"href":"https://api.github.com/repos/nodejs/node/statuses/a26ddc06832d8af8908224c51f600f94da037767"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"mcollina"}}