Skip to content

Commit 573dd0e

Browse files
authored
build(deps): remove legacy browser polyfills (#33853)
Signed-off-by: hainenber <[email protected]>
1 parent 784f86c commit 573dd0e

File tree

11 files changed

+36
-23
lines changed

11 files changed

+36
-23
lines changed

superset-frontend/jest.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ module.exports = {
3232
'<rootDir>/node_modules/@superset-ui/$1/src/$2',
3333
'^@superset-ui/([^/]+)$': '<rootDir>/node_modules/@superset-ui/$1/src',
3434
},
35-
testEnvironment: 'jsdom',
35+
testEnvironment: '<rootDir>/spec/helpers/jsDomWithFetchAPI.ts',
3636
modulePathIgnorePatterns: ['<rootDir>/packages/generator-superset'],
3737
setupFilesAfterEnv: ['<rootDir>/spec/helpers/setup.ts'],
3838
snapshotSerializers: ['@emotion/jest/serializer'],

superset-frontend/package-lock.json

Lines changed: 0 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

superset-frontend/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@
120120
"@visx/scale": "^3.5.0",
121121
"@visx/tooltip": "^3.0.0",
122122
"@visx/xychart": "^3.5.1",
123-
"abortcontroller-polyfill": "^1.7.8",
124123
"ag-grid-community": "33.1.1",
125124
"ag-grid-react": "33.1.1",
126125
"antd": "^5.24.6",

superset-frontend/packages/superset-ui-core/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@
6262
"rison": "^0.1.1",
6363
"seedrandom": "^3.0.5",
6464
"@visx/responsive": "^3.12.0",
65-
"whatwg-fetch": "^3.6.20",
6665
"xss": "^1.0.14"
6766
},
6867
"devDependencies": {

superset-frontend/packages/superset-ui-core/src/connection/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ Per-request aborting is implemented through the `AbortController` API:
9393

9494
```javascript
9595
import { SupersetClient } from '@superset-ui/core';
96-
import AbortController from 'abortcontroller-polyfill';
9796

9897
const controller = new AbortController();
9998
const { signal } = controller;

superset-frontend/packages/superset-ui-core/src/connection/callApi/callApi.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
* under the License.
1818
*/
1919

20-
import 'whatwg-fetch';
2120
import fetchRetry from 'fetch-retry';
2221
import { CallApi, Payload, JsonValue, JsonObject } from '../types';
2322
import {

superset-frontend/packages/superset-ui-core/test/query/api/v1/handleError.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
* specific language governing permissions and limitations
1717
* under the License.
1818
*/
19-
import 'whatwg-fetch'; // for adding Response polyfill
2019
import {
2120
JsonObject,
2221
SupersetApiError,
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/**
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
import JSDOMEnvironment from 'jest-environment-jsdom';
21+
22+
// https://github.com/facebook/jest/blob/v29.4.3/website/versioned_docs/version-29.4/Configuration.md#testenvironment-string
23+
export default class FixJSDOMEnvironment extends JSDOMEnvironment {
24+
constructor(...args: ConstructorParameters<typeof JSDOMEnvironment>) {
25+
super(...args);
26+
27+
// FIXME https://github.com/jsdom/jsdom/issues/1724
28+
this.global.fetch = fetch;
29+
this.global.Headers = Headers;
30+
this.global.Request = Request;
31+
this.global.Response = Response;
32+
this.global.AbortSignal = AbortSignal;
33+
this.global.AbortController = AbortController;
34+
}
35+
}

superset-frontend/spec/helpers/shim.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import { AriaAttributes } from 'react';
2020
import 'core-js/stable';
2121
import 'regenerator-runtime/runtime';
22-
import 'abortcontroller-polyfill/dist/abortcontroller-polyfill-only';
2322
import jQuery from 'jquery';
2423
// https://jestjs.io/docs/jest-object#jestmockmodulename-factory-options
2524
// in order to mock modules in test case, so avoid absolute import module

superset-frontend/src/preamble.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
* under the License.
1818
*/
1919
import { setConfig as setHotLoaderConfig } from 'react-hot-loader';
20-
import 'abortcontroller-polyfill/dist/abortcontroller-polyfill-only';
2120
import dayjs from 'dayjs';
2221
// eslint-disable-next-line no-restricted-imports
2322
import { configure, makeApi, initFeatureFlags } from '@superset-ui/core';

superset-frontend/webpack.config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,6 @@ const config = {
258258
name: 'vendors',
259259
test: new RegExp(
260260
`/node_modules/(${[
261-
'abortcontroller-polyfill',
262261
'react',
263262
'react-dom',
264263
'prop-types',

0 commit comments

Comments
 (0)