Skip to content

Commit

Permalink
Add back missing typed array polyfill for static methods
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolo-ribaudo committed Mar 8, 2024
1 parent 14e86a4 commit b84bd3d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
29 changes: 16 additions & 13 deletions packages/babel-plugin-polyfill-corejs3/src/built-in-definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,15 +211,16 @@ export const DecoratorMetadataDependencies = [
"esnext.function.metadata",
];

const TypedArrayStaticMethods = {
from: define(null, ["es.typed-array.from", ...TypedArrayDependencies]),
const TypedArrayStaticMethods = (base: string) => ({
from: define(null, ["es.typed-array.from", base, ...TypedArrayDependencies]),
fromAsync: define(null, [
"esnext.typed-array.from-async",
base,
...PromiseDependenciesWithIterators,
...TypedArrayDependencies,
]),
of: define(null, ["es.typed-array.of", ...TypedArrayDependencies]),
};
of: define(null, ["es.typed-array.of", base, ...TypedArrayDependencies]),
});

const DataViewDependencies = [
"es.data-view",
Expand Down Expand Up @@ -715,7 +716,7 @@ export const StaticProperties: ObjectMap2<CoreJSPolyfillDescriptor> = {
of: define(null, ["esnext.weak-set.of", ...WeakSetDependencies]),
},

Int8Array: TypedArrayStaticMethods,
Int8Array: TypedArrayStaticMethods("es.typed-array.int8-array"),
Uint8Array: {
fromBase64: define(null, [
"esnext.uint8-array.from-base64",
Expand All @@ -725,15 +726,17 @@ export const StaticProperties: ObjectMap2<CoreJSPolyfillDescriptor> = {
"esnext.uint8-array.from-hex",
...TypedArrayDependencies,
]),
...TypedArrayStaticMethods,
...TypedArrayStaticMethods("es.typed-array.uint8-array"),
},
Uint8ClampedArray: TypedArrayStaticMethods,
Int16Array: TypedArrayStaticMethods,
Uint16Array: TypedArrayStaticMethods,
Int32Array: TypedArrayStaticMethods,
Uint32Array: TypedArrayStaticMethods,
Float32Array: TypedArrayStaticMethods,
Float64Array: TypedArrayStaticMethods,
Uint8ClampedArray: TypedArrayStaticMethods(
"es.typed-array.uint8-clamped-array",
),
Int16Array: TypedArrayStaticMethods("es.typed-array.int16-array"),
Uint16Array: TypedArrayStaticMethods("es.typed-array.uint16-array"),
Int32Array: TypedArrayStaticMethods("es.typed-array.int32-array"),
Uint32Array: TypedArrayStaticMethods("es.typed-array.uint32-array"),
Float32Array: TypedArrayStaticMethods("es.typed-array.float32-array"),
Float64Array: TypedArrayStaticMethods("es.typed-array.float64-array"),

WebAssembly: {
CompileError: define(null, ErrorDependencies),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import "core-js/modules/es.symbol.js";
import "core-js/modules/es.symbol.description.js";
import "core-js/modules/es.symbol.match-all.js";
import "core-js/modules/es.error.cause.js";
import "core-js/modules/es.error.to-string.js";
Expand All @@ -19,7 +18,6 @@ import "core-js/modules/es.array-buffer.transfer.js";
import "core-js/modules/es.array-buffer.transfer-to-fixed-length.js";
import "core-js/modules/es.map.js";
import "core-js/modules/es.map.group-by.js";
import "core-js/modules/es.number.constructor.js";
import "core-js/modules/es.object.create.js";
import "core-js/modules/es.object.freeze.js";
import "core-js/modules/es.object.group-by.js";
Expand All @@ -28,11 +26,9 @@ import "core-js/modules/es.object.proto.js";
import "core-js/modules/es.object.to-string.js";
import "core-js/modules/es.promise.js";
import "core-js/modules/es.promise.with-resolvers.js";
import "core-js/modules/es.regexp.constructor.js";
import "core-js/modules/es.regexp.dot-all.js";
import "core-js/modules/es.regexp.exec.js";
import "core-js/modules/es.regexp.sticky.js";
import "core-js/modules/es.regexp.to-string.js";
import "core-js/modules/es.set.js";
import "core-js/modules/es.string.from-code-point.js";
import "core-js/modules/es.string.is-well-formed.js";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import "core-js/modules/es.array.iterator.js";
import "core-js/modules/es.array-buffer.slice.js";
import "core-js/modules/es.data-view.js";
import "core-js/modules/es.object.to-string.js";
import "core-js/modules/es.typed-array.int8-array.js";
import "core-js/modules/es.typed-array.copy-within.js";
import "core-js/modules/es.typed-array.every.js";
import "core-js/modules/es.typed-array.fill.js";
Expand Down

0 comments on commit b84bd3d

Please sign in to comment.