MCPcopy Index your code
hub / github.com/NativeScript/NativeScript / getPlatformName

Function getPlatformName

packages/webpack5/src/helpers/platform.ts:56–96  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

54 * Utility to get the currently targeted platform name
55 */
56export function getPlatformName(): Platform {
57 if (env?.android) {
58 return 'android';
59 }
60
61 if (env?.ios) {
62 return 'ios';
63 }
64
65 if (env?.visionos || env?.vision) {
66 return 'visionos';
67 }
68
69 // support custom platforms
70 if (env?.platform) {
71 if (platforms[env.platform]) {
72 return env.platform;
73 }
74
75 throw error(`
76 Invalid platform: ${env.platform}
77
78 Valid platforms: ${getAvailablePlatforms().join(', ')}
79 `);
80 }
81
82 warnOnce(
83 'getPlatformName',
84 `
85 You need to provide a target platform!
86
87 Available platforms: ${Object.keys(platforms).join(', ')}
88
89 Use --env.platform=<platform> or --env.android, --env.ios, --env.visionos to specify the target platform.
90
91 Defaulting to "ios".
92 `,
93 );
94
95 return 'ios';
96}
97
98/**
99 * Utility to get the entry file path for the currently targeted platform

Callers 8

angular.tsFile · 0.90
base.tsFile · 0.90
vue.tsFile · 0.90
svelte.tsFile · 0.90
react.tsFile · 0.90
getPlatformFunction · 0.85
getDistPathFunction · 0.85

Calls 5

errorFunction · 0.90
warnOnceFunction · 0.90
getAvailablePlatformsFunction · 0.85
joinMethod · 0.80
keysMethod · 0.65

Tested by

no test coverage detected