-
-
Notifications
You must be signed in to change notification settings - Fork 933
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
feat: implement catalog protocol reads (feature flagged) #8020
Closed
Closed
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
43a173c
feat: create new @pnpm/catalogs.types package
gluxon befc765
feat: create new @pnpm/catalogs.protocol-parser package
gluxon bd7df76
feat: implement catalog protocol parser
gluxon d575cbc
feat: define feature flag to enable catalogs in tests
gluxon 5dee13d
feat: read and store catalogs config in PnpmContext
gluxon ec7dfb2
feat: implement catalog resolver and replace prefs
gluxon 4fee31d
feat: record catalog lookup snapshots through propagated metadata
gluxon 07a2e87
refactor: factor out isWantedDepPrefSame to extend in a future commit
gluxon ca6b6f8
feat: update projects when catalogs config changes
gluxon 93d5599
test: add catalog protocol tests
gluxon File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# @pnpm/catalogs.types | ||
|
||
## 0.1.0 | ||
|
||
Initial release |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# @pnpm/catalogs.types | ||
|
||
> Types related to the pnpm catalogs feature. | ||
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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{ | ||
"name": "@pnpm/catalogs.types", | ||
"version": "0.1.0", | ||
"description": "Types related to the pnpm catalogs feature.", | ||
"main": "lib/index.js", | ||
"types": "lib/index.d.ts", | ||
"engines": { | ||
"node": ">=18.12" | ||
}, | ||
"files": [ | ||
"lib", | ||
"!*.map" | ||
], | ||
"repository": "https://github.com/pnpm/pnpm/blob/main/catalogs/types", | ||
"keywords": [ | ||
"pnpm9", | ||
"pnpm", | ||
"types" | ||
], | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/pnpm/pnpm/issues" | ||
}, | ||
"homepage": "https://github.com/pnpm/pnpm/blob/main/catalogs/types#readme", | ||
"scripts": { | ||
"lint": "eslint \"src/**/*.ts\"", | ||
"compile": "tsc --build && pnpm run lint --fix", | ||
"prepublishOnly": "pnpm run compile", | ||
"test": "pnpm run compile" | ||
}, | ||
"funding": "https://opencollective.com/pnpm", | ||
"exports": { | ||
".": "./lib/index.js" | ||
}, | ||
"devDependencies": { | ||
"@pnpm/catalogs.types": "workspace:*" | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/** | ||
* Catalogs parsed from the pnpm-workspace.yaml file. | ||
* | ||
* https://github.com/pnpm/rfcs/pull/1 | ||
*/ | ||
export interface Catalogs { | ||
/** | ||
* The default catalog. | ||
* | ||
* The default catalog can be defined in 2 ways. | ||
* | ||
* 1. Users can specify a top-level "catalog" field or, | ||
* 2. An explicitly named "default" catalog under the "catalogs" map. | ||
* | ||
* This field contains either definition. Note that it's an error to define | ||
* the default catalog using both options. The parser will fail when reading | ||
* the workspace manifest. | ||
*/ | ||
readonly default?: Catalog | ||
|
||
/** | ||
* Named catalogs. | ||
*/ | ||
readonly [catalogName: string]: Catalog | undefined | ||
} | ||
|
||
export interface Catalog { | ||
readonly [dependencyName: string]: string | undefined | ||
} |
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"extends": "@pnpm/tsconfig", | ||
"composite": true, | ||
"compilerOptions": { | ||
"outDir": "lib", | ||
"rootDir": "src" | ||
}, | ||
"include": [ | ||
"src/**/*.ts", | ||
"../../__typings__/**/*.d.ts" | ||
], | ||
"references": [] | ||
} |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"include": [ | ||
"src/**/*.ts", | ||
"test/**/*.ts", | ||
"../../__typings__/**/*.d.ts" | ||
] | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
Instead of creating a new
@pnpm/catalogs.types
package, we could also stuff the small definitions here into the existing@pnpm/types
package. I opted for a new package for now since we're doing something similar for hooks:@pnpm/hooks.types
.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.
sounds good to me
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.
Thanks. I'll separate the new packages out to a different PR so you don't have to keep looking at these changes when re-reviewing this PR.
@pnpm/catalogs.types
package #8026@pnpm/catalogs.protocol-parser
package for parsing catalog specifiers #8027