mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-23 17:26:42 +00:00
Add CoreJS polyfills to modern build (#20676)
This commit is contained in:
parent
039e9b40bd
commit
686424fc70
@ -92,8 +92,8 @@ module.exports.babelOptions = ({ latestBuild, isProdBuild, isTestBuild }) => ({
|
|||||||
[
|
[
|
||||||
"@babel/preset-env",
|
"@babel/preset-env",
|
||||||
{
|
{
|
||||||
useBuiltIns: latestBuild ? false : "usage",
|
useBuiltIns: "usage",
|
||||||
corejs: latestBuild ? false : dependencies["core-js"],
|
corejs: dependencies["core-js"],
|
||||||
bugfixes: true,
|
bugfixes: true,
|
||||||
shippedProposals: true,
|
shippedProposals: true,
|
||||||
},
|
},
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
import "../resources/compatibility";
|
import "../resources/compatibility";
|
||||||
import "../auth/ha-authorize";
|
import "../auth/ha-authorize";
|
||||||
import "../resources/safari-14-attachshadow-patch";
|
import "../resources/safari-14-attachshadow-patch";
|
||||||
import "../resources/array.flat.polyfill";
|
|
||||||
|
|
||||||
import("../resources/ha-style");
|
import("../resources/ha-style");
|
||||||
import("@polymer/polymer/lib/utils/settings").then(
|
import("@polymer/polymer/lib/utils/settings").then(
|
||||||
|
@ -25,7 +25,6 @@ import { subscribePanels } from "../data/ws-panels";
|
|||||||
import { subscribeThemes } from "../data/ws-themes";
|
import { subscribeThemes } from "../data/ws-themes";
|
||||||
import { subscribeUser } from "../data/ws-user";
|
import { subscribeUser } from "../data/ws-user";
|
||||||
import type { ExternalAuth } from "../external_app/external_auth";
|
import type { ExternalAuth } from "../external_app/external_auth";
|
||||||
import "../resources/array.flat.polyfill";
|
|
||||||
import "../resources/safari-14-attachshadow-patch";
|
import "../resources/safari-14-attachshadow-patch";
|
||||||
|
|
||||||
window.name = MAIN_WINDOW_NAME;
|
window.name = MAIN_WINDOW_NAME;
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
import "../resources/compatibility";
|
import "../resources/compatibility";
|
||||||
import "../onboarding/ha-onboarding";
|
import "../onboarding/ha-onboarding";
|
||||||
import "../resources/safari-14-attachshadow-patch";
|
import "../resources/safari-14-attachshadow-patch";
|
||||||
import "../resources/array.flat.polyfill";
|
|
||||||
|
|
||||||
import("../resources/ha-style");
|
import("../resources/ha-style");
|
||||||
import("@polymer/polymer/lib/utils/settings").then(
|
import("@polymer/polymer/lib/utils/settings").then(
|
||||||
|
@ -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;
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
@ -1,4 +1,3 @@
|
|||||||
import "core-js/modules/web.url.can-parse";
|
|
||||||
import { fromError } from "stacktrace-js";
|
import { fromError } from "stacktrace-js";
|
||||||
import { UAParser } from "ua-parser-js";
|
import { UAParser } from "ua-parser-js";
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user