Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.then(opts => {
opts.fileSystem["main.ts"] = ' ';
opts.fileSystem["custom.ts"] = js;
opts.fileSystem["pxt-core.d.ts"] = common;
opts.fileSystem["pxt-helpers.ts"] = helpers;
opts.ast = true;
opts.testMode = true;
opts.ignoreFileResolutionErrors = true;
var resp = pxtc.compile(opts);
if (!resp.success) {
console.log('error: ', resp);
return;
}
var file = resp.ast.getSourceFile("main.ts");
var apiInfo = pxtc.getApiInfo(opts, resp.ast);
var blockInfo = pxtc.getBlocksInfo(apiInfo);
// Initialize blocks in Blockly
function createWindow () {
win = new BrowserWindow({
width: 800,
height: 600,
title: "code the micro:bit"
})
Menu.setApplicationMenu(null)
win.loadURL(`file://${__dirname}/index.html#local_token=${pxt.globalConfig.localToken}`)
win.on('closed', () => {
win = null
})
}
function startServerAndCreateWindow() {
pxt.mainCli(cliPath, ["serve", "-no-browser"])
createWindow()
}