-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Yarn Plug'n'Play: Implementation #6382
Merged
Changes from 201 commits
Commits
Show all changes
206 commits
Select commit
Hold shift + click to select a range
71f1419
Initial pnp implementation
b942722
Adds the pnp-env directory for quick checks
efb50be
Improves the "yarn node" command so that it works with pnp
9ba4b7e
Adds the pnp tests to the pkg-tests testsuite
3711775
Fixes various issues with the pnp map generation
51adb4c
Remove the scriptsPrependNodePath option
961d242
Adds tests to ensure that the lifecycle scripts are called with the r…
cf9dd1a
Fixes linting
17e3d68
Improve the error message when an optional required dependency hasn't…
882055d
Implements lifecycle wrappers
951bb66
Merge pull request #9 from arcanis/lifecycle-wrappers-remove-option
arcanis bb7046d
Merge pull request #8 from arcanis/lifecycle-wrappers-tests
arcanis 8a9f113
Merge pull request #7 from arcanis/lifecycle-wrappers-flowlint
arcanis bed982a
Merge pull request #10 from arcanis/lifecycle-wrappers-improve-pnp-error
arcanis abaf7f4
Merge pull request #11 from arcanis/lifecycle-wrappers-main
arcanis 0bdb6dd
Adds .pnp.js files to the gitignore
cf0902c
Merge pull request #12 from arcanis/gitignore-pnp
cpojer b9f8eaf
Fallbacks to the toplevel dependencies when a transitive dependency c…
f087c13
Merge pull request #13 from arcanis/pnp-fallback
arcanis 40972bc
Fixes an issue inside the pkg-tests helper
cf00d52
Improves the fixtures so that they also return info about their dev a…
26ebad1
Finishes to hide plugnplay behind a yarnrc option (`plugnplay-experim…
a011d7b
Adds failing tests for pnp peer dependencies
2c32963
Merge pull request #15 from arcanis/pkg-tests-helper-definition
arcanis 009fc45
Merge pull request #14 from arcanis/dev-peer-fixtures
arcanis 8a94aff
Merge pull request #16 from arcanis/option-plugnplay-experimental
arcanis 20a2a2f
Merge pull request #17 from arcanis/pnp-peer-dependencies-failing
arcanis e7d2f99
Prettifies the generated pnp files
08fce0a
Merge pull request #20 from arcanis/prettify-pnp
cpojer 9db30e4
Adds the plugnplay flag to the integrity check
bdf60d9
Removes the pnp file at link-time if installing with pnp disabled
7eb4521
Improves pnp maps compatibility
6d10cc0
Prevents "yarn check" from checking the node_modules existence when u…
9fa12cd
Adds a missing package to the request cache
c2f2abe
Merge pull request #21 from arcanis/pnp-integrity
arcanis 6551486
Fixes tests
da25857
Reimplements the resolution to correctly account for peer dependencies
8fea70b
Externalizes the creation of proxy scripts
8e77876
Implements support for `yarn run` within pnp-enabled installations
e4cd98f
Merge pull request #22 from arcanis/pnp-fix-tests
arcanis 09865d7
Merge pull request #23 from arcanis/better-faster-stronger
arcanis 4a6eb41
Merge pull request #24 from arcanis/portable-proxy-scripts
arcanis d0a03a8
Merge pull request #25 from arcanis/pnp-yarn-run
arcanis 6daa57c
Makes it possible for dependency binaries to require their own depend…
968e231
Merge pull request #26 from arcanis/pnp-yarn-run-dependencies
arcanis fddf91c
Moves the pnp embed api into its own file
37d6b5a
Merge pull request #27 from arcanis/pnp-api-split
arcanis 2ef5f05
Adds the test folder to Jest error messages
e8a27c7
Improves peer dependency tests
062e9f8
Adds tests for require.resolve
0728eba
Refactors the pnp file
a5c3e03
Updates the build-webpack script to include a custom resolver
41f0003
Fixes tests
5216bae
Merge pull request #28 from arcanis/jest-better-message
arcanis 6b9d3fb
Merge pull request #29 from arcanis/peer-deps-tests
arcanis 667a6c5
Merge pull request #30 from arcanis/require-resolve-tests
arcanis 4e2d492
Merge pull request #31 from arcanis/pnp-file-refactoring
arcanis 3380175
Merge pull request #32 from arcanis/webpack-resolver
arcanis 4f34c0e
Merge pull request #33 from arcanis/fix-tests
arcanis ff25ef9
Generates virtual when using peer dependencies
11ebf79
Refactors the generated pnp files to use the newly generated maps
cf362e5
Adds tests for workspaces
4b491e0
Implements Module._findPath
b8e3b40
Fixes top level detection
a67372e
Merge pull request #39 from arcanis/virtual-packages
arcanis a878fbe
Merge pull request #35 from arcanis/pnp-refactor-find
arcanis b9a16b4
Merge pull request #36 from arcanis/module-findpath
arcanis 49aa987
Merge pull request #37 from arcanis/fix-top-level-detection
arcanis 91a2050
Implements workspaces support in pnp
2c3abee
Merge pull request #40 from arcanis/pnp-workspaces
arcanis 82e00e6
Automatically adds workspaces as dependencies of the top-level
fd745e7
Updates the cache path to include the 'node_modules' string
ff45d9a
Prevents pnp from bootstrapping when running non-pnp-installed scripts
bf2a116
Installs peer dependencies symlinks inside a project folder
3818f46
Merge pull request #41 from arcanis/auto-workspace-dependencies
arcanis 7bf140b
Merge pull request #42 from arcanis/node-modules-cache
arcanis 66b2252
Merge pull request #43 from arcanis/fix-npm-run
arcanis 1bd53fb
Merge pull request #44 from arcanis/per-project-virtual-deps
arcanis b1d59c1
Adds a sample application that showcases webpack, babel, react, jest
71a8a56
Ignores the .pnp directory
85f3e6d
Implements a blacklist that throws nicer errors when a package is req…
ebf93b3
Changes the order the locations are matched to package locators
406affa
Automatically adds packages as dependencies of themselves if possible
a58e77b
Updates the node resolution
824798f
Ensures that binaries are set as executable in the cache
67edc56
Disables integrity checks when running under pnp
b2256f4
Makes the .pnp.js file an actual executable that can be used as a res…
5e55ef1
Merge pull request #48 from arcanis/sample-app
arcanis 96eb983
Merge pull request #47 from arcanis/ignore-pnp
arcanis f452a03
Merge pull request #46 from arcanis/location-blacklist
arcanis 7be256a
Merge pull request #51 from arcanis/location-to-locator-match-order
arcanis f4ea197
Merge pull request #50 from arcanis/implicit-self
arcanis 211dbcc
Merge pull request #49 from arcanis/node-resolution-improvements
arcanis a5cef0d
Merge pull request #52 from arcanis/chmod-bins
arcanis ff91c43
Merge pull request #53 from arcanis/pnp-no-integrity
arcanis 764c666
Merge pull request #54 from arcanis/pnp-executable
arcanis 155a2a9
Removes pnp-env
8ddc6f3
Merge remote-tracking branch 'yarnpkg/master'
159380f
Merge pull request #55 from arcanis/rm-pnp-env
arcanis 0561fba
Merge pull request #56 from arcanis/yarnpkg-merge
arcanis 7ce0c98
Fixes a few tests
b1fb4fb
Merge pull request #57 from arcanis/fix-bugs
arcanis 532403b
Merge remote-tracking branch 'yarnpkg/master'
aa4168c
Merge remote-tracking branch 'yarnpkg/master'
1821693
Fixes snapshots
be9641a
Fixes the lockfile not being written when using pnp
7552c6b
Fixes the `yarn node` command being incorrectly forwarded arguments
1cb1af8
Uses symlinks instead of a script for bin indirection to allow callin…
bb2244a
Adds a `yarn bin <name>` command that returns the path of the specifi…
75eb881
Implements an --into option to yarn node/yarn run
8a41330
Implements the `--pnp` option
e3426c5
Adds new tests for checking that packages are correctly locked
8e04f9d
Merge pull request #58 from arcanis/fix-lockfile
arcanis 2ffb593
Merge pull request #59 from arcanis/fix-yarn-node
arcanis ffcef36
Merge pull request #60 from arcanis/bin-symlinks
arcanis 76bb4d7
Merge pull request #61 from arcanis/yarn-bin-name
arcanis dd09a6c
Merge pull request #62 from arcanis/opt-into
arcanis f6f719a
Merge pull request #63 from arcanis/pnp-option
arcanis 8cbc12c
Merge pull request #67 from arcanis/lock-tests
arcanis 666de0f
Bugfixes
2f82e75
Fixes workspace registration
4494106
Uses --enable-pnp (alias --pnp) and --disable-pnp
5ddadbc
Merge pull request #68 from arcanis/bugfixes
arcanis f4aa5c4
Merge pull request #69 from arcanis/workspace-registration-fix
arcanis 87d0ea2
Merge pull request #70 from arcanis/instalconfig-pnp
arcanis 4ba0073
Adds the issuer into the error messages when requesting a package one…
e447dc9
Implements extendedQualifiedPathResolution
a1959f4
Merge pull request #71 from arcanis/via-issuer
arcanis f6f1cc7
Merge pull request #72 from arcanis/extended-qualified-path-resolution
arcanis 34669c8
Merge remote-tracking branch 'origin/via-issuer'
355efd1
Changes the return of the pnp daemon to return json data
c9f3000
Merge pull request #73 from arcanis/json-output
arcanis c2cc8cb
Implements custom shebangs for the pnp file
96bbb61
Merge pull request #74 from arcanis/shebang
arcanis 5183077
Changes the return of the pnp-exposed functions to return null with b…
cf35187
Merge pull request #75 from arcanis/builtins
arcanis 5911b1a
Merge remote-tracking branch 'yarnpkg/master'
5b1d56a
Merge remote-tracking branch 'yarnpkg/master'
07f1cbb
Various fixes & improvements
679deb0
Adds a test, prettier, fixes a test
ee96006
Don't iterate on the registries
3b47060
Merge pull request #76 from arcanis/various-fixes
arcanis b69efe4
Merge remote-tracking branch 'yarnpkg/master'
d29120d
Renames YARN_PLUGNPLAY_EXPERIMENTAL into YARN_PLUGNPLAY_OVERRIDE
7cf5c8e
Avoids touching the .pnp.js file when it doesn't need to change
be34944
Merge pull request #77 from arcanis/env-override
arcanis 87ffdd7
Merge pull request #78 from arcanis/avoid-overwrite
arcanis bae51f5
Reworks the cache path to contain the "node_modules/<pkg-name>" string
4501644
Merge pull request #79 from arcanis/node-modules-cache
arcanis 60752b5
Shims resolve#isCore
3ba32a3
Merge pull request #81 from arcanis/resolve-is-core
cpojer 9d132be
Improves error messages
8484400
Merge pull request #82 from arcanis/better-error-messages
arcanis 254c8a0
Fixes the environment cast to allow passing false/0
a63e850
Merge pull request #83 from arcanis/fix-cast
arcanis 1645e22
Implements a pnp blacklist settings
1a8f7aa
Merge pull request #84 from arcanis/ignore-regex
arcanis c2c3142
Fixes the fallback resolution to use _resolveFilename instead of _fin…
2c2ccfd
Fixes fallback relative path resolution
3c14719
Merge pull request #85 from arcanis/fallback-resolution-fix
arcanis 6e46e78
Implements require.cache
1dc047d
Merge pull request #86 from arcanis/require-cache
arcanis 225976f
Merge remote-tracking branch 'yarnpkg/master'
d5b12f1
Merge pull request #88 from arcanis/merge-080818
cpojer 1a498f8
Prevents pnp from being enabled on Windows
f5374de
Merge pull request #90 from arcanis/disable-win32
arcanis 8923227
Merge remote-tracking branch 'yarnpkg/master'
03fcd14
Merge remote-tracking branch 'yarnpkg/master'
df61b90
Removes absolute paths from the pnp files
30f1860
Merge pull request #89 from arcanis/relative-pnp-file
arcanis f46a763
Implements a super basic offline cache integration
304f4ea
Merge pull request #91 from arcanis/offline-cache
arcanis b9ee7d9
Merge pull request #93 from arcanis/relative-pnp-file
arcanis 6e15b0b
Merge remote-tracking branch 'yarnpkg/master'
dba71ee
feat(pnp): eject package command (#92)
imsnif 428f9ae
Fixes yarn bin
b8f4796
Merge pull request #94 from arcanis/fix-yarn-bin
arcanis bdef391
Preserves the node_modules components in zip paths
6ee42c1
Fixes the offline cache
9dbb226
Merge pull request #95 from arcanis/offline-cache-fixes
arcanis 143a462
Adds a VERSIONS field into the generated resolver
d1f46ea
Exposes the "extensions" option to "resolveRequest"
2d94b06
Renames yarn eject into yarn unplug
9bd6143
Merge pull request #98 from arcanis/eject-into-unplug
arcanis c72bf0f
Merge pull request #96 from arcanis/resolverequest-extensions
arcanis dc9e82d
Merge pull request #97 from arcanis/versioning
arcanis 6492fed
Tweaks yarn unplug
f1c8a1b
Removes packageMainEntry from the package information
8b8e4f5
Merge pull request #100 from arcanis/remove-main-entry
arcanis d78961c
Makes "unplug" print the list of unplugged packages
6a609ee
Merge pull request #99 from arcanis/unplug-clear
arcanis 48c8640
Merge remote-tracking branch 'yarnpkg/master'
56bc811
Unplugs postinstall packages automatically
41a9743
Renames things
02bd204
Adds a warning on Windows to notify that PnP settings are ignored at …
e7c7aa1
Fixes the default shebang
7cd35f1
Exports pnpapi
d9a7104
Reworks the resolve shim to only affect liftoff
77ffbbd
Guards the pnp file against fs extensions
6309d1f
Fixes the resolve shim
84358aa
Fixes a broken test
e1559bb
Re-enables the focus tests
4325ca1
Stops relying on bash for test scripts
48328a6
Fixes nohoist
f17f25e
Revert "Fixes a broken test"
2cf11d4
Ensures that the getPackageInformation function returns an absolute path
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file modified
BIN
+15 Bytes
(100%)
__tests__/fixtures/request-cache/GET/registry.yarnpkg.com/angular/core/-/core-2.4.10.tgz.bin
Binary file not shown.
Binary file added
BIN
+65 KB
__tests__/fixtures/request-cache/GET/registry.yarnpkg.com/types/node/-/node-10.3.2.tgz.bin
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,8 +13,8 @@ jasmine.DEFAULT_TIMEOUT_INTERVAL = 90000; | |
|
||
const path = require('path'); | ||
|
||
// regexp which verifies that cache path contains semver + hash | ||
const cachePathRe = /-\d+\.\d+\.\d+-[\dabcdef]{40}$/; | ||
// regexp which verifies that the cache path contains a path component ending with semver + hash | ||
const cachePathRe = /-\d+\.\d+\.\d+-[\dabcdef]{40}[\\\/]/; | ||
|
||
async function createEnv(configOptions): Object { | ||
const lockfile = new Lockfile(); | ||
|
@@ -82,7 +82,7 @@ addTest( | |
'@foo/[email protected]', | ||
'npm', | ||
async cacheFolder => { | ||
const folder = path.join(cacheFolder, 'npm-@foo', 'bar'); | ||
const folder = path.join(cacheFolder, 'npm-@foo-bar', 'node_modules', '@foo', 'bar'); | ||
await fs.mkdirp(folder); | ||
await fs.writeFile( | ||
path.join(folder, constants.METADATA_FILENAME), | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 7 additions & 2 deletions
9
packages/pkg-tests/pkg-tests-fixtures/packages/dep-loop-entry-1.0.0/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
/* @flow */ | ||
|
||
module.exports = require(`./package.json`); | ||
|
||
for (const key of Object.keys(module.exports.dependencies || {})) { | ||
module.exports.dependencies[key] = require(key); | ||
for (const key of [`dependencies`, `devDependencies`, `peerDependencies`]) { | ||
for (const dep of Object.keys(module.exports[key] || {})) { | ||
// $FlowFixMe The whole point of this file is to be dynamic | ||
module.exports[key][dep] = require(dep); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting .. I've simply updated this test, since the new value seems more correct to me. The extra
../..
is required to jump out ofnode_modules/.bin
(thelinkAt
function just reads the symlink as it is, it doesn't make it relative to anything special).