Skip to content

Commit

Permalink
fix: runtime-corejs 2 should depend on core-js@2 (#14937)
Browse files Browse the repository at this point in the history
* fix: runtime-corejs 2 should depend on core-js@2

* Enforces that @babel/runtime-corejs2 must depend on core-js 2
  • Loading branch information
JLHwung committed Sep 15, 2022
1 parent ae3b864 commit b5d3cc6
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
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').
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

0 comments on commit b5d3cc6

Please sign in to comment.