Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function execute(content: string) {
const container = DI.createContainer();
container.register(
LoggerConfiguration.create(console, LogLevel.debug, ColorOptions.colors),
Registration.singleton(IFileSystem, VirtualFileSystem),
);
const host = new ServiceHost(container);
const result = await host.executeSpecificFile({
shortName: '',
shortPath: '',
kind: FileKind.Script,
path: '',
dir: '',
rootlessPath: '',
name: '',
ext: '',
// eslint-disable-next-line @typescript-eslint/require-await
async getContent() {
return content;
},
getContentSync() {
return content;
async function execute(content: string) {
const container = DI.createContainer();
container.register(
LoggerConfiguration.create(console, LogLevel.debug, ColorOptions.colors),
Registration.singleton(IFileSystem, VirtualFileSystem),
);
const host = new ServiceHost(container);
const result = await host.executeSpecificFile({
shortName: '',
shortPath: '',
kind: FileKind.Script,
path: '',
dir: '',
rootlessPath: '',
name: '',
ext: '',
// eslint-disable-next-line @typescript-eslint/require-await
async getContent() {
return content;
},
getContentSync() {
return content;
},
}, 'module');
if (result.isAbrupt) {
assert.fail(`Evaluation error`);
public get host(): IServiceHost {
let host = this._host;
if (host === null) {
host = this._host = new ServiceHost(this.container);
}
return host;
}