diff --git a/packages/angular/build/src/builders/dev-server/vite-server.ts b/packages/angular/build/src/builders/dev-server/vite-server.ts index c42e3a8ea940..6c279b50c750 100644 --- a/packages/angular/build/src/builders/dev-server/vite-server.ts +++ b/packages/angular/build/src/builders/dev-server/vite-server.ts @@ -14,14 +14,14 @@ import { readFile } from 'node:fs/promises'; import { builtinModules, isBuiltin } from 'node:module'; import { join } from 'node:path'; import type { Connect, DepOptimizationConfig, InlineConfig, ViteDevServer } from 'vite'; -import { createAngularMemoryPlugin } from '../../tools/vite/angular-memory-plugin'; -import { createAngularLocaleDataPlugin } from '../../tools/vite/i18n-locale-plugin'; -import { createRemoveIdPrefixPlugin } from '../../tools/vite/id-prefix-plugin'; import { ServerSsrMode, + createAngularLocaleDataPlugin, + createAngularMemoryPlugin, createAngularSetupMiddlewaresPlugin, -} from '../../tools/vite/setup-middlewares-plugin'; -import { createAngularSsrServerPlugin } from '../../tools/vite/ssr-server-plugin'; + createAngularSsrTransformPlugin, + createRemoveIdPrefixPlugin, +} from '../../tools/vite/plugins'; import { loadProxyConfiguration, normalizeSourceMaps } from '../../utils'; import { loadEsmModule } from '../../utils/load-esm'; import { Result, ResultFile, ResultKind } from '../application/results'; @@ -662,7 +662,7 @@ export async function setupServer( ssrMode, }), createRemoveIdPrefixPlugin(externalMetadata.explicitBrowser), - await createAngularSsrServerPlugin(serverOptions.workspaceRoot), + await createAngularSsrTransformPlugin(serverOptions.workspaceRoot), await createAngularMemoryPlugin({ virtualProjectRoot, outputFiles, diff --git a/packages/angular/build/src/tools/vite/angular-memory-plugin.ts b/packages/angular/build/src/tools/vite/plugins/angular-memory-plugin.ts similarity index 96% rename from packages/angular/build/src/tools/vite/angular-memory-plugin.ts rename to packages/angular/build/src/tools/vite/plugins/angular-memory-plugin.ts index 848c2dc4ff45..9d6510588ffa 100644 --- a/packages/angular/build/src/tools/vite/angular-memory-plugin.ts +++ b/packages/angular/build/src/tools/vite/plugins/angular-memory-plugin.ts @@ -10,10 +10,10 @@ import assert from 'node:assert'; import { readFile } from 'node:fs/promises'; import { basename, dirname, join, relative } from 'node:path'; import type { Plugin } from 'vite'; -import { loadEsmModule } from '../../utils/load-esm'; -import { AngularMemoryOutputFiles } from './utils'; +import { loadEsmModule } from '../../../utils/load-esm'; +import { AngularMemoryOutputFiles } from '../utils'; -export interface AngularMemoryPluginOptions { +interface AngularMemoryPluginOptions { virtualProjectRoot: string; outputFiles: AngularMemoryOutputFiles; external?: string[]; diff --git a/packages/angular/build/src/tools/vite/i18n-locale-plugin.ts b/packages/angular/build/src/tools/vite/plugins/i18n-locale-plugin.ts similarity index 96% rename from packages/angular/build/src/tools/vite/i18n-locale-plugin.ts rename to packages/angular/build/src/tools/vite/plugins/i18n-locale-plugin.ts index 6b6eec3c0b4d..5cf3762245a5 100644 --- a/packages/angular/build/src/tools/vite/i18n-locale-plugin.ts +++ b/packages/angular/build/src/tools/vite/plugins/i18n-locale-plugin.ts @@ -11,7 +11,7 @@ import type { Plugin } from 'vite'; /** * The base module location used to search for locale specific data. */ -export const LOCALE_DATA_BASE_MODULE = '@angular/common/locales/global'; +const LOCALE_DATA_BASE_MODULE = '@angular/common/locales/global'; /** * Creates a Vite plugin that resolves Angular locale data files from `@angular/common`. diff --git a/packages/angular/build/src/tools/vite/id-prefix-plugin.ts b/packages/angular/build/src/tools/vite/plugins/id-prefix-plugin.ts similarity index 100% rename from packages/angular/build/src/tools/vite/id-prefix-plugin.ts rename to packages/angular/build/src/tools/vite/plugins/id-prefix-plugin.ts diff --git a/packages/angular/build/src/tools/vite/plugins/index.ts b/packages/angular/build/src/tools/vite/plugins/index.ts new file mode 100644 index 000000000000..50a6ab6aa7c9 --- /dev/null +++ b/packages/angular/build/src/tools/vite/plugins/index.ts @@ -0,0 +1,13 @@ +/** + * @license + * Copyright Google LLC All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.dev/license + */ + +export { createAngularMemoryPlugin } from './angular-memory-plugin'; +export { createAngularLocaleDataPlugin } from './i18n-locale-plugin'; +export { createRemoveIdPrefixPlugin } from './id-prefix-plugin'; +export { createAngularSetupMiddlewaresPlugin, ServerSsrMode } from './setup-middlewares-plugin'; +export { createAngularSsrTransformPlugin } from './ssr-transform-plugin'; diff --git a/packages/angular/build/src/tools/vite/setup-middlewares-plugin.ts b/packages/angular/build/src/tools/vite/plugins/setup-middlewares-plugin.ts similarity index 95% rename from packages/angular/build/src/tools/vite/setup-middlewares-plugin.ts rename to packages/angular/build/src/tools/vite/plugins/setup-middlewares-plugin.ts index d7b6e6fa870a..3f8611223c1c 100644 --- a/packages/angular/build/src/tools/vite/setup-middlewares-plugin.ts +++ b/packages/angular/build/src/tools/vite/plugins/setup-middlewares-plugin.ts @@ -14,8 +14,8 @@ import { createAngularIndexHtmlMiddleware, createAngularSsrExternalMiddleware, createAngularSsrInternalMiddleware, -} from './middlewares'; -import { AngularMemoryOutputFiles } from './utils'; +} from '../middlewares'; +import { AngularMemoryOutputFiles } from '../utils'; export enum ServerSsrMode { /** @@ -42,7 +42,7 @@ export enum ServerSsrMode { ExternalSsrMiddleware, } -export interface AngularSetupMiddlewaresPluginOptions { +interface AngularSetupMiddlewaresPluginOptions { outputFiles: AngularMemoryOutputFiles; assets: Map; extensionMiddleware?: Connect.NextHandleFunction[]; diff --git a/packages/angular/build/src/tools/vite/ssr-server-plugin.ts b/packages/angular/build/src/tools/vite/plugins/ssr-transform-plugin.ts similarity index 86% rename from packages/angular/build/src/tools/vite/ssr-server-plugin.ts rename to packages/angular/build/src/tools/vite/plugins/ssr-transform-plugin.ts index afc88be32a7b..0b164dee5b46 100644 --- a/packages/angular/build/src/tools/vite/ssr-server-plugin.ts +++ b/packages/angular/build/src/tools/vite/plugins/ssr-transform-plugin.ts @@ -8,13 +8,13 @@ import remapping, { SourceMapInput } from '@ampproject/remapping'; import type { Plugin } from 'vite'; -import { loadEsmModule } from '../../utils/load-esm'; +import { loadEsmModule } from '../../../utils/load-esm'; -export async function createAngularSsrServerPlugin(workspaceRoot: string): Promise { +export async function createAngularSsrTransformPlugin(workspaceRoot: string): Promise { const { normalizePath } = await loadEsmModule('vite'); return { - name: 'vite:angular-ssr-server', + name: 'vite:angular-ssr-transform', enforce: 'pre', async configureServer(server) { const originalssrTransform = server.ssrTransform;