{"action":"created","comment":{"url":"https://api.github.com/repos/nodejs/ecmascript-modules/pulls/comments/233271455","pull_request_review_id":174647506,"id":233271455,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzMzI3MTQ1NQ==","diff_hunk":"@@ -179,12 +179,39 @@ _ESM_RESOLVE_:\n > 1. Assert: _packageSpecifier_ is a bare specifier.\n > 1. If _packageSpecifier_ is a Node.js builtin module then,\n >    1. Return _\"node:${packageSpecifier}\"_.\n-> 1. Set _parentURL_ to the parent folder URL of _parentURL_.\n+> 1. Set _package_ to the result of\n+>    **FIND_PACKAGE_BOUNDARY**(_packageSpecifier_, _parentURL_).\n+> 1. Set _meta_ to the result of loading the resource at _package.metaURL_ as JSON.\n+> 1. Set _packagePath_ to the result of removing _package.name_\n+>    from the beginning of _packageSpecifier_.\n+> 1. Set _directResolution_ to _meta.exports\\[packagePath]_.\n+> 1. If _directResolution_ is a string,\n+>    1. Return the URL resolution of _directResolution_ relative to _package.metaURL_.\n+> 1. Set _directoryKeys_ to the list of _meta.exports_ keys that end with \"/\",\n+>    sorted descending by length (longest key first).\n+> 1. For each _directoryKey_ in _directoryKeys_,\n+>    1. If _packagePath_ begins with _directoryKey_,\n+>       1. Set _directoryPath_ to the result of removing _directoryKey_ from the\n+>          beginning of _packagePath_.\n+>       1. Set _directoryResolution_ to \"${_meta.exports\\[_directoryKey_]}\".\n+>       1. Assert: _directoryResolution_ ends with \"/\".\n+>       1. Return the URL resolution of \"${_directoryResolution_}${_directoryPath_}\"\n+>          relative to _package.metaURL_.\n+> 1. Throw a _Module Not Found_ error.\n+\n+**FIND_PACKAGE_BOUNDARY**(_packageSpecifier_, _parentURL_)\n > 1. While _parentURL_ contains a non-empty _pathname_,\n->    1. Let _packageURL_ be the URL resolution of\n->       _\"${parentURL}/node_modules/${packageSpecifier}\"_.\n->    1. If the file at _packageURL_ exists then,\n->       1. Return _packageURL_.\n+>    1. Set _parentURL_ to the parent folder URL of _parentURL_.\n+>    1. Set _packageNameSegments_ to an empty list\n+>    1. While _packageNameSegments_ does not include all of _packageSpecifier_,\n+>       1. Append the next path segment of __packageSpecifier_\n+>          to __packageNameSegments_.\n+>       1. Set _packageName_ to \"${_packageNameSegments_.join(\"/\")}\"\n+>       1. Let _packageMetaURL_ be the URL resolution of\n+>          _\"${_parentURL_}/node_modules/${_packageName_}/package.json\"_.","path":"doc/api/esm.md","position":38,"original_position":38,"commit_id":"2be6083bb9fbb68413e6f26c718d5657a8a50c90","original_commit_id":"2be6083bb9fbb68413e6f26c718d5657a8a50c90","user":{"login":"jkrems","id":567540,"node_id":"MDQ6VXNlcjU2NzU0MA==","avatar_url":"https://avatars1.githubusercontent.com/u/567540?v=4","gravatar_id":"","url":"https://api.github.com/users/jkrems","html_url":"https://github.com/jkrems","followers_url":"https://api.github.com/users/jkrems/followers","following_url":"https://api.github.com/users/jkrems/following{/other_user}","gists_url":"https://api.github.com/users/jkrems/gists{/gist_id}","starred_url":"https://api.github.com/users/jkrems/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jkrems/subscriptions","organizations_url":"https://api.github.com/users/jkrems/orgs","repos_url":"https://api.github.com/users/jkrems/repos","events_url":"https://api.github.com/users/jkrems/events{/privacy}","received_events_url":"https://api.github.com/users/jkrems/received_events","type":"User","site_admin":false},"body":"Well, I'm trying to build towards \"real-life\" CJS instead of towards the spec. E.g. towards what people are currently hacking on top of CJS instead of the actual resolver as specified in the docs. E.g. tink, pnp, packaged apps. Rebuilding the same inefficiencies and asking people to support them feels awkward. I'm fine describing the default behavior in terms of `node_modules` but I would hope that in practice I wouldn't have to actually have a nested directory structure inside of my project directory.\r\n\r\nPeople already found ways to simulate CJS on top of more efficient, virtualized directory layouts. My hope is that we can skip that indirection / simulation effort for ESM and can make those approaches work natively. Maybe one day we can add APIs to allow node core's implementation of CJS to support these patterns out-of-the-box. I'd definitely welcome it. :)","created_at":"2018-11-14T00:10:19Z","updated_at":"2018-11-14T00:10:19Z","html_url":"https://github.com/nodejs/ecmascript-modules/pull/14#discussion_r233271455","pull_request_url":"https://api.github.com/repos/nodejs/ecmascript-modules/pulls/14","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/nodejs/ecmascript-modules/pulls/comments/233271455"},"html":{"href":"https://github.com/nodejs/ecmascript-modules/pull/14#discussion_r233271455"},"pull_request":{"href":"https://api.github.com/repos/nodejs/ecmascript-modules/pulls/14"}},"in_reply_to_id":233228109},"pull_request":{"url":"https://api.github.com/repos/nodejs/ecmascript-modules/pulls/14","id":230614351,"node_id":"MDExOlB1bGxSZXF1ZXN0MjMwNjE0MzUx","html_url":"https://github.com/nodejs/ecmascript-modules/pull/14","diff_url":"https://github.com/nodejs/ecmascript-modules/pull/14.diff","patch_url":"https://github.com/nodejs/ecmascript-modules/pull/14.patch","issue_url":"https://api.github.com/repos/nodejs/ecmascript-modules/issues/14","number":14,"state":"open","locked":false,"title":"[Do not merge] doc: Add pkg-exports proposal to resolve spec","user":{"login":"jkrems","id":567540,"node_id":"MDQ6VXNlcjU2NzU0MA==","avatar_url":"https://avatars1.githubusercontent.com/u/567540?v=4","gravatar_id":"","url":"https://api.github.com/users/jkrems","html_url":"https://github.com/jkrems","followers_url":"https://api.github.com/users/jkrems/followers","following_url":"https://api.github.com/users/jkrems/following{/other_user}","gists_url":"https://api.github.com/users/jkrems/gists{/gist_id}","starred_url":"https://api.github.com/users/jkrems/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jkrems/subscriptions","organizations_url":"https://api.github.com/users/jkrems/orgs","repos_url":"https://api.github.com/users/jkrems/repos","events_url":"https://api.github.com/users/jkrems/events{/privacy}","received_events_url":"https://api.github.com/users/jkrems/received_events","type":"User","site_admin":false},"body":"A potential way of expressing https://github.com/jkrems/proposal-pkg-exports in terms of the resolver spec.","created_at":"2018-11-13T20:29:11Z","updated_at":"2018-11-14T00:10:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0ef92244e819c0fef1b6852627597f9109d13004","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/nodejs/ecmascript-modules/pulls/14/commits","review_comments_url":"https://api.github.com/repos/nodejs/ecmascript-modules/pulls/14/comments","review_comment_url":"https://api.github.com/repos/nodejs/ecmascript-modules/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nodejs/ecmascript-modules/issues/14/comments","statuses_url":"https://api.github.com/repos/nodejs/ecmascript-modules/statuses/2be6083bb9fbb68413e6f26c718d5657a8a50c90","head":{"label":"nodejs:jkrems/feature/esm-resolver-spec/resource-resolver","ref":"jkrems/feature/esm-resolver-spec/resource-resolver","sha":"2be6083bb9fbb68413e6f26c718d5657a8a50c90","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":145752541,"node_id":"MDEwOlJlcG9zaXRvcnkxNDU3NTI1NDE=","name":"ecmascript-modules","full_name":"nodejs/ecmascript-modules","private":false,"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},"html_url":"https://github.com/nodejs/ecmascript-modules","description":"A fork of Node.js to hash out ideas related to ESModules","fork":false,"url":"https://api.github.com/repos/nodejs/ecmascript-modules","forks_url":"https://api.github.com/repos/nodejs/ecmascript-modules/forks","keys_url":"https://api.github.com/repos/nodejs/ecmascript-modules/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nodejs/ecmascript-modules/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nodejs/ecmascript-modules/teams","hooks_url":"https://api.github.com/repos/nodejs/ecmascript-modules/hooks","issue_events_url":"https://api.github.com/repos/nodejs/ecmascript-modules/issues/events{/number}","events_url":"https://api.github.com/repos/nodejs/ecmascript-modules/events","assignees_url":"https://api.github.com/repos/nodejs/ecmascript-modules/assignees{/user}","branches_url":"https://api.github.com/repos/nodejs/ecmascript-modules/branches{/branch}","tags_url":"https://api.github.com/repos/nodejs/ecmascript-modules/tags","blobs_url":"https://api.github.com/repos/nodejs/ecmascript-modules/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nodejs/ecmascript-modules/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nodejs/ecmascript-modules/git/refs{/sha}","trees_url":"https://api.github.com/repos/nodejs/ecmascript-modules/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nodejs/ecmascript-modules/statuses/{sha}","languages_url":"https://api.github.com/repos/nodejs/ecmascript-modules/languages","stargazers_url":"https://api.github.com/repos/nodejs/ecmascript-modules/stargazers","contributors_url":"https://api.github.com/repos/nodejs/ecmascript-modules/contributors","subscribers_url":"https://api.github.com/repos/nodejs/ecmascript-modules/subscribers","subscription_url":"https://api.github.com/repos/nodejs/ecmascript-modules/subscription","commits_url":"https://api.github.com/repos/nodejs/ecmascript-modules/commits{/sha}","git_commits_url":"https://api.github.com/repos/nodejs/ecmascript-modules/git/commits{/sha}","comments_url":"https://api.github.com/repos/nodejs/ecmascript-modules/comments{/number}","issue_comment_url":"https://api.github.com/repos/nodejs/ecmascript-modules/issues/comments{/number}","contents_url":"https://api.github.com/repos/nodejs/ecmascript-modules/contents/{+path}","compare_url":"https://api.github.com/repos/nodejs/ecmascript-modules/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nodejs/ecmascript-modules/merges","archive_url":"https://api.github.com/repos/nodejs/ecmascript-modules/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nodejs/ecmascript-modules/downloads","issues_url":"https://api.github.com/repos/nodejs/ecmascript-modules/issues{/number}","pulls_url":"https://api.github.com/repos/nodejs/ecmascript-modules/pulls{/number}","milestones_url":"https://api.github.com/repos/nodejs/ecmascript-modules/milestones{/number}","notifications_url":"https://api.github.com/repos/nodejs/ecmascript-modules/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nodejs/ecmascript-modules/labels{/name}","releases_url":"https://api.github.com/repos/nodejs/ecmascript-modules/releases{/id}","deployments_url":"https://api.github.com/repos/nodejs/ecmascript-modules/deployments","created_at":"2018-08-22T19:18:29Z","updated_at":"2018-11-11T20:18:15Z","pushed_at":"2018-11-13T21:24:55Z","git_url":"git://github.com/nodejs/ecmascript-modules.git","ssh_url":"git@github.com:nodejs/ecmascript-modules.git","clone_url":"https://github.com/nodejs/ecmascript-modules.git","svn_url":"https://github.com/nodejs/ecmascript-modules","homepage":null,"size":344976,"stargazers_count":23,"watchers_count":23,"language":"JavaScript","has_issues":false,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":5,"mirror_url":null,"archived":false,"open_issues_count":3,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":5,"open_issues":3,"watchers":23,"default_branch":"modules-lkgr"}},"base":{"label":"nodejs:esm-resolver-spec","ref":"esm-resolver-spec","sha":"719edb703fe156031935c26dca2007b0377d74ed","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":145752541,"node_id":"MDEwOlJlcG9zaXRvcnkxNDU3NTI1NDE=","name":"ecmascript-modules","full_name":"nodejs/ecmascript-modules","private":false,"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},"html_url":"https://github.com/nodejs/ecmascript-modules","description":"A fork of Node.js to hash out ideas related to ESModules","fork":false,"url":"https://api.github.com/repos/nodejs/ecmascript-modules","forks_url":"https://api.github.com/repos/nodejs/ecmascript-modules/forks","keys_url":"https://api.github.com/repos/nodejs/ecmascript-modules/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nodejs/ecmascript-modules/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nodejs/ecmascript-modules/teams","hooks_url":"https://api.github.com/repos/nodejs/ecmascript-modules/hooks","issue_events_url":"https://api.github.com/repos/nodejs/ecmascript-modules/issues/events{/number}","events_url":"https://api.github.com/repos/nodejs/ecmascript-modules/events","assignees_url":"https://api.github.com/repos/nodejs/ecmascript-modules/assignees{/user}","branches_url":"https://api.github.com/repos/nodejs/ecmascript-modules/branches{/branch}","tags_url":"https://api.github.com/repos/nodejs/ecmascript-modules/tags","blobs_url":"https://api.github.com/repos/nodejs/ecmascript-modules/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nodejs/ecmascript-modules/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nodejs/ecmascript-modules/git/refs{/sha}","trees_url":"https://api.github.com/repos/nodejs/ecmascript-modules/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nodejs/ecmascript-modules/statuses/{sha}","languages_url":"https://api.github.com/repos/nodejs/ecmascript-modules/languages","stargazers_url":"https://api.github.com/repos/nodejs/ecmascript-modules/stargazers","contributors_url":"https://api.github.com/repos/nodejs/ecmascript-modules/contributors","subscribers_url":"https://api.github.com/repos/nodejs/ecmascript-modules/subscribers","subscription_url":"https://api.github.com/repos/nodejs/ecmascript-modules/subscription","commits_url":"https://api.github.com/repos/nodejs/ecmascript-modules/commits{/sha}","git_commits_url":"https://api.github.com/repos/nodejs/ecmascript-modules/git/commits{/sha}","comments_url":"https://api.github.com/repos/nodejs/ecmascript-modules/comments{/number}","issue_comment_url":"https://api.github.com/repos/nodejs/ecmascript-modules/issues/comments{/number}","contents_url":"https://api.github.com/repos/nodejs/ecmascript-modules/contents/{+path}","compare_url":"https://api.github.com/repos/nodejs/ecmascript-modules/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nodejs/ecmascript-modules/merges","archive_url":"https://api.github.com/repos/nodejs/ecmascript-modules/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nodejs/ecmascript-modules/downloads","issues_url":"https://api.github.com/repos/nodejs/ecmascript-modules/issues{/number}","pulls_url":"https://api.github.com/repos/nodejs/ecmascript-modules/pulls{/number}","milestones_url":"https://api.github.com/repos/nodejs/ecmascript-modules/milestones{/number}","notifications_url":"https://api.github.com/repos/nodejs/ecmascript-modules/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nodejs/ecmascript-modules/labels{/name}","releases_url":"https://api.github.com/repos/nodejs/ecmascript-modules/releases{/id}","deployments_url":"https://api.github.com/repos/nodejs/ecmascript-modules/deployments","created_at":"2018-08-22T19:18:29Z","updated_at":"2018-11-11T20:18:15Z","pushed_at":"2018-11-13T21:24:55Z","git_url":"git://github.com/nodejs/ecmascript-modules.git","ssh_url":"git@github.com:nodejs/ecmascript-modules.git","clone_url":"https://github.com/nodejs/ecmascript-modules.git","svn_url":"https://github.com/nodejs/ecmascript-modules","homepage":null,"size":344976,"stargazers_count":23,"watchers_count":23,"language":"JavaScript","has_issues":false,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":5,"mirror_url":null,"archived":false,"open_issues_count":3,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":5,"open_issues":3,"watchers":23,"default_branch":"modules-lkgr"}},"_links":{"self":{"href":"https://api.github.com/repos/nodejs/ecmascript-modules/pulls/14"},"html":{"href":"https://github.com/nodejs/ecmascript-modules/pull/14"},"issue":{"href":"https://api.github.com/repos/nodejs/ecmascript-modules/issues/14"},"comments":{"href":"https://api.github.com/repos/nodejs/ecmascript-modules/issues/14/comments"},"review_comments":{"href":"https://api.github.com/repos/nodejs/ecmascript-modules/pulls/14/comments"},"review_comment":{"href":"https://api.github.com/repos/nodejs/ecmascript-modules/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nodejs/ecmascript-modules/pulls/14/commits"},"statuses":{"href":"https://api.github.com/repos/nodejs/ecmascript-modules/statuses/2be6083bb9fbb68413e6f26c718d5657a8a50c90"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"jkrems"}}