@gfean/react-native-bundle-drop 0.4.6 → 0.6.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 +168 -4
- package/android/build.gradle +1 -0
- package/android/src/main/java/com/bundledrop/BundleDropBoundedDownloader.kt +86 -0
- package/android/src/main/java/com/bundledrop/BundleDropModule.kt +69 -0
- package/android/src/main/java/com/bundledrop/BundleDropRuntimeCrypto.kt +81 -0
- package/ios/BundleDropBridge.m +18 -0
- package/ios/BundleDropLocator.swift +48 -2
- package/ios/BundleDropModule.swift +75 -0
- package/ios/BundleDropRuntimeCrypto.swift +45 -0
- package/lib/CLI/cli.d.ts +1 -0
- package/lib/CLI/cli.js +166 -79
- package/lib/CLI/scripts/aipowered/apply-setup-plan.js +7 -17
- package/lib/CLI/scripts/aipowered/backend-client.js +29 -4
- package/lib/CLI/scripts/aipowered/code-push-residue.d.ts +5 -0
- package/lib/CLI/scripts/aipowered/code-push-residue.js +126 -0
- package/lib/CLI/scripts/aipowered/credential-safety.d.ts +1 -0
- package/lib/CLI/scripts/aipowered/credential-safety.js +14 -0
- package/lib/CLI/scripts/aipowered/diff-preview.js +12 -4
- package/lib/CLI/scripts/aipowered/init-project-config.d.ts +4 -0
- package/lib/CLI/scripts/aipowered/init-project-config.js +228 -43
- package/lib/CLI/scripts/aipowered/scanner.d.ts +1 -0
- package/lib/CLI/scripts/aipowered/scanner.js +164 -32
- package/lib/CLI/scripts/aipowered/terminal-safety.d.ts +4 -0
- package/lib/CLI/scripts/aipowered/terminal-safety.js +124 -0
- package/lib/CLI/scripts/aipowered/validate-plan.d.ts +3 -0
- package/lib/CLI/scripts/aipowered/validate-plan.js +1080 -19
- package/lib/CLI/scripts/bare-metro-config.d.ts +1 -1
- package/lib/CLI/scripts/bare-metro-config.js +24 -32
- package/lib/CLI/scripts/doctor.js +143 -22
- package/lib/CLI/scripts/expo/configure-expo.js +51 -60
- package/lib/CLI/scripts/expo/package-manager.d.ts +2 -0
- package/lib/CLI/scripts/expo/package-manager.js +63 -25
- package/lib/CLI/scripts/init-config.d.ts +7 -7
- package/lib/CLI/scripts/init-config.js +246 -32
- package/lib/CLI/scripts/login-cli.js +35 -10
- package/lib/CLI/scripts/metro-config-authority.d.ts +8 -0
- package/lib/CLI/scripts/metro-config-authority.js +303 -0
- package/lib/CLI/scripts/native-entrypoint-authority.d.ts +2 -0
- package/lib/CLI/scripts/native-entrypoint-authority.js +378 -0
- package/lib/CLI/scripts/native-setup-contract.d.ts +2 -2
- package/lib/CLI/scripts/native-setup-contract.js +63 -33
- package/lib/CLI/scripts/native-startup-validator.d.ts +3 -0
- package/lib/CLI/scripts/native-startup-validator.js +964 -0
- package/lib/CLI/scripts/safe-file-transaction.d.ts +12 -0
- package/lib/CLI/scripts/safe-file-transaction.js +159 -0
- package/lib/CLI/scripts/sight-artifacts.d.ts +17 -0
- package/lib/CLI/scripts/sight-artifacts.js +204 -0
- package/lib/CLI/scripts/sight-cli.d.ts +10 -0
- package/lib/CLI/scripts/sight-cli.js +127 -0
- package/lib/CLI/scripts/sight-session.d.ts +14 -0
- package/lib/CLI/scripts/sight-session.js +192 -0
- package/lib/api/clientApi.d.ts +3 -1
- package/lib/api/clientApi.js +14 -0
- package/lib/api/types.d.ts +39 -0
- package/lib/context.d.ts +1 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.js +3 -1
- package/lib/install/installFromZip.d.ts +3 -0
- package/lib/install/installFromZip.js +10 -1
- package/lib/loadConfig.d.ts +17 -1
- package/lib/loadConfig.js +16 -0
- package/lib/manager/downloadAndInstall.d.ts +3 -2
- package/lib/manager/downloadAndInstall.js +111 -46
- package/lib/manager/rollbackState.d.ts +3 -1
- package/lib/manager/rollbackState.js +2 -2
- package/lib/manager/updateCheck.d.ts +1 -0
- package/lib/manager/updateCheck.js +218 -78
- package/lib/metro.d.ts +8 -1
- package/lib/metro.js +68 -19
- package/lib/native/bundleDropNative.js +2 -1
- package/lib/native/fs.d.ts +6 -0
- package/lib/native/fs.js +24 -0
- package/lib/patch-engine/installFromPatchSet.d.ts +2 -0
- package/lib/patch-engine/installFromPatchSet.js +14 -3
- package/lib/patch-engine/patchTransport.d.ts +2 -0
- package/lib/patch-engine/patchTransport.js +9 -0
- package/lib/runtime/initState.d.ts +5 -0
- package/lib/runtime/initState.js +4 -0
- package/lib/runtime/service.js +60 -3
- package/lib/runtime-delivery/artifactCapability.d.ts +1 -0
- package/lib/runtime-delivery/artifactCapability.js +32 -0
- package/lib/runtime-delivery/authorityLeaseVerifier.d.ts +3 -0
- package/lib/runtime-delivery/authorityLeaseVerifier.js +106 -0
- package/lib/runtime-delivery/bootstrapConfig.d.ts +50 -0
- package/lib/runtime-delivery/bootstrapConfig.js +217 -0
- package/lib/runtime-delivery/diagnostics.d.ts +17 -0
- package/lib/runtime-delivery/diagnostics.js +58 -0
- package/lib/runtime-delivery/encoding.d.ts +5 -0
- package/lib/runtime-delivery/encoding.js +132 -0
- package/lib/runtime-delivery/heartbeat.d.ts +3 -0
- package/lib/runtime-delivery/heartbeat.js +88 -0
- package/lib/runtime-delivery/localResolver.d.ts +23 -0
- package/lib/runtime-delivery/localResolver.js +81 -0
- package/lib/runtime-delivery/manifestState.d.ts +9 -0
- package/lib/runtime-delivery/manifestState.js +102 -0
- package/lib/runtime-delivery/manifestVerifier.d.ts +13 -0
- package/lib/runtime-delivery/manifestVerifier.js +329 -0
- package/lib/runtime-delivery/runtimeDelivery.d.ts +19 -0
- package/lib/runtime-delivery/runtimeDelivery.js +375 -0
- package/lib/runtime-delivery/types.d.ts +87 -0
- package/lib/runtime-delivery/types.js +6 -0
- package/package.json +2 -2
|
@@ -3,5 +3,5 @@ export declare const ANDROID_BUNDLE_DROP_PATHS = "com.bundledrop.BundleDropNativ
|
|
|
3
3
|
export declare const IOS_BUNDLE_DROP_MODULE = "BundleDrop";
|
|
4
4
|
export declare const IOS_BUNDLE_DROP_LOCATOR_HEADER = "BundleDrop/BundleDropLocator.h";
|
|
5
5
|
export declare const stripCommentsAndStrings: (content: string) => string;
|
|
6
|
-
export declare const
|
|
7
|
-
export
|
|
6
|
+
export declare const stripComments: (content: string) => string;
|
|
7
|
+
export { findMissingBareNativeStartupStructure, hasBareAndroidStartupIntegration, hasBareIosStartupIntegration, } from './native-startup-validator';
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.hasBareIosStartupIntegration = exports.hasBareAndroidStartupIntegration = exports.stripCommentsAndStrings = exports.IOS_BUNDLE_DROP_LOCATOR_HEADER = exports.IOS_BUNDLE_DROP_MODULE = exports.ANDROID_BUNDLE_DROP_PATHS = exports.ANDROID_BUNDLE_DROP_MODULE = void 0;
|
|
3
|
+
exports.hasBareIosStartupIntegration = exports.hasBareAndroidStartupIntegration = exports.findMissingBareNativeStartupStructure = exports.stripComments = exports.stripCommentsAndStrings = exports.IOS_BUNDLE_DROP_LOCATOR_HEADER = exports.IOS_BUNDLE_DROP_MODULE = exports.ANDROID_BUNDLE_DROP_PATHS = exports.ANDROID_BUNDLE_DROP_MODULE = void 0;
|
|
4
4
|
exports.ANDROID_BUNDLE_DROP_MODULE = 'com.bundledrop.BundleDropModule';
|
|
5
5
|
exports.ANDROID_BUNDLE_DROP_PATHS = 'com.bundledrop.BundleDropNativePaths';
|
|
6
6
|
exports.IOS_BUNDLE_DROP_MODULE = 'BundleDrop';
|
|
7
7
|
exports.IOS_BUNDLE_DROP_LOCATOR_HEADER = 'BundleDrop/BundleDropLocator.h';
|
|
8
|
-
const
|
|
8
|
+
const sanitizeSource = (content, preserveStrings) => {
|
|
9
9
|
let code = '';
|
|
10
10
|
let state = 'code';
|
|
11
11
|
let escaped = false;
|
|
12
|
+
let blockCommentDepth = 0;
|
|
13
|
+
let tripleQuoteHashes = '';
|
|
12
14
|
for (let index = 0; index < content.length; index += 1) {
|
|
13
15
|
const character = content[index];
|
|
14
16
|
const nextCharacter = content[index + 1];
|
|
@@ -20,24 +22,51 @@ const stripCommentsAndStrings = (content) => {
|
|
|
20
22
|
continue;
|
|
21
23
|
}
|
|
22
24
|
if (state === 'block-comment') {
|
|
25
|
+
if (character === '/' && nextCharacter === '*') {
|
|
26
|
+
blockCommentDepth += 1;
|
|
27
|
+
index += 1;
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
23
30
|
if (character === '*' && nextCharacter === '/') {
|
|
24
|
-
|
|
31
|
+
blockCommentDepth -= 1;
|
|
32
|
+
if (blockCommentDepth === 0)
|
|
33
|
+
state = 'code';
|
|
25
34
|
index += 1;
|
|
26
35
|
}
|
|
27
36
|
continue;
|
|
28
37
|
}
|
|
38
|
+
if (state === 'triple-double') {
|
|
39
|
+
const closingDelimiter = `"""${tripleQuoteHashes}`;
|
|
40
|
+
if (content.startsWith(closingDelimiter, index)) {
|
|
41
|
+
if (preserveStrings)
|
|
42
|
+
code += closingDelimiter;
|
|
43
|
+
index += closingDelimiter.length - 1;
|
|
44
|
+
state = 'code';
|
|
45
|
+
tripleQuoteHashes = '';
|
|
46
|
+
}
|
|
47
|
+
else if (preserveStrings) {
|
|
48
|
+
code += character;
|
|
49
|
+
}
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
29
52
|
if (state !== 'code') {
|
|
30
53
|
if (escaped) {
|
|
54
|
+
if (preserveStrings)
|
|
55
|
+
code += character;
|
|
31
56
|
escaped = false;
|
|
32
57
|
continue;
|
|
33
58
|
}
|
|
34
59
|
if (character === '\\') {
|
|
60
|
+
if (preserveStrings)
|
|
61
|
+
code += character;
|
|
35
62
|
escaped = true;
|
|
36
63
|
continue;
|
|
37
64
|
}
|
|
38
65
|
const closesState = (state === 'single' && character === "'") ||
|
|
39
66
|
(state === 'double' && character === '"') ||
|
|
40
67
|
(state === 'template' && character === '`');
|
|
68
|
+
if (preserveStrings)
|
|
69
|
+
code += character;
|
|
41
70
|
if (closesState)
|
|
42
71
|
state = 'code';
|
|
43
72
|
continue;
|
|
@@ -49,53 +78,54 @@ const stripCommentsAndStrings = (content) => {
|
|
|
49
78
|
}
|
|
50
79
|
if (character === '/' && nextCharacter === '*') {
|
|
51
80
|
state = 'block-comment';
|
|
81
|
+
blockCommentDepth = 1;
|
|
52
82
|
index += 1;
|
|
53
83
|
continue;
|
|
54
84
|
}
|
|
85
|
+
const swiftRawTripleQuote = content.slice(index).match(/^(#+)"""/);
|
|
86
|
+
if (character === '"' && content.startsWith('"""', index)) {
|
|
87
|
+
state = 'triple-double';
|
|
88
|
+
tripleQuoteHashes = '';
|
|
89
|
+
if (preserveStrings)
|
|
90
|
+
code += '"""';
|
|
91
|
+
index += 2;
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
if (swiftRawTripleQuote) {
|
|
95
|
+
state = 'triple-double';
|
|
96
|
+
tripleQuoteHashes = swiftRawTripleQuote[1];
|
|
97
|
+
if (preserveStrings)
|
|
98
|
+
code += swiftRawTripleQuote[0];
|
|
99
|
+
index += swiftRawTripleQuote[0].length - 1;
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
55
102
|
if (character === "'") {
|
|
56
103
|
state = 'single';
|
|
104
|
+
if (preserveStrings)
|
|
105
|
+
code += character;
|
|
57
106
|
continue;
|
|
58
107
|
}
|
|
59
108
|
if (character === '"') {
|
|
60
109
|
state = 'double';
|
|
110
|
+
if (preserveStrings)
|
|
111
|
+
code += character;
|
|
61
112
|
continue;
|
|
62
113
|
}
|
|
63
114
|
if (character === '`') {
|
|
64
115
|
state = 'template';
|
|
116
|
+
if (preserveStrings)
|
|
117
|
+
code += character;
|
|
65
118
|
continue;
|
|
66
119
|
}
|
|
67
120
|
code += character;
|
|
68
121
|
}
|
|
69
122
|
return code;
|
|
70
123
|
};
|
|
124
|
+
const stripCommentsAndStrings = (content) => sanitizeSource(content, false);
|
|
71
125
|
exports.stripCommentsAndStrings = stripCommentsAndStrings;
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
const nativeCode = (0, exports.stripCommentsAndStrings)(code);
|
|
79
|
-
const usesModuleResolver = nativeCode.includes('getJSBundleFile') &&
|
|
80
|
-
nativeCode.includes('BundleDropModule.resolveJSBundleFile') &&
|
|
81
|
-
hasJavaOrKotlinReference(nativeCode, exports.ANDROID_BUNDLE_DROP_MODULE, 'resolveJSBundleFile');
|
|
82
|
-
const usesNativePaths = nativeCode.includes('BundleDropNativePaths.getDownloadedBundlePath') &&
|
|
83
|
-
hasJavaOrKotlinReference(nativeCode, exports.ANDROID_BUNDLE_DROP_PATHS, 'getDownloadedBundlePath');
|
|
84
|
-
return usesModuleResolver || usesNativePaths;
|
|
85
|
-
};
|
|
86
|
-
exports.hasBareAndroidStartupIntegration = hasBareAndroidStartupIntegration;
|
|
87
|
-
const hasBareIosStartupIntegration = (filePath, code) => {
|
|
88
|
-
const nativeCode = (0, exports.stripCommentsAndStrings)(code);
|
|
89
|
-
if (filePath.endsWith('.swift')) {
|
|
90
|
-
const usesLocator = nativeCode.includes('bundleURL') &&
|
|
91
|
-
nativeCode.includes('BundleDropLocator.bundleURL()');
|
|
92
|
-
return usesLocator &&
|
|
93
|
-
new RegExp(`\\bimport\\s+${exports.IOS_BUNDLE_DROP_MODULE}\\b`).test(nativeCode);
|
|
94
|
-
}
|
|
95
|
-
const usesLocator = (nativeCode.includes('sourceURLForBridge') || nativeCode.includes('bundleURL')) &&
|
|
96
|
-
nativeCode.includes('[BundleDropLocator bundleURL]');
|
|
97
|
-
const escapedHeader = exports.IOS_BUNDLE_DROP_LOCATOR_HEADER.replace(/[/.]/g, '\\$&');
|
|
98
|
-
return usesLocator &&
|
|
99
|
-
new RegExp(`#import\\s*[<\"]${escapedHeader}[>\"]`).test(nativeCode);
|
|
100
|
-
};
|
|
101
|
-
exports.hasBareIosStartupIntegration = hasBareIosStartupIntegration;
|
|
126
|
+
const stripComments = (content) => sanitizeSource(content, true);
|
|
127
|
+
exports.stripComments = stripComments;
|
|
128
|
+
var native_startup_validator_1 = require("./native-startup-validator");
|
|
129
|
+
Object.defineProperty(exports, "findMissingBareNativeStartupStructure", { enumerable: true, get: function () { return native_startup_validator_1.findMissingBareNativeStartupStructure; } });
|
|
130
|
+
Object.defineProperty(exports, "hasBareAndroidStartupIntegration", { enumerable: true, get: function () { return native_startup_validator_1.hasBareAndroidStartupIntegration; } });
|
|
131
|
+
Object.defineProperty(exports, "hasBareIosStartupIntegration", { enumerable: true, get: function () { return native_startup_validator_1.hasBareIosStartupIntegration; } });
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const hasBareAndroidStartupIntegration: (code: string) => boolean;
|
|
2
|
+
export declare const hasBareIosStartupIntegration: (filePath: string, code: string) => boolean;
|
|
3
|
+
export declare const findMissingBareNativeStartupStructure: (filePath: string, original: string, updated: string) => string[];
|