From 7cdbf7d6e5f412b4a9b88c5d0fa79cd4161c234d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hu=C3=A1ng=20J=C3=B9nli=C3=A0ng?= Date: Wed, 14 Sep 2022 17:12:43 -0400 Subject: [PATCH 1/2] fix: runtime-corejs 2 should depend on core-js@2 --- packages/babel-runtime-corejs2/package.json | 2 +- yarn.lock | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/babel-runtime-corejs2/package.json b/packages/babel-runtime-corejs2/package.json index 495a87b94146..1e50debae340 100644 --- a/packages/babel-runtime-corejs2/package.json +++ b/packages/babel-runtime-corejs2/package.json @@ -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": { diff --git a/yarn.lock b/yarn.lock index 5e7c74d9f80a..64675f972f97 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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 @@ -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" From 13de20bf363ed5f6c1ef26172685d165ec6c4dfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hu=C3=A1ng=20J=C3=B9nli=C3=A0ng?= Date: Wed, 14 Sep 2022 19:03:05 -0400 Subject: [PATCH 2/2] Enforces that @babel/runtime-corejs2 must depend on core-js 2 --- constraints.pro | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/constraints.pro b/constraints.pro index f557c2f4955c..9a5b3650a0ab 100644 --- a/constraints.pro +++ b/constraints.pro @@ -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'. \ No newline at end of file + 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').