@amazon-devices/kepler-compatibility 0.0.5

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.
Files changed (27) hide show
  1. package/LICENSE +7 -0
  2. package/README.md +23 -0
  3. package/THIRD-PARTY-LICENSES.txt +5993 -0
  4. package/dist/index.d.ts +1 -0
  5. package/dist/index.js +6 -0
  6. package/dist/kepler/aarch64-debug/lib/libKeplerCompatibility.so +0 -0
  7. package/dist/kepler/aarch64-debug/lib/libKeplerCompatibility.so.debug +0 -0
  8. package/dist/kepler/aarch64-release/lib/libKeplerCompatibility.so +0 -0
  9. package/dist/kepler/aarch64-release/lib/libKeplerCompatibility.so.debug +0 -0
  10. package/dist/kepler/armv7-debug/lib/libKeplerCompatibility.so +0 -0
  11. package/dist/kepler/armv7-debug/lib/libKeplerCompatibility.so.debug +0 -0
  12. package/dist/kepler/armv7-release/lib/libKeplerCompatibility.so +0 -0
  13. package/dist/kepler/armv7-release/lib/libKeplerCompatibility.so.debug +0 -0
  14. package/dist/kepler/tm-manifest.json +1 -0
  15. package/dist/kepler/x86_64-debug/lib/libKeplerCompatibility.so +0 -0
  16. package/dist/kepler/x86_64-debug/lib/libKeplerCompatibility.so.debug +0 -0
  17. package/dist/kepler/x86_64-release/lib/libKeplerCompatibility.so +0 -0
  18. package/dist/kepler/x86_64-release/lib/libKeplerCompatibility.so.debug +0 -0
  19. package/dist/turbo-modules/KeplerCompatibility.d.ts +2 -0
  20. package/dist/turbo-modules/KeplerCompatibility.js +86 -0
  21. package/dist/turbo-modules/KeplerCompatibilityNative.d.ts +6 -0
  22. package/dist/turbo-modules/KeplerCompatibilityNative.js +4 -0
  23. package/dist/turbo-modules/__mocks__/KeplerCompatibilityNative.d.ts +4 -0
  24. package/dist/turbo-modules/__mocks__/KeplerCompatibilityNative.js +5 -0
  25. package/kepler-compatibility.json +9 -0
  26. package/package.json +1 -0
  27. package/react-native.config.js +27 -0
@@ -0,0 +1 @@
1
+ export { isAppTargeting, isPresentOnOS } from './turbo-modules/KeplerCompatibility';
package/dist/index.js ADDED
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isPresentOnOS = exports.isAppTargeting = void 0;
4
+ var KeplerCompatibility_1 = require("./turbo-modules/KeplerCompatibility");
5
+ Object.defineProperty(exports, "isAppTargeting", { enumerable: true, get: function () { return KeplerCompatibility_1.isAppTargeting; } });
6
+ Object.defineProperty(exports, "isPresentOnOS", { enumerable: true, get: function () { return KeplerCompatibility_1.isPresentOnOS; } });
@@ -0,0 +1 @@
1
+ {"schema":1,"fileSets":{"native":[{"arch":"armv7","variant":"release","directoryPath":"armv7-release"},{"arch":"x86_64","variant":"release","directoryPath":"x86_64-release"},{"arch":"aarch64","variant":"release","directoryPath":"aarch64-release"},{"arch":"armv7","variant":"debug","directoryPath":"armv7-debug"},{"arch":"x86_64","variant":"debug","directoryPath":"x86_64-debug"},{"arch":"aarch64","variant":"debug","directoryPath":"aarch64-debug"}]}}
@@ -0,0 +1,2 @@
1
+ export declare const isAppTargeting: (libraryName: string, version: string) => boolean;
2
+ export declare const isPresentOnOS: (libraryName: string, version: string) => boolean;
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.isPresentOnOS = exports.isAppTargeting = exports.KeplerCompatibility = void 0;
7
+ const KeplerCompatibilityNative_1 = __importDefault(require("./KeplerCompatibilityNative"));
8
+ /** @internal */
9
+ const isEmptyMap = (element) => element == null || Object.keys(element).length === 0;
10
+ /** @internal */
11
+ class KeplerCompatibility {
12
+ static instance;
13
+ keplerModuleMap;
14
+ constructor() {
15
+ // DEV NOTE: This global will be generated by metro config change
16
+ // to polyfills. The metro config change will be injected by
17
+ // Kepler-CLI and other build-tooling as necessary.
18
+ this.keplerModuleMap = global.KEPLER_MODULE_MAP || {};
19
+ console.log('[debug] Kepler Manifest: ', this.keplerModuleMap);
20
+ }
21
+ static getInstance() {
22
+ if (!KeplerCompatibility.instance) {
23
+ KeplerCompatibility.instance = new KeplerCompatibility();
24
+ }
25
+ return KeplerCompatibility.instance;
26
+ }
27
+ /** @internal */
28
+ static resetInstance() {
29
+ KeplerCompatibility.instance = new KeplerCompatibility();
30
+ }
31
+ /**
32
+ * For Library developers, this runtime check returns True
33
+ * if the application developer has requested this version to be enabled.
34
+ *
35
+ * @version 0.0.1
36
+ * @param libraryName The name of the NPM library `@amazon-devices/react-native-gesture-handler`
37
+ * @param version A valid semver string, for example 2.1.0
38
+ * @returns truthy Boolean
39
+ */
40
+ isAppTargeting(libraryName, version) {
41
+ if (isEmptyMap(this.keplerModuleMap)) {
42
+ console.error('Required Lookup Map not populated! Check the output of @amazon-devices/kepler-compatibility-metro-config to determine the source of failure.');
43
+ return false;
44
+ }
45
+ if (!this.keplerModuleMap[libraryName]) {
46
+ console.warn(`No compatibility information found for ${libraryName}`);
47
+ return false;
48
+ }
49
+ const moduleRevision = this.keplerModuleMap[libraryName]?.[version];
50
+ if (!moduleRevision) {
51
+ console.warn(`No compatibility information found for ${libraryName}@${version}`);
52
+ return false;
53
+ }
54
+ return KeplerCompatibilityNative_1.default.isKeplerModuleEnabled(moduleRevision);
55
+ }
56
+ /**
57
+ * For Application developers, Checks whether the `libraryName` and `version`
58
+ * are available on the system the App is running on.
59
+ *
60
+ * @version 0.0.1
61
+ * @param libraryName The name of the NPM library `@amazon-devices/react-native-gesture-handler`
62
+ * @param version A valid semver string, for example 2.1.0
63
+ * @returns truthy Boolean
64
+ */
65
+ isPresentOnOS(libraryName, version) {
66
+ if (isEmptyMap(this.keplerModuleMap)) {
67
+ // FIXME: Should we just throw error in these scenarios? Should the error happen in the ctor()?
68
+ console.error('Required Lookup Map not populated! Check the output of @amazon-devices/kepler-compatibility-metro-config to determine the source of failure.');
69
+ return false;
70
+ }
71
+ if (!this.keplerModuleMap[libraryName]) {
72
+ console.warn(`No compatibility information found for ${libraryName}`);
73
+ return false;
74
+ }
75
+ const moduleRevision = this.keplerModuleMap[libraryName]?.[version];
76
+ if (!moduleRevision) {
77
+ console.warn(`No compatibility information found for ${libraryName}@${version}`);
78
+ return false;
79
+ }
80
+ return KeplerCompatibilityNative_1.default.isKeplerModuleEnabled(moduleRevision);
81
+ }
82
+ }
83
+ exports.KeplerCompatibility = KeplerCompatibility;
84
+ const KeplerCompatibilityAPI = KeplerCompatibility.getInstance();
85
+ exports.isAppTargeting = KeplerCompatibilityAPI.isAppTargeting.bind(KeplerCompatibilityAPI);
86
+ exports.isPresentOnOS = KeplerCompatibilityAPI.isPresentOnOS.bind(KeplerCompatibilityAPI);
@@ -0,0 +1,6 @@
1
+ import type { KeplerTurboModule } from '@amazon-devices/keplerscript-turbomodule-api';
2
+ export interface KeplerCompatibilityNative extends KeplerTurboModule {
3
+ isKeplerModuleEnabled: (keplerModule: string) => boolean;
4
+ }
5
+ declare const _default: KeplerCompatibilityNative;
6
+ export default _default;
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const keplerscript_turbomodule_api_1 = require("@amazon-devices/keplerscript-turbomodule-api");
4
+ exports.default = keplerscript_turbomodule_api_1.TurboModuleRegistry.getEnforcing('KeplerCompatibility');
@@ -0,0 +1,4 @@
1
+ declare const _default: {
2
+ isKeplerModuleEnabled: () => boolean;
3
+ };
4
+ export default _default;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = {
4
+ isKeplerModuleEnabled: () => true,
5
+ };
@@ -0,0 +1,9 @@
1
+ {
2
+ "versions": {
3
+ "0.0.1": ["/com.amazon.kepler.experimental.features_2025_02@IFeature", "/com.amazon.kepler.security@ISecurityModule"],
4
+ "0.0.2": ["/com.amazon.kepler.experimental.features_2025_02@IFeature", "/com.amazon.kepler.security@ISecurityModule"],
5
+ "0.0.3": ["/com.amazon.kepler.experimental.features_2025_02@IFeature", "/com.amazon.kepler.security@ISecurityModule"],
6
+ "0.0.4": ["/com.amazon.kepler.experimental.features_2025_02@IFeature", "/com.amazon.kepler.security@ISecurityModule"],
7
+ "0.0.5": ["/com.amazon.kepler.experimental.features_2025_02@IFeature", "/com.amazon.kepler.security@ISecurityModule"]
8
+ }
9
+ }
package/package.json ADDED
@@ -0,0 +1 @@
1
+ {"name": "@amazon-devices/kepler-compatibility", "version": "0.0.5", "main": "./dist/index.js", "types": "./dist/index.d.ts", "files": ["dist", "kepler-compatibility.json", "react-native.config.js", "THIRD-PARTY-LICENSES.txt"], "scripts": {"clean": "rm -rf node_modules buildinfo.json dist bvm build", "test": "jest --colors", "test:debug": "node --inspect-brk node_modules/.bin/jest --runInBand", "lint": "eslint src test --ext .ts,.tsx", "lint:fix": "eslint src test --ext .ts,.tsx --fix", "build:js": "tsc -p tsconfig.json", "build:native:debug": "kepler build -b Debug", "build:native:release": "kepler build -b Release", "build": "npm-run-all build:js build:native:release", "build:debug": "npm-run-all build:js build:native:debug"}, "dependencies": {"@amazon-devices/keplerscript-turbomodule-api": "^1.0.0"}, "devDependencies": {"@react-native/eslint-config": "0.72.2", "@types/jest": "^28.0.0", "@typescript-eslint/eslint-plugin": "^5.30.0", "babel-jest": "^28.0.0", "eslint": "^8.12.0", "jest": "^28.0.0", "metro-react-native-babel-preset": "^0.76.5", "npm-run-all": "^4.1.5", "prettier": "^2.6.2", "ts-jest": "^28.0.0", "typescript": "4.8.4"}, "kepler": {"projectType": "turbomodule", "targets": ["tv"], "features": ["vega"], "api": 0.1}, "license": "See license in LICENSE"}
@@ -0,0 +1,27 @@
1
+ module.exports = {
2
+ dependency: {
3
+ platforms: {
4
+ kepler: {
5
+ autolink: {
6
+ "KeplerCompatibility": {
7
+ "libraryName": "libKeplerCompatibility.so",
8
+ "linkDynamic": true,
9
+ "provider": "application",
10
+ "components": [],
11
+ "turbomodules": [
12
+ "KeplerCompatibility"
13
+ ]
14
+ }
15
+ }
16
+ }
17
+
18
+ }
19
+ },
20
+ project: {
21
+ kepler: {
22
+ runtimeFeatures: {
23
+ "USE_ABI_STABLE_UI_COMPONENTS": true
24
+ },
25
+ }
26
+ }
27
+ }