@expo/prebuild-config 4.0.3 → 5.0.1

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.
Files changed (67) hide show
  1. package/build/getAutolinkedPackages.js +6 -5
  2. package/build/getAutolinkedPackages.js.map +1 -1
  3. package/build/getPrebuildConfig.js.map +1 -1
  4. package/build/importExpoModulesAutolinking.d.ts +16 -0
  5. package/build/importExpoModulesAutolinking.js +38 -0
  6. package/build/importExpoModulesAutolinking.js.map +1 -0
  7. package/build/index.js.map +1 -1
  8. package/build/plugins/icons/AssetContents.js.map +1 -1
  9. package/build/plugins/icons/withAndroidIcons.d.ts +2 -1
  10. package/build/plugins/icons/withAndroidIcons.js +144 -132
  11. package/build/plugins/icons/withAndroidIcons.js.map +1 -1
  12. package/build/plugins/icons/withAndroidManifestIcons.js.map +1 -1
  13. package/build/plugins/icons/withIosIcons.js.map +1 -1
  14. package/build/plugins/unversioned/createLegacyPlugin.js.map +1 -1
  15. package/build/plugins/unversioned/expo-ads-admob/expo-ads-admob.js.map +1 -1
  16. package/build/plugins/unversioned/expo-ads-admob/withAndroidAdMob.js.map +1 -1
  17. package/build/plugins/unversioned/expo-ads-admob/withIosAdMob.js.map +1 -1
  18. package/build/plugins/unversioned/expo-apple-authentication.js.map +1 -1
  19. package/build/plugins/unversioned/expo-branch/expo-branch.js.map +1 -1
  20. package/build/plugins/unversioned/expo-branch/withAndroidBranch.js.map +1 -1
  21. package/build/plugins/unversioned/expo-branch/withIosBranch.js.map +1 -1
  22. package/build/plugins/unversioned/expo-contacts.js.map +1 -1
  23. package/build/plugins/unversioned/expo-document-picker.js.map +1 -1
  24. package/build/plugins/unversioned/expo-facebook/expo-facebook.js.map +1 -1
  25. package/build/plugins/unversioned/expo-facebook/withAndroidFacebook.js.map +1 -1
  26. package/build/plugins/unversioned/expo-facebook/withIosFacebook.js.map +1 -1
  27. package/build/plugins/unversioned/expo-facebook/withSKAdNetworkIdentifiers.js.map +1 -1
  28. package/build/plugins/unversioned/expo-navigation-bar/expo-navigation-bar.js.map +1 -1
  29. package/build/plugins/unversioned/expo-navigation-bar/withAndroidNavigationBar.js.map +1 -1
  30. package/build/plugins/unversioned/expo-notifications/expo-notifications.js.map +1 -1
  31. package/build/plugins/unversioned/expo-notifications/withAndroidNotifications.js.map +1 -1
  32. package/build/plugins/unversioned/expo-splash-screen/InterfaceBuilder.d.ts +94 -5
  33. package/build/plugins/unversioned/expo-splash-screen/InterfaceBuilder.js +89 -86
  34. package/build/plugins/unversioned/expo-splash-screen/InterfaceBuilder.js.map +1 -1
  35. package/build/plugins/unversioned/expo-splash-screen/expo-splash-screen.js.map +1 -1
  36. package/build/plugins/unversioned/expo-splash-screen/getAndroidSplashConfig.js.map +1 -1
  37. package/build/plugins/unversioned/expo-splash-screen/getIosSplashConfig.js.map +1 -1
  38. package/build/plugins/unversioned/expo-splash-screen/withAndroidSplashDrawables.js.map +1 -1
  39. package/build/plugins/unversioned/expo-splash-screen/withAndroidSplashImages.js.map +1 -1
  40. package/build/plugins/unversioned/expo-splash-screen/withAndroidSplashLegacyMainActivity.js.map +1 -1
  41. package/build/plugins/unversioned/expo-splash-screen/withAndroidSplashScreen.js.map +1 -1
  42. package/build/plugins/unversioned/expo-splash-screen/withAndroidSplashStrings.js.map +1 -1
  43. package/build/plugins/unversioned/expo-splash-screen/withAndroidSplashStyles.js.map +1 -1
  44. package/build/plugins/unversioned/expo-splash-screen/withIosSplashAssets.js.map +1 -1
  45. package/build/plugins/unversioned/expo-splash-screen/withIosSplashInfoPlist.js.map +1 -1
  46. package/build/plugins/unversioned/expo-splash-screen/withIosSplashScreen.js +25 -1
  47. package/build/plugins/unversioned/expo-splash-screen/withIosSplashScreen.js.map +1 -1
  48. package/build/plugins/unversioned/expo-splash-screen/withIosSplashScreenStoryboard.d.ts +14 -0
  49. package/build/plugins/unversioned/expo-splash-screen/withIosSplashScreenStoryboard.js +212 -0
  50. package/build/plugins/unversioned/expo-splash-screen/withIosSplashScreenStoryboard.js.map +1 -0
  51. package/build/plugins/unversioned/expo-splash-screen/withIosSplashXcodeProject.d.ts +5 -7
  52. package/build/plugins/unversioned/expo-splash-screen/withIosSplashXcodeProject.js +11 -87
  53. package/build/plugins/unversioned/expo-splash-screen/withIosSplashXcodeProject.js.map +1 -1
  54. package/build/plugins/unversioned/expo-splash-screen/wtihIosSplashScreenStoryboardImage.d.ts +5 -0
  55. package/build/plugins/unversioned/expo-splash-screen/wtihIosSplashScreenStoryboardImage.js +68 -0
  56. package/build/plugins/unversioned/expo-splash-screen/wtihIosSplashScreenStoryboardImage.js.map +1 -0
  57. package/build/plugins/unversioned/expo-system-ui/expo-system-ui.js.map +1 -1
  58. package/build/plugins/unversioned/expo-system-ui/withAndroidRootViewBackgroundColor.js.map +1 -1
  59. package/build/plugins/unversioned/expo-system-ui/withAndroidUserInterfaceStyle.js.map +1 -1
  60. package/build/plugins/unversioned/expo-system-ui/withIosRootViewBackgroundColor.js.map +1 -1
  61. package/build/plugins/unversioned/expo-system-ui/withIosUserInterfaceStyle.d.ts +2 -2
  62. package/build/plugins/unversioned/expo-system-ui/withIosUserInterfaceStyle.js +8 -10
  63. package/build/plugins/unversioned/expo-system-ui/withIosUserInterfaceStyle.js.map +1 -1
  64. package/build/plugins/unversioned/expo-updates.js.map +1 -1
  65. package/build/plugins/unversioned/react-native-maps.js.map +1 -1
  66. package/build/plugins/withDefaultPlugins.js.map +1 -1
  67. package/package.json +14 -11
@@ -12,6 +12,43 @@ export declare type Rect = {
12
12
  height: number;
13
13
  };
14
14
  export declare type IBRect = IBItem<Rect>;
15
+ export declare type IBAutoresizingMask = IBItem<{
16
+ /** @example `autoresizingMask` */
17
+ key: string;
18
+ flexibleMaxX: IBBoolean;
19
+ flexibleMaxY: IBBoolean;
20
+ }>;
21
+ /** @example `<color key="textColor" systemColor="linkColor"/>` */
22
+ export declare type IBColor = IBItem<{
23
+ /** @example `textColor` */
24
+ key: string;
25
+ } & (/** Custom color */ {
26
+ /** @example `0.86584504117670746` */
27
+ red: number;
28
+ /** @example `0.26445041990630447` */
29
+ green: number;
30
+ /** @example `0.3248577810203549` */
31
+ blue: number;
32
+ /** @example `1` */
33
+ alpha: number;
34
+ colorSpace: 'custom' | string;
35
+ customColorSpace: 'displayP3' | 'sRGB' | string;
36
+ }
37
+ /** Built-in color */
38
+ | {
39
+ systemColor: 'linkColor' | string;
40
+ })>;
41
+ export declare type IBFontDescription = IBItem<{
42
+ /** @example `fontDescription` */
43
+ key: string;
44
+ /** Font size */
45
+ pointSize: number;
46
+ /** Custom font */
47
+ name?: 'HelveticaNeue' | string;
48
+ family?: 'Helvetica Neue' | string;
49
+ /** Built-in font */
50
+ type?: 'system' | 'boldSystem' | 'UICTFontTextStyleCallout' | 'UICTFontTextStyleBody' | string;
51
+ }>;
15
52
  export declare type ImageContentMode = 'scaleAspectFit' | 'scaleAspectFill';
16
53
  export declare type ConstraintAttribute = 'top' | 'bottom' | 'trailing' | 'leading';
17
54
  export declare type IBImageView = IBItem<{
@@ -20,7 +57,7 @@ export declare type IBImageView = IBItem<{
20
57
  image: string;
21
58
  clipsSubviews?: IBBoolean;
22
59
  userInteractionEnabled: IBBoolean;
23
- contentMode: string | 'scaleAspectFill';
60
+ contentMode: IBContentMode;
24
61
  horizontalHuggingPriority: number;
25
62
  verticalHuggingPriority: number;
26
63
  insetsLayoutMarginsFromSafeArea?: IBBoolean;
@@ -28,11 +65,43 @@ export declare type IBImageView = IBItem<{
28
65
  }, {
29
66
  rect: IBRect[];
30
67
  }>;
68
+ export declare type IBLabel = IBItem<{
69
+ id: string;
70
+ /** The main value. */
71
+ text: string;
72
+ opaque: IBBoolean;
73
+ fixedFrame: IBBoolean;
74
+ textAlignment?: IBTextAlignment;
75
+ lineBreakMode: 'clip' | 'characterWrap' | 'wordWrap' | 'headTruncation' | 'middleTruncation' | 'tailTruncation';
76
+ baselineAdjustment?: 'none' | 'alignBaselines';
77
+ adjustsFontSizeToFit: IBBoolean;
78
+ userInteractionEnabled: IBBoolean;
79
+ contentMode: IBContentMode;
80
+ horizontalHuggingPriority: number;
81
+ verticalHuggingPriority: number;
82
+ translatesAutoresizingMaskIntoConstraints?: IBBoolean;
83
+ }, {
84
+ /** @example `<rect key="frame" x="175" y="670" width="35" height="17"/>` */
85
+ rect: IBRect[];
86
+ /** @example `<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>` */
87
+ autoresizingMask?: IBAutoresizingMask[];
88
+ /** @example `<fontDescription key="fontDescription" type="system" pointSize="19"/>` */
89
+ fontDescription?: IBFontDescription[];
90
+ /** @example `<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>` */
91
+ color?: IBColor[];
92
+ nil?: IBItem<{
93
+ /** @example `textColor` `highlightedColor` */
94
+ key: string;
95
+ }>[];
96
+ }>;
97
+ export declare type IBTextAlignment = 'left' | 'center' | 'right' | 'justified' | 'natural';
98
+ export declare type IBContentMode = string | 'left' | 'scaleAspectFill';
31
99
  export declare type IBConstraint = IBItem<{
32
100
  firstItem: string;
33
101
  firstAttribute: ConstraintAttribute;
34
102
  secondItem: string;
35
103
  secondAttribute: ConstraintAttribute;
104
+ constant?: number;
36
105
  id: string;
37
106
  }>;
38
107
  export declare type IBViewController = IBItem<{
@@ -57,6 +126,7 @@ export declare type IBViewController = IBItem<{
57
126
  }>[];
58
127
  subviews: IBItem<object, {
59
128
  imageView: IBImageView[];
129
+ label: IBLabel[];
60
130
  }>[];
61
131
  color: IBItem<{
62
132
  key: string | 'backgroundColor';
@@ -90,12 +160,12 @@ export declare type IBScene = IBItem<{
90
160
  }[];
91
161
  point: IBPoint[];
92
162
  }>;
93
- declare type IBResourceImage = IBItem<{
163
+ export declare type IBResourceImage = IBItem<{
94
164
  name: string;
95
165
  width: number;
96
166
  height: number;
97
167
  }>;
98
- declare type IBDevice = IBItem<{
168
+ export declare type IBDevice = IBItem<{
99
169
  id: string;
100
170
  orientation: string | 'portrait';
101
171
  appearance: string | 'light';
@@ -124,10 +194,29 @@ export declare type IBSplashScreenDocument = {
124
194
  }[];
125
195
  }>;
126
196
  };
197
+ export declare function createConstraint([firstItem, firstAttribute]: [string, ConstraintAttribute], [secondItem, secondAttribute]: [string, ConstraintAttribute], constant?: number): IBConstraint;
198
+ export declare function createConstraintId(...attributes: string[]): string;
199
+ export declare function removeImageFromSplashScreen(xml: IBSplashScreenDocument, { imageName }: {
200
+ imageName: string;
201
+ }): IBSplashScreenDocument;
127
202
  export declare function applyImageToSplashScreenXML(xml: IBSplashScreenDocument, { imageName, contentMode, }: {
128
203
  imageName: string;
129
204
  contentMode: ImageContentMode;
130
205
  }): IBSplashScreenDocument;
131
- export declare function createTemplateSplashScreenAsync(): Promise<IBSplashScreenDocument>;
206
+ /**
207
+ * IB does not allow two items to have the same ID.
208
+ * This method will add an item by first removing any existing item with the same `$.id`.
209
+ */
210
+ export declare function ensureUniquePush<TItem extends {
211
+ $: {
212
+ id: string;
213
+ };
214
+ }>(array: TItem[], item: TItem): TItem[];
215
+ export declare function removeExisting<TItem extends {
216
+ $: {
217
+ id: string;
218
+ };
219
+ }>(array: TItem[], item: TItem | string): TItem[];
132
220
  export declare function toString(xml: any): string;
133
- export {};
221
+ /** Parse string contents into an object. */
222
+ export declare function toObjectAsync(contents: string): Promise<any>;
@@ -4,7 +4,12 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.applyImageToSplashScreenXML = applyImageToSplashScreenXML;
7
- exports.createTemplateSplashScreenAsync = createTemplateSplashScreenAsync;
7
+ exports.createConstraint = createConstraint;
8
+ exports.createConstraintId = createConstraintId;
9
+ exports.ensureUniquePush = ensureUniquePush;
10
+ exports.removeExisting = removeExisting;
11
+ exports.removeImageFromSplashScreen = removeImageFromSplashScreen;
12
+ exports.toObjectAsync = toObjectAsync;
8
13
  exports.toString = toString;
9
14
 
10
15
  function _crypto() {
@@ -29,13 +34,16 @@ function _xml2js() {
29
34
 
30
35
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
31
36
 
32
- function createConstraint([firstItem, firstAttribute], [secondItem, secondAttribute]) {
37
+ const debug = require('debug')('expo:prebuild-config:expo-splash-screen:ios:InterfaceBuilder');
38
+
39
+ function createConstraint([firstItem, firstAttribute], [secondItem, secondAttribute], constant) {
33
40
  return {
34
41
  $: {
35
42
  firstItem,
36
43
  firstAttribute,
37
44
  secondItem,
38
45
  secondAttribute,
46
+ constant,
39
47
  // Prevent updating between runs
40
48
  id: createConstraintId(firstItem, firstAttribute, secondItem, secondAttribute)
41
49
  }
@@ -46,17 +54,45 @@ function createConstraintId(...attributes) {
46
54
  return _crypto().default.createHash('sha1').update(attributes.join('-')).digest('hex');
47
55
  }
48
56
 
57
+ const IMAGE_ID = 'EXPO-SplashScreen';
58
+ const CONTAINER_ID = 'EXPO-ContainerView';
59
+
60
+ function removeImageFromSplashScreen(xml, {
61
+ imageName
62
+ }) {
63
+ const mainView = xml.document.scenes[0].scene[0].objects[0].viewController[0].view[0];
64
+ debug(`Remove all splash screen image elements`);
65
+ removeExisting(mainView.subviews[0].imageView, IMAGE_ID); // Add Constraints
66
+
67
+ getAbsoluteConstraints(IMAGE_ID, CONTAINER_ID).forEach(constraint => {
68
+ // <constraint firstItem="EXPO-SplashScreen" firstAttribute="top" secondItem="EXPO-ContainerView" secondAttribute="top" id="2VS-Uz-0LU"/>
69
+ const constrainsArray = mainView.constraints[0].constraint;
70
+ removeExisting(constrainsArray, constraint);
71
+ }); // Add resource
72
+
73
+ const imageSection = xml.document.resources[0].image;
74
+ const existingImageIndex = imageSection.findIndex(image => image.$.name === imageName);
75
+
76
+ if (existingImageIndex > -1) {
77
+ imageSection.splice(existingImageIndex, 1);
78
+ }
79
+
80
+ return xml;
81
+ }
82
+
83
+ function getAbsoluteConstraints(childId, parentId) {
84
+ return [createConstraint([childId, 'top'], [parentId, 'top']), createConstraint([childId, 'leading'], [parentId, 'leading']), createConstraint([childId, 'trailing'], [parentId, 'trailing']), createConstraint([childId, 'bottom'], [parentId, 'bottom'])];
85
+ }
86
+
49
87
  function applyImageToSplashScreenXML(xml, {
50
88
  imageName,
51
89
  contentMode
52
90
  }) {
53
- const imageId = 'EXPO-SplashScreen';
54
- const containerId = 'EXPO-ContainerView';
55
91
  const width = 414;
56
92
  const height = 736;
57
93
  const imageView = {
58
94
  $: {
59
- id: imageId,
95
+ id: IMAGE_ID,
60
96
  userLabel: imageName,
61
97
  image: imageName,
62
98
  contentMode,
@@ -75,14 +111,26 @@ function applyImageToSplashScreenXML(xml, {
75
111
  height
76
112
  }
77
113
  }]
78
- }; // Add ImageView
114
+ };
115
+ const mainView = xml.document.scenes[0].scene[0].objects[0].viewController[0].view[0]; // Add ImageView
116
+
117
+ ensureUniquePush(mainView.subviews[0].imageView, imageView); // Add Constraints
118
+
119
+ getAbsoluteConstraints(IMAGE_ID, CONTAINER_ID).forEach(constraint => {
120
+ // <constraint firstItem="EXPO-SplashScreen" firstAttribute="top" secondItem="EXPO-ContainerView" secondAttribute="top" id="2VS-Uz-0LU"/>
121
+ const constrainsArray = mainView.constraints[0].constraint;
122
+ ensureUniquePush(constrainsArray, constraint);
123
+ }); // Add resource
79
124
 
80
- xml.document.scenes[0].scene[0].objects[0].viewController[0].view[0].subviews[0].imageView.push(imageView); // Add Constraints
125
+ const imageSection = xml.document.resources[0].image;
126
+ const existingImageIndex = imageSection.findIndex(image => image.$.name === imageName);
81
127
 
82
- xml.document.scenes[0].scene[0].objects[0].viewController[0].view[0].constraints[0].constraint.push( // <constraint firstItem="EXPO-SplashScreen" firstAttribute="top" secondItem="EXPO-ContainerView" secondAttribute="top" id="2VS-Uz-0LU"/>
83
- createConstraint([imageId, 'top'], [containerId, 'top']), createConstraint([imageId, 'leading'], [containerId, 'leading']), createConstraint([imageId, 'trailing'], [containerId, 'trailing']), createConstraint([imageId, 'bottom'], [containerId, 'bottom'])); // Add resource
128
+ if (existingImageIndex > -1) {
129
+ debug(`Removing existing IB image asset at index ${existingImageIndex}`);
130
+ imageSection.splice(existingImageIndex, 1);
131
+ }
84
132
 
85
- xml.document.resources[0].image.push({
133
+ imageSection.push({
86
134
  // <image name="SplashScreen" width="414" height="736"/>
87
135
  $: {
88
136
  name: imageName,
@@ -92,88 +140,37 @@ function applyImageToSplashScreenXML(xml, {
92
140
  });
93
141
  return xml;
94
142
  }
143
+ /**
144
+ * IB does not allow two items to have the same ID.
145
+ * This method will add an item by first removing any existing item with the same `$.id`.
146
+ */
147
+
148
+
149
+ function ensureUniquePush(array, item) {
150
+ if (!array) return array;
151
+ removeExisting(array, item);
152
+ array.push(item);
153
+ return array;
154
+ }
95
155
 
96
- async function createTemplateSplashScreenAsync() {
97
- const contents = `<?xml version="1.0" encoding="UTF-8"?>
98
- <document
99
- type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB"
100
- version="3.0"
101
- toolsVersion="16096"
102
- targetRuntime="iOS.CocoaTouch"
103
- propertyAccessControl="none"
104
- useAutolayout="YES"
105
- launchScreen="YES"
106
- useTraitCollections="YES"
107
- useSafeAreas="YES"
108
- colorMatched="YES"
109
- initialViewController="EXPO-VIEWCONTROLLER-1"
110
- >
111
- <device id="retina5_5" orientation="portrait" appearance="light"/>
112
- <dependencies>
113
- <deployment identifier="iOS"/>
114
- <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/>
115
- <capability name="Safe area layout guides" minToolsVersion="9.0"/>
116
- <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
117
- </dependencies>
118
- <scenes>
119
- <!--View Controller-->
120
- <scene sceneID="EXPO-SCENE-1">
121
- <objects>
122
- <viewController
123
- storyboardIdentifier="SplashScreenViewController"
124
- id="EXPO-VIEWCONTROLLER-1"
125
- sceneMemberID="viewController"
126
- >
127
- <view
128
- key="view"
129
- userInteractionEnabled="NO"
130
- contentMode="scaleToFill"
131
- insetsLayoutMarginsFromSafeArea="NO"
132
- id="EXPO-ContainerView"
133
- userLabel="ContainerView"
134
- >
135
- <rect key="frame" x="0.0" y="0.0" width="414" height="736"/>
136
- <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
137
- <subviews>
138
- <imageView
139
- userInteractionEnabled="NO"
140
- contentMode="scaleAspectFill"
141
- horizontalHuggingPriority="251"
142
- verticalHuggingPriority="251"
143
- insetsLayoutMarginsFromSafeArea="NO"
144
- image="SplashScreenBackground"
145
- translatesAutoresizingMaskIntoConstraints="NO"
146
- id="EXPO-SplashScreenBackground"
147
- userLabel="SplashScreenBackground"
148
- >
149
- <rect key="frame" x="0.0" y="0.0" width="414" height="736"/>
150
- </imageView>
151
- </subviews>
152
- <color key="backgroundColor" systemColor="systemBackgroundColor"/>
153
- <constraints>
154
- <constraint firstItem="EXPO-SplashScreenBackground" firstAttribute="top" secondItem="EXPO-ContainerView" secondAttribute="top" id="1gX-mQ-vu6"/>
155
- <constraint firstItem="EXPO-SplashScreenBackground" firstAttribute="leading" secondItem="EXPO-ContainerView" secondAttribute="leading" id="6tX-OG-Sck"/>
156
- <constraint firstItem="EXPO-SplashScreenBackground" firstAttribute="trailing" secondItem="EXPO-ContainerView" secondAttribute="trailing" id="ABX-8g-7v4"/>
157
- <constraint firstItem="EXPO-SplashScreenBackground" firstAttribute="bottom" secondItem="EXPO-ContainerView" secondAttribute="bottom" id="jkI-2V-eW5"/>
158
- </constraints>
159
- <viewLayoutGuide key="safeArea" id="Rmq-lb-GrQ"/>
160
- </view>
161
- </viewController>
162
- <placeholder placeholderIdentifier="IBFirstResponder" id="EXPO-PLACEHOLDER-1" userLabel="First Responder" sceneMemberID="firstResponder"/>
163
- </objects>
164
- <point key="canvasLocation" x="140.625" y="129.4921875"/>
165
- </scene>
166
- </scenes>
167
- <resources>
168
- <image name="SplashScreenBackground" width="1" height="1"/>
169
- </resources>
170
- </document>`;
171
- return await new (_xml2js().Parser)().parseStringPromise(contents);
156
+ function removeExisting(array, item) {
157
+ var _item$$;
158
+
159
+ const id = typeof item === 'string' ? item : (_item$$ = item.$) === null || _item$$ === void 0 ? void 0 : _item$$.id;
160
+ const existingItem = array === null || array === void 0 ? void 0 : array.findIndex(existingItem => existingItem.$.id === id);
161
+
162
+ if (existingItem > -1) {
163
+ debug(`Removing existing IB item with id ${id}, from: %O`, array);
164
+ array.splice(existingItem, 1);
165
+ }
166
+
167
+ return array;
172
168
  } // Attempt to copy Xcode formatting.
173
169
 
174
170
 
175
171
  function toString(xml) {
176
172
  const builder = new (_xml2js().Builder)({
173
+ // @ts-expect-error: untyped
177
174
  preserveChildrenOrder: true,
178
175
  xmldec: {
179
176
  version: '1.0',
@@ -186,4 +183,10 @@ function toString(xml) {
186
183
  });
187
184
  return builder.buildObject(xml);
188
185
  }
186
+ /** Parse string contents into an object. */
187
+
188
+
189
+ function toObjectAsync(contents) {
190
+ return new (_xml2js().Parser)().parseStringPromise(contents);
191
+ }
189
192
  //# sourceMappingURL=InterfaceBuilder.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/plugins/unversioned/expo-splash-screen/InterfaceBuilder.ts"],"names":["createConstraint","firstItem","firstAttribute","secondItem","secondAttribute","$","id","createConstraintId","attributes","crypto","createHash","update","join","digest","applyImageToSplashScreenXML","xml","imageName","contentMode","imageId","containerId","width","height","imageView","userLabel","image","horizontalHuggingPriority","verticalHuggingPriority","clipsSubviews","userInteractionEnabled","translatesAutoresizingMaskIntoConstraints","rect","key","x","y","document","scenes","scene","objects","viewController","view","subviews","push","constraints","constraint","resources","name","createTemplateSplashScreenAsync","contents","Parser","parseStringPromise","toString","builder","Builder","preserveChildrenOrder","xmldec","version","encoding","renderOpts","pretty","indent","buildObject"],"mappings":";;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;AAmKA,SAASA,gBAAT,CACE,CAACC,SAAD,EAAYC,cAAZ,CADF,EAEE,CAACC,UAAD,EAAaC,eAAb,CAFF,EAGgB;A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AAQ,GAAI;AACpB;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;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,gBAzEE;AA0EA,SAAO,MAAM,KAAIC,gBAAJ,IAAaC,kBAAb,CAAgCF,QAAhC,CAAb;AACD,C,CAED;;;AACO,SAASG,QAAT,CAAkBnC,GAAlB,EAAoC;AACzC,QAAMoC,OAAO,GAAG,KAAIC,iBAAJ,EAAY;AAC1BC,IAAAA,qBAAqB,EAAE,IADG;AAE1BC,IAAAA,MAAM,EAAE;AACNC,MAAAA,OAAO,EAAE,KADH;AAENC,MAAAA,QAAQ,EAAE;AAFJ,KAFkB;AAM1BC,IAAAA,UAAU,EAAE;AACVC,MAAAA,MAAM,EAAE,IADE;AAEVC,MAAAA,MAAM,EAAE;AAFE;AANc,GAAZ,CAAhB;AAWA,SAAOR,OAAO,CAACS,WAAR,CAAoB7C,GAApB,CAAP;AACD","sourcesContent":["import crypto from 'crypto';\nimport { Builder, Parser } from 'xml2js';\n\nexport type IBBoolean = 'YES' | 'NO' | boolean;\n\nexport type IBItem<\n H extends Record<string, any>,\n B extends Record<string, any[]> = { [key: string]: any }\n> = {\n $: H;\n} & B;\n\nexport type Rect = {\n key: string;\n x: number;\n y: number;\n width: number;\n height: number;\n};\n\nexport type IBRect = IBItem<Rect>;\n\nexport type ImageContentMode = 'scaleAspectFit' | 'scaleAspectFill';\n\nexport type ConstraintAttribute = 'top' | 'bottom' | 'trailing' | 'leading';\n\nexport type IBImageView = IBItem<\n {\n id: string;\n userLabel: string;\n image: string;\n clipsSubviews?: IBBoolean;\n userInteractionEnabled: IBBoolean;\n contentMode: string | 'scaleAspectFill';\n horizontalHuggingPriority: number;\n verticalHuggingPriority: number;\n insetsLayoutMarginsFromSafeArea?: IBBoolean;\n translatesAutoresizingMaskIntoConstraints?: IBBoolean;\n },\n {\n rect: IBRect[];\n }\n>;\n\nexport type IBConstraint = IBItem<{\n firstItem: string;\n firstAttribute: ConstraintAttribute;\n secondItem: string;\n secondAttribute: ConstraintAttribute;\n id: string;\n}>;\n\nexport type IBViewController = IBItem<\n {\n id: string;\n placeholderIdentifier?: string;\n userLabel: string;\n sceneMemberID: string;\n },\n {\n view: IBItem<\n {\n id: string;\n key: string;\n userInteractionEnabled: IBBoolean;\n contentMode: string | 'scaleToFill';\n insetsLayoutMarginsFromSafeArea: IBBoolean;\n userLabel: string;\n },\n {\n rect: IBRect[];\n autoresizingMask: IBItem<{\n key: string;\n flexibleMaxX: IBBoolean;\n flexibleMaxY: IBBoolean;\n }>[];\n\n subviews: IBItem<\n object,\n {\n imageView: IBImageView[];\n }\n >[];\n color: IBItem<{\n key: string | 'backgroundColor';\n systemColor: string | 'systemBackgroundColor';\n }>[];\n constraints: IBItem<\n object,\n {\n constraint: IBConstraint[];\n }\n >[];\n viewLayoutGuide: IBItem<{\n id: string;\n key: string | 'safeArea';\n }>[];\n }\n >[];\n }\n>;\n\nexport type IBPoint = IBItem<{\n key: string | 'canvasLocation';\n x: number;\n y: number;\n}>;\n\nexport type IBScene = IBItem<\n { sceneID: string },\n {\n objects: {\n viewController: IBViewController[];\n placeholder: IBItem<{\n id: string;\n placeholderIdentifier?: string;\n userLabel: string;\n sceneMemberID: string;\n }>[];\n }[];\n point: IBPoint[];\n }\n>;\n\ntype IBResourceImage = IBItem<{\n name: string;\n width: number;\n height: number;\n}>;\n\ntype IBDevice = IBItem<{\n id: string;\n orientation: string | 'portrait';\n appearance: string | 'light';\n}>;\n\nexport type IBSplashScreenDocument = {\n document: IBItem<\n {\n type: 'com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB' | string;\n version: '3.0' | string;\n toolsVersion: number;\n targetRuntime: 'iOS.CocoaTouch' | string;\n propertyAccessControl: 'none' | string;\n useAutolayout: IBBoolean;\n launchScreen: IBBoolean;\n useTraitCollections: IBBoolean;\n useSafeAreas: IBBoolean;\n colorMatched: IBBoolean;\n initialViewController: string;\n },\n {\n device: IBDevice[];\n dependencies: unknown[];\n scenes: {\n scene: IBScene[];\n }[];\n resources: {\n image: IBResourceImage[];\n }[];\n }\n >;\n};\n\nfunction createConstraint(\n [firstItem, firstAttribute]: [string, ConstraintAttribute],\n [secondItem, secondAttribute]: [string, ConstraintAttribute]\n): IBConstraint {\n return {\n $: {\n firstItem,\n firstAttribute,\n secondItem,\n secondAttribute,\n // Prevent updating between runs\n id: createConstraintId(firstItem, firstAttribute, secondItem, secondAttribute),\n },\n };\n}\n\nfunction createConstraintId(...attributes: string[]) {\n return crypto.createHash('sha1').update(attributes.join('-')).digest('hex');\n}\n\nexport function applyImageToSplashScreenXML(\n xml: IBSplashScreenDocument,\n {\n imageName,\n contentMode,\n }: {\n imageName: string;\n contentMode: ImageContentMode;\n }\n): IBSplashScreenDocument {\n const imageId = 'EXPO-SplashScreen';\n const containerId = 'EXPO-ContainerView';\n const width = 414;\n const height = 736;\n\n const imageView: IBImageView = {\n $: {\n id: imageId,\n userLabel: imageName,\n image: imageName,\n contentMode,\n horizontalHuggingPriority: 251,\n verticalHuggingPriority: 251,\n clipsSubviews: true,\n userInteractionEnabled: false,\n translatesAutoresizingMaskIntoConstraints: false,\n },\n rect: [\n {\n $: {\n key: 'frame',\n x: 0.0,\n y: 0.0,\n width,\n height,\n },\n },\n ],\n };\n\n // Add ImageView\n xml.document.scenes[0].scene[0].objects[0].viewController[0].view[0].subviews[0].imageView.push(\n imageView\n );\n\n // Add Constraints\n xml.document.scenes[0].scene[0].objects[0].viewController[0].view[0].constraints[0].constraint.push(\n // <constraint firstItem=\"EXPO-SplashScreen\" firstAttribute=\"top\" secondItem=\"EXPO-ContainerView\" secondAttribute=\"top\" id=\"2VS-Uz-0LU\"/>\n createConstraint([imageId, 'top'], [containerId, 'top']),\n createConstraint([imageId, 'leading'], [containerId, 'leading']),\n createConstraint([imageId, 'trailing'], [containerId, 'trailing']),\n createConstraint([imageId, 'bottom'], [containerId, 'bottom'])\n );\n\n // Add resource\n xml.document.resources[0].image.push({\n // <image name=\"SplashScreen\" width=\"414\" height=\"736\"/>\n $: {\n name: imageName,\n width,\n height,\n },\n });\n\n return xml;\n}\n\nexport async function createTemplateSplashScreenAsync(): Promise<IBSplashScreenDocument> {\n const contents = `<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n <document\n type=\"com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB\"\n version=\"3.0\"\n toolsVersion=\"16096\"\n targetRuntime=\"iOS.CocoaTouch\"\n propertyAccessControl=\"none\"\n useAutolayout=\"YES\"\n launchScreen=\"YES\"\n useTraitCollections=\"YES\"\n useSafeAreas=\"YES\"\n colorMatched=\"YES\"\n initialViewController=\"EXPO-VIEWCONTROLLER-1\"\n >\n <device id=\"retina5_5\" orientation=\"portrait\" appearance=\"light\"/>\n <dependencies>\n <deployment identifier=\"iOS\"/>\n <plugIn identifier=\"com.apple.InterfaceBuilder.IBCocoaTouchPlugin\" version=\"16087\"/>\n <capability name=\"Safe area layout guides\" minToolsVersion=\"9.0\"/>\n <capability name=\"documents saved in the Xcode 8 format\" minToolsVersion=\"8.0\"/>\n </dependencies>\n <scenes>\n <!--View Controller-->\n <scene sceneID=\"EXPO-SCENE-1\">\n <objects>\n <viewController\n storyboardIdentifier=\"SplashScreenViewController\"\n id=\"EXPO-VIEWCONTROLLER-1\"\n sceneMemberID=\"viewController\"\n >\n <view\n key=\"view\"\n userInteractionEnabled=\"NO\"\n contentMode=\"scaleToFill\"\n insetsLayoutMarginsFromSafeArea=\"NO\"\n id=\"EXPO-ContainerView\"\n userLabel=\"ContainerView\"\n >\n <rect key=\"frame\" x=\"0.0\" y=\"0.0\" width=\"414\" height=\"736\"/>\n <autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>\n <subviews>\n <imageView\n userInteractionEnabled=\"NO\"\n contentMode=\"scaleAspectFill\"\n horizontalHuggingPriority=\"251\"\n verticalHuggingPriority=\"251\"\n insetsLayoutMarginsFromSafeArea=\"NO\"\n image=\"SplashScreenBackground\"\n translatesAutoresizingMaskIntoConstraints=\"NO\"\n id=\"EXPO-SplashScreenBackground\"\n userLabel=\"SplashScreenBackground\"\n >\n <rect key=\"frame\" x=\"0.0\" y=\"0.0\" width=\"414\" height=\"736\"/>\n </imageView>\n </subviews>\n <color key=\"backgroundColor\" systemColor=\"systemBackgroundColor\"/>\n <constraints>\n <constraint firstItem=\"EXPO-SplashScreenBackground\" firstAttribute=\"top\" secondItem=\"EXPO-ContainerView\" secondAttribute=\"top\" id=\"1gX-mQ-vu6\"/>\n <constraint firstItem=\"EXPO-SplashScreenBackground\" firstAttribute=\"leading\" secondItem=\"EXPO-ContainerView\" secondAttribute=\"leading\" id=\"6tX-OG-Sck\"/>\n <constraint firstItem=\"EXPO-SplashScreenBackground\" firstAttribute=\"trailing\" secondItem=\"EXPO-ContainerView\" secondAttribute=\"trailing\" id=\"ABX-8g-7v4\"/>\n <constraint firstItem=\"EXPO-SplashScreenBackground\" firstAttribute=\"bottom\" secondItem=\"EXPO-ContainerView\" secondAttribute=\"bottom\" id=\"jkI-2V-eW5\"/>\n </constraints>\n <viewLayoutGuide key=\"safeArea\" id=\"Rmq-lb-GrQ\"/>\n </view>\n </viewController>\n <placeholder placeholderIdentifier=\"IBFirstResponder\" id=\"EXPO-PLACEHOLDER-1\" userLabel=\"First Responder\" sceneMemberID=\"firstResponder\"/>\n </objects>\n <point key=\"canvasLocation\" x=\"140.625\" y=\"129.4921875\"/>\n </scene>\n </scenes>\n <resources>\n <image name=\"SplashScreenBackground\" width=\"1\" height=\"1\"/>\n </resources>\n </document>`;\n return await new Parser().parseStringPromise(contents);\n}\n\n// Attempt to copy Xcode formatting.\nexport function toString(xml: any): string {\n const builder = new Builder({\n preserveChildrenOrder: true,\n xmldec: {\n version: '1.0',\n encoding: 'UTF-8',\n },\n renderOpts: {\n pretty: true,\n indent: ' ',\n },\n });\n return builder.buildObject(xml);\n}\n"],"file":"InterfaceBuilder.js"}
1
+ {"version":3,"file":"InterfaceBuilder.js","names":["debug","require","createConstraint","firstItem","firstAttribute","secondItem","secondAttribute","constant","$","id","createConstraintId","attributes","crypto","createHash","update","join","digest","IMAGE_ID","CONTAINER_ID","removeImageFromSplashScreen","xml","imageName","mainView","document","scenes","scene","objects","viewController","view","removeExisting","subviews","imageView","getAbsoluteConstraints","forEach","constraint","constrainsArray","constraints","imageSection","resources","image","existingImageIndex","findIndex","name","splice","childId","parentId","applyImageToSplashScreenXML","contentMode","width","height","userLabel","horizontalHuggingPriority","verticalHuggingPriority","clipsSubviews","userInteractionEnabled","translatesAutoresizingMaskIntoConstraints","rect","key","x","y","ensureUniquePush","push","array","item","existingItem","toString","builder","Builder","preserveChildrenOrder","xmldec","version","encoding","renderOpts","pretty","indent","buildObject","toObjectAsync","contents","Parser","parseStringPromise"],"sources":["../../../../src/plugins/unversioned/expo-splash-screen/InterfaceBuilder.ts"],"sourcesContent":["import crypto from 'crypto';\nimport { Builder, Parser } from 'xml2js';\n\nconst debug = require('debug')(\n 'expo:prebuild-config:expo-splash-screen:ios:InterfaceBuilder'\n) as typeof console.log;\n\nexport type IBBoolean = 'YES' | 'NO' | boolean;\n\nexport type IBItem<\n H extends Record<string, any>,\n B extends Record<string, any[]> = { [key: string]: any }\n> = {\n $: H;\n} & B;\n\nexport type Rect = {\n key: string;\n x: number;\n y: number;\n width: number;\n height: number;\n};\n\nexport type IBRect = IBItem<Rect>;\n\nexport type IBAutoresizingMask = IBItem<{\n /** @example `autoresizingMask` */\n key: string;\n flexibleMaxX: IBBoolean;\n flexibleMaxY: IBBoolean;\n}>;\n\n/** @example `<color key=\"textColor\" systemColor=\"linkColor\"/>` */\nexport type IBColor = IBItem<\n {\n /** @example `textColor` */\n key: string;\n } & (\n | /** Custom color */\n {\n /** @example `0.86584504117670746` */\n red: number;\n /** @example `0.26445041990630447` */\n green: number;\n /** @example `0.3248577810203549` */\n blue: number;\n /** @example `1` */\n alpha: number;\n colorSpace: 'custom' | string;\n customColorSpace: 'displayP3' | 'sRGB' | string;\n }\n /** Built-in color */\n | {\n systemColor: 'linkColor' | string;\n }\n )\n>;\n\nexport type IBFontDescription = IBItem<{\n /** @example `fontDescription` */\n key: string;\n /** Font size */\n pointSize: number;\n\n /** Custom font */\n name?: 'HelveticaNeue' | string;\n family?: 'Helvetica Neue' | string;\n\n /** Built-in font */\n type?: 'system' | 'boldSystem' | 'UICTFontTextStyleCallout' | 'UICTFontTextStyleBody' | string;\n}>;\n\nexport type ImageContentMode = 'scaleAspectFit' | 'scaleAspectFill';\n\nexport type ConstraintAttribute = 'top' | 'bottom' | 'trailing' | 'leading';\n\nexport type IBImageView = IBItem<\n {\n id: string;\n userLabel: string;\n image: string;\n clipsSubviews?: IBBoolean;\n userInteractionEnabled: IBBoolean;\n contentMode: IBContentMode;\n horizontalHuggingPriority: number;\n verticalHuggingPriority: number;\n insetsLayoutMarginsFromSafeArea?: IBBoolean;\n translatesAutoresizingMaskIntoConstraints?: IBBoolean;\n },\n {\n rect: IBRect[];\n }\n>;\n\nexport type IBLabel = IBItem<\n {\n id: string;\n /** The main value. */\n text: string;\n\n opaque: IBBoolean;\n fixedFrame: IBBoolean;\n textAlignment?: IBTextAlignment;\n lineBreakMode:\n | 'clip'\n | 'characterWrap'\n | 'wordWrap'\n | 'headTruncation'\n | 'middleTruncation'\n | 'tailTruncation';\n baselineAdjustment?: 'none' | 'alignBaselines';\n adjustsFontSizeToFit: IBBoolean;\n userInteractionEnabled: IBBoolean;\n contentMode: IBContentMode;\n horizontalHuggingPriority: number;\n verticalHuggingPriority: number;\n translatesAutoresizingMaskIntoConstraints?: IBBoolean;\n },\n {\n /** @example `<rect key=\"frame\" x=\"175\" y=\"670\" width=\"35\" height=\"17\"/>` */\n rect: IBRect[];\n /** @example `<autoresizingMask key=\"autoresizingMask\" flexibleMaxX=\"YES\" flexibleMaxY=\"YES\"/>` */\n autoresizingMask?: IBAutoresizingMask[];\n /** @example `<fontDescription key=\"fontDescription\" type=\"system\" pointSize=\"19\"/>` */\n fontDescription?: IBFontDescription[];\n /** @example `<color key=\"textColor\" red=\"0.0\" green=\"0.0\" blue=\"0.0\" alpha=\"1\" colorSpace=\"custom\" customColorSpace=\"sRGB\"/>` */\n color?: IBColor[];\n nil?: IBItem<{\n /** @example `textColor` `highlightedColor` */\n key: string;\n }>[];\n }\n>;\n\nexport type IBTextAlignment = 'left' | 'center' | 'right' | 'justified' | 'natural';\n\nexport type IBContentMode = string | 'left' | 'scaleAspectFill';\n\nexport type IBConstraint = IBItem<{\n firstItem: string;\n firstAttribute: ConstraintAttribute;\n secondItem: string;\n secondAttribute: ConstraintAttribute;\n constant?: number;\n id: string;\n}>;\n\nexport type IBViewController = IBItem<\n {\n id: string;\n placeholderIdentifier?: string;\n userLabel: string;\n sceneMemberID: string;\n },\n {\n view: IBItem<\n {\n id: string;\n key: string;\n userInteractionEnabled: IBBoolean;\n contentMode: string | 'scaleToFill';\n insetsLayoutMarginsFromSafeArea: IBBoolean;\n userLabel: string;\n },\n {\n rect: IBRect[];\n autoresizingMask: IBItem<{\n key: string;\n flexibleMaxX: IBBoolean;\n flexibleMaxY: IBBoolean;\n }>[];\n\n subviews: IBItem<\n object,\n {\n imageView: IBImageView[];\n label: IBLabel[];\n }\n >[];\n color: IBItem<{\n key: string | 'backgroundColor';\n systemColor: string | 'systemBackgroundColor';\n }>[];\n constraints: IBItem<\n object,\n {\n constraint: IBConstraint[];\n }\n >[];\n viewLayoutGuide: IBItem<{\n id: string;\n key: string | 'safeArea';\n }>[];\n }\n >[];\n }\n>;\n\nexport type IBPoint = IBItem<{\n key: string | 'canvasLocation';\n x: number;\n y: number;\n}>;\n\nexport type IBScene = IBItem<\n { sceneID: string },\n {\n objects: {\n viewController: IBViewController[];\n placeholder: IBItem<{\n id: string;\n placeholderIdentifier?: string;\n userLabel: string;\n sceneMemberID: string;\n }>[];\n }[];\n point: IBPoint[];\n }\n>;\n\nexport type IBResourceImage = IBItem<{\n name: string;\n width: number;\n height: number;\n}>;\n\nexport type IBDevice = IBItem<{\n id: string;\n orientation: string | 'portrait';\n appearance: string | 'light';\n}>;\n\nexport type IBSplashScreenDocument = {\n document: IBItem<\n {\n type: 'com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB' | string;\n version: '3.0' | string;\n toolsVersion: number;\n targetRuntime: 'iOS.CocoaTouch' | string;\n propertyAccessControl: 'none' | string;\n useAutolayout: IBBoolean;\n launchScreen: IBBoolean;\n useTraitCollections: IBBoolean;\n useSafeAreas: IBBoolean;\n colorMatched: IBBoolean;\n initialViewController: string;\n },\n {\n device: IBDevice[];\n dependencies: unknown[];\n scenes: {\n scene: IBScene[];\n }[];\n resources: {\n image: IBResourceImage[];\n }[];\n }\n >;\n};\n\nexport function createConstraint(\n [firstItem, firstAttribute]: [string, ConstraintAttribute],\n [secondItem, secondAttribute]: [string, ConstraintAttribute],\n constant?: number\n): IBConstraint {\n return {\n $: {\n firstItem,\n firstAttribute,\n secondItem,\n secondAttribute,\n constant,\n // Prevent updating between runs\n id: createConstraintId(firstItem, firstAttribute, secondItem, secondAttribute),\n },\n };\n}\n\nexport function createConstraintId(...attributes: string[]) {\n return crypto.createHash('sha1').update(attributes.join('-')).digest('hex');\n}\n\nconst IMAGE_ID = 'EXPO-SplashScreen';\nconst CONTAINER_ID = 'EXPO-ContainerView';\n\nexport function removeImageFromSplashScreen(\n xml: IBSplashScreenDocument,\n { imageName }: { imageName: string }\n) {\n const mainView = xml.document.scenes[0].scene[0].objects[0].viewController[0].view[0];\n\n debug(`Remove all splash screen image elements`);\n\n removeExisting(mainView.subviews[0].imageView, IMAGE_ID);\n\n // Add Constraints\n getAbsoluteConstraints(IMAGE_ID, CONTAINER_ID).forEach((constraint) => {\n // <constraint firstItem=\"EXPO-SplashScreen\" firstAttribute=\"top\" secondItem=\"EXPO-ContainerView\" secondAttribute=\"top\" id=\"2VS-Uz-0LU\"/>\n const constrainsArray = mainView.constraints[0].constraint;\n removeExisting(constrainsArray, constraint);\n });\n\n // Add resource\n const imageSection = xml.document.resources[0].image;\n\n const existingImageIndex = imageSection.findIndex((image) => image.$.name === imageName);\n if (existingImageIndex > -1) {\n imageSection.splice(existingImageIndex, 1);\n }\n return xml;\n}\n\nfunction getAbsoluteConstraints(childId: string, parentId: string) {\n return [\n createConstraint([childId, 'top'], [parentId, 'top']),\n createConstraint([childId, 'leading'], [parentId, 'leading']),\n createConstraint([childId, 'trailing'], [parentId, 'trailing']),\n createConstraint([childId, 'bottom'], [parentId, 'bottom']),\n ];\n}\n\nexport function applyImageToSplashScreenXML(\n xml: IBSplashScreenDocument,\n {\n imageName,\n contentMode,\n }: {\n imageName: string;\n contentMode: ImageContentMode;\n }\n): IBSplashScreenDocument {\n const width = 414;\n const height = 736;\n\n const imageView: IBImageView = {\n $: {\n id: IMAGE_ID,\n userLabel: imageName,\n image: imageName,\n contentMode,\n horizontalHuggingPriority: 251,\n verticalHuggingPriority: 251,\n clipsSubviews: true,\n userInteractionEnabled: false,\n translatesAutoresizingMaskIntoConstraints: false,\n },\n rect: [\n {\n $: {\n key: 'frame',\n x: 0.0,\n y: 0.0,\n width,\n height,\n },\n },\n ],\n };\n\n const mainView = xml.document.scenes[0].scene[0].objects[0].viewController[0].view[0];\n\n // Add ImageView\n ensureUniquePush(mainView.subviews[0].imageView, imageView);\n\n // Add Constraints\n getAbsoluteConstraints(IMAGE_ID, CONTAINER_ID).forEach((constraint) => {\n // <constraint firstItem=\"EXPO-SplashScreen\" firstAttribute=\"top\" secondItem=\"EXPO-ContainerView\" secondAttribute=\"top\" id=\"2VS-Uz-0LU\"/>\n const constrainsArray = mainView.constraints[0].constraint;\n ensureUniquePush(constrainsArray, constraint);\n });\n\n // Add resource\n const imageSection = xml.document.resources[0].image;\n\n const existingImageIndex = imageSection.findIndex((image) => image.$.name === imageName);\n if (existingImageIndex > -1) {\n debug(`Removing existing IB image asset at index ${existingImageIndex}`);\n imageSection.splice(existingImageIndex, 1);\n }\n imageSection.push({\n // <image name=\"SplashScreen\" width=\"414\" height=\"736\"/>\n $: {\n name: imageName,\n width,\n height,\n },\n });\n\n return xml;\n}\n\n/**\n * IB does not allow two items to have the same ID.\n * This method will add an item by first removing any existing item with the same `$.id`.\n */\nexport function ensureUniquePush<TItem extends { $: { id: string } }>(array: TItem[], item: TItem) {\n if (!array) return array;\n removeExisting(array, item);\n array.push(item);\n return array;\n}\n\nexport function removeExisting<TItem extends { $: { id: string } }>(\n array: TItem[],\n item: TItem | string\n) {\n const id = typeof item === 'string' ? item : item.$?.id;\n const existingItem = array?.findIndex((existingItem) => existingItem.$.id === id);\n if (existingItem > -1) {\n debug(`Removing existing IB item with id ${id}, from: %O`, array);\n array.splice(existingItem, 1);\n }\n return array;\n}\n\n// Attempt to copy Xcode formatting.\nexport function toString(xml: any): string {\n const builder = new Builder({\n // @ts-expect-error: untyped\n preserveChildrenOrder: true,\n xmldec: {\n version: '1.0',\n encoding: 'UTF-8',\n },\n renderOpts: {\n pretty: true,\n indent: ' ',\n },\n });\n return builder.buildObject(xml);\n}\n\n/** Parse string contents into an object. */\nexport function toObjectAsync(contents: string) {\n return new Parser().parseStringPromise(contents);\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;;;AAEA,MAAMA,KAAK,GAAGC,OAAO,CAAC,OAAD,CAAP,CACZ,8DADY,CAAd;;AAkQO,SAASC,gBAAT,CACL,CAACC,SAAD,EAAYC,cAAZ,CADK,EAEL,CAACC,UAAD,EAAaC,eAAb,CAFK,EAGLC,QAHK,EAIS;EAC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o-splash-screen.ts"],"names":["packageName","fallback","withAndroidSplashScreen","withIosSplashScreen"],"mappings":";;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;eAEe,8CAAmB;AAChCA,EAAAA,WAAW,EAAE,oBADmB;AAEhCC,EAAAA,QAAQ,EAAE,CAACC,kDAAD,EAA0BC,0CAA1B;AAFsB,CAAnB,C","sourcesContent":["import { createLegacyPlugin } from '../createLegacyPlugin';\nimport { withAndroidSplashScreen } from './withAndroidSplashScreen';\nimport { withIosSplashScreen } from './withIosSplashScreen';\n\nexport default createLegacyPlugin({\n packageName: 'expo-splash-screen',\n fallback: [withAndroidSplashScreen, withIosSplashScreen],\n});\n"],"file":"expo-splash-screen.js"}
1
+ {"version":3,"file":"expo-splash-screen.js","names":["createLegacyPlugin","packageName","fallback","withAndroidSplashScreen","withIosSplashScreen"],"sources":["../../../../src/plugins/unversioned/expo-splash-screen/expo-splash-screen.ts"],"sourcesContent":["import { createLegacyPlugin } from '../createLegacyPlugin';\nimport { withAndroidSplashScreen } from './withAndroidSplashScreen';\nimport { withIosSplashScreen } from './withIosSplashScreen';\n\nexport default createLegacyPlugin({\n packageName: 'expo-splash-screen',\n fallback: [withAndroidSplashScreen, withIosSplashScreen],\n});\n"],"mappings":";;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;eAEe,IAAAA,wCAAA,EAAmB;EAChCC,WAAW,EAAE,oBADmB;EAEhCC,QAAQ,EAAE,CAACC,kDAAD,EAA0BC,0CAA1B;AAFsB,CAAnB,C"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/plugins/unversioned/expo-splash-screen/getAndroidSplashConfig.ts"],"names":["defaultResizeMode","getAndroidSplashConfig","config","android","splash","xxxhdpi","image","xxhdpi","xhdpi","hdpi","mdpi","backgroundColor","resizeMode","getAndroidDarkSplashConfig","dark","lightTheme"],"mappings":";;;;;;;AAYA,MAAMA,iBAAiB,GAAG,SAA1B;;AAEO,SAASC,sBAAT,CACLC,MADK,EAEsB;AAAA;;AAC3B;AACA;AACA,yBAAIA,MAAM,CAACC,OAAX,4CAAI,gBAAgBC,MAApB,EAA4B;AAAA;;AAC1B,UAAMA,MAAM,uBAAGF,MAAM,CAACC,OAAV,qDAAG,iBAAgBC,MAA/B;AACA,WAAO;AACLC,MAAAA,OAAO,6BAAED,MAAM,CAACC,OAAT,6DAAoBD,MAAM,CAACE,KAA3B,uCAAoC,IADtC;AAELC,MAAAA,MAAM,6BAAEH,MAAM,CAACG,MAAT,2DAAmBH,MAAM,CAACE,KAA1B,yCAAmC,IAFpC;AAGLE,MAAAA,KAAK,4BAAEJ,MAAM,CAACI,KAAT,yDAAkBJ,MAAM,CAACE,KAAzB,yCAAkC,IAHlC;AAILG,MAAAA,IAAI,2BAAEL,MAAM,CAACK,IAAT,uDAAiBL,MAAM,CAACE,KAAxB,yCAAiC,IAJhC;AAKLI,MAAAA,IAAI,2BAAEN,MAAM,CAACM,IAAT,uDAAiBN,MAAM,CAACE,KAAxB,yCAAiC,IALhC;AAMLK,MAAAA,eAAe,2BAAEP,MAAM,CAACO,eAAT,yEAA4B,IANtC;AAOLC,MAAAA,UAAU,wBAAER,MAAM,CAACQ,UAAT,mEAAuBZ;AAP5B,KAAP;AASD;;AAED,MAAIE,MAAM,CAACE,MAAX,EAAmB;AAAA;;AACjB,UAAMA,MAAM,GAAGF,MAAM,CAACE,MAAtB;AACA,WAAO;AACLC,MAAAA,OAAO,mBAAED,MAAM,CAACE,KAAT,yDAAkB,IADpB;AAELC,MAAAA,MAAM,oBAAEH,MAAM,CAACE,KAAT,2DAAkB,IAFnB;AAGLE,MAAAA,KAAK,oBAAEJ,MAAM,CAACE,KA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P;AAUD;;AAED,SAAO,IAAP;AACD","sourcesContent":["import { ExpoConfig } from '@expo/config-types';\n\nexport type SplashScreenConfig = {\n xxxhdpi: string | null;\n xxhdpi: string | null;\n xhdpi: string | null;\n hdpi: string | null;\n mdpi: string | null;\n backgroundColor: string | null;\n resizeMode: 'contain' | 'cover' | 'native';\n};\n\nconst defaultResizeMode = 'contain';\n\nexport function getAndroidSplashConfig(\n config: Pick<ExpoConfig, 'splash' | 'android'>\n): SplashScreenConfig | null {\n // Respect the splash screen object, don't mix and match across different splash screen objects\n // in case the user wants the top level splash to apply to every platform except android.\n if (config.android?.splash) {\n const splash = config.android?.splash;\n return {\n xxxhdpi: splash.xxxhdpi ?? splash.image ?? null,\n xxhdpi: splash.xxhdpi ?? splash.image ?? null,\n xhdpi: splash.xhdpi ?? splash.image ?? null,\n hdpi: splash.hdpi ?? splash.image ?? null,\n mdpi: splash.mdpi ?? splash.image ?? null,\n backgroundColor: splash.backgroundColor ?? null,\n resizeMode: splash.resizeMode ?? defaultResizeMode,\n };\n }\n\n if (config.splash) {\n const splash = config.splash;\n return {\n xxxhdpi: splash.image ?? null,\n xxhdpi: splash.image ?? null,\n xhdpi: splash.image ?? null,\n hdpi: splash.image ?? null,\n mdpi: splash.image ?? null,\n backgroundColor: splash.backgroundColor ?? null,\n resizeMode: splash.resizeMode ?? defaultResizeMode,\n };\n }\n\n return null;\n}\n\n// TODO: dark isn't supported in the Expo config spec yet.\nexport function getAndroidDarkSplashConfig(\n config: Pick<ExpoConfig, 'splash' | 'android'>\n): SplashScreenConfig | null {\n // Respect the splash screen object, don't mix and match across different splash screen objects\n // in case the user wants the top level splash to apply to every platform except android.\n if (config.android?.splash?.dark) {\n const splash = config.android?.splash?.dark;\n const lightTheme = getAndroidSplashConfig(config);\n return {\n xxxhdpi: splash.xxxhdpi ?? splash.image ?? null,\n xxhdpi: splash.xxhdpi ?? splash.image ?? null,\n xhdpi: splash.xhdpi ?? splash.image ?? null,\n hdpi: splash.hdpi ?? splash.image ?? null,\n mdpi: splash.mdpi ?? splash.image ?? null,\n backgroundColor: splash.backgroundColor ?? null,\n // Can't support dark resizeMode because the resize mode is hardcoded into the MainActivity.java\n resizeMode: lightTheme?.resizeMode ?? defaultResizeMode,\n };\n }\n\n return null;\n}\n"],"file":"getAndroidSplashConfig.js"}
1
+ {"version":3,"file":"getAndroidSplashConfig.js","names":["defaultResizeMode","getAndroidSplashConfig","config","android","splash","xxxhdpi","image","xxhdpi","xhdpi","hdpi","mdpi","backgroundColor","resizeMode","getAndroidDarkSplashConfig","dark","lightTheme"],"sources":["../../../../src/plugins/unversioned/expo-splash-screen/getAndroidSplashConfig.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config-types';\n\nexport type SplashScreenConfig = {\n xxxhdpi: string | null;\n xxhdpi: string | null;\n xhdpi: string | null;\n hdpi: string | null;\n mdpi: string | null;\n backgroundColor: string | null;\n resizeMode: 'contain' | 'cover' | 'native';\n};\n\nconst defaultResizeMode = 'contain';\n\nexport function getAndroidSplashConfig(\n config: Pick<ExpoConfig, 'splash' | 'android'>\n): SplashScreenConfig | null {\n // Respect the splash screen object, don't mix and match across different splash screen objects\n // in case the user wants the top level splash to apply to every platform except android.\n if (config.android?.splash) {\n const splash = config.android?.splash;\n return {\n xxxhdpi: splash.xxxhdpi ?? splash.image ?? null,\n xxhdpi: splash.xxhdpi ?? splash.image ?? null,\n xhdpi: splash.xhdpi ?? splash.image ?? null,\n hdpi: splash.hdpi ?? splash.image ?? null,\n mdpi: splash.mdpi ?? splash.image ?? null,\n backgroundColor: splash.backgroundColor ?? null,\n resizeMode: splash.resizeMode ?? defaultResizeMode,\n };\n }\n\n if (config.splash) {\n const splash = config.splash;\n return {\n xxxhdpi: splash.image ?? null,\n xxhdpi: splash.image ?? null,\n xhdpi: splash.image ?? null,\n hdpi: splash.image ?? null,\n mdpi: splash.image ?? null,\n backgroundColor: splash.backgroundColor ?? null,\n resizeMode: splash.resizeMode ?? defaultResizeMode,\n };\n }\n\n return null;\n}\n\n// TODO: dark isn't supported in the Expo config spec yet.\nexport function getAndroidDarkSplashConfig(\n config: Pick<ExpoConfig, 'splash' | 'android'>\n): SplashScreenConfig | null {\n // Respect the splash screen object, don't mix and match across different splash screen objects\n // in case the user wants the top level splash to apply to every platform except android.\n if (config.android?.splash?.dark) {\n const splash = config.android?.splash?.dark;\n const lightTheme = getAndroidSplashConfig(config);\n return {\n xxxhdpi: splash.xxxhdpi ?? splash.image ?? null,\n xxhdpi: splash.xxhdpi ?? splash.image ?? null,\n xhdpi: splash.xhdpi ?? splash.image ?? null,\n hdpi: splash.hdpi ?? splash.image ?? null,\n mdpi: splash.mdpi ?? splash.image ?? null,\n backgroundColor: splash.backgroundColor ?? null,\n // Can't support dark resizeMode because the resize mode is hardcoded into the MainActivity.java\n resizeMode: lightTheme?.resizeMode ?? defaultResizeMode,\n };\n }\n\n return null;\n}\n"],"mappings":";;;;;;;AAYA,MAAMA,iBAAiB,GAAG,SAA1B;;AAEO,SAASC,sBAAT,CACLC,MADK,EAEsB;EAAA;;EAC3B;EACA;EACA,uBAAIA,MAAM,CAACC,OAAX,4CAAI,gBAAgBC,MAApB,EAA4B;IAAA;;IAC1B,MAAMA,MAAM,uBAAGF,MAAM,CAACC,OAAV,qDAAG,iBAAgBC,MAA/B;IACA,OAAO;MACLC,OAAO,6BAAED,MAAM,CAACC,OAAT,6DAAoBD,MAAM,CAACE,KAA3B,uCAAoC,IADtC;MAELC,MAAM,6BAAEH,MAAM,CAACG,MAAT,2DAAmBH,MAAM,CAACE,KAA1B,yCAAmC,IAFpC;MAGLE,KAAK,4BAAEJ,MAAM,CAACI,KAAT,yDAAkBJ,MAAM,CAACE,KAAzB,yCAAkC,IAHlC;MAILG,IAAI,2BAAEL,MAAM,CAACK,IAAT,uDAAiBL,MAAM,CAACE,KAAxB,yCAAiC,IAJhC;MAKLI,IAAI,2BAAEN,MAAM,CAACM,IAAT,uDAAiBN,MAAM,CAACE,KAAxB,yCAAiC,IALhC;MAML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K,IAAT,yDAAiBL,MAAM,CAACE,KAAxB,yCAAiC,IAJhC;MAKLI,IAAI,6BAAEN,MAAM,CAACM,IAAT,yDAAiBN,MAAM,CAACE,KAAxB,2CAAiC,IALhC;MAMLK,eAAe,4BAAEP,MAAM,CAACO,eAAT,2EAA4B,IANtC;MAOL;MACAC,UAAU,2BAAEG,UAAF,aAAEA,UAAF,uBAAEA,UAAU,CAAEH,UAAd,yEAA4BZ;IARjC,CAAP;EAUD;;EAED,OAAO,IAAP;AACD"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/plugins/unversioned/expo-splash-screen/getIosSplashConfig.ts"],"names":["defaultResizeMode","defaultBackgroundColor","getIosSplashConfig","config","ios","splash","image","resizeMode","backgroundColor","tabletImage","tabletBackgroundColor","dark","warnUnsupportedSplashProperties","xib","WarningAggregator","addWarningIOS"],"mappings":";;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAKA,MAAMA,iBAAiB,GAAG,SAA1B;AACA,MAAMC,sBAAsB,GAAG,SAA/B;;AAkBA;AACO,SAASC,kBAAT,CAA4BC,MAA5B,EAAwE;AAAA;;AAC7E;AACA;AACA,qBAAIA,MAAM,CAACC,GAAX,wCAAI,YAAYC,MAAhB,EAAwB;AAAA;;AACtB,UAAMA,MAAM,mBAAGF,MAAM,CAACC,GAAV,iDAAG,aAAYC,MAA3B;AACA,UAAMC,KAAK,oBAAGD,MAAM,CAACC,KAAV,yDAAmB,IAA9B;AACA,WAAO;AACLA,MAAAA,KADK;AAELC,MAAAA,UAAU,wBAAEF,MAAM,CAACE,UAAT,mEAAuBP,iBAF5B;AAGLQ,MAAAA,eAAe,2BAAEH,MAAM,CAACG,eAAT,yEAA4BP,sBAHtC;AAILQ,MAAAA,WAAW,yBAAEJ,MAAM,CAACI,WAAT,qEAAwB,IAJ9B;AAKLC,MAAAA,qBAAqB,EAAEL,MAAM,CAACK,qBALzB;AAMLC,MAAAA,IAAI,EAAE;AACJL,QAA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ator } from '@expo/config-plugins';\nimport { ExpoConfig } from '@expo/config-types';\n\ntype ExpoConfigIosSplash = NonNullable<NonNullable<ExpoConfig['ios']>['splash']>;\n\nconst defaultResizeMode = 'contain';\nconst defaultBackgroundColor = '#ffffff';\n\nexport interface IOSSplashConfig {\n image?: string | null;\n // tabletImage: string | null;\n backgroundColor: string;\n resizeMode: NonNullable<ExpoConfigIosSplash['resizeMode']>;\n tabletImage: string | null;\n // TODO: These are here just to test the functionality, the API should be more robust and account for tablet images.\n tabletBackgroundColor: string | null;\n dark?: {\n image?: string | null;\n backgroundColor?: string | null;\n tabletImage?: string | null;\n tabletBackgroundColor?: string | null;\n };\n}\n\n// TODO: Maybe use an array on splash with theme value. Then remove the array in serialization for legacy and manifest.\nexport function getIosSplashConfig(config: ExpoConfig): IOSSplashConfig | null {\n // Respect the splash screen object, don't mix and match across different splash screen objects\n // in case the user wants the top level splash to apply to every platform except iOS.\n if (config.ios?.splash) {\n const splash = config.ios?.splash;\n const image = splash.image ?? null;\n return {\n image,\n resizeMode: splash.resizeMode ?? defaultResizeMode,\n backgroundColor: splash.backgroundColor ?? defaultBackgroundColor,\n tabletImage: splash.tabletImage ?? null,\n tabletBackgroundColor: splash.tabletBackgroundColor,\n dark: {\n image: splash.dark?.image ?? null,\n backgroundColor: splash.dark?.backgroundColor,\n tabletImage: splash.dark?.tabletImage ?? null,\n tabletBackgroundColor: splash.dark?.tabletBackgroundColor,\n },\n };\n }\n\n if (config.splash) {\n const splash = config.splash;\n const image = splash.image ?? null;\n return {\n image,\n resizeMode: splash.resizeMode ?? defaultResizeMode,\n backgroundColor: splash.backgroundColor ?? defaultBackgroundColor,\n tabletImage: null,\n tabletBackgroundColor: null,\n dark: {\n image: null,\n backgroundColor: null,\n tabletImage: null,\n tabletBackgroundColor: null,\n },\n };\n }\n\n return {\n backgroundColor: '#ffffff',\n resizeMode: 'contain',\n tabletImage: null,\n tabletBackgroundColor: null,\n };\n}\n\nexport function warnUnsupportedSplashProperties(config: ExpoConfig) {\n if (config.ios?.splash?.xib) {\n WarningAggregator.addWarningIOS(\n 'ios.splash.xib',\n 'property is not supported in prebuild. Please use ios.splash.image instead.'\n );\n }\n}\n"],"file":"getIosSplashConfig.js"}
1
+ {"version":3,"file":"getIosSplashConfig.js","names":["defaultResizeMode","defaultBackgroundColor","getIosSplashConfig","config","ios","splash","image","resizeMode","backgroundColor","tabletImage","tabletBackgroundColor","dark","warnUnsupportedSplashProperties","xib","WarningAggregator","addWarningIOS"],"sources":["../../../../src/plugins/unversioned/expo-splash-screen/getIosSplashConfig.ts"],"sourcesContent":["import { WarningAggregator } from '@expo/config-plugins';\nimport { ExpoConfig } from '@expo/config-types';\n\ntype ExpoConfigIosSplash = NonNullable<NonNullable<ExpoConfig['ios']>['splash']>;\n\nconst defaultResizeMode = 'contain';\nconst defaultBackgroundColor = '#ffffff';\n\nexport interface IOSSplashConfig {\n image?: string | null;\n // tabletImage: string | null;\n backgroundColor: string;\n resizeMode: NonNullable<ExpoConfigIosSplash['resizeMode']>;\n tabletImage: string | null;\n // TODO: These are here just to test the functionality, the API should be more robust and account for tablet images.\n tabletBackgroundColor: string | null;\n dark?: {\n image?: string | null;\n backgroundColor?: string | null;\n tabletImage?: string | null;\n tabletBackgroundColor?: string | null;\n };\n}\n\n// TODO: Maybe use an array on splash with theme value. Then remove the array in serialization for legacy and manifest.\nexport function getIosSplashConfig(config: ExpoConfig): IOSSplashConfig | null {\n // Respect the splash screen object, don't mix and match across different splash screen objects\n // in case the user wants the top level splash to apply to every platform except iOS.\n if (config.ios?.splash) {\n const splash = config.ios?.splash;\n const image = splash.image ?? null;\n return {\n image,\n resizeMode: splash.resizeMode ?? defaultResizeMode,\n backgroundColor: splash.backgroundColor ?? defaultBackgroundColor,\n tabletImage: splash.tabletImage ?? null,\n tabletBackgroundColor: splash.tabletBackgroundColor,\n dark: {\n image: splash.dark?.image ?? null,\n backgroundColor: splash.dark?.backgroundColor,\n tabletImage: splash.dark?.tabletImage ?? null,\n tabletBackgroundColor: splash.dark?.tabletBackgroundColor,\n },\n };\n }\n\n if (config.splash) {\n const splash = config.splash;\n const image = splash.image ?? null;\n return {\n image,\n resizeMode: splash.resizeMode ?? defaultResizeMode,\n backgroundColor: splash.backgroundColor ?? defaultBackgroundColor,\n tabletImage: null,\n tabletBackgroundColor: null,\n dark: {\n image: null,\n backgroundColor: null,\n tabletImage: null,\n tabletBackgroundColor: null,\n },\n };\n }\n\n return {\n backgroundColor: '#ffffff',\n resizeMode: 'contain',\n tabletImage: null,\n tabletBackgroundColor: null,\n };\n}\n\nexport function warnUnsupportedSplashProperties(config: ExpoConfig) {\n if (config.ios?.splash?.xib) {\n WarningAggregator.addWarningIOS(\n 'ios.splash.xib',\n 'property is not supported in prebuild. Please use ios.splash.image instead.'\n );\n }\n}\n"],"mappings":";;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAKA,MAAMA,iBAAiB,GAAG,SAA1B;AACA,MAAMC,sBAAsB,GAAG,SAA/B;;AAkBA;AACO,SAASC,kBAAT,CAA4BC,MAA5B,EAAwE;EAAA;;EAC7E;EACA;EACA,mBAAIA,MAAM,CAACC,GAAX,wCAAI,YAAYC,MAAhB,EAAwB;IAAA;;IACtB,MAAMA,MAAM,mBAAGF,MAAM,CAACC,GAAV,iDAAG,aAAYC,MAA3B;IACA,MAAMC,KAAK,oBAAGD,MAAM,CAACC,KAAV,yDAAmB,IAA9B;IACA,OAAO;MACLA,KADK;MAELC,UAAU,wBAAEF,MAAM,CAACE,UAAT,mEAAuBP,iBAF5B;MAGLQ,eAAe,2BAAEH,MAAM,CAACG,eAAT,yEAA4BP,sBAHtC;MAILQ,WAAW,yBAAEJ,MAAM,CAACI,WAAT,qEAAwB,IAJ9B;MAKLC,qBAAqB,EAAEL,MAAM,CAACK,qBALzB;MAMLC,IAAI,EAAE;QACJL,KAAK,wCAAED,MAAM,CAACM,IAAT,iDAAE,aAAaL,KAAf,mEAAwB,IADzB;QAEJE,eAAe,mBAAEH,MAAM,CAACM,IAAT,kDAAE,cAAaH,eAF1B;QAGJC,WAAW,4CAAEJ,MAAM,CAACM,IAAT,kDAAE,cAAaF,WAAf,yEAA8B,IAHrC;QAIJC,qBAAqB,mBAAEL,MAAM,CAACM,IAAT,kDAAE,cAAaD;MAJhC;IAND,CAAP;EAaD;;EAED,IAAIP,MAAM,CAACE,MAAX,EAAmB;IAAA;;IACjB,MAAMA,MAAM,GAAGF,MAAM,CAACE,MAAtB;IACA,MAAMC,KAAK,qBAAGD,MAAM,CAACC,KAAV,2DAAmB,IAA9B;IACA,OAAO;MACLA,KADK;MAELC,UAAU,yBAAEF,MAAM,CAACE,UAAT,qEAAuBP,iBAF5B;MAGLQ,eAAe,4BAAEH,MAAM,CAACG,eAAT,2EAA4BP,sBAHtC;MAILQ,WAAW,EAAE,IAJR;MAKLC,qBAAqB,EAAE,IALlB;MAMLC,IAAI,EAAE;QACJL,KAAK,EAAE,IADH;QAEJE,eAAe,EAAE,IAFb;QAGJC,WAAW,EAAE,IAHT;QAIJC,qBAAqB,EAAE;MAJnB;IAND,CAAP;EAaD;;EAED,OAAO;IACLF,eAAe,EAAE,SADZ;IAELD,UAAU,EAAE,SAFP;IAGLE,WAAW,EAAE,IAHR;IAILC,qBAAqB,EAAE;EAJlB,CAAP;AAMD;;AAEM,SAASE,+BAAT,CAAyCT,MAAzC,EAA6D;EAAA;;EAClE,oBAAIA,MAAM,CAACC,GAAX,gEAAI,aAAYC,MAAhB,gDAAI,oBAAoBQ,GAAxB,EAA6B;IAC3BC,kCAAA,CAAkBC,aAAlB,CACE,gBADF,EAEE,6EAFF;EAID;AACF"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/plugins/unversioned/expo-splash-screen/withAndroidSplashDrawables.ts"],"names":["withAndroidSplashDrawables","config","splash","setSplashDrawableAsync","modRequest","projectRoot","resizeMode","filePath","AndroidConfig","Paths","getResourceXMLPathAsync","name","kind","xmlContent","$","item","bitmap","filter","Boolean","XML","writeXMLAsync","path","xml"],"mappings":";;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAIO,MAAMA,0BAAgF,GAAG,CAC9FC,MAD8F,EAE9FC,MAF8F,KAG3F;AACH,SAAO,uCAAiBD,MAAjB,EAAyB,CAC9B,SAD8B,EAE9B,MAAMA,MAAN,IAAgB;AACd,QAAIC,MAAJ,EAAY;AACV,YAAMC,sBAAsB,CAACD,MAAD,EAASD,MAAM,CAACG,UAAP,CAAkBC,WAA3B,CAA5B;AACD;;AACD,WAAOJ,MAAP;AACD,GAP6B,CAAzB,CAAP;AASD,CAbM;;;;AAeA,eAAeE,sBAAf,CACL;AAAEG,EAAAA;AAAF,CADK,EAELD,WAFK,EAGL;AACA,QAAME,QAAQ,GAAI,MAAMC,+BAAcC,KAAd,CAAoBC,uBAApB,CAA4CL,WAA5C,EAAyD;AAC/EM,IAAAA,IAAI,EAAE,cADyE;AAE/EC,IAAAA,IAAI,EAAE;AAFyE,GAAzD,CAAxB,CADA,CAMA;;AACA,QAAMC,UAAU,GAAG;AACjB,kBAAc;AACZC,MAAAA,CAAC,EAAE;AACD,yBAAiB;AADhB,OADS;AAIZC,MAAAA,IAAI,EAAE,CACJ;AACED,QAAAA,CAAC,EAAE;AACD;AACA,8BAAoB;AAFnB;AADL,OADI,EAOJ;AACAR,MAAAA,UAAU,KAAK,QAAf,IAA2B;AACzBU,QAAAA,MAAM,EAAE,CACN;AACEF,UAAAA,CAAC,EAAE;AACD,+BAAmB,QADlB;AAED;AACA,2BAAe;AAHd;AADL,SADM;AADiB,OARvB,EAmBJG,MAnBI,CAmBGC,OAnBH;AAJM;AADG,GAAnB;AA2BA,QAAMC,qBAAIC,aAAJ,CAAkB;AAAEC,IAAAA,IAAI,EAAEd,QAAR;AAAkBe,IAAAA,GAAG,EAAET;AAAvB,GAAlB,CAAN;AACD","sourcesContent":["import { AndroidConfig, ConfigPlugin, withDangerousMod, XML } from '@expo/config-plugins';\n\nimport { SplashScreenConfig } from './getAndroidSplashConfig';\n\nexport const withAndroidSplashDrawables: ConfigPlugin<Pick<SplashScreenConfig, 'resizeMode'>> = (\n config,\n splash\n) => {\n return withDangerousMod(config, [\n 'android',\n async config => {\n if (splash) {\n await setSplashDrawableAsync(splash, config.modRequest.projectRoot);\n }\n return config;\n },\n ]);\n};\n\nexport async function setSplashDrawableAsync(\n { resizeMode }: Pick<SplashScreenConfig, 'resizeMode'>,\n projectRoot: string\n) {\n const filePath = (await AndroidConfig.Paths.getResourceXMLPathAsync(projectRoot, {\n name: 'splashscreen',\n kind: 'drawable',\n }))!;\n\n // Nuke and rewrite the splashscreen.xml drawable\n const xmlContent = {\n 'layer-list': {\n $: {\n 'xmlns:android': 'http://schemas.android.com/apk/res/android',\n },\n item: [\n {\n $: {\n // TODO: Ensure these keys don't get out of sync\n 'android:drawable': '@color/splashscreen_background',\n },\n },\n // Only include the image if resizeMode native is in-use.\n resizeMode === 'native' && {\n bitmap: [\n {\n $: {\n 'android:gravity': 'center',\n // TODO: Ensure these keys don't get out of sync\n 'android:src': '@drawable/splashscreen_image',\n },\n },\n ],\n },\n ].filter(Boolean),\n },\n };\n await XML.writeXMLAsync({ path: filePath, xml: xmlContent });\n}\n"],"file":"withAndroidSplashDrawables.js"}
1
+ {"version":3,"file":"withAndroidSplashDrawables.js","names":["withAndroidSplashDrawables","config","splash","withDangerousMod","setSplashDrawableAsync","modRequest","projectRoot","resizeMode","filePath","AndroidConfig","Paths","getResourceXMLPathAsync","name","kind","xmlContent","$","item","bitmap","filter","Boolean","XML","writeXMLAsync","path","xml"],"sources":["../../../../src/plugins/unversioned/expo-splash-screen/withAndroidSplashDrawables.ts"],"sourcesContent":["import { AndroidConfig, ConfigPlugin, withDangerousMod, XML } from '@expo/config-plugins';\n\nimport { SplashScreenConfig } from './getAndroidSplashConfig';\n\nexport const withAndroidSplashDrawables: ConfigPlugin<Pick<SplashScreenConfig, 'resizeMode'>> = (\n config,\n splash\n) => {\n return withDangerousMod(config, [\n 'android',\n async (config) => {\n if (splash) {\n await setSplashDrawableAsync(splash, config.modRequest.projectRoot);\n }\n return config;\n },\n ]);\n};\n\nexport async function setSplashDrawableAsync(\n { resizeMode }: Pick<SplashScreenConfig, 'resizeMode'>,\n projectRoot: string\n) {\n const filePath = (await AndroidConfig.Paths.getResourceXMLPathAsync(projectRoot, {\n name: 'splashscreen',\n kind: 'drawable',\n }))!;\n\n // Nuke and rewrite the splashscreen.xml drawable\n const xmlContent = {\n 'layer-list': {\n $: {\n 'xmlns:android': 'http://schemas.android.com/apk/res/android',\n },\n item: [\n {\n $: {\n // TODO: Ensure these keys don't get out of sync\n 'android:drawable': '@color/splashscreen_background',\n },\n },\n // Only include the image if resizeMode native is in-use.\n resizeMode === 'native' && {\n bitmap: [\n {\n $: {\n 'android:gravity': 'center',\n // TODO: Ensure these keys don't get out of sync\n 'android:src': '@drawable/splashscreen_image',\n },\n },\n ],\n },\n ].filter(Boolean),\n },\n };\n await XML.writeXMLAsync({ path: filePath, xml: xmlContent });\n}\n"],"mappings":";;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAIO,MAAMA,0BAAgF,GAAG,CAC9FC,MAD8F,EAE9FC,MAF8F,KAG3F;EACH,OAAO,IAAAC,iCAAA,EAAiBF,MAAjB,EAAyB,CAC9B,SAD8B,EAE9B,MAAOA,MAAP,IAAkB;IAChB,IAAIC,MAAJ,EAAY;MACV,MAAME,sBAAsB,CAACF,MAAD,EAASD,MAAM,CAACI,UAAP,CAAkBC,WAA3B,CAA5B;IACD;;IACD,OAAOL,MAAP;EACD,CAP6B,CAAzB,CAAP;AASD,CAbM;;;;AAeA,eAAeG,sBAAf,CACL;EAAEG;AAAF,CADK,EAELD,WAFK,EAGL;EACA,MAAME,QAAQ,GAAI,MAAMC,8BAAA,CAAcC,KAAd,CAAoBC,uBAApB,CAA4CL,WAA5C,EAAyD;IAC/EM,IAAI,EAAE,cADyE;IAE/EC,IAAI,EAAE;EAFyE,CAAzD,CAAxB,CADA,CAMA;;EACA,MAAMC,UAAU,GAAG;IACjB,cAAc;MACZC,CAAC,EAAE;QACD,iBAAiB;MADhB,CADS;MAIZC,IAAI,EAAE,CACJ;QACED,CAAC,EAAE;UACD;UACA,oBAAoB;QAFnB;MADL,CADI,EAOJ;MACAR,UAAU,KAAK,QAAf,IAA2B;QACzBU,MAAM,EAAE,CACN;UACEF,CAAC,EAAE;YACD,mBAAmB,QADlB;YAED;YACA,eAAe;UAHd;QADL,CADM;MADiB,CARvB,EAmBJG,MAnBI,CAmBGC,OAnBH;IAJM;EADG,CAAnB;EA2BA,MAAMC,oBAAA,CAAIC,aAAJ,CAAkB;IAAEC,IAAI,EAAEd,QAAR;IAAkBe,GAAG,EAAET;EAAvB,CAAlB,CAAN;AACD"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/plugins/unversioned/expo-splash-screen/withAndroidSplashImages.ts"],"names":["IMAGE_CACHE_NAME","SPLASH_SCREEN_FILENAME","DRAWABLES_CONFIGS","default","modes","light","path","dark","dimensionsMultiplier","mdpi","hdpi","xhdpi","xxhdpi","xxxhdpi","withAndroidSplashImages","config","setSplashImageDrawablesAsync","modRequest","projectRoot","clearAllExistingSplashImagesAsync","splash","darkSplash","Promise","all","setSplashImageDrawablesForThemeAsync","androidMainPath","join","Object","values","map","filePath","fs","pathExists","resolve","remove","theme","imageKey","image","source","cacheType","src","outputPath","folder","dirname","ensureDir","writeFile"],"mappings":";;;;;;;;;AAAA;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;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;AASA,MAAMA,gBAAgB,GAAG,gBAAzB;AACA,MAAMC,sBAAsB,GAAG,wBAA/B;AACA,MAAMC,iBASL,GAA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AAL,CAAaF,UAAb,CAAf;;AACA,YAAMV,mBAAGa,SAAH,CAAaF,MAAb,CAAN,CAfS,CAgBT;;AACA,YAAMX,mBAAGc,SAAH,CAAaJ,UAAb,EAAyBH,MAAzB,CAAN;AACD;;AACD,WAAO,IAAP;AACD,GAvBD,CADI,CAAN;AA0BD","sourcesContent":["import { ConfigPlugin, withDangerousMod } from '@expo/config-plugins';\nimport { ExpoConfig } from '@expo/config-types';\nimport { generateImageAsync } from '@expo/image-utils';\nimport fs from 'fs-extra';\nimport path from 'path';\n\nimport {\n getAndroidDarkSplashConfig,\n getAndroidSplashConfig,\n SplashScreenConfig,\n} from './getAndroidSplashConfig';\n\ntype DRAWABLE_SIZE = 'default' | 'mdpi' | 'hdpi' | 'xhdpi' | 'xxhdpi' | 'xxxhdpi';\ntype THEME = 'light' | 'dark';\n\nconst IMAGE_CACHE_NAME = 'splash-android';\nconst SPLASH_SCREEN_FILENAME = 'splashscreen_image.png';\nconst DRAWABLES_CONFIGS: {\n [key in DRAWABLE_SIZE]: {\n modes: {\n [key in THEME]: {\n path: string;\n };\n };\n dimensionsMultiplier: number;\n };\n} = {\n default: {\n modes: {\n light: {\n path: `./res/drawable/${SPLASH_SCREEN_FILENAME}`,\n },\n dark: {\n path: `./res/drawable-night/${SPLASH_SCREEN_FILENAME}`,\n },\n },\n dimensionsMultiplier: 1,\n },\n mdpi: {\n modes: {\n light: {\n path: `./res/drawable-mdpi/${SPLASH_SCREEN_FILENAME}`,\n },\n dark: {\n path: `./res/drawable-night-mdpi/${SPLASH_SCREEN_FILENAME}`,\n },\n },\n dimensionsMultiplier: 1,\n },\n hdpi: {\n modes: {\n light: {\n path: `./res/drawable-hdpi/${SPLASH_SCREEN_FILENAME}`,\n },\n dark: {\n path: `./res/drawable-night-hdpi/${SPLASH_SCREEN_FILENAME}`,\n },\n },\n dimensionsMultiplier: 1.5,\n },\n xhdpi: {\n modes: {\n light: {\n path: `./res/drawable-xhdpi/${SPLASH_SCREEN_FILENAME}`,\n },\n dark: {\n path: `./res/drawable-night-xhdpi/${SPLASH_SCREEN_FILENAME}`,\n },\n },\n dimensionsMultiplier: 2,\n },\n xxhdpi: {\n modes: {\n light: {\n path: `./res/drawable-xxhdpi/${SPLASH_SCREEN_FILENAME}`,\n },\n dark: {\n path: `./res/drawable-night-xxhdpi/${SPLASH_SCREEN_FILENAME}`,\n },\n },\n dimensionsMultiplier: 3,\n },\n xxxhdpi: {\n modes: {\n light: {\n path: `./res/drawable-xxxhdpi/${SPLASH_SCREEN_FILENAME}`,\n },\n dark: {\n path: `./res/drawable-night-xxxhdpi/${SPLASH_SCREEN_FILENAME}`,\n },\n },\n dimensionsMultiplier: 4,\n },\n};\n\nexport const withAndroidSplashImages: ConfigPlugin = config => {\n return withDangerousMod(config, [\n 'android',\n async config => {\n await setSplashImageDrawablesAsync(config, config.modRequest.projectRoot);\n return config;\n },\n ]);\n};\n\n/**\n * Deletes all previous splash_screen_images and copies new one to desired drawable directory.\n * If path isn't provided then no new image is placed in drawable directories.\n * @see https://developer.android.com/training/multiscreen/screendensities\n *\n * @param androidMainPath Absolute path to the main directory containing code and resources in Android project. In general that would be `android/app/src/main`.\n */\nexport async function setSplashImageDrawablesAsync(\n config: Pick<ExpoConfig, 'android' | 'splash'>,\n projectRoot: string\n) {\n await clearAllExistingSplashImagesAsync(projectRoot);\n\n const splash = getAndroidSplashConfig(config);\n const darkSplash = getAndroidDarkSplashConfig(config);\n\n await Promise.all([\n setSplashImageDrawablesForThemeAsync(splash, 'light', projectRoot),\n setSplashImageDrawablesForThemeAsync(darkSplash, 'dark', projectRoot),\n ]);\n}\n\nasync function clearAllExistingSplashImagesAsync(projectRoot: string) {\n const androidMainPath = path.join(projectRoot, 'android/app/src/main');\n\n await Promise.all(\n Object.values(DRAWABLES_CONFIGS).map(async ({ modes }) => {\n await Promise.all(\n Object.values(modes).map(async ({ path: filePath }) => {\n if (await fs.pathExists(path.resolve(androidMainPath, filePath))) {\n await fs.remove(path.resolve(androidMainPath, filePath));\n }\n })\n );\n })\n );\n}\n\nexport async function setSplashImageDrawablesForThemeAsync(\n config: SplashScreenConfig | null,\n theme: 'dark' | 'light',\n projectRoot: string\n) {\n if (!config) return;\n const androidMainPath = path.join(projectRoot, 'android/app/src/main');\n\n await Promise.all(\n ['mdpi', 'hdpi', 'xhdpi', 'xxhdpi', 'xxxhdpi'].map(async imageKey => {\n // @ts-ignore\n const image = config[imageKey];\n if (image) {\n // Using this method will cache the images in `.expo` based on the properties used to generate them.\n // this method also supports remote URLs and using the global sharp instance.\n const { source } = await generateImageAsync({ projectRoot, cacheType: IMAGE_CACHE_NAME }, {\n src: image,\n } as any);\n\n // Get output path for drawable.\n const outputPath = path.join(\n androidMainPath,\n // @ts-ignore\n DRAWABLES_CONFIGS[imageKey].modes[theme].path\n );\n // Ensure directory exists.\n const folder = path.dirname(outputPath);\n await fs.ensureDir(folder);\n // Write image buffer to the file system.\n await fs.writeFile(outputPath, source);\n }\n return null;\n })\n );\n}\n"],"file":"withAndroidSplashImages.js"}
1
+ {"version":3,"file":"withAndroidSplashImages.js","names":["IMAGE_CACHE_NAME","SPLASH_SCREEN_FILENAME","DRAWABLES_CONFIGS","default","modes","light","path","dark","dimensionsMultiplier","mdpi","hdpi","xhdpi","xxhdpi","xxxhdpi","withAndroidSplashImages","config","withDangerousMod","setSplashImageDrawablesAsync","modRequest","projectRoot","clearAllExistingSplashImagesAsync","splash","getAndroidSplashConfig","darkSplash","getAndroidDarkSplashConfig","Promise","all","setSplashImageDrawablesForThemeAsync","androidMainPath","join","Object","values","map","filePath","fs","pathExists","resolve","remove","theme","imageKey","image","source","generateImageAsync","cacheType","src","outputPath","folder","dirname","ensureDir","writeFile"],"sources":["../../../../src/plugins/unversioned/expo-splash-screen/withAndroidSplashImages.ts"],"sourcesContent":["import { ConfigPlugin, withDangerousMod } from '@expo/config-plugins';\nimport { ExpoConfig } from '@expo/config-types';\nimport { generateImageAsync } from '@expo/image-utils';\nimport fs from 'fs-extra';\nimport path from 'path';\n\nimport {\n getAndroidDarkSplashConfig,\n getAndroidSplashConfig,\n SplashScreenConfig,\n} from './getAndroidSplashConfig';\n\ntype DRAWABLE_SIZE = 'default' | 'mdpi' | 'hdpi' | 'xhdpi' | 'xxhdpi' | 'xxxhdpi';\ntype THEME = 'light' | 'dark';\n\nconst IMAGE_CACHE_NAME = 'splash-android';\nconst SPLASH_SCREEN_FILENAME = 'splashscreen_image.png';\nconst DRAWABLES_CONFIGS: {\n [key in DRAWABLE_SIZE]: {\n modes: {\n [key in THEME]: {\n path: string;\n };\n };\n dimensionsMultiplier: number;\n };\n} = {\n default: {\n modes: {\n light: {\n path: `./res/drawable/${SPLASH_SCREEN_FILENAME}`,\n },\n dark: {\n path: `./res/drawable-night/${SPLASH_SCREEN_FILENAME}`,\n },\n },\n dimensionsMultiplier: 1,\n },\n mdpi: {\n modes: {\n light: {\n path: `./res/drawable-mdpi/${SPLASH_SCREEN_FILENAME}`,\n },\n dark: {\n path: `./res/drawable-night-mdpi/${SPLASH_SCREEN_FILENAME}`,\n },\n },\n dimensionsMultiplier: 1,\n },\n hdpi: {\n modes: {\n light: {\n path: `./res/drawable-hdpi/${SPLASH_SCREEN_FILENAME}`,\n },\n dark: {\n path: `./res/drawable-night-hdpi/${SPLASH_SCREEN_FILENAME}`,\n },\n },\n dimensionsMultiplier: 1.5,\n },\n xhdpi: {\n modes: {\n light: {\n path: `./res/drawable-xhdpi/${SPLASH_SCREEN_FILENAME}`,\n },\n dark: {\n path: `./res/drawable-night-xhdpi/${SPLASH_SCREEN_FILENAME}`,\n },\n },\n dimensionsMultiplier: 2,\n },\n xxhdpi: {\n modes: {\n light: {\n path: `./res/drawable-xxhdpi/${SPLASH_SCREEN_FILENAME}`,\n },\n dark: {\n path: `./res/drawable-night-xxhdpi/${SPLASH_SCREEN_FILENAME}`,\n },\n },\n dimensionsMultiplier: 3,\n },\n xxxhdpi: {\n modes: {\n light: {\n path: `./res/drawable-xxxhdpi/${SPLASH_SCREEN_FILENAME}`,\n },\n dark: {\n path: `./res/drawable-night-xxxhdpi/${SPLASH_SCREEN_FILENAME}`,\n },\n },\n dimensionsMultiplier: 4,\n },\n};\n\nexport const withAndroidSplashImages: ConfigPlugin = (config) => {\n return withDangerousMod(config, [\n 'android',\n async (config) => {\n await setSplashImageDrawablesAsync(config, config.modRequest.projectRoot);\n return config;\n },\n ]);\n};\n\n/**\n * Deletes all previous splash_screen_images and copies new one to desired drawable directory.\n * If path isn't provided then no new image is placed in drawable directories.\n * @see https://developer.android.com/training/multiscreen/screendensities\n *\n * @param androidMainPath Absolute path to the main directory containing code and resources in Android project. In general that would be `android/app/src/main`.\n */\nexport async function setSplashImageDrawablesAsync(\n config: Pick<ExpoConfig, 'android' | 'splash'>,\n projectRoot: string\n) {\n await clearAllExistingSplashImagesAsync(projectRoot);\n\n const splash = getAndroidSplashConfig(config);\n const darkSplash = getAndroidDarkSplashConfig(config);\n\n await Promise.all([\n setSplashImageDrawablesForThemeAsync(splash, 'light', projectRoot),\n setSplashImageDrawablesForThemeAsync(darkSplash, 'dark', projectRoot),\n ]);\n}\n\nasync function clearAllExistingSplashImagesAsync(projectRoot: string) {\n const androidMainPath = path.join(projectRoot, 'android/app/src/main');\n\n await Promise.all(\n Object.values(DRAWABLES_CONFIGS).map(async ({ modes }) => {\n await Promise.all(\n Object.values(modes).map(async ({ path: filePath }) => {\n if (await fs.pathExists(path.resolve(androidMainPath, filePath))) {\n await fs.remove(path.resolve(androidMainPath, filePath));\n }\n })\n );\n })\n );\n}\n\nexport async function setSplashImageDrawablesForThemeAsync(\n config: SplashScreenConfig | null,\n theme: 'dark' | 'light',\n projectRoot: string\n) {\n if (!config) return;\n const androidMainPath = path.join(projectRoot, 'android/app/src/main');\n\n await Promise.all(\n ['mdpi', 'hdpi', 'xhdpi', 'xxhdpi', 'xxxhdpi'].map(async (imageKey) => {\n // @ts-ignore\n const image = config[imageKey];\n if (image) {\n // Using this method will cache the images in `.expo` based on the properties used to generate them.\n // this method also supports remote URLs and using the global sharp instance.\n const { source } = await generateImageAsync({ projectRoot, cacheType: IMAGE_CACHE_NAME }, {\n src: image,\n } as any);\n\n // Get output path for drawable.\n const outputPath = path.join(\n androidMainPath,\n // @ts-ignore\n DRAWABLES_CONFIGS[imageKey].modes[theme].path\n );\n // Ensure directory exists.\n const folder = path.dirname(outputPath);\n await fs.ensureDir(folder);\n // Write image buffer to the file system.\n await fs.writeFile(outputPath, source);\n }\n return null;\n })\n );\n}\n"],"mappings":";;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;;;AASA,MAAMA,gBAAgB,GAAG,gBAAzB;AACA,MAAMC,sBAAsB,GAAG,wBAA/B;AACA,MAAMC,iBASL,GAAG;EACFC,OAAO,EAAE;IACPC,KAAK,EAAE;MACLC,KAAK,EAAE;QACLC,IAAI,EAAG,kBAAiBL,sBAAuB;MAD1C,CADF;MAILM,IAAI,EAAE;QACJD,IAAI,EAAG,wBAAuBL,sBAAuB;MADjD;IAJD,CADA;IASPO,oBAAoB,EAAE;EATf,CADP;EAYFC,IAAI,EAAE;IACJL,KAAK,EAAE;MACLC,KAAK,EAAE;QACLC,IAAI,EAAG,uBAAsBL,sBAAuB;MAD/C,CADF;MAILM,IAAI,EAAE;QACJD,IAAI,EAAG,6BAA4BL,sBAAuB;MADtD;IAJD,CADH;IASJO,oBAAoB,EAAE;EATlB,CAZJ;EAuBFE,IAAI,EAAE;IACJN,KAAK,EAAE;MACLC,KAAK,EAAE;QACLC,IAAI,EAAG,uBAAsBL,sBAAuB;MAD/C,CADF;MAILM,IAAI,EAAE;QACJD,IAAI,EAAG,6BAA4BL,sBAAuB;MADtD;IAJD,CADH;IASJO,oBAAoB,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