diff --git a/.pnp.cjs b/.pnp.cjs index 7c808bed3928..06b4e2700092 100755 --- a/.pnp.cjs +++ b/.pnp.cjs @@ -288,7 +288,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["jest-junit", "npm:10.0.0"],\ ["micromatch", "npm:4.0.4"],\ ["tslib", "npm:1.13.0"],\ - ["typescript", "patch:typescript@npm%3A4.6.1-rc#~builtin::version=4.6.1-rc&hash=bda367"]\ + ["typescript", "patch:typescript@npm%3A4.6.1-rc#optional!builtin::version=4.6.1-rc&hash=bda367"]\ ],\ "linkType": "SOFT"\ }]\ @@ -582,7 +582,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["gensync", "npm:1.0.0-beta.2"],\ ["json5", "npm:2.2.0"],\ ["lodash", "npm:4.17.21"],\ - ["resolve", "patch:resolve@npm%3A1.20.0#~builtin::version=1.20.0&hash=07638b"],\ + ["resolve", "patch:resolve@npm%3A1.20.0#optional!builtin::version=1.20.0&hash=07638b"],\ ["semver", "npm:5.7.1"],\ ["source-map", "npm:0.5.7"]\ ],\ @@ -605,7 +605,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["gensync", "npm:1.0.0-beta.2"],\ ["json5", "npm:2.2.0"],\ ["lodash", "npm:4.17.21"],\ - ["resolve", "patch:resolve@npm%3A1.20.0#~builtin::version=1.20.0&hash=07638b"],\ + ["resolve", "patch:resolve@npm%3A1.20.0#optional!builtin::version=1.20.0&hash=07638b"],\ ["semver", "npm:5.7.1"],\ ["source-map", "npm:0.5.7"]\ ],\ @@ -845,7 +845,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["@types/babel__core", "npm:7.1.3"],\ ["debug", "virtual:904b3fada4a3265c4dfeed8c42d6542b5b497582d17441c86eea102109bfc3b9e1825aad904bc43dd1b94603ff4820b8cb2ebcf24cfbaf45ecee04e5bc1076b8#npm:4.3.2"],\ ["lodash.debounce", "npm:4.0.8"],\ - ["resolve", "patch:resolve@npm%3A1.20.0#~builtin::version=1.20.0&hash=07638b"],\ + ["resolve", "patch:resolve@npm%3A1.20.0#optional!builtin::version=1.20.0&hash=07638b"],\ ["semver", "npm:6.3.0"]\ ],\ "packagePeers": [\ @@ -866,7 +866,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["@types/babel__core", null],\ ["debug", "virtual:904b3fada4a3265c4dfeed8c42d6542b5b497582d17441c86eea102109bfc3b9e1825aad904bc43dd1b94603ff4820b8cb2ebcf24cfbaf45ecee04e5bc1076b8#npm:4.3.2"],\ ["lodash.debounce", "npm:4.0.8"],\ - ["resolve", "patch:resolve@npm%3A1.20.0#~builtin::version=1.20.0&hash=07638b"],\ + ["resolve", "patch:resolve@npm%3A1.20.0#optional!builtin::version=1.20.0&hash=07638b"],\ ["semver", "npm:6.3.0"]\ ],\ "packagePeers": [\ @@ -7531,7 +7531,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["glob", "npm:7.1.7"],\ ["is-reference", "npm:1.2.1"],\ ["magic-string", "npm:0.25.7"],\ - ["resolve", "patch:resolve@npm%3A1.20.0#~builtin::version=1.20.0&hash=07638b"],\ + ["resolve", "patch:resolve@npm%3A1.20.0#optional!builtin::version=1.20.0&hash=07638b"],\ ["rollup", "npm:2.59.0"]\ ],\ "packagePeers": [\ @@ -7559,7 +7559,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["builtin-modules", "npm:3.2.0"],\ ["deepmerge", "npm:4.2.2"],\ ["is-module", "npm:1.0.0"],\ - ["resolve", "patch:resolve@npm%3A1.20.0#~builtin::version=1.20.0&hash=07638b"],\ + ["resolve", "patch:resolve@npm%3A1.20.0#optional!builtin::version=1.20.0&hash=07638b"],\ ["rollup", "npm:2.59.0"]\ ],\ "packagePeers": [\ @@ -8893,7 +8893,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["regexpp", "npm:3.2.0"],\ ["semver", "npm:7.3.5"],\ ["tsutils", "virtual:5e27cd7a319c4b7c3909eb012bf293660fa275bf4eddce08571aa0562ef7b9b8f3c02315f6dad27820a35a49c368107bf917cd6e2a8d99abe84b6a230d415fc4#npm:3.21.0"],\ - ["typescript", "patch:typescript@npm%3A4.6.1-rc#~builtin::version=4.6.1-rc&hash=bda367"]\ + ["typescript", "patch:typescript@npm%3A4.6.1-rc#optional!builtin::version=4.6.1-rc&hash=bda367"]\ ],\ "packagePeers": [\ "@types/eslint",\ @@ -9062,7 +9062,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["@typescript-eslint/typescript-estree", "virtual:fe98bd70d13aaca1010fe6d701118ea3af3e45d43c8d6c5a099bc3b50f958b72e1ed6da100c174f4c93673179c6f276656d496d7d151b1435a7d2a99739ef29a#npm:5.3.1"],\ ["debug", "virtual:904b3fada4a3265c4dfeed8c42d6542b5b497582d17441c86eea102109bfc3b9e1825aad904bc43dd1b94603ff4820b8cb2ebcf24cfbaf45ecee04e5bc1076b8#npm:4.3.2"],\ ["eslint", "npm:8.2.0"],\ - ["typescript", "patch:typescript@npm%3A4.6.1-rc#~builtin::version=4.6.1-rc&hash=bda367"]\ + ["typescript", "patch:typescript@npm%3A4.6.1-rc#optional!builtin::version=4.6.1-rc&hash=bda367"]\ ],\ "packagePeers": [\ "@types/eslint",\ @@ -9218,7 +9218,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["is-glob", "npm:4.0.3"],\ ["semver", "npm:7.3.5"],\ ["tsutils", "virtual:5e27cd7a319c4b7c3909eb012bf293660fa275bf4eddce08571aa0562ef7b9b8f3c02315f6dad27820a35a49c368107bf917cd6e2a8d99abe84b6a230d415fc4#npm:3.21.0"],\ - ["typescript", "patch:typescript@npm%3A4.6.1-rc#~builtin::version=4.6.1-rc&hash=bda367"]\ + ["typescript", "patch:typescript@npm%3A4.6.1-rc#optional!builtin::version=4.6.1-rc&hash=bda367"]\ ],\ "packagePeers": [\ "@types/typescript",\ @@ -9641,7 +9641,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ]],\ ["semver", "npm:7.3.5"],\ ["tslib", "npm:1.13.0"],\ - ["typescript", "patch:typescript@npm%3A4.6.1-rc#~builtin::version=4.6.1-rc&hash=bda367"]\ + ["typescript", "patch:typescript@npm%3A4.6.1-rc#optional!builtin::version=4.6.1-rc&hash=bda367"]\ ],\ "linkType": "SOFT"\ }]\ @@ -10297,7 +10297,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["micromatch", "npm:4.0.4"],\ ["p-limit", "npm:2.2.0"],\ ["tslib", "npm:1.13.0"],\ - ["typescript", "patch:typescript@npm%3A4.6.1-rc#~builtin::version=4.6.1-rc&hash=bda367"]\ + ["typescript", "patch:typescript@npm%3A4.6.1-rc#optional!builtin::version=4.6.1-rc&hash=bda367"]\ ],\ "linkType": "SOFT"\ }]\ @@ -10348,7 +10348,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["eslint", "npm:8.2.0"],\ ["eslint-plugin-arca", "npm:0.12.1"],\ ["eslint-plugin-react", "virtual:4b728ee22ccd3ae66b83e3be6d39acfb5b7a775112cc78b6b4322feb849fcfe6e39510452356cb4477dc6089bee57db31d02bbfb03b9fc8e914effa16a4145be#npm:7.25.1"],\ - ["typescript", "patch:typescript@npm%3A4.6.1-rc#~builtin::version=4.6.1-rc&hash=bda367"]\ + ["typescript", "patch:typescript@npm%3A4.6.1-rc#optional!builtin::version=4.6.1-rc&hash=bda367"]\ ],\ "packagePeers": [\ "@types/eslint",\ @@ -10481,7 +10481,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["typedoc", "virtual:118b26a6cee620b5aa3e7e8d8b8e34cd9e486f75b92701001168da9be550fadd8c9d9b12643c642e2d528c2624fd8fe7e128eec9d715340efac44400432a0e0c#npm:0.17.0-3"],\ ["typedoc-neo-theme", "npm:1.0.7"],\ ["typedoc-plugin-yarn", "portal:./typedoc-plugin-yarn::locator=%40yarnpkg%2Fgatsby%40workspace%3Apackages%2Fgatsby"],\ - ["typescript", "patch:typescript@npm%3A4.6.1-rc#~builtin::version=4.6.1-rc&hash=bda367"],\ + ["typescript", "patch:typescript@npm%3A4.6.1-rc#optional!builtin::version=4.6.1-rc&hash=bda367"],\ ["unescape-html", "npm:1.1.0"],\ ["unfetch", "npm:4.1.0"],\ ["unified", "npm:7.1.0"],\ @@ -10580,7 +10580,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["jest-junit", "npm:10.0.0"],\ ["micromatch", "npm:4.0.4"],\ ["tslib", "npm:1.13.0"],\ - ["typescript", "patch:typescript@npm%3A4.6.1-rc#~builtin::version=4.6.1-rc&hash=bda367"]\ + ["typescript", "patch:typescript@npm%3A4.6.1-rc#optional!builtin::version=4.6.1-rc&hash=bda367"]\ ],\ "linkType": "SOFT"\ }]\ @@ -10625,7 +10625,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["@yarnpkg/monorepo", "workspace:."],\ ["@yarnpkg/plugin-npm", "virtual:712d04b0098634bdb13868ff8f85b327022bd7d3880873ada8c0ae56847ed36cf9da1fd74a88519380129cec528fe2bd2201426bc28ac9d4a8cc6734ff25c538#workspace:packages/plugin-npm"],\ ["@yarnpkg/plugin-patch", "virtual:f4e4f4a9a0213f122880195b39adaee7de5cb560c1d806ebc8bace6a3124e5b8f820bbb89ebecd4d535caeb6f527d343143210aa405689c118ff2813b78998a0#workspace:packages/plugin-patch"],\ - ["resolve", "patch:resolve@npm%3A1.20.0#~builtin::version=1.20.0&hash=07638b"],\ + ["resolve", "patch:resolve@npm%3A1.20.0#optional!builtin::version=1.20.0&hash=07638b"],\ ["semver", "npm:7.3.5"]\ ],\ "packagePeers": [\ @@ -10650,7 +10650,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["@yarnpkg/monorepo", "workspace:."],\ ["@yarnpkg/plugin-npm", "virtual:712d04b0098634bdb13868ff8f85b327022bd7d3880873ada8c0ae56847ed36cf9da1fd74a88519380129cec528fe2bd2201426bc28ac9d4a8cc6734ff25c538#workspace:packages/plugin-npm"],\ ["@yarnpkg/plugin-patch", "virtual:1c3d72c6b31a8950672985f8306a860ecc80c9a006aac95cf4a7ba13a6e7cc4e095e37186a53c9909e9efe97bc0f7f570a74b3879778e2a2356cdcf407120006#workspace:packages/plugin-patch"],\ - ["resolve", "patch:resolve@npm%3A1.20.0#~builtin::version=1.20.0&hash=07638b"],\ + ["resolve", "patch:resolve@npm%3A1.20.0#optional!builtin::version=1.20.0&hash=07638b"],\ ["semver", "npm:7.3.5"]\ ],\ "packagePeers": [\ @@ -10675,7 +10675,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["@yarnpkg/monorepo", "workspace:."],\ ["@yarnpkg/plugin-npm", "virtual:712d04b0098634bdb13868ff8f85b327022bd7d3880873ada8c0ae56847ed36cf9da1fd74a88519380129cec528fe2bd2201426bc28ac9d4a8cc6734ff25c538#workspace:packages/plugin-npm"],\ ["@yarnpkg/plugin-patch", "virtual:2351fd5ac4f83ad35b714d8af9fdeea561ada341d529d0dba50742dd5735dc3750df6c56bd680e14833d5b987026a1eab6618211ea0ef1b34b727372b3c77bc9#workspace:packages/plugin-patch"],\ - ["resolve", "patch:resolve@npm%3A1.20.0#~builtin::version=1.20.0&hash=07638b"],\ + ["resolve", "patch:resolve@npm%3A1.20.0#optional!builtin::version=1.20.0&hash=07638b"],\ ["semver", "npm:7.3.5"]\ ],\ "packagePeers": [\ @@ -10700,7 +10700,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["@yarnpkg/monorepo", "workspace:."],\ ["@yarnpkg/plugin-npm", "virtual:712d04b0098634bdb13868ff8f85b327022bd7d3880873ada8c0ae56847ed36cf9da1fd74a88519380129cec528fe2bd2201426bc28ac9d4a8cc6734ff25c538#workspace:packages/plugin-npm"],\ ["@yarnpkg/plugin-patch", "virtual:45a6746f11cef24d8db9429cc5650999571e6bb77a8cfb3904a0e832f542be35246ec490516049308ca15b8678eb03bcf394199e514a8145ec32731af7235c91#workspace:packages/plugin-patch"],\ - ["resolve", "patch:resolve@npm%3A1.20.0#~builtin::version=1.20.0&hash=07638b"],\ + ["resolve", "patch:resolve@npm%3A1.20.0#optional!builtin::version=1.20.0&hash=07638b"],\ ["semver", "npm:7.3.5"]\ ],\ "packagePeers": [\ @@ -10725,7 +10725,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["@yarnpkg/monorepo", "workspace:."],\ ["@yarnpkg/plugin-npm", "virtual:712d04b0098634bdb13868ff8f85b327022bd7d3880873ada8c0ae56847ed36cf9da1fd74a88519380129cec528fe2bd2201426bc28ac9d4a8cc6734ff25c538#workspace:packages/plugin-npm"],\ ["@yarnpkg/plugin-patch", "virtual:4864d30fc563f2fd1b72a5e3869493c5f50bf38f98ed3886173d80c044d981c3f68220dbf17f2b5fc5b4c5fba7d0af2e003926efe3487086484049f41c449852#workspace:packages/plugin-patch"],\ - ["resolve", "patch:resolve@npm%3A1.20.0#~builtin::version=1.20.0&hash=07638b"],\ + ["resolve", "patch:resolve@npm%3A1.20.0#optional!builtin::version=1.20.0&hash=07638b"],\ ["semver", "npm:7.3.5"]\ ],\ "packagePeers": [\ @@ -10750,7 +10750,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["@yarnpkg/monorepo", "workspace:."],\ ["@yarnpkg/plugin-npm", "virtual:712d04b0098634bdb13868ff8f85b327022bd7d3880873ada8c0ae56847ed36cf9da1fd74a88519380129cec528fe2bd2201426bc28ac9d4a8cc6734ff25c538#workspace:packages/plugin-npm"],\ ["@yarnpkg/plugin-patch", "virtual:54c8b951e743ea46368d98ac86d4c1ac7d1aa57c9d31cbf6424fa2d918257654f26f71d51dbfe63844c533e97635ff97de50fd37e6e4bf74f2603a98754d6d22#workspace:packages/plugin-patch"],\ - ["resolve", "patch:resolve@npm%3A1.20.0#~builtin::version=1.20.0&hash=07638b"],\ + ["resolve", "patch:resolve@npm%3A1.20.0#optional!builtin::version=1.20.0&hash=07638b"],\ ["semver", "npm:7.3.5"]\ ],\ "packagePeers": [\ @@ -10775,7 +10775,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["@yarnpkg/monorepo", "workspace:."],\ ["@yarnpkg/plugin-npm", "virtual:712d04b0098634bdb13868ff8f85b327022bd7d3880873ada8c0ae56847ed36cf9da1fd74a88519380129cec528fe2bd2201426bc28ac9d4a8cc6734ff25c538#workspace:packages/plugin-npm"],\ ["@yarnpkg/plugin-patch", "virtual:a4e201fc3c2d8b3ec5632082d407d554bbf8ea8b84182577dde1ce419148ae0981b382a0805280637d50e1132628fef8f78ee6a015164963130b1310a4cca910#workspace:packages/plugin-patch"],\ - ["resolve", "patch:resolve@npm%3A1.20.0#~builtin::version=1.20.0&hash=07638b"],\ + ["resolve", "patch:resolve@npm%3A1.20.0#optional!builtin::version=1.20.0&hash=07638b"],\ ["semver", "npm:7.3.5"]\ ],\ "packagePeers": [\ @@ -10800,7 +10800,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["@yarnpkg/monorepo", "workspace:."],\ ["@yarnpkg/plugin-npm", "virtual:08fe6ad7a76ed00f8dc32e3b968ce66fd4db8ac47424db78612ce3633e63ecb46d41984611094facf53bbef7eae7fbf98bbfd729fb77f5ccde564684f4e3a829#workspace:packages/plugin-npm"],\ ["@yarnpkg/plugin-patch", "virtual:a7c38e9a420fd3b408ea245831c2c9f0e880eac64b268fab3219f5f0b1d6015f44b1f92d23aabfc6e980bbbbda00a23e9faa983fb98544fab94119ccd31f2440#workspace:packages/plugin-patch"],\ - ["resolve", "patch:resolve@npm%3A1.20.0#~builtin::version=1.20.0&hash=07638b"],\ + ["resolve", "patch:resolve@npm%3A1.20.0#optional!builtin::version=1.20.0&hash=07638b"],\ ["semver", "npm:7.3.5"]\ ],\ "packagePeers": [\ @@ -10825,7 +10825,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["@yarnpkg/monorepo", "workspace:."],\ ["@yarnpkg/plugin-npm", "virtual:712d04b0098634bdb13868ff8f85b327022bd7d3880873ada8c0ae56847ed36cf9da1fd74a88519380129cec528fe2bd2201426bc28ac9d4a8cc6734ff25c538#workspace:packages/plugin-npm"],\ ["@yarnpkg/plugin-patch", "virtual:adaf1cec8728346f1bf6a263f1954625a52d60518b8d2084da8a926203282105d2b95fb9da84922062af8d4fc84b8a1c39f220238424024e56f55577bdbc7208#workspace:packages/plugin-patch"],\ - ["resolve", "patch:resolve@npm%3A1.20.0#~builtin::version=1.20.0&hash=07638b"],\ + ["resolve", "patch:resolve@npm%3A1.20.0#optional!builtin::version=1.20.0&hash=07638b"],\ ["semver", "npm:7.3.5"]\ ],\ "packagePeers": [\ @@ -10850,7 +10850,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["@yarnpkg/monorepo", "workspace:."],\ ["@yarnpkg/plugin-npm", "virtual:712d04b0098634bdb13868ff8f85b327022bd7d3880873ada8c0ae56847ed36cf9da1fd74a88519380129cec528fe2bd2201426bc28ac9d4a8cc6734ff25c538#workspace:packages/plugin-npm"],\ ["@yarnpkg/plugin-patch", "virtual:b4c0e602e8ac4e01a7b08db41bb5808da767dd1f6802758faa5125fb2423614bb0a8806ee1b30c3a0769f86da15ad37377f5118d93cd93fa48df0008a448fb35#workspace:packages/plugin-patch"],\ - ["resolve", "patch:resolve@npm%3A1.20.0#~builtin::version=1.20.0&hash=07638b"],\ + ["resolve", "patch:resolve@npm%3A1.20.0#optional!builtin::version=1.20.0&hash=07638b"],\ ["semver", "npm:7.3.5"]\ ],\ "packagePeers": [\ @@ -10875,7 +10875,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["@yarnpkg/monorepo", "workspace:."],\ ["@yarnpkg/plugin-npm", "virtual:712d04b0098634bdb13868ff8f85b327022bd7d3880873ada8c0ae56847ed36cf9da1fd74a88519380129cec528fe2bd2201426bc28ac9d4a8cc6734ff25c538#workspace:packages/plugin-npm"],\ ["@yarnpkg/plugin-patch", "virtual:b63ad861025672af62aed0e7c80dca4cfce3194ca046161e54fc14c498c39e3b82004ea844489c7a58d2f1a31867f388bf25b8128f5ccce46f35305e1f91e9ab#workspace:packages/plugin-patch"],\ - ["resolve", "patch:resolve@npm%3A1.20.0#~builtin::version=1.20.0&hash=07638b"],\ + ["resolve", "patch:resolve@npm%3A1.20.0#optional!builtin::version=1.20.0&hash=07638b"],\ ["semver", "npm:7.3.5"]\ ],\ "packagePeers": [\ @@ -10900,7 +10900,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["@yarnpkg/monorepo", "workspace:."],\ ["@yarnpkg/plugin-npm", "virtual:712d04b0098634bdb13868ff8f85b327022bd7d3880873ada8c0ae56847ed36cf9da1fd74a88519380129cec528fe2bd2201426bc28ac9d4a8cc6734ff25c538#workspace:packages/plugin-npm"],\ ["@yarnpkg/plugin-patch", "virtual:d1d72d9e3903ca8b8d9c23a360395cc764db2689e5992ef9af91c79f03a839db10ec675af9e4c1c8f4842aff1a614eb5b115fcc0afe8256630151ef1252de94b#workspace:packages/plugin-patch"],\ - ["resolve", "patch:resolve@npm%3A1.20.0#~builtin::version=1.20.0&hash=07638b"],\ + ["resolve", "patch:resolve@npm%3A1.20.0#optional!builtin::version=1.20.0&hash=07638b"],\ ["semver", "npm:7.3.5"]\ ],\ "packagePeers": [\ @@ -10925,7 +10925,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["@yarnpkg/monorepo", "workspace:."],\ ["@yarnpkg/plugin-npm", "virtual:712d04b0098634bdb13868ff8f85b327022bd7d3880873ada8c0ae56847ed36cf9da1fd74a88519380129cec528fe2bd2201426bc28ac9d4a8cc6734ff25c538#workspace:packages/plugin-npm"],\ ["@yarnpkg/plugin-patch", "virtual:f8376ca2bc11738adced76b97627e7eff07ec08f93f5b76caf8d6bd4f78f5ae9c1911cb9d1a0bd256ef3e0601dedeba933acf0d2381588b6513ee81e25626459#workspace:packages/plugin-patch"],\ - ["resolve", "patch:resolve@npm%3A1.20.0#~builtin::version=1.20.0&hash=07638b"],\ + ["resolve", "patch:resolve@npm%3A1.20.0#optional!builtin::version=1.20.0&hash=07638b"],\ ["semver", "npm:7.3.5"]\ ],\ "packagePeers": [\ @@ -10948,7 +10948,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["@yarnpkg/monorepo", "workspace:."],\ ["@yarnpkg/plugin-npm", "virtual:712d04b0098634bdb13868ff8f85b327022bd7d3880873ada8c0ae56847ed36cf9da1fd74a88519380129cec528fe2bd2201426bc28ac9d4a8cc6734ff25c538#workspace:packages/plugin-npm"],\ ["@yarnpkg/plugin-patch", "virtual:f4e4f4a9a0213f122880195b39adaee7de5cb560c1d806ebc8bace6a3124e5b8f820bbb89ebecd4d535caeb6f527d343143210aa405689c118ff2813b78998a0#workspace:packages/plugin-patch"],\ - ["resolve", "patch:resolve@npm%3A1.20.0#~builtin::version=1.20.0&hash=07638b"],\ + ["resolve", "patch:resolve@npm%3A1.20.0#optional!builtin::version=1.20.0&hash=07638b"],\ ["semver", "npm:7.3.5"]\ ],\ "linkType": "SOFT"\ @@ -16318,7 +16318,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["babel-plugin-macros", "npm:2.8.0"],\ ["@babel/runtime", "npm:7.15.4"],\ ["cosmiconfig", "npm:6.0.0"],\ - ["resolve", "patch:resolve@npm%3A1.20.0#~builtin::version=1.20.0&hash=07638b"]\ + ["resolve", "patch:resolve@npm%3A1.20.0#optional!builtin::version=1.20.0&hash=07638b"]\ ],\ "linkType": "HARD"\ }]\ @@ -17806,7 +17806,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["anymatch", "npm:2.0.0"],\ ["async-each", "npm:1.0.1"],\ ["braces", "npm:2.3.2"],\ - ["fsevents", "patch:fsevents@npm%3A1.2.13#~builtin::version=1.2.13&hash=18f3a7"],\ + ["fsevents", "patch:fsevents@npm%3A1.2.13#optional!builtin::version=1.2.13&hash=18f3a7"],\ ["glob-parent", "npm:3.1.0"],\ ["inherits", "npm:2.0.4"],\ ["is-binary-path", "npm:1.0.1"],\ @@ -17824,7 +17824,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["chokidar", "npm:3.5.2"],\ ["anymatch", "npm:3.1.2"],\ ["braces", "npm:3.0.2"],\ - ["fsevents", "patch:fsevents@npm%3A2.3.2#~builtin::version=2.3.2&hash=18f3a7"],\ + ["fsevents", "patch:fsevents@npm%3A2.3.2#optional!builtin::version=2.3.2&hash=18f3a7"],\ ["glob-parent", "npm:5.1.2"],\ ["is-binary-path", "npm:2.1.0"],\ ["is-glob", "npm:4.0.3"],\ @@ -20937,7 +20937,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "packageDependencies": [\ ["eslint-import-resolver-node", "npm:0.3.6"],\ ["debug", "virtual:11708fcd8b5d4d05ff1d66e93d462ef2e0e1a37e2f059f1c5142e31570731629f92bd79531af0543bc9cc3e8328e18d21151650e1e20b8209c0416b889b286e6#npm:3.2.7"],\ - ["resolve", "patch:resolve@npm%3A1.20.0#~builtin::version=1.20.0&hash=07638b"]\ + ["resolve", "patch:resolve@npm%3A1.20.0#optional!builtin::version=1.20.0&hash=07638b"]\ ],\ "linkType": "HARD"\ }]\ @@ -21066,7 +21066,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["object.values", "npm:1.1.4"],\ ["pkg-up", "npm:2.0.0"],\ ["read-pkg-up", "npm:3.0.0"],\ - ["resolve", "patch:resolve@npm%3A1.20.0#~builtin::version=1.20.0&hash=07638b"],\ + ["resolve", "patch:resolve@npm%3A1.20.0#optional!builtin::version=1.20.0&hash=07638b"],\ ["tsconfig-paths", "npm:3.11.0"]\ ],\ "packagePeers": [\ @@ -21136,7 +21136,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["object.fromentries", "npm:2.0.4"],\ ["object.values", "npm:1.1.4"],\ ["prop-types", "npm:15.7.2"],\ - ["resolve", "patch:resolve@npm%3A2.0.0-next.3#~builtin::version=2.0.0-next.3&hash=07638b"],\ + ["resolve", "patch:resolve@npm%3A2.0.0-next.3#optional!builtin::version=2.0.0-next.3&hash=07638b"],\ ["string.prototype.matchall", "npm:4.0.5"]\ ],\ "packagePeers": [\ @@ -21162,7 +21162,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["object.fromentries", "npm:2.0.4"],\ ["object.values", "npm:1.1.4"],\ ["prop-types", "npm:15.7.2"],\ - ["resolve", "patch:resolve@npm%3A2.0.0-next.3#~builtin::version=2.0.0-next.3&hash=07638b"],\ + ["resolve", "patch:resolve@npm%3A2.0.0-next.3#optional!builtin::version=2.0.0-next.3&hash=07638b"],\ ["string.prototype.matchall", "npm:4.0.5"]\ ],\ "packagePeers": [\ @@ -21188,7 +21188,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["object.fromentries", "npm:2.0.4"],\ ["object.values", "npm:1.1.4"],\ ["prop-types", "npm:15.7.2"],\ - ["resolve", "patch:resolve@npm%3A2.0.0-next.3#~builtin::version=2.0.0-next.3&hash=07638b"],\ + ["resolve", "patch:resolve@npm%3A2.0.0-next.3#optional!builtin::version=2.0.0-next.3&hash=07638b"],\ ["string.prototype.matchall", "npm:4.0.5"]\ ],\ "packagePeers": [\ @@ -22727,19 +22727,19 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { }]\ ]],\ ["fsevents", [\ - ["patch:fsevents@npm%3A1.2.13#~builtin::version=1.2.13&hash=18f3a7", {\ - "packageLocation": "./.yarn/unplugged/fsevents-patch-fcdf30aaca/node_modules/fsevents/",\ + ["patch:fsevents@npm%3A1.2.13#optional!builtin::version=1.2.13&hash=18f3a7", {\ + "packageLocation": "./.yarn/unplugged/fsevents-patch-fb29a08206/node_modules/fsevents/",\ "packageDependencies": [\ - ["fsevents", "patch:fsevents@npm%3A1.2.13#~builtin::version=1.2.13&hash=18f3a7"],\ + ["fsevents", "patch:fsevents@npm%3A1.2.13#optional!builtin::version=1.2.13&hash=18f3a7"],\ ["bindings", "npm:1.5.0"],\ ["nan", "npm:2.15.0"]\ ],\ "linkType": "HARD"\ }],\ - ["patch:fsevents@npm%3A2.3.2#~builtin::version=2.3.2&hash=18f3a7", {\ - "packageLocation": "./.yarn/unplugged/fsevents-patch-3340e2eb10/node_modules/fsevents/",\ + ["patch:fsevents@npm%3A2.3.2#optional!builtin::version=2.3.2&hash=18f3a7", {\ + "packageLocation": "./.yarn/unplugged/fsevents-patch-bc14f4e1ba/node_modules/fsevents/",\ "packageDependencies": [\ - ["fsevents", "patch:fsevents@npm%3A2.3.2#~builtin::version=2.3.2&hash=18f3a7"],\ + ["fsevents", "patch:fsevents@npm%3A2.3.2#optional!builtin::version=2.3.2&hash=18f3a7"],\ ["node-gyp", "npm:6.0.1"]\ ],\ "linkType": "HARD"\ @@ -27106,7 +27106,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["@types/graceful-fs", "npm:4.1.3"],\ ["anymatch", "npm:3.1.2"],\ ["fb-watchman", "npm:2.0.0"],\ - ["fsevents", "patch:fsevents@npm%3A2.3.2#~builtin::version=2.3.2&hash=18f3a7"],\ + ["fsevents", "patch:fsevents@npm%3A2.3.2#optional!builtin::version=2.3.2&hash=18f3a7"],\ ["graceful-fs", "npm:4.2.4"],\ ["jest-serializer", "npm:26.0.0"],\ ["jest-util", "npm:26.0.1"],\ @@ -27307,7 +27307,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["jest-pnp-resolver", "virtual:631d11a244cf9e8543d845f9233371049f6acc7a371f8cdc0328ac0915c7fea1f5e43b0c6464606ba013212ee8e56784c791cb67764091471a2a31ac041ce93f#npm:1.2.1"],\ ["jest-util", "npm:26.0.1"],\ ["read-pkg-up", "npm:7.0.1"],\ - ["resolve", "patch:resolve@npm%3A1.20.0#~builtin::version=1.20.0&hash=07638b"],\ + ["resolve", "patch:resolve@npm%3A1.20.0#optional!builtin::version=1.20.0&hash=07638b"],\ ["slash", "npm:3.0.0"]\ ],\ "linkType": "HARD"\ @@ -29726,7 +29726,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["react-dom", "virtual:118b26a6cee620b5aa3e7e8d8b8e34cd9e486f75b92701001168da9be550fadd8c9d9b12643c642e2d528c2624fd8fe7e128eec9d715340efac44400432a0e0c#npm:16.13.1"],\ ["react-lifecycles-compat", "npm:3.0.4"],\ ["shallowequal", "npm:1.1.0"],\ - ["typescript", "patch:typescript@npm%3A3.9.10#~builtin::version=3.9.10&hash=bda367"]\ + ["typescript", "patch:typescript@npm%3A3.9.10#optional!builtin::version=3.9.10&hash=bda367"]\ ],\ "packagePeers": [\ "@types/react-dom",\ @@ -30365,7 +30365,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "packageDependencies": [\ ["normalize-package-data", "npm:2.5.0"],\ ["hosted-git-info", "npm:2.7.1"],\ - ["resolve", "patch:resolve@npm%3A1.20.0#~builtin::version=1.20.0&hash=07638b"],\ + ["resolve", "patch:resolve@npm%3A1.20.0#optional!builtin::version=1.20.0&hash=07638b"],\ ["semver", "npm:5.7.1"],\ ["validate-npm-package-license", "npm:3.0.4"]\ ],\ @@ -33308,7 +33308,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["js-reporters", "npm:1.2.1"],\ ["minimatch", "npm:3.0.4"],\ ["node-watch", "npm:0.6.0"],\ - ["resolve", "patch:resolve@npm%3A1.9.0#~builtin::version=1.9.0&hash=07638b"]\ + ["resolve", "patch:resolve@npm%3A1.9.0#optional!builtin::version=1.9.0&hash=07638b"]\ ],\ "linkType": "HARD"\ }]\ @@ -34340,7 +34340,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "packageLocation": "./.yarn/cache/rechoir-npm-0.6.2-0df5f171ec-fe76bf9c21.zip/node_modules/rechoir/",\ "packageDependencies": [\ ["rechoir", "npm:0.6.2"],\ - ["resolve", "patch:resolve@npm%3A1.20.0#~builtin::version=1.20.0&hash=07638b"]\ + ["resolve", "patch:resolve@npm%3A1.20.0#optional!builtin::version=1.20.0&hash=07638b"]\ ],\ "linkType": "HARD"\ }]\ @@ -35065,27 +35065,27 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { }]\ ]],\ ["resolve", [\ - ["patch:resolve@npm%3A1.20.0#~builtin::version=1.20.0&hash=07638b", {\ - "packageLocation": "./.yarn/cache/resolve-patch-b4a69197d3-a0dd7d16a8.zip/node_modules/resolve/",\ + ["patch:resolve@npm%3A1.20.0#optional!builtin::version=1.20.0&hash=07638b", {\ + "packageLocation": "./.yarn/cache/resolve-patch-92c1e516ea-a0dd7d16a8.zip/node_modules/resolve/",\ "packageDependencies": [\ - ["resolve", "patch:resolve@npm%3A1.20.0#~builtin::version=1.20.0&hash=07638b"],\ + ["resolve", "patch:resolve@npm%3A1.20.0#optional!builtin::version=1.20.0&hash=07638b"],\ ["is-core-module", "npm:2.6.0"],\ ["path-parse", "npm:1.0.6"]\ ],\ "linkType": "HARD"\ }],\ - ["patch:resolve@npm%3A1.9.0#~builtin::version=1.9.0&hash=07638b", {\ - "packageLocation": "./.yarn/cache/resolve-patch-334bc019de-8e86033057.zip/node_modules/resolve/",\ + ["patch:resolve@npm%3A1.9.0#optional!builtin::version=1.9.0&hash=07638b", {\ + "packageLocation": "./.yarn/cache/resolve-patch-6aeae11fee-8e86033057.zip/node_modules/resolve/",\ "packageDependencies": [\ - ["resolve", "patch:resolve@npm%3A1.9.0#~builtin::version=1.9.0&hash=07638b"],\ + ["resolve", "patch:resolve@npm%3A1.9.0#optional!builtin::version=1.9.0&hash=07638b"],\ ["path-parse", "npm:1.0.6"]\ ],\ "linkType": "HARD"\ }],\ - ["patch:resolve@npm%3A2.0.0-next.3#~builtin::version=2.0.0-next.3&hash=07638b", {\ - "packageLocation": "./.yarn/cache/resolve-patch-00f699a708-21684b4d99.zip/node_modules/resolve/",\ + ["patch:resolve@npm%3A2.0.0-next.3#optional!builtin::version=2.0.0-next.3&hash=07638b", {\ + "packageLocation": "./.yarn/cache/resolve-patch-06b7b68a5c-21684b4d99.zip/node_modules/resolve/",\ "packageDependencies": [\ - ["resolve", "patch:resolve@npm%3A2.0.0-next.3#~builtin::version=2.0.0-next.3&hash=07638b"],\ + ["resolve", "patch:resolve@npm%3A2.0.0-next.3#optional!builtin::version=2.0.0-next.3&hash=07638b"],\ ["is-core-module", "npm:2.6.0"],\ ["path-parse", "npm:1.0.6"]\ ],\ @@ -35264,7 +35264,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "packageLocation": "./.yarn/cache/rollup-npm-2.59.0-72e7408354-9fbaa72b8f.zip/node_modules/rollup/",\ "packageDependencies": [\ ["rollup", "npm:2.59.0"],\ - ["fsevents", "patch:fsevents@npm%3A2.3.2#~builtin::version=2.3.2&hash=18f3a7"]\ + ["fsevents", "patch:fsevents@npm%3A2.3.2#optional!builtin::version=2.3.2&hash=18f3a7"]\ ],\ "linkType": "HARD"\ }]\ @@ -37988,7 +37988,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["tsutils", "virtual:5e27cd7a319c4b7c3909eb012bf293660fa275bf4eddce08571aa0562ef7b9b8f3c02315f6dad27820a35a49c368107bf917cd6e2a8d99abe84b6a230d415fc4#npm:3.21.0"],\ ["@types/typescript", null],\ ["tslib", "npm:1.13.0"],\ - ["typescript", "patch:typescript@npm%3A4.6.1-rc#~builtin::version=4.6.1-rc&hash=bda367"]\ + ["typescript", "patch:typescript@npm%3A4.6.1-rc#optional!builtin::version=4.6.1-rc&hash=bda367"]\ ],\ "packagePeers": [\ "@types/typescript",\ @@ -38230,7 +38230,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["typedoc-default-themes", "npm:0.8.0-0"],\ ["typedoc-neo-theme", "npm:1.0.7"],\ ["typedoc-plugin-yarn", "portal:./typedoc-plugin-yarn::locator=%40yarnpkg%2Fgatsby%40workspace%3Apackages%2Fgatsby"],\ - ["typescript", "patch:typescript@npm%3A4.6.1-rc#~builtin::version=4.6.1-rc&hash=bda367"]\ + ["typescript", "patch:typescript@npm%3A4.6.1-rc#optional!builtin::version=4.6.1-rc&hash=bda367"]\ ],\ "packagePeers": [\ "@strictsoftware/typedoc-plugin-monorepo",\ @@ -38265,7 +38265,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["typedoc-default-themes", "npm:0.8.0-0"],\ ["typedoc-neo-theme", null],\ ["typedoc-plugin-yarn", "portal:./typedoc-plugin-yarn::locator=%40yarnpkg%2Fgatsby%40workspace%3Apackages%2Fgatsby"],\ - ["typescript", "patch:typescript@npm%3A3.9.10#~builtin::version=3.9.10&hash=bda367"]\ + ["typescript", "patch:typescript@npm%3A3.9.10#optional!builtin::version=3.9.10&hash=bda367"]\ ],\ "packagePeers": [\ "@strictsoftware/typedoc-plugin-monorepo",\ @@ -38299,7 +38299,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["typedoc-default-themes", "npm:0.7.2"],\ ["typedoc-neo-theme", "npm:1.0.7"],\ ["typedoc-plugin-yarn", null],\ - ["typescript", "patch:typescript@npm%3A3.7.7#~builtin::version=3.7.7&hash=bda367"]\ + ["typescript", "patch:typescript@npm%3A3.7.7#optional!builtin::version=3.7.7&hash=bda367"]\ ],\ "packagePeers": [\ "@strictsoftware/typedoc-plugin-monorepo",\ @@ -38352,30 +38352,30 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "packageDependencies": [\ ["typedoc-plugin-yarn", "portal:./typedoc-plugin-yarn::locator=%40yarnpkg%2Fgatsby%40workspace%3Apackages%2Fgatsby"],\ ["typedoc", "virtual:258c95d7dd1da51c9c624f238593e0bc1c34b7bd8de0b85fefd9552f2220a4555cad458eb72d96f0c7b341784726b6a8e9c8b4e838a9d27aac3796b29de01981#npm:0.17.0-3"],\ - ["typescript", "patch:typescript@npm%3A3.9.10#~builtin::version=3.9.10&hash=bda367"]\ + ["typescript", "patch:typescript@npm%3A3.9.10#optional!builtin::version=3.9.10&hash=bda367"]\ ],\ "linkType": "SOFT"\ }]\ ]],\ ["typescript", [\ - ["patch:typescript@npm%3A3.7.7#~builtin::version=3.7.7&hash=bda367", {\ - "packageLocation": "./.yarn/cache/typescript-patch-1d635661a9-61283b54e3.zip/node_modules/typescript/",\ + ["patch:typescript@npm%3A3.7.7#optional!builtin::version=3.7.7&hash=bda367", {\ + "packageLocation": "./.yarn/cache/typescript-patch-5d1bc9f9fc-61283b54e3.zip/node_modules/typescript/",\ "packageDependencies": [\ - ["typescript", "patch:typescript@npm%3A3.7.7#~builtin::version=3.7.7&hash=bda367"]\ + ["typescript", "patch:typescript@npm%3A3.7.7#optional!builtin::version=3.7.7&hash=bda367"]\ ],\ "linkType": "HARD"\ }],\ - ["patch:typescript@npm%3A3.9.10#~builtin::version=3.9.10&hash=bda367", {\ - "packageLocation": "./.yarn/cache/typescript-patch-ef99b47708-dc7141ab55.zip/node_modules/typescript/",\ + ["patch:typescript@npm%3A3.9.10#optional!builtin::version=3.9.10&hash=bda367", {\ + "packageLocation": "./.yarn/cache/typescript-patch-f16b0e83cb-dc7141ab55.zip/node_modules/typescript/",\ "packageDependencies": [\ - ["typescript", "patch:typescript@npm%3A3.9.10#~builtin::version=3.9.10&hash=bda367"]\ + ["typescript", "patch:typescript@npm%3A3.9.10#optional!builtin::version=3.9.10&hash=bda367"]\ ],\ "linkType": "HARD"\ }],\ - ["patch:typescript@npm%3A4.6.1-rc#~builtin::version=4.6.1-rc&hash=bda367", {\ - "packageLocation": "./.yarn/cache/typescript-patch-0f331817d1-1b6d012dec.zip/node_modules/typescript/",\ + ["patch:typescript@npm%3A4.6.1-rc#optional!builtin::version=4.6.1-rc&hash=bda367", {\ + "packageLocation": "./.yarn/cache/typescript-patch-f9ea81cdec-1b6d012dec.zip/node_modules/typescript/",\ "packageDependencies": [\ - ["typescript", "patch:typescript@npm%3A4.6.1-rc#~builtin::version=4.6.1-rc&hash=bda367"]\ + ["typescript", "patch:typescript@npm%3A4.6.1-rc#optional!builtin::version=4.6.1-rc&hash=bda367"]\ ],\ "linkType": "HARD"\ }]\ diff --git a/.yarn/cache/fsevents-patch-3340e2eb10-8.zip b/.yarn/cache/fsevents-patch-bc14f4e1ba-8.zip similarity index 100% rename from .yarn/cache/fsevents-patch-3340e2eb10-8.zip rename to .yarn/cache/fsevents-patch-bc14f4e1ba-8.zip diff --git a/.yarn/cache/fsevents-patch-fcdf30aaca-8.zip b/.yarn/cache/fsevents-patch-fb29a08206-8.zip similarity index 100% rename from .yarn/cache/fsevents-patch-fcdf30aaca-8.zip rename to .yarn/cache/fsevents-patch-fb29a08206-8.zip diff --git a/.yarn/cache/resolve-patch-00f699a708-21684b4d99.zip b/.yarn/cache/resolve-patch-06b7b68a5c-21684b4d99.zip similarity index 100% rename from .yarn/cache/resolve-patch-00f699a708-21684b4d99.zip rename to .yarn/cache/resolve-patch-06b7b68a5c-21684b4d99.zip diff --git a/.yarn/cache/resolve-patch-334bc019de-8e86033057.zip b/.yarn/cache/resolve-patch-6aeae11fee-8e86033057.zip similarity index 100% rename from .yarn/cache/resolve-patch-334bc019de-8e86033057.zip rename to .yarn/cache/resolve-patch-6aeae11fee-8e86033057.zip diff --git a/.yarn/cache/resolve-patch-b4a69197d3-a0dd7d16a8.zip b/.yarn/cache/resolve-patch-92c1e516ea-a0dd7d16a8.zip similarity index 100% rename from .yarn/cache/resolve-patch-b4a69197d3-a0dd7d16a8.zip rename to .yarn/cache/resolve-patch-92c1e516ea-a0dd7d16a8.zip diff --git a/.yarn/cache/typescript-patch-1d635661a9-61283b54e3.zip b/.yarn/cache/typescript-patch-5d1bc9f9fc-61283b54e3.zip similarity index 100% rename from .yarn/cache/typescript-patch-1d635661a9-61283b54e3.zip rename to .yarn/cache/typescript-patch-5d1bc9f9fc-61283b54e3.zip diff --git a/.yarn/cache/typescript-patch-ef99b47708-dc7141ab55.zip b/.yarn/cache/typescript-patch-f16b0e83cb-dc7141ab55.zip similarity index 100% rename from .yarn/cache/typescript-patch-ef99b47708-dc7141ab55.zip rename to .yarn/cache/typescript-patch-f16b0e83cb-dc7141ab55.zip diff --git a/.yarn/cache/typescript-patch-0f331817d1-1b6d012dec.zip b/.yarn/cache/typescript-patch-f9ea81cdec-1b6d012dec.zip similarity index 100% rename from .yarn/cache/typescript-patch-0f331817d1-1b6d012dec.zip rename to .yarn/cache/typescript-patch-f9ea81cdec-1b6d012dec.zip diff --git a/.yarn/patches/lodash-npm-4.17.21-6382451519.patch b/.yarn/patches/lodash-npm-4.17.21-6382451519.patch new file mode 100644 index 000000000000..7bb65f71363f --- /dev/null +++ b/.yarn/patches/lodash-npm-4.17.21-6382451519.patch @@ -0,0 +1,12 @@ +diff --git a/package.json b/package.json +index b35fd95cc7aa288e29b3d9b18defc946d610833b..1b05eed0c23c59d907e83839e6247e9a106c347f 100644 +--- a/package.json ++++ b/package.json +@@ -6,6 +6,7 @@ + "homepage": "https://lodash.com/", + "repository": "lodash/lodash", + "icon": "https://lodash.com/icon.svg", ++ "test": "foo", + "license": "MIT", + "main": "lodash.js", + "author": "John-David Dalton ", diff --git a/.yarn/versions/434fcaba.yml b/.yarn/versions/434fcaba.yml new file mode 100644 index 000000000000..f0da8a365a53 --- /dev/null +++ b/.yarn/versions/434fcaba.yml @@ -0,0 +1,38 @@ +releases: + "@yarnpkg/core": minor + "@yarnpkg/fslib": minor + "@yarnpkg/plugin-compat": major + "@yarnpkg/plugin-patch": major + +declined: + - "@yarnpkg/plugin-constraints" + - "@yarnpkg/plugin-dlx" + - "@yarnpkg/plugin-essentials" + - "@yarnpkg/plugin-exec" + - "@yarnpkg/plugin-file" + - "@yarnpkg/plugin-git" + - "@yarnpkg/plugin-github" + - "@yarnpkg/plugin-http" + - "@yarnpkg/plugin-init" + - "@yarnpkg/plugin-interactive-tools" + - "@yarnpkg/plugin-link" + - "@yarnpkg/plugin-nm" + - "@yarnpkg/plugin-npm" + - "@yarnpkg/plugin-npm-cli" + - "@yarnpkg/plugin-pack" + - "@yarnpkg/plugin-pnp" + - "@yarnpkg/plugin-pnpm" + - "@yarnpkg/plugin-stage" + - "@yarnpkg/plugin-typescript" + - "@yarnpkg/plugin-version" + - "@yarnpkg/plugin-workspace-tools" + - vscode-zipfs + - "@yarnpkg/builder" + - "@yarnpkg/cli" + - "@yarnpkg/doctor" + - "@yarnpkg/json-proxy" + - "@yarnpkg/nm" + - "@yarnpkg/pnp" + - "@yarnpkg/pnpify" + - "@yarnpkg/sdks" + - "@yarnpkg/shell" diff --git a/packages/acceptance-tests/pkg-tests-specs/sources/commands/patch.test.ts b/packages/acceptance-tests/pkg-tests-specs/sources/commands/patch.test.ts new file mode 100644 index 000000000000..61e4b7d9cf28 --- /dev/null +++ b/packages/acceptance-tests/pkg-tests-specs/sources/commands/patch.test.ts @@ -0,0 +1,113 @@ +import {Filename, npath, ppath, xfs} from '@yarnpkg/fslib'; + +describe(`Commands`, () => { + describe(`patch`, () => { + test( + `it should restart the patch from scratch on subsequent patches by default`, + makeTemporaryEnv({ + dependencies: { + [`no-deps`]: `1.0.0`, + }, + }, async ({path, run, source}) => { + await run(`install`); + + const notFound = { + externalException: { + code: `MODULE_NOT_FOUND`, + }, + }; + + await expect(source(`require('no-deps/foo')`)).rejects.toMatchObject(notFound); + await expect(source(`require('no-deps/bar')`)).rejects.toMatchObject(notFound); + + { + const {stdout} = await run(`patch`, `no-deps`, `--json`); + const {path: updateFolderN} = JSON.parse(stdout); + + const updateFolder = npath.toPortablePath(updateFolderN); + const updateFile = ppath.join(updateFolder, `foo.js` as Filename); + + const fileUser = `module.exports = 'foo';\n`; + await xfs.writeFilePromise(updateFile, fileUser); + + await run(`patch-commit`, `-s`, npath.fromPortablePath(updateFolder)); + await run(`install`); + + await expect(source(`require('no-deps/foo')`)).resolves.toEqual(`foo`); + await expect(source(`require('no-deps/bar')`)).rejects.toMatchObject(notFound); + } + + { + const {stdout} = await run(`patch`, `no-deps`, `--json`); + const {path: updateFolderN} = JSON.parse(stdout); + + const updateFolder = npath.toPortablePath(updateFolderN); + const updateFile = ppath.join(updateFolder, `bar.js` as Filename); + + const fileUser = `module.exports = 'bar';\n`; + await xfs.writeFilePromise(updateFile, fileUser); + + await run(`patch-commit`, `-s`, npath.fromPortablePath(updateFolder)); + await run(`install`); + + await expect(source(`require('no-deps/foo')`)).rejects.toMatchObject(notFound); + await expect(source(`require('no-deps/bar')`)).resolves.toEqual(`bar`); + } + }), + ); + + test( + `it should augment current patches when using the -u flag`, + makeTemporaryEnv({ + dependencies: { + [`no-deps`]: `1.0.0`, + }, + }, async ({path, run, source}) => { + await run(`install`); + + const notFound = { + externalException: { + code: `MODULE_NOT_FOUND`, + }, + }; + + await expect(source(`require('no-deps/foo')`)).rejects.toMatchObject(notFound); + await expect(source(`require('no-deps/bar')`)).rejects.toMatchObject(notFound); + + { + const {stdout} = await run(`patch`, `no-deps`, `--json`); + const {path: updateFolderN} = JSON.parse(stdout); + + const updateFolder = npath.toPortablePath(updateFolderN); + const updateFile = ppath.join(updateFolder, `foo.js` as Filename); + + const fileUser = `module.exports = 'foo';\n`; + await xfs.writeFilePromise(updateFile, fileUser); + + await run(`patch-commit`, `-s`, npath.fromPortablePath(updateFolder)); + await run(`install`); + + await expect(source(`require('no-deps/foo')`)).resolves.toEqual(`foo`); + await expect(source(`require('no-deps/bar')`)).rejects.toMatchObject(notFound); + } + + { + const {stdout} = await run(`patch`, `no-deps`, `-u`, `--json`); + const {path: updateFolderN} = JSON.parse(stdout); + + const updateFolder = npath.toPortablePath(updateFolderN); + const updateFile = ppath.join(updateFolder, `bar.js` as Filename); + + const fileUser = `module.exports = 'bar';\n`; + await xfs.writeFilePromise(updateFile, fileUser); + + await run(`patch-commit`, `-s`, npath.fromPortablePath(updateFolder)); + await run(`install`); + + await expect(source(`require('no-deps/foo')`)).resolves.toEqual(`foo`); + await expect(source(`require('no-deps/bar')`)).resolves.toEqual(`bar`); + } + }), + ); + }); +}); diff --git a/packages/acceptance-tests/pkg-tests-specs/sources/commands/patchCommit.test.ts b/packages/acceptance-tests/pkg-tests-specs/sources/commands/patchCommit.test.ts index e088283b3e9a..e4b75e287101 100644 --- a/packages/acceptance-tests/pkg-tests-specs/sources/commands/patchCommit.test.ts +++ b/packages/acceptance-tests/pkg-tests-specs/sources/commands/patchCommit.test.ts @@ -54,5 +54,151 @@ describe(`Commands`, () => { }); }), ); + + test( + `it should reference patches from the workspace dependencies when possible`, + makeTemporaryEnv({ + dependencies: { + [`one-fixed-dep`]: `1.0.0`, + }, + }, async ({path, run, source}) => { + await run(`install`); + + const {stdout} = await run(`patch`, `one-fixed-dep`, `--json`); + const {path: updateFolderN} = JSON.parse(stdout); + + const updateFolder = npath.toPortablePath(updateFolderN); + const updateFile = ppath.join(updateFolder, `index.js` as Filename); + + const fileSource = await xfs.readFilePromise(updateFile, `utf8`); + const fileUser = fileSource.replace(`require(dep)`, `42`); + await xfs.writeFilePromise(updateFile, fileUser); + + await run(`patch-commit`, `-s`, npath.fromPortablePath(updateFolder)); + + const manifest = await xfs.readJsonPromise(ppath.join(path, Filename.manifest)); + + expect(manifest.dependencies).toEqual({ + [`one-fixed-dep`]: `patch:one-fixed-dep@npm%3A1.0.0#~/.yarn/patches/one-fixed-dep-npm-1.0.0-b02516a4af.patch`, + }); + + expect(manifest).not.toHaveProperty(`resolutions`); + }), + ); + + test( + `it should reference patches using the 'resolutions' field when required`, + makeTemporaryEnv({ + dependencies: { + [`one-fixed-dep`]: `1.0.0`, + }, + }, async ({path, run, source}) => { + await run(`install`); + + const {stdout} = await run(`patch`, `no-deps`, `--json`); + const {path: updateFolderN} = JSON.parse(stdout); + + const updateFolder = npath.toPortablePath(updateFolderN); + const updateFile = ppath.join(updateFolder, `index.js` as Filename); + + const fileSource = await xfs.readFilePromise(updateFile, `utf8`); + const fileUser = fileSource.replace(`require(dep)`, `42`); + await xfs.writeFilePromise(updateFile, fileUser); + + await run(`patch-commit`, `-s`, npath.fromPortablePath(updateFolder)); + + const manifest = await xfs.readJsonPromise(ppath.join(path, Filename.manifest)); + + expect(manifest.dependencies).toEqual({ + [`one-fixed-dep`]: `1.0.0`, + }); + + expect(manifest.resolutions).toEqual({ + [`no-deps@1.0.0`]: `patch:no-deps@npm%3A1.0.0#~/.yarn/patches/no-deps-npm-1.0.0-cf533b267a.patch`, + }); + }), + ); + + test( + `it should replace the patch when calling patch-commit again, not wrap it into another patch layer`, + makeTemporaryEnv({ + dependencies: { + [`one-fixed-dep`]: `1.0.0`, + }, + }, async ({path, run, source}) => { + await run(`install`); + + { + const {stdout} = await run(`patch`, `one-fixed-dep`, `--json`); + const {path: updateFolderN} = JSON.parse(stdout); + + const updateFolder = npath.toPortablePath(updateFolderN); + const updateFile = ppath.join(updateFolder, `new.js` as Filename); + + const fileUser = `module.exports = 42;\n`; + await xfs.writeFilePromise(updateFile, fileUser); + + await run(`patch-commit`, `-s`, npath.fromPortablePath(updateFolder)); + + const manifest = await xfs.readJsonPromise(ppath.join(path, Filename.manifest)); + + expect(manifest.dependencies).toEqual({ + [`one-fixed-dep`]: `patch:one-fixed-dep@npm%3A1.0.0#~/.yarn/patches/one-fixed-dep-npm-1.0.0-b02516a4af.patch`, + }); + } + + { + const {stdout} = await run(`patch`, `one-fixed-dep`, `--json`); + const {path: updateFolderN} = JSON.parse(stdout); + + const updateFolder = npath.toPortablePath(updateFolderN); + const updateFile = ppath.join(updateFolder, `new.js` as Filename); + + const fileUser = `module.exports = 21;\n`; + await xfs.writeFilePromise(updateFile, fileUser); + + await run(`patch-commit`, `-s`, npath.fromPortablePath(updateFolder)); + + const manifest = await xfs.readJsonPromise(ppath.join(path, Filename.manifest)); + + expect(manifest.dependencies).toEqual({ + [`one-fixed-dep`]: `patch:one-fixed-dep@npm%3A1.0.0#~/.yarn/patches/one-fixed-dep-npm-1.0.0-b02516a4af.patch`, + }); + } + }), + ); + + test( + `it should be able to patch virtual packages`, + makeTemporaryEnv({ + dependencies: { + [`peer-deps-lvl0`]: `1.0.0`, + }, + }, async ({path, run, source}) => { + await run(`install`); + + const {stdout} = await run(`patch`, `peer-deps-lvl1`, `--json`); + const {path: updateFolderN} = JSON.parse(stdout); + + const updateFolder = npath.toPortablePath(updateFolderN); + const updateFile = ppath.join(updateFolder, `index.js` as Filename); + + const fileSource = await xfs.readFilePromise(updateFile, `utf8`); + const fileUser = fileSource.replace(`require(dep)`, `42`); + await xfs.writeFilePromise(updateFile, fileUser); + + await run(`patch-commit`, `-s`, npath.fromPortablePath(updateFolder)); + + const manifest = await xfs.readJsonPromise(ppath.join(path, Filename.manifest)); + + expect(manifest.dependencies).toEqual({ + [`peer-deps-lvl0`]: `1.0.0`, + }); + + expect(manifest.resolutions).toEqual({ + [`peer-deps-lvl1@1.0.0`]: `patch:peer-deps-lvl1@npm%3A1.0.0#~/.yarn/patches/peer-deps-lvl1-npm-1.0.0-894d37389e.patch`, + }); + }), + ); }); }); diff --git a/packages/plugin-compat/sources/index.ts b/packages/plugin-compat/sources/index.ts index 50412ed0e44b..3cd3d4461530 100644 --- a/packages/plugin-compat/sources/index.ts +++ b/packages/plugin-compat/sources/index.ts @@ -39,7 +39,7 @@ const plugin: Plugin = { return structUtils.makeDescriptor(dependency, structUtils.makeRange({ protocol: `patch:`, source: structUtils.stringifyDescriptor(dependency), - selector: `~builtin`, + selector: `optional!builtin`, params: null, })); }, diff --git a/packages/plugin-patch/sources/PatchFetcher.ts b/packages/plugin-patch/sources/PatchFetcher.ts index dfa49eb75773..c46af127e6f0 100644 --- a/packages/plugin-patch/sources/PatchFetcher.ts +++ b/packages/plugin-patch/sources/PatchFetcher.ts @@ -10,7 +10,7 @@ import {reportHunk} export class PatchFetcher implements Fetcher { supports(locator: Locator, opts: MinimalFetchOptions) { - if (!locator.reference.startsWith(`patch:`)) + if (!patchUtils.isPatchLocator(locator)) return false; return true; diff --git a/packages/plugin-patch/sources/PatchResolver.ts b/packages/plugin-patch/sources/PatchResolver.ts index 30adef5af002..be9a731274d5 100644 --- a/packages/plugin-patch/sources/PatchResolver.ts +++ b/packages/plugin-patch/sources/PatchResolver.ts @@ -10,14 +10,14 @@ const CACHE_VERSION = 3; export class PatchResolver implements Resolver { supportsDescriptor(descriptor: Descriptor, opts: MinimalResolveOptions) { - if (!descriptor.range.startsWith(`patch:`)) + if (!patchUtils.isPatchDescriptor(descriptor)) return false; return true; } supportsLocator(locator: Locator, opts: MinimalResolveOptions) { - if (!locator.reference.startsWith(`patch:`)) + if (!patchUtils.isPatchLocator(locator)) return false; return true; diff --git a/packages/plugin-patch/sources/commands/patch.ts b/packages/plugin-patch/sources/commands/patch.ts index ac578584e8f4..5f980c5f0235 100644 --- a/packages/plugin-patch/sources/commands/patch.ts +++ b/packages/plugin-patch/sources/commands/patch.ts @@ -15,11 +15,17 @@ export default class PatchCommand extends BaseCommand { description: `prepare a package for patching`, details: ` This command will cause a package to be extracted in a temporary directory intended to be editable at will. - + Once you're done with your changes, run \`yarn patch-commit -s \` (with \`\` being the temporary directory you received) to generate a patchfile and register it into your top-level manifest via the \`patch:\` protocol. Run \`yarn patch-commit -h\` for more details. + + Calling the command when you already have a patch won't import it by default (in other words, the default behavior is to reset existing patches). However, adding the \`-u,--update\` flag will import any current patch. `, }); + update = Option.Boolean(`-u,--update`, false, { + description: `Reapply local patches that already apply to this packages`, + }); + json = Option.Boolean(`--json`, false, { description: `Format the output as an NDJSON stream`, }); @@ -46,6 +52,9 @@ export default class PatchCommand extends BaseCommand { if (structUtils.isVirtualLocator(pkg)) return miscUtils.mapAndFilter.skip; + if (patchUtils.isPatchLocator(pkg) !== this.update) + return miscUtils.mapAndFilter.skip; + return pkg; }); @@ -65,14 +74,19 @@ export default class PatchCommand extends BaseCommand { json: this.json, stdout: this.context.stdout, }, async report => { + const unpatchedLocator = patchUtils.ensureUnpatchedLocator(locator); const temp = await patchUtils.extractPackageToDisk(locator, {cache, project}); report.reportJson({ - locator: structUtils.stringifyLocator(locator), + locator: structUtils.stringifyLocator(unpatchedLocator), path: npath.fromPortablePath(temp), }); - report.reportInfo(MessageName.UNNAMED, `Package ${structUtils.prettyLocator(configuration, locator)} got extracted with success!`); + const updateString = this.update + ? ` along with its current modifications` + : ``; + + report.reportInfo(MessageName.UNNAMED, `Package ${structUtils.prettyLocator(configuration, unpatchedLocator)} got extracted with success${updateString}!`); report.reportInfo(MessageName.UNNAMED, `You can now edit the following folder: ${formatUtils.pretty(configuration, npath.fromPortablePath(temp), `magenta`)}`); report.reportInfo(MessageName.UNNAMED, `Once you are done run ${formatUtils.pretty(configuration, `yarn patch-commit -s ${process.platform === `win32` ? `"` : ``}${npath.fromPortablePath(temp)}${process.platform === `win32` ? `"` : ``}`, `cyan`)} and Yarn will store a patchfile based on your changes.`); }); diff --git a/packages/plugin-patch/sources/commands/patchCommit.ts b/packages/plugin-patch/sources/commands/patchCommit.ts index 7c3c36c49548..dc79028b889b 100644 --- a/packages/plugin-patch/sources/commands/patchCommit.ts +++ b/packages/plugin-patch/sources/commands/patchCommit.ts @@ -1,9 +1,9 @@ -import {BaseCommand, WorkspaceRequiredError} from '@yarnpkg/cli'; -import {Configuration, Project, structUtils} from '@yarnpkg/core'; -import {npath, xfs, ppath, PortablePath, Filename} from '@yarnpkg/fslib'; -import {Command, Option, Usage, UsageError} from 'clipanion'; +import {BaseCommand, WorkspaceRequiredError} from '@yarnpkg/cli'; +import {Configuration, Descriptor, DescriptorHash, Manifest, Project, structUtils, Workspace} from '@yarnpkg/core'; +import {npath, xfs, ppath, PortablePath, Filename} from '@yarnpkg/fslib'; +import {Command, Option, Usage, UsageError} from 'clipanion'; -import * as patchUtils from '../patchUtils'; +import * as patchUtils from '../patchUtils'; // eslint-disable-next-line arca/no-default-export export default class PatchCommitCommand extends BaseCommand { @@ -63,12 +63,72 @@ export default class PatchCommitCommand extends BaseCommand { await xfs.mkdirPromise(patchFolder, {recursive: true}); await xfs.writeFilePromise(patchPath, diff); - const relPath = ppath.relative(project.cwd, patchPath); + const workspaceDependents: Array = []; + const transitiveDependencies = new Map(); - project.topLevelWorkspace.manifest.resolutions.push({ - pattern: {descriptor: {fullName: structUtils.stringifyIdent(locator), description: meta.version}}, - reference: `patch:${structUtils.stringifyLocator(locator)}#${relPath}`, - }); + for (const pkg of project.storedPackages.values()) { + if (structUtils.isVirtualLocator(pkg)) + continue; + + const descriptor = pkg.dependencies.get(locator.identHash); + if (!descriptor) + continue; + + const devirtualizedDescriptor = structUtils.ensureDevirtualizedDescriptor(descriptor); + const unpatchedDescriptor = patchUtils.ensureUnpatchedDescriptor(devirtualizedDescriptor); + + const resolution = project.storedResolutions.get(unpatchedDescriptor.descriptorHash); + if (!resolution) + throw new Error(`Assertion failed: Expected the resolution to have been registered`); + + const dependency = project.storedPackages.get(resolution); + if (!dependency) + throw new Error(`Assertion failed: Expected the package to have been registered`); + + const workspace = project.tryWorkspaceByLocator(pkg); + if (workspace) { + workspaceDependents.push(workspace); + } else { + const originalPkg = project.originalPackages.get(pkg.locatorHash); + if (!originalPkg) + throw new Error(`Assertion failed: Expected the original package to have been registered`); + + const originalDependency = originalPkg.dependencies.get(descriptor.identHash); + if (!originalDependency) + throw new Error(`Assertion failed: Expected the original dependency to have been registered`); + + transitiveDependencies.set(originalDependency.descriptorHash, originalDependency); + } + } + + for (const workspace of workspaceDependents) { + for (const dependencyType of Manifest.hardDependencies) { + const originalDescriptor = workspace.manifest[dependencyType].get(locator.identHash); + if (!originalDescriptor) + continue; + + const newDescriptor = patchUtils.makeDescriptor(originalDescriptor, { + parentLocator: null, + sourceDescriptor: structUtils.convertLocatorToDescriptor(locator), + patchPaths: [ppath.join(Filename.home, ppath.relative(project.cwd, patchPath))], + }); + + workspace.manifest[dependencyType].set(originalDescriptor.identHash, newDescriptor); + } + } + + for (const originalDescriptor of transitiveDependencies.values()) { + const newDescriptor = patchUtils.makeDescriptor(originalDescriptor, { + parentLocator: null, + sourceDescriptor: structUtils.convertLocatorToDescriptor(locator), + patchPaths: [ppath.join(Filename.home, ppath.relative(project.cwd, patchPath))], + }); + + project.topLevelWorkspace.manifest.resolutions.push({ + pattern: {descriptor: {fullName: structUtils.stringifyIdent(newDescriptor), description: originalDescriptor.range}}, + reference: newDescriptor.range, + }); + } await project.persist(); } diff --git a/packages/plugin-patch/sources/patchUtils.ts b/packages/plugin-patch/sources/patchUtils.ts index d5084a8584ff..11945905f266 100644 --- a/packages/plugin-patch/sources/patchUtils.ts +++ b/packages/plugin-patch/sources/patchUtils.ts @@ -1,7 +1,7 @@ -import {Cache, structUtils, Locator, Descriptor, Ident, Project, ThrowReport, miscUtils, FetchOptions, Package, execUtils} from '@yarnpkg/core'; -import {npath, PortablePath, xfs, ppath, Filename, NativePath, CwdFS} from '@yarnpkg/fslib'; +import {Cache, structUtils, Locator, Descriptor, Ident, Project, ThrowReport, miscUtils, FetchOptions, Package, execUtils, FetchResult} from '@yarnpkg/core'; +import {npath, PortablePath, xfs, ppath, Filename, NativePath, CwdFS} from '@yarnpkg/fslib'; -import {Hooks as PatchHooks} from './index'; +import {Hooks as PatchHooks} from './index'; export {applyPatchFile} from './tools/apply'; export {parsePatchFile} from './tools/parse'; @@ -9,7 +9,9 @@ export {parsePatchFile} from './tools/parse'; const BUILTIN_REGEXP = /^builtin<([^>]+)>$/; function parseSpec(spec: string, sourceParser: (source: string) => T) { - const {source, selector, params} = structUtils.parseRange(spec); + const {protocol, source, selector, params} = structUtils.parseRange(spec); + if (protocol !== `patch:`) + throw new Error(`Invalid patch range`); if (source === null) throw new Error(`Patch locators must explicitly define their source`); @@ -30,6 +32,14 @@ function parseSpec(spec: string, sourceParser: (source: string) => T) { return {parentLocator, sourceItem, patchPaths, sourceVersion}; } +export function isPatchDescriptor(descriptor: Descriptor) { + return descriptor.range.startsWith(`patch:`); +} + +export function isPatchLocator(locator: Locator) { + return locator.reference.startsWith(`patch:`); +} + export function parseDescriptor(descriptor: Descriptor) { const {sourceItem, ...rest} = parseSpec(descriptor.range, structUtils.parseDescriptor); return {...rest, sourceDescriptor: sourceItem}; @@ -40,6 +50,32 @@ export function parseLocator(locator: Locator) { return {...rest, sourceLocator: sourceItem}; } +export function unpatchDescriptor(descriptor: Descriptor) { + const {sourceItem} = parseSpec(descriptor.range, structUtils.parseDescriptor); + return sourceItem; +} + +export function unpatchLocator(locator: Locator) { + const {sourceItem} = parseSpec(locator.reference, structUtils.parseLocator); + return sourceItem; +} + +export function ensureUnpatchedDescriptor(descriptor: Descriptor) { + if (!isPatchDescriptor(descriptor)) + return descriptor; + + const {sourceItem} = parseSpec(descriptor.range, structUtils.parseDescriptor); + return sourceItem; +} + +export function ensureUnpatchedLocator(locator: Locator) { + if (!isPatchLocator(locator)) + return locator; + + const {sourceItem} = parseSpec(locator.reference, structUtils.parseLocator); + return sourceItem; +} + function makeSpec({parentLocator, sourceItem, patchPaths, sourceVersion, patchHash}: {parentLocator: Locator | null, sourceItem: T, patchPaths: Array, sourceVersion?: string | null, patchHash?: string}, sourceStringifier: (source: T) => string) { const parentLocatorSpread = parentLocator !== null ? {locator: structUtils.stringifyLocator(parentLocator)} @@ -65,8 +101,8 @@ function makeSpec({parentLocator, sourceItem, patchPaths, sourceVersion, patc }); } -export function makeDescriptor(ident: Ident, {parentLocator, sourceDescriptor, patchPaths}: ReturnType) { - return structUtils.makeLocator(ident, makeSpec({parentLocator, sourceItem: sourceDescriptor, patchPaths}, structUtils.stringifyDescriptor)); +export function makeDescriptor(ident: Ident, {parentLocator, sourceDescriptor, patchPaths}: Pick, `parentLocator` | `sourceDescriptor` | `patchPaths`>) { + return structUtils.makeDescriptor(ident, makeSpec({parentLocator, sourceItem: sourceDescriptor, patchPaths}, structUtils.stringifyDescriptor)); } export function makeLocator(ident: Ident, {parentLocator, sourcePackage, patchPaths, patchHash}: Omit, 'sourceLocator' | 'sourceVersion'> & {sourcePackage: Package, patchHash: string}) { @@ -76,18 +112,22 @@ export function makeLocator(ident: Ident, {parentLocator, sourcePackage, patchPa type VisitPatchPathOptions = { onAbsolute: (p: PortablePath) => T; onRelative: (p: PortablePath) => T; + onProject: (p: PortablePath) => T; onBuiltin: (name: string) => T; }; -function visitPatchPath({onAbsolute, onRelative, onBuiltin}: VisitPatchPathOptions, patchPath: PortablePath) { - const optional = patchPath.startsWith(`~`); - if (optional) - patchPath = patchPath.slice(1) as PortablePath; +function visitPatchPath({onAbsolute, onRelative, onProject, onBuiltin}: VisitPatchPathOptions, patchPath: PortablePath) { + const flagIndex = patchPath.lastIndexOf(`!`); + if (flagIndex !== -1) + patchPath = patchPath.slice(flagIndex + 1) as PortablePath; const builtinMatch = patchPath.match(BUILTIN_REGEXP); if (builtinMatch !== null) return onBuiltin(builtinMatch[1]); + if (patchPath.startsWith(`~/`)) + return onProject(patchPath.slice(2) as PortablePath); + if (ppath.isAbsolute(patchPath)) { return onAbsolute(patchPath); } else { @@ -96,9 +136,13 @@ function visitPatchPath({onAbsolute, onRelative, onBuiltin}: VisitPatchPathOp } export function extractPatchFlags(patchPath: PortablePath) { - const optional = patchPath.startsWith(`~`); - if (optional) - patchPath = patchPath.slice(1) as PortablePath; + const flagIndex = patchPath.lastIndexOf(`!`); + + const flags = flagIndex !== -1 + ? new Set(patchPath.slice(0, flagIndex).split(/!/)) + : new Set(); + + const optional = flags.has(`optional`); return {optional}; } @@ -107,6 +151,7 @@ export function isParentRequired(patchPath: PortablePath) { return visitPatchPath({ onAbsolute: () => false, onRelative: () => true, + onProject: () => false, onBuiltin: () => false, }, patchPath); } @@ -135,17 +180,21 @@ export async function loadPatchFiles(parentLocator: Locator | null, patchPaths: const flags = extractPatchFlags(patchPath); const source = await visitPatchPath({ - onAbsolute: async () => { + onAbsolute: async patchPath => { return await xfs.readFilePromise(patchPath, `utf8`); }, - onRelative: async () => { + onRelative: async patchPath => { if (effectiveParentFetch === null) throw new Error(`Assertion failed: The parent locator should have been fetched`); return await effectiveParentFetch.packageFs.readFilePromise(ppath.join(effectiveParentFetch.prefixPath, patchPath), `utf8`); }, + onProject: async patchPath => { + return await xfs.readFilePromise(ppath.join(opts.project.cwd, patchPath), `utf8`); + }, + onBuiltin: async name => { return await opts.project.configuration.firstHook((hooks: PatchHooks) => { return hooks.getBuiltinPatch; @@ -172,30 +221,56 @@ export async function extractPackageToDisk(locator: Locator, {cache, project}: { if (typeof pkg === `undefined`) throw new Error(`Assertion failed: Expected the package to be registered`); + const unpatchedLocator = ensureUnpatchedLocator(locator); + const checksums = project.storedChecksums; const report = new ThrowReport(); - const fetcher = project.configuration.makeFetcher(); - const fetchResult = await fetcher.fetch(locator, {cache, project, fetcher, checksums, report}); - const temp = await xfs.mktempPromise(); const sourcePath = ppath.join(temp, `source` as Filename); const userPath = ppath.join(temp, `user` as Filename); const metaPath = ppath.join(temp, `.yarn-patch.json` as Filename); - await Promise.all([ - xfs.copyPromise(sourcePath, fetchResult.prefixPath, { - baseFs: fetchResult.packageFs, - }), - xfs.copyPromise(userPath, fetchResult.prefixPath, { - baseFs: fetchResult.packageFs, - }), - xfs.writeJsonPromise(metaPath, { - locator: structUtils.stringifyLocator(locator), - version: pkg.version, - }), - ]); + const fetcher = project.configuration.makeFetcher(); + + const cleanup: Array<() => void> = []; + + try { + let sourceFetchResult: FetchResult; + let userFetchResult: FetchResult; + + if (locator.locatorHash === unpatchedLocator.locatorHash) { + const fetchResult = await fetcher.fetch(locator, {cache, project, fetcher, checksums, report}); + cleanup.push(() => fetchResult.releaseFs?.()); + + sourceFetchResult = fetchResult; + userFetchResult = fetchResult; + } else { + sourceFetchResult = await fetcher.fetch(locator, {cache, project, fetcher, checksums, report}); + cleanup.push(() => sourceFetchResult.releaseFs?.()); + + userFetchResult = await fetcher.fetch(locator, {cache, project, fetcher, checksums, report}); + cleanup.push(() => userFetchResult.releaseFs?.()); + } + + await Promise.all([ + xfs.copyPromise(sourcePath, sourceFetchResult.prefixPath, { + baseFs: sourceFetchResult.packageFs, + }), + xfs.copyPromise(userPath, userFetchResult.prefixPath, { + baseFs: userFetchResult.packageFs, + }), + xfs.writeJsonPromise(metaPath, { + locator: structUtils.stringifyLocator(locator), + version: pkg.version, + }), + ]); + } finally { + for (const cleanupFn of cleanup) { + cleanupFn(); + } + } xfs.detachTemp(temp); return userPath; diff --git a/packages/yarnpkg-core/sources/structUtils.ts b/packages/yarnpkg-core/sources/structUtils.ts index 2197bbb0f065..026958fb8d57 100644 --- a/packages/yarnpkg-core/sources/structUtils.ts +++ b/packages/yarnpkg-core/sources/structUtils.ts @@ -207,6 +207,27 @@ export function devirtualizeLocator(locator: Locator): Locator { return makeLocator(locator, locator.reference.replace(/^[^#]*#/, ``)); } +/** + * Returns a descriptor guaranteed to be devirtualized + */ +export function ensureDevirtualizedDescriptor(descriptor: Descriptor): Descriptor { + if (!isVirtualDescriptor(descriptor)) + return descriptor; + + return makeDescriptor(descriptor, descriptor.range.replace(/^[^#]*#/, ``)); +} + +/** + * Returns a locator guaranteed to be devirtualized + * @param locator the locator + */ +export function ensureDevirtualizedLocator(locator: Locator): Locator { + if (!isVirtualLocator(locator)) + return locator; + + return makeLocator(locator, locator.reference.replace(/^[^#]*#/, ``)); +} + /** * Some descriptors only make sense when bound with some internal state. For * instance that would be the case for the `file:` ranges, which require to diff --git a/packages/yarnpkg-fslib/sources/path.ts b/packages/yarnpkg-fslib/sources/path.ts index 9988b79b00e0..c01ff34574a1 100644 --- a/packages/yarnpkg-fslib/sources/path.ts +++ b/packages/yarnpkg-fslib/sources/path.ts @@ -18,6 +18,7 @@ export type Filename = string & { __pathType: PathType.File }; export type Path = PortablePath | NativePath; export const Filename = { + home: `~` as Filename, nodeModules: `node_modules` as Filename, manifest: `package.json` as Filename, lockfile: `yarn.lock` as Filename, diff --git a/yarn.lock b/yarn.lock index 643bf1ce575c..645fb02d8d9a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12521,9 +12521,9 @@ __metadata: languageName: node linkType: hard -"fsevents@patch:fsevents@^1.2.7#~builtin": +"fsevents@patch:fsevents@^1.2.7#optional!builtin": version: 1.2.13 - resolution: "fsevents@patch:fsevents@npm%3A1.2.13#~builtin::version=1.2.13&hash=18f3a7" + resolution: "fsevents@patch:fsevents@npm%3A1.2.13#optional!builtin::version=1.2.13&hash=18f3a7" dependencies: bindings: ^1.5.0 nan: ^2.12.1 @@ -12531,9 +12531,9 @@ __metadata: languageName: node linkType: hard -"fsevents@patch:fsevents@^2.1.2#~builtin, fsevents@patch:fsevents@~2.3.2#~builtin": +"fsevents@patch:fsevents@^2.1.2#optional!builtin, fsevents@patch:fsevents@~2.3.2#optional!builtin": version: 2.3.2 - resolution: "fsevents@patch:fsevents@npm%3A2.3.2#~builtin::version=2.3.2&hash=18f3a7" + resolution: "fsevents@patch:fsevents@npm%3A2.3.2#optional!builtin::version=2.3.2&hash=18f3a7" dependencies: node-gyp: latest conditions: os=darwin @@ -22705,18 +22705,18 @@ resolve@^2.0.0-next.3: languageName: node linkType: hard -"resolve@patch:resolve@1.9.0#~builtin": +"resolve@patch:resolve@1.9.0#optional!builtin": version: 1.9.0 - resolution: "resolve@patch:resolve@npm%3A1.9.0#~builtin::version=1.9.0&hash=07638b" + resolution: "resolve@patch:resolve@npm%3A1.9.0#optional!builtin::version=1.9.0&hash=07638b" dependencies: path-parse: ^1.0.6 checksum: 8e86033057ad5b02195f40cc0edcf8ea4eb326e95ad977c6ec01344c9129d77e4f13f8d4512b39390dd8dff3c7aac2112de3912c38e3f884f0d51bf92865bf3f languageName: node linkType: hard -"resolve@patch:resolve@^1.1.6#~builtin, resolve@patch:resolve@^1.10.0#~builtin, resolve@patch:resolve@^1.12.0#~builtin, resolve@patch:resolve@^1.14.2#~builtin, resolve@patch:resolve@^1.17.0#~builtin, resolve@patch:resolve@^1.19.0#~builtin, resolve@patch:resolve@^1.20.0#~builtin, resolve@patch:resolve@^1.3.2#~builtin": +"resolve@patch:resolve@^1.1.6#optional!builtin, resolve@patch:resolve@^1.10.0#optional!builtin, resolve@patch:resolve@^1.12.0#optional!builtin, resolve@patch:resolve@^1.14.2#optional!builtin, resolve@patch:resolve@^1.17.0#optional!builtin, resolve@patch:resolve@^1.19.0#optional!builtin, resolve@patch:resolve@^1.20.0#optional!builtin, resolve@patch:resolve@^1.3.2#optional!builtin": version: 1.20.0 - resolution: "resolve@patch:resolve@npm%3A1.20.0#~builtin::version=1.20.0&hash=07638b" + resolution: "resolve@patch:resolve@npm%3A1.20.0#optional!builtin::version=1.20.0&hash=07638b" dependencies: is-core-module: ^2.2.0 path-parse: ^1.0.6 @@ -22724,9 +22724,9 @@ resolve@^2.0.0-next.3: languageName: node linkType: hard -"resolve@patch:resolve@^2.0.0-next.3#~builtin": +"resolve@patch:resolve@^2.0.0-next.3#optional!builtin": version: 2.0.0-next.3 - resolution: "resolve@patch:resolve@npm%3A2.0.0-next.3#~builtin::version=2.0.0-next.3&hash=07638b" + resolution: "resolve@patch:resolve@npm%3A2.0.0-next.3#optional!builtin::version=2.0.0-next.3&hash=07638b" dependencies: is-core-module: ^2.2.0 path-parse: ^1.0.6 @@ -25555,9 +25555,9 @@ typescript@^3.8.3: languageName: node linkType: hard -"typescript@patch:typescript@3.7.x#~builtin": +"typescript@patch:typescript@3.7.x#optional!builtin": version: 3.7.7 - resolution: "typescript@patch:typescript@npm%3A3.7.7#~builtin::version=3.7.7&hash=bda367" + resolution: "typescript@patch:typescript@npm%3A3.7.7#optional!builtin::version=3.7.7&hash=bda367" bin: tsc: bin/tsc tsserver: bin/tsserver @@ -25565,9 +25565,9 @@ typescript@^3.8.3: languageName: node linkType: hard -"typescript@patch:typescript@4.6.1-rc#~builtin": +"typescript@patch:typescript@4.6.1-rc#optional!builtin": version: 4.6.1-rc - resolution: "typescript@patch:typescript@npm%3A4.6.1-rc#~builtin::version=4.6.1-rc&hash=bda367" + resolution: "typescript@patch:typescript@npm%3A4.6.1-rc#optional!builtin::version=4.6.1-rc&hash=bda367" bin: tsc: bin/tsc tsserver: bin/tsserver @@ -25575,9 +25575,9 @@ typescript@^3.8.3: languageName: node linkType: hard -"typescript@patch:typescript@^3.8.3#~builtin": +"typescript@patch:typescript@^3.8.3#optional!builtin": version: 3.9.10 - resolution: "typescript@patch:typescript@npm%3A3.9.10#~builtin::version=3.9.10&hash=bda367" + resolution: "typescript@patch:typescript@npm%3A3.9.10#optional!builtin::version=3.9.10&hash=bda367" bin: tsc: bin/tsc tsserver: bin/tsserver