export function getRuntimeConfig()

in src/utils.ts [441:491]


export function getRuntimeConfig(config: Partial<IUserConfig> = {}): IRuntimeConfig {
    const settings = vscode.workspace.getConfiguration(SETTINGS_STORE_NAME);
    const pathMapping = config.pathMapping || settings.get('pathMapping') || SETTINGS_DEFAULT_PATH_MAPPING;
    const sourceMapPathOverrides =
        config.sourceMapPathOverrides || settings.get('sourceMapPathOverrides') || SETTINGS_DEFAULT_PATH_OVERRIDES;
    const webRoot = config.webRoot || settings.get('webRoot') || SETTINGS_DEFAULT_WEB_ROOT;
    const defaultEntrypoint = config.defaultEntrypoint || settings.get('defaultEntrypoint') || SETTINGS_DEFAULT_ENTRY_POINT;

    let sourceMaps = SETTINGS_DEFAULT_SOURCE_MAPS;
    if (typeof config.sourceMaps !== 'undefined') {
        sourceMaps = config.sourceMaps;
    } else {
        const settingsSourceMaps: boolean | undefined = settings.get('sourceMaps');
        if (typeof settingsSourceMaps !== 'undefined') {
            sourceMaps = settingsSourceMaps;
        }
    }

    // Resolve the paths with the webRoot set by the user
    const resolvedOverrides: IStringDictionary<string> = {};
    for (const pattern in sourceMapPathOverrides) {
        if (sourceMapPathOverrides.hasOwnProperty(pattern)) {
            const replacePattern = replaceWebRootInSourceMapPathOverridesEntry(webRoot, pattern);
            const replacePatternValue = replaceWebRootInSourceMapPathOverridesEntry(
                webRoot, sourceMapPathOverrides[pattern]);

            resolvedOverrides[replacePattern] = replaceWorkSpaceFolderPlaceholder(replacePatternValue);
        }
    }

    // replace workspaceFolder with local paths
    const resolvedMappingOverrides: IStringDictionary<string> = {};
    for (const customPathMapped in pathMapping) {
        if (pathMapping.hasOwnProperty(customPathMapped)) {
            resolvedMappingOverrides[customPathMapped] =
                replaceWorkSpaceFolderPlaceholder(pathMapping[customPathMapped]);
        }
    }

    const resolvedWebRoot = replaceWorkSpaceFolderPlaceholder(webRoot);
    return {
        pathMapping: resolvedMappingOverrides,
        sourceMapPathOverrides: resolvedOverrides,
        sourceMaps,
        webRoot: resolvedWebRoot,
        isJsDebugProxiedCDPConnection: false,
        useLocalEdgeWatch: DEBUG,
        devtoolsBaseUri: DEVTOOLS_BASE_URI,
        defaultEntrypoint: defaultEntrypoint,
    };
}