vxrn 2.14.2 → 2.15.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/dist/exports/prebuildWithoutExpo.mjs +24 -0
- package/dist/exports/prebuildWithoutExpo.mjs.map +1 -1
- package/dist/exports/prebuildWithoutExpo.native.js +47 -0
- package/dist/exports/prebuildWithoutExpo.native.js.map +1 -1
- package/package.json +13 -13
- package/src/exports/prebuildWithoutExpo.test.ts +59 -0
- package/src/exports/prebuildWithoutExpo.ts +30 -0
- package/types/exports/prebuildWithoutExpo.d.ts.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vxrn",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.15.0",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -80,14 +80,14 @@
|
|
|
80
80
|
"@react-native-community/cli": "^20.2.0",
|
|
81
81
|
"@react-native-community/cli-config": "^20.2.0",
|
|
82
82
|
"@react-native/dev-middleware": "^0.88.0",
|
|
83
|
-
"@vxrn/compiler": "2.
|
|
84
|
-
"@vxrn/debug": "2.
|
|
85
|
-
"@vxrn/query-string": "2.
|
|
86
|
-
"@vxrn/resolve": "2.
|
|
87
|
-
"@vxrn/url-parse": "2.
|
|
88
|
-
"@vxrn/utils": "2.
|
|
89
|
-
"@vxrn/vendor": "2.
|
|
90
|
-
"@vxrn/vite-flow": "2.
|
|
83
|
+
"@vxrn/compiler": "2.15.0",
|
|
84
|
+
"@vxrn/debug": "2.15.0",
|
|
85
|
+
"@vxrn/query-string": "2.15.0",
|
|
86
|
+
"@vxrn/resolve": "2.15.0",
|
|
87
|
+
"@vxrn/url-parse": "2.15.0",
|
|
88
|
+
"@vxrn/utils": "2.15.0",
|
|
89
|
+
"@vxrn/vendor": "2.15.0",
|
|
90
|
+
"@vxrn/vite-flow": "2.15.0",
|
|
91
91
|
"citty": "^0.1.6",
|
|
92
92
|
"dotenv": "^17.2.1",
|
|
93
93
|
"dotenv-expand": "^12.0.2",
|
|
@@ -112,7 +112,7 @@
|
|
|
112
112
|
"devDependencies": {
|
|
113
113
|
"@biomejs/biome": "2.5.15",
|
|
114
114
|
"@jridgewell/gen-mapping": "^0.3.5",
|
|
115
|
-
"@tamagui/build": "3.2.
|
|
115
|
+
"@tamagui/build": "3.2.4",
|
|
116
116
|
"@types/node": "^24.10.0",
|
|
117
117
|
"@types/ws": "^8.18.1",
|
|
118
118
|
"depcheck": "^1.4.7",
|
|
@@ -121,20 +121,20 @@
|
|
|
121
121
|
"react-native": "0.88.0",
|
|
122
122
|
"typescript": "7.0.2",
|
|
123
123
|
"vitest": "^4.1.0",
|
|
124
|
-
"@vxrn/vite-plugin-metro": "2.
|
|
124
|
+
"@vxrn/vite-plugin-metro": "2.15.0"
|
|
125
125
|
},
|
|
126
126
|
"publishConfig": {
|
|
127
127
|
"access": "public"
|
|
128
128
|
},
|
|
129
129
|
"peerDependencies": {
|
|
130
|
-
"@vxrn/vite-plugin-metro": "2.
|
|
130
|
+
"@vxrn/vite-plugin-metro": "2.15.0"
|
|
131
131
|
},
|
|
132
132
|
"peerDependenciesMeta": {
|
|
133
133
|
"@vxrn/vite-plugin-metro": {
|
|
134
134
|
"optional": true
|
|
135
135
|
}
|
|
136
136
|
},
|
|
137
|
-
"releaseSourceCommit": "
|
|
137
|
+
"releaseSourceCommit": "25aca02a5be98e8f28143e439d9e8f8e7ed5c0a8",
|
|
138
138
|
"repository": {
|
|
139
139
|
"type": "git",
|
|
140
140
|
"url": "git+https://github.com/onejs/one.git",
|
|
@@ -1286,6 +1286,65 @@ describe('ios scene lifecycle', () => {
|
|
|
1286
1286
|
expect(sceneDelegate).toContain('RCTLinkingManager.scene(scene, continue: userActivity)')
|
|
1287
1287
|
})
|
|
1288
1288
|
|
|
1289
|
+
it('runs native.app.patches on the generated files and fails on a missing anchor', async () => {
|
|
1290
|
+
const workspaceRoot = fileURLToPath(new URL('../../../..', import.meta.url))
|
|
1291
|
+
const output = mkdtempSync(join(tmpdir(), 'vxrn-prebuild-patches-'))
|
|
1292
|
+
const replaceOnce = (from: string, to: string) => (content: string) => {
|
|
1293
|
+
if (content.includes(to)) return content
|
|
1294
|
+
if (!content.includes(from)) throw new Error(`missing anchor: ${from}`)
|
|
1295
|
+
return content.replace(from, to)
|
|
1296
|
+
}
|
|
1297
|
+
const patches = [
|
|
1298
|
+
{
|
|
1299
|
+
platform: 'ios' as const,
|
|
1300
|
+
file: 'AppDelegate.swift',
|
|
1301
|
+
patch: replaceOnce(
|
|
1302
|
+
'Bundle.main.url(forResource: "main", withExtension: "jsbundle")',
|
|
1303
|
+
'HotUpdater.bundleURL()'
|
|
1304
|
+
),
|
|
1305
|
+
},
|
|
1306
|
+
{
|
|
1307
|
+
platform: 'ios' as const,
|
|
1308
|
+
file: 'MyApp/Info.plist',
|
|
1309
|
+
patch: replaceOnce('<dict>', '<dict>\n\t<key>HotUpdaterChannel</key>\n\t<string>production</string>'),
|
|
1310
|
+
},
|
|
1311
|
+
{
|
|
1312
|
+
platform: 'android' as const,
|
|
1313
|
+
file: 'MainApplication.kt',
|
|
1314
|
+
patch: replaceOnce(
|
|
1315
|
+
'getDefaultReactHost(\n context = applicationContext,',
|
|
1316
|
+
'getDefaultReactHost(\n context = applicationContext,\n jsBundleFilePath = HotUpdater.getJSBundleFile(applicationContext),'
|
|
1317
|
+
),
|
|
1318
|
+
},
|
|
1319
|
+
]
|
|
1320
|
+
await generateForPlatform(workspaceRoot, 'ios', { ...app, patches }, join(output, 'ios'))
|
|
1321
|
+
await generateForPlatform(workspaceRoot, 'android', { ...app, patches }, join(output, 'android'))
|
|
1322
|
+
expect(readFileSync(join(output, 'ios', 'MyApp', 'AppDelegate.swift'), 'utf8')).toContain(
|
|
1323
|
+
'HotUpdater.bundleURL()'
|
|
1324
|
+
)
|
|
1325
|
+
expect(readFileSync(join(output, 'ios', 'MyApp', 'Info.plist'), 'utf8')).toContain(
|
|
1326
|
+
'HotUpdaterChannel'
|
|
1327
|
+
)
|
|
1328
|
+
expect(
|
|
1329
|
+
readFileSync(
|
|
1330
|
+
join(output, 'android', 'app/src/main/java/dev/one/myapp/MainApplication.kt'),
|
|
1331
|
+
'utf8'
|
|
1332
|
+
)
|
|
1333
|
+
).toContain('jsBundleFilePath = HotUpdater.getJSBundleFile(applicationContext)')
|
|
1334
|
+
|
|
1335
|
+
await expect(
|
|
1336
|
+
generateForPlatform(
|
|
1337
|
+
workspaceRoot,
|
|
1338
|
+
'ios',
|
|
1339
|
+
{
|
|
1340
|
+
...app,
|
|
1341
|
+
patches: [{ platform: 'ios', file: 'AppDelegate.swift', patch: replaceOnce('nope-anchor', 'replacement-text') }],
|
|
1342
|
+
},
|
|
1343
|
+
join(output, 'ios2')
|
|
1344
|
+
)
|
|
1345
|
+
).rejects.toThrow('missing anchor')
|
|
1346
|
+
})
|
|
1347
|
+
|
|
1289
1348
|
it('bundles native.app fonts into both platforms from the real template', async () => {
|
|
1290
1349
|
const workspaceRoot = fileURLToPath(new URL('../../../..', import.meta.url))
|
|
1291
1350
|
const output = mkdtempSync(join(tmpdir(), 'vxrn-prebuild-fonts-'))
|
|
@@ -2972,6 +2972,36 @@ export const generateForPlatform = async (
|
|
|
2972
2972
|
if (platform === 'ios') await generateSwiftPackages({ root, dest })
|
|
2973
2973
|
if (platform === 'android') generateAndroidIconForwarder(dest, app)
|
|
2974
2974
|
if (platform === 'android') await generateKotlinSources({ root, dest })
|
|
2975
|
+
applyAppPatches(dest, platform, app)
|
|
2976
|
+
}
|
|
2977
|
+
|
|
2978
|
+
function listFiles(dir: string): string[] {
|
|
2979
|
+
return readdirSync(dir, { withFileTypes: true }).flatMap((entry) =>
|
|
2980
|
+
entry.isDirectory() ? listFiles(path.join(dir, entry.name)) : [path.join(dir, entry.name)]
|
|
2981
|
+
)
|
|
2982
|
+
}
|
|
2983
|
+
|
|
2984
|
+
function applyAppPatches(dest: string, platform: 'ios' | 'android', app: NativeAppManifest) {
|
|
2985
|
+
const patches = (app.patches ?? []).filter((entry) => entry.platform === platform)
|
|
2986
|
+
if (patches.length === 0) return
|
|
2987
|
+
const files = listFiles(dest)
|
|
2988
|
+
for (const { file, patch } of patches) {
|
|
2989
|
+
const matches = files.filter((candidate) => {
|
|
2990
|
+
const relative = path.relative(dest, candidate).split(path.sep).join('/')
|
|
2991
|
+
return relative === file || relative.endsWith('/' + file)
|
|
2992
|
+
})
|
|
2993
|
+
if (matches.length !== 1) {
|
|
2994
|
+
throw new Error(
|
|
2995
|
+
`[vxrn] native.app.patches: "${file}" matched ${matches.length} ${platform} files, expected exactly one`
|
|
2996
|
+
)
|
|
2997
|
+
}
|
|
2998
|
+
const before = readFileSync(matches[0], 'utf8')
|
|
2999
|
+
const after = patch(before)
|
|
3000
|
+
if (patch(after) !== after) {
|
|
3001
|
+
throw new Error(`[vxrn] native.app.patches: patch for "${file}" is not idempotent`)
|
|
3002
|
+
}
|
|
3003
|
+
writeFileSync(matches[0], after)
|
|
3004
|
+
}
|
|
2975
3005
|
}
|
|
2976
3006
|
|
|
2977
3007
|
// an imported kotlin source can reach past the base ui/foundation/material3
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prebuildWithoutExpo.d.ts","sourceRoot":"","sources":["../../src/exports/prebuildWithoutExpo.ts"],"names":[],"mappings":"AAkBA,OAAO,EAKL,iBAAiB,EAEjB,KAAK,iBAAiB,EAEvB,MAAM,+BAA+B,CAAA;AAwEtC,YAAY,EAAE,iBAAiB,IAAI,iBAAiB,EAAE,MAAM,+BAA+B,CAAA;AAE3F,eAAO,MAAM,mBAAmB,0BAAoB,CAAA;AA6EpD,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAwChE;AAyJD,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,WAAW,CAAC,WAAW,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC,YAAY,CA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