@gfean/react-native-bundle-drop 0.4.3 → 0.4.5
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/BundleDropExpo.podspec +21 -0
- package/README.md +250 -124
- package/android/src/main/java/com/bundledrop/BundleDropNativePaths.kt +33 -3
- package/app.plugin.js +3 -0
- package/expo/android/build.gradle +159 -0
- package/expo/android/src/main/AndroidManifest.xml +1 -0
- package/expo/android/src/main/java/com/bundledrop/expo/BundleDropExpoConfiguration.kt +35 -0
- package/expo/android/src/main/java/com/bundledrop/expo/BundleDropExpoIdentityModule.kt +30 -0
- package/expo/android/src/main/java/com/bundledrop/expo/BundleDropExpoPackage.kt +29 -0
- package/expo/android/src/main/java/com/bundledrop/expo/BundleDropExpoReactNativeHostHandler.kt +16 -0
- package/expo/bundle-drop-expo-gradle-plugin/build.gradle +31 -0
- package/expo/bundle-drop-expo-gradle-plugin/src/main/groovy/com/bundledrop/gradle/BundleDropExpoPlugin.groovy +83 -0
- package/expo/bundle-drop-expo-gradle-plugin/src/main/groovy/com/bundledrop/gradle/GenerateBundleDropBuildIdentityTask.groovy +57 -0
- package/expo/ios/Sources/BundleDropExpoIdentity.m +31 -0
- package/expo/ios/Sources/BundleDropExpoReactDelegateHandler.swift +24 -0
- package/expo-module.config.json +19 -0
- package/ios/BundleDropLocator.swift +7 -1
- package/lib/CLI/cli.d.ts +1 -2
- package/lib/CLI/cli.js +151 -56
- package/lib/CLI/logo.js +1 -1
- package/lib/CLI/scripts/aipowered/apply-setup-plan.d.ts +12 -0
- package/lib/CLI/scripts/aipowered/{apply-plan.js → apply-setup-plan.js} +24 -19
- package/lib/CLI/scripts/aipowered/backend-client.d.ts +4 -4
- package/lib/CLI/scripts/aipowered/backend-client.js +7 -7
- package/lib/CLI/scripts/aipowered/init-project-config.d.ts +17 -0
- package/lib/CLI/scripts/aipowered/init-project-config.js +418 -0
- package/lib/CLI/scripts/aipowered/scanner.d.ts +10 -3
- package/lib/CLI/scripts/aipowered/scanner.js +225 -201
- package/lib/CLI/scripts/aipowered/types.d.ts +37 -33
- package/lib/CLI/scripts/aipowered/validate-plan.d.ts +9 -2
- package/lib/CLI/scripts/aipowered/validate-plan.js +70 -119
- package/lib/CLI/scripts/bare-metro-config.d.ts +7 -0
- package/lib/CLI/scripts/{init-metro-config.js → bare-metro-config.js} +16 -30
- package/lib/CLI/scripts/doctor.d.ts +17 -0
- package/lib/CLI/scripts/doctor.js +410 -0
- package/lib/CLI/scripts/expo/build-receipt.d.ts +26 -0
- package/lib/CLI/scripts/expo/build-receipt.js +223 -0
- package/lib/CLI/scripts/expo/configure-expo.d.ts +28 -0
- package/lib/CLI/scripts/expo/configure-expo.js +268 -0
- package/lib/CLI/scripts/expo/eas-build-proof.d.ts +22 -0
- package/lib/CLI/scripts/expo/eas-build-proof.js +116 -0
- package/lib/CLI/scripts/expo/package-manager.d.ts +11 -0
- package/lib/CLI/scripts/expo/package-manager.js +84 -0
- package/lib/CLI/scripts/expo/write-build-receipt.d.ts +25 -0
- package/lib/CLI/scripts/expo/write-build-receipt.js +325 -0
- package/lib/CLI/scripts/expo/write-eas-build-receipt.d.ts +8 -0
- package/lib/CLI/scripts/expo/write-eas-build-receipt.js +71 -0
- package/lib/CLI/scripts/init-config.d.ts +18 -1
- package/lib/CLI/scripts/init-config.js +29 -8
- package/lib/CLI/scripts/login-cli.js +21 -3
- package/lib/CLI/scripts/native-setup-contract.d.ts +7 -0
- package/lib/CLI/scripts/native-setup-contract.js +101 -0
- package/lib/CLI/scripts/post-init.d.ts +6 -1
- package/lib/CLI/scripts/post-init.js +6 -33
- package/lib/CLI/scripts/upload-cli.d.ts +1 -0
- package/lib/CLI/scripts/upload-cli.js +106 -36
- package/lib/context.d.ts +0 -2
- package/lib/context.js +18 -2
- package/lib/expo/buildIdentity.d.ts +15 -0
- package/lib/expo/buildIdentity.js +201 -0
- package/lib/expo/buildReceipt.d.ts +42 -0
- package/lib/expo/buildReceipt.js +272 -0
- package/lib/expo/config.d.ts +7 -0
- package/lib/expo/config.js +43 -0
- package/lib/expo/configCache.d.ts +1 -0
- package/lib/expo/configCache.js +20 -0
- package/lib/expo/errors.d.ts +6 -0
- package/lib/expo/errors.js +11 -0
- package/lib/expo/expoUpdatesOwnership.d.ts +13 -0
- package/lib/expo/expoUpdatesOwnership.js +22 -0
- package/lib/expo/exportExpoProject.d.ts +21 -0
- package/lib/expo/exportExpoProject.js +125 -0
- package/lib/expo/exportValidation.d.ts +11 -0
- package/lib/expo/exportValidation.js +115 -0
- package/lib/expo/index.d.ts +18 -0
- package/lib/expo/index.js +25 -0
- package/lib/expo/localModules.d.ts +4 -0
- package/lib/expo/localModules.js +51 -0
- package/lib/expo/nativeIdentity.d.ts +1 -0
- package/lib/expo/nativeIdentity.js +17 -0
- package/lib/expo/projectType.d.ts +7 -0
- package/lib/expo/projectType.js +200 -0
- package/lib/expo/runtimeVersion.d.ts +13 -0
- package/lib/expo/runtimeVersion.js +45 -0
- package/lib/expo/types.d.ts +15 -0
- package/lib/expo/types.js +2 -0
- package/lib/fs/userProperties.d.ts +0 -2
- package/lib/fs/userProperties.js +0 -3
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -2
- package/lib/loadConfig.d.ts +15 -7
- package/lib/loadConfig.js +2 -19
- package/lib/metro.d.ts +17 -0
- package/lib/metro.js +57 -0
- package/lib/native/bundleDropNative.d.ts +2 -0
- package/lib/native/bundleDropNative.js +9 -1
- package/lib/runtime/service.js +12 -1
- package/lib/scripts/bundle.d.ts +2 -2
- package/lib/scripts/bundle.js +10 -97
- package/lib/scripts/canonicalArtifact.d.ts +30 -0
- package/lib/scripts/canonicalArtifact.js +212 -0
- package/lib/scripts/exportProject.d.ts +41 -0
- package/lib/scripts/exportProject.js +82 -0
- package/package.json +51 -46
- package/plugin/constants.js +9 -0
- package/plugin/expoUpdates.js +131 -0
- package/plugin/index.js +11 -0
- package/plugin/markers.js +31 -0
- package/plugin/withBundleDrop.js +36 -0
- package/plugin/xcodeBuildPhase.js +77 -0
- package/react-native.config.js +15 -0
- package/lib/CLI/scripts/aipowered/apply-plan.d.ts +0 -10
- package/lib/CLI/scripts/aipowered/init-native-config.d.ts +0 -2
- package/lib/CLI/scripts/aipowered/init-native-config.js +0 -131
- package/lib/CLI/scripts/init-metro-config.d.ts +0 -2
|
@@ -0,0 +1,115 @@
|
|
|
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.assertSafeExpoExportRelativePaths = assertSafeExpoExportRelativePaths;
|
|
7
|
+
exports.validateExpoExportOutput = validateExpoExportOutput;
|
|
8
|
+
const fs_1 = __importDefault(require("fs"));
|
|
9
|
+
const path_1 = __importDefault(require("path"));
|
|
10
|
+
const errors_1 = require("./errors");
|
|
11
|
+
function isInsideDirectory(rootDirectory, candidatePath) {
|
|
12
|
+
const relativePath = path_1.default.relative(rootDirectory, candidatePath);
|
|
13
|
+
return (relativePath !== '' &&
|
|
14
|
+
!relativePath.startsWith(`..${path_1.default.sep}`) &&
|
|
15
|
+
relativePath !== '..' &&
|
|
16
|
+
!path_1.default.isAbsolute(relativePath));
|
|
17
|
+
}
|
|
18
|
+
function assertSafeExpoExportRelativePaths(relativePaths) {
|
|
19
|
+
const collisionKeys = new Map();
|
|
20
|
+
for (const relativePath of relativePaths) {
|
|
21
|
+
if (relativePath === '' ||
|
|
22
|
+
path_1.default.isAbsolute(relativePath) ||
|
|
23
|
+
relativePath.includes('\0') ||
|
|
24
|
+
relativePath.includes('\\') ||
|
|
25
|
+
/[\u0000-\u001f\u007f:*?"<>|]/.test(relativePath)) {
|
|
26
|
+
throw new errors_1.ExpoIntegrationError(`Expo export produced an unsafe path: ${relativePath}.`);
|
|
27
|
+
}
|
|
28
|
+
const segments = relativePath.split('/');
|
|
29
|
+
if (segments.some(segment => segment === '' ||
|
|
30
|
+
segment === '.' ||
|
|
31
|
+
segment === '..' ||
|
|
32
|
+
/[. ]$/.test(segment) ||
|
|
33
|
+
/^(con|prn|aux|nul|com[1-9]|lpt[1-9])(?:\.|$)/i.test(segment))) {
|
|
34
|
+
throw new errors_1.ExpoIntegrationError(`Expo export produced a non-portable or traversing path: ${relativePath}.`);
|
|
35
|
+
}
|
|
36
|
+
const collisionKey = relativePath.normalize('NFC').toLowerCase();
|
|
37
|
+
const existingPath = collisionKeys.get(collisionKey);
|
|
38
|
+
if (existingPath && existingPath !== relativePath) {
|
|
39
|
+
throw new errors_1.ExpoIntegrationError(`Expo export contains a case-folding or Unicode path collision: ${existingPath} and ${relativePath}.`);
|
|
40
|
+
}
|
|
41
|
+
collisionKeys.set(collisionKey, relativePath);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
function collectFiles(outputDirectory) {
|
|
45
|
+
const files = [];
|
|
46
|
+
const relativePaths = [];
|
|
47
|
+
function visit(directoryPath) {
|
|
48
|
+
for (const directoryEntry of fs_1.default.readdirSync(directoryPath, { withFileTypes: true })) {
|
|
49
|
+
const absolutePath = path_1.default.join(directoryPath, directoryEntry.name);
|
|
50
|
+
const relativePath = path_1.default.relative(outputDirectory, absolutePath).split(path_1.default.sep).join('/');
|
|
51
|
+
relativePaths.push(relativePath);
|
|
52
|
+
const stats = fs_1.default.lstatSync(absolutePath);
|
|
53
|
+
if (stats.isSymbolicLink()) {
|
|
54
|
+
throw new errors_1.ExpoIntegrationError(`Expo export contains a symbolic link: ${relativePath}.`);
|
|
55
|
+
}
|
|
56
|
+
if (stats.isDirectory()) {
|
|
57
|
+
visit(absolutePath);
|
|
58
|
+
}
|
|
59
|
+
else if (stats.isFile()) {
|
|
60
|
+
files.push(relativePath);
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
throw new errors_1.ExpoIntegrationError(`Expo export contains an unsupported file type: ${relativePath}.`);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
visit(outputDirectory);
|
|
68
|
+
assertSafeExpoExportRelativePaths(relativePaths);
|
|
69
|
+
return files.sort();
|
|
70
|
+
}
|
|
71
|
+
function requireRegularNonEmptyFile(outputDirectory, filePath, role) {
|
|
72
|
+
const absoluteFilePath = path_1.default.resolve(filePath);
|
|
73
|
+
if (!isInsideDirectory(outputDirectory, absoluteFilePath)) {
|
|
74
|
+
throw new errors_1.ExpoIntegrationError(`${role} is outside the Expo export directory.`);
|
|
75
|
+
}
|
|
76
|
+
const stats = fs_1.default.lstatSync(absoluteFilePath);
|
|
77
|
+
if (!stats.isFile() || stats.isSymbolicLink() || stats.size === 0) {
|
|
78
|
+
throw new errors_1.ExpoIntegrationError(`${role} must be a non-empty regular file.`);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
function validateExpoExportOutput(options) {
|
|
82
|
+
const outputDirectory = path_1.default.resolve(options.outputDirectory);
|
|
83
|
+
const outputStats = fs_1.default.lstatSync(outputDirectory);
|
|
84
|
+
if (!outputStats.isDirectory() || outputStats.isSymbolicLink()) {
|
|
85
|
+
throw new errors_1.ExpoIntegrationError('Expo export output must be a real directory, not a symlink.');
|
|
86
|
+
}
|
|
87
|
+
requireRegularNonEmptyFile(outputDirectory, options.bundlePath, 'Expo JavaScript bundle');
|
|
88
|
+
requireRegularNonEmptyFile(outputDirectory, options.sourceMapPath, 'Expo source map');
|
|
89
|
+
const assetsDirectory = path_1.default.resolve(options.assetsDirectory);
|
|
90
|
+
if (!isInsideDirectory(outputDirectory, assetsDirectory)) {
|
|
91
|
+
throw new errors_1.ExpoIntegrationError('Expo assets directory is outside the export directory.');
|
|
92
|
+
}
|
|
93
|
+
const assetStats = fs_1.default.lstatSync(assetsDirectory);
|
|
94
|
+
if (!assetStats.isDirectory() || assetStats.isSymbolicLink()) {
|
|
95
|
+
throw new errors_1.ExpoIntegrationError('Expo assets output must be a real directory, not a symlink.');
|
|
96
|
+
}
|
|
97
|
+
let sourceMap;
|
|
98
|
+
try {
|
|
99
|
+
sourceMap = JSON.parse(fs_1.default.readFileSync(options.sourceMapPath, 'utf8'));
|
|
100
|
+
}
|
|
101
|
+
catch (error) {
|
|
102
|
+
throw new errors_1.ExpoIntegrationError('Expo produced a malformed source map.', { cause: error });
|
|
103
|
+
}
|
|
104
|
+
if (!sourceMap || typeof sourceMap !== 'object' || sourceMap.version !== 3) {
|
|
105
|
+
throw new errors_1.ExpoIntegrationError('Expo source map must be a version 3 source map object.');
|
|
106
|
+
}
|
|
107
|
+
const sourceMapDebugId = sourceMap.debugId ?? sourceMap.debug_id;
|
|
108
|
+
if (sourceMapDebugId !== undefined && typeof sourceMapDebugId !== 'string') {
|
|
109
|
+
throw new errors_1.ExpoIntegrationError('Expo source map contains a malformed debug ID.');
|
|
110
|
+
}
|
|
111
|
+
return {
|
|
112
|
+
files: collectFiles(outputDirectory),
|
|
113
|
+
...(typeof sourceMapDebugId === 'string' ? { sourceMapDebugId } : {}),
|
|
114
|
+
};
|
|
115
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export { evaluateExpoConfig } from './config';
|
|
2
|
+
export type { EvaluatedExpoConfig } from './config';
|
|
3
|
+
export { ExpoIntegrationError } from './errors';
|
|
4
|
+
export { detectProjectType } from './projectType';
|
|
5
|
+
export type { DetectProjectTypeOptions } from './projectType';
|
|
6
|
+
export { resolveBundleDropRuntimeVersionAuthority } from './runtimeVersion';
|
|
7
|
+
export type { BundleDropRuntimeVersionAuthority } from './runtimeVersion';
|
|
8
|
+
export { assertExpoUpdatesDoesNotOwnStartup, inspectExpoUpdatesOwnership, } from './expoUpdatesOwnership';
|
|
9
|
+
export type { ExpoUpdatesOwnership } from './expoUpdatesOwnership';
|
|
10
|
+
export { resolveExpoBuildIdentity, resolveExpoMetroRuntimeVersion, resolveExpoProjectFingerprint, } from './buildIdentity';
|
|
11
|
+
export type { ExpoMetroRuntimeVersion } from './buildIdentity';
|
|
12
|
+
export { parseExpoBuildIdentityReceipt, resolveExpoIntegrationGeneration, } from './buildReceipt';
|
|
13
|
+
export type { ExpoBuildIdentityReceipt, ExpoBuildPlatformProof, ExpoBuildProofEvidence, } from './buildReceipt';
|
|
14
|
+
export { exportExpoProject } from './exportExpoProject';
|
|
15
|
+
export type { ExpoExportOptions, ExpoExportResult } from './exportExpoProject';
|
|
16
|
+
export { validateExpoExportOutput } from './exportValidation';
|
|
17
|
+
export type { ValidatedExpoExport } from './exportValidation';
|
|
18
|
+
export type { ExpoBuildIdentity, ExpoRuntimeVersionPolicy, JavaScriptEngine, MobilePlatform, ProjectType, } from './types';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateExpoExportOutput = exports.exportExpoProject = exports.resolveExpoIntegrationGeneration = exports.parseExpoBuildIdentityReceipt = exports.resolveExpoProjectFingerprint = exports.resolveExpoMetroRuntimeVersion = exports.resolveExpoBuildIdentity = exports.inspectExpoUpdatesOwnership = exports.assertExpoUpdatesDoesNotOwnStartup = exports.resolveBundleDropRuntimeVersionAuthority = exports.detectProjectType = exports.ExpoIntegrationError = exports.evaluateExpoConfig = void 0;
|
|
4
|
+
var config_1 = require("./config");
|
|
5
|
+
Object.defineProperty(exports, "evaluateExpoConfig", { enumerable: true, get: function () { return config_1.evaluateExpoConfig; } });
|
|
6
|
+
var errors_1 = require("./errors");
|
|
7
|
+
Object.defineProperty(exports, "ExpoIntegrationError", { enumerable: true, get: function () { return errors_1.ExpoIntegrationError; } });
|
|
8
|
+
var projectType_1 = require("./projectType");
|
|
9
|
+
Object.defineProperty(exports, "detectProjectType", { enumerable: true, get: function () { return projectType_1.detectProjectType; } });
|
|
10
|
+
var runtimeVersion_1 = require("./runtimeVersion");
|
|
11
|
+
Object.defineProperty(exports, "resolveBundleDropRuntimeVersionAuthority", { enumerable: true, get: function () { return runtimeVersion_1.resolveBundleDropRuntimeVersionAuthority; } });
|
|
12
|
+
var expoUpdatesOwnership_1 = require("./expoUpdatesOwnership");
|
|
13
|
+
Object.defineProperty(exports, "assertExpoUpdatesDoesNotOwnStartup", { enumerable: true, get: function () { return expoUpdatesOwnership_1.assertExpoUpdatesDoesNotOwnStartup; } });
|
|
14
|
+
Object.defineProperty(exports, "inspectExpoUpdatesOwnership", { enumerable: true, get: function () { return expoUpdatesOwnership_1.inspectExpoUpdatesOwnership; } });
|
|
15
|
+
var buildIdentity_1 = require("./buildIdentity");
|
|
16
|
+
Object.defineProperty(exports, "resolveExpoBuildIdentity", { enumerable: true, get: function () { return buildIdentity_1.resolveExpoBuildIdentity; } });
|
|
17
|
+
Object.defineProperty(exports, "resolveExpoMetroRuntimeVersion", { enumerable: true, get: function () { return buildIdentity_1.resolveExpoMetroRuntimeVersion; } });
|
|
18
|
+
Object.defineProperty(exports, "resolveExpoProjectFingerprint", { enumerable: true, get: function () { return buildIdentity_1.resolveExpoProjectFingerprint; } });
|
|
19
|
+
var buildReceipt_1 = require("./buildReceipt");
|
|
20
|
+
Object.defineProperty(exports, "parseExpoBuildIdentityReceipt", { enumerable: true, get: function () { return buildReceipt_1.parseExpoBuildIdentityReceipt; } });
|
|
21
|
+
Object.defineProperty(exports, "resolveExpoIntegrationGeneration", { enumerable: true, get: function () { return buildReceipt_1.resolveExpoIntegrationGeneration; } });
|
|
22
|
+
var exportExpoProject_1 = require("./exportExpoProject");
|
|
23
|
+
Object.defineProperty(exports, "exportExpoProject", { enumerable: true, get: function () { return exportExpoProject_1.exportExpoProject; } });
|
|
24
|
+
var exportValidation_1 = require("./exportValidation");
|
|
25
|
+
Object.defineProperty(exports, "validateExpoExportOutput", { enumerable: true, get: function () { return exportValidation_1.validateExpoExportOutput; } });
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function resolveProjectModule(projectRoot: string, moduleId: string): string;
|
|
2
|
+
export declare function loadProjectModule<T>(projectRoot: string, moduleId: string): T;
|
|
3
|
+
export declare function resolveExpoDependency(projectRoot: string, moduleId: string): string;
|
|
4
|
+
export declare function loadExpoDependency<T>(projectRoot: string, moduleId: string): T;
|
|
@@ -0,0 +1,51 @@
|
|
|
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.resolveProjectModule = resolveProjectModule;
|
|
7
|
+
exports.loadProjectModule = loadProjectModule;
|
|
8
|
+
exports.resolveExpoDependency = resolveExpoDependency;
|
|
9
|
+
exports.loadExpoDependency = loadExpoDependency;
|
|
10
|
+
const fs_1 = __importDefault(require("fs"));
|
|
11
|
+
const path_1 = __importDefault(require("path"));
|
|
12
|
+
const module_1 = require("module");
|
|
13
|
+
const errors_1 = require("./errors");
|
|
14
|
+
function getProjectManifestPath(projectRoot) {
|
|
15
|
+
const manifestPath = path_1.default.join(path_1.default.resolve(projectRoot), 'package.json');
|
|
16
|
+
if (!fs_1.default.existsSync(manifestPath)) {
|
|
17
|
+
throw new errors_1.ExpoIntegrationError(`No package.json was found at ${manifestPath}.`);
|
|
18
|
+
}
|
|
19
|
+
return manifestPath;
|
|
20
|
+
}
|
|
21
|
+
function resolveProjectModule(projectRoot, moduleId) {
|
|
22
|
+
const projectRequire = (0, module_1.createRequire)(getProjectManifestPath(projectRoot));
|
|
23
|
+
try {
|
|
24
|
+
return projectRequire.resolve(moduleId);
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
throw new errors_1.ExpoIntegrationError(`Could not resolve ${moduleId} from the Expo project at ${path_1.default.resolve(projectRoot)}. ` +
|
|
28
|
+
'Install dependencies in the project and try again.', { cause: error });
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
function loadProjectModule(projectRoot, moduleId) {
|
|
32
|
+
const projectRequire = (0, module_1.createRequire)(getProjectManifestPath(projectRoot));
|
|
33
|
+
const resolvedPath = resolveProjectModule(projectRoot, moduleId);
|
|
34
|
+
return projectRequire(resolvedPath);
|
|
35
|
+
}
|
|
36
|
+
function resolveExpoDependency(projectRoot, moduleId) {
|
|
37
|
+
const expoManifestPath = resolveProjectModule(projectRoot, 'expo/package.json');
|
|
38
|
+
const expoRequire = (0, module_1.createRequire)(expoManifestPath);
|
|
39
|
+
try {
|
|
40
|
+
return expoRequire.resolve(moduleId);
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
throw new errors_1.ExpoIntegrationError(`The project-local Expo installation could not resolve ${moduleId}. ` +
|
|
44
|
+
'Run the package manager used by the app and verify that its Expo SDK installation is complete.', { cause: error });
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function loadExpoDependency(projectRoot, moduleId) {
|
|
48
|
+
const expoManifestPath = resolveProjectModule(projectRoot, 'expo/package.json');
|
|
49
|
+
const expoRequire = (0, module_1.createRequire)(expoManifestPath);
|
|
50
|
+
return expoRequire(resolveExpoDependency(projectRoot, moduleId));
|
|
51
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function resolveExpoNativeRuntimeVersion(source: 'appVersion' | 'nativeVersion'): string;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveExpoNativeRuntimeVersion = resolveExpoNativeRuntimeVersion;
|
|
4
|
+
const react_native_1 = require("react-native");
|
|
5
|
+
function resolveExpoNativeRuntimeVersion(source) {
|
|
6
|
+
const identity = react_native_1.NativeModules.BundleDropExpoIdentity;
|
|
7
|
+
const appVersion = identity?.appVersion;
|
|
8
|
+
const appBuildVersion = identity?.appBuildVersion;
|
|
9
|
+
if (typeof appVersion !== 'string' || !appVersion.trim() ||
|
|
10
|
+
typeof appBuildVersion !== 'string' || !appBuildVersion.trim()) {
|
|
11
|
+
throw new Error('Bundle Drop could not read the Expo native build version. ' +
|
|
12
|
+
'Create a new native binary with the Bundle Drop Expo adapter.');
|
|
13
|
+
}
|
|
14
|
+
return source === 'appVersion'
|
|
15
|
+
? appVersion
|
|
16
|
+
: `${appVersion}(${appBuildVersion})`;
|
|
17
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ProjectType } from './types';
|
|
2
|
+
export type DetectProjectTypeOptions = {
|
|
3
|
+
projectRoot: string;
|
|
4
|
+
explicitType?: ProjectType;
|
|
5
|
+
};
|
|
6
|
+
export declare function setBundleDropProjectType(content: string, projectType: ProjectType): string;
|
|
7
|
+
export declare function detectProjectType({ projectRoot, explicitType, }: DetectProjectTypeOptions): ProjectType;
|
|
@@ -0,0 +1,200 @@
|
|
|
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.setBundleDropProjectType = setBundleDropProjectType;
|
|
7
|
+
exports.detectProjectType = detectProjectType;
|
|
8
|
+
const fs_1 = __importDefault(require("fs"));
|
|
9
|
+
const path_1 = __importDefault(require("path"));
|
|
10
|
+
const config_1 = require("./config");
|
|
11
|
+
const errors_1 = require("./errors");
|
|
12
|
+
const localModules_1 = require("./localModules");
|
|
13
|
+
const BUNDLE_DROP_PACKAGE_NAME = '@gfean/react-native-bundle-drop';
|
|
14
|
+
const EXPO_RUNTIME_SOURCE_PATTERN = /runtimeVersion\s*:\s*\{\s*source\s*:\s*['"]expo['"]\s*\}/;
|
|
15
|
+
const RUNTIME_VERSION_BLOCK_PATTERN = /runtimeVersion\s*:\s*\{([\s\S]*?)\}/;
|
|
16
|
+
const IOS_LITERAL_RUNTIME_PATTERN = /(?:^|[,\s])['"]?ios['"]?\s*:\s*['"`][^'"`\r\n]+['"`]/;
|
|
17
|
+
const ANDROID_LITERAL_RUNTIME_PATTERN = /(?:^|[,\s])['"]?android['"]?\s*:\s*['"`][^'"`\r\n]+['"`]/;
|
|
18
|
+
const PROJECT_TYPE_MARKER_PATTERN = /(?:^|[,{])\s*projectType\s*:\s*['"]([^'"]+)['"]/g;
|
|
19
|
+
const isProjectType = (value) => value === 'bare' || value === 'expo';
|
|
20
|
+
function canResolve(projectRoot, moduleId) {
|
|
21
|
+
try {
|
|
22
|
+
(0, localModules_1.resolveProjectModule)(projectRoot, moduleId);
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function declaresDependency(projectRoot, dependencyName) {
|
|
30
|
+
const manifestPath = path_1.default.join(projectRoot, 'package.json');
|
|
31
|
+
try {
|
|
32
|
+
const manifest = JSON.parse(fs_1.default.readFileSync(manifestPath, 'utf8'));
|
|
33
|
+
const declaresRegularDependency = [
|
|
34
|
+
'dependencies',
|
|
35
|
+
'devDependencies',
|
|
36
|
+
'optionalDependencies',
|
|
37
|
+
].some(dependencyGroup => typeof manifest[dependencyGroup]?.[dependencyName] === 'string');
|
|
38
|
+
const declaresRequiredPeer = typeof manifest.peerDependencies?.[dependencyName] === 'string' &&
|
|
39
|
+
manifest.peerDependenciesMeta?.[dependencyName]?.optional !== true;
|
|
40
|
+
return declaresRegularDependency || declaresRequiredPeer;
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
function isBundleDropExpoPlugin(plugin) {
|
|
47
|
+
if (typeof plugin === 'string') {
|
|
48
|
+
return plugin === BUNDLE_DROP_PACKAGE_NAME;
|
|
49
|
+
}
|
|
50
|
+
return Array.isArray(plugin) && plugin[0] === BUNDLE_DROP_PACKAGE_NAME;
|
|
51
|
+
}
|
|
52
|
+
function readBundleDropRuntimeSignals(projectRoot) {
|
|
53
|
+
const configPath = path_1.default.join(projectRoot, 'bundle.drop.config.js');
|
|
54
|
+
try {
|
|
55
|
+
const config = fs_1.default.readFileSync(configPath, 'utf8');
|
|
56
|
+
const runtimeBlock = config.match(RUNTIME_VERSION_BLOCK_PATTERN)?.[1] ?? '';
|
|
57
|
+
const persistedProjectTypes = [...config.matchAll(PROJECT_TYPE_MARKER_PATTERN)]
|
|
58
|
+
.map(match => match[1]);
|
|
59
|
+
if (persistedProjectTypes.length > 1) {
|
|
60
|
+
throw new errors_1.ExpoIntegrationError('bundle.drop.config.js contains multiple projectType markers. Keep exactly one marker.');
|
|
61
|
+
}
|
|
62
|
+
const persistedProjectTypeValue = persistedProjectTypes[0] ?? null;
|
|
63
|
+
if (persistedProjectTypeValue !== null && !isProjectType(persistedProjectTypeValue)) {
|
|
64
|
+
throw new errors_1.ExpoIntegrationError(`Unsupported bundle.drop.config.js projectType marker: ${persistedProjectTypeValue}.`);
|
|
65
|
+
}
|
|
66
|
+
const persistedProjectType = isProjectType(persistedProjectTypeValue)
|
|
67
|
+
? persistedProjectTypeValue
|
|
68
|
+
: null;
|
|
69
|
+
return {
|
|
70
|
+
bare: IOS_LITERAL_RUNTIME_PATTERN.test(runtimeBlock) &&
|
|
71
|
+
ANDROID_LITERAL_RUNTIME_PATTERN.test(runtimeBlock),
|
|
72
|
+
expo: EXPO_RUNTIME_SOURCE_PATTERN.test(config),
|
|
73
|
+
persistedProjectType,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
catch (error) {
|
|
77
|
+
if (error instanceof errors_1.ExpoIntegrationError)
|
|
78
|
+
throw error;
|
|
79
|
+
return { bare: false, expo: false, persistedProjectType: null };
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
function setBundleDropProjectType(content, projectType) {
|
|
83
|
+
const markerMatches = [...content.matchAll(PROJECT_TYPE_MARKER_PATTERN)];
|
|
84
|
+
if (markerMatches.length > 1) {
|
|
85
|
+
throw new errors_1.ExpoIntegrationError('bundle.drop.config.js contains multiple projectType markers. Keep exactly one marker.');
|
|
86
|
+
}
|
|
87
|
+
if (markerMatches.length === 1) {
|
|
88
|
+
const currentType = markerMatches[0][1];
|
|
89
|
+
if (currentType !== 'bare' && currentType !== 'expo') {
|
|
90
|
+
throw new errors_1.ExpoIntegrationError(`Unsupported bundle.drop.config.js projectType marker: ${currentType}.`);
|
|
91
|
+
}
|
|
92
|
+
if (currentType === projectType)
|
|
93
|
+
return content;
|
|
94
|
+
return content.replace(/(projectType\s*:\s*)['"](?:bare|expo)['"]/, `$1'${projectType}'`);
|
|
95
|
+
}
|
|
96
|
+
const moduleExportsOpening = /module\.exports\s*=\s*\{/;
|
|
97
|
+
if (!moduleExportsOpening.test(content)) {
|
|
98
|
+
throw new errors_1.ExpoIntegrationError('Could not safely persist projectType in bundle.drop.config.js. ' +
|
|
99
|
+
'Restore a standard CommonJS Bundle Drop config shape and run init again.');
|
|
100
|
+
}
|
|
101
|
+
const newline = content.includes('\r\n') ? '\r\n' : '\n';
|
|
102
|
+
return content.replace(moduleExportsOpening, opening => `${opening}${newline} projectType: '${projectType}',`);
|
|
103
|
+
}
|
|
104
|
+
function hasExplicitStaticExpoConfig(staticConfigPath) {
|
|
105
|
+
if (typeof staticConfigPath !== 'string' || !staticConfigPath.trim()) {
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
try {
|
|
109
|
+
const staticConfig = JSON.parse(fs_1.default.readFileSync(staticConfigPath, 'utf8'));
|
|
110
|
+
return typeof staticConfig.expo === 'object' && staticConfig.expo !== null;
|
|
111
|
+
}
|
|
112
|
+
catch {
|
|
113
|
+
return false;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
function hasExplicitExpoProjectSignal(evaluatedConfig, hasExpoRuntimeSource) {
|
|
117
|
+
const hasDynamicExpoConfig = typeof evaluatedConfig.dynamicConfigPath === 'string' &&
|
|
118
|
+
evaluatedConfig.dynamicConfigPath.trim().length > 0;
|
|
119
|
+
const hasStaticExpoConfig = hasExplicitStaticExpoConfig(evaluatedConfig.staticConfigPath);
|
|
120
|
+
const hasBundleDropPlugin = Array.isArray(evaluatedConfig.exp.plugins) &&
|
|
121
|
+
evaluatedConfig.exp.plugins.some(isBundleDropExpoPlugin);
|
|
122
|
+
return hasDynamicExpoConfig || hasStaticExpoConfig || hasBundleDropPlugin ||
|
|
123
|
+
hasExpoRuntimeSource;
|
|
124
|
+
}
|
|
125
|
+
function detectProjectType({ projectRoot, explicitType, }) {
|
|
126
|
+
const absoluteProjectRoot = path_1.default.resolve(projectRoot);
|
|
127
|
+
if (explicitType !== undefined) {
|
|
128
|
+
if (explicitType !== 'expo' && explicitType !== 'bare') {
|
|
129
|
+
throw new errors_1.ExpoIntegrationError(`Unsupported explicit project type: ${String(explicitType)}.`);
|
|
130
|
+
}
|
|
131
|
+
if (explicitType === 'expo') {
|
|
132
|
+
if (!canResolve(absoluteProjectRoot, 'expo/package.json')) {
|
|
133
|
+
throw new errors_1.ExpoIntegrationError('The explicit Expo project type requires a project-local Expo installation.');
|
|
134
|
+
}
|
|
135
|
+
try {
|
|
136
|
+
(0, config_1.evaluateExpoConfig)(absoluteProjectRoot);
|
|
137
|
+
}
|
|
138
|
+
catch (error) {
|
|
139
|
+
throw new errors_1.ExpoIntegrationError('The explicit Expo project type requires an Expo config that can be evaluated.', { cause: error });
|
|
140
|
+
}
|
|
141
|
+
return 'expo';
|
|
142
|
+
}
|
|
143
|
+
if (!canResolve(absoluteProjectRoot, 'react-native/package.json')) {
|
|
144
|
+
throw new errors_1.ExpoIntegrationError('The explicit bare project type requires a project-local React Native installation.');
|
|
145
|
+
}
|
|
146
|
+
return explicitType;
|
|
147
|
+
}
|
|
148
|
+
const runtimeSignals = readBundleDropRuntimeSignals(absoluteProjectRoot);
|
|
149
|
+
if (runtimeSignals.persistedProjectType === 'bare') {
|
|
150
|
+
if (!canResolve(absoluteProjectRoot, 'react-native/package.json')) {
|
|
151
|
+
throw new errors_1.ExpoIntegrationError('The persisted bare project type requires a project-local React Native installation.');
|
|
152
|
+
}
|
|
153
|
+
return 'bare';
|
|
154
|
+
}
|
|
155
|
+
if (runtimeSignals.persistedProjectType === 'expo') {
|
|
156
|
+
if (!canResolve(absoluteProjectRoot, 'expo/package.json')) {
|
|
157
|
+
throw new errors_1.ExpoIntegrationError('The persisted Expo project type requires a project-local Expo installation.');
|
|
158
|
+
}
|
|
159
|
+
try {
|
|
160
|
+
(0, config_1.evaluateExpoConfig)(absoluteProjectRoot);
|
|
161
|
+
}
|
|
162
|
+
catch (error) {
|
|
163
|
+
throw new errors_1.ExpoIntegrationError('The persisted Expo project type requires an Expo config that can be evaluated.', { cause: error });
|
|
164
|
+
}
|
|
165
|
+
return 'expo';
|
|
166
|
+
}
|
|
167
|
+
if (canResolve(absoluteProjectRoot, 'expo/package.json')) {
|
|
168
|
+
let evaluatedConfig;
|
|
169
|
+
try {
|
|
170
|
+
evaluatedConfig = (0, config_1.evaluateExpoConfig)(absoluteProjectRoot);
|
|
171
|
+
}
|
|
172
|
+
catch (error) {
|
|
173
|
+
throw new errors_1.ExpoIntegrationError('Expo is resolvable, but its app config cannot be evaluated. ' +
|
|
174
|
+
'Bundle Drop will not guess that this is a bare project.', { cause: error });
|
|
175
|
+
}
|
|
176
|
+
const hasExpoSignal = hasExplicitExpoProjectSignal(evaluatedConfig, runtimeSignals.expo);
|
|
177
|
+
if (hasExpoSignal && runtimeSignals.bare) {
|
|
178
|
+
throw new errors_1.ExpoIntegrationError('The project has conflicting Expo and bare Bundle Drop configuration signals. ' +
|
|
179
|
+
'Pass --project-type expo or --project-type bare explicitly after reviewing the config.');
|
|
180
|
+
}
|
|
181
|
+
if (hasExpoSignal) {
|
|
182
|
+
return 'expo';
|
|
183
|
+
}
|
|
184
|
+
if (runtimeSignals.bare) {
|
|
185
|
+
return 'bare';
|
|
186
|
+
}
|
|
187
|
+
throw new errors_1.ExpoIntegrationError('Expo is resolvable, but the project has no explicit Expo app config, Bundle Drop Expo ' +
|
|
188
|
+
'plugin, or Expo runtime source. This is ambiguous because bare React Native apps may ' +
|
|
189
|
+
'install Expo modules. Pass --project-type expo or --project-type bare explicitly.');
|
|
190
|
+
}
|
|
191
|
+
if (declaresDependency(absoluteProjectRoot, 'expo')) {
|
|
192
|
+
throw new errors_1.ExpoIntegrationError('package.json declares Expo, but the project-local Expo package is not resolvable. ' +
|
|
193
|
+
'Install dependencies before Bundle Drop decides how to configure the project.');
|
|
194
|
+
}
|
|
195
|
+
if (canResolve(absoluteProjectRoot, 'react-native/package.json')) {
|
|
196
|
+
return 'bare';
|
|
197
|
+
}
|
|
198
|
+
throw new errors_1.ExpoIntegrationError('Could not determine the project type. Neither a usable Expo installation nor React Native was resolvable. ' +
|
|
199
|
+
'Install project dependencies or pass --project-type explicitly.');
|
|
200
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { MobilePlatform } from './types';
|
|
2
|
+
export type BundleDropRuntimeVersionAuthority = {
|
|
3
|
+
source: 'bundle-drop';
|
|
4
|
+
runtimeVersion: string;
|
|
5
|
+
} | {
|
|
6
|
+
source: 'expo';
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Bundle Drop literals are the default runtime authority for every project
|
|
10
|
+
* type. Expo runtime policies remain available only through an explicit
|
|
11
|
+
* `runtimeVersion: { source: 'expo' }` opt-in.
|
|
12
|
+
*/
|
|
13
|
+
export declare function resolveBundleDropRuntimeVersionAuthority(projectRoot: string, platform: MobilePlatform): BundleDropRuntimeVersionAuthority;
|
|
@@ -0,0 +1,45 @@
|
|
|
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.resolveBundleDropRuntimeVersionAuthority = resolveBundleDropRuntimeVersionAuthority;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const errors_1 = require("./errors");
|
|
9
|
+
const loadBundleDropConfig = (projectRoot) => {
|
|
10
|
+
const configPath = path_1.default.join(path_1.default.resolve(projectRoot), 'bundle.drop.config.js');
|
|
11
|
+
try {
|
|
12
|
+
const resolvedConfigPath = require.resolve(configPath);
|
|
13
|
+
delete require.cache[resolvedConfigPath];
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
15
|
+
const config = require(resolvedConfigPath);
|
|
16
|
+
if (!config || typeof config !== 'object') {
|
|
17
|
+
throw new Error('the module did not export an object');
|
|
18
|
+
}
|
|
19
|
+
return config;
|
|
20
|
+
}
|
|
21
|
+
catch (error) {
|
|
22
|
+
throw new errors_1.ExpoIntegrationError(`Could not load Bundle Drop runtime configuration from ${configPath}.`, { cause: error });
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Bundle Drop literals are the default runtime authority for every project
|
|
27
|
+
* type. Expo runtime policies remain available only through an explicit
|
|
28
|
+
* `runtimeVersion: { source: 'expo' }` opt-in.
|
|
29
|
+
*/
|
|
30
|
+
function resolveBundleDropRuntimeVersionAuthority(projectRoot, platform) {
|
|
31
|
+
const config = loadBundleDropConfig(projectRoot);
|
|
32
|
+
const configuredRuntimeVersion = config.runtimeVersion;
|
|
33
|
+
if (configuredRuntimeVersion?.source === 'expo') {
|
|
34
|
+
return { source: 'expo' };
|
|
35
|
+
}
|
|
36
|
+
const runtimeVersion = configuredRuntimeVersion?.[platform];
|
|
37
|
+
if (typeof runtimeVersion !== 'string' || !runtimeVersion.trim()) {
|
|
38
|
+
throw new errors_1.ExpoIntegrationError(`bundle.drop.config.js must define a non-empty runtimeVersion.${platform} literal. ` +
|
|
39
|
+
"Use runtimeVersion: { source: 'expo' } only when explicitly opting into Expo runtime policies.");
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
source: 'bundle-drop',
|
|
43
|
+
runtimeVersion: runtimeVersion.trim(),
|
|
44
|
+
};
|
|
45
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type ProjectType = 'expo' | 'bare';
|
|
2
|
+
export type MobilePlatform = 'ios' | 'android';
|
|
3
|
+
export type JavaScriptEngine = 'hermes' | 'jsc';
|
|
4
|
+
export type ExpoRuntimeVersionPolicy = 'literal' | 'appVersion' | 'nativeVersion' | 'sdkVersion' | 'fingerprint';
|
|
5
|
+
export type ExpoBuildIdentity = {
|
|
6
|
+
platform: MobilePlatform;
|
|
7
|
+
runtimeVersion: string;
|
|
8
|
+
runtimeVersionPolicy: ExpoRuntimeVersionPolicy;
|
|
9
|
+
expoSdkVersion: string;
|
|
10
|
+
reactNativeVersion: string;
|
|
11
|
+
javaScriptEngine: JavaScriptEngine;
|
|
12
|
+
appVersion: string;
|
|
13
|
+
nativeVersion: string;
|
|
14
|
+
identityHash: string;
|
|
15
|
+
};
|
|
@@ -24,5 +24,3 @@ export declare function removeUserProperty(key: string): Promise<UserProperties>
|
|
|
24
24
|
* Clear all locally stored user properties.
|
|
25
25
|
*/
|
|
26
26
|
export declare function resetUserProperties(): Promise<void>;
|
|
27
|
-
/** @deprecated Use setUserProperty(key, value) instead. */
|
|
28
|
-
export declare const setUserPropery: typeof setUserProperty;
|
package/lib/fs/userProperties.js
CHANGED
|
@@ -3,7 +3,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.setUserPropery = void 0;
|
|
7
6
|
exports.getCurrentUserProperties = getCurrentUserProperties;
|
|
8
7
|
exports.getUserProperties = getUserProperties;
|
|
9
8
|
exports.setUserProperty = setUserProperty;
|
|
@@ -129,5 +128,3 @@ async function resetUserProperties() {
|
|
|
129
128
|
console.warn('⚠️ Failed to reset user-properties.json', e);
|
|
130
129
|
}
|
|
131
130
|
}
|
|
132
|
-
/** @deprecated Use setUserProperty(key, value) instead. */
|
|
133
|
-
exports.setUserPropery = setUserProperty;
|
package/lib/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export type { ObservabilityContext } from './runtime/service';
|
|
|
5
5
|
export type { AvailableBundlesPage, GetAvailableBundlesOptions } from './manager/updateCheck';
|
|
6
6
|
export { downloadUpdate, installBundle, getRuntimeUpdateState as getUpdateState, applyUpdate, setChannel, getChannelName, reportHealthy, } from './runtime/service';
|
|
7
7
|
export { BundleDropError, isBundleDropError } from './errors';
|
|
8
|
-
export { getCurrentUserProperties, getUserProperties, setUserProperty,
|
|
8
|
+
export { getCurrentUserProperties, getUserProperties, setUserProperty, removeUserProperty, resetUserProperties, } from './fs/userProperties';
|
|
9
9
|
export type { UserProperties, UserPropertyValue } from './fs/userProperties';
|
|
10
10
|
export type { BundleInfo } from './bundleInfo';
|
|
11
11
|
export type { UpdatePolicy } from './types';
|
package/lib/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BundleDrop = exports.bundleDropConfig = exports.useBundleDrop = exports.resetUserProperties = exports.removeUserProperty = exports.
|
|
3
|
+
exports.BundleDrop = exports.bundleDropConfig = exports.useBundleDrop = exports.resetUserProperties = exports.removeUserProperty = exports.setUserProperty = exports.getUserProperties = exports.getCurrentUserProperties = exports.isBundleDropError = exports.BundleDropError = exports.reportHealthy = exports.getChannelName = exports.setChannel = exports.applyUpdate = exports.getUpdateState = exports.installBundle = exports.downloadUpdate = exports.getAvailableBundles = exports.getObservabilityContext = exports.getInstalledBundleInfo = exports.checkForUpdate = exports.getAvailableChannels = void 0;
|
|
4
4
|
require("./bootstrap");
|
|
5
5
|
const service_1 = require("./runtime/service");
|
|
6
6
|
var service_2 = require("./runtime/service");
|
|
@@ -24,7 +24,6 @@ var userProperties_1 = require("./fs/userProperties");
|
|
|
24
24
|
Object.defineProperty(exports, "getCurrentUserProperties", { enumerable: true, get: function () { return userProperties_1.getCurrentUserProperties; } });
|
|
25
25
|
Object.defineProperty(exports, "getUserProperties", { enumerable: true, get: function () { return userProperties_1.getUserProperties; } });
|
|
26
26
|
Object.defineProperty(exports, "setUserProperty", { enumerable: true, get: function () { return userProperties_1.setUserProperty; } });
|
|
27
|
-
Object.defineProperty(exports, "setUserPropery", { enumerable: true, get: function () { return userProperties_1.setUserPropery; } });
|
|
28
27
|
Object.defineProperty(exports, "removeUserProperty", { enumerable: true, get: function () { return userProperties_1.removeUserProperty; } });
|
|
29
28
|
Object.defineProperty(exports, "resetUserProperties", { enumerable: true, get: function () { return userProperties_1.resetUserProperties; } });
|
|
30
29
|
var useBundleDrop_1 = require("./useBundleDrop");
|
package/lib/loadConfig.d.ts
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
* Shape of `bundle.drop.config.js` after it is loaded through Metro.
|
|
3
3
|
*/
|
|
4
4
|
export type BundleDropProjectConfig = {
|
|
5
|
+
/** Persisted project shape used to keep Expo and bare runtime behavior distinct. */
|
|
6
|
+
projectType?: 'expo' | 'bare';
|
|
5
7
|
/** BundleDrop backend base URL. */
|
|
6
8
|
serverUrl: string;
|
|
7
9
|
/** Organization identity used for public API calls. */
|
|
@@ -19,17 +21,23 @@ export type BundleDropProjectConfig = {
|
|
|
19
21
|
apiKey?: string;
|
|
20
22
|
};
|
|
21
23
|
/**
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
24
|
+
* Runtime compatibility source. Concrete platform values are the default for
|
|
25
|
+
* both bare and Expo projects. Expo projects may explicitly delegate runtime
|
|
26
|
+
* resolution to the Expo app config; the Expo Metro wrapper then replaces that
|
|
27
|
+
* declaration with the concrete values embedded in the build.
|
|
25
28
|
*/
|
|
26
|
-
debugLocal?: boolean;
|
|
27
|
-
/** Native runtime versions for platform compatibility checks. */
|
|
28
29
|
runtimeVersion?: {
|
|
29
30
|
/** iOS runtime version. */
|
|
30
|
-
ios
|
|
31
|
+
ios?: string | {
|
|
32
|
+
source: 'appVersion' | 'nativeVersion';
|
|
33
|
+
};
|
|
31
34
|
/** Android runtime version. */
|
|
32
|
-
android
|
|
35
|
+
android?: string | {
|
|
36
|
+
source: 'appVersion' | 'nativeVersion';
|
|
37
|
+
};
|
|
38
|
+
} | {
|
|
39
|
+
/** Explicitly resolve concrete values from the evaluated Expo app config. */
|
|
40
|
+
source: 'expo';
|
|
33
41
|
};
|
|
34
42
|
/** Default OTA channel used before runtime code sets another channel. */
|
|
35
43
|
defaultChannel?: string;
|