{"action":"closed","number":30,"pull_request":{"url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/pulls/30","id":277463299,"node_id":"MDExOlB1bGxSZXF1ZXN0Mjc3NDYzMjk5","html_url":"https://github.com/zeit/webpack-asset-relocator-loader/pull/30","diff_url":"https://github.com/zeit/webpack-asset-relocator-loader/pull/30.diff","patch_url":"https://github.com/zeit/webpack-asset-relocator-loader/pull/30.patch","issue_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/issues/30","number":30,"state":"closed","locked":false,"title":"Asset emission reworking","user":{"login":"guybedford","id":598730,"node_id":"MDQ6VXNlcjU5ODczMA==","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":"This PR represents a reworking of the asset emission algorithm including:\r\n\r\n* Removing the \"not found\" require handling and instead relying on not found errors being runtime errors in ncc itself via https://github.com/zeit/ncc/pull/378.\r\n* Refactoring of asset emission handling to avoid a number of special cases including the need to special case ffmpeg (which has tests here)\r\n* escapeNonAnalyzableRequires is no longer an option, and this is done much more consistently for both `require` and `require.resolve`. As a result many previously non-working dynamic require cases should now work out correctly.\r\n* Implementing wildcard asset handling, and process.cwd() analysis - https://github.com/zeit/webpack-asset-relocator-loader/issues/10\r\n\r\nThe exact emission logic is described below:\r\n\r\n### process.cwd\r\n\r\nThe `path.resolve` and `process.cwd()` analysis will use the `process.cwd` of the build process itself. So if the build is run from the wrong directory these can not work out and cause assets not to be emitted.\r\n\r\nTo support a custom `cwd`, this can be passed as an option as well.\r\n\r\n### require.resolve\r\n\r\n* ALWAYS escape it as `__non_webpack_require__.resolve`.\r\n* Inline its expression wherever possible further.\r\n\r\n### require\r\n\r\n* If we're unable to analyze the input, escape it as `__non_webpack_require__`.\r\n* If the input is known but not webpack analyzable (utilized getKnownBinding), then inline the analyzed value (including in branched cases).\r\n* On the Webpack side, ensure that all `require` calls fallback to outer (like we did previously).\r\n* In addition ensure that any not found resolutions do not fail.\r\n\r\n### variable declarations and assignments\r\n\r\n* All variable declarations and assignments are analyzed for pure static values\r\n* If the value is an absolute path string, then it is allowed to become an asset emission\r\n* Otherwise, the walking routine will continue to check for internal asset triggers\r\n* The logic here has been significantly improved, with a lot of special casing removed. Even 'require()' is handled as a standard call expression analysis now in a variable declaration.\r\n\r\n### call expressions\r\n\r\n* All call expression callee values are statically analyzed to determine if they are known (typically from the known staticModules that might be required such as fs functions, path functions).\r\n* If the callee is a known pure function it is executed in the analysis\r\n* If the callee has a [TRIGGER] property, then it can trigger an asset emission (eg in path.resolve('./a')), the path.resolve function has a [TRIGGER] for emission like this, so we don't analyze every \"./a\" string).\r\n* If the callee is a well-known symbol, then we have various special cases applied (eg EXPRESS gets its own treatment this way etc).\r\n* Well known symbols are also applied for all fs functions as asset emission points. In this way fs.readFile(...) will emit the argument as an asset if it can be computed.\r\n\r\nThis PR should now resolve the following issues on ncc core:\r\n\r\n* https://github.com/zeit/ncc/issues/290\r\n* https://github.com/zeit/ncc/issues/216\r\n* https://github.com/zeit/ncc/issues/349\r\n* https://github.com/zeit/ncc/issues/41\r\n* https://github.com/zeit/ncc/issues/216\r\n* https://github.com/zeit/ncc/issues/297\r\n\r\nJust a few ncc bugs left before this should be ready for further review and merging.","created_at":"2019-05-09T16:31:34Z","updated_at":"2019-05-15T01:19:40Z","closed_at":"2019-05-15T01:19:40Z","merged_at":"2019-05-15T01:19:40Z","merge_commit_sha":"0ae9ba7a1e04db70f70e746e8c5505fb65fc3447","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/pulls/30/commits","review_comments_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/pulls/30/comments","review_comment_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/pulls/comments{/number}","comments_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/issues/30/comments","statuses_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/statuses/89ecdc5860811342c7a3e496e292220594e555aa","head":{"label":"zeit:refactoring","ref":"refactoring","sha":"89ecdc5860811342c7a3e496e292220594e555aa","user":{"login":"zeit","id":14985020,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE0OTg1MDIw","avatar_url":"https://avatars0.githubusercontent.com/u/14985020?v=4","gravatar_id":"","url":"https://api.github.com/users/zeit","html_url":"https://github.com/zeit","followers_url":"https://api.github.com/users/zeit/followers","following_url":"https://api.github.com/users/zeit/following{/other_user}","gists_url":"https://api.github.com/users/zeit/gists{/gist_id}","starred_url":"https://api.github.com/users/zeit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zeit/subscriptions","organizations_url":"https://api.github.com/users/zeit/orgs","repos_url":"https://api.github.com/users/zeit/repos","events_url":"https://api.github.com/users/zeit/events{/privacy}","received_events_url":"https://api.github.com/users/zeit/received_events","type":"Organization","site_admin":false},"repo":{"id":168409412,"node_id":"MDEwOlJlcG9zaXRvcnkxNjg0MDk0MTI=","name":"webpack-asset-relocator-loader","full_name":"zeit/webpack-asset-relocator-loader","private":false,"owner":{"login":"zeit","id":14985020,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE0OTg1MDIw","avatar_url":"https://avatars0.githubusercontent.com/u/14985020?v=4","gravatar_id":"","url":"https://api.github.com/users/zeit","html_url":"https://github.com/zeit","followers_url":"https://api.github.com/users/zeit/followers","following_url":"https://api.github.com/users/zeit/following{/other_user}","gists_url":"https://api.github.com/users/zeit/gists{/gist_id}","starred_url":"https://api.github.com/users/zeit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zeit/subscriptions","organizations_url":"https://api.github.com/users/zeit/orgs","repos_url":"https://api.github.com/users/zeit/repos","events_url":"https://api.github.com/users/zeit/events{/privacy}","received_events_url":"https://api.github.com/users/zeit/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/zeit/webpack-asset-relocator-loader","description":"Used in ncc while emitting and relocating any asset references","fork":false,"url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader","forks_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/forks","keys_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/teams","hooks_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/hooks","issue_events_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/issues/events{/number}","events_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/events","assignees_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/assignees{/user}","branches_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/branches{/branch}","tags_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/tags","blobs_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/git/refs{/sha}","trees_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/statuses/{sha}","languages_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/languages","stargazers_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/stargazers","contributors_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/contributors","subscribers_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/subscribers","subscription_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/subscription","commits_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/commits{/sha}","git_commits_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/git/commits{/sha}","comments_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/comments{/number}","issue_comment_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/issues/comments{/number}","contents_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/contents/{+path}","compare_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/merges","archive_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/downloads","issues_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/issues{/number}","pulls_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/pulls{/number}","milestones_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/milestones{/number}","notifications_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/labels{/name}","releases_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/releases{/id}","deployments_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/deployments","created_at":"2019-01-30T20:22:17Z","updated_at":"2019-05-11T05:57:50Z","pushed_at":"2019-05-15T01:19:40Z","git_url":"git://github.com/zeit/webpack-asset-relocator-loader.git","ssh_url":"git@github.com:zeit/webpack-asset-relocator-loader.git","clone_url":"https://github.com/zeit/webpack-asset-relocator-loader.git","svn_url":"https://github.com/zeit/webpack-asset-relocator-loader","homepage":"https://npmjs.com/@zeit/webpack-asset-relocator-loader","size":313,"stargazers_count":16,"watchers_count":16,"language":"JavaScript","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":4,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":5,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":4,"open_issues":5,"watchers":16,"default_branch":"master"}},"base":{"label":"zeit:master","ref":"master","sha":"b0520b584b5c941f5bc5b87ce09cd51a0ae7e690","user":{"login":"zeit","id":14985020,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE0OTg1MDIw","avatar_url":"https://avatars0.githubusercontent.com/u/14985020?v=4","gravatar_id":"","url":"https://api.github.com/users/zeit","html_url":"https://github.com/zeit","followers_url":"https://api.github.com/users/zeit/followers","following_url":"https://api.github.com/users/zeit/following{/other_user}","gists_url":"https://api.github.com/users/zeit/gists{/gist_id}","starred_url":"https://api.github.com/users/zeit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zeit/subscriptions","organizations_url":"https://api.github.com/users/zeit/orgs","repos_url":"https://api.github.com/users/zeit/repos","events_url":"https://api.github.com/users/zeit/events{/privacy}","received_events_url":"https://api.github.com/users/zeit/received_events","type":"Organization","site_admin":false},"repo":{"id":168409412,"node_id":"MDEwOlJlcG9zaXRvcnkxNjg0MDk0MTI=","name":"webpack-asset-relocator-loader","full_name":"zeit/webpack-asset-relocator-loader","private":false,"owner":{"login":"zeit","id":14985020,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE0OTg1MDIw","avatar_url":"https://avatars0.githubusercontent.com/u/14985020?v=4","gravatar_id":"","url":"https://api.github.com/users/zeit","html_url":"https://github.com/zeit","followers_url":"https://api.github.com/users/zeit/followers","following_url":"https://api.github.com/users/zeit/following{/other_user}","gists_url":"https://api.github.com/users/zeit/gists{/gist_id}","starred_url":"https://api.github.com/users/zeit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zeit/subscriptions","organizations_url":"https://api.github.com/users/zeit/orgs","repos_url":"https://api.github.com/users/zeit/repos","events_url":"https://api.github.com/users/zeit/events{/privacy}","received_events_url":"https://api.github.com/users/zeit/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/zeit/webpack-asset-relocator-loader","description":"Used in ncc while emitting and relocating any asset references","fork":false,"url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader","forks_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/forks","keys_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/teams","hooks_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/hooks","issue_events_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/issues/events{/number}","events_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/events","assignees_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/assignees{/user}","branches_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/branches{/branch}","tags_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/tags","blobs_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/git/refs{/sha}","trees_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/statuses/{sha}","languages_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/languages","stargazers_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/stargazers","contributors_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/contributors","subscribers_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/subscribers","subscription_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/subscription","commits_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/commits{/sha}","git_commits_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/git/commits{/sha}","comments_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/comments{/number}","issue_comment_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/issues/comments{/number}","contents_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/contents/{+path}","compare_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/merges","archive_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/downloads","issues_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/issues{/number}","pulls_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/pulls{/number}","milestones_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/milestones{/number}","notifications_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/labels{/name}","releases_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/releases{/id}","deployments_url":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/deployments","created_at":"2019-01-30T20:22:17Z","updated_at":"2019-05-11T05:57:50Z","pushed_at":"2019-05-15T01:19:40Z","git_url":"git://github.com/zeit/webpack-asset-relocator-loader.git","ssh_url":"git@github.com:zeit/webpack-asset-relocator-loader.git","clone_url":"https://github.com/zeit/webpack-asset-relocator-loader.git","svn_url":"https://github.com/zeit/webpack-asset-relocator-loader","homepage":"https://npmjs.com/@zeit/webpack-asset-relocator-loader","size":313,"stargazers_count":16,"watchers_count":16,"language":"JavaScript","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":4,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":5,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":4,"open_issues":5,"watchers":16,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/pulls/30"},"html":{"href":"https://github.com/zeit/webpack-asset-relocator-loader/pull/30"},"issue":{"href":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/issues/30"},"comments":{"href":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/issues/30/comments"},"review_comments":{"href":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/pulls/30/comments"},"review_comment":{"href":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/pulls/30/commits"},"statuses":{"href":"https://api.github.com/repos/zeit/webpack-asset-relocator-loader/statuses/89ecdc5860811342c7a3e496e292220594e555aa"}},"author_association":"COLLABORATOR","merged":true,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":{"login":"guybedford","id":598730,"node_id":"MDQ6VXNlcjU5ODczMA==","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},"comments":2,"review_comments":0,"maintainer_can_modify":false,"commits":20,"additions":2543,"deletions":1199,"changed_files":68}}
{"actor":{"display_login":"guybedford"}}