diff --git a/packages/core-js-pure/override/internals/collection.js b/packages/core-js-pure/override/internals/collection.js index 9422c9c27227..4f4a25974888 100644 --- a/packages/core-js-pure/override/internals/collection.js +++ b/packages/core-js-pure/override/internals/collection.js @@ -1,6 +1,6 @@ 'use strict'; var $ = require('../internals/export'); -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); var InternalMetadataModule = require('../internals/internal-metadata'); var fails = require('../internals/fails'); var createNonEnumerableProperty = require('../internals/create-non-enumerable-property'); @@ -22,7 +22,7 @@ module.exports = function (CONSTRUCTOR_NAME, wrapper, common) { var IS_MAP = CONSTRUCTOR_NAME.indexOf('Map') !== -1; var IS_WEAK = CONSTRUCTOR_NAME.indexOf('Weak') !== -1; var ADDER = IS_MAP ? 'set' : 'add'; - var NativeConstructor = global[CONSTRUCTOR_NAME]; + var NativeConstructor = globalThis[CONSTRUCTOR_NAME]; var NativePrototype = NativeConstructor && NativeConstructor.prototype; var exported = {}; var Constructor; diff --git a/packages/core-js-pure/override/internals/export.js b/packages/core-js-pure/override/internals/export.js index 6135786dece6..48cb7fdde97a 100644 --- a/packages/core-js-pure/override/internals/export.js +++ b/packages/core-js-pure/override/internals/export.js @@ -1,5 +1,5 @@ 'use strict'; -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); var apply = require('../internals/function-apply'); var uncurryThis = require('../internals/function-uncurry-this-clause'); var isCallable = require('../internals/is-callable'); @@ -47,7 +47,7 @@ module.exports = function (options, source) { var STATIC = options.stat; var PROTO = options.proto; - var nativeSource = GLOBAL ? global : STATIC ? global[TARGET] : global[TARGET] && global[TARGET].prototype; + var nativeSource = GLOBAL ? globalThis : STATIC ? globalThis[TARGET] : globalThis[TARGET] && globalThis[TARGET].prototype; var target = GLOBAL ? path : path[TARGET] || createNonEnumerableProperty(path, TARGET, {})[TARGET]; var targetPrototype = target.prototype; @@ -73,7 +73,7 @@ module.exports = function (options, source) { if (!FORCED && !PROTO && typeof targetProperty == typeof sourceProperty) continue; // bind methods to global for calling from export context - if (options.bind && USE_NATIVE) resultProperty = bind(sourceProperty, global); + if (options.bind && USE_NATIVE) resultProperty = bind(sourceProperty, globalThis); // wrap global constructors for prevent changes in this version else if (options.wrap && USE_NATIVE) resultProperty = wrapConstructor(sourceProperty); // make static versions for prototype methods diff --git a/packages/core-js-pure/override/internals/get-built-in-prototype-method.js b/packages/core-js-pure/override/internals/get-built-in-prototype-method.js index f08de2012684..9d6c65555c5d 100644 --- a/packages/core-js-pure/override/internals/get-built-in-prototype-method.js +++ b/packages/core-js-pure/override/internals/get-built-in-prototype-method.js @@ -1,12 +1,12 @@ 'use strict'; -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); var path = require('../internals/path'); module.exports = function (CONSTRUCTOR, METHOD) { var Namespace = path[CONSTRUCTOR + 'Prototype']; var pureMethod = Namespace && Namespace[METHOD]; if (pureMethod) return pureMethod; - var NativeConstructor = global[CONSTRUCTOR]; + var NativeConstructor = globalThis[CONSTRUCTOR]; var NativePrototype = NativeConstructor && NativeConstructor.prototype; return NativePrototype && NativePrototype[METHOD]; }; diff --git a/packages/core-js-pure/override/internals/get-built-in.js b/packages/core-js-pure/override/internals/get-built-in.js index f861be92f0f5..868f5e7cd52a 100644 --- a/packages/core-js-pure/override/internals/get-built-in.js +++ b/packages/core-js-pure/override/internals/get-built-in.js @@ -1,6 +1,6 @@ 'use strict'; var path = require('../internals/path'); -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); var isCallable = require('../internals/is-callable'); var aFunction = function (variable) { @@ -8,6 +8,6 @@ var aFunction = function (variable) { }; module.exports = function (namespace, method) { - return arguments.length < 2 ? aFunction(path[namespace]) || aFunction(global[namespace]) - : path[namespace] && path[namespace][method] || global[namespace] && global[namespace][method]; + return arguments.length < 2 ? aFunction(path[namespace]) || aFunction(globalThis[namespace]) + : path[namespace] && path[namespace][method] || globalThis[namespace] && globalThis[namespace][method]; }; diff --git a/packages/core-js-pure/override/modules/web.dom-collections.iterator.js b/packages/core-js-pure/override/modules/web.dom-collections.iterator.js index 5a46ba3e2388..de53c60da2c2 100644 --- a/packages/core-js-pure/override/modules/web.dom-collections.iterator.js +++ b/packages/core-js-pure/override/modules/web.dom-collections.iterator.js @@ -1,11 +1,11 @@ 'use strict'; require('../modules/es.array.iterator'); var DOMIterables = require('../internals/dom-iterables'); -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); var setToStringTag = require('../internals/set-to-string-tag'); var Iterators = require('../internals/iterators'); for (var COLLECTION_NAME in DOMIterables) { - setToStringTag(global[COLLECTION_NAME], COLLECTION_NAME); + setToStringTag(globalThis[COLLECTION_NAME], COLLECTION_NAME); Iterators[COLLECTION_NAME] = Iterators.Array; } diff --git a/packages/core-js-pure/override/modules/web.self.js b/packages/core-js-pure/override/modules/web.self.js index 8686fc40518f..3a7c9e943850 100644 --- a/packages/core-js-pure/override/modules/web.self.js +++ b/packages/core-js-pure/override/modules/web.self.js @@ -1,9 +1,9 @@ 'use strict'; var $ = require('../internals/export'); -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); // `self` getter // https://html.spec.whatwg.org/multipage/window-object.html#dom-self -$({ global: true, forced: global.self !== global }, { - self: global +$({ global: true, forced: globalThis.self !== globalThis }, { + self: globalThis }); diff --git a/packages/core-js/es/global-this.js b/packages/core-js/es/global-this.js index 8dd89b70fba5..4b10fec4379b 100644 --- a/packages/core-js/es/global-this.js +++ b/packages/core-js/es/global-this.js @@ -1,4 +1,4 @@ 'use strict'; require('../modules/es.global-this'); -module.exports = require('../internals/global'); +module.exports = require('../internals/global-this'); diff --git a/packages/core-js/es/typed-array/float32-array.js b/packages/core-js/es/typed-array/float32-array.js index 6ea2df17551d..9f3e4bb2c53a 100644 --- a/packages/core-js/es/typed-array/float32-array.js +++ b/packages/core-js/es/typed-array/float32-array.js @@ -3,6 +3,6 @@ require('../../modules/es.array-buffer.constructor'); require('../../modules/es.array-buffer.slice'); require('../../modules/es.typed-array.float32-array'); require('./methods'); -var global = require('../../internals/global'); +var global = require('../../internals/global-this'); module.exports = global.Float32Array; diff --git a/packages/core-js/es/typed-array/float64-array.js b/packages/core-js/es/typed-array/float64-array.js index fa5d039655df..5506d7b2c9e2 100644 --- a/packages/core-js/es/typed-array/float64-array.js +++ b/packages/core-js/es/typed-array/float64-array.js @@ -3,6 +3,6 @@ require('../../modules/es.array-buffer.constructor'); require('../../modules/es.array-buffer.slice'); require('../../modules/es.typed-array.float64-array'); require('./methods'); -var global = require('../../internals/global'); +var global = require('../../internals/global-this'); module.exports = global.Float64Array; diff --git a/packages/core-js/es/typed-array/index.js b/packages/core-js/es/typed-array/index.js index 4db1597cc015..9e20b36bb1ea 100644 --- a/packages/core-js/es/typed-array/index.js +++ b/packages/core-js/es/typed-array/index.js @@ -10,4 +10,4 @@ require('../../modules/es.typed-array.float32-array'); require('../../modules/es.typed-array.float64-array'); require('./methods'); -module.exports = require('../../internals/global'); +module.exports = require('../../internals/global-this'); diff --git a/packages/core-js/es/typed-array/int16-array.js b/packages/core-js/es/typed-array/int16-array.js index d75ba118506e..5ba8637b91ad 100644 --- a/packages/core-js/es/typed-array/int16-array.js +++ b/packages/core-js/es/typed-array/int16-array.js @@ -3,6 +3,6 @@ require('../../modules/es.array-buffer.constructor'); require('../../modules/es.array-buffer.slice'); require('../../modules/es.typed-array.int16-array'); require('./methods'); -var global = require('../../internals/global'); +var global = require('../../internals/global-this'); module.exports = global.Int16Array; diff --git a/packages/core-js/es/typed-array/int32-array.js b/packages/core-js/es/typed-array/int32-array.js index 61436471f5ec..24bf16935e9c 100644 --- a/packages/core-js/es/typed-array/int32-array.js +++ b/packages/core-js/es/typed-array/int32-array.js @@ -3,6 +3,6 @@ require('../../modules/es.array-buffer.constructor'); require('../../modules/es.array-buffer.slice'); require('../../modules/es.typed-array.int32-array'); require('./methods'); -var global = require('../../internals/global'); +var global = require('../../internals/global-this'); module.exports = global.Int32Array; diff --git a/packages/core-js/es/typed-array/int8-array.js b/packages/core-js/es/typed-array/int8-array.js index 29cd3bb5c0f2..3796320fad03 100644 --- a/packages/core-js/es/typed-array/int8-array.js +++ b/packages/core-js/es/typed-array/int8-array.js @@ -3,6 +3,6 @@ require('../../modules/es.array-buffer.constructor'); require('../../modules/es.array-buffer.slice'); require('../../modules/es.typed-array.int8-array'); require('./methods'); -var global = require('../../internals/global'); +var global = require('../../internals/global-this'); module.exports = global.Int8Array; diff --git a/packages/core-js/es/typed-array/uint16-array.js b/packages/core-js/es/typed-array/uint16-array.js index 0300add83274..08ebcadd96bd 100644 --- a/packages/core-js/es/typed-array/uint16-array.js +++ b/packages/core-js/es/typed-array/uint16-array.js @@ -3,6 +3,6 @@ require('../../modules/es.array-buffer.constructor'); require('../../modules/es.array-buffer.slice'); require('../../modules/es.typed-array.uint16-array'); require('./methods'); -var global = require('../../internals/global'); +var global = require('../../internals/global-this'); module.exports = global.Uint16Array; diff --git a/packages/core-js/es/typed-array/uint32-array.js b/packages/core-js/es/typed-array/uint32-array.js index 28fe8f0abf54..04cd382b8d55 100644 --- a/packages/core-js/es/typed-array/uint32-array.js +++ b/packages/core-js/es/typed-array/uint32-array.js @@ -3,6 +3,6 @@ require('../../modules/es.array-buffer.constructor'); require('../../modules/es.array-buffer.slice'); require('../../modules/es.typed-array.uint32-array'); require('./methods'); -var global = require('../../internals/global'); +var global = require('../../internals/global-this'); module.exports = global.Uint32Array; diff --git a/packages/core-js/es/typed-array/uint8-array.js b/packages/core-js/es/typed-array/uint8-array.js index 968c57aba287..531c1f3e9d7d 100644 --- a/packages/core-js/es/typed-array/uint8-array.js +++ b/packages/core-js/es/typed-array/uint8-array.js @@ -3,6 +3,6 @@ require('../../modules/es.array-buffer.constructor'); require('../../modules/es.array-buffer.slice'); require('../../modules/es.typed-array.uint8-array'); require('./methods'); -var global = require('../../internals/global'); +var global = require('../../internals/global-this'); module.exports = global.Uint8Array; diff --git a/packages/core-js/es/typed-array/uint8-clamped-array.js b/packages/core-js/es/typed-array/uint8-clamped-array.js index 1ce93fd32289..2081308bde75 100644 --- a/packages/core-js/es/typed-array/uint8-clamped-array.js +++ b/packages/core-js/es/typed-array/uint8-clamped-array.js @@ -3,6 +3,6 @@ require('../../modules/es.array-buffer.constructor'); require('../../modules/es.array-buffer.slice'); require('../../modules/es.typed-array.uint8-clamped-array'); require('./methods'); -var global = require('../../internals/global'); +var global = require('../../internals/global-this'); module.exports = global.Uint8ClampedArray; diff --git a/packages/core-js/internals/array-buffer-byte-length.js b/packages/core-js/internals/array-buffer-byte-length.js index 8954c4f30583..56ffa876ca2f 100644 --- a/packages/core-js/internals/array-buffer-byte-length.js +++ b/packages/core-js/internals/array-buffer-byte-length.js @@ -1,5 +1,5 @@ 'use strict'; -var globalThis = require('../internals/global'); +var globalThis = require('../internals/global-this'); var uncurryThisAccessor = require('../internals/function-uncurry-this-accessor'); var classof = require('../internals/classof-raw'); diff --git a/packages/core-js/internals/array-buffer-is-detached.js b/packages/core-js/internals/array-buffer-is-detached.js index 909dfc7ff45d..62836449e1f9 100644 --- a/packages/core-js/internals/array-buffer-is-detached.js +++ b/packages/core-js/internals/array-buffer-is-detached.js @@ -1,5 +1,5 @@ 'use strict'; -var globalThis = require('../internals/global'); +var globalThis = require('../internals/global-this'); var uncurryThis = require('../internals/function-uncurry-this-clause'); var arrayBufferByteLength = require('../internals/array-buffer-byte-length'); diff --git a/packages/core-js/internals/array-buffer-transfer.js b/packages/core-js/internals/array-buffer-transfer.js index fef204966b59..26ae9d07e699 100644 --- a/packages/core-js/internals/array-buffer-transfer.js +++ b/packages/core-js/internals/array-buffer-transfer.js @@ -1,5 +1,5 @@ 'use strict'; -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); var uncurryThis = require('../internals/function-uncurry-this'); var uncurryThisAccessor = require('../internals/function-uncurry-this-accessor'); var toIndex = require('../internals/to-index'); @@ -8,9 +8,9 @@ var arrayBufferByteLength = require('../internals/array-buffer-byte-length'); var detachTransferable = require('../internals/detach-transferable'); var PROPER_STRUCTURED_CLONE_TRANSFER = require('../internals/structured-clone-proper-transfer'); -var structuredClone = global.structuredClone; -var ArrayBuffer = global.ArrayBuffer; -var DataView = global.DataView; +var structuredClone = globalThis.structuredClone; +var ArrayBuffer = globalThis.ArrayBuffer; +var DataView = globalThis.DataView; var min = Math.min; var ArrayBufferPrototype = ArrayBuffer.prototype; var DataViewPrototype = DataView.prototype; diff --git a/packages/core-js/internals/array-buffer-view-core.js b/packages/core-js/internals/array-buffer-view-core.js index 4cf1d0db9d46..14d2d1c0e798 100644 --- a/packages/core-js/internals/array-buffer-view-core.js +++ b/packages/core-js/internals/array-buffer-view-core.js @@ -1,7 +1,7 @@ 'use strict'; var NATIVE_ARRAY_BUFFER = require('../internals/array-buffer-basic-detection'); var DESCRIPTORS = require('../internals/descriptors'); -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); var isCallable = require('../internals/is-callable'); var isObject = require('../internals/is-object'); var hasOwn = require('../internals/has-own-property'); @@ -19,20 +19,20 @@ var InternalStateModule = require('../internals/internal-state'); var enforceInternalState = InternalStateModule.enforce; var getInternalState = InternalStateModule.get; -var Int8Array = global.Int8Array; +var Int8Array = globalThis.Int8Array; var Int8ArrayPrototype = Int8Array && Int8Array.prototype; -var Uint8ClampedArray = global.Uint8ClampedArray; +var Uint8ClampedArray = globalThis.Uint8ClampedArray; var Uint8ClampedArrayPrototype = Uint8ClampedArray && Uint8ClampedArray.prototype; var TypedArray = Int8Array && getPrototypeOf(Int8Array); var TypedArrayPrototype = Int8ArrayPrototype && getPrototypeOf(Int8ArrayPrototype); var ObjectPrototype = Object.prototype; -var TypeError = global.TypeError; +var TypeError = globalThis.TypeError; var TO_STRING_TAG = wellKnownSymbol('toStringTag'); var TYPED_ARRAY_TAG = uid('TYPED_ARRAY_TAG'); var TYPED_ARRAY_CONSTRUCTOR = 'TypedArrayConstructor'; // Fixing native typed arrays in Opera Presto crashes the browser, see #595 -var NATIVE_ARRAY_BUFFER_VIEWS = NATIVE_ARRAY_BUFFER && !!setPrototypeOf && classof(global.opera) !== 'Opera'; +var NATIVE_ARRAY_BUFFER_VIEWS = NATIVE_ARRAY_BUFFER && !!setPrototypeOf && classof(globalThis.opera) !== 'Opera'; var TYPED_ARRAY_TAG_REQUIRED = false; var NAME, Constructor, Prototype; @@ -88,7 +88,7 @@ var aTypedArrayConstructor = function (C) { var exportTypedArrayMethod = function (KEY, property, forced, options) { if (!DESCRIPTORS) return; if (forced) for (var ARRAY in TypedArrayConstructorsList) { - var TypedArrayConstructor = global[ARRAY]; + var TypedArrayConstructor = globalThis[ARRAY]; if (TypedArrayConstructor && hasOwn(TypedArrayConstructor.prototype, KEY)) try { delete TypedArrayConstructor.prototype[KEY]; } catch (error) { @@ -109,7 +109,7 @@ var exportTypedArrayStaticMethod = function (KEY, property, forced) { if (!DESCRIPTORS) return; if (setPrototypeOf) { if (forced) for (ARRAY in TypedArrayConstructorsList) { - TypedArrayConstructor = global[ARRAY]; + TypedArrayConstructor = globalThis[ARRAY]; if (TypedArrayConstructor && hasOwn(TypedArrayConstructor, KEY)) try { delete TypedArrayConstructor[KEY]; } catch (error) { /* empty */ } @@ -122,7 +122,7 @@ var exportTypedArrayStaticMethod = function (KEY, property, forced) { } else return; } for (ARRAY in TypedArrayConstructorsList) { - TypedArrayConstructor = global[ARRAY]; + TypedArrayConstructor = globalThis[ARRAY]; if (TypedArrayConstructor && (!TypedArrayConstructor[KEY] || forced)) { defineBuiltIn(TypedArrayConstructor, KEY, property); } @@ -130,14 +130,14 @@ var exportTypedArrayStaticMethod = function (KEY, property, forced) { }; for (NAME in TypedArrayConstructorsList) { - Constructor = global[NAME]; + Constructor = globalThis[NAME]; Prototype = Constructor && Constructor.prototype; if (Prototype) enforceInternalState(Prototype)[TYPED_ARRAY_CONSTRUCTOR] = Constructor; else NATIVE_ARRAY_BUFFER_VIEWS = false; } for (NAME in BigIntArrayConstructorsList) { - Constructor = global[NAME]; + Constructor = globalThis[NAME]; Prototype = Constructor && Constructor.prototype; if (Prototype) enforceInternalState(Prototype)[TYPED_ARRAY_CONSTRUCTOR] = Constructor; } @@ -149,14 +149,14 @@ if (!NATIVE_ARRAY_BUFFER_VIEWS || !isCallable(TypedArray) || TypedArray === Func throw new TypeError('Incorrect invocation'); }; if (NATIVE_ARRAY_BUFFER_VIEWS) for (NAME in TypedArrayConstructorsList) { - if (global[NAME]) setPrototypeOf(global[NAME], TypedArray); + if (globalThis[NAME]) setPrototypeOf(globalThis[NAME], TypedArray); } } if (!NATIVE_ARRAY_BUFFER_VIEWS || !TypedArrayPrototype || TypedArrayPrototype === ObjectPrototype) { TypedArrayPrototype = TypedArray.prototype; if (NATIVE_ARRAY_BUFFER_VIEWS) for (NAME in TypedArrayConstructorsList) { - if (global[NAME]) setPrototypeOf(global[NAME].prototype, TypedArrayPrototype); + if (globalThis[NAME]) setPrototypeOf(globalThis[NAME].prototype, TypedArrayPrototype); } } @@ -173,8 +173,8 @@ if (DESCRIPTORS && !hasOwn(TypedArrayPrototype, TO_STRING_TAG)) { return isObject(this) ? this[TYPED_ARRAY_TAG] : undefined; } }); - for (NAME in TypedArrayConstructorsList) if (global[NAME]) { - createNonEnumerableProperty(global[NAME], TYPED_ARRAY_TAG, NAME); + for (NAME in TypedArrayConstructorsList) if (globalThis[NAME]) { + createNonEnumerableProperty(globalThis[NAME], TYPED_ARRAY_TAG, NAME); } } diff --git a/packages/core-js/internals/array-buffer.js b/packages/core-js/internals/array-buffer.js index fa13f8107971..ba8b5c375fe2 100644 --- a/packages/core-js/internals/array-buffer.js +++ b/packages/core-js/internals/array-buffer.js @@ -1,5 +1,5 @@ 'use strict'; -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); var uncurryThis = require('../internals/function-uncurry-this'); var DESCRIPTORS = require('../internals/descriptors'); var NATIVE_ARRAY_BUFFER = require('../internals/array-buffer-basic-detection'); @@ -33,14 +33,14 @@ var WRONG_INDEX = 'Wrong index'; var getInternalArrayBufferState = InternalStateModule.getterFor(ARRAY_BUFFER); var getInternalDataViewState = InternalStateModule.getterFor(DATA_VIEW); var setInternalState = InternalStateModule.set; -var NativeArrayBuffer = global[ARRAY_BUFFER]; +var NativeArrayBuffer = globalThis[ARRAY_BUFFER]; var $ArrayBuffer = NativeArrayBuffer; var ArrayBufferPrototype = $ArrayBuffer && $ArrayBuffer[PROTOTYPE]; -var $DataView = global[DATA_VIEW]; +var $DataView = globalThis[DATA_VIEW]; var DataViewPrototype = $DataView && $DataView[PROTOTYPE]; var ObjectPrototype = Object.prototype; -var Array = global.Array; -var RangeError = global.RangeError; +var Array = globalThis.Array; +var RangeError = globalThis.RangeError; var fill = uncurryThis(arrayFill); var reverse = uncurryThis([].reverse); diff --git a/packages/core-js/internals/async-iterator-prototype.js b/packages/core-js/internals/async-iterator-prototype.js index d95a1acf5ebe..1fed1354a9b7 100644 --- a/packages/core-js/internals/async-iterator-prototype.js +++ b/packages/core-js/internals/async-iterator-prototype.js @@ -1,5 +1,5 @@ 'use strict'; -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); var shared = require('../internals/shared-store'); var isCallable = require('../internals/is-callable'); var create = require('../internals/object-create'); @@ -10,7 +10,7 @@ var IS_PURE = require('../internals/is-pure'); var USE_FUNCTION_CONSTRUCTOR = 'USE_FUNCTION_CONSTRUCTOR'; var ASYNC_ITERATOR = wellKnownSymbol('asyncIterator'); -var AsyncIterator = global.AsyncIterator; +var AsyncIterator = globalThis.AsyncIterator; var PassedAsyncIteratorPrototype = shared.AsyncIteratorPrototype; var AsyncIteratorPrototype, prototype; @@ -18,7 +18,7 @@ if (PassedAsyncIteratorPrototype) { AsyncIteratorPrototype = PassedAsyncIteratorPrototype; } else if (isCallable(AsyncIterator)) { AsyncIteratorPrototype = AsyncIterator.prototype; -} else if (shared[USE_FUNCTION_CONSTRUCTOR] || global[USE_FUNCTION_CONSTRUCTOR]) { +} else if (shared[USE_FUNCTION_CONSTRUCTOR] || globalThis[USE_FUNCTION_CONSTRUCTOR]) { try { // eslint-disable-next-line no-new-func -- we have no alternatives without usage of modern syntax prototype = getPrototypeOf(getPrototypeOf(getPrototypeOf(Function('return async function*(){}()')()))); diff --git a/packages/core-js/internals/collection.js b/packages/core-js/internals/collection.js index 6566580d08a5..4961bd76c5dd 100644 --- a/packages/core-js/internals/collection.js +++ b/packages/core-js/internals/collection.js @@ -1,6 +1,6 @@ 'use strict'; var $ = require('../internals/export'); -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); var uncurryThis = require('../internals/function-uncurry-this'); var isForced = require('../internals/is-forced'); var defineBuiltIn = require('../internals/define-built-in'); @@ -19,7 +19,7 @@ module.exports = function (CONSTRUCTOR_NAME, wrapper, common) { var IS_MAP = CONSTRUCTOR_NAME.indexOf('Map') !== -1; var IS_WEAK = CONSTRUCTOR_NAME.indexOf('Weak') !== -1; var ADDER = IS_MAP ? 'set' : 'add'; - var NativeConstructor = global[CONSTRUCTOR_NAME]; + var NativeConstructor = globalThis[CONSTRUCTOR_NAME]; var NativePrototype = NativeConstructor && NativeConstructor.prototype; var Constructor = NativeConstructor; var exported = {}; diff --git a/packages/core-js/internals/define-global-property.js b/packages/core-js/internals/define-global-property.js index 8178ecc10d89..96fd4a2e135c 100644 --- a/packages/core-js/internals/define-global-property.js +++ b/packages/core-js/internals/define-global-property.js @@ -1,13 +1,13 @@ 'use strict'; -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); // eslint-disable-next-line es/no-object-defineproperty -- safe var defineProperty = Object.defineProperty; module.exports = function (key, value) { try { - defineProperty(global, key, { value: value, configurable: true, writable: true }); + defineProperty(globalThis, key, { value: value, configurable: true, writable: true }); } catch (error) { - global[key] = value; + globalThis[key] = value; } return value; }; diff --git a/packages/core-js/internals/detach-transferable.js b/packages/core-js/internals/detach-transferable.js index 7ba7c95b6ef0..8fa55c53eed5 100644 --- a/packages/core-js/internals/detach-transferable.js +++ b/packages/core-js/internals/detach-transferable.js @@ -1,11 +1,11 @@ 'use strict'; -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); var getBuiltInNodeModule = require('../internals/get-built-in-node-module'); var PROPER_STRUCTURED_CLONE_TRANSFER = require('../internals/structured-clone-proper-transfer'); -var structuredClone = global.structuredClone; -var $ArrayBuffer = global.ArrayBuffer; -var $MessageChannel = global.MessageChannel; +var structuredClone = globalThis.structuredClone; +var $ArrayBuffer = globalThis.ArrayBuffer; +var $MessageChannel = globalThis.MessageChannel; var detach = false; var WorkerThreads, channel, buffer, $detach; diff --git a/packages/core-js/internals/document-create-element.js b/packages/core-js/internals/document-create-element.js index dbbe49f97be9..dd572fbeeca9 100644 --- a/packages/core-js/internals/document-create-element.js +++ b/packages/core-js/internals/document-create-element.js @@ -1,8 +1,8 @@ 'use strict'; -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); var isObject = require('../internals/is-object'); -var document = global.document; +var document = globalThis.document; // typeof document.createElement is 'object' in old IE var EXISTS = isObject(document) && isObject(document.createElement); diff --git a/packages/core-js/internals/entry-unbind.js b/packages/core-js/internals/entry-unbind.js index 082fbe1ac501..3ec17cd5c53e 100644 --- a/packages/core-js/internals/entry-unbind.js +++ b/packages/core-js/internals/entry-unbind.js @@ -1,7 +1,7 @@ 'use strict'; -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); var uncurryThis = require('../internals/function-uncurry-this'); module.exports = function (CONSTRUCTOR, METHOD) { - return uncurryThis(global[CONSTRUCTOR].prototype[METHOD]); + return uncurryThis(globalThis[CONSTRUCTOR].prototype[METHOD]); }; diff --git a/packages/core-js/internals/entry-virtual.js b/packages/core-js/internals/entry-virtual.js index 5a0be6852ec9..948d83f1817b 100644 --- a/packages/core-js/internals/entry-virtual.js +++ b/packages/core-js/internals/entry-virtual.js @@ -1,6 +1,6 @@ 'use strict'; -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); module.exports = function (CONSTRUCTOR) { - return global[CONSTRUCTOR].prototype; + return globalThis[CONSTRUCTOR].prototype; }; diff --git a/packages/core-js/internals/environment-user-agent.js b/packages/core-js/internals/environment-user-agent.js index 6ebd2a5993d2..31b1067f2241 100644 --- a/packages/core-js/internals/environment-user-agent.js +++ b/packages/core-js/internals/environment-user-agent.js @@ -1,5 +1,5 @@ 'use strict'; -var globalThis = require('../internals/global'); +var globalThis = require('../internals/global-this'); var navigator = globalThis.navigator; var userAgent = navigator && navigator.userAgent; diff --git a/packages/core-js/internals/environment-v8-version.js b/packages/core-js/internals/environment-v8-version.js index 7327cfd1a428..6b083aab36e9 100644 --- a/packages/core-js/internals/environment-v8-version.js +++ b/packages/core-js/internals/environment-v8-version.js @@ -1,9 +1,9 @@ 'use strict'; -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); var userAgent = require('../internals/environment-user-agent'); -var process = global.process; -var Deno = global.Deno; +var process = globalThis.process; +var Deno = globalThis.Deno; var versions = process && process.versions || Deno && Deno.version; var v8 = versions && versions.v8; var match, version; diff --git a/packages/core-js/internals/environment.js b/packages/core-js/internals/environment.js index 7019529703bd..1c6fdd8b7e8a 100644 --- a/packages/core-js/internals/environment.js +++ b/packages/core-js/internals/environment.js @@ -1,6 +1,6 @@ 'use strict'; /* global Bun, Deno -- detection */ -var globalThis = require('../internals/global'); +var globalThis = require('../internals/global-this'); var userAgent = require('../internals/environment-user-agent'); var classof = require('../internals/classof-raw'); diff --git a/packages/core-js/internals/export.js b/packages/core-js/internals/export.js index 669f5ad0e69c..b175366fa823 100644 --- a/packages/core-js/internals/export.js +++ b/packages/core-js/internals/export.js @@ -1,5 +1,5 @@ 'use strict'; -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); var getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f; var createNonEnumerableProperty = require('../internals/create-non-enumerable-property'); var defineBuiltIn = require('../internals/define-built-in'); @@ -28,11 +28,11 @@ module.exports = function (options, source) { var STATIC = options.stat; var FORCED, target, key, targetProperty, sourceProperty, descriptor; if (GLOBAL) { - target = global; + target = globalThis; } else if (STATIC) { - target = global[TARGET] || defineGlobalProperty(TARGET, {}); + target = globalThis[TARGET] || defineGlobalProperty(TARGET, {}); } else { - target = global[TARGET] && global[TARGET].prototype; + target = globalThis[TARGET] && globalThis[TARGET].prototype; } if (target) for (key in source) { sourceProperty = source[key]; diff --git a/packages/core-js/internals/get-built-in-node-module.js b/packages/core-js/internals/get-built-in-node-module.js index eba0ea25a3bf..93ba567bccea 100644 --- a/packages/core-js/internals/get-built-in-node-module.js +++ b/packages/core-js/internals/get-built-in-node-module.js @@ -1,5 +1,5 @@ 'use strict'; -var globalThis = require('../internals/global'); +var globalThis = require('../internals/global-this'); var IS_NODE = require('../internals/environment-is-node'); module.exports = function (name) { diff --git a/packages/core-js/internals/get-built-in-prototype-method.js b/packages/core-js/internals/get-built-in-prototype-method.js index 1230be552ee6..ad0540437059 100644 --- a/packages/core-js/internals/get-built-in-prototype-method.js +++ b/packages/core-js/internals/get-built-in-prototype-method.js @@ -1,8 +1,8 @@ 'use strict'; -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); module.exports = function (CONSTRUCTOR, METHOD) { - var Constructor = global[CONSTRUCTOR]; + var Constructor = globalThis[CONSTRUCTOR]; var Prototype = Constructor && Constructor.prototype; return Prototype && Prototype[METHOD]; }; diff --git a/packages/core-js/internals/get-built-in.js b/packages/core-js/internals/get-built-in.js index f6a98b750364..b685be59fd34 100644 --- a/packages/core-js/internals/get-built-in.js +++ b/packages/core-js/internals/get-built-in.js @@ -1,5 +1,5 @@ 'use strict'; -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); var isCallable = require('../internals/is-callable'); var aFunction = function (argument) { @@ -7,5 +7,5 @@ var aFunction = function (argument) { }; module.exports = function (namespace, method) { - return arguments.length < 2 ? aFunction(global[namespace]) : global[namespace] && global[namespace][method]; + return arguments.length < 2 ? aFunction(globalThis[namespace]) : globalThis[namespace] && globalThis[namespace][method]; }; diff --git a/packages/core-js/internals/global.js b/packages/core-js/internals/global-this.js similarity index 100% rename from packages/core-js/internals/global.js rename to packages/core-js/internals/global-this.js diff --git a/packages/core-js/internals/internal-state.js b/packages/core-js/internals/internal-state.js index 15f3c4428e74..83e70b642815 100644 --- a/packages/core-js/internals/internal-state.js +++ b/packages/core-js/internals/internal-state.js @@ -1,6 +1,6 @@ 'use strict'; var NATIVE_WEAK_MAP = require('../internals/weak-map-basic-detection'); -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); var isObject = require('../internals/is-object'); var createNonEnumerableProperty = require('../internals/create-non-enumerable-property'); var hasOwn = require('../internals/has-own-property'); @@ -9,8 +9,8 @@ var sharedKey = require('../internals/shared-key'); var hiddenKeys = require('../internals/hidden-keys'); var OBJECT_ALREADY_INITIALIZED = 'Object already initialized'; -var TypeError = global.TypeError; -var WeakMap = global.WeakMap; +var TypeError = globalThis.TypeError; +var WeakMap = globalThis.WeakMap; var set, get, has; var enforce = function (it) { diff --git a/packages/core-js/internals/microtask.js b/packages/core-js/internals/microtask.js index cefe4cd56c5e..906ffc4395d5 100644 --- a/packages/core-js/internals/microtask.js +++ b/packages/core-js/internals/microtask.js @@ -1,5 +1,5 @@ 'use strict'; -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); var safeGetBuiltIn = require('../internals/safe-get-built-in'); var bind = require('../internals/function-bind-context'); var macrotask = require('../internals/task').set; @@ -9,10 +9,10 @@ var IS_IOS_PEBBLE = require('../internals/environment-is-ios-pebble'); var IS_WEBOS_WEBKIT = require('../internals/environment-is-webos-webkit'); var IS_NODE = require('../internals/environment-is-node'); -var MutationObserver = global.MutationObserver || global.WebKitMutationObserver; -var document = global.document; -var process = global.process; -var Promise = global.Promise; +var MutationObserver = globalThis.MutationObserver || globalThis.WebKitMutationObserver; +var document = globalThis.document; +var process = globalThis.process; +var Promise = globalThis.Promise; var microtask = safeGetBuiltIn('queueMicrotask'); var notify, toggle, node, promise, then; @@ -64,7 +64,7 @@ if (!microtask) { // - setTimeout } else { // `webpack` dev server bug on IE global methods - use bind(fn, global) - macrotask = bind(macrotask, global); + macrotask = bind(macrotask, globalThis); notify = function () { macrotask(flush); }; diff --git a/packages/core-js/internals/number-is-finite.js b/packages/core-js/internals/number-is-finite.js index 50ed6cb5824b..d2fe159ffae1 100644 --- a/packages/core-js/internals/number-is-finite.js +++ b/packages/core-js/internals/number-is-finite.js @@ -1,7 +1,7 @@ 'use strict'; -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); -var globalIsFinite = global.isFinite; +var globalIsFinite = globalThis.isFinite; // `Number.isFinite` method // https://tc39.es/ecma262/#sec-number.isfinite diff --git a/packages/core-js/internals/number-parse-float.js b/packages/core-js/internals/number-parse-float.js index f46ab4360137..09da20d9da0b 100644 --- a/packages/core-js/internals/number-parse-float.js +++ b/packages/core-js/internals/number-parse-float.js @@ -1,5 +1,5 @@ 'use strict'; -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); var fails = require('../internals/fails'); var uncurryThis = require('../internals/function-uncurry-this'); var toString = require('../internals/to-string'); @@ -7,8 +7,8 @@ var trim = require('../internals/string-trim').trim; var whitespaces = require('../internals/whitespaces'); var charAt = uncurryThis(''.charAt); -var $parseFloat = global.parseFloat; -var Symbol = global.Symbol; +var $parseFloat = globalThis.parseFloat; +var Symbol = globalThis.Symbol; var ITERATOR = Symbol && Symbol.iterator; var FORCED = 1 / $parseFloat(whitespaces + '-0') !== -Infinity // MS Edge 18- broken with boxed symbols diff --git a/packages/core-js/internals/number-parse-int.js b/packages/core-js/internals/number-parse-int.js index d6c1987e8852..eae2813124f6 100644 --- a/packages/core-js/internals/number-parse-int.js +++ b/packages/core-js/internals/number-parse-int.js @@ -1,13 +1,13 @@ 'use strict'; -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); var fails = require('../internals/fails'); var uncurryThis = require('../internals/function-uncurry-this'); var toString = require('../internals/to-string'); var trim = require('../internals/string-trim').trim; var whitespaces = require('../internals/whitespaces'); -var $parseInt = global.parseInt; -var Symbol = global.Symbol; +var $parseInt = globalThis.parseInt; +var Symbol = globalThis.Symbol; var ITERATOR = Symbol && Symbol.iterator; var hex = /^[+-]?0x/i; var exec = uncurryThis(hex.exec); diff --git a/packages/core-js/internals/object-prototype-accessors-forced.js b/packages/core-js/internals/object-prototype-accessors-forced.js index f562eadb702e..6e982a29ae4e 100644 --- a/packages/core-js/internals/object-prototype-accessors-forced.js +++ b/packages/core-js/internals/object-prototype-accessors-forced.js @@ -1,6 +1,6 @@ 'use strict'; var IS_PURE = require('../internals/is-pure'); -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); var fails = require('../internals/fails'); var WEBKIT = require('../internals/environment-webkit-version'); @@ -13,5 +13,5 @@ module.exports = IS_PURE || !fails(function () { // In FF throws only define methods // eslint-disable-next-line no-undef, no-useless-call, es/no-legacy-object-prototype-accessor-methods -- required for testing __defineSetter__.call(null, key, function () { /* empty */ }); - delete global[key]; + delete globalThis[key]; }); diff --git a/packages/core-js/internals/path.js b/packages/core-js/internals/path.js index d9eeb384d99c..6c8b3444c696 100644 --- a/packages/core-js/internals/path.js +++ b/packages/core-js/internals/path.js @@ -1,4 +1,4 @@ 'use strict'; -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); -module.exports = global; +module.exports = globalThis; diff --git a/packages/core-js/internals/promise-constructor-detection.js b/packages/core-js/internals/promise-constructor-detection.js index 6f802392c433..1c2e2035a9f4 100644 --- a/packages/core-js/internals/promise-constructor-detection.js +++ b/packages/core-js/internals/promise-constructor-detection.js @@ -1,5 +1,5 @@ 'use strict'; -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); var NativePromiseConstructor = require('../internals/promise-native-constructor'); var isCallable = require('../internals/is-callable'); var isForced = require('../internals/is-forced'); @@ -12,7 +12,7 @@ var V8_VERSION = require('../internals/environment-v8-version'); var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype; var SPECIES = wellKnownSymbol('species'); var SUBCLASSING = false; -var NATIVE_PROMISE_REJECTION_EVENT = isCallable(global.PromiseRejectionEvent); +var NATIVE_PROMISE_REJECTION_EVENT = isCallable(globalThis.PromiseRejectionEvent); var FORCED_PROMISE_CONSTRUCTOR = isForced('Promise', function () { var PROMISE_CONSTRUCTOR_SOURCE = inspectSource(NativePromiseConstructor); diff --git a/packages/core-js/internals/promise-native-constructor.js b/packages/core-js/internals/promise-native-constructor.js index 67fe11a3aa1f..4d126bc8135f 100644 --- a/packages/core-js/internals/promise-native-constructor.js +++ b/packages/core-js/internals/promise-native-constructor.js @@ -1,4 +1,4 @@ 'use strict'; -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); -module.exports = global.Promise; +module.exports = globalThis.Promise; diff --git a/packages/core-js/internals/regexp-sticky-helpers.js b/packages/core-js/internals/regexp-sticky-helpers.js index 060e3028586b..7e266f27632b 100644 --- a/packages/core-js/internals/regexp-sticky-helpers.js +++ b/packages/core-js/internals/regexp-sticky-helpers.js @@ -1,9 +1,9 @@ 'use strict'; var fails = require('../internals/fails'); -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); // babel-minify and Closure Compiler transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError -var $RegExp = global.RegExp; +var $RegExp = globalThis.RegExp; var UNSUPPORTED_Y = fails(function () { var re = $RegExp('a', 'y'); diff --git a/packages/core-js/internals/regexp-unsupported-dot-all.js b/packages/core-js/internals/regexp-unsupported-dot-all.js index cec5db5d856c..2ffb9d2c77df 100644 --- a/packages/core-js/internals/regexp-unsupported-dot-all.js +++ b/packages/core-js/internals/regexp-unsupported-dot-all.js @@ -1,9 +1,9 @@ 'use strict'; var fails = require('../internals/fails'); -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); // babel-minify and Closure Compiler transpiles RegExp('.', 's') -> /./s and it causes SyntaxError -var $RegExp = global.RegExp; +var $RegExp = globalThis.RegExp; module.exports = fails(function () { var re = $RegExp('.', 's'); diff --git a/packages/core-js/internals/regexp-unsupported-ncg.js b/packages/core-js/internals/regexp-unsupported-ncg.js index 09b581cef836..5fa1939c47de 100644 --- a/packages/core-js/internals/regexp-unsupported-ncg.js +++ b/packages/core-js/internals/regexp-unsupported-ncg.js @@ -1,9 +1,9 @@ 'use strict'; var fails = require('../internals/fails'); -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); // babel-minify and Closure Compiler transpiles RegExp('(?b)', 'g') -> /(?b)/g and it causes SyntaxError -var $RegExp = global.RegExp; +var $RegExp = globalThis.RegExp; module.exports = fails(function () { var re = $RegExp('(?b)', 'g'); diff --git a/packages/core-js/internals/safe-get-built-in.js b/packages/core-js/internals/safe-get-built-in.js index 04e49ef896fc..7185174b36e0 100644 --- a/packages/core-js/internals/safe-get-built-in.js +++ b/packages/core-js/internals/safe-get-built-in.js @@ -1,5 +1,5 @@ 'use strict'; -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); var DESCRIPTORS = require('../internals/descriptors'); // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe @@ -7,7 +7,7 @@ var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; // Avoid NodeJS experimental warning module.exports = function (name) { - if (!DESCRIPTORS) return global[name]; - var descriptor = getOwnPropertyDescriptor(global, name); + if (!DESCRIPTORS) return globalThis[name]; + var descriptor = getOwnPropertyDescriptor(globalThis, name); return descriptor && descriptor.value; }; diff --git a/packages/core-js/internals/schedulers-fix.js b/packages/core-js/internals/schedulers-fix.js index f373407ef022..6c1001c1e0ad 100644 --- a/packages/core-js/internals/schedulers-fix.js +++ b/packages/core-js/internals/schedulers-fix.js @@ -1,5 +1,5 @@ 'use strict'; -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); var apply = require('../internals/function-apply'); var isCallable = require('../internals/is-callable'); var ENVIRONMENT = require('../internals/environment'); @@ -7,10 +7,10 @@ var USER_AGENT = require('../internals/environment-user-agent'); var arraySlice = require('../internals/array-slice'); var validateArgumentsLength = require('../internals/validate-arguments-length'); -var Function = global.Function; +var Function = globalThis.Function; // dirty IE9- and Bun 0.3.0- checks var WRAP = /MSIE .\./.test(USER_AGENT) || ENVIRONMENT === 'BUN' && (function () { - var version = global.Bun.version.split('.'); + var version = globalThis.Bun.version.split('.'); return version.length < 3 || version[0] === '0' && (version[1] < 3 || version[1] === '3' && version[2] === '0'); })(); diff --git a/packages/core-js/internals/shared-store.js b/packages/core-js/internals/shared-store.js index d493823528bb..29857b4657b6 100644 --- a/packages/core-js/internals/shared-store.js +++ b/packages/core-js/internals/shared-store.js @@ -1,6 +1,6 @@ 'use strict'; var IS_PURE = require('../internals/is-pure'); -var globalThis = require('../internals/global'); +var globalThis = require('../internals/global-this'); var defineGlobalProperty = require('../internals/define-global-property'); var SHARED = '__core-js_shared__'; diff --git a/packages/core-js/internals/structured-clone-proper-transfer.js b/packages/core-js/internals/structured-clone-proper-transfer.js index cb22f1ef36d5..eb57f299eaf9 100644 --- a/packages/core-js/internals/structured-clone-proper-transfer.js +++ b/packages/core-js/internals/structured-clone-proper-transfer.js @@ -1,10 +1,10 @@ 'use strict'; -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); var fails = require('../internals/fails'); var V8 = require('../internals/environment-v8-version'); var ENVIRONMENT = require('../internals/environment'); -var structuredClone = global.structuredClone; +var structuredClone = globalThis.structuredClone; module.exports = !!structuredClone && !fails(function () { // prevent V8 ArrayBufferDetaching protector cell invalidation and performance degradation diff --git a/packages/core-js/internals/symbol-constructor-detection.js b/packages/core-js/internals/symbol-constructor-detection.js index 10ea88e91b9a..2c421dd6f862 100644 --- a/packages/core-js/internals/symbol-constructor-detection.js +++ b/packages/core-js/internals/symbol-constructor-detection.js @@ -2,9 +2,9 @@ /* eslint-disable es/no-symbol -- required for testing */ var V8_VERSION = require('../internals/environment-v8-version'); var fails = require('../internals/fails'); -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); -var $String = global.String; +var $String = globalThis.String; // eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing module.exports = !!Object.getOwnPropertySymbols && !fails(function () { diff --git a/packages/core-js/internals/task.js b/packages/core-js/internals/task.js index fb59c71120f2..691b36e89c72 100644 --- a/packages/core-js/internals/task.js +++ b/packages/core-js/internals/task.js @@ -1,5 +1,5 @@ 'use strict'; -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); var apply = require('../internals/function-apply'); var bind = require('../internals/function-bind-context'); var isCallable = require('../internals/is-callable'); @@ -12,13 +12,13 @@ var validateArgumentsLength = require('../internals/validate-arguments-length'); var IS_IOS = require('../internals/environment-is-ios'); var IS_NODE = require('../internals/environment-is-node'); -var set = global.setImmediate; -var clear = global.clearImmediate; -var process = global.process; -var Dispatch = global.Dispatch; -var Function = global.Function; -var MessageChannel = global.MessageChannel; -var String = global.String; +var set = globalThis.setImmediate; +var clear = globalThis.clearImmediate; +var process = globalThis.process; +var Dispatch = globalThis.Dispatch; +var Function = globalThis.Function; +var MessageChannel = globalThis.MessageChannel; +var String = globalThis.String; var counter = 0; var queue = {}; var ONREADYSTATECHANGE = 'onreadystatechange'; @@ -26,7 +26,7 @@ var $location, defer, channel, port; fails(function () { // Deno throws a ReferenceError on `location` access without `--location` flag - $location = global.location; + $location = globalThis.location; }); var run = function (id) { @@ -49,7 +49,7 @@ var eventListener = function (event) { var globalPostMessageDefer = function (id) { // old engines have not location.origin - global.postMessage(String(id), $location.protocol + '//' + $location.host); + globalThis.postMessage(String(id), $location.protocol + '//' + $location.host); }; // Node.js 0.9+ & IE10+ has setImmediate, otherwise: @@ -87,14 +87,14 @@ if (!set || !clear) { // Browsers with postMessage, skip WebWorkers // IE8 has postMessage, but it's sync & typeof its postMessage is 'object' } else if ( - global.addEventListener && - isCallable(global.postMessage) && - !global.importScripts && + globalThis.addEventListener && + isCallable(globalThis.postMessage) && + !globalThis.importScripts && $location && $location.protocol !== 'file:' && !fails(globalPostMessageDefer) ) { defer = globalPostMessageDefer; - global.addEventListener('message', eventListener, false); + globalThis.addEventListener('message', eventListener, false); // IE8- } else if (ONREADYSTATECHANGE in createElement('script')) { defer = function (id) { diff --git a/packages/core-js/internals/typed-array-constructor.js b/packages/core-js/internals/typed-array-constructor.js index c09ff39fc247..b7046a3c337f 100644 --- a/packages/core-js/internals/typed-array-constructor.js +++ b/packages/core-js/internals/typed-array-constructor.js @@ -1,6 +1,6 @@ 'use strict'; var $ = require('../internals/export'); -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); var call = require('../internals/function-call'); var DESCRIPTORS = require('../internals/descriptors'); var TYPED_ARRAYS_CONSTRUCTORS_REQUIRES_WRAPPERS = require('../internals/typed-array-constructors-require-wrappers'); @@ -38,7 +38,7 @@ var setInternalState = InternalStateModule.set; var enforceInternalState = InternalStateModule.enforce; var nativeDefineProperty = definePropertyModule.f; var nativeGetOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f; -var RangeError = global.RangeError; +var RangeError = globalThis.RangeError; var ArrayBuffer = ArrayBufferModule.ArrayBuffer; var ArrayBufferPrototype = ArrayBuffer.prototype; var DataView = ArrayBufferModule.DataView; @@ -116,7 +116,7 @@ if (DESCRIPTORS) { var CONSTRUCTOR_NAME = TYPE + (CLAMPED ? 'Clamped' : '') + 'Array'; var GETTER = 'get' + TYPE; var SETTER = 'set' + TYPE; - var NativeTypedArrayConstructor = global[CONSTRUCTOR_NAME]; + var NativeTypedArrayConstructor = globalThis[CONSTRUCTOR_NAME]; var TypedArrayConstructor = NativeTypedArrayConstructor; var TypedArrayConstructorPrototype = TypedArrayConstructor && TypedArrayConstructor.prototype; var exported = {}; diff --git a/packages/core-js/internals/typed-array-constructors-require-wrappers.js b/packages/core-js/internals/typed-array-constructors-require-wrappers.js index 7dc44c1dcd4f..10a7bd1fb3ae 100644 --- a/packages/core-js/internals/typed-array-constructors-require-wrappers.js +++ b/packages/core-js/internals/typed-array-constructors-require-wrappers.js @@ -1,12 +1,12 @@ 'use strict'; /* eslint-disable no-new -- required for testing */ -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); var fails = require('../internals/fails'); var checkCorrectnessOfIteration = require('../internals/check-correctness-of-iteration'); var NATIVE_ARRAY_BUFFER_VIEWS = require('../internals/array-buffer-view-core').NATIVE_ARRAY_BUFFER_VIEWS; -var ArrayBuffer = global.ArrayBuffer; -var Int8Array = global.Int8Array; +var ArrayBuffer = globalThis.ArrayBuffer; +var Int8Array = globalThis.Int8Array; module.exports = !NATIVE_ARRAY_BUFFER_VIEWS || !fails(function () { Int8Array(1); diff --git a/packages/core-js/internals/uint8-from-hex.js b/packages/core-js/internals/uint8-from-hex.js index 3e2d8981e698..b9488b1b4c82 100644 --- a/packages/core-js/internals/uint8-from-hex.js +++ b/packages/core-js/internals/uint8-from-hex.js @@ -1,10 +1,10 @@ 'use strict'; -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); var uncurryThis = require('../internals/function-uncurry-this'); -var Uint8Array = global.Uint8Array; -var SyntaxError = global.SyntaxError; -var parseInt = global.parseInt; +var Uint8Array = globalThis.Uint8Array; +var SyntaxError = globalThis.SyntaxError; +var parseInt = globalThis.parseInt; var min = Math.min; var NOT_HEX = /[^\da-f]/i; var exec = uncurryThis(NOT_HEX.exec); diff --git a/packages/core-js/internals/weak-map-basic-detection.js b/packages/core-js/internals/weak-map-basic-detection.js index d4f87f4b6fef..d9072c2015fe 100644 --- a/packages/core-js/internals/weak-map-basic-detection.js +++ b/packages/core-js/internals/weak-map-basic-detection.js @@ -1,7 +1,7 @@ 'use strict'; -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); var isCallable = require('../internals/is-callable'); -var WeakMap = global.WeakMap; +var WeakMap = globalThis.WeakMap; module.exports = isCallable(WeakMap) && /native code/.test(String(WeakMap)); diff --git a/packages/core-js/internals/well-known-symbol.js b/packages/core-js/internals/well-known-symbol.js index 7e629a59c277..bc94b14b0e03 100644 --- a/packages/core-js/internals/well-known-symbol.js +++ b/packages/core-js/internals/well-known-symbol.js @@ -1,12 +1,12 @@ 'use strict'; -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); var shared = require('../internals/shared'); var hasOwn = require('../internals/has-own-property'); var uid = require('../internals/uid'); var NATIVE_SYMBOL = require('../internals/symbol-constructor-detection'); var USE_SYMBOL_AS_UID = require('../internals/use-symbol-as-uid'); -var Symbol = global.Symbol; +var Symbol = globalThis.Symbol; var WellKnownSymbolsStore = shared('wks'); var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol['for'] || Symbol : Symbol && Symbol.withoutSetter || uid; diff --git a/packages/core-js/modules/es.array-buffer.constructor.js b/packages/core-js/modules/es.array-buffer.constructor.js index 7af8885a1946..810c906f722e 100644 --- a/packages/core-js/modules/es.array-buffer.constructor.js +++ b/packages/core-js/modules/es.array-buffer.constructor.js @@ -1,12 +1,12 @@ 'use strict'; var $ = require('../internals/export'); -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); var arrayBufferModule = require('../internals/array-buffer'); var setSpecies = require('../internals/set-species'); var ARRAY_BUFFER = 'ArrayBuffer'; var ArrayBuffer = arrayBufferModule[ARRAY_BUFFER]; -var NativeArrayBuffer = global[ARRAY_BUFFER]; +var NativeArrayBuffer = globalThis[ARRAY_BUFFER]; // `ArrayBuffer` constructor // https://tc39.es/ecma262/#sec-arraybuffer-constructor diff --git a/packages/core-js/modules/es.error.cause.js b/packages/core-js/modules/es.error.cause.js index 1aa11d0e36a4..2e82c21f333c 100644 --- a/packages/core-js/modules/es.error.cause.js +++ b/packages/core-js/modules/es.error.cause.js @@ -1,12 +1,12 @@ 'use strict'; /* eslint-disable no-unused-vars -- required for functions `.length` */ var $ = require('../internals/export'); -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); var apply = require('../internals/function-apply'); var wrapErrorConstructorWithCause = require('../internals/wrap-error-constructor-with-cause'); var WEB_ASSEMBLY = 'WebAssembly'; -var WebAssembly = global[WEB_ASSEMBLY]; +var WebAssembly = globalThis[WEB_ASSEMBLY]; // eslint-disable-next-line es/no-error-cause -- feature detection var FORCED = new Error('e', { cause: 7 }).cause !== 7; diff --git a/packages/core-js/modules/es.global-this.js b/packages/core-js/modules/es.global-this.js index aacb400aaefc..92635853abba 100644 --- a/packages/core-js/modules/es.global-this.js +++ b/packages/core-js/modules/es.global-this.js @@ -1,9 +1,9 @@ 'use strict'; var $ = require('../internals/export'); -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); // `globalThis` object // https://tc39.es/ecma262/#sec-globalthis -$({ global: true, forced: global.globalThis !== global }, { - globalThis: global +$({ global: true, forced: globalThis.globalThis !== globalThis }, { + globalThis: globalThis }); diff --git a/packages/core-js/modules/es.json.to-string-tag.js b/packages/core-js/modules/es.json.to-string-tag.js index 358d446c3fd4..b886b62bf049 100644 --- a/packages/core-js/modules/es.json.to-string-tag.js +++ b/packages/core-js/modules/es.json.to-string-tag.js @@ -1,7 +1,7 @@ 'use strict'; -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); var setToStringTag = require('../internals/set-to-string-tag'); // JSON[@@toStringTag] property // https://tc39.es/ecma262/#sec-json-@@tostringtag -setToStringTag(global.JSON, 'JSON', true); +setToStringTag(globalThis.JSON, 'JSON', true); diff --git a/packages/core-js/modules/es.number.constructor.js b/packages/core-js/modules/es.number.constructor.js index 975159b4c3f2..a7e856c69dac 100644 --- a/packages/core-js/modules/es.number.constructor.js +++ b/packages/core-js/modules/es.number.constructor.js @@ -2,7 +2,7 @@ var $ = require('../internals/export'); var IS_PURE = require('../internals/is-pure'); var DESCRIPTORS = require('../internals/descriptors'); -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); var path = require('../internals/path'); var uncurryThis = require('../internals/function-uncurry-this'); var isForced = require('../internals/is-forced'); @@ -19,10 +19,10 @@ var thisNumberValue = require('../internals/this-number-value'); var trim = require('../internals/string-trim').trim; var NUMBER = 'Number'; -var NativeNumber = global[NUMBER]; +var NativeNumber = globalThis[NUMBER]; var PureNumberNamespace = path[NUMBER]; var NumberPrototype = NativeNumber.prototype; -var TypeError = global.TypeError; +var TypeError = globalThis.TypeError; var stringSlice = uncurryThis(''.slice); var charCodeAt = uncurryThis(''.charCodeAt); diff --git a/packages/core-js/modules/es.promise.constructor.js b/packages/core-js/modules/es.promise.constructor.js index ba4840f43266..88990a980b10 100644 --- a/packages/core-js/modules/es.promise.constructor.js +++ b/packages/core-js/modules/es.promise.constructor.js @@ -2,7 +2,7 @@ var $ = require('../internals/export'); var IS_PURE = require('../internals/is-pure'); var IS_NODE = require('../internals/environment-is-node'); -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); var call = require('../internals/function-call'); var defineBuiltIn = require('../internals/define-built-in'); var setPrototypeOf = require('../internals/object-set-prototype-of'); @@ -32,13 +32,13 @@ var setInternalState = InternalStateModule.set; var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype; var PromiseConstructor = NativePromiseConstructor; var PromisePrototype = NativePromisePrototype; -var TypeError = global.TypeError; -var document = global.document; -var process = global.process; +var TypeError = globalThis.TypeError; +var document = globalThis.document; +var process = globalThis.process; var newPromiseCapability = newPromiseCapabilityModule.f; var newGenericPromiseCapability = newPromiseCapability; -var DISPATCH_EVENT = !!(document && document.createEvent && global.dispatchEvent); +var DISPATCH_EVENT = !!(document && document.createEvent && globalThis.dispatchEvent); var UNHANDLED_REJECTION = 'unhandledrejection'; var REJECTION_HANDLED = 'rejectionhandled'; var PENDING = 0; @@ -111,14 +111,14 @@ var dispatchEvent = function (name, promise, reason) { event.promise = promise; event.reason = reason; event.initEvent(name, false, true); - global.dispatchEvent(event); + globalThis.dispatchEvent(event); } else event = { promise: promise, reason: reason }; - if (!NATIVE_PROMISE_REJECTION_EVENT && (handler = global['on' + name])) handler(event); + if (!NATIVE_PROMISE_REJECTION_EVENT && (handler = globalThis['on' + name])) handler(event); else if (name === UNHANDLED_REJECTION) hostReportErrors('Unhandled promise rejection', reason); }; var onUnhandled = function (state) { - call(task, global, function () { + call(task, globalThis, function () { var promise = state.facade; var value = state.value; var IS_UNHANDLED = isUnhandled(state); @@ -141,7 +141,7 @@ var isUnhandled = function (state) { }; var onHandleUnhandled = function (state) { - call(task, global, function () { + call(task, globalThis, function () { var promise = state.facade; if (IS_NODE) { process.emit('rejectionHandled', promise); diff --git a/packages/core-js/modules/es.reflect.to-string-tag.js b/packages/core-js/modules/es.reflect.to-string-tag.js index 14f27161997d..90f12cde1acc 100644 --- a/packages/core-js/modules/es.reflect.to-string-tag.js +++ b/packages/core-js/modules/es.reflect.to-string-tag.js @@ -1,10 +1,10 @@ 'use strict'; var $ = require('../internals/export'); -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); var setToStringTag = require('../internals/set-to-string-tag'); $({ global: true }, { Reflect: {} }); // Reflect[@@toStringTag] property // https://tc39.es/ecma262/#sec-reflect-@@tostringtag -setToStringTag(global.Reflect, 'Reflect', true); +setToStringTag(globalThis.Reflect, 'Reflect', true); diff --git a/packages/core-js/modules/es.regexp.constructor.js b/packages/core-js/modules/es.regexp.constructor.js index edb89c217f09..e1641cd7293e 100644 --- a/packages/core-js/modules/es.regexp.constructor.js +++ b/packages/core-js/modules/es.regexp.constructor.js @@ -1,6 +1,6 @@ 'use strict'; var DESCRIPTORS = require('../internals/descriptors'); -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); var uncurryThis = require('../internals/function-uncurry-this'); var isForced = require('../internals/is-forced'); var inheritIfRequired = require('../internals/inherit-if-required'); @@ -23,9 +23,9 @@ var UNSUPPORTED_DOT_ALL = require('../internals/regexp-unsupported-dot-all'); var UNSUPPORTED_NCG = require('../internals/regexp-unsupported-ncg'); var MATCH = wellKnownSymbol('match'); -var NativeRegExp = global.RegExp; +var NativeRegExp = globalThis.RegExp; var RegExpPrototype = NativeRegExp.prototype; -var SyntaxError = global.SyntaxError; +var SyntaxError = globalThis.SyntaxError; var exec = uncurryThis(RegExpPrototype.exec); var charAt = uncurryThis(''.charAt); var replace = uncurryThis(''.replace); @@ -189,7 +189,7 @@ if (isForced('RegExp', BASE_FORCED)) { RegExpPrototype.constructor = RegExpWrapper; RegExpWrapper.prototype = RegExpPrototype; - defineBuiltIn(global, 'RegExp', RegExpWrapper, { constructor: true }); + defineBuiltIn(globalThis, 'RegExp', RegExpWrapper, { constructor: true }); } // https://tc39.es/ecma262/#sec-get-regexp-@@species diff --git a/packages/core-js/modules/es.regexp.flags.js b/packages/core-js/modules/es.regexp.flags.js index d42b8cb41089..167dc23496ff 100644 --- a/packages/core-js/modules/es.regexp.flags.js +++ b/packages/core-js/modules/es.regexp.flags.js @@ -1,12 +1,12 @@ 'use strict'; -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); var DESCRIPTORS = require('../internals/descriptors'); var defineBuiltInAccessor = require('../internals/define-built-in-accessor'); var regExpFlags = require('../internals/regexp-flags'); var fails = require('../internals/fails'); // babel-minify and Closure Compiler transpiles RegExp('.', 'd') -> /./d and it causes SyntaxError -var RegExp = global.RegExp; +var RegExp = globalThis.RegExp; var RegExpPrototype = RegExp.prototype; var FORCED = DESCRIPTORS && fails(function () { diff --git a/packages/core-js/modules/es.symbol.constructor.js b/packages/core-js/modules/es.symbol.constructor.js index e3982a9b0a88..274e2ef6cfcc 100644 --- a/packages/core-js/modules/es.symbol.constructor.js +++ b/packages/core-js/modules/es.symbol.constructor.js @@ -1,6 +1,6 @@ 'use strict'; var $ = require('../internals/export'); -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); var call = require('../internals/function-call'); var uncurryThis = require('../internals/function-uncurry-this'); var IS_PURE = require('../internals/is-pure'); @@ -45,11 +45,11 @@ var setInternalState = InternalStateModule.set; var getInternalState = InternalStateModule.getterFor(SYMBOL); var ObjectPrototype = Object[PROTOTYPE]; -var $Symbol = global.Symbol; +var $Symbol = globalThis.Symbol; var SymbolPrototype = $Symbol && $Symbol[PROTOTYPE]; -var RangeError = global.RangeError; -var TypeError = global.TypeError; -var QObject = global.QObject; +var RangeError = globalThis.RangeError; +var TypeError = globalThis.TypeError; +var QObject = globalThis.QObject; var nativeGetOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f; var nativeDefineProperty = definePropertyModule.f; var nativeGetOwnPropertyNames = getOwnPropertyNamesExternal.f; @@ -168,7 +168,7 @@ if (!NATIVE_SYMBOL) { var description = !arguments.length || arguments[0] === undefined ? undefined : $toString(arguments[0]); var tag = uid(description); var setter = function (value) { - var $this = this === undefined ? global : this; + var $this = this === undefined ? globalThis : this; if ($this === ObjectPrototype) call(setter, ObjectPrototypeSymbols, value); if (hasOwn($this, HIDDEN) && hasOwn($this[HIDDEN], tag)) $this[HIDDEN][tag] = false; var descriptor = createPropertyDescriptor(1, value); diff --git a/packages/core-js/modules/es.symbol.description.js b/packages/core-js/modules/es.symbol.description.js index 4f36b504e59d..908af46db5bb 100644 --- a/packages/core-js/modules/es.symbol.description.js +++ b/packages/core-js/modules/es.symbol.description.js @@ -3,7 +3,7 @@ 'use strict'; var $ = require('../internals/export'); var DESCRIPTORS = require('../internals/descriptors'); -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); var uncurryThis = require('../internals/function-uncurry-this'); var hasOwn = require('../internals/has-own-property'); var isCallable = require('../internals/is-callable'); @@ -12,7 +12,7 @@ var toString = require('../internals/to-string'); var defineBuiltInAccessor = require('../internals/define-built-in-accessor'); var copyConstructorProperties = require('../internals/copy-constructor-properties'); -var NativeSymbol = global.Symbol; +var NativeSymbol = globalThis.Symbol; var SymbolPrototype = NativeSymbol && NativeSymbol.prototype; if (DESCRIPTORS && isCallable(NativeSymbol) && (!('description' in SymbolPrototype) || diff --git a/packages/core-js/modules/es.typed-array.iterator.js b/packages/core-js/modules/es.typed-array.iterator.js index 09950277430e..55bdbbc77dca 100644 --- a/packages/core-js/modules/es.typed-array.iterator.js +++ b/packages/core-js/modules/es.typed-array.iterator.js @@ -1,5 +1,5 @@ 'use strict'; -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); var fails = require('../internals/fails'); var uncurryThis = require('../internals/function-uncurry-this'); var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); @@ -7,7 +7,7 @@ var ArrayIterators = require('../modules/es.array.iterator'); var wellKnownSymbol = require('../internals/well-known-symbol'); var ITERATOR = wellKnownSymbol('iterator'); -var Uint8Array = global.Uint8Array; +var Uint8Array = globalThis.Uint8Array; var arrayValues = uncurryThis(ArrayIterators.values); var arrayKeys = uncurryThis(ArrayIterators.keys); var arrayEntries = uncurryThis(ArrayIterators.entries); diff --git a/packages/core-js/modules/es.typed-array.set.js b/packages/core-js/modules/es.typed-array.set.js index ec89248c431a..8248ce24183f 100644 --- a/packages/core-js/modules/es.typed-array.set.js +++ b/packages/core-js/modules/es.typed-array.set.js @@ -1,5 +1,5 @@ 'use strict'; -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); var call = require('../internals/function-call'); var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); var lengthOfArrayLike = require('../internals/length-of-array-like'); @@ -7,8 +7,8 @@ var toOffset = require('../internals/to-offset'); var toIndexedObject = require('../internals/to-object'); var fails = require('../internals/fails'); -var RangeError = global.RangeError; -var Int8Array = global.Int8Array; +var RangeError = globalThis.RangeError; +var Int8Array = globalThis.Int8Array; var Int8ArrayPrototype = Int8Array && Int8Array.prototype; var $set = Int8ArrayPrototype && Int8ArrayPrototype.set; var aTypedArray = ArrayBufferViewCore.aTypedArray; diff --git a/packages/core-js/modules/es.typed-array.sort.js b/packages/core-js/modules/es.typed-array.sort.js index 18bdc6623ae1..5fddfb14f994 100644 --- a/packages/core-js/modules/es.typed-array.sort.js +++ b/packages/core-js/modules/es.typed-array.sort.js @@ -1,5 +1,5 @@ 'use strict'; -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); var uncurryThis = require('../internals/function-uncurry-this-clause'); var fails = require('../internals/fails'); var aCallable = require('../internals/a-callable'); @@ -12,7 +12,7 @@ var WEBKIT = require('../internals/environment-webkit-version'); var aTypedArray = ArrayBufferViewCore.aTypedArray; var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod; -var Uint16Array = global.Uint16Array; +var Uint16Array = globalThis.Uint16Array; var nativeSort = Uint16Array && uncurryThis(Uint16Array.prototype.sort); // WebKit diff --git a/packages/core-js/modules/es.typed-array.to-locale-string.js b/packages/core-js/modules/es.typed-array.to-locale-string.js index 32e6c2fbc562..714e50fabaf6 100644 --- a/packages/core-js/modules/es.typed-array.to-locale-string.js +++ b/packages/core-js/modules/es.typed-array.to-locale-string.js @@ -1,11 +1,11 @@ 'use strict'; -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); var apply = require('../internals/function-apply'); var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); var fails = require('../internals/fails'); var arraySlice = require('../internals/array-slice'); -var Int8Array = global.Int8Array; +var Int8Array = globalThis.Int8Array; var aTypedArray = ArrayBufferViewCore.aTypedArray; var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod; var $toLocaleString = [].toLocaleString; diff --git a/packages/core-js/modules/es.typed-array.to-string.js b/packages/core-js/modules/es.typed-array.to-string.js index 735a527276d4..c7b9459c7174 100644 --- a/packages/core-js/modules/es.typed-array.to-string.js +++ b/packages/core-js/modules/es.typed-array.to-string.js @@ -1,10 +1,10 @@ 'use strict'; var exportTypedArrayMethod = require('../internals/array-buffer-view-core').exportTypedArrayMethod; var fails = require('../internals/fails'); -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); var uncurryThis = require('../internals/function-uncurry-this'); -var Uint8Array = global.Uint8Array; +var Uint8Array = globalThis.Uint8Array; var Uint8ArrayPrototype = Uint8Array && Uint8Array.prototype || {}; var arrayToString = [].toString; var join = uncurryThis([].join); diff --git a/packages/core-js/modules/es.weak-map.constructor.js b/packages/core-js/modules/es.weak-map.constructor.js index 15314b8b1887..d5105e4d4532 100644 --- a/packages/core-js/modules/es.weak-map.constructor.js +++ b/packages/core-js/modules/es.weak-map.constructor.js @@ -1,6 +1,6 @@ 'use strict'; var FREEZING = require('../internals/freezing'); -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); var uncurryThis = require('../internals/function-uncurry-this'); var defineBuiltIns = require('../internals/define-built-ins'); var InternalMetadataModule = require('../internals/internal-metadata'); @@ -25,7 +25,7 @@ var freeze = $Object.freeze; // eslint-disable-next-line es/no-object-seal -- safe var seal = $Object.seal; -var IS_IE11 = !global.ActiveXObject && 'ActiveXObject' in global; +var IS_IE11 = !globalThis.ActiveXObject && 'ActiveXObject' in globalThis; var InternalWeakMap; var wrapper = function (init) { diff --git a/packages/core-js/modules/esnext.iterator.constructor.js b/packages/core-js/modules/esnext.iterator.constructor.js index df222d90aaf4..4f3fe75aef0f 100644 --- a/packages/core-js/modules/esnext.iterator.constructor.js +++ b/packages/core-js/modules/esnext.iterator.constructor.js @@ -1,6 +1,6 @@ 'use strict'; var $ = require('../internals/export'); -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); var anInstance = require('../internals/an-instance'); var anObject = require('../internals/an-object'); var isCallable = require('../internals/is-callable'); @@ -19,7 +19,7 @@ var ITERATOR = 'Iterator'; var TO_STRING_TAG = wellKnownSymbol('toStringTag'); var $TypeError = TypeError; -var NativeIterator = global[ITERATOR]; +var NativeIterator = globalThis[ITERATOR]; // FF56- have non-standard global helper `Iterator` var FORCED = IS_PURE diff --git a/packages/core-js/modules/esnext.json.parse.js b/packages/core-js/modules/esnext.json.parse.js index 1addaeb36ccc..e4dda860b57b 100644 --- a/packages/core-js/modules/esnext.json.parse.js +++ b/packages/core-js/modules/esnext.json.parse.js @@ -1,7 +1,7 @@ 'use strict'; var $ = require('../internals/export'); var DESCRIPTORS = require('../internals/descriptors'); -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); var getBuiltIn = require('../internals/get-built-in'); var uncurryThis = require('../internals/function-uncurry-this'); var call = require('../internals/function-call'); @@ -16,9 +16,9 @@ var fails = require('../internals/fails'); var parseJSONString = require('../internals/parse-json-string'); var NATIVE_SYMBOL = require('../internals/symbol-constructor-detection'); -var JSON = global.JSON; -var Number = global.Number; -var SyntaxError = global.SyntaxError; +var JSON = globalThis.JSON; +var Number = globalThis.Number; +var SyntaxError = globalThis.SyntaxError; var nativeParse = JSON && JSON.parse; var enumerableOwnProperties = getBuiltIn('Object', 'keys'); // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe diff --git a/packages/core-js/modules/esnext.suppressed-error.constructor.js b/packages/core-js/modules/esnext.suppressed-error.constructor.js index ba0db6ab3bb0..f1f57e995e75 100644 --- a/packages/core-js/modules/esnext.suppressed-error.constructor.js +++ b/packages/core-js/modules/esnext.suppressed-error.constructor.js @@ -1,6 +1,6 @@ 'use strict'; var $ = require('../internals/export'); -var globalThis = require('../internals/global'); +var globalThis = require('../internals/global-this'); var isPrototypeOf = require('../internals/object-is-prototype-of'); var getPrototypeOf = require('../internals/object-get-prototype-of'); var setPrototypeOf = require('../internals/object-set-prototype-of'); diff --git a/packages/core-js/modules/esnext.symbol.async-dispose.js b/packages/core-js/modules/esnext.symbol.async-dispose.js index c5889b1578df..76d7edec7779 100644 --- a/packages/core-js/modules/esnext.symbol.async-dispose.js +++ b/packages/core-js/modules/esnext.symbol.async-dispose.js @@ -1,10 +1,10 @@ 'use strict'; -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); var defineWellKnownSymbol = require('../internals/well-known-symbol-define'); var defineProperty = require('../internals/object-define-property').f; var getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f; -var Symbol = global.Symbol; +var Symbol = globalThis.Symbol; // `Symbol.asyncDispose` well-known symbol // https://github.com/tc39/proposal-async-explicit-resource-management diff --git a/packages/core-js/modules/esnext.symbol.dispose.js b/packages/core-js/modules/esnext.symbol.dispose.js index d4b913d8a660..4cae30cb1ae8 100644 --- a/packages/core-js/modules/esnext.symbol.dispose.js +++ b/packages/core-js/modules/esnext.symbol.dispose.js @@ -1,10 +1,10 @@ 'use strict'; -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); var defineWellKnownSymbol = require('../internals/well-known-symbol-define'); var defineProperty = require('../internals/object-define-property').f; var getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f; -var Symbol = global.Symbol; +var Symbol = globalThis.Symbol; // `Symbol.dispose` well-known symbol // https://github.com/tc39/proposal-explicit-resource-management diff --git a/packages/core-js/modules/esnext.uint8-array.from-base64.js b/packages/core-js/modules/esnext.uint8-array.from-base64.js index f80c5a416514..18689bb926e1 100644 --- a/packages/core-js/modules/esnext.uint8-array.from-base64.js +++ b/packages/core-js/modules/esnext.uint8-array.from-base64.js @@ -1,6 +1,6 @@ 'use strict'; var $ = require('../internals/export'); -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); var uncurryThis = require('../internals/function-uncurry-this'); var anObjectOrUndefined = require('../internals/an-object-or-undefined'); var aString = require('../internals/a-string'); @@ -12,8 +12,8 @@ var getAlphabetOption = require('../internals/get-alphabet-option'); var base64Alphabet = base64Map.c2i; var base64UrlAlphabet = base64Map.c2iUrl; -var Uint8Array = global.Uint8Array; -var SyntaxError = global.SyntaxError; +var Uint8Array = globalThis.Uint8Array; +var SyntaxError = globalThis.SyntaxError; var charAt = uncurryThis(''.charAt); var replace = uncurryThis(''.replace); var stringSlice = uncurryThis(''.slice); diff --git a/packages/core-js/modules/esnext.uint8-array.from-hex.js b/packages/core-js/modules/esnext.uint8-array.from-hex.js index 2ddf2ca73add..036f3a8b11a6 100644 --- a/packages/core-js/modules/esnext.uint8-array.from-hex.js +++ b/packages/core-js/modules/esnext.uint8-array.from-hex.js @@ -1,12 +1,12 @@ 'use strict'; var $ = require('../internals/export'); -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); var aString = require('../internals/a-string'); var $fromHex = require('../internals/uint8-from-hex'); // `Uint8Array.fromHex` method // https://github.com/tc39/proposal-arraybuffer-base64 -if (global.Uint8Array) $({ target: 'Uint8Array', stat: true }, { +if (globalThis.Uint8Array) $({ target: 'Uint8Array', stat: true }, { fromHex: function fromHex(string) { return $fromHex(aString(string)).bytes; } diff --git a/packages/core-js/modules/esnext.uint8-array.set-from-hex.js b/packages/core-js/modules/esnext.uint8-array.set-from-hex.js index 8af82008a195..29f54208db6a 100644 --- a/packages/core-js/modules/esnext.uint8-array.set-from-hex.js +++ b/packages/core-js/modules/esnext.uint8-array.set-from-hex.js @@ -1,16 +1,14 @@ 'use strict'; var $ = require('../internals/export'); -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); var aString = require('../internals/a-string'); var anUint8Array = require('../internals/an-uint8-array'); var notDetached = require('../internals/array-buffer-not-detached'); var $fromHex = require('../internals/uint8-from-hex'); -var Uint8Array = global.Uint8Array; - // `Uint8Array.prototype.setFromHex` method // https://github.com/tc39/proposal-arraybuffer-base64 -if (Uint8Array) $({ target: 'Uint8Array', proto: true }, { +if (globalThis.Uint8Array) $({ target: 'Uint8Array', proto: true }, { setFromHex: function setFromHex(string) { anUint8Array(this); aString(string); diff --git a/packages/core-js/modules/esnext.uint8-array.to-base64.js b/packages/core-js/modules/esnext.uint8-array.to-base64.js index dc5ad8e124fe..e7426e396964 100644 --- a/packages/core-js/modules/esnext.uint8-array.to-base64.js +++ b/packages/core-js/modules/esnext.uint8-array.to-base64.js @@ -1,6 +1,6 @@ 'use strict'; var $ = require('../internals/export'); -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); var uncurryThis = require('../internals/function-uncurry-this'); var anObjectOrUndefined = require('../internals/an-object-or-undefined'); var anUint8Array = require('../internals/an-uint8-array'); @@ -11,12 +11,11 @@ var getAlphabetOption = require('../internals/get-alphabet-option'); var base64Alphabet = base64Map.i2c; var base64UrlAlphabet = base64Map.i2cUrl; -var Uint8Array = global.Uint8Array; var charAt = uncurryThis(''.charAt); // `Uint8Array.prototype.toBase64` method // https://github.com/tc39/proposal-arraybuffer-base64 -if (Uint8Array) $({ target: 'Uint8Array', proto: true }, { +if (globalThis.Uint8Array) $({ target: 'Uint8Array', proto: true }, { toBase64: function toBase64(/* options */) { var array = anUint8Array(this); var options = arguments.length ? anObjectOrUndefined(arguments[0]) : undefined; diff --git a/packages/core-js/modules/esnext.uint8-array.to-hex.js b/packages/core-js/modules/esnext.uint8-array.to-hex.js index 6b47e26b48b1..e023ad053b63 100644 --- a/packages/core-js/modules/esnext.uint8-array.to-hex.js +++ b/packages/core-js/modules/esnext.uint8-array.to-hex.js @@ -1,16 +1,15 @@ 'use strict'; var $ = require('../internals/export'); -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); var uncurryThis = require('../internals/function-uncurry-this'); var anUint8Array = require('../internals/an-uint8-array'); var notDetached = require('../internals/array-buffer-not-detached'); -var Uint8Array = global.Uint8Array; var numberToString = uncurryThis(1.0.toString); // `Uint8Array.prototype.toHex` method // https://github.com/tc39/proposal-arraybuffer-base64 -if (Uint8Array) $({ target: 'Uint8Array', proto: true }, { +if (globalThis.Uint8Array) $({ target: 'Uint8Array', proto: true }, { toHex: function toHex() { anUint8Array(this); notDetached(this.buffer); diff --git a/packages/core-js/modules/web.atob.js b/packages/core-js/modules/web.atob.js index b6624011fbd1..c3221c6647c0 100644 --- a/packages/core-js/modules/web.atob.js +++ b/packages/core-js/modules/web.atob.js @@ -1,6 +1,6 @@ 'use strict'; var $ = require('../internals/export'); -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); var getBuiltIn = require('../internals/get-built-in'); var uncurryThis = require('../internals/function-uncurry-this'); var call = require('../internals/function-call'); @@ -45,7 +45,7 @@ $({ global: true, bind: true, enumerable: true, forced: FORCED }, { atob: function atob(data) { validateArgumentsLength(arguments.length, 1); // `webpack` dev server bug on IE global methods - use call(fn, global, ...) - if (BASIC && !NO_SPACES_IGNORE && !NO_ENCODING_CHECK) return call($atob, global, data); + if (BASIC && !NO_SPACES_IGNORE && !NO_ENCODING_CHECK) return call($atob, globalThis, data); var string = replace(toString(data), whitespaces, ''); var output = ''; var position = 0; diff --git a/packages/core-js/modules/web.btoa.js b/packages/core-js/modules/web.btoa.js index 0696e8c2d6b2..b8bda16c5b17 100644 --- a/packages/core-js/modules/web.btoa.js +++ b/packages/core-js/modules/web.btoa.js @@ -1,6 +1,6 @@ 'use strict'; var $ = require('../internals/export'); -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); var getBuiltIn = require('../internals/get-built-in'); var uncurryThis = require('../internals/function-uncurry-this'); var call = require('../internals/function-call'); @@ -33,7 +33,7 @@ $({ global: true, bind: true, enumerable: true, forced: !BASIC || NO_ARG_RECEIVI btoa: function btoa(data) { validateArgumentsLength(arguments.length, 1); // `webpack` dev server bug on IE global methods - use call(fn, global, ...) - if (BASIC) return call($btoa, global, toString(data)); + if (BASIC) return call($btoa, globalThis, toString(data)); var string = toString(data); var output = ''; var position = 0; diff --git a/packages/core-js/modules/web.clear-immediate.js b/packages/core-js/modules/web.clear-immediate.js index 52da424845d6..e2d8eb5bdb23 100644 --- a/packages/core-js/modules/web.clear-immediate.js +++ b/packages/core-js/modules/web.clear-immediate.js @@ -1,10 +1,10 @@ 'use strict'; var $ = require('../internals/export'); -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); var clearImmediate = require('../internals/task').clear; // `clearImmediate` method // http://w3c.github.io/setImmediate/#si-clearImmediate -$({ global: true, bind: true, enumerable: true, forced: global.clearImmediate !== clearImmediate }, { +$({ global: true, bind: true, enumerable: true, forced: globalThis.clearImmediate !== clearImmediate }, { clearImmediate: clearImmediate }); diff --git a/packages/core-js/modules/web.dom-collections.for-each.js b/packages/core-js/modules/web.dom-collections.for-each.js index d6c64503142d..bbbdef24b0a4 100644 --- a/packages/core-js/modules/web.dom-collections.for-each.js +++ b/packages/core-js/modules/web.dom-collections.for-each.js @@ -1,5 +1,5 @@ 'use strict'; -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); var DOMIterables = require('../internals/dom-iterables'); var DOMTokenListPrototype = require('../internals/dom-token-list-prototype'); var forEach = require('../internals/array-for-each'); @@ -16,7 +16,7 @@ var handlePrototype = function (CollectionPrototype) { for (var COLLECTION_NAME in DOMIterables) { if (DOMIterables[COLLECTION_NAME]) { - handlePrototype(global[COLLECTION_NAME] && global[COLLECTION_NAME].prototype); + handlePrototype(globalThis[COLLECTION_NAME] && globalThis[COLLECTION_NAME].prototype); } } diff --git a/packages/core-js/modules/web.dom-collections.iterator.js b/packages/core-js/modules/web.dom-collections.iterator.js index d265360bbb03..882a8287b913 100644 --- a/packages/core-js/modules/web.dom-collections.iterator.js +++ b/packages/core-js/modules/web.dom-collections.iterator.js @@ -1,5 +1,5 @@ 'use strict'; -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); var DOMIterables = require('../internals/dom-iterables'); var DOMTokenListPrototype = require('../internals/dom-token-list-prototype'); var ArrayIteratorMethods = require('../modules/es.array.iterator'); @@ -31,7 +31,7 @@ var handlePrototype = function (CollectionPrototype, COLLECTION_NAME) { }; for (var COLLECTION_NAME in DOMIterables) { - handlePrototype(global[COLLECTION_NAME] && global[COLLECTION_NAME].prototype, COLLECTION_NAME); + handlePrototype(globalThis[COLLECTION_NAME] && globalThis[COLLECTION_NAME].prototype, COLLECTION_NAME); } handlePrototype(DOMTokenListPrototype, 'DOMTokenList'); diff --git a/packages/core-js/modules/web.dom-exception.stack.js b/packages/core-js/modules/web.dom-exception.stack.js index da347118a9c3..f166de3e5382 100644 --- a/packages/core-js/modules/web.dom-exception.stack.js +++ b/packages/core-js/modules/web.dom-exception.stack.js @@ -1,6 +1,6 @@ 'use strict'; var $ = require('../internals/export'); -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); var getBuiltIn = require('../internals/get-built-in'); var createPropertyDescriptor = require('../internals/create-property-descriptor'); var defineProperty = require('../internals/object-define-property').f; @@ -36,7 +36,7 @@ var ERROR_HAS_STACK = 'stack' in new Error(DOM_EXCEPTION); var DOM_EXCEPTION_HAS_STACK = 'stack' in new NativeDOMException(1, 2); // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe -var descriptor = NativeDOMException && DESCRIPTORS && Object.getOwnPropertyDescriptor(global, DOM_EXCEPTION); +var descriptor = NativeDOMException && DESCRIPTORS && Object.getOwnPropertyDescriptor(globalThis, DOM_EXCEPTION); // Bun ~ 0.1.1 DOMException have incorrect descriptor and we can't redefine it // https://github.com/Jarred-Sumner/bun/issues/399 diff --git a/packages/core-js/modules/web.queue-microtask.js b/packages/core-js/modules/web.queue-microtask.js index b5e9464ffa9a..d34de6733b49 100644 --- a/packages/core-js/modules/web.queue-microtask.js +++ b/packages/core-js/modules/web.queue-microtask.js @@ -1,6 +1,6 @@ 'use strict'; var $ = require('../internals/export'); -var globalThis = require('../internals/global'); +var globalThis = require('../internals/global-this'); var microtask = require('../internals/microtask'); var aCallable = require('../internals/a-callable'); var validateArgumentsLength = require('../internals/validate-arguments-length'); diff --git a/packages/core-js/modules/web.self.js b/packages/core-js/modules/web.self.js index c732753f69c3..f409cc0cd12b 100644 --- a/packages/core-js/modules/web.self.js +++ b/packages/core-js/modules/web.self.js @@ -1,30 +1,30 @@ 'use strict'; var $ = require('../internals/export'); -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); var defineBuiltInAccessor = require('../internals/define-built-in-accessor'); var DESCRIPTORS = require('../internals/descriptors'); var $TypeError = TypeError; // eslint-disable-next-line es/no-object-defineproperty -- safe var defineProperty = Object.defineProperty; -var INCORRECT_VALUE = global.self !== global; +var INCORRECT_VALUE = globalThis.self !== globalThis; // `self` getter // https://html.spec.whatwg.org/multipage/window-object.html#dom-self try { if (DESCRIPTORS) { // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe - var descriptor = Object.getOwnPropertyDescriptor(global, 'self'); + var descriptor = Object.getOwnPropertyDescriptor(globalThis, 'self'); // some engines have `self`, but with incorrect descriptor // https://github.com/denoland/deno/issues/15765 if (INCORRECT_VALUE || !descriptor || !descriptor.get || !descriptor.enumerable) { - defineBuiltInAccessor(global, 'self', { + defineBuiltInAccessor(globalThis, 'self', { get: function self() { - return global; + return globalThis; }, set: function self(value) { - if (this !== global) throw new $TypeError('Illegal invocation'); - defineProperty(global, 'self', { + if (this !== globalThis) throw new $TypeError('Illegal invocation'); + defineProperty(globalThis, 'self', { value: value, writable: true, configurable: true, @@ -36,6 +36,6 @@ try { }); } } else $({ global: true, simple: true, forced: INCORRECT_VALUE }, { - self: global + self: globalThis }); } catch (error) { /* empty */ } diff --git a/packages/core-js/modules/web.set-immediate.js b/packages/core-js/modules/web.set-immediate.js index 6cb313a566a0..8aa3dc8721fa 100644 --- a/packages/core-js/modules/web.set-immediate.js +++ b/packages/core-js/modules/web.set-immediate.js @@ -1,14 +1,14 @@ 'use strict'; var $ = require('../internals/export'); -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); var setTask = require('../internals/task').set; var schedulersFix = require('../internals/schedulers-fix'); // https://github.com/oven-sh/bun/issues/1633 -var setImmediate = global.setImmediate ? schedulersFix(setTask, false) : setTask; +var setImmediate = globalThis.setImmediate ? schedulersFix(setTask, false) : setTask; // `setImmediate` method // http://w3c.github.io/setImmediate/#si-setImmediate -$({ global: true, bind: true, enumerable: true, forced: global.setImmediate !== setImmediate }, { +$({ global: true, bind: true, enumerable: true, forced: globalThis.setImmediate !== setImmediate }, { setImmediate: setImmediate }); diff --git a/packages/core-js/modules/web.set-interval.js b/packages/core-js/modules/web.set-interval.js index caa2737b8d2f..d0b6bb700f04 100644 --- a/packages/core-js/modules/web.set-interval.js +++ b/packages/core-js/modules/web.set-interval.js @@ -1,12 +1,12 @@ 'use strict'; var $ = require('../internals/export'); -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); var schedulersFix = require('../internals/schedulers-fix'); -var setInterval = schedulersFix(global.setInterval, true); +var setInterval = schedulersFix(globalThis.setInterval, true); // Bun / IE9- setInterval additional parameters fix // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-setinterval -$({ global: true, bind: true, forced: global.setInterval !== setInterval }, { +$({ global: true, bind: true, forced: globalThis.setInterval !== setInterval }, { setInterval: setInterval }); diff --git a/packages/core-js/modules/web.set-timeout.js b/packages/core-js/modules/web.set-timeout.js index ebc329bc510a..3b054ae37750 100644 --- a/packages/core-js/modules/web.set-timeout.js +++ b/packages/core-js/modules/web.set-timeout.js @@ -1,12 +1,12 @@ 'use strict'; var $ = require('../internals/export'); -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); var schedulersFix = require('../internals/schedulers-fix'); -var setTimeout = schedulersFix(global.setTimeout, true); +var setTimeout = schedulersFix(globalThis.setTimeout, true); // Bun / IE9- setTimeout additional parameters fix // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-settimeout -$({ global: true, bind: true, forced: global.setTimeout !== setTimeout }, { +$({ global: true, bind: true, forced: globalThis.setTimeout !== setTimeout }, { setTimeout: setTimeout }); diff --git a/packages/core-js/modules/web.structured-clone.js b/packages/core-js/modules/web.structured-clone.js index a1ec75619350..95ee571adebd 100644 --- a/packages/core-js/modules/web.structured-clone.js +++ b/packages/core-js/modules/web.structured-clone.js @@ -1,7 +1,7 @@ 'use strict'; var IS_PURE = require('../internals/is-pure'); var $ = require('../internals/export'); -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); var getBuiltIn = require('../internals/get-built-in'); var uncurryThis = require('../internals/function-uncurry-this'); var fails = require('../internals/fails'); @@ -27,12 +27,12 @@ var detachTransferable = require('../internals/detach-transferable'); var ERROR_STACK_INSTALLABLE = require('../internals/error-stack-installable'); var PROPER_STRUCTURED_CLONE_TRANSFER = require('../internals/structured-clone-proper-transfer'); -var Object = global.Object; -var Array = global.Array; -var Date = global.Date; -var Error = global.Error; -var TypeError = global.TypeError; -var PerformanceMark = global.PerformanceMark; +var Object = globalThis.Object; +var Array = globalThis.Array; +var Date = globalThis.Date; +var Error = globalThis.Error; +var TypeError = globalThis.TypeError; +var PerformanceMark = globalThis.PerformanceMark; var DOMException = getBuiltIn('DOMException'); var Map = MapHelpers.Map; var mapHas = MapHelpers.has; @@ -53,7 +53,7 @@ var TRANSFERRING = 'Transferring'; var checkBasicSemantic = function (structuredCloneImplementation) { return !fails(function () { - var set1 = new global.Set([7]); + var set1 = new globalThis.Set([7]); var set2 = structuredCloneImplementation(set1); var number = structuredCloneImplementation(Object(7)); return set2 === set1 || !set2.has(7) || !isObject(number) || +number !== 7; @@ -71,7 +71,7 @@ var checkErrorsCloning = function (structuredCloneImplementation, $Error) { // https://github.com/whatwg/html/pull/5749 var checkNewErrorsCloningSemantic = function (structuredCloneImplementation) { return !fails(function () { - var test = structuredCloneImplementation(new global.AggregateError([1], PERFORMANCE_MARK, { cause: 3 })); + var test = structuredCloneImplementation(new globalThis.AggregateError([1], PERFORMANCE_MARK, { cause: 3 })); return test.name !== 'AggregateError' || test.errors[0] !== 1 || test.message !== PERFORMANCE_MARK || test.cause !== 3; }); }; @@ -88,7 +88,7 @@ var checkNewErrorsCloningSemantic = function (structuredCloneImplementation) { // NodeJS implementation can't clone DOMExceptions // https://github.com/nodejs/node/issues/41038 // only FF103+ supports new (html/5749) error cloning semantic -var nativeStructuredClone = global.structuredClone; +var nativeStructuredClone = globalThis.structuredClone; var FORCED_REPLACEMENT = IS_PURE || !checkErrorsCloning(nativeStructuredClone, Error) @@ -128,10 +128,10 @@ var tryNativeRestrictedStructuredClone = function (value, type) { var createDataTransfer = function () { var dataTransfer; try { - dataTransfer = new global.DataTransfer(); + dataTransfer = new globalThis.DataTransfer(); } catch (error) { try { - dataTransfer = new global.ClipboardEvent('').clipboardData; + dataTransfer = new globalThis.ClipboardEvent('').clipboardData; } catch (error2) { /* empty */ } } return dataTransfer && dataTransfer.items && dataTransfer.files ? dataTransfer : null; @@ -148,7 +148,7 @@ var cloneBuffer = function (value, map, $type) { // SharedArrayBuffer should use shared memory, we can't polyfill it, so return the original else clone = value; } else { - var DataView = global.DataView; + var DataView = globalThis.DataView; // `ArrayBuffer#slice` is not available in IE10 // `ArrayBuffer#slice` and `DataView` are not available in old FF @@ -179,7 +179,7 @@ var cloneBuffer = function (value, map, $type) { }; var cloneView = function (value, type, offset, length, map) { - var C = global[type]; + var C = globalThis[type]; // in some old engines like Safari 9, typeof C is 'object' // on Uint8ClampedArray or some other constructors if (!isObject(C)) throwUnpolyfillable(type); @@ -334,7 +334,7 @@ var structuredCloneInternal = function (value, map) { } break; case 'DOMPoint': case 'DOMPointReadOnly': - C = global[type]; + C = globalThis[type]; try { cloned = C.fromPoint ? C.fromPoint(value) @@ -344,7 +344,7 @@ var structuredCloneInternal = function (value, map) { } break; case 'DOMRect': case 'DOMRectReadOnly': - C = global[type]; + C = globalThis[type]; try { cloned = C.fromRect ? C.fromRect(value) @@ -354,7 +354,7 @@ var structuredCloneInternal = function (value, map) { } break; case 'DOMMatrix': case 'DOMMatrixReadOnly': - C = global[type]; + C = globalThis[type]; try { cloned = C.fromMatrix ? C.fromMatrix(value) @@ -459,7 +459,7 @@ var tryToTransfer = function (rawTransfer, map) { transferred = nativeStructuredClone(value, { transfer: [value] }); } else switch (type) { case 'ImageBitmap': - C = global.OffscreenCanvas; + C = globalThis.OffscreenCanvas; if (!isConstructor(C)) throwUnpolyfillable(type, TRANSFERRING); try { canvas = new C(value.width, value.height); diff --git a/packages/core-js/modules/web.url-search-params.constructor.js b/packages/core-js/modules/web.url-search-params.constructor.js index 4498e5bc0f9f..e9e3af50d934 100644 --- a/packages/core-js/modules/web.url-search-params.constructor.js +++ b/packages/core-js/modules/web.url-search-params.constructor.js @@ -2,7 +2,7 @@ // TODO: in core-js@4, move /modules/ dependencies to public entries for better optimization by tools like `preset-env` require('../modules/es.array.iterator'); var $ = require('../internals/export'); -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); var safeGetBuiltIn = require('../internals/safe-get-built-in'); var call = require('../internals/function-call'); var uncurryThis = require('../internals/function-uncurry-this'); @@ -43,10 +43,10 @@ var NativeRequest = safeGetBuiltIn('Request'); var Headers = safeGetBuiltIn('Headers'); var RequestPrototype = NativeRequest && NativeRequest.prototype; var HeadersPrototype = Headers && Headers.prototype; -var RegExp = global.RegExp; -var TypeError = global.TypeError; -var decodeURIComponent = global.decodeURIComponent; -var encodeURIComponent = global.encodeURIComponent; +var RegExp = globalThis.RegExp; +var TypeError = globalThis.TypeError; +var decodeURIComponent = globalThis.decodeURIComponent; +var encodeURIComponent = globalThis.encodeURIComponent; var charAt = uncurryThis(''.charAt); var join = uncurryThis([].join); var push = uncurryThis([].push); diff --git a/packages/core-js/modules/web.url.constructor.js b/packages/core-js/modules/web.url.constructor.js index 90ec3dd726d9..2a31ff0afd5c 100644 --- a/packages/core-js/modules/web.url.constructor.js +++ b/packages/core-js/modules/web.url.constructor.js @@ -4,7 +4,7 @@ require('../modules/es.string.iterator'); var $ = require('../internals/export'); var DESCRIPTORS = require('../internals/descriptors'); var USE_NATIVE_URL = require('../internals/url-constructor-detection'); -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); var bind = require('../internals/function-bind-context'); var uncurryThis = require('../internals/function-uncurry-this'); var defineBuiltIn = require('../internals/define-built-in'); @@ -27,9 +27,9 @@ var getInternalURLState = InternalStateModule.getterFor('URL'); var URLSearchParams = URLSearchParamsModule.URLSearchParams; var getInternalSearchParamsState = URLSearchParamsModule.getState; -var NativeURL = global.URL; -var TypeError = global.TypeError; -var parseInt = global.parseInt; +var NativeURL = globalThis.URL; +var TypeError = globalThis.TypeError; +var parseInt = globalThis.parseInt; var floor = Math.floor; var pow = Math.pow; var charAt = uncurryThis(''.charAt); diff --git a/packages/core-js/proposals/global-this.js b/packages/core-js/proposals/global-this.js index 04421a45746b..aa3a21007473 100644 --- a/packages/core-js/proposals/global-this.js +++ b/packages/core-js/proposals/global-this.js @@ -1,6 +1,6 @@ 'use strict'; // https://github.com/tc39/proposal-global require('../modules/esnext.global-this'); -var global = require('../internals/global'); +var globalThis = require('../internals/global-this'); -module.exports = global; +module.exports = globalThis;