(key: string, breakIfMissing: boolean = false)
| 66 | // This prevents having to iterate every time we search. |
| 67 | let flattenedPackageJson: Map<string, any>; |
| 68 | export function getRawSetting(key: string, breakIfMissing: boolean = false): any { |
| 69 | if (flattenedPackageJson === undefined) { |
| 70 | flattenedPackageJson = new Map(); |
| 71 | for (const subheading of packageJson.contributes.configuration) { |
| 72 | for (const setting in subheading.properties) { |
| 73 | flattenedPackageJson.set(setting, subheading.properties[setting]); |
| 74 | } |
| 75 | } |
| 76 | } |
| 77 | const result = flattenedPackageJson.get(key); |
| 78 | if (result === undefined && breakIfMissing) { |
| 79 | // eslint-disable-next-line no-debugger |
| 80 | debugger; // The setting does not exist in package.json. Check the `key`. |
| 81 | } |
| 82 | return result; |
| 83 | } |
| 84 | |
| 85 | export async function getRawJson(path: string | undefined): Promise<any> { |
| 86 | if (!path) { |
no test coverage detected