expo-modules-autolinking 3.1.0-canary-20251013-623c5a6 → 3.1.0-canary-20251023-4c86f95
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/CHANGELOG.md +3 -0
- package/android/expo-gradle-plugin/expo-autolinking-plugin/src/main/kotlin/expo/modules/plugin/ExpoAutolinkingPlugin.kt +0 -5
- package/build/ExpoModuleConfig.d.ts +1 -1
- package/build/dependencies/utils.d.ts +0 -1
- package/build/dependencies/utils.js +0 -3
- package/build/dependencies/utils.js.map +1 -1
- package/build/fileUtils.d.ts +3 -3
- package/build/fileUtils.js +18 -6
- package/build/fileUtils.js.map +1 -1
- package/build/platforms/apple/apple.js +23 -4
- package/build/platforms/apple/apple.js.map +1 -1
- package/build/types.d.ts +10 -2
- package/build/types.js.map +1 -1
- package/package.json +2 -2
- package/src/dependencies/utils.ts +1 -3
- package/src/fileUtils.ts +21 -9
- package/src/platforms/apple/apple.ts +35 -6
- package/src/types.ts +10 -2
package/CHANGELOG.md
CHANGED
|
@@ -11,8 +11,11 @@
|
|
|
11
11
|
|
|
12
12
|
### 🐛 Bug fixes
|
|
13
13
|
|
|
14
|
+
- fix globMatchFunctorAllAsync to check if globbed path is a file to prevent errors ([#40437](https://github.com/expo/expo/pull/40437) by [@artus9033](https://github.com/artus9033)) ([#40501](https://github.com/expo/expo/pull/40501) by [@kitten](https://github.com/kitten))
|
|
14
15
|
- [iOS] Added build phase script for a workaround to autolinking-generated react-native-config output not being used in ReactCodegen script phase due to temp output directory. ([#40219](https://github.com/expo/expo/pull/40219) by [@chrfalch](https://github.com/chrfalch))
|
|
15
16
|
- [Android] Fix passing exclude options. ([#40014](https://github.com/expo/expo/pull/40014) by [@jakex7](https://github.com/jakex7))
|
|
17
|
+
- Ignore missing `package.json` name property when scanning dependencies ([#40367](https://github.com/expo/expo/pull/40367) by [@kitten](https://github.com/kitten))
|
|
18
|
+
- [Android] Fixed `library projects cannot set applicationIdSuffix`. ([#40477](https://github.com/expo/expo/pull/40477) by [@lukmccall](https://github.com/lukmccall))
|
|
16
19
|
|
|
17
20
|
### 💡 Others
|
|
18
21
|
|
|
@@ -156,11 +156,6 @@ open class ExpoAutolinkingPlugin : Plugin<Project> {
|
|
|
156
156
|
|
|
157
157
|
consumerFlavors.create(appFlavor.name).apply {
|
|
158
158
|
this.dimension = dimension
|
|
159
|
-
appFlavor.applicationIdSuffix?.let { this.applicationIdSuffix = it }
|
|
160
|
-
appFlavor.versionNameSuffix?.let { this.versionNameSuffix = it }
|
|
161
|
-
if (appFlavor.manifestPlaceholders.isNotEmpty()) {
|
|
162
|
-
this.manifestPlaceholders.putAll(appFlavor.manifestPlaceholders)
|
|
163
|
-
}
|
|
164
159
|
}
|
|
165
160
|
|
|
166
161
|
project.logger.quiet(" -> Created flavor '${appFlavor.name}' (dimension='$dimension') in :${project.path}")
|
|
@@ -38,7 +38,7 @@ export declare class ExpoModuleConfig {
|
|
|
38
38
|
/**
|
|
39
39
|
* Returns a list of names of Swift native modules classes to put to the generated modules provider file.
|
|
40
40
|
*/
|
|
41
|
-
appleModules(): string[];
|
|
41
|
+
appleModules(): (string | import("./types").RawAppleModuleConfig)[];
|
|
42
42
|
/**
|
|
43
43
|
* Returns a list of names of Swift classes that receives AppDelegate life-cycle events.
|
|
44
44
|
*/
|
|
@@ -3,7 +3,6 @@ export declare function defaultShouldIncludeDependency(dependencyName: string):
|
|
|
3
3
|
export declare const fastJoin: (from: string, append: string) => string;
|
|
4
4
|
export declare const maybeRealpath: (target: string) => Promise<string | null>;
|
|
5
5
|
export type PackageJson = Record<string, unknown> & {
|
|
6
|
-
name: string;
|
|
7
6
|
version?: string;
|
|
8
7
|
};
|
|
9
8
|
export declare const loadPackageJson: (input: string, ...args: any[]) => Promise<any>;
|
|
@@ -56,9 +56,6 @@ exports.loadPackageJson = (0, utils_1.memoize)(async function loadPackageJson(js
|
|
|
56
56
|
if (typeof json !== 'object' || json == null) {
|
|
57
57
|
return null;
|
|
58
58
|
}
|
|
59
|
-
else if (typeof json.name !== 'string' || !json.name) {
|
|
60
|
-
return null;
|
|
61
|
-
}
|
|
62
59
|
return json;
|
|
63
60
|
}
|
|
64
61
|
catch {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/dependencies/utils.ts"],"names":[],"mappings":";;;;;;AASA,wEA0BC;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/dependencies/utils.ts"],"names":[],"mappings":";;;;;;AASA,wEA0BC;AAiCD,gDA4CC;AAED,8DAkBC;AAED,wDAiBC;AAvJD,4CAAoB;AACpB,gDAAwB;AAExB,oCAAmC;AAGnC,MAAM,oBAAoB,GAAG,GAAG,cAAI,CAAC,GAAG,eAAe,cAAI,CAAC,GAAG,EAAE,CAAC;AAElE,oGAAoG;AACpG,SAAgB,8BAA8B,CAAC,cAAsB;IACnE,MAAM,SAAS,GACb,cAAc,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,EAAE,cAAc,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAC1F,IACE,SAAS,KAAK,OAAO;QACrB,SAAS,KAAK,OAAO;QACrB,SAAS,KAAK,QAAQ;QACtB,SAAS,KAAK,mBAAmB,EACjC,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,QAAQ,cAAc,EAAE,CAAC;QACvB,KAAK,WAAW,CAAC;QACjB,KAAK,cAAc,CAAC;QACpB,KAAK,oBAAoB,CAAC;QAC1B,KAAK,uBAAuB,CAAC;QAC7B,KAAK,uBAAuB,CAAC;QAC7B,KAAK,WAAW,CAAC;QACjB,KAAK,uBAAuB,CAAC;QAC7B,KAAK,QAAQ,CAAC;QACd,KAAK,oBAAoB,CAAC;QAC1B,KAAK,oBAAoB;YACvB,OAAO,KAAK,CAAC;QACf;YACE,O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GAAqB,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACrD,KAAK,IAAI,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,MAAM,EAAE,GAAG,EAAE,EAAE,CAAC;QAC9C,KAAK,MAAM,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;YAC/B,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,CAAE,CAAC;YACtC,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;YACnC,IAAI,cAAc,IAAI,IAAI,EAAE,CAAC;gBAC3B,MAAM,CAAC,GAAG,CAAC,GAAG,kBAAkB,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC;YAC/D,CAAC;iBAAM,CAAC;gBACN,MAAM,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC;YAC3B,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import fs from 'fs';\nimport path from 'path';\n\nimport { memoize } from '../utils';\nimport type { DependencyResolution, ResolutionResult } from './types';\n\nconst NODE_MODULES_PATTERN = `${path.sep}node_modules${path.sep}`;\n\n// The default dependencies we exclude don't contain dependency chains leading to autolinked modules\nexport function defaultShouldIncludeDependency(dependencyName: string): boolean {\n const scopeName =\n dependencyName[0] === '@' ? dependencyName.slice(1, dependencyName.indexOf('/')) : null;\n if (\n scopeName === 'babel' ||\n scopeName === 'types' ||\n scopeName === 'eslint' ||\n scopeName === 'typescript-eslint'\n ) {\n return false;\n }\n switch (dependencyName) {\n case '@expo/cli':\n case '@expo/config':\n case '@expo/metro-config':\n case '@expo/package-manager':\n case '@expo/prebuild-config':\n case '@expo/env':\n case '@react-native/codegen':\n case 'eslint':\n case 'eslint-config-expo':\n case 'eslint-plugin-expo':\n return false;\n default:\n return true;\n }\n}\n\nexport const fastJoin: (from: string, append: string) => string =\n path.sep === '/'\n ? (from, append) => `${from}${path.sep}${append}`\n : (from, append) =>\n `${from}${path.sep}${append[0] === '@' ? append.replace('/', path.sep) : append}`;\n\nexport const maybeRealpath = async (target: string): Promise<string | null> => {\n try {\n return await fs.promises.realpath(target);\n } catch {\n return null;\n }\n};\n\nexport type PackageJson = Record<string, unknown> & { version?: string };\n\nexport const loadPackageJson = memoize(async function loadPackageJson(\n jsonPath: string\n): Promise<PackageJson | null> {\n try {\n const packageJsonText = await fs.promises.readFile(jsonPath, 'utf8');\n const json = JSON.parse(packageJsonText);\n if (typeof json !== 'object' || json == null) {\n return null;\n }\n return json;\n } catch {\n return null;\n }\n});\n\nexport function mergeWithDuplicate(\n a: DependencyResolution,\n b: DependencyResolution\n): DependencyResolution {\n let target: DependencyResolution;\n let duplicate: DependencyResolution;\n if (a.depth < b.depth) {\n target = a;\n duplicate = b;\n } else if (b.depth < a.depth) {\n target = b;\n duplicate = a;\n } else {\n // If both are equal, then the shallowest path wins\n const pathDepthA = a.originPath.split(NODE_MODULES_PATTERN).length;\n const pathDepthB = b.originPath.split(NODE_MODULES_PATTERN).length;\n if (pathDepthA < pathDepthB) {\n target = a;\n duplicate = b;\n } else if (pathDepthB < pathDepthA) {\n target = b;\n duplicate = a;\n } else {\n target = a;\n duplicate = b;\n }\n }\n const duplicates = target.duplicates || (target.duplicates = []);\n if (target.path !== duplicate.path) {\n duplicates.push({\n name: duplicate.name,\n version: duplicate.version,\n path: duplicate.path,\n originPath: duplicate.originPath,\n });\n }\n if (duplicate.duplicates?.length) {\n duplicates.push(\n ...duplicate.duplicates.filter((child) =>\n duplicates.every((parent) => parent.path !== child.path)\n )\n );\n }\n return target;\n}\n\nexport async function filterMapResolutionResult<T extends { name: string }>(\n results: ResolutionResult,\n filterMap: (resolution: DependencyResolution) => Promise<T | null> | T | null\n): Promise<Record<string, T>> {\n const resolutions = await Promise.all(\n Object.keys(results).map(async (key) => {\n const resolution = results[key];\n return resolution ? await filterMap(resolution) : null;\n })\n );\n const output: Record<string, T> = Object.create(null);\n for (let idx = 0; idx < resolutions.length; idx++) {\n const resolution = resolutions[idx];\n if (resolution != null) {\n output[resolution.name] = resolution;\n }\n }\n return output;\n}\n\nexport function mergeResolutionResults(results: ResolutionResult[]) {\n if (results.length === 1) {\n return results[0];\n }\n const output: ResolutionResult = Object.create(null);\n for (let idx = 0; idx < results.length; idx++) {\n for (const key in results[idx]) {\n const resolution = results[idx][key]!;\n const prevResolution = output[key];\n if (prevResolution != null) {\n output[key] = mergeWithDuplicate(prevResolution, resolution);\n } else {\n output[key] = resolution;\n }\n }\n }\n return output;\n}\n"]}
|
package/build/fileUtils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GlobOptions } from 'glob';
|
|
1
|
+
import { type GlobOptions } from 'glob';
|
|
2
2
|
/**
|
|
3
3
|
* A matching function that takes a file path and its contents and returns a string if it matches, or null otherwise.
|
|
4
4
|
*/
|
|
@@ -10,9 +10,9 @@ export declare function fileExistsAsync(file: string): Promise<boolean>;
|
|
|
10
10
|
/**
|
|
11
11
|
* Search files that match the glob pattern and return all matches from the matchFunctor.
|
|
12
12
|
*/
|
|
13
|
-
export declare function globMatchFunctorAllAsync(globPattern: string, matchFunctor: MatchFunctor, options?: GlobOptions): Promise<string[]>;
|
|
13
|
+
export declare function globMatchFunctorAllAsync(globPattern: string, matchFunctor: MatchFunctor, options?: Omit<GlobOptions, 'withFileTypes'>): Promise<string[]>;
|
|
14
14
|
/**
|
|
15
15
|
* Search files that match the glob pattern and return the first match from the matchFunctor.
|
|
16
16
|
*/
|
|
17
|
-
export declare function globMatchFunctorFirstAsync(globPattern: string, matchFunctor: MatchFunctor, options?: GlobOptions): Promise<string | null>;
|
|
17
|
+
export declare function globMatchFunctorFirstAsync(globPattern: string, matchFunctor: MatchFunctor, options?: Omit<GlobOptions, 'withFileTypes'>): Promise<string | null>;
|
|
18
18
|
export {};
|
package/build/fileUtils.js
CHANGED
|
@@ -19,11 +19,17 @@ async function fileExistsAsync(file) {
|
|
|
19
19
|
* Search files that match the glob pattern and return all matches from the matchFunctor.
|
|
20
20
|
*/
|
|
21
21
|
async function globMatchFunctorAllAsync(globPattern, matchFunctor, options) {
|
|
22
|
-
const globStream = glob_1.glob.stream(globPattern, {
|
|
22
|
+
const globStream = glob_1.glob.stream(globPattern, {
|
|
23
|
+
...options,
|
|
24
|
+
withFileTypes: true,
|
|
25
|
+
});
|
|
23
26
|
const cwd = options?.cwd !== undefined ? `${options.cwd}` : process.cwd();
|
|
24
27
|
const results = [];
|
|
25
|
-
for await (const
|
|
26
|
-
|
|
28
|
+
for await (const globPath of globStream) {
|
|
29
|
+
if (!globPath.isFile()) {
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
let filePath = globPath.fullpath();
|
|
27
33
|
if (!path_1.default.isAbsolute(filePath)) {
|
|
28
34
|
filePath = path_1.default.resolve(cwd, filePath);
|
|
29
35
|
}
|
|
@@ -39,10 +45,16 @@ async function globMatchFunctorAllAsync(globPattern, matchFunctor, options) {
|
|
|
39
45
|
* Search files that match the glob pattern and return the first match from the matchFunctor.
|
|
40
46
|
*/
|
|
41
47
|
async function globMatchFunctorFirstAsync(globPattern, matchFunctor, options) {
|
|
42
|
-
const globStream = glob_1.glob.stream(globPattern, {
|
|
48
|
+
const globStream = glob_1.glob.stream(globPattern, {
|
|
49
|
+
...options,
|
|
50
|
+
withFileTypes: true,
|
|
51
|
+
});
|
|
43
52
|
const cwd = options?.cwd !== undefined ? `${options.cwd}` : process.cwd();
|
|
44
|
-
for await (const
|
|
45
|
-
|
|
53
|
+
for await (const globPath of globStream) {
|
|
54
|
+
if (!globPath.isFile()) {
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
let filePath = globPath.fullpath();
|
|
46
58
|
if (!path_1.default.isAbsolute(filePath)) {
|
|
47
59
|
filePath = path_1.default.resolve(cwd, filePath);
|
|
48
60
|
}
|
package/build/fileUtils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fileUtils.js","sourceRoot":"","sources":["../src/fileUtils.ts"],"names":[],"mappings":";;;;;AAYA,0CAEC;AAKD,
|
|
1
|
+
{"version":3,"file":"fileUtils.js","sourceRoot":"","sources":["../src/fileUtils.ts"],"names":[],"mappings":";;;;;AAYA,0CAEC;AAKD,4DA0BC;AAKD,gEAyBC;AA3ED,2DAA6B;AAC7B,+BAAiF;AACjF,gDAAwB;AAOxB;;GAEG;AACI,KAAK,UAAU,eAAe,CAAC,IAAY;IAChD,OAAO,CAAC,MAAM,kBAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,KAAK,CAAC;AACpE,CAAC;AAED;;GAEG;AACI,KAAK,UAAU,wBAAwB,CAC5C,WAAmB,EACnB,YAA0B,EAC1B,OAA4C;IAE5C,MAAM,UAAU,GAAG,WAAI,CAAC,MAAM,CAAC,WAAW,EAAE;QAC1C,GAAG,OAAO;QACV,aAAa,EAAE,IAAI;KACY,CAAC,CAAC;IACnC,MAAM,GAAG,GAAG,OAAO,EAAE,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC;IAC1E,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,IAAI,KAAK,EAAE,MAAM,QAAQ,IAAI,UAAU,EAAE,CAAC;QACxC,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC;YACvB,SAAS;QACX,CAAC;QACD,IAAI,QAAQ,GAAG,QAAQ,CAAC,QAAQ,EAAE,CAAC;QACnC,IAAI,CAAC,cAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC/B,QAAQ,GAAG,cAAI,CAAC,OAAO,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;QACzC,CAAC;QACD,MAAM,QAAQ,GAAG,MAAM,kB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sourcesContent":["import fs from 'fs/promises';\nimport { glob, type GlobOptions, type GlobOptionsWithFileTypesTrue } from 'glob';\nimport path from 'path';\n\n/**\n * A matching function that takes a file path and its contents and returns a string if it matches, or null otherwise.\n */\ntype MatchFunctor = (filePath: string, contents: Buffer) => string | null;\n\n/**\n * Check if the file exists.\n */\nexport async function fileExistsAsync(file: string): Promise<boolean> {\n return (await fs.stat(file).catch(() => null))?.isFile() ?? false;\n}\n\n/**\n * Search files that match the glob pattern and return all matches from the matchFunctor.\n */\nexport async function globMatchFunctorAllAsync(\n globPattern: string,\n matchFunctor: MatchFunctor,\n options?: Omit<GlobOptions, 'withFileTypes'>\n): Promise<string[]> {\n const globStream = glob.stream(globPattern, {\n ...options,\n withFileTypes: true,\n } as GlobOptionsWithFileTypesTrue);\n const cwd = options?.cwd !== undefined ? `${options.cwd}` : process.cwd();\n const results: string[] = [];\n for await (const globPath of globStream) {\n if (!globPath.isFile()) {\n continue;\n }\n let filePath = globPath.fullpath();\n if (!path.isAbsolute(filePath)) {\n filePath = path.resolve(cwd, filePath);\n }\n const contents = await fs.readFile(filePath);\n const matched = matchFunctor(filePath, contents);\n if (matched != null) {\n results.push(matched);\n }\n }\n return results;\n}\n\n/**\n * Search files that match the glob pattern and return the first match from the matchFunctor.\n */\nexport async function globMatchFunctorFirstAsync(\n globPattern: string,\n matchFunctor: MatchFunctor,\n options?: Omit<GlobOptions, 'withFileTypes'>\n): Promise<string | null> {\n const globStream = glob.stream(globPattern, {\n ...options,\n withFileTypes: true,\n } as GlobOptionsWithFileTypesTrue);\n const cwd = options?.cwd !== undefined ? `${options.cwd}` : process.cwd();\n for await (const globPath of globStream) {\n if (!globPath.isFile()) {\n continue;\n }\n let filePath = globPath.fullpath();\n if (!path.isAbsolute(filePath)) {\n filePath = path.resolve(cwd, filePath);\n }\n const contents = await fs.readFile(filePath);\n const matched = matchFunctor(filePath, contents);\n if (matched != null) {\n return matched;\n }\n }\n return null;\n}\n"]}
|
|
@@ -51,7 +51,10 @@ async function resolveModuleAsync(packageName, revision, extraOutput) {
|
|
|
51
51
|
pods,
|
|
52
52
|
swiftModuleNames,
|
|
53
53
|
flags: extraOutput.flags,
|
|
54
|
-
modules: revision.config
|
|
54
|
+
modules: revision.config
|
|
55
|
+
?.appleModules()
|
|
56
|
+
.map((module) => (typeof module === 'string' ? { name: null, class: module } : module)) ??
|
|
57
|
+
[],
|
|
55
58
|
appDelegateSubscribers: revision.config?.appleAppDelegateSubscribers() ?? [],
|
|
56
59
|
reactDelegateHandlers: revision.config?.appleReactDelegateHandlers() ?? [],
|
|
57
60
|
debugOnly: revision.config?.appleDebugOnly() ?? false,
|
|
@@ -120,12 +123,12 @@ ${generateCommonImportList(swiftModules)}
|
|
|
120
123
|
${generateDebugOnlyImportList(debugOnlySwiftModules)}
|
|
121
124
|
@objc(${className})
|
|
122
125
|
public class ${className}: ModulesProvider {
|
|
123
|
-
public override func getModuleClasses() -> [
|
|
126
|
+
public override func getModuleClasses() -> [ExpoModuleTupleType] {
|
|
124
127
|
${generateModuleClasses(modulesClassNames, debugOnlyModulesClassNames)}
|
|
125
128
|
}
|
|
126
129
|
|
|
127
130
|
public override func getAppDelegateSubscribers() -> [ExpoAppDelegateSubscriber.Type] {
|
|
128
|
-
${
|
|
131
|
+
${generateClasses(appDelegateSubscribers, debugOnlyAppDelegateSubscribers)}
|
|
129
132
|
}
|
|
130
133
|
|
|
131
134
|
public override func getReactDelegateHandlers() -> [ExpoReactDelegateHandlerTupleType] {
|
|
@@ -147,7 +150,23 @@ function generateDebugOnlyImportList(swiftModules) {
|
|
|
147
150
|
}
|
|
148
151
|
return (wrapInDebugConfigurationCheck(0, swiftModules.map((moduleName) => `import ${moduleName}`).join('\n')) + '\n');
|
|
149
152
|
}
|
|
150
|
-
function generateModuleClasses(
|
|
153
|
+
function generateModuleClasses(modules, debugOnlyModules) {
|
|
154
|
+
const commonClassNames = formatArrayOfModuleTuples(modules);
|
|
155
|
+
if (debugOnlyModules.length > 0) {
|
|
156
|
+
return wrapInDebugConfigurationCheck(2, `return ${formatArrayOfModuleTuples(modules.concat(debugOnlyModules))}`, `return ${commonClassNames}`);
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
return `${indent.repeat(2)}return ${commonClassNames}`;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Formats an array of modules config to Swift's array of module tuples.
|
|
164
|
+
*/
|
|
165
|
+
function formatArrayOfModuleTuples(modules) {
|
|
166
|
+
return `[${modules.map((module) => `\n${indent.repeat(3)}(module: ${module.class}.self, name: ${module.name ? `"${module.name}"` : 'nil'})`).join(',')}
|
|
167
|
+
${indent.repeat(2)}]`;
|
|
168
|
+
}
|
|
169
|
+
function generateClasses(classNames, debugOnlyClassName) {
|
|
151
170
|
const commonClassNames = formatArrayOfClassNames(classNames);
|
|
152
171
|
if (debugOnlyClassName.length > 0) {
|
|
153
172
|
return wrapInDebugConfigurationCheck(2, `return ${formatArrayOfClassNames(classNames.concat(debugOnlyClassName))}`, `return ${commonClassNames}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apple.js","sourceRoot":"","sources":["../../../src/platforms/apple/apple.ts"],"names":[],"mappings":";;;;;AAiCA,kDASC;AAGD,gDA6BC;AAED,gFAcC;AAKD,oEAeC;AA4ID,8EASC;AAnQD,oEAA2C;AAC3C,4CAAoB;AACpB,+BAA4B;AAC5B,gDAAwB;AAExB,+CAAkD;AASlD,MAAM,qBAAqB,GAAG,yBAAyB,CAAC;AACxD,MAAM,0BAA0B,GAAG,iBAAiB,CAAC;AAErD,MAAM,MAAM,GAAG,IAAI,CAAC;AAEpB,KAAK,UAAU,gBAAgB,CAAC,QAAyB;IACvD,MAAM,kBAAkB,GAAG,QAAQ,CAAC,MAAM,EAAE,iBAAiB,EAAE,CAAC;IAChE,IAAI,kBAAkB,IAAI,kBAAkB,CAAC,MAAM,EAAE,CAAC;QACpD,OAAO,kBAAkB,CAAC;IAC5B,CAAC;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,gBAAgB,CAAC,iCAAiC,MAAM,CAAC,MAAM,CACrF,gBAAgB,CACjB,GAAG,UAAU,KAAK,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,UAAU,MAAM,CAAC,MAAM,CACvE,gBAAgB,CACjB,GAAG,YAAY,KAAK,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,QAAQ,CAAC;IAC/D,CAAC;IAED,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,iCAAiC,MAAM,CAAC,MAAM,CACrF,gBAAgB,CACjB,GAAG,UAAU,KAAK,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,QAAQ,CAAC;AAC7D,CAAC;AAED,KAAK,UAAU,sBAAsB,CACnC,eAA8B;IAE9B,IAAI,CAAC,eAAe,IAAI,CAAC,CAAC,MAAM,IAAA,2BAAe,EAAC,eAAe,CAAC,CAAC,EAAE,CAAC;QAClE,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,IAAA,qBAAU,EAAC,QAAQ,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,eAAe,CAAC,CAAC,CAAC;IAChG,MAAM,gBAAgB,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC5C,OAAO;QACL,SAAS,EAAE,gBAAgB,CAAC,uCAAuC,CAAC,IAAI,SAAS;KAClF,CAAC;AACJ,CAAC","sourcesContent":["import spawnAsync from '@expo/spawn-async';\nimport fs from 'fs';\nimport { glob } from 'glob';\nimport path from 'path';\n\nimport { fileExistsAsync } from '../../fileUtils';\nimport type {\n AppleCodeSignEntitlements,\n ExtraDependencies,\n ModuleDescriptorIos,\n ModuleIosPodspecInfo,\n PackageRevision,\n} from '../../types';\n\nconst APPLE_PROPERTIES_FILE = 'Podfile.properties.json';\nconst APPLE_EXTRA_BUILD_DEPS_KEY = 'apple.extraPods';\n\nconst indent = ' ';\n\nasync function findPodspecFiles(revision: PackageRevision): Promise<string[]> {\n const configPodspecPaths = revision.config?.applePodspecPaths();\n if (configPodspecPaths && configPodspecPaths.length) {\n return configPodspecPaths;\n }\n\n const podspecFiles = await glob('*/*.podspec', {\n cwd: revision.path,\n ignore: ['**/node_modules/**'],\n });\n\n return podspecFiles;\n}\n\nexport function getSwiftModuleNames(\n pods: ModuleIosPodspecInfo[],\n swiftModuleNames: string[] | undefined\n): string[] {\n if (swiftModuleNames && swiftModuleNames.length) {\n return swiftModuleNames;\n }\n // by default, non-alphanumeric characters in the pod name are replaced by _ in the module name\n return pods.map((pod) => pod.podName.replace(/[^a-zA-Z0-9]/g, '_'));\n}\n\n/** Resolves module search result with additional details required for iOS platform. */\nexport async function resolveModuleAsync(\n packageName: string,\n revision: PackageRevision,\n extraOutput: { flags?: Record<string, any> }\n): Promise<ModuleDescriptorIos | null> {\n const podspecFiles = await findPodspecFiles(revision);\n if (!podspecFiles.length) {\n return null;\n }\n\n const pods = podspecFiles.map((podspecFile) => ({\n podName: path.basename(podspecFile, path.extname(podspecFile)),\n podspecDir: path.dirname(path.join(revision.path, podspecFile)),\n }));\n\n const swiftModuleNames = getSwiftModuleNames(pods, revision.config?.appleSwiftModuleNames());\n const coreFeatures = revision.config?.coreFeatures() ?? [];\n\n return {\n packageName,\n pods,\n swiftModuleNames,\n flags: extraOutput.flags,\n modules: revision.config?.appleModules() ?? [],\n appDelegateSubscribers: revision.config?.appleAppDelegateSubscribers() ?? [],\n reactDelegateHandlers: revision.config?.appleReactDelegateHandlers() ?? [],\n debugOnly: revision.config?.appleDebugOnly() ?? false,\n ...(coreFeatures.length > 0 ? { coreFeatures } : {}),\n };\n}\n\nexport async function resolveExtraBuildDependenciesAsync(\n projectNativeRoot: string\n): Promise<ExtraDependencies | null> {\n const propsFile = path.join(projectNativeRoot, APPLE_PROPERTIES_FILE);\n try {\n const contents = await fs.promises.readFile(propsFile, 'utf8');\n const podfileJson = JSON.parse(contents);\n if (podfileJson[APPLE_EXTRA_BUILD_DEPS_KEY]) {\n // expo-build-properties would serialize the extraPods as JSON string, we should parse it again.\n const extraPods = JSON.parse(podfileJson[APPLE_EXTRA_BUILD_DEPS_KEY]);\n return extraPods;\n }\n } catch {}\n return null;\n}\n\n/**\n * Generates Swift file that contains all autolinked Swift packages.\n */\nexport async function generateModulesProviderAsync(\n modules: ModuleDescriptorIos[],\n targetPath: string,\n entitlementPath: string | null\n): Promise<void> {\n const className = path.basename(targetPath, path.extname(targetPath));\n const entitlements = await parseEntitlementsAsync(entitlementPath);\n const generatedFileContent = await generatePackageListFileContentAsync(\n modules,\n className,\n entitlements\n );\n const parentPath = path.dirname(targetPath);\n await fs.promises.mkdir(parentPath, { recursive: true });\n await fs.promises.writeFile(targetPath, generatedFileContent, 'utf8');\n}\n\n/**\n * Generates the string to put into the generated package list.\n */\nasync function generatePackageListFileContentAsync(\n modules: ModuleDescriptorIos[],\n className: string,\n entitlements: AppleCodeSignEntitlements\n): Promise<string> {\n const iosModules = modules.filter(\n (module) =>\n module.modules.length ||\n module.appDelegateSubscribers.length ||\n module.reactDelegateHandlers.length\n );\n\n const modulesToImport = iosModules.filter((module) => !module.debugOnly);\n const debugOnlyModules = iosModules.filter((module) => module.debugOnly);\n\n const swiftModules = ([] as string[])\n .concat(...modulesToImport.map((module) => module.swiftModuleNames))\n .filter(Boolean);\n\n const debugOnlySwiftModules = ([] as string[])\n .concat(...debugOnlyModules.map((module) => module.swiftModuleNames))\n .filter(Boolean);\n\n const modulesClassNames = ([] as string[])\n .concat(...modulesToImport.map((module) => module.modules))\n .filter(Boolean);\n\n const debugOnlyModulesClassNames = ([] as string[])\n .concat(...debugOnlyModules.map((module) => module.modules))\n .filter(Boolean);\n\n const appDelegateSubscribers = ([] as string[]).concat(\n ...modulesToImport.map((module) => module.appDelegateSubscribers)\n );\n\n const debugOnlyAppDelegateSubscribers = ([] as string[]).concat(\n ...debugOnlyModules.map((module) => module.appDelegateSubscribers)\n );\n\n const reactDelegateHandlerModules = modulesToImport.filter(\n (module) => !!module.reactDelegateHandlers.length\n );\n\n const debugOnlyReactDelegateHandlerModules = debugOnlyModules.filter(\n (module) => !!module.reactDelegateHandlers.length\n );\n\n return `/**\n * Automatically generated by expo-modules-autolinking.\n *\n * This autogenerated class provides a list of classes of native Expo modules,\n * but only these that are written in Swift and use the new API for creating Expo modules.\n */\n\nimport ExpoModulesCore\n${generateCommonImportList(swiftModules)}\n${generateDebugOnlyImportList(debugOnlySwiftModules)}\n@objc(${className})\npublic class ${className}: ModulesProvider {\n public override func getModuleClasses() -> [AnyModule.Type] {\n${generateModuleClasses(modulesClassNames, debugOnlyModulesClassNames)}\n }\n\n public override func getAppDelegateSubscribers() -> [ExpoAppDelegateSubscriber.Type] {\n${generateModuleClasses(appDelegateSubscribers, debugOnlyAppDelegateSubscribers)}\n }\n\n public override func getReactDelegateHandlers() -> [ExpoReactDelegateHandlerTupleType] {\n${generateReactDelegateHandlers(reactDelegateHandlerModules, debugOnlyReactDelegateHandlerModules)}\n }\n\n public override func getAppCodeSignEntitlements() -> AppCodeSignEntitlements {\n return AppCodeSignEntitlements.from(json: #\"${JSON.stringify(entitlements)}\"#)\n }\n}\n`;\n}\n\nfunction generateCommonImportList(swiftModules: string[]): string {\n return swiftModules.map((moduleName) => `import ${moduleName}`).join('\\n');\n}\n\nfunction generateDebugOnlyImportList(swiftModules: string[]): string {\n if (!swiftModules.length) {\n return '';\n }\n\n return (\n wrapInDebugConfigurationCheck(\n 0,\n swiftModules.map((moduleName) => `import ${moduleName}`).join('\\n')\n ) + '\\n'\n );\n}\n\nfunction generateModuleClasses(classNames: string[], debugOnlyClassName: string[]): string {\n const commonClassNames = formatArrayOfClassNames(classNames);\n if (debugOnlyClassName.length > 0) {\n return wrapInDebugConfigurationCheck(\n 2,\n `return ${formatArrayOfClassNames(classNames.concat(debugOnlyClassName))}`,\n `return ${commonClassNames}`\n );\n } else {\n return `${indent.repeat(2)}return ${commonClassNames}`;\n }\n}\n\n/**\n * Formats an array of class names to Swift's array containing these classes.\n */\nfunction formatArrayOfClassNames(classNames: string[]): string {\n return `[${classNames.map((className) => `\\n${indent.repeat(3)}${className}.self`).join(',')}\n${indent.repeat(2)}]`;\n}\n\nfunction generateReactDelegateHandlers(\n module: ModuleDescriptorIos[],\n debugOnlyModules: ModuleDescriptorIos[]\n): string {\n const commonModules = formatArrayOfReactDelegateHandler(module);\n if (debugOnlyModules.length > 0) {\n return wrapInDebugConfigurationCheck(\n 2,\n `return ${formatArrayOfReactDelegateHandler(module.concat(debugOnlyModules))}`,\n `return ${commonModules}`\n );\n } else {\n return `${indent.repeat(2)}return ${commonModules}`;\n }\n}\n\n/**\n * Formats an array of modules to Swift's array containing ReactDelegateHandlers\n */\nexport function formatArrayOfReactDelegateHandler(modules: ModuleDescriptorIos[]): string {\n const values: string[] = [];\n for (const module of modules) {\n for (const handler of module.reactDelegateHandlers) {\n values.push(`(packageName: \"${module.packageName}\", handler: ${handler}.self)`);\n }\n }\n return `[${values.map((value) => `\\n${indent.repeat(3)}${value}`).join(',')}\n${indent.repeat(2)}]`;\n}\n\nfunction wrapInDebugConfigurationCheck(\n indentationLevel: number,\n debugBlock: string,\n releaseBlock: string | null = null\n) {\n if (releaseBlock) {\n return `${indent.repeat(indentationLevel)}#if EXPO_CONFIGURATION_DEBUG\\n${indent.repeat(\n indentationLevel\n )}${debugBlock}\\n${indent.repeat(indentationLevel)}#else\\n${indent.repeat(\n indentationLevel\n )}${releaseBlock}\\n${indent.repeat(indentationLevel)}#endif`;\n }\n\n return `${indent.repeat(indentationLevel)}#if EXPO_CONFIGURATION_DEBUG\\n${indent.repeat(\n indentationLevel\n )}${debugBlock}\\n${indent.repeat(indentationLevel)}#endif`;\n}\n\nasync function parseEntitlementsAsync(\n entitlementPath: string | null\n): Promise<AppleCodeSignEntitlements> {\n if (!entitlementPath || !(await fileExistsAsync(entitlementPath))) {\n return {};\n }\n const { stdout } = await spawnAsync('plutil', ['-convert', 'json', '-o', '-', entitlementPath]);\n const entitlementsJson = JSON.parse(stdout);\n return {\n appGroups: entitlementsJson['com.apple.security.application-groups'] || undefined,\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"apple.js","sourceRoot":"","sources":["../../../src/platforms/apple/apple.ts"],"names":[],"mappings":";;;;;AAkCA,kDASC;AAGD,gDAiCC;AAED,gFAcC;AAKD,oEAeC;AAoKD,8EASC;AAhSD,oEAA2C;AAC3C,4CAAoB;AACpB,+BAA4B;AAC5B,gDAAwB;AAExB,+CAAkD;AAUlD,MAAM,qBAAqB,GAAG,yBAAyB,CAAC;AACxD,MAAM,0BAA0B,GAAG,iBAAiB,CAAC;AAErD,MAAM,MAAM,GAAG,IAAI,CAAC;AAEpB,KAAK,UAAU,gBAAgB,CAAC,QAAyB;IACvD,MAAM,kBAAkB,GAAG,QAAQ,CAAC,MAAM,EAAE,iBAAiB,EAAE,CAAC;IAChE,IAAI,kBAAkB,IAAI,kBAAkB,CAAC,MAAM,EAAE,CAAC;QACpD,OAAO,kBAAkB,CAAC;IAC5B,CAAC;IAED,MAAM,YAAY,GAAG,MAAM,IAAA,WAAI,EAAC,aAAa,EAAE;QAC7C,GAAG,EAAE,QAAQ,CAAC,IAAI;QAClB,MAAM,EAAE,CAAC,oBAAoB,CAAC;KAC/B,CAAC,CAAC;IAEH,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,SAAgB,mBAAmB,CACjC,IAA4B,EAC5B,gBAAsC;IAEtC,IAAI,gBAAgB,IAAI,gBAAgB,CAAC,MAAM,EAAE,CAAC;QAChD,OAAO,gBAAgB,CAAC;IAC1B,CAAC;IACD,+FAA+F;IAC/F,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,eAAe,EAAE,GAAG,CAAC,CAAC,CAAC;AACtE,CAAC;AAED,uFAAuF;AAChF,KAAK,UAAU,kBAAkB,CACtC,WAAmB,EACnB,QAAyB,EACzB,WAA4C;IA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,CAAC,MAAM,CAAC,CAAC;IAC5C,OAAO;QACL,SAAS,EAAE,gBAAgB,CAAC,uCAAuC,CAAC,IAAI,SAAS;KAClF,CAAC;AACJ,CAAC","sourcesContent":["import spawnAsync from '@expo/spawn-async';\nimport fs from 'fs';\nimport { glob } from 'glob';\nimport path from 'path';\n\nimport { fileExistsAsync } from '../../fileUtils';\nimport type {\n AppleCodeSignEntitlements,\n ExtraDependencies,\n ModuleDescriptorIos,\n ModuleIosConfig,\n ModuleIosPodspecInfo,\n PackageRevision,\n} from '../../types';\n\nconst APPLE_PROPERTIES_FILE = 'Podfile.properties.json';\nconst APPLE_EXTRA_BUILD_DEPS_KEY = 'apple.extraPods';\n\nconst indent = ' ';\n\nasync function findPodspecFiles(revision: PackageRevision): Promise<string[]> {\n const configPodspecPaths = revision.config?.applePodspecPaths();\n if (configPodspecPaths && configPodspecPaths.length) {\n return configPodspecPaths;\n }\n\n const podspecFiles = await glob('*/*.podspec', {\n cwd: revision.path,\n ignore: ['**/node_modules/**'],\n });\n\n return podspecFiles;\n}\n\nexport function getSwiftModuleNames(\n pods: ModuleIosPodspecInfo[],\n swiftModuleNames: string[] | undefined\n): string[] {\n if (swiftModuleNames && swiftModuleNames.length) {\n return swiftModuleNames;\n }\n // by default, non-alphanumeric characters in the pod name are replaced by _ in the module name\n return pods.map((pod) => pod.podName.replace(/[^a-zA-Z0-9]/g, '_'));\n}\n\n/** Resolves module search result with additional details required for iOS platform. */\nexport async function resolveModuleAsync(\n packageName: string,\n revision: PackageRevision,\n extraOutput: { flags?: Record<string, any> }\n): Promise<ModuleDescriptorIos | null> {\n const podspecFiles = await findPodspecFiles(revision);\n if (!podspecFiles.length) {\n return null;\n }\n\n const pods = podspecFiles.map((podspecFile) => ({\n podName: path.basename(podspecFile, path.extname(podspecFile)),\n podspecDir: path.dirname(path.join(revision.path, podspecFile)),\n }));\n\n const swiftModuleNames = getSwiftModuleNames(pods, revision.config?.appleSwiftModuleNames());\n const coreFeatures = revision.config?.coreFeatures() ?? [];\n\n return {\n packageName,\n pods,\n swiftModuleNames,\n flags: extraOutput.flags,\n modules:\n revision.config\n ?.appleModules()\n .map((module) => (typeof module === 'string' ? { name: null, class: module } : module)) ??\n [],\n appDelegateSubscribers: revision.config?.appleAppDelegateSubscribers() ?? [],\n reactDelegateHandlers: revision.config?.appleReactDelegateHandlers() ?? [],\n debugOnly: revision.config?.appleDebugOnly() ?? false,\n ...(coreFeatures.length > 0 ? { coreFeatures } : {}),\n };\n}\n\nexport async function resolveExtraBuildDependenciesAsync(\n projectNativeRoot: string\n): Promise<ExtraDependencies | null> {\n const propsFile = path.join(projectNativeRoot, APPLE_PROPERTIES_FILE);\n try {\n const contents = await fs.promises.readFile(propsFile, 'utf8');\n const podfileJson = JSON.parse(contents);\n if (podfileJson[APPLE_EXTRA_BUILD_DEPS_KEY]) {\n // expo-build-properties would serialize the extraPods as JSON string, we should parse it again.\n const extraPods = JSON.parse(podfileJson[APPLE_EXTRA_BUILD_DEPS_KEY]);\n return extraPods;\n }\n } catch {}\n return null;\n}\n\n/**\n * Generates Swift file that contains all autolinked Swift packages.\n */\nexport async function generateModulesProviderAsync(\n modules: ModuleDescriptorIos[],\n targetPath: string,\n entitlementPath: string | null\n): Promise<void> {\n const className = path.basename(targetPath, path.extname(targetPath));\n const entitlements = await parseEntitlementsAsync(entitlementPath);\n const generatedFileContent = await generatePackageListFileContentAsync(\n modules,\n className,\n entitlements\n );\n const parentPath = path.dirname(targetPath);\n await fs.promises.mkdir(parentPath, { recursive: true });\n await fs.promises.writeFile(targetPath, generatedFileContent, 'utf8');\n}\n\n/**\n * Generates the string to put into the generated package list.\n */\nasync function generatePackageListFileContentAsync(\n modules: ModuleDescriptorIos[],\n className: string,\n entitlements: AppleCodeSignEntitlements\n): Promise<string> {\n const iosModules = modules.filter(\n (module) =>\n module.modules.length ||\n module.appDelegateSubscribers.length ||\n module.reactDelegateHandlers.length\n );\n\n const modulesToImport = iosModules.filter((module) => !module.debugOnly);\n const debugOnlyModules = iosModules.filter((module) => module.debugOnly);\n\n const swiftModules = ([] as string[])\n .concat(...modulesToImport.map((module) => module.swiftModuleNames))\n .filter(Boolean);\n\n const debugOnlySwiftModules = ([] as string[])\n .concat(...debugOnlyModules.map((module) => module.swiftModuleNames))\n .filter(Boolean);\n\n const modulesClassNames = ([] as ModuleIosConfig[])\n .concat(...modulesToImport.map((module) => module.modules))\n .filter(Boolean);\n\n const debugOnlyModulesClassNames = ([] as ModuleIosConfig[])\n .concat(...debugOnlyModules.map((module) => module.modules))\n .filter(Boolean);\n\n const appDelegateSubscribers = ([] as string[]).concat(\n ...modulesToImport.map((module) => module.appDelegateSubscribers)\n );\n\n const debugOnlyAppDelegateSubscribers = ([] as string[]).concat(\n ...debugOnlyModules.map((module) => module.appDelegateSubscribers)\n );\n\n const reactDelegateHandlerModules = modulesToImport.filter(\n (module) => !!module.reactDelegateHandlers.length\n );\n\n const debugOnlyReactDelegateHandlerModules = debugOnlyModules.filter(\n (module) => !!module.reactDelegateHandlers.length\n );\n\n return `/**\n * Automatically generated by expo-modules-autolinking.\n *\n * This autogenerated class provides a list of classes of native Expo modules,\n * but only these that are written in Swift and use the new API for creating Expo modules.\n */\n\nimport ExpoModulesCore\n${generateCommonImportList(swiftModules)}\n${generateDebugOnlyImportList(debugOnlySwiftModules)}\n@objc(${className})\npublic class ${className}: ModulesProvider {\n public override func getModuleClasses() -> [ExpoModuleTupleType] {\n${generateModuleClasses(modulesClassNames, debugOnlyModulesClassNames)}\n }\n\n public override func getAppDelegateSubscribers() -> [ExpoAppDelegateSubscriber.Type] {\n${generateClasses(appDelegateSubscribers, debugOnlyAppDelegateSubscribers)}\n }\n\n public override func getReactDelegateHandlers() -> [ExpoReactDelegateHandlerTupleType] {\n${generateReactDelegateHandlers(reactDelegateHandlerModules, debugOnlyReactDelegateHandlerModules)}\n }\n\n public override func getAppCodeSignEntitlements() -> AppCodeSignEntitlements {\n return AppCodeSignEntitlements.from(json: #\"${JSON.stringify(entitlements)}\"#)\n }\n}\n`;\n}\n\nfunction generateCommonImportList(swiftModules: string[]): string {\n return swiftModules.map((moduleName) => `import ${moduleName}`).join('\\n');\n}\n\nfunction generateDebugOnlyImportList(swiftModules: string[]): string {\n if (!swiftModules.length) {\n return '';\n }\n\n return (\n wrapInDebugConfigurationCheck(\n 0,\n swiftModules.map((moduleName) => `import ${moduleName}`).join('\\n')\n ) + '\\n'\n );\n}\n\nfunction generateModuleClasses(\n modules: ModuleIosConfig[],\n debugOnlyModules: ModuleIosConfig[]\n): string {\n const commonClassNames = formatArrayOfModuleTuples(modules);\n if (debugOnlyModules.length > 0) {\n return wrapInDebugConfigurationCheck(\n 2,\n `return ${formatArrayOfModuleTuples(modules.concat(debugOnlyModules))}`,\n `return ${commonClassNames}`\n );\n } else {\n return `${indent.repeat(2)}return ${commonClassNames}`;\n }\n}\n\n/**\n * Formats an array of modules config to Swift's array of module tuples.\n */\nfunction formatArrayOfModuleTuples(modules: ModuleIosConfig[]): string {\n return `[${modules.map((module) => `\\n${indent.repeat(3)}(module: ${module.class}.self, name: ${module.name ? `\"${module.name}\"` : 'nil'})`).join(',')}\n${indent.repeat(2)}]`;\n}\n\nfunction generateClasses(classNames: string[], debugOnlyClassName: string[]): string {\n const commonClassNames = formatArrayOfClassNames(classNames);\n if (debugOnlyClassName.length > 0) {\n return wrapInDebugConfigurationCheck(\n 2,\n `return ${formatArrayOfClassNames(classNames.concat(debugOnlyClassName))}`,\n `return ${commonClassNames}`\n );\n } else {\n return `${indent.repeat(2)}return ${commonClassNames}`;\n }\n}\n\n/**\n * Formats an array of class names to Swift's array containing these classes.\n */\nfunction formatArrayOfClassNames(classNames: string[]): string {\n return `[${classNames.map((className) => `\\n${indent.repeat(3)}${className}.self`).join(',')}\n${indent.repeat(2)}]`;\n}\n\nfunction generateReactDelegateHandlers(\n module: ModuleDescriptorIos[],\n debugOnlyModules: ModuleDescriptorIos[]\n): string {\n const commonModules = formatArrayOfReactDelegateHandler(module);\n if (debugOnlyModules.length > 0) {\n return wrapInDebugConfigurationCheck(\n 2,\n `return ${formatArrayOfReactDelegateHandler(module.concat(debugOnlyModules))}`,\n `return ${commonModules}`\n );\n } else {\n return `${indent.repeat(2)}return ${commonModules}`;\n }\n}\n\n/**\n * Formats an array of modules to Swift's array containing ReactDelegateHandlers\n */\nexport function formatArrayOfReactDelegateHandler(modules: ModuleDescriptorIos[]): string {\n const values: string[] = [];\n for (const module of modules) {\n for (const handler of module.reactDelegateHandlers) {\n values.push(`(packageName: \"${module.packageName}\", handler: ${handler}.self)`);\n }\n }\n return `[${values.map((value) => `\\n${indent.repeat(3)}${value}`).join(',')}\n${indent.repeat(2)}]`;\n}\n\nfunction wrapInDebugConfigurationCheck(\n indentationLevel: number,\n debugBlock: string,\n releaseBlock: string | null = null\n) {\n if (releaseBlock) {\n return `${indent.repeat(indentationLevel)}#if EXPO_CONFIGURATION_DEBUG\\n${indent.repeat(\n indentationLevel\n )}${debugBlock}\\n${indent.repeat(indentationLevel)}#else\\n${indent.repeat(\n indentationLevel\n )}${releaseBlock}\\n${indent.repeat(indentationLevel)}#endif`;\n }\n\n return `${indent.repeat(indentationLevel)}#if EXPO_CONFIGURATION_DEBUG\\n${indent.repeat(\n indentationLevel\n )}${debugBlock}\\n${indent.repeat(indentationLevel)}#endif`;\n}\n\nasync function parseEntitlementsAsync(\n entitlementPath: string | null\n): Promise<AppleCodeSignEntitlements> {\n if (!entitlementPath || !(await fileExistsAsync(entitlementPath))) {\n return {};\n }\n const { stdout } = await spawnAsync('plutil', ['-convert', 'json', '-o', '-', entitlementPath]);\n const entitlementsJson = JSON.parse(stdout);\n return {\n appGroups: entitlementsJson['com.apple.security.application-groups'] || undefined,\n };\n}\n"]}
|
package/build/types.d.ts
CHANGED
|
@@ -46,8 +46,12 @@ export interface ModuleIosPodspecInfo {
|
|
|
46
46
|
podName: string;
|
|
47
47
|
podspecDir: string;
|
|
48
48
|
}
|
|
49
|
+
export interface ModuleIosConfig {
|
|
50
|
+
name: string | null;
|
|
51
|
+
class: string;
|
|
52
|
+
}
|
|
49
53
|
export interface ModuleDescriptorIos extends CommonNativeModuleDescriptor {
|
|
50
|
-
modules:
|
|
54
|
+
modules: ModuleIosConfig[];
|
|
51
55
|
pods: ModuleIosPodspecInfo[];
|
|
52
56
|
flags: Record<string, any> | undefined;
|
|
53
57
|
swiftModuleNames: string[];
|
|
@@ -129,6 +133,10 @@ export interface AndroidPublication {
|
|
|
129
133
|
*/
|
|
130
134
|
repository: string;
|
|
131
135
|
}
|
|
136
|
+
export type RawAppleModuleConfig = {
|
|
137
|
+
name: string;
|
|
138
|
+
class: string;
|
|
139
|
+
};
|
|
132
140
|
/**
|
|
133
141
|
* Represents a raw config specific to Apple platforms.
|
|
134
142
|
*/
|
|
@@ -136,7 +144,7 @@ export type RawModuleConfigApple = {
|
|
|
136
144
|
/**
|
|
137
145
|
* Names of Swift native modules classes to put to the generated modules provider file.
|
|
138
146
|
*/
|
|
139
|
-
modules?: string[];
|
|
147
|
+
modules?: (string | RawAppleModuleConfig)[];
|
|
140
148
|
/**
|
|
141
149
|
* Names of Swift classes that hooks into `ExpoAppDelegate` to receive AppDelegate life-cycle events.
|
|
142
150
|
*/
|
package/build/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import { ExpoModuleConfig } from './ExpoModuleConfig';\n\ntype Required<T, K extends keyof T> = T & { [P in K]-?: T[P] };\n\ntype WithRequired<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>> & Required<T, K>;\n\n// NOTE(@kitten): Our code has never guaranteed this to be exhaustive, hence the `| (string & {})` addition\nexport type SupportedPlatform =\n | 'apple'\n | 'ios'\n | 'android'\n | 'web'\n | 'macos'\n | 'tvos'\n | 'devtools'\n | (string & {});\n\nexport type PackageRevision = {\n name: string;\n path: string;\n version: string;\n config?: ExpoModuleConfig;\n duplicates?: PackageRevision[];\n};\n\nexport type SearchResults = {\n [moduleName: string]: PackageRevision;\n};\n\nexport interface ModuleAndroidProjectInfo {\n name: string;\n sourceDir: string;\n modules: ModuleAndroidModuleInfo[];\n packages: string[];\n publication?: AndroidPublication;\n aarProjects?: AndroidGradleAarProjectDescriptor[];\n shouldUsePublicationScriptPath?: string;\n}\n\nexport interface ModuleAndroidModuleInfo {\n name: string | null;\n classifier: string;\n}\n\nexport interface ModuleAndroidPluginInfo {\n id: string;\n sourceDir: string;\n}\n\nexport interface ModuleAndroidAarProjectInfo extends AndroidGradleAarProjectDescriptor {\n projectDir: string;\n}\n\nexport interface CommonNativeModuleDescriptor {\n packageName: string;\n coreFeatures?: string[];\n}\n\nexport interface ModuleDescriptorAndroid extends CommonNativeModuleDescriptor {\n projects?: ModuleAndroidProjectInfo[];\n plugins?: ModuleAndroidPluginInfo[];\n}\n\nexport interface ModuleIosPodspecInfo {\n podName: string;\n podspecDir: string;\n}\nexport interface ModuleDescriptorIos extends CommonNativeModuleDescriptor {\n modules: string[];\n pods: ModuleIosPodspecInfo[];\n flags: Record<string, any> | undefined;\n swiftModuleNames: string[];\n appDelegateSubscribers: string[];\n reactDelegateHandlers: string[];\n debugOnly: boolean;\n}\n\nexport interface ModuleDescriptorDevTools {\n packageName: string;\n packageRoot: string;\n webpageRoot?: string;\n cliExtensions?: {\n description: string;\n commands: {\n name: string;\n title: string;\n environments: ('cli' | 'mcp')[];\n parameters?: {\n name: string;\n type: 'text' | 'number' | 'confirm';\n description?: string;\n }[];\n }[];\n entryPoint: string;\n };\n}\n\nexport interface ModuleDescriptorWeb {\n packageName: string;\n packageRoot: string;\n}\n\nexport type ModuleDescriptor =\n | ModuleDescriptorAndroid\n | ModuleDescriptorIos\n | ModuleDescriptorDevTools\n | ModuleDescriptorWeb;\n\nexport interface AndroidGradlePluginDescriptor {\n /**\n * Gradle plugin ID\n */\n id: string;\n\n /**\n * Artifact group\n */\n group: string;\n\n /**\n * Relative path to the gradle plugin directory\n */\n sourceDir: string;\n\n /**\n * Whether to apply the plugin to the root project\n * Defaults to true\n */\n applyToRootProject?: boolean;\n}\n\nexport interface AndroidGradleAarProjectDescriptor {\n /**\n * Gradle project name\n */\n name: string;\n\n /**\n * Path to the AAR file\n */\n aarFilePath: string;\n}\n\n/**\n * Information about the available publication of an Android AAR file.\n */\nexport interface AndroidPublication {\n /**\n * The Maven artifact ID.\n */\n id: string;\n /**\n * The Maven group ID.\n */\n group: string;\n /**\n * The Maven version.\n */\n version: string;\n /**\n * The Maven repository.\n */\n repository: string;\n}\n\n/**\n * Represents a raw config specific to Apple platforms.\n */\nexport type RawModuleConfigApple = {\n /**\n * Names of Swift native modules classes to put to the generated modules provider file.\n */\n modules?: string[];\n\n /**\n * Names of Swift classes that hooks into `ExpoAppDelegate` to receive AppDelegate life-cycle events.\n */\n appDelegateSubscribers?: string[];\n\n /**\n * Names of Swift classes that implement `ExpoReactDelegateHandler` to hook React instance creation.\n */\n reactDelegateHandlers?: string[];\n\n /**\n * Podspec relative path.\n * To have multiple podspecs, string array type is also supported.\n */\n podspecPath?: string | string[];\n\n /**\n * Swift product module name. If empty, the pod name is used for Swift imports.\n * To have multiple modules, string array is also supported.\n */\n swiftModuleName?: string | string[];\n\n /**\n * Whether this module will be added only to the debug configuration.\n * Defaults to false.\n */\n debugOnly?: boolean;\n};\n\nexport type RawAndroidModuleConfig = {\n /**\n * Names of the modules to be linked in the project.\n */\n name: string;\n class: string;\n};\n\n/**\n * Represents a raw config specific to Android platforms.\n */\nexport type RawAndroidProjectConfig = {\n /**\n * The name of the project. It will be used as the Gradle project name.\n */\n name?: string;\n\n /**\n * The path to the project directory. Should contain the `build.gradle{.kts}` file.\n * It's relative to the module root directory.\n */\n path?: string;\n\n /**\n * Information about the available publication of an Android AAR file\n */\n publication?: AndroidPublication;\n\n /**\n * The path to the script that determines whether the publication should be used.\n * Evaluate in the context of the `settings.gradle` file.\n * Won't be run if the publication is not defined.\n */\n shouldUsePublicationScriptPath?: string;\n /**\n * Names of the modules to be linked in the project.\n */\n modules?: (string | RawAndroidModuleConfig)[];\n\n /**\n * Prebuilded AAR projects.\n */\n gradleAarProjects?: AndroidGradleAarProjectDescriptor[];\n\n gradlePath?: string;\n};\n\nexport type RawAndroidConfig = {\n projects?: WithRequired<RawAndroidProjectConfig, 'name' | 'path'>[];\n /**\n * Gradle plugins.\n */\n gradlePlugins?: AndroidGradlePluginDescriptor[];\n\n /**\n * Gradle projects containing AAR files.\n */\n} & RawAndroidProjectConfig;\n\n/**\n * Represents a raw config from `expo-module.json`.\n */\nexport interface RawExpoModuleConfig {\n /**\n * An array of supported platforms.\n */\n platforms?: SupportedPlatform[];\n\n /**\n * A config for all Apple platforms.\n */\n apple?: RawModuleConfigApple;\n\n /**\n * The legacy config previously used for iOS platform. For backwards compatibility it's used as the fallback for `apple`.\n * @deprecated As the module can now support more than iOS platform, use the generic `apple` config instead.\n */\n ios?: RawModuleConfigApple;\n\n /**\n * Android-specific config.\n */\n android?: RawAndroidConfig;\n\n /**\n * List of core features that this module requires.\n */\n coreFeatures?: string[];\n\n /**\n * DevTools-specific config.\n */\n devtools?: {\n /**\n * The webpage root directory for Expo CLI DevTools to serve the web resources. Only set if the module has a web interface.\n */\n webpageRoot?: string;\n /**\n * Cli extension config for the module.\n */\n cliExtensions?: {\n /*\n * The description of the module that will be displayed in the CLI.\n */\n description: string;\n /**\n * The commands that the module provides in the CLI.\n * Each command has a name and a caption.\n */\n commands: {\n /**\n * Name of command\n */\n name: string;\n /**\n * Title for the command that will be displayed in the CLI.\n */\n title: string;\n /**\n * Optional array of disabled environments for the command. By default all commands are enabled on all environments.\n * Environments can be 'cli' for the CLI or 'mcp' for the Model Context Protocol.\n */\n environments: ('cli' | 'mcp')[];\n /**\n * Optional parameters for the command.\n */\n parameters?: {\n /**\n * Name of the parameter.\n */\n name: string;\n /**\n * Type of the parameter.\n * Can be 'text', 'number', or 'confirm'.\n */\n type: 'text' | 'number' | 'confirm';\n /**\n * Description of the parameter that will be displayed in the CLI.\n */\n description?: string;\n }[];\n }[];\n /**\n * The main entry point for the module in the CLI.\n */\n entryPoint: string;\n };\n };\n}\n\ninterface AndroidMavenRepositoryPasswordCredentials {\n username: string;\n password: string;\n}\n\ninterface AndroidMavenRepositoryHttpHeaderCredentials {\n name: string;\n value: string;\n}\n\ninterface AndroidMavenRepositoryAWSCredentials {\n accessKey: string;\n secretKey: string;\n sessionToken?: string;\n}\n\ntype AndroidMavenRepositoryCredentials =\n | AndroidMavenRepositoryPasswordCredentials\n | AndroidMavenRepositoryHttpHeaderCredentials\n | AndroidMavenRepositoryAWSCredentials;\n\nexport interface AndroidMavenRepository {\n /**\n * The URL of the Maven repository.\n */\n url: string;\n /**\n * The credentials to use when accessing the Maven repository.\n * May be of type PasswordCredentials, HttpHeaderCredentials, or AWSCredentials.\n *\n * @see the authentication schemes section of [Gradle documentation](https://docs.gradle.org/current/userguide/declaring_repositories.html#sec:authentication_schemes) for more information.\n */\n credentials?: AndroidMavenRepositoryCredentials;\n /**\n * The authentication scheme to use when accessing the Maven repository.\n */\n authentication?: 'basic' | 'digest' | 'header';\n}\n\ninterface ApplePod {\n name: string;\n version?: string;\n configurations?: string[];\n modular_headers?: boolean;\n source?: string;\n path?: string;\n podspec?: string;\n testspecs?: string[];\n git?: string;\n branch?: string;\n tag?: string;\n commit?: string;\n}\n\nexport type ExtraDependencies = AndroidMavenRepository[] | ApplePod[];\n\n/**\n * Represents code signing entitlements passed to the `ExpoModulesProvider` for Apple platforms.\n */\nexport interface AppleCodeSignEntitlements {\n /**\n * @see https://developer.apple.com/documentation/bundleresources/entitlements/com_apple_security_application-groups\n */\n appGroups?: string[];\n}\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import { ExpoModuleConfig } from './ExpoModuleConfig';\n\ntype Required<T, K extends keyof T> = T & { [P in K]-?: T[P] };\n\ntype WithRequired<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>> & Required<T, K>;\n\n// NOTE(@kitten): Our code has never guaranteed this to be exhaustive, hence the `| (string & {})` addition\nexport type SupportedPlatform =\n | 'apple'\n | 'ios'\n | 'android'\n | 'web'\n | 'macos'\n | 'tvos'\n | 'devtools'\n | (string & {});\n\nexport type PackageRevision = {\n name: string;\n path: string;\n version: string;\n config?: ExpoModuleConfig;\n duplicates?: PackageRevision[];\n};\n\nexport type SearchResults = {\n [moduleName: string]: PackageRevision;\n};\n\nexport interface ModuleAndroidProjectInfo {\n name: string;\n sourceDir: string;\n modules: ModuleAndroidModuleInfo[];\n packages: string[];\n publication?: AndroidPublication;\n aarProjects?: AndroidGradleAarProjectDescriptor[];\n shouldUsePublicationScriptPath?: string;\n}\n\nexport interface ModuleAndroidModuleInfo {\n name: string | null;\n classifier: string;\n}\n\nexport interface ModuleAndroidPluginInfo {\n id: string;\n sourceDir: string;\n}\n\nexport interface ModuleAndroidAarProjectInfo extends AndroidGradleAarProjectDescriptor {\n projectDir: string;\n}\n\nexport interface CommonNativeModuleDescriptor {\n packageName: string;\n coreFeatures?: string[];\n}\n\nexport interface ModuleDescriptorAndroid extends CommonNativeModuleDescriptor {\n projects?: ModuleAndroidProjectInfo[];\n plugins?: ModuleAndroidPluginInfo[];\n}\n\nexport interface ModuleIosPodspecInfo {\n podName: string;\n podspecDir: string;\n}\nexport interface ModuleIosConfig {\n name: string | null;\n class: string;\n}\nexport interface ModuleDescriptorIos extends CommonNativeModuleDescriptor {\n modules: ModuleIosConfig[];\n pods: ModuleIosPodspecInfo[];\n flags: Record<string, any> | undefined;\n swiftModuleNames: string[];\n appDelegateSubscribers: string[];\n reactDelegateHandlers: string[];\n debugOnly: boolean;\n}\n\nexport interface ModuleDescriptorDevTools {\n packageName: string;\n packageRoot: string;\n webpageRoot?: string;\n cliExtensions?: {\n description: string;\n commands: {\n name: string;\n title: string;\n environments: ('cli' | 'mcp')[];\n parameters?: {\n name: string;\n type: 'text' | 'number' | 'confirm';\n description?: string;\n }[];\n }[];\n entryPoint: string;\n };\n}\n\nexport interface ModuleDescriptorWeb {\n packageName: string;\n packageRoot: string;\n}\n\nexport type ModuleDescriptor =\n | ModuleDescriptorAndroid\n | ModuleDescriptorIos\n | ModuleDescriptorDevTools\n | ModuleDescriptorWeb;\n\nexport interface AndroidGradlePluginDescriptor {\n /**\n * Gradle plugin ID\n */\n id: string;\n\n /**\n * Artifact group\n */\n group: string;\n\n /**\n * Relative path to the gradle plugin directory\n */\n sourceDir: string;\n\n /**\n * Whether to apply the plugin to the root project\n * Defaults to true\n */\n applyToRootProject?: boolean;\n}\n\nexport interface AndroidGradleAarProjectDescriptor {\n /**\n * Gradle project name\n */\n name: string;\n\n /**\n * Path to the AAR file\n */\n aarFilePath: string;\n}\n\n/**\n * Information about the available publication of an Android AAR file.\n */\nexport interface AndroidPublication {\n /**\n * The Maven artifact ID.\n */\n id: string;\n /**\n * The Maven group ID.\n */\n group: string;\n /**\n * The Maven version.\n */\n version: string;\n /**\n * The Maven repository.\n */\n repository: string;\n}\n\nexport type RawAppleModuleConfig = {\n name: string;\n class: string;\n};\n/**\n * Represents a raw config specific to Apple platforms.\n */\nexport type RawModuleConfigApple = {\n /**\n * Names of Swift native modules classes to put to the generated modules provider file.\n */\n modules?: (string | RawAppleModuleConfig)[];\n\n /**\n * Names of Swift classes that hooks into `ExpoAppDelegate` to receive AppDelegate life-cycle events.\n */\n appDelegateSubscribers?: string[];\n\n /**\n * Names of Swift classes that implement `ExpoReactDelegateHandler` to hook React instance creation.\n */\n reactDelegateHandlers?: string[];\n\n /**\n * Podspec relative path.\n * To have multiple podspecs, string array type is also supported.\n */\n podspecPath?: string | string[];\n\n /**\n * Swift product module name. If empty, the pod name is used for Swift imports.\n * To have multiple modules, string array is also supported.\n */\n swiftModuleName?: string | string[];\n\n /**\n * Whether this module will be added only to the debug configuration.\n * Defaults to false.\n */\n debugOnly?: boolean;\n};\n\nexport type RawAndroidModuleConfig = {\n /**\n * Names of the modules to be linked in the project.\n */\n name: string;\n class: string;\n};\n\n/**\n * Represents a raw config specific to Android platforms.\n */\nexport type RawAndroidProjectConfig = {\n /**\n * The name of the project. It will be used as the Gradle project name.\n */\n name?: string;\n\n /**\n * The path to the project directory. Should contain the `build.gradle{.kts}` file.\n * It's relative to the module root directory.\n */\n path?: string;\n\n /**\n * Information about the available publication of an Android AAR file\n */\n publication?: AndroidPublication;\n\n /**\n * The path to the script that determines whether the publication should be used.\n * Evaluate in the context of the `settings.gradle` file.\n * Won't be run if the publication is not defined.\n */\n shouldUsePublicationScriptPath?: string;\n /**\n * Names of the modules to be linked in the project.\n */\n modules?: (string | RawAndroidModuleConfig)[];\n\n /**\n * Prebuilded AAR projects.\n */\n gradleAarProjects?: AndroidGradleAarProjectDescriptor[];\n\n gradlePath?: string;\n};\n\nexport type RawAndroidConfig = {\n projects?: WithRequired<RawAndroidProjectConfig, 'name' | 'path'>[];\n /**\n * Gradle plugins.\n */\n gradlePlugins?: AndroidGradlePluginDescriptor[];\n\n /**\n * Gradle projects containing AAR files.\n */\n} & RawAndroidProjectConfig;\n\n/**\n * Represents a raw config from `expo-module.json`.\n */\nexport interface RawExpoModuleConfig {\n /**\n * An array of supported platforms.\n */\n platforms?: SupportedPlatform[];\n\n /**\n * A config for all Apple platforms.\n */\n apple?: RawModuleConfigApple;\n\n /**\n * The legacy config previously used for iOS platform. For backwards compatibility it's used as the fallback for `apple`.\n * @deprecated As the module can now support more than iOS platform, use the generic `apple` config instead.\n */\n ios?: RawModuleConfigApple;\n\n /**\n * Android-specific config.\n */\n android?: RawAndroidConfig;\n\n /**\n * List of core features that this module requires.\n */\n coreFeatures?: string[];\n\n /**\n * DevTools-specific config.\n */\n devtools?: {\n /**\n * The webpage root directory for Expo CLI DevTools to serve the web resources. Only set if the module has a web interface.\n */\n webpageRoot?: string;\n /**\n * Cli extension config for the module.\n */\n cliExtensions?: {\n /*\n * The description of the module that will be displayed in the CLI.\n */\n description: string;\n /**\n * The commands that the module provides in the CLI.\n * Each command has a name and a caption.\n */\n commands: {\n /**\n * Name of command\n */\n name: string;\n /**\n * Title for the command that will be displayed in the CLI.\n */\n title: string;\n /**\n * Optional array of disabled environments for the command. By default all commands are enabled on all environments.\n * Environments can be 'cli' for the CLI or 'mcp' for the Model Context Protocol.\n */\n environments: ('cli' | 'mcp')[];\n /**\n * Optional parameters for the command.\n */\n parameters?: {\n /**\n * Name of the parameter.\n */\n name: string;\n /**\n * Type of the parameter.\n * Can be 'text', 'number', or 'confirm'.\n */\n type: 'text' | 'number' | 'confirm';\n /**\n * Description of the parameter that will be displayed in the CLI.\n */\n description?: string;\n }[];\n }[];\n /**\n * The main entry point for the module in the CLI.\n */\n entryPoint: string;\n };\n };\n}\n\ninterface AndroidMavenRepositoryPasswordCredentials {\n username: string;\n password: string;\n}\n\ninterface AndroidMavenRepositoryHttpHeaderCredentials {\n name: string;\n value: string;\n}\n\ninterface AndroidMavenRepositoryAWSCredentials {\n accessKey: string;\n secretKey: string;\n sessionToken?: string;\n}\n\ntype AndroidMavenRepositoryCredentials =\n | AndroidMavenRepositoryPasswordCredentials\n | AndroidMavenRepositoryHttpHeaderCredentials\n | AndroidMavenRepositoryAWSCredentials;\n\nexport interface AndroidMavenRepository {\n /**\n * The URL of the Maven repository.\n */\n url: string;\n /**\n * The credentials to use when accessing the Maven repository.\n * May be of type PasswordCredentials, HttpHeaderCredentials, or AWSCredentials.\n *\n * @see the authentication schemes section of [Gradle documentation](https://docs.gradle.org/current/userguide/declaring_repositories.html#sec:authentication_schemes) for more information.\n */\n credentials?: AndroidMavenRepositoryCredentials;\n /**\n * The authentication scheme to use when accessing the Maven repository.\n */\n authentication?: 'basic' | 'digest' | 'header';\n}\n\ninterface ApplePod {\n name: string;\n version?: string;\n configurations?: string[];\n modular_headers?: boolean;\n source?: string;\n path?: string;\n podspec?: string;\n testspecs?: string[];\n git?: string;\n branch?: string;\n tag?: string;\n commit?: string;\n}\n\nexport type ExtraDependencies = AndroidMavenRepository[] | ApplePod[];\n\n/**\n * Represents code signing entitlements passed to the `ExpoModulesProvider` for Apple platforms.\n */\nexport interface AppleCodeSignEntitlements {\n /**\n * @see https://developer.apple.com/documentation/bundleresources/entitlements/com_apple_security_application-groups\n */\n appGroups?: string[];\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-modules-autolinking",
|
|
3
|
-
"version": "3.1.0-canary-
|
|
3
|
+
"version": "3.1.0-canary-20251023-4c86f95",
|
|
4
4
|
"description": "Scripts that autolink Expo modules.",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"license": "MIT",
|
|
35
35
|
"homepage": "https://github.com/expo/expo/tree/main/packages/expo-modules-autolinking#readme",
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"expo-module-scripts": "5.0.8-canary-
|
|
37
|
+
"expo-module-scripts": "5.0.8-canary-20251023-4c86f95",
|
|
38
38
|
"memfs": "^3.2.0",
|
|
39
39
|
"minimatch": "^9.0.0"
|
|
40
40
|
},
|
|
@@ -49,7 +49,7 @@ export const maybeRealpath = async (target: string): Promise<string | null> => {
|
|
|
49
49
|
}
|
|
50
50
|
};
|
|
51
51
|
|
|
52
|
-
export type PackageJson = Record<string, unknown> & {
|
|
52
|
+
export type PackageJson = Record<string, unknown> & { version?: string };
|
|
53
53
|
|
|
54
54
|
export const loadPackageJson = memoize(async function loadPackageJson(
|
|
55
55
|
jsonPath: string
|
|
@@ -59,8 +59,6 @@ export const loadPackageJson = memoize(async function loadPackageJson(
|
|
|
59
59
|
const json = JSON.parse(packageJsonText);
|
|
60
60
|
if (typeof json !== 'object' || json == null) {
|
|
61
61
|
return null;
|
|
62
|
-
} else if (typeof json.name !== 'string' || !json.name) {
|
|
63
|
-
return null;
|
|
64
62
|
}
|
|
65
63
|
return json;
|
|
66
64
|
} catch {
|
package/src/fileUtils.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import fs from 'fs/promises';
|
|
2
|
-
import { glob, GlobOptions } from 'glob';
|
|
2
|
+
import { glob, type GlobOptions, type GlobOptionsWithFileTypesTrue } from 'glob';
|
|
3
3
|
import path from 'path';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -20,13 +20,19 @@ export async function fileExistsAsync(file: string): Promise<boolean> {
|
|
|
20
20
|
export async function globMatchFunctorAllAsync(
|
|
21
21
|
globPattern: string,
|
|
22
22
|
matchFunctor: MatchFunctor,
|
|
23
|
-
options?: GlobOptions
|
|
23
|
+
options?: Omit<GlobOptions, 'withFileTypes'>
|
|
24
24
|
): Promise<string[]> {
|
|
25
|
-
const globStream = glob.stream(globPattern, {
|
|
25
|
+
const globStream = glob.stream(globPattern, {
|
|
26
|
+
...options,
|
|
27
|
+
withFileTypes: true,
|
|
28
|
+
} as GlobOptionsWithFileTypesTrue);
|
|
26
29
|
const cwd = options?.cwd !== undefined ? `${options.cwd}` : process.cwd();
|
|
27
30
|
const results: string[] = [];
|
|
28
|
-
for await (const
|
|
29
|
-
|
|
31
|
+
for await (const globPath of globStream) {
|
|
32
|
+
if (!globPath.isFile()) {
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
let filePath = globPath.fullpath();
|
|
30
36
|
if (!path.isAbsolute(filePath)) {
|
|
31
37
|
filePath = path.resolve(cwd, filePath);
|
|
32
38
|
}
|
|
@@ -45,12 +51,18 @@ export async function globMatchFunctorAllAsync(
|
|
|
45
51
|
export async function globMatchFunctorFirstAsync(
|
|
46
52
|
globPattern: string,
|
|
47
53
|
matchFunctor: MatchFunctor,
|
|
48
|
-
options?: GlobOptions
|
|
54
|
+
options?: Omit<GlobOptions, 'withFileTypes'>
|
|
49
55
|
): Promise<string | null> {
|
|
50
|
-
const globStream = glob.stream(globPattern, {
|
|
56
|
+
const globStream = glob.stream(globPattern, {
|
|
57
|
+
...options,
|
|
58
|
+
withFileTypes: true,
|
|
59
|
+
} as GlobOptionsWithFileTypesTrue);
|
|
51
60
|
const cwd = options?.cwd !== undefined ? `${options.cwd}` : process.cwd();
|
|
52
|
-
for await (const
|
|
53
|
-
|
|
61
|
+
for await (const globPath of globStream) {
|
|
62
|
+
if (!globPath.isFile()) {
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
let filePath = globPath.fullpath();
|
|
54
66
|
if (!path.isAbsolute(filePath)) {
|
|
55
67
|
filePath = path.resolve(cwd, filePath);
|
|
56
68
|
}
|
|
@@ -8,6 +8,7 @@ import type {
|
|
|
8
8
|
AppleCodeSignEntitlements,
|
|
9
9
|
ExtraDependencies,
|
|
10
10
|
ModuleDescriptorIos,
|
|
11
|
+
ModuleIosConfig,
|
|
11
12
|
ModuleIosPodspecInfo,
|
|
12
13
|
PackageRevision,
|
|
13
14
|
} from '../../types';
|
|
@@ -66,7 +67,11 @@ export async function resolveModuleAsync(
|
|
|
66
67
|
pods,
|
|
67
68
|
swiftModuleNames,
|
|
68
69
|
flags: extraOutput.flags,
|
|
69
|
-
modules:
|
|
70
|
+
modules:
|
|
71
|
+
revision.config
|
|
72
|
+
?.appleModules()
|
|
73
|
+
.map((module) => (typeof module === 'string' ? { name: null, class: module } : module)) ??
|
|
74
|
+
[],
|
|
70
75
|
appDelegateSubscribers: revision.config?.appleAppDelegateSubscribers() ?? [],
|
|
71
76
|
reactDelegateHandlers: revision.config?.appleReactDelegateHandlers() ?? [],
|
|
72
77
|
debugOnly: revision.config?.appleDebugOnly() ?? false,
|
|
@@ -136,11 +141,11 @@ async function generatePackageListFileContentAsync(
|
|
|
136
141
|
.concat(...debugOnlyModules.map((module) => module.swiftModuleNames))
|
|
137
142
|
.filter(Boolean);
|
|
138
143
|
|
|
139
|
-
const modulesClassNames = ([] as
|
|
144
|
+
const modulesClassNames = ([] as ModuleIosConfig[])
|
|
140
145
|
.concat(...modulesToImport.map((module) => module.modules))
|
|
141
146
|
.filter(Boolean);
|
|
142
147
|
|
|
143
|
-
const debugOnlyModulesClassNames = ([] as
|
|
148
|
+
const debugOnlyModulesClassNames = ([] as ModuleIosConfig[])
|
|
144
149
|
.concat(...debugOnlyModules.map((module) => module.modules))
|
|
145
150
|
.filter(Boolean);
|
|
146
151
|
|
|
@@ -172,12 +177,12 @@ ${generateCommonImportList(swiftModules)}
|
|
|
172
177
|
${generateDebugOnlyImportList(debugOnlySwiftModules)}
|
|
173
178
|
@objc(${className})
|
|
174
179
|
public class ${className}: ModulesProvider {
|
|
175
|
-
public override func getModuleClasses() -> [
|
|
180
|
+
public override func getModuleClasses() -> [ExpoModuleTupleType] {
|
|
176
181
|
${generateModuleClasses(modulesClassNames, debugOnlyModulesClassNames)}
|
|
177
182
|
}
|
|
178
183
|
|
|
179
184
|
public override func getAppDelegateSubscribers() -> [ExpoAppDelegateSubscriber.Type] {
|
|
180
|
-
${
|
|
185
|
+
${generateClasses(appDelegateSubscribers, debugOnlyAppDelegateSubscribers)}
|
|
181
186
|
}
|
|
182
187
|
|
|
183
188
|
public override func getReactDelegateHandlers() -> [ExpoReactDelegateHandlerTupleType] {
|
|
@@ -208,7 +213,31 @@ function generateDebugOnlyImportList(swiftModules: string[]): string {
|
|
|
208
213
|
);
|
|
209
214
|
}
|
|
210
215
|
|
|
211
|
-
function generateModuleClasses(
|
|
216
|
+
function generateModuleClasses(
|
|
217
|
+
modules: ModuleIosConfig[],
|
|
218
|
+
debugOnlyModules: ModuleIosConfig[]
|
|
219
|
+
): string {
|
|
220
|
+
const commonClassNames = formatArrayOfModuleTuples(modules);
|
|
221
|
+
if (debugOnlyModules.length > 0) {
|
|
222
|
+
return wrapInDebugConfigurationCheck(
|
|
223
|
+
2,
|
|
224
|
+
`return ${formatArrayOfModuleTuples(modules.concat(debugOnlyModules))}`,
|
|
225
|
+
`return ${commonClassNames}`
|
|
226
|
+
);
|
|
227
|
+
} else {
|
|
228
|
+
return `${indent.repeat(2)}return ${commonClassNames}`;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Formats an array of modules config to Swift's array of module tuples.
|
|
234
|
+
*/
|
|
235
|
+
function formatArrayOfModuleTuples(modules: ModuleIosConfig[]): string {
|
|
236
|
+
return `[${modules.map((module) => `\n${indent.repeat(3)}(module: ${module.class}.self, name: ${module.name ? `"${module.name}"` : 'nil'})`).join(',')}
|
|
237
|
+
${indent.repeat(2)}]`;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
function generateClasses(classNames: string[], debugOnlyClassName: string[]): string {
|
|
212
241
|
const commonClassNames = formatArrayOfClassNames(classNames);
|
|
213
242
|
if (debugOnlyClassName.length > 0) {
|
|
214
243
|
return wrapInDebugConfigurationCheck(
|
package/src/types.ts
CHANGED
|
@@ -65,8 +65,12 @@ export interface ModuleIosPodspecInfo {
|
|
|
65
65
|
podName: string;
|
|
66
66
|
podspecDir: string;
|
|
67
67
|
}
|
|
68
|
+
export interface ModuleIosConfig {
|
|
69
|
+
name: string | null;
|
|
70
|
+
class: string;
|
|
71
|
+
}
|
|
68
72
|
export interface ModuleDescriptorIos extends CommonNativeModuleDescriptor {
|
|
69
|
-
modules:
|
|
73
|
+
modules: ModuleIosConfig[];
|
|
70
74
|
pods: ModuleIosPodspecInfo[];
|
|
71
75
|
flags: Record<string, any> | undefined;
|
|
72
76
|
swiftModuleNames: string[];
|
|
@@ -163,6 +167,10 @@ export interface AndroidPublication {
|
|
|
163
167
|
repository: string;
|
|
164
168
|
}
|
|
165
169
|
|
|
170
|
+
export type RawAppleModuleConfig = {
|
|
171
|
+
name: string;
|
|
172
|
+
class: string;
|
|
173
|
+
};
|
|
166
174
|
/**
|
|
167
175
|
* Represents a raw config specific to Apple platforms.
|
|
168
176
|
*/
|
|
@@ -170,7 +178,7 @@ export type RawModuleConfigApple = {
|
|
|
170
178
|
/**
|
|
171
179
|
* Names of Swift native modules classes to put to the generated modules provider file.
|
|
172
180
|
*/
|
|
173
|
-
modules?: string[];
|
|
181
|
+
modules?: (string | RawAppleModuleConfig)[];
|
|
174
182
|
|
|
175
183
|
/**
|
|
176
184
|
* Names of Swift classes that hooks into `ExpoAppDelegate` to receive AppDelegate life-cycle events.
|