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

Function resolveVerboseFlag

packages/vite/helpers/logging.ts:36–82  ·  view source on GitHub ↗
(options: ResolveOptions = {})

Source from the content-addressed store, hash-verified

34}
35
36export function resolveVerboseFlag(options: ResolveOptions = {}): boolean {
37 if (options.cache !== false && typeof cachedVerbose === 'boolean') {
38 return cachedVerbose;
39 }
40
41 const { env = typeof process !== 'undefined' ? process.env : undefined, cliFlags } = options;
42 let resolved: boolean | undefined;
43
44 if (cliFlags && typeof cliFlags === 'object') {
45 const cliVerbose = coerceBoolean(cliFlags.verbose ?? cliFlags.VERBOSE);
46 if (typeof cliVerbose === 'boolean') {
47 resolved = cliVerbose;
48 }
49 }
50
51 if (resolved === undefined && options.useGlobalFlag !== false) {
52 try {
53 const globalVerbose = (globalThis as any)?.[GLOBAL_VERBOSE_FLAG];
54 const coerced = coerceBoolean(globalVerbose);
55 if (typeof coerced === 'boolean') {
56 resolved = coerced;
57 }
58 } catch {}
59 }
60
61 if (resolved === undefined && env) {
62 for (const key of ENV_VERBOSE_KEYS) {
63 if (Object.prototype.hasOwnProperty.call(env, key)) {
64 const envVerbose = coerceBoolean(env[key]);
65 if (typeof envVerbose === 'boolean') {
66 resolved = envVerbose;
67 break;
68 }
69 }
70 }
71 }
72
73 if (resolved === undefined) {
74 resolved = options.defaultValue ?? false;
75 }
76
77 if (options.cache !== false) {
78 cachedVerbose = resolved;
79 }
80
81 return resolved;
82}
83
84export function clearVerboseCache(): void {
85 cachedVerbose = undefined;

Callers 1

baseConfigFunction · 0.85

Calls 2

coerceBooleanFunction · 0.85
callMethod · 0.45

Tested by

no test coverage detected