mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
feat(visionos): Vision Pro support (#10392)
This commit is contained in:
@@ -338,7 +338,9 @@ exports[`angular configuration for android 1`] = `
|
||||
/* config.plugin('PlatformSuffixPlugin') */
|
||||
new PlatformSuffixPlugin(
|
||||
{
|
||||
platform: 'android'
|
||||
extensions: [
|
||||
'android'
|
||||
]
|
||||
}
|
||||
),
|
||||
/* config.plugin('ContextExclusionPlugin|App_Resources') */
|
||||
@@ -347,7 +349,7 @@ exports[`angular configuration for android 1`] = `
|
||||
),
|
||||
/* config.plugin('ContextExclusionPlugin|Other_Platforms') */
|
||||
new ContextExclusionPlugin(
|
||||
/\\.(ios)\\.(\\w+)$/
|
||||
/\\.(ios|visionos)\\.(\\w+)$/
|
||||
),
|
||||
/* config.plugin('DefinePlugin') */
|
||||
new DefinePlugin(
|
||||
@@ -361,8 +363,10 @@ exports[`angular configuration for android 1`] = `
|
||||
__UI_USE_EXTERNAL_RENDERER__: false,
|
||||
__ANDROID__: true,
|
||||
__IOS__: false,
|
||||
__VISIONOS__: false,
|
||||
'global.isAndroid': true,
|
||||
'global.isIOS': false,
|
||||
'global.isVisionOS': false,
|
||||
process: 'global.process',
|
||||
__USE_TEST_ID__: false
|
||||
}
|
||||
@@ -767,7 +771,9 @@ exports[`angular configuration for ios 1`] = `
|
||||
/* config.plugin('PlatformSuffixPlugin') */
|
||||
new PlatformSuffixPlugin(
|
||||
{
|
||||
platform: 'ios'
|
||||
extensions: [
|
||||
'ios'
|
||||
]
|
||||
}
|
||||
),
|
||||
/* config.plugin('ContextExclusionPlugin|App_Resources') */
|
||||
@@ -776,7 +782,7 @@ exports[`angular configuration for ios 1`] = `
|
||||
),
|
||||
/* config.plugin('ContextExclusionPlugin|Other_Platforms') */
|
||||
new ContextExclusionPlugin(
|
||||
/\\.(android)\\.(\\w+)$/
|
||||
/\\.(android|visionos)\\.(\\w+)$/
|
||||
),
|
||||
/* config.plugin('DefinePlugin') */
|
||||
new DefinePlugin(
|
||||
@@ -790,8 +796,10 @@ exports[`angular configuration for ios 1`] = `
|
||||
__UI_USE_EXTERNAL_RENDERER__: false,
|
||||
__ANDROID__: false,
|
||||
__IOS__: true,
|
||||
__VISIONOS__: false,
|
||||
'global.isAndroid': false,
|
||||
'global.isIOS': true,
|
||||
'global.isVisionOS': false,
|
||||
process: 'global.process',
|
||||
__USE_TEST_ID__: false
|
||||
}
|
||||
|
||||
@@ -240,7 +240,9 @@ exports[`base configuration for android 1`] = `
|
||||
/* config.plugin('PlatformSuffixPlugin') */
|
||||
new PlatformSuffixPlugin(
|
||||
{
|
||||
platform: 'android'
|
||||
extensions: [
|
||||
'android'
|
||||
]
|
||||
}
|
||||
),
|
||||
/* config.plugin('ContextExclusionPlugin|App_Resources') */
|
||||
@@ -249,7 +251,7 @@ exports[`base configuration for android 1`] = `
|
||||
),
|
||||
/* config.plugin('ContextExclusionPlugin|Other_Platforms') */
|
||||
new ContextExclusionPlugin(
|
||||
/\\.(ios)\\.(\\w+)$/
|
||||
/\\.(ios|visionos)\\.(\\w+)$/
|
||||
),
|
||||
/* config.plugin('DefinePlugin') */
|
||||
new DefinePlugin(
|
||||
@@ -263,8 +265,10 @@ exports[`base configuration for android 1`] = `
|
||||
__UI_USE_EXTERNAL_RENDERER__: false,
|
||||
__ANDROID__: true,
|
||||
__IOS__: false,
|
||||
__VISIONOS__: false,
|
||||
'global.isAndroid': true,
|
||||
'global.isIOS': false,
|
||||
'global.isVisionOS': false,
|
||||
process: 'global.process',
|
||||
__USE_TEST_ID__: false
|
||||
}
|
||||
@@ -564,7 +568,9 @@ exports[`base configuration for ios 1`] = `
|
||||
/* config.plugin('PlatformSuffixPlugin') */
|
||||
new PlatformSuffixPlugin(
|
||||
{
|
||||
platform: 'ios'
|
||||
extensions: [
|
||||
'ios'
|
||||
]
|
||||
}
|
||||
),
|
||||
/* config.plugin('ContextExclusionPlugin|App_Resources') */
|
||||
@@ -573,7 +579,7 @@ exports[`base configuration for ios 1`] = `
|
||||
),
|
||||
/* config.plugin('ContextExclusionPlugin|Other_Platforms') */
|
||||
new ContextExclusionPlugin(
|
||||
/\\.(android)\\.(\\w+)$/
|
||||
/\\.(android|visionos)\\.(\\w+)$/
|
||||
),
|
||||
/* config.plugin('DefinePlugin') */
|
||||
new DefinePlugin(
|
||||
@@ -587,8 +593,10 @@ exports[`base configuration for ios 1`] = `
|
||||
__UI_USE_EXTERNAL_RENDERER__: false,
|
||||
__ANDROID__: false,
|
||||
__IOS__: true,
|
||||
__VISIONOS__: false,
|
||||
'global.isAndroid': false,
|
||||
'global.isIOS': true,
|
||||
'global.isVisionOS': false,
|
||||
process: 'global.process',
|
||||
__USE_TEST_ID__: false
|
||||
}
|
||||
|
||||
@@ -240,7 +240,9 @@ exports[`javascript configuration for android 1`] = `
|
||||
/* config.plugin('PlatformSuffixPlugin') */
|
||||
new PlatformSuffixPlugin(
|
||||
{
|
||||
platform: 'android'
|
||||
extensions: [
|
||||
'android'
|
||||
]
|
||||
}
|
||||
),
|
||||
/* config.plugin('ContextExclusionPlugin|App_Resources') */
|
||||
@@ -249,7 +251,7 @@ exports[`javascript configuration for android 1`] = `
|
||||
),
|
||||
/* config.plugin('ContextExclusionPlugin|Other_Platforms') */
|
||||
new ContextExclusionPlugin(
|
||||
/\\.(ios)\\.(\\w+)$/
|
||||
/\\.(ios|visionos)\\.(\\w+)$/
|
||||
),
|
||||
/* config.plugin('DefinePlugin') */
|
||||
new DefinePlugin(
|
||||
@@ -263,8 +265,10 @@ exports[`javascript configuration for android 1`] = `
|
||||
__UI_USE_EXTERNAL_RENDERER__: false,
|
||||
__ANDROID__: true,
|
||||
__IOS__: false,
|
||||
__VISIONOS__: false,
|
||||
'global.isAndroid': true,
|
||||
'global.isIOS': false,
|
||||
'global.isVisionOS': false,
|
||||
process: 'global.process',
|
||||
__USE_TEST_ID__: false
|
||||
}
|
||||
@@ -563,7 +567,9 @@ exports[`javascript configuration for ios 1`] = `
|
||||
/* config.plugin('PlatformSuffixPlugin') */
|
||||
new PlatformSuffixPlugin(
|
||||
{
|
||||
platform: 'ios'
|
||||
extensions: [
|
||||
'ios'
|
||||
]
|
||||
}
|
||||
),
|
||||
/* config.plugin('ContextExclusionPlugin|App_Resources') */
|
||||
@@ -572,7 +578,7 @@ exports[`javascript configuration for ios 1`] = `
|
||||
),
|
||||
/* config.plugin('ContextExclusionPlugin|Other_Platforms') */
|
||||
new ContextExclusionPlugin(
|
||||
/\\.(android)\\.(\\w+)$/
|
||||
/\\.(android|visionos)\\.(\\w+)$/
|
||||
),
|
||||
/* config.plugin('DefinePlugin') */
|
||||
new DefinePlugin(
|
||||
@@ -586,8 +592,10 @@ exports[`javascript configuration for ios 1`] = `
|
||||
__UI_USE_EXTERNAL_RENDERER__: false,
|
||||
__ANDROID__: false,
|
||||
__IOS__: true,
|
||||
__VISIONOS__: false,
|
||||
'global.isAndroid': false,
|
||||
'global.isIOS': true,
|
||||
'global.isVisionOS': false,
|
||||
process: 'global.process',
|
||||
__USE_TEST_ID__: false
|
||||
}
|
||||
|
||||
@@ -262,7 +262,9 @@ exports[`react configuration > android > adds ReactRefreshWebpackPlugin when HMR
|
||||
/* config.plugin('PlatformSuffixPlugin') */
|
||||
new PlatformSuffixPlugin(
|
||||
{
|
||||
platform: 'android'
|
||||
extensions: [
|
||||
'android'
|
||||
]
|
||||
}
|
||||
),
|
||||
/* config.plugin('ContextExclusionPlugin|App_Resources') */
|
||||
@@ -271,7 +273,7 @@ exports[`react configuration > android > adds ReactRefreshWebpackPlugin when HMR
|
||||
),
|
||||
/* config.plugin('ContextExclusionPlugin|Other_Platforms') */
|
||||
new ContextExclusionPlugin(
|
||||
/\\.(ios)\\.(\\w+)$/
|
||||
/\\.(ios|visionos)\\.(\\w+)$/
|
||||
),
|
||||
/* config.plugin('DefinePlugin') */
|
||||
new DefinePlugin(
|
||||
@@ -285,8 +287,10 @@ exports[`react configuration > android > adds ReactRefreshWebpackPlugin when HMR
|
||||
__UI_USE_EXTERNAL_RENDERER__: false,
|
||||
__ANDROID__: true,
|
||||
__IOS__: false,
|
||||
__VISIONOS__: false,
|
||||
'global.isAndroid': true,
|
||||
'global.isIOS': false,
|
||||
'global.isVisionOS': false,
|
||||
process: 'global.process',
|
||||
__USE_TEST_ID__: false,
|
||||
__TEST__: false,
|
||||
@@ -597,7 +601,9 @@ exports[`react configuration > android > base config 1`] = `
|
||||
/* config.plugin('PlatformSuffixPlugin') */
|
||||
new PlatformSuffixPlugin(
|
||||
{
|
||||
platform: 'android'
|
||||
extensions: [
|
||||
'android'
|
||||
]
|
||||
}
|
||||
),
|
||||
/* config.plugin('ContextExclusionPlugin|App_Resources') */
|
||||
@@ -606,7 +612,7 @@ exports[`react configuration > android > base config 1`] = `
|
||||
),
|
||||
/* config.plugin('ContextExclusionPlugin|Other_Platforms') */
|
||||
new ContextExclusionPlugin(
|
||||
/\\.(ios)\\.(\\w+)$/
|
||||
/\\.(ios|visionos)\\.(\\w+)$/
|
||||
),
|
||||
/* config.plugin('DefinePlugin') */
|
||||
new DefinePlugin(
|
||||
@@ -620,8 +626,10 @@ exports[`react configuration > android > base config 1`] = `
|
||||
__UI_USE_EXTERNAL_RENDERER__: false,
|
||||
__ANDROID__: true,
|
||||
__IOS__: false,
|
||||
__VISIONOS__: false,
|
||||
'global.isAndroid': true,
|
||||
'global.isIOS': false,
|
||||
'global.isVisionOS': false,
|
||||
process: 'global.process',
|
||||
__USE_TEST_ID__: false,
|
||||
__TEST__: false,
|
||||
@@ -939,7 +947,9 @@ exports[`react configuration > ios > adds ReactRefreshWebpackPlugin when HMR ena
|
||||
/* config.plugin('PlatformSuffixPlugin') */
|
||||
new PlatformSuffixPlugin(
|
||||
{
|
||||
platform: 'ios'
|
||||
extensions: [
|
||||
'ios'
|
||||
]
|
||||
}
|
||||
),
|
||||
/* config.plugin('ContextExclusionPlugin|App_Resources') */
|
||||
@@ -948,7 +958,7 @@ exports[`react configuration > ios > adds ReactRefreshWebpackPlugin when HMR ena
|
||||
),
|
||||
/* config.plugin('ContextExclusionPlugin|Other_Platforms') */
|
||||
new ContextExclusionPlugin(
|
||||
/\\.(android)\\.(\\w+)$/
|
||||
/\\.(android|visionos)\\.(\\w+)$/
|
||||
),
|
||||
/* config.plugin('DefinePlugin') */
|
||||
new DefinePlugin(
|
||||
@@ -962,8 +972,10 @@ exports[`react configuration > ios > adds ReactRefreshWebpackPlugin when HMR ena
|
||||
__UI_USE_EXTERNAL_RENDERER__: false,
|
||||
__ANDROID__: false,
|
||||
__IOS__: true,
|
||||
__VISIONOS__: false,
|
||||
'global.isAndroid': false,
|
||||
'global.isIOS': true,
|
||||
'global.isVisionOS': false,
|
||||
process: 'global.process',
|
||||
__USE_TEST_ID__: false,
|
||||
__TEST__: false,
|
||||
@@ -1275,7 +1287,9 @@ exports[`react configuration > ios > base config 1`] = `
|
||||
/* config.plugin('PlatformSuffixPlugin') */
|
||||
new PlatformSuffixPlugin(
|
||||
{
|
||||
platform: 'ios'
|
||||
extensions: [
|
||||
'ios'
|
||||
]
|
||||
}
|
||||
),
|
||||
/* config.plugin('ContextExclusionPlugin|App_Resources') */
|
||||
@@ -1284,7 +1298,7 @@ exports[`react configuration > ios > base config 1`] = `
|
||||
),
|
||||
/* config.plugin('ContextExclusionPlugin|Other_Platforms') */
|
||||
new ContextExclusionPlugin(
|
||||
/\\.(android)\\.(\\w+)$/
|
||||
/\\.(android|visionos)\\.(\\w+)$/
|
||||
),
|
||||
/* config.plugin('DefinePlugin') */
|
||||
new DefinePlugin(
|
||||
@@ -1298,8 +1312,10 @@ exports[`react configuration > ios > base config 1`] = `
|
||||
__UI_USE_EXTERNAL_RENDERER__: false,
|
||||
__ANDROID__: false,
|
||||
__IOS__: true,
|
||||
__VISIONOS__: false,
|
||||
'global.isAndroid': false,
|
||||
'global.isIOS': true,
|
||||
'global.isVisionOS': false,
|
||||
process: 'global.process',
|
||||
__USE_TEST_ID__: false,
|
||||
__TEST__: false,
|
||||
|
||||
@@ -267,7 +267,9 @@ exports[`svelte configuration for android 1`] = `
|
||||
/* config.plugin('PlatformSuffixPlugin') */
|
||||
new PlatformSuffixPlugin(
|
||||
{
|
||||
platform: 'android'
|
||||
extensions: [
|
||||
'android'
|
||||
]
|
||||
}
|
||||
),
|
||||
/* config.plugin('ContextExclusionPlugin|App_Resources') */
|
||||
@@ -276,7 +278,7 @@ exports[`svelte configuration for android 1`] = `
|
||||
),
|
||||
/* config.plugin('ContextExclusionPlugin|Other_Platforms') */
|
||||
new ContextExclusionPlugin(
|
||||
/\\.(ios)\\.(\\w+)$/
|
||||
/\\.(ios|visionos)\\.(\\w+)$/
|
||||
),
|
||||
/* config.plugin('DefinePlugin') */
|
||||
new DefinePlugin(
|
||||
@@ -290,8 +292,10 @@ exports[`svelte configuration for android 1`] = `
|
||||
__UI_USE_EXTERNAL_RENDERER__: false,
|
||||
__ANDROID__: true,
|
||||
__IOS__: false,
|
||||
__VISIONOS__: false,
|
||||
'global.isAndroid': true,
|
||||
'global.isIOS': false,
|
||||
'global.isVisionOS': false,
|
||||
process: 'global.process',
|
||||
__USE_TEST_ID__: false
|
||||
}
|
||||
@@ -612,7 +616,9 @@ exports[`svelte configuration for ios 1`] = `
|
||||
/* config.plugin('PlatformSuffixPlugin') */
|
||||
new PlatformSuffixPlugin(
|
||||
{
|
||||
platform: 'ios'
|
||||
extensions: [
|
||||
'ios'
|
||||
]
|
||||
}
|
||||
),
|
||||
/* config.plugin('ContextExclusionPlugin|App_Resources') */
|
||||
@@ -621,7 +627,7 @@ exports[`svelte configuration for ios 1`] = `
|
||||
),
|
||||
/* config.plugin('ContextExclusionPlugin|Other_Platforms') */
|
||||
new ContextExclusionPlugin(
|
||||
/\\.(android)\\.(\\w+)$/
|
||||
/\\.(android|visionos)\\.(\\w+)$/
|
||||
),
|
||||
/* config.plugin('DefinePlugin') */
|
||||
new DefinePlugin(
|
||||
@@ -635,8 +641,10 @@ exports[`svelte configuration for ios 1`] = `
|
||||
__UI_USE_EXTERNAL_RENDERER__: false,
|
||||
__ANDROID__: false,
|
||||
__IOS__: true,
|
||||
__VISIONOS__: false,
|
||||
'global.isAndroid': false,
|
||||
'global.isIOS': true,
|
||||
'global.isVisionOS': false,
|
||||
process: 'global.process',
|
||||
__USE_TEST_ID__: false
|
||||
}
|
||||
|
||||
@@ -240,7 +240,9 @@ exports[`typescript configuration for android 1`] = `
|
||||
/* config.plugin('PlatformSuffixPlugin') */
|
||||
new PlatformSuffixPlugin(
|
||||
{
|
||||
platform: 'android'
|
||||
extensions: [
|
||||
'android'
|
||||
]
|
||||
}
|
||||
),
|
||||
/* config.plugin('ContextExclusionPlugin|App_Resources') */
|
||||
@@ -249,7 +251,7 @@ exports[`typescript configuration for android 1`] = `
|
||||
),
|
||||
/* config.plugin('ContextExclusionPlugin|Other_Platforms') */
|
||||
new ContextExclusionPlugin(
|
||||
/\\.(ios)\\.(\\w+)$/
|
||||
/\\.(ios|visionos)\\.(\\w+)$/
|
||||
),
|
||||
/* config.plugin('DefinePlugin') */
|
||||
new DefinePlugin(
|
||||
@@ -263,8 +265,10 @@ exports[`typescript configuration for android 1`] = `
|
||||
__UI_USE_EXTERNAL_RENDERER__: false,
|
||||
__ANDROID__: true,
|
||||
__IOS__: false,
|
||||
__VISIONOS__: false,
|
||||
'global.isAndroid': true,
|
||||
'global.isIOS': false,
|
||||
'global.isVisionOS': false,
|
||||
process: 'global.process',
|
||||
__USE_TEST_ID__: false
|
||||
}
|
||||
@@ -563,7 +567,9 @@ exports[`typescript configuration for ios 1`] = `
|
||||
/* config.plugin('PlatformSuffixPlugin') */
|
||||
new PlatformSuffixPlugin(
|
||||
{
|
||||
platform: 'ios'
|
||||
extensions: [
|
||||
'ios'
|
||||
]
|
||||
}
|
||||
),
|
||||
/* config.plugin('ContextExclusionPlugin|App_Resources') */
|
||||
@@ -572,7 +578,7 @@ exports[`typescript configuration for ios 1`] = `
|
||||
),
|
||||
/* config.plugin('ContextExclusionPlugin|Other_Platforms') */
|
||||
new ContextExclusionPlugin(
|
||||
/\\.(android)\\.(\\w+)$/
|
||||
/\\.(android|visionos)\\.(\\w+)$/
|
||||
),
|
||||
/* config.plugin('DefinePlugin') */
|
||||
new DefinePlugin(
|
||||
@@ -586,8 +592,10 @@ exports[`typescript configuration for ios 1`] = `
|
||||
__UI_USE_EXTERNAL_RENDERER__: false,
|
||||
__ANDROID__: false,
|
||||
__IOS__: true,
|
||||
__VISIONOS__: false,
|
||||
'global.isAndroid': false,
|
||||
'global.isIOS': true,
|
||||
'global.isVisionOS': false,
|
||||
process: 'global.process',
|
||||
__USE_TEST_ID__: false
|
||||
}
|
||||
|
||||
@@ -280,7 +280,9 @@ exports[`vue configuration for android 1`] = `
|
||||
/* config.plugin('PlatformSuffixPlugin') */
|
||||
new PlatformSuffixPlugin(
|
||||
{
|
||||
platform: 'android'
|
||||
extensions: [
|
||||
'android'
|
||||
]
|
||||
}
|
||||
),
|
||||
/* config.plugin('ContextExclusionPlugin|App_Resources') */
|
||||
@@ -289,7 +291,7 @@ exports[`vue configuration for android 1`] = `
|
||||
),
|
||||
/* config.plugin('ContextExclusionPlugin|Other_Platforms') */
|
||||
new ContextExclusionPlugin(
|
||||
/\\.(ios)\\.(\\w+)$/
|
||||
/\\.(ios|visionos)\\.(\\w+)$/
|
||||
),
|
||||
/* config.plugin('DefinePlugin') */
|
||||
new DefinePlugin(
|
||||
@@ -303,8 +305,10 @@ exports[`vue configuration for android 1`] = `
|
||||
__UI_USE_EXTERNAL_RENDERER__: false,
|
||||
__ANDROID__: true,
|
||||
__IOS__: false,
|
||||
__VISIONOS__: false,
|
||||
'global.isAndroid': true,
|
||||
'global.isIOS': false,
|
||||
'global.isVisionOS': false,
|
||||
process: 'global.process',
|
||||
__USE_TEST_ID__: false
|
||||
}
|
||||
@@ -638,7 +642,9 @@ exports[`vue configuration for ios 1`] = `
|
||||
/* config.plugin('PlatformSuffixPlugin') */
|
||||
new PlatformSuffixPlugin(
|
||||
{
|
||||
platform: 'ios'
|
||||
extensions: [
|
||||
'ios'
|
||||
]
|
||||
}
|
||||
),
|
||||
/* config.plugin('ContextExclusionPlugin|App_Resources') */
|
||||
@@ -647,7 +653,7 @@ exports[`vue configuration for ios 1`] = `
|
||||
),
|
||||
/* config.plugin('ContextExclusionPlugin|Other_Platforms') */
|
||||
new ContextExclusionPlugin(
|
||||
/\\.(android)\\.(\\w+)$/
|
||||
/\\.(android|visionos)\\.(\\w+)$/
|
||||
),
|
||||
/* config.plugin('DefinePlugin') */
|
||||
new DefinePlugin(
|
||||
@@ -661,8 +667,10 @@ exports[`vue configuration for ios 1`] = `
|
||||
__UI_USE_EXTERNAL_RENDERER__: false,
|
||||
__ANDROID__: false,
|
||||
__IOS__: true,
|
||||
__VISIONOS__: false,
|
||||
'global.isAndroid': false,
|
||||
'global.isIOS': true,
|
||||
'global.isVisionOS': false,
|
||||
process: 'global.process',
|
||||
__USE_TEST_ID__: false
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nativescript/webpack",
|
||||
"version": "5.0.17",
|
||||
"version": "5.0.18-vision.0",
|
||||
"private": false,
|
||||
"main": "dist/index.js",
|
||||
"files": [
|
||||
|
||||
@@ -391,7 +391,7 @@ export default function (config: Config, env: IWebpackEnv = _env): Config {
|
||||
|
||||
config.plugin('PlatformSuffixPlugin').use(PlatformSuffixPlugin, [
|
||||
{
|
||||
platform,
|
||||
extensions: platform === 'visionos' ? [platform, 'ios'] : [platform],
|
||||
},
|
||||
]);
|
||||
|
||||
@@ -442,8 +442,11 @@ export default function (config: Config, env: IWebpackEnv = _env): Config {
|
||||
__UI_USE_EXTERNAL_RENDERER__: false,
|
||||
__ANDROID__: platform === 'android',
|
||||
__IOS__: platform === 'ios',
|
||||
__VISIONOS__: platform === 'visionos',
|
||||
/* for compat only */ 'global.isAndroid': platform === 'android',
|
||||
/* for compat only */ 'global.isIOS': platform === 'ios',
|
||||
/* for compat only */ 'global.isIOS':
|
||||
platform === 'ios' || platform === 'visionos',
|
||||
/* for compat only */ 'global.isVisionOS': platform === 'visionos',
|
||||
process: 'global.process',
|
||||
|
||||
// enable testID when using --env.e2e
|
||||
|
||||
@@ -7,6 +7,7 @@ import { env } from '../';
|
||||
|
||||
import AndroidPlatform from '../platforms/android';
|
||||
import iOSPlatform from '../platforms/ios';
|
||||
import visionOSPlatform from '../platforms/visionos';
|
||||
|
||||
export interface INativeScriptPlatform {
|
||||
getEntryPath?(): string;
|
||||
@@ -21,6 +22,7 @@ const platforms: {
|
||||
} = {
|
||||
android: AndroidPlatform,
|
||||
ios: iOSPlatform,
|
||||
visionos: visionOSPlatform,
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -60,6 +62,10 @@ export function getPlatformName(): Platform {
|
||||
return 'ios';
|
||||
}
|
||||
|
||||
if (env?.visionos) {
|
||||
return 'visionos';
|
||||
}
|
||||
|
||||
// support custom platforms
|
||||
if (env?.platform) {
|
||||
if (platforms[env.platform]) {
|
||||
@@ -80,7 +86,7 @@ export function getPlatformName(): Platform {
|
||||
|
||||
Available platforms: ${Object.keys(platforms).join(', ')}
|
||||
|
||||
Use --env.platform=<platform> or --env.android, --env.ios to specify the target platform.
|
||||
Use --env.platform=<platform> or --env.android, --env.ios, --env.visionos to specify the target platform.
|
||||
|
||||
Defaulting to "ios".
|
||||
`
|
||||
|
||||
20
packages/webpack5/src/platforms/visionos.ts
Normal file
20
packages/webpack5/src/platforms/visionos.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import { basename } from "path";
|
||||
|
||||
import { INativeScriptPlatform } from "../helpers/platform";
|
||||
import { getProjectRootPath } from "../helpers/project";
|
||||
|
||||
function sanitizeName(appName: string): string {
|
||||
return appName.split("").filter((c) =>
|
||||
/[a-zA-Z0-9]/.test(c)
|
||||
).join("");
|
||||
}
|
||||
function getDistPath() {
|
||||
const appName = sanitizeName(basename(getProjectRootPath()));
|
||||
return `platforms/visionos/${appName}/app`;
|
||||
}
|
||||
|
||||
const visionOSPlatform: INativeScriptPlatform = {
|
||||
getDistPath,
|
||||
}
|
||||
|
||||
export default visionOSPlatform;
|
||||
@@ -4,8 +4,7 @@ import { existsSync } from 'fs';
|
||||
const id = 'PlatformSuffixPlugin';
|
||||
|
||||
interface PlatformSuffixPluginOptions {
|
||||
platform: string;
|
||||
// extensions: string[] | (() => string[])
|
||||
extensions: Array<string>;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -20,11 +19,10 @@ interface PlatformSuffixPluginOptions {
|
||||
*
|
||||
*/
|
||||
export class PlatformSuffixPlugin {
|
||||
private readonly platform: string;
|
||||
// private readonly extensions: string[]
|
||||
private readonly extensions: string[];
|
||||
|
||||
constructor(options: PlatformSuffixPluginOptions) {
|
||||
this.platform = options.platform;
|
||||
this.extensions = options.extensions;
|
||||
|
||||
// if (typeof options.extensions === "function") {
|
||||
// this.extensions = options.extensions()
|
||||
@@ -34,7 +32,7 @@ export class PlatformSuffixPlugin {
|
||||
}
|
||||
|
||||
apply(compiler: any) {
|
||||
const platformRE = new RegExp(`\\.${this.platform}\\.`);
|
||||
const platformRE = new RegExp(`\\.${this.extensions.join('|')}\\.`);
|
||||
|
||||
// require.context
|
||||
compiler.hooks.contextModuleFactory.tap(id, (cmf) => {
|
||||
@@ -78,47 +76,49 @@ export class PlatformSuffixPlugin {
|
||||
resolver.hooks.normalResolve.tapAsync(
|
||||
id,
|
||||
(request_, resolveContext, callback) => {
|
||||
const { path, request } = request_;
|
||||
const ext = request && extname(request);
|
||||
const platformExt = ext ? `.${this.platform}${ext}` : '';
|
||||
for (const platform of this.extensions) {
|
||||
const { path, request } = request_;
|
||||
const ext = request && extname(request);
|
||||
const platformExt = ext ? `.${platform}${ext}` : '';
|
||||
|
||||
if (path && request && ext && !request.includes(platformExt)) {
|
||||
const platformRequest = request.replace(ext, platformExt);
|
||||
const extPath = resolve(path, platformRequest);
|
||||
if (path && request && ext && !request.includes(platformExt)) {
|
||||
const platformRequest = request.replace(ext, platformExt);
|
||||
const extPath = resolve(path, platformRequest);
|
||||
|
||||
// console.log({
|
||||
// path,
|
||||
// request,
|
||||
// ext,
|
||||
// extPath
|
||||
// })
|
||||
// console.log({
|
||||
// path,
|
||||
// request,
|
||||
// ext,
|
||||
// extPath
|
||||
// })
|
||||
|
||||
// if a file with the same + a platform suffix exists
|
||||
// we want to resolve that file instead
|
||||
if (existsSync(extPath)) {
|
||||
const message = `resolving "${request}" to "${platformRequest}"`;
|
||||
const hook = resolver.ensureHook('normalResolve');
|
||||
console.log(message);
|
||||
// if a file with the same + a platform suffix exists
|
||||
// we want to resolve that file instead
|
||||
if (existsSync(extPath)) {
|
||||
const message = `resolving "${request}" to "${platformRequest}"`;
|
||||
const hook = resolver.ensureHook('normalResolve');
|
||||
console.log(message);
|
||||
|
||||
// here we are creating a new resolve object and replacing the path
|
||||
// with the .<platform>.<ext> suffix
|
||||
const obj = {
|
||||
...request_,
|
||||
path: resolver.join(path, platformRequest),
|
||||
relativePath:
|
||||
request_.relativePath &&
|
||||
resolver.join(request_.relativePath, platformRequest),
|
||||
request: undefined,
|
||||
};
|
||||
// here we are creating a new resolve object and replacing the path
|
||||
// with the .<platform>.<ext> suffix
|
||||
const obj = {
|
||||
...request_,
|
||||
path: resolver.join(path, platformRequest),
|
||||
relativePath:
|
||||
request_.relativePath &&
|
||||
resolver.join(request_.relativePath, platformRequest),
|
||||
request: undefined,
|
||||
};
|
||||
|
||||
// we call to the actual resolver to do the resolving of this new file
|
||||
return resolver.doResolve(
|
||||
hook,
|
||||
obj,
|
||||
message,
|
||||
resolveContext,
|
||||
callback
|
||||
);
|
||||
// we call to the actual resolver to do the resolving of this new file
|
||||
return resolver.doResolve(
|
||||
hook,
|
||||
obj,
|
||||
message,
|
||||
resolveContext,
|
||||
callback
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
callback();
|
||||
|
||||
Reference in New Issue
Block a user