@expo/config-plugins 7.1.0 → 7.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -46,10 +46,10 @@ function createBuildGradlePropsConfigPlugin(configToPropertyRules, name) {
|
|
|
46
46
|
* A config-plugin to update `android/gradle.properties` from the `jsEngine` in expo config
|
|
47
47
|
*/
|
|
48
48
|
const withJsEngineGradleProps = createBuildGradlePropsConfigPlugin([{
|
|
49
|
-
propName: '
|
|
49
|
+
propName: 'hermesEnabled',
|
|
50
50
|
propValueGetter: config => {
|
|
51
51
|
var _ref, _config$android$jsEng, _config$android;
|
|
52
|
-
return (_ref = (_config$android$jsEng = (_config$android = config.android) === null || _config$android === void 0 ? void 0 : _config$android.jsEngine) !== null && _config$android$jsEng !== void 0 ? _config$android$jsEng : config.jsEngine) !== null && _ref !== void 0 ? _ref : 'hermes';
|
|
52
|
+
return (((_ref = (_config$android$jsEng = (_config$android = config.android) === null || _config$android === void 0 ? void 0 : _config$android.jsEngine) !== null && _config$android$jsEng !== void 0 ? _config$android$jsEng : config.jsEngine) !== null && _ref !== void 0 ? _ref : 'hermes') === 'hermes').toString();
|
|
53
53
|
}
|
|
54
54
|
}], 'withJsEngineGradleProps');
|
|
55
55
|
exports.withJsEngineGradleProps = withJsEngineGradleProps;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BuildProperties.js","names":["_androidPlugins","data","require","createBuildGradlePropsConfigPlugin","configToPropertyRules","name","withUnknown","config","sourceConfig","withGradleProperties","modResults","updateAndroidBuildPropertiesFromConfig","Object","defineProperty","value","withJsEngineGradleProps","propName","propValueGetter","_ref","_config$android$jsEng","_config$android","android","jsEngine","exports","gradleProperties","configToProperty","updateAndroidBuildProperty","options","oldPropIndex","findIndex","prop","type","key","newProp","push","removePropWhenValueIsNull","splice"],"sources":["../../src/android/BuildProperties.ts"],"sourcesContent":["import type { ExpoConfig } from '@expo/config-types';\n\nimport type { ConfigPlugin } from '../Plugin.types';\nimport { withGradleProperties } from '../plugins/android-plugins';\nimport { BuildPropertiesConfig, ConfigToPropertyRuleType } from '../utils/BuildProperties.types';\nimport type { PropertiesItem } from './Properties';\n\n/**\n * Creates a `withGradleProperties` config-plugin based on given config to property mapping rules.\n *\n * The factory supports two modes from generic type inference\n * ```ts\n * // config-plugin without `props`, it will implicitly use the expo config as source config.\n * createBuildGradlePropsConfigPlugin<ExpoConfig>(): ConfigPlugin<void>;\n *\n * // config-plugin with a parameter `props: CustomType`, it will use the `props` as source config.\n * createBuildGradlePropsConfigPlugin<CustomType>(): ConfigPlugin<CustomType>;\n * ```\n *\n * @param configToPropertyRules config to property mapping rules\n * @param name the config plugin name\n */\nexport function createBuildGradlePropsConfigPlugin<SourceConfigType extends BuildPropertiesConfig>(\n configToPropertyRules: ConfigToPropertyRuleType<SourceConfigType>[],\n name?: string\n) {\n const withUnknown: ConfigPlugin<SourceConfigType extends ExpoConfig ? void : SourceConfigType> = (\n config,\n sourceConfig\n ) =>\n withGradleProperties(config, (config) => {\n config.modResults = updateAndroidBuildPropertiesFromConfig(\n (sourceConfig ?? config) as SourceConfigType,\n config.modResults,\n configToPropertyRules\n );\n return config;\n });\n if (name) {\n Object.defineProperty(withUnknown, 'name', {\n value: name,\n });\n }\n return withUnknown;\n}\n\n/**\n * A config-plugin to update `android/gradle.properties` from the `jsEngine` in expo config\n */\nexport const withJsEngineGradleProps = createBuildGradlePropsConfigPlugin<ExpoConfig>(\n [\n {\n propName: '
|
|
1
|
+
{"version":3,"file":"BuildProperties.js","names":["_androidPlugins","data","require","createBuildGradlePropsConfigPlugin","configToPropertyRules","name","withUnknown","config","sourceConfig","withGradleProperties","modResults","updateAndroidBuildPropertiesFromConfig","Object","defineProperty","value","withJsEngineGradleProps","propName","propValueGetter","_ref","_config$android$jsEng","_config$android","android","jsEngine","toString","exports","gradleProperties","configToProperty","updateAndroidBuildProperty","options","oldPropIndex","findIndex","prop","type","key","newProp","push","removePropWhenValueIsNull","splice"],"sources":["../../src/android/BuildProperties.ts"],"sourcesContent":["import type { ExpoConfig } from '@expo/config-types';\n\nimport type { ConfigPlugin } from '../Plugin.types';\nimport { withGradleProperties } from '../plugins/android-plugins';\nimport { BuildPropertiesConfig, ConfigToPropertyRuleType } from '../utils/BuildProperties.types';\nimport type { PropertiesItem } from './Properties';\n\n/**\n * Creates a `withGradleProperties` config-plugin based on given config to property mapping rules.\n *\n * The factory supports two modes from generic type inference\n * ```ts\n * // config-plugin without `props`, it will implicitly use the expo config as source config.\n * createBuildGradlePropsConfigPlugin<ExpoConfig>(): ConfigPlugin<void>;\n *\n * // config-plugin with a parameter `props: CustomType`, it will use the `props` as source config.\n * createBuildGradlePropsConfigPlugin<CustomType>(): ConfigPlugin<CustomType>;\n * ```\n *\n * @param configToPropertyRules config to property mapping rules\n * @param name the config plugin name\n */\nexport function createBuildGradlePropsConfigPlugin<SourceConfigType extends BuildPropertiesConfig>(\n configToPropertyRules: ConfigToPropertyRuleType<SourceConfigType>[],\n name?: string\n) {\n const withUnknown: ConfigPlugin<SourceConfigType extends ExpoConfig ? void : SourceConfigType> = (\n config,\n sourceConfig\n ) =>\n withGradleProperties(config, (config) => {\n config.modResults = updateAndroidBuildPropertiesFromConfig(\n (sourceConfig ?? config) as SourceConfigType,\n config.modResults,\n configToPropertyRules\n );\n return config;\n });\n if (name) {\n Object.defineProperty(withUnknown, 'name', {\n value: name,\n });\n }\n return withUnknown;\n}\n\n/**\n * A config-plugin to update `android/gradle.properties` from the `jsEngine` in expo config\n */\nexport const withJsEngineGradleProps = createBuildGradlePropsConfigPlugin<ExpoConfig>(\n [\n {\n propName: 'hermesEnabled',\n propValueGetter: (config) =>\n ((config.android?.jsEngine ?? config.jsEngine ?? 'hermes') === 'hermes').toString(),\n },\n ],\n 'withJsEngineGradleProps'\n);\n\nexport function updateAndroidBuildPropertiesFromConfig<\n SourceConfigType extends BuildPropertiesConfig\n>(\n config: SourceConfigType,\n gradleProperties: PropertiesItem[],\n configToPropertyRules: ConfigToPropertyRuleType<SourceConfigType>[]\n) {\n for (const configToProperty of configToPropertyRules) {\n const value = configToProperty.propValueGetter(config);\n updateAndroidBuildProperty(gradleProperties, configToProperty.propName, value);\n }\n\n return gradleProperties;\n}\n\nexport function updateAndroidBuildProperty(\n gradleProperties: PropertiesItem[],\n name: string,\n value: string | null | undefined,\n options?: { removePropWhenValueIsNull?: boolean }\n) {\n const oldPropIndex = gradleProperties.findIndex(\n (prop) => prop.type === 'property' && prop.key === name\n );\n\n if (value) {\n // found the matched value, add or merge new property\n const newProp: PropertiesItem = {\n type: 'property',\n key: name,\n value,\n };\n\n if (oldPropIndex >= 0) {\n gradleProperties[oldPropIndex] = newProp;\n } else {\n gradleProperties.push(newProp);\n }\n } else if (options?.removePropWhenValueIsNull && oldPropIndex >= 0) {\n gradleProperties.splice(oldPropIndex, 1);\n }\n\n return gradleProperties;\n}\n"],"mappings":";;;;;;;;;AAGA,SAAAA,gBAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,eAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,kCAAkCA,CAChDC,qBAAmE,EACnEC,IAAa,EACb;EACA,MAAMC,WAAwF,GAAGA,CAC/FC,MAAM,EACNC,YAAY,KAEZ,IAAAC,sCAAoB,EAACF,MAAM,EAAGA,MAAM,IAAK;IACvCA,MAAM,CAACG,UAAU,GAAGC,sCAAsC,CACvDH,YAAY,aAAZA,YAAY,cAAZA,YAAY,GAAID,MAAM,EACvBA,MAAM,CAACG,UAAU,EACjBN,qBAAqB,CACtB;IACD,OAAOG,MAAM;EACf,CAAC,CAAC;EACJ,IAAIF,IAAI,EAAE;IACRO,MAAM,CAACC,cAAc,CAACP,WAAW,EAAE,MAAM,EAAE;MACzCQ,KAAK,EAAET;IACT,CAAC,CAAC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E;MACrBJ,gBAAgB,CAACI,YAAY,CAAC,GAAGK,OAAO;IAC1C,CAAC,MAAM;MACLT,gBAAgB,CAACU,IAAI,CAACD,OAAO,CAAC;IAChC;EACF,CAAC,MAAM,IAAIN,OAAO,aAAPA,OAAO,eAAPA,OAAO,CAAEQ,yBAAyB,IAAIP,YAAY,IAAI,CAAC,EAAE;IAClEJ,gBAAgB,CAACY,MAAM,CAACR,YAAY,EAAE,CAAC,CAAC;EAC1C;EAEA,OAAOJ,gBAAgB;AACzB"}
|
|
@@ -6,11 +6,11 @@ import type { ExpoConfig } from '@expo/config-types';
|
|
|
6
6
|
* ```ts
|
|
7
7
|
* {
|
|
8
8
|
* propName: 'expo.jsEngine',
|
|
9
|
-
* propValueGetter: (config) => config.
|
|
9
|
+
* propValueGetter: (config) => config.ios?.jsEngine ?? config.jsEngine ?? 'hermes',
|
|
10
10
|
* }
|
|
11
11
|
* ```
|
|
12
|
-
* Will lookup a value through the `propValueGetter
|
|
13
|
-
*
|
|
12
|
+
* Will lookup a value through the `propValueGetter`, and update to `hermesEnabled` key-value in **android/gradle.properties**
|
|
13
|
+
* or `expo.jsEngine` key-value in **ios/Podfile.properties.json**.
|
|
14
14
|
*
|
|
15
15
|
*/
|
|
16
16
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BuildProperties.types.js","names":[],"sources":["../../src/utils/BuildProperties.types.ts"],"sourcesContent":["import type { ExpoConfig } from '@expo/config-types';\n\n/**\n * Rule to transform from config to build properties\n *\n * @example\n * ```ts\n * {\n * propName: 'expo.jsEngine',\n * propValueGetter: (config) => config.
|
|
1
|
+
{"version":3,"file":"BuildProperties.types.js","names":[],"sources":["../../src/utils/BuildProperties.types.ts"],"sourcesContent":["import type { ExpoConfig } from '@expo/config-types';\n\n/**\n * Rule to transform from config to build properties\n *\n * @example\n * ```ts\n * {\n * propName: 'expo.jsEngine',\n * propValueGetter: (config) => config.ios?.jsEngine ?? config.jsEngine ?? 'hermes',\n * }\n * ```\n * Will lookup a value through the `propValueGetter`, and update to `hermesEnabled` key-value in **android/gradle.properties**\n * or `expo.jsEngine` key-value in **ios/Podfile.properties.json**.\n *\n */\n\n/**\n * Source config can be either expo config or generic config\n */\nexport type BuildPropertiesConfig = ExpoConfig | Record<string, any>;\n\nexport interface ConfigToPropertyRuleType<SourceConfigType extends BuildPropertiesConfig> {\n /** Property name in `android/gradle.properties` or `ios/Podfile.properties.json` */\n propName: string;\n\n /** Passing config and get the property value */\n propValueGetter: (config: SourceConfigType) => string | null | undefined;\n}\n"],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expo/config-plugins",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.2.0",
|
|
4
4
|
"description": "A library for Expo config plugins",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -46,15 +46,15 @@
|
|
|
46
46
|
"semver": "^7.3.5",
|
|
47
47
|
"slash": "^3.0.0",
|
|
48
48
|
"xcode": "^3.0.1",
|
|
49
|
-
"xml2js": "0.
|
|
49
|
+
"xml2js": "0.6.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@types/debug": "^4.1.5",
|
|
53
53
|
"@types/find-up": "^4.0.0",
|
|
54
|
-
"@types/xml2js": "
|
|
54
|
+
"@types/xml2js": "~0.4.11"
|
|
55
55
|
},
|
|
56
56
|
"publishConfig": {
|
|
57
57
|
"access": "public"
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "fa5ecca8251986b9f197cc14074eec0ab6dfb6db"
|
|
60
60
|
}
|