@expo/platforms 0.0.0-stage → 58.0.1
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/LICENSE +21 -0
- package/README.md +14 -2
- package/build/index.d.ts +52 -0
- package/build/index.js +101 -0
- package/build/index.js.map +1 -0
- package/package.json +48 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023-present 650 Industries, Inc. (aka Expo)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @expo/platforms
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Platform identity metadata shared by Expo tooling. This package has **zero runtime dependencies** so that every layer of the toolchain can consume it — `expo-modules-autolinking`, `@expo/config`, `@expo/metro-config`, and `@expo/cli` — without creating dependency cycles.
|
|
4
|
+
|
|
5
|
+
It contains pure data and pure functions over platform names:
|
|
6
|
+
|
|
7
|
+
- The set of platform names Expo tooling recognizes, and which of them are out-of-tree platforms.
|
|
8
|
+
- The react-native host package for each platform (for example `tvos` → `react-native-tvos`).
|
|
9
|
+
- Metro source-extension fallback chains for out-of-tree platforms (for example `tvos` → `ios` → `native`).
|
|
10
|
+
|
|
11
|
+
It deliberately contains **no behavior**: no filesystem access, no path resolution, no config plugins. Behavioral platform code lives with its consumers.
|
|
12
|
+
|
|
13
|
+
## Why
|
|
14
|
+
|
|
15
|
+
Before this package, each of these tables was duplicated across packages that cannot depend on each other, and the copies drifted. This package is the single source of truth for platform identity.
|
package/build/index.d.ts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Platform identity metadata shared by Expo tooling.
|
|
3
|
+
*
|
|
4
|
+
* This package is the single source of truth for pure data about platform names. It has zero
|
|
5
|
+
* runtime dependencies so that every layer of the toolchain can consume it — including
|
|
6
|
+
* `expo-modules-autolinking`, which deliberately keeps its dependency list minimal.
|
|
7
|
+
*
|
|
8
|
+
* Keep this package free of behavior: no filesystem access, no path resolution, no config
|
|
9
|
+
* evaluation. Consumers wrap this data in their own semantics (defaults, throws, gating).
|
|
10
|
+
*/
|
|
11
|
+
/** All platform names known to Expo tooling. */
|
|
12
|
+
export type PlatformName = 'android' | 'ios' | 'web' | 'tvos' | 'macos';
|
|
13
|
+
/** Platform names that run a react-native runtime (every platform except `web`). */
|
|
14
|
+
export type NativePlatformName = Exclude<PlatformName, 'web'>;
|
|
15
|
+
/** Out-of-tree platform names: hosted by a react-native fork rather than `react-native` itself. */
|
|
16
|
+
export type OutOfTreePlatformName = Extract<PlatformName, 'tvos' | 'macos'>;
|
|
17
|
+
/** All platform names known to Expo tooling, in display order. */
|
|
18
|
+
export declare const KNOWN_PLATFORMS: readonly PlatformName[];
|
|
19
|
+
/**
|
|
20
|
+
* Out-of-tree platforms. These are available only behind `experiments.outOfTreePlatforms` in the
|
|
21
|
+
* app config, and each is hosted by the react-native fork named in `REACT_NATIVE_HOST_PACKAGES`.
|
|
22
|
+
*/
|
|
23
|
+
export declare const OUT_OF_TREE_PLATFORMS: readonly OutOfTreePlatformName[];
|
|
24
|
+
/** Whether the platform is an out-of-tree platform (see `OUT_OF_TREE_PLATFORMS`). */
|
|
25
|
+
export declare function isOutOfTreePlatform(platform: string | null | undefined): platform is OutOfTreePlatformName;
|
|
26
|
+
/** Platform names that build through Xcode and follow Apple bundle conventions. */
|
|
27
|
+
export type AppleTargetPlatformName = Extract<PlatformName, 'ios' | 'tvos' | 'macos'>;
|
|
28
|
+
/**
|
|
29
|
+
* Platforms that build through Xcode and follow Apple bundle conventions (`main.jsbundle`,
|
|
30
|
+
* `PLATFORM_NAME` environment, CocoaPods).
|
|
31
|
+
*/
|
|
32
|
+
export declare const APPLE_TARGET_PLATFORMS: readonly AppleTargetPlatformName[];
|
|
33
|
+
/** Whether the platform builds through Xcode and follows Apple bundle conventions. */
|
|
34
|
+
export declare function isAppleTargetPlatform(platform: string | null | undefined): platform is AppleTargetPlatformName;
|
|
35
|
+
/**
|
|
36
|
+
* The react-native host package for each platform: the package providing the platform's
|
|
37
|
+
* react-native implementation. `windows` is listed for `expo-modules-autolinking`, which
|
|
38
|
+
* recognizes it even though the rest of the toolchain does not target it yet.
|
|
39
|
+
*/
|
|
40
|
+
export declare const REACT_NATIVE_HOST_PACKAGES: Readonly<Record<string, string>>;
|
|
41
|
+
/**
|
|
42
|
+
* Returns the react-native host package for the platform, or `undefined` for platforms without
|
|
43
|
+
* one (such as `web`). Consumers decide their own fallback and error semantics.
|
|
44
|
+
*/
|
|
45
|
+
export declare function getReactNativeHostPackage(platform: string | null | undefined): string | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* Metro source-extension fallback chains for out-of-tree platforms: the platform-qualified file
|
|
48
|
+
* extensions tried in order when bundling for the platform (for example, `App.tvos.tsx` falls
|
|
49
|
+
* back to `App.ios.tsx`, then `App.native.tsx`). In-tree platforms use Metro's default behavior
|
|
50
|
+
* and are deliberately absent.
|
|
51
|
+
*/
|
|
52
|
+
export declare const PLATFORM_EXTENSIONS: Readonly<Record<string, readonly string[]>>;
|
package/build/index.js
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Platform identity metadata shared by Expo tooling.
|
|
3
|
+
*
|
|
4
|
+
* This package is the single source of truth for pure data about platform names. It has zero
|
|
5
|
+
* runtime dependencies so that every layer of the toolchain can consume it — including
|
|
6
|
+
* `expo-modules-autolinking`, which deliberately keeps its dependency list minimal.
|
|
7
|
+
*
|
|
8
|
+
* Keep this package free of behavior: no filesystem access, no path resolution, no config
|
|
9
|
+
* evaluation. Consumers wrap this data in their own semantics (defaults, throws, gating).
|
|
10
|
+
*/ /** All platform names known to Expo tooling. */ "use strict";
|
|
11
|
+
Object.defineProperty(exports, "__esModule", {
|
|
12
|
+
value: true
|
|
13
|
+
});
|
|
14
|
+
0 && (module.exports = {
|
|
15
|
+
APPLE_TARGET_PLATFORMS: null,
|
|
16
|
+
KNOWN_PLATFORMS: null,
|
|
17
|
+
OUT_OF_TREE_PLATFORMS: null,
|
|
18
|
+
PLATFORM_EXTENSIONS: null,
|
|
19
|
+
REACT_NATIVE_HOST_PACKAGES: null,
|
|
20
|
+
getReactNativeHostPackage: null,
|
|
21
|
+
isAppleTargetPlatform: null,
|
|
22
|
+
isOutOfTreePlatform: null
|
|
23
|
+
});
|
|
24
|
+
function _export(target, all) {
|
|
25
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
_export(exports, {
|
|
31
|
+
get APPLE_TARGET_PLATFORMS () {
|
|
32
|
+
return APPLE_TARGET_PLATFORMS;
|
|
33
|
+
},
|
|
34
|
+
get KNOWN_PLATFORMS () {
|
|
35
|
+
return KNOWN_PLATFORMS;
|
|
36
|
+
},
|
|
37
|
+
get OUT_OF_TREE_PLATFORMS () {
|
|
38
|
+
return OUT_OF_TREE_PLATFORMS;
|
|
39
|
+
},
|
|
40
|
+
get PLATFORM_EXTENSIONS () {
|
|
41
|
+
return PLATFORM_EXTENSIONS;
|
|
42
|
+
},
|
|
43
|
+
get REACT_NATIVE_HOST_PACKAGES () {
|
|
44
|
+
return REACT_NATIVE_HOST_PACKAGES;
|
|
45
|
+
},
|
|
46
|
+
get getReactNativeHostPackage () {
|
|
47
|
+
return getReactNativeHostPackage;
|
|
48
|
+
},
|
|
49
|
+
get isAppleTargetPlatform () {
|
|
50
|
+
return isAppleTargetPlatform;
|
|
51
|
+
},
|
|
52
|
+
get isOutOfTreePlatform () {
|
|
53
|
+
return isOutOfTreePlatform;
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
const KNOWN_PLATFORMS = [
|
|
57
|
+
'android',
|
|
58
|
+
'ios',
|
|
59
|
+
'web',
|
|
60
|
+
'tvos',
|
|
61
|
+
'macos'
|
|
62
|
+
];
|
|
63
|
+
const OUT_OF_TREE_PLATFORMS = [
|
|
64
|
+
'tvos',
|
|
65
|
+
'macos'
|
|
66
|
+
];
|
|
67
|
+
function isOutOfTreePlatform(platform) {
|
|
68
|
+
return OUT_OF_TREE_PLATFORMS.includes(platform);
|
|
69
|
+
}
|
|
70
|
+
const APPLE_TARGET_PLATFORMS = [
|
|
71
|
+
'ios',
|
|
72
|
+
'tvos',
|
|
73
|
+
'macos'
|
|
74
|
+
];
|
|
75
|
+
function isAppleTargetPlatform(platform) {
|
|
76
|
+
return APPLE_TARGET_PLATFORMS.includes(platform);
|
|
77
|
+
}
|
|
78
|
+
const REACT_NATIVE_HOST_PACKAGES = {
|
|
79
|
+
android: 'react-native',
|
|
80
|
+
ios: 'react-native',
|
|
81
|
+
tvos: 'react-native-tvos',
|
|
82
|
+
macos: 'react-native-macos',
|
|
83
|
+
windows: 'react-native-windows'
|
|
84
|
+
};
|
|
85
|
+
function getReactNativeHostPackage(platform) {
|
|
86
|
+
return platform == null ? undefined : REACT_NATIVE_HOST_PACKAGES[platform];
|
|
87
|
+
}
|
|
88
|
+
const PLATFORM_EXTENSIONS = {
|
|
89
|
+
tvos: [
|
|
90
|
+
'tvos',
|
|
91
|
+
'ios',
|
|
92
|
+
'native'
|
|
93
|
+
],
|
|
94
|
+
macos: [
|
|
95
|
+
'macos',
|
|
96
|
+
'ios',
|
|
97
|
+
'native'
|
|
98
|
+
]
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":[null],"names":["APPLE_TARGET_PLATFORMS","KNOWN_PLATFORMS","OUT_OF_TREE_PLATFORMS","PLATFORM_EXTENSIONS","REACT_NATIVE_HOST_PACKAGES","getReactNativeHostPackage","isAppleTargetPlatform","isOutOfTreePlatform","platform","includes","android","ios","tvos","macos","windows","undefined"],"mappings":"AAAA;;;;;;;;;CASC,GAED,8CAA8C;;;;;;;;;;;;;;;;;;;;;QAgCjCA;eAAAA;;QAtBAC;eAAAA;;QAMAC;eAAAA;;QAoDAC;eAAAA;;QAtBAC;eAAAA;;QAYGC;eAAAA;;QAvBAC;eAAAA;;QAhBAC;eAAAA;;;AATT,MAAMN,kBAA2C;IAAC;IAAW;IAAO;IAAO;IAAQ;CAAQ;AAM3F,MAAMC,wBAA0D;IAAC;IAAQ;CAAQ;AAGjF,SAASK,oBACdC,QAAmC;IAEnC,OAAO,AAACN,sBAA4CO,QAAQ,CAACD;AAC/D;AASO,MAAMR,yBAA6D;IAAC;IAAO;IAAQ;CAAQ;AAG3F,SAASM,sBACdE,QAAmC;IAEnC,OAAO,AAACR,uBAA6CS,QAAQ,CAACD;AAChE;AAOO,MAAMJ,6BAA+D;IAC1EM,SAAS;IACTC,KAAK;IACLC,MAAM;IACNC,OAAO;IACPC,SAAS;AACX;AAMO,SAAST,0BAA0BG,QAAmC;IAC3E,OAAOA,YAAY,OAAOO,YAAYX,0BAA0B,CAACI,SAAS;AAC5E;AAQO,MAAML,sBAAmE;IAC9ES,MAAM;QAAC;QAAQ;QAAO;KAAS;IAC/BC,OAAO;QAAC;QAAS;QAAO;KAAS;AACnC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,51 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expo/platforms",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "58.0.1",
|
|
4
|
+
"description": "Platform identity metadata shared by Expo tooling: platform names, react-native host packages, and Metro extension fallback chains",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"expo",
|
|
7
|
+
"platforms",
|
|
8
|
+
"react-native"
|
|
9
|
+
],
|
|
10
|
+
"homepage": "https://github.com/expo/expo/tree/main/packages/@expo/platforms#readme",
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/expo/expo/issues"
|
|
13
|
+
},
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "https://github.com/expo/expo.git",
|
|
18
|
+
"directory": "packages/@expo/platforms"
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"build"
|
|
22
|
+
],
|
|
23
|
+
"main": "build/index.js",
|
|
24
|
+
"types": "build/index.d.ts",
|
|
25
|
+
"exports": {
|
|
26
|
+
".": {
|
|
27
|
+
"types": {
|
|
28
|
+
"expo-source": "./src/index.ts",
|
|
29
|
+
"default": "./build/index.d.ts"
|
|
30
|
+
},
|
|
31
|
+
"expo-source": "./src/index.ts",
|
|
32
|
+
"default": "./build/index.js"
|
|
33
|
+
},
|
|
34
|
+
"./package.json": "./package.json"
|
|
35
|
+
},
|
|
36
|
+
"publishConfig": {
|
|
37
|
+
"access": "public"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@expo/internal-scripts": "58.0.1"
|
|
41
|
+
},
|
|
42
|
+
"scripts": {
|
|
43
|
+
"build": "expo-build cjs:src",
|
|
44
|
+
"clean": "expo-module clean",
|
|
45
|
+
"lint": "oxlint --config oxlint.config.mjs .",
|
|
46
|
+
"format": "expo-module format",
|
|
47
|
+
"test": "jest",
|
|
48
|
+
"depscheck": "expo-module depscheck",
|
|
49
|
+
"typecheck": "tsc -p tsconfig.json"
|
|
50
|
+
}
|
|
6
51
|
}
|