diff --git a/packages/astro/src/manifest/virtual-module.ts b/packages/astro/src/manifest/virtual-module.ts index 348779c6b10e..9142bfe99055 100644 --- a/packages/astro/src/manifest/virtual-module.ts +++ b/packages/astro/src/manifest/virtual-module.ts @@ -80,7 +80,7 @@ const cacheDir = new URL(manifest.cacheDir); const outDir = new URL(manifest.outDir); const publicDir = new URL(manifest.publicDir); const srcDir = new URL(manifest.srcDir); -const root = new URL(manifest.hrefRoot); +const root = new URL(manifest.rootDir); const trailingSlash = manifest.trailingSlash; const site = manifest.site; const compressHTML = manifest.compressHTML; diff --git a/packages/astro/src/vite-plugin-hmr-reload/index.ts b/packages/astro/src/vite-plugin-hmr-reload/index.ts index c5ff20edcb76..cf151eef6605 100644 --- a/packages/astro/src/vite-plugin-hmr-reload/index.ts +++ b/packages/astro/src/vite-plugin-hmr-reload/index.ts @@ -1,4 +1,4 @@ -import { type EnvironmentModuleNode, type Plugin } from 'vite'; +import type { EnvironmentModuleNode, Plugin } from 'vite'; /** * The very last Vite plugin to reload the browser if any SSR-only module are updated diff --git a/packages/astro/test/units/routing/route-matching.test.js b/packages/astro/test/units/routing/route-matching.test.js index 9e878d2d1d9f..2582ac29f759 100644 --- a/packages/astro/test/units/routing/route-matching.test.js +++ b/packages/astro/test/units/routing/route-matching.test.js @@ -5,7 +5,7 @@ import { createContainer } from '../../../dist/core/dev/container.js'; import { createViteLoader } from '../../../dist/core/module-loader/vite.js'; import { createRoutesList, matchAllRoutes } from '../../../dist/core/routing/index.js'; import { getSortedPreloadedMatches } from '../../../dist/prerender/routing.js'; -import { DevPipeline } from '../../../dist/vite-plugin-astro-server/pipeline.js'; +import { AstroServerPipeline } from '../../../dist/vite-plugin-app/pipeline.js'; import { createDevelopmentManifest } from '../../../dist/vite-plugin-astro-server/plugin.js'; import testAdapter from '../../test-adapter.js'; import { @@ -127,6 +127,7 @@ describe('Route matching', () => { let manifestData; let container; let settings; + let manifest; before(async () => { const fixture = await createFixture(fileSystem); @@ -142,8 +143,7 @@ describe('Route matching', () => { }); const loader = createViteLoader(container.viteServer); - const manifest = createDevelopmentManifest(container.settings); - pipeline = DevPipeline.create(undefined, { loader, logger: defaultLogger, manifest, settings }); + manifest = createDevelopmentManifest(container.settings); manifestData = await createRoutesList( { cwd: fixture.path, @@ -151,6 +151,12 @@ describe('Route matching', () => { }, defaultLogger, ); + pipeline = AstroServerPipeline.create(manifestData, { + loader, + logger: defaultLogger, + manifest, + settings, + }); }); after(async () => { @@ -160,7 +166,12 @@ describe('Route matching', () => { describe('Matched routes', () => { it('should be sorted correctly', async () => { const matches = matchAllRoutes('/try-matching-a-route', manifestData); - const preloadedMatches = await getSortedPreloadedMatches({ pipeline, matches, settings }); + const preloadedMatches = await getSortedPreloadedMatches({ + pipeline, + matches, + settings, + manifest, + }); const sortedRouteNames = preloadedMatches.map((match) => match.route.route); assert.deepEqual(sortedRouteNames, [ @@ -174,7 +185,12 @@ describe('Route matching', () => { }); it('nested should be sorted correctly', async () => { const matches = matchAllRoutes('/nested/try-matching-a-route', manifestData); - const preloadedMatches = await getSortedPreloadedMatches({ pipeline, matches, settings }); + const preloadedMatches = await getSortedPreloadedMatches({ + pipeline, + matches, + settings, + manifest, + }); const sortedRouteNames = preloadedMatches.map((match) => match.route.route); assert.deepEqual(sortedRouteNames, [ diff --git a/packages/astro/test/units/test-utils.js b/packages/astro/test/units/test-utils.js index 6132a2a4354d..5f7326d50d0c 100644 --- a/packages/astro/test/units/test-utils.js +++ b/packages/astro/test/units/test-utils.js @@ -105,7 +105,7 @@ export function createBasicPipeline(options = {}) { const pipeline = new Pipeline( options.logger ?? defaultLogger, options.manifest ?? { - hrefRoot: import.meta.url, + rootDir: import.meta.url, }, options.mode ?? 'development', options.renderers ?? [], diff --git a/packages/astro/test/units/vite-plugin-astro-server/request.test.js b/packages/astro/test/units/vite-plugin-astro-server/request.test.js index 92b0c019bb97..933b41c5b69b 100644 --- a/packages/astro/test/units/vite-plugin-astro-server/request.test.js +++ b/packages/astro/test/units/vite-plugin-astro-server/request.test.js @@ -5,7 +5,8 @@ import { createContainer } from '../../../dist/core/dev/container.js'; import { createLoader } from '../../../dist/core/module-loader/index.js'; import { createRoutesList } from '../../../dist/core/routing/index.js'; import { createComponent, render } from '../../../dist/runtime/server/index.js'; -import { createController, DevApp } from '../../../dist/vite-plugin-astro-server/index.js'; +import { AstroServerApp } from '../../../dist/vite-plugin-app/app.js'; +import { createController } from '../../../dist/vite-plugin-astro-server/index.js'; import { createDevelopmentManifest } from '../../../dist/vite-plugin-astro-server/plugin.js'; import testAdapter from '../../test-adapter.js'; import { @@ -18,7 +19,7 @@ import { async function createDevApp(overrides = {}, root) { const settings = overrides.settings ?? (await createBasicSettings({ root })); - const loader = overrides.loader ?? createLoader(); + const loader = overrides.loader ?? createLoader({}); const manifest = createDevelopmentManifest(settings); const routesList = await createRoutesList( { @@ -43,7 +44,7 @@ async function createDevApp(overrides = {}, root) { // TODO: temporarily inject route list inside manifest - return new DevApp(manifest, true, settings, defaultLogger, loader, routesList); + return new AstroServerApp(manifest, true, defaultLogger, routesList, loader, settings); } describe('vite-plugin-astro-server', () => { diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index dba0afa5e67b..3a6304fd851c 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -12,4 +12,3 @@ packages: # Wait until three days after release to install new versions of packages minimumReleaseAge: 4320 -