import { Uri , WebviewOptions , WebviewPanelOptions } from 'vscode' ; type WebviewOptionsType = WebviewOptions & WebviewPanelOptions ; export function getWebviewOptions ( extensionUri ) { const webviewOptions = { enableScripts : true , localResourceRoots : [ Uri . joinPath ( extensionUri , 'media' ) ] , retainContextWhenHidden : true , } ; return webviewOptions ; } export function getNonce ( ) { let text = '' ; const possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789' ; for ( let i = 0 ; i < 32 ; i ++ ) { text += possible . charAt ( Math . floor ( Math . random ( ) * possible . length ) ) ; } return text ; }