Skip to content

Commit 543367b

Browse files
Align the browser-support floor with classroom and ml-trainer
Raises Safari/iOS from 14/14 to 14.1/14.5, which is a correctness fix rather than a tidy-up: flexbox `gap` landed in exactly those two versions, and this app's layout is built on the Panda stack patterns, which are gap-based. The built CSS has 18 gap declarations against 24 display:flex, so on Safari 14.0 or iOS 14.0–14.4 that spacing collapses to zero — nothing can polyfill it. The floor claimed support the layout could not honour, and no device is stranded there anyway: Safari 14.1 shipped for the same macOS range as 14.0, and every iOS 14.0 device can reach 14.5. Chrome/Edge come down from 98 to 90 to match the other two apps. The 98 was not load-bearing: it arrived wholesale in the CRA→Vite switch (4425d16), replacing CRA's usage-share default, with no stated reason, and Chrome 98 predates that commit by two years. Nothing in src uses a Chrome 91–98 era API — no structuredClone, .at(), findLast, Object.hasOwn or error.cause; the only modern method is replaceAll, which is Chrome 85. The device-connection code lives in a dependency and feature-detects, so it was never governed by this floor. The two lists also disagreed with each other, which is what let them drift: browserslist entries are OR'd, so with no explicit Firefox entry `defaults` supplied Firefox 140 while the build targeted firefox104, and the Vite switch had dropped CRA's `not op_mini all` / `not ie >0`, leaving Opera Mini and KaiOS in the resolved set. There is now one BUILD_TARGETS const mirrored into build.target and build.cssTarget, with browserslist as documentation pointing at it — the same shape as the other two apps. Deliberately not aligned: cssMinify stays esbuild rather than lightningcss. That is a rendering change, not a support declaration — lightningcss rewrites logical border-radius longhands into fragile :lang()-based physical rules — and this app's PostCSS chain is documented around the current choice. Verified: typecheck, lint, production build, and the production CSS still has its logical shorthands expanded (421 longhands, no var()-bearing shorthands), its layers flattened, and its 18 gap rules intact.
1 parent 7dfc8b6 commit 543367b

3 files changed

Lines changed: 33 additions & 22 deletions

File tree

package.json

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -114,19 +114,13 @@
114114
"typecheck": "tsc --noEmit",
115115
"typecheck:watch": "tsc --noEmit --watch"
116116
},
117-
"browserslist": {
118-
"production": [
119-
"defaults",
120-
"Chrome >= 98",
121-
"Edge >= 98",
122-
"ChromeAndroid >= 95",
123-
"Safari >= 14",
124-
"iOS >= 14"
125-
],
126-
"development": [
127-
"last 1 chrome version",
128-
"last 1 firefox version",
129-
"last 1 safari version"
130-
]
131-
}
117+
"//browserslist": "Keep in sync with BUILD_TARGETS in vite.config.ts, which is what the build actually uses.",
118+
"browserslist": [
119+
"safari >= 14.1",
120+
"ios_saf >= 14.5",
121+
"chrome >= 90",
122+
"edge >= 90",
123+
"firefox >= 88",
124+
"not dead"
125+
]
132126
}

postcss.config.cjs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,11 @@
66
* PostCSS runs because vite.config.ts keeps Vite's default CSS transformer
77
* (not lightningcss, which would disable PostCSS).
88
*
9-
* This app targets Safari/iOS 14 (see package.json "browserslist"), below the
10-
* 15.4 floor where Panda's output works natively, so two TEMPORARY downleveling
11-
* plugins run in PRODUCTION builds only (dev browsers are modern, and the
12-
* flattened @layer output makes devtools tracing painful). Drop both — and
13-
* raise the vite.config.ts build target — once support rises past those
14-
* browsers.
9+
* This app targets Safari 14.1 / iOS 14.5 (BUILD_TARGETS in vite.config.ts),
10+
* below the 15.4 floor where Panda's output works natively, so two TEMPORARY
11+
* downleveling plugins run in PRODUCTION builds only (dev browsers are modern,
12+
* and the flattened @layer output makes devtools tracing painful). Drop both —
13+
* and raise BUILD_TARGETS — once support rises past those browsers.
1514
*
1615
* 1. expandLogicalShorthands (@microbit/ui/postcss-legacy-safari) — Safari 14.x
1716
* silently drops logical *shorthands* whose value contains var()

vite.config.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,23 @@ import { VitePWA } from "vite-plugin-pwa";
1212
import svgr from "vite-plugin-svgr";
1313
import { configDefaults, defineConfig, UserConfig } from "vitest/config";
1414

15+
// Browser-support floor (esbuild/lightningcss target syntax) for JS
16+
// (build.target) and CSS (build.cssTarget). Keep in sync with the
17+
// "browserslist" field in package.json, which is documentation — this is what
18+
// the build actually uses.
19+
//
20+
// safari14.1/ios14.5 rather than 14/14 is deliberate: flexbox `gap` landed in
21+
// exactly those versions, and the Panda stack patterns this app is built on
22+
// depend on it. See postcss.config.cjs for the two Safari <15.4 fixes that go
23+
// with this floor.
24+
const BUILD_TARGETS = [
25+
"chrome90",
26+
"edge90",
27+
"firefox88",
28+
"safari14.1",
29+
"ios14.5",
30+
];
31+
1532
// Support optionally pulling in external branding if the module is installed.
1633
const theme = "@microbit-foundation/python-editor-v3-microbit";
1734
const external = `node_modules/${theme}`;
@@ -88,7 +105,8 @@ export default defineConfig(({ mode }) => {
88105
build: {
89106
outDir: "build",
90107
sourcemap: true,
91-
target: ["chrome98", "edge98", "safari14", "ios14", "firefox104"],
108+
target: BUILD_TARGETS,
109+
cssTarget: BUILD_TARGETS,
92110
},
93111
server: {
94112
port: 3000,

0 commit comments

Comments
 (0)