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.
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.writeXmlLike = exports.writeWebAssets = exports.writeJson = exports.writeIOSAssets = exports.writeGenericAssets = exports.writeAndroidAssets = exports.workingPath = exports.withBootSplash = exports.readXmlLike = exports.log = exports.hfs = exports.getExtras = exports.generate = void 0;
6
+ exports.writeXmlLike = exports.writeJson = exports.withBootSplash = exports.readXmlLike = exports.log = exports.hfs = exports.generate = void 0;
7
7
  var Expo = _interopRequireWildcard(require("@expo/config-plugins"));
8
8
  var _Colors = require("@expo/config-plugins/build/android/Colors");
9
9
  var _codeMod = require("@expo/config-plugins/build/android/codeMod");
@@ -31,7 +31,7 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
31
31
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
32
32
  const PACKAGE_NAME = "react-native-bootsplash";
33
33
  let isExpo = false;
34
- const workingPath = exports.workingPath = process.env.INIT_CWD ?? process.env.PWD ?? process.cwd();
34
+ const workingPath = process.env.INIT_CWD ?? process.env.PWD ?? process.cwd();
35
35
  const projectRoot = (0, _cliTools.findProjectRoot)(workingPath);
36
36
  const promisifiedExec = _util.default.promisify(_child_process.default.exec);
37
37
  const exec = cmd => promisifiedExec(cmd).then(({
@@ -73,18 +73,12 @@ const parseColor = value => {
73
73
  rgb
74
74
  };
75
75
  };
76
- const getStoryboard = ({
77
- props,
78
- extras
79
- }) => {
76
+ const getStoryboard = props => {
80
77
  const {
81
78
  background,
82
- logo
79
+ logo,
80
+ fileNameSuffix
83
81
  } = props;
84
- const {
85
- fileNameSuffix,
86
- logoHeight
87
- } = extras;
88
82
  const {
89
83
  R,
90
84
  G,
@@ -113,7 +107,7 @@ const getStoryboard = ({
113
107
  <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
114
108
  <subviews>
115
109
  <imageView autoresizesSubviews="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" image="BootSplashLogo-${fileNameSuffix}" translatesAutoresizingMaskIntoConstraints="NO" id="3lX-Ut-9ad">
116
- <rect key="frame" x="${(frameWidth - logo.width) / 2}" y="${(frameHeight - logoHeight) / 2}" width="${logo.width}" height="${logoHeight}"/>
110
+ <rect key="frame" x="${(frameWidth - logo.width) / 2}" y="${(frameHeight - logo.height) / 2}" width="${logo.width}" height="${logo.height}"/>
117
111
  <accessibility key="accessibilityConfiguration">
118
112
  <accessibilityTraits key="traits" image="YES" notEnabled="YES"/>
119
113
  </accessibility>
@@ -133,7 +127,7 @@ const getStoryboard = ({
133
127
  </scene>
134
128
  </scenes>
135
129
  <resources>
136
- <image name="BootSplashLogo-${fileNameSuffix}" width="${logo.width}" height="${logoHeight}"/>
130
+ <image name="BootSplashLogo-${fileNameSuffix}" width="${logo.width}" height="${logo.height}"/>
137
131
  <namedColor name="BootSplashBackground-${fileNameSuffix}">
138
132
  <color red="${R}" green="${G}" blue="${B}" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
139
133
  </namedColor>
@@ -220,26 +214,6 @@ const writeXmlLike = async (filePath, content, {
220
214
  }
221
215
  };
222
216
  exports.writeXmlLike = writeXmlLike;
223
- const getAssetBase64 = async (name, asset) => {
224
- if (asset == null) {
225
- return "";
226
- }
227
- const {
228
- image,
229
- width
230
- } = asset;
231
- const {
232
- format
233
- } = await image.metadata();
234
- if (format !== "png" && format !== "svg") {
235
- log.error(`${name} image file format (${format}) is not supported`);
236
- process.exit(1);
237
- }
238
- const buffer = await image.clone().resize(width).png({
239
- quality: 100
240
- }).toBuffer();
241
- return buffer.toString("base64");
242
- };
243
217
  const getAndroidOutputPath = ({
244
218
  flavor,
245
219
  platforms
@@ -298,52 +272,47 @@ const getInfoPlistPath = ({
298
272
  }
299
273
  return _path.default.resolve(iosOutputPath, "Info.plist");
300
274
  };
301
- const getAssetHeight = asset => {
302
- if (asset == null) {
303
- return Promise.resolve(0);
275
+ const toAsset = async (filePath, width) => {
276
+ const image = (0, _sharp.default)(filePath);
277
+ const {
278
+ format
279
+ } = await image.metadata();
280
+ if (format !== "png" && format !== "svg") {
281
+ log.error(`${_path.default.basename(filePath)} image file format (${format}) is not supported`);
282
+ process.exit(1);
304
283
  }
305
- return asset.image.clone().resize(asset.width).toBuffer().then(buffer => (0, _sharp.default)(buffer).metadata()).then(({
284
+ const [height, hash] = await Promise.all([image.clone().resize(width).toBuffer().then(buffer => (0, _sharp.default)(buffer).metadata()).then(({
306
285
  height = 0
307
- }) => Math.round(height));
286
+ }) => Math.round(height)), image.clone().resize(width).png({
287
+ quality: 100
288
+ }).toBuffer().then(buffer => buffer.toString("base64"))]);
289
+ return {
290
+ path: filePath,
291
+ image,
292
+ hash,
293
+ height,
294
+ width
295
+ };
308
296
  };
309
- const getProps = ({
297
+ const transformProps = async (rootPath, {
310
298
  android = {},
311
299
  licenseKey,
312
- ...config
300
+ ...rawProps
313
301
  }) => {
314
302
  if (_semver.default.lt(process.versions.node, "20.0.0")) {
315
303
  log.error("Requires Node 20 (or higher)");
316
304
  process.exit(1);
317
305
  }
318
- const assetsOutputPath = _path.default.resolve(workingPath, config.assetsOutput);
319
- const logoPath = _path.default.resolve(workingPath, config.logo);
320
- const darkLogoPath = config.darkLogo != null ? _path.default.resolve(workingPath, config.darkLogo) : undefined;
321
- const brandPath = config.brand != null ? _path.default.resolve(workingPath, config.brand) : undefined;
322
- const darkBrandPath = config.darkBrand != null ? _path.default.resolve(workingPath, config.darkBrand) : undefined;
323
- const logoWidth = config.logoWidth - config.logoWidth % 2;
324
- const brandWidth = config.brandWidth - config.brandWidth % 2;
325
- const logo = {
326
- path: logoPath,
327
- image: (0, _sharp.default)(logoPath),
328
- width: logoWidth
329
- };
330
- const darkLogo = darkLogoPath != null ? {
331
- path: darkLogoPath,
332
- image: (0, _sharp.default)(darkLogoPath),
333
- width: logoWidth
334
- } : undefined;
335
- const brand = brandPath != null ? {
336
- path: brandPath,
337
- image: (0, _sharp.default)(brandPath),
338
- width: brandWidth
339
- } : undefined;
340
- const darkBrand = darkBrandPath != null ? {
341
- path: darkBrandPath,
342
- image: (0, _sharp.default)(darkBrandPath),
343
- width: brandWidth
344
- } : undefined;
345
- const background = parseColor(config.background);
346
- const darkBackground = config.darkBackground != null ? parseColor(config.darkBackground) : undefined;
306
+ const assetsOutputPath = _path.default.resolve(rootPath, rawProps.assetsOutput);
307
+ const logoPath = _path.default.resolve(rootPath, rawProps.logo);
308
+ const darkLogoPath = rawProps.darkLogo != null ? _path.default.resolve(rootPath, rawProps.darkLogo) : undefined;
309
+ const brandPath = rawProps.brand != null ? _path.default.resolve(rootPath, rawProps.brand) : undefined;
310
+ const darkBrandPath = rawProps.darkBrand != null ? _path.default.resolve(rootPath, rawProps.darkBrand) : undefined;
311
+ const logoWidth = rawProps.logoWidth - rawProps.logoWidth % 2;
312
+ const brandWidth = rawProps.brandWidth - rawProps.brandWidth % 2;
313
+ 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]);
314
+ const background = parseColor(rawProps.background);
315
+ const darkBackground = rawProps.darkBackground != null ? parseColor(rawProps.darkBackground) : undefined;
347
316
  const executeAddon = brand != null || darkBackground != null || darkLogo != null || darkBrand != null;
348
317
  if (licenseKey != null && !executeAddon) {
349
318
  log.warn("You specified a license key but none of the options that requires it.");
@@ -363,12 +332,24 @@ const getProps = ({
363
332
  log.error(`${optionNames.darkBrand} option couldn't be used without ${optionNames.brand}.`);
364
333
  process.exit(1);
365
334
  }
366
- if (logoWidth < config.logoWidth) {
335
+ if (logoWidth < rawProps.logoWidth) {
367
336
  log.warn(`Logo width must be a multiple of 2. It has been rounded to ${logoWidth}dp.`);
368
337
  }
369
- if (brandWidth < config.brandWidth) {
338
+ if (brandWidth < rawProps.brandWidth) {
370
339
  log.warn(`Brand width must be a multiple of 2. It has been rounded to ${brandWidth}dp.`);
371
340
  }
341
+ const record = {
342
+ background: background.hex,
343
+ darkBackground: darkBackground?.hex ?? "",
344
+ logo: logo.hash,
345
+ darkLogo: darkLogo?.hash ?? "",
346
+ brand: brand?.hash ?? "",
347
+ darkBrand: darkBrand?.hash ?? ""
348
+ };
349
+ const stableKey = Object.keys(record).sort().map(key => record[key]).join();
350
+ const fileNameSuffix = _crypto.default.createHash("shake256", {
351
+ outputLength: 3
352
+ }).update(stableKey).digest("hex").toLowerCase();
372
353
  return {
373
354
  android,
374
355
  assetsOutputPath,
@@ -379,53 +360,25 @@ const getProps = ({
379
360
  logo,
380
361
  darkLogo,
381
362
  brand,
382
- darkBrand
363
+ darkBrand,
364
+ fileNameSuffix
383
365
  };
384
366
  };
385
- const getExtras = async ({
386
- background,
387
- darkBackground,
388
- logo,
389
- darkLogo,
390
- brand,
391
- darkBrand
392
- }) => {
393
- 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)]);
394
- const record = {
395
- background: background.hex,
396
- darkBackground: darkBackground?.hex ?? "",
397
- logo: logoHash,
398
- darkLogo: darkLogoHash,
399
- brand: brandHash,
400
- darkBrand: darkBrandHash
401
- };
402
- const stableKey = Object.keys(record).sort().map(key => record[key]).join();
403
- const fileNameSuffix = _crypto.default.createHash("shake256", {
404
- outputLength: 3
405
- }).update(stableKey).digest("hex").toLowerCase();
406
- return {
407
- fileNameSuffix,
408
- logoHeight,
409
- brandHeight
410
- };
411
- };
412
- exports.getExtras = getExtras;
413
367
  const writeAndroidAssets = async ({
414
368
  androidOutputPath,
415
- props,
416
- extras
369
+ props
417
370
  }) => {
418
371
  const {
419
372
  logo,
420
373
  brand
421
374
  } = props;
422
- if (logo.width > 192 || extras.logoHeight > 192) {
375
+ if (logo.width > 192 || logo.height > 192) {
423
376
  return log.warn("Logo size exceeding 192x192dp will be cropped by Android. Skipping Android assets generation…");
424
377
  }
425
- if (brand != null && (brand.width > 200 || extras.brandHeight > 80)) {
378
+ if (brand != null && (brand.width > 200 || brand.height > 80)) {
426
379
  return log.warn("Brand size exceeding 200x80dp will be cropped by Android. Skipping Android assets generation…");
427
380
  }
428
- if (logo.width > 134 || extras.logoHeight > 134) {
381
+ if (logo.width > 134 || logo.height > 134) {
429
382
  log.warn("Logo size exceeds 134x134dp. It might be cropped by Android.");
430
383
  }
431
384
  log.title("🤖", "Android");
@@ -482,15 +435,14 @@ const writeAndroidAssets = async ({
482
435
  });
483
436
  }));
484
437
  };
485
- exports.writeAndroidAssets = writeAndroidAssets;
486
438
  const writeIOSAssets = async ({
487
439
  iosOutputPath,
488
- props,
489
- extras
440
+ props
490
441
  }) => {
491
442
  const {
492
443
  background,
493
- logo
444
+ logo,
445
+ fileNameSuffix
494
446
  } = props;
495
447
  log.title("🍏", "iOS");
496
448
  hfs.ensureDir(iosOutputPath);
@@ -500,14 +452,11 @@ const writeIOSAssets = async ({
500
452
  hfs.rm(file);
501
453
  });
502
454
  const storyboardPath = _path.default.resolve(iosOutputPath, "BootSplash.storyboard");
503
- await writeXmlLike(storyboardPath, getStoryboard({
504
- props,
505
- extras
506
- }), {
455
+ await writeXmlLike(storyboardPath, getStoryboard(props), {
507
456
  formatter: "xmlFormatter",
508
457
  whiteSpaceAtEndOfSelfclosingTag: false
509
458
  });
510
- const colorsSetPath = _path.default.resolve(iosOutputPath, "Colors.xcassets", `BootSplashBackground-${extras.fileNameSuffix}.colorset`);
459
+ const colorsSetPath = _path.default.resolve(iosOutputPath, "Colors.xcassets", `BootSplashBackground-${fileNameSuffix}.colorset`);
511
460
  hfs.ensureDir(colorsSetPath);
512
461
  writeJson(_path.default.resolve(colorsSetPath, "Contents.json"), {
513
462
  colors: [{
@@ -527,8 +476,8 @@ const writeIOSAssets = async ({
527
476
  version: 1
528
477
  }
529
478
  });
530
- const logoFileName = `logo-${extras.fileNameSuffix}`;
531
- const imagesSetPath = _path.default.resolve(iosOutputPath, "Images.xcassets", `BootSplashLogo-${extras.fileNameSuffix}.imageset`);
479
+ const logoFileName = `logo-${fileNameSuffix}`;
480
+ const imagesSetPath = _path.default.resolve(iosOutputPath, "Images.xcassets", `BootSplashLogo-${fileNameSuffix}.imageset`);
532
481
  hfs.ensureDir(imagesSetPath);
533
482
  writeJson(_path.default.resolve(imagesSetPath, "Contents.json"), {
534
483
  images: [{
@@ -576,11 +525,9 @@ const writeIOSAssets = async ({
576
525
  });
577
526
  }));
578
527
  };
579
- exports.writeIOSAssets = writeIOSAssets;
580
528
  const writeWebAssets = async ({
581
529
  htmlTemplatePath,
582
- props,
583
- extras
530
+ props
584
531
  }) => {
585
532
  const {
586
533
  background,
@@ -613,7 +560,7 @@ const writeWebAssets = async ({
613
560
  #bootsplash-logo {
614
561
  content: url("${dataURI}");
615
562
  width: ${logo.width}px;
616
- height: ${extras.logoHeight}px;
563
+ height: ${logo.height}px;
617
564
  }
618
565
  </style>
619
566
  `);
@@ -639,10 +586,8 @@ const writeWebAssets = async ({
639
586
  useCssPlugin: true
640
587
  });
641
588
  };
642
- exports.writeWebAssets = writeWebAssets;
643
589
  const writeGenericAssets = async ({
644
- props,
645
- extras
590
+ props
646
591
  }) => {
647
592
  const {
648
593
  assetsOutputPath,
@@ -655,7 +600,7 @@ const writeGenericAssets = async ({
655
600
  background: background.hex,
656
601
  logo: {
657
602
  width: logo.width,
658
- height: extras.logoHeight
603
+ height: logo.height
659
604
  }
660
605
  });
661
606
  await Promise.all([{
@@ -691,12 +636,16 @@ const writeGenericAssets = async ({
691
636
  });
692
637
  }));
693
638
  };
694
- exports.writeGenericAssets = writeGenericAssets;
695
- const requireAddon = () => {
696
- try {
697
- return require("./addon");
698
- } catch {
699
- return;
639
+ const requireAddon = ({
640
+ executeAddon,
641
+ licenseKey
642
+ }) => {
643
+ if (licenseKey != null && executeAddon) {
644
+ try {
645
+ return require("./addon");
646
+ } catch {
647
+ return;
648
+ }
700
649
  }
701
650
  };
702
651
  const generate = async ({
@@ -704,16 +653,14 @@ const generate = async ({
704
653
  html,
705
654
  flavor,
706
655
  plist,
707
- ...config
656
+ ...rawProps
708
657
  }) => {
709
- const props = getProps(config);
658
+ const props = await transformProps(workingPath, rawProps);
659
+ const addon = requireAddon(props);
710
660
  const {
711
661
  background,
712
- brand,
713
- licenseKey,
714
- executeAddon
662
+ brand
715
663
  } = props;
716
- const extras = await getExtras(props);
717
664
  const androidOutputPath = getAndroidOutputPath({
718
665
  flavor,
719
666
  platforms
@@ -728,8 +675,7 @@ const generate = async ({
728
675
  if (androidOutputPath != null) {
729
676
  await writeAndroidAssets({
730
677
  androidOutputPath,
731
- props,
732
- extras
678
+ props
733
679
  });
734
680
  const manifestXmlPath = _path.default.resolve(androidOutputPath, "..", "AndroidManifest.xml");
735
681
  if (hfs.exists(manifestXmlPath)) {
@@ -804,8 +750,7 @@ const generate = async ({
804
750
  if (iosOutputPath != null) {
805
751
  await writeIOSAssets({
806
752
  iosOutputPath,
807
- props,
808
- extras
753
+ props
809
754
  });
810
755
  const infoPlistPath = getInfoPlistPath({
811
756
  iosOutputPath,
@@ -847,19 +792,15 @@ const generate = async ({
847
792
  if (htmlTemplatePath != null) {
848
793
  await writeWebAssets({
849
794
  htmlTemplatePath,
850
- props,
851
- extras
795
+ props
852
796
  });
853
797
  }
854
798
  await writeGenericAssets({
855
- props,
856
- extras
799
+ props
857
800
  });
858
- if (licenseKey != null && executeAddon) {
859
- const addon = requireAddon();
860
- await addon?.execute({
801
+ if (addon != null) {
802
+ await addon.execute({
861
803
  props,
862
- extras,
863
804
  androidOutputPath,
864
805
  iosOutputPath,
865
806
  htmlTemplatePath
@@ -876,21 +817,26 @@ ${_picocolors.default.blue("┗━━━━━━━━━━━━━━━━
876
817
 
877
818
  // Expo plugin
878
819
  exports.generate = generate;
879
- const withoutExpoSplashScreen = Expo.createRunOncePlugin(config => config, "expo-splash-screen", "skip");
880
- const withAndroidAssets = (config, props) => Expo.withDangerousMod(config, ["android", async config => {
820
+ const withoutExpoSplashScreen = Expo.createRunOncePlugin(expoConfig => expoConfig, "expo-splash-screen", "skip");
821
+ const withAndroidAssets = (expoConfig, rawProps) => Expo.withDangerousMod(expoConfig, ["android", async config => {
881
822
  const {
882
- platformProjectRoot
823
+ platformProjectRoot,
824
+ projectRoot
883
825
  } = config.modRequest;
884
- const extras = await getExtras(props);
826
+ const props = await transformProps(projectRoot, rawProps);
827
+ const addon = requireAddon(props);
885
828
  const androidOutputPath = _path.default.resolve(platformProjectRoot, "app", "src", "main", "res");
886
829
  await writeAndroidAssets({
887
830
  androidOutputPath,
888
- props,
889
- extras
831
+ props
832
+ });
833
+ await addon?.writeAndroidAssets({
834
+ androidOutputPath,
835
+ props
890
836
  });
891
837
  return config;
892
838
  }]);
893
- const withAndroidManifest = config => Expo.withAndroidManifest(config, config => {
839
+ const withAndroidManifest = expoConfig => Expo.withAndroidManifest(expoConfig, config => {
894
840
  config.modResults.manifest.application?.forEach(application => {
895
841
  if (application.$["android:name"] === ".MainApplication") {
896
842
  const {
@@ -905,7 +851,7 @@ const withAndroidManifest = config => Expo.withAndroidManifest(config, config =>
905
851
  });
906
852
  return config;
907
853
  });
908
- const withMainActivity = config => Expo.withMainActivity(config, config => {
854
+ const withMainActivity = expoConfig => Expo.withMainActivity(expoConfig, config => {
909
855
  const {
910
856
  modResults
911
857
  } = config;
@@ -928,11 +874,14 @@ const withMainActivity = config => Expo.withMainActivity(config, config => {
928
874
  }
929
875
  };
930
876
  });
931
- const withAndroidStyles = (config, props) => Expo.withAndroidStyles(config, config => {
877
+ const withAndroidStyles = (expoConfig, rawProps) => Expo.withAndroidStyles(expoConfig, async config => {
878
+ const {
879
+ projectRoot
880
+ } = config.modRequest;
932
881
  const {
933
882
  android,
934
883
  brand
935
- } = props;
884
+ } = await transformProps(projectRoot, rawProps);
936
885
  const {
937
886
  darkContentBarsStyle
938
887
  } = android;
@@ -997,38 +946,57 @@ const withAndroidStyles = (config, props) => Expo.withAndroidStyles(config, conf
997
946
  }
998
947
  };
999
948
  });
1000
- const withAndroidColors = (config, props) => Expo.withAndroidColors(config, config => {
949
+ const withAndroidColors = (expoConfig, rawProps) => Expo.withAndroidColors(expoConfig, async config => {
950
+ const {
951
+ projectRoot
952
+ } = config.modRequest;
1001
953
  const {
1002
954
  background
1003
- } = props;
955
+ } = await transformProps(projectRoot, rawProps);
1004
956
  config.modResults = (0, _Colors.assignColorValue)(config.modResults, {
1005
957
  name: "bootsplash_background",
1006
958
  value: background.hex
1007
959
  });
1008
960
  return config;
1009
961
  });
1010
- const withIOSAssets = (config, props) => Expo.withDangerousMod(config, ["ios", async config => {
962
+ const withAndroidColorsNight = (expoConfig, rawProps) => Expo.withAndroidColorsNight(expoConfig, async config => {
963
+ const {
964
+ projectRoot
965
+ } = config.modRequest;
966
+ const props = await transformProps(projectRoot, rawProps);
967
+ const addon = requireAddon(props);
968
+ return addon != null ? await addon.withAndroidColorsNight({
969
+ config,
970
+ props
971
+ }) : config;
972
+ });
973
+ const withIOSAssets = (expoConfig, rawProps) => Expo.withDangerousMod(expoConfig, ["ios", async config => {
1011
974
  const {
1012
975
  platformProjectRoot,
1013
- projectName = ""
976
+ projectName = "",
977
+ projectRoot
1014
978
  } = config.modRequest;
1015
- const extras = await getExtras(props);
979
+ const props = await transformProps(projectRoot, rawProps);
980
+ const addon = requireAddon(props);
1016
981
  const iosOutputPath = _path.default.resolve(platformProjectRoot, projectName);
1017
982
  await writeIOSAssets({
1018
983
  iosOutputPath,
1019
- props,
1020
- extras
984
+ props
985
+ });
986
+ await addon?.writeIOSAssets({
987
+ iosOutputPath,
988
+ props
1021
989
  });
1022
990
  return config;
1023
991
  }]);
1024
- const withAppDelegate = config => Expo.withAppDelegate(config, config => {
992
+ const withAppDelegate = expoConfig => Expo.withAppDelegate(expoConfig, config => {
1025
993
  const {
1026
994
  modResults
1027
995
  } = config;
1028
996
  const {
1029
997
  language
1030
998
  } = modResults;
1031
- if (language !== "objc" && language !== "objcpp" && language !== "swift") {
999
+ if (language !== "swift") {
1032
1000
  throw new Error(`Cannot modify the project AppDelegate as it's not in a supported language: ${language}`);
1033
1001
  }
1034
1002
  const withHeader = (0, _generateCode.mergeContents)({
@@ -1060,11 +1028,11 @@ const withAppDelegate = config => Expo.withAppDelegate(config, config => {
1060
1028
  }
1061
1029
  };
1062
1030
  });
1063
- const withInfoPlist = config => Expo.withInfoPlist(config, config => {
1031
+ const withInfoPlist = expoConfig => Expo.withInfoPlist(expoConfig, config => {
1064
1032
  config.modResults["UILaunchStoryboardName"] = "BootSplash";
1065
1033
  return config;
1066
1034
  });
1067
- const withXcodeProject = config => Expo.withXcodeProject(config, config => {
1035
+ const withXcodeProject = expoConfig => Expo.withXcodeProject(expoConfig, config => {
1068
1036
  const {
1069
1037
  projectName = ""
1070
1038
  } = config.modRequest;
@@ -1082,25 +1050,38 @@ const withXcodeProject = config => Expo.withXcodeProject(config, config => {
1082
1050
  });
1083
1051
  return config;
1084
1052
  });
1085
- const withWebAssets = (config, props) => Expo.withDangerousMod(config, [config.platforms?.includes("ios") ? "ios" : "android", async config => {
1086
- const extras = await getExtras(props);
1053
+ const withWebAssets = (expoConfig, rawProps) => Expo.withDangerousMod(expoConfig, [expoConfig.platforms?.includes("ios") ? "ios" : "android", async config => {
1054
+ const {
1055
+ projectRoot
1056
+ } = config.modRequest;
1057
+ const props = await transformProps(projectRoot, rawProps);
1058
+ const addon = requireAddon(props);
1087
1059
  const fileName = "public/index.html";
1088
- const htmlTemplatePath = _path.default.resolve(workingPath, fileName);
1060
+ const htmlTemplatePath = _path.default.resolve(projectRoot, fileName);
1089
1061
  if (!hfs.exists(htmlTemplatePath)) {
1090
1062
  await exec(`npx expo customize ${fileName}`);
1091
1063
  }
1092
1064
  await writeWebAssets({
1093
1065
  htmlTemplatePath,
1094
- props,
1095
- extras
1066
+ props
1067
+ });
1068
+ await addon?.writeWebAssets({
1069
+ htmlTemplatePath,
1070
+ props
1096
1071
  });
1097
1072
  return config;
1098
1073
  }]);
1099
- const withGenericAssets = (config, props) => Expo.withDangerousMod(config, [config.platforms?.includes("ios") ? "ios" : "android", async config => {
1100
- const extras = await getExtras(props);
1074
+ const withGenericAssets = (expoConfig, rawProps) => Expo.withDangerousMod(expoConfig, [expoConfig.platforms?.includes("ios") ? "ios" : "android", async config => {
1075
+ const {
1076
+ projectRoot
1077
+ } = config.modRequest;
1078
+ const props = await transformProps(projectRoot, rawProps);
1079
+ const addon = requireAddon(props);
1101
1080
  await writeGenericAssets({
1102
- props,
1103
- extras
1081
+ props
1082
+ });
1083
+ await addon?.writeGenericAssets({
1084
+ props
1104
1085
  });
1105
1086
  return config;
1106
1087
  }]);
@@ -1110,38 +1091,31 @@ const withBootSplash = exports.withBootSplash = Expo.createRunOncePlugin((config
1110
1091
  sdkVersion = "0.1.0"
1111
1092
  } = config;
1112
1093
  isExpo = true;
1113
- if (_semver.default.lt(sdkVersion, "53.0.0")) {
1114
- log.error("Requires Expo 53.0.0 (or higher)");
1094
+ if (_semver.default.lt(sdkVersion, "54.0.0")) {
1095
+ log.error("Requires Expo 54.0.0 (or higher)");
1115
1096
  process.exit(1);
1116
1097
  }
1117
1098
  if (!baseProps?.logo) {
1118
1099
  log.error("Missing required parameter 'logo'");
1119
1100
  process.exit(1);
1120
1101
  }
1121
- const props = getProps({
1102
+ const rawProps = {
1122
1103
  assetsOutput: "assets/bootsplash",
1123
1104
  background: "#fff",
1124
1105
  brandWidth: 80,
1125
1106
  logoWidth: 100,
1126
1107
  ...baseProps
1127
- });
1128
- const {
1129
- executeAddon
1130
- } = props;
1131
- const addon = executeAddon ? requireAddon() : undefined;
1132
- const plugins = [withoutExpoSplashScreen, addon?.withGenericAssets ?? withGenericAssets];
1108
+ };
1109
+ const plugins = [withoutExpoSplashScreen, withGenericAssets];
1133
1110
  if (platforms.includes("android")) {
1134
- plugins.push(addon?.withAndroidAssets ?? withAndroidAssets, withAndroidManifest, withMainActivity, withAndroidStyles, withAndroidColors);
1135
- if (addon != null) {
1136
- plugins.push(addon.withAndroidColorsNight);
1137
- }
1111
+ plugins.push(withAndroidAssets, withAndroidManifest, withMainActivity, withAndroidStyles, withAndroidColors, withAndroidColorsNight);
1138
1112
  }
1139
1113
  if (platforms.includes("ios")) {
1140
- plugins.push(addon?.withIOSAssets ?? withIOSAssets, withAppDelegate, withInfoPlist, withXcodeProject);
1114
+ plugins.push(withIOSAssets, withAppDelegate, withInfoPlist, withXcodeProject);
1141
1115
  }
1142
1116
  if (platforms.includes("web")) {
1143
- plugins.push(addon?.withWebAssets ?? withWebAssets);
1117
+ plugins.push(withWebAssets);
1144
1118
  }
1145
- return Expo.withPlugins(config, plugins.map(plugin => [plugin, props]));
1119
+ return Expo.withPlugins(config, plugins.map(plugin => [plugin, rawProps]));
1146
1120
  }, PACKAGE_NAME);
1147
1121
  //# sourceMappingURL=generate.js.map