@expo/config-plugins
Advanced tools
Comparing version 8.0.3 to 8.0.4
@@ -19,1 +19,6 @@ import { ExpoConfig } from '@expo/config-types'; | ||
export declare function getApplicationIdAsync(projectRoot: string): Promise<string | null>; | ||
/** | ||
* Make a package name safe to use in a kotlin file, | ||
* e.g. is.pvin.hello -> `is`.pvin.hello | ||
*/ | ||
export declare function kotlinSanitized(packageName: string): string; |
@@ -8,2 +8,3 @@ "use strict"; | ||
exports.getPackage = getPackage; | ||
exports.kotlinSanitized = kotlinSanitized; | ||
exports.renameJniOnDiskForType = renameJniOnDiskForType; | ||
@@ -243,2 +244,3 @@ exports.renamePackageOnDisk = renamePackageOnDisk; | ||
} | ||
const kotlinSanitizedPackageName = kotlinSanitized(packageName); | ||
// Replace all occurrences of the path in the project | ||
@@ -249,3 +251,7 @@ filesToUpdate.forEach(filepath => { | ||
let contents = _fs().default.readFileSync(filepath).toString(); | ||
contents = replacePackageName(contents, currentPackageName, packageName); | ||
if (_path().default.extname(filepath) === '.kt') { | ||
contents = replacePackageName(contents, currentPackageName, kotlinSanitizedPackageName); | ||
} else { | ||
contents = replacePackageName(contents, currentPackageName, packageName); | ||
} | ||
if (['.h', '.cpp'].includes(_path().default.extname(filepath))) { | ||
@@ -308,2 +314,14 @@ contents = contents.replace(new RegExp(transformJavaClassDescriptor(currentPackageName).replace(/\//g, '\\'), 'g'), transformJavaClassDescriptor(packageName)); | ||
} | ||
/** | ||
* Make a package name safe to use in a kotlin file, | ||
* e.g. is.pvin.hello -> `is`.pvin.hello | ||
*/ | ||
function kotlinSanitized(packageName) { | ||
const stringsToWrap = ['is', 'in', 'as', 'fun']; | ||
const parts = packageName.split('.'); | ||
const cleanParts = parts.map(part => stringsToWrap.includes(part) ? '`' + part + '`' : part); | ||
const cleanName = cleanParts.join('.'); | ||
return cleanName; | ||
} | ||
//# sourceMappingURL=Package.js.map |
{ | ||
"name": "@expo/config-plugins", | ||
"version": "8.0.3", | ||
"version": "8.0.4", | ||
"description": "A library for Expo config plugins", | ||
@@ -61,3 +61,3 @@ "main": "build/index.js", | ||
}, | ||
"gitHead": "f47e3af17a790a34b95fe10dda8383389e7d74e2" | ||
"gitHead": "470464ab5c25ae8bd45eb2a94d221ce51a8b2560" | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1098336
12863