@expo/config-plugins 4.0.6 → 4.0.7

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/README.md CHANGED
@@ -3,3 +3,17 @@
3
3
  The Expo config is a powerful tool for generating native app code from a unified JavaScript interface. Most basic functionality can be controlled by using the the [static Expo config](https://docs.expo.dev/versions/latest/config/app/), but some features require manipulation of the native project files. To support complex behavior we've created config plugins, and mods (short for modifiers).
4
4
 
5
5
  For more info, please refer to the official docs: [Config Plugins](https://docs.expo.dev/guides/config-plugins/).
6
+
7
+ ## Environment Variables
8
+
9
+ ### `EXPO_DEBUG`
10
+
11
+ Print debug information related to static plugin resolution.
12
+
13
+ ### `EXPO_CONFIG_PLUGIN_VERBOSE_ERRORS`
14
+
15
+ Show all error info related to static plugin resolution. Requires `EXPO_DEBUG` to be enabled.
16
+
17
+ ### `EXPO_USE_UNVERSIONED_PLUGINS`
18
+
19
+ Force using the fallback unversioned plugins instead of a local versioned copy from installed packages, this should only be used for testing the CLI.
@@ -14,14 +14,12 @@ import * as Permissions from './Permissions';
14
14
  import * as PrimaryColor from './PrimaryColor';
15
15
  import * as Properties from './Properties';
16
16
  import * as Resources from './Resources';
17
- import * as RootViewBackgroundColor from './RootViewBackgroundColor';
18
17
  import * as Scheme from './Scheme';
19
18
  import * as StatusBar from './StatusBar';
20
19
  import * as Strings from './Strings';
21
20
  import * as Styles from './Styles';
22
21
  import * as Updates from './Updates';
23
- import * as UserInterfaceStyle from './UserInterfaceStyle';
24
22
  import * as Version from './Version';
25
23
  import * as WindowSoftInputMode from './WindowSoftInputMode';
26
24
  export { Manifest, Colors, Paths, Permissions, Properties, Resources, Scheme, Strings, Styles };
27
- export { AllowBackup, EasBuild, GoogleMapsApiKey, GoogleServices, IntentFilters, Name, Orientation, Package, PrimaryColor, RootViewBackgroundColor, StatusBar, Updates, UserInterfaceStyle, Version, JsEngine, WindowSoftInputMode, };
25
+ export { AllowBackup, EasBuild, GoogleMapsApiKey, GoogleServices, IntentFilters, Name, Orientation, Package, PrimaryColor, StatusBar, Updates, Version, JsEngine, WindowSoftInputMode, };
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.WindowSoftInputMode = exports.Version = exports.UserInterfaceStyle = exports.Updates = exports.Styles = exports.Strings = exports.StatusBar = exports.Scheme = exports.RootViewBackgroundColor = exports.Resources = exports.Properties = exports.PrimaryColor = exports.Permissions = exports.Paths = exports.Package = exports.Orientation = exports.Name = exports.Manifest = exports.JsEngine = exports.IntentFilters = exports.GoogleServices = exports.GoogleMapsApiKey = exports.EasBuild = exports.Colors = exports.AllowBackup = void 0;
6
+ exports.WindowSoftInputMode = exports.Version = exports.Updates = exports.Styles = exports.Strings = exports.StatusBar = exports.Scheme = exports.Resources = exports.Properties = exports.PrimaryColor = exports.Permissions = exports.Paths = exports.Package = exports.Orientation = exports.Name = exports.Manifest = exports.JsEngine = exports.IntentFilters = exports.GoogleServices = exports.GoogleMapsApiKey = exports.EasBuild = exports.Colors = exports.AllowBackup = void 0;
7
7
 
8
8
  function AllowBackup() {
9
9
  const data = _interopRequireWildcard(require("./AllowBackup"));
@@ -277,23 +277,6 @@ Object.defineProperty(exports, "Resources", {
277
277
  }
278
278
  });
279
279
 
280
- function RootViewBackgroundColor() {
281
- const data = _interopRequireWildcard(require("./RootViewBackgroundColor"));
282
-
283
- RootViewBackgroundColor = function () {
284
- return data;
285
- };
286
-
287
- return data;
288
- }
289
-
290
- Object.defineProperty(exports, "RootViewBackgroundColor", {
291
- enumerable: true,
292
- get: function () {
293
- return RootViewBackgroundColor();
294
- }
295
- });
296
-
297
280
  function Scheme() {
298
281
  const data = _interopRequireWildcard(require("./Scheme"));
299
282
 
@@ -379,23 +362,6 @@ Object.defineProperty(exports, "Updates", {
379
362
  }
380
363
  });
381
364
 
382
- function UserInterfaceStyle() {
383
- const data = _interopRequireWildcard(require("./UserInterfaceStyle"));
384
-
385
- UserInterfaceStyle = function () {
386
- return data;
387
- };
388
-
389
- return data;
390
- }
391
-
392
- Object.defineProperty(exports, "UserInterfaceStyle", {
393
- enumerable: true,
394
- get: function () {
395
- return UserInterfaceStyle();
396
- }
397
- });
398
-
399
365
  function Version() {
400
366
  const data = _interopRequireWildcard(require("./Version"));
401
367
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/android/index.ts"],"names":[],"mappings":";;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA","sourcesContent":["import * as AllowBackup from './AllowBackup';\nimport * as Colors from './Colors';\nimport * as EasBuild from './EasBuild';\nimport * as GoogleMapsApiKey from './GoogleMapsApiKey';\nimport * as GoogleServices from './GoogleServices';\nimport * as IntentFilters from './IntentFilters';\nimport * as JsEngine from './JsEngine';\nimport * as Manifest from './Manifest';\nimport * as Name from './Name';\nimport * as Orientation from './Orientation';\nimport * as Package from './Package';\nimport * as Paths from './Paths';\nimport * as Permissions from './Permissions';\nimport * as PrimaryColor from './PrimaryColor';\nimport * as Properties from './Properties';\nimport * as Resources from './Resources';\nimport * as RootViewBackgroundColor from './RootViewBackgroundColor';\nimport * as Scheme from './Scheme';\nimport * as StatusBar from './StatusBar';\nimport * as Strings from './Strings';\nimport * as Styles from './Styles';\nimport * as Updates from './Updates';\nimport * as UserInterfaceStyle from './UserInterfaceStyle';\nimport * as Version from './Version';\nimport * as WindowSoftInputMode from './WindowSoftInputMode';\n\nexport { Manifest, Colors, Paths, Permissions, Properties, Resources, Scheme, Strings, Styles };\n\nexport {\n AllowBackup,\n EasBuild,\n GoogleMapsApiKey,\n GoogleServices,\n IntentFilters,\n Name,\n Orientation,\n Package,\n PrimaryColor,\n RootViewBackgroundColor,\n StatusBar,\n Updates,\n UserInterfaceStyle,\n Version,\n JsEngine,\n WindowSoftInputMode,\n};\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../../src/android/index.ts"],"names":[],"mappings":";;;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ackup from './AllowBackup';\nimport * as Colors from './Colors';\nimport * as EasBuild from './EasBuild';\nimport * as GoogleMapsApiKey from './GoogleMapsApiKey';\nimport * as GoogleServices from './GoogleServices';\nimport * as IntentFilters from './IntentFilters';\nimport * as JsEngine from './JsEngine';\nimport * as Manifest from './Manifest';\nimport * as Name from './Name';\nimport * as Orientation from './Orientation';\nimport * as Package from './Package';\nimport * as Paths from './Paths';\nimport * as Permissions from './Permissions';\nimport * as PrimaryColor from './PrimaryColor';\nimport * as Properties from './Properties';\nimport * as Resources from './Resources';\nimport * as Scheme from './Scheme';\nimport * as StatusBar from './StatusBar';\nimport * as Strings from './Strings';\nimport * as Styles from './Styles';\nimport * as Updates from './Updates';\nimport * as Version from './Version';\nimport * as WindowSoftInputMode from './WindowSoftInputMode';\n\nexport { Manifest, Colors, Paths, Permissions, Properties, Resources, Scheme, Strings, Styles };\n\nexport {\n AllowBackup,\n EasBuild,\n GoogleMapsApiKey,\n GoogleServices,\n IntentFilters,\n Name,\n Orientation,\n Package,\n PrimaryColor,\n StatusBar,\n Updates,\n Version,\n JsEngine,\n WindowSoftInputMode,\n};\n"],"file":"index.js"}
@@ -14,15 +14,13 @@ import * as Paths from './Paths';
14
14
  import * as Permissions from './Permissions';
15
15
  import * as ProvisioningProfile from './ProvisioningProfile';
16
16
  import * as RequiresFullScreen from './RequiresFullScreen';
17
- import * as RootViewBackgroundColor from './RootViewBackgroundColor';
18
17
  import * as Scheme from './Scheme';
19
18
  import * as Swift from './Swift';
20
19
  import * as Target from './Target';
21
20
  import * as Updates from './Updates';
22
- import * as UserInterfaceStyle from './UserInterfaceStyle';
23
21
  import * as UsesNonExemptEncryption from './UsesNonExemptEncryption';
24
22
  import * as Version from './Version';
25
23
  import * as XcodeProjectFile from './XcodeProjectFile';
26
24
  import * as XcodeUtils from './utils/Xcodeproj';
27
25
  export { InfoPlist, ExpoPlist, Entitlements, Paths, Permissions, XcodeUtils };
28
- export { Bitcode, BundleIdentifier, BuildScheme, DeviceFamily, Google, Maps, Locales, JsEngine, Name, Orientation, ProvisioningProfile, RequiresFullScreen, RootViewBackgroundColor, Scheme, Swift, Target, Updates, UserInterfaceStyle, UsesNonExemptEncryption, Version, XcodeProjectFile, };
26
+ export { Bitcode, BundleIdentifier, BuildScheme, DeviceFamily, Google, Maps, Locales, JsEngine, Name, Orientation, ProvisioningProfile, RequiresFullScreen, Scheme, Swift, Target, Updates, UsesNonExemptEncryption, Version, XcodeProjectFile, };
@@ -15,7 +15,7 @@ Object.defineProperty(exports, "InfoPlist", {
15
15
  return _IosConfig().InfoPlist;
16
16
  }
17
17
  });
18
- exports.XcodeUtils = exports.XcodeProjectFile = exports.Version = exports.UsesNonExemptEncryption = exports.UserInterfaceStyle = exports.Updates = exports.Target = exports.Swift = exports.Scheme = exports.RootViewBackgroundColor = exports.RequiresFullScreen = exports.ProvisioningProfile = exports.Permissions = exports.Paths = exports.Orientation = exports.Name = exports.Maps = exports.Locales = exports.JsEngine = exports.Google = exports.Entitlements = exports.DeviceFamily = exports.BundleIdentifier = exports.BuildScheme = exports.Bitcode = void 0;
18
+ exports.XcodeUtils = exports.XcodeProjectFile = exports.Version = exports.UsesNonExemptEncryption = exports.Updates = exports.Target = exports.Swift = exports.Scheme = exports.RequiresFullScreen = exports.ProvisioningProfile = exports.Permissions = exports.Paths = exports.Orientation = exports.Name = exports.Maps = exports.Locales = exports.JsEngine = exports.Google = exports.Entitlements = exports.DeviceFamily = exports.BundleIdentifier = exports.BuildScheme = exports.Bitcode = void 0;
19
19
 
20
20
  function Bitcode() {
21
21
  const data = _interopRequireWildcard(require("./Bitcode"));
@@ -282,23 +282,6 @@ Object.defineProperty(exports, "RequiresFullScreen", {
282
282
  }
283
283
  });
284
284
 
285
- function RootViewBackgroundColor() {
286
- const data = _interopRequireWildcard(require("./RootViewBackgroundColor"));
287
-
288
- RootViewBackgroundColor = function () {
289
- return data;
290
- };
291
-
292
- return data;
293
- }
294
-
295
- Object.defineProperty(exports, "RootViewBackgroundColor", {
296
- enumerable: true,
297
- get: function () {
298
- return RootViewBackgroundColor();
299
- }
300
- });
301
-
302
285
  function Scheme() {
303
286
  const data = _interopRequireWildcard(require("./Scheme"));
304
287
 
@@ -367,23 +350,6 @@ Object.defineProperty(exports, "Updates", {
367
350
  }
368
351
  });
369
352
 
370
- function UserInterfaceStyle() {
371
- const data = _interopRequireWildcard(require("./UserInterfaceStyle"));
372
-
373
- UserInterfaceStyle = function () {
374
- return data;
375
- };
376
-
377
- return data;
378
- }
379
-
380
- Object.defineProperty(exports, "UserInterfaceStyle", {
381
- enumerable: true,
382
- get: function () {
383
- return UserInterfaceStyle();
384
- }
385
- });
386
-
387
353
  function UsesNonExemptEncryption() {
388
354
  const data = _interopRequireWildcard(require("./UsesNonExemptEncryption"));
389
355
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/ios/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA","sourcesContent":["import * as Bitcode from './Bitcode';\nimport * as BuildScheme from './BuildScheme';\nimport * as BundleIdentifier from './BundleIdentifier';\nimport * as DeviceFamily from './DeviceFamily';\nimport * as Entitlements from './Entitlements';\nimport * as Google from './Google';\nimport { ExpoPlist, InfoPlist } from './IosConfig.types';\nimport * as JsEngine from './JsEngine';\nimport * as Locales from './Locales';\nimport * as Maps from './Maps';\nimport * as Name from './Name';\nimport * as Orientation from './Orientation';\nimport * as Paths from './Paths';\nimport * as Permissions from './Permissions';\nimport * as ProvisioningProfile from './ProvisioningProfile';\nimport * as RequiresFullScreen from './RequiresFullScreen';\nimport * as RootViewBackgroundColor from './RootViewBackgroundColor';\nimport * as Scheme from './Scheme';\nimport * as Swift from './Swift';\nimport * as Target from './Target';\nimport * as Updates from './Updates';\nimport * as UserInterfaceStyle from './UserInterfaceStyle';\nimport * as UsesNonExemptEncryption from './UsesNonExemptEncryption';\nimport * as Version from './Version';\nimport * as XcodeProjectFile from './XcodeProjectFile';\nimport * as XcodeUtils from './utils/Xcodeproj';\n\n// We can change this to export * as X with TypeScript 3.8+\n// https://devblogs.microsoft.com/typescript/announcing-typescript-3-8-beta/#export-star-as-namespace-syntax\n// .. but we should wait for this to be the default VSCode version.\nexport { InfoPlist, ExpoPlist, Entitlements, Paths, Permissions, XcodeUtils };\n\nexport {\n Bitcode,\n BundleIdentifier,\n BuildScheme,\n DeviceFamily,\n Google,\n Maps,\n Locales,\n JsEngine,\n Name,\n Orientation,\n ProvisioningProfile,\n RequiresFullScreen,\n RootViewBackgroundColor,\n Scheme,\n Swift,\n Target,\n Updates,\n UserInterfaceStyle,\n UsesNonExemptEncryption,\n Version,\n XcodeProjectFile,\n};\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../../src/ios/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA","sourcesContent":["import * as Bitcode from './Bitcode';\nimport * as BuildScheme from './BuildScheme';\nimport * as BundleIdentifier from './BundleIdentifier';\nimport * as DeviceFamily from './DeviceFamily';\nimport * as Entitlements from './Entitlements';\nimport * as Google from './Google';\nimport { ExpoPlist, InfoPlist } from './IosConfig.types';\nimport * as JsEngine from './JsEngine';\nimport * as Locales from './Locales';\nimport * as Maps from './Maps';\nimport * as Name from './Name';\nimport * as Orientation from './Orientation';\nimport * as Paths from './Paths';\nimport * as Permissions from './Permissions';\nimport * as ProvisioningProfile from './ProvisioningProfile';\nimport * as RequiresFullScreen from './RequiresFullScreen';\nimport * as Scheme from './Scheme';\nimport * as Swift from './Swift';\nimport * as Target from './Target';\nimport * as Updates from './Updates';\nimport * as UsesNonExemptEncryption from './UsesNonExemptEncryption';\nimport * as Version from './Version';\nimport * as XcodeProjectFile from './XcodeProjectFile';\nimport * as XcodeUtils from './utils/Xcodeproj';\n\n// We can change this to export * as X with TypeScript 3.8+\n// https://devblogs.microsoft.com/typescript/announcing-typescript-3-8-beta/#export-star-as-namespace-syntax\n// .. but we should wait for this to be the default VSCode version.\nexport { InfoPlist, ExpoPlist, Entitlements, Paths, Permissions, XcodeUtils };\n\nexport {\n Bitcode,\n BundleIdentifier,\n BuildScheme,\n DeviceFamily,\n Google,\n Maps,\n Locales,\n JsEngine,\n Name,\n Orientation,\n ProvisioningProfile,\n RequiresFullScreen,\n Scheme,\n Swift,\n Target,\n Updates,\n UsesNonExemptEncryption,\n Version,\n XcodeProjectFile,\n};\n"],"file":"index.js"}
@@ -47,8 +47,12 @@ function _pluginResolver() {
47
47
 
48
48
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
49
49
 
50
- const EXPO_DEBUG = (0, _getenv().boolish)('EXPO_DEBUG', false);
51
- const EXPO_CONFIG_PLUGIN_VERBOSE_ERRORS = (0, _getenv().boolish)('EXPO_CONFIG_PLUGIN_VERBOSE_ERRORS', false);
50
+ const EXPO_DEBUG = (0, _getenv().boolish)('EXPO_DEBUG', false); // Show all error info related to plugin resolution.
51
+
52
+ const EXPO_CONFIG_PLUGIN_VERBOSE_ERRORS = (0, _getenv().boolish)('EXPO_CONFIG_PLUGIN_VERBOSE_ERRORS', false); // Force using the fallback unversioned plugin instead of a local versioned copy,
53
+ // this should only be used for testing the CLI.
54
+
55
+ const EXPO_USE_UNVERSIONED_PLUGINS = (0, _getenv().boolish)('EXPO_USE_UNVERSIONED_PLUGINS', false);
52
56
 
53
57
  function isModuleMissingError(name, error) {
54
58
  // @ts-ignore
@@ -93,14 +97,21 @@ const withStaticPlugin = (config, props) => {
93
97
  let [pluginResolve, pluginProps] = (0, _pluginResolver().normalizeStaticPlugin)(props.plugin); // Ensure no one uses this property by accident.
94
98
 
95
99
  (0, _assert().default)(!((_pluginProps = pluginProps) !== null && _pluginProps !== void 0 && _pluginProps._resolverError), `Plugin property '_resolverError' is a reserved property of \`withStaticPlugin\``);
96
- let withPlugin; // Function was provided, no need to resolve: [withPlugin, {}]
100
+ let withPlugin;
97
101
 
98
- if (typeof pluginResolve === 'function') {
102
+ if ( // Function was provided, no need to resolve: [withPlugin, {}]
103
+ typeof pluginResolve === 'function') {
99
104
  withPlugin = pluginResolve;
100
105
  } else if (typeof pluginResolve === 'string') {
101
106
  try {
102
107
  // Resolve and evaluate plugins.
103
- withPlugin = (0, _pluginResolver().resolveConfigPluginFunction)(projectRoot, pluginResolve);
108
+ withPlugin = (0, _pluginResolver().resolveConfigPluginFunction)(projectRoot, pluginResolve); // Only force if the project has the versioned plugin, otherwise use default behavior.
109
+ // This helps see which plugins are being skipped.
110
+
111
+ if (EXPO_USE_UNVERSIONED_PLUGINS && !!withPlugin && !!props._isLegacyPlugin && !!props.fallback) {
112
+ console.log(`Force "${pluginResolve}" to unversioned plugin`);
113
+ withPlugin = props.fallback;
114
+ }
104
115
  } catch (error) {
105
116
  if (EXPO_DEBUG) {
106
117
  if (EXPO_CONFIG_PLUGIN_VERBOSE_ERRORS) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/plugins/withStaticPlugin.ts"],"names":["EXPO_DEBUG","EXPO_CONFIG_PLUGIN_VERBOSE_ERRORS","isModuleMissingError","name","error","includes","code","message","isUnexpectedTokenError","SyntaxError","PluginError","match","withStaticPlugin","config","props","projectRoot","_internal","pluginResolve","pluginProps","plugin","_resolverError","withPlugin","console","log","shouldMuteWarning","_isLegacyPlugin","fallback"],"mappings":";;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAGA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;AAMA,MAAMA,UAAU,GAAG,uBAAQ,YAAR,EAAsB,KAAtB,CAAnB;AACA,MAAMC,iCAAiC,GAAG,uBAAQ,mCAAR,EAA6C,KAA7C,CAA1C;;AAEA,SAASC,oBAAT,CAA8BC,IAA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nB;AACA,SAAOL,MAAP;AACD,CA1EM","sourcesContent":["import assert from 'assert';\nimport { boolish } from 'getenv';\n\nimport { ConfigPlugin, StaticPlugin } from '../Plugin.types';\nimport { PluginError } from '../utils/errors';\nimport {\n assertInternalProjectRoot,\n normalizeStaticPlugin,\n resolveConfigPluginFunction,\n} from '../utils/plugin-resolver';\n\nconst EXPO_DEBUG = boolish('EXPO_DEBUG', false);\nconst EXPO_CONFIG_PLUGIN_VERBOSE_ERRORS = boolish('EXPO_CONFIG_PLUGIN_VERBOSE_ERRORS', false);\n\nfunction isModuleMissingError(name: string, error: Error): boolean {\n // @ts-ignore\n if (['MODULE_NOT_FOUND', 'PLUGIN_NOT_FOUND'].includes(error.code)) {\n return true;\n }\n return error.message.includes(`Cannot find module '${name}'`);\n}\n\nfunction isUnexpectedTokenError(error: Error): boolean {\n if (\n error instanceof SyntaxError ||\n (error instanceof PluginError && error.code === 'INVALID_PLUGIN_IMPORT')\n ) {\n return (\n // These are the most common errors that'll be thrown when a package isn't transpiled correctly.\n !!error.message.match(/Unexpected token/) ||\n !!error.message.match(/Cannot use import statement/)\n );\n }\n return false;\n}\n\n/**\n * Resolves static module plugin and potentially falls back on a provided plugin if the module cannot be resolved\n *\n * @param config\n * @param fallback Plugin with `_resolverError` explaining why the module couldn't be used\n * @param projectRoot optional project root, fallback to _internal.projectRoot. Used for testing.\n * @param _isLegacyPlugin Used to suppress errors thrown by plugins that are applied automatically\n */\nexport const withStaticPlugin: ConfigPlugin<{\n plugin: StaticPlugin | ConfigPlugin | string;\n fallback?: ConfigPlugin<{ _resolverError: Error } & any>;\n projectRoot?: string;\n _isLegacyPlugin?: boolean;\n}> = (config, props) => {\n let projectRoot = props.projectRoot;\n if (!projectRoot) {\n projectRoot = config._internal?.projectRoot;\n assertInternalProjectRoot(projectRoot);\n }\n\n let [pluginResolve, pluginProps] = normalizeStaticPlugin(props.plugin);\n // Ensure no one uses this property by accident.\n assert(\n !pluginProps?._resolverError,\n `Plugin property '_resolverError' is a reserved property of \\`withStaticPlugin\\``\n );\n\n let withPlugin: ConfigPlugin<unknown>;\n // Function was provided, no need to resolve: [withPlugin, {}]\n if (typeof pluginResolve === 'function') {\n withPlugin = pluginResolve;\n } else if (typeof pluginResolve === 'string') {\n try {\n // Resolve and evaluate plugins.\n withPlugin = resolveConfigPluginFunction(projectRoot, pluginResolve);\n } catch (error) {\n if (EXPO_DEBUG) {\n if (EXPO_CONFIG_PLUGIN_VERBOSE_ERRORS) {\n // Log the error in debug mode for plugins with fallbacks (like the Expo managed plugins).\n console.log(`Error resolving plugin \"${pluginResolve}\"`);\n console.log(error);\n console.log();\n } else {\n const shouldMuteWarning =\n props._isLegacyPlugin &&\n (isModuleMissingError(pluginResolve, error) || isUnexpectedTokenError(error));\n if (!shouldMuteWarning) {\n if (isModuleMissingError(pluginResolve, error)) {\n // Prevent causing log spew for basic resolution errors.\n console.log(`Could not find plugin \"${pluginResolve}\"`);\n } else {\n // Log the error in debug mode for plugins with fallbacks (like the Expo managed plugins).\n console.log(`Error resolving plugin \"${pluginResolve}\"`);\n console.log(error);\n console.log();\n }\n }\n }\n }\n // TODO: Maybe allow for `PluginError`s to be thrown so external plugins can assert invalid options.\n\n // If the static module failed to resolve, attempt to use a fallback.\n // This enables support for built-in plugins with versioned variations living in other packages.\n if (props.fallback) {\n if (!pluginProps) pluginProps = {};\n // Pass this to the fallback plugin for potential warnings about needing to install a versioned package.\n pluginProps._resolverError = error;\n withPlugin = props.fallback;\n } else {\n // If no fallback, throw the resolution error.\n throw error;\n }\n }\n } else {\n throw new PluginError(\n `Plugin is an unexpected type: ${typeof pluginResolve}`,\n 'INVALID_PLUGIN_TYPE'\n );\n }\n // Execute the plugin.\n config = withPlugin(config, pluginProps);\n return config;\n};\n"],"file":"withStaticPlugin.js"}
1
+ {"version":3,"sources":["../../src/plugins/withStaticPlugin.ts"],"names":["EXPO_DEBUG","EXPO_CONFIG_PLUGIN_VERBOSE_ERRORS","EXPO_USE_UNVERSIONED_PLUGINS","isModuleMissingError","name","error","includes","code","message","isUnexpectedTokenError","SyntaxError","PluginError","match","withStaticPlugin","config","props","projectRoot","_internal","pluginResolve","pluginProps","plugin","_resolverError","withPlugin","_isLegacyPlugin","fallback","console","log","shouldMuteWarning"],"mappings":";;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAGA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;AAMA,MAAMA,UAAU,GAAG,uBAAQ,YAAR,EAAsB,KAAtB,CAAnB,C,CAEA;;AACA,MAAMC,iCAAiC,GAAG,uBAAQ,mCAAR,EAA6C,KAA7C,CAA1C,C,CACA;AACA;;AACA,MAAMC,4BAA4B,GAAG,uBAAQ,8BAAR,EAAwC,KAAxC,CAArC;;AAEA,SAASC,oBAAT,CAA8BC,IAA9B,EAA4CC,KAA5C,EAAmE;AACjE;AACA,MAAI,CAAC,kBAAD,EAAqB,kBAArB,EAAyCC,QAAzC,CAAkDD,KAAK,CAACE,IAAxD,CAAJ,EAAmE;AACjE,WAAO,IAAP;AACD;;AACD,SAAOF,KAAK,CAACG,OAAN,CAAcF,QAAd,CAAwB,uBAAsBF,IAAK,GAAnD,CAAP;AACD;;AAED,SAASK,sBAAT,CAAgCJ,KAAhC,EAAuD;AACrD,MACEA,KAAK,YAAYK,WAAjB,IACCL,KAAK,YAAYM,qBAAjB,IAAgCN,KAAK,CAACE,IAAN,KAAe,uBAFlD,EAGE;AACA,WACE;AACA,OAAC,CAACF,KAAK,CAACG,OAAN,CAAcI,KAAd,CAAoB,kBAApB,CAAF,IACA,CAAC,CAACP,KAAK,CAACG,OAAN,CAAcI,KAAd,CAAoB,6BAApB;AAHJ;AAKD;;AACD,SAAO,KAAP;AACD;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,MAAMC,gBAKX,GAAG,CA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8CI,sBAAsB,CAACJ,KAAD,CADrE,CADF;;AAGA,cAAI,CAACsB,iBAAL,EAAwB;AACtB,gBAAIxB,oBAAoB,CAACe,aAAD,EAAgBb,KAAhB,CAAxB,EAAgD;AAC9C;AACAoB,cAAAA,OAAO,CAACC,GAAR,CAAa,0BAAyBR,aAAc,GAApD;AACD,aAHD,MAGO;AACL;AACAO,cAAAA,OAAO,CAACC,GAAR,CAAa,2BAA0BR,aAAc,GAArD;AACAO,cAAAA,OAAO,CAACC,GAAR,CAAYrB,KAAZ;AACAoB,cAAAA,OAAO,CAACC,GAAR;AACD;AACF;AACF;AACF,OAvBkB,CAwBnB;AAEA;AACA;;;AACA,UAAIX,KAAK,CAACS,QAAV,EAAoB;AAClB,YAAI,CAACL,WAAL,EAAkBA,WAAW,GAAG,EAAd,CADA,CAElB;;AACAA,QAAAA,WAAW,CAACE,cAAZ,GAA6BhB,KAA7B;AACAiB,QAAAA,UAAU,GAAGP,KAAK,CAACS,QAAnB;AACD,OALD,MAKO;AACL;AACA,cAAMnB,KAAN;AACD;AACF;AACF,GAtDM,MAsDA;AACL,UAAM,KAAIM,qBAAJ,EACH,iCAAgC,OAAOO,aAAc,EADlD,EAEJ,qBAFI,CAAN;AAID,GAhFqB,CAkFtB;;;AACAJ,EAAAA,MAAM,GAAGQ,UAAU,CAACR,MAAD,EAASK,WAAT,CAAnB;AACA,SAAOL,MAAP;AACD,CA1FM","sourcesContent":["import assert from 'assert';\nimport { boolish } from 'getenv';\n\nimport { ConfigPlugin, StaticPlugin } from '../Plugin.types';\nimport { PluginError } from '../utils/errors';\nimport {\n assertInternalProjectRoot,\n normalizeStaticPlugin,\n resolveConfigPluginFunction,\n} from '../utils/plugin-resolver';\n\nconst EXPO_DEBUG = boolish('EXPO_DEBUG', false);\n\n// Show all error info related to plugin resolution.\nconst EXPO_CONFIG_PLUGIN_VERBOSE_ERRORS = boolish('EXPO_CONFIG_PLUGIN_VERBOSE_ERRORS', false);\n// Force using the fallback unversioned plugin instead of a local versioned copy,\n// this should only be used for testing the CLI.\nconst EXPO_USE_UNVERSIONED_PLUGINS = boolish('EXPO_USE_UNVERSIONED_PLUGINS', false);\n\nfunction isModuleMissingError(name: string, error: Error): boolean {\n // @ts-ignore\n if (['MODULE_NOT_FOUND', 'PLUGIN_NOT_FOUND'].includes(error.code)) {\n return true;\n }\n return error.message.includes(`Cannot find module '${name}'`);\n}\n\nfunction isUnexpectedTokenError(error: Error): boolean {\n if (\n error instanceof SyntaxError ||\n (error instanceof PluginError && error.code === 'INVALID_PLUGIN_IMPORT')\n ) {\n return (\n // These are the most common errors that'll be thrown when a package isn't transpiled correctly.\n !!error.message.match(/Unexpected token/) ||\n !!error.message.match(/Cannot use import statement/)\n );\n }\n return false;\n}\n\n/**\n * Resolves static module plugin and potentially falls back on a provided plugin if the module cannot be resolved\n *\n * @param config\n * @param fallback Plugin with `_resolverError` explaining why the module couldn't be used\n * @param projectRoot optional project root, fallback to _internal.projectRoot. Used for testing.\n * @param _isLegacyPlugin Used to suppress errors thrown by plugins that are applied automatically\n */\nexport const withStaticPlugin: ConfigPlugin<{\n plugin: StaticPlugin | ConfigPlugin | string;\n fallback?: ConfigPlugin<{ _resolverError: Error } & any>;\n projectRoot?: string;\n _isLegacyPlugin?: boolean;\n}> = (config, props) => {\n let projectRoot = props.projectRoot;\n if (!projectRoot) {\n projectRoot = config._internal?.projectRoot;\n assertInternalProjectRoot(projectRoot);\n }\n\n let [pluginResolve, pluginProps] = normalizeStaticPlugin(props.plugin);\n // Ensure no one uses this property by accident.\n assert(\n !pluginProps?._resolverError,\n `Plugin property '_resolverError' is a reserved property of \\`withStaticPlugin\\``\n );\n\n let withPlugin: ConfigPlugin<unknown>;\n\n if (\n // Function was provided, no need to resolve: [withPlugin, {}]\n typeof pluginResolve === 'function'\n ) {\n withPlugin = pluginResolve;\n } else if (typeof pluginResolve === 'string') {\n try {\n // Resolve and evaluate plugins.\n withPlugin = resolveConfigPluginFunction(projectRoot, pluginResolve);\n\n // Only force if the project has the versioned plugin, otherwise use default behavior.\n // This helps see which plugins are being skipped.\n if (\n EXPO_USE_UNVERSIONED_PLUGINS &&\n !!withPlugin &&\n !!props._isLegacyPlugin &&\n !!props.fallback\n ) {\n console.log(`Force \"${pluginResolve}\" to unversioned plugin`);\n withPlugin = props.fallback;\n }\n } catch (error: any) {\n if (EXPO_DEBUG) {\n if (EXPO_CONFIG_PLUGIN_VERBOSE_ERRORS) {\n // Log the error in debug mode for plugins with fallbacks (like the Expo managed plugins).\n console.log(`Error resolving plugin \"${pluginResolve}\"`);\n console.log(error);\n console.log();\n } else {\n const shouldMuteWarning =\n props._isLegacyPlugin &&\n (isModuleMissingError(pluginResolve, error) || isUnexpectedTokenError(error));\n if (!shouldMuteWarning) {\n if (isModuleMissingError(pluginResolve, error)) {\n // Prevent causing log spew for basic resolution errors.\n console.log(`Could not find plugin \"${pluginResolve}\"`);\n } else {\n // Log the error in debug mode for plugins with fallbacks (like the Expo managed plugins).\n console.log(`Error resolving plugin \"${pluginResolve}\"`);\n console.log(error);\n console.log();\n }\n }\n }\n }\n // TODO: Maybe allow for `PluginError`s to be thrown so external plugins can assert invalid options.\n\n // If the static module failed to resolve, attempt to use a fallback.\n // This enables support for built-in plugins with versioned variations living in other packages.\n if (props.fallback) {\n if (!pluginProps) pluginProps = {};\n // Pass this to the fallback plugin for potential warnings about needing to install a versioned package.\n pluginProps._resolverError = error;\n withPlugin = props.fallback;\n } else {\n // If no fallback, throw the resolution error.\n throw error;\n }\n }\n } else {\n throw new PluginError(\n `Plugin is an unexpected type: ${typeof pluginResolve}`,\n 'INVALID_PLUGIN_TYPE'\n );\n }\n\n // Execute the plugin.\n config = withPlugin(config, pluginProps);\n return config;\n};\n"],"file":"withStaticPlugin.js"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@expo/config-plugins",
3
- "version": "4.0.6",
3
+ "version": "4.0.7",
4
4
  "description": "A library for Expo config plugins",
5
5
  "main": "build/index.js",
6
6
  "scripts": {
@@ -1,6 +0,0 @@
1
- import { ExpoConfig } from '@expo/config-types';
2
- import { ConfigPlugin } from '../Plugin.types';
3
- export declare const withRootViewBackgroundColor: ConfigPlugin;
4
- export declare const withRootViewBackgroundColorColors: ConfigPlugin;
5
- export declare const withRootViewBackgroundColorStyles: ConfigPlugin;
6
- export declare function getRootViewBackgroundColor(config: Pick<ExpoConfig, 'android' | 'backgroundColor'>): string | null;
@@ -1,81 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getRootViewBackgroundColor = getRootViewBackgroundColor;
7
- exports.withRootViewBackgroundColorStyles = exports.withRootViewBackgroundColorColors = exports.withRootViewBackgroundColor = void 0;
8
-
9
- function _androidPlugins() {
10
- const data = require("../plugins/android-plugins");
11
-
12
- _androidPlugins = function () {
13
- return data;
14
- };
15
-
16
- return data;
17
- }
18
-
19
- function _Colors() {
20
- const data = require("./Colors");
21
-
22
- _Colors = function () {
23
- return data;
24
- };
25
-
26
- return data;
27
- }
28
-
29
- function _Styles() {
30
- const data = require("./Styles");
31
-
32
- _Styles = function () {
33
- return data;
34
- };
35
-
36
- return data;
37
- }
38
-
39
- const ANDROID_WINDOW_BACKGROUND = 'android:windowBackground';
40
- const WINDOW_BACKGROUND_COLOR = 'activityBackground';
41
-
42
- const withRootViewBackgroundColor = config => {
43
- config = withRootViewBackgroundColorColors(config);
44
- config = withRootViewBackgroundColorStyles(config);
45
- return config;
46
- };
47
-
48
- exports.withRootViewBackgroundColor = withRootViewBackgroundColor;
49
-
50
- const withRootViewBackgroundColorColors = config => {
51
- return (0, _androidPlugins().withAndroidColors)(config, async config => {
52
- config.modResults = (0, _Colors().assignColorValue)(config.modResults, {
53
- value: getRootViewBackgroundColor(config),
54
- name: WINDOW_BACKGROUND_COLOR
55
- });
56
- return config;
57
- });
58
- };
59
-
60
- exports.withRootViewBackgroundColorColors = withRootViewBackgroundColorColors;
61
-
62
- const withRootViewBackgroundColorStyles = config => {
63
- return (0, _androidPlugins().withAndroidStyles)(config, async config => {
64
- config.modResults = (0, _Styles().assignStylesValue)(config.modResults, {
65
- add: !!getRootViewBackgroundColor(config),
66
- parent: (0, _Styles().getAppThemeLightNoActionBarGroup)(),
67
- name: ANDROID_WINDOW_BACKGROUND,
68
- value: `@color/${WINDOW_BACKGROUND_COLOR}`
69
- });
70
- return config;
71
- });
72
- };
73
-
74
- exports.withRootViewBackgroundColorStyles = withRootViewBackgroundColorStyles;
75
-
76
- function getRootViewBackgroundColor(config) {
77
- var _config$android;
78
-
79
- return ((_config$android = config.android) === null || _config$android === void 0 ? void 0 : _config$android.backgroundColor) || config.backgroundColor || null;
80
- }
81
- //# sourceMappingURL=RootViewBackgroundColor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/android/RootViewBackgroundColor.ts"],"names":["ANDROID_WINDOW_BACKGROUND","WINDOW_BACKGROUND_COLOR","withRootViewBackgroundColor","config","withRootViewBackgroundColorColors","withRootViewBackgroundColorStyles","modResults","value","getRootViewBackgroundColor","name","add","parent","android","backgroundColor"],"mappings":";;;;;;;;AAGA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA,MAAMA,yBAAyB,GAAG,0BAAlC;AACA,MAAMC,uBAAuB,GAAG,oBAAhC;;AAEO,MAAMC,2BAAyC,GAAGC,MAAM,IAAI;AACjEA,EAAAA,MAAM,GAAGC,iCAAiC,CAACD,MAAD,CAA1C;AACAA,EAAAA,MAAM,GAAGE,iCAAiC,CAACF,MAAD,CAA1C;AACA,SAAOA,MAAP;AACD,CAJM;;;;AAMA,MAAMC,iCAA+C,GAAGD,MAAM,IAAI;AACvE,SAAO,yCAAkBA,MAAlB,EAA0B,MAAMA,MAAN,IAAgB;AAC/CA,IAAAA,MAAM,CAACG,UAAP,GAAoB,gCAAiBH,MAAM,CAACG,UAAxB,EAAoC;AACtDC,MAAAA,KAAK,EAAEC,0BAA0B,CAACL,MAAD,CADqB;AAEtDM,MAAAA,IAAI,EAAER;AAFgD,KAApC,CAApB;AAIA,WAAOE,MAAP;AACD,GANM,CAAP;AAOD,CARM;;;;AAUA,MAAME,iCAA+C,GAAGF,MAAM,IAAI;AACvE,SAAO,yCAAkBA,MAAlB,EAA0B,MAAMA,MAAN,IAAgB;AAC/CA,IAAAA,MAAM,CAACG,UAAP,GAAoB,iCAAkBH,MAAM,CAACG,UAAzB,EAAqC;AACvDI,MAAAA,GAAG,EAAE,CAAC,CAACF,0BAA0B,CAACL,MAAD,CADsB;AAEvDQ,MAAAA,MAAM,EAAE,iDAF+C;AAGvDF,MAAAA,IAAI,EAAET,yBAHiD;AAIvDO,MAAAA,KAAK,EAAG,UAASN,uBAAwB;AAJc,KAArC,CAApB;AAMA,WAAOE,MAAP;AACD,GARM,CAAP;AASD,CAVM;;;;AAYA,SAASK,0BAAT,CACLL,MADK,EAEL;AAAA;;AACA,SAAO,oBAAAA,MAAM,CAACS,OAAP,oEAAgBC,eAAhB,KAAmCV,MAAM,CAACU,eAA1C,IAA6D,IAApE;AACD","sourcesContent":["import { ExpoConfig } from '@expo/config-types';\n\nimport { ConfigPlugin } from '../Plugin.types';\nimport { withAndroidColors, withAndroidStyles } from '../plugins/android-plugins';\nimport { assignColorValue } from './Colors';\nimport { assignStylesValue, getAppThemeLightNoActionBarGroup } from './Styles';\n\nconst ANDROID_WINDOW_BACKGROUND = 'android:windowBackground';\nconst WINDOW_BACKGROUND_COLOR = 'activityBackground';\n\nexport const withRootViewBackgroundColor: ConfigPlugin = config => {\n config = withRootViewBackgroundColorColors(config);\n config = withRootViewBackgroundColorStyles(config);\n return config;\n};\n\nexport const withRootViewBackgroundColorColors: ConfigPlugin = config => {\n return withAndroidColors(config, async config => {\n config.modResults = assignColorValue(config.modResults, {\n value: getRootViewBackgroundColor(config),\n name: WINDOW_BACKGROUND_COLOR,\n });\n return config;\n });\n};\n\nexport const withRootViewBackgroundColorStyles: ConfigPlugin = config => {\n return withAndroidStyles(config, async config => {\n config.modResults = assignStylesValue(config.modResults, {\n add: !!getRootViewBackgroundColor(config),\n parent: getAppThemeLightNoActionBarGroup(),\n name: ANDROID_WINDOW_BACKGROUND,\n value: `@color/${WINDOW_BACKGROUND_COLOR}`,\n });\n return config;\n });\n};\n\nexport function getRootViewBackgroundColor(\n config: Pick<ExpoConfig, 'android' | 'backgroundColor'>\n) {\n return config.android?.backgroundColor || config.backgroundColor || null;\n}\n"],"file":"RootViewBackgroundColor.js"}
@@ -1,10 +0,0 @@
1
- import { ExpoConfig } from '@expo/config-types';
2
- import { ConfigPlugin } from '../Plugin.types';
3
- import { AndroidManifest } from './Manifest';
4
- export declare const CONFIG_CHANGES_ATTRIBUTE = "android:configChanges";
5
- export declare const ON_CONFIGURATION_CHANGED = "\npublic class MainActivity extends ReactActivity {\n\n // Added automatically by Expo Config\n @Override\n public void onConfigurationChanged(Configuration newConfig) {\n super.onConfigurationChanged(newConfig);\n Intent intent = new Intent(\"onConfigurationChanged\");\n intent.putExtra(\"newConfig\", newConfig);\n sendBroadcast(intent);\n }\n";
6
- export declare const withUiModeManifest: ConfigPlugin<void>;
7
- export declare const withUiModeMainActivity: ConfigPlugin;
8
- export declare function getUserInterfaceStyle(config: Pick<ExpoConfig, 'android' | 'userInterfaceStyle'>): string;
9
- export declare function setUiModeAndroidManifest(config: Pick<ExpoConfig, 'android' | 'userInterfaceStyle'>, androidManifest: AndroidManifest): AndroidManifest;
10
- export declare function addOnConfigurationChangedMainActivity(config: Pick<ExpoConfig, 'android' | 'userInterfaceStyle'>, mainActivity: string): string;
@@ -1,119 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getUserInterfaceStyle = getUserInterfaceStyle;
7
- exports.setUiModeAndroidManifest = setUiModeAndroidManifest;
8
- exports.addOnConfigurationChangedMainActivity = addOnConfigurationChangedMainActivity;
9
- exports.withUiModeMainActivity = exports.withUiModeManifest = exports.ON_CONFIGURATION_CHANGED = exports.CONFIG_CHANGES_ATTRIBUTE = void 0;
10
-
11
- function _androidPlugins() {
12
- const data = require("../plugins/android-plugins");
13
-
14
- _androidPlugins = function () {
15
- return data;
16
- };
17
-
18
- return data;
19
- }
20
-
21
- function _warnings() {
22
- const data = require("../utils/warnings");
23
-
24
- _warnings = function () {
25
- return data;
26
- };
27
-
28
- return data;
29
- }
30
-
31
- function _Manifest() {
32
- const data = require("./Manifest");
33
-
34
- _Manifest = function () {
35
- return data;
36
- };
37
-
38
- return data;
39
- }
40
-
41
- function _codeMod() {
42
- const data = require("./codeMod");
43
-
44
- _codeMod = function () {
45
- return data;
46
- };
47
-
48
- return data;
49
- }
50
-
51
- const CONFIG_CHANGES_ATTRIBUTE = 'android:configChanges';
52
- exports.CONFIG_CHANGES_ATTRIBUTE = CONFIG_CHANGES_ATTRIBUTE;
53
- const ON_CONFIGURATION_CHANGED = `
54
- public class MainActivity extends ReactActivity {
55
-
56
- // Added automatically by Expo Config
57
- @Override
58
- public void onConfigurationChanged(Configuration newConfig) {
59
- super.onConfigurationChanged(newConfig);
60
- Intent intent = new Intent("onConfigurationChanged");
61
- intent.putExtra("newConfig", newConfig);
62
- sendBroadcast(intent);
63
- }
64
- `;
65
- exports.ON_CONFIGURATION_CHANGED = ON_CONFIGURATION_CHANGED;
66
- const withUiModeManifest = (0, _androidPlugins().createAndroidManifestPlugin)(setUiModeAndroidManifest, 'withUiModeManifest');
67
- exports.withUiModeManifest = withUiModeManifest;
68
-
69
- const withUiModeMainActivity = config => {
70
- return (0, _androidPlugins().withMainActivity)(config, config => {
71
- if (config.modResults.language === 'java') {
72
- config.modResults.contents = addOnConfigurationChangedMainActivity(config, config.modResults.contents);
73
- } else {
74
- (0, _warnings().addWarningAndroid)('android.userInterfaceStyle', `Cannot automatically configure MainActivity if it's not java`);
75
- }
76
-
77
- return config;
78
- });
79
- };
80
-
81
- exports.withUiModeMainActivity = withUiModeMainActivity;
82
-
83
- function getUserInterfaceStyle(config) {
84
- var _ref, _config$android$userI, _config$android;
85
-
86
- return (_ref = (_config$android$userI = (_config$android = config.android) === null || _config$android === void 0 ? void 0 : _config$android.userInterfaceStyle) !== null && _config$android$userI !== void 0 ? _config$android$userI : config.userInterfaceStyle) !== null && _ref !== void 0 ? _ref : 'light';
87
- }
88
-
89
- function setUiModeAndroidManifest(config, androidManifest) {
90
- const userInterfaceStyle = getUserInterfaceStyle(config); // TODO: Remove this if we decide to remove any uiMode configuration when not specified
91
-
92
- if (!userInterfaceStyle) {
93
- return androidManifest;
94
- }
95
-
96
- const mainActivity = (0, _Manifest().getMainActivityOrThrow)(androidManifest);
97
- mainActivity.$[CONFIG_CHANGES_ATTRIBUTE] = 'keyboard|keyboardHidden|orientation|screenSize|uiMode';
98
- return androidManifest;
99
- }
100
-
101
- function addOnConfigurationChangedMainActivity(config, mainActivity) {
102
- var _mainActivity$match;
103
-
104
- const userInterfaceStyle = getUserInterfaceStyle(config);
105
-
106
- if (!userInterfaceStyle) {
107
- return mainActivity;
108
- } // Cruzan: this is not ideal, but I'm not sure of a better way to handle writing to MainActivity.java
109
-
110
-
111
- if ((_mainActivity$match = mainActivity.match(`onConfigurationChanged`)) !== null && _mainActivity$match !== void 0 && _mainActivity$match.length) {
112
- return mainActivity;
113
- }
114
-
115
- const MainActivityWithImports = (0, _codeMod().addImports)(mainActivity, ['android.content.Intent', 'android.content.res.Configuration'], true);
116
- const pattern = new RegExp(`public class MainActivity extends ReactActivity {`);
117
- return MainActivityWithImports.replace(pattern, ON_CONFIGURATION_CHANGED);
118
- }
119
- //# sourceMappingURL=UserInterfaceStyle.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/android/UserInterfaceStyle.ts"],"names":["CONFIG_CHANGES_ATTRIBUTE","ON_CONFIGURATION_CHANGED","withUiModeManifest","setUiModeAndroidManifest","withUiModeMainActivity","config","modResults","language","contents","addOnConfigurationChangedMainActivity","getUserInterfaceStyle","android","userInterfaceStyle","androidManifest","mainActivity","$","match","length","MainActivityWithImports","pattern","RegExp","replace"],"mappings":";;;;;;;;;;AAGA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEO,MAAMA,wBAAwB,GAAG,uBAAjC;;AAEA,MAAMC,wBAAwB,GAAI;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAXO;;AAaA,MAAMC,kBAAkB,GAAG,mDAChCC,wBADgC,EAEhC,oBAFgC,CAA3B;;;AAKA,MAAMC,sBAAoC,GAAGC,MAAM,IAAI;AAC5D,SAAO,wCAAiBA,MAAjB,EAAyBA,MAAM,IAAI;AACxC,QAAIA,MAAM,CAACC,UAAP,CAAkBC,QAAlB,KAA+B,MAAnC,EAA2C;AACzCF,MAAAA,MAAM,CAACC,UAAP,CAAkBE,QAAlB,GAA6BC,qCAAqC,CAChEJ,MADgE,EAEhEA,MAAM,CAACC,UAAP,CAAkBE,QAF8C,CAAlE;AAID,KALD,MAKO;AACL,yCACE,4BADF,EAEG,8DAFH;AAID;;AACD,WAAOH,MAAP;AACD,GAbM,CAAP;AAcD,CAfM;;;;AAiBA,SAASK,qBAAT,CACLL,MADK,EAEG;AAAA;;AACR,6DAAOA,MAAM,CAACM,OAAd,oDAAO,gBAAgBC,kBAAvB,yEAA6CP,MAAM,CAACO,kBAApD,uCAA0E,OAA1E;AACD;;AAEM,SAAST,wBAAT,CACLE,MADK,EAELQ,eAFK,EAGL;AACA,QAAMD,kBAAkB,GAAGF,qBAAqB,CAACL,MAAD,CAAhD,CADA,CAEA;;AACA,MAAI,CAACO,kBAAL,EAAyB;AACvB,WAAOC,eAAP;AACD;;AAED,QAAMC,YAAY,GAAG,wCAAuBD,eAAvB,CAArB;AACAC,EAAAA,YAAY,CAACC,CAAb,CAAef,wBAAf,IACE,uDADF;AAGA,SAAOa,eAAP;AACD;;AAEM,SAASJ,qCAAT,CACLJ,MADK,EAELS,YAFK,EAGG;AAAA;;AACR,QAAMF,kBAAkB,GAAGF,qBAAqB,CAACL,MAAD,CAAhD;;AACA,MAAI,CAACO,kBAAL,EAAyB;AACvB,WAAOE,YAAP;AACD,GAJO,CAMR;;;AACA,6BAAIA,YAAY,CAACE,KAAb,CAAoB,wBAApB,CAAJ,gDAAI,oBAA8CC,MAAlD,EAA0D;AACxD,WAAOH,YAAP;AACD;;AAED,QAAMI,uBAAuB,GAAG,2BAC9BJ,YAD8B,EAE9B,CAAC,wBAAD,EAA2B,mCAA3B,CAF8B,EAG9B,IAH8B,CAAhC;AAMA,QAAMK,OAAO,GAAG,IAAIC,MAAJ,CAAY,mDAAZ,CAAhB;AACA,SAAOF,uBAAuB,CAACG,OAAxB,CAAgCF,OAAhC,EAAyClB,wBAAzC,CAAP;AACD","sourcesContent":["import { ExpoConfig } from '@expo/config-types';\n\nimport { ConfigPlugin } from '../Plugin.types';\nimport { createAndroidManifestPlugin, withMainActivity } from '../plugins/android-plugins';\nimport { addWarningAndroid } from '../utils/warnings';\nimport { AndroidManifest, getMainActivityOrThrow } from './Manifest';\nimport { addImports } from './codeMod';\n\nexport const CONFIG_CHANGES_ATTRIBUTE = 'android:configChanges';\n\nexport const ON_CONFIGURATION_CHANGED = `\npublic class MainActivity extends ReactActivity {\n\n // Added automatically by Expo Config\n @Override\n public void onConfigurationChanged(Configuration newConfig) {\n super.onConfigurationChanged(newConfig);\n Intent intent = new Intent(\"onConfigurationChanged\");\n intent.putExtra(\"newConfig\", newConfig);\n sendBroadcast(intent);\n }\n`;\n\nexport const withUiModeManifest = createAndroidManifestPlugin(\n setUiModeAndroidManifest,\n 'withUiModeManifest'\n);\n\nexport const withUiModeMainActivity: ConfigPlugin = config => {\n return withMainActivity(config, config => {\n if (config.modResults.language === 'java') {\n config.modResults.contents = addOnConfigurationChangedMainActivity(\n config,\n config.modResults.contents\n );\n } else {\n addWarningAndroid(\n 'android.userInterfaceStyle',\n `Cannot automatically configure MainActivity if it's not java`\n );\n }\n return config;\n });\n};\n\nexport function getUserInterfaceStyle(\n config: Pick<ExpoConfig, 'android' | 'userInterfaceStyle'>\n): string {\n return config.android?.userInterfaceStyle ?? config.userInterfaceStyle ?? 'light';\n}\n\nexport function setUiModeAndroidManifest(\n config: Pick<ExpoConfig, 'android' | 'userInterfaceStyle'>,\n androidManifest: AndroidManifest\n) {\n const userInterfaceStyle = getUserInterfaceStyle(config);\n // TODO: Remove this if we decide to remove any uiMode configuration when not specified\n if (!userInterfaceStyle) {\n return androidManifest;\n }\n\n const mainActivity = getMainActivityOrThrow(androidManifest);\n mainActivity.$[CONFIG_CHANGES_ATTRIBUTE] =\n 'keyboard|keyboardHidden|orientation|screenSize|uiMode';\n\n return androidManifest;\n}\n\nexport function addOnConfigurationChangedMainActivity(\n config: Pick<ExpoConfig, 'android' | 'userInterfaceStyle'>,\n mainActivity: string\n): string {\n const userInterfaceStyle = getUserInterfaceStyle(config);\n if (!userInterfaceStyle) {\n return mainActivity;\n }\n\n // Cruzan: this is not ideal, but I'm not sure of a better way to handle writing to MainActivity.java\n if (mainActivity.match(`onConfigurationChanged`)?.length) {\n return mainActivity;\n }\n\n const MainActivityWithImports = addImports(\n mainActivity,\n ['android.content.Intent', 'android.content.res.Configuration'],\n true\n );\n\n const pattern = new RegExp(`public class MainActivity extends ReactActivity {`);\n return MainActivityWithImports.replace(pattern, ON_CONFIGURATION_CHANGED);\n}\n"],"file":"UserInterfaceStyle.js"}
@@ -1,6 +0,0 @@
1
- import { ExpoConfig } from '@expo/config-types';
2
- import { ConfigPlugin } from '../Plugin.types';
3
- import { InfoPlist } from './IosConfig.types';
4
- export declare const withRootViewBackgroundColor: ConfigPlugin;
5
- export declare function setRootViewBackgroundColor(config: Pick<ExpoConfig, 'backgroundColor' | 'ios'>, infoPlist: InfoPlist): InfoPlist;
6
- export declare function getRootViewBackgroundColor(config: Pick<ExpoConfig, 'ios' | 'backgroundColor'>): string | null;
@@ -1,70 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.setRootViewBackgroundColor = setRootViewBackgroundColor;
7
- exports.getRootViewBackgroundColor = getRootViewBackgroundColor;
8
- exports.withRootViewBackgroundColor = void 0;
9
-
10
- function _normalizeColor() {
11
- const data = _interopRequireDefault(require("@react-native/normalize-color"));
12
-
13
- _normalizeColor = function () {
14
- return data;
15
- };
16
-
17
- return data;
18
- }
19
-
20
- function _iosPlugins() {
21
- const data = require("../plugins/ios-plugins");
22
-
23
- _iosPlugins = function () {
24
- return data;
25
- };
26
-
27
- return data;
28
- }
29
-
30
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
31
-
32
- // @ts-ignore: uses flow
33
- // Maps to the template AppDelegate.m
34
- const BACKGROUND_COLOR_KEY = 'RCTRootViewBackgroundColor';
35
-
36
- const withRootViewBackgroundColor = config => {
37
- config = (0, _iosPlugins().withInfoPlist)(config, config => {
38
- config.modResults = setRootViewBackgroundColor(config, config.modResults);
39
- return config;
40
- });
41
- return config;
42
- };
43
-
44
- exports.withRootViewBackgroundColor = withRootViewBackgroundColor;
45
-
46
- function setRootViewBackgroundColor(config, infoPlist) {
47
- const backgroundColor = getRootViewBackgroundColor(config);
48
-
49
- if (!backgroundColor) {
50
- delete infoPlist[BACKGROUND_COLOR_KEY];
51
- } else {
52
- let color = (0, _normalizeColor().default)(backgroundColor);
53
-
54
- if (!color) {
55
- throw new Error('Invalid background color on iOS');
56
- }
57
-
58
- color = (color << 24 | color >>> 8) >>> 0;
59
- infoPlist[BACKGROUND_COLOR_KEY] = color;
60
- }
61
-
62
- return infoPlist;
63
- }
64
-
65
- function getRootViewBackgroundColor(config) {
66
- var _config$ios;
67
-
68
- return ((_config$ios = config.ios) === null || _config$ios === void 0 ? void 0 : _config$ios.backgroundColor) || config.backgroundColor || null;
69
- }
70
- //# sourceMappingURL=RootViewBackgroundColor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/ios/RootViewBackgroundColor.ts"],"names":["BACKGROUND_COLOR_KEY","withRootViewBackgroundColor","config","modResults","setRootViewBackgroundColor","infoPlist","backgroundColor","getRootViewBackgroundColor","color","Error","ios"],"mappings":";;;;;;;;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAGA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;AAJA;AAOA;AACA,MAAMA,oBAAoB,GAAG,4BAA7B;;AAEO,MAAMC,2BAAyC,GAAGC,MAAM,IAAI;AACjEA,EAAAA,MAAM,GAAG,iCAAcA,MAAd,EAAsBA,MAAM,IAAI;AACvCA,IAAAA,MAAM,CAACC,UAAP,GAAoBC,0BAA0B,CAACF,MAAD,EAASA,MAAM,CAACC,UAAhB,CAA9C;AACA,WAAOD,MAAP;AACD,GAHQ,CAAT;AAIA,SAAOA,MAAP;AACD,CANM;;;;AAQA,SAASE,0BAAT,CACLF,MADK,EAELG,SAFK,EAGM;AACX,QAAMC,eAAe,GAAGC,0BAA0B,CAACL,MAAD,CAAlD;;AACA,MAAI,CAACI,eAAL,EAAsB;AACpB,WAAOD,SAAS,CAACL,oBAAD,CAAhB;AACD,GAFD,MAEO;AACL,QAAIQ,KAAK,GAAG,+BAAeF,eAAf,CAAZ;;AACA,QAAI,CAACE,KAAL,EAAY;AACV,YAAM,IAAIC,KAAJ,CAAU,iCAAV,CAAN;AACD;;AACDD,IAAAA,KAAK,GAAG,CAAEA,KAAK,IAAI,EAAV,GAAiBA,KAAK,KAAK,CAA5B,MAAoC,CAA5C;AACAH,IAAAA,SAAS,CAACL,oBAAD,CAAT,GAAkCQ,KAAlC;AACD;;AACD,SAAOH,SAAP;AACD;;AAEM,SAASE,0BAAT,CAAoCL,MAApC,EAAyF;AAAA;;AAC9F,SAAO,gBAAAA,MAAM,CAACQ,GAAP,4DAAYJ,eAAZ,KAA+BJ,MAAM,CAACI,eAAtC,IAAyD,IAAhE;AACD","sourcesContent":["import { ExpoConfig } from '@expo/config-types';\n// @ts-ignore: uses flow\nimport normalizeColor from '@react-native/normalize-color';\n\nimport { ConfigPlugin } from '../Plugin.types';\nimport { withInfoPlist } from '../plugins/ios-plugins';\nimport { InfoPlist } from './IosConfig.types';\n\n// Maps to the template AppDelegate.m\nconst BACKGROUND_COLOR_KEY = 'RCTRootViewBackgroundColor';\n\nexport const withRootViewBackgroundColor: ConfigPlugin = config => {\n config = withInfoPlist(config, config => {\n config.modResults = setRootViewBackgroundColor(config, config.modResults);\n return config;\n });\n return config;\n};\n\nexport function setRootViewBackgroundColor(\n config: Pick<ExpoConfig, 'backgroundColor' | 'ios'>,\n infoPlist: InfoPlist\n): InfoPlist {\n const backgroundColor = getRootViewBackgroundColor(config);\n if (!backgroundColor) {\n delete infoPlist[BACKGROUND_COLOR_KEY];\n } else {\n let color = normalizeColor(backgroundColor);\n if (!color) {\n throw new Error('Invalid background color on iOS');\n }\n color = ((color << 24) | (color >>> 8)) >>> 0;\n infoPlist[BACKGROUND_COLOR_KEY] = color;\n }\n return infoPlist;\n}\n\nexport function getRootViewBackgroundColor(config: Pick<ExpoConfig, 'ios' | 'backgroundColor'>) {\n return config.ios?.backgroundColor || config.backgroundColor || null;\n}\n"],"file":"RootViewBackgroundColor.js"}
@@ -1,5 +0,0 @@
1
- import { ExpoConfig } from '@expo/config-types';
2
- import { InfoPlist } from './IosConfig.types';
3
- export declare const withUserInterfaceStyle: import("..").ConfigPlugin<void>;
4
- export declare function getUserInterfaceStyle(config: Pick<ExpoConfig, 'ios' | 'userInterfaceStyle'>): string;
5
- export declare function setUserInterfaceStyle(config: Pick<ExpoConfig, 'ios' | 'userInterfaceStyle'>, { UIUserInterfaceStyle, ...infoPlist }: InfoPlist): InfoPlist;
@@ -1,59 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getUserInterfaceStyle = getUserInterfaceStyle;
7
- exports.setUserInterfaceStyle = setUserInterfaceStyle;
8
- exports.withUserInterfaceStyle = void 0;
9
-
10
- function _iosPlugins() {
11
- const data = require("../plugins/ios-plugins");
12
-
13
- _iosPlugins = function () {
14
- return data;
15
- };
16
-
17
- return data;
18
- }
19
-
20
- const withUserInterfaceStyle = (0, _iosPlugins().createInfoPlistPlugin)(setUserInterfaceStyle, 'withUserInterfaceStyle');
21
- exports.withUserInterfaceStyle = withUserInterfaceStyle;
22
-
23
- function getUserInterfaceStyle(config) {
24
- var _ref, _config$ios$userInter, _config$ios;
25
-
26
- return (_ref = (_config$ios$userInter = (_config$ios = config.ios) === null || _config$ios === void 0 ? void 0 : _config$ios.userInterfaceStyle) !== null && _config$ios$userInter !== void 0 ? _config$ios$userInter : config.userInterfaceStyle) !== null && _ref !== void 0 ? _ref : 'light';
27
- }
28
-
29
- function setUserInterfaceStyle(config, {
30
- UIUserInterfaceStyle,
31
- ...infoPlist
32
- }) {
33
- const userInterfaceStyle = getUserInterfaceStyle(config);
34
- const style = mapUserInterfaceStyleForInfoPlist(userInterfaceStyle);
35
-
36
- if (!style) {
37
- return infoPlist;
38
- }
39
-
40
- return { ...infoPlist,
41
- UIUserInterfaceStyle: style
42
- };
43
- }
44
-
45
- function mapUserInterfaceStyleForInfoPlist(userInterfaceStyle) {
46
- switch (userInterfaceStyle) {
47
- case 'light':
48
- return 'Light';
49
-
50
- case 'dark':
51
- return 'Dark';
52
-
53
- case 'automatic':
54
- return 'Automatic';
55
- }
56
-
57
- return null;
58
- }
59
- //# sourceMappingURL=UserInterfaceStyle.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/ios/UserInterfaceStyle.ts"],"names":["withUserInterfaceStyle","setUserInterfaceStyle","getUserInterfaceStyle","config","ios","userInterfaceStyle","UIUserInterfaceStyle","infoPlist","style","mapUserInterfaceStyleForInfoPlist"],"mappings":";;;;;;;;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAGO,MAAMA,sBAAsB,GAAG,yCACpCC,qBADoC,EAEpC,wBAFoC,CAA/B;;;AAKA,SAASC,qBAAT,CACLC,MADK,EAEG;AAAA;;AACR,yDAAOA,MAAM,CAACC,GAAd,gDAAO,YAAYC,kBAAnB,yEAAyCF,MAAM,CAACE,kBAAhD,uCAAsE,OAAtE;AACD;;AAEM,SAASJ,qBAAT,CACLE,MADK,EAEL;AAAEG,EAAAA,oBAAF;AAAwB,KAAGC;AAA3B,CAFK,EAGM;AACX,QAAMF,kBAAkB,GAAGH,qBAAqB,CAACC,MAAD,CAAhD;AACA,QAAMK,KAAK,GAAGC,iCAAiC,CAACJ,kBAAD,CAA/C;;AAEA,MAAI,CAACG,KAAL,EAAY;AACV,WAAOD,SAAP;AACD;;AAED,SAAO,EACL,GAAGA,SADE;AAELD,IAAAA,oBAAoB,EAAEE;AAFjB,GAAP;AAID;;AAED,SAASC,iCAAT,CAA2CJ,kBAA3C,EAA8F;AAC5F,UAAQA,kBAAR;AACE,SAAK,OAAL;AACE,aAAO,OAAP;;AACF,SAAK,MAAL;AACE,aAAO,MAAP;;AACF,SAAK,WAAL;AACE,aAAO,WAAP;AANJ;;AASA,SAAO,IAAP;AACD","sourcesContent":["import { ExpoConfig } from '@expo/config-types';\n\nimport { createInfoPlistPlugin } from '../plugins/ios-plugins';\nimport { InfoPlist, InterfaceStyle } from './IosConfig.types';\n\nexport const withUserInterfaceStyle = createInfoPlistPlugin(\n setUserInterfaceStyle,\n 'withUserInterfaceStyle'\n);\n\nexport function getUserInterfaceStyle(\n config: Pick<ExpoConfig, 'ios' | 'userInterfaceStyle'>\n): string {\n return config.ios?.userInterfaceStyle ?? config.userInterfaceStyle ?? 'light';\n}\n\nexport function setUserInterfaceStyle(\n config: Pick<ExpoConfig, 'ios' | 'userInterfaceStyle'>,\n { UIUserInterfaceStyle, ...infoPlist }: InfoPlist\n): InfoPlist {\n const userInterfaceStyle = getUserInterfaceStyle(config);\n const style = mapUserInterfaceStyleForInfoPlist(userInterfaceStyle);\n\n if (!style) {\n return infoPlist;\n }\n\n return {\n ...infoPlist,\n UIUserInterfaceStyle: style,\n };\n}\n\nfunction mapUserInterfaceStyleForInfoPlist(userInterfaceStyle: string): InterfaceStyle | null {\n switch (userInterfaceStyle) {\n case 'light':\n return 'Light';\n case 'dark':\n return 'Dark';\n case 'automatic':\n return 'Automatic';\n }\n\n return null;\n}\n"],"file":"UserInterfaceStyle.js"}