remove “abortcontroller-polyfill” (#119308)

This commit is contained in:
Anton Dosov 2021-11-25 10:15:52 +01:00 committed by GitHub
parent ba9dfeafa0
commit d2d5432c05
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 1 additions and 28 deletions

View file

@ -189,7 +189,6 @@
"@types/jsonwebtoken": "^8.5.6",
"JSONStream": "1.3.5",
"abort-controller": "^3.0.0",
"abortcontroller-polyfill": "^1.7.3",
"antlr4ts": "^0.5.0-alpha.3",
"archiver": "^5.2.0",
"axios": "^0.21.1",

View file

@ -34,7 +34,6 @@ RUNTIME_DEPS = [
"@npm//@elastic/eui",
"@npm//@elastic/numeral",
"@npm//@emotion/react",
"@npm//abortcontroller-polyfill",
"@npm//babel-loader",
"@npm//babel-plugin-transform-react-remove-prop-types",
"@npm//core-js",
@ -74,7 +73,6 @@ TYPES_DEPS = [
"@npm//@elastic/eui",
"@npm//@elastic/numeral",
"@npm//@emotion/react",
"@npm//abortcontroller-polyfill",
"@npm//babel-loader",
"@npm//core-js",
"@npm//css-loader",

View file

@ -7,8 +7,6 @@
*/
import { Observable } from 'rxjs';
// @ts-ignore not typed
import { AbortController } from 'abortcontroller-polyfill/dist/cjs-ponyfill';
/**
* A simple utility function that returns an `AbortSignal` corresponding to an `AbortController`

View file

@ -64,23 +64,6 @@ export interface ExecutionResult<Output> {
result: Output;
}
/**
* AbortController is not available in Node until v15, so we
* need to temporarily mock it for plugins using expressions
* on the server.
*
* TODO: Remove this once Kibana is upgraded to Node 15.
*/
const getNewAbortController = (): AbortController => {
try {
return new AbortController();
} catch (error) {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const polyfill = require('abortcontroller-polyfill/dist/cjs-ponyfill');
return new polyfill.AbortController();
}
};
const createAbortErrorValue = () =>
createError({
message: 'The expression was aborted.',
@ -173,7 +156,7 @@ export class Execution<
/**
* AbortController to cancel this Execution.
*/
private readonly abortController = getNewAbortController();
private readonly abortController = new AbortController();
/**
* Whether .start() method has been called.

View file

@ -7062,11 +7062,6 @@ abort-controller@^3.0.0:
dependencies:
event-target-shim "^5.0.0"
abortcontroller-polyfill@^1.7.3:
version "1.7.3"
resolved "https://registry.yarnpkg.com/abortcontroller-polyfill/-/abortcontroller-polyfill-1.7.3.tgz#1b5b487bd6436b5b764fd52a612509702c3144b5"
integrity sha512-zetDJxd89y3X99Kvo4qFx8GKlt6GsvN3UcRZHwU6iFA/0KiOmhkTVhe8oRoTBiTVPZu09x3vCra47+w8Yz1+2Q==
accepts@~1.3.4, accepts@~1.3.5, accepts@~1.3.7:
version "1.3.7"
resolved "https://registry.yarnpkg.com/accepts/-/accepts-1.3.7.tgz#531bc726517a3b2b41f850021c6cc15eaab507cd"