@githubnext/vitale
Advanced tools
Comparing version
@@ -7,3 +7,3 @@ #!/usr/bin/env node | ||
// package.json | ||
var version = "0.0.10"; | ||
var version = "0.0.11"; | ||
@@ -530,8 +530,11 @@ // src/server.ts | ||
} | ||
async executeCell(id, path2, cellId) { | ||
await Promise.all( | ||
async executeCell(id, path2, cellId, force) { | ||
const startOK = (await Promise.all( | ||
Array.from(this.clients.values()).map( | ||
(client) => client.startCellExecution(path2, cellId) | ||
(client) => client.startCellExecution(path2, cellId, force) | ||
) | ||
); | ||
)).every((ok) => ok); | ||
if (!startOK) { | ||
return false; | ||
} | ||
let data; | ||
@@ -593,3 +596,3 @@ let mime; | ||
}; | ||
return await Promise.all( | ||
await Promise.all( | ||
Array.from(this.clients.values()).map( | ||
@@ -599,2 +602,3 @@ (client) => client.endCellExecution(path2, cellId, cellOutput) | ||
); | ||
return true; | ||
} | ||
@@ -631,3 +635,3 @@ invalidateModule(id, dirtyCells) { | ||
} | ||
async executeCellsRPC(cells, executeDirtyCells) { | ||
async executeCellsRPC(cells, force, executeDirtyCells) { | ||
let dirtyCells = []; | ||
@@ -656,17 +660,16 @@ for (const { path: path2, cellId, language, code } of cells) { | ||
cellId, | ||
ext: extOfLanguage(language) | ||
ext: extOfLanguage(language), | ||
force | ||
})), | ||
...executeDirtyCells ? dirtyCells : [] | ||
...executeDirtyCells ? dirtyCells.map((cell) => ({ ...cell, force: false })) : [] | ||
]; | ||
await Promise.all( | ||
cellsToExecute.map(async ({ path: path2, cellId, ext }) => { | ||
const id = `${path2}-cellId=${cellId}.${ext}`; | ||
return this.executeCell(id, path2, cellId).catch((e) => { | ||
console.error(e); | ||
}); | ||
}) | ||
const executed = await Promise.all( | ||
cellsToExecute.map( | ||
({ path: path2, cellId, ext, force: force2 }) => this.executeCell(`${path2}-cellId=${cellId}.${ext}`, path2, cellId, force2) | ||
) | ||
); | ||
if (!executeDirtyCells) { | ||
this.markCellsDirty(dirtyCells); | ||
} | ||
const cellsToMarkDirty = cellsToExecute.filter( | ||
({ force: force2 }, i) => !force2 && !executed[i] | ||
); | ||
this.markCellsDirty(cellsToMarkDirty); | ||
} | ||
@@ -700,5 +703,5 @@ removeCellsRPC(cells) { | ||
}, | ||
async executeCells(cells, executeDirtyCells) { | ||
async executeCells(cells, force, executeDirtyCells) { | ||
try { | ||
return self.executeCellsRPC(cells, executeDirtyCells); | ||
return self.executeCellsRPC(cells, force, executeDirtyCells); | ||
} catch (e) { | ||
@@ -705,0 +708,0 @@ console.error(e); |
@@ -22,3 +22,3 @@ import * as babelTypes from '@babel/types'; | ||
code?: string; | ||
}[], executeDirtyCells: boolean) => void; | ||
}[], force: boolean, executeDirtyCells: boolean) => void; | ||
}; | ||
@@ -30,3 +30,3 @@ type ClientFunctions = { | ||
}[]) => void; | ||
startCellExecution: (path: string, cellId: string) => void; | ||
startCellExecution: (path: string, cellId: string, force: boolean) => Promise<boolean>; | ||
endCellExecution: (path: string, cellId: string, cellOutput: CellOutput) => void; | ||
@@ -33,0 +33,0 @@ }; |
{ | ||
"name": "@githubnext/vitale", | ||
"version": "0.0.10", | ||
"version": "0.0.11", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
25278
1.04%781
0.39%