Skip to content

Commit

Permalink
Merge branch 'master' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
arcanis authored Oct 2, 2024
2 parents dc76e73 + 80052a0 commit 0b88d71
Show file tree
Hide file tree
Showing 31 changed files with 319 additions and 275 deletions.
332 changes: 153 additions & 179 deletions .pnp.cjs

Large diffs are not rendered by default.

Binary file not shown.
Binary file removed .yarn/cache/ink-npm-3.0.8-3a8005f59f-7bf1000576.zip
Binary file not shown.
Binary file not shown.
Binary file removed .yarn/cache/ink-patch-45ad7f405c-0285ba15e2.zip
Binary file not shown.
Binary file added .yarn/cache/ink-patch-68b5a63278-04dad338ca.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/build/ink.js b/build/ink.js
index f292bccdd049835ded848da83a6daac1e4f70416..54c4ebf36dc0c8f7f2580a5e69869848c83dc46f 100644
index 3c578b82d95eaeda5a0d7b9b03e88a41c503813b..70a98636304393a9296d8b3656e97d888806245d 100644
--- a/build/ink.js
+++ b/build/ink.js
@@ -23,7 +23,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
Expand Down
24 changes: 24 additions & 0 deletions .yarn/versions/54f60131.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
releases:
"@yarnpkg/cli": patch
"@yarnpkg/libui": patch
"@yarnpkg/plugin-interactive-tools": patch
"@yarnpkg/plugin-version": patch

declined:
- "@yarnpkg/plugin-compat"
- "@yarnpkg/plugin-constraints"
- "@yarnpkg/plugin-dlx"
- "@yarnpkg/plugin-essentials"
- "@yarnpkg/plugin-init"
- "@yarnpkg/plugin-nm"
- "@yarnpkg/plugin-npm-cli"
- "@yarnpkg/plugin-pack"
- "@yarnpkg/plugin-patch"
- "@yarnpkg/plugin-pnp"
- "@yarnpkg/plugin-pnpm"
- "@yarnpkg/plugin-stage"
- "@yarnpkg/plugin-typescript"
- "@yarnpkg/plugin-workspace-tools"
- "@yarnpkg/builder"
- "@yarnpkg/core"
- "@yarnpkg/doctor"
25 changes: 25 additions & 0 deletions .yarn/versions/a6283714.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
releases:
"@yarnpkg/cli": patch
"@yarnpkg/nm": patch
"@yarnpkg/plugin-nm": patch
"@yarnpkg/pnpify": patch

declined:
- "@yarnpkg/plugin-compat"
- "@yarnpkg/plugin-constraints"
- "@yarnpkg/plugin-dlx"
- "@yarnpkg/plugin-essentials"
- "@yarnpkg/plugin-init"
- "@yarnpkg/plugin-interactive-tools"
- "@yarnpkg/plugin-npm-cli"
- "@yarnpkg/plugin-pack"
- "@yarnpkg/plugin-patch"
- "@yarnpkg/plugin-pnp"
- "@yarnpkg/plugin-pnpm"
- "@yarnpkg/plugin-stage"
- "@yarnpkg/plugin-typescript"
- "@yarnpkg/plugin-version"
- "@yarnpkg/plugin-workspace-tools"
- "@yarnpkg/builder"
- "@yarnpkg/core"
- "@yarnpkg/doctor"
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Features in `master` can be tried out by running `yarn set version from sources`
- `node-modules` linker now honors user-defined symlinks for `<workspace>/node_modules` directories
- `node-modules` linker supports hoisting into inner workspaces that are parents of other workspaces
- `node-modules` linker attemps to hoist tree more exhaustivel until nothing can be hoisted
- `node-modules` linker uses aggregated count of peer and regular usages to decide hoisting priority, instead of preferring peer usages over regular as before, which should result in fewer duplicates

## 4.1.0

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"typescript": "^5.5.2"
},
"resolutions": {
"ink": "patch:ink@npm%3A3.0.8#~/.yarn/patches/ink-npm-3.0.8-3a8005f59f.patch",
"ink@^3.2.0": "patch:ink@npm%3A3.2.0#~/.yarn/patches/ink-npm-3.2.0-2f1df5b094.patch",
"yoga-layout-prebuilt": "patch:[email protected]#./.yarn/patches/yoga-layout-prebuilt.patch"
},
"dependenciesMeta": {
Expand Down
11 changes: 11 additions & 0 deletions packages/docusaurus/netlify.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[build]
publish = 'packages/docusaurus/build'
command = 'yarn packages/docusaurus build --no-minify'

[build.environment]
NODE_VERSION = '18.16'
NODE_OPTIONS = '--max-old-space-size=4096'
DOCUSAURUS_SSR_CONCURRENCY = '1'

[build.processing.html]
pretty_urls = false
6 changes: 3 additions & 3 deletions packages/plugin-interactive-tools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
"algoliasearch": "^4.2.0",
"clipanion": "^4.0.0-rc.2",
"diff": "^5.1.0",
"ink": "^3.0.8",
"ink-text-input": "^4.0.1",
"react": "^16.13.1",
"ink": "^3.2.0",
"ink-text-input": "^4.0.3",
"react": "^17.0.2",
"semver": "^7.1.2",
"tslib": "^2.4.0"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/plugin-version/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
"@yarnpkg/libui": "workspace:^",
"@yarnpkg/parsers": "workspace:^",
"clipanion": "^4.0.0-rc.2",
"ink": "^3.0.8",
"ink": "^3.2.0",
"lodash": "^4.17.15",
"react": "^16.13.1",
"react": "^17.0.2",
"semver": "^7.1.2",
"tslib": "^2.4.0"
},
Expand Down
6 changes: 3 additions & 3 deletions packages/yarnpkg-libui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
],
"peerDependencies": {
"ink": "^3.0.8",
"react": "^16.8.4"
"react": "^17.0.2"
},
"devDependencies": {
"@types/react": "^16.8.0",
"ink": "^3.0.8",
"react": "^16.13.1"
"ink": "^3.2.0",
"react": "^17.0.2"
},
"repository": {
"type": "git",
Expand Down
6 changes: 3 additions & 3 deletions packages/yarnpkg-nm/sources/hoist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,10 +298,10 @@ const getHoistIdentMap = (rootNode: HoisterWorkTree, preferenceMap: PreferenceMa
const entry2 = preferenceMap.get(key2)!;
if (entry2.hoistPriority !== entry1.hoistPriority) {
return entry2.hoistPriority - entry1.hoistPriority;
} else if (entry2.peerDependents.size !== entry1.peerDependents.size) {
return entry2.peerDependents.size - entry1.peerDependents.size;
} else {
return entry2.dependents.size - entry1.dependents.size;
const entry1Usages = entry1.dependents.size + entry1.peerDependents.size;
const entry2Usages = entry2.dependents.size + entry2.peerDependents.size;
return entry2Usages - entry1Usages;
}
});

Expand Down
37 changes: 37 additions & 0 deletions packages/yarnpkg-nm/tests/hoist.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,43 @@ describe(`hoist`, () => {
expect(getTreeHeight(hoist(toTree(tree), {check: true}))).toEqual(3);
});

it(`should honor package popularity considering number of all references over number of references by peers`, () => {
// . -> A -> Z@X
// -> B -> Z@X
// -> C -> Z@X
// -> D -> Z@Y
// -> U -> Z@Y
// should be hoisted to:
// . -> A
// -> B
// -> C
// -> D -> U
// -> Z@Y
// -> Z@X
const tree = toTree({
'.': {dependencies: [`A`, `B`, `C`, `D`]},
A: {dependencies: [`Z@X`]},
B: {dependencies: [`Z@X`]},
C: {dependencies: [`Z@X`]},
D: {dependencies: [`Z@Y`, `U`]},
U: {dependencies: [`Z@Y`], peerNames: [`Z`]},
});
const result = hoist(tree, {check: true});
expect(getTreeHeight(result)).toEqual(3);

const topLevelDeps = [...result.dependencies];
const hoistedZ = topLevelDeps.find(x => x.name === `Z`)!;
expect(hoistedZ.references).toContain(`X`);
expect(hoistedZ.references).not.toContain(`Y`);

const D = topLevelDeps.find(x => x.name === `D`)!;
const dDeps = [...D.dependencies];
expect(dDeps.length).toEqual(2);
const nestedZ = dDeps.find(x => x.name === `Z`)!;
expect(nestedZ.references).not.toContain(`X`);
expect(nestedZ.references).toContain(`Y`);
});

it(`should hoist dependencies after hoisting peer dep`, () => {
// . -> A -> B --> D@X
// -> D@X
Expand Down
Loading

0 comments on commit 0b88d71

Please sign in to comment.