MCPcopy Create free account
hub / github.com/damms005/devdb-vscode / getVueAssets

Function getVueAssets

src/services/html.ts:50–70  ·  view source on GitHub ↗
(context: vscode.ExtensionContext)

Source from the content-addressed store, hash-verified

48 * Gets the compiled Vue assets from the Vue project output folder
49 */
50export async function getVueAssets(context: vscode.ExtensionContext): Promise<VueAssets> {
51 const allFiles = await vscode.workspace.fs.readDirectory(vscode.Uri.file(context.extensionPath));
52
53 const uiFolder = allFiles.find((item) => item[0] === FRONTEND_FOLDER_NAME && item[1] === vscode.FileType.Directory);
54 if (!uiFolder) {
55 throw new Error('Could not find UI assets folder');
56 }
57
58 const projectFolder = join(context.extensionPath, FRONTEND_FOLDER_NAME, 'dist', 'assets');
59 const uiFiles: [string, vscode.FileType][] = await vscode.workspace.fs.readDirectory(vscode.Uri.file(projectFolder));
60 const jsFile = uiFiles.find((item) => item[1] === vscode.FileType.File && item[0].endsWith('.js'));
61 const cssFile = uiFiles.find((item) => item[1] === vscode.FileType.File && item[0].endsWith('.css'));
62 if (!jsFile || !cssFile) {
63 throw new Error('UI asset files (JS or CSS) not found in build output');
64 }
65
66 return {
67 jsFile: jsFile[0],
68 cssFile: cssFile[0]
69 };
70}
71
72/**
73 * Generates a random nonce for webview Content Security Policy

Callers 1

activateFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected