@expo/config-plugins
Advanced tools
Comparing version 8.1.0-canary-20240912-1059f85 to 8.1.0-canary-20240927-ab8a962
@@ -13,2 +13,3 @@ import { Resources } from '.'; | ||
UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY = "expo.modules.updates.UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY", | ||
UPDATES_HAS_EMBEDDED_UPDATE = "expo.modules.updates.HAS_EMBEDDED_UPDATE", | ||
CODE_SIGNING_CERTIFICATE = "expo.modules.updates.CODE_SIGNING_CERTIFICATE", | ||
@@ -15,0 +16,0 @@ CODE_SIGNING_METADATA = "expo.modules.updates.CODE_SIGNING_METADATA" |
@@ -54,2 +54,9 @@ "use strict"; | ||
} | ||
function _warnings() { | ||
const data = require("../utils/warnings"); | ||
_warnings = function () { | ||
return data; | ||
}; | ||
return data; | ||
} | ||
let Config = exports.Config = /*#__PURE__*/function (Config) { | ||
@@ -62,2 +69,3 @@ Config["ENABLED"] = "expo.modules.updates.ENABLED"; | ||
Config["UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY"] = "expo.modules.updates.UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY"; | ||
Config["UPDATES_HAS_EMBEDDED_UPDATE"] = "expo.modules.updates.HAS_EMBEDDED_UPDATE"; | ||
Config["CODE_SIGNING_CERTIFICATE"] = "expo.modules.updates.CODE_SIGNING_CERTIFICATE"; | ||
@@ -98,4 +106,16 @@ Config["CODE_SIGNING_METADATA"] = "expo.modules.updates.CODE_SIGNING_METADATA"; | ||
(0, _Manifest().addMetaDataItemToMainApplication)(mainApplication, Config.ENABLED, String((0, _Updates().getUpdatesEnabled)(config))); | ||
(0, _Manifest().addMetaDataItemToMainApplication)(mainApplication, Config.CHECK_ON_LAUNCH, (0, _Updates().getUpdatesCheckOnLaunch)(config, expoUpdatesPackageVersion)); | ||
(0, _Manifest().addMetaDataItemToMainApplication)(mainApplication, Config.LAUNCH_WAIT_MS, String((0, _Updates().getUpdatesTimeout)(config))); | ||
const checkOnLaunch = (0, _Updates().getUpdatesCheckOnLaunch)(config, expoUpdatesPackageVersion); | ||
(0, _Manifest().addMetaDataItemToMainApplication)(mainApplication, Config.CHECK_ON_LAUNCH, checkOnLaunch); | ||
const timeout = (0, _Updates().getUpdatesTimeout)(config); | ||
(0, _Manifest().addMetaDataItemToMainApplication)(mainApplication, Config.LAUNCH_WAIT_MS, String(timeout)); | ||
const useEmbeddedUpdate = (0, _Updates().getUpdatesUseEmbeddedUpdate)(config); | ||
if (useEmbeddedUpdate) { | ||
(0, _Manifest().removeMetaDataItemFromMainApplication)(mainApplication, Config.UPDATES_HAS_EMBEDDED_UPDATE); | ||
} else { | ||
// TODO: is there a better place for this validation? | ||
if (timeout === 0 && checkOnLaunch !== 'ALWAYS') { | ||
(0, _warnings().addWarningAndroid)('updates.useEmbeddedUpdate', `updates.checkOnLaunch should be set to "ON_LOAD" and updates.fallbackToCacheTimeout should be set to a non-zero value when updates.useEmbeddedUpdate is set to false. This is because an update must be fetched on the initial launch, when no embedded update is available.`); | ||
} | ||
(0, _Manifest().addMetaDataItemToMainApplication)(mainApplication, Config.UPDATES_HAS_EMBEDDED_UPDATE, 'false'); | ||
} | ||
const updateUrl = (0, _Updates().getUpdateUrl)(config); | ||
@@ -102,0 +122,0 @@ if (updateUrl) { |
@@ -37,2 +37,3 @@ import { JSONValue } from '@expo/json-file'; | ||
EXUpdatesEnabled?: boolean; | ||
EXUpdatesHasEmbeddedUpdate?: boolean; | ||
EXUpdatesLaunchWaitMs?: number; | ||
@@ -39,0 +40,0 @@ EXUpdatesRuntimeVersion?: string; |
@@ -30,5 +30,5 @@ "use strict"; | ||
} | ||
function _Xcodeproj() { | ||
const data = require("./utils/Xcodeproj"); | ||
_Xcodeproj = function () { | ||
function _() { | ||
const data = require(".."); | ||
_ = function () { | ||
return data; | ||
@@ -38,5 +38,5 @@ }; | ||
} | ||
function _() { | ||
const data = require(".."); | ||
_ = function () { | ||
function _Xcodeproj() { | ||
const data = require("./utils/Xcodeproj"); | ||
_Xcodeproj = function () { | ||
return data; | ||
@@ -43,0 +43,0 @@ }; |
@@ -11,2 +11,3 @@ import { ExpoPlist } from './IosConfig.types'; | ||
UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY = "EXUpdatesRequestHeaders", | ||
UPDATES_HAS_EMBEDDED_UPDATE = "EXUpdatesHasEmbeddedUpdate", | ||
CODE_SIGNING_CERTIFICATE = "EXUpdatesCodeSigningCertificate", | ||
@@ -13,0 +14,0 @@ CODE_SIGNING_METADATA = "EXUpdatesCodeSigningMetadata" |
@@ -24,2 +24,9 @@ "use strict"; | ||
} | ||
function _warnings() { | ||
const data = require("../utils/warnings"); | ||
_warnings = function () { | ||
return data; | ||
}; | ||
return data; | ||
} | ||
let Config = exports.Config = /*#__PURE__*/function (Config) { | ||
@@ -32,2 +39,3 @@ Config["ENABLED"] = "EXUpdatesEnabled"; | ||
Config["UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY"] = "EXUpdatesRequestHeaders"; | ||
Config["UPDATES_HAS_EMBEDDED_UPDATE"] = "EXUpdatesHasEmbeddedUpdate"; | ||
Config["CODE_SIGNING_CERTIFICATE"] = "EXUpdatesCodeSigningCertificate"; | ||
@@ -48,8 +56,26 @@ Config["CODE_SIGNING_METADATA"] = "EXUpdatesCodeSigningMetadata"; | ||
async function setUpdatesConfigAsync(projectRoot, config, expoPlist, expoUpdatesPackageVersion) { | ||
const checkOnLaunch = (0, _Updates().getUpdatesCheckOnLaunch)(config, expoUpdatesPackageVersion); | ||
const timeout = (0, _Updates().getUpdatesTimeout)(config); | ||
const useEmbeddedUpdate = (0, _Updates().getUpdatesUseEmbeddedUpdate)(config); | ||
// TODO: is there a better place for this validation? | ||
if (!useEmbeddedUpdate && timeout === 0 && checkOnLaunch !== 'ALWAYS') { | ||
(0, _warnings().addWarningIOS)('updates.useEmbeddedUpdate', `updates.checkOnLaunch should be set to "ON_LOAD" and updates.fallbackToCacheTimeout should be set to a non-zero value when updates.useEmbeddedUpdate is set to false. This is because an update must be fetched on the initial launch, when no embedded update is available.`); | ||
} | ||
const newExpoPlist = { | ||
...expoPlist, | ||
[Config.ENABLED]: (0, _Updates().getUpdatesEnabled)(config), | ||
[Config.CHECK_ON_LAUNCH]: (0, _Updates().getUpdatesCheckOnLaunch)(config, expoUpdatesPackageVersion), | ||
[Config.LAUNCH_WAIT_MS]: (0, _Updates().getUpdatesTimeout)(config) | ||
[Config.CHECK_ON_LAUNCH]: checkOnLaunch, | ||
[Config.LAUNCH_WAIT_MS]: timeout | ||
}; | ||
// The native config name is "has embedded update", but we want to expose | ||
// this to the user as "use embedded update", since this is more accurate. | ||
// The field does not disable actually building and embedding the update, | ||
// only whether it is actually used. | ||
if (useEmbeddedUpdate) { | ||
delete newExpoPlist[Config.UPDATES_HAS_EMBEDDED_UPDATE]; | ||
} else { | ||
newExpoPlist[Config.UPDATES_HAS_EMBEDDED_UPDATE] = false; | ||
} | ||
const updateUrl = (0, _Updates().getUpdateUrl)(config); | ||
@@ -56,0 +82,0 @@ if (updateUrl) { |
@@ -1,7 +0,7 @@ | ||
declare const LEFT_BRACKETS: readonly ["(", "{"]; | ||
declare const RIGHT_BRACKETS: readonly [")", "}"]; | ||
type LeftBracket = (typeof LEFT_BRACKETS)[number]; | ||
type RightBracket = (typeof RIGHT_BRACKETS)[number]; | ||
type LeftBrackets = ['(', '{']; | ||
type RightBrackets = [')', '}']; | ||
type LeftBracket = LeftBrackets[number]; | ||
type RightBracket = RightBrackets[number]; | ||
type Bracket = LeftBracket | RightBracket; | ||
export declare function findMatchingBracketPosition(contents: string, bracket: Bracket, offset?: number): number; | ||
export {}; |
@@ -7,4 +7,2 @@ "use strict"; | ||
exports.findMatchingBracketPosition = findMatchingBracketPosition; | ||
const LEFT_BRACKETS = ['(', '{']; | ||
const RIGHT_BRACKETS = [')', '}']; | ||
function findMatchingBracketPosition(contents, bracket, offset = 0) { | ||
@@ -49,3 +47,3 @@ // search first occurrence of `bracket` | ||
function isLeftBracket(bracket) { | ||
const leftBracketList = LEFT_BRACKETS; | ||
const leftBracketList = ['(', '{']; | ||
return leftBracketList.includes(bracket); | ||
@@ -52,0 +50,0 @@ } |
@@ -22,2 +22,3 @@ import { Android, ExpoConfig, IOS } from '@expo/config-types'; | ||
export declare function getUpdatesEnabled(config: Pick<ExpoConfigUpdates, 'updates'>): boolean; | ||
export declare function getUpdatesUseEmbeddedUpdate(config: Pick<ExpoConfigUpdates, 'updates'>): boolean; | ||
export declare function getUpdatesTimeout(config: Pick<ExpoConfigUpdates, 'updates'>): number; | ||
@@ -24,0 +25,0 @@ export declare function getUpdatesCheckOnLaunch(config: Pick<ExpoConfigUpdates, 'updates'>, expoUpdatesPackageVersion?: string | null): 'NEVER' | 'ERROR_RECOVERY_ONLY' | 'ALWAYS' | 'WIFI_ONLY'; |
@@ -22,2 +22,3 @@ "use strict"; | ||
exports.getUpdatesTimeout = getUpdatesTimeout; | ||
exports.getUpdatesUseEmbeddedUpdate = getUpdatesUseEmbeddedUpdate; | ||
exports.resolveRuntimeVersionPolicyAsync = resolveRuntimeVersionPolicyAsync; | ||
@@ -161,2 +162,8 @@ function _sdkRuntimeVersions() { | ||
} | ||
function getUpdatesUseEmbeddedUpdate(config) { | ||
if (config.updates?.useEmbeddedUpdate !== undefined) { | ||
return config.updates.useEmbeddedUpdate; | ||
} | ||
return true; | ||
} | ||
function getUpdatesTimeout(config) { | ||
@@ -163,0 +170,0 @@ return config.updates?.fallbackToCacheTimeout ?? 0; |
{ | ||
"name": "@expo/config-plugins", | ||
"version": "8.1.0-canary-20240912-1059f85", | ||
"version": "8.1.0-canary-20240927-ab8a962", | ||
"description": "A library for Expo config plugins", | ||
@@ -36,5 +36,5 @@ "main": "build/index.js", | ||
"dependencies": { | ||
"@expo/config-types": "52.0.0-canary-20240912-1059f85", | ||
"@expo/json-file": "8.3.4-canary-20240912-1059f85", | ||
"@expo/plist": "0.1.4-canary-20240912-1059f85", | ||
"@expo/config-types": "52.0.0-canary-20240927-ab8a962", | ||
"@expo/json-file": "8.4.0-canary-20240927-ab8a962", | ||
"@expo/plist": "0.1.4-canary-20240927-ab8a962", | ||
"@expo/sdk-runtime-versions": "^1.0.0", | ||
@@ -57,3 +57,3 @@ "chalk": "^4.1.2", | ||
"@types/xml2js": "~0.4.11", | ||
"expo-module-scripts": "3.6.0-canary-20240912-1059f85" | ||
"expo-module-scripts": "3.6.0-canary-20240927-ab8a962" | ||
}, | ||
@@ -63,3 +63,3 @@ "publishConfig": { | ||
}, | ||
"gitHead": "1059f8556047a3e02fa319e8b2459274571f4e6f" | ||
"gitHead": "ab8a962d2c3dddbda124a6bd88d24475831dae00" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1125145
13136
+ Added@expo/config-types@52.0.0-canary-20240927-ab8a962(transitive)
+ Added@expo/json-file@8.4.0-canary-20240927-ab8a962(transitive)
+ Added@expo/plist@0.1.4-canary-20240927-ab8a962(transitive)
- Removed@expo/config-types@52.0.0-canary-20240912-1059f85(transitive)
- Removed@expo/json-file@8.3.4-canary-20240912-1059f85(transitive)
- Removed@expo/plist@0.1.4-canary-20240912-1059f85(transitive)