react-native-bootsplash 7.0.1 → 7.1.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/app.plugin.js +1 -1
  2. package/cli.js +1 -1
  3. package/dist/commonjs/extras/addon/index.js +97 -0
  4. package/dist/commonjs/extras/addon/index.js.map +1 -0
  5. package/dist/commonjs/{expo.js → extras/expo.js} +27 -23
  6. package/dist/commonjs/extras/expo.js.map +1 -0
  7. package/dist/commonjs/extras/generate.js +274 -0
  8. package/dist/commonjs/extras/generate.js.map +1 -0
  9. package/dist/commonjs/{generate.js → extras/utils.js} +110 -339
  10. package/dist/commonjs/extras/utils.js.map +1 -0
  11. package/dist/commonjs/package.json +1 -0
  12. package/dist/module/extras/addon/index.js +97 -0
  13. package/dist/module/extras/addon/index.js.map +1 -0
  14. package/dist/module/{expo.js → extras/expo.js} +6 -3
  15. package/dist/module/extras/expo.js.map +1 -0
  16. package/dist/module/extras/generate.js +267 -0
  17. package/dist/module/extras/generate.js.map +1 -0
  18. package/dist/module/{generate.js → extras/utils.js} +98 -326
  19. package/dist/module/extras/utils.js.map +1 -0
  20. package/dist/module/package.json +1 -0
  21. package/dist/typescript/{addon → commonjs/extras/addon}/index.d.ts +1 -1
  22. package/dist/typescript/commonjs/extras/addon/index.d.ts.map +1 -0
  23. package/dist/typescript/commonjs/extras/expo.d.ts +8 -0
  24. package/dist/typescript/commonjs/extras/expo.d.ts.map +1 -0
  25. package/dist/typescript/commonjs/extras/generate.d.ts +17 -0
  26. package/dist/typescript/commonjs/extras/generate.d.ts.map +1 -0
  27. package/dist/typescript/{generate.d.ts → commonjs/extras/utils.d.ts} +85 -50
  28. package/dist/typescript/commonjs/extras/utils.d.ts.map +1 -0
  29. package/dist/typescript/commonjs/index.d.ts.map +1 -0
  30. package/dist/typescript/commonjs/package.json +1 -0
  31. package/dist/typescript/commonjs/specs/NativeRNBootSplash.d.ts.map +1 -0
  32. package/dist/typescript/commonjs/specs/NativeRNBootSplash.web.d.ts.map +1 -0
  33. package/dist/typescript/module/extras/addon/index.d.ts +26 -0
  34. package/dist/typescript/module/extras/addon/index.d.ts.map +1 -0
  35. package/dist/typescript/module/extras/expo.d.ts +8 -0
  36. package/dist/typescript/module/extras/expo.d.ts.map +1 -0
  37. package/dist/typescript/module/extras/generate.d.ts +17 -0
  38. package/dist/typescript/module/extras/generate.d.ts.map +1 -0
  39. package/dist/typescript/module/extras/utils.d.ts +193 -0
  40. package/dist/typescript/module/extras/utils.d.ts.map +1 -0
  41. package/dist/typescript/module/index.d.ts +61 -0
  42. package/dist/typescript/module/index.d.ts.map +1 -0
  43. package/dist/typescript/module/package.json +1 -0
  44. package/dist/typescript/module/specs/NativeRNBootSplash.d.ts +14 -0
  45. package/dist/typescript/module/specs/NativeRNBootSplash.d.ts.map +1 -0
  46. package/dist/typescript/module/specs/NativeRNBootSplash.web.d.ts +9 -0
  47. package/dist/typescript/module/specs/NativeRNBootSplash.web.d.ts.map +1 -0
  48. package/package.json +52 -24
  49. package/src/{expo.ts → extras/expo.ts} +32 -33
  50. package/src/extras/generate.ts +410 -0
  51. package/src/{generate.ts → extras/utils.ts} +159 -471
  52. package/dist/commonjs/addon/index.js +0 -97
  53. package/dist/commonjs/addon/index.js.map +0 -1
  54. package/dist/commonjs/expo.js.map +0 -1
  55. package/dist/commonjs/generate.js.map +0 -1
  56. package/dist/module/addon/index.js +0 -97
  57. package/dist/module/addon/index.js.map +0 -1
  58. package/dist/module/expo.js.map +0 -1
  59. package/dist/module/generate.js.map +0 -1
  60. package/dist/typescript/addon/index.d.ts.map +0 -1
  61. package/dist/typescript/expo.d.ts +0 -6
  62. package/dist/typescript/expo.d.ts.map +0 -1
  63. package/dist/typescript/generate.d.ts.map +0 -1
  64. package/dist/typescript/index.d.ts.map +0 -1
  65. package/dist/typescript/specs/NativeRNBootSplash.d.ts.map +0 -1
  66. package/dist/typescript/specs/NativeRNBootSplash.web.d.ts.map +0 -1
  67. /package/dist/typescript/{index.d.ts → commonjs/index.d.ts} +0 -0
  68. /package/dist/typescript/{specs → commonjs/specs}/NativeRNBootSplash.d.ts +0 -0
  69. /package/dist/typescript/{specs → commonjs/specs}/NativeRNBootSplash.web.d.ts +0 -0
package/package.json CHANGED
@@ -1,13 +1,37 @@
1
1
  {
2
2
  "name": "react-native-bootsplash",
3
- "version": "7.0.1",
3
+ "version": "7.1.0-beta.0",
4
4
  "license": "MIT",
5
5
  "description": "Display a bootsplash on your app starts. Hide it when you want.",
6
6
  "author": "Mathieu Acthernoene <zoontek@gmail.com>",
7
7
  "homepage": "https://github.com/zoontek/react-native-bootsplash",
8
- "main": "dist/commonjs/index.js",
9
- "module": "dist/module/index.js",
10
- "types": "dist/typescript/index.d.ts",
8
+ "main": "./dist/commonjs/index.js",
9
+ "module": "./dist/module/index.js",
10
+ "types": "./dist/typescript/commonjs/index.d.ts",
11
+ "exports": {
12
+ ".": {
13
+ "import": {
14
+ "types": "./dist/typescript/module/index.d.ts",
15
+ "default": "./dist/module/index.js"
16
+ },
17
+ "require": {
18
+ "types": "./dist/typescript/commonjs/index.d.ts",
19
+ "default": "./dist/commonjs/index.js"
20
+ }
21
+ },
22
+ "./expo": {
23
+ "import": {
24
+ "types": "./dist/typescript/module/extras/expo.d.ts",
25
+ "default": "./dist/module/extras/expo.js"
26
+ },
27
+ "require": {
28
+ "types": "./dist/typescript/commonjs/extras/expo.d.ts",
29
+ "default": "./dist/commonjs/extras/expo.js"
30
+ }
31
+ },
32
+ "./package.json": "./package.json",
33
+ "./app.plugin.js": "./app.plugin.js"
34
+ },
11
35
  "files": [
12
36
  "dist",
13
37
  "android",
@@ -17,11 +41,10 @@
17
41
  "!android/.cxx",
18
42
  "!android/.gradle",
19
43
  "!ios/build",
20
- "!src/addon",
44
+ "!src/extras/addon",
21
45
  "RNBootSplash.podspec",
22
- "app.plugin.js",
23
46
  "cli.js",
24
- "react-native.config.js"
47
+ "app.plugin.js"
25
48
  ],
26
49
  "bin": "./cli.js",
27
50
  "repository": {
@@ -45,16 +68,26 @@
45
68
  "format": "prettier '**/*' -u -w",
46
69
  "lint": "oxlint",
47
70
  "typecheck": "tsc --noEmit",
48
- "build": "yarn clean && bob build && rm -rf dist/*/package.json",
71
+ "build": "yarn clean && bob build",
49
72
  "prepack": "prettier '**/*' -u -c && yarn lint && yarn typecheck && yarn build && node ../obfuscator"
50
73
  },
51
74
  "react-native-builder-bob": {
52
75
  "source": "src",
53
76
  "output": "dist",
54
77
  "targets": [
55
- "commonjs",
56
- "module",
57
- "typescript"
78
+ "typescript",
79
+ [
80
+ "module",
81
+ {
82
+ "esm": true
83
+ }
84
+ ],
85
+ [
86
+ "commonjs",
87
+ {
88
+ "esm": true
89
+ }
90
+ ]
58
91
  ]
59
92
  },
60
93
  "prettier": {
@@ -68,12 +101,9 @@
68
101
  },
69
102
  "dependencies": {
70
103
  "@expo/config-plugins": "*",
71
- "@react-native-community/cli-config-android": "^20.0.0",
72
- "@react-native-community/cli-config-apple": "^20.0.0",
73
- "@react-native-community/cli-tools": "^20.0.0",
74
- "commander": "^14.0.2",
104
+ "commander": "^14.0.3",
75
105
  "detect-indent": "^6.1.0",
76
- "fs-extra": "^11.3.3",
106
+ "fast-glob": "^3.3.3",
77
107
  "node-html-parser": "^7.0.2",
78
108
  "picocolors": "^1.1.1",
79
109
  "prettier": "^3.8.1",
@@ -85,17 +115,15 @@
85
115
  "devDependencies": {
86
116
  "@babel/core": "^7.25.2",
87
117
  "@babel/preset-env": "^7.25.3",
88
- "@react-native-community/cli-types": "^20.0.0",
89
- "@types/fs-extra": "^11.0.4",
90
- "@types/node": "^20.19.30",
118
+ "@types/node": "^20.19.31",
91
119
  "@types/react": "^19.2.0",
92
120
  "@types/semver": "^7.7.1",
93
- "oxlint": "^1.41.0",
121
+ "oxlint": "^1.49.0",
94
122
  "prettier-plugin-organize-imports": "^4.3.0",
95
- "react": "19.2.0",
96
- "react-native": "0.83.1",
97
- "react-native-builder-bob": "^0.40.17",
98
- "semver": "^7.7.3",
123
+ "react": "19.2.3",
124
+ "react-native": "0.84.0",
125
+ "react-native-builder-bob": "^0.40.18",
126
+ "semver": "^7.7.4",
99
127
  "typescript": "^5.9.3"
100
128
  },
101
129
  "codegenConfig": {
@@ -8,32 +8,33 @@ import semver from "semver";
8
8
  import { dedent } from "ts-dedent";
9
9
  import util from "util";
10
10
  import {
11
- type RawProps,
11
+ type BootSplashPluginConfig,
12
12
  hfs,
13
13
  log,
14
- packageName,
14
+ PACKAGE_NAME,
15
15
  requireAddon,
16
- setIsExpo,
16
+ setLoggerMode,
17
17
  transformProps,
18
18
  writeAndroidAssets,
19
19
  writeGenericAssets,
20
20
  writeIOSAssets,
21
21
  writeWebAssets,
22
- } from "./generate";
22
+ } from "./utils";
23
23
 
24
24
  const promisifiedExec = util.promisify(childProcess.exec);
25
25
 
26
26
  const exec = (cmd: string) =>
27
27
  promisifiedExec(cmd).then(({ stdout, stderr }) => stdout || stderr);
28
28
 
29
- const withoutExpoSplashScreen: Expo.ConfigPlugin<RawProps> =
30
- Expo.createRunOncePlugin(
31
- (expoConfig) => expoConfig,
32
- "expo-splash-screen",
33
- "skip",
34
- );
29
+ type ConfigPlugin = Expo.ConfigPlugin<BootSplashPluginConfig>;
30
+
31
+ const withoutExpoSplashScreen: ConfigPlugin = Expo.createRunOncePlugin(
32
+ (expoConfig) => expoConfig,
33
+ "expo-splash-screen",
34
+ "skip",
35
+ );
35
36
 
36
- const withAndroidAssets: Expo.ConfigPlugin<RawProps> = (expoConfig, rawProps) =>
37
+ const withAndroidAssets: ConfigPlugin = (expoConfig, rawProps) =>
37
38
  Expo.withDangerousMod(expoConfig, [
38
39
  "android",
39
40
  async (config) => {
@@ -56,7 +57,7 @@ const withAndroidAssets: Expo.ConfigPlugin<RawProps> = (expoConfig, rawProps) =>
56
57
  },
57
58
  ]);
58
59
 
59
- const withAndroidManifest: Expo.ConfigPlugin<RawProps> = (expoConfig) =>
60
+ const withAndroidManifest: ConfigPlugin = (expoConfig) =>
60
61
  Expo.withAndroidManifest(expoConfig, (config) => {
61
62
  config.modResults.manifest.application?.forEach((application) => {
62
63
  if (application.$["android:name"] === ".MainApplication") {
@@ -73,7 +74,7 @@ const withAndroidManifest: Expo.ConfigPlugin<RawProps> = (expoConfig) =>
73
74
  return config;
74
75
  });
75
76
 
76
- const withMainActivity: Expo.ConfigPlugin<RawProps> = (expoConfig) =>
77
+ const withMainActivity: ConfigPlugin = (expoConfig) =>
77
78
  Expo.withMainActivity(expoConfig, (config) => {
78
79
  const { modResults } = config;
79
80
 
@@ -105,7 +106,7 @@ const withMainActivity: Expo.ConfigPlugin<RawProps> = (expoConfig) =>
105
106
  };
106
107
  });
107
108
 
108
- const withAndroidStyles: Expo.ConfigPlugin<RawProps> = (expoConfig, rawProps) =>
109
+ const withAndroidStyles: ConfigPlugin = (expoConfig, rawProps) =>
109
110
  Expo.withAndroidStyles(expoConfig, async (config) => {
110
111
  const { projectRoot } = config.modRequest;
111
112
  const { android, brand } = await transformProps(projectRoot, rawProps);
@@ -166,7 +167,7 @@ const withAndroidStyles: Expo.ConfigPlugin<RawProps> = (expoConfig, rawProps) =>
166
167
  };
167
168
  });
168
169
 
169
- const withAndroidColors: Expo.ConfigPlugin<RawProps> = (expoConfig, rawProps) =>
170
+ const withAndroidColors: ConfigPlugin = (expoConfig, rawProps) =>
170
171
  Expo.withAndroidColors(expoConfig, async (config) => {
171
172
  const { projectRoot } = config.modRequest;
172
173
  const { background } = await transformProps(projectRoot, rawProps);
@@ -179,10 +180,7 @@ const withAndroidColors: Expo.ConfigPlugin<RawProps> = (expoConfig, rawProps) =>
179
180
  return config;
180
181
  });
181
182
 
182
- const withAndroidColorsNight: Expo.ConfigPlugin<RawProps> = (
183
- expoConfig,
184
- rawProps,
185
- ) =>
183
+ const withAndroidColorsNight: ConfigPlugin = (expoConfig, rawProps) =>
186
184
  Expo.withAndroidColorsNight(expoConfig, async (config) => {
187
185
  const { projectRoot } = config.modRequest;
188
186
  const props = await transformProps(projectRoot, rawProps);
@@ -193,7 +191,7 @@ const withAndroidColorsNight: Expo.ConfigPlugin<RawProps> = (
193
191
  : config;
194
192
  });
195
193
 
196
- const withIOSAssets: Expo.ConfigPlugin<RawProps> = (expoConfig, rawProps) =>
194
+ const withIOSAssets: ConfigPlugin = (expoConfig, rawProps) =>
197
195
  Expo.withDangerousMod(expoConfig, [
198
196
  "ios",
199
197
  async (config) => {
@@ -214,7 +212,7 @@ const withIOSAssets: Expo.ConfigPlugin<RawProps> = (expoConfig, rawProps) =>
214
212
  },
215
213
  ]);
216
214
 
217
- const withAppDelegate: Expo.ConfigPlugin<RawProps> = (expoConfig) =>
215
+ const withAppDelegate: ConfigPlugin = (expoConfig) =>
218
216
  Expo.withAppDelegate(expoConfig, (config) => {
219
217
  const { modResults } = config;
220
218
  const { language } = modResults;
@@ -257,13 +255,13 @@ const withAppDelegate: Expo.ConfigPlugin<RawProps> = (expoConfig) =>
257
255
  };
258
256
  });
259
257
 
260
- const withInfoPlist: Expo.ConfigPlugin<RawProps> = (expoConfig) =>
258
+ const withInfoPlist: ConfigPlugin = (expoConfig) =>
261
259
  Expo.withInfoPlist(expoConfig, (config) => {
262
260
  config.modResults["UILaunchStoryboardName"] = "BootSplash";
263
261
  return config;
264
262
  });
265
263
 
266
- const withXcodeProject: Expo.ConfigPlugin<RawProps> = (expoConfig) =>
264
+ const withXcodeProject: ConfigPlugin = (expoConfig) =>
267
265
  Expo.withXcodeProject(expoConfig, (config) => {
268
266
  const { projectName = "" } = config.modRequest;
269
267
 
@@ -284,7 +282,7 @@ const withXcodeProject: Expo.ConfigPlugin<RawProps> = (expoConfig) =>
284
282
  return config;
285
283
  });
286
284
 
287
- const withWebAssets: Expo.ConfigPlugin<RawProps> = (expoConfig, rawProps) =>
285
+ const withWebAssets: ConfigPlugin = (expoConfig, rawProps) =>
288
286
  Expo.withDangerousMod(expoConfig, [
289
287
  expoConfig.platforms?.includes("ios") ? "ios" : "android",
290
288
  async (config) => {
@@ -306,7 +304,7 @@ const withWebAssets: Expo.ConfigPlugin<RawProps> = (expoConfig, rawProps) =>
306
304
  },
307
305
  ]);
308
306
 
309
- const withGenericAssets: Expo.ConfigPlugin<RawProps> = (expoConfig, rawProps) =>
307
+ const withGenericAssets: ConfigPlugin = (expoConfig, rawProps) =>
310
308
  Expo.withDangerousMod(expoConfig, [
311
309
  expoConfig.platforms?.includes("ios") ? "ios" : "android",
312
310
  async (config) => {
@@ -322,11 +320,11 @@ const withGenericAssets: Expo.ConfigPlugin<RawProps> = (expoConfig, rawProps) =>
322
320
  ]);
323
321
 
324
322
  export const withBootSplash = Expo.createRunOncePlugin<
325
- (Partial<RawProps> & { logo: string }) | undefined
323
+ (Partial<BootSplashPluginConfig> & { logo: string }) | undefined
326
324
  >((expoConfig, baseProps) => {
327
325
  const { platforms = [], sdkVersion = "0.1.0" } = expoConfig;
328
326
 
329
- setIsExpo(true);
327
+ setLoggerMode({ type: "plugin" });
330
328
 
331
329
  if (semver.lt(sdkVersion, "54.0.0")) {
332
330
  log.error("Requires Expo 54.0.0 (or higher)");
@@ -338,7 +336,7 @@ export const withBootSplash = Expo.createRunOncePlugin<
338
336
  process.exit(1);
339
337
  }
340
338
 
341
- const rawProps: RawProps = {
339
+ const rawProps: BootSplashPluginConfig = {
342
340
  assetsOutput: "assets/bootsplash",
343
341
  background: "#fff",
344
342
  brandWidth: 80,
@@ -346,10 +344,7 @@ export const withBootSplash = Expo.createRunOncePlugin<
346
344
  ...baseProps,
347
345
  };
348
346
 
349
- const plugins: Expo.ConfigPlugin<RawProps>[] = [
350
- withoutExpoSplashScreen,
351
- withGenericAssets,
352
- ];
347
+ const plugins: ConfigPlugin[] = [withoutExpoSplashScreen, withGenericAssets];
353
348
 
354
349
  if (platforms.includes("android")) {
355
350
  plugins.push(
@@ -379,4 +374,8 @@ export const withBootSplash = Expo.createRunOncePlugin<
379
374
  expoConfig,
380
375
  plugins.map((plugin) => [plugin, rawProps]),
381
376
  );
382
- }, packageName);
377
+ }, PACKAGE_NAME);
378
+
379
+ export default (
380
+ config: BootSplashPluginConfig,
381
+ ): [typeof PACKAGE_NAME, BootSplashPluginConfig] => [PACKAGE_NAME, config];