Skip to content

Commit ce28fd0

Browse files
rtibblesbotclaude
andcommitted
Upgrade Babel to 8 and move polyfill injection to babel-plugin-polyfill-corejs3
Babel 8 removes preset-env's `useBuiltIns`. Each of the three configs that set it keeps its injection mode: `entry-global` for the core polyfills bundle and Jest, `usage-global` for the sandbox. The core-js version hint moves with it, onto the plugin's `version` option. core-js unifies on the catalog at 3.49.0 — 3.50.0 is inside the 7-day `minimumReleaseAge` window. 300 -> 327 generated modules; all 38 removals are proposals that graduated to `es.*` in the same diff. Consequences of the major: - `vue-jest@3` reaches @babel/core through the `babel-core` bridge, which dies under 8. `@vue/vue2-jest` delegates to babel-jest instead. - transform-runtime needs an explicit `moduleName`: polyfill-corejs3 advertises `@babel/runtime-corejs3` as the helper module whatever its `method`. - `@babel/parser` is pinned to 7.x inside recast's scope — recast requires it from CJS without declaring it, and 8.x is ESM-only. - `@babel/plugin-syntax-import-assertions` is dropped; it has no 8.x release, and nothing transformed here uses import attributes. polyfillLoader.js's comment claimed browsers passing its ES2023 array-method test support the full polyfill set. That was already false at 3.31; the comment now states the test as the legacy-cohort cutoff it is. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 1800eba commit ce28fd0

12 files changed

Lines changed: 1217 additions & 1335 deletions

File tree

kolibri/core/buildConfig.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,10 @@ module.exports = [
3030
include: [path.resolve(__dirname, 'frontend/polyfills.js')],
3131
loader: 'babel-loader',
3232
options: {
33-
presets: [
34-
[
35-
'@babel/preset-env',
36-
{
37-
useBuiltIns: 'entry',
38-
corejs: '3.31',
39-
},
40-
],
33+
presets: ['@babel/preset-env'],
34+
// `version` must track the `core-js` catalog entry in pnpm-workspace.yaml.
35+
plugins: [
36+
['babel-plugin-polyfill-corejs3', { method: 'entry-global', version: '3.49' }],
4137
],
4238
sourceType: 'unambiguous',
4339
},

kolibri/core/frontend/polyfillLoader.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
1-
// Feature test for core-js 3.31 long-pole: ES2023 Array copy methods
2-
// (Array.prototype.toSorted / toReversed / toSpliced / with).
3-
// All browsers that natively support these also support the full
4-
// core-js 3.31 polyfill set — no generation from core-js-compat needed.
5-
// The pinned core-js version is corejs: '3.31' in kolibri/core/buildConfig.js —
6-
// revisit this test when bumping that value.
1+
// Legacy-cohort cutoff, not a completeness check: browsers that pass this
2+
// ES2023 Array-copy test still lack part of the bundled core-js set.
3+
// No feature test separates that set cleanly at any core-js version.
74
(function () {
85
var p = Array.prototype;
96
var methods = ['toSorted', 'toReversed', 'toSpliced', 'with'];

kolibri/core/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44
"private": true,
55
"version": "0.0.1",
66
"dependencies": {
7-
"@babel/core": "^7.29.7",
8-
"@babel/preset-env": "^7.29.7",
7+
"@babel/core": "^8.0.0",
8+
"@babel/preset-env": "^8.0.0",
99
"@vueuse/core": "catalog:",
1010
"babel-loader": "^10.1.1",
11+
"babel-plugin-polyfill-corejs3": "^1.0.0",
1112
"browserslist-config-kolibri": "workspace:*",
1213
"core-js": "catalog:",
1314
"kolibri": "workspace:*",

kolibri/plugins/media_player/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"private": true,
55
"version": "0.0.1",
66
"dependencies": {
7-
"@babel/runtime": "^7.29.7",
7+
"@babel/runtime": "^8.0.0",
88
"@vueuse/core": "catalog:",
99
"frame-throttle": "^3.0.0",
1010
"global": "^4.4.0",

package.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@
4343
"devDependencies": {
4444
"@crowdin/cli": "^4.14.1",
4545
"@types/jest": "^30.0.0",
46+
"@vue/vue2-jest": "^29.2.6",
4647
"@vueuse/shared": "^11.3.0",
47-
"babel-core": "7.0.0-bridge.0",
4848
"babel-jest": "^30.3.0",
4949
"browserslist-config-kolibri": "workspace:*",
5050
"concurrently": "^8.0.1",
@@ -60,7 +60,6 @@
6060
"kolibri-logging": "workspace:*",
6161
"kolibri-plugin-data": "workspace:*",
6262
"rewire": "^6.0.0",
63-
"vue-jest": "^3.0.0",
6463
"vue-template-compiler": "2.7.16",
6564
"webpack": "^5.104.0"
6665
},
@@ -98,14 +97,18 @@
9897
"vue-demi"
9998
],
10099
"overrides": {
101-
"@khanacademy/math-input>mathquill": "github:Khan/mathquill#v1.0.0",
102-
"vue-jest>vue-template-es2015-compiler": "npm:vue-template-babel-compiler@^2.0.0"
100+
"@khanacademy/math-input>mathquill": "github:Khan/mathquill#v1.0.0"
103101
},
104102
"packageExtensions": {
105103
"@khanacademy/perseus@*": {
106104
"dependencies": {
107105
"@swc/helpers": "^0.5.18"
108106
}
107+
},
108+
"recast@*": {
109+
"dependencies": {
110+
"@babel/parser": "^7.29.7"
111+
}
109112
}
110113
}
111114
}
Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
module.exports = {
2-
presets: [
3-
[
4-
'@babel/preset-env',
5-
{
6-
useBuiltIns: 'entry',
7-
corejs: '3.31',
8-
},
9-
],
2+
presets: ['@babel/preset-env'],
3+
// `version` must track the `core-js` catalog entry in pnpm-workspace.yaml.
4+
plugins: [
5+
['babel-plugin-polyfill-corejs3', { method: 'entry-global', version: '3.49' }],
6+
// polyfill-corejs3 advertises `@babel/runtime-corejs3` as the helper module
7+
// whatever its `method`, and transform-runtime follows that over its default.
8+
['@babel/plugin-transform-runtime', { moduleName: '@babel/runtime' }],
109
],
11-
plugins: ['@babel/plugin-syntax-import-assertions', '@babel/plugin-transform-runtime'],
1210
sourceType: 'unambiguous',
1311
};

packages/kolibri-jest-config/jest.conf/index.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
const path = require('node:path');
2-
const babelConfig = require('./babel.config');
32

43
const moduleNameMapper = {
54
'^testUtils$': path.resolve(__dirname, './testUtils'),
@@ -13,9 +12,6 @@ module.exports = {
1312
__version: 'testversion',
1413
__copyrightYear: '2018',
1514
__webpack_public_path__: 'webpack_public_path',
16-
'vue-jest': {
17-
babelConfig,
18-
},
1915
},
2016
rootDir: path.resolve(process.cwd()),
2117
moduleFileExtensions: ['js', 'json', 'vue'],
@@ -26,7 +22,7 @@ module.exports = {
2622
},
2723
transform: {
2824
'^.+\\.js$': 'babel-jest',
29-
'^.+\\.vue$': 'vue-jest',
25+
'^.+\\.vue$': '@vue/vue2-jest',
3026
},
3127
transformIgnorePatterns: [
3228
// Ignore all node_modules except kolibri packages

packages/kolibri-jest-config/package.json

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,13 @@
1212
"private": false,
1313
"main": "jest.conf/index.js",
1414
"dependencies": {
15-
"@babel/core": "^7.29.7",
16-
"@babel/plugin-syntax-import-assertions": "^7.29.7",
17-
"@babel/plugin-transform-runtime": "^7.29.7",
18-
"@babel/preset-env": "^7.29.7",
15+
"@babel/core": "^8.0.0",
16+
"@babel/plugin-transform-runtime": "^8.0.0",
17+
"@babel/preset-env": "^8.0.0",
18+
"@babel/runtime": "^8.0.0",
1919
"aphrodite": "^2.4.0",
20-
"core-js": "^3",
20+
"babel-plugin-polyfill-corejs3": "^1.0.0",
21+
"core-js": "catalog:",
2122
"intl": "^1.2.4",
2223
"kolibri": "workspace:*",
2324
"kolibri-design-system": "catalog:",
@@ -36,11 +37,11 @@
3637
"@testing-library/user-event": "^14.6.1",
3738
"@testing-library/vue": "^5",
3839
"@vue/test-utils": "^1.3.6",
40+
"@vue/vue2-jest": "^29.2.6",
3941
"babel-jest": "^30.2.0",
4042
"jest": "^30.2.0",
4143
"jest-environment-jsdom": "^30.2.0",
42-
"jest-serializer-vue": "^3.1.0",
43-
"vue-jest": "^3.0.0"
44+
"jest-serializer-vue": "^3.1.0"
4445
},
4546
"engines": {
4647
"node": ">= 20.19.0",
Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
/* eslint-disable import-x/no-commonjs, import-x/no-amd, import-x/no-import-module-exports */
22
module.exports = {
3-
presets: [
4-
[
5-
'@babel/preset-env',
6-
{
7-
useBuiltIns: 'usage',
8-
corejs: '3.46',
9-
},
10-
],
11-
],
3+
presets: ['@babel/preset-env'],
4+
// `version` must track the `core-js` catalog entry in pnpm-workspace.yaml.
5+
plugins: [['babel-plugin-polyfill-corejs3', { method: 'usage-global', version: '3.49' }]],
126
};

packages/kolibri-sandbox/package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@
1414
"author": "Learning Equality",
1515
"license": "MIT",
1616
"devDependencies": {
17-
"@babel/core": "^7.29.7",
18-
"@babel/preset-env": "^7.29.7",
17+
"@babel/core": "^8.0.0",
18+
"@babel/preset-env": "^8.0.0",
1919
"babel-loader": "^10.1.1",
20+
"babel-plugin-polyfill-corejs3": "^1.0.0",
2021
"css-loader": "7.1.2",
2122
"css-minimizer-webpack-plugin": "8.0.0",
2223
"eslint-plugin-compat": "^6.0.2",
@@ -31,7 +32,7 @@
3132
"webpack-cli": "^7.0.2"
3233
},
3334
"dependencies": {
34-
"core-js": "3.47",
35+
"core-js": "catalog:",
3536
"dayjs": "^1.11.20",
3637
"iri": "^1.3.1",
3738
"is-language-code": "^3.1.0",

0 commit comments

Comments
 (0)