Skip to content
TypeScript

chore(mobile): upgrade Uniwind to 1.13.0 (#22173)

Hubert Bieszczad1efe762be330
diff --git a/apps/mobile/package.json b/apps/mobile/package.json
index a20120edd4d..fdd83742516 100644
--- a/apps/mobile/package.json
+++ b/apps/mobile/package.json
@@ -143,7 +143,7 @@
"shiki": "4.2.0",
"tailwind-merge": "^3.5.0",
"unified": "catalog:",
- "uniwind": "1.12.1"
+ "uniwind": "1.13.0"
},
"devDependencies": {
"@babel/core": "^7.29.7",
diff --git a/apps/mobile/src/lib/uniwind-platform-variants.fixture.cjs b/apps/mobile/src/lib/uniwind-platform-variants.fixture.cjs
index 97fcdd08f99..3820585bcb5 100644
--- a/apps/mobile/src/lib/uniwind-platform-variants.fixture.cjs
+++ b/apps/mobile/src/lib/uniwind-platform-variants.fixture.cjs
@@ -99,18 +99,27 @@ async function main() {
const compiled = addMetaToStylesTemplate(processor, platform);
const payload = compileNativeCSS(bundlerConfig, tailwindCSS);
const styles = {};
+ // Compiled entries keep only their generated `matches` predicate; the
+ // conditions they were built from live on the processor's style metadata.
for (const [className, entries] of Object.entries(compiled)) {
- styles[className] = entries.map(
- ({ native, minWidth, maxWidth, active, focus, disabled, dataAttributes }) => ({
- native,
- minWidth,
- maxWidth,
- active: active ?? null,
- focus: focus ?? null,
- disabled: disabled ?? null,
- dataAttributes: dataAttributes ?? null,
- }),
- );
+ styles[className] = entries.map(({ index }) => {
+ const {
+ platform: guard,
+ conditions,
+ active,
+ focus,
+ disabled,
+ dataAttributes,
+ } = processor.stylesheets[className][index].meta;
+ return {
+ platform: guard,
+ responsive: conditions.some((condition) => condition.includes("rt.screen.width")),
+ active,
+ focus,
+ disabled,
+ dataAttributes,
+ };
+ });
}
platforms[platform] = {
styles,
diff --git a/apps/mobile/src/lib/uniwind-platform-variants.test.ts b/apps/mobile/src/lib/uniwind-platform-variants.test.ts
index e24fb5dae4c..6525f10c440 100644
--- a/apps/mobile/src/lib/uniwind-platform-variants.test.ts
+++ b/apps/mobile/src/lib/uniwind-platform-variants.test.ts
@@ -6,9 +6,8 @@ import * as NodeURL from "node:url";
import { beforeAll, describe, expect, it } from "vite-plus/test";
interface CompiledStyle {
- native: boolean;
- minWidth: number;
- maxWidth: number;
+ platform: string | null;
+ responsive: boolean;
active: boolean | null;
focus: boolean | null;
disabled: boolean | null;
@@ -101,7 +100,9 @@ describe("uniwind platform variants compile per platform", () => {
`android has ${className}`,
).toBeUndefined();
expect(output.platforms.ios?.styles[className], `ios lacks ${className}`).toBeDefined();
- expect(output.platforms.ios?.styles[className]?.every((style) => style.native)).toBe(true);
+ expect(
+ output.platforms.ios?.styles[className]?.every((style) => style.platform === "ios"),
+ ).toBe(true);
}
});
@@ -112,9 +113,9 @@ describe("uniwind platform variants compile per platform", () => {
output.platforms.android?.styles[className],
`android lacks ${className}`,
).toBeDefined();
- expect(output.platforms.android?.styles[className]?.every((style) => style.native)).toBe(
- true,
- );
+ expect(
+ output.platforms.android?.styles[className]?.every((style) => style.platform === "android"),
+ ).toBe(true);
}
});
@@ -123,13 +124,13 @@ describe("uniwind platform variants compile per platform", () => {
for (const platform of ["ios", "android"]) {
const styles = output.platforms[platform]?.styles[className];
expect(styles, `${platform} lacks ${className}`).toBeDefined();
- expect(styles?.every((style) => !style.native)).toBe(true);
+ expect(styles?.every((style) => style.platform === null)).toBe(true);
}
}
for (const platform of ["ios", "android"]) {
for (const className of RESPONSIVE_CLASSES) {
const style = output.platforms[platform]?.styles[className]?.at(-1);
- expect(style?.minWidth, `${className} lost its breakpoint`).toBeGreaterThan(0);
+ expect(style?.responsive, `${className} lost its breakpoint`).toBe(true);
}
}
});
@@ -174,19 +175,19 @@ describe("uniwind keeps media rules nested inside class rules attached to the cl
for (const platform of ["ios", "android"]) {
const entries = nested.platforms[platform]?.styles["container-x"];
expect(entries, `${platform} lacks container-x`).toBeDefined();
- expect(entries?.some((style) => !style.native && style.minWidth === 0)).toBe(true);
- expect(entries?.some((style) => !style.native && style.minWidth > 0)).toBe(true);
+ expect(entries?.some((style) => style.platform === null && !style.responsive)).toBe(true);
+ expect(entries?.some((style) => style.platform === null && style.responsive)).toBe(true);
}
});
it("keeps @variant declarations inside @utility on their platform", () => {
const iosEntries = nested.platforms.ios?.styles["foo-x"];
- expect(iosEntries?.some((style) => !style.native)).toBe(true);
- expect(iosEntries?.some((style) => style.native)).toBe(true);
+ expect(iosEntries?.some((style) => style.platform === null)).toBe(true);
+ expect(iosEntries?.some((style) => style.platform === "ios")).toBe(true);
const androidEntries = nested.platforms.android?.styles["foo-x"];
- expect(androidEntries?.some((style) => !style.native)).toBe(true);
- expect(androidEntries?.some((style) => style.native)).toBe(false);
+ expect(androidEntries?.some((style) => style.platform === null)).toBe(true);
+ expect(androidEntries?.some((style) => style.platform !== null)).toBe(false);
});
});
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index c3558921ab6..a97274d8554 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -621,8 +621,8 @@ importers:
specifier: 'catalog:'
version: 11.0.5
uniwind:
- specifier: 1.12.1
+ specifier: 1.13.0
devDependencies:
'@babel/core':
specifier: ^7.29.7
@@ -12177,8 +12177,8 @@ packages:
resolution: {integrity: sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==}
engines: {node: '>= 10.0.0'}
- resolution: {integrity: sha512-u0OVMVqefGchOpsPIwIYvcF2Jl9JtVVaXBb+wfqAYoyLrhN27Ll50aQ7aFT81k73JSq+He6dNlcbTl2Qb9cTMw==}
+ resolution: {integrity: sha512-kr9mFYQIUmYlyV6Pm663EsE9UVJSRZM1XYOwQ8BVUpRIhfKw6dOoqqZCFzCj9PqVIcVXY16J702C8rFmUjNR6Q==}
hasBin: true
peerDependencies:
'@expo/metro-config': 58.0.14
@@ -16843,7 +16843,7 @@ snapshots:
jiti: 2.7.0
lightningcss: 1.33.0
magic-string: 0.30.21
- source-map-js: 1.2.1
+ source-map-js: 1.2.2
tailwindcss: 4.3.3
'@tailwindcss/[email protected]':
@@ -18910,7 +18910,7 @@ snapshots:
dependencies:
mdn-data: 2.0.28
- source-map-js: 1.2.1
+ source-map-js: 1.2.2
dependencies:
@@ -23771,7 +23771,7 @@ snapshots:
dependencies:
'@tailwindcss/node': 4.3.3
'@tailwindcss/oxide': 4.3.3
diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml
index 12ec4bc1b6e..96fe658e8a3 100644
--- a/pnpm-workspace.yaml
+++ b/pnpm-workspace.yaml
@@ -165,7 +165,7 @@ minimumReleaseAgeExclude:
- "@distilled.cloud/[email protected]"
- "@shadcn/[email protected]"