Skip to content

Commit 94f7cc6

Browse files
committed
fix: improve public exports
1 parent 8c2d0a1 commit 94f7cc6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+963
-1445
lines changed

example/metro.config.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const path = require("path");
22
const { getDefaultConfig } = require("@expo/metro-config");
3-
const { withReactNativeCSS } = require("../dist/commonjs/metro");
3+
const { withReactNativeCSS } = require("react-native-css/metro");
44

55
/**
66
* Metro configuration
@@ -12,10 +12,6 @@ const config = getDefaultConfig(__dirname);
1212

1313
config.resolver.unstable_enablePackageExports = true;
1414

15-
config.resolver.extraNodeModules = {
16-
"react-native-css": path.resolve(__dirname, "../"),
17-
};
18-
1915
config.resolver.nodeModulesPaths = [
2016
path.resolve(__dirname, "node_modules"),
2117
path.resolve(__dirname, "../node_modules"),

example/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"react": "19.1.0",
2121
"react-dom": "19.1.0",
2222
"react-native": "0.81.1",
23+
"react-native-css": "link:../",
2324
"react-native-reanimated": "4.0.2",
2425
"react-native-web": "~0.21.1",
2526
"react-native-worklets": "0.4.1",

example/src/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export default function App() {
1515
"--custom": "pink",
1616
}}
1717
>
18-
<View className="bg-[var(--custom,purple)] w-10 h-10" />
18+
<View className="bg-[var(--custom,green)] w-10 h-10" />
1919

2020
<CustomView className="bg-[var(--custom,purple)] w-10 h-10" />
2121
</VariableContextProvider>

package.json

Lines changed: 73 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -14,31 +14,6 @@
1414
"default": "./dist/commonjs/index.js"
1515
}
1616
},
17-
"./types": {
18-
"types": "./types.d.ts"
19-
},
20-
"./style-collection": {
21-
"source": "./src/runtime/native/style-collection/index.ts",
22-
"import": {
23-
"types": "./dist/typescript/module/src/style-collection/index.d.ts",
24-
"default": "./dist/module/style-collection/index.js"
25-
},
26-
"require": {
27-
"types": "./dist/typescript/commonjs/src/style-collection/index.d.ts",
28-
"default": "./dist/commonjs/style-collection/index.js"
29-
}
30-
},
31-
"./metro": {
32-
"source": "./src/metro/index.ts",
33-
"import": {
34-
"types": "./dist/typescript/module/src/metro/index.d.ts",
35-
"default": "./dist/module/metro/index.js"
36-
},
37-
"require": {
38-
"types": "./dist/typescript/commonjs/src/metro/index.d.ts",
39-
"default": "./dist/commonjs/metro/index.js"
40-
}
41-
},
4217
"./compiler": {
4318
"source": "./src/compiler/index.ts",
4419
"import": {
@@ -50,18 +25,6 @@
5025
"default": "./dist/commonjs/compiler/index.js"
5126
}
5227
},
53-
"./jest": {
54-
"source": "./src/jest/index.ts",
55-
"react-native": "./src/jest/index.ts",
56-
"import": {
57-
"types": "./dist/typescript/module/src/jest/index.d.ts",
58-
"default": "./dist/module/jest/index.js"
59-
},
60-
"require": {
61-
"types": "./dist/typescript/commonjs/src/jest/index.d.ts",
62-
"default": "./dist/commonjs/jest/index.js"
63-
}
64-
},
6528
"./babel": {
6629
"source": "./src/babel/index.ts",
6730
"import": {
@@ -97,14 +60,85 @@
9760
"default": "./dist/commonjs/components/*.js"
9861
}
9962
},
100-
"./package.json": "./package.json"
63+
"./jest": {
64+
"source": "./src/jest/index.ts",
65+
"react-native": "./src/jest/index.ts",
66+
"import": {
67+
"types": "./dist/typescript/module/src/jest/index.d.ts",
68+
"default": "./dist/module/jest/index.js"
69+
},
70+
"require": {
71+
"types": "./dist/typescript/commonjs/src/jest/index.d.ts",
72+
"default": "./dist/commonjs/jest/index.js"
73+
}
74+
},
75+
"./metro": {
76+
"source": "./src/metro/index.ts",
77+
"import": {
78+
"types": "./dist/typescript/module/src/metro/index.d.ts",
79+
"default": "./dist/module/metro/index.js"
80+
},
81+
"require": {
82+
"types": "./dist/typescript/commonjs/src/metro/index.d.ts",
83+
"default": "./dist/commonjs/metro/index.js"
84+
}
85+
},
86+
"./native": {
87+
"source": "./src/native/index.ts",
88+
"import": {
89+
"types": "./dist/typescript/module/src/native/index.d.ts",
90+
"default": "./dist/module/native/index.js"
91+
},
92+
"require": {
93+
"types": "./dist/typescript/commonjs/src/native/index.d.ts",
94+
"default": "./dist/commonjs/native/index.js"
95+
}
96+
},
97+
"./package.json": "./package.json",
98+
"./style-collection": {
99+
"source": "./src/runtime/native/style-collection/index.ts",
100+
"import": {
101+
"types": "./dist/typescript/module/src/style-collection/index.d.ts",
102+
"default": "./dist/module/style-collection/index.js"
103+
},
104+
"require": {
105+
"types": "./dist/typescript/commonjs/src/style-collection/index.d.ts",
106+
"default": "./dist/commonjs/style-collection/index.js"
107+
}
108+
},
109+
"./types": {
110+
"types": "./types.d.ts"
111+
},
112+
"./utilities": {
113+
"source": "./src/utilities/index.ts",
114+
"import": {
115+
"types": "./dist/typescript/module/src/utilities/index.d.ts",
116+
"default": "./dist/module/utilities/index.js"
117+
},
118+
"require": {
119+
"types": "./dist/typescript/commonjs/src/utilities/index.d.ts",
120+
"default": "./dist/commonjs/utilities/index.js"
121+
}
122+
},
123+
"./web": {
124+
"source": "./src/web/index.ts",
125+
"import": {
126+
"types": "./dist/typescript/module/src/web/index.d.ts",
127+
"default": "./dist/module/web/index.js"
128+
},
129+
"require": {
130+
"types": "./dist/typescript/commonjs/src/web/index.d.ts",
131+
"default": "./dist/commonjs/web/index.js"
132+
}
133+
}
101134
},
102135
"main": "./dist/commonjs/index.js",
103136
"module": "./dist/module/index.js",
104137
"types": "./dist/typescript/commonjs/src/index.d.ts",
105138
"workspaces": [
106139
"example",
107-
"configs"
140+
"configs",
141+
"."
108142
],
109143
"scripts": {
110144
"build": "bob build",

src/__tests__/native/keywords.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { View } from "react-native";
22

33
import { renderHook } from "@testing-library/react-native";
44
import { registerCSS } from "react-native-css/jest";
5-
import { useNativeCss } from "react-native-css/runtime/native";
5+
import { useNativeCss } from "react-native-css/native";
66

77
test("unset", () => {
88
registerCSS(`.my-class { background-color: unset; }`);

src/__tests__/native/media-query.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { View } from "react-native-css/components/View";
55
import { registerCSS, testID } from "react-native-css/jest";
66
import { colorScheme } from "react-native-css/runtime";
77

8-
import { dimensions } from "../../runtime/native/reactivity";
8+
import { dimensions } from "../../native/reactivity";
99

1010
jest.mock("react-native", () => {
1111
const RN = jest.requireActual("react-native");

src/__tests__/native/units.test.tsx

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,11 @@ import { View } from "react-native";
22

33
import { act, renderHook } from "@testing-library/react-native";
44
import { registerCSS } from "react-native-css/jest";
5-
import { useNativeCss } from "react-native-css/runtime/native";
5+
import { useNativeCss } from "react-native-css/native";
66
import { VariableContext } from "react-native-css/style-collection";
77

8-
import {
9-
dimensions,
10-
VAR_SYMBOL,
11-
vh,
12-
vw,
13-
} from "../../runtime/native/reactivity";
14-
import { emVariableName } from "../../runtime/native/styles/constants";
8+
import { dimensions, VAR_SYMBOL, vh, vw } from "../../native/reactivity";
9+
import { emVariableName } from "../../native/styles/constants";
1510

1611
test("px", () => {
1712
registerCSS(`.my-class { width: 10px; }`);

src/compiler/compiler.types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import type {
55
TokenOrValue,
66
} from "lightningcss";
77

8-
import { VAR_SYMBOL } from "../runtime/native/reactivity";
8+
import { VAR_SYMBOL } from "../native/reactivity";
99

1010
export interface CompilerOptions {
1111
filename?: string;

src/compiler/declarations.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ import type {
3636
UnresolvedColor,
3737
} from "lightningcss";
3838

39-
import { isStyleFunction } from "../runtime/utils";
39+
import { isStyleFunction } from "../utilities";
4040
import type {
4141
StyleDescriptor,
4242
StyleFunction,

src/compiler/pseudo-elements.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { isStyleFunction } from "../runtime/utils";
1+
import { isStyleFunction } from "../utilities";
22
import type { StyleDeclaration, StyleRule } from "./compiler.types";
33

44
export function modifyRuleForSelection(rule: StyleRule): StyleRule | undefined {

0 commit comments

Comments
 (0)