@expo/config-plugins 4.0.18 → 4.1.2
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 +17 -2
- package/build/android/BuildProperties.d.ts +28 -0
- package/build/android/BuildProperties.js +96 -0
- package/build/android/BuildProperties.js.map +1 -0
- package/build/android/EasBuild.js +8 -8
- package/build/android/EasBuild.js.map +1 -1
- package/build/android/GoogleServices.js +16 -14
- package/build/android/GoogleServices.js.map +1 -1
- package/build/android/Manifest.js +7 -5
- package/build/android/Manifest.js.map +1 -1
- package/build/android/Package.js +27 -15
- package/build/android/Package.js.map +1 -1
- package/build/android/Paths.js +6 -6
- package/build/android/Paths.js.map +1 -1
- package/build/android/Scheme.d.ts +5 -2
- package/build/android/Scheme.js +26 -15
- package/build/android/Scheme.js.map +1 -1
- package/build/android/index.d.ts +2 -2
- package/build/android/index.js +18 -18
- package/build/android/index.js.map +1 -1
- package/build/ios/BuildProperties.d.ts +27 -0
- package/build/ios/BuildProperties.js +83 -0
- package/build/ios/BuildProperties.js.map +1 -0
- package/build/ios/BuildScheme.js +6 -3
- package/build/ios/BuildScheme.js.map +1 -1
- package/build/ios/BundleIdentifier.js +6 -6
- package/build/ios/BundleIdentifier.js.map +1 -1
- package/build/ios/Entitlements.d.ts +5 -1
- package/build/ios/Entitlements.js +63 -52
- package/build/ios/Entitlements.js.map +1 -1
- package/build/ios/Google.d.ts +5 -5
- package/build/ios/Google.js +62 -12
- package/build/ios/Google.js.map +1 -1
- package/build/ios/Locales.js +14 -14
- package/build/ios/Locales.js.map +1 -1
- package/build/ios/Maps.js +7 -7
- package/build/ios/Maps.js.map +1 -1
- package/build/ios/Paths.d.ts +4 -5
- package/build/ios/Paths.js +33 -25
- package/build/ios/Paths.js.map +1 -1
- package/build/ios/ProvisioningProfile.js +4 -4
- package/build/ios/ProvisioningProfile.js.map +1 -1
- package/build/ios/Swift.js +5 -5
- package/build/ios/Swift.js.map +1 -1
- package/build/ios/Target.d.ts +1 -0
- package/build/ios/Target.js +11 -1
- package/build/ios/Target.js.map +1 -1
- package/build/ios/XcodeProjectFile.js +5 -5
- package/build/ios/XcodeProjectFile.js.map +1 -1
- package/build/ios/index.d.ts +2 -2
- package/build/ios/index.js +19 -19
- package/build/ios/index.js.map +1 -1
- package/build/ios/utils/Xcodeproj.d.ts +2 -1
- package/build/ios/utils/Xcodeproj.js +4 -1
- package/build/ios/utils/Xcodeproj.js.map +1 -1
- package/build/plugins/ios-plugins.d.ts +3 -3
- package/build/plugins/ios-plugins.js.map +1 -1
- package/build/plugins/withAndroidBaseMods.js +0 -3
- package/build/plugins/withAndroidBaseMods.js.map +1 -1
- package/build/plugins/withIosBaseMods.js +27 -7
- package/build/plugins/withIosBaseMods.js.map +1 -1
- package/build/utils/BuildProperties.types.d.ts +25 -0
- package/build/utils/BuildProperties.types.js +2 -0
- package/build/utils/BuildProperties.types.js.map +1 -0
- package/build/utils/Updates.d.ts +1 -1
- package/build/utils/Updates.js +15 -7
- package/build/utils/Updates.js.map +1 -1
- package/build/utils/XML.d.ts +1 -0
- package/build/utils/XML.js +33 -11
- package/build/utils/XML.js.map +1 -1
- package/build/utils/fs.d.ts +4 -0
- package/build/utils/fs.js +56 -0
- package/build/utils/fs.js.map +1 -0
- package/build/utils/modules.js +1 -1
- package/build/utils/modules.js.map +1 -1
- package/build/utils/versions.js +2 -2
- package/build/utils/versions.js.map +1 -1
- package/package.json +3 -5
- package/build/android/JsEngine.d.ts +0 -8
- package/build/android/JsEngine.js +0 -59
- package/build/android/JsEngine.js.map +0 -1
- package/build/ios/JsEngine.d.ts +0 -8
- package/build/ios/JsEngine.js +0 -47
- package/build/ios/JsEngine.js.map +0 -1
package/build/android/Paths.js
CHANGED
|
@@ -29,10 +29,10 @@ function _assert() {
|
|
|
29
29
|
return data;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
function
|
|
33
|
-
const data = _interopRequireDefault(require("fs
|
|
32
|
+
function _fs() {
|
|
33
|
+
const data = _interopRequireDefault(require("fs"));
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
_fs = function () {
|
|
36
36
|
return data;
|
|
37
37
|
};
|
|
38
38
|
|
|
@@ -114,7 +114,7 @@ function getLanguage(filePath) {
|
|
|
114
114
|
function getFileInfo(filePath) {
|
|
115
115
|
return {
|
|
116
116
|
path: path().normalize(filePath),
|
|
117
|
-
contents:
|
|
117
|
+
contents: _fs().default.readFileSync(filePath, 'utf8'),
|
|
118
118
|
language: getLanguage(filePath)
|
|
119
119
|
};
|
|
120
120
|
}
|
|
@@ -133,9 +133,9 @@ function getGradleFilePath(projectRoot, gradleName) {
|
|
|
133
133
|
const groovyPath = path().resolve(projectRoot, `${gradleName}.gradle`);
|
|
134
134
|
const ktPath = path().resolve(projectRoot, `${gradleName}.gradle.kts`);
|
|
135
135
|
|
|
136
|
-
const isGroovy =
|
|
136
|
+
const isGroovy = _fs().default.existsSync(groovyPath);
|
|
137
137
|
|
|
138
|
-
const isKotlin = !isGroovy &&
|
|
138
|
+
const isKotlin = !isGroovy && _fs().default.existsSync(ktPath);
|
|
139
139
|
|
|
140
140
|
if (!isGroovy && !isKotlin) {
|
|
141
141
|
throw new Error(`Failed to find '${gradleName}.gradle' file for project: ${projectRoot}.`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/android/Paths.ts"],"names":["getProjectFilePath","projectRoot","name","filePath","path","join","getLanguage","extension","extname","UnexpectedError","getFileInfo","normalize","contents","fs","readFileSync","language","getMainApplicationAsync","getMainActivityAsync","getGradleFilePath","gradleName","groovyPath","resolve","ktPath","isGroovy","
|
|
1
|
+
{"version":3,"sources":["../../src/android/Paths.ts"],"names":["getProjectFilePath","projectRoot","name","filePath","path","join","getLanguage","extension","extname","UnexpectedError","getFileInfo","normalize","contents","fs","readFileSync","language","getMainApplicationAsync","getMainActivityAsync","getGradleFilePath","gradleName","groovyPath","resolve","ktPath","isGroovy","existsSync","isKotlin","Error","getProjectBuildGradleFilePath","getProjectBuildGradleAsync","getSettingsGradleFilePath","getSettingsGradleAsync","getAppBuildGradleFilePath","getAppBuildGradleAsync","getProjectPathOrThrowAsync","projectPath","getAndroidManifestAsync","getResourceFolderAsync","getResourceXMLPathAsync","kind","resourcePath"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;AAYO,SAASA,kBAAT,CAA4BC,WAA5B,EAAiDC,IAAjD,EAAuE;AAC5E,QAAMC,QAAQ,GAAG,kBACfC,IAAI,GAACC,IAAL,CAAUJ,WAAV,EAAwB,gCAA+BC,IAAK,aAA5D,CADe,EAEf,CAFe,CAAjB;AAGA,yBACEC,QADF,EAEG,iBAAgBD,IAAK,iDAAgDD,WAAY,GAFpF;AAKA,SAAOE,QAAP;AACD;;AAED,SAASG,WAAT,CAAqBH,QAArB,EAAiE;AAC/D,QAAMI,SAAS,GAAGH,IAAI,GAACI,OAAL,CAAaL,QAAb,CAAlB;;AACA,UAAQI,SAAR;AACE,SAAK,OAAL;AACE,aAAO,MAAP;;AACF,SAAK,MAAL;AACA,SAAK,KAAL;AACE,aAAO,IAAP;;AACF,SAAK,SAAL;AACA,SAAK,SAAL;AACE,aAAO,QAAP;;AACF;AACE,YAAM,KAAIE,yBAAJ,EAAqB,sCAAqCF,SAAU,EAApE,CAAN;AAVJ;AAYD;;AAEM,SAASG,WAAT,CAAqBP,QAArB,EAAuC;AAC5C,SAAO;AACLC,IAAAA,IAAI,EAAEA,IAAI,GAACO,SAAL,CAAeR,QAAf,CADD;AAELS,IAAAA,QAAQ,EAAEC,cAAGC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AAL,CAAU6B,WAAV,EAAwB,kBAAxB,CAAP;AACD;;AAEM,eAAeG,uBAAf,CACLpC,WADK,EAEL;AAAEqC,EAAAA,IAAI,GAAG,QAAT;AAAmBpC,EAAAA;AAAnB,CAFK,EAGY;AACjB,QAAMqC,YAAY,GAAG,MAAMH,sBAAsB,CAACnC,WAAD,CAAjD;AAEA,QAAME,QAAQ,GAAGC,IAAI,GAACC,IAAL,CAAUkC,YAAV,EAAyB,GAAED,IAAK,IAAGpC,IAAK,MAAxC,CAAjB;AACA,SAAOC,QAAP;AACD","sourcesContent":["import assert from 'assert';\nimport fs from 'fs';\nimport { sync as globSync } from 'glob';\nimport * as path from 'path';\n\nimport { UnexpectedError } from '../utils/errors';\nimport { directoryExistsAsync } from '../utils/modules';\nimport { ResourceKind } from './Resources';\n\nexport interface ProjectFile<L extends string = string> {\n path: string;\n language: L;\n contents: string;\n}\n\nexport type ApplicationProjectFile = ProjectFile<'java' | 'kt'>;\nexport type GradleProjectFile = ProjectFile<'groovy' | 'kt'>;\n\nexport function getProjectFilePath(projectRoot: string, name: string): string {\n const filePath = globSync(\n path.join(projectRoot, `android/app/src/main/java/**/${name}.@(java|kt)`)\n )[0];\n assert(\n filePath,\n `Project file \"${name}\" does not exist in android project for root \"${projectRoot}\"`\n );\n\n return filePath;\n}\n\nfunction getLanguage(filePath: string): 'java' | 'groovy' | 'kt' {\n const extension = path.extname(filePath);\n switch (extension) {\n case '.java':\n return 'java';\n case '.kts':\n case '.kt':\n return 'kt';\n case '.groovy':\n case '.gradle':\n return 'groovy';\n default:\n throw new UnexpectedError(`Unexpected Android file extension: ${extension}`);\n }\n}\n\nexport function getFileInfo(filePath: string) {\n return {\n path: path.normalize(filePath),\n contents: fs.readFileSync(filePath, 'utf8'),\n language: getLanguage(filePath) as any,\n };\n}\n\nexport async function getMainApplicationAsync(\n projectRoot: string\n): Promise<ApplicationProjectFile> {\n const filePath = getProjectFilePath(projectRoot, 'MainApplication');\n return getFileInfo(filePath);\n}\n\nexport async function getMainActivityAsync(projectRoot: string): Promise<ApplicationProjectFile> {\n const filePath = getProjectFilePath(projectRoot, 'MainActivity');\n return getFileInfo(filePath);\n}\n\nexport function getGradleFilePath(projectRoot: string, gradleName: string): string {\n const groovyPath = path.resolve(projectRoot, `${gradleName}.gradle`);\n const ktPath = path.resolve(projectRoot, `${gradleName}.gradle.kts`);\n\n const isGroovy = fs.existsSync(groovyPath);\n const isKotlin = !isGroovy && fs.existsSync(ktPath);\n\n if (!isGroovy && !isKotlin) {\n throw new Error(`Failed to find '${gradleName}.gradle' file for project: ${projectRoot}.`);\n }\n const filePath = isGroovy ? groovyPath : ktPath;\n return filePath;\n}\n\nexport function getProjectBuildGradleFilePath(projectRoot: string): string {\n return getGradleFilePath(path.join(projectRoot, 'android'), 'build');\n}\n\nexport async function getProjectBuildGradleAsync(projectRoot: string): Promise<GradleProjectFile> {\n return getFileInfo(getProjectBuildGradleFilePath(projectRoot));\n}\n\nexport function getSettingsGradleFilePath(projectRoot: string): string {\n return getGradleFilePath(path.join(projectRoot, 'android'), 'settings');\n}\n\nexport async function getSettingsGradleAsync(projectRoot: string): Promise<GradleProjectFile> {\n return getFileInfo(getSettingsGradleFilePath(projectRoot));\n}\n\nexport function getAppBuildGradleFilePath(projectRoot: string): string {\n return getGradleFilePath(path.join(projectRoot, 'android', 'app'), 'build');\n}\n\nexport async function getAppBuildGradleAsync(projectRoot: string): Promise<GradleProjectFile> {\n return getFileInfo(getAppBuildGradleFilePath(projectRoot));\n}\n\nexport async function getProjectPathOrThrowAsync(projectRoot: string): Promise<string> {\n const projectPath = path.join(projectRoot, 'android');\n if (await directoryExistsAsync(projectPath)) {\n return projectPath;\n }\n throw new Error(`Android project folder is missing in project: ${projectRoot}`);\n}\n\nexport async function getAndroidManifestAsync(projectRoot: string): Promise<string> {\n const projectPath = await getProjectPathOrThrowAsync(projectRoot);\n const filePath = path.join(projectPath, 'app/src/main/AndroidManifest.xml');\n return filePath;\n}\n\nexport async function getResourceFolderAsync(projectRoot: string): Promise<string> {\n const projectPath = await getProjectPathOrThrowAsync(projectRoot);\n return path.join(projectPath, `app/src/main/res`);\n}\n\nexport async function getResourceXMLPathAsync(\n projectRoot: string,\n { kind = 'values', name }: { kind?: ResourceKind; name: 'colors' | 'strings' | 'styles' | string }\n): Promise<string> {\n const resourcePath = await getResourceFolderAsync(projectRoot);\n\n const filePath = path.join(resourcePath, `${kind}/${name}.xml`);\n return filePath;\n}\n"],"file":"Paths.js"}
|
|
@@ -3,14 +3,17 @@ import { AndroidManifest } from './Manifest';
|
|
|
3
3
|
export declare type IntentFilterProps = {
|
|
4
4
|
actions: string[];
|
|
5
5
|
categories: string[];
|
|
6
|
-
|
|
6
|
+
data: {
|
|
7
|
+
scheme: string;
|
|
8
|
+
host?: string;
|
|
9
|
+
}[];
|
|
7
10
|
};
|
|
8
11
|
export declare const withScheme: import("..").ConfigPlugin<void>;
|
|
9
12
|
export declare function getScheme(config: {
|
|
10
13
|
scheme?: string | string[];
|
|
11
14
|
}): string[];
|
|
12
15
|
export declare function setScheme(config: Pick<ExpoConfig, 'scheme' | 'android'>, androidManifest: AndroidManifest): AndroidManifest;
|
|
13
|
-
export declare function getSchemesFromManifest(androidManifest: AndroidManifest): string[];
|
|
16
|
+
export declare function getSchemesFromManifest(androidManifest: AndroidManifest, requestedHost?: string | null): string[];
|
|
14
17
|
export declare function ensureManifestHasValidIntentFilter(androidManifest: AndroidManifest): boolean;
|
|
15
18
|
export declare function hasScheme(scheme: string, androidManifest: AndroidManifest): boolean;
|
|
16
19
|
export declare function appendScheme(scheme: string, androidManifest: AndroidManifest): AndroidManifest;
|
package/build/android/Scheme.js
CHANGED
|
@@ -87,14 +87,13 @@ function setScheme(config, androidManifest) {
|
|
|
87
87
|
|
|
88
88
|
function isValidRedirectIntentFilter({
|
|
89
89
|
actions,
|
|
90
|
-
categories
|
|
91
|
-
schemes
|
|
90
|
+
categories
|
|
92
91
|
}) {
|
|
93
92
|
return actions.includes('android.intent.action.VIEW') && !categories.includes('android.intent.category.LAUNCHER');
|
|
94
93
|
}
|
|
95
94
|
|
|
96
95
|
function propertiesFromIntentFilter(intentFilter) {
|
|
97
|
-
var _intentFilter$action$, _intentFilter$action, _intentFilter$categor, _intentFilter$categor2, _intentFilter$data$
|
|
96
|
+
var _intentFilter$action$, _intentFilter$action, _intentFilter$categor, _intentFilter$categor2, _intentFilter$data$fi, _intentFilter$data, _intentFilter$data$fi2;
|
|
98
97
|
|
|
99
98
|
const actions = (_intentFilter$action$ = intentFilter === null || intentFilter === void 0 ? void 0 : (_intentFilter$action = intentFilter.action) === null || _intentFilter$action === void 0 ? void 0 : _intentFilter$action.map(data => {
|
|
100
99
|
var _data$$;
|
|
@@ -106,15 +105,22 @@ function propertiesFromIntentFilter(intentFilter) {
|
|
|
106
105
|
|
|
107
106
|
return data === null || data === void 0 ? void 0 : (_data$$2 = data.$) === null || _data$$2 === void 0 ? void 0 : _data$$2['android:name'];
|
|
108
107
|
})) !== null && _intentFilter$categor !== void 0 ? _intentFilter$categor : [];
|
|
109
|
-
const
|
|
108
|
+
const data = (_intentFilter$data$fi = intentFilter === null || intentFilter === void 0 ? void 0 : (_intentFilter$data = intentFilter.data) === null || _intentFilter$data === void 0 ? void 0 : (_intentFilter$data$fi2 = _intentFilter$data.filter(data => {
|
|
110
109
|
var _data$$3;
|
|
111
110
|
|
|
112
111
|
return data === null || data === void 0 ? void 0 : (_data$$3 = data.$) === null || _data$$3 === void 0 ? void 0 : _data$$3['android:scheme'];
|
|
113
|
-
}))
|
|
112
|
+
})) === null || _intentFilter$data$fi2 === void 0 ? void 0 : _intentFilter$data$fi2.map(data => {
|
|
113
|
+
var _data$$4, _data$$5;
|
|
114
|
+
|
|
115
|
+
return {
|
|
116
|
+
scheme: data === null || data === void 0 ? void 0 : (_data$$4 = data.$) === null || _data$$4 === void 0 ? void 0 : _data$$4['android:scheme'],
|
|
117
|
+
host: data === null || data === void 0 ? void 0 : (_data$$5 = data.$) === null || _data$$5 === void 0 ? void 0 : _data$$5['android:host']
|
|
118
|
+
};
|
|
119
|
+
})) !== null && _intentFilter$data$fi !== void 0 ? _intentFilter$data$fi : [];
|
|
114
120
|
return {
|
|
115
|
-
schemes,
|
|
116
121
|
actions,
|
|
117
|
-
categories
|
|
122
|
+
categories,
|
|
123
|
+
data
|
|
118
124
|
};
|
|
119
125
|
}
|
|
120
126
|
|
|
@@ -143,21 +149,26 @@ function getSingleTaskIntentFilters(androidManifest) {
|
|
|
143
149
|
return outputSchemes;
|
|
144
150
|
}
|
|
145
151
|
|
|
146
|
-
function getSchemesFromManifest(androidManifest) {
|
|
152
|
+
function getSchemesFromManifest(androidManifest, requestedHost = null) {
|
|
147
153
|
const outputSchemes = [];
|
|
148
154
|
const singleTaskIntentFilters = getSingleTaskIntentFilters(androidManifest);
|
|
149
155
|
|
|
150
156
|
for (const intentFilter of singleTaskIntentFilters) {
|
|
151
157
|
const properties = propertiesFromIntentFilter(intentFilter);
|
|
152
158
|
|
|
153
|
-
if (isValidRedirectIntentFilter(properties)) {
|
|
154
|
-
|
|
159
|
+
if (isValidRedirectIntentFilter(properties) && properties.data) {
|
|
160
|
+
for (const {
|
|
161
|
+
scheme,
|
|
162
|
+
host
|
|
163
|
+
} of properties.data) {
|
|
164
|
+
if (requestedHost === null || !host || host === requestedHost) {
|
|
165
|
+
outputSchemes.push(scheme);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
155
168
|
}
|
|
156
169
|
}
|
|
157
170
|
|
|
158
|
-
return outputSchemes
|
|
159
|
-
schemes
|
|
160
|
-
}) => [...prev, ...schemes], []);
|
|
171
|
+
return outputSchemes;
|
|
161
172
|
}
|
|
162
173
|
|
|
163
174
|
function ensureManifestHasValidIntentFilter(androidManifest) {
|
|
@@ -259,11 +270,11 @@ function removeScheme(scheme, androidManifest) {
|
|
|
259
270
|
|
|
260
271
|
if (isValidRedirectIntentFilter(properties)) {
|
|
261
272
|
for (const dataKey in (intentFilter === null || intentFilter === void 0 ? void 0 : intentFilter.data) || []) {
|
|
262
|
-
var _intentFilter$data2, _data$$
|
|
273
|
+
var _intentFilter$data2, _data$$6;
|
|
263
274
|
|
|
264
275
|
const data = (_intentFilter$data2 = intentFilter.data) === null || _intentFilter$data2 === void 0 ? void 0 : _intentFilter$data2[dataKey];
|
|
265
276
|
|
|
266
|
-
if ((data === null || data === void 0 ? void 0 : (_data$$
|
|
277
|
+
if ((data === null || data === void 0 ? void 0 : (_data$$6 = data.$) === null || _data$$6 === void 0 ? void 0 : _data$$6['android:scheme']) === scheme) {
|
|
267
278
|
var _intentFilter$data3;
|
|
268
279
|
|
|
269
280
|
(_intentFilter$data3 = intentFilter.data) === null || _intentFilter$data3 === void 0 ? true : delete _intentFilter$data3[dataKey];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/android/Scheme.ts"],"names":["withScheme","setScheme","getScheme","config","Array","isArray","scheme","validate","value","filter","androidManifest","schemes","android","package","push","length","ensureManifestHasValidIntentFilter","currentSchemes","getSchemesFromManifest","uri","index","indexOf","splice","appendScheme","isValidRedirectIntentFilter","actions","categories","includes","propertiesFromIntentFilter","intentFilter","action","map","data","$","category","getSingleTaskIntentFilters","manifest","application","outputSchemes","activity","activities","singleTaskActivities","intentFilters","concat","singleTaskIntentFilters","properties","reduce","prev","hasScheme","removeScheme","dataKey"],"mappings":";;;;;;;;;;;;;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AASO,MAAMA,UAAU,GAAG,mDAA4BC,SAA5B,EAAuC,YAAvC,CAAnB;;;AAEA,SAASC,SAAT,CAAmBC,MAAnB,EAAqE;AAC1E,MAAIC,KAAK,CAACC,OAAN,CAAcF,MAAM,CAACG,MAArB,CAAJ,EAAkC;AAChC,UAAMC,QAAQ,GAAIC,KAAD,IAAiC,OAAOA,KAAP,KAAiB,QAAnE;;AAEA,WAAOL,MAAM,CAACG,MAAP,CAAcG,MAAd,C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AA;;AACjD,UAAI,CAAAA,QAAQ,SAAR,IAAAA,QAAQ,WAAR,4BAAAA,QAAQ,CAAEN,CAAV,8DAAc,oBAAd,OAAwC,YAA5C,EAA0D;AACxD,aAAK,MAAMJ,YAAX,IAA2BU,QAAQ,CAAC,eAAD,CAAR,IAA6B,EAAxD,EAA4D;AAC1D;AACA,gBAAMM,UAAU,GAAGjB,0BAA0B,CAACC,YAAD,CAA7C;;AACA,cAAIL,2BAA2B,CAACqB,UAAD,CAA/B,EAA6C;AAC3C,iBAAK,MAAMK,OAAX,IAAsB,CAAArB,YAAY,SAAZ,IAAAA,YAAY,WAAZ,YAAAA,YAAY,CAAEG,IAAd,KAAsB,EAA5C,EAAgD;AAAA;;AAC9C,oBAAMA,IAAI,0BAAGH,YAAY,CAACG,IAAhB,wDAAG,oBAAoBkB,OAApB,CAAb;;AACA,kBAAI,CAAAlB,IAAI,SAAJ,IAAAA,IAAI,WAAJ,wBAAAA,IAAI,CAAEC,CAAN,sDAAU,gBAAV,OAAgC3B,MAApC,EAA4C;AAAA;;AAC1C,uCAAOuB,YAAY,CAACG,IAApB,6DAAO,oBAAoBkB,OAApB,CAAP;AACD;AACF;AACF;AACF;;AACD;AACD;AACF;AACF;;AAED,SAAOxC,eAAP;AACD","sourcesContent":["import { ExpoConfig } from '@expo/config-types';\n\nimport { createAndroidManifestPlugin } from '../plugins/android-plugins';\nimport { addWarningAndroid } from '../utils/warnings';\nimport { AndroidManifest, ManifestActivity } from './Manifest';\n\nexport type IntentFilterProps = {\n actions: string[];\n categories: string[];\n schemes: string[];\n};\n\nexport const withScheme = createAndroidManifestPlugin(setScheme, 'withScheme');\n\nexport function getScheme(config: { scheme?: string | string[] }): string[] {\n if (Array.isArray(config.scheme)) {\n const validate = (value: any): value is string => typeof value === 'string';\n\n return config.scheme.filter<string>(validate);\n } else if (typeof config.scheme === 'string') {\n return [config.scheme];\n }\n return [];\n}\n\n// This plugin used to remove the unused schemes but this is unpredictable because other plugins could add schemes.\n// The only way to reliably remove schemes from the project is to nuke the file and regenerate the code (`expo prebuild --clean`).\n// Regardless, having extra schemes isn't a fatal issue and therefore a tolerable compromise is to just add new schemes that aren't currently present.\nexport function setScheme(\n config: Pick<ExpoConfig, 'scheme' | 'android'>,\n androidManifest: AndroidManifest\n) {\n const schemes = [\n ...getScheme(config),\n // @ts-ignore: TODO: android.scheme is an unreleased -- harder to add to turtle v1.\n ...getScheme(config.android ?? {}),\n ];\n // Add the package name to the list of schemes for easier Google auth and parity with Turtle v1.\n if (config.android?.package) {\n schemes.push(config.android.package);\n }\n if (schemes.length === 0) {\n return androidManifest;\n }\n\n if (!ensureManifestHasValidIntentFilter(androidManifest)) {\n addWarningAndroid(\n 'scheme',\n `Cannot add schemes because the provided manifest does not have a valid Activity with \\`android:launchMode=\"singleTask\"\\``,\n 'https://expo.fyi/setup-android-uri-scheme'\n );\n return androidManifest;\n }\n\n // Get the current schemes and remove them from the list of schemes to add.\n const currentSchemes = getSchemesFromManifest(androidManifest);\n for (const uri of currentSchemes) {\n const index = schemes.indexOf(uri);\n if (index > -1) schemes.splice(index, 1);\n }\n\n // Now add all of the remaining schemes.\n for (const uri of schemes) {\n androidManifest = appendScheme(uri, androidManifest);\n }\n\n return androidManifest;\n}\n\nfunction isValidRedirectIntentFilter({ actions, categories, schemes }: IntentFilterProps): boolean {\n return (\n actions.includes('android.intent.action.VIEW') &&\n !categories.includes('android.intent.category.LAUNCHER')\n );\n}\n\nfunction propertiesFromIntentFilter(intentFilter: any): IntentFilterProps {\n const actions = intentFilter?.action?.map((data: any) => data?.$?.['android:name']) ?? [];\n const categories = intentFilter?.category?.map((data: any) => data?.$?.['android:name']) ?? [];\n const schemes = intentFilter?.data?.map((data: any) => data?.$?.['android:scheme']) ?? [];\n return {\n schemes,\n actions,\n categories,\n };\n}\n\nfunction getSingleTaskIntentFilters(androidManifest: AndroidManifest): any[] {\n if (!Array.isArray(androidManifest.manifest.application)) return [];\n\n let outputSchemes: any[] = [];\n for (const application of androidManifest.manifest.application) {\n const { activity } = application;\n // @ts-ignore\n const activities = Array.isArray(activity) ? activity : [activity];\n const singleTaskActivities = (activities as ManifestActivity[]).filter(\n activity => activity?.$?.['android:launchMode'] === 'singleTask'\n );\n for (const activity of singleTaskActivities) {\n const intentFilters = activity['intent-filter'];\n outputSchemes = outputSchemes.concat(intentFilters);\n }\n }\n return outputSchemes;\n}\n\nexport function getSchemesFromManifest(androidManifest: AndroidManifest): string[] {\n const outputSchemes: IntentFilterProps[] = [];\n\n const singleTaskIntentFilters = getSingleTaskIntentFilters(androidManifest);\n for (const intentFilter of singleTaskIntentFilters) {\n const properties = propertiesFromIntentFilter(intentFilter);\n if (isValidRedirectIntentFilter(properties)) {\n outputSchemes.push(properties);\n }\n }\n\n return outputSchemes.reduce<string[]>((prev, { schemes }) => [...prev, ...schemes], []);\n}\n\nexport function ensureManifestHasValidIntentFilter(androidManifest: AndroidManifest): boolean {\n if (!Array.isArray(androidManifest.manifest.application)) {\n return false;\n }\n\n for (const application of androidManifest.manifest.application) {\n for (const activity of application.activity || []) {\n if (activity?.$?.['android:launchMode'] === 'singleTask') {\n for (const intentFilter of activity['intent-filter'] || []) {\n // Parse valid intent filters...\n const properties = propertiesFromIntentFilter(intentFilter);\n if (isValidRedirectIntentFilter(properties)) {\n return true;\n }\n }\n if (!activity['intent-filter']) {\n activity['intent-filter'] = [];\n }\n\n activity['intent-filter'].push({\n action: [{ $: { 'android:name': 'android.intent.action.VIEW' } }],\n category: [\n { $: { 'android:name': 'android.intent.category.DEFAULT' } },\n { $: { 'android:name': 'android.intent.category.BROWSABLE' } },\n ],\n });\n return true;\n }\n }\n }\n return false;\n}\n\nexport function hasScheme(scheme: string, androidManifest: AndroidManifest): boolean {\n const schemes = getSchemesFromManifest(androidManifest);\n return schemes.includes(scheme);\n}\n\nexport function appendScheme(scheme: string, androidManifest: AndroidManifest): AndroidManifest {\n if (!Array.isArray(androidManifest.manifest.application)) {\n return androidManifest;\n }\n\n for (const application of androidManifest.manifest.application) {\n for (const activity of application.activity || []) {\n if (activity?.$?.['android:launchMode'] === 'singleTask') {\n for (const intentFilter of activity['intent-filter'] || []) {\n const properties = propertiesFromIntentFilter(intentFilter);\n if (isValidRedirectIntentFilter(properties)) {\n if (!intentFilter.data) intentFilter.data = [];\n intentFilter.data.push({\n $: { 'android:scheme': scheme },\n });\n }\n }\n break;\n }\n }\n }\n return androidManifest;\n}\n\nexport function removeScheme(scheme: string, androidManifest: AndroidManifest): AndroidManifest {\n if (!Array.isArray(androidManifest.manifest.application)) {\n return androidManifest;\n }\n\n for (const application of androidManifest.manifest.application) {\n for (const activity of application.activity || []) {\n if (activity?.$?.['android:launchMode'] === 'singleTask') {\n for (const intentFilter of activity['intent-filter'] || []) {\n // Parse valid intent filters...\n const properties = propertiesFromIntentFilter(intentFilter);\n if (isValidRedirectIntentFilter(properties)) {\n for (const dataKey in intentFilter?.data || []) {\n const data = intentFilter.data?.[dataKey];\n if (data?.$?.['android:scheme'] === scheme) {\n delete intentFilter.data?.[dataKey];\n }\n }\n }\n }\n break;\n }\n }\n }\n\n return androidManifest;\n}\n"],"file":"Scheme.js"}
|
|
1
|
+
{"version":3,"sources":["../../src/android/Scheme.ts"],"names":["withScheme","setScheme","getScheme","config","Array","isArray","scheme","validate","value","filter","androidManifest","schemes","android","package","push","length","ensureManifestHasValidIntentFilter","currentSchemes","getSchemesFromManifest","uri","index","indexOf","splice","appendScheme","isValidRedirectIntentFilter","actions","categories","includes","propertiesFromIntentFilter","intentFilter","action","map","data","$","category","host","getSingleTaskIntentFilters","manifest","application","outputSchemes","activity","activities","singleTaskActivities","intentFilters","concat","requestedHost","singleTaskIntentFilters","properties","hasScheme","removeScheme","dataKey"],"mappings":";;;;;;;;;;;;;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAYO,MAAMA,UAAU,GAAG,mDAA4BC,SAA5B,EAAuC,YAAvC,CAAnB;;;AA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AAC1C,uCAAOuB,YAAY,CAACG,IAApB,6DAAO,oBAAoBkB,OAApB,CAAP;AACD;AACF;AACF;AACF;;AACD;AACD;AACF;AACF;;AAED,SAAOxC,eAAP;AACD","sourcesContent":["import { ExpoConfig } from '@expo/config-types';\n\nimport { createAndroidManifestPlugin } from '../plugins/android-plugins';\nimport { addWarningAndroid } from '../utils/warnings';\nimport { AndroidManifest, ManifestActivity } from './Manifest';\n\nexport type IntentFilterProps = {\n actions: string[];\n categories: string[];\n data: {\n scheme: string;\n host?: string;\n }[];\n};\n\nexport const withScheme = createAndroidManifestPlugin(setScheme, 'withScheme');\n\nexport function getScheme(config: { scheme?: string | string[] }): string[] {\n if (Array.isArray(config.scheme)) {\n const validate = (value: any): value is string => typeof value === 'string';\n\n return config.scheme.filter<string>(validate);\n } else if (typeof config.scheme === 'string') {\n return [config.scheme];\n }\n return [];\n}\n\n// This plugin used to remove the unused schemes but this is unpredictable because other plugins could add schemes.\n// The only way to reliably remove schemes from the project is to nuke the file and regenerate the code (`expo prebuild --clean`).\n// Regardless, having extra schemes isn't a fatal issue and therefore a tolerable compromise is to just add new schemes that aren't currently present.\nexport function setScheme(\n config: Pick<ExpoConfig, 'scheme' | 'android'>,\n androidManifest: AndroidManifest\n) {\n const schemes = [\n ...getScheme(config),\n // @ts-ignore: TODO: android.scheme is an unreleased -- harder to add to turtle v1.\n ...getScheme(config.android ?? {}),\n ];\n // Add the package name to the list of schemes for easier Google auth and parity with Turtle v1.\n if (config.android?.package) {\n schemes.push(config.android.package);\n }\n if (schemes.length === 0) {\n return androidManifest;\n }\n\n if (!ensureManifestHasValidIntentFilter(androidManifest)) {\n addWarningAndroid(\n 'scheme',\n `Cannot add schemes because the provided manifest does not have a valid Activity with \\`android:launchMode=\"singleTask\"\\``,\n 'https://expo.fyi/setup-android-uri-scheme'\n );\n return androidManifest;\n }\n\n // Get the current schemes and remove them from the list of schemes to add.\n const currentSchemes = getSchemesFromManifest(androidManifest);\n for (const uri of currentSchemes) {\n const index = schemes.indexOf(uri);\n if (index > -1) schemes.splice(index, 1);\n }\n\n // Now add all of the remaining schemes.\n for (const uri of schemes) {\n androidManifest = appendScheme(uri, androidManifest);\n }\n\n return androidManifest;\n}\n\nfunction isValidRedirectIntentFilter({ actions, categories }: IntentFilterProps): boolean {\n return (\n actions.includes('android.intent.action.VIEW') &&\n !categories.includes('android.intent.category.LAUNCHER')\n );\n}\n\nfunction propertiesFromIntentFilter(intentFilter: any): IntentFilterProps {\n const actions = intentFilter?.action?.map((data: any) => data?.$?.['android:name']) ?? [];\n const categories = intentFilter?.category?.map((data: any) => data?.$?.['android:name']) ?? [];\n const data =\n intentFilter?.data\n ?.filter((data: any) => data?.$?.['android:scheme'])\n ?.map((data: any) => ({\n scheme: data?.$?.['android:scheme'],\n host: data?.$?.['android:host'],\n })) ?? [];\n return {\n actions,\n categories,\n data,\n };\n}\n\nfunction getSingleTaskIntentFilters(androidManifest: AndroidManifest): any[] {\n if (!Array.isArray(androidManifest.manifest.application)) return [];\n\n let outputSchemes: any[] = [];\n for (const application of androidManifest.manifest.application) {\n const { activity } = application;\n // @ts-ignore\n const activities = Array.isArray(activity) ? activity : [activity];\n const singleTaskActivities = (activities as ManifestActivity[]).filter(\n activity => activity?.$?.['android:launchMode'] === 'singleTask'\n );\n for (const activity of singleTaskActivities) {\n const intentFilters = activity['intent-filter'];\n outputSchemes = outputSchemes.concat(intentFilters);\n }\n }\n return outputSchemes;\n}\n\nexport function getSchemesFromManifest(\n androidManifest: AndroidManifest,\n requestedHost: string | null = null\n): string[] {\n const outputSchemes: string[] = [];\n\n const singleTaskIntentFilters = getSingleTaskIntentFilters(androidManifest);\n for (const intentFilter of singleTaskIntentFilters) {\n const properties = propertiesFromIntentFilter(intentFilter);\n if (isValidRedirectIntentFilter(properties) && properties.data) {\n for (const { scheme, host } of properties.data) {\n if (requestedHost === null || !host || host === requestedHost) {\n outputSchemes.push(scheme);\n }\n }\n }\n }\n\n return outputSchemes;\n}\n\nexport function ensureManifestHasValidIntentFilter(androidManifest: AndroidManifest): boolean {\n if (!Array.isArray(androidManifest.manifest.application)) {\n return false;\n }\n\n for (const application of androidManifest.manifest.application) {\n for (const activity of application.activity || []) {\n if (activity?.$?.['android:launchMode'] === 'singleTask') {\n for (const intentFilter of activity['intent-filter'] || []) {\n // Parse valid intent filters...\n const properties = propertiesFromIntentFilter(intentFilter);\n if (isValidRedirectIntentFilter(properties)) {\n return true;\n }\n }\n if (!activity['intent-filter']) {\n activity['intent-filter'] = [];\n }\n\n activity['intent-filter'].push({\n action: [{ $: { 'android:name': 'android.intent.action.VIEW' } }],\n category: [\n { $: { 'android:name': 'android.intent.category.DEFAULT' } },\n { $: { 'android:name': 'android.intent.category.BROWSABLE' } },\n ],\n });\n return true;\n }\n }\n }\n return false;\n}\n\nexport function hasScheme(scheme: string, androidManifest: AndroidManifest): boolean {\n const schemes = getSchemesFromManifest(androidManifest);\n return schemes.includes(scheme);\n}\n\nexport function appendScheme(scheme: string, androidManifest: AndroidManifest): AndroidManifest {\n if (!Array.isArray(androidManifest.manifest.application)) {\n return androidManifest;\n }\n\n for (const application of androidManifest.manifest.application) {\n for (const activity of application.activity || []) {\n if (activity?.$?.['android:launchMode'] === 'singleTask') {\n for (const intentFilter of activity['intent-filter'] || []) {\n const properties = propertiesFromIntentFilter(intentFilter);\n if (isValidRedirectIntentFilter(properties)) {\n if (!intentFilter.data) intentFilter.data = [];\n intentFilter.data.push({\n $: { 'android:scheme': scheme },\n });\n }\n }\n break;\n }\n }\n }\n return androidManifest;\n}\n\nexport function removeScheme(scheme: string, androidManifest: AndroidManifest): AndroidManifest {\n if (!Array.isArray(androidManifest.manifest.application)) {\n return androidManifest;\n }\n\n for (const application of androidManifest.manifest.application) {\n for (const activity of application.activity || []) {\n if (activity?.$?.['android:launchMode'] === 'singleTask') {\n for (const intentFilter of activity['intent-filter'] || []) {\n // Parse valid intent filters...\n const properties = propertiesFromIntentFilter(intentFilter);\n if (isValidRedirectIntentFilter(properties)) {\n for (const dataKey in intentFilter?.data || []) {\n const data = intentFilter.data?.[dataKey];\n if (data?.$?.['android:scheme'] === scheme) {\n delete intentFilter.data?.[dataKey];\n }\n }\n }\n }\n break;\n }\n }\n }\n\n return androidManifest;\n}\n"],"file":"Scheme.js"}
|
package/build/android/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as AllowBackup from './AllowBackup';
|
|
2
|
+
import * as BuildProperties from './BuildProperties';
|
|
2
3
|
import * as Colors from './Colors';
|
|
3
4
|
import * as EasBuild from './EasBuild';
|
|
4
5
|
import * as GoogleMapsApiKey from './GoogleMapsApiKey';
|
|
5
6
|
import * as GoogleServices from './GoogleServices';
|
|
6
7
|
import * as IntentFilters from './IntentFilters';
|
|
7
|
-
import * as JsEngine from './JsEngine';
|
|
8
8
|
import * as Manifest from './Manifest';
|
|
9
9
|
import * as Name from './Name';
|
|
10
10
|
import * as Orientation from './Orientation';
|
|
@@ -22,4 +22,4 @@ import * as Updates from './Updates';
|
|
|
22
22
|
import * as Version from './Version';
|
|
23
23
|
import * as WindowSoftInputMode from './WindowSoftInputMode';
|
|
24
24
|
export { Manifest, Colors, Paths, Permissions, Properties, Resources, Scheme, Strings, Styles };
|
|
25
|
-
export { AllowBackup, EasBuild, GoogleMapsApiKey, GoogleServices, IntentFilters, Name, Orientation, Package, PrimaryColor, StatusBar, Updates, Version,
|
|
25
|
+
export { AllowBackup, BuildProperties, EasBuild, GoogleMapsApiKey, GoogleServices, IntentFilters, Name, Orientation, Package, PrimaryColor, StatusBar, Updates, Version, WindowSoftInputMode, };
|
package/build/android/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.WindowSoftInputMode = exports.Version = exports.Updates = exports.Styles = exports.Strings = exports.StatusBar = exports.Scheme = exports.Resources = exports.Properties = exports.PrimaryColor = exports.Permissions = exports.Paths = exports.Package = exports.Orientation = exports.Name = exports.Manifest = exports.
|
|
6
|
+
exports.WindowSoftInputMode = exports.Version = exports.Updates = exports.Styles = exports.Strings = exports.StatusBar = exports.Scheme = exports.Resources = exports.Properties = exports.PrimaryColor = exports.Permissions = exports.Paths = exports.Package = exports.Orientation = exports.Name = exports.Manifest = exports.IntentFilters = exports.GoogleServices = exports.GoogleMapsApiKey = exports.EasBuild = exports.Colors = exports.BuildProperties = exports.AllowBackup = void 0;
|
|
7
7
|
|
|
8
8
|
function AllowBackup() {
|
|
9
9
|
const data = _interopRequireWildcard(require("./AllowBackup"));
|
|
@@ -22,6 +22,23 @@ Object.defineProperty(exports, "AllowBackup", {
|
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
24
|
|
|
25
|
+
function BuildProperties() {
|
|
26
|
+
const data = _interopRequireWildcard(require("./BuildProperties"));
|
|
27
|
+
|
|
28
|
+
BuildProperties = function () {
|
|
29
|
+
return data;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
return data;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
Object.defineProperty(exports, "BuildProperties", {
|
|
36
|
+
enumerable: true,
|
|
37
|
+
get: function () {
|
|
38
|
+
return BuildProperties();
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
|
|
25
42
|
function Colors() {
|
|
26
43
|
const data = _interopRequireWildcard(require("./Colors"));
|
|
27
44
|
|
|
@@ -107,23 +124,6 @@ Object.defineProperty(exports, "IntentFilters", {
|
|
|
107
124
|
}
|
|
108
125
|
});
|
|
109
126
|
|
|
110
|
-
function JsEngine() {
|
|
111
|
-
const data = _interopRequireWildcard(require("./JsEngine"));
|
|
112
|
-
|
|
113
|
-
JsEngine = function () {
|
|
114
|
-
return data;
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
return data;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
Object.defineProperty(exports, "JsEngine", {
|
|
121
|
-
enumerable: true,
|
|
122
|
-
get: function () {
|
|
123
|
-
return JsEngine();
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
|
|
127
127
|
function Manifest() {
|
|
128
128
|
const data = _interopRequireWildcard(require("./Manifest"));
|
|
129
129
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/android/index.ts"],"names":[],"mappings":";;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA","sourcesContent":["import * as AllowBackup from './AllowBackup';\nimport * as
|
|
1
|
+
{"version":3,"sources":["../../src/android/index.ts"],"names":[],"mappings":";;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA","sourcesContent":["import * as AllowBackup from './AllowBackup';\nimport * as BuildProperties from './BuildProperties';\nimport * as Colors from './Colors';\nimport * as EasBuild from './EasBuild';\nimport * as GoogleMapsApiKey from './GoogleMapsApiKey';\nimport * as GoogleServices from './GoogleServices';\nimport * as IntentFilters from './IntentFilters';\nimport * as Manifest from './Manifest';\nimport * as Name from './Name';\nimport * as Orientation from './Orientation';\nimport * as Package from './Package';\nimport * as Paths from './Paths';\nimport * as Permissions from './Permissions';\nimport * as PrimaryColor from './PrimaryColor';\nimport * as Properties from './Properties';\nimport * as Resources from './Resources';\nimport * as Scheme from './Scheme';\nimport * as StatusBar from './StatusBar';\nimport * as Strings from './Strings';\nimport * as Styles from './Styles';\nimport * as Updates from './Updates';\nimport * as Version from './Version';\nimport * as WindowSoftInputMode from './WindowSoftInputMode';\n\nexport { Manifest, Colors, Paths, Permissions, Properties, Resources, Scheme, Strings, Styles };\n\nexport {\n AllowBackup,\n BuildProperties,\n EasBuild,\n GoogleMapsApiKey,\n GoogleServices,\n IntentFilters,\n Name,\n Orientation,\n Package,\n PrimaryColor,\n StatusBar,\n Updates,\n Version,\n WindowSoftInputMode,\n};\n"],"file":"index.js"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ExpoConfig } from '@expo/config-types';
|
|
2
|
+
import type { ConfigPlugin } from '../Plugin.types';
|
|
3
|
+
import { BuildPropertiesConfig, ConfigToPropertyRuleType } from '../utils/BuildProperties.types';
|
|
4
|
+
/**
|
|
5
|
+
* Creates a `withPodfileProperties` config-plugin based on given config to property mapping rules.
|
|
6
|
+
*
|
|
7
|
+
* The factory supports two modes from generic type inference
|
|
8
|
+
* ```ts
|
|
9
|
+
* // config-plugin without `props`, it will implicitly use the expo config as source config.
|
|
10
|
+
* createBuildPodfilePropsConfigPlugin<ExpoConfig>(): ConfigPlugin<void>;
|
|
11
|
+
*
|
|
12
|
+
* // config-plugin with a parameter `props: CustomType`, it will use the `props` as source config.
|
|
13
|
+
* createBuildPodfilePropsConfigPlugin<CustomType>(): ConfigPlugin<CustomType>;
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @param configToPropertyRules config to property mapping rules
|
|
17
|
+
* @param name the config plugin name
|
|
18
|
+
*/
|
|
19
|
+
export declare function createBuildPodfilePropsConfigPlugin<SourceConfigType extends BuildPropertiesConfig>(configToPropertyRules: ConfigToPropertyRuleType<SourceConfigType>[], name?: string): ConfigPlugin<SourceConfigType extends ExpoConfig ? void : SourceConfigType>;
|
|
20
|
+
/**
|
|
21
|
+
* A config-plugin to update `ios/Podfile.properties.json` from the `jsEngine` in expo config
|
|
22
|
+
*/
|
|
23
|
+
export declare const withJsEnginePodfileProps: ConfigPlugin<void>;
|
|
24
|
+
export declare function updateIosBuildPropertiesFromConfig<SourceConfigType extends BuildPropertiesConfig>(config: SourceConfigType, podfileProperties: Record<string, string>, configToPropertyRules: ConfigToPropertyRuleType<SourceConfigType>[]): Record<string, string>;
|
|
25
|
+
export declare function updateIosBuildProperty(podfileProperties: Record<string, string>, name: string, value: string | null | undefined, options?: {
|
|
26
|
+
removePropWhenValueIsNull?: boolean;
|
|
27
|
+
}): Record<string, string>;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createBuildPodfilePropsConfigPlugin = createBuildPodfilePropsConfigPlugin;
|
|
7
|
+
exports.updateIosBuildPropertiesFromConfig = updateIosBuildPropertiesFromConfig;
|
|
8
|
+
exports.updateIosBuildProperty = updateIosBuildProperty;
|
|
9
|
+
exports.withJsEnginePodfileProps = void 0;
|
|
10
|
+
|
|
11
|
+
function _iosPlugins() {
|
|
12
|
+
const data = require("../plugins/ios-plugins");
|
|
13
|
+
|
|
14
|
+
_iosPlugins = function () {
|
|
15
|
+
return data;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
return data;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Creates a `withPodfileProperties` config-plugin based on given config to property mapping rules.
|
|
23
|
+
*
|
|
24
|
+
* The factory supports two modes from generic type inference
|
|
25
|
+
* ```ts
|
|
26
|
+
* // config-plugin without `props`, it will implicitly use the expo config as source config.
|
|
27
|
+
* createBuildPodfilePropsConfigPlugin<ExpoConfig>(): ConfigPlugin<void>;
|
|
28
|
+
*
|
|
29
|
+
* // config-plugin with a parameter `props: CustomType`, it will use the `props` as source config.
|
|
30
|
+
* createBuildPodfilePropsConfigPlugin<CustomType>(): ConfigPlugin<CustomType>;
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @param configToPropertyRules config to property mapping rules
|
|
34
|
+
* @param name the config plugin name
|
|
35
|
+
*/
|
|
36
|
+
function createBuildPodfilePropsConfigPlugin(configToPropertyRules, name) {
|
|
37
|
+
const withUnknown = (config, sourceConfig) => (0, _iosPlugins().withPodfileProperties)(config, config => {
|
|
38
|
+
config.modResults = updateIosBuildPropertiesFromConfig(sourceConfig !== null && sourceConfig !== void 0 ? sourceConfig : config, config.modResults, configToPropertyRules);
|
|
39
|
+
return config;
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
if (name) {
|
|
43
|
+
Object.defineProperty(withUnknown, 'name', {
|
|
44
|
+
value: name
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return withUnknown;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* A config-plugin to update `ios/Podfile.properties.json` from the `jsEngine` in expo config
|
|
52
|
+
*/
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
const withJsEnginePodfileProps = createBuildPodfilePropsConfigPlugin([{
|
|
56
|
+
propName: 'expo.jsEngine',
|
|
57
|
+
propValueGetter: config => {
|
|
58
|
+
var _ref, _config$ios$jsEngine, _config$ios;
|
|
59
|
+
|
|
60
|
+
return (_ref = (_config$ios$jsEngine = (_config$ios = config.ios) === null || _config$ios === void 0 ? void 0 : _config$ios.jsEngine) !== null && _config$ios$jsEngine !== void 0 ? _config$ios$jsEngine : config.jsEngine) !== null && _ref !== void 0 ? _ref : 'jsc';
|
|
61
|
+
}
|
|
62
|
+
}], 'withJsEnginePodfileProps');
|
|
63
|
+
exports.withJsEnginePodfileProps = withJsEnginePodfileProps;
|
|
64
|
+
|
|
65
|
+
function updateIosBuildPropertiesFromConfig(config, podfileProperties, configToPropertyRules) {
|
|
66
|
+
for (const configToProperty of configToPropertyRules) {
|
|
67
|
+
const value = configToProperty.propValueGetter(config);
|
|
68
|
+
updateIosBuildProperty(podfileProperties, configToProperty.propName, value);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return podfileProperties;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function updateIosBuildProperty(podfileProperties, name, value, options) {
|
|
75
|
+
if (value) {
|
|
76
|
+
podfileProperties[name] = value;
|
|
77
|
+
} else if (options !== null && options !== void 0 && options.removePropWhenValueIsNull) {
|
|
78
|
+
delete podfileProperties[name];
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return podfileProperties;
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=BuildProperties.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/ios/BuildProperties.ts"],"names":["createBuildPodfilePropsConfigPlugin","configToPropertyRules","name","withUnknown","config","sourceConfig","modResults","updateIosBuildPropertiesFromConfig","Object","defineProperty","value","withJsEnginePodfileProps","propName","propValueGetter","ios","jsEngine","podfileProperties","configToProperty","updateIosBuildProperty","options","removePropWhenValueIsNull"],"mappings":";;;;;;;;;;AAGA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,mCAAT,CACLC,qBADK,EAELC,IAFK,EAGL;AACA,QAAMC,WAAwF,GAAG,CAC/FC,MAD+F,EAE/FC,YAF+F,KAI/F,yCAAsBD,MAAtB,EAA8BA,MAAM,IAAI;AACtCA,IAAAA,MAAM,CAACE,UAAP,GAAoBC,kCAAkC,CACnDF,YADmD,aACnDA,YADmD,cACnDA,YADmD,GACnCD,MADmC,EAEpDA,MAAM,CAACE,UAF6C,EAGpDL,qBAHoD,CAAtD;AAKA,WAAOG,MAAP;AACD,GAPD,CAJF;;AAYA,MAAIF,IAAJ,EAAU;AACRM,IAAAA,MAAM,CAACC,cAAP,CAAsBN,WAAtB,EAAmC,MAAnC,EAA2C;AACzCO,MAAAA,KAAK,EAAER;AADkC,KAA3C;AAGD;;AACD,SAAOC,WAAP;AACD;AAED;AACA;AACA;;;AACO,MAAMQ,wBAAwB,GAAGX,mCAAmC,CACzE,CACE;AACEY,EAAAA,QAAQ,EAAE,eADZ;AAEEC,EAAAA,eAAe,EAAET,MAAM;AAAA;;AAAA,0DAAIA,MAAM,CAACU,GAAX,gDAAI,YAAYC,QAAhB,uEAA4BX,MAAM,CAACW,QAAnC,uCAA+C,KAA/C;AAAA;AAFzB,CADF,CADyE,EAOzE,0BAPyE,CAApE;;;AAUA,SAASR,kCAAT,CACLH,MADK,EAELY,iBAFK,EAGLf,qBAHK,EAIL;AACA,OAAK,MAAMgB,gBAAX,IAA+BhB,qBAA/B,EAAsD;AACpD,UAAMS,KAAK,GAAGO,gBAAgB,CAACJ,eAAjB,CAAiCT,MAAjC,CAAd;AACAc,IAAAA,sBAAsB,CAACF,iBAAD,EAAoBC,gBAAgB,CAACL,QAArC,EAA+CF,KAA/C,CAAtB;AACD;;AACD,SAAOM,iBAAP;AACD;;AAEM,SAASE,sBAAT,CACLF,iBADK,EAELd,IAFK,EAGLQ,KAHK,EAILS,OAJK,EAKL;AACA,MAAIT,KAAJ,EAAW;AACTM,IAAAA,iBAAiB,CAACd,IAAD,CAAjB,GAA0BQ,KAA1B;AACD,GAFD,MAEO,IAAIS,OAAJ,aAAIA,OAAJ,eAAIA,OAAO,CAAEC,yBAAb,EAAwC;AAC7C,WAAOJ,iBAAiB,CAACd,IAAD,CAAxB;AACD;;AACD,SAAOc,iBAAP;AACD","sourcesContent":["import type { ExpoConfig } from '@expo/config-types';\n\nimport type { ConfigPlugin } from '../Plugin.types';\nimport { withPodfileProperties } from '../plugins/ios-plugins';\nimport { BuildPropertiesConfig, ConfigToPropertyRuleType } from '../utils/BuildProperties.types';\n\n/**\n * Creates a `withPodfileProperties` config-plugin based on given config to property mapping rules.\n *\n * The factory supports two modes from generic type inference\n * ```ts\n * // config-plugin without `props`, it will implicitly use the expo config as source config.\n * createBuildPodfilePropsConfigPlugin<ExpoConfig>(): ConfigPlugin<void>;\n *\n * // config-plugin with a parameter `props: CustomType`, it will use the `props` as source config.\n * createBuildPodfilePropsConfigPlugin<CustomType>(): ConfigPlugin<CustomType>;\n * ```\n *\n * @param configToPropertyRules config to property mapping rules\n * @param name the config plugin name\n */\nexport function createBuildPodfilePropsConfigPlugin<SourceConfigType extends BuildPropertiesConfig>(\n configToPropertyRules: ConfigToPropertyRuleType<SourceConfigType>[],\n name?: string\n) {\n const withUnknown: ConfigPlugin<SourceConfigType extends ExpoConfig ? void : SourceConfigType> = (\n config,\n sourceConfig\n ) =>\n withPodfileProperties(config, config => {\n config.modResults = updateIosBuildPropertiesFromConfig(\n (sourceConfig ?? config) as SourceConfigType,\n config.modResults,\n configToPropertyRules\n );\n return config;\n });\n if (name) {\n Object.defineProperty(withUnknown, 'name', {\n value: name,\n });\n }\n return withUnknown;\n}\n\n/**\n * A config-plugin to update `ios/Podfile.properties.json` from the `jsEngine` in expo config\n */\nexport const withJsEnginePodfileProps = createBuildPodfilePropsConfigPlugin<ExpoConfig>(\n [\n {\n propName: 'expo.jsEngine',\n propValueGetter: config => config.ios?.jsEngine ?? config.jsEngine ?? 'jsc',\n },\n ],\n 'withJsEnginePodfileProps'\n);\n\nexport function updateIosBuildPropertiesFromConfig<SourceConfigType extends BuildPropertiesConfig>(\n config: SourceConfigType,\n podfileProperties: Record<string, string>,\n configToPropertyRules: ConfigToPropertyRuleType<SourceConfigType>[]\n) {\n for (const configToProperty of configToPropertyRules) {\n const value = configToProperty.propValueGetter(config);\n updateIosBuildProperty(podfileProperties, configToProperty.propName, value);\n }\n return podfileProperties;\n}\n\nexport function updateIosBuildProperty(\n podfileProperties: Record<string, string>,\n name: string,\n value: string | null | undefined,\n options?: { removePropWhenValueIsNull?: boolean }\n) {\n if (value) {\n podfileProperties[name] = value;\n } else if (options?.removePropWhenValueIsNull) {\n delete podfileProperties[name];\n }\n return podfileProperties;\n}\n"],"file":"BuildProperties.js"}
|
package/build/ios/BuildScheme.js
CHANGED
|
@@ -60,7 +60,12 @@ function getRunnableSchemesFromXcodeproj(projectRoot, {
|
|
|
60
60
|
let osType = 'iOS';
|
|
61
61
|
const type = (0, _Xcodeproj().unquote)(target.productType);
|
|
62
62
|
|
|
63
|
-
if (type === _Target().TargetType.
|
|
63
|
+
if (type === _Target().TargetType.WATCH) {
|
|
64
|
+
osType = 'watchOS';
|
|
65
|
+
} else if ( // (apps) com.apple.product-type.application
|
|
66
|
+
// (app clips) com.apple.product-type.application.on-demand-install-capable
|
|
67
|
+
// NOTE(EvanBacon): This matches against `watchOS` as well so we check for watch first.
|
|
68
|
+
type.startsWith(_Target().TargetType.APPLICATION)) {
|
|
64
69
|
// Attempt to resolve the platform SDK for each target so we can filter devices.
|
|
65
70
|
const xcConfigurationList = project.hash.project.objects.XCConfigurationList[target.buildConfigurationList];
|
|
66
71
|
|
|
@@ -81,8 +86,6 @@ function getRunnableSchemesFromXcodeproj(projectRoot, {
|
|
|
81
86
|
}
|
|
82
87
|
}
|
|
83
88
|
}
|
|
84
|
-
} else if (type === _Target().TargetType.WATCH) {
|
|
85
|
-
osType = 'watchOS';
|
|
86
89
|
}
|
|
87
90
|
|
|
88
91
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/ios/BuildScheme.ts"],"names":["getSchemesFromXcodeproj","projectRoot","getRunnableSchemesFromXcodeproj","configuration","project","map","target","osType","type","productType","TargetType","APPLICATION","xcConfigurationList","hash","objects","XCConfigurationList","buildConfigurationList","buildConfiguration","buildConfigurations","find","value","comment","xcBuildConfiguration","XCBuildConfiguration","buildSdkRoot","buildSettings","SDKROOT","
|
|
1
|
+
{"version":3,"sources":["../../src/ios/BuildScheme.ts"],"names":["getSchemesFromXcodeproj","projectRoot","getRunnableSchemesFromXcodeproj","configuration","project","map","target","osType","type","productType","TargetType","WATCH","startsWith","APPLICATION","xcConfigurationList","hash","objects","XCConfigurationList","buildConfigurationList","buildConfiguration","buildConfigurations","find","value","comment","xcBuildConfiguration","XCBuildConfiguration","buildSdkRoot","buildSettings","SDKROOT","name","readSchemeAsync","scheme","allSchemePaths","re","RegExp","schemePath","i","exec","path","Error","getApplicationTargetNameForSchemeAsync","schemeXML","buildActionEntry","Scheme","BuildAction","BuildActionEntries","BuildActionEntry","targetName","length","getBlueprintName","entry","BuildableReference","BuildableName","endsWith","getArchiveBuildConfigurationForSchemeAsync","ArchiveAction","BlueprintName"],"mappings":";;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AA0BO,SAASA,uBAAT,CAAiCC,WAAjC,EAAgE;AACrE,SAAO,8BAAgBA,WAAhB,CAAP;AACD;;AAEM,SAASC,+BAAT,CACLD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EIO,gBAAgB,CACdP,gBADc,aACdA,gBADc,uBACdA,gBAAgB,CAAErB,IAAlB,CAAuB6B,KAAK,IAAI;AAAA;;AAC9B,oCAAOA,KAAK,CAACC,kBAAb,oFAAO,sBAA2B,CAA3B,CAAP,qFAAO,uBAAgC,GAAhC,CAAP,qFAAO,uBAAsCC,aAA7C,2DAAO,uBAAqDC,QAArD,CAA8D,MAA9D,CAAP;AACD,GAFD,CADc,CAHtB;;AAQA,MAAI,CAACN,UAAL,EAAiB;AACf,UAAM,IAAIR,KAAJ,CAAW,GAAER,MAAO,iCAApB,CAAN;AACD;;AACD,SAAOgB,UAAP;AACD;;AAEM,eAAeO,0CAAf,CACLrD,WADK,EAEL8B,MAFK,EAGY;AAAA;;AACjB,QAAMU,SAAS,GAAG,MAAMX,eAAe,CAAC7B,WAAD,EAAc8B,MAAd,CAAvC;AACA,QAAMZ,kBAAkB,GAAGsB,SAAH,aAAGA,SAAH,6CAAGA,SAAS,CAAEE,MAAd,gFAAG,mBAAmBY,aAAtB,oFAAG,sBAAmC,CAAnC,CAAH,qFAAG,uBAAwC,GAAxC,CAAH,2DAAG,uBAA8CpC,kBAAzE;;AACA,MAAI,CAACA,kBAAL,EAAyB;AACvB,UAAM,IAAIoB,KAAJ,CAAW,GAAER,MAAO,iCAApB,CAAN;AACD;;AACD,SAAOZ,kBAAP;AACD;;AAED,SAAS8B,gBAAT,CAA0BC,KAA1B,EAA4E;AAAA;;AAC1E,SAAOA,KAAP,aAAOA,KAAP,iDAAOA,KAAK,CAAEC,kBAAd,qFAAO,uBAA4B,CAA5B,CAAP,qFAAO,uBAAiC,GAAjC,CAAP,2DAAO,uBAAuCK,aAA9C;AACD","sourcesContent":["import { readXMLAsync } from '../utils/XML';\nimport { findSchemeNames, findSchemePaths } from './Paths';\nimport { findSignableTargets, TargetType } from './Target';\nimport { getPbxproj, unquote } from './utils/Xcodeproj';\n\ninterface SchemeXML {\n Scheme?: {\n BuildAction?: {\n BuildActionEntries?: {\n BuildActionEntry?: BuildActionEntryType[];\n }[];\n }[];\n ArchiveAction?: {\n $?: {\n buildConfiguration?: string;\n };\n }[];\n };\n}\n\ninterface BuildActionEntryType {\n BuildableReference?: {\n $?: {\n BlueprintName?: string;\n BuildableName?: string;\n };\n }[];\n}\n\nexport function getSchemesFromXcodeproj(projectRoot: string): string[] {\n return findSchemeNames(projectRoot);\n}\n\nexport function getRunnableSchemesFromXcodeproj(\n projectRoot: string,\n { configuration = 'Debug' }: { configuration?: 'Debug' | 'Release' } = {}\n): { name: string; osType: string; type: string }[] {\n const project = getPbxproj(projectRoot);\n\n return findSignableTargets(project).map(([, target]) => {\n let osType = 'iOS';\n const type = unquote(target.productType);\n\n if (type === TargetType.WATCH) {\n osType = 'watchOS';\n } else if (\n // (apps) com.apple.product-type.application\n // (app clips) com.apple.product-type.application.on-demand-install-capable\n // NOTE(EvanBacon): This matches against `watchOS` as well so we check for watch first.\n type.startsWith(TargetType.APPLICATION)\n ) {\n // Attempt to resolve the platform SDK for each target so we can filter devices.\n const xcConfigurationList =\n project.hash.project.objects.XCConfigurationList[target.buildConfigurationList];\n\n if (xcConfigurationList) {\n const buildConfiguration =\n xcConfigurationList.buildConfigurations.find(\n (value: { comment: string; value: string }) => value.comment === configuration\n ) || xcConfigurationList.buildConfigurations[0];\n if (buildConfiguration?.value) {\n const xcBuildConfiguration =\n project.hash.project.objects.XCBuildConfiguration?.[buildConfiguration.value];\n\n const buildSdkRoot = xcBuildConfiguration.buildSettings.SDKROOT;\n if (\n buildSdkRoot === 'appletvos' ||\n 'TVOS_DEPLOYMENT_TARGET' in xcBuildConfiguration.buildSettings\n ) {\n // Is a TV app...\n osType = 'tvOS';\n } else if (buildSdkRoot === 'iphoneos') {\n osType = 'iOS';\n }\n }\n }\n }\n\n return {\n name: unquote(target.name),\n osType,\n type: unquote(target.productType),\n };\n });\n}\n\nasync function readSchemeAsync(\n projectRoot: string,\n scheme: string\n): Promise<SchemeXML | undefined> {\n const allSchemePaths = findSchemePaths(projectRoot);\n const re = new RegExp(`/${scheme}.xcscheme`, 'i');\n const schemePath = allSchemePaths.find(i => re.exec(i));\n if (schemePath) {\n return ((await readXMLAsync({ path: schemePath })) as unknown) as SchemeXML | undefined;\n } else {\n throw new Error(`scheme '${scheme}' does not exist, make sure it's marked as shared`);\n }\n}\n\nexport async function getApplicationTargetNameForSchemeAsync(\n projectRoot: string,\n scheme: string\n): Promise<string> {\n const schemeXML = await readSchemeAsync(projectRoot, scheme);\n const buildActionEntry =\n schemeXML?.Scheme?.BuildAction?.[0]?.BuildActionEntries?.[0]?.BuildActionEntry;\n const targetName =\n buildActionEntry?.length === 1\n ? getBlueprintName(buildActionEntry[0])\n : getBlueprintName(\n buildActionEntry?.find(entry => {\n return entry.BuildableReference?.[0]?.['$']?.BuildableName?.endsWith('.app');\n })\n );\n if (!targetName) {\n throw new Error(`${scheme}.xcscheme seems to be corrupted`);\n }\n return targetName;\n}\n\nexport async function getArchiveBuildConfigurationForSchemeAsync(\n projectRoot: string,\n scheme: string\n): Promise<string> {\n const schemeXML = await readSchemeAsync(projectRoot, scheme);\n const buildConfiguration = schemeXML?.Scheme?.ArchiveAction?.[0]?.['$']?.buildConfiguration;\n if (!buildConfiguration) {\n throw new Error(`${scheme}.xcscheme seems to be corrupted`);\n }\n return buildConfiguration;\n}\n\nfunction getBlueprintName(entry?: BuildActionEntryType): string | undefined {\n return entry?.BuildableReference?.[0]?.['$']?.BlueprintName;\n}\n"],"file":"BuildScheme.js"}
|
|
@@ -32,10 +32,10 @@ function _assert() {
|
|
|
32
32
|
return data;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
function
|
|
36
|
-
const data = _interopRequireDefault(require("fs
|
|
35
|
+
function _fs() {
|
|
36
|
+
const data = _interopRequireDefault(require("fs"));
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
_fs = function () {
|
|
39
39
|
return data;
|
|
40
40
|
};
|
|
41
41
|
|
|
@@ -235,7 +235,7 @@ function updateBundleIdentifierForPbxproj(pbxprojPath, bundleIdentifier, updateP
|
|
|
235
235
|
}
|
|
236
236
|
});
|
|
237
237
|
|
|
238
|
-
|
|
238
|
+
_fs().default.writeFileSync(pbxprojPath, project.writeSync());
|
|
239
239
|
}
|
|
240
240
|
/**
|
|
241
241
|
* Updates the bundle identifier for pbx projects inside the ios directory of the given project root
|
|
@@ -274,7 +274,7 @@ function resetAllPlistBundleIdentifiers(projectRoot) {
|
|
|
274
274
|
}
|
|
275
275
|
|
|
276
276
|
function resetPlistBundleIdentifier(plistPath) {
|
|
277
|
-
const rawPlist =
|
|
277
|
+
const rawPlist = _fs().default.readFileSync(plistPath, 'utf8');
|
|
278
278
|
|
|
279
279
|
const plistObject = _plist().default.parse(rawPlist);
|
|
280
280
|
|
|
@@ -291,7 +291,7 @@ function resetPlistBundleIdentifier(plistPath) {
|
|
|
291
291
|
}, format);
|
|
292
292
|
|
|
293
293
|
if (xml !== rawPlist) {
|
|
294
|
-
|
|
294
|
+
_fs().default.writeFileSync(plistPath, xml);
|
|
295
295
|
}
|
|
296
296
|
}
|
|
297
297
|
}
|