Compare commits

..
8 changed files with 64 additions and 119 deletions
+39 -23
View File
@@ -1,36 +1,52 @@
[modern]
# Modern builds target recent browsers supporting the latest features to minimize transpilation, polyfills, etc.
# It is served to browsers meeting the following requirements:
# - released in the last year + current alpha/beta versions
# - Firefox extended support release (ESR)
# - with global utilization at or above 0.5%
# - released in the last 2 years + current alpha/beta versions
# - exclude dead browsers (no security maintenance for 2+ years)
# - exclude KaiOS, QQ, and UC browsers due to lack of sufficient feature support data
unreleased versions
last 1 year
Firefox ESR
>= 0.5%
last 2 years
not dead
not KaiOS > 0
not QQAndroid > 0
not UCAndroid > 0
[legacy]
# Legacy builds are served when modern requirements are not met and support browsers:
# - released in the last 7 years + current alpha/beta versionss
# - with global utilization at or above 0.05%
# - exclude dead browsers (no security maintenance for 2+ years)
# - exclude Opera Mini which does not support web sockets
unreleased versions
last 7 years
>= 0.05%
not dead
not op_mini all
# Legacy builds are served when modern requirements are not met.
# Floors are pinned explicitly (not usage-based) so the support policy is
# deliberate and does not drift with global usage statistics, which do not
# represent old tablets and wall displays used as Home Assistant dashboards:
# - iOS/Safari >= 12: iPad Air 1 / mini 2 / mini 3 (last supported iOS).
# Older iPads (iPad 2/3/mini 1 on iOS 9.3, iPad 4 on iOS 10.3) cannot run
# the app: their engines lack custom elements, shadow DOM, and/or CSS grid.
# - Chrome >= 59: Fire OS 5 tablets (Fire 7/HD 8/HD 10 through ~2017) have
# their system WebView pinned at Chromium 59 and commonly run Fully Kiosk;
# also covers old kiosk browsers and no-longer-updating webviews above it.
# - Edge >= 79: all Chromium-based Edge. Costs nothing (above the Chrome
# floor); mainly catches Edge 109 on Windows 7/8.1 and update-frozen
# enterprise installs, whose engines can run the legacy build fine.
# - Firefox >= 94: the zero-cost floor, not a chased population — pinning it
# adds no babel transforms, core-js modules, or Lightning CSS prefixes to
# the output. Mozilla-supported Firefox (incl. current ESR) always matches
# [modern]; Firefox on old OSes is not supported (use Chrome 109 instead).
# If Firefox ever becomes the pin forcing extra output, raise it first.
# - Samsung >= 9: Samsung Internet on old Galaxy tablets
Chrome >= 59
ChromeAndroid >= 59
Edge >= 79
Firefox >= 94
FirefoxAndroid >= 94
iOS >= 12
Safari >= 12
Samsung >= 9
[legacy-sw]
# Same as legacy plus supports service workers
unreleased versions
last 7 years
>= 0.05% and supports serviceworkers
not dead
not op_mini all
# Same as legacy, restricted to browsers that support service workers
# (currently resolves to the same set; guards the service worker build if the legacy floor ever drops below them)
Chrome >= 59 and supports serviceworkers
ChromeAndroid >= 59 and supports serviceworkers
Edge >= 79 and supports serviceworkers
Firefox >= 94 and supports serviceworkers
FirefoxAndroid >= 94 and supports serviceworkers
iOS >= 12 and supports serviceworkers
Safari >= 12 and supports serviceworkers
Samsung >= 9 and supports serviceworkers
+8 -8
View File
@@ -1,15 +1,15 @@
{
"_comment": "Initial JS budget (raw/uncompressed bytes) for the cold-load critical entrypoints. Enforced by build-scripts/check-bundle-size.cjs in CI. Re-seed after an intentional change with `--update --headroom=<percent>`.",
"frontend-modern": {
"app": 585518,
"core": 57048,
"authorize": 552423,
"onboarding": 666818
"app": 576583,
"core": 54790,
"authorize": 543547,
"onboarding": 655556
},
"frontend-legacy": {
"app": 887384,
"core": 244482,
"authorize": 844995,
"onboarding": 1008816
"app": 717124,
"core": 181583,
"authorize": 699175,
"onboarding": 816133
}
}
+4 -2
View File
@@ -63,8 +63,10 @@ module.exports.htmlMinifierOptions = {
};
module.exports.terserOptions = ({ latestBuild, isTestBuild }) => ({
safari10: !latestBuild,
ecma: latestBuild ? 2015 : 5,
// Highest syntax the minifier may emit; it never downlevels. Every browser
// in [modern] is well past ES2020 (universal since spring 2020); the
// [legacy] floors (Chrome 59 / Safari 12) top out at ES2017.
ecma: latestBuild ? 2020 : 2017,
module: latestBuild,
format: { comments: false },
sourceMap: !isTestBuild,
+2
View File
@@ -172,6 +172,7 @@
"@vitest/coverage-v8": "4.1.10",
"babel-loader": "10.1.1",
"babel-plugin-polyfill-corejs3": "1.0.0",
"browserslist": "4.28.6",
"browserslist-useragent-regexp": "4.1.4",
"del": "8.0.1",
"eslint": "10.8.1",
@@ -195,6 +196,7 @@
"jsdom": "30.0.1",
"jszip": "3.10.1",
"license-checker-rseidelsohn": "5.0.1",
"lightningcss": "1.32.0",
"lint-staged": "17.3.0",
"lit-analyzer": "2.0.3",
"lodash.merge": "4.6.2",
+1 -10
View File
@@ -1135,10 +1135,6 @@ export const resolveEntityIDs = (
expanded.areas.forEach((id) => targetAreas.add(id));
});
// Devices only reached through an area do not pull in entities that are
// explicitly assigned to another area, matching core.
const devicesNotViaArea = new Set(targetDevices);
targetAreas.forEach((areaId) => {
const expanded = expandAreaTarget(
hass,
@@ -1157,7 +1153,6 @@ export const resolveEntityIDs = (
Object.values(devices).forEach((device) => {
if (device.parent_device_id && directDevices.has(device.parent_device_id)) {
targetDevices.add(device.id);
devicesNotViaArea.add(device.id);
}
});
@@ -1168,11 +1163,7 @@ export const resolveEntityIDs = (
entities,
targetSelector
);
expanded.entities.forEach((id) => {
if (devicesNotViaArea.has(deviceId) || !entities[id]?.area_id) {
targetEntities.add(id);
}
});
expanded.entities.forEach((id) => targetEntities.add(id));
});
return Array.from(targetEntities);
@@ -291,17 +291,11 @@ export const showRepairsFlowDialog = (
},
renderMenuOption(hass, step, option) {
return (
hass.localize(
`component.${issue.domain}.issues.${
issue.translation_key || issue.issue_id
}.fix_flow.step.${step.step_id}.menu_options.${option}`,
mergePlaceholders(issue, step)
) ||
// Newer backends can offer options this frontend has no
// translation for yet — show the raw option key instead of
// an empty menu entry
option
return hass.localize(
`component.${issue.domain}.issues.${
issue.translation_key || issue.issue_id
}.fix_flow.step.${step.step_id}.menu_options.${option}`,
mergePlaceholders(issue, step)
);
},
+1 -63
View File
@@ -1,10 +1,7 @@
import type { HassEntity } from "home-assistant-js-websocket";
import { describe, expect, it } from "vitest";
import type { DeviceRegistryEntry } from "../../src/data/device/device_registry";
import {
filterSelectorEntities,
resolveEntityIDs,
} from "../../src/data/selector";
import { filterSelectorEntities } from "../../src/data/selector";
import type { HomeAssistant } from "../../src/types";
const entity = {
@@ -135,62 +132,3 @@ describe("filterSelectorEntities device filter", () => {
).toBe(false);
});
});
describe("resolveEntityIDs", () => {
const areaHass = {
states: {
"light.kitchen": { entity_id: "light.kitchen", state: "on" },
"sensor.kitchen_hub_temp": {
entity_id: "sensor.kitchen_hub_temp",
state: "20",
},
"sensor.hallway_probe": { entity_id: "sensor.hallway_probe", state: "5" },
},
entities: {
"light.kitchen": { entity_id: "light.kitchen", device_id: "hub" },
"sensor.kitchen_hub_temp": {
entity_id: "sensor.kitchen_hub_temp",
device_id: "hub",
},
"sensor.hallway_probe": {
entity_id: "sensor.hallway_probe",
device_id: "hub",
area_id: "hallway",
},
},
devices: { hub: { id: "hub", area_id: "kitchen" } },
areas: { kitchen: { area_id: "kitchen" }, hallway: { area_id: "hallway" } },
} as unknown as HomeAssistant;
const resolve = (target) =>
resolveEntityIDs(
areaHass,
target,
areaHass.entities,
areaHass.devices,
areaHass.areas
).sort();
it("skips entities of an area device that are assigned to another area", () => {
expect(resolve({ area_id: "kitchen" })).toEqual([
"light.kitchen",
"sensor.kitchen_hub_temp",
]);
});
it("keeps every entity of a directly targeted device", () => {
expect(resolve({ device_id: "hub" })).toEqual([
"light.kitchen",
"sensor.hallway_probe",
"sensor.kitchen_hub_temp",
]);
});
it("keeps the entity when its own area is targeted as well", () => {
expect(resolve({ area_id: ["kitchen", "hallway"] })).toEqual([
"light.kitchen",
"sensor.hallway_probe",
"sensor.kitchen_hub_temp",
]);
});
});
+4 -2
View File
@@ -7317,7 +7317,7 @@ __metadata:
languageName: node
linkType: hard
"browserslist@npm:^4.24.0, browserslist@npm:^4.28.1, browserslist@npm:^4.28.2":
"browserslist@npm:4.28.6, browserslist@npm:^4.24.0, browserslist@npm:^4.28.1, browserslist@npm:^4.28.2":
version: 4.28.6
resolution: "browserslist@npm:4.28.6"
dependencies:
@@ -9985,6 +9985,7 @@ __metadata:
babel-loader: "npm:10.1.1"
babel-plugin-polyfill-corejs3: "npm:1.0.0"
barcode-detector: "npm:3.2.1"
browserslist: "npm:4.28.6"
browserslist-useragent-regexp: "npm:4.1.4"
cally: "npm:0.9.2"
color-name: "npm:2.1.1"
@@ -10029,6 +10030,7 @@ __metadata:
leaflet-draw: "patch:leaflet-draw@npm%3A1.0.4#./.yarn/patches/leaflet-draw-npm-1.0.4-0ca0ebcf65.patch"
leaflet.markercluster: "npm:1.5.3"
license-checker-rseidelsohn: "npm:5.0.1"
lightningcss: "npm:1.32.0"
lint-staged: "npm:17.3.0"
lit: "npm:3.3.3"
lit-analyzer: "npm:2.0.3"
@@ -11365,7 +11367,7 @@ __metadata:
languageName: node
linkType: hard
"lightningcss@npm:^1.32.0":
"lightningcss@npm:1.32.0, lightningcss@npm:^1.32.0":
version: 1.32.0
resolution: "lightningcss@npm:1.32.0"
dependencies: