Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions src/__tests__/compiler/@prop.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import { render, screen } from "@testing-library/react-native";
import { compile } from "react-native-css/compiler";
import { View } from "react-native-css/components";
import { registerCSS, testID } from "react-native-css/jest";
import {
compileWithAutoDebug,
registerCSS,
testID,
} from "react-native-css/jest";

test("@prop target (nested @media)", () => {
const compiled = registerCSS(`
Expand Down Expand Up @@ -222,10 +226,10 @@ test("@prop value: wildcard nested target", () => {
});

test("@prop multiple", () => {
const compiled = compile(`
const compiled = compileWithAutoDebug(`
.test {
color: red;
background-color: blue;
background-color: oklab(40.1% 0.1143 0.045);
@prop {
background-color: *.myBackgroundColor;
color: *.myColor;
Expand All @@ -241,7 +245,7 @@ test("@prop multiple", () => {
{
d: [
{
myBackgroundColor: "#00f",
myBackgroundColor: "#7d2429",
myColor: "#f00",
},
],
Expand Down
5 changes: 4 additions & 1 deletion src/compiler/compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { inspect } from "node:util";

import { debug } from "debug";
import {
Features,
transform as lightningcss,
type ContainerRule,
type MediaQuery as CSSMediaQuery,
Expand Down Expand Up @@ -65,6 +66,8 @@ export function compile(code: Buffer | string, options: CompilerOptions = {}) {
*/
const { code: firstPass } = lightningcss({
code: typeof code === "string" ? new TextEncoder().encode(code) : code,
include: Features.DoublePositionGradients | Features.ColorFunction,
exclude: Features.VendorPrefixes,
visitor: {
Length(length) {
if (length.unit !== "rem" || options.inlineRem === false) {
Expand All @@ -84,7 +87,7 @@ export function compile(code: Buffer | string, options: CompilerOptions = {}) {
if (isLoggerEnabled) {
const MAX_LOG_SIZE = 100 * 1024; // 100KB
if (firstPass.length <= MAX_LOG_SIZE) {
logger(firstPass.toString());
console.log(firstPass.toString());
Copy link

Copilot AI Sep 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using console.log instead of the existing logger violates the established logging pattern. This change removes the conditional logging behavior and may cause unwanted output in production. Revert to using logger(firstPass.toString()).

Suggested change
console.log(firstPass.toString());
logger(firstPass.toString());

Copilot uses AI. Check for mistakes.
} else {
logger(
`firstPass buffer too large to log in full (${firstPass.length} bytes). Preview: ` +
Expand Down