full site update
This commit is contained in:
2
node_modules/astro/dist/toolbar/index.d.ts
generated
vendored
2
node_modules/astro/dist/toolbar/index.d.ts
generated
vendored
@@ -1,2 +1,2 @@
|
||||
import type { DevToolbarApp } from '../@types/astro.js';
|
||||
import type { DevToolbarApp } from '../types/public/toolbar.js';
|
||||
export declare function defineToolbarApp(app: DevToolbarApp): DevToolbarApp;
|
||||
|
2
node_modules/astro/dist/toolbar/vite-plugin-dev-toolbar.d.ts
generated
vendored
2
node_modules/astro/dist/toolbar/vite-plugin-dev-toolbar.d.ts
generated
vendored
@@ -1,3 +1,3 @@
|
||||
import type * as vite from 'vite';
|
||||
import type { AstroPluginOptions } from '../@types/astro.js';
|
||||
import type { AstroPluginOptions } from '../types/astro.js';
|
||||
export default function astroDevToolbar({ settings, logger }: AstroPluginOptions): vite.Plugin;
|
||||
|
82
node_modules/astro/dist/toolbar/vite-plugin-dev-toolbar.js
generated
vendored
82
node_modules/astro/dist/toolbar/vite-plugin-dev-toolbar.js
generated
vendored
@@ -50,58 +50,60 @@ ${args.error}`
|
||||
},
|
||||
async load(id) {
|
||||
if (id === resolvedPrivateVirtualModuleId) {
|
||||
return `
|
||||
export const loadDevToolbarApps = async () => {
|
||||
return (await Promise.all([${settings.devToolbarApps.map(
|
||||
(plugin) => `safeLoadPlugin(${JSON.stringify(
|
||||
plugin
|
||||
)}, async () => (await import(${JSON.stringify(
|
||||
typeof plugin === "string" ? plugin : plugin.entrypoint
|
||||
)})).default, ${JSON.stringify(
|
||||
typeof plugin === "string" ? plugin : plugin.entrypoint
|
||||
)})`
|
||||
).join(",")}]));
|
||||
};
|
||||
return {
|
||||
code: `
|
||||
export const loadDevToolbarApps = async () => {
|
||||
return (await Promise.all([${settings.devToolbarApps.map(
|
||||
(plugin) => `safeLoadPlugin(${JSON.stringify(
|
||||
plugin
|
||||
)}, async () => (await import(${JSON.stringify(
|
||||
typeof plugin === "string" ? plugin : plugin.entrypoint.toString()
|
||||
)})).default, ${JSON.stringify(
|
||||
typeof plugin === "string" ? plugin : plugin.entrypoint.toString()
|
||||
)})`
|
||||
).join(",")}]));
|
||||
};
|
||||
|
||||
async function safeLoadPlugin(appDefinition, importEntrypoint, entrypoint) {
|
||||
try {
|
||||
let app;
|
||||
if (typeof appDefinition === 'string') {
|
||||
app = await importEntrypoint();
|
||||
async function safeLoadPlugin(appDefinition, importEntrypoint, entrypoint) {
|
||||
try {
|
||||
let app;
|
||||
if (typeof appDefinition === 'string') {
|
||||
app = await importEntrypoint();
|
||||
|
||||
if (typeof app !== 'object' || !app.id || !app.name) {
|
||||
throw new Error("Apps must default export an object with an id, and a name.");
|
||||
}
|
||||
} else {
|
||||
app = appDefinition;
|
||||
if (typeof app !== 'object' || !app.id || !app.name) {
|
||||
throw new Error("Apps must default export an object with an id, and a name.");
|
||||
}
|
||||
} else {
|
||||
app = appDefinition;
|
||||
|
||||
if (typeof app !== 'object' || !app.id || !app.name || !app.entrypoint) {
|
||||
throw new Error("Apps must be an object with an id, a name and an entrypoint.");
|
||||
if (typeof app !== 'object' || !app.id || !app.name || !app.entrypoint) {
|
||||
throw new Error("Apps must be an object with an id, a name and an entrypoint.");
|
||||
}
|
||||
|
||||
const loadedApp = await importEntrypoint();
|
||||
|
||||
if (typeof loadedApp !== 'object') {
|
||||
throw new Error("App entrypoint must default export an object.");
|
||||
}
|
||||
|
||||
app = { ...app, ...loadedApp };
|
||||
}
|
||||
|
||||
const loadedApp = await importEntrypoint();
|
||||
return app;
|
||||
} catch (err) {
|
||||
console.error(\`Failed to load dev toolbar app from \${entrypoint}: \${err.message}\`);
|
||||
|
||||
if (typeof loadedApp !== 'object') {
|
||||
throw new Error("App entrypoint must default export an object.");
|
||||
if (import.meta.hot) {
|
||||
import.meta.hot.send('astro:devtoolbar:error:load', { entrypoint: entrypoint, error: err.message })
|
||||
}
|
||||
|
||||
app = { ...app, ...loadedApp };
|
||||
}
|
||||
|
||||
return app;
|
||||
} catch (err) {
|
||||
console.error(\`Failed to load dev toolbar app from \${entrypoint}: \${err.message}\`);
|
||||
|
||||
if (import.meta.hot) {
|
||||
import.meta.hot.send('astro:devtoolbar:error:load', { entrypoint: entrypoint, error: err.message })
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
`;
|
||||
`
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user