(code: string)
| 1 | import { parse } from 'es-module-lexer/js' |
| 2 | |
| 3 | const EXTERNAL_MODULE_ERROR = 'External module loading is not allowed in plugins.' |
| 4 | const INVALID_MODULE_ERROR = 'Plugin module syntax could not be validated.' |
| 5 | |
| 6 | export function assertPluginModuleIsSelfContained(code: string): void { |
| 7 | let imports: ReturnType<typeof parse>[0] |
| 8 | try { |
| 9 | imports = parse(code)[0] |
| 10 | } catch { |
| 11 | throw new Error(INVALID_MODULE_ERROR) |
no outgoing calls
no test coverage detected