@expo/prebuild-config 8.0.7 → 8.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/plugins/icons/AssetContents.d.ts +16 -2
- package/build/plugins/icons/AssetContents.js.map +1 -1
- package/build/plugins/icons/withAndroidIcons.js +36 -8
- package/build/plugins/icons/withAndroidIcons.js.map +1 -1
- package/build/plugins/unversioned/expo-splash-screen/InterfaceBuilder.d.ts +16 -0
- package/build/plugins/unversioned/expo-splash-screen/InterfaceBuilder.js +21 -5
- package/build/plugins/unversioned/expo-splash-screen/InterfaceBuilder.js.map +1 -1
- package/build/plugins/unversioned/expo-splash-screen/withIosSplashAssets.js +39 -45
- package/build/plugins/unversioned/expo-splash-screen/withIosSplashAssets.js.map +1 -1
- package/build/plugins/unversioned/expo-splash-screen/withIosSplashColors.d.ts +4 -0
- package/build/plugins/unversioned/expo-splash-screen/withIosSplashColors.js +135 -0
- package/build/plugins/unversioned/expo-splash-screen/withIosSplashColors.js.map +1 -0
- package/build/plugins/unversioned/expo-splash-screen/withIosSplashScreen.js +8 -1
- package/build/plugins/unversioned/expo-splash-screen/withIosSplashScreen.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,20 +1,34 @@
|
|
|
1
1
|
export type ContentsJsonImageIdiom = 'iphone' | 'ipad' | 'watchos' | 'ios' | 'ios-marketing' | 'universal';
|
|
2
2
|
export type ContentsJsonImageAppearanceLuminosityType = 'dark' | 'tinted';
|
|
3
|
-
export type
|
|
3
|
+
export type ContentsJsonAppearance = {
|
|
4
4
|
appearance: 'luminosity';
|
|
5
5
|
value: ContentsJsonImageAppearanceLuminosityType;
|
|
6
6
|
};
|
|
7
7
|
export type ContentsJsonImageScale = '1x' | '2x' | '3x';
|
|
8
8
|
export interface ContentsJsonImage {
|
|
9
|
-
appearances?:
|
|
9
|
+
appearances?: ContentsJsonAppearance[];
|
|
10
10
|
idiom: ContentsJsonImageIdiom;
|
|
11
11
|
size?: string;
|
|
12
12
|
scale?: ContentsJsonImageScale;
|
|
13
13
|
filename?: string;
|
|
14
14
|
platform?: ContentsJsonImageIdiom;
|
|
15
15
|
}
|
|
16
|
+
export interface ContentsJsonColor {
|
|
17
|
+
appearances?: ContentsJsonAppearance[];
|
|
18
|
+
idiom: ContentsJsonImageIdiom;
|
|
19
|
+
color: {
|
|
20
|
+
'color-space': 'srgb';
|
|
21
|
+
components: {
|
|
22
|
+
alpha: string;
|
|
23
|
+
blue: string;
|
|
24
|
+
green: string;
|
|
25
|
+
red: string;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
}
|
|
16
29
|
export interface ContentsJson {
|
|
17
30
|
images: ContentsJsonImage[];
|
|
31
|
+
colors: ContentsJsonColor[];
|
|
18
32
|
info: {
|
|
19
33
|
version: number;
|
|
20
34
|
author: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AssetContents.js","names":["_fsExtra","data","_interopRequireDefault","require","_path","e","__esModule","default","createContentsJsonItem","item","writeContentsJsonAsync","directory","images","fs","ensureDir","writeFile","join","JSON","stringify","info","version","author"],"sources":["../../../src/plugins/icons/AssetContents.ts"],"sourcesContent":["import fs from 'fs-extra';\nimport { join } from 'path';\n\nexport type ContentsJsonImageIdiom =\n | 'iphone'\n | 'ipad'\n | 'watchos'\n | 'ios'\n | 'ios-marketing'\n | 'universal';\n\nexport type ContentsJsonImageAppearanceLuminosityType = 'dark' | 'tinted';\n\nexport type
|
|
1
|
+
{"version":3,"file":"AssetContents.js","names":["_fsExtra","data","_interopRequireDefault","require","_path","e","__esModule","default","createContentsJsonItem","item","writeContentsJsonAsync","directory","images","fs","ensureDir","writeFile","join","JSON","stringify","info","version","author"],"sources":["../../../src/plugins/icons/AssetContents.ts"],"sourcesContent":["import fs from 'fs-extra';\nimport { join } from 'path';\n\nexport type ContentsJsonImageIdiom =\n | 'iphone'\n | 'ipad'\n | 'watchos'\n | 'ios'\n | 'ios-marketing'\n | 'universal';\n\nexport type ContentsJsonImageAppearanceLuminosityType = 'dark' | 'tinted';\n\nexport type ContentsJsonAppearance = {\n appearance: 'luminosity';\n value: ContentsJsonImageAppearanceLuminosityType;\n};\n\nexport type ContentsJsonImageScale = '1x' | '2x' | '3x';\n\nexport interface ContentsJsonImage {\n appearances?: ContentsJsonAppearance[];\n idiom: ContentsJsonImageIdiom;\n size?: string;\n scale?: ContentsJsonImageScale;\n filename?: string;\n platform?: ContentsJsonImageIdiom;\n}\n\nexport interface ContentsJsonColor {\n appearances?: ContentsJsonAppearance[];\n idiom: ContentsJsonImageIdiom;\n color: {\n 'color-space': 'srgb';\n components: {\n alpha: string;\n blue: string;\n green: string;\n red: string;\n };\n };\n}\n\nexport interface ContentsJson {\n images: ContentsJsonImage[];\n colors: ContentsJsonColor[];\n info: {\n version: number;\n author: string;\n };\n}\n\nexport function createContentsJsonItem(item: ContentsJsonImage): ContentsJsonImage {\n return item;\n}\n\n/**\n * Writes the Config.json which is used to assign images to their respective platform, dpi, and idiom.\n *\n * @param directory path to add the Contents.json to.\n * @param contents image json data\n */\nexport async function writeContentsJsonAsync(\n directory: string,\n { images }: Pick<ContentsJson, 'images'>\n): Promise<void> {\n await fs.ensureDir(directory);\n\n await fs.writeFile(\n join(directory, 'Contents.json'),\n JSON.stringify(\n {\n images,\n info: {\n version: 1,\n // common practice is for the tool that generated the icons to be the \"author\"\n author: 'expo',\n },\n },\n null,\n 2\n )\n );\n}\n"],"mappings":";;;;;;;AAAA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,MAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,KAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA4B,SAAAC,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAmDrB,SAASG,sBAAsBA,CAACC,IAAuB,EAAqB;EACjF,OAAOA,IAAI;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,eAAeC,sBAAsBA,CAC1CC,SAAiB,EACjB;EAAEC;AAAqC,CAAC,EACzB;EACf,MAAMC,kBAAE,CAACC,SAAS,CAACH,SAAS,CAAC;EAE7B,MAAME,kBAAE,CAACE,SAAS,CAChB,IAAAC,YAAI,EAACL,SAAS,EAAE,eAAe,CAAC,EAChCM,IAAI,CAACC,SAAS,CACZ;IACEN,MAAM;IACNO,IAAI,EAAE;MACJC,OAAO,EAAE,CAAC;MACV;MACAC,MAAM,EAAE;IACV;EACF,CAAC,EACD,IAAI,EACJ,CACF,CACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -122,7 +122,7 @@ function setRoundIconManifest(config, manifest) {
|
|
|
122
122
|
}
|
|
123
123
|
const withAndroidAdaptiveIconColors = (config, backgroundColor) => {
|
|
124
124
|
return (0, _configPlugins().withAndroidColors)(config, config => {
|
|
125
|
-
config.modResults = setBackgroundColor(backgroundColor ?? '#
|
|
125
|
+
config.modResults = setBackgroundColor(backgroundColor ?? '#ffffff', config.modResults);
|
|
126
126
|
return config;
|
|
127
127
|
});
|
|
128
128
|
};
|
|
@@ -276,7 +276,7 @@ async function generateMultiLayerImageAsync(projectRoot, {
|
|
|
276
276
|
scale,
|
|
277
277
|
backgroundColor: backgroundColor ?? 'transparent',
|
|
278
278
|
borderRadiusRatio,
|
|
279
|
-
|
|
279
|
+
imageStlye: getImageStyle(outputImageFileName)
|
|
280
280
|
});
|
|
281
281
|
if (backgroundImage) {
|
|
282
282
|
const backgroundLayer = await generateIconAsync(projectRoot, {
|
|
@@ -340,11 +340,12 @@ async function generateIconAsync(projectRoot, {
|
|
|
340
340
|
scale,
|
|
341
341
|
backgroundColor,
|
|
342
342
|
borderRadiusRatio,
|
|
343
|
-
|
|
343
|
+
imageStlye
|
|
344
344
|
}) {
|
|
345
|
-
const
|
|
346
|
-
const
|
|
347
|
-
const
|
|
345
|
+
const isForegound = imageStlye === 'foreground';
|
|
346
|
+
const baseline = isForegound ? FOREGROUND_BASELINE_PIXEL_SIZE : ICON_BASELINE_PIXEL_SIZE;
|
|
347
|
+
const bgIconSizePx = Math.round(baseline * scale);
|
|
348
|
+
const iconSizePx = Math.round(bgIconSizePx * getImageScale(imageStlye ?? 'background'));
|
|
348
349
|
const {
|
|
349
350
|
source: foreground
|
|
350
351
|
} = await (0, _imageUtils().generateImageAsync)({
|
|
@@ -352,14 +353,14 @@ async function generateIconAsync(projectRoot, {
|
|
|
352
353
|
cacheType
|
|
353
354
|
}, {
|
|
354
355
|
src,
|
|
355
|
-
resizeMode: '
|
|
356
|
+
resizeMode: 'cover',
|
|
356
357
|
width: iconSizePx,
|
|
357
358
|
height: iconSizePx
|
|
358
359
|
});
|
|
359
360
|
const background = await (0, _imageUtils().generateImageBackgroundAsync)({
|
|
360
361
|
width: bgIconSizePx,
|
|
361
362
|
height: bgIconSizePx,
|
|
362
|
-
backgroundColor:
|
|
363
|
+
backgroundColor: isForegound ? 'transparent' : backgroundColor,
|
|
363
364
|
resizeMode: 'cover',
|
|
364
365
|
borderRadius: borderRadiusRatio ? bgIconSizePx * borderRadiusRatio : undefined
|
|
365
366
|
});
|
|
@@ -372,4 +373,31 @@ async function generateIconAsync(projectRoot, {
|
|
|
372
373
|
y
|
|
373
374
|
});
|
|
374
375
|
}
|
|
376
|
+
function getImageStyle(outputFileName) {
|
|
377
|
+
switch (outputFileName) {
|
|
378
|
+
case IC_LAUNCHER_WEBP:
|
|
379
|
+
return 'legacy';
|
|
380
|
+
case IC_LAUNCHER_BACKGROUND_WEBP:
|
|
381
|
+
return 'background';
|
|
382
|
+
case IC_LAUNCHER_FOREGROUND_WEBP:
|
|
383
|
+
return 'foreground';
|
|
384
|
+
case IC_LAUNCHER_ROUND_WEBP:
|
|
385
|
+
return 'rounded';
|
|
386
|
+
case IC_LAUNCHER_MONOCHROME_WEBP:
|
|
387
|
+
return 'monochrome';
|
|
388
|
+
}
|
|
389
|
+
return 'background';
|
|
390
|
+
}
|
|
391
|
+
function getImageScale(imageStyle) {
|
|
392
|
+
switch (imageStyle) {
|
|
393
|
+
case 'legacy':
|
|
394
|
+
case 'rounded':
|
|
395
|
+
return 0.9;
|
|
396
|
+
case 'foreground':
|
|
397
|
+
case 'background':
|
|
398
|
+
return 0.7;
|
|
399
|
+
case 'monochrome':
|
|
400
|
+
return 1;
|
|
401
|
+
}
|
|
402
|
+
}
|
|
375
403
|
//# sourceMappingURL=withAndroidIcons.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withAndroidIcons.js","names":["_configPlugins","data","require","_imageUtils","_fsExtra","_interopRequireDefault","_path","_withAndroidManifestIcons","e","__esModule","default","Colors","AndroidConfig","dpiValues","exports","mdpi","folderName","scale","hdpi","xhdpi","xxhdpi","xxxhdpi","ICON_BASELINE_PIXEL_SIZE","FOREGROUND_BASELINE_PIXEL_SIZE","ANDROID_RES_PATH","MIPMAP_ANYDPI_V26","ICON_BACKGROUND","IC_LAUNCHER_WEBP","IC_LAUNCHER_ROUND_WEBP","IC_LAUNCHER_BACKGROUND_WEBP","IC_LAUNCHER_FOREGROUND_WEBP","IC_LAUNCHER_MONOCHROME_WEBP","IC_LAUNCHER_XML","IC_LAUNCHER_ROUND_XML","withAndroidIcons","config","foregroundImage","backgroundColor","backgroundImage","monochromeImage","getAdaptiveIcon","icon","getIcon","withAndroidManifestIcons","withAndroidAdaptiveIconColors","withDangerousMod","setIconAsync","modRequest","projectRoot","isAdaptive","android","adaptiveIcon","setRoundIconManifest","manifest","application","Manifest","getMainApplicationOrThrow","$","withAndroidColors","modResults","setBackgroundColor","configureLegacyIconAsync","generateRoundIconAsync","deleteIconNamedAsync","configureAdaptiveIconAsync","generateMultiLayerImageAsync","outputImageFileName","imageCacheFolder","backgroundImageCacheFolder","borderRadiusRatio","generateMonochromeImageAsync","backgroundImageFileName","icLauncherXmlString","createAdaptiveIconXmlString","createAdaptiveIconXmlFiles","colors","assignColorValue","value","name","background","iconElements","push","join","add","anyDpiV26Directory","path","resolve","fs","ensureDir","launcherPath","launcherRoundPath","Promise","all","writeFile","map","existsSync","remove","iterateDpiValues","dpiFolder","iconLayer","generateIconAsync","cacheType","src","isForeground","backgroundLayer","compositeImagesAsync","foreground","monochromeIcon","callback","Object","values","baseline","bgIconSizePx","iconSizePx","source","generateImageAsync","resizeMode","width","height","generateImageBackgroundAsync","borderRadius","undefined","x","y"],"sources":["../../../src/plugins/icons/withAndroidIcons.ts"],"sourcesContent":["import {\n AndroidConfig,\n ConfigPlugin,\n withAndroidColors,\n withDangerousMod,\n} from '@expo/config-plugins';\nimport { ResourceXML } from '@expo/config-plugins/build/android/Resources';\nimport { ExpoConfig } from '@expo/config-types';\nimport {\n generateImageAsync,\n compositeImagesAsync,\n generateImageBackgroundAsync,\n} from '@expo/image-utils';\nimport fs from 'fs-extra';\nimport path from 'path';\n\nimport { withAndroidManifestIcons } from './withAndroidManifestIcons';\n\nconst { Colors } = AndroidConfig;\n\ntype DPIString = 'mdpi' | 'hdpi' | 'xhdpi' | 'xxhdpi' | 'xxxhdpi';\ntype dpiMap = Record<DPIString, { folderName: string; scale: number }>;\n\nexport const dpiValues: dpiMap = {\n mdpi: { folderName: 'mipmap-mdpi', scale: 1 },\n hdpi: { folderName: 'mipmap-hdpi', scale: 1.5 },\n xhdpi: { folderName: 'mipmap-xhdpi', scale: 2 },\n xxhdpi: { folderName: 'mipmap-xxhdpi', scale: 3 },\n xxxhdpi: { folderName: 'mipmap-xxxhdpi', scale: 4 },\n};\nconst ICON_BASELINE_PIXEL_SIZE = 48;\nconst FOREGROUND_BASELINE_PIXEL_SIZE = 108;\n\nexport const ANDROID_RES_PATH = 'android/app/src/main/res/';\nconst MIPMAP_ANYDPI_V26 = 'mipmap-anydpi-v26';\nconst ICON_BACKGROUND = 'iconBackground';\nconst IC_LAUNCHER_WEBP = 'ic_launcher.webp';\nconst IC_LAUNCHER_ROUND_WEBP = 'ic_launcher_round.webp';\nconst IC_LAUNCHER_BACKGROUND_WEBP = 'ic_launcher_background.webp';\nconst IC_LAUNCHER_FOREGROUND_WEBP = 'ic_launcher_foreground.webp';\nconst IC_LAUNCHER_MONOCHROME_WEBP = 'ic_launcher_monochrome.webp';\nconst IC_LAUNCHER_XML = 'ic_launcher.xml';\nconst IC_LAUNCHER_ROUND_XML = 'ic_launcher_round.xml';\n\nexport const withAndroidIcons: ConfigPlugin = (config) => {\n const { foregroundImage, backgroundColor, backgroundImage, monochromeImage } =\n getAdaptiveIcon(config);\n const icon = foregroundImage ?? getIcon(config);\n\n if (!icon) {\n return config;\n }\n\n config = withAndroidManifestIcons(config);\n // Apply colors.xml changes\n config = withAndroidAdaptiveIconColors(config, backgroundColor);\n return withDangerousMod(config, [\n 'android',\n async (config) => {\n await setIconAsync(config.modRequest.projectRoot, {\n icon,\n backgroundColor,\n backgroundImage,\n monochromeImage,\n isAdaptive: !!config.android?.adaptiveIcon,\n });\n return config;\n },\n ]);\n};\n\nexport function setRoundIconManifest(\n config: Pick<ExpoConfig, 'android'>,\n manifest: AndroidConfig.Manifest.AndroidManifest\n): AndroidConfig.Manifest.AndroidManifest {\n const isAdaptive = !!config.android?.adaptiveIcon;\n const application = AndroidConfig.Manifest.getMainApplicationOrThrow(manifest);\n\n if (isAdaptive) {\n application.$['android:roundIcon'] = '@mipmap/ic_launcher_round';\n } else {\n delete application.$['android:roundIcon'];\n }\n return manifest;\n}\n\nconst withAndroidAdaptiveIconColors: ConfigPlugin<string | null> = (config, backgroundColor) => {\n return withAndroidColors(config, (config) => {\n config.modResults = setBackgroundColor(backgroundColor ?? '#FFFFFF', config.modResults);\n return config;\n });\n};\n\nexport function getIcon(config: ExpoConfig) {\n return config.android?.icon || config.icon || null;\n}\n\nexport function getAdaptiveIcon(config: ExpoConfig) {\n return {\n foregroundImage: config.android?.adaptiveIcon?.foregroundImage ?? null,\n backgroundColor: config.android?.adaptiveIcon?.backgroundColor ?? null,\n backgroundImage: config.android?.adaptiveIcon?.backgroundImage ?? null,\n monochromeImage: config.android?.adaptiveIcon?.monochromeImage ?? null,\n };\n}\n\n/**\n * Resizes the user-provided icon to create a set of legacy icon files in\n * their respective \"mipmap\" directories for <= Android 7, and creates a set of adaptive\n * icon files for > Android 7 from the adaptive icon files (if provided).\n */\nexport async function setIconAsync(\n projectRoot: string,\n {\n icon,\n backgroundColor,\n backgroundImage,\n monochromeImage,\n isAdaptive,\n }: {\n icon: string | null;\n backgroundColor: string | null;\n backgroundImage: string | null;\n monochromeImage: string | null;\n isAdaptive: boolean;\n }\n) {\n if (!icon) {\n return null;\n }\n\n await configureLegacyIconAsync(projectRoot, icon, backgroundImage, backgroundColor);\n if (isAdaptive) {\n await generateRoundIconAsync(projectRoot, icon, backgroundImage, backgroundColor);\n } else {\n await deleteIconNamedAsync(projectRoot, IC_LAUNCHER_ROUND_WEBP);\n }\n await configureAdaptiveIconAsync(\n projectRoot,\n icon,\n backgroundImage,\n backgroundColor,\n monochromeImage,\n isAdaptive\n );\n\n return true;\n}\n\n/**\n * Configures legacy icon files to be used on Android 7 and earlier. If adaptive icon configuration\n * was provided, we create a pseudo-adaptive icon by layering the provided files (or background\n * color if no backgroundImage is provided. If no backgroundImage and no backgroundColor are provided,\n * the background is set to transparent.)\n */\nasync function configureLegacyIconAsync(\n projectRoot: string,\n icon: string,\n backgroundImage: string | null,\n backgroundColor: string | null\n) {\n return generateMultiLayerImageAsync(projectRoot, {\n icon,\n backgroundImage,\n backgroundColor,\n outputImageFileName: IC_LAUNCHER_WEBP,\n imageCacheFolder: 'android-standard-square',\n backgroundImageCacheFolder: 'android-standard-square-background',\n });\n}\n\nasync function generateRoundIconAsync(\n projectRoot: string,\n icon: string,\n backgroundImage: string | null,\n backgroundColor: string | null\n) {\n return generateMultiLayerImageAsync(projectRoot, {\n icon,\n borderRadiusRatio: 0.5,\n outputImageFileName: IC_LAUNCHER_ROUND_WEBP,\n backgroundImage,\n backgroundColor,\n imageCacheFolder: 'android-standard-circle',\n backgroundImageCacheFolder: 'android-standard-round-background',\n });\n}\n\n/**\n * Configures adaptive icon files to be used on Android 8 and up. A foreground image must be provided,\n * and will have a transparent background unless:\n * - A backgroundImage is provided, or\n * - A backgroundColor was specified\n */\nexport async function configureAdaptiveIconAsync(\n projectRoot: string,\n foregroundImage: string,\n backgroundImage: string | null,\n backgroundColor: string | null,\n monochromeImage: string | null,\n isAdaptive: boolean\n) {\n if (monochromeImage) {\n await generateMonochromeImageAsync(projectRoot, {\n icon: monochromeImage,\n imageCacheFolder: 'android-adaptive-monochrome',\n outputImageFileName: IC_LAUNCHER_MONOCHROME_WEBP,\n });\n }\n await generateMultiLayerImageAsync(projectRoot, {\n backgroundColor,\n backgroundImage,\n backgroundImageCacheFolder: 'android-adaptive-background',\n outputImageFileName: IC_LAUNCHER_FOREGROUND_WEBP,\n icon: foregroundImage,\n imageCacheFolder: 'android-adaptive-foreground',\n backgroundImageFileName: IC_LAUNCHER_BACKGROUND_WEBP,\n });\n\n // create ic_launcher.xml and ic_launcher_round.xml\n const icLauncherXmlString = createAdaptiveIconXmlString(backgroundImage, monochromeImage);\n await createAdaptiveIconXmlFiles(\n projectRoot,\n icLauncherXmlString,\n // If the user only defined icon and not android.adaptiveIcon, then skip enabling the layering system\n // this will scale the image down and present it uncropped.\n isAdaptive\n );\n}\n\nfunction setBackgroundColor(backgroundColor: string | null, colors: ResourceXML) {\n return Colors.assignColorValue(colors, {\n value: backgroundColor,\n name: ICON_BACKGROUND,\n });\n}\n\nexport const createAdaptiveIconXmlString = (\n backgroundImage: string | null,\n monochromeImage: string | null\n) => {\n const background = backgroundImage ? `@drawable/ic_launcher_background` : `@color/iconBackground`;\n\n const iconElements: string[] = [\n `<background android:drawable=\"${background}\"/>`,\n '<foreground android:drawable=\"@mipmap/ic_launcher_foreground\"/>',\n ];\n\n if (monochromeImage) {\n iconElements.push('<monochrome android:drawable=\"@mipmap/ic_launcher_monochrome\"/>');\n }\n\n return `<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<adaptive-icon xmlns:android=\"http://schemas.android.com/apk/res/android\">\n ${iconElements.join('\\n ')}\n</adaptive-icon>`;\n};\n\nasync function createAdaptiveIconXmlFiles(\n projectRoot: string,\n icLauncherXmlString: string,\n add: boolean\n) {\n const anyDpiV26Directory = path.resolve(projectRoot, ANDROID_RES_PATH, MIPMAP_ANYDPI_V26);\n await fs.ensureDir(anyDpiV26Directory);\n const launcherPath = path.resolve(anyDpiV26Directory, IC_LAUNCHER_XML);\n const launcherRoundPath = path.resolve(anyDpiV26Directory, IC_LAUNCHER_ROUND_XML);\n if (add) {\n await Promise.all([\n fs.writeFile(launcherPath, icLauncherXmlString),\n fs.writeFile(launcherRoundPath, icLauncherXmlString),\n ]);\n } else {\n // Remove the xml if the icon switches from adaptive to standard.\n await Promise.all(\n [launcherPath, launcherRoundPath].map(async (path) => {\n if (fs.existsSync(path)) {\n return fs.remove(path);\n }\n })\n );\n }\n}\n\nasync function generateMultiLayerImageAsync(\n projectRoot: string,\n {\n icon,\n backgroundColor,\n backgroundImage,\n imageCacheFolder,\n backgroundImageCacheFolder,\n borderRadiusRatio,\n outputImageFileName,\n backgroundImageFileName,\n }: {\n icon: string;\n backgroundImage: string | null;\n backgroundColor: string | null;\n imageCacheFolder: string;\n backgroundImageCacheFolder: string;\n backgroundImageFileName?: string;\n borderRadiusRatio?: number;\n outputImageFileName: string;\n }\n) {\n await iterateDpiValues(projectRoot, async ({ dpiFolder, scale }) => {\n let iconLayer = await generateIconAsync(projectRoot, {\n cacheType: imageCacheFolder,\n src: icon,\n scale,\n backgroundColor: backgroundColor ?? 'transparent',\n borderRadiusRatio,\n isForeground: outputImageFileName === IC_LAUNCHER_FOREGROUND_WEBP,\n });\n\n if (backgroundImage) {\n const backgroundLayer = await generateIconAsync(projectRoot, {\n cacheType: backgroundImageCacheFolder,\n src: backgroundImage,\n scale,\n backgroundColor: backgroundColor ?? 'transparent',\n borderRadiusRatio,\n });\n\n if (backgroundImageFileName) {\n await fs.writeFile(path.resolve(dpiFolder, backgroundImageFileName), backgroundLayer);\n } else {\n iconLayer = await compositeImagesAsync({\n foreground: iconLayer,\n background: backgroundLayer,\n });\n }\n } else if (backgroundImageFileName) {\n // Remove any instances of ic_launcher_background.png that are there from previous icons\n await deleteIconNamedAsync(projectRoot, backgroundImageFileName);\n }\n\n await fs.ensureDir(dpiFolder);\n await fs.writeFile(path.resolve(dpiFolder, outputImageFileName), iconLayer);\n });\n}\n\nasync function generateMonochromeImageAsync(\n projectRoot: string,\n {\n icon,\n imageCacheFolder,\n outputImageFileName,\n }: { icon: string; imageCacheFolder: string; outputImageFileName: string }\n) {\n await iterateDpiValues(projectRoot, async ({ dpiFolder, scale }) => {\n const monochromeIcon = await generateIconAsync(projectRoot, {\n cacheType: imageCacheFolder,\n src: icon,\n scale,\n backgroundColor: 'transparent',\n });\n await fs.ensureDir(dpiFolder);\n await fs.writeFile(path.resolve(dpiFolder, outputImageFileName), monochromeIcon);\n });\n}\n\nfunction iterateDpiValues(\n projectRoot: string,\n callback: (value: { dpiFolder: string; folderName: string; scale: number }) => Promise<void>\n) {\n return Promise.all(\n Object.values(dpiValues).map((value) =>\n callback({\n dpiFolder: path.resolve(projectRoot, ANDROID_RES_PATH, value.folderName),\n ...value,\n })\n )\n );\n}\n\nasync function deleteIconNamedAsync(projectRoot: string, name: string) {\n return iterateDpiValues(projectRoot, ({ dpiFolder }) => {\n return fs.remove(path.resolve(dpiFolder, name));\n });\n}\n\nasync function generateIconAsync(\n projectRoot: string,\n {\n cacheType,\n src,\n scale,\n backgroundColor,\n borderRadiusRatio,\n isForeground,\n }: {\n cacheType: string;\n src: string;\n scale: number;\n backgroundColor: string;\n borderRadiusRatio?: number;\n isForeground?: boolean;\n }\n) {\n const baseline = isForeground ? FOREGROUND_BASELINE_PIXEL_SIZE : ICON_BASELINE_PIXEL_SIZE;\n const bgIconSizePx = baseline * scale;\n const iconSizePx = bgIconSizePx * (isForeground ? 0.4 : 0.65);\n\n const { source: foreground } = await generateImageAsync(\n { projectRoot, cacheType },\n {\n src,\n resizeMode: 'contain',\n width: iconSizePx,\n height: iconSizePx,\n }\n );\n\n const background = await generateImageBackgroundAsync({\n width: bgIconSizePx,\n height: bgIconSizePx,\n backgroundColor: isForeground ? 'transparent' : backgroundColor,\n resizeMode: 'cover',\n borderRadius: borderRadiusRatio ? bgIconSizePx * borderRadiusRatio : undefined,\n });\n\n const x = (bgIconSizePx - iconSizePx) / 2;\n const y = x;\n\n return compositeImagesAsync({ background, foreground, x, y });\n}\n"],"mappings":";;;;;;;;;;;;;AAAA,SAAAA,eAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,cAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAQA,SAAAE,YAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,WAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAKA,SAAAG,SAAA;EAAA,MAAAH,IAAA,GAAAI,sBAAA,CAAAH,OAAA;EAAAE,QAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,MAAA;EAAA,MAAAL,IAAA,GAAAI,sBAAA,CAAAH,OAAA;EAAAI,KAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAM,0BAAA;EAAA,MAAAN,IAAA,GAAAC,OAAA;EAAAK,yBAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAsE,SAAAI,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEtE,MAAM;EAAEG;AA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,SAAS,EAAEpB,IAAI,CAAC,CAAC;EACjD,CAAC,CAAC;AACJ;AAEA,eAAesB,iBAAiBA,CAC9BpD,WAAmB,EACnB;EACEqD,SAAS;EACTC,GAAG;EACHrF,KAAK;EACLoB,eAAe;EACfgC,iBAAiB;EACjBkC;AAQF,CAAC,EACD;EACA,MAAMQ,QAAQ,GAAGR,YAAY,GAAGhF,8BAA8B,GAAGD,wBAAwB;EACzF,MAAM0F,YAAY,GAAGD,QAAQ,GAAG9F,KAAK;EACrC,MAAMgG,UAAU,GAAGD,YAAY,IAAIT,YAAY,GAAG,GAAG,GAAG,IAAI,CAAC;EAE7D,MAAM;IAAEW,MAAM,EAAER;EAAW,CAAC,GAAG,MAAM,IAAAS,gCAAkB,EACrD;IAAEnE,WAAW;IAAEqD;EAAU,CAAC,EAC1B;IACEC,GAAG;IACHc,UAAU,EAAE,SAAS;IACrBC,KAAK,EAAEJ,UAAU;IACjBK,MAAM,EAAEL;EACV,CACF,CAAC;EAED,MAAMlC,UAAU,GAAG,MAAM,IAAAwC,0CAA4B,EAAC;IACpDF,KAAK,EAAEL,YAAY;IACnBM,MAAM,EAAEN,YAAY;IACpB3E,eAAe,EAAEkE,YAAY,GAAG,aAAa,GAAGlE,eAAe;IAC/D+E,UAAU,EAAE,OAAO;IACnBI,YAAY,EAAEnD,iBAAiB,GAAG2C,YAAY,GAAG3C,iBAAiB,GAAGoD;EACvE,CAAC,CAAC;EAEF,MAAMC,CAAC,GAAG,CAACV,YAAY,GAAGC,UAAU,IAAI,CAAC;EACzC,MAAMU,CAAC,GAAGD,CAAC;EAEX,OAAO,IAAAjB,kCAAoB,EAAC;IAAE1B,UAAU;IAAE2B,UAAU;IAAEgB,CAAC;IAAEC;EAAE,CAAC,CAAC;AAC/D","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"withAndroidIcons.js","names":["_configPlugins","data","require","_imageUtils","_fsExtra","_interopRequireDefault","_path","_withAndroidManifestIcons","e","__esModule","default","Colors","AndroidConfig","dpiValues","exports","mdpi","folderName","scale","hdpi","xhdpi","xxhdpi","xxxhdpi","ICON_BASELINE_PIXEL_SIZE","FOREGROUND_BASELINE_PIXEL_SIZE","ANDROID_RES_PATH","MIPMAP_ANYDPI_V26","ICON_BACKGROUND","IC_LAUNCHER_WEBP","IC_LAUNCHER_ROUND_WEBP","IC_LAUNCHER_BACKGROUND_WEBP","IC_LAUNCHER_FOREGROUND_WEBP","IC_LAUNCHER_MONOCHROME_WEBP","IC_LAUNCHER_XML","IC_LAUNCHER_ROUND_XML","withAndroidIcons","config","foregroundImage","backgroundColor","backgroundImage","monochromeImage","getAdaptiveIcon","icon","getIcon","withAndroidManifestIcons","withAndroidAdaptiveIconColors","withDangerousMod","setIconAsync","modRequest","projectRoot","isAdaptive","android","adaptiveIcon","setRoundIconManifest","manifest","application","Manifest","getMainApplicationOrThrow","$","withAndroidColors","modResults","setBackgroundColor","configureLegacyIconAsync","generateRoundIconAsync","deleteIconNamedAsync","configureAdaptiveIconAsync","generateMultiLayerImageAsync","outputImageFileName","imageCacheFolder","backgroundImageCacheFolder","borderRadiusRatio","generateMonochromeImageAsync","backgroundImageFileName","icLauncherXmlString","createAdaptiveIconXmlString","createAdaptiveIconXmlFiles","colors","assignColorValue","value","name","background","iconElements","push","join","add","anyDpiV26Directory","path","resolve","fs","ensureDir","launcherPath","launcherRoundPath","Promise","all","writeFile","map","existsSync","remove","iterateDpiValues","dpiFolder","iconLayer","generateIconAsync","cacheType","src","imageStlye","getImageStyle","backgroundLayer","compositeImagesAsync","foreground","monochromeIcon","callback","Object","values","isForegound","baseline","bgIconSizePx","Math","round","iconSizePx","getImageScale","source","generateImageAsync","resizeMode","width","height","generateImageBackgroundAsync","borderRadius","undefined","x","y","outputFileName","imageStyle"],"sources":["../../../src/plugins/icons/withAndroidIcons.ts"],"sourcesContent":["import {\n AndroidConfig,\n ConfigPlugin,\n withAndroidColors,\n withDangerousMod,\n} from '@expo/config-plugins';\nimport { ResourceXML } from '@expo/config-plugins/build/android/Resources';\nimport { ExpoConfig } from '@expo/config-types';\nimport {\n generateImageAsync,\n compositeImagesAsync,\n generateImageBackgroundAsync,\n} from '@expo/image-utils';\nimport fs from 'fs-extra';\nimport path from 'path';\n\nimport { withAndroidManifestIcons } from './withAndroidManifestIcons';\n\nconst { Colors } = AndroidConfig;\n\ntype DPIString = 'mdpi' | 'hdpi' | 'xhdpi' | 'xxhdpi' | 'xxxhdpi';\ntype dpiMap = Record<DPIString, { folderName: string; scale: number }>;\ntype ImageStyle = 'foreground' | 'background' | 'rounded' | 'monochrome' | 'legacy';\n\nexport const dpiValues: dpiMap = {\n mdpi: { folderName: 'mipmap-mdpi', scale: 1 },\n hdpi: { folderName: 'mipmap-hdpi', scale: 1.5 },\n xhdpi: { folderName: 'mipmap-xhdpi', scale: 2 },\n xxhdpi: { folderName: 'mipmap-xxhdpi', scale: 3 },\n xxxhdpi: { folderName: 'mipmap-xxxhdpi', scale: 4 },\n};\nconst ICON_BASELINE_PIXEL_SIZE = 48;\nconst FOREGROUND_BASELINE_PIXEL_SIZE = 108;\n\nexport const ANDROID_RES_PATH = 'android/app/src/main/res/';\nconst MIPMAP_ANYDPI_V26 = 'mipmap-anydpi-v26';\nconst ICON_BACKGROUND = 'iconBackground';\nconst IC_LAUNCHER_WEBP = 'ic_launcher.webp';\nconst IC_LAUNCHER_ROUND_WEBP = 'ic_launcher_round.webp';\nconst IC_LAUNCHER_BACKGROUND_WEBP = 'ic_launcher_background.webp';\nconst IC_LAUNCHER_FOREGROUND_WEBP = 'ic_launcher_foreground.webp';\nconst IC_LAUNCHER_MONOCHROME_WEBP = 'ic_launcher_monochrome.webp';\nconst IC_LAUNCHER_XML = 'ic_launcher.xml';\nconst IC_LAUNCHER_ROUND_XML = 'ic_launcher_round.xml';\n\nexport const withAndroidIcons: ConfigPlugin = (config) => {\n const { foregroundImage, backgroundColor, backgroundImage, monochromeImage } =\n getAdaptiveIcon(config);\n const icon = foregroundImage ?? getIcon(config);\n\n if (!icon) {\n return config;\n }\n\n config = withAndroidManifestIcons(config);\n // Apply colors.xml changes\n config = withAndroidAdaptiveIconColors(config, backgroundColor);\n return withDangerousMod(config, [\n 'android',\n async (config) => {\n await setIconAsync(config.modRequest.projectRoot, {\n icon,\n backgroundColor,\n backgroundImage,\n monochromeImage,\n isAdaptive: !!config.android?.adaptiveIcon,\n });\n return config;\n },\n ]);\n};\n\nexport function setRoundIconManifest(\n config: Pick<ExpoConfig, 'android'>,\n manifest: AndroidConfig.Manifest.AndroidManifest\n): AndroidConfig.Manifest.AndroidManifest {\n const isAdaptive = !!config.android?.adaptiveIcon;\n const application = AndroidConfig.Manifest.getMainApplicationOrThrow(manifest);\n\n if (isAdaptive) {\n application.$['android:roundIcon'] = '@mipmap/ic_launcher_round';\n } else {\n delete application.$['android:roundIcon'];\n }\n return manifest;\n}\n\nconst withAndroidAdaptiveIconColors: ConfigPlugin<string | null> = (config, backgroundColor) => {\n return withAndroidColors(config, (config) => {\n config.modResults = setBackgroundColor(backgroundColor ?? '#ffffff', config.modResults);\n return config;\n });\n};\n\nexport function getIcon(config: ExpoConfig) {\n return config.android?.icon || config.icon || null;\n}\n\nexport function getAdaptiveIcon(config: ExpoConfig) {\n return {\n foregroundImage: config.android?.adaptiveIcon?.foregroundImage ?? null,\n backgroundColor: config.android?.adaptiveIcon?.backgroundColor ?? null,\n backgroundImage: config.android?.adaptiveIcon?.backgroundImage ?? null,\n monochromeImage: config.android?.adaptiveIcon?.monochromeImage ?? null,\n };\n}\n\n/**\n * Resizes the user-provided icon to create a set of legacy icon files in\n * their respective \"mipmap\" directories for <= Android 7, and creates a set of adaptive\n * icon files for > Android 7 from the adaptive icon files (if provided).\n */\nexport async function setIconAsync(\n projectRoot: string,\n {\n icon,\n backgroundColor,\n backgroundImage,\n monochromeImage,\n isAdaptive,\n }: {\n icon: string | null;\n backgroundColor: string | null;\n backgroundImage: string | null;\n monochromeImage: string | null;\n isAdaptive: boolean;\n }\n) {\n if (!icon) {\n return null;\n }\n\n await configureLegacyIconAsync(projectRoot, icon, backgroundImage, backgroundColor);\n if (isAdaptive) {\n await generateRoundIconAsync(projectRoot, icon, backgroundImage, backgroundColor);\n } else {\n await deleteIconNamedAsync(projectRoot, IC_LAUNCHER_ROUND_WEBP);\n }\n await configureAdaptiveIconAsync(\n projectRoot,\n icon,\n backgroundImage,\n backgroundColor,\n monochromeImage,\n isAdaptive\n );\n\n return true;\n}\n\n/**\n * Configures legacy icon files to be used on Android 7 and earlier. If adaptive icon configuration\n * was provided, we create a pseudo-adaptive icon by layering the provided files (or background\n * color if no backgroundImage is provided. If no backgroundImage and no backgroundColor are provided,\n * the background is set to transparent.)\n */\nasync function configureLegacyIconAsync(\n projectRoot: string,\n icon: string,\n backgroundImage: string | null,\n backgroundColor: string | null\n) {\n return generateMultiLayerImageAsync(projectRoot, {\n icon,\n backgroundImage,\n backgroundColor,\n outputImageFileName: IC_LAUNCHER_WEBP,\n imageCacheFolder: 'android-standard-square',\n backgroundImageCacheFolder: 'android-standard-square-background',\n });\n}\n\nasync function generateRoundIconAsync(\n projectRoot: string,\n icon: string,\n backgroundImage: string | null,\n backgroundColor: string | null\n) {\n return generateMultiLayerImageAsync(projectRoot, {\n icon,\n borderRadiusRatio: 0.5,\n outputImageFileName: IC_LAUNCHER_ROUND_WEBP,\n backgroundImage,\n backgroundColor,\n imageCacheFolder: 'android-standard-circle',\n backgroundImageCacheFolder: 'android-standard-round-background',\n });\n}\n\n/**\n * Configures adaptive icon files to be used on Android 8 and up. A foreground image must be provided,\n * and will have a transparent background unless:\n * - A backgroundImage is provided, or\n * - A backgroundColor was specified\n */\nexport async function configureAdaptiveIconAsync(\n projectRoot: string,\n foregroundImage: string,\n backgroundImage: string | null,\n backgroundColor: string | null,\n monochromeImage: string | null,\n isAdaptive: boolean\n) {\n if (monochromeImage) {\n await generateMonochromeImageAsync(projectRoot, {\n icon: monochromeImage,\n imageCacheFolder: 'android-adaptive-monochrome',\n outputImageFileName: IC_LAUNCHER_MONOCHROME_WEBP,\n });\n }\n await generateMultiLayerImageAsync(projectRoot, {\n backgroundColor,\n backgroundImage,\n backgroundImageCacheFolder: 'android-adaptive-background',\n outputImageFileName: IC_LAUNCHER_FOREGROUND_WEBP,\n icon: foregroundImage,\n imageCacheFolder: 'android-adaptive-foreground',\n backgroundImageFileName: IC_LAUNCHER_BACKGROUND_WEBP,\n });\n\n // create ic_launcher.xml and ic_launcher_round.xml\n const icLauncherXmlString = createAdaptiveIconXmlString(backgroundImage, monochromeImage);\n await createAdaptiveIconXmlFiles(\n projectRoot,\n icLauncherXmlString,\n // If the user only defined icon and not android.adaptiveIcon, then skip enabling the layering system\n // this will scale the image down and present it uncropped.\n isAdaptive\n );\n}\n\nfunction setBackgroundColor(backgroundColor: string | null, colors: ResourceXML) {\n return Colors.assignColorValue(colors, {\n value: backgroundColor,\n name: ICON_BACKGROUND,\n });\n}\n\nexport const createAdaptiveIconXmlString = (\n backgroundImage: string | null,\n monochromeImage: string | null\n) => {\n const background = backgroundImage ? `@drawable/ic_launcher_background` : `@color/iconBackground`;\n\n const iconElements: string[] = [\n `<background android:drawable=\"${background}\"/>`,\n '<foreground android:drawable=\"@mipmap/ic_launcher_foreground\"/>',\n ];\n\n if (monochromeImage) {\n iconElements.push('<monochrome android:drawable=\"@mipmap/ic_launcher_monochrome\"/>');\n }\n\n return `<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<adaptive-icon xmlns:android=\"http://schemas.android.com/apk/res/android\">\n ${iconElements.join('\\n ')}\n</adaptive-icon>`;\n};\n\nasync function createAdaptiveIconXmlFiles(\n projectRoot: string,\n icLauncherXmlString: string,\n add: boolean\n) {\n const anyDpiV26Directory = path.resolve(projectRoot, ANDROID_RES_PATH, MIPMAP_ANYDPI_V26);\n await fs.ensureDir(anyDpiV26Directory);\n const launcherPath = path.resolve(anyDpiV26Directory, IC_LAUNCHER_XML);\n const launcherRoundPath = path.resolve(anyDpiV26Directory, IC_LAUNCHER_ROUND_XML);\n if (add) {\n await Promise.all([\n fs.writeFile(launcherPath, icLauncherXmlString),\n fs.writeFile(launcherRoundPath, icLauncherXmlString),\n ]);\n } else {\n // Remove the xml if the icon switches from adaptive to standard.\n await Promise.all(\n [launcherPath, launcherRoundPath].map(async (path) => {\n if (fs.existsSync(path)) {\n return fs.remove(path);\n }\n })\n );\n }\n}\n\nasync function generateMultiLayerImageAsync(\n projectRoot: string,\n {\n icon,\n backgroundColor,\n backgroundImage,\n imageCacheFolder,\n backgroundImageCacheFolder,\n borderRadiusRatio,\n outputImageFileName,\n backgroundImageFileName,\n }: {\n icon: string;\n backgroundImage: string | null;\n backgroundColor: string | null;\n imageCacheFolder: string;\n backgroundImageCacheFolder: string;\n backgroundImageFileName?: string;\n borderRadiusRatio?: number;\n outputImageFileName: string;\n }\n) {\n await iterateDpiValues(projectRoot, async ({ dpiFolder, scale }) => {\n let iconLayer = await generateIconAsync(projectRoot, {\n cacheType: imageCacheFolder,\n src: icon,\n scale,\n backgroundColor: backgroundColor ?? 'transparent',\n borderRadiusRatio,\n imageStlye: getImageStyle(outputImageFileName),\n });\n\n if (backgroundImage) {\n const backgroundLayer = await generateIconAsync(projectRoot, {\n cacheType: backgroundImageCacheFolder,\n src: backgroundImage,\n scale,\n backgroundColor: backgroundColor ?? 'transparent',\n borderRadiusRatio,\n });\n\n if (backgroundImageFileName) {\n await fs.writeFile(path.resolve(dpiFolder, backgroundImageFileName), backgroundLayer);\n } else {\n iconLayer = await compositeImagesAsync({\n foreground: iconLayer,\n background: backgroundLayer,\n });\n }\n } else if (backgroundImageFileName) {\n // Remove any instances of ic_launcher_background.png that are there from previous icons\n await deleteIconNamedAsync(projectRoot, backgroundImageFileName);\n }\n\n await fs.ensureDir(dpiFolder);\n await fs.writeFile(path.resolve(dpiFolder, outputImageFileName), iconLayer);\n });\n}\n\nasync function generateMonochromeImageAsync(\n projectRoot: string,\n {\n icon,\n imageCacheFolder,\n outputImageFileName,\n }: { icon: string; imageCacheFolder: string; outputImageFileName: string }\n) {\n await iterateDpiValues(projectRoot, async ({ dpiFolder, scale }) => {\n const monochromeIcon = await generateIconAsync(projectRoot, {\n cacheType: imageCacheFolder,\n src: icon,\n scale,\n backgroundColor: 'transparent',\n });\n await fs.ensureDir(dpiFolder);\n await fs.writeFile(path.resolve(dpiFolder, outputImageFileName), monochromeIcon);\n });\n}\n\nfunction iterateDpiValues(\n projectRoot: string,\n callback: (value: { dpiFolder: string; folderName: string; scale: number }) => Promise<void>\n) {\n return Promise.all(\n Object.values(dpiValues).map((value) =>\n callback({\n dpiFolder: path.resolve(projectRoot, ANDROID_RES_PATH, value.folderName),\n ...value,\n })\n )\n );\n}\n\nasync function deleteIconNamedAsync(projectRoot: string, name: string) {\n return iterateDpiValues(projectRoot, ({ dpiFolder }) => {\n return fs.remove(path.resolve(dpiFolder, name));\n });\n}\n\nasync function generateIconAsync(\n projectRoot: string,\n {\n cacheType,\n src,\n scale,\n backgroundColor,\n borderRadiusRatio,\n imageStlye,\n }: {\n cacheType: string;\n src: string;\n scale: number;\n backgroundColor: string;\n borderRadiusRatio?: number;\n imageStlye?: ImageStyle;\n }\n) {\n const isForegound = imageStlye === 'foreground';\n const baseline = isForegound ? FOREGROUND_BASELINE_PIXEL_SIZE : ICON_BASELINE_PIXEL_SIZE;\n const bgIconSizePx = Math.round(baseline * scale);\n const iconSizePx = Math.round(bgIconSizePx * getImageScale(imageStlye ?? 'background'));\n\n const { source: foreground } = await generateImageAsync(\n { projectRoot, cacheType },\n {\n src,\n resizeMode: 'cover',\n width: iconSizePx,\n height: iconSizePx,\n }\n );\n\n const background = await generateImageBackgroundAsync({\n width: bgIconSizePx,\n height: bgIconSizePx,\n backgroundColor: isForegound ? 'transparent' : backgroundColor,\n resizeMode: 'cover',\n borderRadius: borderRadiusRatio ? bgIconSizePx * borderRadiusRatio : undefined,\n });\n\n const x = (bgIconSizePx - iconSizePx) / 2;\n const y = x;\n\n return compositeImagesAsync({ background, foreground, x, y });\n}\n\nfunction getImageStyle(outputFileName: string): ImageStyle {\n switch (outputFileName) {\n case IC_LAUNCHER_WEBP:\n return 'legacy';\n case IC_LAUNCHER_BACKGROUND_WEBP:\n return 'background';\n case IC_LAUNCHER_FOREGROUND_WEBP:\n return 'foreground';\n case IC_LAUNCHER_ROUND_WEBP:\n return 'rounded';\n case IC_LAUNCHER_MONOCHROME_WEBP:\n return 'monochrome';\n }\n\n return 'background';\n}\n\nfunction getImageScale(imageStyle: ImageStyle) {\n switch (imageStyle) {\n case 'legacy':\n case 'rounded':\n return 0.9;\n case 'foreground':\n case 'background':\n return 0.7;\n case 'monochrome':\n return 1;\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAAA,SAAAA,eAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,cAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAQA,SAAAE,YAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,WAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAKA,SAAAG,SAAA;EAAA,MAAAH,IAAA,GAAAI,sBAAA,CAAAH,OAAA;EAAAE,QAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,MAAA;EAAA,MAAAL,IAAA,GAAAI,sBAAA,CAAAH,OAAA;EAAAI,KAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAM,0BAAA;EAAA,MAAAN,IAAA,GAAAC,OAAA;EAAAK,yBAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAsE,SAAAI,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEtE,MAAM;EAAEG;AAAO,CAAC,GAAGC,8BAAa;AAMzB,MAA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KtG,gBAAgB;MACnB,OAAO,QAAQ;IACjB,KAAKE,2BAA2B;MAC9B,OAAO,YAAY;IACrB,KAAKC,2BAA2B;MAC9B,OAAO,YAAY;IACrB,KAAKF,sBAAsB;MACzB,OAAO,SAAS;IAClB,KAAKG,2BAA2B;MAC9B,OAAO,YAAY;EACvB;EAEA,OAAO,YAAY;AACrB;AAEA,SAASuF,aAAaA,CAACY,UAAsB,EAAE;EAC7C,QAAQA,UAAU;IAChB,KAAK,QAAQ;IACb,KAAK,SAAS;MACZ,OAAO,GAAG;IACZ,KAAK,YAAY;IACjB,KAAK,YAAY;MACf,OAAO,GAAG;IACZ,KAAK,YAAY;MACf,OAAO,CAAC;EACZ;AACF","ignoreList":[]}
|
|
@@ -130,6 +130,7 @@ export type IBViewController = IBItem<{
|
|
|
130
130
|
}>[];
|
|
131
131
|
color: IBItem<{
|
|
132
132
|
key: string | 'backgroundColor';
|
|
133
|
+
name?: string;
|
|
133
134
|
systemColor?: string | 'systemBackgroundColor';
|
|
134
135
|
red?: string;
|
|
135
136
|
green?: string;
|
|
@@ -171,6 +172,16 @@ export type IBResourceImage = IBItem<{
|
|
|
171
172
|
width: number;
|
|
172
173
|
height: number;
|
|
173
174
|
}>;
|
|
175
|
+
export type IBResourceNamedColor = IBItem<{
|
|
176
|
+
name?: string;
|
|
177
|
+
systemColor?: string | 'systemBackgroundColor';
|
|
178
|
+
red?: string;
|
|
179
|
+
green?: string;
|
|
180
|
+
blue?: string;
|
|
181
|
+
alpha?: string;
|
|
182
|
+
colorSpace?: string;
|
|
183
|
+
customColorSpace?: string;
|
|
184
|
+
}>;
|
|
174
185
|
export type IBDevice = IBItem<{
|
|
175
186
|
id: string;
|
|
176
187
|
orientation: string | 'portrait';
|
|
@@ -197,6 +208,11 @@ export type IBSplashScreenDocument = {
|
|
|
197
208
|
}[];
|
|
198
209
|
resources: {
|
|
199
210
|
image: IBResourceImage[];
|
|
211
|
+
namedColor?: IBItem<{
|
|
212
|
+
name: string;
|
|
213
|
+
}, {
|
|
214
|
+
color: IBResourceNamedColor[];
|
|
215
|
+
}>[];
|
|
200
216
|
}[];
|
|
201
217
|
}>;
|
|
202
218
|
};
|
|
@@ -135,16 +135,32 @@ function applyImageToSplashScreenXML(xml, {
|
|
|
135
135
|
// Add background color
|
|
136
136
|
mainView.color = mainView.color ?? [];
|
|
137
137
|
const colorSection = mainView.color;
|
|
138
|
-
const color = parseColor(backgroundColor);
|
|
139
138
|
colorSection.push({
|
|
140
139
|
$: {
|
|
141
140
|
key: 'backgroundColor',
|
|
142
|
-
|
|
143
|
-
alpha: '1',
|
|
144
|
-
colorSpace: 'custom',
|
|
145
|
-
customColorSpace: 'sRGB'
|
|
141
|
+
name: 'SplashScreenBackground'
|
|
146
142
|
}
|
|
147
143
|
});
|
|
144
|
+
|
|
145
|
+
// Add background named color reference
|
|
146
|
+
xml.document.resources[0].namedColor = xml.document.resources[0].namedColor ?? [];
|
|
147
|
+
const namedColorSection = xml.document.resources[0].namedColor;
|
|
148
|
+
const color = parseColor(backgroundColor);
|
|
149
|
+
namedColorSection.push({
|
|
150
|
+
$: {
|
|
151
|
+
name: 'SplashScreenBackground'
|
|
152
|
+
},
|
|
153
|
+
color: [{
|
|
154
|
+
$: {
|
|
155
|
+
alpha: '1.000',
|
|
156
|
+
blue: color.rgb.blue,
|
|
157
|
+
green: color.rgb.green,
|
|
158
|
+
red: color.rgb.red,
|
|
159
|
+
customColorSpace: 'sRGB',
|
|
160
|
+
colorSpace: 'custom'
|
|
161
|
+
}
|
|
162
|
+
}]
|
|
163
|
+
});
|
|
148
164
|
return xml;
|
|
149
165
|
}
|
|
150
166
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InterfaceBuilder.js","names":["_crypto","data","_interopRequireDefault","require","_xml2js","e","__esModule","default","debug","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","backgroundColor","logoWidth","width","height","x","rect","y","userLabel","clipsSubviews","userInteractionEnabled","translatesAutoresizingMaskIntoConstraints","key","ensureUniquePush","push","color","colorSection","parseColor","rgb","alpha","colorSpace","customColorSpace","array","item","existingItem","toString","builder","Builder","preserveChildrenOrder","xmldec","version","encoding","renderOpts","pretty","indent","buildObject","toObjectAsync","contents","Parser","parseStringPromise","value","toUpperCase","replace","length","console","error","process","exit","hex","red","parseInt","toPrecision","green","blue","exports"],"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' | 'centerX' | 'centerY';\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 red?: string;\n green?: string;\n blue?: string;\n alpha?: string;\n colorSpace?: string;\n customColorSpace?: string;\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, 'centerX'], [parentId, 'centerX']),\n createConstraint([childId, 'centerY'], [parentId, 'centerY']),\n ];\n}\n\nexport function applyImageToSplashScreenXML(\n xml: IBSplashScreenDocument,\n {\n imageName,\n contentMode,\n backgroundColor,\n logoWidth = 100,\n }: {\n imageName: string;\n contentMode: ImageContentMode;\n backgroundColor: string;\n logoWidth?: number;\n }\n): IBSplashScreenDocument {\n const mainView = xml.document.scenes[0].scene[0].objects[0].viewController[0].view[0];\n const width = logoWidth;\n const height = logoWidth;\n const x = (mainView.rect[0].$.width - width) / 2;\n const y = (mainView.rect[0].$.height - height) / 2;\n\n const imageView: IBImageView = {\n $: {\n id: IMAGE_ID,\n userLabel: imageName,\n image: imageName,\n contentMode,\n clipsSubviews: true,\n userInteractionEnabled: false,\n translatesAutoresizingMaskIntoConstraints: false,\n },\n rect: [\n {\n $: {\n key: 'frame',\n x,\n y,\n width,\n height,\n },\n },\n ],\n };\n\n // Add ImageView\n ensureUniquePush(mainView.subviews[0].imageView, imageView);\n\n mainView.constraints[0].constraint = [];\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 $: {\n name: imageName,\n width,\n height,\n },\n });\n\n // Add background color\n mainView.color = mainView.color ?? [];\n const colorSection = mainView.color;\n const color = parseColor(backgroundColor);\n\n colorSection.push({\n $: {\n key: 'backgroundColor',\n ...color.rgb,\n alpha: '1',\n colorSpace: 'custom',\n customColorSpace: 'sRGB',\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\n// Function taken from react-native-bootsplash\nexport const parseColor = (value: string): Color => {\n const color = value.toUpperCase().replace(/[^0-9A-F]/g, '');\n\n if (color.length !== 3 && color.length !== 6) {\n console.error(`\"${value}\" value is not a valid hexadecimal color.`);\n process.exit(1);\n }\n\n const hex =\n color.length === 3\n ? '#' + color[0] + color[0] + color[1] + color[1] + color[2] + color[2]\n : '#' + color;\n\n const rgb: Color['rgb'] = {\n red: (parseInt('' + hex[1] + hex[2], 16) / 255).toPrecision(15),\n green: (parseInt('' + hex[3] + hex[4], 16) / 255).toPrecision(15),\n blue: (parseInt('' + hex[5] + hex[6], 16) / 255).toPrecision(15),\n };\n\n return { hex, rgb };\n};\n\ntype Color = {\n hex: string;\n rgb: {\n red: string;\n green: string;\n blue: string;\n };\n};\n"],"mappings":";;;;;;;;;;;;;;AAAA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,QAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAyC,SAAAC,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEzC,MAAMG,KAAK,GAAGL,OAAO,CAAC,OAAO,CAAC,CAC5B,8DACF,CAAuB;;AA4BvB;;AA0OO,SAASM,gBAAgBA,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,kBAAkBA,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,2BAA2BA,CACzCC,GAA2B,EA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AAK,CAAC4B,MAAM,KAAK,CAAC,EAAE;IAC5CC,OAAO,CAACC,KAAK,CAAC,IAAIL,KAAK,2CAA2C,CAAC;IACnEM,OAAO,CAACC,IAAI,CAAC,CAAC,CAAC;EACjB;EAEA,MAAMC,GAAG,GACPjC,KAAK,CAAC4B,MAAM,KAAK,CAAC,GACd,GAAG,GAAG5B,KAAK,CAAC,CAAC,CAAC,GAAGA,KAAK,CAAC,CAAC,CAAC,GAAGA,KAAK,CAAC,CAAC,CAAC,GAAGA,KAAK,CAAC,CAAC,CAAC,GAAGA,KAAK,CAAC,CAAC,CAAC,GAAGA,KAAK,CAAC,CAAC,CAAC,GACrE,GAAG,GAAGA,KAAK;EAEjB,MAAMG,GAAiB,GAAG;IACxB+B,GAAG,EAAE,CAACC,QAAQ,CAAC,EAAE,GAAGF,GAAG,CAAC,CAAC,CAAC,GAAGA,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,EAAEG,WAAW,CAAC,EAAE,CAAC;IAC/DC,KAAK,EAAE,CAACF,QAAQ,CAAC,EAAE,GAAGF,GAAG,CAAC,CAAC,CAAC,GAAGA,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,EAAEG,WAAW,CAAC,EAAE,CAAC;IACjEE,IAAI,EAAE,CAACH,QAAQ,CAAC,EAAE,GAAGF,GAAG,CAAC,CAAC,CAAC,GAAGA,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,EAAEG,WAAW,CAAC,EAAE;EACjE,CAAC;EAED,OAAO;IAAEH,GAAG;IAAE9B;EAAI,CAAC;AACrB,CAAC;AAACoC,OAAA,CAAArC,UAAA,GAAAA,UAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"InterfaceBuilder.js","names":["_crypto","data","_interopRequireDefault","require","_xml2js","e","__esModule","default","debug","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","backgroundColor","logoWidth","width","height","x","rect","y","userLabel","clipsSubviews","userInteractionEnabled","translatesAutoresizingMaskIntoConstraints","key","ensureUniquePush","push","color","colorSection","namedColor","namedColorSection","parseColor","alpha","blue","rgb","green","red","customColorSpace","colorSpace","array","item","existingItem","toString","builder","Builder","preserveChildrenOrder","xmldec","version","encoding","renderOpts","pretty","indent","buildObject","toObjectAsync","contents","Parser","parseStringPromise","value","toUpperCase","replace","length","console","error","process","exit","hex","parseInt","toPrecision","exports"],"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' | 'centerX' | 'centerY';\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 name?: string;\n systemColor?: string | 'systemBackgroundColor';\n red?: string;\n green?: string;\n blue?: string;\n alpha?: string;\n colorSpace?: string;\n customColorSpace?: string;\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 IBResourceNamedColor = IBItem<{\n name?: string;\n systemColor?: string | 'systemBackgroundColor';\n red?: string;\n green?: string;\n blue?: string;\n alpha?: string;\n colorSpace?: string;\n customColorSpace?: string;\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 namedColor?: IBItem<{ name: string }, { color: IBResourceNamedColor[] }>[];\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, 'centerX'], [parentId, 'centerX']),\n createConstraint([childId, 'centerY'], [parentId, 'centerY']),\n ];\n}\n\nexport function applyImageToSplashScreenXML(\n xml: IBSplashScreenDocument,\n {\n imageName,\n contentMode,\n backgroundColor,\n logoWidth = 100,\n }: {\n imageName: string;\n contentMode: ImageContentMode;\n backgroundColor: string;\n logoWidth?: number;\n }\n): IBSplashScreenDocument {\n const mainView = xml.document.scenes[0].scene[0].objects[0].viewController[0].view[0];\n const width = logoWidth;\n const height = logoWidth;\n const x = (mainView.rect[0].$.width - width) / 2;\n const y = (mainView.rect[0].$.height - height) / 2;\n\n const imageView: IBImageView = {\n $: {\n id: IMAGE_ID,\n userLabel: imageName,\n image: imageName,\n contentMode,\n clipsSubviews: true,\n userInteractionEnabled: false,\n translatesAutoresizingMaskIntoConstraints: false,\n },\n rect: [\n {\n $: {\n key: 'frame',\n x,\n y,\n width,\n height,\n },\n },\n ],\n };\n\n // Add ImageView\n ensureUniquePush(mainView.subviews[0].imageView, imageView);\n\n mainView.constraints[0].constraint = [];\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 $: {\n name: imageName,\n width,\n height,\n },\n });\n\n // Add background color\n mainView.color = mainView.color ?? [];\n const colorSection = mainView.color;\n\n colorSection.push({\n $: {\n key: 'backgroundColor',\n name: 'SplashScreenBackground',\n },\n });\n\n // Add background named color reference\n xml.document.resources[0].namedColor = xml.document.resources[0].namedColor ?? [];\n const namedColorSection = xml.document.resources[0].namedColor;\n const color = parseColor(backgroundColor);\n\n namedColorSection.push({\n $: {\n name: 'SplashScreenBackground',\n },\n color: [\n {\n $: {\n alpha: '1.000',\n blue: color.rgb.blue,\n green: color.rgb.green,\n red: color.rgb.red,\n customColorSpace: 'sRGB',\n colorSpace: 'custom',\n },\n },\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\n// Function taken from react-native-bootsplash\nexport const parseColor = (value: string): Color => {\n const color = value.toUpperCase().replace(/[^0-9A-F]/g, '');\n\n if (color.length !== 3 && color.length !== 6) {\n console.error(`\"${value}\" value is not a valid hexadecimal color.`);\n process.exit(1);\n }\n\n const hex =\n color.length === 3\n ? '#' + color[0] + color[0] + color[1] + color[1] + color[2] + color[2]\n : '#' + color;\n\n const rgb: Color['rgb'] = {\n red: (parseInt('' + hex[1] + hex[2], 16) / 255).toPrecision(15),\n green: (parseInt('' + hex[3] + hex[4], 16) / 255).toPrecision(15),\n blue: (parseInt('' + hex[5] + hex[6], 16) / 255).toPrecision(15),\n };\n\n return { hex, rgb };\n};\n\ntype Color = {\n hex: string;\n rgb: {\n red: string;\n green: string;\n blue: string;\n };\n};\n"],"mappings":";;;;;;;;;;;;;;AAAA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,QAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAyC,SAAAC,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEzC,MAAMG,KAAK,GAAGL,OAAO,CAAC,OAAO,CAAC,CAC5B,8DACF,CAAuB;;AA4BvB;;AAuPO,SAASM,gBAAgBA,CAC9B,CAACC,SAAS,EAAEC,cAAc,CAAgC,EAC1D,CAACC,UAAU,EAAEC,eAAe,CAAgC,EAC5DC,QAAiB,EACH;EACd,OAAO;IACLC,CAAC,EAAE;MACD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AAG,GAAGjC,KAAK,CAAC,CAAC,CAAC,GAAGA,KAAK,CAAC,CAAC,CAAC,GAAGA,KAAK,CAAC,CAAC,CAAC,GAAGA,KAAK,CAAC,CAAC,CAAC,GAAGA,KAAK,CAAC,CAAC,CAAC,GAAGA,KAAK,CAAC,CAAC,CAAC,GACrE,GAAG,GAAGA,KAAK;EAEjB,MAAMO,GAAiB,GAAG;IACxBE,GAAG,EAAE,CAAC8B,QAAQ,CAAC,EAAE,GAAGD,GAAG,CAAC,CAAC,CAAC,GAAGA,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,EAAEE,WAAW,CAAC,EAAE,CAAC;IAC/DhC,KAAK,EAAE,CAAC+B,QAAQ,CAAC,EAAE,GAAGD,GAAG,CAAC,CAAC,CAAC,GAAGA,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,EAAEE,WAAW,CAAC,EAAE,CAAC;IACjElC,IAAI,EAAE,CAACiC,QAAQ,CAAC,EAAE,GAAGD,GAAG,CAAC,CAAC,CAAC,GAAGA,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,EAAEE,WAAW,CAAC,EAAE;EACjE,CAAC;EAED,OAAO;IAAEF,GAAG;IAAE/B;EAAI,CAAC;AACrB,CAAC;AAACkC,OAAA,CAAArC,UAAA,GAAAA,UAAA","ignoreList":[]}
|
|
@@ -122,49 +122,38 @@ async function copyImageFiles({
|
|
|
122
122
|
darkTabletImage,
|
|
123
123
|
logoWidth
|
|
124
124
|
}) {
|
|
125
|
-
await Promise.all([{
|
|
126
|
-
ratio: 1,
|
|
127
|
-
suffix: ''
|
|
128
|
-
}, {
|
|
129
|
-
ratio: 2,
|
|
130
|
-
suffix: '@2x'
|
|
131
|
-
}, {
|
|
132
|
-
ratio: 3,
|
|
133
|
-
suffix: '@3x'
|
|
134
|
-
}].map(async ({
|
|
135
|
-
ratio,
|
|
136
|
-
suffix
|
|
137
|
-
}) => {
|
|
138
|
-
const filePath = _path().default.resolve(iosNamedProjectRoot, IMAGESET_PATH, `${PNG_FILENAME}${suffix}.png`);
|
|
139
|
-
const size = logoWidth * ratio;
|
|
140
|
-
const {
|
|
141
|
-
source
|
|
142
|
-
} = await (0, _imageUtils().generateImageAsync)({
|
|
143
|
-
projectRoot,
|
|
144
|
-
cacheType: IMAGE_CACHE_NAME
|
|
145
|
-
}, {
|
|
146
|
-
src: image,
|
|
147
|
-
width: size,
|
|
148
|
-
height: size,
|
|
149
|
-
resizeMode: 'contain'
|
|
150
|
-
});
|
|
151
|
-
return await _fsExtra().default.writeFile(filePath, source);
|
|
152
|
-
}));
|
|
153
125
|
await generateImagesAssetsAsync({
|
|
154
126
|
async generateImageAsset(item, fileName) {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
cacheType: IMAGE_CACHE_NAME
|
|
127
|
+
[{
|
|
128
|
+
ratio: 1,
|
|
129
|
+
suffix: ''
|
|
130
|
+
}, {
|
|
131
|
+
ratio: 2,
|
|
132
|
+
suffix: '@2x'
|
|
162
133
|
}, {
|
|
163
|
-
|
|
134
|
+
ratio: 3,
|
|
135
|
+
suffix: '@3x'
|
|
136
|
+
}].map(async ({
|
|
137
|
+
ratio,
|
|
138
|
+
suffix
|
|
139
|
+
}) => {
|
|
140
|
+
const size = logoWidth * ratio;
|
|
141
|
+
// Using this method will cache the images in `.expo` based on the properties used to generate them.
|
|
142
|
+
// this method also supports remote URLs and using the global sharp instance.
|
|
143
|
+
const {
|
|
144
|
+
source
|
|
145
|
+
} = await (0, _imageUtils().generateImageAsync)({
|
|
146
|
+
projectRoot,
|
|
147
|
+
cacheType: IMAGE_CACHE_NAME
|
|
148
|
+
}, {
|
|
149
|
+
src: item,
|
|
150
|
+
width: size,
|
|
151
|
+
height: size
|
|
152
|
+
});
|
|
153
|
+
// Write image buffer to the file system.
|
|
154
|
+
// const assetPath = join(iosNamedProjectRoot, IMAGESET_PATH, filename);
|
|
155
|
+
await _fsExtra().default.writeFile(_path().default.resolve(iosNamedProjectRoot, IMAGESET_PATH, `${fileName}${suffix}.png`), source);
|
|
164
156
|
});
|
|
165
|
-
// Write image buffer to the file system.
|
|
166
|
-
// const assetPath = join(iosNamedProjectRoot, IMAGESET_PATH, filename);
|
|
167
|
-
await _fsExtra().default.writeFile(_path().default.resolve(iosNamedProjectRoot, IMAGESET_PATH, fileName), source);
|
|
168
157
|
},
|
|
169
158
|
anyItem: image,
|
|
170
159
|
darkItem: darkImage,
|
|
@@ -211,34 +200,39 @@ function buildContentsJsonImages({
|
|
|
211
200
|
darkImage && (0, _AssetContents().createContentsJsonItem)({
|
|
212
201
|
idiom: 'universal',
|
|
213
202
|
appearances: darkAppearances,
|
|
214
|
-
scale: '1x'
|
|
203
|
+
scale: '1x',
|
|
204
|
+
filename: `${darkImage}.png`
|
|
215
205
|
}), darkImage && (0, _AssetContents().createContentsJsonItem)({
|
|
216
206
|
idiom: 'universal',
|
|
217
207
|
appearances: darkAppearances,
|
|
218
|
-
scale: '2x'
|
|
208
|
+
scale: '2x',
|
|
209
|
+
filename: `${darkImage}@2x.png`
|
|
219
210
|
}), darkImage && (0, _AssetContents().createContentsJsonItem)({
|
|
220
211
|
idiom: 'universal',
|
|
221
212
|
appearances: darkAppearances,
|
|
222
|
-
scale: '3x'
|
|
213
|
+
scale: '3x',
|
|
214
|
+
filename: `${darkImage}@3x.png`
|
|
223
215
|
}),
|
|
224
216
|
// Tablet light
|
|
225
217
|
tabletImage && (0, _AssetContents().createContentsJsonItem)({
|
|
226
218
|
idiom: 'ipad',
|
|
227
|
-
filename: tabletImage
|
|
219
|
+
filename: `${tabletImage}.png`,
|
|
228
220
|
scale: '1x'
|
|
229
221
|
}), tabletImage && (0, _AssetContents().createContentsJsonItem)({
|
|
230
222
|
idiom: 'ipad',
|
|
231
|
-
scale: '2x'
|
|
223
|
+
scale: '2x',
|
|
224
|
+
filename: `${tabletImage}@2x.png`
|
|
232
225
|
}),
|
|
233
226
|
// Phone dark
|
|
234
227
|
darkTabletImage && (0, _AssetContents().createContentsJsonItem)({
|
|
235
228
|
idiom: 'ipad',
|
|
236
229
|
appearances: darkAppearances,
|
|
237
|
-
filename: darkTabletImage
|
|
230
|
+
filename: `${darkTabletImage}.png`,
|
|
238
231
|
scale: '1x'
|
|
239
232
|
}), darkTabletImage && (0, _AssetContents().createContentsJsonItem)({
|
|
240
233
|
idiom: 'ipad',
|
|
241
234
|
appearances: darkAppearances,
|
|
235
|
+
filename: `${darkTabletImage}@2x.png`,
|
|
242
236
|
scale: '2x'
|
|
243
237
|
})].filter(Boolean);
|
|
244
238
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withIosSplashAssets.js","names":["_configPlugins","data","require","_imageUtils","_debug","_interopRequireDefault","_fsExtra","_path","_AssetContents","e","__esModule","default","debug","Debug","IMAGE_CACHE_NAME","IMAGESET_PATH","PNG_FILENAME","DARK_PNG_FILENAME","TABLET_PNG_FILENAME","DARK_TABLET_PNG_FILENAME","withIosSplashAssets","config","splash","withDangerousMod","iosNamedProjectRoot","IOSConfig","Paths","getSourceRoot","modRequest","projectRoot","configureImageAssets","image","darkImage","dark","tabletImage","darkTabletImage","logoWidth","exports","imageSetPath","path","resolve","fs","remove","writeContentsJsonFileAsync","assetPath","copyImageFiles","Promise","all","ratio","suffix","map","filePath","size","source","generateImageAsync","cacheType","src","width","height","resizeMode","writeFile","generateImagesAssetsAsync","generateImageAsset","item","fileName","anyItem","darkItem","tabletItem","darkTabletItem","items","filter","darkAppearances","appearance","value","buildContentsJsonImages","createContentsJsonItem","idiom","filename","scale","appearances","undefined","Boolean","images","writeContentsJsonAsync"],"sources":["../../../../src/plugins/unversioned/expo-splash-screen/withIosSplashAssets.ts"],"sourcesContent":["import { ConfigPlugin, IOSConfig, withDangerousMod } from '@expo/config-plugins';\nimport { generateImageAsync } from '@expo/image-utils';\nimport Debug from 'debug';\nimport fs from 'fs-extra';\n// @ts-ignore\nimport path from 'path';\n\nimport { IOSSplashConfig } from './getIosSplashConfig';\nimport {\n ContentsJsonImage,\n ContentsJsonImageAppearance,\n createContentsJsonItem,\n writeContentsJsonAsync,\n} from '../../icons/AssetContents';\n\nconst debug = Debug('expo:prebuild-config:expo-splash-screen:ios:assets');\n\nconst IMAGE_CACHE_NAME = 'splash-ios';\nconst IMAGESET_PATH = 'Images.xcassets/SplashScreenLogo.imageset';\nconst PNG_FILENAME = 'image';\nconst DARK_PNG_FILENAME = 'dark_image';\nconst TABLET_PNG_FILENAME = 'tablet_image';\nconst DARK_TABLET_PNG_FILENAME = 'dark_tablet_image';\n\nexport const withIosSplashAssets: ConfigPlugin<IOSSplashConfig> = (config, splash) => {\n if (!splash) {\n return config;\n }\n return withDangerousMod(config, [\n 'ios',\n async (config) => {\n const iosNamedProjectRoot = IOSConfig.Paths.getSourceRoot(config.modRequest.projectRoot);\n\n await configureImageAssets({\n projectRoot: config.modRequest.projectRoot,\n iosNamedProjectRoot,\n image: splash.image,\n darkImage: splash.dark?.image,\n tabletImage: splash.tabletImage,\n darkTabletImage: splash.dark?.tabletImage,\n logoWidth: splash.logoWidth ?? 100,\n });\n\n return config;\n },\n ]);\n};\n\n/**\n * Creates imageset containing image for Splash/Launch Screen.\n */\nasync function configureImageAssets({\n projectRoot,\n iosNamedProjectRoot,\n image,\n darkImage,\n tabletImage,\n darkTabletImage,\n logoWidth,\n}: {\n projectRoot: string;\n iosNamedProjectRoot: string;\n image?: string | null;\n darkImage?: string | null;\n tabletImage: string | null;\n darkTabletImage?: string | null;\n logoWidth: number;\n}) {\n const imageSetPath = path.resolve(iosNamedProjectRoot, IMAGESET_PATH);\n\n // ensure old SplashScreen imageSet is removed\n await fs.remove(imageSetPath);\n\n if (!image) {\n return;\n }\n\n await writeContentsJsonFileAsync({\n assetPath: imageSetPath,\n image: PNG_FILENAME,\n darkImage: darkImage ? DARK_PNG_FILENAME : null,\n tabletImage: tabletImage ? TABLET_PNG_FILENAME : null,\n darkTabletImage: darkTabletImage ? DARK_TABLET_PNG_FILENAME : null,\n });\n\n await copyImageFiles({\n projectRoot,\n iosNamedProjectRoot,\n image,\n darkImage,\n tabletImage,\n darkTabletImage,\n logoWidth,\n });\n}\n\nasync function copyImageFiles({\n projectRoot,\n iosNamedProjectRoot,\n image,\n darkImage,\n tabletImage,\n darkTabletImage,\n logoWidth,\n}: {\n projectRoot: string;\n iosNamedProjectRoot: string;\n image: string;\n darkImage?: string | null;\n tabletImage?: string | null;\n darkTabletImage?: string | null;\n logoWidth: number;\n}) {\n await Promise.all(\n [\n { ratio: 1, suffix: '' },\n { ratio: 2, suffix: '@2x' },\n { ratio: 3, suffix: '@3x' },\n ].map(async ({ ratio, suffix }) => {\n const filePath = path.resolve(\n iosNamedProjectRoot,\n IMAGESET_PATH,\n `${PNG_FILENAME}${suffix}.png`\n );\n\n const size = logoWidth * ratio;\n\n const { source } = await generateImageAsync(\n { projectRoot, cacheType: IMAGE_CACHE_NAME },\n {\n src: image,\n width: size,\n height: size,\n resizeMode: 'contain',\n }\n );\n return await fs.writeFile(filePath, source);\n })\n );\n\n await generateImagesAssetsAsync({\n async generateImageAsset(item, fileName) {\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: item,\n } as any);\n // Write image buffer to the file system.\n // const assetPath = join(iosNamedProjectRoot, IMAGESET_PATH, filename);\n await fs.writeFile(path.resolve(iosNamedProjectRoot, IMAGESET_PATH, fileName), source);\n },\n anyItem: image,\n darkItem: darkImage,\n tabletItem: tabletImage,\n darkTabletItem: darkTabletImage,\n });\n}\n\nasync function generateImagesAssetsAsync({\n generateImageAsset,\n anyItem,\n darkItem,\n tabletItem,\n darkTabletItem,\n}: {\n generateImageAsset: (item: string, fileName: string) => Promise<void>;\n anyItem: string;\n darkItem?: string | null;\n tabletItem?: string | null;\n darkTabletItem?: string | null;\n}) {\n const items = [\n [anyItem, PNG_FILENAME],\n [darkItem, DARK_PNG_FILENAME],\n [tabletItem, TABLET_PNG_FILENAME],\n [darkTabletItem, DARK_TABLET_PNG_FILENAME],\n ].filter(([item]) => !!item) as unknown as [string, string];\n\n await Promise.all(items.map(([item, fileName]) => generateImageAsset(item, fileName)));\n}\n\nconst darkAppearances: ContentsJsonImageAppearance[] = [\n {\n appearance: 'luminosity',\n value: 'dark',\n } as ContentsJsonImageAppearance,\n];\n\nexport function buildContentsJsonImages({\n image,\n darkImage,\n tabletImage,\n darkTabletImage,\n}: {\n image: string;\n tabletImage: string | null;\n darkImage: string | null;\n darkTabletImage: string | null;\n}): ContentsJsonImage[] {\n return [\n // Phone light\n createContentsJsonItem({\n idiom: 'universal',\n filename: `${image}.png`,\n scale: '1x',\n }),\n createContentsJsonItem({\n idiom: 'universal',\n filename: `${image}@2x.png`,\n scale: '2x',\n }),\n createContentsJsonItem({\n idiom: 'universal',\n filename: `${image}@3x.png`,\n scale: '3x',\n }),\n // Phone dark\n darkImage &&\n createContentsJsonItem({\n idiom: 'universal',\n appearances: darkAppearances,\n scale: '1x',\n }),\n darkImage &&\n createContentsJsonItem({\n idiom: 'universal',\n appearances: darkAppearances,\n scale: '2x',\n }),\n darkImage &&\n createContentsJsonItem({\n idiom: 'universal',\n appearances: darkAppearances,\n scale: '3x',\n }),\n // Tablet light\n tabletImage &&\n createContentsJsonItem({\n idiom: 'ipad',\n filename: tabletImage,\n scale: '1x',\n }),\n tabletImage &&\n createContentsJsonItem({\n idiom: 'ipad',\n scale: '2x',\n }),\n // Phone dark\n darkTabletImage &&\n createContentsJsonItem({\n idiom: 'ipad',\n appearances: darkAppearances,\n filename: darkTabletImage ?? undefined,\n scale: '1x',\n }),\n darkTabletImage &&\n createContentsJsonItem({\n idiom: 'ipad',\n appearances: darkAppearances,\n scale: '2x',\n }),\n ].filter(Boolean) as ContentsJsonImage[];\n}\n\nasync function writeContentsJsonFileAsync({\n assetPath,\n image,\n darkImage,\n tabletImage,\n darkTabletImage,\n}: {\n assetPath: string;\n image: string;\n darkImage: string | null;\n tabletImage: string | null;\n darkTabletImage: string | null;\n}) {\n const images = buildContentsJsonImages({ image, darkImage, tabletImage, darkTabletImage });\n\n debug(`create contents.json:`, assetPath);\n debug(`use images:`, images);\n await writeContentsJsonAsync(assetPath, { images });\n}\n"],"mappings":";;;;;;;AAAA,SAAAA,eAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,cAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,YAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,WAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,OAAA;EAAA,MAAAH,IAAA,GAAAI,sBAAA,CAAAH,OAAA;EAAAE,MAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,SAAA;EAAA,MAAAL,IAAA,GAAAI,sBAAA,CAAAH,OAAA;EAAAI,QAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAM,MAAA;EAAA,MAAAN,IAAA,GAAAI,sBAAA,CAAAH,OAAA;EAAAK,KAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAO,eAAA;EAAA,MAAAP,IAAA,GAAAC,OAAA;EAAAM,cAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAKmC,SAAAI,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AATnC;;AAWA,MAAMG,KAAK,GAAG,IAAAC,gBAAK,EAAC,oDAAoD,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,uCAAsB,EAAC;IACrBC,KAAK,EAAE,MAAM;IACbG,WAAW,EAAER,eAAe;IAC5BM,QAAQ,EAAE1C,eAAe,IAAI6C,SAAS;IACtCF,KAAK,EAAE;EACT,CAAC,CAAC,EACJ3C,eAAe,IACb,IAAAwC,uCAAsB,EAAC;IACrBC,KAAK,EAAE,MAAM;IACbG,WAAW,EAAER,eAAe;IAC5BO,KAAK,EAAE;EACT,CAAC,CAAC,CACL,CAACR,MAAM,CAACW,OAAO,CAAC;AACnB;AAEA,eAAetC,0BAA0BA,CAAC;EACxCC,SAAS;EACTb,KAAK;EACLC,SAAS;EACTE,WAAW;EACXC;AAOF,CAAC,EAAE;EACD,MAAM+C,MAAM,GAAGR,uBAAuB,CAAC;IAAE3C,KAAK;IAAEC,SAAS;IAAEE,WAAW;IAAEC;EAAgB,CAAC,CAAC;EAE1FvB,KAAK,CAAC,uBAAuB,EAAEgC,SAAS,CAAC;EACzChC,KAAK,CAAC,aAAa,EAAEsE,MAAM,CAAC;EAC5B,MAAM,IAAAC,uCAAsB,EAACvC,SAAS,EAAE;IAAEsC;EAAO,CAAC,CAAC;AACrD","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"withIosSplashAssets.js","names":["_configPlugins","data","require","_imageUtils","_debug","_interopRequireDefault","_fsExtra","_path","_AssetContents","e","__esModule","default","debug","Debug","IMAGE_CACHE_NAME","IMAGESET_PATH","PNG_FILENAME","DARK_PNG_FILENAME","TABLET_PNG_FILENAME","DARK_TABLET_PNG_FILENAME","withIosSplashAssets","config","splash","withDangerousMod","iosNamedProjectRoot","IOSConfig","Paths","getSourceRoot","modRequest","projectRoot","configureImageAssets","image","darkImage","dark","tabletImage","darkTabletImage","logoWidth","exports","imageSetPath","path","resolve","fs","remove","writeContentsJsonFileAsync","assetPath","copyImageFiles","generateImagesAssetsAsync","generateImageAsset","item","fileName","ratio","suffix","map","size","source","generateImageAsync","cacheType","src","width","height","writeFile","anyItem","darkItem","tabletItem","darkTabletItem","items","filter","Promise","all","darkAppearances","appearance","value","buildContentsJsonImages","createContentsJsonItem","idiom","filename","scale","appearances","Boolean","images","writeContentsJsonAsync"],"sources":["../../../../src/plugins/unversioned/expo-splash-screen/withIosSplashAssets.ts"],"sourcesContent":["import { ConfigPlugin, IOSConfig, withDangerousMod } from '@expo/config-plugins';\nimport { generateImageAsync } from '@expo/image-utils';\nimport Debug from 'debug';\nimport fs from 'fs-extra';\n// @ts-ignore\nimport path from 'path';\n\nimport { IOSSplashConfig } from './getIosSplashConfig';\nimport {\n ContentsJsonImage,\n ContentsJsonAppearance,\n createContentsJsonItem,\n writeContentsJsonAsync,\n} from '../../icons/AssetContents';\n\nconst debug = Debug('expo:prebuild-config:expo-splash-screen:ios:assets');\n\nconst IMAGE_CACHE_NAME = 'splash-ios';\nconst IMAGESET_PATH = 'Images.xcassets/SplashScreenLogo.imageset';\nconst PNG_FILENAME = 'image';\nconst DARK_PNG_FILENAME = 'dark_image';\nconst TABLET_PNG_FILENAME = 'tablet_image';\nconst DARK_TABLET_PNG_FILENAME = 'dark_tablet_image';\n\nexport const withIosSplashAssets: ConfigPlugin<IOSSplashConfig> = (config, splash) => {\n if (!splash) {\n return config;\n }\n return withDangerousMod(config, [\n 'ios',\n async (config) => {\n const iosNamedProjectRoot = IOSConfig.Paths.getSourceRoot(config.modRequest.projectRoot);\n\n await configureImageAssets({\n projectRoot: config.modRequest.projectRoot,\n iosNamedProjectRoot,\n image: splash.image,\n darkImage: splash.dark?.image,\n tabletImage: splash.tabletImage,\n darkTabletImage: splash.dark?.tabletImage,\n logoWidth: splash.logoWidth ?? 100,\n });\n\n return config;\n },\n ]);\n};\n\n/**\n * Creates imageset containing image for Splash/Launch Screen.\n */\nasync function configureImageAssets({\n projectRoot,\n iosNamedProjectRoot,\n image,\n darkImage,\n tabletImage,\n darkTabletImage,\n logoWidth,\n}: {\n projectRoot: string;\n iosNamedProjectRoot: string;\n image?: string | null;\n darkImage?: string | null;\n tabletImage: string | null;\n darkTabletImage?: string | null;\n logoWidth: number;\n}) {\n const imageSetPath = path.resolve(iosNamedProjectRoot, IMAGESET_PATH);\n\n // ensure old SplashScreen imageSet is removed\n await fs.remove(imageSetPath);\n\n if (!image) {\n return;\n }\n\n await writeContentsJsonFileAsync({\n assetPath: imageSetPath,\n image: PNG_FILENAME,\n darkImage: darkImage ? DARK_PNG_FILENAME : null,\n tabletImage: tabletImage ? TABLET_PNG_FILENAME : null,\n darkTabletImage: darkTabletImage ? DARK_TABLET_PNG_FILENAME : null,\n });\n\n await copyImageFiles({\n projectRoot,\n iosNamedProjectRoot,\n image,\n darkImage,\n tabletImage,\n darkTabletImage,\n logoWidth,\n });\n}\n\nasync function copyImageFiles({\n projectRoot,\n iosNamedProjectRoot,\n image,\n darkImage,\n tabletImage,\n darkTabletImage,\n logoWidth,\n}: {\n projectRoot: string;\n iosNamedProjectRoot: string;\n image: string;\n darkImage?: string | null;\n tabletImage?: string | null;\n darkTabletImage?: string | null;\n logoWidth: number;\n}) {\n await generateImagesAssetsAsync({\n async generateImageAsset(item, fileName) {\n [\n { ratio: 1, suffix: '' },\n { ratio: 2, suffix: '@2x' },\n { ratio: 3, suffix: '@3x' },\n ].map(async ({ ratio, suffix }) => {\n const size = logoWidth * ratio;\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: item,\n width: size,\n height: size,\n } as any);\n // Write image buffer to the file system.\n // const assetPath = join(iosNamedProjectRoot, IMAGESET_PATH, filename);\n await fs.writeFile(\n path.resolve(iosNamedProjectRoot, IMAGESET_PATH, `${fileName}${suffix}.png`),\n source\n );\n });\n },\n anyItem: image,\n darkItem: darkImage,\n tabletItem: tabletImage,\n darkTabletItem: darkTabletImage,\n });\n}\n\nasync function generateImagesAssetsAsync({\n generateImageAsset,\n anyItem,\n darkItem,\n tabletItem,\n darkTabletItem,\n}: {\n generateImageAsset: (item: string, fileName: string) => Promise<void>;\n anyItem: string;\n darkItem?: string | null;\n tabletItem?: string | null;\n darkTabletItem?: string | null;\n}) {\n const items = [\n [anyItem, PNG_FILENAME],\n [darkItem, DARK_PNG_FILENAME],\n [tabletItem, TABLET_PNG_FILENAME],\n [darkTabletItem, DARK_TABLET_PNG_FILENAME],\n ].filter(([item]) => !!item) as unknown as [string, string];\n\n await Promise.all(items.map(([item, fileName]) => generateImageAsset(item, fileName)));\n}\n\nconst darkAppearances: ContentsJsonAppearance[] = [\n {\n appearance: 'luminosity',\n value: 'dark',\n } as ContentsJsonAppearance,\n];\n\nexport function buildContentsJsonImages({\n image,\n darkImage,\n tabletImage,\n darkTabletImage,\n}: {\n image: string;\n tabletImage: string | null;\n darkImage: string | null;\n darkTabletImage: string | null;\n}): ContentsJsonImage[] {\n return [\n // Phone light\n createContentsJsonItem({\n idiom: 'universal',\n filename: `${image}.png`,\n scale: '1x',\n }),\n createContentsJsonItem({\n idiom: 'universal',\n filename: `${image}@2x.png`,\n scale: '2x',\n }),\n createContentsJsonItem({\n idiom: 'universal',\n filename: `${image}@3x.png`,\n scale: '3x',\n }),\n // Phone dark\n darkImage &&\n createContentsJsonItem({\n idiom: 'universal',\n appearances: darkAppearances,\n scale: '1x',\n filename: `${darkImage}.png`,\n }),\n darkImage &&\n createContentsJsonItem({\n idiom: 'universal',\n appearances: darkAppearances,\n scale: '2x',\n filename: `${darkImage}@2x.png`,\n }),\n darkImage &&\n createContentsJsonItem({\n idiom: 'universal',\n appearances: darkAppearances,\n scale: '3x',\n filename: `${darkImage}@3x.png`,\n }),\n // Tablet light\n tabletImage &&\n createContentsJsonItem({\n idiom: 'ipad',\n filename: `${tabletImage}.png`,\n scale: '1x',\n }),\n tabletImage &&\n createContentsJsonItem({\n idiom: 'ipad',\n scale: '2x',\n filename: `${tabletImage}@2x.png`,\n }),\n // Phone dark\n darkTabletImage &&\n createContentsJsonItem({\n idiom: 'ipad',\n appearances: darkAppearances,\n filename: `${darkTabletImage}.png`,\n scale: '1x',\n }),\n darkTabletImage &&\n createContentsJsonItem({\n idiom: 'ipad',\n appearances: darkAppearances,\n filename: `${darkTabletImage}@2x.png`,\n scale: '2x',\n }),\n ].filter(Boolean) as ContentsJsonImage[];\n}\n\nasync function writeContentsJsonFileAsync({\n assetPath,\n image,\n darkImage,\n tabletImage,\n darkTabletImage,\n}: {\n assetPath: string;\n image: string;\n darkImage: string | null;\n tabletImage: string | null;\n darkTabletImage: string | null;\n}) {\n const images = buildContentsJsonImages({ image, darkImage, tabletImage, darkTabletImage });\n\n debug(`create contents.json:`, assetPath);\n debug(`use images:`, images);\n await writeContentsJsonAsync(assetPath, { images });\n}\n"],"mappings":";;;;;;;AAAA,SAAAA,eAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,cAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,YAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,WAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,OAAA;EAAA,MAAAH,IAAA,GAAAI,sBAAA,CAAAH,OAAA;EAAAE,MAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,SAAA;EAAA,MAAAL,IAAA,GAAAI,sBAAA,CAAAH,OAAA;EAAAI,QAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAM,MAAA;EAAA,MAAAN,IAAA,GAAAI,sBAAA,CAAAH,OAAA;EAAAK,KAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAO,eAAA;EAAA,MAAAP,IAAA,GAAAC,OAAA;EAAAM,cAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;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M;IACbG,WAAW,EAAER,eAAe;IAC5BM,QAAQ,EAAE,GAAGxC,eAAe,MAAM;IAClCyC,KAAK,EAAE;EACT,CAAC,CAAC,EACJzC,eAAe,IACb,IAAAsC,uCAAsB,EAAC;IACrBC,KAAK,EAAE,MAAM;IACbG,WAAW,EAAER,eAAe;IAC5BM,QAAQ,EAAE,GAAGxC,eAAe,SAAS;IACrCyC,KAAK,EAAE;EACT,CAAC,CAAC,CACL,CAACV,MAAM,CAACY,OAAO,CAAC;AACnB;AAEA,eAAenC,0BAA0BA,CAAC;EACxCC,SAAS;EACTb,KAAK;EACLC,SAAS;EACTE,WAAW;EACXC;AAOF,CAAC,EAAE;EACD,MAAM4C,MAAM,GAAGP,uBAAuB,CAAC;IAAEzC,KAAK;IAAEC,SAAS;IAAEE,WAAW;IAAEC;EAAgB,CAAC,CAAC;EAE1FvB,KAAK,CAAC,uBAAuB,EAAEgC,SAAS,CAAC;EACzChC,KAAK,CAAC,aAAa,EAAEmE,MAAM,CAAC;EAC5B,MAAM,IAAAC,uCAAsB,EAACpC,SAAS,EAAE;IAAEmC;EAAO,CAAC,CAAC;AACrD","ignoreList":[]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ConfigPlugin } from '@expo/config-plugins';
|
|
2
|
+
import { IOSSplashConfig } from './getIosSplashConfig';
|
|
3
|
+
export declare const SPLASHSCREEN_COLORSET_PATH = "Images.xcassets/SplashScreenBackground.colorset";
|
|
4
|
+
export declare const withIosSplashColors: ConfigPlugin<IOSSplashConfig>;
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.withIosSplashColors = exports.SPLASHSCREEN_COLORSET_PATH = void 0;
|
|
7
|
+
function _configPlugins() {
|
|
8
|
+
const data = require("@expo/config-plugins");
|
|
9
|
+
_configPlugins = function () {
|
|
10
|
+
return data;
|
|
11
|
+
};
|
|
12
|
+
return data;
|
|
13
|
+
}
|
|
14
|
+
function _debug() {
|
|
15
|
+
const data = _interopRequireDefault(require("debug"));
|
|
16
|
+
_debug = function () {
|
|
17
|
+
return data;
|
|
18
|
+
};
|
|
19
|
+
return data;
|
|
20
|
+
}
|
|
21
|
+
function _fsExtra() {
|
|
22
|
+
const data = _interopRequireDefault(require("fs-extra"));
|
|
23
|
+
_fsExtra = function () {
|
|
24
|
+
return data;
|
|
25
|
+
};
|
|
26
|
+
return data;
|
|
27
|
+
}
|
|
28
|
+
function _path() {
|
|
29
|
+
const data = _interopRequireWildcard(require("path"));
|
|
30
|
+
_path = function () {
|
|
31
|
+
return data;
|
|
32
|
+
};
|
|
33
|
+
return data;
|
|
34
|
+
}
|
|
35
|
+
function _InterfaceBuilder() {
|
|
36
|
+
const data = require("./InterfaceBuilder");
|
|
37
|
+
_InterfaceBuilder = function () {
|
|
38
|
+
return data;
|
|
39
|
+
};
|
|
40
|
+
return data;
|
|
41
|
+
}
|
|
42
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
43
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
44
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
45
|
+
// @ts-ignore
|
|
46
|
+
|
|
47
|
+
const debug = (0, _debug().default)('expo:prebuild-config:expo-splash-screen:ios:splash-colorset');
|
|
48
|
+
const SPLASHSCREEN_COLORSET_PATH = exports.SPLASHSCREEN_COLORSET_PATH = 'Images.xcassets/SplashScreenBackground.colorset';
|
|
49
|
+
const withIosSplashColors = (config, splash) => {
|
|
50
|
+
if (!splash) {
|
|
51
|
+
return config;
|
|
52
|
+
}
|
|
53
|
+
return (0, _configPlugins().withDangerousMod)(config, ['ios', async config => {
|
|
54
|
+
const iosNamedProjectRoot = _configPlugins().IOSConfig.Paths.getSourceRoot(config.modRequest.projectRoot);
|
|
55
|
+
await configureColorAssets({
|
|
56
|
+
iosNamedProjectRoot,
|
|
57
|
+
backgroundColor: splash.backgroundColor,
|
|
58
|
+
darkBackgroundColor: splash.dark?.backgroundColor
|
|
59
|
+
});
|
|
60
|
+
return config;
|
|
61
|
+
}]);
|
|
62
|
+
};
|
|
63
|
+
exports.withIosSplashColors = withIosSplashColors;
|
|
64
|
+
async function configureColorAssets({
|
|
65
|
+
iosNamedProjectRoot,
|
|
66
|
+
backgroundColor = '#ffffff',
|
|
67
|
+
darkBackgroundColor
|
|
68
|
+
}) {
|
|
69
|
+
const colorsetPath = _path().default.resolve(iosNamedProjectRoot, SPLASHSCREEN_COLORSET_PATH);
|
|
70
|
+
|
|
71
|
+
// ensure old SplashScreen colorSet is removed
|
|
72
|
+
await _fsExtra().default.remove(colorsetPath);
|
|
73
|
+
await writeColorsContentsJsonFileAsync({
|
|
74
|
+
assetPath: colorsetPath,
|
|
75
|
+
backgroundColor,
|
|
76
|
+
darkBackgroundColor: darkBackgroundColor ?? null
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
async function writeColorsContentsJsonFileAsync({
|
|
80
|
+
assetPath,
|
|
81
|
+
backgroundColor,
|
|
82
|
+
darkBackgroundColor
|
|
83
|
+
}) {
|
|
84
|
+
const color = (0, _InterfaceBuilder().parseColor)(backgroundColor);
|
|
85
|
+
const darkColor = darkBackgroundColor ? (0, _InterfaceBuilder().parseColor)(darkBackgroundColor) : null;
|
|
86
|
+
const colors = [{
|
|
87
|
+
color: {
|
|
88
|
+
components: {
|
|
89
|
+
alpha: '1.000',
|
|
90
|
+
blue: color.rgb.blue,
|
|
91
|
+
green: color.rgb.green,
|
|
92
|
+
red: color.rgb.red
|
|
93
|
+
},
|
|
94
|
+
'color-space': 'srgb'
|
|
95
|
+
},
|
|
96
|
+
idiom: 'universal'
|
|
97
|
+
}];
|
|
98
|
+
if (darkColor) {
|
|
99
|
+
colors.push({
|
|
100
|
+
color: {
|
|
101
|
+
components: {
|
|
102
|
+
alpha: '1.000',
|
|
103
|
+
blue: darkColor.rgb.blue,
|
|
104
|
+
green: darkColor.rgb.green,
|
|
105
|
+
red: darkColor.rgb.red
|
|
106
|
+
},
|
|
107
|
+
'color-space': 'srgb'
|
|
108
|
+
},
|
|
109
|
+
idiom: 'universal',
|
|
110
|
+
appearances: [{
|
|
111
|
+
appearance: 'luminosity',
|
|
112
|
+
value: 'dark'
|
|
113
|
+
}]
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
debug(`create colors contents.json:`, assetPath);
|
|
117
|
+
debug(`use colors:`, colors);
|
|
118
|
+
await writeContentsJsonAsync(assetPath, {
|
|
119
|
+
colors
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
async function writeContentsJsonAsync(directory, {
|
|
123
|
+
colors
|
|
124
|
+
}) {
|
|
125
|
+
await _fsExtra().default.ensureDir(directory);
|
|
126
|
+
await _fsExtra().default.writeFile((0, _path().join)(directory, 'Contents.json'), JSON.stringify({
|
|
127
|
+
colors,
|
|
128
|
+
info: {
|
|
129
|
+
version: 1,
|
|
130
|
+
// common practice is for the tool that generated the icons to be the "author"
|
|
131
|
+
author: 'expo'
|
|
132
|
+
}
|
|
133
|
+
}, null, 2));
|
|
134
|
+
}
|
|
135
|
+
//# sourceMappingURL=withIosSplashColors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withIosSplashColors.js","names":["_configPlugins","data","require","_debug","_interopRequireDefault","_fsExtra","_path","_interopRequireWildcard","_InterfaceBuilder","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","debug","Debug","SPLASHSCREEN_COLORSET_PATH","exports","withIosSplashColors","config","splash","withDangerousMod","iosNamedProjectRoot","IOSConfig","Paths","getSourceRoot","modRequest","projectRoot","configureColorAssets","backgroundColor","darkBackgroundColor","dark","colorsetPath","path","resolve","fs","remove","writeColorsContentsJsonFileAsync","assetPath","color","parseColor","darkColor","colors","components","alpha","blue","rgb","green","red","idiom","push","appearances","appearance","value","writeContentsJsonAsync","directory","ensureDir","writeFile","join","JSON","stringify","info","version","author"],"sources":["../../../../src/plugins/unversioned/expo-splash-screen/withIosSplashColors.ts"],"sourcesContent":["import { ConfigPlugin, IOSConfig, withDangerousMod } from '@expo/config-plugins';\nimport Debug from 'debug';\nimport fs from 'fs-extra';\n// @ts-ignore\nimport path, { join } from 'path';\n\nimport { parseColor } from './InterfaceBuilder';\nimport { IOSSplashConfig } from './getIosSplashConfig';\nimport { ContentsJsonColor } from '../../icons/AssetContents';\n\nconst debug = Debug('expo:prebuild-config:expo-splash-screen:ios:splash-colorset');\n\nexport const SPLASHSCREEN_COLORSET_PATH = 'Images.xcassets/SplashScreenBackground.colorset';\n\nexport const withIosSplashColors: ConfigPlugin<IOSSplashConfig> = (config, splash) => {\n if (!splash) {\n return config;\n }\n return withDangerousMod(config, [\n 'ios',\n async (config) => {\n const iosNamedProjectRoot = IOSConfig.Paths.getSourceRoot(config.modRequest.projectRoot);\n\n await configureColorAssets({\n iosNamedProjectRoot,\n backgroundColor: splash.backgroundColor,\n darkBackgroundColor: splash.dark?.backgroundColor,\n });\n return config;\n },\n ]);\n};\n\nasync function configureColorAssets({\n iosNamedProjectRoot,\n backgroundColor = '#ffffff',\n darkBackgroundColor,\n}: {\n iosNamedProjectRoot: string;\n backgroundColor: string;\n darkBackgroundColor?: string | null;\n}) {\n const colorsetPath = path.resolve(iosNamedProjectRoot, SPLASHSCREEN_COLORSET_PATH);\n\n // ensure old SplashScreen colorSet is removed\n await fs.remove(colorsetPath);\n\n await writeColorsContentsJsonFileAsync({\n assetPath: colorsetPath,\n backgroundColor,\n darkBackgroundColor: darkBackgroundColor ?? null,\n });\n}\n\nasync function writeColorsContentsJsonFileAsync({\n assetPath,\n backgroundColor,\n darkBackgroundColor,\n}: {\n assetPath: string;\n backgroundColor: string;\n darkBackgroundColor: string | null;\n}) {\n const color = parseColor(backgroundColor);\n const darkColor = darkBackgroundColor ? parseColor(darkBackgroundColor) : null;\n\n const colors: ContentsJsonColor[] = [\n {\n color: {\n components: {\n alpha: '1.000',\n blue: color.rgb.blue,\n green: color.rgb.green,\n red: color.rgb.red,\n },\n 'color-space': 'srgb',\n },\n idiom: 'universal',\n },\n ];\n\n if (darkColor) {\n colors.push({\n color: {\n components: {\n alpha: '1.000',\n blue: darkColor.rgb.blue,\n green: darkColor.rgb.green,\n red: darkColor.rgb.red,\n },\n 'color-space': 'srgb',\n },\n idiom: 'universal',\n appearances: [\n {\n appearance: 'luminosity',\n value: 'dark',\n },\n ],\n });\n }\n debug(`create colors contents.json:`, assetPath);\n debug(`use colors:`, colors);\n await writeContentsJsonAsync(assetPath, { colors });\n}\n\nasync function writeContentsJsonAsync(\n directory: string,\n { colors }: { colors: ContentsJsonColor[] }\n): Promise<void> {\n await fs.ensureDir(directory);\n\n await fs.writeFile(\n join(directory, 'Contents.json'),\n JSON.stringify(\n {\n colors,\n info: {\n version: 1,\n // common practice is for the tool that generated the icons to be the \"author\"\n author: 'expo',\n },\n },\n null,\n 2\n )\n );\n}\n"],"mappings":";;;;;;AAAA,SAAAA,eAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,cAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,OAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,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AK,CAAC,8BAA8B,EAAEwB,SAAS,CAAC;EAChDxB,KAAK,CAAC,aAAa,EAAE4B,MAAM,CAAC;EAC5B,MAAMY,sBAAsB,CAAChB,SAAS,EAAE;IAAEI;EAAO,CAAC,CAAC;AACrD;AAEA,eAAeY,sBAAsBA,CACnCC,SAAiB,EACjB;EAAEb;AAAwC,CAAC,EAC5B;EACf,MAAMP,kBAAE,CAACqB,SAAS,CAACD,SAAS,CAAC;EAE7B,MAAMpB,kBAAE,CAACsB,SAAS,CAChB,IAAAC,YAAI,EAACH,SAAS,EAAE,eAAe,CAAC,EAChCI,IAAI,CAACC,SAAS,CACZ;IACElB,MAAM;IACNmB,IAAI,EAAE;MACJC,OAAO,EAAE,CAAC;MACV;MACAC,MAAM,EAAE;IACV;EACF,CAAC,EACD,IAAI,EACJ,CACF,CACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -32,6 +32,13 @@ function _withIosSplashAssets() {
|
|
|
32
32
|
};
|
|
33
33
|
return data;
|
|
34
34
|
}
|
|
35
|
+
function _withIosSplashColors() {
|
|
36
|
+
const data = require("./withIosSplashColors");
|
|
37
|
+
_withIosSplashColors = function () {
|
|
38
|
+
return data;
|
|
39
|
+
};
|
|
40
|
+
return data;
|
|
41
|
+
}
|
|
35
42
|
function _withIosSplashInfoPlist() {
|
|
36
43
|
const data = require("./withIosSplashInfoPlist");
|
|
37
44
|
_withIosSplashInfoPlist = function () {
|
|
@@ -73,7 +80,7 @@ const withIosSplashScreen = (config, splash) => {
|
|
|
73
80
|
};
|
|
74
81
|
}
|
|
75
82
|
debug(`config:`, splash);
|
|
76
|
-
return (0, _configPlugins().withPlugins)(config, [[_withIosSplashInfoPlist().withIosSplashInfoPlist, splash], [_withIosSplashAssets().withIosSplashAssets, splash],
|
|
83
|
+
return (0, _configPlugins().withPlugins)(config, [[_withIosSplashInfoPlist().withIosSplashInfoPlist, splash], [_withIosSplashAssets().withIosSplashAssets, splash], [_withIosSplashColors().withIosSplashColors, splash],
|
|
77
84
|
// Add the image settings to the storyboard.
|
|
78
85
|
[_withIosSplashScreenStoryboardImage().withIosSplashScreenImage, splash],
|
|
79
86
|
// Link storyboard to xcode project.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withIosSplashScreen.js","names":["_configPlugins","data","require","_debug","_interopRequireDefault","_getIosSplashConfig","_withIosSplashAssets","_withIosSplashInfoPlist","_withIosSplashScreenStoryboard","_withIosSplashScreenStoryboardImage","_withIosSplashXcodeProject","e","__esModule","default","debug","Debug","withIosSplashScreen","config","splash","getIosSplashConfig","withPlugins","withIosSplashInfoPlist","withIosSplashAssets","withIosSplashScreenImage","withIosSplashXcodeProject","withIosSplashScreenStoryboardBaseMod","exports"],"sources":["../../../../src/plugins/unversioned/expo-splash-screen/withIosSplashScreen.ts"],"sourcesContent":["import { ConfigPlugin, withPlugins } from '@expo/config-plugins';\nimport Debug from 'debug';\n\nimport { getIosSplashConfig, IOSSplashConfig } from './getIosSplashConfig';\nimport { withIosSplashAssets } from './withIosSplashAssets';\nimport { withIosSplashInfoPlist } from './withIosSplashInfoPlist';\nimport { withIosSplashScreenStoryboardBaseMod } from './withIosSplashScreenStoryboard';\nimport { withIosSplashScreenImage } from './withIosSplashScreenStoryboardImage';\nimport { withIosSplashXcodeProject } from './withIosSplashXcodeProject';\n\nconst debug = Debug('expo:prebuild-config:expo-splash-screen:ios');\n\nexport const withIosSplashScreen: ConfigPlugin<IOSSplashConfig | undefined | null | void> = (\n config,\n splash\n) => {\n // If the user didn't specify a splash object, infer the splash object from the Expo config.\n if (!splash) {\n splash = getIosSplashConfig(config);\n } else {\n splash = { ...getIosSplashConfig(config), ...splash };\n }\n\n debug(`config:`, splash);\n\n return withPlugins(config, [\n [withIosSplashInfoPlist, splash],\n [withIosSplashAssets, splash],\n // Add the image settings to the storyboard.\n [withIosSplashScreenImage, splash],\n // Link storyboard to xcode project.\n // TODO: Maybe fold this into the base mod.\n withIosSplashXcodeProject,\n // Insert the base mod last, no other ios.splashScreenStoryboard mods can be added after this.\n withIosSplashScreenStoryboardBaseMod,\n ]);\n};\n"],"mappings":";;;;;;AAAA,SAAAA,eAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,cAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,OAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,MAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,oBAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,mBAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,qBAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,oBAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,
|
|
1
|
+
{"version":3,"file":"withIosSplashScreen.js","names":["_configPlugins","data","require","_debug","_interopRequireDefault","_getIosSplashConfig","_withIosSplashAssets","_withIosSplashColors","_withIosSplashInfoPlist","_withIosSplashScreenStoryboard","_withIosSplashScreenStoryboardImage","_withIosSplashXcodeProject","e","__esModule","default","debug","Debug","withIosSplashScreen","config","splash","getIosSplashConfig","withPlugins","withIosSplashInfoPlist","withIosSplashAssets","withIosSplashColors","withIosSplashScreenImage","withIosSplashXcodeProject","withIosSplashScreenStoryboardBaseMod","exports"],"sources":["../../../../src/plugins/unversioned/expo-splash-screen/withIosSplashScreen.ts"],"sourcesContent":["import { ConfigPlugin, withPlugins } from '@expo/config-plugins';\nimport Debug from 'debug';\n\nimport { getIosSplashConfig, IOSSplashConfig } from './getIosSplashConfig';\nimport { withIosSplashAssets } from './withIosSplashAssets';\nimport { withIosSplashColors } from './withIosSplashColors';\nimport { withIosSplashInfoPlist } from './withIosSplashInfoPlist';\nimport { withIosSplashScreenStoryboardBaseMod } from './withIosSplashScreenStoryboard';\nimport { withIosSplashScreenImage } from './withIosSplashScreenStoryboardImage';\nimport { withIosSplashXcodeProject } from './withIosSplashXcodeProject';\n\nconst debug = Debug('expo:prebuild-config:expo-splash-screen:ios');\n\nexport const withIosSplashScreen: ConfigPlugin<IOSSplashConfig | undefined | null | void> = (\n config,\n splash\n) => {\n // If the user didn't specify a splash object, infer the splash object from the Expo config.\n if (!splash) {\n splash = getIosSplashConfig(config);\n } else {\n splash = { ...getIosSplashConfig(config), ...splash };\n }\n\n debug(`config:`, splash);\n\n return withPlugins(config, [\n [withIosSplashInfoPlist, splash],\n [withIosSplashAssets, splash],\n [withIosSplashColors, splash],\n // Add the image settings to the storyboard.\n [withIosSplashScreenImage, splash],\n // Link storyboard to xcode project.\n // TODO: Maybe fold this into the base mod.\n withIosSplashXcodeProject,\n // Insert the base mod last, no other ios.splashScreenStoryboard mods can be added after this.\n withIosSplashScreenStoryboardBaseMod,\n ]);\n};\n"],"mappings":";;;;;;AAAA,SAAAA,eAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,cAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,OAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,MAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,oBAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,mBAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,qBAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,oBAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,qBAAA;EAAA,MAAAN,IAAA,GAAAC,OAAA;EAAAK,oBA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AC7B;EACA,CAACM,8DAAwB,EAAEN,MAAM,CAAC;EAClC;EACA;EACAO,sDAAyB;EACzB;EACAC,qEAAoC,CACrC,CAAC;AACJ,CAAC;AAACC,OAAA,CAAAX,mBAAA,GAAAA,mBAAA","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expo/prebuild-config",
|
|
3
|
-
"version": "8.0.
|
|
3
|
+
"version": "8.0.8",
|
|
4
4
|
"description": "Get the prebuild config",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -50,10 +50,10 @@
|
|
|
50
50
|
"xml2js": "0.6.0"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
|
-
"expo-modules-autolinking": "2.0.0-preview.
|
|
53
|
+
"expo-modules-autolinking": "2.0.0-preview.3"
|
|
54
54
|
},
|
|
55
55
|
"publishConfig": {
|
|
56
56
|
"access": "public"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "a64603dce90981bf7688657f87dfa4be3e24f58b"
|
|
59
59
|
}
|