This reverts commit 03b18e8d1b
.
This commit is contained in:
parent
7acded4d0e
commit
13a4b0d488
5 changed files with 1 additions and 42 deletions
|
@ -1,5 +0,0 @@
|
|||
---
|
||||
'astro': minor
|
||||
---
|
||||
|
||||
Adds a new "astro:build:generated" hook that runs after SSG builds finish but **before** build artifacts are cleaned up. This is a very specific use case, "astro:build:done" is probably what you're looking for.
|
|
@ -1159,7 +1159,6 @@ export interface AstroIntegration {
|
|||
target: 'client' | 'server';
|
||||
updateConfig: (newConfig: ViteConfigWithSSR) => void;
|
||||
}) => void | Promise<void>;
|
||||
'astro:build:generated'?: (options: { dir: URL }) => void | Promise<void>;
|
||||
'astro:build:done'?: (options: {
|
||||
pages: { pathname: string }[];
|
||||
dir: URL;
|
||||
|
|
|
@ -19,7 +19,6 @@ import {
|
|||
removeTrailingForwardSlash,
|
||||
} from '../../core/path.js';
|
||||
import type { RenderOptions } from '../../core/render/core';
|
||||
import { runHookBuildGenerated } from '../../integrations/index.js';
|
||||
import { BEFORE_HYDRATION_SCRIPT_ID, PAGE_SCRIPT_ID } from '../../vite-plugin-scripts/index.js';
|
||||
import { call as callEndpoint } from '../endpoint/index.js';
|
||||
import { debug, info } from '../logger/core.js';
|
||||
|
@ -113,12 +112,6 @@ export async function generatePages(opts: StaticBuildOptions, internals: BuildIn
|
|||
await generatePage(opts, internals, pageData, ssrEntry, builtPaths);
|
||||
}
|
||||
|
||||
await runHookBuildGenerated({
|
||||
config: opts.astroConfig,
|
||||
buildConfig: opts.buildConfig,
|
||||
logging: opts.logging,
|
||||
});
|
||||
|
||||
info(opts.logging, null, dim(`Completed in ${getTimeStat(timer, performance.now())}.\n`));
|
||||
}
|
||||
|
||||
|
|
|
@ -263,28 +263,6 @@ export async function runHookBuildSsr({
|
|||
}
|
||||
}
|
||||
|
||||
export async function runHookBuildGenerated({
|
||||
config,
|
||||
buildConfig,
|
||||
logging,
|
||||
}: {
|
||||
config: AstroConfig;
|
||||
buildConfig: BuildConfig;
|
||||
logging: LogOptions;
|
||||
}) {
|
||||
const dir = config.output === 'server' ? buildConfig.client : config.outDir;
|
||||
|
||||
for (const integration of config.integrations) {
|
||||
if (integration?.hooks?.['astro:build:generated']) {
|
||||
await withTakingALongTimeMsg({
|
||||
name: integration.name,
|
||||
hookResult: integration.hooks['astro:build:generated']({ dir }),
|
||||
logging,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function runHookBuildDone({
|
||||
config,
|
||||
buildConfig,
|
||||
|
|
|
@ -4,8 +4,6 @@ import { loadFixture } from './test-utils.js';
|
|||
describe('Static build: dir takes the URL path to the output directory', () => {
|
||||
/** @type {URL} */
|
||||
let checkDir;
|
||||
/** @type {URL} */
|
||||
let checkGeneratedDir;
|
||||
before(async () => {
|
||||
const fixture = await loadFixture({
|
||||
root: './fixtures/static-build-dir/',
|
||||
|
@ -13,9 +11,6 @@ describe('Static build: dir takes the URL path to the output directory', () => {
|
|||
{
|
||||
name: '@astrojs/dir',
|
||||
hooks: {
|
||||
'astro:build:generated': ({ dir }) => {
|
||||
checkGeneratedDir = dir;
|
||||
},
|
||||
'astro:build:done': ({ dir }) => {
|
||||
checkDir = dir;
|
||||
},
|
||||
|
@ -30,6 +25,5 @@ describe('Static build: dir takes the URL path to the output directory', () => {
|
|||
expect(removeTrailingSlash(checkDir.toString())).to.be.equal(
|
||||
removeTrailingSlash(new URL('./fixtures/static-build-dir/dist', import.meta.url).toString())
|
||||
);
|
||||
expect(checkDir.toString()).to.be.equal(checkGeneratedDir.toString());
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue