Skip to content
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

fix: runtime-corejs 2 should depend on core-js@2 #14937

Merged
merged 2 commits into from Sep 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 11 additions & 2 deletions constraints.pro
Expand Up @@ -92,11 +92,20 @@ gen_enforced_field(WorkspaceCwd, 'exports', '{ ".": "./lib/index.js", "./package
gen_enforced_field(WorkspaceCwd, 'type', 'commonjs') :-
\+ workspace_field(WorkspaceCwd, 'type', 'module').

% Enforce a default 'conditions', unless it's already specified
% Enforces a default 'conditions', unless it's already specified
gen_enforced_field(WorkspaceCwd, 'conditions', '{ "USE_ESM": [{ "type": "module" }, null] }') :-
\+ workspace_field(WorkspaceCwd, 'private', true),
\+ workspace_field(WorkspaceCwd, 'conditions', _),
\+ workspace_field(WorkspaceCwd, 'main', './lib/index.cjs'),
% Exclude some packages
workspace_ident(WorkspaceCwd, WorkspaceIdent),
WorkspaceIdent \= '@babel/compat-data'.
WorkspaceIdent \= '@babel/compat-data'.

% Enforces that @babel/runtime-corejs2 must depend on core-js 2
gen_enforced_dependency(WorkspaceCwd, 'core-js', '^2.6.12', DependencyType) :-
% Get the workspace name
workspace_ident(WorkspaceCwd, WorkspaceIdent),
% Only consider 'dependencies'
(DependencyType = 'dependencies'),
% The rule works for @babel/runtime-corejs2 only
(WorkspaceIdent = '@babel/runtime-corejs2').
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now yarn constraints will throw

YN0024: @babel/runtime-corejs2 must depend on core-js via ^2.6.12, but uses ^3.25.1 instead (in dependencies)

if we run yarn up core-js without yarn constraints --fix, the constraint check is in CI so we should be all good.

2 changes: 1 addition & 1 deletion packages/babel-runtime-corejs2/package.json
Expand Up @@ -14,7 +14,7 @@
"homepage": "https://babel.dev/docs/en/next/babel-runtime-corejs2",
"author": "The Babel Team (https://babel.dev/team)",
"dependencies": {
"core-js": "^3.25.1",
"core-js": "^2.6.12",
"regenerator-runtime": "^0.13.4"
},
"exports": {
Expand Down
9 changes: 8 additions & 1 deletion yarn.lock
Expand Up @@ -3582,7 +3582,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@babel/runtime-corejs2@workspace:packages/babel-runtime-corejs2"
dependencies:
core-js: ^3.25.1
core-js: ^2.6.12
regenerator-runtime: ^0.13.4
languageName: unknown
linkType: soft
Expand Down Expand Up @@ -7023,6 +7023,13 @@ __metadata:
languageName: node
linkType: hard

"core-js@npm:^2.6.12":
version: 2.6.12
resolution: "core-js@npm:2.6.12"
checksum: 44fa9934a85f8c78d61e0c8b7b22436330471ffe59ec5076fe7f324d6e8cf7f824b14b1c81ca73608b13bdb0fef035bd820989bf059767ad6fa13123bb8bd016
languageName: node
linkType: hard

"core-js@npm:^3.25.1":
version: 3.25.1
resolution: "core-js@npm:3.25.1"
Expand Down