@oxy.so/app-preset 5.2.0 → 5.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -0
- package/metro/index.js +47 -2
- package/package.json +11 -11
package/README.md
CHANGED
|
@@ -270,6 +270,20 @@ paths are escaped and block only their descendants. `extraNodeModules`,
|
|
|
270
270
|
`extraWatchFolders`, `extraAssetExts`, and `extraSourceExts` extend the shared
|
|
271
271
|
defaults without replacing them.
|
|
272
272
|
|
|
273
|
+
#### Native CSS runtime identity (5.2.1+)
|
|
274
|
+
|
|
275
|
+
Native bundles resolve `react-native-css` runtime imports and stylesheet injection
|
|
276
|
+
through the app's CommonJS export condition. The package's ESM and CommonJS builds
|
|
277
|
+
own separate root-variable registries; loading both can leave variable-based
|
|
278
|
+
utilities such as `text-white` without their registered color. The resolver runs
|
|
279
|
+
below NativeWind so redirected component imports share the same runtime, while
|
|
280
|
+
preserving native component export conditions. Web resolution is unchanged.
|
|
281
|
+
|
|
282
|
+
When validating a packed dependency on Android, force Metro to regenerate the
|
|
283
|
+
release bundle: Gradle can otherwise reuse its previous bundle despite a changed
|
|
284
|
+
package install. Inspect the regenerated source map for a single CSS runtime
|
|
285
|
+
before comparing device behavior.
|
|
286
|
+
|
|
273
287
|
#### `react-native` on native: the complete NativeWind shim (4.1.0+)
|
|
274
288
|
|
|
275
289
|
On native, NativeWind's resolver sends every `import … from 'react-native'`
|
package/metro/index.js
CHANGED
|
@@ -266,13 +266,52 @@ function createOxyMetroConfig(projectRoot, options = {}) {
|
|
|
266
266
|
},
|
|
267
267
|
};
|
|
268
268
|
|
|
269
|
-
return withNativeWind(config, {
|
|
269
|
+
return withNativeWind(withReactNativeCssSingleInstance(config, projectRoot), {
|
|
270
270
|
input: cssInput,
|
|
271
271
|
inlineRem: 16,
|
|
272
272
|
inlineVariables: false,
|
|
273
273
|
});
|
|
274
274
|
}
|
|
275
275
|
|
|
276
|
+
/** Keep CSS injection and consumers on one runtime, including NativeWind redirects.
|
|
277
|
+
* Its ESM and CommonJS builds have separate root-variable registries. NativeWind
|
|
278
|
+
* injects through require(), so native imports must select the same export.
|
|
279
|
+
* Preserve react-native conditions: some component adapters require native code.
|
|
280
|
+
*/
|
|
281
|
+
function cssRuntimeContext(context, moduleName, platform, projectRoot) {
|
|
282
|
+
if (
|
|
283
|
+
platform === 'web' ||
|
|
284
|
+
platform == null ||
|
|
285
|
+
!(moduleName === 'react-native-css' || moduleName.startsWith('react-native-css/'))
|
|
286
|
+
)
|
|
287
|
+
return context;
|
|
288
|
+
const conditions = (values = []) =>
|
|
289
|
+
values.filter((value) => value !== 'import' && value !== 'source');
|
|
290
|
+
return {
|
|
291
|
+
...context,
|
|
292
|
+
originModulePath: path.join(projectRoot, 'package.json'),
|
|
293
|
+
isESMImport: false,
|
|
294
|
+
unstable_conditionNames: conditions(context.unstable_conditionNames),
|
|
295
|
+
unstable_conditionsByPlatform: Object.fromEntries(
|
|
296
|
+
Object.entries(context.unstable_conditionsByPlatform ?? {}).map(([key, values]) => [
|
|
297
|
+
key,
|
|
298
|
+
conditions(values),
|
|
299
|
+
]),
|
|
300
|
+
),
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
function withReactNativeCssSingleInstance(config, projectRoot = config.projectRoot) {
|
|
305
|
+
const parentResolveRequest = config.resolver.resolveRequest;
|
|
306
|
+
config.resolver.resolveRequest = (context, moduleName, platform) =>
|
|
307
|
+
(parentResolveRequest ?? context.resolveRequest)(
|
|
308
|
+
cssRuntimeContext(context, moduleName, platform, projectRoot),
|
|
309
|
+
moduleName,
|
|
310
|
+
platform,
|
|
311
|
+
);
|
|
312
|
+
return config;
|
|
313
|
+
}
|
|
314
|
+
|
|
276
315
|
const COMPLETE_REACT_NATIVE = path.join(__dirname, 'react-native.js');
|
|
277
316
|
/** Both spellings: Metro reports real paths, and the preset may sit behind a symlink. */
|
|
278
317
|
const COMPLETE_REACT_NATIVE_PATHS = new Set([
|
|
@@ -317,7 +356,12 @@ function withCompleteReactNative(config, projectRoot = config.projectRoot) {
|
|
|
317
356
|
(moduleName === 'react-native' || moduleName === 'react-native-css/components')
|
|
318
357
|
) {
|
|
319
358
|
return context.resolveRequest(
|
|
320
|
-
|
|
359
|
+
cssRuntimeContext(
|
|
360
|
+
{ ...context, originModulePath: projectOrigin },
|
|
361
|
+
moduleName,
|
|
362
|
+
platform,
|
|
363
|
+
projectRoot,
|
|
364
|
+
),
|
|
321
365
|
moduleName,
|
|
322
366
|
platform,
|
|
323
367
|
);
|
|
@@ -412,6 +456,7 @@ module.exports = {
|
|
|
412
456
|
createOxyMetroConfig: createOxyMetroConfigWithBloom,
|
|
413
457
|
findWorkspaceRoot,
|
|
414
458
|
withBloomSingleInstance,
|
|
459
|
+
withReactNativeCssSingleInstance,
|
|
415
460
|
withCompleteReactNative,
|
|
416
461
|
withLinkedNativePackagesOnly,
|
|
417
462
|
withFreshWorkspaceBuilds,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oxy.so/app-preset",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.3.0",
|
|
4
4
|
"description": "The Oxy distro of Expo — centralized Expo config plugin, Metro/Babel/ESLint factories, Tailwind base CSS and TypeScript bases shared by every Oxy app (Mention, Homiio, Allo, accounts, …). A zero-build package: apps replace copy-pasted config with a single dependency bump.",
|
|
5
5
|
"main": "./app.plugin.js",
|
|
6
6
|
"publishConfig": {
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"license": "SEE LICENSE IN LICENSE",
|
|
58
58
|
"homepage": "https://oxy.so",
|
|
59
59
|
"engines": {
|
|
60
|
-
"node": ">=
|
|
60
|
+
"node": ">=20.19.0"
|
|
61
61
|
},
|
|
62
62
|
"scripts": {
|
|
63
63
|
"test": "node --test __tests__/*.test.js"
|
|
@@ -84,15 +84,15 @@
|
|
|
84
84
|
"react-dom": ">=19.0.0 <20.0.0"
|
|
85
85
|
},
|
|
86
86
|
"devDependencies": {
|
|
87
|
-
"expo": "~58.0.
|
|
87
|
+
"expo": "~58.0.23",
|
|
88
88
|
"nativewind": "5.0.0-rc.0",
|
|
89
|
-
"tailwindcss": "4.3.
|
|
90
|
-
"react": "19.3.
|
|
91
|
-
"react-dom": "19.3.
|
|
92
|
-
"jsdom": "^
|
|
93
|
-
"expo-router": "~58.0.
|
|
94
|
-
"@expo/router-server": "58.0.
|
|
95
|
-
"react-native": "0.88.
|
|
89
|
+
"tailwindcss": "4.3.4",
|
|
90
|
+
"react": "19.3.1",
|
|
91
|
+
"react-dom": "19.3.1",
|
|
92
|
+
"jsdom": "^30.1.3",
|
|
93
|
+
"expo-router": "~58.0.30",
|
|
94
|
+
"@expo/router-server": "58.0.21",
|
|
95
|
+
"react-native": "0.88.1",
|
|
96
96
|
"react-native-css": "3.1.0-rc.0"
|
|
97
97
|
},
|
|
98
98
|
"peerDependenciesMeta": {
|
|
@@ -140,6 +140,6 @@
|
|
|
140
140
|
}
|
|
141
141
|
},
|
|
142
142
|
"dependencies": {
|
|
143
|
-
"parse5": "
|
|
143
|
+
"parse5": "8.1.0"
|
|
144
144
|
}
|
|
145
145
|
}
|