MCPcopy Create free account
hub / github.com/ecomfe/tempad-dev / evaluate

Function evaluate

packages/extension/utils/module.ts:1–8  ·  view source on GitHub ↗
(code: string)

Source from the content-addressed store, hash-verified

1import { parse } from 'es-module-lexer/js'
2
3const EXTERNAL_MODULE_ERROR = 'External module loading is not allowed in plugins.'
4const INVALID_MODULE_ERROR = 'Plugin module syntax could not be validated.'
5
6export 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)

Callers 3

module.test.tsFile · 0.90
worker.tsFile · 0.90
worker.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected