MCPcopy Create free account
hub / github.com/NativeScript/NativeScript / getCore

Function getCore

packages/vite/runtime/core-aliases-early.ts:9–36  ·  view source on GitHub ↗
(name: string)

Source from the content-addressed store, hash-verified

7 try {
8 const g: any = globalThis as any;
9 const getCore = (name: string): any => {
10 try {
11 const reg = g.__nsVendorRegistry;
12 const req = reg?.get ? g.__nsVendorRequire || g.__nsRequire || g.require : g.__nsRequire || g.require;
13 let mod: any = null;
14 if (reg && reg.has('@nativescript/core')) mod = reg.get('@nativescript/core');
15 else if (typeof req === 'function') {
16 try {
17 mod = req('@nativescript/core');
18 } catch {}
19 }
20 const ns = (mod && (mod.default ?? mod)) || mod;
21 if (name === 'Application' && ns && (ns.Application || ns)) return ns.Application || ns;
22 if (ns && ns[name]) return ns[name];
23 } catch {}
24 try {
25 const nr = g.__nativeRequire;
26 if (typeof nr === 'function') {
27 try {
28 const mod = nr('@nativescript/core', '/');
29 const ns = (mod && (mod.default ?? mod)) || mod;
30 if (name === 'Application' && ns && (ns.Application || ns)) return ns.Application || ns;
31 if (ns && ns[name]) return ns[name];
32 } catch {}
33 }
34 } catch {}
35 return undefined;
36 };
37
38 for (const n of ['Application', 'Frame', 'Page']) {
39 try {

Callers 1

installCoreAliasesEarlyFunction · 0.70

Calls 2

reqFunction · 0.85
getMethod · 0.65

Tested by

no test coverage detected