refactor: image preview plugin (#3457)

This commit is contained in:
Alex Yang
2023-07-29 00:18:28 -07:00
committed by GitHub
parent be3909370e
commit 52809a2783
18 changed files with 129 additions and 45 deletions

View File

@@ -45,7 +45,8 @@ const external = [
/^@toeverything/,
// react
/^react/,
'react',
/^react\//,
/^react-dom/,
// store
@@ -72,11 +73,11 @@ const json: z.infer<typeof packageJsonInputSchema> = await readFile(
)
.then(text => JSON.parse(text))
.then(async json => {
const { success } = await packageJsonInputSchema.safeParseAsync(json);
if (success) {
const result = await packageJsonInputSchema.safeParseAsync(json);
if (result.success) {
return json;
} else {
throw new Error('invalid package.json');
throw new Error('invalid package.json', result.error);
}
});