@oxy.so/app-preset 1.0.0 → 2.0.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/css/base.css CHANGED
@@ -61,14 +61,14 @@
61
61
  restatement is not a re-skin, it is what stops NativeWind's own unlayered default
62
62
  from overriding Bloom. Do not "tidy" it away. */
63
63
  :root {
64
- --font-sans: var(--bloom-font-sans, BlomusModernus, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
64
+ --font-sans: var(--bloom-font-sans, Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
65
65
 
66
66
  @media ios {
67
- --font-sans: BlomusModernus;
67
+ --font-sans: Inter;
68
68
  }
69
69
 
70
70
  @media android {
71
- --font-sans: BlomusModernus;
71
+ --font-sans: Inter;
72
72
  }
73
73
  }
74
74
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxy.so/app-preset",
3
- "version": "1.0.0",
3
+ "version": "2.0.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": {
@@ -63,10 +63,10 @@
63
63
  "prepublishOnly": "node ../../scripts/assert-bun-publish.mjs",
64
64
  "test": "node --test __tests__/*.test.js"
65
65
  },
66
- "//peerDependencies": "THE TWO @oxy.so PEERS ARE DELIBERATE. This package couples to them by FILE PATH, not by API: `css/base.css` imports `@oxy.so/bloom/design-tokens/theme.css`, and `plugin/withOxyAppPreset.js` optionally requires `@oxy.so/services/plugins/withSharedIdentityReader`. Services is exact-pinned so every preset release names the one SDK generation whose plugin path was verified. Bloom retains a measured floor and a breaking-major cap. Never replace either constraint with `*` or an uncapped range.",
66
+ "//peerDependencies": "THE TWO @oxy.so PEERS ARE DELIBERATE. This package couples to them by FILE PATH, not by API: `css/base.css` imports `@oxy.so/bloom/design-tokens/theme.css`, and `plugin/withOxyAppPreset.js` optionally requires `@oxy.so/services/plugins/withSharedIdentityReader`. Both peers retain a measured floor and a breaking-major cap so compatible patches deduplicate in consumers. Never replace either constraint with `*` or an uncapped range.",
67
67
  "peerDependencies": {
68
- "@oxy.so/bloom": "^1.0.0",
69
- "@oxy.so/services": "1.0.0",
68
+ "@oxy.so/bloom": "^2.0.0",
69
+ "@oxy.so/services": "^2.0.0",
70
70
  "babel-plugin-module-resolver": "*",
71
71
  "babel-preset-expo": "*",
72
72
  "eslint": ">=9.0.0",
@@ -79,7 +79,9 @@
79
79
  "tailwindcss": ">=4.0.0"
80
80
  },
81
81
  "devDependencies": {
82
- "expo": "^57.0.6"
82
+ "expo": "^57.0.6",
83
+ "nativewind": "5.0.0-preview.3",
84
+ "tailwindcss": "4.3.3"
83
85
  },
84
86
  "peerDependenciesMeta": {
85
87
  "@oxy.so/bloom": {
@@ -103,17 +105,11 @@
103
105
  "expo-build-properties": {
104
106
  "optional": true
105
107
  },
106
- "nativewind": {
107
- "optional": true
108
- },
109
108
  "react-native-worklets": {
110
109
  "optional": true
111
110
  },
112
111
  "sharp": {
113
112
  "optional": true
114
- },
115
- "tailwindcss": {
116
- "optional": true
117
113
  }
118
114
  }
119
115
  }
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Load an optional peer the way a config plugin must: from the APP first.
3
+ *
4
+ * A peer dependency belongs to the app that installs it. Under Bun's isolated
5
+ * linker (`peer = false`, see the repo's bunfig.toml) a workspace-linked preset
6
+ * cannot see the app's packages from its own directory, so a plain `require`
7
+ * here throws even when the app has the peer installed. Resolving from the
8
+ * app's project root first, then falling back to the preset's own resolution,
9
+ * works under both an isolated and a hoisted install.
10
+ *
11
+ * @param {string} specifier Module specifier, e.g. `expo-build-properties`.
12
+ * @param {string | undefined} projectRoot The app's directory.
13
+ */
14
+ function requireFromProject(specifier, projectRoot) {
15
+ if (projectRoot) {
16
+ let resolved;
17
+ try {
18
+ resolved = require.resolve(specifier, { paths: [projectRoot] });
19
+ } catch {
20
+ resolved = null;
21
+ }
22
+ if (resolved) return require(resolved);
23
+ }
24
+ return require(specifier);
25
+ }
26
+
27
+ /**
28
+ * The app's project root for a config: `_internal.projectRoot` when Expo
29
+ * provides it, else the working directory Expo evaluates config plugins in.
30
+ *
31
+ * @param {{ _internal?: { projectRoot?: string } } | undefined} config
32
+ */
33
+ function projectRootOf(config) {
34
+ return config?._internal?.projectRoot ?? process.cwd();
35
+ }
36
+
37
+ module.exports = { requireFromProject, projectRootOf };
@@ -53,6 +53,7 @@
53
53
  const fs = require('fs/promises');
54
54
  const path = require('path');
55
55
  const { withDangerousMod } = require('expo/config-plugins');
56
+ const { requireFromProject } = require('./requireFromProject');
56
57
 
57
58
  const RES_DIR = path.join('app', 'src', 'main', 'res');
58
59
  const PNG_MAGIC = Buffer.from([0x89, 0x50, 0x4e, 0x47]);
@@ -132,7 +133,7 @@ function rendersIdentically(before, after) {
132
133
  async function convertResourceImages(projectRoot, resDir) {
133
134
  let sharp;
134
135
  try {
135
- sharp = require('sharp');
136
+ sharp = requireFromProject('sharp', projectRoot);
136
137
  } catch (error) {
137
138
  throw new Error(
138
139
  `[withOxyAndroidWebp] \`sharp\` is required to emit real WebP resources but could not be loaded (${error.message}). ` +
@@ -33,6 +33,7 @@
33
33
  const withSharedUserId = require('./withSharedUserId');
34
34
  const withOxyKeychain = require('./withOxyKeychain');
35
35
  const withOxyBuildProperties = require('./withOxyBuildProperties');
36
+ const { projectRootOf, requireFromProject } = require('./requireFromProject');
36
37
 
37
38
  module.exports = function withOxyAppPreset(config, options = {}) {
38
39
  const {
@@ -60,7 +61,7 @@ module.exports = function withOxyAppPreset(config, options = {}) {
60
61
  if (sharedIdentityReader !== false) {
61
62
  let withSharedIdentityReader;
62
63
  try {
63
- withSharedIdentityReader = require('@oxy.so/services/plugins/withSharedIdentityReader');
64
+ withSharedIdentityReader = requireFromProject('@oxy.so/services/plugins/withSharedIdentityReader', projectRootOf(config));
64
65
  } catch (error) {
65
66
  throw new Error(
66
67
  "[@oxy.so/app-preset] sharedIdentityReader is enabled but the peer dependency '@oxy.so/services' "
@@ -9,12 +9,15 @@
9
9
  * `expo-build-properties` is required lazily (it is an optional peer): a missing
10
10
  * install throws a clear, actionable error only when this plugin actually runs
11
11
  * with build properties enabled.
12
+ * It is resolved from the APP's project root first (see `requireFromProject`).
12
13
  *
13
14
  * @param {import('expo/config').ExpoConfig} config
14
15
  * @param {object} [options]
15
16
  * @param {object|false} [options.ios] iOS overrides, or `false` to skip iOS.
16
17
  * @param {object|false} [options.android] Android overrides, or `false` to skip Android.
17
18
  */
19
+ const { projectRootOf, requireFromProject } = require('./requireFromProject');
20
+
18
21
  const DEFAULTS = {
19
22
  ios: {
20
23
  deploymentTarget: '16.4',
@@ -46,10 +49,10 @@ function deepMerge(base, override) {
46
49
  return result;
47
50
  }
48
51
 
49
- function resolveBuildPropertiesPlugin() {
52
+ function resolveBuildPropertiesPlugin(projectRoot) {
50
53
  let mod;
51
54
  try {
52
- mod = require('expo-build-properties');
55
+ mod = requireFromProject('expo-build-properties', projectRoot);
53
56
  } catch (error) {
54
57
  throw new Error(
55
58
  "[@oxy.so/app-preset] withOxyBuildProperties requires the peer dependency 'expo-build-properties'. "
@@ -81,7 +84,7 @@ module.exports = function withOxyBuildProperties(config, options = {}) {
81
84
  props.android = deepMerge(DEFAULTS.android, android);
82
85
  }
83
86
 
84
- const withBuildProperties = resolveBuildPropertiesPlugin();
87
+ const withBuildProperties = resolveBuildPropertiesPlugin(projectRootOf(config));
85
88
  return withBuildProperties(config, props);
86
89
  };
87
90