Skip to content

Commit 9a3caa3

Browse files
authored
feat(deps)!: Remove core-js (#1401)
1 parent fa082c0 commit 9a3caa3

File tree

28 files changed

+43
-1134
lines changed

28 files changed

+43
-1134
lines changed

.changesets/release_notes_major.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,3 +240,25 @@ from `schema.prisma` and print a warning reminding you to update
240240
- [ ] Write upgrade script that warns about `directUrl`
241241
- [ ] Warn about custom `prisma.config.cjs` path (from cedar.toml) for sqlite
242242
apps
243+
244+
# Breaking Changes
245+
246+
## Babel Target Updated: Node.js 20.10 → 24
247+
248+
Cedar now targets **Node.js 24** as the minimum version for the API side for the
249+
babel config. This allows us to remove several Babel plugins for class fields,
250+
private methods, and nullish coalescing. All those are natively supported in
251+
Node 24.
252+
253+
**Note** that Cedar already officially moved to Node 24 with the release of
254+
Cedar v2.0.0. So unless you're running on an unsupported version of Node, this
255+
change should not affect you at all.
256+
257+
## Removed: core-js Polyfills
258+
259+
`core-js` and `@babel/runtime-corejs3` have been completely removed from Cedar.
260+
The framework was only polyfilling stage 1–3 TC39 proposals, which are not
261+
recommended for production use and are not used anywhere in Cedar itself.
262+
263+
If you need polyfills for any feature it's now up to you to configure it
264+
yourself in your app.

__fixtures__/example-todo-main/api/src/lib/polyfill.js

Lines changed: 0 additions & 134 deletions
This file was deleted.

babel.config.js

Lines changed: 1 addition & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,13 @@
1-
const path = require('path')
2-
3-
const packageJSON = require(path.join(__dirname, 'package.json'))
4-
5-
const TARGETS_NODE = '20.10'
6-
71
// Run `npx browserslist "defaults"` to see a list of target browsers.
82
const TARGETS_BROWSERS = ['defaults']
93

10-
// Warning! Recommended to specify used minor core-js version, like corejs: '3.6',
11-
// instead of corejs: '3', since with '3' it will not be injected modules
12-
// which were added in minor core-js releases.
13-
// https://github.com/zloirock/core-js/blob/master/README.md#babelpreset-env
14-
const CORE_JS_VERSION = packageJSON.devDependencies['core-js']
15-
.split('.')
16-
.slice(0, 2)
17-
.join('.') // Produces: 3.12, instead of 3.12.1
18-
194
// We use the recommended babel configuration for monorepos, which is a base directory
205
// `babel.config.js` file, but then use a per-project `.babelrc.js` file.
216
// Learn more: https://babeljs.io/docs/en/config-files#monorepos
227

238
/** @type {import('@babel/core').TransformOptions} */
249
module.exports = {
2510
presets: [
26-
[
27-
'@babel/preset-env',
28-
{
29-
targets: { node: TARGETS_NODE },
30-
useBuiltIns: 'usage',
31-
corejs: {
32-
version: CORE_JS_VERSION,
33-
// List of supported proposals: https://github.com/zloirock/core-js/blob/master/docs/2019-03-19-core-js-3-babel-and-a-look-into-the-future.md#ecmascript-proposals
34-
proposals: true,
35-
},
36-
exclude: [
37-
'es.error.cause',
38-
process.env.NODE_ENV !== 'test' && 'proposal-dynamic-import',
39-
].filter(Boolean),
40-
},
41-
],
4211
['@babel/preset-react', { runtime: 'automatic' }],
4312
/**
4413
* TODO(pc): w/ '@babel/plugin-transform-typescript' in plugins now, is '@babel/typescript' preset still needed?
@@ -87,22 +56,7 @@ module.exports = {
8756
* https://github.com/tc39/proposal-decorators
8857
**/
8958
['@babel/plugin-proposal-decorators', { legacy: true }],
90-
// The "loose" option must be the same for all three of these plugins.
91-
['@babel/plugin-transform-class-properties', { loose: true }],
92-
['@babel/plugin-transform-private-methods', { loose: true }],
93-
['@babel/plugin-transform-private-property-in-object', { loose: true }],
94-
[
95-
'@babel/plugin-transform-runtime',
96-
{
97-
// https://babeljs.io/docs/en/babel-plugin-transform-runtime/#core-js-aliasing
98-
// Setting the version here also requires `@babel/runtime-corejs3`
99-
corejs: { version: 3, proposals: true },
100-
// https://babeljs.io/docs/en/babel-plugin-transform-runtime/#version
101-
// Transform-runtime assumes that @babel/runtime@7.0.0 is installed.
102-
// Specifying the version can result in a smaller bundle size.
103-
version: packageJSON.devDependencies['@babel/runtime-corejs3'],
104-
},
105-
],
59+
['@babel/plugin-transform-runtime'],
10660
'@babel/plugin-syntax-import-attributes',
10761
],
10862
overrides: [
@@ -137,10 +91,6 @@ module.exports = {
13791
],
13892
},
13993
],
140-
// normally provided through preset-env detecting TARGET_BROWSER
141-
// but webpack 4 has an issue with this
142-
// see https://github.com/PaulLeCam/react-leaflet/issues/883
143-
['@babel/plugin-transform-nullish-coalescing-operator'],
14494
],
14595
},
14696
],

package.json

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,16 +77,11 @@
7777
"@babel/generator": "7.29.1",
7878
"@babel/node": "7.29.0",
7979
"@babel/plugin-proposal-decorators": "7.29.0",
80-
"@babel/plugin-transform-class-properties": "7.28.6",
81-
"@babel/plugin-transform-nullish-coalescing-operator": "7.28.6",
82-
"@babel/plugin-transform-private-methods": "7.28.6",
83-
"@babel/plugin-transform-private-property-in-object": "7.28.6",
8480
"@babel/plugin-transform-react-jsx": "7.28.6",
8581
"@babel/plugin-transform-runtime": "7.29.0",
8682
"@babel/preset-env": "7.29.0",
8783
"@babel/preset-react": "7.28.5",
8884
"@babel/preset-typescript": "7.28.5",
89-
"@babel/runtime-corejs3": "7.29.0",
9085
"@npmcli/arborist": "9.4.1",
9186
"@playwright/test": "1.58.2",
9287
"@prisma/dev": "0.20.0",
@@ -108,7 +103,6 @@
108103
"babel-plugin-remove-code": "0.0.6",
109104
"boxen": "5.1.2",
110105
"concurrently": "9.2.1",
111-
"core-js": "3.48.0",
112106
"cross-env": "7.0.3",
113107
"cypress": "13.17.0",
114108
"cypress-fail-fast": "7.1.1",

packages/auth-providers/dbAuth/setup/package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,9 @@
2222
"test:watch": "yarn test --watch"
2323
},
2424
"dependencies": {
25-
"@babel/runtime-corejs3": "7.29.0",
2625
"@cedarjs/cli-helpers": "workspace:*",
2726
"@prisma/internals": "7.5.0",
2827
"@simplewebauthn/browser": "10.0.0",
29-
"core-js": "3.48.0",
3028
"prompts": "2.4.2",
3129
"termi-link": "1.1.0"
3230
},

packages/auth/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@
8787
"test:watch": "vitest watch"
8888
},
8989
"dependencies": {
90-
"core-js": "3.48.0",
9190
"react": "19.2.3"
9291
},
9392
"devDependencies": {

packages/babel-config/dist.test.ts

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6,37 +6,9 @@ describe('dist', () => {
66
it('exports', async () => {
77
const { default: mod } = await import(path.join(distPath, 'index.js'))
88

9-
// We use this to calculate the diff in minor versions
10-
const runtimeMinorVersion = mod.RUNTIME_CORE_JS_VERSION.split('.')[1]
11-
// We use this to allow all patch versions
12-
const runtimePatchVersion = mod.RUNTIME_CORE_JS_VERSION.split('.')[2]
13-
14-
// We use this to calculate the diff in minor versions
15-
const coreJsMinorVersion = mod.CORE_JS_VERSION.split('.')[1]
16-
17-
const expectedRuntimeMinorVersion = 28
18-
const expectedCoreJsMinorVersion = 48
19-
20-
// Allow a minor version difference of 1
21-
expect(
22-
Math.abs(expectedRuntimeMinorVersion - runtimeMinorVersion),
23-
).toBeLessThanOrEqual(1)
24-
expect(
25-
Math.abs(expectedCoreJsMinorVersion - coreJsMinorVersion),
26-
).toBeLessThanOrEqual(1)
27-
289
expect(mod).toMatchInlineSnapshot(`
2910
{
30-
"BABEL_PLUGIN_TRANSFORM_RUNTIME_OPTIONS": {
31-
"corejs": {
32-
"proposals": true,
33-
"version": 3,
34-
},
35-
"version": "7.${runtimeMinorVersion}.${runtimePatchVersion}",
36-
},
37-
"CORE_JS_VERSION": "3.${coreJsMinorVersion}",
38-
"RUNTIME_CORE_JS_VERSION": "7.${runtimeMinorVersion}.${runtimePatchVersion}",
39-
"TARGETS_NODE": "20.10",
11+
"TARGETS_NODE": "24",
4012
"getApiSideBabelConfigPath": [Function],
4113
"getApiSideBabelPlugins": [Function],
4214
"getApiSideBabelPresets": [Function],

packages/babel-config/package.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,17 @@
2424
"dependencies": {
2525
"@babel/core": "^7.26.10",
2626
"@babel/parser": "7.29.0",
27-
"@babel/plugin-transform-class-properties": "7.28.6",
28-
"@babel/plugin-transform-private-methods": "7.28.6",
29-
"@babel/plugin-transform-private-property-in-object": "7.28.6",
3027
"@babel/plugin-transform-react-jsx": "7.28.6",
3128
"@babel/plugin-transform-runtime": "7.29.0",
3229
"@babel/preset-env": "7.29.0",
3330
"@babel/preset-react": "7.28.5",
3431
"@babel/preset-typescript": "7.28.5",
3532
"@babel/register": "7.28.6",
36-
"@babel/runtime-corejs3": "7.29.0",
3733
"@babel/traverse": "7.29.0",
3834
"@cedarjs/project-config": "workspace:*",
3935
"babel-plugin-auto-import": "1.1.0",
4036
"babel-plugin-graphql-tag": "3.3.0",
4137
"babel-plugin-module-resolver": "5.0.2",
42-
"core-js": "3.48.0",
4338
"fast-glob": "3.3.3",
4439
"graphql": "16.13.1",
4540
"typescript": "5.9.3"

0 commit comments

Comments
 (0)