@expo/prebuild-config 5.0.7 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/build/getAutolinkedPackages.js +3 -13
  2. package/build/getAutolinkedPackages.js.map +1 -1
  3. package/build/getPrebuildConfig.js +9 -24
  4. package/build/getPrebuildConfig.js.map +1 -1
  5. package/build/importExpoModulesAutolinking.d.ts +3 -3
  6. package/build/importExpoModulesAutolinking.js +0 -5
  7. package/build/importExpoModulesAutolinking.js.map +1 -1
  8. package/build/index.js +0 -5
  9. package/build/index.js.map +1 -1
  10. package/build/plugins/icons/AssetContents.d.ts +3 -3
  11. package/build/plugins/icons/AssetContents.js +1 -10
  12. package/build/plugins/icons/AssetContents.js.map +1 -1
  13. package/build/plugins/icons/withAndroidIcons.d.ts +7 -5
  14. package/build/plugins/icons/withAndroidIcons.js +52 -71
  15. package/build/plugins/icons/withAndroidIcons.js.map +1 -1
  16. package/build/plugins/icons/withAndroidManifestIcons.js +0 -10
  17. package/build/plugins/icons/withAndroidManifestIcons.js.map +1 -1
  18. package/build/plugins/icons/withIosIcons.js +24 -48
  19. package/build/plugins/icons/withIosIcons.js.map +1 -1
  20. package/build/plugins/unversioned/createLegacyPlugin.js +0 -11
  21. package/build/plugins/unversioned/createLegacyPlugin.js.map +1 -1
  22. package/build/plugins/unversioned/expo-ads-admob/expo-ads-admob.js +0 -11
  23. package/build/plugins/unversioned/expo-ads-admob/expo-ads-admob.js.map +1 -1
  24. package/build/plugins/unversioned/expo-ads-admob/withAndroidAdMob.js +0 -14
  25. package/build/plugins/unversioned/expo-ads-admob/withAndroidAdMob.js.map +1 -1
  26. package/build/plugins/unversioned/expo-ads-admob/withIosAdMob.js +5 -14
  27. package/build/plugins/unversioned/expo-ads-admob/withIosAdMob.js.map +1 -1
  28. package/build/plugins/unversioned/expo-apple-authentication.js +0 -11
  29. package/build/plugins/unversioned/expo-apple-authentication.js.map +1 -1
  30. package/build/plugins/unversioned/expo-branch/expo-branch.js +4 -13
  31. package/build/plugins/unversioned/expo-branch/expo-branch.js.map +1 -1
  32. package/build/plugins/unversioned/expo-branch/withAndroidBranch.js +0 -12
  33. package/build/plugins/unversioned/expo-branch/withAndroidBranch.js.map +1 -1
  34. package/build/plugins/unversioned/expo-branch/withIosBranch.js +2 -11
  35. package/build/plugins/unversioned/expo-branch/withIosBranch.js.map +1 -1
  36. package/build/plugins/unversioned/expo-contacts.js +2 -13
  37. package/build/plugins/unversioned/expo-contacts.js.map +1 -1
  38. package/build/plugins/unversioned/expo-document-picker.js +2 -12
  39. package/build/plugins/unversioned/expo-document-picker.js.map +1 -1
  40. package/build/plugins/unversioned/expo-navigation-bar/expo-navigation-bar.js +2 -9
  41. package/build/plugins/unversioned/expo-navigation-bar/expo-navigation-bar.js.map +1 -1
  42. package/build/plugins/unversioned/expo-navigation-bar/withAndroidNavigationBar.js +0 -20
  43. package/build/plugins/unversioned/expo-navigation-bar/withAndroidNavigationBar.js.map +1 -1
  44. package/build/plugins/unversioned/expo-notifications/expo-notifications.js +4 -14
  45. package/build/plugins/unversioned/expo-notifications/expo-notifications.js.map +1 -1
  46. package/build/plugins/unversioned/expo-notifications/withAndroidNotifications.d.ts +1 -1
  47. package/build/plugins/unversioned/expo-notifications/withAndroidNotifications.js +1 -44
  48. package/build/plugins/unversioned/expo-notifications/withAndroidNotifications.js.map +1 -1
  49. package/build/plugins/unversioned/expo-splash-screen/InterfaceBuilder.d.ts +20 -20
  50. package/build/plugins/unversioned/expo-splash-screen/InterfaceBuilder.js +14 -33
  51. package/build/plugins/unversioned/expo-splash-screen/InterfaceBuilder.js.map +1 -1
  52. package/build/plugins/unversioned/expo-splash-screen/expo-splash-screen.js +0 -11
  53. package/build/plugins/unversioned/expo-splash-screen/expo-splash-screen.js.map +1 -1
  54. package/build/plugins/unversioned/expo-splash-screen/getAndroidSplashConfig.d.ts +1 -1
  55. package/build/plugins/unversioned/expo-splash-screen/getAndroidSplashConfig.js +2 -11
  56. package/build/plugins/unversioned/expo-splash-screen/getAndroidSplashConfig.js.map +1 -1
  57. package/build/plugins/unversioned/expo-splash-screen/getIosSplashConfig.d.ts +1 -2
  58. package/build/plugins/unversioned/expo-splash-screen/getIosSplashConfig.js +0 -26
  59. package/build/plugins/unversioned/expo-splash-screen/getIosSplashConfig.js.map +1 -1
  60. package/build/plugins/unversioned/expo-splash-screen/withAndroidSplashDrawables.js +4 -9
  61. package/build/plugins/unversioned/expo-splash-screen/withAndroidSplashDrawables.js.map +1 -1
  62. package/build/plugins/unversioned/expo-splash-screen/withAndroidSplashImages.js +9 -36
  63. package/build/plugins/unversioned/expo-splash-screen/withAndroidSplashImages.js.map +1 -1
  64. package/build/plugins/unversioned/expo-splash-screen/withAndroidSplashLegacyMainActivity.js +13 -34
  65. package/build/plugins/unversioned/expo-splash-screen/withAndroidSplashLegacyMainActivity.js.map +1 -1
  66. package/build/plugins/unversioned/expo-splash-screen/withAndroidSplashScreen.js +4 -46
  67. package/build/plugins/unversioned/expo-splash-screen/withAndroidSplashScreen.js.map +1 -1
  68. package/build/plugins/unversioned/expo-splash-screen/withAndroidSplashStrings.js +0 -13
  69. package/build/plugins/unversioned/expo-splash-screen/withAndroidSplashStrings.js.map +1 -1
  70. package/build/plugins/unversioned/expo-splash-screen/withAndroidSplashStyles.js +2 -23
  71. package/build/plugins/unversioned/expo-splash-screen/withAndroidSplashStyles.js.map +1 -1
  72. package/build/plugins/unversioned/expo-splash-screen/withIosSplashAssets.js +16 -54
  73. package/build/plugins/unversioned/expo-splash-screen/withIosSplashAssets.js.map +1 -1
  74. package/build/plugins/unversioned/expo-splash-screen/withIosSplashInfoPlist.js +6 -22
  75. package/build/plugins/unversioned/expo-splash-screen/withIosSplashInfoPlist.js.map +1 -1
  76. package/build/plugins/unversioned/expo-splash-screen/withIosSplashScreen.js +7 -35
  77. package/build/plugins/unversioned/expo-splash-screen/withIosSplashScreen.js.map +1 -1
  78. package/build/plugins/unversioned/expo-splash-screen/withIosSplashScreenStoryboard.js +9 -33
  79. package/build/plugins/unversioned/expo-splash-screen/withIosSplashScreenStoryboard.js.map +1 -1
  80. package/build/plugins/unversioned/expo-splash-screen/withIosSplashXcodeProject.js +1 -18
  81. package/build/plugins/unversioned/expo-splash-screen/withIosSplashXcodeProject.js.map +1 -1
  82. package/build/plugins/unversioned/expo-splash-screen/wtihIosSplashScreenStoryboardImage.js +2 -15
  83. package/build/plugins/unversioned/expo-splash-screen/wtihIosSplashScreenStoryboardImage.js.map +1 -1
  84. package/build/plugins/unversioned/expo-system-ui/expo-system-ui.js +0 -17
  85. package/build/plugins/unversioned/expo-system-ui/expo-system-ui.js.map +1 -1
  86. package/build/plugins/unversioned/expo-system-ui/withAndroidRootViewBackgroundColor.js +0 -14
  87. package/build/plugins/unversioned/expo-system-ui/withAndroidRootViewBackgroundColor.js.map +1 -1
  88. package/build/plugins/unversioned/expo-system-ui/withAndroidUserInterfaceStyle.js +2 -9
  89. package/build/plugins/unversioned/expo-system-ui/withAndroidUserInterfaceStyle.js.map +1 -1
  90. package/build/plugins/unversioned/expo-system-ui/withIosRootViewBackgroundColor.js +2 -27
  91. package/build/plugins/unversioned/expo-system-ui/withIosRootViewBackgroundColor.js.map +1 -1
  92. package/build/plugins/unversioned/expo-system-ui/withIosUserInterfaceStyle.js +2 -14
  93. package/build/plugins/unversioned/expo-system-ui/withIosUserInterfaceStyle.js.map +1 -1
  94. package/build/plugins/unversioned/expo-updates.js +1 -8
  95. package/build/plugins/unversioned/expo-updates.js.map +1 -1
  96. package/build/plugins/unversioned/react-native-maps.js +4 -19
  97. package/build/plugins/unversioned/react-native-maps.js.map +1 -1
  98. package/build/plugins/withDefaultPlugins.d.ts +2 -2
  99. package/build/plugins/withDefaultPlugins.js +41 -94
  100. package/build/plugins/withDefaultPlugins.js.map +1 -1
  101. package/package.json +6 -6
  102. package/build/plugins/unversioned/expo-facebook/expo-facebook.d.ts +0 -2
  103. package/build/plugins/unversioned/expo-facebook/expo-facebook.js +0 -57
  104. package/build/plugins/unversioned/expo-facebook/expo-facebook.js.map +0 -1
  105. package/build/plugins/unversioned/expo-facebook/withAndroidFacebook.d.ts +0 -13
  106. package/build/plugins/unversioned/expo-facebook/withAndroidFacebook.js +0 -235
  107. package/build/plugins/unversioned/expo-facebook/withAndroidFacebook.js.map +0 -1
  108. package/build/plugins/unversioned/expo-facebook/withIosFacebook.d.ts +0 -26
  109. package/build/plugins/unversioned/expo-facebook/withIosFacebook.js +0 -233
  110. package/build/plugins/unversioned/expo-facebook/withIosFacebook.js.map +0 -1
  111. package/build/plugins/unversioned/expo-facebook/withSKAdNetworkIdentifiers.d.ts +0 -9
  112. package/build/plugins/unversioned/expo-facebook/withSKAdNetworkIdentifiers.js +0 -69
  113. package/build/plugins/unversioned/expo-facebook/withSKAdNetworkIdentifiers.js.map +0 -1
@@ -10,69 +10,50 @@ exports.setNotificationConfig = setNotificationConfig;
10
10
  exports.setNotificationIconAsync = setNotificationIconAsync;
11
11
  exports.setNotificationIconColor = setNotificationIconColor;
12
12
  exports.withNotificationManifest = exports.withNotificationIcons = exports.withNotificationIconColor = void 0;
13
-
14
13
  function _configPlugins() {
15
14
  const data = require("@expo/config-plugins");
16
-
17
15
  _configPlugins = function () {
18
16
  return data;
19
17
  };
20
-
21
18
  return data;
22
19
  }
23
-
24
20
  function _imageUtils() {
25
21
  const data = require("@expo/image-utils");
26
-
27
22
  _imageUtils = function () {
28
23
  return data;
29
24
  };
30
-
31
25
  return data;
32
26
  }
33
-
34
27
  function _fsExtra() {
35
28
  const data = _interopRequireDefault(require("fs-extra"));
36
-
37
29
  _fsExtra = function () {
38
30
  return data;
39
31
  };
40
-
41
32
  return data;
42
33
  }
43
-
44
34
  function _path() {
45
35
  const data = _interopRequireDefault(require("path"));
46
-
47
36
  _path = function () {
48
37
  return data;
49
38
  };
50
-
51
39
  return data;
52
40
  }
53
-
54
41
  function _withAndroidIcons() {
55
42
  const data = require("../../icons/withAndroidIcons");
56
-
57
43
  _withAndroidIcons = function () {
58
44
  return data;
59
45
  };
60
-
61
46
  return data;
62
47
  }
63
-
64
48
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
65
-
66
49
  const {
67
50
  Colors
68
51
  } = _configPlugins().AndroidConfig;
69
-
70
52
  const {
71
53
  addMetaDataItemToMainApplication,
72
54
  getMainApplicationOrThrow,
73
55
  removeMetaDataItemFromMainApplication
74
56
  } = _configPlugins().AndroidConfig.Manifest;
75
-
76
57
  const BASELINE_PIXEL_SIZE = 24;
77
58
  const META_DATA_NOTIFICATION_ICON = 'expo.modules.notifications.default_notification_icon';
78
59
  exports.META_DATA_NOTIFICATION_ICON = META_DATA_NOTIFICATION_ICON;
@@ -86,100 +67,79 @@ const NOTIFICATION_ICON_COLOR = 'notification_icon_color';
86
67
  exports.NOTIFICATION_ICON_COLOR = NOTIFICATION_ICON_COLOR;
87
68
  const NOTIFICATION_ICON_COLOR_RESOURCE = `@color/${NOTIFICATION_ICON_COLOR}`;
88
69
  exports.NOTIFICATION_ICON_COLOR_RESOURCE = NOTIFICATION_ICON_COLOR_RESOURCE;
89
-
90
70
  const withNotificationIcons = config => {
91
71
  return (0, _configPlugins().withDangerousMod)(config, ['android', async config => {
92
72
  await setNotificationIconAsync(config, config.modRequest.projectRoot);
93
73
  return config;
94
74
  }]);
95
75
  };
96
-
97
76
  exports.withNotificationIcons = withNotificationIcons;
98
-
99
77
  const withNotificationIconColor = config => {
100
78
  return (0, _configPlugins().withAndroidColors)(config, config => {
101
79
  config.modResults = setNotificationIconColor(config, config.modResults);
102
80
  return config;
103
81
  });
104
82
  };
105
-
106
83
  exports.withNotificationIconColor = withNotificationIconColor;
107
-
108
84
  const withNotificationManifest = config => {
109
85
  return (0, _configPlugins().withAndroidManifest)(config, config => {
110
86
  config.modResults = setNotificationConfig(config, config.modResults);
111
87
  return config;
112
88
  });
113
89
  };
114
-
115
90
  exports.withNotificationManifest = withNotificationManifest;
116
-
117
91
  function getNotificationIcon(config) {
118
92
  var _config$notification;
119
-
120
93
  return ((_config$notification = config.notification) === null || _config$notification === void 0 ? void 0 : _config$notification.icon) || null;
121
94
  }
122
-
123
95
  function getNotificationColor(config) {
124
96
  var _config$notification2;
125
-
126
97
  return ((_config$notification2 = config.notification) === null || _config$notification2 === void 0 ? void 0 : _config$notification2.color) || null;
127
98
  }
99
+
128
100
  /**
129
101
  * Applies configuration for expo-notifications, including
130
102
  * the notification icon and notification color.
131
103
  */
132
-
133
-
134
104
  async function setNotificationIconAsync(config, projectRoot) {
135
105
  const icon = getNotificationIcon(config);
136
-
137
106
  if (icon) {
138
107
  await writeNotificationIconImageFilesAsync(icon, projectRoot);
139
108
  } else {
140
109
  await removeNotificationIconImageFilesAsync(projectRoot);
141
110
  }
142
111
  }
143
-
144
112
  function setNotificationConfig(config, manifest) {
145
113
  const icon = getNotificationIcon(config);
146
114
  const color = getNotificationColor(config);
147
115
  const mainApplication = getMainApplicationOrThrow(manifest);
148
-
149
116
  if (icon) {
150
117
  addMetaDataItemToMainApplication(mainApplication, META_DATA_NOTIFICATION_ICON, NOTIFICATION_ICON_RESOURCE, 'resource');
151
118
  } else {
152
119
  removeMetaDataItemFromMainApplication(mainApplication, META_DATA_NOTIFICATION_ICON);
153
120
  }
154
-
155
121
  if (color) {
156
122
  addMetaDataItemToMainApplication(mainApplication, META_DATA_NOTIFICATION_ICON_COLOR, NOTIFICATION_ICON_COLOR_RESOURCE, 'resource');
157
123
  } else {
158
124
  removeMetaDataItemFromMainApplication(mainApplication, META_DATA_NOTIFICATION_ICON_COLOR);
159
125
  }
160
-
161
126
  return manifest;
162
127
  }
163
-
164
128
  function setNotificationIconColor(config, colors) {
165
129
  return Colors.assignColorValue(colors, {
166
130
  name: NOTIFICATION_ICON_COLOR,
167
131
  value: getNotificationColor(config)
168
132
  });
169
133
  }
170
-
171
134
  async function writeNotificationIconImageFilesAsync(icon, projectRoot) {
172
135
  await Promise.all(Object.values(_withAndroidIcons().dpiValues).map(async ({
173
136
  folderName,
174
137
  scale
175
138
  }) => {
176
139
  const drawableFolderName = folderName.replace('mipmap', 'drawable');
177
-
178
140
  const dpiFolderPath = _path().default.resolve(projectRoot, _withAndroidIcons().ANDROID_RES_PATH, drawableFolderName);
179
-
180
141
  await _fsExtra().default.ensureDir(dpiFolderPath);
181
142
  const iconSizePx = BASELINE_PIXEL_SIZE * scale;
182
-
183
143
  try {
184
144
  const resizedIcon = (await (0, _imageUtils().generateImageAsync)({
185
145
  projectRoot,
@@ -197,15 +157,12 @@ async function writeNotificationIconImageFilesAsync(icon, projectRoot) {
197
157
  }
198
158
  }));
199
159
  }
200
-
201
160
  async function removeNotificationIconImageFilesAsync(projectRoot) {
202
161
  await Promise.all(Object.values(_withAndroidIcons().dpiValues).map(async ({
203
162
  folderName
204
163
  }) => {
205
164
  const drawableFolderName = folderName.replace('mipmap', 'drawable');
206
-
207
165
  const dpiFolderPath = _path().default.resolve(projectRoot, _withAndroidIcons().ANDROID_RES_PATH, drawableFolderName);
208
-
209
166
  await _fsExtra().default.remove(_path().default.resolve(dpiFolderPath, NOTIFICATION_ICON + '.png'));
210
167
  }));
211
168
  }
@@ -1 +1 @@
1
- {"version":3,"file":"withAndroidNotifications.js","names":["Colors","AndroidConfig","addMetaDataItemToMainApplication","getMainApplicationOrThrow","removeMetaDataItemFromMainApplication","Manifest","BASELINE_PIXEL_SIZE","META_DATA_NOTIFICATION_ICON","META_DATA_NOTIFICATION_ICON_COLOR","NOTIFICATION_ICON","NOTIFICATION_ICON_RESOURCE","NOTIFICATION_ICON_COLOR","NOTIFICATION_ICON_COLOR_RESOURCE","withNotificationIcons","config","withDangerousMod","setNotificationIconAsync","modRequest","projectRoot","withNotificationIconColor","withAndroidColors","modResults","setNotificationIconColor","withNotificationManifest","withAndroidManifest","setNotificationConfig","getNotificationIcon","notification","icon","getNotificationColor","color","writeNotificationIconImageFilesAsync","removeNotificationIconImageFilesAsync","manifest","mainApplication","colors","assignColorValue","name","value","Promise","all","Object","values","dpiValues","map","folderName","scale","drawableFolderName","replace","dpiFolderPath","path","resolve","ANDROID_RES_PATH","fs","ensureDir","iconSizePx","resizedIcon","generateImageAsync","cacheType","src","width","height","resizeMode","backgroundColor","source","writeFile","e","Error","remove"],"sources":["../../../../src/plugins/unversioned/expo-notifications/withAndroidNotifications.ts"],"sourcesContent":["import {\n AndroidConfig,\n ConfigPlugin,\n withAndroidColors,\n withAndroidManifest,\n withDangerousMod,\n} 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 { ANDROID_RES_PATH, dpiValues } from '../../icons/withAndroidIcons';\n\nconst { Colors } = AndroidConfig;\nconst {\n addMetaDataItemToMainApplication,\n getMainApplicationOrThrow,\n removeMetaDataItemFromMainApplication,\n} = AndroidConfig.Manifest;\n\ntype AndroidManifest = AndroidConfig.Manifest.AndroidManifest;\nconst BASELINE_PIXEL_SIZE = 24;\nexport const META_DATA_NOTIFICATION_ICON = 'expo.modules.notifications.default_notification_icon';\nexport const META_DATA_NOTIFICATION_ICON_COLOR =\n 'expo.modules.notifications.default_notification_color';\nexport const NOTIFICATION_ICON = 'notification_icon';\nexport const NOTIFICATION_ICON_RESOURCE = `@drawable/${NOTIFICATION_ICON}`;\nexport const NOTIFICATION_ICON_COLOR = 'notification_icon_color';\nexport const NOTIFICATION_ICON_COLOR_RESOURCE = `@color/${NOTIFICATION_ICON_COLOR}`;\n\nexport const withNotificationIcons: ConfigPlugin = (config) => {\n return withDangerousMod(config, [\n 'android',\n async (config) => {\n await setNotificationIconAsync(config, config.modRequest.projectRoot);\n return config;\n },\n ]);\n};\n\nexport const withNotificationIconColor: ConfigPlugin = (config) => {\n return withAndroidColors(config, (config) => {\n config.modResults = setNotificationIconColor(config, config.modResults);\n return config;\n });\n};\n\nexport const withNotificationManifest: ConfigPlugin = (config) => {\n return withAndroidManifest(config, (config) => {\n config.modResults = setNotificationConfig(config, config.modResults);\n return config;\n });\n};\n\nexport function getNotificationIcon(config: ExpoConfig) {\n return config.notification?.icon || null;\n}\n\nexport function getNotificationColor(config: ExpoConfig) {\n return config.notification?.color || null;\n}\n\n/**\n * Applies configuration for expo-notifications, including\n * the notification icon and notification color.\n */\nexport async function setNotificationIconAsync(config: ExpoConfig, projectRoot: string) {\n const icon = getNotificationIcon(config);\n if (icon) {\n await writeNotificationIconImageFilesAsync(icon, projectRoot);\n } else {\n await removeNotificationIconImageFilesAsync(projectRoot);\n }\n}\n\nexport function setNotificationConfig(config: ExpoConfig, manifest: AndroidManifest) {\n const icon = getNotificationIcon(config);\n const color = getNotificationColor(config);\n const mainApplication = getMainApplicationOrThrow(manifest);\n if (icon) {\n addMetaDataItemToMainApplication(\n mainApplication,\n META_DATA_NOTIFICATION_ICON,\n NOTIFICATION_ICON_RESOURCE,\n 'resource'\n );\n } else {\n removeMetaDataItemFromMainApplication(mainApplication, META_DATA_NOTIFICATION_ICON);\n }\n if (color) {\n addMetaDataItemToMainApplication(\n mainApplication,\n META_DATA_NOTIFICATION_ICON_COLOR,\n NOTIFICATION_ICON_COLOR_RESOURCE,\n 'resource'\n );\n } else {\n removeMetaDataItemFromMainApplication(mainApplication, META_DATA_NOTIFICATION_ICON_COLOR);\n }\n return manifest;\n}\n\nexport function setNotificationIconColor(\n config: ExpoConfig,\n colors: AndroidConfig.Resources.ResourceXML\n) {\n return Colors.assignColorValue(colors, {\n name: NOTIFICATION_ICON_COLOR,\n value: getNotificationColor(config),\n });\n}\n\nasync function writeNotificationIconImageFilesAsync(icon: string, projectRoot: string) {\n await Promise.all(\n Object.values(dpiValues).map(async ({ folderName, scale }) => {\n const drawableFolderName = folderName.replace('mipmap', 'drawable');\n const dpiFolderPath = path.resolve(projectRoot, ANDROID_RES_PATH, drawableFolderName);\n await fs.ensureDir(dpiFolderPath);\n const iconSizePx = BASELINE_PIXEL_SIZE * scale;\n\n try {\n const resizedIcon = (\n await generateImageAsync(\n { projectRoot, cacheType: 'android-notification' },\n {\n src: icon,\n width: iconSizePx,\n height: iconSizePx,\n resizeMode: 'cover',\n backgroundColor: 'transparent',\n }\n )\n ).source;\n await fs.writeFile(path.resolve(dpiFolderPath, NOTIFICATION_ICON + '.png'), resizedIcon);\n } catch (e) {\n throw new Error('Encountered an issue resizing Android notification icon: ' + e);\n }\n })\n );\n}\n\nasync function removeNotificationIconImageFilesAsync(projectRoot: string) {\n await Promise.all(\n Object.values(dpiValues).map(async ({ folderName }) => {\n const drawableFolderName = folderName.replace('mipmap', 'drawable');\n const dpiFolderPath = path.resolve(projectRoot, ANDROID_RES_PATH, drawableFolderName);\n await fs.remove(path.resolve(dpiFolderPath, NOTIFICATION_ICON + '.png'));\n })\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAQA;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;;;;AAEA,MAAM;EAAEA;AAAF,IAAaC,8BAAnB;;AACA,MAAM;EACJC,gCADI;EAEJC,yBAFI;EAGJC;AAHI,IAIFH,8BAAA,CAAcI,QAJlB;;AAOA,MAAMC,mBAAmB,GAAG,EAA5B;AACO,MAAMC,2BAA2B,GAAG,sDAApC;;AACA,MAAMC,iCAAiC,GAC5C,uDADK;;AAEA,MAAMC,iBAAiB,GAAG,mBAA1B;;AACA,MAAMC,0BAA0B,GAAI,aAAYD,iBAAkB,EAAlE;;AACA,MAAME,uBAAuB,GAAG,yBAAhC;;AACA,MAAMC,gCAAgC,GAAI,UAASD,uBAAwB,EAA3E;;;AAEA,MAAME,qBAAmC,GAAIC,MAAD,IAAY;EAC7D,OAAO,IAAAC,iCAAA,EAAiBD,MAAjB,EAAyB,CAC9B,SAD8B,EAE9B,MAAOA,MAAP,IAAkB;IAChB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;IAEA,IAAI;MACF,MAAMU,WAAW,GAAG,CAClB,MAAM,IAAAC,gCAAA,EACJ;QAAEvC,WAAF;QAAewC,SAAS,EAAE;MAA1B,CADI,EAEJ;QACEC,GAAG,EAAE/B,IADP;QAEEgC,KAAK,EAAEL,UAFT;QAGEM,MAAM,EAAEN,UAHV;QAIEO,UAAU,EAAE,OAJd;QAKEC,eAAe,EAAE;MALnB,CAFI,CADY,EAWlBC,MAXF;MAYA,MAAMX,kBAAA,CAAGY,SAAH,CAAaf,eAAA,CAAKC,OAAL,CAAaF,aAAb,EAA4BxC,iBAAiB,GAAG,MAAhD,CAAb,EAAsE+C,WAAtE,CAAN;IACD,CAdD,CAcE,OAAOU,CAAP,EAAU;MACV,MAAM,IAAIC,KAAJ,CAAU,8DAA8DD,CAAxE,CAAN;IACD;EACF,CAvBD,CADI,CAAN;AA0BD;;AAED,eAAelC,qCAAf,CAAqDd,WAArD,EAA0E;EACxE,MAAMqB,OAAO,CAACC,GAAR,CACJC,MAAM,CAACC,MAAP,CAAcC,6BAAd,EAAyBC,GAAzB,CAA6B,OAAO;IAAEC;EAAF,CAAP,KAA0B;IACrD,MAAME,kBAAkB,GAAGF,UAAU,CAACG,OAAX,CAAmB,QAAnB,EAA6B,UAA7B,CAA3B;;IACA,MAAMC,aAAa,GAAGC,eAAA,CAAKC,OAAL,CAAajC,WAAb,EAA0BkC,oCAA1B,EAA4CL,kBAA5C,CAAtB;;IACA,MAAMM,kBAAA,CAAGe,MAAH,CAAUlB,eAAA,CAAKC,OAAL,CAAaF,aAAb,EAA4BxC,iBAAiB,GAAG,MAAhD,CAAV,CAAN;EACD,CAJD,CADI,CAAN;AAOD"}
1
+ {"version":3,"file":"withAndroidNotifications.js","names":["Colors","AndroidConfig","addMetaDataItemToMainApplication","getMainApplicationOrThrow","removeMetaDataItemFromMainApplication","Manifest","BASELINE_PIXEL_SIZE","META_DATA_NOTIFICATION_ICON","META_DATA_NOTIFICATION_ICON_COLOR","NOTIFICATION_ICON","NOTIFICATION_ICON_RESOURCE","NOTIFICATION_ICON_COLOR","NOTIFICATION_ICON_COLOR_RESOURCE","withNotificationIcons","config","withDangerousMod","setNotificationIconAsync","modRequest","projectRoot","withNotificationIconColor","withAndroidColors","modResults","setNotificationIconColor","withNotificationManifest","withAndroidManifest","setNotificationConfig","getNotificationIcon","notification","icon","getNotificationColor","color","writeNotificationIconImageFilesAsync","removeNotificationIconImageFilesAsync","manifest","mainApplication","colors","assignColorValue","name","value","Promise","all","Object","values","dpiValues","map","folderName","scale","drawableFolderName","replace","dpiFolderPath","path","resolve","ANDROID_RES_PATH","fs","ensureDir","iconSizePx","resizedIcon","generateImageAsync","cacheType","src","width","height","resizeMode","backgroundColor","source","writeFile","e","Error","remove"],"sources":["../../../../src/plugins/unversioned/expo-notifications/withAndroidNotifications.ts"],"sourcesContent":["import {\n AndroidConfig,\n ConfigPlugin,\n withAndroidColors,\n withAndroidManifest,\n withDangerousMod,\n} 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 { ANDROID_RES_PATH, dpiValues } from '../../icons/withAndroidIcons';\n\nconst { Colors } = AndroidConfig;\nconst {\n addMetaDataItemToMainApplication,\n getMainApplicationOrThrow,\n removeMetaDataItemFromMainApplication,\n} = AndroidConfig.Manifest;\n\ntype AndroidManifest = AndroidConfig.Manifest.AndroidManifest;\nconst BASELINE_PIXEL_SIZE = 24;\nexport const META_DATA_NOTIFICATION_ICON = 'expo.modules.notifications.default_notification_icon';\nexport const META_DATA_NOTIFICATION_ICON_COLOR =\n 'expo.modules.notifications.default_notification_color';\nexport const NOTIFICATION_ICON = 'notification_icon';\nexport const NOTIFICATION_ICON_RESOURCE = `@drawable/${NOTIFICATION_ICON}`;\nexport const NOTIFICATION_ICON_COLOR = 'notification_icon_color';\nexport const NOTIFICATION_ICON_COLOR_RESOURCE = `@color/${NOTIFICATION_ICON_COLOR}`;\n\nexport const withNotificationIcons: ConfigPlugin = (config) => {\n return withDangerousMod(config, [\n 'android',\n async (config) => {\n await setNotificationIconAsync(config, config.modRequest.projectRoot);\n return config;\n },\n ]);\n};\n\nexport const withNotificationIconColor: ConfigPlugin = (config) => {\n return withAndroidColors(config, (config) => {\n config.modResults = setNotificationIconColor(config, config.modResults);\n return config;\n });\n};\n\nexport const withNotificationManifest: ConfigPlugin = (config) => {\n return withAndroidManifest(config, (config) => {\n config.modResults = setNotificationConfig(config, config.modResults);\n return config;\n });\n};\n\nexport function getNotificationIcon(config: ExpoConfig) {\n return config.notification?.icon || null;\n}\n\nexport function getNotificationColor(config: ExpoConfig) {\n return config.notification?.color || null;\n}\n\n/**\n * Applies configuration for expo-notifications, including\n * the notification icon and notification color.\n */\nexport async function setNotificationIconAsync(config: ExpoConfig, projectRoot: string) {\n const icon = getNotificationIcon(config);\n if (icon) {\n await writeNotificationIconImageFilesAsync(icon, projectRoot);\n } else {\n await removeNotificationIconImageFilesAsync(projectRoot);\n }\n}\n\nexport function setNotificationConfig(config: ExpoConfig, manifest: AndroidManifest) {\n const icon = getNotificationIcon(config);\n const color = getNotificationColor(config);\n const mainApplication = getMainApplicationOrThrow(manifest);\n if (icon) {\n addMetaDataItemToMainApplication(\n mainApplication,\n META_DATA_NOTIFICATION_ICON,\n NOTIFICATION_ICON_RESOURCE,\n 'resource'\n );\n } else {\n removeMetaDataItemFromMainApplication(mainApplication, META_DATA_NOTIFICATION_ICON);\n }\n if (color) {\n addMetaDataItemToMainApplication(\n mainApplication,\n META_DATA_NOTIFICATION_ICON_COLOR,\n NOTIFICATION_ICON_COLOR_RESOURCE,\n 'resource'\n );\n } else {\n removeMetaDataItemFromMainApplication(mainApplication, META_DATA_NOTIFICATION_ICON_COLOR);\n }\n return manifest;\n}\n\nexport function setNotificationIconColor(\n config: ExpoConfig,\n colors: AndroidConfig.Resources.ResourceXML\n) {\n return Colors.assignColorValue(colors, {\n name: NOTIFICATION_ICON_COLOR,\n value: getNotificationColor(config),\n });\n}\n\nasync function writeNotificationIconImageFilesAsync(icon: string, projectRoot: string) {\n await Promise.all(\n Object.values(dpiValues).map(async ({ folderName, scale }) => {\n const drawableFolderName = folderName.replace('mipmap', 'drawable');\n const dpiFolderPath = path.resolve(projectRoot, ANDROID_RES_PATH, drawableFolderName);\n await fs.ensureDir(dpiFolderPath);\n const iconSizePx = BASELINE_PIXEL_SIZE * scale;\n\n try {\n const resizedIcon = (\n await generateImageAsync(\n { projectRoot, cacheType: 'android-notification' },\n {\n src: icon,\n width: iconSizePx,\n height: iconSizePx,\n resizeMode: 'cover',\n backgroundColor: 'transparent',\n }\n )\n ).source;\n await fs.writeFile(path.resolve(dpiFolderPath, NOTIFICATION_ICON + '.png'), resizedIcon);\n } catch (e) {\n throw new Error('Encountered an issue resizing Android notification icon: ' + e);\n }\n })\n );\n}\n\nasync function removeNotificationIconImageFilesAsync(projectRoot: string) {\n await Promise.all(\n Object.values(dpiValues).map(async ({ folderName }) => {\n const drawableFolderName = folderName.replace('mipmap', 'drawable');\n const dpiFolderPath = path.resolve(projectRoot, ANDROID_RES_PATH, drawableFolderName);\n await fs.remove(path.resolve(dpiFolderPath, NOTIFICATION_ICON + '.png'));\n })\n );\n}\n"],"mappings":";;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAQA;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;AAA2E;AAE3E,MAAM;EAAEA;AAAO,CAAC,GAAGC,8BAAa;AAChC,MAAM;EACJC,gCAAgC;EAChCC,yBAAyB;EACzBC;AACF,CAAC,GAAGH,8BAAa,CAACI,QAAQ;AAG1B,MAAMC,mBAAmB,GAAG,EAAE;AACvB,MAAMC,2BAA2B,GAAG,sDAAsD;AAAC;AAC3F,MAAMC,iCA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CAACC,OAAO,CAACF,aAAa,EAAExC,iBAAiB,GAAG,MAAM,CAAC,CAAC;EAC1E,CAAC,CAAC,CACH;AACH"}
@@ -1,25 +1,25 @@
1
- export declare type IBBoolean = 'YES' | 'NO' | boolean;
2
- export declare type IBItem<H extends Record<string, any>, B extends Record<string, any[]> = {
1
+ export type IBBoolean = 'YES' | 'NO' | boolean;
2
+ export type IBItem<H extends Record<string, any>, B extends Record<string, any[]> = {
3
3
  [key: string]: any;
4
4
  }> = {
5
5
  $: H;
6
6
  } & B;
7
- export declare type Rect = {
7
+ export type Rect = {
8
8
  key: string;
9
9
  x: number;
10
10
  y: number;
11
11
  width: number;
12
12
  height: number;
13
13
  };
14
- export declare type IBRect = IBItem<Rect>;
15
- export declare type IBAutoresizingMask = IBItem<{
14
+ export type IBRect = IBItem<Rect>;
15
+ export type IBAutoresizingMask = IBItem<{
16
16
  /** @example `autoresizingMask` */
17
17
  key: string;
18
18
  flexibleMaxX: IBBoolean;
19
19
  flexibleMaxY: IBBoolean;
20
20
  }>;
21
21
  /** @example `<color key="textColor" systemColor="linkColor"/>` */
22
- export declare type IBColor = IBItem<{
22
+ export type IBColor = IBItem<{
23
23
  /** @example `textColor` */
24
24
  key: string;
25
25
  } & (/** Custom color */ {
@@ -38,7 +38,7 @@ export declare type IBColor = IBItem<{
38
38
  | {
39
39
  systemColor: 'linkColor' | string;
40
40
  })>;
41
- export declare type IBFontDescription = IBItem<{
41
+ export type IBFontDescription = IBItem<{
42
42
  /** @example `fontDescription` */
43
43
  key: string;
44
44
  /** Font size */
@@ -49,9 +49,9 @@ export declare type IBFontDescription = IBItem<{
49
49
  /** Built-in font */
50
50
  type?: 'system' | 'boldSystem' | 'UICTFontTextStyleCallout' | 'UICTFontTextStyleBody' | string;
51
51
  }>;
52
- export declare type ImageContentMode = 'scaleAspectFit' | 'scaleAspectFill';
53
- export declare type ConstraintAttribute = 'top' | 'bottom' | 'trailing' | 'leading';
54
- export declare type IBImageView = IBItem<{
52
+ export type ImageContentMode = 'scaleAspectFit' | 'scaleAspectFill';
53
+ export type ConstraintAttribute = 'top' | 'bottom' | 'trailing' | 'leading';
54
+ export type IBImageView = IBItem<{
55
55
  id: string;
56
56
  userLabel: string;
57
57
  image: string;
@@ -65,7 +65,7 @@ export declare type IBImageView = IBItem<{
65
65
  }, {
66
66
  rect: IBRect[];
67
67
  }>;
68
- export declare type IBLabel = IBItem<{
68
+ export type IBLabel = IBItem<{
69
69
  id: string;
70
70
  /** The main value. */
71
71
  text: string;
@@ -94,9 +94,9 @@ export declare type IBLabel = IBItem<{
94
94
  key: string;
95
95
  }>[];
96
96
  }>;
97
- export declare type IBTextAlignment = 'left' | 'center' | 'right' | 'justified' | 'natural';
98
- export declare type IBContentMode = string | 'left' | 'scaleAspectFill';
99
- export declare type IBConstraint = IBItem<{
97
+ export type IBTextAlignment = 'left' | 'center' | 'right' | 'justified' | 'natural';
98
+ export type IBContentMode = string | 'left' | 'scaleAspectFill';
99
+ export type IBConstraint = IBItem<{
100
100
  firstItem: string;
101
101
  firstAttribute: ConstraintAttribute;
102
102
  secondItem: string;
@@ -104,7 +104,7 @@ export declare type IBConstraint = IBItem<{
104
104
  constant?: number;
105
105
  id: string;
106
106
  }>;
107
- export declare type IBViewController = IBItem<{
107
+ export type IBViewController = IBItem<{
108
108
  id: string;
109
109
  placeholderIdentifier?: string;
110
110
  userLabel: string;
@@ -141,12 +141,12 @@ export declare type IBViewController = IBItem<{
141
141
  }>[];
142
142
  }>[];
143
143
  }>;
144
- export declare type IBPoint = IBItem<{
144
+ export type IBPoint = IBItem<{
145
145
  key: string | 'canvasLocation';
146
146
  x: number;
147
147
  y: number;
148
148
  }>;
149
- export declare type IBScene = IBItem<{
149
+ export type IBScene = IBItem<{
150
150
  sceneID: string;
151
151
  }, {
152
152
  objects: {
@@ -160,17 +160,17 @@ export declare type IBScene = IBItem<{
160
160
  }[];
161
161
  point: IBPoint[];
162
162
  }>;
163
- export declare type IBResourceImage = IBItem<{
163
+ export type IBResourceImage = IBItem<{
164
164
  name: string;
165
165
  width: number;
166
166
  height: number;
167
167
  }>;
168
- export declare type IBDevice = IBItem<{
168
+ export type IBDevice = IBItem<{
169
169
  id: string;
170
170
  orientation: string | 'portrait';
171
171
  appearance: string | 'light';
172
172
  }>;
173
- export declare type IBSplashScreenDocument = {
173
+ export type IBSplashScreenDocument = {
174
174
  document: IBItem<{
175
175
  type: 'com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB' | string;
176
176
  version: '3.0' | string;
@@ -11,31 +11,22 @@ exports.removeExisting = removeExisting;
11
11
  exports.removeImageFromSplashScreen = removeImageFromSplashScreen;
12
12
  exports.toObjectAsync = toObjectAsync;
13
13
  exports.toString = toString;
14
-
15
14
  function _crypto() {
16
15
  const data = _interopRequireDefault(require("crypto"));
17
-
18
16
  _crypto = function () {
19
17
  return data;
20
18
  };
21
-
22
19
  return data;
23
20
  }
24
-
25
21
  function _xml2js() {
26
22
  const data = require("xml2js");
27
-
28
23
  _xml2js = function () {
29
24
  return data;
30
25
  };
31
-
32
26
  return data;
33
27
  }
34
-
35
28
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
36
-
37
29
  const debug = require('debug')('expo:prebuild-config:expo-splash-screen:ios:InterfaceBuilder');
38
-
39
30
  function createConstraint([firstItem, firstAttribute], [secondItem, secondAttribute], constant) {
40
31
  return {
41
32
  $: {
@@ -49,41 +40,36 @@ function createConstraint([firstItem, firstAttribute], [secondItem, secondAttrib
49
40
  }
50
41
  };
51
42
  }
52
-
53
43
  function createConstraintId(...attributes) {
54
44
  return _crypto().default.createHash('sha1').update(attributes.join('-')).digest('hex');
55
45
  }
56
-
57
46
  const IMAGE_ID = 'EXPO-SplashScreen';
58
47
  const CONTAINER_ID = 'EXPO-ContainerView';
59
-
60
48
  function removeImageFromSplashScreen(xml, {
61
49
  imageName
62
50
  }) {
63
51
  const mainView = xml.document.scenes[0].scene[0].objects[0].viewController[0].view[0];
64
52
  debug(`Remove all splash screen image elements`);
65
- removeExisting(mainView.subviews[0].imageView, IMAGE_ID); // Add Constraints
53
+ removeExisting(mainView.subviews[0].imageView, IMAGE_ID);
66
54
 
55
+ // Add Constraints
67
56
  getAbsoluteConstraints(IMAGE_ID, CONTAINER_ID).forEach(constraint => {
68
57
  // <constraint firstItem="EXPO-SplashScreen" firstAttribute="top" secondItem="EXPO-ContainerView" secondAttribute="top" id="2VS-Uz-0LU"/>
69
58
  const constrainsArray = mainView.constraints[0].constraint;
70
59
  removeExisting(constrainsArray, constraint);
71
- }); // Add resource
60
+ });
72
61
 
62
+ // Add resource
73
63
  const imageSection = xml.document.resources[0].image;
74
64
  const existingImageIndex = imageSection.findIndex(image => image.$.name === imageName);
75
-
76
65
  if (existingImageIndex > -1) {
77
66
  imageSection.splice(existingImageIndex, 1);
78
67
  }
79
-
80
68
  return xml;
81
69
  }
82
-
83
70
  function getAbsoluteConstraints(childId, parentId) {
84
71
  return [createConstraint([childId, 'top'], [parentId, 'top']), createConstraint([childId, 'leading'], [parentId, 'leading']), createConstraint([childId, 'trailing'], [parentId, 'trailing']), createConstraint([childId, 'bottom'], [parentId, 'bottom'])];
85
72
  }
86
-
87
73
  function applyImageToSplashScreenXML(xml, {
88
74
  imageName,
89
75
  contentMode
@@ -112,24 +98,25 @@ function applyImageToSplashScreenXML(xml, {
112
98
  }
113
99
  }]
114
100
  };
115
- const mainView = xml.document.scenes[0].scene[0].objects[0].viewController[0].view[0]; // Add ImageView
101
+ const mainView = xml.document.scenes[0].scene[0].objects[0].viewController[0].view[0];
116
102
 
117
- ensureUniquePush(mainView.subviews[0].imageView, imageView); // Add Constraints
103
+ // Add ImageView
104
+ ensureUniquePush(mainView.subviews[0].imageView, imageView);
118
105
 
106
+ // Add Constraints
119
107
  getAbsoluteConstraints(IMAGE_ID, CONTAINER_ID).forEach(constraint => {
120
108
  // <constraint firstItem="EXPO-SplashScreen" firstAttribute="top" secondItem="EXPO-ContainerView" secondAttribute="top" id="2VS-Uz-0LU"/>
121
109
  const constrainsArray = mainView.constraints[0].constraint;
122
110
  ensureUniquePush(constrainsArray, constraint);
123
- }); // Add resource
111
+ });
124
112
 
113
+ // Add resource
125
114
  const imageSection = xml.document.resources[0].image;
126
115
  const existingImageIndex = imageSection.findIndex(image => image.$.name === imageName);
127
-
128
116
  if (existingImageIndex > -1) {
129
117
  debug(`Removing existing IB image asset at index ${existingImageIndex}`);
130
118
  imageSection.splice(existingImageIndex, 1);
131
119
  }
132
-
133
120
  imageSection.push({
134
121
  // <image name="SplashScreen" width="414" height="736"/>
135
122
  $: {
@@ -140,34 +127,29 @@ function applyImageToSplashScreenXML(xml, {
140
127
  });
141
128
  return xml;
142
129
  }
130
+
143
131
  /**
144
132
  * IB does not allow two items to have the same ID.
145
133
  * This method will add an item by first removing any existing item with the same `$.id`.
146
134
  */
147
-
148
-
149
135
  function ensureUniquePush(array, item) {
150
136
  if (!array) return array;
151
137
  removeExisting(array, item);
152
138
  array.push(item);
153
139
  return array;
154
140
  }
155
-
156
141
  function removeExisting(array, item) {
157
142
  var _item$$;
158
-
159
143
  const id = typeof item === 'string' ? item : (_item$$ = item.$) === null || _item$$ === void 0 ? void 0 : _item$$.id;
160
144
  const existingItem = array === null || array === void 0 ? void 0 : array.findIndex(existingItem => existingItem.$.id === id);
161
-
162
145
  if (existingItem > -1) {
163
146
  debug(`Removing existing IB item with id ${id}, from: %O`, array);
164
147
  array.splice(existingItem, 1);
165
148
  }
166
-
167
149
  return array;
168
- } // Attempt to copy Xcode formatting.
169
-
150
+ }
170
151
 
152
+ // Attempt to copy Xcode formatting.
171
153
  function toString(xml) {
172
154
  const builder = new (_xml2js().Builder)({
173
155
  // @ts-expect-error: untyped
@@ -183,9 +165,8 @@ function toString(xml) {
183
165
  });
184
166
  return builder.buildObject(xml);
185
167
  }
186
- /** Parse string contents into an object. */
187
-
188
168
 
169
+ /** Parse string contents into an object. */
189
170
  function toObjectAsync(contents) {
190
171
  return new (_xml2js().Parser)().parseStringPromise(contents);
191
172
  }
@@ -1 +1 @@
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;EACd,OAAO;IACLC,CAAC,EAAE;MACDL,SADC;MAEDC,cAFC;MAGDC,UAHC;MAIDC,eAJC;MAKDC,QALC;MAMD;MACAE,EAAE,EAAEC,kBAAkB,CAACP,SAAD,EAAYC,cAAZ,EAA4BC,UAA5B,EAAwCC,eAAxC;IAPrB;EADE,CAAP;AAWD;;AAEM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FK,EAGL;EAAA;;EACA,MAAMtD,EAAE,GAAG,OAAOsD,IAAP,KAAgB,QAAhB,GAA2BA,IAA3B,cAAkCA,IAAI,CAACvD,CAAvC,4CAAkC,QAAQC,EAArD;EACA,MAAMuD,YAAY,GAAGF,KAAH,aAAGA,KAAH,uBAAGA,KAAK,CAAErB,SAAP,CAAkBuB,YAAD,IAAkBA,YAAY,CAACxD,CAAb,CAAeC,EAAf,KAAsBA,EAAzD,CAArB;;EACA,IAAIuD,YAAY,GAAG,CAAC,CAApB,EAAuB;IACrBhE,KAAK,CAAE,qCAAoCS,EAAG,YAAzC,EAAsDqD,KAAtD,CAAL;IACAA,KAAK,CAACnB,MAAN,CAAaqB,YAAb,EAA2B,CAA3B;EACD;;EACD,OAAOF,KAAP;AACD,C,CAED;;;AACO,SAASG,QAAT,CAAkB7C,GAAlB,EAAoC;EACzC,MAAM8C,OAAO,GAAG,KAAIC,iBAAJ,EAAY;IAC1B;IACAC,qBAAqB,EAAE,IAFG;IAG1BC,MAAM,EAAE;MACNC,OAAO,EAAE,KADH;MAENC,QAAQ,EAAE;IAFJ,CAHkB;IAO1BC,UAAU,EAAE;MACVC,MAAM,EAAE,IADE;MAEVC,MAAM,EAAE;IAFE;EAPc,CAAZ,CAAhB;EAYA,OAAOR,OAAO,CAACS,WAAR,CAAoBvD,GAApB,CAAP;AACD;AAED;;;AACO,SAASwD,aAAT,CAAuBC,QAAvB,EAAyC;EAC9C,OAAO,KAAIC,gBAAJ,IAAaC,kBAAb,CAAgCF,QAAhC,CAAP;AACD"}
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;AAAyC;AAEzC,MAAMA,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAC5B,8DAA8D,CACzC;AAgQhB,SAASC,gBAAgB,CAC9B,CAACC,SAAS,EAAEC,cAAc,CAAgC,EAC1D,CAACC,UAAU,EAAEC,eAAe,CAAgC,EAC5DC,QAAiB,EACH;EACd,OAAO;IACLC,CAAC,EAAE;MACDL,SAAS;MACTC,cAAc;MACdC,UAAU;MACVC,eAAe;MACfC,QAAQ;MACR;MACAE,EAAE,EAAEC,kBAAkB,CAACP,SAAS,EAAEC,cAAc,EAAEC,UAAU,EAAEC,eAAe;IAC/E;EACF,CAAC;AACH;AAEO,SAASI,kBAAkB,CAAC,GAAGC,UAAoB,EAAE;EAC1D,OAAOC,iBAAM,CAACC,UAAU,CAAC,MAAM,CAAC,CAACC,MAAM,CAACH,UAAU,CAACI,IAAI,CAAC,GAAG,CAAC,CAAC,CAACC,MAAM,CAAC,KAAK,CAAC;AAC7E;AAEA,MAAMC,QAAQ,GAAG,mBAAmB;AACpC,MAAMC,YAAY,GAAG,oBAAoB;AAElC,SAASC,2BAA2B,CACzCC,GAA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CAAE,qCAAoCS,EAAG,YAAW,EAAEqD,KAAK,CAAC;IACjEA,KAAK,CAACnB,MAAM,CAACqB,YAAY,EAAE,CAAC,CAAC;EAC/B;EACA,OAAOF,KAAK;AACd;;AAEA;AACO,SAASG,QAAQ,CAAC7C,GAAQ,EAAU;EACzC,MAAM8C,OAAO,GAAG,KAAIC,iBAAO,EAAC;IAC1B;IACAC,qBAAqB,EAAE,IAAI;IAC3BC,MAAM,EAAE;MACNC,OAAO,EAAE,KAAK;MACdC,QAAQ,EAAE;IACZ,CAAC;IACDC,UAAU,EAAE;MACVC,MAAM,EAAE,IAAI;MACZC,MAAM,EAAE;IACV;EACF,CAAC,CAAC;EACF,OAAOR,OAAO,CAACS,WAAW,CAACvD,GAAG,CAAC;AACjC;;AAEA;AACO,SAASwD,aAAa,CAACC,QAAgB,EAAE;EAC9C,OAAO,KAAIC,gBAAM,GAAE,CAACC,kBAAkB,CAACF,QAAQ,CAAC;AAClD"}
@@ -4,41 +4,30 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  function _createLegacyPlugin() {
9
8
  const data = require("../createLegacyPlugin");
10
-
11
9
  _createLegacyPlugin = function () {
12
10
  return data;
13
11
  };
14
-
15
12
  return data;
16
13
  }
17
-
18
14
  function _withAndroidSplashScreen() {
19
15
  const data = require("./withAndroidSplashScreen");
20
-
21
16
  _withAndroidSplashScreen = function () {
22
17
  return data;
23
18
  };
24
-
25
19
  return data;
26
20
  }
27
-
28
21
  function _withIosSplashScreen() {
29
22
  const data = require("./withIosSplashScreen");
30
-
31
23
  _withIosSplashScreen = function () {
32
24
  return data;
33
25
  };
34
-
35
26
  return data;
36
27
  }
37
-
38
28
  var _default = (0, _createLegacyPlugin().createLegacyPlugin)({
39
29
  packageName: 'expo-splash-screen',
40
30
  fallback: [_withAndroidSplashScreen().withAndroidSplashScreen, _withIosSplashScreen().withIosSplashScreen]
41
31
  });
42
-
43
32
  exports.default = _default;
44
33
  //# sourceMappingURL=expo-splash-screen.js.map
@@ -1 +1 @@
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
+ {"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;AAA4D,eAE7C,IAAAA,wCAAkB,EAAC;EAChCC,WAAW,EAAE,oBAAoB;EACjCC,QAAQ,EAAE,CAACC,kDAAuB,EAAEC,0CAAmB;AACzD,CAAC,CAAC;AAAA"}