Add CoreJS polyfills to modern build (#20676)

pull/21126/head
Steve Repsher 2024-06-21 05:07:39 -04:00 committed by GitHub
parent 039e9b40bd
commit 686424fc70
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 2 additions and 34 deletions

View File

@ -92,8 +92,8 @@ module.exports.babelOptions = ({ latestBuild, isProdBuild, isTestBuild }) => ({
[
"@babel/preset-env",
{
useBuiltIns: latestBuild ? false : "usage",
corejs: latestBuild ? false : dependencies["core-js"],
useBuiltIns: "usage",
corejs: dependencies["core-js"],
bugfixes: true,
shippedProposals: true,
},

View File

@ -2,7 +2,6 @@
import "../resources/compatibility";
import "../auth/ha-authorize";
import "../resources/safari-14-attachshadow-patch";
import "../resources/array.flat.polyfill";
import("../resources/ha-style");
import("@polymer/polymer/lib/utils/settings").then(

View File

@ -25,7 +25,6 @@ import { subscribePanels } from "../data/ws-panels";
import { subscribeThemes } from "../data/ws-themes";
import { subscribeUser } from "../data/ws-user";
import type { ExternalAuth } from "../external_app/external_auth";
import "../resources/array.flat.polyfill";
import "../resources/safari-14-attachshadow-patch";
window.name = MAIN_WINDOW_NAME;

View File

@ -2,7 +2,6 @@
import "../resources/compatibility";
import "../onboarding/ha-onboarding";
import "../resources/safari-14-attachshadow-patch";
import "../resources/array.flat.polyfill";
import("../resources/ha-style");
import("@polymer/polymer/lib/utils/settings").then(

View File

@ -1,28 +0,0 @@
/* eslint-disable no-extend-native */
export {}; // for Babel to treat as a module
if (!Array.prototype.flat) {
Object.defineProperty(Array.prototype, "flat", {
configurable: true,
writable: true,
value: function (...args) {
const depth = typeof args[0] === "undefined" ? 1 : Number(args[0]) || 0;
const result = [];
const forEach = result.forEach;
const flatDeep = (arr: Array<any>, dpth: number) => {
forEach.call(arr, (val) => {
if (dpth > 0 && Array.isArray(val)) {
flatDeep(val, dpth - 1);
} else {
result.push(val);
}
});
};
flatDeep(this, depth);
return result;
},
});
}

View File

@ -1,4 +1,3 @@
import "core-js/modules/web.url.can-parse";
import { fromError } from "stacktrace-js";
import { UAParser } from "ua-parser-js";