first commit

This commit is contained in:
2026-03-10 16:18:05 +00:00
commit 11f9c069b5
31635 changed files with 3187747 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
import { AutolinkingOptions } from '../../commands/autolinkingOptions';
import type { ExtraDependencies, ModuleDescriptorAndroid, PackageRevision } from '../../types';
interface AndroidConfigurationOutput {
buildFromSource: string[];
}
export declare function getConfiguration(options: AutolinkingOptions): AndroidConfigurationOutput | undefined;
export declare function isAndroidProject(projectRoot: string): boolean;
export declare function resolveModuleAsync(packageName: string, revision: PackageRevision): Promise<ModuleDescriptorAndroid | null>;
export declare function resolveExtraBuildDependenciesAsync(projectNativeRoot: string): Promise<ExtraDependencies | null>;
export declare function resolveGradlePropertyAsync(projectNativeRoot: string, propertyKey: string): Promise<string | null>;
/**
* Converts the package name to Android's project name.
* `/` path will transform as `-`
*
* Example: `@expo/example` + `android/build.gradle` → `expo-example`
*/
export declare function convertPackageToProjectName(packageName: string): string;
/**
* Converts the package name and gradle file path to Android's project name.
* `$` to indicate subprojects
* `/` path will transform as `-`
*
* Example: `@expo/example` + `android/build.gradle` → `expo-example`
*
* Example: multiple projects
* - `expo-test` + `android/build.gradle` → `react-native-third-party`
* - `expo-test` + `subproject/build.gradle` → `react-native-third-party$subproject`
*/
export declare function convertPackageWithGradleToProjectName(packageName: string, buildGradleFile: string): string;
/**
* Given the contents of a `gradle.properties` file,
* searches for a property with the given name.
*
* This function will return the first property found with the given name.
* The implementation follows config-plugins and
* tries to align the behavior with the `withGradleProperties` plugin.
*/
export declare function searchGradlePropertyFirst(contents: string, propertyName: string): string | null;
export {};

View File

@@ -0,0 +1,175 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getConfiguration = getConfiguration;
exports.isAndroidProject = isAndroidProject;
exports.resolveModuleAsync = resolveModuleAsync;
exports.resolveExtraBuildDependenciesAsync = resolveExtraBuildDependenciesAsync;
exports.resolveGradlePropertyAsync = resolveGradlePropertyAsync;
exports.convertPackageToProjectName = convertPackageToProjectName;
exports.convertPackageWithGradleToProjectName = convertPackageWithGradleToProjectName;
exports.searchGradlePropertyFirst = searchGradlePropertyFirst;
const fs_1 = __importDefault(require("fs"));
const path_1 = __importDefault(require("path"));
const concurrency_1 = require("../../concurrency");
const utils_1 = require("../../utils");
const ANDROID_PROPERTIES_FILE = 'gradle.properties';
const ANDROID_EXTRA_BUILD_DEPS_KEY = 'android.extraMavenRepos';
function getConfiguration(options) {
return options.buildFromSource ? { buildFromSource: options.buildFromSource } : undefined;
}
function isAndroidProject(projectRoot) {
return (fs_1.default.existsSync(path_1.default.join(projectRoot, 'build.gradle')) ||
fs_1.default.existsSync(path_1.default.join(projectRoot, 'build.gradle.kts')));
}
async function resolveModuleAsync(packageName, revision) {
// TODO: Relative source dir should be configurable through the module config.
// Don't link itself... :D
if (packageName === '@unimodules/react-native-adapter') {
return null;
}
const plugins = (revision.config?.androidGradlePlugins() ?? []).map(({ id, group, sourceDir, applyToRootProject }) => ({
id,
group,
sourceDir: path_1.default.join(revision.path, sourceDir),
applyToRootProject: applyToRootProject ?? true,
}));
const defaultProjectName = convertPackageToProjectName(packageName);
const androidProjects = revision.config
?.androidProjects(defaultProjectName)
?.filter((project) => {
return !project.isDefault || isAndroidProject(path_1.default.join(revision.path, project.path));
});
// Just in case where the module doesn't have its own `build.gradle`/`settings.gradle`.
if (!androidProjects?.length) {
if (!plugins.length) {
return null;
}
return {
packageName,
plugins,
};
}
const projects = await (0, concurrency_1.taskAll)(androidProjects, async (project) => {
const projectPath = path_1.default.join(revision.path, project.path);
const aarProjects = (project.gradleAarProjects ?? [])?.map((aarProject) => {
const projectName = `${defaultProjectName}$${aarProject.name}`;
const projectDir = path_1.default.join(projectPath, 'build', projectName);
return {
name: projectName,
aarFilePath: path_1.default.join(revision.path, aarProject.aarFilePath),
projectDir,
};
});
const { publication } = project;
const shouldUsePublicationScriptPath = project.shouldUsePublicationScriptPath
? path_1.default.join(revision.path, project.shouldUsePublicationScriptPath)
: undefined;
const packages = new Set();
for await (const file of (0, utils_1.scanFilesRecursively)(projectPath)) {
if (!file.name.endsWith('Package.java') && !file.name.endsWith('Package.kt')) {
continue;
}
const fileContent = await fs_1.default.promises.readFile(file.path, 'utf8');
// Very naive check to skip non-expo packages
if (!/\bimport\s+expo\.modules\.core\.(interfaces\.Package|BasePackage)\b/.test(fileContent)) {
continue;
}
const classPathMatches = fileContent.match(/^package ([\w.]+)\b/m);
if (classPathMatches) {
const basename = path_1.default.basename(file.name, path_1.default.extname(file.name));
packages.add(`${classPathMatches[1]}.${basename}`);
}
}
return {
name: project.name,
sourceDir: projectPath,
modules: project.modules ?? [],
services: project.services ?? [],
packages: [...packages].sort((a, b) => a.localeCompare(b)),
...(shouldUsePublicationScriptPath ? { shouldUsePublicationScriptPath } : {}),
...(publication ? { publication } : {}),
...(aarProjects?.length > 0 ? { aarProjects } : {}),
};
});
const coreFeatures = revision.config?.coreFeatures() ?? [];
return {
packageName,
projects,
...(plugins?.length > 0 ? { plugins } : {}),
...(coreFeatures.length > 0 ? { coreFeatures } : {}),
};
}
async function resolveExtraBuildDependenciesAsync(projectNativeRoot) {
const extraMavenReposString = await resolveGradlePropertyAsync(projectNativeRoot, ANDROID_EXTRA_BUILD_DEPS_KEY);
if (extraMavenReposString) {
try {
return JSON.parse(extraMavenReposString);
}
catch { }
}
return null;
}
async function resolveGradlePropertyAsync(projectNativeRoot, propertyKey) {
const propsFile = path_1.default.join(projectNativeRoot, ANDROID_PROPERTIES_FILE);
try {
const contents = await fs_1.default.promises.readFile(propsFile, 'utf8');
const propertyValue = searchGradlePropertyFirst(contents, propertyKey);
if (propertyValue) {
return propertyValue;
}
}
catch { }
return null;
}
/**
* Converts the package name to Android's project name.
* `/` path will transform as `-`
*
* Example: `@expo/example` + `android/build.gradle` → `expo-example`
*/
function convertPackageToProjectName(packageName) {
return packageName.replace(/^@/g, '').replace(/\W+/g, '-');
}
/**
* Converts the package name and gradle file path to Android's project name.
* `$` to indicate subprojects
* `/` path will transform as `-`
*
* Example: `@expo/example` + `android/build.gradle` → `expo-example`
*
* Example: multiple projects
* - `expo-test` + `android/build.gradle` → `react-native-third-party`
* - `expo-test` + `subproject/build.gradle` → `react-native-third-party$subproject`
*/
function convertPackageWithGradleToProjectName(packageName, buildGradleFile) {
const name = convertPackageToProjectName(packageName);
const baseDir = path_1.default.dirname(buildGradleFile).replace(/\//g, '-');
return baseDir === 'android' ? name : `${name}$${baseDir}`;
}
/**
* Given the contents of a `gradle.properties` file,
* searches for a property with the given name.
*
* This function will return the first property found with the given name.
* The implementation follows config-plugins and
* tries to align the behavior with the `withGradleProperties` plugin.
*/
function searchGradlePropertyFirst(contents, propertyName) {
const lines = contents.split('\n');
for (let i = 0; i < lines.length; i++) {
const line = lines[i].trim();
if (line && !line.startsWith('#')) {
const eok = line.indexOf('=');
const key = line.slice(0, eok);
if (key === propertyName) {
const value = line.slice(eok + 1, line.length);
return value;
}
}
}
return null;
}
//# sourceMappingURL=android.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
export { getConfiguration, resolveModuleAsync, resolveExtraBuildDependenciesAsync, } from './android';

View File

@@ -0,0 +1,8 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.resolveExtraBuildDependenciesAsync = exports.resolveModuleAsync = exports.getConfiguration = void 0;
var android_1 = require("./android");
Object.defineProperty(exports, "getConfiguration", { enumerable: true, get: function () { return android_1.getConfiguration; } });
Object.defineProperty(exports, "resolveModuleAsync", { enumerable: true, get: function () { return android_1.resolveModuleAsync; } });
Object.defineProperty(exports, "resolveExtraBuildDependenciesAsync", { enumerable: true, get: function () { return android_1.resolveExtraBuildDependenciesAsync; } });
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/platforms/android/index.ts"],"names":[],"mappings":";;;AAAA,qCAImB;AAHjB,2GAAA,gBAAgB,OAAA;AAChB,6GAAA,kBAAkB,OAAA;AAClB,6HAAA,kCAAkC,OAAA","sourcesContent":["export {\n getConfiguration,\n resolveModuleAsync,\n resolveExtraBuildDependenciesAsync,\n} from './android';\n"]}

View File

@@ -0,0 +1,15 @@
import type { ExtraDependencies, ModuleDescriptorIos, ModuleIosPodspecInfo, PackageRevision } from '../../types';
export declare function getSwiftModuleNames(pods: ModuleIosPodspecInfo[], swiftModuleNames: string[] | undefined): string[];
/** Resolves module search result with additional details required for iOS platform. */
export declare function resolveModuleAsync(packageName: string, revision: PackageRevision, extraOutput: {
flags?: Record<string, any>;
}): Promise<ModuleDescriptorIos | null>;
export declare function resolveExtraBuildDependenciesAsync(projectNativeRoot: string): Promise<ExtraDependencies | null>;
/**
* Generates Swift file that contains all autolinked Swift packages.
*/
export declare function generateModulesProviderAsync(modules: ModuleDescriptorIos[], targetPath: string, entitlementPath: string | null): Promise<void>;
/**
* Formats an array of modules to Swift's array containing ReactDelegateHandlers
*/
export declare function formatArrayOfReactDelegateHandler(modules: ModuleDescriptorIos[]): string;

View File

@@ -0,0 +1,221 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getSwiftModuleNames = getSwiftModuleNames;
exports.resolveModuleAsync = resolveModuleAsync;
exports.resolveExtraBuildDependenciesAsync = resolveExtraBuildDependenciesAsync;
exports.generateModulesProviderAsync = generateModulesProviderAsync;
exports.formatArrayOfReactDelegateHandler = formatArrayOfReactDelegateHandler;
const spawn_async_1 = __importDefault(require("@expo/spawn-async"));
const fs_1 = __importDefault(require("fs"));
const path_1 = __importDefault(require("path"));
const utils_1 = require("../../utils");
const APPLE_PROPERTIES_FILE = 'Podfile.properties.json';
const APPLE_EXTRA_BUILD_DEPS_KEY = 'apple.extraPods';
const indent = ' ';
/** Find all *.podspec files in top-level directories */
async function findPodspecFiles(revision) {
const configPodspecPaths = revision.config?.applePodspecPaths();
if (configPodspecPaths && configPodspecPaths.length) {
return configPodspecPaths;
}
else {
return await (0, utils_1.listFilesInDirectories)(revision.path, (basename) => basename.endsWith('.podspec'));
}
}
function getSwiftModuleNames(pods, swiftModuleNames) {
if (swiftModuleNames && swiftModuleNames.length) {
return swiftModuleNames;
}
// by default, non-alphanumeric characters in the pod name are replaced by _ in the module name
return pods.map((pod) => pod.podName.replace(/[^a-zA-Z0-9]/g, '_'));
}
/** Resolves module search result with additional details required for iOS platform. */
async function resolveModuleAsync(packageName, revision, extraOutput) {
const podspecFiles = await findPodspecFiles(revision);
if (!podspecFiles.length) {
return null;
}
const pods = podspecFiles.map((podspecFile) => ({
podName: path_1.default.basename(podspecFile, path_1.default.extname(podspecFile)),
podspecDir: path_1.default.dirname(path_1.default.join(revision.path, podspecFile)),
}));
const swiftModuleNames = getSwiftModuleNames(pods, revision.config?.appleSwiftModuleNames());
const coreFeatures = revision.config?.coreFeatures() ?? [];
return {
packageName,
pods,
swiftModuleNames,
flags: extraOutput.flags,
modules: revision.config
?.appleModules()
.map((module) => (typeof module === 'string' ? { name: null, class: module } : module)) ??
[],
appDelegateSubscribers: revision.config?.appleAppDelegateSubscribers() ?? [],
reactDelegateHandlers: revision.config?.appleReactDelegateHandlers() ?? [],
debugOnly: revision.config?.appleDebugOnly() ?? false,
...(coreFeatures.length > 0 ? { coreFeatures } : {}),
};
}
async function resolveExtraBuildDependenciesAsync(projectNativeRoot) {
const propsFile = path_1.default.join(projectNativeRoot, APPLE_PROPERTIES_FILE);
try {
const contents = await fs_1.default.promises.readFile(propsFile, 'utf8');
const podfileJson = JSON.parse(contents);
if (podfileJson[APPLE_EXTRA_BUILD_DEPS_KEY]) {
// expo-build-properties would serialize the extraPods as JSON string, we should parse it again.
const extraPods = JSON.parse(podfileJson[APPLE_EXTRA_BUILD_DEPS_KEY]);
return extraPods;
}
}
catch { }
return null;
}
/**
* Generates Swift file that contains all autolinked Swift packages.
*/
async function generateModulesProviderAsync(modules, targetPath, entitlementPath) {
const className = path_1.default.basename(targetPath, path_1.default.extname(targetPath));
const entitlements = await parseEntitlementsAsync(entitlementPath);
const generatedFileContent = await generatePackageListFileContentAsync(modules, className, entitlements);
const parentPath = path_1.default.dirname(targetPath);
await fs_1.default.promises.mkdir(parentPath, { recursive: true });
await fs_1.default.promises.writeFile(targetPath, generatedFileContent, 'utf8');
}
/**
* Generates the string to put into the generated package list.
*/
async function generatePackageListFileContentAsync(modules, className, entitlements) {
const iosModules = modules.filter((module) => module.modules.length ||
module.appDelegateSubscribers.length ||
module.reactDelegateHandlers.length);
const modulesToImport = iosModules.filter((module) => !module.debugOnly);
const debugOnlyModules = iosModules.filter((module) => module.debugOnly);
const swiftModules = []
.concat(...modulesToImport.map((module) => module.swiftModuleNames))
.filter(Boolean);
const debugOnlySwiftModules = []
.concat(...debugOnlyModules.map((module) => module.swiftModuleNames))
.filter(Boolean);
const modulesClassNames = []
.concat(...modulesToImport.map((module) => module.modules))
.filter(Boolean);
const debugOnlyModulesClassNames = []
.concat(...debugOnlyModules.map((module) => module.modules))
.filter(Boolean);
const appDelegateSubscribers = [].concat(...modulesToImport.map((module) => module.appDelegateSubscribers));
const debugOnlyAppDelegateSubscribers = [].concat(...debugOnlyModules.map((module) => module.appDelegateSubscribers));
const reactDelegateHandlerModules = modulesToImport.filter((module) => !!module.reactDelegateHandlers.length);
const debugOnlyReactDelegateHandlerModules = debugOnlyModules.filter((module) => !!module.reactDelegateHandlers.length);
return `/**
* Automatically generated by expo-modules-autolinking.
*
* This autogenerated class provides a list of classes of native Expo modules,
* but only these that are written in Swift and use the new API for creating Expo modules.
*/
internal import ExpoModulesCore
${generateCommonImportList(swiftModules)}
${generateDebugOnlyImportList(debugOnlySwiftModules)}
@objc(${className})
internal class ${className}: ModulesProvider {
public override func getModuleClasses() -> [ExpoModuleTupleType] {
${generateModuleClasses(modulesClassNames, debugOnlyModulesClassNames)}
}
public override func getAppDelegateSubscribers() -> [ExpoAppDelegateSubscriber.Type] {
${generateClasses(appDelegateSubscribers, debugOnlyAppDelegateSubscribers)}
}
public override func getReactDelegateHandlers() -> [ExpoReactDelegateHandlerTupleType] {
${generateReactDelegateHandlers(reactDelegateHandlerModules, debugOnlyReactDelegateHandlerModules)}
}
public override func getAppCodeSignEntitlements() -> AppCodeSignEntitlements {
return AppCodeSignEntitlements.from(json: #"${JSON.stringify(entitlements)}"#)
}
}
`;
}
function generateCommonImportList(swiftModules) {
return swiftModules.map((moduleName) => `internal import ${moduleName}`).join('\n');
}
function generateDebugOnlyImportList(swiftModules) {
if (!swiftModules.length) {
return '';
}
return (wrapInDebugConfigurationCheck(0, swiftModules.map((moduleName) => `internal import ${moduleName}`).join('\n')) + '\n');
}
function generateModuleClasses(modules, debugOnlyModules) {
const commonClassNames = formatArrayOfModuleTuples(modules);
if (debugOnlyModules.length > 0) {
return wrapInDebugConfigurationCheck(2, `return ${formatArrayOfModuleTuples(modules.concat(debugOnlyModules))}`, `return ${commonClassNames}`);
}
else {
return `${indent.repeat(2)}return ${commonClassNames}`;
}
}
/**
* Formats an array of modules config to Swift's array of module tuples.
*/
function formatArrayOfModuleTuples(modules) {
return `[${modules.map((module) => `\n${indent.repeat(3)}(module: ${module.class}.self, name: ${module.name ? `"${module.name}"` : 'nil'})`).join(',')}
${indent.repeat(2)}]`;
}
function generateClasses(classNames, debugOnlyClassName) {
const commonClassNames = formatArrayOfClassNames(classNames);
if (debugOnlyClassName.length > 0) {
return wrapInDebugConfigurationCheck(2, `return ${formatArrayOfClassNames(classNames.concat(debugOnlyClassName))}`, `return ${commonClassNames}`);
}
else {
return `${indent.repeat(2)}return ${commonClassNames}`;
}
}
/**
* Formats an array of class names to Swift's array containing these classes.
*/
function formatArrayOfClassNames(classNames) {
return `[${classNames.map((className) => `\n${indent.repeat(3)}${className}.self`).join(',')}
${indent.repeat(2)}]`;
}
function generateReactDelegateHandlers(module, debugOnlyModules) {
const commonModules = formatArrayOfReactDelegateHandler(module);
if (debugOnlyModules.length > 0) {
return wrapInDebugConfigurationCheck(2, `return ${formatArrayOfReactDelegateHandler(module.concat(debugOnlyModules))}`, `return ${commonModules}`);
}
else {
return `${indent.repeat(2)}return ${commonModules}`;
}
}
/**
* Formats an array of modules to Swift's array containing ReactDelegateHandlers
*/
function formatArrayOfReactDelegateHandler(modules) {
const values = [];
for (const module of modules) {
for (const handler of module.reactDelegateHandlers) {
values.push(`(packageName: "${module.packageName}", handler: ${handler}.self)`);
}
}
return `[${values.map((value) => `\n${indent.repeat(3)}${value}`).join(',')}
${indent.repeat(2)}]`;
}
function wrapInDebugConfigurationCheck(indentationLevel, debugBlock, releaseBlock = null) {
if (releaseBlock) {
return `${indent.repeat(indentationLevel)}#if EXPO_CONFIGURATION_DEBUG\n${indent.repeat(indentationLevel)}${debugBlock}\n${indent.repeat(indentationLevel)}#else\n${indent.repeat(indentationLevel)}${releaseBlock}\n${indent.repeat(indentationLevel)}#endif`;
}
return `${indent.repeat(indentationLevel)}#if EXPO_CONFIGURATION_DEBUG\n${indent.repeat(indentationLevel)}${debugBlock}\n${indent.repeat(indentationLevel)}#endif`;
}
async function parseEntitlementsAsync(entitlementPath) {
if (!entitlementPath || !(await (0, utils_1.fileExistsAsync)(entitlementPath))) {
return {};
}
const { stdout } = await (0, spawn_async_1.default)('plutil', ['-convert', 'json', '-o', '-', entitlementPath]);
const entitlementsJson = JSON.parse(stdout);
return {
appGroups: entitlementsJson['com.apple.security.application-groups'] || undefined,
};
}
//# sourceMappingURL=apple.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
export { generateModulesProviderAsync, resolveModuleAsync, resolveExtraBuildDependenciesAsync, } from './apple';

View File

@@ -0,0 +1,8 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.resolveExtraBuildDependenciesAsync = exports.resolveModuleAsync = exports.generateModulesProviderAsync = void 0;
var apple_1 = require("./apple");
Object.defineProperty(exports, "generateModulesProviderAsync", { enumerable: true, get: function () { return apple_1.generateModulesProviderAsync; } });
Object.defineProperty(exports, "resolveModuleAsync", { enumerable: true, get: function () { return apple_1.resolveModuleAsync; } });
Object.defineProperty(exports, "resolveExtraBuildDependenciesAsync", { enumerable: true, get: function () { return apple_1.resolveExtraBuildDependenciesAsync; } });
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/platforms/apple/index.ts"],"names":[],"mappings":";;;AAAA,iCAIiB;AAHf,qHAAA,4BAA4B,OAAA;AAC5B,2GAAA,kBAAkB,OAAA;AAClB,2HAAA,kCAAkC,OAAA","sourcesContent":["export {\n generateModulesProviderAsync,\n resolveModuleAsync,\n resolveExtraBuildDependenciesAsync,\n} from './apple';\n"]}

View File

@@ -0,0 +1,3 @@
import type { ExtraDependencies, ModuleDescriptorDevTools, PackageRevision } from '../types';
export declare function resolveModuleAsync(packageName: string, revision: PackageRevision): Promise<ModuleDescriptorDevTools | null>;
export declare function resolveExtraBuildDependenciesAsync(_projectNativeRoot: string): Promise<ExtraDependencies | null>;

View File

@@ -0,0 +1,26 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.resolveModuleAsync = resolveModuleAsync;
exports.resolveExtraBuildDependenciesAsync = resolveExtraBuildDependenciesAsync;
const path_1 = __importDefault(require("path"));
async function resolveModuleAsync(packageName, revision) {
const devtoolsConfig = revision.config?.toJSON().devtools;
if (devtoolsConfig == null) {
return null;
}
return {
packageName,
packageRoot: revision.path,
webpageRoot: devtoolsConfig.webpageRoot
? path_1.default.join(revision.path, devtoolsConfig.webpageRoot)
: undefined,
cliExtensions: devtoolsConfig.cliExtensions,
};
}
async function resolveExtraBuildDependenciesAsync(_projectNativeRoot) {
return null;
}
//# sourceMappingURL=devtools.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"devtools.js","sourceRoot":"","sources":["../../src/platforms/devtools.ts"],"names":[],"mappings":";;;;;AAIA,gDAiBC;AAED,gFAIC;AA3BD,gDAAwB;AAIjB,KAAK,UAAU,kBAAkB,CACtC,WAAmB,EACnB,QAAyB;IAEzB,MAAM,cAAc,GAAG,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,QAAQ,CAAC;IAC1D,IAAI,cAAc,IAAI,IAAI,EAAE,CAAC;QAC3B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO;QACL,WAAW;QACX,WAAW,EAAE,QAAQ,CAAC,IAAI;QAC1B,WAAW,EAAE,cAAc,CAAC,WAAW;YACrC,CAAC,CAAC,cAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC,WAAW,CAAC;YACtD,CAAC,CAAC,SAAS;QACb,aAAa,EAAE,cAAc,CAAC,aAAa;KAC5C,CAAC;AACJ,CAAC;AAEM,KAAK,UAAU,kCAAkC,CACtD,kBAA0B;IAE1B,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import path from 'path';\n\nimport type { ExtraDependencies, ModuleDescriptorDevTools, PackageRevision } from '../types';\n\nexport async function resolveModuleAsync(\n packageName: string,\n revision: PackageRevision\n): Promise<ModuleDescriptorDevTools | null> {\n const devtoolsConfig = revision.config?.toJSON().devtools;\n if (devtoolsConfig == null) {\n return null;\n }\n\n return {\n packageName,\n packageRoot: revision.path,\n webpageRoot: devtoolsConfig.webpageRoot\n ? path.join(revision.path, devtoolsConfig.webpageRoot)\n : undefined,\n cliExtensions: devtoolsConfig.cliExtensions,\n };\n}\n\nexport async function resolveExtraBuildDependenciesAsync(\n _projectNativeRoot: string\n): Promise<ExtraDependencies | null> {\n return null;\n}\n"]}

View File

@@ -0,0 +1,17 @@
import { SupportedPlatform } from '../types';
interface PlatformImplementations {
ios: typeof import('./apple/apple');
macos: typeof import('./apple/apple');
tvos: typeof import('./apple/apple');
apple: typeof import('./apple/apple');
android: typeof import('./android/android');
devtools: typeof import('./devtools');
web: typeof import('./web');
}
declare function getLinkingImplementationForPlatform<Platform extends keyof PlatformImplementations>(platform: Platform): PlatformImplementations[Platform];
declare function getLinkingImplementationForPlatform(platform: 'ios' | 'macos' | 'tvos' | 'apple'): PlatformImplementations['apple'];
declare function getLinkingImplementationForPlatform(platform: 'android'): PlatformImplementations['android'];
declare function getLinkingImplementationForPlatform(platform: 'devtools'): PlatformImplementations['devtools'];
declare function getLinkingImplementationForPlatform(platform: 'web'): PlatformImplementations['web'];
declare function getLinkingImplementationForPlatform(platform: SupportedPlatform): PlatformImplementations[keyof PlatformImplementations];
export { getLinkingImplementationForPlatform };

View File

@@ -0,0 +1,24 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getLinkingImplementationForPlatform = getLinkingImplementationForPlatform;
function getLinkingImplementationForPlatform(platform) {
if (!platform) {
throw new Error(`No platform was specified, but linking commands require a specific platform.`);
}
switch (platform) {
case 'ios':
case 'macos':
case 'tvos':
case 'apple':
return require('../platforms/apple');
case 'android':
return require('../platforms/android');
case 'devtools':
return require('../platforms/devtools');
case 'web':
return require('../platforms/web');
default:
throw new Error(`No linking implementation is available for platform "${platform}"`);
}
}
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/platforms/index.ts"],"names":[],"mappings":";;AAoDS,kFAAmC;AAvB5C,SAAS,mCAAmC,CAC1C,QAA2B;IAE3B,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,8EAA8E,CAAC,CAAC;IAClG,CAAC;IACD,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,KAAK,CAAC;QACX,KAAK,OAAO,CAAC;QACb,KAAK,MAAM,CAAC;QACZ,KAAK,OAAO;YACV,OAAO,OAAO,CAAC,oBAAoB,CAAC,CAAC;QACvC,KAAK,SAAS;YACZ,OAAO,OAAO,CAAC,sBAAsB,CAAC,CAAC;QACzC,KAAK,UAAU;YACb,OAAO,OAAO,CAAC,uBAAuB,CAAC,CAAC;QAC1C,KAAK,KAAK;YACR,OAAO,OAAO,CAAC,kBAAkB,CAAC,CAAC;QACrC;YACE,MAAM,IAAI,KAAK,CAAC,wDAAwD,QAAQ,GAAG,CAAC,CAAC;IACzF,CAAC;AACH,CAAC","sourcesContent":["import { SupportedPlatform } from '../types';\n\ninterface PlatformImplementations {\n ios: typeof import('./apple/apple');\n macos: typeof import('./apple/apple');\n tvos: typeof import('./apple/apple');\n apple: typeof import('./apple/apple');\n android: typeof import('./android/android');\n devtools: typeof import('./devtools');\n web: typeof import('./web');\n}\n\nfunction getLinkingImplementationForPlatform<Platform extends keyof PlatformImplementations>(\n platform: Platform\n): PlatformImplementations[Platform];\nfunction getLinkingImplementationForPlatform(\n platform: 'ios' | 'macos' | 'tvos' | 'apple'\n): PlatformImplementations['apple'];\nfunction getLinkingImplementationForPlatform(\n platform: 'android'\n): PlatformImplementations['android'];\nfunction getLinkingImplementationForPlatform(\n platform: 'devtools'\n): PlatformImplementations['devtools'];\nfunction getLinkingImplementationForPlatform(platform: 'web'): PlatformImplementations['web'];\nfunction getLinkingImplementationForPlatform(\n platform: SupportedPlatform\n): PlatformImplementations[keyof PlatformImplementations];\n\nfunction getLinkingImplementationForPlatform(\n platform: SupportedPlatform\n): PlatformImplementations[keyof PlatformImplementations] {\n if (!platform) {\n throw new Error(`No platform was specified, but linking commands require a specific platform.`);\n }\n switch (platform) {\n case 'ios':\n case 'macos':\n case 'tvos':\n case 'apple':\n return require('../platforms/apple');\n case 'android':\n return require('../platforms/android');\n case 'devtools':\n return require('../platforms/devtools');\n case 'web':\n return require('../platforms/web');\n default:\n throw new Error(`No linking implementation is available for platform \"${platform}\"`);\n }\n}\n\nexport { getLinkingImplementationForPlatform };\n"]}

View File

@@ -0,0 +1,3 @@
import type { ExtraDependencies, ModuleDescriptorWeb, PackageRevision } from '../types';
export declare function resolveModuleAsync(packageName: string, revision: PackageRevision): Promise<ModuleDescriptorWeb | null>;
export declare function resolveExtraBuildDependenciesAsync(_projectNativeRoot: string): Promise<ExtraDependencies | null>;

View File

@@ -0,0 +1,14 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.resolveModuleAsync = resolveModuleAsync;
exports.resolveExtraBuildDependenciesAsync = resolveExtraBuildDependenciesAsync;
async function resolveModuleAsync(packageName, revision) {
return {
packageName,
packageRoot: revision.path,
};
}
async function resolveExtraBuildDependenciesAsync(_projectNativeRoot) {
return null;
}
//# sourceMappingURL=web.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/platforms/web.ts"],"names":[],"mappings":";;AAEA,gDAQC;AAED,gFAIC;AAdM,KAAK,UAAU,kBAAkB,CACtC,WAAmB,EACnB,QAAyB;IAEzB,OAAO;QACL,WAAW;QACX,WAAW,EAAE,QAAQ,CAAC,IAAI;KAC3B,CAAC;AACJ,CAAC;AAEM,KAAK,UAAU,kCAAkC,CACtD,kBAA0B;IAE1B,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import type { ExtraDependencies, ModuleDescriptorWeb, PackageRevision } from '../types';\n\nexport async function resolveModuleAsync(\n packageName: string,\n revision: PackageRevision\n): Promise<ModuleDescriptorWeb | null> {\n return {\n packageName,\n packageRoot: revision.path,\n };\n}\n\nexport async function resolveExtraBuildDependenciesAsync(\n _projectNativeRoot: string\n): Promise<ExtraDependencies | null> {\n return null;\n}\n"]}