Compare commits

...

2 Commits

Author SHA1 Message Date
Evan
85fef51c3a fix(ci): use valid regex for .patch exclusion in .rat-excludes
RAT compiles .rat-excludes lines as Java regex, so the glob '*.patch'
threw 'Dangling meta character' and was skipped, leaving the new
patch-package patch flagged as unlicensed. Use '.*\.patch' to match the
existing regex style and exclude patch files.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-28 18:21:00 -07:00
Claude Code
e763ef86fd chore(deps): upgrade Babel to 8.x across the frontend
Upgrades all @babel/* packages from 7.x to 8.0.x in one coordinated change,
replacing the ~17 individual Dependabot PRs (Babel 8 must be adopted atomically
because @babel/core and its plugins/presets share peer ranges).

Includes the workarounds the surrounding ecosystem still requires for Babel 8:

- babel.config.js migrated for Babel 8 removals:
  - loose/spec options -> `assumptions` (setPublicClassFields,
    privateFieldsAsProperties, noDocumentAll)
  - preset-env `useBuiltIns`/`corejs` -> babel-plugin-polyfill-corejs3
  - dropped @babel/plugin-syntax-dynamic-import (removed in v8) and the
    standalone class/optional-chaining/nullish transforms (now in preset-env)
  - preset-typescript `onlyRemoveTypeImports: false` to keep eliding
    value-syntax type-only imports (the v8 default flipped to true)
  - preset-react and @emotion/babel-plugin scoped to .jsx/.tsx via `overrides`
    so their JSX syntax plugin no longer makes TS generic arrows in .ts files
    parse as JSX
  - test env uses preset-env `modules: 'commonjs'` instead of the standalone
    transform-modules-commonjs plugin (plugin/preset ordering changed in v8)

- Removed babel-plugin-lodash: it calls the removed `path.hoist`/
  `isModuleDeclaration` APIs and is unmaintained (bundle-size note in the PR).

- patch-package introduced (postinstall) to patch @emotion/babel-plugin, whose
  latest release still calls the removed NodePath#hoist. Remove once Emotion
  ships Babel 8 support.

- package.json `overrides` relax @babel/core peer ranges for ts-jest and the
  @babel/plugin-syntax-* no-op packages (via babel-preset-current-node-syntax)
  that have not yet declared Babel 8 compatibility.

Validated with `npm ci`, the production webpack build, and the Jest unit suite.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-28 13:50:33 -07:00
9 changed files with 7756 additions and 1830 deletions

View File

@@ -55,9 +55,9 @@ repos:
exclude: ^helm/superset/templates/
- id: debug-statements
- id: end-of-file-fixer
exclude: .*/lerna\.json$|^docs/static/img/logos/
exclude: .*/lerna\.json$|^docs/static/img/logos/|^superset-frontend/patches/
- id: trailing-whitespace
exclude: ^.*\.(snap)
exclude: ^.*\.(snap)|^superset-frontend/patches/
args: ["--markdown-linebreak-ext=md"]
- repo: local
hooks:

View File

@@ -80,6 +80,9 @@ erd.svg
intro_header.txt
TODO.md
# patch-package patches (unified diffs cannot carry license headers)
.*\.patch
# for LLMs
llm-context.md
llms.txt

View File

@@ -22,44 +22,41 @@ module.exports = {
sourceMaps: true,
sourceType: 'module',
retainLines: true,
// Babel 8 removed the `loose`/`spec` options from preset-env and plugins in
// favor of granular compiler assumptions. These mirror the previous loose
// behavior. See https://babeljs.io/assumptions
assumptions: {
setPublicClassFields: true,
privateFieldsAsProperties: true,
noDocumentAll: true,
},
presets: [
[
'@babel/preset-env',
{
useBuiltIns: 'usage',
corejs: 3,
loose: true,
modules: false,
shippedProposals: true,
targets: packageConfig.browserslist,
},
],
[
'@babel/preset-react',
{
development: process.env.BABEL_ENV === 'development',
runtime: 'automatic',
},
],
'@babel/preset-typescript',
// preset-react is scoped to .jsx/.tsx via `overrides` below. In Babel 8 its
// JSX syntax plugin would otherwise apply to .ts files and make TypeScript
// generic arrows (e.g. `<T = unknown>(x: T) => x`) parse as JSX.
['@babel/preset-typescript', { onlyRemoveTypeImports: false }],
],
plugins: [
'lodash',
'@babel/plugin-syntax-dynamic-import',
// Babel 8 removed preset-env's `useBuiltIns`/`corejs`; core-js polyfill
// injection is now handled directly by babel-plugin-polyfill-corejs3.
['babel-plugin-polyfill-corejs3', { method: 'usage-global' }],
'@babel/plugin-transform-export-namespace-from',
['@babel/plugin-transform-class-properties', { loose: true }],
'@babel/plugin-transform-class-static-block',
['@babel/plugin-transform-optional-chaining', { loose: true }],
['@babel/plugin-transform-private-methods', { loose: true }],
['@babel/plugin-transform-nullish-coalescing-operator', { loose: true }],
// The class-properties/class-static-block/optional-chaining/private-methods/
// nullish-coalescing transforms are bundled into preset-env in Babel 8 and
// ordered correctly after preset-typescript; their loose behavior is now
// covered by the top-level `assumptions`.
['@babel/plugin-transform-runtime', { corejs: 3 }],
[
'@emotion/babel-plugin',
{
autoLabel: 'dev-only',
labelFormat: '[local]',
},
],
// @emotion/babel-plugin is scoped to .jsx/.tsx via `overrides` below: it
// enables JSX syntax (for the `css` prop), which on .ts files would make
// TypeScript generic arrows parse as JSX.
],
env: {
// Setup a different config for tests as they run in node instead of a browser
@@ -68,26 +65,23 @@ module.exports = {
[
'@babel/preset-env',
{
useBuiltIns: 'usage',
corejs: 3,
loose: true,
shippedProposals: true,
modules: 'auto',
// Let preset-env handle the CommonJS transform so it runs after
// preset-typescript strips type-only imports/exports. A standalone
// transform-modules-commonjs plugin would run first (Babel 8 orders
// plugins before presets) and rewrite type-only re-exports into
// requires before they can be elided.
modules: 'commonjs',
targets: { node: 'current' },
},
],
[
'@babel/preset-react',
{
development: process.env.BABEL_ENV === 'development',
runtime: 'automatic',
},
],
'@babel/preset-typescript',
// preset-react is applied via the top-level `overrides` (scoped to
// .jsx/.tsx), which also apply in this env.
['@babel/preset-typescript', { onlyRemoveTypeImports: false }],
],
plugins: [
['babel-plugin-polyfill-corejs3', { method: 'usage-global' }],
'babel-plugin-dynamic-import-node',
'@babel/plugin-transform-modules-commonjs',
'@babel/plugin-transform-export-namespace-from',
],
},
@@ -127,5 +121,29 @@ module.exports = {
test: './plugins/plugin-chart-handlebars/node_modules/just-handlebars-helpers/*',
sourceType: 'unambiguous',
},
{
// Apply JSX-dependent transforms (preset-react and @emotion/babel-plugin)
// only to files that can contain JSX. Both enable the JSX syntax plugin,
// which on .ts files would make TypeScript generic arrows parse as JSX.
test: /\.(jsx|tsx)$/,
presets: [
[
'@babel/preset-react',
{
development: process.env.BABEL_ENV === 'development',
runtime: 'automatic',
},
],
],
plugins: [
[
'@emotion/babel-plugin',
{
autoLabel: 'dev-only',
labelFormat: '[local]',
},
],
],
},
],
};

File diff suppressed because it is too large Load Diff

View File

@@ -76,6 +76,7 @@
"playwright:debug": "playwright test --debug",
"playwright:report": "playwright show-report",
"docs:screenshots": "playwright test --config=playwright/generators/playwright.config.ts docs/",
"postinstall": "patch-package",
"prettier": "npm run _prettier -- --write",
"prettier-check": "npm run _prettier -- --check",
"prod": "npm run build",
@@ -242,22 +243,20 @@
"yargs": "^18.0.0"
},
"devDependencies": {
"@babel/cli": "^7.29.7",
"@babel/compat-data": "^7.28.4",
"@babel/core": "^7.29.7",
"@babel/eslint-parser": "^7.29.7",
"@babel/node": "^7.29.7",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/plugin-transform-export-namespace-from": "^7.29.7",
"@babel/plugin-transform-modules-commonjs": "^7.29.7",
"@babel/plugin-transform-runtime": "^7.29.7",
"@babel/preset-env": "^7.29.7",
"@babel/preset-react": "^7.29.7",
"@babel/preset-typescript": "^7.29.7",
"@babel/register": "^7.29.7",
"@babel/runtime": "^7.29.7",
"@babel/runtime-corejs3": "^7.29.7",
"@babel/types": "^7.29.7",
"@babel/cli": "^8.0.1",
"@babel/compat-data": "^8.0.0",
"@babel/core": "^8.0.1",
"@babel/eslint-parser": "^8.0.1",
"@babel/node": "^8.0.1",
"@babel/plugin-transform-export-namespace-from": "^8.0.1",
"@babel/plugin-transform-runtime": "^8.0.1",
"@babel/preset-env": "^8.0.2",
"@babel/preset-react": "^8.0.1",
"@babel/preset-typescript": "^8.0.1",
"@babel/register": "^8.0.1",
"@babel/runtime": "^8.0.0",
"@babel/runtime-corejs3": "^8.0.0",
"@babel/types": "^8.0.0",
"@emotion/babel-plugin": "^11.13.5",
"@emotion/jest": "^11.14.2",
"@formatjs/intl-durationformat": "^0.10.15",
@@ -302,7 +301,7 @@
"babel-loader": "^10.1.1",
"babel-plugin-dynamic-import-node": "^2.3.3",
"babel-plugin-jsx-remove-data-test-id": "^3.0.0",
"babel-plugin-lodash": "^3.3.4",
"babel-plugin-polyfill-corejs3": "^1.0.0",
"baseline-browser-mapping": "^2.10.38",
"cheerio": "1.2.0",
"concurrently": "^10.0.3",
@@ -344,6 +343,7 @@
"mini-css-extract-plugin": "^2.10.2",
"open-cli": "^9.0.0",
"oxlint": "^1.70.0",
"patch-package": "^8.0.1",
"po2json": "^0.4.5",
"prettier": "3.8.4",
"prettier-plugin-packagejson": "^3.0.2",
@@ -427,6 +427,57 @@
},
"eslint-plugin-jest-dom": {
"eslint": "$eslint"
},
"babel-plugin-jsx-remove-data-test-id": {
"@babel/core": "$@babel/core"
},
"ts-jest": {
"@babel/core": "$@babel/core"
},
"@babel/plugin-syntax-async-generators": {
"@babel/core": "$@babel/core"
},
"@babel/plugin-syntax-bigint": {
"@babel/core": "$@babel/core"
},
"@babel/plugin-syntax-class-properties": {
"@babel/core": "$@babel/core"
},
"@babel/plugin-syntax-class-static-block": {
"@babel/core": "$@babel/core"
},
"@babel/plugin-syntax-import-attributes": {
"@babel/core": "$@babel/core"
},
"@babel/plugin-syntax-import-meta": {
"@babel/core": "$@babel/core"
},
"@babel/plugin-syntax-json-strings": {
"@babel/core": "$@babel/core"
},
"@babel/plugin-syntax-logical-assignment-operators": {
"@babel/core": "$@babel/core"
},
"@babel/plugin-syntax-nullish-coalescing-operator": {
"@babel/core": "$@babel/core"
},
"@babel/plugin-syntax-numeric-separator": {
"@babel/core": "$@babel/core"
},
"@babel/plugin-syntax-object-rest-spread": {
"@babel/core": "$@babel/core"
},
"@babel/plugin-syntax-optional-catch-binding": {
"@babel/core": "$@babel/core"
},
"@babel/plugin-syntax-optional-chaining": {
"@babel/core": "$@babel/core"
},
"@babel/plugin-syntax-private-property-in-object": {
"@babel/core": "$@babel/core"
},
"@babel/plugin-syntax-top-level-await": {
"@babel/core": "$@babel/core"
}
},
"readme": "ERROR: No README data found!",

View File

@@ -81,11 +81,11 @@
"author": "Apache Software Foundation",
"license": "Apache-2.0",
"devDependencies": {
"@babel/cli": "^7.29.7",
"@babel/core": "^7.29.7",
"@babel/preset-env": "^7.29.7",
"@babel/preset-react": "^7.29.7",
"@babel/preset-typescript": "^7.29.7",
"@babel/cli": "^8.0.1",
"@babel/core": "^8.0.1",
"@babel/preset-env": "^8.0.2",
"@babel/preset-react": "^8.0.1",
"@babel/preset-typescript": "^8.0.1",
"typescript": "^5.0.0",
"@emotion/styled": "^11.14.1",
"@types/lodash": "^4.17.24",

View File

@@ -26,7 +26,7 @@
"dependencies": {
"@ant-design/icons": "^6.2.5",
"@apache-superset/core": "*",
"@babel/runtime": "^7.29.7",
"@babel/runtime": "^8.0.0",
"@braintree/sanitize-url": "^7.1.2",
"@types/json-bigint": "^1.0.4",
"@visx/responsive": "^4.0.0",

View File

@@ -0,0 +1,26 @@
diff --git a/node_modules/@emotion/babel-plugin/dist/emotion-babel-plugin.cjs.js b/node_modules/@emotion/babel-plugin/dist/emotion-babel-plugin.cjs.js
index c97c6b4..3837543 100644
--- a/node_modules/@emotion/babel-plugin/dist/emotion-babel-plugin.cjs.js
+++ b/node_modules/@emotion/babel-plugin/dist/emotion-babel-plugin.cjs.js
@@ -1083,7 +1083,7 @@ annotateAsPure?: boolean
if (node) {
path.replaceWith(node);
- path.hoist();
+ if (typeof path.hoist === "function") path.hoist();
} else if (annotateAsPure && path.isCallExpression()) {
path.addComment('leading', '#__PURE__');
}
diff --git a/node_modules/@emotion/babel-plugin/dist/emotion-babel-plugin.esm.js b/node_modules/@emotion/babel-plugin/dist/emotion-babel-plugin.esm.js
index fbe8ce1..b6f43d8 100644
--- a/node_modules/@emotion/babel-plugin/dist/emotion-babel-plugin.esm.js
+++ b/node_modules/@emotion/babel-plugin/dist/emotion-babel-plugin.esm.js
@@ -1070,7 +1070,7 @@ annotateAsPure?: boolean
if (node) {
path.replaceWith(node);
- path.hoist();
+ if (typeof path.hoist === "function") path.hoist();
} else if (annotateAsPure && path.isCallExpression()) {
path.addComment('leading', '#__PURE__');
}

View File

@@ -37,7 +37,7 @@
"react-dom": "^18.3.0"
},
"devDependencies": {
"@babel/types": "^7.29.7",
"@babel/types": "^8.0.0",
"@types/jest": "^30.0.0",
"jest": "^30.4.2"
}