import { join, resolve } from 'node:path'; import { type CustomViewSummary } from 'ontime-types'; import { defaultDemoHtml } from '../../bundle/bundledDemoHtml.js'; import { publicDir } from '../../setup/index.js'; import { createDirectory, deleteDirectory, ensureDirectory, fileIsReadable, isNodeError, readDirectoryEntries, replaceDirectory, statIfExists, writeToFile, } from '../../utils/fileManagement.js'; import { CustomViewError } from './customViews.errors.js'; /** * Patterns that indicate external resource loading. * Custom views must be self-contained single HTML files with only inline CSS and JavaScript. */ const forbiddenHtmlPatterns: { pattern: RegExp; message: string }[] = [ { pattern: /]+src\s*=/i, message: 'External scripts are not allowed. Use inline