@expo/config-plugins 4.0.2 → 4.0.7
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 +14 -0
- package/build/Plugin.types.d.ts +4 -0
- package/build/Plugin.types.js.map +1 -1
- package/build/android/Updates.d.ts +10 -10
- package/build/android/Updates.js.map +1 -1
- package/build/android/codeMod.d.ts +20 -0
- package/build/android/codeMod.js +109 -0
- package/build/android/codeMod.js.map +1 -0
- package/build/android/index.d.ts +2 -6
- package/build/android/index.js +1 -86
- package/build/android/index.js.map +1 -1
- package/build/index.d.ts +1 -1
- package/build/index.js +8 -0
- package/build/index.js.map +1 -1
- package/build/ios/Bitcode.d.ts +33 -0
- package/build/ios/Bitcode.js +131 -0
- package/build/ios/Bitcode.js.map +1 -0
- package/build/ios/Maps.js +1 -0
- package/build/ios/Maps.js.map +1 -1
- package/build/ios/Paths.d.ts +1 -0
- package/build/ios/Paths.js +25 -0
- package/build/ios/Paths.js.map +1 -1
- package/build/ios/Updates.d.ts +10 -10
- package/build/ios/Updates.js.map +1 -1
- package/build/ios/codeMod.d.ts +81 -0
- package/build/ios/codeMod.js +306 -0
- package/build/ios/codeMod.js.map +1 -0
- package/build/ios/index.d.ts +3 -5
- package/build/ios/index.js +6 -57
- package/build/ios/index.js.map +1 -1
- package/build/plugins/android-plugins.d.ts +7 -0
- package/build/plugins/android-plugins.js +19 -2
- package/build/plugins/android-plugins.js.map +1 -1
- package/build/plugins/ios-plugins.d.ts +6 -6
- package/build/plugins/ios-plugins.js.map +1 -1
- package/build/plugins/withAndroidBaseMods.d.ts +2 -0
- package/build/plugins/withAndroidBaseMods.js +32 -0
- package/build/plugins/withAndroidBaseMods.js.map +1 -1
- package/build/plugins/withStaticPlugin.js +16 -5
- package/build/plugins/withStaticPlugin.js.map +1 -1
- package/build/utils/Updates.d.ts +5 -4
- package/build/utils/Updates.js +1 -1
- package/build/utils/Updates.js.map +1 -1
- package/build/utils/commonCodeMod.d.ts +32 -0
- package/build/utils/commonCodeMod.js +71 -0
- package/build/utils/commonCodeMod.js.map +1 -0
- package/build/utils/matchBrackets.d.ts +7 -0
- package/build/utils/matchBrackets.js +80 -0
- package/build/utils/matchBrackets.js.map +1 -0
- package/package.json +3 -3
- package/build/android/Branch.d.ts +0 -5
- package/build/android/Branch.js +0 -54
- package/build/android/Branch.js.map +0 -1
- package/build/android/Facebook.d.ts +0 -13
- package/build/android/Facebook.js +0 -236
- package/build/android/Facebook.js.map +0 -1
- package/build/android/NavigationBar.d.ts +0 -9
- package/build/android/NavigationBar.js +0 -141
- package/build/android/NavigationBar.js.map +0 -1
- package/build/android/RootViewBackgroundColor.d.ts +0 -6
- package/build/android/RootViewBackgroundColor.js +0 -81
- package/build/android/RootViewBackgroundColor.js.map +0 -1
- package/build/android/UserInterfaceStyle.d.ts +0 -11
- package/build/android/UserInterfaceStyle.js +0 -125
- package/build/android/UserInterfaceStyle.js.map +0 -1
- package/build/ios/Branch.d.ts +0 -5
- package/build/ios/Branch.js +0 -42
- package/build/ios/Branch.js.map +0 -1
- package/build/ios/Facebook.d.ts +0 -176
- package/build/ios/Facebook.js +0 -232
- package/build/ios/Facebook.js.map +0 -1
- package/build/ios/RootViewBackgroundColor.d.ts +0 -6
- package/build/ios/RootViewBackgroundColor.js +0 -70
- package/build/ios/RootViewBackgroundColor.js.map +0 -1
- package/build/ios/UserInterfaceStyle.d.ts +0 -5
- package/build/ios/UserInterfaceStyle.js +0 -59
- package/build/ios/UserInterfaceStyle.js.map +0 -1
|
@@ -15,6 +15,7 @@ declare const defaultProviders: {
|
|
|
15
15
|
settingsGradle: import("./createBaseMod").BaseModProviderMethods<Paths.GradleProjectFile, Partial<Pick<import("./withMod").BaseModOptions, "skipEmptyMod" | "saveToInternal">>>;
|
|
16
16
|
appBuildGradle: import("./createBaseMod").BaseModProviderMethods<Paths.GradleProjectFile, Partial<Pick<import("./withMod").BaseModOptions, "skipEmptyMod" | "saveToInternal">>>;
|
|
17
17
|
mainActivity: import("./createBaseMod").BaseModProviderMethods<Paths.ApplicationProjectFile, Partial<Pick<import("./withMod").BaseModOptions, "skipEmptyMod" | "saveToInternal">>>;
|
|
18
|
+
mainApplication: import("./createBaseMod").BaseModProviderMethods<Paths.ApplicationProjectFile, Partial<Pick<import("./withMod").BaseModOptions, "skipEmptyMod" | "saveToInternal">>>;
|
|
18
19
|
};
|
|
19
20
|
declare type AndroidDefaultProviders = typeof defaultProviders;
|
|
20
21
|
export declare function withAndroidBaseMods(config: ExportedConfig, { providers, ...props }?: ForwardedBaseModOptions & {
|
|
@@ -32,5 +33,6 @@ export declare function getAndroidModFileProviders(): {
|
|
|
32
33
|
settingsGradle: import("./createBaseMod").BaseModProviderMethods<Paths.GradleProjectFile, Partial<Pick<import("./withMod").BaseModOptions, "skipEmptyMod" | "saveToInternal">>>;
|
|
33
34
|
appBuildGradle: import("./createBaseMod").BaseModProviderMethods<Paths.GradleProjectFile, Partial<Pick<import("./withMod").BaseModOptions, "skipEmptyMod" | "saveToInternal">>>;
|
|
34
35
|
mainActivity: import("./createBaseMod").BaseModProviderMethods<Paths.ApplicationProjectFile, Partial<Pick<import("./withMod").BaseModOptions, "skipEmptyMod" | "saveToInternal">>>;
|
|
36
|
+
mainApplication: import("./createBaseMod").BaseModProviderMethods<Paths.ApplicationProjectFile, Partial<Pick<import("./withMod").BaseModOptions, "skipEmptyMod" | "saveToInternal">>>;
|
|
35
37
|
};
|
|
36
38
|
export {};
|
|
@@ -92,6 +92,16 @@ function getAndroidManifestTemplate(config) {
|
|
|
92
92
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
|
|
93
93
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
|
94
94
|
<!-- END OPTIONAL PERMISSIONS -->
|
|
95
|
+
|
|
96
|
+
<queries>
|
|
97
|
+
<!-- Support checking for http(s) links via the Linking API -->
|
|
98
|
+
<intent>
|
|
99
|
+
<action android:name="android.intent.action.VIEW" />
|
|
100
|
+
<category android:name="android.intent.category.BROWSABLE" />
|
|
101
|
+
<data android:scheme="https" />
|
|
102
|
+
</intent>
|
|
103
|
+
</queries>
|
|
104
|
+
|
|
95
105
|
<application
|
|
96
106
|
android:name=".MainApplication"
|
|
97
107
|
android:label="@string/app_name"
|
|
@@ -553,6 +563,28 @@ const defaultProviders = {
|
|
|
553
563
|
await writeFile(filePath, contents);
|
|
554
564
|
}
|
|
555
565
|
|
|
566
|
+
}),
|
|
567
|
+
mainApplication: (0, _createBaseMod().provider)({
|
|
568
|
+
getFilePath({
|
|
569
|
+
modRequest: {
|
|
570
|
+
projectRoot
|
|
571
|
+
}
|
|
572
|
+
}) {
|
|
573
|
+
return _android().Paths.getProjectFilePath(projectRoot, 'MainApplication');
|
|
574
|
+
},
|
|
575
|
+
|
|
576
|
+
async read(filePath) {
|
|
577
|
+
return _android().Paths.getFileInfo(filePath);
|
|
578
|
+
},
|
|
579
|
+
|
|
580
|
+
async write(filePath, {
|
|
581
|
+
modResults: {
|
|
582
|
+
contents
|
|
583
|
+
}
|
|
584
|
+
}) {
|
|
585
|
+
await writeFile(filePath, contents);
|
|
586
|
+
}
|
|
587
|
+
|
|
556
588
|
})
|
|
557
589
|
};
|
|
558
590
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/plugins/withAndroidBaseMods.ts"],"names":["readFile","writeFile","promises","getAndroidManifestTemplate","config","android","package","sortAndroidManifest","obj","manifest","reverseSortString","Array","isArray","sort","a","b","$","application","map","defaultProviders","dangerous","getFilePath","read","filePath","modResults","write","isIntrospective","modRequest","platformProjectRoot","path","join","Manifest","readAndroidManifestAsync","error","introspect","writeAndroidManifestAsync","gradleProperties","Properties","parsePropertiesFile","propertiesListToString","strings","projectRoot","Strings","getProjectStringsXMLPathAsync","Resources","readResourcesXMLAsync","resources","xml","colors","Colors","getProjectColorsXMLPathAsync","colorsNight","kind","styles","Styles","getProjectStylesXMLPathAsync","fallback","projectBuildGradle","Paths","getProjectBuildGradleFilePath","getFileInfo","contents","settingsGradle","getSettingsGradleFilePath","appBuildGradle","getAppBuildGradleFilePath","mainActivity","getProjectFilePath","withAndroidBaseMods","providers","props","platform","getAndroidModFileProviders"],"mappings":";;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAGA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;AAEA,MAAM;AAAEA,EAAAA,QAAF;AAAYC,EAAAA;AAAZ,IAA0BC,cAAhC;;AAIA,SAASC,0BAAT,CAAoCC,MAApC,EAA4D;AAAA;;AAC1D;AACA;AACA,SAAO,0BAAe;AACxB,kFADuB,4CAEnBA,MAAM,CAACC,OAFY,oDAEnB,gBAAgBC,OAFG,yEAEQ,uBAC5B;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GA1CS,CAAP;AA2CD;;AAEM,SAASC,mBAAT,CAA6BC,GAA7B,EAAmD;AACxD,MAAIA,GAAG,CAACC,QAAR,EAAkB;AAChB;AACAD,IAAAA,GAAG,CAACC,QAAJ,GAAe,8BAAWD,GAAG,CAACC,QAAf,EAAyBC,+BAAzB,CAAf;;AAEA,QAAIC,KAAK,CAACC,OAAN,CAAcJ,GAAG,CAACC,QAAJ,CAAa,iBAAb,CAAd,CAAJ,EAAoD;AAClD;AACAD,MAAAA,GAAG,CAACC,QAAJ,CAAa,iBAAb,EAAgCI,IAAhC,CAAqC,CAACC,CAAD,EAAIC,CAAJ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,EAA8C,EACnD,GAAGkE,KADgD;AAEnDC,IAAAA,QAAQ,EAAE,SAFyC;AAGnDF,IAAAA,SAAS,EAAEA,SAAF,aAAEA,SAAF,cAAEA,SAAF,GAAeG,0BAA0B;AAHC,GAA9C,CAAP;AAKD;;AAEM,SAASA,0BAAT,GAAsC;AAC3C,SAAOrD,gBAAP;AACD","sourcesContent":["import { promises } from 'fs';\nimport path from 'path';\n\nimport { ExportedConfig, ModConfig } from '../Plugin.types';\nimport { Colors, Manifest, Paths, Properties, Resources, Strings, Styles } from '../android';\nimport { AndroidManifest } from '../android/Manifest';\nimport { parseXMLAsync, writeXMLAsync } from '../utils/XML';\nimport { reverseSortString, sortObject, sortObjWithOrder } from '../utils/sortObject';\nimport { ForwardedBaseModOptions, provider, withGeneratedBaseMods } from './createBaseMod';\n\nconst { readFile, writeFile } = promises;\n\ntype AndroidModName = keyof Required<ModConfig>['android'];\n\nfunction getAndroidManifestTemplate(config: ExportedConfig) {\n // Keep in sync with https://github.com/expo/expo/blob/master/templates/expo-template-bare-minimum/android/app/src/main/AndroidManifest.xml\n // TODO: Read from remote template when possible\n return parseXMLAsync(`\n <manifest xmlns:android=\"http://schemas.android.com/apk/res/android\" package=\"${\n config.android?.package ?? 'com.placeholder.appid'\n }\">\n\n <uses-permission android:name=\"android.permission.INTERNET\"/>\n <!-- OPTIONAL PERMISSIONS, REMOVE WHATEVER YOU DO NOT NEED -->\n <uses-permission android:name=\"android.permission.SYSTEM_ALERT_WINDOW\"/>\n <uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>\n <uses-permission android:name=\"android.permission.VIBRATE\"/>\n <uses-permission android:name=\"android.permission.MODIFY_AUDIO_SETTINGS\"/>\n <!-- These require runtime permissions on M -->\n <uses-permission android:name=\"android.permission.READ_EXTERNAL_STORAGE\"/>\n <uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\"/>\n <!-- END OPTIONAL PERMISSIONS -->\n <application\n android:name=\".MainApplication\"\n android:label=\"@string/app_name\"\n android:icon=\"@mipmap/ic_launcher\"\n android:roundIcon=\"@mipmap/ic_launcher_round\"\n android:allowBackup=\"false\"\n android:theme=\"@style/AppTheme\"\n android:usesCleartextTraffic=\"true\"\n >\n <meta-data android:name=\"expo.modules.updates.EXPO_UPDATE_URL\" android:value=\"YOUR-APP-URL-HERE\"/>\n <meta-data android:name=\"expo.modules.updates.EXPO_SDK_VERSION\" android:value=\"YOUR-APP-SDK-VERSION-HERE\"/>\n <activity\n android:name=\".MainActivity\"\n android:label=\"@string/app_name\"\n android:configChanges=\"keyboard|keyboardHidden|orientation|screenSize|uiMode\"\n android:launchMode=\"singleTask\"\n android:windowSoftInputMode=\"adjustResize\"\n android:theme=\"@style/Theme.App.SplashScreen\"\n >\n <intent-filter>\n <action android:name=\"android.intent.action.MAIN\"/>\n <category android:name=\"android.intent.category.LAUNCHER\"/>\n </intent-filter>\n </activity>\n <activity android:name=\"com.facebook.react.devsupport.DevSettingsActivity\"/>\n </application>\n </manifest>\n `) as Promise<AndroidManifest>;\n}\n\nexport function sortAndroidManifest(obj: AndroidManifest) {\n if (obj.manifest) {\n // Reverse sort so application is last and permissions are first\n obj.manifest = sortObject(obj.manifest, reverseSortString);\n\n if (Array.isArray(obj.manifest['uses-permission'])) {\n // Sort permissions alphabetically\n obj.manifest['uses-permission'].sort((a, b) => {\n if (a.$['android:name'] < b.$['android:name']) return -1;\n if (a.$['android:name'] > b.$['android:name']) return 1;\n return 0;\n });\n }\n\n if (Array.isArray(obj.manifest.application)) {\n // reverse sort applications so activity is towards the end and meta-data is towards the front.\n obj.manifest.application = obj.manifest.application.map(application => {\n application = sortObjWithOrder(application, ['meta-data', 'service', 'activity']);\n\n if (Array.isArray(application['meta-data'])) {\n // Sort metadata alphabetically\n application['meta-data'].sort((a, b) => {\n if (a.$['android:name'] < b.$['android:name']) return -1;\n if (a.$['android:name'] > b.$['android:name']) return 1;\n return 0;\n });\n }\n return application;\n });\n }\n }\n return obj;\n}\n\nconst defaultProviders = {\n dangerous: provider<unknown>({\n getFilePath() {\n return '';\n },\n async read() {\n return { filePath: '', modResults: {} };\n },\n async write() {},\n }),\n\n // Append a rule to supply gradle.properties data to mods on `mods.android.gradleProperties`\n manifest: provider<Manifest.AndroidManifest>({\n isIntrospective: true,\n getFilePath({ modRequest: { platformProjectRoot } }) {\n return path.join(platformProjectRoot, 'app/src/main/AndroidManifest.xml');\n },\n async read(filePath, config) {\n try {\n return await Manifest.readAndroidManifestAsync(filePath);\n } catch (error: any) {\n if (!config.modRequest.introspect) {\n throw error;\n }\n }\n return await getAndroidManifestTemplate(config);\n },\n async write(filePath, { modResults, modRequest: { introspect } }) {\n if (introspect) return;\n await Manifest.writeAndroidManifestAsync(filePath, sortAndroidManifest(modResults));\n },\n }),\n\n // Append a rule to supply gradle.properties data to mods on `mods.android.gradleProperties`\n gradleProperties: provider<Properties.PropertiesItem[]>({\n isIntrospective: true,\n\n getFilePath({ modRequest: { platformProjectRoot } }) {\n return path.join(platformProjectRoot, 'gradle.properties');\n },\n async read(filePath, config) {\n try {\n return await Properties.parsePropertiesFile(await readFile(filePath, 'utf8'));\n } catch (error) {\n if (!config.modRequest.introspect) {\n throw error;\n }\n }\n return [];\n },\n async write(filePath, { modResults, modRequest: { introspect } }) {\n if (introspect) return;\n await writeFile(filePath, Properties.propertiesListToString(modResults));\n },\n }),\n\n // Append a rule to supply strings.xml data to mods on `mods.android.strings`\n strings: provider<Resources.ResourceXML>({\n isIntrospective: true,\n\n async getFilePath({ modRequest: { projectRoot, introspect } }) {\n try {\n return await Strings.getProjectStringsXMLPathAsync(projectRoot);\n } catch (error: any) {\n if (!introspect) {\n throw error;\n }\n }\n return '';\n },\n\n async read(filePath, config) {\n try {\n return await Resources.readResourcesXMLAsync({ path: filePath });\n } catch (error) {\n if (!config.modRequest.introspect) {\n throw error;\n }\n }\n return { resources: {} };\n },\n async write(filePath, { modResults, modRequest: { introspect } }) {\n if (introspect) return;\n await writeXMLAsync({ path: filePath, xml: modResults });\n },\n }),\n\n colors: provider<Resources.ResourceXML>({\n isIntrospective: true,\n\n async getFilePath({ modRequest: { projectRoot, introspect } }) {\n try {\n return await Colors.getProjectColorsXMLPathAsync(projectRoot);\n } catch (error: any) {\n if (!introspect) {\n throw error;\n }\n }\n return '';\n },\n\n async read(filePath, { modRequest: { introspect } }) {\n try {\n return await Resources.readResourcesXMLAsync({ path: filePath });\n } catch (error: any) {\n if (!introspect) {\n throw error;\n }\n }\n return { resources: {} };\n },\n async write(filePath, { modResults, modRequest: { introspect } }) {\n if (introspect) return;\n await writeXMLAsync({ path: filePath, xml: modResults });\n },\n }),\n\n colorsNight: provider<Resources.ResourceXML>({\n isIntrospective: true,\n\n async getFilePath({ modRequest: { projectRoot, introspect } }) {\n try {\n return await Colors.getProjectColorsXMLPathAsync(projectRoot, { kind: 'values-night' });\n } catch (error: any) {\n if (!introspect) {\n throw error;\n }\n }\n return '';\n },\n async read(filePath, config) {\n try {\n return await Resources.readResourcesXMLAsync({ path: filePath });\n } catch (error: any) {\n if (!config.modRequest.introspect) {\n throw error;\n }\n }\n return { resources: {} };\n },\n async write(filePath, { modResults, modRequest: { introspect } }) {\n if (introspect) return;\n await writeXMLAsync({ path: filePath, xml: modResults });\n },\n }),\n\n styles: provider<Resources.ResourceXML>({\n isIntrospective: true,\n\n async getFilePath({ modRequest: { projectRoot, introspect } }) {\n try {\n return await Styles.getProjectStylesXMLPathAsync(projectRoot);\n } catch (error: any) {\n if (!introspect) {\n throw error;\n }\n }\n return '';\n },\n async read(filePath, config) {\n let styles: Resources.ResourceXML = { resources: {} };\n\n try {\n // Adds support for `tools:x`\n styles = await Resources.readResourcesXMLAsync({\n path: filePath,\n fallback: `<?xml version=\"1.0\" encoding=\"utf-8\"?><resources xmlns:tools=\"http://schemas.android.com/tools\"></resources>`,\n });\n } catch (error: any) {\n if (!config.modRequest.introspect) {\n throw error;\n }\n }\n\n // Ensure support for tools is added...\n if (!styles.resources.$) {\n styles.resources.$ = {};\n }\n if (!styles.resources.$?.['xmlns:tools']) {\n styles.resources.$['xmlns:tools'] = 'http://schemas.android.com/tools';\n }\n return styles;\n },\n async write(filePath, { modResults, modRequest: { introspect } }) {\n if (introspect) return;\n await writeXMLAsync({ path: filePath, xml: modResults });\n },\n }),\n\n projectBuildGradle: provider<Paths.GradleProjectFile>({\n getFilePath({ modRequest: { projectRoot } }) {\n return Paths.getProjectBuildGradleFilePath(projectRoot);\n },\n async read(filePath) {\n return Paths.getFileInfo(filePath);\n },\n async write(filePath, { modResults: { contents } }) {\n await writeFile(filePath, contents);\n },\n }),\n\n settingsGradle: provider<Paths.GradleProjectFile>({\n getFilePath({ modRequest: { projectRoot } }) {\n return Paths.getSettingsGradleFilePath(projectRoot);\n },\n async read(filePath) {\n return Paths.getFileInfo(filePath);\n },\n async write(filePath, { modResults: { contents } }) {\n await writeFile(filePath, contents);\n },\n }),\n\n appBuildGradle: provider<Paths.GradleProjectFile>({\n getFilePath({ modRequest: { projectRoot } }) {\n return Paths.getAppBuildGradleFilePath(projectRoot);\n },\n async read(filePath) {\n return Paths.getFileInfo(filePath);\n },\n async write(filePath, { modResults: { contents } }) {\n await writeFile(filePath, contents);\n },\n }),\n\n mainActivity: provider<Paths.ApplicationProjectFile>({\n getFilePath({ modRequest: { projectRoot } }) {\n return Paths.getProjectFilePath(projectRoot, 'MainActivity');\n },\n async read(filePath) {\n return Paths.getFileInfo(filePath);\n },\n async write(filePath, { modResults: { contents } }) {\n await writeFile(filePath, contents);\n },\n }),\n};\n\ntype AndroidDefaultProviders = typeof defaultProviders;\n\nexport function withAndroidBaseMods(\n config: ExportedConfig,\n {\n providers,\n ...props\n }: ForwardedBaseModOptions & { providers?: Partial<AndroidDefaultProviders> } = {}\n): ExportedConfig {\n return withGeneratedBaseMods<AndroidModName>(config, {\n ...props,\n platform: 'android',\n providers: providers ?? getAndroidModFileProviders(),\n });\n}\n\nexport function getAndroidModFileProviders() {\n return defaultProviders;\n}\n"],"file":"withAndroidBaseMods.js"}
|
|
1
|
+
{"version":3,"sources":["../../src/plugins/withAndroidBaseMods.ts"],"names":["readFile","writeFile","promises","getAndroidManifestTemplate","config","android","package","sortAndroidManifest","obj","manifest","reverseSortString","Array","isArray","sort","a","b","$","application","map","defaultProviders","dangerous","getFilePath","read","filePath","modResults","write","isIntrospective","modRequest","platformProjectRoot","path","join","Manifest","readAndroidManifestAsync","error","introspect","writeAndroidManifestAsync","gradleProperties","Properties","parsePropertiesFile","propertiesListToString","strings","projectRoot","Strings","getProjectStringsXMLPathAsync","Resources","readResourcesXMLAsync","resources","xml","colors","Colors","getProjectColorsXMLPathAsync","colorsNight","kind","styles","Styles","getProjectStylesXMLPathAsync","fallback","projectBuildGradle","Paths","getProjectBuildGradleFilePath","getFileInfo","contents","settingsGradle","getSettingsGradleFilePath","appBuildGradle","getAppBuildGradleFilePath","mainActivity","getProjectFilePath","mainApplication","withAndroidBaseMods","providers","props","platform","getAndroidModFileProviders"],"mappings":";;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAGA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;AAEA,MAAM;AAAEA,EAAAA,QAAF;AAAYC,EAAAA;AAAZ,IAA0BC,cAAhC;;AAIA,SAASC,0BAAT,CAAoCC,MAApC,EAA4D;AAAA;;AAC1D;AACA;AACA,SAAO,0BAAe;AACxB,kFADuB,4CAEnBA,MAAM,CAACC,OAFY,oDAEnB,gBAAgBC,OAFG,yEAEQ,uBAC5B;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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{ promises } from 'fs';\nimport path from 'path';\n\nimport { ExportedConfig, ModConfig } from '../Plugin.types';\nimport { Colors, Manifest, Paths, Properties, Resources, Strings, Styles } from '../android';\nimport { AndroidManifest } from '../android/Manifest';\nimport { parseXMLAsync, writeXMLAsync } from '../utils/XML';\nimport { reverseSortString, sortObject, sortObjWithOrder } from '../utils/sortObject';\nimport { ForwardedBaseModOptions, provider, withGeneratedBaseMods } from './createBaseMod';\n\nconst { readFile, writeFile } = promises;\n\ntype AndroidModName = keyof Required<ModConfig>['android'];\n\nfunction getAndroidManifestTemplate(config: ExportedConfig) {\n // Keep in sync with https://github.com/expo/expo/blob/master/templates/expo-template-bare-minimum/android/app/src/main/AndroidManifest.xml\n // TODO: Read from remote template when possible\n return parseXMLAsync(`\n <manifest xmlns:android=\"http://schemas.android.com/apk/res/android\" package=\"${\n config.android?.package ?? 'com.placeholder.appid'\n }\">\n\n <uses-permission android:name=\"android.permission.INTERNET\"/>\n <!-- OPTIONAL PERMISSIONS, REMOVE WHATEVER YOU DO NOT NEED -->\n <uses-permission android:name=\"android.permission.SYSTEM_ALERT_WINDOW\"/>\n <uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>\n <uses-permission android:name=\"android.permission.VIBRATE\"/>\n <uses-permission android:name=\"android.permission.MODIFY_AUDIO_SETTINGS\"/>\n <!-- These require runtime permissions on M -->\n <uses-permission android:name=\"android.permission.READ_EXTERNAL_STORAGE\"/>\n <uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\"/>\n <!-- END OPTIONAL PERMISSIONS -->\n\n <queries>\n <!-- Support checking for http(s) links via the Linking API -->\n <intent>\n <action android:name=\"android.intent.action.VIEW\" />\n <category android:name=\"android.intent.category.BROWSABLE\" />\n <data android:scheme=\"https\" />\n </intent>\n </queries>\n\n <application\n android:name=\".MainApplication\"\n android:label=\"@string/app_name\"\n android:icon=\"@mipmap/ic_launcher\"\n android:roundIcon=\"@mipmap/ic_launcher_round\"\n android:allowBackup=\"false\"\n android:theme=\"@style/AppTheme\"\n android:usesCleartextTraffic=\"true\"\n >\n <meta-data android:name=\"expo.modules.updates.EXPO_UPDATE_URL\" android:value=\"YOUR-APP-URL-HERE\"/>\n <meta-data android:name=\"expo.modules.updates.EXPO_SDK_VERSION\" android:value=\"YOUR-APP-SDK-VERSION-HERE\"/>\n <activity\n android:name=\".MainActivity\"\n android:label=\"@string/app_name\"\n android:configChanges=\"keyboard|keyboardHidden|orientation|screenSize|uiMode\"\n android:launchMode=\"singleTask\"\n android:windowSoftInputMode=\"adjustResize\"\n android:theme=\"@style/Theme.App.SplashScreen\"\n >\n <intent-filter>\n <action android:name=\"android.intent.action.MAIN\"/>\n <category android:name=\"android.intent.category.LAUNCHER\"/>\n </intent-filter>\n </activity>\n <activity android:name=\"com.facebook.react.devsupport.DevSettingsActivity\"/>\n </application>\n </manifest>\n `) as Promise<AndroidManifest>;\n}\n\nexport function sortAndroidManifest(obj: AndroidManifest) {\n if (obj.manifest) {\n // Reverse sort so application is last and permissions are first\n obj.manifest = sortObject(obj.manifest, reverseSortString);\n\n if (Array.isArray(obj.manifest['uses-permission'])) {\n // Sort permissions alphabetically\n obj.manifest['uses-permission'].sort((a, b) => {\n if (a.$['android:name'] < b.$['android:name']) return -1;\n if (a.$['android:name'] > b.$['android:name']) return 1;\n return 0;\n });\n }\n\n if (Array.isArray(obj.manifest.application)) {\n // reverse sort applications so activity is towards the end and meta-data is towards the front.\n obj.manifest.application = obj.manifest.application.map(application => {\n application = sortObjWithOrder(application, ['meta-data', 'service', 'activity']);\n\n if (Array.isArray(application['meta-data'])) {\n // Sort metadata alphabetically\n application['meta-data'].sort((a, b) => {\n if (a.$['android:name'] < b.$['android:name']) return -1;\n if (a.$['android:name'] > b.$['android:name']) return 1;\n return 0;\n });\n }\n return application;\n });\n }\n }\n return obj;\n}\n\nconst defaultProviders = {\n dangerous: provider<unknown>({\n getFilePath() {\n return '';\n },\n async read() {\n return { filePath: '', modResults: {} };\n },\n async write() {},\n }),\n\n // Append a rule to supply gradle.properties data to mods on `mods.android.gradleProperties`\n manifest: provider<Manifest.AndroidManifest>({\n isIntrospective: true,\n getFilePath({ modRequest: { platformProjectRoot } }) {\n return path.join(platformProjectRoot, 'app/src/main/AndroidManifest.xml');\n },\n async read(filePath, config) {\n try {\n return await Manifest.readAndroidManifestAsync(filePath);\n } catch (error: any) {\n if (!config.modRequest.introspect) {\n throw error;\n }\n }\n return await getAndroidManifestTemplate(config);\n },\n async write(filePath, { modResults, modRequest: { introspect } }) {\n if (introspect) return;\n await Manifest.writeAndroidManifestAsync(filePath, sortAndroidManifest(modResults));\n },\n }),\n\n // Append a rule to supply gradle.properties data to mods on `mods.android.gradleProperties`\n gradleProperties: provider<Properties.PropertiesItem[]>({\n isIntrospective: true,\n\n getFilePath({ modRequest: { platformProjectRoot } }) {\n return path.join(platformProjectRoot, 'gradle.properties');\n },\n async read(filePath, config) {\n try {\n return await Properties.parsePropertiesFile(await readFile(filePath, 'utf8'));\n } catch (error) {\n if (!config.modRequest.introspect) {\n throw error;\n }\n }\n return [];\n },\n async write(filePath, { modResults, modRequest: { introspect } }) {\n if (introspect) return;\n await writeFile(filePath, Properties.propertiesListToString(modResults));\n },\n }),\n\n // Append a rule to supply strings.xml data to mods on `mods.android.strings`\n strings: provider<Resources.ResourceXML>({\n isIntrospective: true,\n\n async getFilePath({ modRequest: { projectRoot, introspect } }) {\n try {\n return await Strings.getProjectStringsXMLPathAsync(projectRoot);\n } catch (error: any) {\n if (!introspect) {\n throw error;\n }\n }\n return '';\n },\n\n async read(filePath, config) {\n try {\n return await Resources.readResourcesXMLAsync({ path: filePath });\n } catch (error) {\n if (!config.modRequest.introspect) {\n throw error;\n }\n }\n return { resources: {} };\n },\n async write(filePath, { modResults, modRequest: { introspect } }) {\n if (introspect) return;\n await writeXMLAsync({ path: filePath, xml: modResults });\n },\n }),\n\n colors: provider<Resources.ResourceXML>({\n isIntrospective: true,\n\n async getFilePath({ modRequest: { projectRoot, introspect } }) {\n try {\n return await Colors.getProjectColorsXMLPathAsync(projectRoot);\n } catch (error: any) {\n if (!introspect) {\n throw error;\n }\n }\n return '';\n },\n\n async read(filePath, { modRequest: { introspect } }) {\n try {\n return await Resources.readResourcesXMLAsync({ path: filePath });\n } catch (error: any) {\n if (!introspect) {\n throw error;\n }\n }\n return { resources: {} };\n },\n async write(filePath, { modResults, modRequest: { introspect } }) {\n if (introspect) return;\n await writeXMLAsync({ path: filePath, xml: modResults });\n },\n }),\n\n colorsNight: provider<Resources.ResourceXML>({\n isIntrospective: true,\n\n async getFilePath({ modRequest: { projectRoot, introspect } }) {\n try {\n return await Colors.getProjectColorsXMLPathAsync(projectRoot, { kind: 'values-night' });\n } catch (error: any) {\n if (!introspect) {\n throw error;\n }\n }\n return '';\n },\n async read(filePath, config) {\n try {\n return await Resources.readResourcesXMLAsync({ path: filePath });\n } catch (error: any) {\n if (!config.modRequest.introspect) {\n throw error;\n }\n }\n return { resources: {} };\n },\n async write(filePath, { modResults, modRequest: { introspect } }) {\n if (introspect) return;\n await writeXMLAsync({ path: filePath, xml: modResults });\n },\n }),\n\n styles: provider<Resources.ResourceXML>({\n isIntrospective: true,\n\n async getFilePath({ modRequest: { projectRoot, introspect } }) {\n try {\n return await Styles.getProjectStylesXMLPathAsync(projectRoot);\n } catch (error: any) {\n if (!introspect) {\n throw error;\n }\n }\n return '';\n },\n async read(filePath, config) {\n let styles: Resources.ResourceXML = { resources: {} };\n\n try {\n // Adds support for `tools:x`\n styles = await Resources.readResourcesXMLAsync({\n path: filePath,\n fallback: `<?xml version=\"1.0\" encoding=\"utf-8\"?><resources xmlns:tools=\"http://schemas.android.com/tools\"></resources>`,\n });\n } catch (error: any) {\n if (!config.modRequest.introspect) {\n throw error;\n }\n }\n\n // Ensure support for tools is added...\n if (!styles.resources.$) {\n styles.resources.$ = {};\n }\n if (!styles.resources.$?.['xmlns:tools']) {\n styles.resources.$['xmlns:tools'] = 'http://schemas.android.com/tools';\n }\n return styles;\n },\n async write(filePath, { modResults, modRequest: { introspect } }) {\n if (introspect) return;\n await writeXMLAsync({ path: filePath, xml: modResults });\n },\n }),\n\n projectBuildGradle: provider<Paths.GradleProjectFile>({\n getFilePath({ modRequest: { projectRoot } }) {\n return Paths.getProjectBuildGradleFilePath(projectRoot);\n },\n async read(filePath) {\n return Paths.getFileInfo(filePath);\n },\n async write(filePath, { modResults: { contents } }) {\n await writeFile(filePath, contents);\n },\n }),\n\n settingsGradle: provider<Paths.GradleProjectFile>({\n getFilePath({ modRequest: { projectRoot } }) {\n return Paths.getSettingsGradleFilePath(projectRoot);\n },\n async read(filePath) {\n return Paths.getFileInfo(filePath);\n },\n async write(filePath, { modResults: { contents } }) {\n await writeFile(filePath, contents);\n },\n }),\n\n appBuildGradle: provider<Paths.GradleProjectFile>({\n getFilePath({ modRequest: { projectRoot } }) {\n return Paths.getAppBuildGradleFilePath(projectRoot);\n },\n async read(filePath) {\n return Paths.getFileInfo(filePath);\n },\n async write(filePath, { modResults: { contents } }) {\n await writeFile(filePath, contents);\n },\n }),\n\n mainActivity: provider<Paths.ApplicationProjectFile>({\n getFilePath({ modRequest: { projectRoot } }) {\n return Paths.getProjectFilePath(projectRoot, 'MainActivity');\n },\n async read(filePath) {\n return Paths.getFileInfo(filePath);\n },\n async write(filePath, { modResults: { contents } }) {\n await writeFile(filePath, contents);\n },\n }),\n\n mainApplication: provider<Paths.ApplicationProjectFile>({\n getFilePath({ modRequest: { projectRoot } }) {\n return Paths.getProjectFilePath(projectRoot, 'MainApplication');\n },\n async read(filePath) {\n return Paths.getFileInfo(filePath);\n },\n async write(filePath, { modResults: { contents } }) {\n await writeFile(filePath, contents);\n },\n }),\n};\n\ntype AndroidDefaultProviders = typeof defaultProviders;\n\nexport function withAndroidBaseMods(\n config: ExportedConfig,\n {\n providers,\n ...props\n }: ForwardedBaseModOptions & { providers?: Partial<AndroidDefaultProviders> } = {}\n): ExportedConfig {\n return withGeneratedBaseMods<AndroidModName>(config, {\n ...props,\n platform: 'android',\n providers: providers ?? getAndroidModFileProviders(),\n });\n}\n\nexport function getAndroidModFileProviders() {\n return defaultProviders;\n}\n"],"file":"withAndroidBaseMods.js"}
|
|
@@ -47,8 +47,12 @@ function _pluginResolver() {
|
|
|
47
47
|
|
|
48
48
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
49
49
|
|
|
50
|
-
const EXPO_DEBUG = (0, _getenv().boolish)('EXPO_DEBUG', false);
|
|
51
|
-
|
|
50
|
+
const EXPO_DEBUG = (0, _getenv().boolish)('EXPO_DEBUG', false); // Show all error info related to plugin resolution.
|
|
51
|
+
|
|
52
|
+
const EXPO_CONFIG_PLUGIN_VERBOSE_ERRORS = (0, _getenv().boolish)('EXPO_CONFIG_PLUGIN_VERBOSE_ERRORS', false); // Force using the fallback unversioned plugin instead of a local versioned copy,
|
|
53
|
+
// this should only be used for testing the CLI.
|
|
54
|
+
|
|
55
|
+
const EXPO_USE_UNVERSIONED_PLUGINS = (0, _getenv().boolish)('EXPO_USE_UNVERSIONED_PLUGINS', false);
|
|
52
56
|
|
|
53
57
|
function isModuleMissingError(name, error) {
|
|
54
58
|
// @ts-ignore
|
|
@@ -93,14 +97,21 @@ const withStaticPlugin = (config, props) => {
|
|
|
93
97
|
let [pluginResolve, pluginProps] = (0, _pluginResolver().normalizeStaticPlugin)(props.plugin); // Ensure no one uses this property by accident.
|
|
94
98
|
|
|
95
99
|
(0, _assert().default)(!((_pluginProps = pluginProps) !== null && _pluginProps !== void 0 && _pluginProps._resolverError), `Plugin property '_resolverError' is a reserved property of \`withStaticPlugin\``);
|
|
96
|
-
let withPlugin;
|
|
100
|
+
let withPlugin;
|
|
97
101
|
|
|
98
|
-
if (
|
|
102
|
+
if ( // Function was provided, no need to resolve: [withPlugin, {}]
|
|
103
|
+
typeof pluginResolve === 'function') {
|
|
99
104
|
withPlugin = pluginResolve;
|
|
100
105
|
} else if (typeof pluginResolve === 'string') {
|
|
101
106
|
try {
|
|
102
107
|
// Resolve and evaluate plugins.
|
|
103
|
-
withPlugin = (0, _pluginResolver().resolveConfigPluginFunction)(projectRoot, pluginResolve);
|
|
108
|
+
withPlugin = (0, _pluginResolver().resolveConfigPluginFunction)(projectRoot, pluginResolve); // Only force if the project has the versioned plugin, otherwise use default behavior.
|
|
109
|
+
// This helps see which plugins are being skipped.
|
|
110
|
+
|
|
111
|
+
if (EXPO_USE_UNVERSIONED_PLUGINS && !!withPlugin && !!props._isLegacyPlugin && !!props.fallback) {
|
|
112
|
+
console.log(`Force "${pluginResolve}" to unversioned plugin`);
|
|
113
|
+
withPlugin = props.fallback;
|
|
114
|
+
}
|
|
104
115
|
} catch (error) {
|
|
105
116
|
if (EXPO_DEBUG) {
|
|
106
117
|
if (EXPO_CONFIG_PLUGIN_VERBOSE_ERRORS) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/plugins/withStaticPlugin.ts"],"names":["EXPO_DEBUG","EXPO_CONFIG_PLUGIN_VERBOSE_ERRORS","isModuleMissingError","name","error","includes","code","message","isUnexpectedTokenError","SyntaxError","PluginError","match","withStaticPlugin","config","props","projectRoot","_internal","pluginResolve","pluginProps","plugin","_resolverError","withPlugin","
|
|
1
|
+
{"version":3,"sources":["../../src/plugins/withStaticPlugin.ts"],"names":["EXPO_DEBUG","EXPO_CONFIG_PLUGIN_VERBOSE_ERRORS","EXPO_USE_UNVERSIONED_PLUGINS","isModuleMissingError","name","error","includes","code","message","isUnexpectedTokenError","SyntaxError","PluginError","match","withStaticPlugin","config","props","projectRoot","_internal","pluginResolve","pluginProps","plugin","_resolverError","withPlugin","_isLegacyPlugin","fallback","console","log","shouldMuteWarning"],"mappings":";;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAGA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;AAMA,MAAMA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D;AACF;AACF;AACF,OAvBkB,CAwBnB;AAEA;AACA;;;AACA,UAAIX,KAAK,CAACS,QAAV,EAAoB;AAClB,YAAI,CAACL,WAAL,EAAkBA,WAAW,GAAG,EAAd,CADA,CAElB;;AACAA,QAAAA,WAAW,CAACE,cAAZ,GAA6BhB,KAA7B;AACAiB,QAAAA,UAAU,GAAGP,KAAK,CAACS,QAAnB;AACD,OALD,MAKO;AACL;AACA,cAAMnB,KAAN;AACD;AACF;AACF,GAtDM,MAsDA;AACL,UAAM,KAAIM,qBAAJ,EACH,iCAAgC,OAAOO,aAAc,EADlD,EAEJ,qBAFI,CAAN;AAID,GAhFqB,CAkFtB;;;AACAJ,EAAAA,MAAM,GAAGQ,UAAU,CAACR,MAAD,EAASK,WAAT,CAAnB;AACA,SAAOL,MAAP;AACD,CA1FM","sourcesContent":["import assert from 'assert';\nimport { boolish } from 'getenv';\n\nimport { ConfigPlugin, StaticPlugin } from '../Plugin.types';\nimport { PluginError } from '../utils/errors';\nimport {\n assertInternalProjectRoot,\n normalizeStaticPlugin,\n resolveConfigPluginFunction,\n} from '../utils/plugin-resolver';\n\nconst EXPO_DEBUG = boolish('EXPO_DEBUG', false);\n\n// Show all error info related to plugin resolution.\nconst EXPO_CONFIG_PLUGIN_VERBOSE_ERRORS = boolish('EXPO_CONFIG_PLUGIN_VERBOSE_ERRORS', false);\n// Force using the fallback unversioned plugin instead of a local versioned copy,\n// this should only be used for testing the CLI.\nconst EXPO_USE_UNVERSIONED_PLUGINS = boolish('EXPO_USE_UNVERSIONED_PLUGINS', false);\n\nfunction isModuleMissingError(name: string, error: Error): boolean {\n // @ts-ignore\n if (['MODULE_NOT_FOUND', 'PLUGIN_NOT_FOUND'].includes(error.code)) {\n return true;\n }\n return error.message.includes(`Cannot find module '${name}'`);\n}\n\nfunction isUnexpectedTokenError(error: Error): boolean {\n if (\n error instanceof SyntaxError ||\n (error instanceof PluginError && error.code === 'INVALID_PLUGIN_IMPORT')\n ) {\n return (\n // These are the most common errors that'll be thrown when a package isn't transpiled correctly.\n !!error.message.match(/Unexpected token/) ||\n !!error.message.match(/Cannot use import statement/)\n );\n }\n return false;\n}\n\n/**\n * Resolves static module plugin and potentially falls back on a provided plugin if the module cannot be resolved\n *\n * @param config\n * @param fallback Plugin with `_resolverError` explaining why the module couldn't be used\n * @param projectRoot optional project root, fallback to _internal.projectRoot. Used for testing.\n * @param _isLegacyPlugin Used to suppress errors thrown by plugins that are applied automatically\n */\nexport const withStaticPlugin: ConfigPlugin<{\n plugin: StaticPlugin | ConfigPlugin | string;\n fallback?: ConfigPlugin<{ _resolverError: Error } & any>;\n projectRoot?: string;\n _isLegacyPlugin?: boolean;\n}> = (config, props) => {\n let projectRoot = props.projectRoot;\n if (!projectRoot) {\n projectRoot = config._internal?.projectRoot;\n assertInternalProjectRoot(projectRoot);\n }\n\n let [pluginResolve, pluginProps] = normalizeStaticPlugin(props.plugin);\n // Ensure no one uses this property by accident.\n assert(\n !pluginProps?._resolverError,\n `Plugin property '_resolverError' is a reserved property of \\`withStaticPlugin\\``\n );\n\n let withPlugin: ConfigPlugin<unknown>;\n\n if (\n // Function was provided, no need to resolve: [withPlugin, {}]\n typeof pluginResolve === 'function'\n ) {\n withPlugin = pluginResolve;\n } else if (typeof pluginResolve === 'string') {\n try {\n // Resolve and evaluate plugins.\n withPlugin = resolveConfigPluginFunction(projectRoot, pluginResolve);\n\n // Only force if the project has the versioned plugin, otherwise use default behavior.\n // This helps see which plugins are being skipped.\n if (\n EXPO_USE_UNVERSIONED_PLUGINS &&\n !!withPlugin &&\n !!props._isLegacyPlugin &&\n !!props.fallback\n ) {\n console.log(`Force \"${pluginResolve}\" to unversioned plugin`);\n withPlugin = props.fallback;\n }\n } catch (error: any) {\n if (EXPO_DEBUG) {\n if (EXPO_CONFIG_PLUGIN_VERBOSE_ERRORS) {\n // Log the error in debug mode for plugins with fallbacks (like the Expo managed plugins).\n console.log(`Error resolving plugin \"${pluginResolve}\"`);\n console.log(error);\n console.log();\n } else {\n const shouldMuteWarning =\n props._isLegacyPlugin &&\n (isModuleMissingError(pluginResolve, error) || isUnexpectedTokenError(error));\n if (!shouldMuteWarning) {\n if (isModuleMissingError(pluginResolve, error)) {\n // Prevent causing log spew for basic resolution errors.\n console.log(`Could not find plugin \"${pluginResolve}\"`);\n } else {\n // Log the error in debug mode for plugins with fallbacks (like the Expo managed plugins).\n console.log(`Error resolving plugin \"${pluginResolve}\"`);\n console.log(error);\n console.log();\n }\n }\n }\n }\n // TODO: Maybe allow for `PluginError`s to be thrown so external plugins can assert invalid options.\n\n // If the static module failed to resolve, attempt to use a fallback.\n // This enables support for built-in plugins with versioned variations living in other packages.\n if (props.fallback) {\n if (!pluginProps) pluginProps = {};\n // Pass this to the fallback plugin for potential warnings about needing to install a versioned package.\n pluginProps._resolverError = error;\n withPlugin = props.fallback;\n } else {\n // If no fallback, throw the resolution error.\n throw error;\n }\n }\n } else {\n throw new PluginError(\n `Plugin is an unexpected type: ${typeof pluginResolve}`,\n 'INVALID_PLUGIN_TYPE'\n );\n }\n\n // Execute the plugin.\n config = withPlugin(config, pluginProps);\n return config;\n};\n"],"file":"withStaticPlugin.js"}
|
package/build/utils/Updates.d.ts
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { Android, ExpoConfig, IOS } from '@expo/config-types';
|
|
2
|
-
export declare
|
|
2
|
+
export declare type ExpoConfigUpdates = Pick<ExpoConfig, 'sdkVersion' | 'owner' | 'runtimeVersion' | 'updates' | 'slug'>;
|
|
3
|
+
export declare function getUpdateUrl(config: Pick<ExpoConfigUpdates, 'owner' | 'slug' | 'updates'>, username: string | null): string | null;
|
|
3
4
|
export declare function getNativeVersion(config: Pick<ExpoConfig, 'version'> & {
|
|
4
|
-
android?: Pick<Android, 'versionCode'
|
|
5
|
-
ios?: Pick<IOS, 'buildNumber'
|
|
5
|
+
android?: Pick<Android, 'versionCode'>;
|
|
6
|
+
ios?: Pick<IOS, 'buildNumber'>;
|
|
6
7
|
}, platform: 'android' | 'ios'): string;
|
|
7
8
|
/**
|
|
8
9
|
* Compute runtime version policies.
|
|
9
10
|
* @return an expoConfig with only string valued platform specific runtime versions.
|
|
10
11
|
*/
|
|
11
12
|
export declare const withRuntimeVersion: (config: ExpoConfig) => ExpoConfig;
|
|
12
|
-
export declare function getRuntimeVersion(config: Pick<ExpoConfig, 'version' | '
|
|
13
|
+
export declare function getRuntimeVersion(config: Pick<ExpoConfig, 'version' | 'runtimeVersion' | 'sdkVersion'> & {
|
|
13
14
|
android?: Pick<Android, 'versionCode' | 'runtimeVersion'>;
|
|
14
15
|
ios?: Pick<IOS, 'buildNumber' | 'runtimeVersion'>;
|
|
15
16
|
}, platform: 'android' | 'ios'): string;
|
package/build/utils/Updates.js
CHANGED
|
@@ -108,7 +108,7 @@ function getRuntimeVersion(config, platform) {
|
|
|
108
108
|
|
|
109
109
|
if (typeof runtimeVersion === 'string') {
|
|
110
110
|
return runtimeVersion;
|
|
111
|
-
} else if (runtimeVersion.policy === '
|
|
111
|
+
} else if (runtimeVersion.policy === 'nativeVersion') {
|
|
112
112
|
return getNativeVersion(config, platform);
|
|
113
113
|
} else if (runtimeVersion.policy === 'sdkVersion') {
|
|
114
114
|
if (!config.sdkVersion) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/Updates.ts"],"names":["getUpdateUrl","config","username","updates","url","user","owner","slug","getNativeVersion","platform","version","IOSConfig","Version","getVersion","buildNumber","getBuildNumber","versionCode","AndroidConfig","getVersionCode","Error","withRuntimeVersion","ios","runtimeVersion","getRuntimeVersion","android","policy","sdkVersion","JSON","stringify"],"mappings":";;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;
|
|
1
|
+
{"version":3,"sources":["../../src/utils/Updates.ts"],"names":["getUpdateUrl","config","username","updates","url","user","owner","slug","getNativeVersion","platform","version","IOSConfig","Version","getVersion","buildNumber","getBuildNumber","versionCode","AndroidConfig","getVersionCode","Error","withRuntimeVersion","ios","runtimeVersion","getRuntimeVersion","android","policy","sdkVersion","JSON","stringify"],"mappings":";;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAOO,SAASA,YAAT,CACLC,MADK,EAELC,QAFK,EAGU;AAAA;;AACf,yBAAID,MAAM,CAACE,OAAX,4CAAI,gBAAgBC,GAApB,EAAyB;AAAA;;AACvB,+BAAOH,MAAM,CAACE,OAAd,qDAAO,iBAAgBC,GAAvB;AACD;;AAED,QAAMC,IAAI,GAAG,OAAOJ,MAAM,CAACK,KAAd,KAAwB,QAAxB,GAAmCL,MAAM,CAACK,KAA1C,GAAkDJ,QAA/D;;AACA,MAAI,CAACG,IAAL,EAAW;AACT,WAAO,IAAP;AACD;;AACD,SAAQ,qBAAoBA,IAAK,IAAGJ,MAAM,CAACM,IAAK,EAAhD;AACD;;AAEM,SAASC,gBAAT,CACLP,MADK,EAKLQ,QALK,EAMG;AACR,QAAMC,OAAO,GAAGC,cAAUC,OAAV,CAAkBC,UAAlB,CAA6BZ,MAA7B,CAAhB;;AACA,UAAQQ,QAAR;AACE,SAAK,KAAL;AAAY;AACV,cAAMK,WAAW,GAAGH,cAAUC,OAAV,CAAkBG,cAAlB,CAAiCd,MAAjC,CAApB;;AACA,eAAQ,GAAES,OAAQ,IAAGI,WAAY,GAAjC;AACD;;AACD,SAAK,SAAL;AAAgB;AACd,cAAME,WAAW,GAAGC,kBAAcL,OAAd,CAAsBM,cAAtB,CAAqCjB,MAArC,CAApB;;AACA,eAAQ,GAAES,OAAQ,IAAGM,WAAY,GAAjC;AACD;;AACD;AAAS;AACP,cAAM,IAAIG,KAAJ,CACH,IAAGV,QAAS,kEADT,CAAN;AAGD;AAbH;AAeD;AAED;AACA;AACA;AACA;;;AACO,MAAMW,kBAAsD,GAAGnB,MAAM,IAAI;AAAA;;AA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M,IAAIP,KAAJ,CACH,IACC,OAAOG,cAAP,KAA0B,QAA1B,GAAqCK,IAAI,CAACC,SAAL,CAAeN,cAAf,CAArC,GAAsEA,cACvE,sHAHG,CAAN;AAKD","sourcesContent":["import { Android, ExpoConfig, IOS } from '@expo/config-types';\nimport { getRuntimeVersionForSDKVersion } from '@expo/sdk-runtime-versions';\n\nimport { AndroidConfig, IOSConfig } from '..';\n\nexport type ExpoConfigUpdates = Pick<\n ExpoConfig,\n 'sdkVersion' | 'owner' | 'runtimeVersion' | 'updates' | 'slug'\n>;\n\nexport function getUpdateUrl(\n config: Pick<ExpoConfigUpdates, 'owner' | 'slug' | 'updates'>,\n username: string | null\n): string | null {\n if (config.updates?.url) {\n return config.updates?.url;\n }\n\n const user = typeof config.owner === 'string' ? config.owner : username;\n if (!user) {\n return null;\n }\n return `https://exp.host/@${user}/${config.slug}`;\n}\n\nexport function getNativeVersion(\n config: Pick<ExpoConfig, 'version'> & {\n android?: Pick<Android, 'versionCode'>;\n ios?: Pick<IOS, 'buildNumber'>;\n },\n platform: 'android' | 'ios'\n): string {\n const version = IOSConfig.Version.getVersion(config);\n switch (platform) {\n case 'ios': {\n const buildNumber = IOSConfig.Version.getBuildNumber(config);\n return `${version}(${buildNumber})`;\n }\n case 'android': {\n const versionCode = AndroidConfig.Version.getVersionCode(config);\n return `${version}(${versionCode})`;\n }\n default: {\n throw new Error(\n `\"${platform}\" is not a supported platform. Choose either \"ios\" or \"android\".`\n );\n }\n }\n}\n\n/**\n * Compute runtime version policies.\n * @return an expoConfig with only string valued platform specific runtime versions.\n */\nexport const withRuntimeVersion: (config: ExpoConfig) => ExpoConfig = config => {\n if (config.ios?.runtimeVersion || config.runtimeVersion) {\n config.ios = {\n ...config.ios,\n runtimeVersion: getRuntimeVersion(config, 'ios'),\n };\n }\n if (config.android?.runtimeVersion || config.runtimeVersion) {\n config.android = {\n ...config.android,\n runtimeVersion: getRuntimeVersion(config, 'android'),\n };\n }\n delete config.runtimeVersion;\n return config;\n};\n\nexport function getRuntimeVersion(\n config: Pick<ExpoConfig, 'version' | 'runtimeVersion' | 'sdkVersion'> & {\n android?: Pick<Android, 'versionCode' | 'runtimeVersion'>;\n ios?: Pick<IOS, 'buildNumber' | 'runtimeVersion'>;\n },\n platform: 'android' | 'ios'\n): string {\n const runtimeVersion = config[platform]?.runtimeVersion ?? config.runtimeVersion;\n if (!runtimeVersion) {\n throw new Error(\n `There is neither a value or a policy set for the runtime version on \"${platform}\"`\n );\n }\n\n if (typeof runtimeVersion === 'string') {\n return runtimeVersion;\n } else if (runtimeVersion.policy === 'nativeVersion') {\n return getNativeVersion(config, platform);\n } else if (runtimeVersion.policy === 'sdkVersion') {\n if (!config.sdkVersion) {\n throw new Error(\"An SDK version must be defined when using the 'sdkVersion' runtime policy.\");\n }\n return getRuntimeVersionForSDKVersion(config.sdkVersion);\n }\n\n throw new Error(\n `\"${\n typeof runtimeVersion === 'object' ? JSON.stringify(runtimeVersion) : runtimeVersion\n }\" is not a valid runtime version. getRuntimeVersion only supports a string, \"sdkVersion\", or \"nativeVersion\" policy.`\n );\n}\n"],"file":"Updates.js"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export interface CodeBlock {
|
|
2
|
+
start: number;
|
|
3
|
+
end: number;
|
|
4
|
+
code: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Insert contents at given offset
|
|
8
|
+
* @param srcContents source contents
|
|
9
|
+
* @param insertion content to insert
|
|
10
|
+
* @param offset `srcContents` offset to insert `insertion`
|
|
11
|
+
* @returns updated contents
|
|
12
|
+
*/
|
|
13
|
+
export declare function insertContentsAtOffset(srcContents: string, insertion: string, offset: number): string;
|
|
14
|
+
/**
|
|
15
|
+
* Replace contents at given start and end offset
|
|
16
|
+
*
|
|
17
|
+
* @param contents source contents
|
|
18
|
+
* @param replacement new contents to place in [startOffset:endOffset]
|
|
19
|
+
* @param startOffset `contents` start offset for replacement
|
|
20
|
+
* @param endOffset `contents` end offset for replacement
|
|
21
|
+
* @returns updated contents
|
|
22
|
+
*/
|
|
23
|
+
export declare function replaceContentsWithOffset(contents: string, replacement: string, startOffset: number, endOffset: number): string;
|
|
24
|
+
/**
|
|
25
|
+
* String.prototype.search() with offset support
|
|
26
|
+
*
|
|
27
|
+
* @param source source string to search
|
|
28
|
+
* @param regexp RegExp pattern to search
|
|
29
|
+
* @param offset start offset of `source` to search `regexp` pattern
|
|
30
|
+
* @returns The index of the first match between the regular expression and the given string, or -1 if no match was found.
|
|
31
|
+
*/
|
|
32
|
+
export declare function searchFromOffset(source: string, regexp: RegExp, offset: number): number;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.insertContentsAtOffset = insertContentsAtOffset;
|
|
7
|
+
exports.replaceContentsWithOffset = replaceContentsWithOffset;
|
|
8
|
+
exports.searchFromOffset = searchFromOffset;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Insert contents at given offset
|
|
12
|
+
* @param srcContents source contents
|
|
13
|
+
* @param insertion content to insert
|
|
14
|
+
* @param offset `srcContents` offset to insert `insertion`
|
|
15
|
+
* @returns updated contents
|
|
16
|
+
*/
|
|
17
|
+
function insertContentsAtOffset(srcContents, insertion, offset) {
|
|
18
|
+
const srcContentsLength = srcContents.length;
|
|
19
|
+
|
|
20
|
+
if (offset < 0 || offset > srcContentsLength) {
|
|
21
|
+
throw new Error('Invalid parameters.');
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (offset === 0) {
|
|
25
|
+
return `${insertion}${srcContents}`;
|
|
26
|
+
} else if (offset === srcContentsLength) {
|
|
27
|
+
return `${srcContents}${insertion}`;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const prefix = srcContents.substring(0, offset);
|
|
31
|
+
const suffix = srcContents.substring(offset);
|
|
32
|
+
return `${prefix}${insertion}${suffix}`;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Replace contents at given start and end offset
|
|
36
|
+
*
|
|
37
|
+
* @param contents source contents
|
|
38
|
+
* @param replacement new contents to place in [startOffset:endOffset]
|
|
39
|
+
* @param startOffset `contents` start offset for replacement
|
|
40
|
+
* @param endOffset `contents` end offset for replacement
|
|
41
|
+
* @returns updated contents
|
|
42
|
+
*/
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
function replaceContentsWithOffset(contents, replacement, startOffset, endOffset) {
|
|
46
|
+
const contentsLength = contents.length;
|
|
47
|
+
|
|
48
|
+
if (startOffset < 0 || endOffset < 0 || startOffset >= contentsLength || endOffset >= contentsLength || startOffset > endOffset) {
|
|
49
|
+
throw new Error('Invalid parameters.');
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const prefix = contents.substring(0, startOffset);
|
|
53
|
+
const suffix = contents.substring(endOffset + 1);
|
|
54
|
+
return `${prefix}${replacement}${suffix}`;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* String.prototype.search() with offset support
|
|
58
|
+
*
|
|
59
|
+
* @param source source string to search
|
|
60
|
+
* @param regexp RegExp pattern to search
|
|
61
|
+
* @param offset start offset of `source` to search `regexp` pattern
|
|
62
|
+
* @returns The index of the first match between the regular expression and the given string, or -1 if no match was found.
|
|
63
|
+
*/
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
function searchFromOffset(source, regexp, offset) {
|
|
67
|
+
const target = source.substring(offset);
|
|
68
|
+
const matchedIndex = target.search(regexp);
|
|
69
|
+
return matchedIndex < 0 ? matchedIndex : matchedIndex + offset;
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=commonCodeMod.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/commonCodeMod.ts"],"names":["insertContentsAtOffset","srcContents","insertion","offset","srcContentsLength","length","Error","prefix","substring","suffix","replaceContentsWithOffset","contents","replacement","startOffset","endOffset","contentsLength","searchFromOffset","source","regexp","target","matchedIndex","search"],"mappings":";;;;;;;;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,sBAAT,CACLC,WADK,EAELC,SAFK,EAGLC,MAHK,EAIG;AACR,QAAMC,iBAAiB,GAAGH,WAAW,CAACI,MAAtC;;AACA,MAAIF,MAAM,GAAG,CAAT,IAAcA,MAAM,GAAGC,iBAA3B,EAA8C;AAC5C,UAAM,IAAIE,KAAJ,CAAU,qBAAV,CAAN;AACD;;AACD,MAAIH,MAAM,KAAK,CAAf,EAAkB;AAChB,WAAQ,GAAED,SAAU,GAAED,WAAY,EAAlC;AACD,GAFD,MAEO,IAAIE,MAAM,KAAKC,iBAAf,EAAkC;AACvC,WAAQ,GAAEH,WAAY,GAAEC,SAAU,EAAlC;AACD;;AAED,QAAMK,MAAM,GAAGN,WAAW,CAACO,SAAZ,CAAsB,CAAtB,EAAyBL,MAAzB,CAAf;AACA,QAAMM,MAAM,GAAGR,WAAW,CAACO,SAAZ,CAAsBL,MAAtB,CAAf;AACA,SAAQ,GAAEI,MAAO,GAAEL,SAAU,GAAEO,MAAO,EAAtC;AACD;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASC,yBAAT,CACLC,QADK,EAELC,WAFK,EAGLC,WAHK,EAILC,SAJK,EAKG;AACR,QAAMC,cAAc,GAAGJ,QAAQ,CAACN,MAAhC;;AACA,MACEQ,WAAW,GAAG,CAAd,IACAC,SAAS,GAAG,CADZ,IAEAD,WAAW,IAAIE,cAFf,IAGAD,SAAS,IAAIC,cAHb,IAIAF,WAAW,GAAGC,SALhB,EAME;AACA,UAAM,IAAIR,KAAJ,CAAU,qBAAV,CAAN;AACD;;AACD,QAAMC,MAAM,GAAGI,QAAQ,CAACH,SAAT,CAAmB,CAAnB,EAAsBK,WAAtB,CAAf;AACA,QAAMJ,MAAM,GAAGE,QAAQ,CAACH,SAAT,CAAmBM,SAAS,GAAG,CAA/B,CAAf;AACA,SAAQ,GAAEP,MAAO,GAAEK,WAAY,GAAEH,MAAO,EAAxC;AACD;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASO,gBAAT,CAA0BC,MAA1B,EAA0CC,MAA1C,EAA0Df,MAA1D,EAAkF;AACvF,QAAMgB,MAAM,GAAGF,MAAM,CAACT,SAAP,CAAiBL,MAAjB,CAAf;AACA,QAAMiB,YAAY,GAAGD,MAAM,CAACE,MAAP,CAAcH,MAAd,CAArB;AACA,SAAOE,YAAY,GAAG,CAAf,GAAmBA,YAAnB,GAAkCA,YAAY,GAAGjB,MAAxD;AACD","sourcesContent":["export interface CodeBlock {\n start: number;\n end: number;\n code: string;\n}\n\n/**\n * Insert contents at given offset\n * @param srcContents source contents\n * @param insertion content to insert\n * @param offset `srcContents` offset to insert `insertion`\n * @returns updated contents\n */\nexport function insertContentsAtOffset(\n srcContents: string,\n insertion: string,\n offset: number\n): string {\n const srcContentsLength = srcContents.length;\n if (offset < 0 || offset > srcContentsLength) {\n throw new Error('Invalid parameters.');\n }\n if (offset === 0) {\n return `${insertion}${srcContents}`;\n } else if (offset === srcContentsLength) {\n return `${srcContents}${insertion}`;\n }\n\n const prefix = srcContents.substring(0, offset);\n const suffix = srcContents.substring(offset);\n return `${prefix}${insertion}${suffix}`;\n}\n\n/**\n * Replace contents at given start and end offset\n *\n * @param contents source contents\n * @param replacement new contents to place in [startOffset:endOffset]\n * @param startOffset `contents` start offset for replacement\n * @param endOffset `contents` end offset for replacement\n * @returns updated contents\n */\nexport function replaceContentsWithOffset(\n contents: string,\n replacement: string,\n startOffset: number,\n endOffset: number\n): string {\n const contentsLength = contents.length;\n if (\n startOffset < 0 ||\n endOffset < 0 ||\n startOffset >= contentsLength ||\n endOffset >= contentsLength ||\n startOffset > endOffset\n ) {\n throw new Error('Invalid parameters.');\n }\n const prefix = contents.substring(0, startOffset);\n const suffix = contents.substring(endOffset + 1);\n return `${prefix}${replacement}${suffix}`;\n}\n\n/**\n * String.prototype.search() with offset support\n *\n * @param source source string to search\n * @param regexp RegExp pattern to search\n * @param offset start offset of `source` to search `regexp` pattern\n * @returns The index of the first match between the regular expression and the given string, or -1 if no match was found.\n */\nexport function searchFromOffset(source: string, regexp: RegExp, offset: number): number {\n const target = source.substring(offset);\n const matchedIndex = target.search(regexp);\n return matchedIndex < 0 ? matchedIndex : matchedIndex + offset;\n}\n"],"file":"commonCodeMod.js"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
declare const LEFT_BRACKETS: readonly ["(", "{"];
|
|
2
|
+
declare const RIGHT_BRACKETS: readonly [")", "}"];
|
|
3
|
+
declare type LeftBracket = typeof LEFT_BRACKETS[number];
|
|
4
|
+
declare type RightBracket = typeof RIGHT_BRACKETS[number];
|
|
5
|
+
declare type Bracket = LeftBracket | RightBracket;
|
|
6
|
+
export declare function findMatchingBracketPosition(contents: string, bracket: Bracket, offset?: number): number;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.findMatchingBracketPosition = findMatchingBracketPosition;
|
|
7
|
+
const LEFT_BRACKETS = ['(', '{'];
|
|
8
|
+
const RIGHT_BRACKETS = [')', '}'];
|
|
9
|
+
|
|
10
|
+
function findMatchingBracketPosition(contents, bracket, offset = 0) {
|
|
11
|
+
// search first occurrence of `bracket`
|
|
12
|
+
const firstBracketPos = contents.indexOf(bracket, offset);
|
|
13
|
+
|
|
14
|
+
if (firstBracketPos < 0) {
|
|
15
|
+
return -1;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
let stackCounter = 0;
|
|
19
|
+
const matchingBracket = getMatchingBracket(bracket);
|
|
20
|
+
|
|
21
|
+
if (isLeftBracket(bracket)) {
|
|
22
|
+
const contentsLength = contents.length; // search forward
|
|
23
|
+
|
|
24
|
+
for (let i = firstBracketPos + 1; i < contentsLength; ++i) {
|
|
25
|
+
const c = contents[i];
|
|
26
|
+
|
|
27
|
+
if (c === bracket) {
|
|
28
|
+
stackCounter += 1;
|
|
29
|
+
} else if (c === matchingBracket) {
|
|
30
|
+
if (stackCounter === 0) {
|
|
31
|
+
return i;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
stackCounter -= 1;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
} else {
|
|
38
|
+
// search backward
|
|
39
|
+
for (let i = firstBracketPos - 1; i >= 0; --i) {
|
|
40
|
+
const c = contents[i];
|
|
41
|
+
|
|
42
|
+
if (c === bracket) {
|
|
43
|
+
stackCounter += 1;
|
|
44
|
+
} else if (c === matchingBracket) {
|
|
45
|
+
if (stackCounter === 0) {
|
|
46
|
+
return i;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
stackCounter -= 1;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return -1;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function isLeftBracket(bracket) {
|
|
58
|
+
const leftBracketList = LEFT_BRACKETS;
|
|
59
|
+
return leftBracketList.includes(bracket);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function getMatchingBracket(bracket) {
|
|
63
|
+
switch (bracket) {
|
|
64
|
+
case '(':
|
|
65
|
+
return ')';
|
|
66
|
+
|
|
67
|
+
case ')':
|
|
68
|
+
return '(';
|
|
69
|
+
|
|
70
|
+
case '{':
|
|
71
|
+
return '}';
|
|
72
|
+
|
|
73
|
+
case '}':
|
|
74
|
+
return '{';
|
|
75
|
+
|
|
76
|
+
default:
|
|
77
|
+
throw new Error(`Unsupported bracket - ${bracket}`);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=matchBrackets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/matchBrackets.ts"],"names":["LEFT_BRACKETS","RIGHT_BRACKETS","findMatchingBracketPosition","contents","bracket","offset","firstBracketPos","indexOf","stackCounter","matchingBracket","getMatchingBracket","isLeftBracket","contentsLength","length","i","c","leftBracketList","includes","Error"],"mappings":";;;;;;AAAA,MAAMA,aAAa,GAAG,CAAC,GAAD,EAAM,GAAN,CAAtB;AACA,MAAMC,cAAc,GAAG,CAAC,GAAD,EAAM,GAAN,CAAvB;;AAMO,SAASC,2BAAT,CACLC,QADK,EAELC,OAFK,EAGLC,MAAc,GAAG,CAHZ,EAIG;AACR;AACA,QAAMC,eAAe,GAAGH,QAAQ,CAACI,OAAT,CAAiBH,OAAjB,EAA0BC,MAA1B,CAAxB;;AACA,MAAIC,eAAe,GAAG,CAAtB,EAAyB;AACvB,WAAO,CAAC,CAAR;AACD;;AAED,MAAIE,YAAY,GAAG,CAAnB;AACA,QAAMC,eAAe,GAAGC,kBAAkB,CAACN,OAAD,CAA1C;;AAEA,MAAIO,aAAa,CAACP,OAAD,CAAjB,EAA4B;AAC1B,UAAMQ,cAAc,GAAGT,QAAQ,CAACU,MAAhC,CAD0B,CAE1B;;AACA,SAAK,IAAIC,CAAC,GAAGR,eAAe,GAAG,CAA/B,EAAkCQ,CAAC,GAAGF,cAAtC,EAAsD,EAAEE,CAAxD,EAA2D;AACzD,YAAMC,CAAC,GAAGZ,QAAQ,CAACW,CAAD,CAAlB;;AACA,UAAIC,CAAC,KAAKX,OAAV,EAAmB;AACjBI,QAAAA,YAAY,IAAI,CAAhB;AACD,OAFD,MAEO,IAAIO,CAAC,KAAKN,eAAV,EAA2B;AAChC,YAAID,YAAY,KAAK,CAArB,EAAwB;AACtB,iBAAOM,CAAP;AACD;;AACDN,QAAAA,YAAY,IAAI,CAAhB;AACD;AACF;AACF,GAdD,MAcO;AACL;AACA,SAAK,IAAIM,CAAC,GAAGR,eAAe,GAAG,CAA/B,EAAkCQ,CAAC,IAAI,CAAvC,EAA0C,EAAEA,CAA5C,EAA+C;AAC7C,YAAMC,CAAC,GAAGZ,QAAQ,CAACW,CAAD,CAAlB;;AACA,UAAIC,CAAC,KAAKX,OAAV,EAAmB;AACjBI,QAAAA,YAAY,IAAI,CAAhB;AACD,OAFD,MAEO,IAAIO,CAAC,KAAKN,eAAV,EAA2B;AAChC,YAAID,YAAY,KAAK,CAArB,EAAwB;AACtB,iBAAOM,CAAP;AACD;;AACDN,QAAAA,YAAY,IAAI,CAAhB;AACD;AACF;AACF;;AAED,SAAO,CAAC,CAAR;AACD;;AAED,SAASG,aAAT,CAAuBP,OAAvB,EAAkD;AAChD,QAAMY,eAAmC,GAAGhB,aAA5C;AACA,SAAOgB,eAAe,CAACC,QAAhB,CAAyBb,OAAzB,CAAP;AACD;;AAED,SAASM,kBAAT,CAA4BN,OAA5B,EAAuD;AACrD,UAAQA,OAAR;AACE,SAAK,GAAL;AACE,aAAO,GAAP;;AACF,SAAK,GAAL;AACE,aAAO,GAAP;;AACF,SAAK,GAAL;AACE,aAAO,GAAP;;AACF,SAAK,GAAL;AACE,aAAO,GAAP;;AACF;AACE,YAAM,IAAIc,KAAJ,CAAW,yBAAwBd,OAAQ,EAA3C,CAAN;AAVJ;AAYD","sourcesContent":["const LEFT_BRACKETS = ['(', '{'] as const;\nconst RIGHT_BRACKETS = [')', '}'] as const;\n\ntype LeftBracket = typeof LEFT_BRACKETS[number];\ntype RightBracket = typeof RIGHT_BRACKETS[number];\ntype Bracket = LeftBracket | RightBracket;\n\nexport function findMatchingBracketPosition(\n contents: string,\n bracket: Bracket,\n offset: number = 0\n): number {\n // search first occurrence of `bracket`\n const firstBracketPos = contents.indexOf(bracket, offset);\n if (firstBracketPos < 0) {\n return -1;\n }\n\n let stackCounter = 0;\n const matchingBracket = getMatchingBracket(bracket);\n\n if (isLeftBracket(bracket)) {\n const contentsLength = contents.length;\n // search forward\n for (let i = firstBracketPos + 1; i < contentsLength; ++i) {\n const c = contents[i];\n if (c === bracket) {\n stackCounter += 1;\n } else if (c === matchingBracket) {\n if (stackCounter === 0) {\n return i;\n }\n stackCounter -= 1;\n }\n }\n } else {\n // search backward\n for (let i = firstBracketPos - 1; i >= 0; --i) {\n const c = contents[i];\n if (c === bracket) {\n stackCounter += 1;\n } else if (c === matchingBracket) {\n if (stackCounter === 0) {\n return i;\n }\n stackCounter -= 1;\n }\n }\n }\n\n return -1;\n}\n\nfunction isLeftBracket(bracket: Bracket): boolean {\n const leftBracketList: readonly Bracket[] = LEFT_BRACKETS;\n return leftBracketList.includes(bracket);\n}\n\nfunction getMatchingBracket(bracket: Bracket): Bracket {\n switch (bracket) {\n case '(':\n return ')';\n case ')':\n return '(';\n case '{':\n return '}';\n case '}':\n return '{';\n default:\n throw new Error(`Unsupported bracket - ${bracket}`);\n }\n}\n"],"file":"matchBrackets.js"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expo/config-plugins",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.7",
|
|
4
4
|
"description": "A library for Expo config plugins",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"paths"
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@expo/config-types": "^43.0.
|
|
35
|
+
"@expo/config-types": "^43.0.1",
|
|
36
36
|
"@expo/json-file": "8.2.33",
|
|
37
37
|
"@expo/plist": "0.0.15",
|
|
38
38
|
"@react-native/normalize-color": "^2.0.0",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"semver": "^7.3.5",
|
|
47
47
|
"slash": "^3.0.0",
|
|
48
48
|
"xcode": "^3.0.1",
|
|
49
|
-
"xml2js": "
|
|
49
|
+
"xml2js": "0.4.23"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@types/debug": "^4.1.5",
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { ExpoConfig } from '@expo/config-types';
|
|
2
|
-
import { AndroidManifest } from './Manifest';
|
|
3
|
-
export declare const withBranch: import("..").ConfigPlugin<void>;
|
|
4
|
-
export declare function getBranchApiKey(config: ExpoConfig): string | null;
|
|
5
|
-
export declare function setBranchApiKey(config: ExpoConfig, androidManifest: AndroidManifest): AndroidManifest;
|