chore(ui): do not add sources into the zip file (#21588)

This commit is contained in:
Pavel Feldman 2023-03-10 17:01:30 -08:00 committed by GitHub
parent 34efbea4c5
commit 0b9c037f36
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 3 deletions

View file

@ -51,7 +51,7 @@ class UIMode {
for (const p of config.projects)
p.retries = 0;
config._internal.configCLIOverrides.use = config._internal.configCLIOverrides.use || {};
config._internal.configCLIOverrides.use.trace = 'on';
config._internal.configCLIOverrides.use.trace = { mode: 'on', sources: false };
this._originalStderr = process.stderr.write.bind(process.stderr);
process.stdout.write = (chunk: string | Buffer) => {

View file

@ -55,7 +55,14 @@ export const SourceTab: React.FunctionComponent<{
return '';
if (!stackInfo.fileContent.has(filePath)) {
const sha1 = await calculateSha1(filePath);
stackInfo.fileContent.set(filePath, await fetch(`sha1/src@${sha1}.txt`).then(response => response.text()).catch(() => `<Unable to read "${filePath}">`));
try {
let response = await fetch(`sha1/src@${sha1}.txt`);
if (response.status === 404)
response = await fetch(`file?path=${filePath}`);
stackInfo.fileContent.set(filePath, await response.text());
} catch {
stackInfo.fileContent.set(filePath, `<Unable to read "${filePath}">`);
}
}
return stackInfo.fileContent.get(filePath)!;
}, [stackInfo, selectedFrame], '');

View file

@ -36,12 +36,23 @@ export const Workbench: React.FunctionComponent<{
output?: React.ReactElement,
rightToolbar?: React.ReactElement[],
}> = ({ model, output, rightToolbar }) => {
const [selectedAction, setSelectedAction] = React.useState<ActionTraceEvent | undefined>();
const [selectedAction, setSelectedAction] = React.useState<ActionTraceEvent | undefined>(undefined);
const [highlightedAction, setHighlightedAction] = React.useState<ActionTraceEvent | undefined>();
const [selectedNavigatorTab, setSelectedNavigatorTab] = React.useState<string>('actions');
const [selectedPropertiesTab, setSelectedPropertiesTab] = React.useState<string>(output ? 'output' : 'call');
const activeAction = model ? highlightedAction || selectedAction : undefined;
React.useEffect(() => {
if (selectedAction)
return;
const failedAction = model?.actions.find(a => a.error);
if (failedAction)
setSelectedAction(failedAction);
// In the UI mode, selecting the first error should reveal source.
if (output)
setSelectedPropertiesTab('source');
}, [model, output, selectedAction, setSelectedAction, setSelectedPropertiesTab]);
const { errors, warnings } = activeAction ? modelUtil.stats(activeAction) : { errors: 0, warnings: 0 };
const consoleCount = errors + warnings;
const networkCount = activeAction ? modelUtil.resourcesForAction(activeAction).length : 0;