mirror of
https://github.com/withastro/astro.git
synced 2025-02-17 22:44:24 -05:00
chore(astro): reorganize integrations hooks (#10896)
* chore(astro): reorganize integrations hooks * fix: test paths
This commit is contained in:
parent
c238aa81ee
commit
76980362dd
14 changed files with 14 additions and 14 deletions
|
@ -19,7 +19,7 @@ import type { AstroTimer } from '../core/config/timer.js';
|
||||||
import type { TSConfig } from '../core/config/tsconfig.js';
|
import type { TSConfig } from '../core/config/tsconfig.js';
|
||||||
import type { AstroCookies } from '../core/cookies/index.js';
|
import type { AstroCookies } from '../core/cookies/index.js';
|
||||||
import type { AstroIntegrationLogger, Logger, LoggerLevel } from '../core/logger/core.js';
|
import type { AstroIntegrationLogger, Logger, LoggerLevel } from '../core/logger/core.js';
|
||||||
import type { getToolbarServerCommunicationHelpers } from '../integrations/index.js';
|
import type { getToolbarServerCommunicationHelpers } from '../integrations/hooks.js';
|
||||||
import type { AstroPreferences } from '../preferences/index.js';
|
import type { AstroPreferences } from '../preferences/index.js';
|
||||||
import type {
|
import type {
|
||||||
ToolbarAppEventTarget,
|
ToolbarAppEventTarget,
|
||||||
|
|
|
@ -27,7 +27,7 @@ export function getViteConfig(inlineConfig: UserConfig) {
|
||||||
import('../core/logger/node.js'),
|
import('../core/logger/node.js'),
|
||||||
import('../core/config/index.js'),
|
import('../core/config/index.js'),
|
||||||
import('../core/create-vite.js'),
|
import('../core/create-vite.js'),
|
||||||
import('../integrations/index.js'),
|
import('../integrations/hooks.js'),
|
||||||
import('./vite-plugin-content-listen.js'),
|
import('./vite-plugin-content-listen.js'),
|
||||||
]);
|
]);
|
||||||
const logger = new Logger({
|
const logger = new Logger({
|
||||||
|
|
|
@ -30,7 +30,7 @@ import {
|
||||||
removeTrailingForwardSlash,
|
removeTrailingForwardSlash,
|
||||||
} from '../../core/path.js';
|
} from '../../core/path.js';
|
||||||
import { toRoutingStrategy } from '../../i18n/utils.js';
|
import { toRoutingStrategy } from '../../i18n/utils.js';
|
||||||
import { runHookBuildGenerated } from '../../integrations/index.js';
|
import { runHookBuildGenerated } from '../../integrations/hooks.js';
|
||||||
import { getOutputDirectory, isServerLikeOutput } from '../../prerender/utils.js';
|
import { getOutputDirectory, isServerLikeOutput } from '../../prerender/utils.js';
|
||||||
import type { SSRManifestI18n } from '../app/types.js';
|
import type { SSRManifestI18n } from '../app/types.js';
|
||||||
import { NoPrerenderedRoutesWithDomains } from '../errors/errors-data.js';
|
import { NoPrerenderedRoutesWithDomains } from '../errors/errors-data.js';
|
||||||
|
|
|
@ -18,7 +18,7 @@ import {
|
||||||
runHookBuildStart,
|
runHookBuildStart,
|
||||||
runHookConfigDone,
|
runHookConfigDone,
|
||||||
runHookConfigSetup,
|
runHookConfigSetup,
|
||||||
} from '../../integrations/index.js';
|
} from '../../integrations/hooks.js';
|
||||||
import { isServerLikeOutput } from '../../prerender/utils.js';
|
import { isServerLikeOutput } from '../../prerender/utils.js';
|
||||||
import { resolveConfig } from '../config/config.js';
|
import { resolveConfig } from '../config/config.js';
|
||||||
import { createNodeLogger } from '../config/logging.js';
|
import { createNodeLogger } from '../config/logging.js';
|
||||||
|
|
|
@ -5,7 +5,7 @@ import { type Plugin as VitePlugin } from 'vite';
|
||||||
import { getAssetsPrefix } from '../../../assets/utils/getAssetsPrefix.js';
|
import { getAssetsPrefix } from '../../../assets/utils/getAssetsPrefix.js';
|
||||||
import { normalizeTheLocale } from '../../../i18n/index.js';
|
import { normalizeTheLocale } from '../../../i18n/index.js';
|
||||||
import { toRoutingStrategy } from '../../../i18n/utils.js';
|
import { toRoutingStrategy } from '../../../i18n/utils.js';
|
||||||
import { runHookBuildSsr } from '../../../integrations/index.js';
|
import { runHookBuildSsr } from '../../../integrations/hooks.js';
|
||||||
import { BEFORE_HYDRATION_SCRIPT_ID, PAGE_SCRIPT_ID } from '../../../vite-plugin-scripts/index.js';
|
import { BEFORE_HYDRATION_SCRIPT_ID, PAGE_SCRIPT_ID } from '../../../vite-plugin-scripts/index.js';
|
||||||
import type {
|
import type {
|
||||||
SSRManifestI18n,
|
SSRManifestI18n,
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { join } from 'node:path';
|
||||||
import { fileURLToPath, pathToFileURL } from 'node:url';
|
import { fileURLToPath, pathToFileURL } from 'node:url';
|
||||||
import type { Plugin as VitePlugin } from 'vite';
|
import type { Plugin as VitePlugin } from 'vite';
|
||||||
import type { AstroAdapter } from '../../../@types/astro.js';
|
import type { AstroAdapter } from '../../../@types/astro.js';
|
||||||
import { isFunctionPerRouteEnabled } from '../../../integrations/index.js';
|
import { isFunctionPerRouteEnabled } from '../../../integrations/hooks.js';
|
||||||
import { isServerLikeOutput } from '../../../prerender/utils.js';
|
import { isServerLikeOutput } from '../../../prerender/utils.js';
|
||||||
import { routeIsRedirect } from '../../redirects/index.js';
|
import { routeIsRedirect } from '../../redirects/index.js';
|
||||||
import { addRollupInput } from '../add-rollup-input.js';
|
import { addRollupInput } from '../add-rollup-input.js';
|
||||||
|
|
|
@ -17,7 +17,7 @@ import {
|
||||||
import { emptyDir, removeEmptyDirs } from '../../core/fs/index.js';
|
import { emptyDir, removeEmptyDirs } from '../../core/fs/index.js';
|
||||||
import { appendForwardSlash, prependForwardSlash, removeFileExtension } from '../../core/path.js';
|
import { appendForwardSlash, prependForwardSlash, removeFileExtension } from '../../core/path.js';
|
||||||
import { isModeServerWithNoAdapter } from '../../core/util.js';
|
import { isModeServerWithNoAdapter } from '../../core/util.js';
|
||||||
import { runHookBuildSetup } from '../../integrations/index.js';
|
import { runHookBuildSetup } from '../../integrations/hooks.js';
|
||||||
import { getOutputDirectory, isServerLikeOutput } from '../../prerender/utils.js';
|
import { getOutputDirectory, isServerLikeOutput } from '../../prerender/utils.js';
|
||||||
import { PAGE_SCRIPT_ID } from '../../vite-plugin-scripts/index.js';
|
import { PAGE_SCRIPT_ID } from '../../vite-plugin-scripts/index.js';
|
||||||
import { AstroError, AstroErrorData } from '../errors/index.js';
|
import { AstroError, AstroErrorData } from '../errors/index.js';
|
||||||
|
|
|
@ -10,7 +10,7 @@ import {
|
||||||
runHookConfigSetup,
|
runHookConfigSetup,
|
||||||
runHookServerDone,
|
runHookServerDone,
|
||||||
runHookServerStart,
|
runHookServerStart,
|
||||||
} from '../../integrations/index.js';
|
} from '../../integrations/hooks.js';
|
||||||
import { createVite } from '../create-vite.js';
|
import { createVite } from '../create-vite.js';
|
||||||
import type { Logger } from '../logger/core.js';
|
import type { Logger } from '../logger/core.js';
|
||||||
import { apply as applyPolyfill } from '../polyfill.js';
|
import { apply as applyPolyfill } from '../polyfill.js';
|
||||||
|
|
|
@ -5,7 +5,7 @@ import type { AstroInlineConfig, PreviewModule, PreviewServer } from '../../@typ
|
||||||
import { AstroIntegrationLogger } from '../../core/logger/core.js';
|
import { AstroIntegrationLogger } from '../../core/logger/core.js';
|
||||||
import { telemetry } from '../../events/index.js';
|
import { telemetry } from '../../events/index.js';
|
||||||
import { eventCliSession } from '../../events/session.js';
|
import { eventCliSession } from '../../events/session.js';
|
||||||
import { runHookConfigDone, runHookConfigSetup } from '../../integrations/index.js';
|
import { runHookConfigDone, runHookConfigSetup } from '../../integrations/hooks.js';
|
||||||
import { resolveConfig } from '../config/config.js';
|
import { resolveConfig } from '../config/config.js';
|
||||||
import { createNodeLogger } from '../config/logging.js';
|
import { createNodeLogger } from '../config/logging.js';
|
||||||
import { createSettings } from '../config/settings.js';
|
import { createSettings } from '../config/settings.js';
|
||||||
|
|
|
@ -9,7 +9,7 @@ import { createContentTypesGenerator } from '../../content/index.js';
|
||||||
import { globalContentConfigObserver } from '../../content/utils.js';
|
import { globalContentConfigObserver } from '../../content/utils.js';
|
||||||
import { telemetry } from '../../events/index.js';
|
import { telemetry } from '../../events/index.js';
|
||||||
import { eventCliSession } from '../../events/session.js';
|
import { eventCliSession } from '../../events/session.js';
|
||||||
import { runHookConfigSetup } from '../../integrations/index.js';
|
import { runHookConfigSetup } from '../../integrations/hooks.js';
|
||||||
import { setUpEnvTs } from '../../vite-plugin-inject-env-ts/index.js';
|
import { setUpEnvTs } from '../../vite-plugin-inject-env-ts/index.js';
|
||||||
import { getTimeStat } from '../build/util.js';
|
import { getTimeStat } from '../build/util.js';
|
||||||
import { resolveConfig } from '../config/config.js';
|
import { resolveConfig } from '../config/config.js';
|
||||||
|
|
|
@ -20,7 +20,7 @@ import { buildClientDirectiveEntrypoint } from '../core/client-directive/index.j
|
||||||
import { mergeConfig } from '../core/config/index.js';
|
import { mergeConfig } from '../core/config/index.js';
|
||||||
import type { AstroIntegrationLogger, Logger } from '../core/logger/core.js';
|
import type { AstroIntegrationLogger, Logger } from '../core/logger/core.js';
|
||||||
import { isServerLikeOutput } from '../prerender/utils.js';
|
import { isServerLikeOutput } from '../prerender/utils.js';
|
||||||
import { validateSupportedFeatures } from './astroFeaturesValidation.js';
|
import { validateSupportedFeatures } from './features-validation.js';
|
||||||
|
|
||||||
async function withTakingALongTimeMsg<T>({
|
async function withTakingALongTimeMsg<T>({
|
||||||
name,
|
name,
|
|
@ -4,7 +4,7 @@ import type { AstroSettings, InjectedRoute, ResolvedInjectedRoute } from '../@ty
|
||||||
import type { Logger } from '../core/logger/core.js';
|
import type { Logger } from '../core/logger/core.js';
|
||||||
|
|
||||||
import { normalizePath } from 'vite';
|
import { normalizePath } from 'vite';
|
||||||
import { runHookServerSetup } from '../integrations/index.js';
|
import { runHookServerSetup } from '../integrations/hooks.js';
|
||||||
|
|
||||||
/** Connect Astro integrations into Vite, as needed. */
|
/** Connect Astro integrations into Vite, as needed. */
|
||||||
export default function astroIntegrationsContainerPlugin({
|
export default function astroIntegrationsContainerPlugin({
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import * as assert from 'node:assert/strict';
|
import * as assert from 'node:assert/strict';
|
||||||
import { describe, it } from 'node:test';
|
import { describe, it } from 'node:test';
|
||||||
import { validateSupportedFeatures } from '../../../dist/integrations/astroFeaturesValidation.js';
|
import { validateSupportedFeatures } from '../../../dist/integrations/features-validation.js';
|
||||||
import { runHookBuildSetup, runHookConfigSetup } from '../../../dist/integrations/index.js';
|
import { runHookBuildSetup, runHookConfigSetup } from '../../../dist/integrations/hooks.js';
|
||||||
import { defaultLogger } from '../test-utils.js';
|
import { defaultLogger } from '../test-utils.js';
|
||||||
|
|
||||||
describe('Integration API', () => {
|
describe('Integration API', () => {
|
||||||
|
|
Loading…
Add table
Reference in a new issue