@expo/config-plugins 56.0.5 → 56.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/build/android/Updates.js +1 -6
- package/build/android/Updates.js.map +1 -1
- package/build/ios/Maps.js +7 -7
- package/build/ios/Maps.js.map +1 -1
- package/build/ios/Updates.js +1 -6
- package/build/ios/Updates.js.map +1 -1
- package/build/utils/Updates.js +10 -10
- package/build/utils/Updates.js.map +1 -1
- package/build/utils/modules.js +22 -1
- package/build/utils/modules.js.map +1 -1
- package/build/utils/plugin-resolver.d.ts +1 -1
- package/build/utils/plugin-resolver.js +31 -59
- package/build/utils/plugin-resolver.js.map +1 -1
- package/package.json +6 -6
package/build/android/Updates.js
CHANGED
|
@@ -162,12 +162,7 @@ async function setUpdatesConfigAsync(projectRoot, config, androidManifest, expoU
|
|
|
162
162
|
} else {
|
|
163
163
|
(0, _Manifest().removeMetaDataItemFromMainApplication)(mainApplication, Config.DISABLE_ANTI_BRICKING_MEASURES);
|
|
164
164
|
}
|
|
165
|
-
|
|
166
|
-
if (bsPatchSupport) {
|
|
167
|
-
(0, _Manifest().addMetaDataItemToMainApplication)(mainApplication, Config.BSDIFF_PATCH_SUPPORT, 'true');
|
|
168
|
-
} else {
|
|
169
|
-
(0, _Manifest().removeMetaDataItemFromMainApplication)(mainApplication, Config.BSDIFF_PATCH_SUPPORT);
|
|
170
|
-
}
|
|
165
|
+
(0, _Manifest().addMetaDataItemToMainApplication)(mainApplication, Config.BSDIFF_PATCH_SUPPORT, (0, _Updates().getUpdatesBsdiffPatchSupportEnabled)(config) ? 'true' : 'false');
|
|
171
166
|
return await setVersionsConfigAsync(projectRoot, config, androidManifest);
|
|
172
167
|
}
|
|
173
168
|
async function setVersionsConfigAsync(projectRoot, config, androidManifest) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Updates.js","names":["_BuildProperties","data","require","_Manifest","_Resources","_Strings","_androidPlugins","_withPlugins","_Updates","_warnings","Config","exports","withUpdates","config","withPlugins","withUpdatesManifest","withRuntimeVersionResource","withUpdatesNativeDebugGradleProps","createBuildGradlePropsConfigPlugin","propName","propValueGetter","updates","useNativeDebug","undefined","withAndroidManifest","projectRoot","modRequest","expoUpdatesPackageVersion","getExpoUpdatesPackageVersion","modResults","setUpdatesConfigAsync","createStringsXmlPlugin","applyRuntimeVersionFromConfigAsync","stringsJSON","applyRuntimeVersionFromConfigForProjectRootAsync","runtimeVersion","getRuntimeVersionNullableAsync","setStringItem","buildResourceItem","name","value","removeStringItem","androidManifest","mainApplication","getMainApplicationOrThrow","addMetaDataItemToMainApplication","ENABLED","String","getUpdatesEnabled","checkOnLaunch","getUpdatesCheckOnLaunch","CHECK_ON_LAUNCH","timeout","getUpdatesTimeout","LAUNCH_WAIT_MS","useEmbeddedUpdate","getUpdatesUseEmbeddedUpdate","removeMetaDataItemFromMainApplication","UPDATES_HAS_EMBEDDED_UPDATE","addWarningAndroid","updateUrl","getUpdateUrl","UPDATE_URL","codeSigningCertificate","getUpdatesCodeSigningCertificate","CODE_SIGNING_CERTIFICATE","codeSigningMetadata","getUpdatesCodeSigningMetadataStringified","CODE_SIGNING_METADATA","requestHeaders","getUpdatesRequestHeadersStringified","UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY","disableAntiBrickingMeasures","getDisableAntiBrickingMeasures","DISABLE_ANTI_BRICKING_MEASURES","bsPatchSupport","getUpdatesBsdiffPatchSupportEnabled","BSDIFF_PATCH_SUPPORT","setVersionsConfigAsync","findMetaDataItem","RUNTIME_VERSION","Error"],"sources":["../../src/android/Updates.ts"],"sourcesContent":["import type { ExpoConfig } from '@expo/config-types';\n\nimport { createBuildGradlePropsConfigPlugin } from './BuildProperties';\nimport type { AndroidManifest } from './Manifest';\nimport {\n addMetaDataItemToMainApplication,\n findMetaDataItem,\n getMainApplicationOrThrow,\n removeMetaDataItemFromMainApplication,\n} from './Manifest';\nimport { buildResourceItem, type ResourceXML } from './Resources';\nimport { removeStringItem, setStringItem } from './Strings';\nimport type { ConfigPlugin, ExportedConfigWithProps } from '../Plugin.types';\nimport { createStringsXmlPlugin, withAndroidManifest } from '../plugins/android-plugins';\nimport { withPlugins } from '../plugins/withPlugins';\nimport type { ExpoConfigUpdates } from '../utils/Updates';\nimport {\n getDisableAntiBrickingMeasures,\n getExpoUpdatesPackageVersion,\n getRuntimeVersionNullableAsync,\n getUpdatesCheckOnLaunch,\n getUpdatesCodeSigningCertificate,\n getUpdatesCodeSigningMetadataStringified,\n getUpdatesRequestHeadersStringified,\n getUpdatesEnabled,\n getUpdatesTimeout,\n getUpdateUrl,\n getUpdatesBsdiffPatchSupportEnabled,\n getUpdatesUseEmbeddedUpdate,\n} from '../utils/Updates';\nimport { addWarningAndroid } from '../utils/warnings';\n\nexport enum Config {\n ENABLED = 'expo.modules.updates.ENABLED',\n CHECK_ON_LAUNCH = 'expo.modules.updates.EXPO_UPDATES_CHECK_ON_LAUNCH',\n LAUNCH_WAIT_MS = 'expo.modules.updates.EXPO_UPDATES_LAUNCH_WAIT_MS',\n RUNTIME_VERSION = 'expo.modules.updates.EXPO_RUNTIME_VERSION',\n UPDATE_URL = 'expo.modules.updates.EXPO_UPDATE_URL',\n UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY = 'expo.modules.updates.UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY',\n UPDATES_HAS_EMBEDDED_UPDATE = 'expo.modules.updates.HAS_EMBEDDED_UPDATE',\n CODE_SIGNING_CERTIFICATE = 'expo.modules.updates.CODE_SIGNING_CERTIFICATE',\n CODE_SIGNING_METADATA = 'expo.modules.updates.CODE_SIGNING_METADATA',\n DISABLE_ANTI_BRICKING_MEASURES = 'expo.modules.updates.DISABLE_ANTI_BRICKING_MEASURES',\n BSDIFF_PATCH_SUPPORT = 'expo.modules.updates.ENABLE_BSDIFF_PATCH_SUPPORT',\n}\n\n// when making changes to this config plugin, ensure the same changes are also made in eas-cli and build-tools\n// Also ensure the docs are up-to-date: https://docs.expo.dev/bare/installing-updates/\n\nexport const withUpdates: ConfigPlugin = (config) => {\n return withPlugins(config, [\n withUpdatesManifest,\n withRuntimeVersionResource,\n withUpdatesNativeDebugGradleProps,\n ]);\n};\n\n/**\n * A config-plugin to update `android/gradle.properties` from the `updates.useNativeDebug` in expo config\n */\nconst withUpdatesNativeDebugGradleProps = createBuildGradlePropsConfigPlugin<ExpoConfig>(\n [\n {\n propName: 'EX_UPDATES_NATIVE_DEBUG',\n propValueGetter: (config) => (config?.updates?.useNativeDebug === true ? 'true' : undefined),\n },\n ],\n 'withUpdatesNativeDebugGradleProps'\n);\n\nconst withUpdatesManifest: ConfigPlugin = (config) => {\n return withAndroidManifest(config, async (config) => {\n const projectRoot = config.modRequest.projectRoot;\n const expoUpdatesPackageVersion = getExpoUpdatesPackageVersion(projectRoot);\n config.modResults = await setUpdatesConfigAsync(\n projectRoot,\n config,\n config.modResults,\n expoUpdatesPackageVersion\n );\n return config;\n });\n};\n\nconst withRuntimeVersionResource = createStringsXmlPlugin(\n applyRuntimeVersionFromConfigAsync,\n 'withRuntimeVersionResource'\n);\n\nexport async function applyRuntimeVersionFromConfigAsync(\n config: ExportedConfigWithProps<ResourceXML>,\n stringsJSON: ResourceXML\n): Promise<ResourceXML> {\n const projectRoot = config.modRequest.projectRoot;\n return await applyRuntimeVersionFromConfigForProjectRootAsync(projectRoot, config, stringsJSON);\n}\n\nexport async function applyRuntimeVersionFromConfigForProjectRootAsync(\n projectRoot: string,\n config: ExpoConfigUpdates,\n stringsJSON: ResourceXML\n): Promise<ResourceXML> {\n const runtimeVersion = await getRuntimeVersionNullableAsync(projectRoot, config, 'android');\n if (runtimeVersion) {\n return setStringItem(\n [buildResourceItem({ name: 'expo_runtime_version', value: runtimeVersion })],\n stringsJSON\n );\n }\n return removeStringItem('expo_runtime_version', stringsJSON);\n}\n\nexport async function setUpdatesConfigAsync(\n projectRoot: string,\n config: ExpoConfigUpdates,\n androidManifest: AndroidManifest,\n expoUpdatesPackageVersion?: string | null\n): Promise<AndroidManifest> {\n const mainApplication = getMainApplicationOrThrow(androidManifest);\n\n addMetaDataItemToMainApplication(\n mainApplication,\n Config.ENABLED,\n String(getUpdatesEnabled(config))\n );\n const checkOnLaunch = getUpdatesCheckOnLaunch(config, expoUpdatesPackageVersion);\n addMetaDataItemToMainApplication(mainApplication, Config.CHECK_ON_LAUNCH, checkOnLaunch);\n\n const timeout = getUpdatesTimeout(config);\n addMetaDataItemToMainApplication(mainApplication, Config.LAUNCH_WAIT_MS, String(timeout));\n\n const useEmbeddedUpdate = getUpdatesUseEmbeddedUpdate(config);\n if (useEmbeddedUpdate) {\n removeMetaDataItemFromMainApplication(mainApplication, Config.UPDATES_HAS_EMBEDDED_UPDATE);\n } else {\n // TODO: is there a better place for this validation?\n if (timeout === 0 && checkOnLaunch !== 'ALWAYS') {\n addWarningAndroid(\n 'updates.useEmbeddedUpdate',\n `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.`\n );\n }\n addMetaDataItemToMainApplication(mainApplication, Config.UPDATES_HAS_EMBEDDED_UPDATE, 'false');\n }\n\n const updateUrl = getUpdateUrl(config);\n if (updateUrl) {\n addMetaDataItemToMainApplication(mainApplication, Config.UPDATE_URL, updateUrl);\n } else {\n removeMetaDataItemFromMainApplication(mainApplication, Config.UPDATE_URL);\n }\n\n const codeSigningCertificate = getUpdatesCodeSigningCertificate(projectRoot, config);\n if (codeSigningCertificate) {\n addMetaDataItemToMainApplication(\n mainApplication,\n Config.CODE_SIGNING_CERTIFICATE,\n codeSigningCertificate\n );\n } else {\n removeMetaDataItemFromMainApplication(mainApplication, Config.CODE_SIGNING_CERTIFICATE);\n }\n\n const codeSigningMetadata = getUpdatesCodeSigningMetadataStringified(config);\n if (codeSigningMetadata) {\n addMetaDataItemToMainApplication(\n mainApplication,\n Config.CODE_SIGNING_METADATA,\n codeSigningMetadata\n );\n } else {\n removeMetaDataItemFromMainApplication(mainApplication, Config.CODE_SIGNING_METADATA);\n }\n\n const requestHeaders = getUpdatesRequestHeadersStringified(config);\n if (requestHeaders) {\n addMetaDataItemToMainApplication(\n mainApplication,\n Config.UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY,\n requestHeaders\n );\n } else {\n removeMetaDataItemFromMainApplication(\n mainApplication,\n Config.UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY\n );\n }\n\n const disableAntiBrickingMeasures = getDisableAntiBrickingMeasures(config);\n if (disableAntiBrickingMeasures) {\n addMetaDataItemToMainApplication(\n mainApplication,\n Config.DISABLE_ANTI_BRICKING_MEASURES,\n 'true'\n );\n } else {\n removeMetaDataItemFromMainApplication(mainApplication, Config.DISABLE_ANTI_BRICKING_MEASURES);\n }\n\n const bsPatchSupport = getUpdatesBsdiffPatchSupportEnabled(config);\n if (bsPatchSupport) {\n addMetaDataItemToMainApplication(mainApplication, Config.BSDIFF_PATCH_SUPPORT, 'true');\n } else {\n removeMetaDataItemFromMainApplication(mainApplication, Config.BSDIFF_PATCH_SUPPORT);\n }\n\n return await setVersionsConfigAsync(projectRoot, config, androidManifest);\n}\n\nexport async function setVersionsConfigAsync(\n projectRoot: string,\n config: Pick<ExpoConfigUpdates, 'sdkVersion' | 'runtimeVersion'>,\n androidManifest: AndroidManifest\n): Promise<AndroidManifest> {\n const mainApplication = getMainApplicationOrThrow(androidManifest);\n\n const runtimeVersion = await getRuntimeVersionNullableAsync(projectRoot, config, 'android');\n if (!runtimeVersion && findMetaDataItem(mainApplication, Config.RUNTIME_VERSION) > -1) {\n throw new Error(\n 'A runtime version is set in your AndroidManifest.xml, but is missing from your Expo app config (app.json/app.config.js). Either set runtimeVersion in your Expo app config or remove expo.modules.updates.EXPO_RUNTIME_VERSION from your AndroidManifest.xml.'\n );\n }\n if (runtimeVersion) {\n removeMetaDataItemFromMainApplication(mainApplication, 'expo.modules.updates.EXPO_SDK_VERSION');\n addMetaDataItemToMainApplication(\n mainApplication,\n Config.RUNTIME_VERSION,\n '@string/expo_runtime_version'\n );\n } else {\n removeMetaDataItemFromMainApplication(mainApplication, Config.RUNTIME_VERSION);\n removeMetaDataItemFromMainApplication(mainApplication, 'expo.modules.updates.EXPO_SDK_VERSION');\n }\n\n return androidManifest;\n}\n"],"mappings":";;;;;;;;;;;AAEA,SAAAA,iBAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,gBAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAE,UAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,SAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAMA,SAAAG,WAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,UAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,SAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,QAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAK,gBAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,eAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,aAAA;EAAA,MAAAN,IAAA,GAAAC,OAAA;EAAAK,YAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAO,SAAA;EAAA,MAAAP,IAAA,GAAAC,OAAA;EAAAM,QAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAcA,SAAAQ,UAAA;EAAA,MAAAR,IAAA,GAAAC,OAAA;EAAAO,SAAA,YAAAA,CAAA;IAAA,OAAAR,IAAA;EAAA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C/F,IAAAE,4CAAgC,EAC9BF,eAAe,EACfjC,MAAM,CAACsE,eAAe,EACtB,8BACF,CAAC;EACH,CAAC,MAAM;IACL,IAAAvB,iDAAqC,EAACd,eAAe,EAAEjC,MAAM,CAACsE,eAAe,CAAC;IAC9E,IAAAvB,iDAAqC,EAACd,eAAe,EAAE,uCAAuC,CAAC;EACjG;EAEA,OAAOD,eAAe;AACxB","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"Updates.js","names":["_BuildProperties","data","require","_Manifest","_Resources","_Strings","_androidPlugins","_withPlugins","_Updates","_warnings","Config","exports","withUpdates","config","withPlugins","withUpdatesManifest","withRuntimeVersionResource","withUpdatesNativeDebugGradleProps","createBuildGradlePropsConfigPlugin","propName","propValueGetter","updates","useNativeDebug","undefined","withAndroidManifest","projectRoot","modRequest","expoUpdatesPackageVersion","getExpoUpdatesPackageVersion","modResults","setUpdatesConfigAsync","createStringsXmlPlugin","applyRuntimeVersionFromConfigAsync","stringsJSON","applyRuntimeVersionFromConfigForProjectRootAsync","runtimeVersion","getRuntimeVersionNullableAsync","setStringItem","buildResourceItem","name","value","removeStringItem","androidManifest","mainApplication","getMainApplicationOrThrow","addMetaDataItemToMainApplication","ENABLED","String","getUpdatesEnabled","checkOnLaunch","getUpdatesCheckOnLaunch","CHECK_ON_LAUNCH","timeout","getUpdatesTimeout","LAUNCH_WAIT_MS","useEmbeddedUpdate","getUpdatesUseEmbeddedUpdate","removeMetaDataItemFromMainApplication","UPDATES_HAS_EMBEDDED_UPDATE","addWarningAndroid","updateUrl","getUpdateUrl","UPDATE_URL","codeSigningCertificate","getUpdatesCodeSigningCertificate","CODE_SIGNING_CERTIFICATE","codeSigningMetadata","getUpdatesCodeSigningMetadataStringified","CODE_SIGNING_METADATA","requestHeaders","getUpdatesRequestHeadersStringified","UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY","disableAntiBrickingMeasures","getDisableAntiBrickingMeasures","DISABLE_ANTI_BRICKING_MEASURES","BSDIFF_PATCH_SUPPORT","getUpdatesBsdiffPatchSupportEnabled","setVersionsConfigAsync","findMetaDataItem","RUNTIME_VERSION","Error"],"sources":["../../src/android/Updates.ts"],"sourcesContent":["import type { ExpoConfig } from '@expo/config-types';\n\nimport { createBuildGradlePropsConfigPlugin } from './BuildProperties';\nimport type { AndroidManifest } from './Manifest';\nimport {\n addMetaDataItemToMainApplication,\n findMetaDataItem,\n getMainApplicationOrThrow,\n removeMetaDataItemFromMainApplication,\n} from './Manifest';\nimport { buildResourceItem, type ResourceXML } from './Resources';\nimport { removeStringItem, setStringItem } from './Strings';\nimport type { ConfigPlugin, ExportedConfigWithProps } from '../Plugin.types';\nimport { createStringsXmlPlugin, withAndroidManifest } from '../plugins/android-plugins';\nimport { withPlugins } from '../plugins/withPlugins';\nimport type { ExpoConfigUpdates } from '../utils/Updates';\nimport {\n getDisableAntiBrickingMeasures,\n getExpoUpdatesPackageVersion,\n getRuntimeVersionNullableAsync,\n getUpdatesCheckOnLaunch,\n getUpdatesCodeSigningCertificate,\n getUpdatesCodeSigningMetadataStringified,\n getUpdatesRequestHeadersStringified,\n getUpdatesEnabled,\n getUpdatesTimeout,\n getUpdateUrl,\n getUpdatesBsdiffPatchSupportEnabled,\n getUpdatesUseEmbeddedUpdate,\n} from '../utils/Updates';\nimport { addWarningAndroid } from '../utils/warnings';\n\nexport enum Config {\n ENABLED = 'expo.modules.updates.ENABLED',\n CHECK_ON_LAUNCH = 'expo.modules.updates.EXPO_UPDATES_CHECK_ON_LAUNCH',\n LAUNCH_WAIT_MS = 'expo.modules.updates.EXPO_UPDATES_LAUNCH_WAIT_MS',\n RUNTIME_VERSION = 'expo.modules.updates.EXPO_RUNTIME_VERSION',\n UPDATE_URL = 'expo.modules.updates.EXPO_UPDATE_URL',\n UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY = 'expo.modules.updates.UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY',\n UPDATES_HAS_EMBEDDED_UPDATE = 'expo.modules.updates.HAS_EMBEDDED_UPDATE',\n CODE_SIGNING_CERTIFICATE = 'expo.modules.updates.CODE_SIGNING_CERTIFICATE',\n CODE_SIGNING_METADATA = 'expo.modules.updates.CODE_SIGNING_METADATA',\n DISABLE_ANTI_BRICKING_MEASURES = 'expo.modules.updates.DISABLE_ANTI_BRICKING_MEASURES',\n BSDIFF_PATCH_SUPPORT = 'expo.modules.updates.ENABLE_BSDIFF_PATCH_SUPPORT',\n}\n\n// when making changes to this config plugin, ensure the same changes are also made in eas-cli and build-tools\n// Also ensure the docs are up-to-date: https://docs.expo.dev/bare/installing-updates/\n\nexport const withUpdates: ConfigPlugin = (config) => {\n return withPlugins(config, [\n withUpdatesManifest,\n withRuntimeVersionResource,\n withUpdatesNativeDebugGradleProps,\n ]);\n};\n\n/**\n * A config-plugin to update `android/gradle.properties` from the `updates.useNativeDebug` in expo config\n */\nconst withUpdatesNativeDebugGradleProps = createBuildGradlePropsConfigPlugin<ExpoConfig>(\n [\n {\n propName: 'EX_UPDATES_NATIVE_DEBUG',\n propValueGetter: (config) => (config?.updates?.useNativeDebug === true ? 'true' : undefined),\n },\n ],\n 'withUpdatesNativeDebugGradleProps'\n);\n\nconst withUpdatesManifest: ConfigPlugin = (config) => {\n return withAndroidManifest(config, async (config) => {\n const projectRoot = config.modRequest.projectRoot;\n const expoUpdatesPackageVersion = getExpoUpdatesPackageVersion(projectRoot);\n config.modResults = await setUpdatesConfigAsync(\n projectRoot,\n config,\n config.modResults,\n expoUpdatesPackageVersion\n );\n return config;\n });\n};\n\nconst withRuntimeVersionResource = createStringsXmlPlugin(\n applyRuntimeVersionFromConfigAsync,\n 'withRuntimeVersionResource'\n);\n\nexport async function applyRuntimeVersionFromConfigAsync(\n config: ExportedConfigWithProps<ResourceXML>,\n stringsJSON: ResourceXML\n): Promise<ResourceXML> {\n const projectRoot = config.modRequest.projectRoot;\n return await applyRuntimeVersionFromConfigForProjectRootAsync(projectRoot, config, stringsJSON);\n}\n\nexport async function applyRuntimeVersionFromConfigForProjectRootAsync(\n projectRoot: string,\n config: ExpoConfigUpdates,\n stringsJSON: ResourceXML\n): Promise<ResourceXML> {\n const runtimeVersion = await getRuntimeVersionNullableAsync(projectRoot, config, 'android');\n if (runtimeVersion) {\n return setStringItem(\n [buildResourceItem({ name: 'expo_runtime_version', value: runtimeVersion })],\n stringsJSON\n );\n }\n return removeStringItem('expo_runtime_version', stringsJSON);\n}\n\nexport async function setUpdatesConfigAsync(\n projectRoot: string,\n config: ExpoConfigUpdates,\n androidManifest: AndroidManifest,\n expoUpdatesPackageVersion?: string | null\n): Promise<AndroidManifest> {\n const mainApplication = getMainApplicationOrThrow(androidManifest);\n\n addMetaDataItemToMainApplication(\n mainApplication,\n Config.ENABLED,\n String(getUpdatesEnabled(config))\n );\n const checkOnLaunch = getUpdatesCheckOnLaunch(config, expoUpdatesPackageVersion);\n addMetaDataItemToMainApplication(mainApplication, Config.CHECK_ON_LAUNCH, checkOnLaunch);\n\n const timeout = getUpdatesTimeout(config);\n addMetaDataItemToMainApplication(mainApplication, Config.LAUNCH_WAIT_MS, String(timeout));\n\n const useEmbeddedUpdate = getUpdatesUseEmbeddedUpdate(config);\n if (useEmbeddedUpdate) {\n removeMetaDataItemFromMainApplication(mainApplication, Config.UPDATES_HAS_EMBEDDED_UPDATE);\n } else {\n // TODO: is there a better place for this validation?\n if (timeout === 0 && checkOnLaunch !== 'ALWAYS') {\n addWarningAndroid(\n 'updates.useEmbeddedUpdate',\n `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.`\n );\n }\n addMetaDataItemToMainApplication(mainApplication, Config.UPDATES_HAS_EMBEDDED_UPDATE, 'false');\n }\n\n const updateUrl = getUpdateUrl(config);\n if (updateUrl) {\n addMetaDataItemToMainApplication(mainApplication, Config.UPDATE_URL, updateUrl);\n } else {\n removeMetaDataItemFromMainApplication(mainApplication, Config.UPDATE_URL);\n }\n\n const codeSigningCertificate = getUpdatesCodeSigningCertificate(projectRoot, config);\n if (codeSigningCertificate) {\n addMetaDataItemToMainApplication(\n mainApplication,\n Config.CODE_SIGNING_CERTIFICATE,\n codeSigningCertificate\n );\n } else {\n removeMetaDataItemFromMainApplication(mainApplication, Config.CODE_SIGNING_CERTIFICATE);\n }\n\n const codeSigningMetadata = getUpdatesCodeSigningMetadataStringified(config);\n if (codeSigningMetadata) {\n addMetaDataItemToMainApplication(\n mainApplication,\n Config.CODE_SIGNING_METADATA,\n codeSigningMetadata\n );\n } else {\n removeMetaDataItemFromMainApplication(mainApplication, Config.CODE_SIGNING_METADATA);\n }\n\n const requestHeaders = getUpdatesRequestHeadersStringified(config);\n if (requestHeaders) {\n addMetaDataItemToMainApplication(\n mainApplication,\n Config.UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY,\n requestHeaders\n );\n } else {\n removeMetaDataItemFromMainApplication(\n mainApplication,\n Config.UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY\n );\n }\n\n const disableAntiBrickingMeasures = getDisableAntiBrickingMeasures(config);\n if (disableAntiBrickingMeasures) {\n addMetaDataItemToMainApplication(\n mainApplication,\n Config.DISABLE_ANTI_BRICKING_MEASURES,\n 'true'\n );\n } else {\n removeMetaDataItemFromMainApplication(mainApplication, Config.DISABLE_ANTI_BRICKING_MEASURES);\n }\n\n addMetaDataItemToMainApplication(\n mainApplication,\n Config.BSDIFF_PATCH_SUPPORT,\n getUpdatesBsdiffPatchSupportEnabled(config) ? 'true' : 'false'\n );\n\n return await setVersionsConfigAsync(projectRoot, config, androidManifest);\n}\n\nexport async function setVersionsConfigAsync(\n projectRoot: string,\n config: Pick<ExpoConfigUpdates, 'sdkVersion' | 'runtimeVersion'>,\n androidManifest: AndroidManifest\n): Promise<AndroidManifest> {\n const mainApplication = getMainApplicationOrThrow(androidManifest);\n\n const runtimeVersion = await getRuntimeVersionNullableAsync(projectRoot, config, 'android');\n if (!runtimeVersion && findMetaDataItem(mainApplication, Config.RUNTIME_VERSION) > -1) {\n throw new Error(\n 'A runtime version is set in your AndroidManifest.xml, but is missing from your Expo app config (app.json/app.config.js). Either set runtimeVersion in your Expo app config or remove expo.modules.updates.EXPO_RUNTIME_VERSION from your AndroidManifest.xml.'\n );\n }\n if (runtimeVersion) {\n removeMetaDataItemFromMainApplication(mainApplication, 'expo.modules.updates.EXPO_SDK_VERSION');\n addMetaDataItemToMainApplication(\n mainApplication,\n Config.RUNTIME_VERSION,\n '@string/expo_runtime_version'\n );\n } else {\n removeMetaDataItemFromMainApplication(mainApplication, Config.RUNTIME_VERSION);\n removeMetaDataItemFromMainApplication(mainApplication, 'expo.modules.updates.EXPO_SDK_VERSION');\n }\n\n return androidManifest;\n}\n"],"mappings":";;;;;;;;;;;AAEA,SAAAA,iBAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,gBAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAE,UAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,SAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAMA,SAAAG,WAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,UAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,SAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,QAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAK,gBAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,eAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,aAAA;EAAA,MAAAN,IAAA,GAAAC,OAAA;EAAAK,YAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EA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EAAE;IACrF,MAAM,IAAIC,KAAK,CACb,+PACF,CAAC;EACH;EACA,IAAI7C,cAAc,EAAE;IAClB,IAAAsB,iDAAqC,EAACd,eAAe,EAAE,uCAAuC,CAAC;IAC/F,IAAAE,4CAAgC,EAC9BF,eAAe,EACfjC,MAAM,CAACqE,eAAe,EACtB,8BACF,CAAC;EACH,CAAC,MAAM;IACL,IAAAtB,iDAAqC,EAACd,eAAe,EAAEjC,MAAM,CAACqE,eAAe,CAAC;IAC9E,IAAAtB,iDAAqC,EAACd,eAAe,EAAE,uCAAuC,CAAC;EACjG;EAEA,OAAOD,eAAe;AACxB","ignoreList":[]}
|
package/build/ios/Maps.js
CHANGED
|
@@ -13,16 +13,16 @@ exports.removeGoogleMapsAppDelegateInit = removeGoogleMapsAppDelegateInit;
|
|
|
13
13
|
exports.removeMapsCocoaPods = removeMapsCocoaPods;
|
|
14
14
|
exports.setGoogleMapsApiKey = setGoogleMapsApiKey;
|
|
15
15
|
exports.withMaps = void 0;
|
|
16
|
-
function
|
|
17
|
-
const data =
|
|
18
|
-
|
|
16
|
+
function _requireUtils() {
|
|
17
|
+
const data = require("@expo/require-utils");
|
|
18
|
+
_requireUtils = function () {
|
|
19
19
|
return data;
|
|
20
20
|
};
|
|
21
21
|
return data;
|
|
22
22
|
}
|
|
23
|
-
function
|
|
24
|
-
const data = _interopRequireDefault(require("
|
|
25
|
-
|
|
23
|
+
function _path() {
|
|
24
|
+
const data = _interopRequireDefault(require("path"));
|
|
25
|
+
_path = function () {
|
|
26
26
|
return data;
|
|
27
27
|
};
|
|
28
28
|
return data;
|
|
@@ -134,7 +134,7 @@ function removeMapsCocoaPods(src) {
|
|
|
134
134
|
});
|
|
135
135
|
}
|
|
136
136
|
function isReactNativeMapsInstalled(projectRoot) {
|
|
137
|
-
const resolved =
|
|
137
|
+
const resolved = (0, _requireUtils().resolveFrom)(projectRoot, 'react-native-maps/package.json');
|
|
138
138
|
return resolved ? _path().default.dirname(resolved) : null;
|
|
139
139
|
}
|
|
140
140
|
function isReactNativeMapsAutolinked(config) {
|
package/build/ios/Maps.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Maps.js","names":["_path","data","_interopRequireDefault","require","_resolveFrom","_iosPlugins","_generateCode","e","__esModule","default","debug","MATCH_INIT","exports","withGoogleMapsKey","createInfoPlistPlugin","setGoogleMapsApiKey","withMaps","config","apiKey","getGoogleMapsApiKey","withMapsCocoaPods","useGoogleMaps","withGoogleMapsAppDelegate","ios","googleMapsApiKey","GMSApiKey","infoPlist","addGoogleMapsAppDelegateImport","src","newSrc","mergeContents","tag","join","anchor","offset","comment","removeGoogleMapsAppDelegateImport","removeContents","addGoogleMapsAppDelegateInit","removeGoogleMapsAppDelegateInit","addMapsCocoaPods","removeMapsCocoaPods","isReactNativeMapsInstalled","projectRoot","resolved","resolveFrom","silent","path","dirname","isReactNativeMapsAutolinked","withPodfile","googleMapsPath","modRequest","isLinked","results","modResults","contents","error","code","Error","didMerge","didClear","withAppDelegate","language"],"sources":["../../src/ios/Maps.ts"],"sourcesContent":["import type { ExpoConfig } from '@expo/config-types';\nimport path from 'path';\nimport resolveFrom from 'resolve-from';\n\nimport type { ConfigPlugin, InfoPlist } from '../Plugin.types';\nimport { createInfoPlistPlugin, withAppDelegate, withPodfile } from '../plugins/ios-plugins';\nimport type { MergeResults } from '../utils/generateCode';\nimport { mergeContents, removeContents } from '../utils/generateCode';\n\nconst debug = require('debug')('expo:config-plugins:ios:maps') as typeof console.log;\n\nexport const MATCH_INIT = /\\bsuper\\.application\\(\\w+?, didFinishLaunchingWithOptions: \\w+?\\)/g;\n\nconst withGoogleMapsKey = createInfoPlistPlugin(setGoogleMapsApiKey, 'withGoogleMapsKey');\n\nexport const withMaps: ConfigPlugin = (config) => {\n config = withGoogleMapsKey(config);\n\n const apiKey = getGoogleMapsApiKey(config);\n // Technically adds react-native-maps (Apple maps) and google maps.\n\n debug('Google Maps API Key:', apiKey);\n config = withMapsCocoaPods(config, { useGoogleMaps: !!apiKey });\n\n // Adds/Removes AppDelegate setup for Google Maps API on iOS\n config = withGoogleMapsAppDelegate(config, { apiKey });\n\n return config;\n};\n\nexport function getGoogleMapsApiKey(config: Pick<ExpoConfig, 'ios'>) {\n return config.ios?.config?.googleMapsApiKey ?? null;\n}\n\nexport function setGoogleMapsApiKey(\n config: Pick<ExpoConfig, 'ios'>,\n { GMSApiKey, ...infoPlist }: InfoPlist\n): InfoPlist {\n const apiKey = getGoogleMapsApiKey(config);\n\n if (apiKey === null) {\n return infoPlist;\n }\n\n return {\n ...infoPlist,\n GMSApiKey: apiKey,\n };\n}\n\nexport function addGoogleMapsAppDelegateImport(src: string): MergeResults {\n const newSrc = ['#if canImport(GoogleMaps)', 'import GoogleMaps', '#endif'];\n\n return mergeContents({\n tag: 'react-native-maps-import',\n src,\n newSrc: newSrc.join('\\n'),\n anchor: /(@main|@UIApplicationMain)/,\n offset: 0,\n comment: '//',\n });\n}\n\nexport function removeGoogleMapsAppDelegateImport(src: string): MergeResults {\n return removeContents({\n tag: 'react-native-maps-import',\n src,\n });\n}\n\nexport function addGoogleMapsAppDelegateInit(src: string, apiKey: string): MergeResults {\n const newSrc = ['#if canImport(GoogleMaps)', `GMSServices.provideAPIKey(\"${apiKey}\")`, '#endif'];\n\n return mergeContents({\n tag: 'react-native-maps-init',\n src,\n newSrc: newSrc.join('\\n'),\n anchor: MATCH_INIT,\n offset: 0,\n comment: '//',\n });\n}\n\nexport function removeGoogleMapsAppDelegateInit(src: string): MergeResults {\n return removeContents({\n tag: 'react-native-maps-init',\n src,\n });\n}\n\n/**\n * @param src The contents of the Podfile.\n * @returns Podfile with Google Maps added.\n */\nexport function addMapsCocoaPods(src: string): MergeResults {\n return mergeContents({\n tag: 'react-native-maps',\n src,\n newSrc: ` pod 'react-native-google-maps', path: File.dirname(\\`node --print \"require.resolve('react-native-maps/package.json')\"\\`)`,\n anchor: /use_native_modules/,\n offset: 0,\n comment: '#',\n });\n}\n\nexport function removeMapsCocoaPods(src: string): MergeResults {\n return removeContents({\n tag: 'react-native-maps',\n src,\n });\n}\n\nfunction isReactNativeMapsInstalled(projectRoot: string): string | null {\n const resolved = resolveFrom.silent(projectRoot, 'react-native-maps/package.json');\n return resolved ? path.dirname(resolved) : null;\n}\n\nfunction isReactNativeMapsAutolinked(config: Pick<ExpoConfig, '_internal'>): boolean {\n // Only add the native code changes if we know that the package is going to be linked natively.\n // This is specifically for monorepo support where one app might have react-native-maps (adding it to the node_modules)\n // but another app will not have it installed in the package.json, causing it to not be linked natively.\n // This workaround only exists because react-native-maps doesn't have a config plugin vendored in the package.\n\n // TODO: `react-native-maps` doesn't use Expo autolinking so we cannot safely disable the module.\n return true;\n\n // return (\n // !config._internal?.autolinkedModules ||\n // config._internal.autolinkedModules.includes('react-native-maps')\n // );\n}\n\nconst withMapsCocoaPods: ConfigPlugin<{ useGoogleMaps: boolean }> = (config, { useGoogleMaps }) => {\n return withPodfile(config, async (config) => {\n // Only add the block if react-native-maps is installed in the project (best effort).\n // Generally prebuild runs after a yarn install so this should always work as expected.\n const googleMapsPath = isReactNativeMapsInstalled(config.modRequest.projectRoot);\n const isLinked = isReactNativeMapsAutolinked(config);\n debug('Is Expo Autolinked:', isLinked);\n debug('react-native-maps path:', googleMapsPath);\n\n let results: MergeResults;\n\n if (isLinked && googleMapsPath && useGoogleMaps) {\n try {\n results = addMapsCocoaPods(config.modResults.contents);\n } catch (error: any) {\n if (error.code === 'ERR_NO_MATCH') {\n throw new Error(\n `Cannot add react-native-maps to the project's ios/Podfile because it's malformed. Report this with a copy of your project Podfile: https://github.com/expo/expo/issues`\n );\n }\n throw error;\n }\n } else {\n // If the package is no longer installed, then remove the block.\n results = removeMapsCocoaPods(config.modResults.contents);\n }\n\n if (results.didMerge || results.didClear) {\n config.modResults.contents = results.contents;\n }\n\n return config;\n });\n};\n\nconst withGoogleMapsAppDelegate: ConfigPlugin<{ apiKey: string | null }> = (config, { apiKey }) => {\n return withAppDelegate(config, (config) => {\n if (\n !apiKey ||\n !isReactNativeMapsAutolinked(config) ||\n !isReactNativeMapsInstalled(config.modRequest.projectRoot)\n ) {\n config.modResults.contents = removeGoogleMapsAppDelegateImport(\n config.modResults.contents\n ).contents;\n config.modResults.contents = removeGoogleMapsAppDelegateInit(\n config.modResults.contents\n ).contents;\n return config;\n }\n\n if (config.modResults.language !== 'swift') {\n throw new Error(\n `Cannot setup Google Maps because the project AppDelegate is not a supported language: ${config.modResults.language}`\n );\n }\n\n try {\n config.modResults.contents = addGoogleMapsAppDelegateImport(\n config.modResults.contents\n ).contents;\n config.modResults.contents = addGoogleMapsAppDelegateInit(\n config.modResults.contents,\n apiKey\n ).contents;\n } catch (error: any) {\n if (error.code === 'ERR_NO_MATCH') {\n throw new Error(\n `Cannot add Google Maps to the project's AppDelegate because it's malformed. Report this with a copy of your project AppDelegate: https://github.com/expo/expo/issues`\n );\n }\n throw error;\n }\n return config;\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;AACA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,KAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,aAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,YAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAI,YAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,WAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAK,cAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,aAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAsE,SAAAC,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAA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,"file":"Maps.js","names":["_requireUtils","data","require","_path","_interopRequireDefault","_iosPlugins","_generateCode","e","__esModule","default","debug","MATCH_INIT","exports","withGoogleMapsKey","createInfoPlistPlugin","setGoogleMapsApiKey","withMaps","config","apiKey","getGoogleMapsApiKey","withMapsCocoaPods","useGoogleMaps","withGoogleMapsAppDelegate","ios","googleMapsApiKey","GMSApiKey","infoPlist","addGoogleMapsAppDelegateImport","src","newSrc","mergeContents","tag","join","anchor","offset","comment","removeGoogleMapsAppDelegateImport","removeContents","addGoogleMapsAppDelegateInit","removeGoogleMapsAppDelegateInit","addMapsCocoaPods","removeMapsCocoaPods","isReactNativeMapsInstalled","projectRoot","resolved","resolveFrom","path","dirname","isReactNativeMapsAutolinked","withPodfile","googleMapsPath","modRequest","isLinked","results","modResults","contents","error","code","Error","didMerge","didClear","withAppDelegate","language"],"sources":["../../src/ios/Maps.ts"],"sourcesContent":["import type { ExpoConfig } from '@expo/config-types';\nimport { resolveFrom } from '@expo/require-utils';\nimport path from 'path';\n\nimport type { ConfigPlugin, InfoPlist } from '../Plugin.types';\nimport { createInfoPlistPlugin, withAppDelegate, withPodfile } from '../plugins/ios-plugins';\nimport type { MergeResults } from '../utils/generateCode';\nimport { mergeContents, removeContents } from '../utils/generateCode';\n\nconst debug = require('debug')('expo:config-plugins:ios:maps') as typeof console.log;\n\nexport const MATCH_INIT = /\\bsuper\\.application\\(\\w+?, didFinishLaunchingWithOptions: \\w+?\\)/g;\n\nconst withGoogleMapsKey = createInfoPlistPlugin(setGoogleMapsApiKey, 'withGoogleMapsKey');\n\nexport const withMaps: ConfigPlugin = (config) => {\n config = withGoogleMapsKey(config);\n\n const apiKey = getGoogleMapsApiKey(config);\n // Technically adds react-native-maps (Apple maps) and google maps.\n\n debug('Google Maps API Key:', apiKey);\n config = withMapsCocoaPods(config, { useGoogleMaps: !!apiKey });\n\n // Adds/Removes AppDelegate setup for Google Maps API on iOS\n config = withGoogleMapsAppDelegate(config, { apiKey });\n\n return config;\n};\n\nexport function getGoogleMapsApiKey(config: Pick<ExpoConfig, 'ios'>) {\n return config.ios?.config?.googleMapsApiKey ?? null;\n}\n\nexport function setGoogleMapsApiKey(\n config: Pick<ExpoConfig, 'ios'>,\n { GMSApiKey, ...infoPlist }: InfoPlist\n): InfoPlist {\n const apiKey = getGoogleMapsApiKey(config);\n\n if (apiKey === null) {\n return infoPlist;\n }\n\n return {\n ...infoPlist,\n GMSApiKey: apiKey,\n };\n}\n\nexport function addGoogleMapsAppDelegateImport(src: string): MergeResults {\n const newSrc = ['#if canImport(GoogleMaps)', 'import GoogleMaps', '#endif'];\n\n return mergeContents({\n tag: 'react-native-maps-import',\n src,\n newSrc: newSrc.join('\\n'),\n anchor: /(@main|@UIApplicationMain)/,\n offset: 0,\n comment: '//',\n });\n}\n\nexport function removeGoogleMapsAppDelegateImport(src: string): MergeResults {\n return removeContents({\n tag: 'react-native-maps-import',\n src,\n });\n}\n\nexport function addGoogleMapsAppDelegateInit(src: string, apiKey: string): MergeResults {\n const newSrc = ['#if canImport(GoogleMaps)', `GMSServices.provideAPIKey(\"${apiKey}\")`, '#endif'];\n\n return mergeContents({\n tag: 'react-native-maps-init',\n src,\n newSrc: newSrc.join('\\n'),\n anchor: MATCH_INIT,\n offset: 0,\n comment: '//',\n });\n}\n\nexport function removeGoogleMapsAppDelegateInit(src: string): MergeResults {\n return removeContents({\n tag: 'react-native-maps-init',\n src,\n });\n}\n\n/**\n * @param src The contents of the Podfile.\n * @returns Podfile with Google Maps added.\n */\nexport function addMapsCocoaPods(src: string): MergeResults {\n return mergeContents({\n tag: 'react-native-maps',\n src,\n newSrc: ` pod 'react-native-google-maps', path: File.dirname(\\`node --print \"require.resolve('react-native-maps/package.json')\"\\`)`,\n anchor: /use_native_modules/,\n offset: 0,\n comment: '#',\n });\n}\n\nexport function removeMapsCocoaPods(src: string): MergeResults {\n return removeContents({\n tag: 'react-native-maps',\n src,\n });\n}\n\nfunction isReactNativeMapsInstalled(projectRoot: string): string | null {\n const resolved = resolveFrom(projectRoot, 'react-native-maps/package.json');\n return resolved ? path.dirname(resolved) : null;\n}\n\nfunction isReactNativeMapsAutolinked(config: Pick<ExpoConfig, '_internal'>): boolean {\n // Only add the native code changes if we know that the package is going to be linked natively.\n // This is specifically for monorepo support where one app might have react-native-maps (adding it to the node_modules)\n // but another app will not have it installed in the package.json, causing it to not be linked natively.\n // This workaround only exists because react-native-maps doesn't have a config plugin vendored in the package.\n\n // TODO: `react-native-maps` doesn't use Expo autolinking so we cannot safely disable the module.\n return true;\n\n // return (\n // !config._internal?.autolinkedModules ||\n // config._internal.autolinkedModules.includes('react-native-maps')\n // );\n}\n\nconst withMapsCocoaPods: ConfigPlugin<{ useGoogleMaps: boolean }> = (config, { useGoogleMaps }) => {\n return withPodfile(config, async (config) => {\n // Only add the block if react-native-maps is installed in the project (best effort).\n // Generally prebuild runs after a yarn install so this should always work as expected.\n const googleMapsPath = isReactNativeMapsInstalled(config.modRequest.projectRoot);\n const isLinked = isReactNativeMapsAutolinked(config);\n debug('Is Expo Autolinked:', isLinked);\n debug('react-native-maps path:', googleMapsPath);\n\n let results: MergeResults;\n\n if (isLinked && googleMapsPath && useGoogleMaps) {\n try {\n results = addMapsCocoaPods(config.modResults.contents);\n } catch (error: any) {\n if (error.code === 'ERR_NO_MATCH') {\n throw new Error(\n `Cannot add react-native-maps to the project's ios/Podfile because it's malformed. Report this with a copy of your project Podfile: https://github.com/expo/expo/issues`\n );\n }\n throw error;\n }\n } else {\n // If the package is no longer installed, then remove the block.\n results = removeMapsCocoaPods(config.modResults.contents);\n }\n\n if (results.didMerge || results.didClear) {\n config.modResults.contents = results.contents;\n }\n\n return config;\n });\n};\n\nconst withGoogleMapsAppDelegate: ConfigPlugin<{ apiKey: string | null }> = (config, { apiKey }) => {\n return withAppDelegate(config, (config) => {\n if (\n !apiKey ||\n !isReactNativeMapsAutolinked(config) ||\n !isReactNativeMapsInstalled(config.modRequest.projectRoot)\n ) {\n config.modResults.contents = removeGoogleMapsAppDelegateImport(\n config.modResults.contents\n ).contents;\n config.modResults.contents = removeGoogleMapsAppDelegateInit(\n config.modResults.contents\n ).contents;\n return config;\n }\n\n if (config.modResults.language !== 'swift') {\n throw new Error(\n `Cannot setup Google Maps because the project AppDelegate is not a supported language: ${config.modResults.language}`\n );\n }\n\n try {\n config.modResults.contents = addGoogleMapsAppDelegateImport(\n config.modResults.contents\n ).contents;\n config.modResults.contents = addGoogleMapsAppDelegateInit(\n config.modResults.contents,\n apiKey\n ).contents;\n } catch (error: any) {\n if (error.code === 'ERR_NO_MATCH') {\n throw new Error(\n `Cannot add Google Maps to the project's AppDelegate because it's malformed. Report this with a copy of your project AppDelegate: https://github.com/expo/expo/issues`\n );\n }\n throw error;\n }\n return config;\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;AACA,SAAAA,cAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,aAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,MAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,KAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAI,YAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,WAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAK,cAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,aAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAsE,SAAAG,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEtE,MAAMG,KAAK,GAAGR,OAAO,CAAC,OAAO,CAAC,CAAC,8BAA8B,CAAuB;AAE7E,MAAMS,UAAU,GAAAC,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G,OAAO,IAAA2C,6BAAe,EAAC5C,MAAM,EAAGA,MAAM,IAAK;IACzC,IACE,CAACC,MAAM,IACP,CAAC8B,2BAA2B,CAAC/B,MAAM,CAAC,IACpC,CAACyB,0BAA0B,CAACzB,MAAM,CAACkC,UAAU,CAACR,WAAW,CAAC,EAC1D;MACA1B,MAAM,CAACqC,UAAU,CAACC,QAAQ,GAAGnB,iCAAiC,CAC5DnB,MAAM,CAACqC,UAAU,CAACC,QACpB,CAAC,CAACA,QAAQ;MACVtC,MAAM,CAACqC,UAAU,CAACC,QAAQ,GAAGhB,+BAA+B,CAC1DtB,MAAM,CAACqC,UAAU,CAACC,QACpB,CAAC,CAACA,QAAQ;MACV,OAAOtC,MAAM;IACf;IAEA,IAAIA,MAAM,CAACqC,UAAU,CAACQ,QAAQ,KAAK,OAAO,EAAE;MAC1C,MAAM,IAAIJ,KAAK,CACb,yFAAyFzC,MAAM,CAACqC,UAAU,CAACQ,QAAQ,EACrH,CAAC;IACH;IAEA,IAAI;MACF7C,MAAM,CAACqC,UAAU,CAACC,QAAQ,GAAG5B,8BAA8B,CACzDV,MAAM,CAACqC,UAAU,CAACC,QACpB,CAAC,CAACA,QAAQ;MACVtC,MAAM,CAACqC,UAAU,CAACC,QAAQ,GAAGjB,4BAA4B,CACvDrB,MAAM,CAACqC,UAAU,CAACC,QAAQ,EAC1BrC,MACF,CAAC,CAACqC,QAAQ;IACZ,CAAC,CAAC,OAAOC,KAAU,EAAE;MACnB,IAAIA,KAAK,CAACC,IAAI,KAAK,cAAc,EAAE;QACjC,MAAM,IAAIC,KAAK,CACb,sKACF,CAAC;MACH;MACA,MAAMF,KAAK;IACb;IACA,OAAOvC,MAAM;EACf,CAAC,CAAC;AACJ,CAAC","ignoreList":[]}
|
package/build/ios/Updates.js
CHANGED
|
@@ -132,12 +132,7 @@ async function setUpdatesConfigAsync(projectRoot, config, expoPlist, expoUpdates
|
|
|
132
132
|
} else {
|
|
133
133
|
delete newExpoPlist[Config.DISABLE_ANTI_BRICKING_MEASURES];
|
|
134
134
|
}
|
|
135
|
-
|
|
136
|
-
if (bsPatchSupport) {
|
|
137
|
-
newExpoPlist[Config.ENABLE_BSDIFF_PATCH_SUPPORT] = bsPatchSupport;
|
|
138
|
-
} else {
|
|
139
|
-
delete newExpoPlist[Config.ENABLE_BSDIFF_PATCH_SUPPORT];
|
|
140
|
-
}
|
|
135
|
+
newExpoPlist[Config.ENABLE_BSDIFF_PATCH_SUPPORT] = (0, _Updates().getUpdatesBsdiffPatchSupportEnabled)(config);
|
|
141
136
|
return await setVersionsConfigAsync(projectRoot, config, newExpoPlist);
|
|
142
137
|
}
|
|
143
138
|
async function setVersionsConfigAsync(projectRoot, config, expoPlist) {
|
package/build/ios/Updates.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Updates.js","names":["_BuildProperties","data","require","_iosPlugins","_withPlugins","_Updates","_warnings","Config","exports","withUpdates","config","withPlugins","withUpdatesPlist","withUpdatesNativeDebugPodfileProps","createBuildPodfilePropsConfigPlugin","propName","propValueGetter","updates","useNativeDebug","undefined","withExpoPlist","projectRoot","modRequest","expoUpdatesPackageVersion","getExpoUpdatesPackageVersion","modResults","setUpdatesConfigAsync","expoPlist","checkOnLaunch","getUpdatesCheckOnLaunch","timeout","getUpdatesTimeout","useEmbeddedUpdate","getUpdatesUseEmbeddedUpdate","addWarningIOS","newExpoPlist","ENABLED","getUpdatesEnabled","CHECK_ON_LAUNCH","LAUNCH_WAIT_MS","UPDATES_HAS_EMBEDDED_UPDATE","updateUrl","getUpdateUrl","UPDATE_URL","codeSigningCertificate","getUpdatesCodeSigningCertificate","CODE_SIGNING_CERTIFICATE","codeSigningMetadata","getUpdatesCodeSigningMetadata","CODE_SIGNING_METADATA","requestHeaders","getUpdatesRequestHeaders","UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY","disableAntiBrickingMeasures","getDisableAntiBrickingMeasures","DISABLE_ANTI_BRICKING_MEASURES","bsPatchSupport","getUpdatesBsdiffPatchSupportEnabled","ENABLE_BSDIFF_PATCH_SUPPORT","setVersionsConfigAsync","runtimeVersion","getRuntimeVersionNullableAsync","RUNTIME_VERSION","Error"],"sources":["../../src/ios/Updates.ts"],"sourcesContent":["import type { ExpoConfig } from '@expo/config-types';\n\nimport { createBuildPodfilePropsConfigPlugin } from './BuildProperties';\nimport type { ExpoPlist } from './IosConfig.types';\nimport type { ConfigPlugin } from '../Plugin.types';\nimport { withExpoPlist } from '../plugins/ios-plugins';\nimport { withPlugins } from '../plugins/withPlugins';\nimport type { ExpoConfigUpdates } from '../utils/Updates';\nimport {\n getDisableAntiBrickingMeasures,\n getExpoUpdatesPackageVersion,\n getRuntimeVersionNullableAsync,\n getUpdatesCheckOnLaunch,\n getUpdatesCodeSigningCertificate,\n getUpdatesCodeSigningMetadata,\n getUpdatesRequestHeaders,\n getUpdatesEnabled,\n getUpdatesTimeout,\n getUpdatesBsdiffPatchSupportEnabled,\n getUpdatesUseEmbeddedUpdate,\n getUpdateUrl,\n} from '../utils/Updates';\nimport { addWarningIOS } from '../utils/warnings';\n\nexport enum Config {\n ENABLED = 'EXUpdatesEnabled',\n CHECK_ON_LAUNCH = 'EXUpdatesCheckOnLaunch',\n LAUNCH_WAIT_MS = 'EXUpdatesLaunchWaitMs',\n RUNTIME_VERSION = 'EXUpdatesRuntimeVersion',\n UPDATE_URL = 'EXUpdatesURL',\n UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY = 'EXUpdatesRequestHeaders',\n UPDATES_HAS_EMBEDDED_UPDATE = 'EXUpdatesHasEmbeddedUpdate',\n CODE_SIGNING_CERTIFICATE = 'EXUpdatesCodeSigningCertificate',\n CODE_SIGNING_METADATA = 'EXUpdatesCodeSigningMetadata',\n DISABLE_ANTI_BRICKING_MEASURES = 'EXUpdatesDisableAntiBrickingMeasures',\n ENABLE_BSDIFF_PATCH_SUPPORT = 'EXUpdatesEnableBsdiffPatchSupport',\n}\n\n// when making changes to this config plugin, ensure the same changes are also made in eas-cli and build-tools\n// Also ensure the docs are up-to-date: https://docs.expo.dev/bare/installing-updates/\n\nexport const withUpdates: ConfigPlugin = (config) => {\n return withPlugins(config, [withUpdatesPlist, withUpdatesNativeDebugPodfileProps]);\n};\n\n/**\n * A config-plugin to update `ios/Podfile.properties.json` from the `updates.useNativeDebug` in expo config\n */\nexport const withUpdatesNativeDebugPodfileProps = createBuildPodfilePropsConfigPlugin<ExpoConfig>(\n [\n {\n propName: 'updatesNativeDebug',\n propValueGetter: (config) => (config?.updates?.useNativeDebug === true ? 'true' : undefined),\n },\n ],\n 'withUpdatesNativeDebugPodfileProps'\n);\n\nconst withUpdatesPlist: ConfigPlugin = (config) => {\n return withExpoPlist(config, async (config) => {\n const projectRoot = config.modRequest.projectRoot;\n const expoUpdatesPackageVersion = getExpoUpdatesPackageVersion(projectRoot);\n config.modResults = await setUpdatesConfigAsync(\n projectRoot,\n config,\n config.modResults,\n expoUpdatesPackageVersion\n );\n return config;\n });\n};\n\nexport async function setUpdatesConfigAsync(\n projectRoot: string,\n config: ExpoConfigUpdates,\n expoPlist: ExpoPlist,\n expoUpdatesPackageVersion?: string | null\n): Promise<ExpoPlist> {\n const checkOnLaunch = getUpdatesCheckOnLaunch(config, expoUpdatesPackageVersion);\n const timeout = getUpdatesTimeout(config);\n const useEmbeddedUpdate = getUpdatesUseEmbeddedUpdate(config);\n\n // TODO: is there a better place for this validation?\n if (!useEmbeddedUpdate && timeout === 0 && checkOnLaunch !== 'ALWAYS') {\n addWarningIOS(\n 'updates.useEmbeddedUpdate',\n `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.`\n );\n }\n\n const newExpoPlist = {\n ...expoPlist,\n [Config.ENABLED]: getUpdatesEnabled(config),\n [Config.CHECK_ON_LAUNCH]: checkOnLaunch,\n [Config.LAUNCH_WAIT_MS]: timeout,\n };\n\n // The native config name is \"has embedded update\", but we want to expose\n // this to the user as \"use embedded update\", since this is more accurate.\n // The field does not disable actually building and embedding the update,\n // only whether it is actually used.\n if (useEmbeddedUpdate) {\n delete newExpoPlist[Config.UPDATES_HAS_EMBEDDED_UPDATE];\n } else {\n newExpoPlist[Config.UPDATES_HAS_EMBEDDED_UPDATE] = false;\n }\n\n const updateUrl = getUpdateUrl(config);\n if (updateUrl) {\n newExpoPlist[Config.UPDATE_URL] = updateUrl;\n } else {\n delete newExpoPlist[Config.UPDATE_URL];\n }\n\n const codeSigningCertificate = getUpdatesCodeSigningCertificate(projectRoot, config);\n if (codeSigningCertificate) {\n newExpoPlist[Config.CODE_SIGNING_CERTIFICATE] = codeSigningCertificate;\n } else {\n delete newExpoPlist[Config.CODE_SIGNING_CERTIFICATE];\n }\n\n const codeSigningMetadata = getUpdatesCodeSigningMetadata(config);\n if (codeSigningMetadata) {\n newExpoPlist[Config.CODE_SIGNING_METADATA] = codeSigningMetadata;\n } else {\n delete newExpoPlist[Config.CODE_SIGNING_METADATA];\n }\n\n const requestHeaders = getUpdatesRequestHeaders(config);\n if (requestHeaders) {\n newExpoPlist[Config.UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY] = requestHeaders;\n } else {\n delete newExpoPlist[Config.UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY];\n }\n\n const disableAntiBrickingMeasures = getDisableAntiBrickingMeasures(config);\n if (disableAntiBrickingMeasures) {\n newExpoPlist[Config.DISABLE_ANTI_BRICKING_MEASURES] = disableAntiBrickingMeasures;\n } else {\n delete newExpoPlist[Config.DISABLE_ANTI_BRICKING_MEASURES];\n }\n\n const bsPatchSupport = getUpdatesBsdiffPatchSupportEnabled(config);\n if (bsPatchSupport) {\n newExpoPlist[Config.ENABLE_BSDIFF_PATCH_SUPPORT] = bsPatchSupport;\n } else {\n delete newExpoPlist[Config.ENABLE_BSDIFF_PATCH_SUPPORT];\n }\n\n return await setVersionsConfigAsync(projectRoot, config, newExpoPlist);\n}\n\nexport async function setVersionsConfigAsync(\n projectRoot: string,\n config: ExpoConfigUpdates,\n expoPlist: ExpoPlist\n): Promise<ExpoPlist> {\n const newExpoPlist = { ...expoPlist };\n\n const runtimeVersion = await getRuntimeVersionNullableAsync(projectRoot, config, 'ios');\n if (!runtimeVersion && expoPlist[Config.RUNTIME_VERSION]) {\n throw new Error(\n 'A runtime version is set in your Expo.plist, but is missing from your Expo app config (app.json/app.config.js). Set runtimeVersion in your Expo app config or remove EXUpdatesRuntimeVersion from your Expo.plist.'\n );\n }\n\n if (runtimeVersion) {\n delete newExpoPlist['EXUpdatesSDKVersion'];\n newExpoPlist[Config.RUNTIME_VERSION] = runtimeVersion;\n } else {\n delete newExpoPlist['EXUpdatesSDKVersion'];\n delete newExpoPlist[Config.RUNTIME_VERSION];\n }\n\n return newExpoPlist;\n}\n"],"mappings":";;;;;;;;;AAEA,SAAAA,iBAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,gBAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAE,YAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,WAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,aAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,YAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,SAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,QAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAcA,SAAAK,UAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,SAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAkD,IAEtCM,MAAM,GAAAC,OAAA,CAAAD,MAAA,0BA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AAc,EAAE;IAClB,OAAOzB,YAAY,CAAC,qBAAqB,CAAC;IAC1CA,YAAY,CAAC5B,MAAM,CAACuD,eAAe,CAAC,GAAGF,cAAc;EACvD,CAAC,MAAM;IACL,OAAOzB,YAAY,CAAC,qBAAqB,CAAC;IAC1C,OAAOA,YAAY,CAAC5B,MAAM,CAACuD,eAAe,CAAC;EAC7C;EAEA,OAAO3B,YAAY;AACrB","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"Updates.js","names":["_BuildProperties","data","require","_iosPlugins","_withPlugins","_Updates","_warnings","Config","exports","withUpdates","config","withPlugins","withUpdatesPlist","withUpdatesNativeDebugPodfileProps","createBuildPodfilePropsConfigPlugin","propName","propValueGetter","updates","useNativeDebug","undefined","withExpoPlist","projectRoot","modRequest","expoUpdatesPackageVersion","getExpoUpdatesPackageVersion","modResults","setUpdatesConfigAsync","expoPlist","checkOnLaunch","getUpdatesCheckOnLaunch","timeout","getUpdatesTimeout","useEmbeddedUpdate","getUpdatesUseEmbeddedUpdate","addWarningIOS","newExpoPlist","ENABLED","getUpdatesEnabled","CHECK_ON_LAUNCH","LAUNCH_WAIT_MS","UPDATES_HAS_EMBEDDED_UPDATE","updateUrl","getUpdateUrl","UPDATE_URL","codeSigningCertificate","getUpdatesCodeSigningCertificate","CODE_SIGNING_CERTIFICATE","codeSigningMetadata","getUpdatesCodeSigningMetadata","CODE_SIGNING_METADATA","requestHeaders","getUpdatesRequestHeaders","UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY","disableAntiBrickingMeasures","getDisableAntiBrickingMeasures","DISABLE_ANTI_BRICKING_MEASURES","ENABLE_BSDIFF_PATCH_SUPPORT","getUpdatesBsdiffPatchSupportEnabled","setVersionsConfigAsync","runtimeVersion","getRuntimeVersionNullableAsync","RUNTIME_VERSION","Error"],"sources":["../../src/ios/Updates.ts"],"sourcesContent":["import type { ExpoConfig } from '@expo/config-types';\n\nimport { createBuildPodfilePropsConfigPlugin } from './BuildProperties';\nimport type { ExpoPlist } from './IosConfig.types';\nimport type { ConfigPlugin } from '../Plugin.types';\nimport { withExpoPlist } from '../plugins/ios-plugins';\nimport { withPlugins } from '../plugins/withPlugins';\nimport type { ExpoConfigUpdates } from '../utils/Updates';\nimport {\n getDisableAntiBrickingMeasures,\n getExpoUpdatesPackageVersion,\n getRuntimeVersionNullableAsync,\n getUpdatesCheckOnLaunch,\n getUpdatesCodeSigningCertificate,\n getUpdatesCodeSigningMetadata,\n getUpdatesRequestHeaders,\n getUpdatesEnabled,\n getUpdatesTimeout,\n getUpdatesBsdiffPatchSupportEnabled,\n getUpdatesUseEmbeddedUpdate,\n getUpdateUrl,\n} from '../utils/Updates';\nimport { addWarningIOS } from '../utils/warnings';\n\nexport enum Config {\n ENABLED = 'EXUpdatesEnabled',\n CHECK_ON_LAUNCH = 'EXUpdatesCheckOnLaunch',\n LAUNCH_WAIT_MS = 'EXUpdatesLaunchWaitMs',\n RUNTIME_VERSION = 'EXUpdatesRuntimeVersion',\n UPDATE_URL = 'EXUpdatesURL',\n UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY = 'EXUpdatesRequestHeaders',\n UPDATES_HAS_EMBEDDED_UPDATE = 'EXUpdatesHasEmbeddedUpdate',\n CODE_SIGNING_CERTIFICATE = 'EXUpdatesCodeSigningCertificate',\n CODE_SIGNING_METADATA = 'EXUpdatesCodeSigningMetadata',\n DISABLE_ANTI_BRICKING_MEASURES = 'EXUpdatesDisableAntiBrickingMeasures',\n ENABLE_BSDIFF_PATCH_SUPPORT = 'EXUpdatesEnableBsdiffPatchSupport',\n}\n\n// when making changes to this config plugin, ensure the same changes are also made in eas-cli and build-tools\n// Also ensure the docs are up-to-date: https://docs.expo.dev/bare/installing-updates/\n\nexport const withUpdates: ConfigPlugin = (config) => {\n return withPlugins(config, [withUpdatesPlist, withUpdatesNativeDebugPodfileProps]);\n};\n\n/**\n * A config-plugin to update `ios/Podfile.properties.json` from the `updates.useNativeDebug` in expo config\n */\nexport const withUpdatesNativeDebugPodfileProps = createBuildPodfilePropsConfigPlugin<ExpoConfig>(\n [\n {\n propName: 'updatesNativeDebug',\n propValueGetter: (config) => (config?.updates?.useNativeDebug === true ? 'true' : undefined),\n },\n ],\n 'withUpdatesNativeDebugPodfileProps'\n);\n\nconst withUpdatesPlist: ConfigPlugin = (config) => {\n return withExpoPlist(config, async (config) => {\n const projectRoot = config.modRequest.projectRoot;\n const expoUpdatesPackageVersion = getExpoUpdatesPackageVersion(projectRoot);\n config.modResults = await setUpdatesConfigAsync(\n projectRoot,\n config,\n config.modResults,\n expoUpdatesPackageVersion\n );\n return config;\n });\n};\n\nexport async function setUpdatesConfigAsync(\n projectRoot: string,\n config: ExpoConfigUpdates,\n expoPlist: ExpoPlist,\n expoUpdatesPackageVersion?: string | null\n): Promise<ExpoPlist> {\n const checkOnLaunch = getUpdatesCheckOnLaunch(config, expoUpdatesPackageVersion);\n const timeout = getUpdatesTimeout(config);\n const useEmbeddedUpdate = getUpdatesUseEmbeddedUpdate(config);\n\n // TODO: is there a better place for this validation?\n if (!useEmbeddedUpdate && timeout === 0 && checkOnLaunch !== 'ALWAYS') {\n addWarningIOS(\n 'updates.useEmbeddedUpdate',\n `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.`\n );\n }\n\n const newExpoPlist = {\n ...expoPlist,\n [Config.ENABLED]: getUpdatesEnabled(config),\n [Config.CHECK_ON_LAUNCH]: checkOnLaunch,\n [Config.LAUNCH_WAIT_MS]: timeout,\n };\n\n // The native config name is \"has embedded update\", but we want to expose\n // this to the user as \"use embedded update\", since this is more accurate.\n // The field does not disable actually building and embedding the update,\n // only whether it is actually used.\n if (useEmbeddedUpdate) {\n delete newExpoPlist[Config.UPDATES_HAS_EMBEDDED_UPDATE];\n } else {\n newExpoPlist[Config.UPDATES_HAS_EMBEDDED_UPDATE] = false;\n }\n\n const updateUrl = getUpdateUrl(config);\n if (updateUrl) {\n newExpoPlist[Config.UPDATE_URL] = updateUrl;\n } else {\n delete newExpoPlist[Config.UPDATE_URL];\n }\n\n const codeSigningCertificate = getUpdatesCodeSigningCertificate(projectRoot, config);\n if (codeSigningCertificate) {\n newExpoPlist[Config.CODE_SIGNING_CERTIFICATE] = codeSigningCertificate;\n } else {\n delete newExpoPlist[Config.CODE_SIGNING_CERTIFICATE];\n }\n\n const codeSigningMetadata = getUpdatesCodeSigningMetadata(config);\n if (codeSigningMetadata) {\n newExpoPlist[Config.CODE_SIGNING_METADATA] = codeSigningMetadata;\n } else {\n delete newExpoPlist[Config.CODE_SIGNING_METADATA];\n }\n\n const requestHeaders = getUpdatesRequestHeaders(config);\n if (requestHeaders) {\n newExpoPlist[Config.UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY] = requestHeaders;\n } else {\n delete newExpoPlist[Config.UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY];\n }\n\n const disableAntiBrickingMeasures = getDisableAntiBrickingMeasures(config);\n if (disableAntiBrickingMeasures) {\n newExpoPlist[Config.DISABLE_ANTI_BRICKING_MEASURES] = disableAntiBrickingMeasures;\n } else {\n delete newExpoPlist[Config.DISABLE_ANTI_BRICKING_MEASURES];\n }\n\n newExpoPlist[Config.ENABLE_BSDIFF_PATCH_SUPPORT] = getUpdatesBsdiffPatchSupportEnabled(config);\n\n return await setVersionsConfigAsync(projectRoot, config, newExpoPlist);\n}\n\nexport async function setVersionsConfigAsync(\n projectRoot: string,\n config: ExpoConfigUpdates,\n expoPlist: ExpoPlist\n): Promise<ExpoPlist> {\n const newExpoPlist = { ...expoPlist };\n\n const runtimeVersion = await getRuntimeVersionNullableAsync(projectRoot, config, 'ios');\n if (!runtimeVersion && expoPlist[Config.RUNTIME_VERSION]) {\n throw new Error(\n 'A runtime version is set in your Expo.plist, but is missing from your Expo app config (app.json/app.config.js). Set runtimeVersion in your Expo app config or remove EXUpdatesRuntimeVersion from your Expo.plist.'\n );\n }\n\n if (runtimeVersion) {\n delete newExpoPlist['EXUpdatesSDKVersion'];\n newExpoPlist[Config.RUNTIME_VERSION] = runtimeVersion;\n } else {\n delete newExpoPlist['EXUpdatesSDKVersion'];\n delete newExpoPlist[Config.RUNTIME_VERSION];\n }\n\n return newExpoPlist;\n}\n"],"mappings":";;;;;;;;;AAEA,SAAAA,iBAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,gBAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAE,YAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,WAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,aAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,YAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,SAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,QAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAcA,SAAAK,UAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,SAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAkD,IAEtCM,MAAM,GAAAC,OAAA,CAAAD,MAAA,0BAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAAA,OAANA,MAAM;AAAA,OAclB;AACA;AAEO,MAAME,WAAyB,GAAIC,MAAM,IAAK;EACnD,OAAO,IAAAC,0BAAW,EAACD,MAAM,EAAE,CAACE,gBAAgB,EAAEC,kCAAkC,CAAC,CAAC;AACpF,CAAC;;AAED;AACA;AACA;A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C,2BAA2B,GAAG,IAAAC,yCAA8B,EAAC5C,MAAM,CAAC;EAC1E,IAAI2C,2BAA2B,EAAE;IAC/BlB,YAAY,CAAC5B,MAAM,CAACgD,8BAA8B,CAAC,GAAGF,2BAA2B;EACnF,CAAC,MAAM;IACL,OAAOlB,YAAY,CAAC5B,MAAM,CAACgD,8BAA8B,CAAC;EAC5D;EAEApB,YAAY,CAAC5B,MAAM,CAACiD,2BAA2B,CAAC,GAAG,IAAAC,8CAAmC,EAAC/C,MAAM,CAAC;EAE9F,OAAO,MAAMgD,sBAAsB,CAACrC,WAAW,EAAEX,MAAM,EAAEyB,YAAY,CAAC;AACxE;AAEO,eAAeuB,sBAAsBA,CAC1CrC,WAAmB,EACnBX,MAAyB,EACzBiB,SAAoB,EACA;EACpB,MAAMQ,YAAY,GAAG;IAAE,GAAGR;EAAU,CAAC;EAErC,MAAMgC,cAAc,GAAG,MAAM,IAAAC,yCAA8B,EAACvC,WAAW,EAAEX,MAAM,EAAE,KAAK,CAAC;EACvF,IAAI,CAACiD,cAAc,IAAIhC,SAAS,CAACpB,MAAM,CAACsD,eAAe,CAAC,EAAE;IACxD,MAAM,IAAIC,KAAK,CACb,oNACF,CAAC;EACH;EAEA,IAAIH,cAAc,EAAE;IAClB,OAAOxB,YAAY,CAAC,qBAAqB,CAAC;IAC1CA,YAAY,CAAC5B,MAAM,CAACsD,eAAe,CAAC,GAAGF,cAAc;EACvD,CAAC,MAAM;IACL,OAAOxB,YAAY,CAAC,qBAAqB,CAAC;IAC1C,OAAOA,YAAY,CAAC5B,MAAM,CAACsD,eAAe,CAAC;EAC7C;EAEA,OAAO1B,YAAY;AACrB","ignoreList":[]}
|
package/build/utils/Updates.js
CHANGED
|
@@ -23,6 +23,13 @@ exports.getUpdatesRequestHeadersStringified = getUpdatesRequestHeadersStringifie
|
|
|
23
23
|
exports.getUpdatesTimeout = getUpdatesTimeout;
|
|
24
24
|
exports.getUpdatesUseEmbeddedUpdate = getUpdatesUseEmbeddedUpdate;
|
|
25
25
|
exports.resolveRuntimeVersionPolicyAsync = resolveRuntimeVersionPolicyAsync;
|
|
26
|
+
function _requireUtils() {
|
|
27
|
+
const data = require("@expo/require-utils");
|
|
28
|
+
_requireUtils = function () {
|
|
29
|
+
return data;
|
|
30
|
+
};
|
|
31
|
+
return data;
|
|
32
|
+
}
|
|
26
33
|
function _sdkRuntimeVersions() {
|
|
27
34
|
const data = require("@expo/sdk-runtime-versions");
|
|
28
35
|
_sdkRuntimeVersions = function () {
|
|
@@ -51,13 +58,6 @@ function _path() {
|
|
|
51
58
|
};
|
|
52
59
|
return data;
|
|
53
60
|
}
|
|
54
|
-
function _resolveFrom() {
|
|
55
|
-
const data = _interopRequireDefault(require("resolve-from"));
|
|
56
|
-
_resolveFrom = function () {
|
|
57
|
-
return data;
|
|
58
|
-
};
|
|
59
|
-
return data;
|
|
60
|
-
}
|
|
61
61
|
function _semver() {
|
|
62
62
|
const data = _interopRequireDefault(require("semver"));
|
|
63
63
|
_semver = function () {
|
|
@@ -83,8 +83,8 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
83
83
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
84
84
|
const FINGERPRINT_RUNTIME_VERSION_SENTINEL = exports.FINGERPRINT_RUNTIME_VERSION_SENTINEL = 'file:fingerprint';
|
|
85
85
|
function getExpoUpdatesPackageVersion(projectRoot) {
|
|
86
|
-
const expoUpdatesPackageJsonPath =
|
|
87
|
-
if (!expoUpdatesPackageJsonPath
|
|
86
|
+
const expoUpdatesPackageJsonPath = (0, _requireUtils().resolveFrom)(projectRoot, 'expo-updates/package.json');
|
|
87
|
+
if (!expoUpdatesPackageJsonPath) {
|
|
88
88
|
return null;
|
|
89
89
|
}
|
|
90
90
|
const packageJson = JSON.parse(_fs().default.readFileSync(expoUpdatesPackageJsonPath, 'utf8'));
|
|
@@ -178,7 +178,7 @@ function getUpdatesBsdiffPatchSupportEnabled(config) {
|
|
|
178
178
|
if (config.updates?.enableBsdiffPatchSupport !== undefined) {
|
|
179
179
|
return config.updates.enableBsdiffPatchSupport;
|
|
180
180
|
}
|
|
181
|
-
return
|
|
181
|
+
return true;
|
|
182
182
|
}
|
|
183
183
|
function getUpdatesTimeout(config) {
|
|
184
184
|
return config.updates?.fallbackToCacheTimeout ?? 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Updates.js","names":["_sdkRuntimeVersions","data","require","_fs","_interopRequireDefault","_getenv","_path","_resolveFrom","_semver","AndroidVersion","_interopRequireWildcard","IOSVersion","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","FINGERPRINT_RUNTIME_VERSION_SENTINEL","exports","getExpoUpdatesPackageVersion","projectRoot","expoUpdatesPackageJsonPath","resolveFrom","silent","fs","existsSync","packageJson","JSON","parse","readFileSync","version","getUpdateUrl","config","updates","url","getAppVersion","getNativeVersion","platform","getVersion","buildNumber","getBuildNumber","versionCode","getVersionCode","Error","getRuntimeVersionNullableAsync","getRuntimeVersionAsync","boolish","console","log","runtimeVersion","policy","resolveRuntimeVersionPolicyAsync","sdkVersion","getRuntimeVersionForSDKVersion","getSDKVersion","getUpdatesEnabled","enabled","undefined","getUpdatesUseEmbeddedUpdate","useEmbeddedUpdate","getUpdatesBsdiffPatchSupportEnabled","enableBsdiffPatchSupport","getUpdatesTimeout","fallbackToCacheTimeout","getUpdatesCheckOnLaunch","expoUpdatesPackageVersion","checkAutomatically","semver","gte","getUpdatesCodeSigningCertificate","codeSigningCertificatePath","codeSigningCertificate","finalPath","path","join","getUpdatesCodeSigningMetadata","codeSigningMetadata","getUpdatesCodeSigningMetadataStringified","metadata","stringify","getUpdatesRequestHeaders","requestHeaders","getUpdatesRequestHeadersStringified","getDisableAntiBrickingMeasures","disableAntiBrickingMeasures"],"sources":["../../src/utils/Updates.ts"],"sourcesContent":["import type { Android, ExpoConfig, IOS } from '@expo/config-types';\nimport { getRuntimeVersionForSDKVersion } from '@expo/sdk-runtime-versions';\nimport fs from 'fs';\nimport { boolish } from 'getenv';\nimport path from 'path';\nimport resolveFrom from 'resolve-from';\nimport semver from 'semver';\n\nimport * as AndroidVersion from '../android/Version';\nimport * as IOSVersion from '../ios/Version';\n\nexport type ExpoConfigUpdates = Pick<\n ExpoConfig,\n 'sdkVersion' | 'runtimeVersion' | 'updates' | 'slug'\n>;\n\nexport const FINGERPRINT_RUNTIME_VERSION_SENTINEL = 'file:fingerprint';\n\nexport function getExpoUpdatesPackageVersion(projectRoot: string): string | null {\n const expoUpdatesPackageJsonPath = resolveFrom.silent(projectRoot, 'expo-updates/package.json');\n if (!expoUpdatesPackageJsonPath || !fs.existsSync(expoUpdatesPackageJsonPath)) {\n return null;\n }\n const packageJson = JSON.parse(fs.readFileSync(expoUpdatesPackageJsonPath, 'utf8'));\n return packageJson.version;\n}\n\nexport function getUpdateUrl(config: Pick<ExpoConfigUpdates, 'updates'>): string | null {\n return config.updates?.url ?? null;\n}\n\nexport function getAppVersion(config: Pick<ExpoConfig, 'version'>): string {\n return config.version ?? '1.0.0';\n}\n\nexport function getNativeVersion(\n config: Pick<ExpoConfig, 'version'> & {\n android?: Pick<Android, 'versionCode'>;\n ios?: Pick<IOS, 'buildNumber'>;\n },\n platform: 'android' | 'ios'\n): string {\n const version = IOSVersion.getVersion(config);\n switch (platform) {\n case 'ios': {\n const buildNumber = IOSVersion.getBuildNumber(config);\n return `${version}(${buildNumber})`;\n }\n case 'android': {\n const versionCode = AndroidVersion.getVersionCode(config);\n return `${version}(${versionCode})`;\n }\n default: {\n throw new Error(\n `\"${platform}\" is not a supported platform. Choose either \"ios\" or \"android\".`\n );\n }\n }\n}\n\nexport async function getRuntimeVersionNullableAsync(\n ...[projectRoot, config, platform]: Parameters<typeof getRuntimeVersionAsync>\n): Promise<string | null> {\n try {\n return await getRuntimeVersionAsync(projectRoot, config, platform);\n } catch (e) {\n if (boolish('EXPO_DEBUG', false)) {\n console.log(e);\n }\n return null;\n }\n}\n\nexport async function getRuntimeVersionAsync(\n projectRoot: string,\n config: Pick<ExpoConfig, 'version' | 'runtimeVersion' | 'sdkVersion'> & {\n android?: Pick<Android, 'versionCode' | 'runtimeVersion'>;\n ios?: Pick<IOS, 'buildNumber' | 'runtimeVersion'>;\n },\n platform: 'android' | 'ios'\n): Promise<string | null> {\n const runtimeVersion = config[platform]?.runtimeVersion ?? config.runtimeVersion;\n if (!runtimeVersion) {\n return null;\n }\n\n if (typeof runtimeVersion === 'string') {\n if (runtimeVersion === FINGERPRINT_RUNTIME_VERSION_SENTINEL) {\n throw new Error(\n `${FINGERPRINT_RUNTIME_VERSION_SENTINEL} is a reserved value for runtime version. To use a fingerprint runtime version, use the \"fingerprint\" runtime version policy.`\n );\n }\n return runtimeVersion;\n } else if (!runtimeVersion.policy) {\n throw new Error(\n `\"${runtimeVersion}\" is not a valid runtime version. Only a string or a runtime version policy is supported.`\n );\n } else if (runtimeVersion.policy === 'fingerprint') {\n return FINGERPRINT_RUNTIME_VERSION_SENTINEL;\n } else {\n return await resolveRuntimeVersionPolicyAsync(runtimeVersion.policy, config, platform);\n }\n}\n\nexport async function resolveRuntimeVersionPolicyAsync(\n policy: 'appVersion' | 'nativeVersion' | 'sdkVersion',\n config: Pick<ExpoConfig, 'version' | 'sdkVersion'> & {\n android?: Pick<Android, 'versionCode'>;\n ios?: Pick<IOS, 'buildNumber'>;\n },\n platform: 'android' | 'ios'\n): Promise<string> {\n if (policy === 'appVersion') {\n return getAppVersion(config);\n } else if (policy === 'nativeVersion') {\n return getNativeVersion(config, platform);\n } else if (policy === 'sdkVersion') {\n if (!config.sdkVersion) {\n throw new Error(\"An SDK version must be defined when using the 'sdkVersion' runtime policy.\");\n }\n return getRuntimeVersionForSDKVersion(config.sdkVersion);\n } else {\n // fingerprint is resolvable only at build time (not in config plugin).\n throw new Error(`\"${policy}\" is not a valid runtime version policy type.`);\n }\n}\n\nexport function getSDKVersion(config: Pick<ExpoConfigUpdates, 'sdkVersion'>): string | null {\n return typeof config.sdkVersion === 'string' ? config.sdkVersion : null;\n}\n\nexport function getUpdatesEnabled(config: Pick<ExpoConfigUpdates, 'updates'>): boolean {\n // allow override of enabled property\n if (config.updates?.enabled !== undefined) {\n return config.updates.enabled;\n }\n\n return getUpdateUrl(config) !== null;\n}\n\nexport function getUpdatesUseEmbeddedUpdate(config: Pick<ExpoConfigUpdates, 'updates'>): boolean {\n if (config.updates?.useEmbeddedUpdate !== undefined) {\n return config.updates.useEmbeddedUpdate;\n }\n\n return true;\n}\n\nexport function getUpdatesBsdiffPatchSupportEnabled(\n config: Pick<ExpoConfigUpdates, 'updates'>\n): boolean {\n if (config.updates?.enableBsdiffPatchSupport !== undefined) {\n return config.updates.enableBsdiffPatchSupport;\n }\n return false;\n}\n\nexport function getUpdatesTimeout(config: Pick<ExpoConfigUpdates, 'updates'>): number {\n return config.updates?.fallbackToCacheTimeout ?? 0;\n}\n\nexport function getUpdatesCheckOnLaunch(\n config: Pick<ExpoConfigUpdates, 'updates'>,\n expoUpdatesPackageVersion?: string | null\n): 'NEVER' | 'ERROR_RECOVERY_ONLY' | 'ALWAYS' | 'WIFI_ONLY' {\n if (config.updates?.checkAutomatically === 'ON_ERROR_RECOVERY') {\n // native 'ERROR_RECOVERY_ONLY' option was only introduced in 0.11.x\n if (expoUpdatesPackageVersion && semver.gte(expoUpdatesPackageVersion, '0.11.0')) {\n return 'ERROR_RECOVERY_ONLY';\n }\n return 'NEVER';\n } else if (config.updates?.checkAutomatically === 'ON_LOAD') {\n return 'ALWAYS';\n } else if (config.updates?.checkAutomatically === 'WIFI_ONLY') {\n return 'WIFI_ONLY';\n } else if (config.updates?.checkAutomatically === 'NEVER') {\n return 'NEVER';\n }\n return 'ALWAYS';\n}\n\nexport function getUpdatesCodeSigningCertificate(\n projectRoot: string,\n config: Pick<ExpoConfigUpdates, 'updates'>\n): string | undefined {\n const codeSigningCertificatePath = config.updates?.codeSigningCertificate;\n if (!codeSigningCertificatePath) {\n return undefined;\n }\n\n const finalPath = path.join(projectRoot, codeSigningCertificatePath);\n if (!fs.existsSync(finalPath)) {\n throw new Error(`File not found at \\`updates.codeSigningCertificate\\` path: ${finalPath}`);\n }\n\n return fs.readFileSync(finalPath, 'utf8');\n}\n\nexport function getUpdatesCodeSigningMetadata(\n config: Pick<ExpoConfigUpdates, 'updates'>\n): NonNullable<ExpoConfigUpdates['updates']>['codeSigningMetadata'] {\n return config.updates?.codeSigningMetadata;\n}\n\nexport function getUpdatesCodeSigningMetadataStringified(\n config: Pick<ExpoConfigUpdates, 'updates'>\n): string | undefined {\n const metadata = getUpdatesCodeSigningMetadata(config);\n if (!metadata) {\n return undefined;\n }\n\n return JSON.stringify(metadata);\n}\n\nexport function getUpdatesRequestHeaders(\n config: Pick<ExpoConfigUpdates, 'updates'>\n): NonNullable<ExpoConfigUpdates['updates']>['requestHeaders'] {\n return config.updates?.requestHeaders;\n}\n\nexport function getUpdatesRequestHeadersStringified(\n config: Pick<ExpoConfigUpdates, 'updates'>\n): string | undefined {\n const metadata = getUpdatesRequestHeaders(config);\n if (!metadata) {\n return undefined;\n }\n\n return JSON.stringify(metadata);\n}\n\nexport function getDisableAntiBrickingMeasures(\n config: Pick<ExpoConfigUpdates, 'updates'>\n): boolean | undefined {\n return config.updates?.disableAntiBrickingMeasures;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AACA,SAAAA,oBAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,mBAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,IAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,GAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,QAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,OAAA,YAAAA,CAAA;I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C,sBAAsB;EACzE,IAAI,CAACD,0BAA0B,EAAE;IAC/B,OAAOb,SAAS;EAClB;EAEA,MAAMe,SAAS,GAAGC,eAAI,CAACC,IAAI,CAACtD,WAAW,EAAEkD,0BAA0B,CAAC;EACpE,IAAI,CAAC9C,aAAE,CAACC,UAAU,CAAC+C,SAAS,CAAC,EAAE;IAC7B,MAAM,IAAI7B,KAAK,CAAC,8DAA8D6B,SAAS,EAAE,CAAC;EAC5F;EAEA,OAAOhD,aAAE,CAACK,YAAY,CAAC2C,SAAS,EAAE,MAAM,CAAC;AAC3C;AAEO,SAASG,6BAA6BA,CAC3C3C,MAA0C,EACwB;EAClE,OAAOA,MAAM,CAACC,OAAO,EAAE2C,mBAAmB;AAC5C;AAEO,SAASC,wCAAwCA,CACtD7C,MAA0C,EACtB;EACpB,MAAM8C,QAAQ,GAAGH,6BAA6B,CAAC3C,MAAM,CAAC;EACtD,IAAI,CAAC8C,QAAQ,EAAE;IACb,OAAOrB,SAAS;EAClB;EAEA,OAAO9B,IAAI,CAACoD,SAAS,CAACD,QAAQ,CAAC;AACjC;AAEO,SAASE,wBAAwBA,CACtChD,MAA0C,EACmB;EAC7D,OAAOA,MAAM,CAACC,OAAO,EAAEgD,cAAc;AACvC;AAEO,SAASC,mCAAmCA,CACjDlD,MAA0C,EACtB;EACpB,MAAM8C,QAAQ,GAAGE,wBAAwB,CAAChD,MAAM,CAAC;EACjD,IAAI,CAAC8C,QAAQ,EAAE;IACb,OAAOrB,SAAS;EAClB;EAEA,OAAO9B,IAAI,CAACoD,SAAS,CAACD,QAAQ,CAAC;AACjC;AAEO,SAASK,8BAA8BA,CAC5CnD,MAA0C,EACrB;EACrB,OAAOA,MAAM,CAACC,OAAO,EAAEmD,2BAA2B;AACpD","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"Updates.js","names":["_requireUtils","data","require","_sdkRuntimeVersions","_fs","_interopRequireDefault","_getenv","_path","_semver","AndroidVersion","_interopRequireWildcard","IOSVersion","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","FINGERPRINT_RUNTIME_VERSION_SENTINEL","exports","getExpoUpdatesPackageVersion","projectRoot","expoUpdatesPackageJsonPath","resolveFrom","packageJson","JSON","parse","fs","readFileSync","version","getUpdateUrl","config","updates","url","getAppVersion","getNativeVersion","platform","getVersion","buildNumber","getBuildNumber","versionCode","getVersionCode","Error","getRuntimeVersionNullableAsync","getRuntimeVersionAsync","boolish","console","log","runtimeVersion","policy","resolveRuntimeVersionPolicyAsync","sdkVersion","getRuntimeVersionForSDKVersion","getSDKVersion","getUpdatesEnabled","enabled","undefined","getUpdatesUseEmbeddedUpdate","useEmbeddedUpdate","getUpdatesBsdiffPatchSupportEnabled","enableBsdiffPatchSupport","getUpdatesTimeout","fallbackToCacheTimeout","getUpdatesCheckOnLaunch","expoUpdatesPackageVersion","checkAutomatically","semver","gte","getUpdatesCodeSigningCertificate","codeSigningCertificatePath","codeSigningCertificate","finalPath","path","join","existsSync","getUpdatesCodeSigningMetadata","codeSigningMetadata","getUpdatesCodeSigningMetadataStringified","metadata","stringify","getUpdatesRequestHeaders","requestHeaders","getUpdatesRequestHeadersStringified","getDisableAntiBrickingMeasures","disableAntiBrickingMeasures"],"sources":["../../src/utils/Updates.ts"],"sourcesContent":["import type { Android, ExpoConfig, IOS } from '@expo/config-types';\nimport { resolveFrom } from '@expo/require-utils';\nimport { getRuntimeVersionForSDKVersion } from '@expo/sdk-runtime-versions';\nimport fs from 'fs';\nimport { boolish } from 'getenv';\nimport path from 'path';\nimport semver from 'semver';\n\nimport * as AndroidVersion from '../android/Version';\nimport * as IOSVersion from '../ios/Version';\n\nexport type ExpoConfigUpdates = Pick<\n ExpoConfig,\n 'sdkVersion' | 'runtimeVersion' | 'updates' | 'slug'\n>;\n\nexport const FINGERPRINT_RUNTIME_VERSION_SENTINEL = 'file:fingerprint';\n\nexport function getExpoUpdatesPackageVersion(projectRoot: string): string | null {\n const expoUpdatesPackageJsonPath = resolveFrom(projectRoot, 'expo-updates/package.json');\n if (!expoUpdatesPackageJsonPath) {\n return null;\n }\n const packageJson = JSON.parse(fs.readFileSync(expoUpdatesPackageJsonPath, 'utf8'));\n return packageJson.version;\n}\n\nexport function getUpdateUrl(config: Pick<ExpoConfigUpdates, 'updates'>): string | null {\n return config.updates?.url ?? null;\n}\n\nexport function getAppVersion(config: Pick<ExpoConfig, 'version'>): string {\n return config.version ?? '1.0.0';\n}\n\nexport function getNativeVersion(\n config: Pick<ExpoConfig, 'version'> & {\n android?: Pick<Android, 'versionCode'>;\n ios?: Pick<IOS, 'buildNumber'>;\n },\n platform: 'android' | 'ios'\n): string {\n const version = IOSVersion.getVersion(config);\n switch (platform) {\n case 'ios': {\n const buildNumber = IOSVersion.getBuildNumber(config);\n return `${version}(${buildNumber})`;\n }\n case 'android': {\n const versionCode = AndroidVersion.getVersionCode(config);\n return `${version}(${versionCode})`;\n }\n default: {\n throw new Error(\n `\"${platform}\" is not a supported platform. Choose either \"ios\" or \"android\".`\n );\n }\n }\n}\n\nexport async function getRuntimeVersionNullableAsync(\n ...[projectRoot, config, platform]: Parameters<typeof getRuntimeVersionAsync>\n): Promise<string | null> {\n try {\n return await getRuntimeVersionAsync(projectRoot, config, platform);\n } catch (e) {\n if (boolish('EXPO_DEBUG', false)) {\n console.log(e);\n }\n return null;\n }\n}\n\nexport async function getRuntimeVersionAsync(\n projectRoot: string,\n config: Pick<ExpoConfig, 'version' | 'runtimeVersion' | 'sdkVersion'> & {\n android?: Pick<Android, 'versionCode' | 'runtimeVersion'>;\n ios?: Pick<IOS, 'buildNumber' | 'runtimeVersion'>;\n },\n platform: 'android' | 'ios'\n): Promise<string | null> {\n const runtimeVersion = config[platform]?.runtimeVersion ?? config.runtimeVersion;\n if (!runtimeVersion) {\n return null;\n }\n\n if (typeof runtimeVersion === 'string') {\n if (runtimeVersion === FINGERPRINT_RUNTIME_VERSION_SENTINEL) {\n throw new Error(\n `${FINGERPRINT_RUNTIME_VERSION_SENTINEL} is a reserved value for runtime version. To use a fingerprint runtime version, use the \"fingerprint\" runtime version policy.`\n );\n }\n return runtimeVersion;\n } else if (!runtimeVersion.policy) {\n throw new Error(\n `\"${runtimeVersion}\" is not a valid runtime version. Only a string or a runtime version policy is supported.`\n );\n } else if (runtimeVersion.policy === 'fingerprint') {\n return FINGERPRINT_RUNTIME_VERSION_SENTINEL;\n } else {\n return await resolveRuntimeVersionPolicyAsync(runtimeVersion.policy, config, platform);\n }\n}\n\nexport async function resolveRuntimeVersionPolicyAsync(\n policy: 'appVersion' | 'nativeVersion' | 'sdkVersion',\n config: Pick<ExpoConfig, 'version' | 'sdkVersion'> & {\n android?: Pick<Android, 'versionCode'>;\n ios?: Pick<IOS, 'buildNumber'>;\n },\n platform: 'android' | 'ios'\n): Promise<string> {\n if (policy === 'appVersion') {\n return getAppVersion(config);\n } else if (policy === 'nativeVersion') {\n return getNativeVersion(config, platform);\n } else if (policy === 'sdkVersion') {\n if (!config.sdkVersion) {\n throw new Error(\"An SDK version must be defined when using the 'sdkVersion' runtime policy.\");\n }\n return getRuntimeVersionForSDKVersion(config.sdkVersion);\n } else {\n // fingerprint is resolvable only at build time (not in config plugin).\n throw new Error(`\"${policy}\" is not a valid runtime version policy type.`);\n }\n}\n\nexport function getSDKVersion(config: Pick<ExpoConfigUpdates, 'sdkVersion'>): string | null {\n return typeof config.sdkVersion === 'string' ? config.sdkVersion : null;\n}\n\nexport function getUpdatesEnabled(config: Pick<ExpoConfigUpdates, 'updates'>): boolean {\n // allow override of enabled property\n if (config.updates?.enabled !== undefined) {\n return config.updates.enabled;\n }\n\n return getUpdateUrl(config) !== null;\n}\n\nexport function getUpdatesUseEmbeddedUpdate(config: Pick<ExpoConfigUpdates, 'updates'>): boolean {\n if (config.updates?.useEmbeddedUpdate !== undefined) {\n return config.updates.useEmbeddedUpdate;\n }\n\n return true;\n}\n\nexport function getUpdatesBsdiffPatchSupportEnabled(\n config: Pick<ExpoConfigUpdates, 'updates'>\n): boolean {\n if (config.updates?.enableBsdiffPatchSupport !== undefined) {\n return config.updates.enableBsdiffPatchSupport;\n }\n return true;\n}\n\nexport function getUpdatesTimeout(config: Pick<ExpoConfigUpdates, 'updates'>): number {\n return config.updates?.fallbackToCacheTimeout ?? 0;\n}\n\nexport function getUpdatesCheckOnLaunch(\n config: Pick<ExpoConfigUpdates, 'updates'>,\n expoUpdatesPackageVersion?: string | null\n): 'NEVER' | 'ERROR_RECOVERY_ONLY' | 'ALWAYS' | 'WIFI_ONLY' {\n if (config.updates?.checkAutomatically === 'ON_ERROR_RECOVERY') {\n // native 'ERROR_RECOVERY_ONLY' option was only introduced in 0.11.x\n if (expoUpdatesPackageVersion && semver.gte(expoUpdatesPackageVersion, '0.11.0')) {\n return 'ERROR_RECOVERY_ONLY';\n }\n return 'NEVER';\n } else if (config.updates?.checkAutomatically === 'ON_LOAD') {\n return 'ALWAYS';\n } else if (config.updates?.checkAutomatically === 'WIFI_ONLY') {\n return 'WIFI_ONLY';\n } else if (config.updates?.checkAutomatically === 'NEVER') {\n return 'NEVER';\n }\n return 'ALWAYS';\n}\n\nexport function getUpdatesCodeSigningCertificate(\n projectRoot: string,\n config: Pick<ExpoConfigUpdates, 'updates'>\n): string | undefined {\n const codeSigningCertificatePath = config.updates?.codeSigningCertificate;\n if (!codeSigningCertificatePath) {\n return undefined;\n }\n\n const finalPath = path.join(projectRoot, codeSigningCertificatePath);\n if (!fs.existsSync(finalPath)) {\n throw new Error(`File not found at \\`updates.codeSigningCertificate\\` path: ${finalPath}`);\n }\n\n return fs.readFileSync(finalPath, 'utf8');\n}\n\nexport function getUpdatesCodeSigningMetadata(\n config: Pick<ExpoConfigUpdates, 'updates'>\n): NonNullable<ExpoConfigUpdates['updates']>['codeSigningMetadata'] {\n return config.updates?.codeSigningMetadata;\n}\n\nexport function getUpdatesCodeSigningMetadataStringified(\n config: Pick<ExpoConfigUpdates, 'updates'>\n): string | undefined {\n const metadata = getUpdatesCodeSigningMetadata(config);\n if (!metadata) {\n return undefined;\n }\n\n return JSON.stringify(metadata);\n}\n\nexport function getUpdatesRequestHeaders(\n config: Pick<ExpoConfigUpdates, 'updates'>\n): NonNullable<ExpoConfigUpdates['updates']>['requestHeaders'] {\n return config.updates?.requestHeaders;\n}\n\nexport function getUpdatesRequestHeadersStringified(\n config: Pick<ExpoConfigUpdates, 'updates'>\n): string | undefined {\n const metadata = getUpdatesRequestHeaders(config);\n if (!metadata) {\n return undefined;\n }\n\n return JSON.stringify(metadata);\n}\n\nexport function getDisableAntiBrickingMeasures(\n config: Pick<ExpoConfigUpdates, 'updates'>\n): boolean | undefined {\n return config.updates?.disableAntiBrickingMeasures;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AACA,SAAAA,cAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,aAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,oBAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,mBAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,IAAA;EAAA,MAAAH,IAAA,GAAAI,sBAAA,CAAAH,OAAA;EAAAE,GAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,QAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,OAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,MAAA;EAAA,MAAAN,IAAA,GAAAI,sBAAA,CAAAH,OAAA;EAAAK,KAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,QAAA;EAAA,MAAAP,IAAA,GAAAI,sBAAA,CAAAH,OAAA;EAAAM,OAAA,YAAAA,C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C,MAA0C,EACtB;EACpB,MAAM+C,QAAQ,GAAGH,6BAA6B,CAAC5C,MAAM,CAAC;EACtD,IAAI,CAAC+C,QAAQ,EAAE;IACb,OAAOtB,SAAS;EAClB;EAEA,OAAO/B,IAAI,CAACsD,SAAS,CAACD,QAAQ,CAAC;AACjC;AAEO,SAASE,wBAAwBA,CACtCjD,MAA0C,EACmB;EAC7D,OAAOA,MAAM,CAACC,OAAO,EAAEiD,cAAc;AACvC;AAEO,SAASC,mCAAmCA,CACjDnD,MAA0C,EACtB;EACpB,MAAM+C,QAAQ,GAAGE,wBAAwB,CAACjD,MAAM,CAAC;EACjD,IAAI,CAAC+C,QAAQ,EAAE;IACb,OAAOtB,SAAS;EAClB;EAEA,OAAO/B,IAAI,CAACsD,SAAS,CAACD,QAAQ,CAAC;AACjC;AAEO,SAASK,8BAA8BA,CAC5CpD,MAA0C,EACrB;EACrB,OAAOA,MAAM,CAACC,OAAO,EAAEoD,2BAA2B;AACpD","ignoreList":[]}
|
package/build/utils/modules.js
CHANGED
|
@@ -34,7 +34,28 @@ async function directoryExistsAsync(file) {
|
|
|
34
34
|
}
|
|
35
35
|
function fileExists(file) {
|
|
36
36
|
try {
|
|
37
|
-
|
|
37
|
+
const stat = _fs().default.lstatSync(file, {
|
|
38
|
+
throwIfNoEntry: false
|
|
39
|
+
});
|
|
40
|
+
if (!stat) {
|
|
41
|
+
return false;
|
|
42
|
+
} else if (stat.isFile()) {
|
|
43
|
+
return true;
|
|
44
|
+
} else if (stat.isSymbolicLink()) {
|
|
45
|
+
return isRealpathFileSync(file);
|
|
46
|
+
} else {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
} catch {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
function isRealpathFileSync(target) {
|
|
54
|
+
try {
|
|
55
|
+
const realpath = _fs().default.realpathSync(target);
|
|
56
|
+
return !!_fs().default.lstatSync(realpath, {
|
|
57
|
+
throwIfNoEntry: false
|
|
58
|
+
})?.isFile();
|
|
38
59
|
} catch {
|
|
39
60
|
return false;
|
|
40
61
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modules.js","names":["_fs","data","_interopRequireDefault","require","e","__esModule","default","statAsync","file","fs","promises","stat","fileExistsAsync","isFile","directoryExistsAsync","isDirectory","fileExists","
|
|
1
|
+
{"version":3,"file":"modules.js","names":["_fs","data","_interopRequireDefault","require","e","__esModule","default","statAsync","file","fs","promises","stat","fileExistsAsync","isFile","directoryExistsAsync","isDirectory","fileExists","lstatSync","throwIfNoEntry","isSymbolicLink","isRealpathFileSync","target","realpath","realpathSync"],"sources":["../../src/utils/modules.ts"],"sourcesContent":["import fs from 'fs';\n\n/**\n * A non-failing version of async FS stat.\n *\n * @param file\n */\nasync function statAsync(file: string): Promise<fs.Stats | null> {\n try {\n return await fs.promises.stat(file);\n } catch {\n return null;\n }\n}\n\nexport async function fileExistsAsync(file: string): Promise<boolean> {\n return (await statAsync(file))?.isFile() ?? false;\n}\n\nexport async function directoryExistsAsync(file: string): Promise<boolean> {\n return (await statAsync(file))?.isDirectory() ?? false;\n}\n\nexport function fileExists(file: string): boolean {\n try {\n const stat = fs.lstatSync(file, { throwIfNoEntry: false });\n if (!stat) {\n return false;\n } else if (stat.isFile()) {\n return true;\n } else if (stat.isSymbolicLink()) {\n return isRealpathFileSync(file);\n } else {\n return false;\n }\n } catch {\n return false;\n }\n}\n\nfunction isRealpathFileSync(target: string): boolean {\n try {\n const realpath = fs.realpathSync(target);\n return !!fs.lstatSync(realpath, { throwIfNoEntry: false })?.isFile();\n } catch {\n return false;\n }\n}\n"],"mappings":";;;;;;;;AAAA,SAAAA,IAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,GAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAoB,SAAAC,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CA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C,CAAC,MAAM;IACN,OAAO,KAAK;EACd;AACF","ignoreList":[]}
|
|
@@ -7,7 +7,7 @@ export declare const pluginFileName = "app.plugin.js";
|
|
|
7
7
|
* 1. Is the reference a relative file path or an import specifier with file path? e.g. `./file.js`, `pkg/file.js` or `@org/pkg/file.js`?
|
|
8
8
|
* - Resolve the config plugin as-is
|
|
9
9
|
* 2. If the reference a module? e.g. `expo-font`
|
|
10
|
-
* - Resolve the root `app.plugin.js` file within the module
|
|
10
|
+
* - Resolve the root `app.plugin.{js,cjs,mjs,ts,cts,mts}` file within the module
|
|
11
11
|
* 3. Does the module have a valid config plugin in the `main` field?
|
|
12
12
|
* - Resolve the `main` entry point as config plugin
|
|
13
13
|
*/
|
|
@@ -12,23 +12,16 @@ exports.resolveConfigPluginExport = resolveConfigPluginExport;
|
|
|
12
12
|
exports.resolveConfigPluginFunction = resolveConfigPluginFunction;
|
|
13
13
|
exports.resolveConfigPluginFunctionWithInfo = resolveConfigPluginFunctionWithInfo;
|
|
14
14
|
exports.resolvePluginForModule = resolvePluginForModule;
|
|
15
|
-
function
|
|
16
|
-
const data =
|
|
17
|
-
|
|
15
|
+
function _requireUtils() {
|
|
16
|
+
const data = require("@expo/require-utils");
|
|
17
|
+
_requireUtils = function () {
|
|
18
18
|
return data;
|
|
19
19
|
};
|
|
20
20
|
return data;
|
|
21
21
|
}
|
|
22
|
-
function
|
|
23
|
-
const data =
|
|
24
|
-
|
|
25
|
-
return data;
|
|
26
|
-
};
|
|
27
|
-
return data;
|
|
28
|
-
}
|
|
29
|
-
function _resolveFrom() {
|
|
30
|
-
const data = _interopRequireDefault(require("resolve-from"));
|
|
31
|
-
_resolveFrom = function () {
|
|
22
|
+
function _assert() {
|
|
23
|
+
const data = _interopRequireDefault(require("assert"));
|
|
24
|
+
_assert = function () {
|
|
32
25
|
return data;
|
|
33
26
|
};
|
|
34
27
|
return data;
|
|
@@ -40,18 +33,13 @@ function _errors() {
|
|
|
40
33
|
};
|
|
41
34
|
return data;
|
|
42
35
|
}
|
|
43
|
-
function _modules() {
|
|
44
|
-
const data = require("./modules");
|
|
45
|
-
_modules = function () {
|
|
46
|
-
return data;
|
|
47
|
-
};
|
|
48
|
-
return data;
|
|
49
|
-
}
|
|
50
|
-
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); }
|
|
51
36
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
52
|
-
//
|
|
37
|
+
// Re-exported for back-compat with external consumers.
|
|
53
38
|
const pluginFileName = exports.pluginFileName = 'app.plugin.js';
|
|
54
39
|
|
|
40
|
+
// `.js` first keeps the published-artifact case at one stat.
|
|
41
|
+
const pluginExtensions = ['.js', '.cjs', '.mjs', '.ts', '.cts', '.mts'];
|
|
42
|
+
|
|
55
43
|
/**
|
|
56
44
|
* Resolve the config plugin from a node module or package.
|
|
57
45
|
* If the module or package does not include a config plugin, this function throws a `PluginError`.
|
|
@@ -59,32 +47,35 @@ const pluginFileName = exports.pluginFileName = 'app.plugin.js';
|
|
|
59
47
|
* 1. Is the reference a relative file path or an import specifier with file path? e.g. `./file.js`, `pkg/file.js` or `@org/pkg/file.js`?
|
|
60
48
|
* - Resolve the config plugin as-is
|
|
61
49
|
* 2. If the reference a module? e.g. `expo-font`
|
|
62
|
-
* - Resolve the root `app.plugin.js` file within the module
|
|
50
|
+
* - Resolve the root `app.plugin.{js,cjs,mjs,ts,cts,mts}` file within the module
|
|
63
51
|
* 3. Does the module have a valid config plugin in the `main` field?
|
|
64
52
|
* - Resolve the `main` entry point as config plugin
|
|
65
53
|
*/
|
|
66
54
|
function resolvePluginForModule(projectRoot, pluginReference) {
|
|
67
55
|
if (moduleNameIsDirectFileReference(pluginReference)) {
|
|
68
|
-
|
|
69
|
-
|
|
56
|
+
const pluginScriptFile = (0, _requireUtils().resolveFrom)(projectRoot, pluginReference, {
|
|
57
|
+
extensions: pluginExtensions
|
|
58
|
+
});
|
|
70
59
|
if (pluginScriptFile) {
|
|
71
60
|
return {
|
|
72
|
-
|
|
73
|
-
isPluginFile: pluginScriptFile.endsWith(path().sep + pluginFileName),
|
|
61
|
+
isPluginFile: false,
|
|
74
62
|
filePath: pluginScriptFile
|
|
75
63
|
};
|
|
76
64
|
}
|
|
77
65
|
} else if (moduleNameIsPackageReference(pluginReference)) {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
66
|
+
const pluginPackageFile = (0, _requireUtils().resolveFrom)(projectRoot, `${pluginReference}/app.plugin`, {
|
|
67
|
+
extensions: pluginExtensions
|
|
68
|
+
});
|
|
69
|
+
if (pluginPackageFile) {
|
|
81
70
|
return {
|
|
82
71
|
isPluginFile: true,
|
|
83
72
|
filePath: pluginPackageFile
|
|
84
73
|
};
|
|
85
74
|
}
|
|
86
|
-
//
|
|
87
|
-
const packageMainEntry =
|
|
75
|
+
// Skip the extension/index probes — Node's resolver (step 4) handles `main`.
|
|
76
|
+
const packageMainEntry = (0, _requireUtils().resolveFrom)(projectRoot, pluginReference, {
|
|
77
|
+
extensions: []
|
|
78
|
+
});
|
|
88
79
|
if (packageMainEntry) {
|
|
89
80
|
return {
|
|
90
81
|
isPluginFile: false,
|
|
@@ -144,27 +135,16 @@ function resolveConfigPluginFunctionWithInfo(projectRoot, pluginReference) {
|
|
|
144
135
|
} = resolvePluginForModule(projectRoot, pluginReference);
|
|
145
136
|
let result;
|
|
146
137
|
try {
|
|
147
|
-
result =
|
|
138
|
+
result = (0, _requireUtils().loadModuleSync)(pluginFile);
|
|
148
139
|
} catch (error) {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
const errorWithCode = error;
|
|
154
|
-
underlyingError = `${errorWithCode.message} ${errorWithCode.code ?? ''}`;
|
|
155
|
-
stack = errorWithCode.stack;
|
|
156
|
-
} else {
|
|
157
|
-
underlyingError = String(error);
|
|
158
|
-
}
|
|
159
|
-
let errorMessage = `Unable to resolve a valid config plugin for ${pluginReference}.\n`;
|
|
160
|
-
if (!isPluginFile) {
|
|
161
|
-
errorMessage += `• No "${pluginFileName}" file found in ${pluginReference}: config plugins are typically exported from an "${pluginFileName}" file in the package root.\n`;
|
|
140
|
+
let message = error instanceof Error ? error.message : String(error);
|
|
141
|
+
// Don't clobber `loadModuleSync`'s code-framed error
|
|
142
|
+
if (!isPluginFile && !moduleNameIsDirectFileReference(pluginReference)) {
|
|
143
|
+
message += `\n\nNo "app.plugin.{js,cjs,mjs,ts,cts,mts}" file was found in "${pluginReference}", so the package's main entry was loaded instead. Config plugins are typically exported from an "${pluginFileName}" file in the package root.\nLearn more: https://docs.expo.dev/guides/config-plugins/`;
|
|
162
144
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
if (stack) {
|
|
167
|
-
pluginError.stack = stack;
|
|
145
|
+
const pluginError = new (_errors().PluginError)(message, 'INVALID_PLUGIN_IMPORT');
|
|
146
|
+
if (error instanceof Error && error.stack) {
|
|
147
|
+
pluginError.stack = error.stack;
|
|
168
148
|
}
|
|
169
149
|
throw pluginError;
|
|
170
150
|
}
|
|
@@ -212,12 +192,4 @@ function resolveConfigPluginExport({
|
|
|
212
192
|
}
|
|
213
193
|
return plugin;
|
|
214
194
|
}
|
|
215
|
-
function requirePluginFile(filePath) {
|
|
216
|
-
try {
|
|
217
|
-
return require(filePath);
|
|
218
|
-
} catch (error) {
|
|
219
|
-
// TODO: Improve error messages
|
|
220
|
-
throw error;
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
195
|
//# sourceMappingURL=plugin-resolver.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-resolver.js","names":["_assert","data","_interopRequireDefault","require","path","_interopRequireWildcard","_resolveFrom","_errors","_modules","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","pluginFileName","exports","resolvePluginForModule","projectRoot","pluginReference","moduleNameIsDirectFileReference","pluginScriptFile","resolveFrom","silent","isPluginFile","endsWith","sep","filePath","moduleNameIsPackageReference","pluginPackageFile","fileExists","packageMainEntry","PluginError","pathIsFilePath","name","match","slashCount","split","length","startsWith","normalizeStaticPlugin","plugin","Array","isArray","assert","undefined","assertInternalProjectRoot","resolveConfigPluginFunction","resolveConfigPluginFunctionWithInfo","pluginFile","result","requirePluginFile","error","learnMoreLink","underlyingError","stack","Error","errorWithCode","message","code","String","errorMessage","pluginError","resolveConfigPluginExport"],"sources":["../../src/utils/plugin-resolver.ts"],"sourcesContent":["import assert from 'assert';\nimport * as path from 'path';\nimport resolveFrom from 'resolve-from';\n\nimport { PluginError } from './errors';\nimport type { ConfigPlugin, StaticPlugin } from '../Plugin.types';\nimport { fileExists } from './modules';\n// Default plugin entry file name.\nexport const pluginFileName = 'app.plugin.js';\n\n/**\n * Resolve the config plugin from a node module or package.\n * If the module or package does not include a config plugin, this function throws a `PluginError`.\n * The resolution is done in following order:\n * 1. Is the reference a relative file path or an import specifier with file path? e.g. `./file.js`, `pkg/file.js` or `@org/pkg/file.js`?\n * - Resolve the config plugin as-is\n * 2. If the reference a module? e.g. `expo-font`\n * - Resolve the root `app.plugin.js` file within the module, e.g. `expo-font/app.plugin.js`\n * 3. Does the module have a valid config plugin in the `main` field?\n * - Resolve the `main` entry point as config plugin\n */\nexport function resolvePluginForModule(\n projectRoot: string,\n pluginReference: string\n): { filePath: string; isPluginFile: boolean } {\n if (moduleNameIsDirectFileReference(pluginReference)) {\n // Only resolve `./file.js`, `package/file.js`, `@org/package/file.js`\n const pluginScriptFile = resolveFrom.silent(projectRoot, pluginReference);\n if (pluginScriptFile) {\n return {\n // NOTE(cedric): `path.sep` is required here, we are resolving the absolute path, not the plugin reference\n isPluginFile: pluginScriptFile.endsWith(path.sep + pluginFileName),\n filePath: pluginScriptFile,\n };\n }\n } else if (moduleNameIsPackageReference(pluginReference)) {\n // Only resolve `package -> package/app.plugin.js`, `@org/package -> @org/package/app.plugin.js`\n const pluginPackageFile = resolveFrom.silent(\n projectRoot,\n `${pluginReference}/${pluginFileName}`\n );\n if (pluginPackageFile && fileExists(pluginPackageFile)) {\n return { isPluginFile: true, filePath: pluginPackageFile };\n }\n // Try to resole the `main` entry as config plugin\n const packageMainEntry = resolveFrom.silent(projectRoot, pluginReference);\n if (packageMainEntry) {\n return { isPluginFile: false, filePath: packageMainEntry };\n }\n }\n\n throw new PluginError(\n `Failed to resolve plugin for module \"${pluginReference}\" relative to \"${projectRoot}\". Do you have node modules installed?`,\n 'PLUGIN_NOT_FOUND'\n );\n}\n\n// TODO: Test windows\nfunction pathIsFilePath(name: string): boolean {\n // Matches lines starting with: . / ~/\n return !!name.match(/^(\\.|~\\/|\\/)/g);\n}\n\nexport function moduleNameIsDirectFileReference(name: string): boolean {\n if (pathIsFilePath(name)) {\n return true;\n }\n\n const slashCount = name.split('/')?.length;\n // Orgs (like @expo/config ) should have more than one slash to be a direct file.\n if (name.startsWith('@')) {\n return slashCount > 2;\n }\n\n // Regular packages should be considered direct reference if they have more than one slash.\n return slashCount > 1;\n}\n\nexport function moduleNameIsPackageReference(name: string): boolean {\n const slashCount = name.split('/')?.length;\n return name.startsWith('@') ? slashCount === 2 : slashCount === 1;\n}\n\nexport function normalizeStaticPlugin(plugin: StaticPlugin | ConfigPlugin | string): StaticPlugin {\n if (Array.isArray(plugin)) {\n assert(\n plugin.length > 0 && plugin.length < 3,\n `Wrong number of arguments provided for static config plugin, expected either 1 or 2, got ${plugin.length}`\n );\n return plugin;\n }\n return [plugin, undefined];\n}\n\nexport function assertInternalProjectRoot(projectRoot?: string): asserts projectRoot {\n assert(\n projectRoot,\n `Unexpected: Config \\`_internal.projectRoot\\` isn't defined by expo-cli, this is a bug.`\n );\n}\n\n// Resolve the module function and assert type\nexport function resolveConfigPluginFunction(projectRoot: string, pluginReference: string) {\n const { plugin } = resolveConfigPluginFunctionWithInfo(projectRoot, pluginReference);\n return plugin;\n}\n\n// Resolve the module function and assert type\nexport function resolveConfigPluginFunctionWithInfo(projectRoot: string, pluginReference: string) {\n const { filePath: pluginFile, isPluginFile } = resolvePluginForModule(\n projectRoot,\n pluginReference\n );\n let result: any;\n try {\n result = requirePluginFile(pluginFile);\n } catch (error) {\n const learnMoreLink = 'Learn more: https://docs.expo.dev/guides/config-plugins/';\n\n let underlyingError: string;\n let stack: string | undefined;\n\n if (error instanceof Error) {\n const errorWithCode = error as Error & { code?: string };\n underlyingError = `${errorWithCode.message} ${errorWithCode.code ?? ''}`;\n stack = errorWithCode.stack;\n } else {\n underlyingError = String(error);\n }\n\n let errorMessage = `Unable to resolve a valid config plugin for ${pluginReference}.\\n`;\n\n if (!isPluginFile) {\n errorMessage += `• No \"${pluginFileName}\" file found in ${pluginReference}: config plugins are typically exported from an \"${pluginFileName}\" file in the package root.\\n`;\n }\n\n errorMessage += `• main export of ${pluginReference} does not appear to be a config plugin: the following error was thrown when importing ${pluginFile}: ${underlyingError}\\n`;\n errorMessage += `Verify that ${pluginReference} includes a config plugin. If it does not, then remove the entry from plugins in your app config file. ${learnMoreLink}`;\n\n const pluginError = new PluginError(errorMessage, 'INVALID_PLUGIN_IMPORT');\n\n if (stack) {\n pluginError.stack = stack;\n }\n throw pluginError;\n }\n\n const plugin = resolveConfigPluginExport({\n plugin: result,\n pluginFile,\n pluginReference,\n isPluginFile,\n });\n return { plugin, pluginFile, pluginReference, isPluginFile };\n}\n\n/**\n * - Resolve the exported contents of an Expo config (be it default or module.exports)\n * - Assert no promise exports\n * - Return config type\n * - Serialize config\n *\n * @param props.plugin plugin results\n * @param props.pluginFile plugin file path\n * @param props.pluginReference the string used to reference the plugin\n * @param props.isPluginFile is file path from the app.plugin.js module root\n */\nexport function resolveConfigPluginExport({\n plugin,\n pluginFile,\n pluginReference,\n isPluginFile,\n}: {\n plugin: any;\n pluginFile: string;\n pluginReference: string;\n isPluginFile: boolean;\n}): ConfigPlugin<unknown> {\n if (plugin.default != null) {\n plugin = plugin.default;\n }\n if (typeof plugin !== 'function') {\n const learnMoreLink = `Learn more: https://docs.expo.dev/guides/config-plugins/`;\n // If the plugin reference is a node module, and that node module does not export a function then it probably doesn't have a config plugin.\n if (!isPluginFile && !moduleNameIsDirectFileReference(pluginReference)) {\n throw new PluginError(\n `Package \"${pluginReference}\" does not contain a valid config plugin. Module must export a function from file: ${pluginFile}\\n${learnMoreLink}`,\n 'INVALID_PLUGIN_TYPE'\n );\n }\n throw new PluginError(\n `Plugin \"${pluginReference}\" must export a function from file: ${pluginFile}. ${learnMoreLink}`,\n 'INVALID_PLUGIN_TYPE'\n );\n }\n\n return plugin;\n}\n\nfunction requirePluginFile(filePath: string): any {\n try {\n return require(filePath);\n } catch (error) {\n // TODO: Improve error messages\n throw error;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,KAAA;EAAA,MAAAH,IAAA,GAAAI,uBAAA,CAAAF,OAAA;EAAAC,IAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,aAAA;EAAA,MAAAL,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAG,YAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAM,QAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI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ACA;AACA;AACA;AACA;AACO,SAASuC,yBAAyBA,CAAC;EACxCtB,MAAM;EACNQ,UAAU;EACV9B,eAAe;EACfK;AAMF,CAAC,EAAyB;EACxB,IAAIiB,MAAM,CAACnC,OAAO,IAAI,IAAI,EAAE;IAC1BmC,MAAM,GAAGA,MAAM,CAACnC,OAAO;EACzB;EACA,IAAI,OAAOmC,MAAM,KAAK,UAAU,EAAE;IAChC,MAAMY,aAAa,GAAG,0DAA0D;IAChF;IACA,IAAI,CAAC7B,YAAY,IAAI,CAACJ,+BAA+B,CAACD,eAAe,CAAC,EAAE;MACtE,MAAM,KAAIa,qBAAW,EACnB,YAAYb,eAAe,sFAAsF8B,UAAU,KAAKI,aAAa,EAAE,EAC/I,qBACF,CAAC;IACH;IACA,MAAM,KAAIrB,qBAAW,EACnB,WAAWb,eAAe,uCAAuC8B,UAAU,KAAKI,aAAa,EAAE,EAC/F,qBACF,CAAC;EACH;EAEA,OAAOZ,MAAM;AACf;AAEA,SAASU,iBAAiBA,CAACxB,QAAgB,EAAO;EAChD,IAAI;IACF,OAAOrC,OAAO,CAACqC,QAAQ,CAAC;EAC1B,CAAC,CAAC,OAAOyB,KAAK,EAAE;IACd;IACA,MAAMA,KAAK;EACb;AACF","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"plugin-resolver.js","names":["_requireUtils","data","require","_assert","_interopRequireDefault","_errors","e","__esModule","default","pluginFileName","exports","pluginExtensions","resolvePluginForModule","projectRoot","pluginReference","moduleNameIsDirectFileReference","pluginScriptFile","resolveFrom","extensions","isPluginFile","filePath","moduleNameIsPackageReference","pluginPackageFile","packageMainEntry","PluginError","pathIsFilePath","name","match","slashCount","split","length","startsWith","normalizeStaticPlugin","plugin","Array","isArray","assert","undefined","assertInternalProjectRoot","resolveConfigPluginFunction","resolveConfigPluginFunctionWithInfo","pluginFile","result","loadModuleSync","error","message","Error","String","pluginError","stack","resolveConfigPluginExport","learnMoreLink"],"sources":["../../src/utils/plugin-resolver.ts"],"sourcesContent":["import { loadModuleSync, resolveFrom } from '@expo/require-utils';\nimport assert from 'assert';\n\nimport { PluginError } from './errors';\nimport type { ConfigPlugin, StaticPlugin } from '../Plugin.types';\n\n// Re-exported for back-compat with external consumers.\nexport const pluginFileName = 'app.plugin.js';\n\n// `.js` first keeps the published-artifact case at one stat.\nconst pluginExtensions = ['.js', '.cjs', '.mjs', '.ts', '.cts', '.mts'];\n\n/**\n * Resolve the config plugin from a node module or package.\n * If the module or package does not include a config plugin, this function throws a `PluginError`.\n * The resolution is done in following order:\n * 1. Is the reference a relative file path or an import specifier with file path? e.g. `./file.js`, `pkg/file.js` or `@org/pkg/file.js`?\n * - Resolve the config plugin as-is\n * 2. If the reference a module? e.g. `expo-font`\n * - Resolve the root `app.plugin.{js,cjs,mjs,ts,cts,mts}` file within the module\n * 3. Does the module have a valid config plugin in the `main` field?\n * - Resolve the `main` entry point as config plugin\n */\nexport function resolvePluginForModule(\n projectRoot: string,\n pluginReference: string\n): { filePath: string; isPluginFile: boolean } {\n if (moduleNameIsDirectFileReference(pluginReference)) {\n const pluginScriptFile = resolveFrom(projectRoot, pluginReference, {\n extensions: pluginExtensions,\n });\n if (pluginScriptFile) {\n return { isPluginFile: false, filePath: pluginScriptFile };\n }\n } else if (moduleNameIsPackageReference(pluginReference)) {\n const pluginPackageFile = resolveFrom(projectRoot, `${pluginReference}/app.plugin`, {\n extensions: pluginExtensions,\n });\n if (pluginPackageFile) {\n return { isPluginFile: true, filePath: pluginPackageFile };\n }\n // Skip the extension/index probes — Node's resolver (step 4) handles `main`.\n const packageMainEntry = resolveFrom(projectRoot, pluginReference, { extensions: [] });\n if (packageMainEntry) {\n return { isPluginFile: false, filePath: packageMainEntry };\n }\n }\n\n throw new PluginError(\n `Failed to resolve plugin for module \"${pluginReference}\" relative to \"${projectRoot}\". Do you have node modules installed?`,\n 'PLUGIN_NOT_FOUND'\n );\n}\n\n// TODO: Test windows\nfunction pathIsFilePath(name: string): boolean {\n // Matches lines starting with: . / ~/\n return !!name.match(/^(\\.|~\\/|\\/)/g);\n}\n\nexport function moduleNameIsDirectFileReference(name: string): boolean {\n if (pathIsFilePath(name)) {\n return true;\n }\n\n const slashCount = name.split('/')?.length;\n // Orgs (like @expo/config ) should have more than one slash to be a direct file.\n if (name.startsWith('@')) {\n return slashCount > 2;\n }\n\n // Regular packages should be considered direct reference if they have more than one slash.\n return slashCount > 1;\n}\n\nexport function moduleNameIsPackageReference(name: string): boolean {\n const slashCount = name.split('/')?.length;\n return name.startsWith('@') ? slashCount === 2 : slashCount === 1;\n}\n\nexport function normalizeStaticPlugin(plugin: StaticPlugin | ConfigPlugin | string): StaticPlugin {\n if (Array.isArray(plugin)) {\n assert(\n plugin.length > 0 && plugin.length < 3,\n `Wrong number of arguments provided for static config plugin, expected either 1 or 2, got ${plugin.length}`\n );\n return plugin;\n }\n return [plugin, undefined];\n}\n\nexport function assertInternalProjectRoot(projectRoot?: string): asserts projectRoot {\n assert(\n projectRoot,\n `Unexpected: Config \\`_internal.projectRoot\\` isn't defined by expo-cli, this is a bug.`\n );\n}\n\n// Resolve the module function and assert type\nexport function resolveConfigPluginFunction(projectRoot: string, pluginReference: string) {\n const { plugin } = resolveConfigPluginFunctionWithInfo(projectRoot, pluginReference);\n return plugin;\n}\n\n// Resolve the module function and assert type\nexport function resolveConfigPluginFunctionWithInfo(projectRoot: string, pluginReference: string) {\n const { filePath: pluginFile, isPluginFile } = resolvePluginForModule(\n projectRoot,\n pluginReference\n );\n let result: any;\n try {\n result = loadModuleSync(pluginFile);\n } catch (error) {\n let message = error instanceof Error ? error.message : String(error);\n // Don't clobber `loadModuleSync`'s code-framed error\n if (!isPluginFile && !moduleNameIsDirectFileReference(pluginReference)) {\n message += `\\n\\nNo \"app.plugin.{js,cjs,mjs,ts,cts,mts}\" file was found in \"${pluginReference}\", so the package's main entry was loaded instead. Config plugins are typically exported from an \"${pluginFileName}\" file in the package root.\\nLearn more: https://docs.expo.dev/guides/config-plugins/`;\n }\n\n const pluginError = new PluginError(message, 'INVALID_PLUGIN_IMPORT');\n if (error instanceof Error && error.stack) {\n pluginError.stack = error.stack;\n }\n throw pluginError;\n }\n\n const plugin = resolveConfigPluginExport({\n plugin: result,\n pluginFile,\n pluginReference,\n isPluginFile,\n });\n return { plugin, pluginFile, pluginReference, isPluginFile };\n}\n\n/**\n * - Resolve the exported contents of an Expo config (be it default or module.exports)\n * - Assert no promise exports\n * - Return config type\n * - Serialize config\n *\n * @param props.plugin plugin results\n * @param props.pluginFile plugin file path\n * @param props.pluginReference the string used to reference the plugin\n * @param props.isPluginFile is file path from the app.plugin.js module root\n */\nexport function resolveConfigPluginExport({\n plugin,\n pluginFile,\n pluginReference,\n isPluginFile,\n}: {\n plugin: any;\n pluginFile: string;\n pluginReference: string;\n isPluginFile: boolean;\n}): ConfigPlugin<unknown> {\n if (plugin.default != null) {\n plugin = plugin.default;\n }\n if (typeof plugin !== 'function') {\n const learnMoreLink = `Learn more: https://docs.expo.dev/guides/config-plugins/`;\n // If the plugin reference is a node module, and that node module does not export a function then it probably doesn't have a config plugin.\n if (!isPluginFile && !moduleNameIsDirectFileReference(pluginReference)) {\n throw new PluginError(\n `Package \"${pluginReference}\" does not contain a valid config plugin. Module must export a function from file: ${pluginFile}\\n${learnMoreLink}`,\n 'INVALID_PLUGIN_TYPE'\n );\n }\n throw new PluginError(\n `Plugin \"${pluginReference}\" must export a function from file: ${pluginFile}. ${learnMoreLink}`,\n 'INVALID_PLUGIN_TYPE'\n );\n }\n\n return plugin;\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA,SAAAA,cAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,aAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,QAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAE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Q,UAAU;EACV3B,eAAe;EACfK;AAMF,CAAC,EAAyB;EACxB,IAAIc,MAAM,CAACzB,OAAO,IAAI,IAAI,EAAE;IAC1ByB,MAAM,GAAGA,MAAM,CAACzB,OAAO;EACzB;EACA,IAAI,OAAOyB,MAAM,KAAK,UAAU,EAAE;IAChC,MAAMkB,aAAa,GAAG,0DAA0D;IAChF;IACA,IAAI,CAAChC,YAAY,IAAI,CAACJ,+BAA+B,CAACD,eAAe,CAAC,EAAE;MACtE,MAAM,KAAIU,qBAAW,EACnB,YAAYV,eAAe,sFAAsF2B,UAAU,KAAKU,aAAa,EAAE,EAC/I,qBACF,CAAC;IACH;IACA,MAAM,KAAI3B,qBAAW,EACnB,WAAWV,eAAe,uCAAuC2B,UAAU,KAAKU,aAAa,EAAE,EAC/F,qBACF,CAAC;EACH;EAEA,OAAOlB,MAAM;AACf","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expo/config-plugins",
|
|
3
|
-
"version": "56.0.
|
|
3
|
+
"version": "56.0.7",
|
|
4
4
|
"description": "A library for Expo config plugins",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -46,15 +46,15 @@
|
|
|
46
46
|
"paths"
|
|
47
47
|
],
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@expo/config-types": "^56.0.
|
|
50
|
-
"@expo/json-file": "~10.
|
|
51
|
-
"@expo/plist": "^0.
|
|
49
|
+
"@expo/config-types": "^56.0.5",
|
|
50
|
+
"@expo/json-file": "~10.2.0",
|
|
51
|
+
"@expo/plist": "^0.7.0",
|
|
52
|
+
"@expo/require-utils": "^56.1.2",
|
|
52
53
|
"@expo/sdk-runtime-versions": "^1.0.0",
|
|
53
54
|
"chalk": "^4.1.2",
|
|
54
55
|
"debug": "^4.3.5",
|
|
55
56
|
"getenv": "^2.0.0",
|
|
56
57
|
"glob": "^13.0.0",
|
|
57
|
-
"resolve-from": "^5.0.0",
|
|
58
58
|
"semver": "^7.5.4",
|
|
59
59
|
"slugify": "^1.6.6",
|
|
60
60
|
"xcode": "^3.0.1",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"publishConfig": {
|
|
72
72
|
"access": "public"
|
|
73
73
|
},
|
|
74
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "c4c9867a0bcbb188e55ecaec4998e38d33108a5d",
|
|
75
75
|
"scripts": {
|
|
76
76
|
"build": "tsc --emitDeclarationOnly && babel src --out-dir build --extensions \".ts\" --source-maps --ignore \"src/**/__mocks__/*\",\"src/**/__tests__/*\",\"src/**/__integration_tests__/*\"",
|
|
77
77
|
"clean": "expo-module clean",
|