@oxy.so/app-preset 3.0.0 → 3.2.1
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 +22 -0
- package/babel/index.js +96 -23
- package/build-id/index.js +4 -1
- package/css/base.css +9 -1
- package/metro/index.js +37 -4
- package/package.json +8 -4
- package/plugin/withOxyAndroidRelease.js +1 -2
- package/plugin/withOxyAppPreset.js +24 -11
- package/plugin/withOxyBuildProperties.js +5 -6
- package/plugin/withOxyUpdates.js +14 -14
- package/tsconfig/backend.json +3 -2
- package/tsconfig/base.json +1 -7
package/README.md
CHANGED
|
@@ -58,6 +58,10 @@ The iOS and build-property pieces are overridable:
|
|
|
58
58
|
The `sharedUserId` and `sharedIdentityReader` options were removed in 3.0.0 and
|
|
59
59
|
throw if passed. `@oxy.so/services` 11+ is a required peer.
|
|
60
60
|
|
|
61
|
+
`webgpu: true` (opt-in, 3.2.0+) also applies `react-native-webgpu`'s config
|
|
62
|
+
plugin, for an app that draws with WebGPU on native. Install
|
|
63
|
+
`react-native-webgpu` in the app first; the option throws without it.
|
|
64
|
+
|
|
61
65
|
#### Android release-build plugins (opt-in)
|
|
62
66
|
|
|
63
67
|
These two are deliberately NOT part of `['@oxy.so/app-preset', {}]`: one writes a
|
|
@@ -147,6 +151,11 @@ module.exports = createOxyMetroConfig(__dirname, {
|
|
|
147
151
|
});
|
|
148
152
|
```
|
|
149
153
|
|
|
154
|
+
`workletsBundleMode: true` (opt-in, 3.2.0+) turns on react-native-worklets'
|
|
155
|
+
[Bundle Mode](https://docs.swmansion.com/react-native-worklets/docs/bundleMode).
|
|
156
|
+
It wraps the finished config with worklets' `getBundleModeMetroConfig`. Use it
|
|
157
|
+
together with the Babel option of the same name (below); neither works alone.
|
|
158
|
+
|
|
150
159
|
`extraBlockList` accepts regular expressions or directory paths. Directory
|
|
151
160
|
paths are escaped and block only their descendants. `extraNodeModules`,
|
|
152
161
|
`extraWatchFolders`, `extraAssetExts`, and `extraSourceExts` extend the shared
|
|
@@ -158,6 +167,19 @@ defaults without replacing them.
|
|
|
158
167
|
module.exports = require('@oxy.so/app-preset/babel');
|
|
159
168
|
```
|
|
160
169
|
|
|
170
|
+
With Bundle Mode (opt-in, 3.2.0+), a worker runtime runs the app's own modules:
|
|
171
|
+
|
|
172
|
+
```js
|
|
173
|
+
module.exports = require('@oxy.so/app-preset/babel').createOxyBabelConfig({
|
|
174
|
+
workletsBundleMode: {
|
|
175
|
+
// The modules whose imports a worklet runs ON its runtime (worklets'
|
|
176
|
+
// `importForwarding`). An import not forwarded stays on the RN runtime,
|
|
177
|
+
// and a synchronous call to it from a worker runtime throws.
|
|
178
|
+
importForwarding: { relativePaths: ['components/map/engine/city3d'] },
|
|
179
|
+
},
|
|
180
|
+
});
|
|
181
|
+
```
|
|
182
|
+
|
|
161
183
|
### 4. ESLint (`eslint.config.js`)
|
|
162
184
|
|
|
163
185
|
```js
|
package/babel/index.js
CHANGED
|
@@ -10,33 +10,106 @@
|
|
|
10
10
|
*
|
|
11
11
|
* module.exports = require('@oxy.so/app-preset/babel');
|
|
12
12
|
*
|
|
13
|
+
* With options (all opt-in; an app that passes none gets the config above):
|
|
14
|
+
*
|
|
15
|
+
* module.exports = require('@oxy.so/app-preset/babel').createOxyBabelConfig({
|
|
16
|
+
* workletsBundleMode: { importForwarding: { relativePaths: ['components/engine'] } },
|
|
17
|
+
* });
|
|
18
|
+
*
|
|
19
|
+
* `workletsBundleMode` turns on react-native-worklets' Bundle Mode, in which a
|
|
20
|
+
* worker runtime runs the app's own MODULES rather than only copied worklet
|
|
21
|
+
* closures. It needs the Metro side too (`createOxyMetroConfig(…, {
|
|
22
|
+
* workletsBundleMode: true })`). `importForwarding` (worklets'
|
|
23
|
+
* `moduleNames`/`relativePaths`) names the modules whose imports a worklet
|
|
24
|
+
* runs ON its runtime; an import not forwarded stays on the RN runtime and a
|
|
25
|
+
* synchronous call to it from a worker runtime throws.
|
|
26
|
+
*
|
|
13
27
|
* The peer packages (`babel-preset-expo`, `babel-plugin-module-resolver`,
|
|
14
28
|
* `react-native-worklets`) resolve from the consuming app's node_modules, where
|
|
15
29
|
* Expo already installs them.
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
const FORWARDING_KEYS = ['moduleNames', 'relativePaths'];
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* The worklets plugin's Bundle Mode options, or `null` when it is off.
|
|
16
36
|
*
|
|
17
|
-
* @param {
|
|
18
|
-
|
|
37
|
+
* @param {boolean | { importForwarding?: { moduleNames?: string[], relativePaths?: string[] } } | undefined} value
|
|
38
|
+
*/
|
|
39
|
+
function bundleModeOptions(value) {
|
|
40
|
+
if (value === undefined || value === false) return null;
|
|
41
|
+
if (value === true) return { bundleMode: true };
|
|
42
|
+
if (typeof value !== 'object' || value === null) {
|
|
43
|
+
throw new TypeError(
|
|
44
|
+
'[@oxy.so/app-preset/babel] `workletsBundleMode` is a boolean or an object.',
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
for (const key of Object.keys(value)) {
|
|
48
|
+
if (key !== 'importForwarding') {
|
|
49
|
+
throw new TypeError(
|
|
50
|
+
`[@oxy.so/app-preset/babel] Unknown \`workletsBundleMode.${key}\`; the only option is \`importForwarding\`.`,
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
const forwarding = value.importForwarding;
|
|
55
|
+
if (forwarding === undefined) return { bundleMode: true };
|
|
56
|
+
const importForwarding = {};
|
|
57
|
+
for (const [key, list] of Object.entries(forwarding)) {
|
|
58
|
+
if (!FORWARDING_KEYS.includes(key)) {
|
|
59
|
+
throw new TypeError(
|
|
60
|
+
`[@oxy.so/app-preset/babel] Unknown \`importForwarding.${key}\`; expected ${FORWARDING_KEYS.join(' or ')}.`,
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
if (!Array.isArray(list) || !list.every((entry) => typeof entry === 'string')) {
|
|
64
|
+
throw new TypeError(
|
|
65
|
+
`[@oxy.so/app-preset/babel] \`importForwarding.${key}\` is a list of strings.`,
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
importForwarding[key] = [...list];
|
|
69
|
+
}
|
|
70
|
+
return { bundleMode: true, importForwarding };
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* @param {object} [options]
|
|
75
|
+
* @param {boolean | { importForwarding?: { moduleNames?: string[], relativePaths?: string[] } }} [options.workletsBundleMode=false]
|
|
76
|
+
* @returns {(api: import('@babel/core').ConfigAPI) => import('@babel/core').TransformOptions}
|
|
19
77
|
*/
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
return {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
78
|
+
function createOxyBabelConfig(options = {}) {
|
|
79
|
+
const bundleMode = bundleModeOptions(options.workletsBundleMode);
|
|
80
|
+
return function oxyBabelPreset(api) {
|
|
81
|
+
api.cache(true);
|
|
82
|
+
return {
|
|
83
|
+
presets: [
|
|
84
|
+
[
|
|
85
|
+
'babel-preset-expo',
|
|
86
|
+
// In Bundle Mode the worklets plugin needs its options, so
|
|
87
|
+
// babel-preset-expo must not add a second, option-less copy.
|
|
88
|
+
bundleMode
|
|
89
|
+
? { unstable_transformImportMeta: true, worklets: false }
|
|
90
|
+
: { unstable_transformImportMeta: true },
|
|
91
|
+
],
|
|
92
|
+
],
|
|
93
|
+
plugins: [
|
|
94
|
+
// The module-resolver must come first for correct module resolution.
|
|
95
|
+
[
|
|
96
|
+
'module-resolver',
|
|
97
|
+
{
|
|
98
|
+
root: ['./'],
|
|
99
|
+
alias: { '@': './' },
|
|
100
|
+
extensions: ['.ts', '.tsx', '.js', '.jsx', '.json', '.svg'],
|
|
101
|
+
},
|
|
102
|
+
],
|
|
103
|
+
// The build id `@oxy.so/services` busts its persisted caches on.
|
|
104
|
+
require.resolve('./inline-oxy-build-id'),
|
|
105
|
+
// Must be LAST.
|
|
106
|
+
bundleMode ? ['react-native-worklets/plugin', bundleMode] : 'react-native-worklets/plugin',
|
|
35
107
|
],
|
|
36
|
-
|
|
37
|
-
require.resolve('./inline-oxy-build-id'),
|
|
38
|
-
// Must be LAST.
|
|
39
|
-
'react-native-worklets/plugin',
|
|
40
|
-
],
|
|
108
|
+
};
|
|
41
109
|
};
|
|
42
|
-
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
const oxyBabelPreset = createOxyBabelConfig();
|
|
113
|
+
|
|
114
|
+
module.exports = oxyBabelPreset;
|
|
115
|
+
module.exports.createOxyBabelConfig = createOxyBabelConfig;
|
package/build-id/index.js
CHANGED
|
@@ -16,7 +16,10 @@ function resolveOxyBuildId(projectRoot = process.cwd()) {
|
|
|
16
16
|
const ciCommit = process.env.GITHUB_SHA || process.env.EAS_BUILD_GIT_COMMIT_HASH;
|
|
17
17
|
if (ciCommit) return ciCommit;
|
|
18
18
|
try {
|
|
19
|
-
return execFileSync('git', ['rev-parse', 'HEAD'], {
|
|
19
|
+
return execFileSync('git', ['rev-parse', 'HEAD'], {
|
|
20
|
+
cwd: projectRoot,
|
|
21
|
+
stdio: ['ignore', 'pipe', 'ignore'],
|
|
22
|
+
})
|
|
20
23
|
.toString()
|
|
21
24
|
.trim();
|
|
22
25
|
} catch {
|
package/css/base.css
CHANGED
|
@@ -61,7 +61,15 @@
|
|
|
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(
|
|
64
|
+
--font-sans: var(
|
|
65
|
+
--bloom-font-sans,
|
|
66
|
+
Inter,
|
|
67
|
+
-apple-system,
|
|
68
|
+
BlinkMacSystemFont,
|
|
69
|
+
"Segoe UI",
|
|
70
|
+
Roboto,
|
|
71
|
+
sans-serif
|
|
72
|
+
);
|
|
65
73
|
|
|
66
74
|
@media ios {
|
|
67
75
|
--font-sans: Inter;
|
package/metro/index.js
CHANGED
|
@@ -30,12 +30,18 @@
|
|
|
30
30
|
* @param {string[]} [options.extraWatchFolders=[]] Additional watch roots.
|
|
31
31
|
* @param {string[]} [options.extraAssetExts=[]] Additional asset extensions.
|
|
32
32
|
* @param {string[]} [options.extraSourceExts=[]] Additional source extensions.
|
|
33
|
+
* @param {boolean} [options.workletsBundleMode=false] react-native-worklets'
|
|
34
|
+
* Bundle Mode: wraps the config with `getBundleModeMetroConfig` (worklets'
|
|
35
|
+
* module ids, its resolver shims, inline requires), so a worker runtime can
|
|
36
|
+
* load the app's bundle. Pair it with the Babel factory's option of the same
|
|
37
|
+
* name; neither works alone. Needs `react-native-worklets` installed.
|
|
33
38
|
* @returns {import('metro-config').MetroConfig}
|
|
34
39
|
*/
|
|
35
40
|
const { getDefaultConfig } = require('expo/metro-config');
|
|
36
41
|
const { withNativeWind } = require('nativewind/metro');
|
|
37
42
|
const path = require('path');
|
|
38
43
|
const { resolveOxyBuildId } = require('../build-id');
|
|
44
|
+
const { requireFromProject } = require('../plugin/requireFromProject');
|
|
39
45
|
|
|
40
46
|
function blockPath(dir) {
|
|
41
47
|
const resolved = path.resolve(dir);
|
|
@@ -73,7 +79,10 @@ function createOxyMetroConfig(projectRoot, options = {}) {
|
|
|
73
79
|
config.projectRoot = projectRoot;
|
|
74
80
|
|
|
75
81
|
// Include the monorepo root so Metro resolves hoisted deps in root node_modules/.
|
|
76
|
-
config.watchFolders = unique([
|
|
82
|
+
config.watchFolders = unique([
|
|
83
|
+
monorepoRoot,
|
|
84
|
+
...extraWatchFolders.map((folder) => path.resolve(folder)),
|
|
85
|
+
]);
|
|
77
86
|
|
|
78
87
|
const blockList = [
|
|
79
88
|
blockPath(path.join(monorepoRoot, 'packages/backend')),
|
|
@@ -94,7 +103,9 @@ function createOxyMetroConfig(projectRoot, options = {}) {
|
|
|
94
103
|
/\.spec\.(js|ts|tsx|jsx)$/,
|
|
95
104
|
/\.md$/,
|
|
96
105
|
/(?:^|[/\\])README(?:\.[^/\\]+)?$/,
|
|
97
|
-
...extraBlockList.map((pattern) =>
|
|
106
|
+
...extraBlockList.map((pattern) =>
|
|
107
|
+
typeof pattern === 'string' ? blockPath(pattern) : pattern,
|
|
108
|
+
),
|
|
98
109
|
];
|
|
99
110
|
|
|
100
111
|
const extraNodeModules = {};
|
|
@@ -134,7 +145,9 @@ function createOxyMetroConfig(projectRoot, options = {}) {
|
|
|
134
145
|
// '…/empty.svg')} />`) — there is no react-native-svg-transformer configured,
|
|
135
146
|
// so removing `svg` from assetExts leaves it unresolvable (breaks the build).
|
|
136
147
|
assetExts: [
|
|
137
|
-
...config.resolver.assetExts.filter(
|
|
148
|
+
...config.resolver.assetExts.filter(
|
|
149
|
+
(extension) => !svgTransformerPath || extension !== 'svg',
|
|
150
|
+
),
|
|
138
151
|
'wasm',
|
|
139
152
|
'woff2',
|
|
140
153
|
'woff',
|
|
@@ -216,9 +229,29 @@ function withBloomSingleInstance(nativeWindConfig, projectRoot) {
|
|
|
216
229
|
return nativeWindConfig;
|
|
217
230
|
}
|
|
218
231
|
|
|
232
|
+
/**
|
|
233
|
+
* Wraps the finished config for react-native-worklets' Bundle Mode. Applied
|
|
234
|
+
* LAST, so worklets' resolver sees every request first and hands the rest to
|
|
235
|
+
* the Bloom and NativeWind resolvers underneath.
|
|
236
|
+
*/
|
|
237
|
+
function withWorkletsBundleMode(config, projectRoot) {
|
|
238
|
+
let bundleMode;
|
|
239
|
+
try {
|
|
240
|
+
bundleMode = requireFromProject('react-native-worklets/bundleMode', projectRoot);
|
|
241
|
+
} catch (error) {
|
|
242
|
+
throw new Error(
|
|
243
|
+
"[@oxy.so/app-preset/metro] `workletsBundleMode` needs 'react-native-worklets' installed in the app. " +
|
|
244
|
+
`(${error instanceof Error ? error.message : String(error)})`,
|
|
245
|
+
);
|
|
246
|
+
}
|
|
247
|
+
return bundleMode.getBundleModeMetroConfig(config);
|
|
248
|
+
}
|
|
249
|
+
|
|
219
250
|
function createOxyMetroConfigWithBloom(projectRoot, options = {}) {
|
|
251
|
+
const { workletsBundleMode = false } = options;
|
|
220
252
|
const nativeWindConfig = createOxyMetroConfig(projectRoot, options);
|
|
221
|
-
|
|
253
|
+
const config = withBloomSingleInstance(nativeWindConfig, projectRoot);
|
|
254
|
+
return workletsBundleMode ? withWorkletsBundleMode(config, projectRoot) : config;
|
|
222
255
|
}
|
|
223
256
|
|
|
224
257
|
module.exports = { createOxyMetroConfig: createOxyMetroConfigWithBloom, withBloomSingleInstance };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oxy.so/app-preset",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.1",
|
|
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` requires `@oxy.so/services/plugins/withOxySharedPermissions` (services 11+, where it first exists, so the services floor is the major that ships it). Both peers retain a measured floor and
|
|
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` requires `@oxy.so/services/plugins/withOxySharedPermissions` (services 11+, where it first exists, so the services floor is the major that ships it). Both peers retain a measured floor and are deliberately OPEN-ENDED above it: Oxy apps always run the latest Bloom and Services, so a new release of either must never need a preset release first. A release that breaks this package's file-path coupling is caught by its own tests and the apps' CI, not by a cap. Never replace either constraint with `*`.",
|
|
67
67
|
"peerDependencies": {
|
|
68
|
-
"@oxy.so/bloom": "^2.0.0 || ^3.0.0 || ^4.2.0 || ^5.1.0 ||
|
|
69
|
-
"@oxy.so/services": "
|
|
68
|
+
"@oxy.so/bloom": "^2.0.0 || ^3.0.0 || ^4.2.0 || ^5.1.0 || >=6.0.0",
|
|
69
|
+
"@oxy.so/services": ">=11.0.0",
|
|
70
70
|
"babel-plugin-module-resolver": "*",
|
|
71
71
|
"babel-preset-expo": "*",
|
|
72
72
|
"eslint": ">=9.0.0",
|
|
@@ -74,6 +74,7 @@
|
|
|
74
74
|
"expo": ">=56.0.0",
|
|
75
75
|
"expo-build-properties": "*",
|
|
76
76
|
"nativewind": ">=5.0.0-preview.0",
|
|
77
|
+
"react-native-webgpu": ">=0.5.18 <1.0.0",
|
|
77
78
|
"react-native-worklets": "*",
|
|
78
79
|
"sharp": ">=0.33.0",
|
|
79
80
|
"tailwindcss": ">=4.0.0"
|
|
@@ -102,6 +103,9 @@
|
|
|
102
103
|
"expo-build-properties": {
|
|
103
104
|
"optional": true
|
|
104
105
|
},
|
|
106
|
+
"react-native-webgpu": {
|
|
107
|
+
"optional": true
|
|
108
|
+
},
|
|
105
109
|
"react-native-worklets": {
|
|
106
110
|
"optional": true
|
|
107
111
|
},
|
|
@@ -49,8 +49,7 @@ const DEFAULT_PROGUARD = 'getDefaultProguardFile("proguard-android.txt")';
|
|
|
49
49
|
const OPTIMIZED_PROGUARD = 'getDefaultProguardFile("proguard-android-optimize.txt")';
|
|
50
50
|
|
|
51
51
|
const DEBUG_SIGNING_CONFIG = 'signingConfig signingConfigs.debug';
|
|
52
|
-
const CONDITIONAL_SIGNING_CONFIG =
|
|
53
|
-
`signingConfig project.hasProperty('${STORE_FILE}') ? signingConfigs.release : signingConfigs.debug`;
|
|
52
|
+
const CONDITIONAL_SIGNING_CONFIG = `signingConfig project.hasProperty('${STORE_FILE}') ? signingConfigs.release : signingConfigs.debug`;
|
|
54
53
|
|
|
55
54
|
const RELEASE_SIGNING_CONFIG = ` release {
|
|
56
55
|
// Populated only when the Oxy release keystore properties are
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
* keychainGroup: 'group.so.oxy.shared', // false → skip iOS keychain entitlement
|
|
19
19
|
* ios: { deploymentTarget: '17.0' }, // false → skip iOS build properties
|
|
20
20
|
* android: { targetSdkVersion: 34 }, // false → skip Android build properties
|
|
21
|
+
* webgpu: true, // opt-in: react-native-webgpu's config plugin
|
|
21
22
|
* }]
|
|
22
23
|
*
|
|
23
24
|
* Android never gets `android:sharedUserId`: each Oxy app has its own UID and
|
|
@@ -33,6 +34,9 @@
|
|
|
33
34
|
* @param {string|false} [options.keychainGroup='group.so.oxy.shared']
|
|
34
35
|
* @param {object|false} [options.ios]
|
|
35
36
|
* @param {object|false} [options.android]
|
|
37
|
+
* @param {boolean} [options.webgpu=false] Apply `react-native-webgpu`'s
|
|
38
|
+
* config plugin (an app drawing with WebGPU on native). Needs
|
|
39
|
+
* `react-native-webgpu` installed in the app.
|
|
36
40
|
*/
|
|
37
41
|
const withOxyKeychain = require('./withOxyKeychain');
|
|
38
42
|
const withOxyBuildProperties = require('./withOxyBuildProperties');
|
|
@@ -40,11 +44,11 @@ const { projectRootOf, requireFromProject } = require('./requireFromProject');
|
|
|
40
44
|
|
|
41
45
|
const REMOVED_OPTIONS = {
|
|
42
46
|
sharedUserId:
|
|
43
|
-
'Oxy Android apps no longer share a UID: they share the identity and the session with Commons '
|
|
44
|
-
|
|
47
|
+
'Oxy Android apps no longer share a UID: they share the identity and the session with Commons ' +
|
|
48
|
+
'over signature-protected IPC. Remove the option (and any android:sharedUserId).',
|
|
45
49
|
sharedIdentityReader:
|
|
46
|
-
'the reader plugin is gone; every Oxy app now applies @oxy.so/services/plugins/withOxySharedPermissions, '
|
|
47
|
-
|
|
50
|
+
'the reader plugin is gone; every Oxy app now applies @oxy.so/services/plugins/withOxySharedPermissions, ' +
|
|
51
|
+
'which the preset always does. Remove the option.',
|
|
48
52
|
};
|
|
49
53
|
|
|
50
54
|
module.exports = function withOxyAppPreset(config, options = {}) {
|
|
@@ -54,11 +58,7 @@ module.exports = function withOxyAppPreset(config, options = {}) {
|
|
|
54
58
|
}
|
|
55
59
|
}
|
|
56
60
|
|
|
57
|
-
const {
|
|
58
|
-
keychainGroup = 'group.so.oxy.shared',
|
|
59
|
-
ios = {},
|
|
60
|
-
android = {},
|
|
61
|
-
} = options;
|
|
61
|
+
const { keychainGroup = 'group.so.oxy.shared', ios = {}, android = {}, webgpu = false } = options;
|
|
62
62
|
|
|
63
63
|
let next = config;
|
|
64
64
|
|
|
@@ -78,11 +78,24 @@ module.exports = function withOxyAppPreset(config, options = {}) {
|
|
|
78
78
|
);
|
|
79
79
|
} catch (error) {
|
|
80
80
|
throw new Error(
|
|
81
|
-
"[@oxy.so/app-preset] needs '@oxy.so/services' 11 or later (for plugins/withOxySharedPermissions). "
|
|
82
|
-
|
|
81
|
+
"[@oxy.so/app-preset] needs '@oxy.so/services' 11 or later (for plugins/withOxySharedPermissions). " +
|
|
82
|
+
`Install it in the app. (${error instanceof Error ? error.message : String(error)})`,
|
|
83
83
|
);
|
|
84
84
|
}
|
|
85
85
|
next = withOxySharedPermissions(next);
|
|
86
86
|
|
|
87
|
+
if (webgpu) {
|
|
88
|
+
let withWebGPU;
|
|
89
|
+
try {
|
|
90
|
+
withWebGPU = requireFromProject('react-native-webgpu/app.plugin.js', projectRootOf(config));
|
|
91
|
+
} catch (error) {
|
|
92
|
+
throw new Error(
|
|
93
|
+
"[@oxy.so/app-preset] `webgpu: true` needs 'react-native-webgpu' installed in the app. " +
|
|
94
|
+
`(${error instanceof Error ? error.message : String(error)})`,
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
next = withWebGPU(next);
|
|
98
|
+
}
|
|
99
|
+
|
|
87
100
|
return next;
|
|
88
101
|
};
|
|
@@ -42,9 +42,8 @@ function deepMerge(base, override) {
|
|
|
42
42
|
}
|
|
43
43
|
const result = { ...base };
|
|
44
44
|
for (const [key, value] of Object.entries(override)) {
|
|
45
|
-
result[key] =
|
|
46
|
-
? deepMerge(result[key], value)
|
|
47
|
-
: value;
|
|
45
|
+
result[key] =
|
|
46
|
+
isPlainObject(value) && isPlainObject(result[key]) ? deepMerge(result[key], value) : value;
|
|
48
47
|
}
|
|
49
48
|
return result;
|
|
50
49
|
}
|
|
@@ -55,9 +54,9 @@ function resolveBuildPropertiesPlugin(projectRoot) {
|
|
|
55
54
|
mod = requireFromProject('expo-build-properties', projectRoot);
|
|
56
55
|
} catch (error) {
|
|
57
56
|
throw new Error(
|
|
58
|
-
"[@oxy.so/app-preset] withOxyBuildProperties requires the peer dependency 'expo-build-properties'. "
|
|
59
|
-
|
|
60
|
-
|
|
57
|
+
"[@oxy.so/app-preset] withOxyBuildProperties requires the peer dependency 'expo-build-properties'. " +
|
|
58
|
+
'Install it with `npx expo install expo-build-properties`, or disable it by passing ' +
|
|
59
|
+
'`{ ios: false, android: false }` to the preset.',
|
|
61
60
|
);
|
|
62
61
|
}
|
|
63
62
|
const plugin = typeof mod === 'function' ? mod : mod.withBuildProperties || mod.default;
|
package/plugin/withOxyUpdates.js
CHANGED
|
@@ -99,9 +99,9 @@ module.exports = function withOxyUpdates(config, options = {}) {
|
|
|
99
99
|
|
|
100
100
|
if (typeof clientId !== 'string' || clientId.trim().length === 0) {
|
|
101
101
|
throw new Error(
|
|
102
|
-
`[${PLUGIN_NAME}] a non-empty \`clientId\` is required. Pass this app's registered `
|
|
103
|
-
|
|
104
|
-
|
|
102
|
+
`[${PLUGIN_NAME}] a non-empty \`clientId\` is required. Pass this app's registered ` +
|
|
103
|
+
'ApplicationCredential publicKey (oxy_dk_...), normally from an ' +
|
|
104
|
+
'EXPO_PUBLIC_OXY_CLIENT_ID-backed constant.',
|
|
105
105
|
);
|
|
106
106
|
}
|
|
107
107
|
|
|
@@ -122,9 +122,9 @@ module.exports = function withOxyUpdates(config, options = {}) {
|
|
|
122
122
|
const projectRoot = config._internal?.projectRoot;
|
|
123
123
|
if (typeof projectRoot !== 'string') {
|
|
124
124
|
throw new Error(
|
|
125
|
-
`[${PLUGIN_NAME}] could not resolve the project root from the Expo config, so the `
|
|
126
|
-
|
|
127
|
-
|
|
125
|
+
`[${PLUGIN_NAME}] could not resolve the project root from the Expo config, so the ` +
|
|
126
|
+
'code-signing certificate path cannot be made project-relative (expo-updates joins it ' +
|
|
127
|
+
'onto the project root). Upgrade @expo/config, or pass `{ codeSigning: false }`.',
|
|
128
128
|
);
|
|
129
129
|
}
|
|
130
130
|
// expo-updates reads this as `path.join(projectRoot, value)`, so it must be
|
|
@@ -133,17 +133,17 @@ module.exports = function withOxyUpdates(config, options = {}) {
|
|
|
133
133
|
updates.codeSigningMetadata = { keyid: CODE_SIGNING_KEY_ID, alg: CODE_SIGNING_ALG };
|
|
134
134
|
} else if (codeSigning === 'require') {
|
|
135
135
|
throw new Error(
|
|
136
|
-
`[${PLUGIN_NAME}] code signing is required but the Oxy Updates certificate is missing at `
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
136
|
+
`[${PLUGIN_NAME}] code signing is required but the Oxy Updates certificate is missing at ` +
|
|
137
|
+
`${certificatePath}. Generate the ecosystem keypair with oxy-api's ` +
|
|
138
|
+
'`bun scripts/generate-updates-code-signing.ts`, commit the certificate into ' +
|
|
139
|
+
'@oxy.so/app-preset, and set the private key as UPDATES_CODE_SIGNING_PRIVATE_KEY on oxy-api.',
|
|
140
140
|
);
|
|
141
141
|
} else {
|
|
142
142
|
const warning =
|
|
143
|
-
'The Oxy Updates code-signing certificate is not present in @oxy.so/app-preset, so this build '
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
143
|
+
'The Oxy Updates code-signing certificate is not present in @oxy.so/app-preset, so this build ' +
|
|
144
|
+
'will accept UNSIGNED update manifests for its entire lifetime (the certificate is baked in ' +
|
|
145
|
+
'at build time). Do not ship this binary to a store. See the app-preset README, section ' +
|
|
146
|
+
'"Oxy Updates (OTA)".';
|
|
147
147
|
WarningAggregator.addWarningForPlatform('android', PLUGIN_NAME, warning);
|
|
148
148
|
WarningAggregator.addWarningForPlatform('ios', PLUGIN_NAME, warning);
|
|
149
149
|
}
|
package/tsconfig/backend.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
3
|
"//": "@oxy.so/app-preset — Node/Bun backend TypeScript config. Compiled with tsc to dist/ (CommonJS) and THAT emitted output is what the Docker/ECS image runs — module format and emit layout are a runtime contract. Overrides the Oxy base only where this becomes an emitting CommonJS Node service. Consumers set their own `rootDir`/`outDir`/`include` (and `paths` to resolve workspace deps from source during type-check).",
|
|
4
|
+
"//module": "Node16, not commonjs + node10. TypeScript 7 (and `bun check`) removes `moduleResolution: node`/`node10` (TS5108), and TypeScript 5.x rejects `bundler` with `commonjs` (TS5095), so Node16 is the one setting valid on both. Node16 emits CommonJS for every file whose nearest package.json has no `\"type\": \"module\"` — byte-identical to `commonjs` — with one exception: a dynamic `import()` stays a real `import()` (needing a `.js` extension on a relative path) instead of becoming `require()`. A package that sets `\"type\": \"module\"` gets ESM output.",
|
|
4
5
|
"extends": "./base.json",
|
|
5
6
|
"compilerOptions": {
|
|
6
|
-
"module": "
|
|
7
|
-
"moduleResolution": "
|
|
7
|
+
"module": "node16",
|
|
8
|
+
"moduleResolution": "node16",
|
|
8
9
|
"noEmit": false,
|
|
9
10
|
"declaration": true
|
|
10
11
|
}
|
package/tsconfig/base.json
CHANGED