react-native-bootsplash 7.0.0-beta.0 → 7.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -25,7 +25,7 @@ import util from "util";
25
25
  import formatXml from "xml-formatter";
26
26
  const PACKAGE_NAME = "react-native-bootsplash";
27
27
  let isExpo = false;
28
- export const workingPath = process.env.INIT_CWD ?? process.env.PWD ?? process.cwd();
28
+ const workingPath = process.env.INIT_CWD ?? process.env.PWD ?? process.cwd();
29
29
  const projectRoot = findProjectRoot(workingPath);
30
30
  const promisifiedExec = util.promisify(childProcess.exec);
31
31
  const exec = cmd => promisifiedExec(cmd).then(({
@@ -67,18 +67,12 @@ const parseColor = value => {
67
67
  rgb
68
68
  };
69
69
  };
70
- const getStoryboard = ({
71
- props,
72
- extras
73
- }) => {
70
+ const getStoryboard = props => {
74
71
  const {
75
72
  background,
76
- logo
73
+ logo,
74
+ fileNameSuffix
77
75
  } = props;
78
- const {
79
- fileNameSuffix,
80
- logoHeight
81
- } = extras;
82
76
  const {
83
77
  R,
84
78
  G,
@@ -107,7 +101,7 @@ const getStoryboard = ({
107
101
  <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
108
102
  <subviews>
109
103
  <imageView autoresizesSubviews="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" image="BootSplashLogo-${fileNameSuffix}" translatesAutoresizingMaskIntoConstraints="NO" id="3lX-Ut-9ad">
110
- <rect key="frame" x="${(frameWidth - logo.width) / 2}" y="${(frameHeight - logoHeight) / 2}" width="${logo.width}" height="${logoHeight}"/>
104
+ <rect key="frame" x="${(frameWidth - logo.width) / 2}" y="${(frameHeight - logo.height) / 2}" width="${logo.width}" height="${logo.height}"/>
111
105
  <accessibility key="accessibilityConfiguration">
112
106
  <accessibilityTraits key="traits" image="YES" notEnabled="YES"/>
113
107
  </accessibility>
@@ -127,7 +121,7 @@ const getStoryboard = ({
127
121
  </scene>
128
122
  </scenes>
129
123
  <resources>
130
- <image name="BootSplashLogo-${fileNameSuffix}" width="${logo.width}" height="${logoHeight}"/>
124
+ <image name="BootSplashLogo-${fileNameSuffix}" width="${logo.width}" height="${logo.height}"/>
131
125
  <namedColor name="BootSplashBackground-${fileNameSuffix}">
132
126
  <color red="${R}" green="${G}" blue="${B}" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
133
127
  </namedColor>
@@ -211,26 +205,6 @@ export const writeXmlLike = async (filePath, content, {
211
205
  log.write(filePath);
212
206
  }
213
207
  };
214
- const getAssetBase64 = async (name, asset) => {
215
- if (asset == null) {
216
- return "";
217
- }
218
- const {
219
- image,
220
- width
221
- } = asset;
222
- const {
223
- format
224
- } = await image.metadata();
225
- if (format !== "png" && format !== "svg") {
226
- log.error(`${name} image file format (${format}) is not supported`);
227
- process.exit(1);
228
- }
229
- const buffer = await image.clone().resize(width).png({
230
- quality: 100
231
- }).toBuffer();
232
- return buffer.toString("base64");
233
- };
234
208
  const getAndroidOutputPath = ({
235
209
  flavor,
236
210
  platforms
@@ -289,52 +263,47 @@ const getInfoPlistPath = ({
289
263
  }
290
264
  return path.resolve(iosOutputPath, "Info.plist");
291
265
  };
292
- const getAssetHeight = asset => {
293
- if (asset == null) {
294
- return Promise.resolve(0);
266
+ const toAsset = async (filePath, width) => {
267
+ const image = sharp(filePath);
268
+ const {
269
+ format
270
+ } = await image.metadata();
271
+ if (format !== "png" && format !== "svg") {
272
+ log.error(`${path.basename(filePath)} image file format (${format}) is not supported`);
273
+ process.exit(1);
295
274
  }
296
- return asset.image.clone().resize(asset.width).toBuffer().then(buffer => sharp(buffer).metadata()).then(({
275
+ const [height, hash] = await Promise.all([image.clone().resize(width).toBuffer().then(buffer => sharp(buffer).metadata()).then(({
297
276
  height = 0
298
- }) => Math.round(height));
277
+ }) => Math.round(height)), image.clone().resize(width).png({
278
+ quality: 100
279
+ }).toBuffer().then(buffer => buffer.toString("base64"))]);
280
+ return {
281
+ path: filePath,
282
+ image,
283
+ hash,
284
+ height,
285
+ width
286
+ };
299
287
  };
300
- const getProps = ({
288
+ const transformProps = async (rootPath, {
301
289
  android = {},
302
290
  licenseKey,
303
- ...config
291
+ ...rawProps
304
292
  }) => {
305
293
  if (semver.lt(process.versions.node, "20.0.0")) {
306
294
  log.error("Requires Node 20 (or higher)");
307
295
  process.exit(1);
308
296
  }
309
- const assetsOutputPath = path.resolve(workingPath, config.assetsOutput);
310
- const logoPath = path.resolve(workingPath, config.logo);
311
- const darkLogoPath = config.darkLogo != null ? path.resolve(workingPath, config.darkLogo) : undefined;
312
- const brandPath = config.brand != null ? path.resolve(workingPath, config.brand) : undefined;
313
- const darkBrandPath = config.darkBrand != null ? path.resolve(workingPath, config.darkBrand) : undefined;
314
- const logoWidth = config.logoWidth - config.logoWidth % 2;
315
- const brandWidth = config.brandWidth - config.brandWidth % 2;
316
- const logo = {
317
- path: logoPath,
318
- image: sharp(logoPath),
319
- width: logoWidth
320
- };
321
- const darkLogo = darkLogoPath != null ? {
322
- path: darkLogoPath,
323
- image: sharp(darkLogoPath),
324
- width: logoWidth
325
- } : undefined;
326
- const brand = brandPath != null ? {
327
- path: brandPath,
328
- image: sharp(brandPath),
329
- width: brandWidth
330
- } : undefined;
331
- const darkBrand = darkBrandPath != null ? {
332
- path: darkBrandPath,
333
- image: sharp(darkBrandPath),
334
- width: brandWidth
335
- } : undefined;
336
- const background = parseColor(config.background);
337
- const darkBackground = config.darkBackground != null ? parseColor(config.darkBackground) : undefined;
297
+ const assetsOutputPath = path.resolve(rootPath, rawProps.assetsOutput);
298
+ const logoPath = path.resolve(rootPath, rawProps.logo);
299
+ const darkLogoPath = rawProps.darkLogo != null ? path.resolve(rootPath, rawProps.darkLogo) : undefined;
300
+ const brandPath = rawProps.brand != null ? path.resolve(rootPath, rawProps.brand) : undefined;
301
+ const darkBrandPath = rawProps.darkBrand != null ? path.resolve(rootPath, rawProps.darkBrand) : undefined;
302
+ const logoWidth = rawProps.logoWidth - rawProps.logoWidth % 2;
303
+ const brandWidth = rawProps.brandWidth - rawProps.brandWidth % 2;
304
+ const [logo, darkLogo, brand, darkBrand] = await Promise.all([toAsset(logoPath, logoWidth), darkLogoPath != null ? toAsset(darkLogoPath, logoWidth) : undefined, brandPath != null ? toAsset(brandPath, brandWidth) : undefined, darkBrandPath != null ? toAsset(darkBrandPath, brandWidth) : undefined]);
305
+ const background = parseColor(rawProps.background);
306
+ const darkBackground = rawProps.darkBackground != null ? parseColor(rawProps.darkBackground) : undefined;
338
307
  const executeAddon = brand != null || darkBackground != null || darkLogo != null || darkBrand != null;
339
308
  if (licenseKey != null && !executeAddon) {
340
309
  log.warn("You specified a license key but none of the options that requires it.");
@@ -354,12 +323,24 @@ const getProps = ({
354
323
  log.error(`${optionNames.darkBrand} option couldn't be used without ${optionNames.brand}.`);
355
324
  process.exit(1);
356
325
  }
357
- if (logoWidth < config.logoWidth) {
326
+ if (logoWidth < rawProps.logoWidth) {
358
327
  log.warn(`Logo width must be a multiple of 2. It has been rounded to ${logoWidth}dp.`);
359
328
  }
360
- if (brandWidth < config.brandWidth) {
329
+ if (brandWidth < rawProps.brandWidth) {
361
330
  log.warn(`Brand width must be a multiple of 2. It has been rounded to ${brandWidth}dp.`);
362
331
  }
332
+ const record = {
333
+ background: background.hex,
334
+ darkBackground: darkBackground?.hex ?? "",
335
+ logo: logo.hash,
336
+ darkLogo: darkLogo?.hash ?? "",
337
+ brand: brand?.hash ?? "",
338
+ darkBrand: darkBrand?.hash ?? ""
339
+ };
340
+ const stableKey = Object.keys(record).sort().map(key => record[key]).join();
341
+ const fileNameSuffix = crypto.createHash("shake256", {
342
+ outputLength: 3
343
+ }).update(stableKey).digest("hex").toLowerCase();
363
344
  return {
364
345
  android,
365
346
  assetsOutputPath,
@@ -370,52 +351,25 @@ const getProps = ({
370
351
  logo,
371
352
  darkLogo,
372
353
  brand,
373
- darkBrand
354
+ darkBrand,
355
+ fileNameSuffix
374
356
  };
375
357
  };
376
- export const getExtras = async ({
377
- background,
378
- darkBackground,
379
- logo,
380
- darkLogo,
381
- brand,
382
- darkBrand
383
- }) => {
384
- const [logoHash, darkLogoHash, brandHash, darkBrandHash, logoHeight, brandHeight] = await Promise.all([getAssetBase64("Logo", logo), getAssetBase64("Dark logo", darkLogo), getAssetBase64("Brand", brand), getAssetBase64("Dark brand", darkBrand), getAssetHeight(logo), getAssetHeight(brand)]);
385
- const record = {
386
- background: background.hex,
387
- darkBackground: darkBackground?.hex ?? "",
388
- logo: logoHash,
389
- darkLogo: darkLogoHash,
390
- brand: brandHash,
391
- darkBrand: darkBrandHash
392
- };
393
- const stableKey = Object.keys(record).sort().map(key => record[key]).join();
394
- const fileNameSuffix = crypto.createHash("shake256", {
395
- outputLength: 3
396
- }).update(stableKey).digest("hex").toLowerCase();
397
- return {
398
- fileNameSuffix,
399
- logoHeight,
400
- brandHeight
401
- };
402
- };
403
- export const writeAndroidAssets = async ({
358
+ const writeAndroidAssets = async ({
404
359
  androidOutputPath,
405
- props,
406
- extras
360
+ props
407
361
  }) => {
408
362
  const {
409
363
  logo,
410
364
  brand
411
365
  } = props;
412
- if (logo.width > 192 || extras.logoHeight > 192) {
366
+ if (logo.width > 192 || logo.height > 192) {
413
367
  return log.warn("Logo size exceeding 192x192dp will be cropped by Android. Skipping Android assets generation…");
414
368
  }
415
- if (brand != null && (brand.width > 200 || extras.brandHeight > 80)) {
369
+ if (brand != null && (brand.width > 200 || brand.height > 80)) {
416
370
  return log.warn("Brand size exceeding 200x80dp will be cropped by Android. Skipping Android assets generation…");
417
371
  }
418
- if (logo.width > 134 || extras.logoHeight > 134) {
372
+ if (logo.width > 134 || logo.height > 134) {
419
373
  log.warn("Logo size exceeds 134x134dp. It might be cropped by Android.");
420
374
  }
421
375
  log.title("🤖", "Android");
@@ -472,14 +426,14 @@ export const writeAndroidAssets = async ({
472
426
  });
473
427
  }));
474
428
  };
475
- export const writeIOSAssets = async ({
429
+ const writeIOSAssets = async ({
476
430
  iosOutputPath,
477
- props,
478
- extras
431
+ props
479
432
  }) => {
480
433
  const {
481
434
  background,
482
- logo
435
+ logo,
436
+ fileNameSuffix
483
437
  } = props;
484
438
  log.title("🍏", "iOS");
485
439
  hfs.ensureDir(iosOutputPath);
@@ -489,14 +443,11 @@ export const writeIOSAssets = async ({
489
443
  hfs.rm(file);
490
444
  });
491
445
  const storyboardPath = path.resolve(iosOutputPath, "BootSplash.storyboard");
492
- await writeXmlLike(storyboardPath, getStoryboard({
493
- props,
494
- extras
495
- }), {
446
+ await writeXmlLike(storyboardPath, getStoryboard(props), {
496
447
  formatter: "xmlFormatter",
497
448
  whiteSpaceAtEndOfSelfclosingTag: false
498
449
  });
499
- const colorsSetPath = path.resolve(iosOutputPath, "Colors.xcassets", `BootSplashBackground-${extras.fileNameSuffix}.colorset`);
450
+ const colorsSetPath = path.resolve(iosOutputPath, "Colors.xcassets", `BootSplashBackground-${fileNameSuffix}.colorset`);
500
451
  hfs.ensureDir(colorsSetPath);
501
452
  writeJson(path.resolve(colorsSetPath, "Contents.json"), {
502
453
  colors: [{
@@ -516,8 +467,8 @@ export const writeIOSAssets = async ({
516
467
  version: 1
517
468
  }
518
469
  });
519
- const logoFileName = `logo-${extras.fileNameSuffix}`;
520
- const imagesSetPath = path.resolve(iosOutputPath, "Images.xcassets", `BootSplashLogo-${extras.fileNameSuffix}.imageset`);
470
+ const logoFileName = `logo-${fileNameSuffix}`;
471
+ const imagesSetPath = path.resolve(iosOutputPath, "Images.xcassets", `BootSplashLogo-${fileNameSuffix}.imageset`);
521
472
  hfs.ensureDir(imagesSetPath);
522
473
  writeJson(path.resolve(imagesSetPath, "Contents.json"), {
523
474
  images: [{
@@ -565,10 +516,9 @@ export const writeIOSAssets = async ({
565
516
  });
566
517
  }));
567
518
  };
568
- export const writeWebAssets = async ({
519
+ const writeWebAssets = async ({
569
520
  htmlTemplatePath,
570
- props,
571
- extras
521
+ props
572
522
  }) => {
573
523
  const {
574
524
  background,
@@ -601,7 +551,7 @@ export const writeWebAssets = async ({
601
551
  #bootsplash-logo {
602
552
  content: url("${dataURI}");
603
553
  width: ${logo.width}px;
604
- height: ${extras.logoHeight}px;
554
+ height: ${logo.height}px;
605
555
  }
606
556
  </style>
607
557
  `);
@@ -627,9 +577,8 @@ export const writeWebAssets = async ({
627
577
  useCssPlugin: true
628
578
  });
629
579
  };
630
- export const writeGenericAssets = async ({
631
- props,
632
- extras
580
+ const writeGenericAssets = async ({
581
+ props
633
582
  }) => {
634
583
  const {
635
584
  assetsOutputPath,
@@ -642,7 +591,7 @@ export const writeGenericAssets = async ({
642
591
  background: background.hex,
643
592
  logo: {
644
593
  width: logo.width,
645
- height: extras.logoHeight
594
+ height: logo.height
646
595
  }
647
596
  });
648
597
  await Promise.all([{
@@ -678,11 +627,16 @@ export const writeGenericAssets = async ({
678
627
  });
679
628
  }));
680
629
  };
681
- const requireAddon = () => {
682
- try {
683
- return require("./addon");
684
- } catch {
685
- return;
630
+ const requireAddon = ({
631
+ executeAddon,
632
+ licenseKey
633
+ }) => {
634
+ if (licenseKey != null && executeAddon) {
635
+ try {
636
+ return require("./addon");
637
+ } catch {
638
+ return;
639
+ }
686
640
  }
687
641
  };
688
642
  export const generate = async ({
@@ -690,16 +644,14 @@ export const generate = async ({
690
644
  html,
691
645
  flavor,
692
646
  plist,
693
- ...config
647
+ ...rawProps
694
648
  }) => {
695
- const props = getProps(config);
649
+ const props = await transformProps(workingPath, rawProps);
650
+ const addon = requireAddon(props);
696
651
  const {
697
652
  background,
698
- brand,
699
- licenseKey,
700
- executeAddon
653
+ brand
701
654
  } = props;
702
- const extras = await getExtras(props);
703
655
  const androidOutputPath = getAndroidOutputPath({
704
656
  flavor,
705
657
  platforms
@@ -714,8 +666,7 @@ export const generate = async ({
714
666
  if (androidOutputPath != null) {
715
667
  await writeAndroidAssets({
716
668
  androidOutputPath,
717
- props,
718
- extras
669
+ props
719
670
  });
720
671
  const manifestXmlPath = path.resolve(androidOutputPath, "..", "AndroidManifest.xml");
721
672
  if (hfs.exists(manifestXmlPath)) {
@@ -790,8 +741,7 @@ export const generate = async ({
790
741
  if (iosOutputPath != null) {
791
742
  await writeIOSAssets({
792
743
  iosOutputPath,
793
- props,
794
- extras
744
+ props
795
745
  });
796
746
  const infoPlistPath = getInfoPlistPath({
797
747
  iosOutputPath,
@@ -833,19 +783,15 @@ export const generate = async ({
833
783
  if (htmlTemplatePath != null) {
834
784
  await writeWebAssets({
835
785
  htmlTemplatePath,
836
- props,
837
- extras
786
+ props
838
787
  });
839
788
  }
840
789
  await writeGenericAssets({
841
- props,
842
- extras
790
+ props
843
791
  });
844
- if (licenseKey != null && executeAddon) {
845
- const addon = requireAddon();
846
- await addon?.execute({
792
+ if (addon != null) {
793
+ await addon.execute({
847
794
  props,
848
- extras,
849
795
  androidOutputPath,
850
796
  iosOutputPath,
851
797
  htmlTemplatePath
@@ -862,21 +808,26 @@ ${pc.blue("┗━━━━━━━━━━━━━━━━━━━━━━
862
808
 
863
809
  // Expo plugin
864
810
 
865
- const withoutExpoSplashScreen = Expo.createRunOncePlugin(config => config, "expo-splash-screen", "skip");
866
- const withAndroidAssets = (config, props) => Expo.withDangerousMod(config, ["android", async config => {
811
+ const withoutExpoSplashScreen = Expo.createRunOncePlugin(expoConfig => expoConfig, "expo-splash-screen", "skip");
812
+ const withAndroidAssets = (expoConfig, rawProps) => Expo.withDangerousMod(expoConfig, ["android", async config => {
867
813
  const {
868
- platformProjectRoot
814
+ platformProjectRoot,
815
+ projectRoot
869
816
  } = config.modRequest;
870
- const extras = await getExtras(props);
817
+ const props = await transformProps(projectRoot, rawProps);
818
+ const addon = requireAddon(props);
871
819
  const androidOutputPath = path.resolve(platformProjectRoot, "app", "src", "main", "res");
872
820
  await writeAndroidAssets({
873
821
  androidOutputPath,
874
- props,
875
- extras
822
+ props
823
+ });
824
+ await addon?.writeAndroidAssets({
825
+ androidOutputPath,
826
+ props
876
827
  });
877
828
  return config;
878
829
  }]);
879
- const withAndroidManifest = config => Expo.withAndroidManifest(config, config => {
830
+ const withAndroidManifest = expoConfig => Expo.withAndroidManifest(expoConfig, config => {
880
831
  config.modResults.manifest.application?.forEach(application => {
881
832
  if (application.$["android:name"] === ".MainApplication") {
882
833
  const {
@@ -891,7 +842,7 @@ const withAndroidManifest = config => Expo.withAndroidManifest(config, config =>
891
842
  });
892
843
  return config;
893
844
  });
894
- const withMainActivity = config => Expo.withMainActivity(config, config => {
845
+ const withMainActivity = expoConfig => Expo.withMainActivity(expoConfig, config => {
895
846
  const {
896
847
  modResults
897
848
  } = config;
@@ -914,11 +865,14 @@ const withMainActivity = config => Expo.withMainActivity(config, config => {
914
865
  }
915
866
  };
916
867
  });
917
- const withAndroidStyles = (config, props) => Expo.withAndroidStyles(config, config => {
868
+ const withAndroidStyles = (expoConfig, rawProps) => Expo.withAndroidStyles(expoConfig, async config => {
869
+ const {
870
+ projectRoot
871
+ } = config.modRequest;
918
872
  const {
919
873
  android,
920
874
  brand
921
- } = props;
875
+ } = await transformProps(projectRoot, rawProps);
922
876
  const {
923
877
  darkContentBarsStyle
924
878
  } = android;
@@ -983,38 +937,57 @@ const withAndroidStyles = (config, props) => Expo.withAndroidStyles(config, conf
983
937
  }
984
938
  };
985
939
  });
986
- const withAndroidColors = (config, props) => Expo.withAndroidColors(config, config => {
940
+ const withAndroidColors = (expoConfig, rawProps) => Expo.withAndroidColors(expoConfig, async config => {
941
+ const {
942
+ projectRoot
943
+ } = config.modRequest;
987
944
  const {
988
945
  background
989
- } = props;
946
+ } = await transformProps(projectRoot, rawProps);
990
947
  config.modResults = assignColorValue(config.modResults, {
991
948
  name: "bootsplash_background",
992
949
  value: background.hex
993
950
  });
994
951
  return config;
995
952
  });
996
- const withIOSAssets = (config, props) => Expo.withDangerousMod(config, ["ios", async config => {
953
+ const withAndroidColorsNight = (expoConfig, rawProps) => Expo.withAndroidColorsNight(expoConfig, async config => {
954
+ const {
955
+ projectRoot
956
+ } = config.modRequest;
957
+ const props = await transformProps(projectRoot, rawProps);
958
+ const addon = requireAddon(props);
959
+ return addon != null ? await addon.withAndroidColorsNight({
960
+ config,
961
+ props
962
+ }) : config;
963
+ });
964
+ const withIOSAssets = (expoConfig, rawProps) => Expo.withDangerousMod(expoConfig, ["ios", async config => {
997
965
  const {
998
966
  platformProjectRoot,
999
- projectName = ""
967
+ projectName = "",
968
+ projectRoot
1000
969
  } = config.modRequest;
1001
- const extras = await getExtras(props);
970
+ const props = await transformProps(projectRoot, rawProps);
971
+ const addon = requireAddon(props);
1002
972
  const iosOutputPath = path.resolve(platformProjectRoot, projectName);
1003
973
  await writeIOSAssets({
1004
974
  iosOutputPath,
1005
- props,
1006
- extras
975
+ props
976
+ });
977
+ await addon?.writeIOSAssets({
978
+ iosOutputPath,
979
+ props
1007
980
  });
1008
981
  return config;
1009
982
  }]);
1010
- const withAppDelegate = config => Expo.withAppDelegate(config, config => {
983
+ const withAppDelegate = expoConfig => Expo.withAppDelegate(expoConfig, config => {
1011
984
  const {
1012
985
  modResults
1013
986
  } = config;
1014
987
  const {
1015
988
  language
1016
989
  } = modResults;
1017
- if (language !== "objc" && language !== "objcpp" && language !== "swift") {
990
+ if (language !== "swift") {
1018
991
  throw new Error(`Cannot modify the project AppDelegate as it's not in a supported language: ${language}`);
1019
992
  }
1020
993
  const withHeader = mergeContents({
@@ -1046,11 +1019,11 @@ const withAppDelegate = config => Expo.withAppDelegate(config, config => {
1046
1019
  }
1047
1020
  };
1048
1021
  });
1049
- const withInfoPlist = config => Expo.withInfoPlist(config, config => {
1022
+ const withInfoPlist = expoConfig => Expo.withInfoPlist(expoConfig, config => {
1050
1023
  config.modResults["UILaunchStoryboardName"] = "BootSplash";
1051
1024
  return config;
1052
1025
  });
1053
- const withXcodeProject = config => Expo.withXcodeProject(config, config => {
1026
+ const withXcodeProject = expoConfig => Expo.withXcodeProject(expoConfig, config => {
1054
1027
  const {
1055
1028
  projectName = ""
1056
1029
  } = config.modRequest;
@@ -1068,25 +1041,38 @@ const withXcodeProject = config => Expo.withXcodeProject(config, config => {
1068
1041
  });
1069
1042
  return config;
1070
1043
  });
1071
- const withWebAssets = (config, props) => Expo.withDangerousMod(config, [config.platforms?.includes("ios") ? "ios" : "android", async config => {
1072
- const extras = await getExtras(props);
1044
+ const withWebAssets = (expoConfig, rawProps) => Expo.withDangerousMod(expoConfig, [expoConfig.platforms?.includes("ios") ? "ios" : "android", async config => {
1045
+ const {
1046
+ projectRoot
1047
+ } = config.modRequest;
1048
+ const props = await transformProps(projectRoot, rawProps);
1049
+ const addon = requireAddon(props);
1073
1050
  const fileName = "public/index.html";
1074
- const htmlTemplatePath = path.resolve(workingPath, fileName);
1051
+ const htmlTemplatePath = path.resolve(projectRoot, fileName);
1075
1052
  if (!hfs.exists(htmlTemplatePath)) {
1076
1053
  await exec(`npx expo customize ${fileName}`);
1077
1054
  }
1078
1055
  await writeWebAssets({
1079
1056
  htmlTemplatePath,
1080
- props,
1081
- extras
1057
+ props
1058
+ });
1059
+ await addon?.writeWebAssets({
1060
+ htmlTemplatePath,
1061
+ props
1082
1062
  });
1083
1063
  return config;
1084
1064
  }]);
1085
- const withGenericAssets = (config, props) => Expo.withDangerousMod(config, [config.platforms?.includes("ios") ? "ios" : "android", async config => {
1086
- const extras = await getExtras(props);
1065
+ const withGenericAssets = (expoConfig, rawProps) => Expo.withDangerousMod(expoConfig, [expoConfig.platforms?.includes("ios") ? "ios" : "android", async config => {
1066
+ const {
1067
+ projectRoot
1068
+ } = config.modRequest;
1069
+ const props = await transformProps(projectRoot, rawProps);
1070
+ const addon = requireAddon(props);
1087
1071
  await writeGenericAssets({
1088
- props,
1089
- extras
1072
+ props
1073
+ });
1074
+ await addon?.writeGenericAssets({
1075
+ props
1090
1076
  });
1091
1077
  return config;
1092
1078
  }]);
@@ -1096,38 +1082,31 @@ export const withBootSplash = Expo.createRunOncePlugin((config, baseProps) => {
1096
1082
  sdkVersion = "0.1.0"
1097
1083
  } = config;
1098
1084
  isExpo = true;
1099
- if (semver.lt(sdkVersion, "53.0.0")) {
1100
- log.error("Requires Expo 53.0.0 (or higher)");
1085
+ if (semver.lt(sdkVersion, "54.0.0")) {
1086
+ log.error("Requires Expo 54.0.0 (or higher)");
1101
1087
  process.exit(1);
1102
1088
  }
1103
1089
  if (!baseProps?.logo) {
1104
1090
  log.error("Missing required parameter 'logo'");
1105
1091
  process.exit(1);
1106
1092
  }
1107
- const props = getProps({
1093
+ const rawProps = {
1108
1094
  assetsOutput: "assets/bootsplash",
1109
1095
  background: "#fff",
1110
1096
  brandWidth: 80,
1111
1097
  logoWidth: 100,
1112
1098
  ...baseProps
1113
- });
1114
- const {
1115
- executeAddon
1116
- } = props;
1117
- const addon = executeAddon ? requireAddon() : undefined;
1118
- const plugins = [withoutExpoSplashScreen, addon?.withGenericAssets ?? withGenericAssets];
1099
+ };
1100
+ const plugins = [withoutExpoSplashScreen, withGenericAssets];
1119
1101
  if (platforms.includes("android")) {
1120
- plugins.push(addon?.withAndroidAssets ?? withAndroidAssets, withAndroidManifest, withMainActivity, withAndroidStyles, withAndroidColors);
1121
- if (addon != null) {
1122
- plugins.push(addon.withAndroidColorsNight);
1123
- }
1102
+ plugins.push(withAndroidAssets, withAndroidManifest, withMainActivity, withAndroidStyles, withAndroidColors, withAndroidColorsNight);
1124
1103
  }
1125
1104
  if (platforms.includes("ios")) {
1126
- plugins.push(addon?.withIOSAssets ?? withIOSAssets, withAppDelegate, withInfoPlist, withXcodeProject);
1105
+ plugins.push(withIOSAssets, withAppDelegate, withInfoPlist, withXcodeProject);
1127
1106
  }
1128
1107
  if (platforms.includes("web")) {
1129
- plugins.push(addon?.withWebAssets ?? withWebAssets);
1108
+ plugins.push(withWebAssets);
1130
1109
  }
1131
- return Expo.withPlugins(config, plugins.map(plugin => [plugin, props]));
1110
+ return Expo.withPlugins(config, plugins.map(plugin => [plugin, rawProps]));
1132
1111
  }, PACKAGE_NAME);
1133
1112
  //# sourceMappingURL=generate.js.map