@gfean/react-native-bundle-drop 0.8.1 → 0.9.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 +18 -0
- package/lib/CLI/cli.d.ts +2 -1
- package/lib/CLI/cli.js +19 -18
- package/lib/CLI/scripts/sight-cli.js +1 -34
- package/lib/CLI/scripts/sight-ota.js +8 -8
- package/lib/CLI/scripts/upload-cli.js +9 -5
- package/lib/CLI/utils/read-xml-plist.d.ts +2 -0
- package/lib/CLI/utils/read-xml-plist.js +22 -0
- package/lib/manager/updateCheck.js +3 -34
- package/lib/scripts/bundle.d.ts +1 -1
- package/lib/scripts/bundle.js +4 -1
- package/lib/scripts/iosHermesDefault.d.ts +2 -0
- package/lib/scripts/iosHermesDefault.js +135 -0
- package/package.json +7 -5
package/README.md
CHANGED
|
@@ -57,6 +57,15 @@ runtime identity. Native changes still require a new App Store or Play Store bui
|
|
|
57
57
|
| Node.js | 20.19.4 or newer |
|
|
58
58
|
| React | 17 or newer |
|
|
59
59
|
|
|
60
|
+
The Node requirement applies to installation of the package, including projects
|
|
61
|
+
that use only the mobile SDK. Development and
|
|
62
|
+
package builds use Node 22.13.0, as specified in `.nvmrc`.
|
|
63
|
+
|
|
64
|
+
Run `bundle-drop --help` to browse commands grouped into Setup, Analysis,
|
|
65
|
+
Releases, and Account. Existing command names and flags remain unchanged.
|
|
66
|
+
For iOS metadata, `--plist-file` and Sight accept XML Info.plist files; binary
|
|
67
|
+
and OpenStep property lists are not supported.
|
|
68
|
+
|
|
60
69
|
## Installation
|
|
61
70
|
|
|
62
71
|
### Expo
|
|
@@ -115,6 +124,15 @@ canonical packaging. Each revision uses its own JavaScript engine configuration:
|
|
|
115
124
|
Hermes is compiled with project-local tooling when enabled. JavaScript attribution
|
|
116
125
|
and raw asset sizes remain separate; they are not bytecode attribution.
|
|
117
126
|
|
|
127
|
+
Bare iOS upload and Sight honor explicit Bundle Drop and native Hermes settings first.
|
|
128
|
+
For the standard React Native **0.81.x** template, they also recognize the installed
|
|
129
|
+
React Native helpers' implicit Hermes default when those helpers match the verified
|
|
130
|
+
0.81.5 files. This conservative fallback is skipped
|
|
131
|
+
for custom engine configuration, community JSC indicators, or unfamiliar templates
|
|
132
|
+
and versions. For a custom project, set `hermesBytecode: { ios: true }` (or `false`
|
|
133
|
+
for JavaScript) in `bundle.drop.config.js` to match the engine in your native app.
|
|
134
|
+
The fallback does not evaluate Ruby or change your Podfile.
|
|
135
|
+
|
|
118
136
|
Measurement adds compilation and archive compression after the JavaScript build, once
|
|
119
137
|
per side in a comparison. Expo's Hermes path also performs a separate bytecode
|
|
120
138
|
export to preserve its upload-specific minification behavior. It requires a resolvable app/runtime identity. When that
|
package/lib/CLI/cli.d.ts
CHANGED
package/lib/CLI/cli.js
CHANGED
|
@@ -98,11 +98,14 @@ const buildProgram = () => {
|
|
|
98
98
|
const program = new commander_1.Command();
|
|
99
99
|
program
|
|
100
100
|
.name('bundle-drop')
|
|
101
|
-
.version(package_json_1.default.version || '0.0.0', '-v, --cli-version', 'Show CLI version')
|
|
101
|
+
.version(package_json_1.default.version || '0.0.0', '-v, --cli-version', 'Show CLI version')
|
|
102
|
+
// Preserve the CLI's existing handling of extra arguments in shell wrappers.
|
|
103
|
+
.allowExcessArguments(true)
|
|
104
|
+
.configureHelp({ styleTitle: title => chalk_1.default.bold.cyan(title) })
|
|
105
|
+
.showHelpAfterError('Run "bundle-drop <command> --help" for usage.');
|
|
102
106
|
program.addHelpText('beforeAll', logo);
|
|
103
107
|
program.addHelpText('before', `
|
|
104
108
|
${chalk_1.default.magentaBright('Ship OTA Updates with Confidence\n')}
|
|
105
|
-
${chalk_1.default.bold.cyan('Available Commands:')}
|
|
106
109
|
`);
|
|
107
110
|
program.addHelpText('afterAll', `
|
|
108
111
|
${chalk_1.default.bold.cyan('Common Usage:')}
|
|
@@ -120,6 +123,7 @@ ${chalk_1.default.gray('Uploading →')} ${chalk_1.default.underline.gray(DOCS_U
|
|
|
120
123
|
${chalk_1.default.gray('CI/CD →')} ${chalk_1.default.underline.gray(DOCS_CI_CD_URL)}\n`);
|
|
121
124
|
program
|
|
122
125
|
.command('sight')
|
|
126
|
+
.helpGroup('Analysis:')
|
|
123
127
|
.option('--compare <ref>', 'Compare the working tree with an explicit Git baseline')
|
|
124
128
|
.option('--fetch', 'Refresh the explicitly named remote branch before comparing')
|
|
125
129
|
.option('--include <path>', 'Copy an ignored local input identically into both builds (repeatable)', (value, previous) => [...previous, value], [])
|
|
@@ -142,6 +146,7 @@ ${chalk_1.default.bold('Examples:')}
|
|
|
142
146
|
.action(sight_cli_1.runSightCommand);
|
|
143
147
|
program
|
|
144
148
|
.command('upload <platform>')
|
|
149
|
+
.helpGroup('Releases:')
|
|
145
150
|
.option('--plist-file <path>', 'Path to Info.plist for iOS')
|
|
146
151
|
.option('--version <version>', 'App version. iOS will fallback to --plist-file; Android can fallback to build.gradle when provided.')
|
|
147
152
|
.option('--buildgradle-path <path>', 'Optional Android build.gradle path to read versionName')
|
|
@@ -167,6 +172,7 @@ ${chalk_1.default.gray('CI/CD docs →')} ${chalk_1.default.underline.gray(DOCS_
|
|
|
167
172
|
.action(upload_cli_1.default);
|
|
168
173
|
program
|
|
169
174
|
.command('logout')
|
|
175
|
+
.helpGroup('Account:')
|
|
170
176
|
.description('Log out of the CLI')
|
|
171
177
|
.action(() => {
|
|
172
178
|
const tokenPath = getTokenPath();
|
|
@@ -180,12 +186,14 @@ ${chalk_1.default.gray('CI/CD docs →')} ${chalk_1.default.underline.gray(DOCS_
|
|
|
180
186
|
});
|
|
181
187
|
program
|
|
182
188
|
.command('login')
|
|
189
|
+
.helpGroup('Account:')
|
|
183
190
|
.description('Log in to the CLI')
|
|
184
191
|
.action(() => require('../CLI/scripts/login-cli').default());
|
|
185
192
|
program
|
|
186
193
|
.command('init')
|
|
194
|
+
.helpGroup('Setup:')
|
|
187
195
|
.option('--token <token>', 'Personal Access Token (alternative to `bundle-drop login`)')
|
|
188
|
-
.
|
|
196
|
+
.addOption(new commander_1.Option('--project-type <type>', 'Force project type: expo or bare').choices(['expo', 'bare']))
|
|
189
197
|
.option('--dry-run', 'Preview setup and AI context without changing files')
|
|
190
198
|
.option('--migrate-code-push', 'Explicitly remove react-native-code-push after reviewing its native migration')
|
|
191
199
|
.option('--migrate-expo-updates', 'Explicitly remove active expo-updates configuration and dependency')
|
|
@@ -193,9 +201,6 @@ ${chalk_1.default.gray('CI/CD docs →')} ${chalk_1.default.underline.gray(DOCS_
|
|
|
193
201
|
.option('--yes', 'Approve ordinary setup changes noninteractively')
|
|
194
202
|
.description('Configure Bundle Drop for Expo or bare React Native')
|
|
195
203
|
.action(async (options) => {
|
|
196
|
-
if (options.projectType && !['expo', 'bare'].includes(options.projectType)) {
|
|
197
|
-
throw new Error('--project-type must be expo or bare.');
|
|
198
|
-
}
|
|
199
204
|
if (options.token) {
|
|
200
205
|
const { detectProjectType } = require('../expo');
|
|
201
206
|
const projectType = detectProjectType({
|
|
@@ -308,6 +313,7 @@ ${chalk_1.default.gray('CI/CD docs →')} ${chalk_1.default.underline.gray(DOCS_
|
|
|
308
313
|
});
|
|
309
314
|
program
|
|
310
315
|
.command('sync')
|
|
316
|
+
.helpGroup('Setup:')
|
|
311
317
|
.option('--token <token>', 'Personal Access Token (alternative to `bundle-drop login`)')
|
|
312
318
|
.option('--dry-run', 'Validate and preview bootstrap synchronization without writing')
|
|
313
319
|
.description('Refresh the package-managed runtime delivery bootstrap')
|
|
@@ -342,8 +348,9 @@ ${chalk_1.default.gray('CI/CD docs →')} ${chalk_1.default.underline.gray(DOCS_
|
|
|
342
348
|
});
|
|
343
349
|
program
|
|
344
350
|
.command('doctor')
|
|
345
|
-
.
|
|
346
|
-
.
|
|
351
|
+
.helpGroup('Setup:')
|
|
352
|
+
.addOption(new commander_1.Option('--platform <platform>', 'Limit checks to ios or android').choices(['ios', 'android']))
|
|
353
|
+
.addOption(new commander_1.Option('--project-type <type>', 'Force project type: expo or bare').choices(['expo', 'bare']))
|
|
347
354
|
.description('Validate Bundle Drop setup, runtime identity, and OTA startup ownership')
|
|
348
355
|
.addHelpText('after', `
|
|
349
356
|
${chalk_1.default.bold('Examples:')}
|
|
@@ -352,23 +359,16 @@ ${chalk_1.default.bold('Examples:')}
|
|
|
352
359
|
${chalk_1.default.gray('bundle-drop doctor --project-type bare --platform android')}
|
|
353
360
|
`)
|
|
354
361
|
.action(async (options) => {
|
|
355
|
-
if (options.platform && !['ios', 'android'].includes(options.platform)) {
|
|
356
|
-
throw new Error('--platform must be ios or android.');
|
|
357
|
-
}
|
|
358
|
-
if (options.projectType && !['expo', 'bare'].includes(options.projectType)) {
|
|
359
|
-
throw new Error('--project-type must be expo or bare.');
|
|
360
|
-
}
|
|
361
362
|
await require('./scripts/doctor').runDoctor(options);
|
|
362
363
|
});
|
|
363
364
|
program
|
|
364
|
-
.command('eas-receipt
|
|
365
|
+
.command('eas-receipt')
|
|
366
|
+
.helpGroup('Releases:')
|
|
367
|
+
.addArgument(new commander_1.Argument('<platform>', 'Platform of the finished EAS build').choices(['ios', 'android']))
|
|
365
368
|
.requiredOption('--build-id <id>', 'Exact finished EAS application build ID')
|
|
366
369
|
.option('--output <path>', 'Receipt path; defaults under .bundle-drop')
|
|
367
370
|
.description('Create an authenticated Expo build receipt from official EAS metadata')
|
|
368
371
|
.action(async (platform, options) => {
|
|
369
|
-
if (platform !== 'ios' && platform !== 'android') {
|
|
370
|
-
throw new Error('eas-receipt platform must be ios or android.');
|
|
371
|
-
}
|
|
372
372
|
const receiptPath = await require('./scripts/expo/write-eas-build-receipt')
|
|
373
373
|
.writeEasBuildReceipt({
|
|
374
374
|
projectRoot: process.cwd(),
|
|
@@ -380,6 +380,7 @@ ${chalk_1.default.bold('Examples:')}
|
|
|
380
380
|
});
|
|
381
381
|
program
|
|
382
382
|
.command('whoami')
|
|
383
|
+
.helpGroup('Account:')
|
|
383
384
|
.description('Show currently logged in user')
|
|
384
385
|
.action(() => {
|
|
385
386
|
const authState = readStoredAuthData();
|
|
@@ -1,37 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
4
|
};
|
|
@@ -95,7 +62,7 @@ async function runSightCommand(options) {
|
|
|
95
62
|
throw new Error('--project-type must be expo or bare.');
|
|
96
63
|
}
|
|
97
64
|
if (options.compare !== undefined) {
|
|
98
|
-
const { runSightComparison } = await
|
|
65
|
+
const { runSightComparison } = await import('./sight-compare/run.js');
|
|
99
66
|
await runSightComparison(options);
|
|
100
67
|
return;
|
|
101
68
|
}
|
|
@@ -9,7 +9,7 @@ const child_process_1 = require("child_process");
|
|
|
9
9
|
const fs_1 = __importDefault(require("fs"));
|
|
10
10
|
const path_1 = __importDefault(require("path"));
|
|
11
11
|
const module_1 = require("module");
|
|
12
|
-
const
|
|
12
|
+
const read_xml_plist_1 = require("../utils/read-xml-plist");
|
|
13
13
|
const buildIdentity_1 = require("../../expo/buildIdentity");
|
|
14
14
|
const exportValidation_1 = require("../../expo/exportValidation");
|
|
15
15
|
const canonicalArtifact_1 = require("../../scripts/canonicalArtifact");
|
|
@@ -51,7 +51,7 @@ function iosVersion(options, value) {
|
|
|
51
51
|
return values.length > 0 && values.every(concreteVersion) && new Set(values).size === 1 ? values[0] : undefined;
|
|
52
52
|
}
|
|
53
53
|
/** Only literal, unambiguous native versions are used; no native build configuration is executed. */
|
|
54
|
-
function bareAppVersion(options) {
|
|
54
|
+
async function bareAppVersion(options) {
|
|
55
55
|
if (options.platform === 'android') {
|
|
56
56
|
const files = ['build.gradle', 'build.gradle.kts'].map(name => path_1.default.join(options.projectRoot, 'android', 'app', name)).filter(file => fs_1.default.existsSync(file));
|
|
57
57
|
if (files.length !== 1)
|
|
@@ -70,12 +70,12 @@ function bareAppVersion(options) {
|
|
|
70
70
|
if (item.isDirectory() && !['Pods', 'build'].includes(item.name))
|
|
71
71
|
candidates.push(path_1.default.join(ios, item.name, 'Info.plist'));
|
|
72
72
|
}
|
|
73
|
-
const documents = candidates.filter(file => fs_1.default.existsSync(file)).map(file =>
|
|
74
|
-
const applications = documents.filter(document => document.CFBundlePackageType === 'APPL');
|
|
73
|
+
const documents = await Promise.all(candidates.filter(file => fs_1.default.existsSync(file)).map(file => (0, read_xml_plist_1.readXmlPlist)(insideSnapshot(options, file))));
|
|
74
|
+
const applications = documents.filter(document => Object.prototype.hasOwnProperty.call(document, 'CFBundlePackageType') && document.CFBundlePackageType === 'APPL');
|
|
75
75
|
// Test bundles and extensions have their own versions, unrelated to the app's OTA identity.
|
|
76
76
|
// Older app plists may omit the package type; use those only when no explicit app exists.
|
|
77
|
-
const appDocuments = applications.length > 0 ? applications : documents.filter(document => document
|
|
78
|
-
const versions = appDocuments.map(document => iosVersion(options, document.CFBundleShortVersionString));
|
|
77
|
+
const appDocuments = applications.length > 0 ? applications : documents.filter(document => !Object.prototype.hasOwnProperty.call(document, 'CFBundlePackageType') && !Object.prototype.hasOwnProperty.call(document, 'NSExtension'));
|
|
78
|
+
const versions = appDocuments.map(document => iosVersion(options, Object.prototype.hasOwnProperty.call(document, 'CFBundleShortVersionString') ? document.CFBundleShortVersionString : undefined));
|
|
79
79
|
if (!versions.length || !versions.every(concreteVersion) || new Set(versions).size !== 1)
|
|
80
80
|
return undefined;
|
|
81
81
|
return versions[0];
|
|
@@ -142,12 +142,12 @@ async function measureInstalledSightOta(options) {
|
|
|
142
142
|
return unavailable(`Bundle Drop has no runtime version configured for ${options.platform}. Set runtimeVersion.${options.platform} in bundle.drop.config.js.`);
|
|
143
143
|
}
|
|
144
144
|
reason = `The native ${options.platform} app version could not be resolved unambiguously for Bundle Drop OTA packaging.`;
|
|
145
|
-
const version = bareAppVersion(options);
|
|
145
|
+
const version = await bareAppVersion(options);
|
|
146
146
|
if (!version)
|
|
147
147
|
return unavailable(reason);
|
|
148
148
|
appVersion = version;
|
|
149
149
|
runtimeVersion = runtime;
|
|
150
|
-
hermes = (0, bundle_1.shouldCompileHermesBytecode)(config, options.platform, options.projectRoot);
|
|
150
|
+
hermes = (0, bundle_1.shouldCompileHermesBytecode)(config, options.platform, options.projectRoot, options.snapshotRoot);
|
|
151
151
|
}
|
|
152
152
|
const bundlePath = path_1.default.join(options.workDirectory, 'main.jsbundle');
|
|
153
153
|
let assetsDirectory = options.assetsDirectory;
|
|
@@ -43,8 +43,8 @@ const child_process_1 = require("child_process");
|
|
|
43
43
|
const form_data_1 = __importDefault(require("form-data"));
|
|
44
44
|
const fs = __importStar(require("fs"));
|
|
45
45
|
const path = __importStar(require("path"));
|
|
46
|
-
const plist = __importStar(require("plist"));
|
|
47
46
|
const ui_1 = require("../utils/ui");
|
|
47
|
+
const read_xml_plist_1 = require("../utils/read-xml-plist");
|
|
48
48
|
const resolve_ios_version_1 = require("../../scripts/resolve-ios-version");
|
|
49
49
|
const expo_1 = require("../../expo");
|
|
50
50
|
const resolveModule_1 = require("../../scripts/resolveModule");
|
|
@@ -265,13 +265,17 @@ async function runUpload(platform, options, dependencies = defaultUploadDependen
|
|
|
265
265
|
process.exit(1);
|
|
266
266
|
}
|
|
267
267
|
try {
|
|
268
|
-
const
|
|
269
|
-
const
|
|
270
|
-
|
|
271
|
-
|
|
268
|
+
const parsed = await (0, read_xml_plist_1.readXmlPlist)(options.plistFile);
|
|
269
|
+
const rawVersion = Object.prototype.hasOwnProperty.call(parsed, 'CFBundleShortVersionString')
|
|
270
|
+
? parsed.CFBundleShortVersionString
|
|
271
|
+
: undefined;
|
|
272
|
+
if (rawVersion === undefined) {
|
|
272
273
|
ui_1.log.error('❌ Could not find CFBundleShortVersionString in plist');
|
|
273
274
|
process.exit(1);
|
|
274
275
|
}
|
|
276
|
+
if (typeof rawVersion !== 'string' || !rawVersion.trim()) {
|
|
277
|
+
throw new Error('CFBundleShortVersionString must be a non-empty string.');
|
|
278
|
+
}
|
|
275
279
|
const resolved = (0, resolve_ios_version_1.resolveIosPlistVersion)(rawVersion, projectRoot);
|
|
276
280
|
if (!resolved) {
|
|
277
281
|
process.exit(1);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.readXmlPlist = readXmlPlist;
|
|
7
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
|
+
/** Read native XML metadata without enabling Plist's binary/OpenStep autodetection. */
|
|
9
|
+
async function readXmlPlist(file) {
|
|
10
|
+
const xml = node_fs_1.default.readFileSync(file, 'utf8').replace(/^\uFEFF/, '');
|
|
11
|
+
if (!xml.trimStart().startsWith('<')) {
|
|
12
|
+
throw new Error('Info.plist must be an XML property list.');
|
|
13
|
+
}
|
|
14
|
+
const { parse } = await import('plist');
|
|
15
|
+
const document = parse(xml);
|
|
16
|
+
if (document === null ||
|
|
17
|
+
typeof document !== 'object' ||
|
|
18
|
+
Object.getPrototypeOf(document) !== Object.prototype) {
|
|
19
|
+
throw new Error('Info.plist must contain a dictionary.');
|
|
20
|
+
}
|
|
21
|
+
return document;
|
|
22
|
+
}
|
|
@@ -1,37 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
3
|
exports.getAvailableChannels = getAvailableChannels;
|
|
37
4
|
exports.checkForUpdate = checkForUpdate;
|
|
@@ -114,7 +81,9 @@ async function readResolveContext(channelName) {
|
|
|
114
81
|
(0, installId_1.getOrCreateInstallId)(),
|
|
115
82
|
(0, rollbackState_1.getFailedBundleHashes)(),
|
|
116
83
|
]);
|
|
117
|
-
const supportsXdelta = await Promise.resolve()
|
|
84
|
+
const supportsXdelta = await Promise.resolve()
|
|
85
|
+
.then(() => require('../native/fs'))
|
|
86
|
+
.then(module => module.default.supportsXdelta())
|
|
118
87
|
.catch(() => false);
|
|
119
88
|
return {
|
|
120
89
|
channelName,
|
package/lib/scripts/bundle.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ type BundleScriptOptions = {
|
|
|
14
14
|
};
|
|
15
15
|
export declare const buildHermesFlags: (hermescPath: string, generateSourceMap: boolean, spawnProcess: SpawnProcess) => string[];
|
|
16
16
|
export declare const detectHermesFromNativeProject: (projectRoot: string, platform: string) => boolean | undefined;
|
|
17
|
-
export declare const shouldCompileHermesBytecode: (cfg: Record<string, unknown>, platform: string, projectRoot: string) => boolean;
|
|
17
|
+
export declare const shouldCompileHermesBytecode: (cfg: Record<string, unknown>, platform: string, projectRoot: string, snapshotRoot?: string) => boolean;
|
|
18
18
|
export declare function runBundleScript(options?: BundleScriptOptions): {
|
|
19
19
|
outputDir: string;
|
|
20
20
|
bundlePath: string;
|
package/lib/scripts/bundle.js
CHANGED
|
@@ -44,6 +44,7 @@ const canonicalArtifact_1 = require("./canonicalArtifact");
|
|
|
44
44
|
const projectRoot_1 = require("./projectRoot");
|
|
45
45
|
Object.defineProperty(exports, "findProjectRoot", { enumerable: true, get: function () { return projectRoot_1.findProjectRoot; } });
|
|
46
46
|
const resolveModule_1 = require("./resolveModule");
|
|
47
|
+
const iosHermesDefault_1 = require("./iosHermesDefault");
|
|
47
48
|
const SENTRY_HERMES_OTA_DOCS_URL = 'https://bundledrop.app/docs/observability#sentry-and-hermes-ota-builds';
|
|
48
49
|
const SENTRY_DEBUG_ID_MARKERS = ['//# debugId=', 'sentry-dbid-'];
|
|
49
50
|
const runProcess = (spawnProcess, executable, args, options) => {
|
|
@@ -182,7 +183,7 @@ const detectHermesFromNativeProject = (projectRoot, platform) => {
|
|
|
182
183
|
]);
|
|
183
184
|
};
|
|
184
185
|
exports.detectHermesFromNativeProject = detectHermesFromNativeProject;
|
|
185
|
-
const shouldCompileHermesBytecode = (cfg, platform, projectRoot) => {
|
|
186
|
+
const shouldCompileHermesBytecode = (cfg, platform, projectRoot, snapshotRoot) => {
|
|
186
187
|
const explicit = readPlatformSetting(cfg.hermesBytecode, platform) ??
|
|
187
188
|
readPlatformSetting(cfg.hermes, platform);
|
|
188
189
|
if (typeof explicit === 'boolean')
|
|
@@ -190,6 +191,8 @@ const shouldCompileHermesBytecode = (cfg, platform, projectRoot) => {
|
|
|
190
191
|
const detected = (0, exports.detectHermesFromNativeProject)(projectRoot, platform);
|
|
191
192
|
if (detected !== undefined)
|
|
192
193
|
return detected;
|
|
194
|
+
if (platform === 'ios' && (0, iosHermesDefault_1.detectImplicitIosHermes)(projectRoot, snapshotRoot))
|
|
195
|
+
return true;
|
|
193
196
|
if (explicit === 'auto') {
|
|
194
197
|
console.warn(`⚠️ Could not detect Hermes for ${platform}; set hermesBytecode.${platform} in bundle.drop.config.js to opt in explicitly.`);
|
|
195
198
|
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.detectImplicitIosHermes = detectImplicitIosHermes;
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const crypto_1 = require("crypto");
|
|
10
|
+
// This recognizes a known template, not arbitrary Ruby configuration. Unknown
|
|
11
|
+
// layouts must keep using the existing detector or an explicit SDK setting.
|
|
12
|
+
const engineMention = /hermes|jsc|javascriptcore|js[_-]?engine/i;
|
|
13
|
+
function withoutUnusedTemplateFramework(text) {
|
|
14
|
+
// The stock Xcode template lists JavaScriptCore in its navigator but does not
|
|
15
|
+
// link it. Ignore that exact unused reference, not linked JSC or engine flags.
|
|
16
|
+
const reference = text.match(/^\s*([A-F0-9]{24}) \/\* JavaScriptCore\.framework \*\/ = \{isa = PBXFileReference; lastKnownFileType = wrapper\.framework; name = JavaScriptCore\.framework; path = System\/Library\/Frameworks\/JavaScriptCore\.framework; sourceTree = SDKROOT; \};$/m);
|
|
17
|
+
if (!reference || text.split(reference[1]).length !== 3)
|
|
18
|
+
return text;
|
|
19
|
+
return text.replace(reference[0], '').replace(new RegExp(`^\\s*${reference[1]} /\\* JavaScriptCore\\.framework \\*/,\\s*$`, 'm'), '');
|
|
20
|
+
}
|
|
21
|
+
// RN 0.81.5's shipped helpers. Deliberately decline other implementations rather
|
|
22
|
+
// than interpret Ruby or assume that a package version proves engine semantics.
|
|
23
|
+
const helperHashes = {
|
|
24
|
+
'scripts/react_native_pods.rb': 'bd090959a5ff31edcd1c391a44a4e5f342969a33e11f9d4ecd457bda2a2eef73',
|
|
25
|
+
'scripts/cocoapods/jsengine.rb': '4bc4b49e4ab5adf1fc2000e276822cb31af7819a5d9ce1a635563cb7cc527106',
|
|
26
|
+
};
|
|
27
|
+
const compactRuby = (text) => text
|
|
28
|
+
.replace(/^\s*#.*$/gm, '')
|
|
29
|
+
.replace(/\s+/g, ' ')
|
|
30
|
+
.replace(/"/g, "'")
|
|
31
|
+
.trim();
|
|
32
|
+
const standardLoader = compactRuby(`require Pod::Executable.execute_command('node', ['-p',
|
|
33
|
+
'require.resolve(
|
|
34
|
+
"react-native/scripts/react_native_pods.rb",
|
|
35
|
+
{paths: [process.argv[1]]},
|
|
36
|
+
)', __dir__]).strip`);
|
|
37
|
+
const standardArguments = compactRuby(`
|
|
38
|
+
:path => config[:reactNativePath],
|
|
39
|
+
:app_path => "#{Pod::Config.instance.installation_root}/.."
|
|
40
|
+
`);
|
|
41
|
+
/** Only infer the installed 0.81.x template's default after explicit detection. */
|
|
42
|
+
function detectImplicitIosHermes(projectRoot, snapshotRoot) {
|
|
43
|
+
if (process.env.USE_HERMES !== undefined || process.env.USE_THIRD_PARTY_JSC !== undefined)
|
|
44
|
+
return undefined;
|
|
45
|
+
try {
|
|
46
|
+
const boundary = snapshotRoot ? fs_1.default.realpathSync(snapshotRoot) : undefined;
|
|
47
|
+
function checked(file) {
|
|
48
|
+
const resolved = fs_1.default.realpathSync(file);
|
|
49
|
+
if (boundary) {
|
|
50
|
+
const relative = path_1.default.relative(boundary, resolved);
|
|
51
|
+
if (relative === '..' || relative.startsWith(`..${path_1.default.sep}`) || path_1.default.isAbsolute(relative)) {
|
|
52
|
+
throw new Error('Hermes configuration resolved outside the comparison snapshot.');
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return resolved;
|
|
56
|
+
}
|
|
57
|
+
function read(file) {
|
|
58
|
+
return fs_1.default.readFileSync(checked(file), 'utf8');
|
|
59
|
+
}
|
|
60
|
+
const app = JSON.parse(read(path_1.default.join(projectRoot, 'package.json')));
|
|
61
|
+
const dependencies = { ...app.dependencies, ...app.devDependencies, ...app.optionalDependencies, ...app.peerDependencies };
|
|
62
|
+
if (!dependencies['react-native'] || Object.keys(dependencies).some(name => /jsc|javascriptcore/i.test(name)))
|
|
63
|
+
return undefined;
|
|
64
|
+
if (['js', 'cjs', 'mjs', 'ts'].some(extension => fs_1.default.existsSync(path_1.default.join(projectRoot, `react-native.config.${extension}`))))
|
|
65
|
+
return undefined;
|
|
66
|
+
const ios = path_1.default.join(projectRoot, 'ios');
|
|
67
|
+
if (fs_1.default.existsSync(path_1.default.join(ios, 'node_modules/react-native')))
|
|
68
|
+
return undefined;
|
|
69
|
+
const podfile = read(path_1.default.join(ios, 'Podfile'));
|
|
70
|
+
const nativeFiles = ['.xcode.env', '.xcode.env.local', 'Podfile.properties.json']
|
|
71
|
+
.map(name => path_1.default.join(ios, name));
|
|
72
|
+
for (const name of fs_1.default.readdirSync(checked(ios))) {
|
|
73
|
+
if (name.endsWith('.xcodeproj'))
|
|
74
|
+
nativeFiles.push(path_1.default.join(ios, name, 'project.pbxproj'));
|
|
75
|
+
if (name.endsWith('.xcconfig'))
|
|
76
|
+
nativeFiles.push(path_1.default.join(ios, name));
|
|
77
|
+
}
|
|
78
|
+
const nativeContents = nativeFiles.filter(file => fs_1.default.existsSync(file)).map(file => {
|
|
79
|
+
const contents = read(file);
|
|
80
|
+
return file.endsWith('project.pbxproj') ? withoutUnusedTemplateFramework(contents) : contents;
|
|
81
|
+
});
|
|
82
|
+
if ([podfile, ...nativeContents].some(text => engineMention.test(text)))
|
|
83
|
+
return undefined;
|
|
84
|
+
// The stock template already references CocoaPods' generated debug/release
|
|
85
|
+
// configs before pods are installed. Other referenced configs are custom.
|
|
86
|
+
for (const text of nativeContents) {
|
|
87
|
+
for (const line of text.split('\n').filter(line => line.includes('baseConfigurationReference'))) {
|
|
88
|
+
if (!/\/\* Pods-[\w-]+\.(?:debug|release)\.xcconfig \*\//.test(line))
|
|
89
|
+
return undefined;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
const ruby = compactRuby(podfile);
|
|
93
|
+
const calls = [...ruby.matchAll(/\buse_react_native!\s*\(([^()]*)\)/g)];
|
|
94
|
+
if (!ruby.includes(standardLoader) || calls.length !== 1 ||
|
|
95
|
+
[...ruby.matchAll(/\buse_react_native!/g)].length !== 1 ||
|
|
96
|
+
compactRuby(calls[0][1]) !== standardArguments ||
|
|
97
|
+
!/\bconfig = use_native_modules! use_react_native!/.test(ruby) ||
|
|
98
|
+
[...ruby.matchAll(/\bconfig\s*=/g)].length !== 1 ||
|
|
99
|
+
/\bconfig\s*(?:\[[^\]]*\]\s*=|\.)/.test(ruby) ||
|
|
100
|
+
/\b(?:def|eval|load|require_relative)\b/.test(ruby) ||
|
|
101
|
+
[...ruby.matchAll(/\brequire\b(?!\.)/g)].length !== 1)
|
|
102
|
+
return undefined;
|
|
103
|
+
// Search only the consumer's node_modules ancestry: never NODE_PATH or the
|
|
104
|
+
// CLI's own React Native dependency. Hoisted and symlinked installs work too.
|
|
105
|
+
let directory = path_1.default.resolve(projectRoot);
|
|
106
|
+
let manifest;
|
|
107
|
+
while (true) {
|
|
108
|
+
const candidate = path_1.default.join(directory, 'node_modules/react-native/package.json');
|
|
109
|
+
if (fs_1.default.existsSync(candidate)) {
|
|
110
|
+
manifest = checked(candidate);
|
|
111
|
+
break;
|
|
112
|
+
}
|
|
113
|
+
const parent = path_1.default.dirname(directory);
|
|
114
|
+
if (parent === directory || (boundary && fs_1.default.realpathSync(directory) === boundary))
|
|
115
|
+
break;
|
|
116
|
+
directory = parent;
|
|
117
|
+
}
|
|
118
|
+
if (!manifest)
|
|
119
|
+
return undefined;
|
|
120
|
+
const rn = JSON.parse(read(manifest));
|
|
121
|
+
if (rn.name !== 'react-native' || typeof rn.version !== 'string' || !/^0\.81\.\d+$/.test(rn.version))
|
|
122
|
+
return undefined;
|
|
123
|
+
const root = path_1.default.dirname(manifest);
|
|
124
|
+
for (const [file, expectedHash] of Object.entries(helperHashes)) {
|
|
125
|
+
const source = read(path_1.default.join(root, file)).replace(/\r\n/g, '\n');
|
|
126
|
+
if ((0, crypto_1.createHash)('sha256').update(source).digest('hex') !== expectedHash)
|
|
127
|
+
return undefined;
|
|
128
|
+
}
|
|
129
|
+
return true;
|
|
130
|
+
}
|
|
131
|
+
catch {
|
|
132
|
+
// Missing, unreadable, or unfamiliar inputs provide no evidence of a default.
|
|
133
|
+
return undefined;
|
|
134
|
+
}
|
|
135
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gfean/react-native-bundle-drop",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"nativeVersion": "0.6.0",
|
|
5
5
|
"description": "Over-the-air updates for Expo and bare React Native apps, with channels, staged rollouts, patch delivery, and rollback.",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -38,6 +38,8 @@
|
|
|
38
38
|
"clean": "rimraf lib dist",
|
|
39
39
|
"build": "npm run clean && tsc -p tsconfig.build.json && node scripts/make-cli-executable.js",
|
|
40
40
|
"test": "jest --runInBand",
|
|
41
|
+
"typecheck": "tsc --noEmit -p tsconfig.json",
|
|
42
|
+
"test:cli:compat": "node scripts/check-cli-compatibility.cjs",
|
|
41
43
|
"test:coverage": "jest --runInBand --coverage",
|
|
42
44
|
"coverage:check": "node scripts/check-coverage-thresholds.cjs",
|
|
43
45
|
"coverage:gate": "yarn test:coverage && yarn coverage:check",
|
|
@@ -50,7 +52,7 @@
|
|
|
50
52
|
"codeql:local:fast": "node scripts/run-codeql-local.cjs fast",
|
|
51
53
|
"codeql:local:full": "node scripts/run-codeql-local.cjs full",
|
|
52
54
|
"codeql:local:compare": "node scripts/run-codeql-local.cjs compare",
|
|
53
|
-
"verify:quick": "yarn build && yarn coverage:gate && yarn test:expo:plugin && yarn package:check",
|
|
55
|
+
"verify:quick": "yarn typecheck && yarn build && yarn coverage:gate && yarn test:expo:plugin && yarn package:check",
|
|
54
56
|
"verify:native": "yarn test:android && yarn test:ios",
|
|
55
57
|
"verify:release": "yarn verify:quick && yarn verify:native && yarn audit:production",
|
|
56
58
|
"prepack": "npm run build",
|
|
@@ -59,7 +61,7 @@
|
|
|
59
61
|
"devDependencies": {
|
|
60
62
|
"@types/adm-zip": "^0.5.8",
|
|
61
63
|
"@types/jest": "^29.5.14",
|
|
62
|
-
"@types/node": "^24.13.
|
|
64
|
+
"@types/node": "^24.13.5",
|
|
63
65
|
"@types/react": "^18.2.66",
|
|
64
66
|
"@types/react-native": "^0.73.0",
|
|
65
67
|
"expo-autolinking-sdk55": "npm:expo-modules-autolinking@55.0.8",
|
|
@@ -172,12 +174,12 @@
|
|
|
172
174
|
"adm-zip": "0.6.1",
|
|
173
175
|
"axios": "1.20.0",
|
|
174
176
|
"chalk": "4.1.2",
|
|
175
|
-
"commander": "
|
|
177
|
+
"commander": "14.0.3",
|
|
176
178
|
"diff": "9.0.0",
|
|
177
179
|
"figures": "3.2.0",
|
|
178
180
|
"form-data": "4.0.6",
|
|
179
181
|
"fs-extra": "11.4.0",
|
|
180
|
-
"plist": "
|
|
182
|
+
"plist": "5.0.0",
|
|
181
183
|
"prompts": "2.4.2"
|
|
182
184
|
},
|
|
183
185
|
"publishConfig": {
|