Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions packages/angular/ssr/node/src/app-engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ import { createWebRequestFromNodeRequest } from './request';
*
* @remarks This class should be instantiated once and used as a singleton across the server-side
* application to ensure consistent handling of rendering requests and resource management.
*
* @developerPreview
*/
export class AngularNodeAppEngine {
private readonly angularAppEngine = new AngularAppEngine();
Expand Down
2 changes: 0 additions & 2 deletions packages/angular/ssr/node/src/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import type { IncomingMessage, ServerResponse } from 'node:http';
* @param next - A callback function that signals the completion of the middleware or forwards the error if provided.
*
* @returns A Promise that resolves to void or simply void. The handler can be asynchronous.
* @developerPreview
*/
export type NodeRequestHandlerFunction = (
req: IncomingMessage,
Expand Down Expand Up @@ -66,7 +65,6 @@ export type NodeRequestHandlerFunction = (
* res.send('Hello from Fastify with Node Next Handler!');
* }));
* ```
* @developerPreview
*/
export function createNodeRequestHandler<T extends NodeRequestHandlerFunction>(handler: T): T {
(handler as T & { __ng_node_request_handler__?: boolean })['__ng_node_request_handler__'] = true;
Expand Down
1 change: 0 additions & 1 deletion packages/angular/ssr/node/src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import { fileURLToPath } from 'node:url';
*
* @param url The URL of the module to check. This should typically be `import.meta.url`.
* @returns `true` if the provided URL represents the main entry point, otherwise `false`.
* @developerPreview
*/
export function isMainModule(url: string): boolean {
return url.startsWith('file:') && argv[1] === fileURLToPath(url);
Expand Down
1 change: 0 additions & 1 deletion packages/angular/ssr/node/src/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ const HTTP2_PSEUDO_HEADERS = new Set([':method', ':scheme', ':authority', ':path
*
* @param nodeRequest - The Node.js request object (`IncomingMessage` or `Http2ServerRequest`) to convert.
* @returns A Web Standard `Request` object.
* @developerPreview
*/
export function createWebRequestFromNodeRequest(
nodeRequest: IncomingMessage | Http2ServerRequest,
Expand Down
1 change: 0 additions & 1 deletion packages/angular/ssr/node/src/response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import type { Http2ServerResponse } from 'node:http2';
* @param source - The web-standard `Response` object to stream from.
* @param destination - The Node.js response object (`ServerResponse` or `Http2ServerResponse`) to stream into.
* @returns A promise that resolves once the streaming operation is complete.
* @developerPreview
*/
export async function writeResponseToNodeResponse(
source: Response,
Expand Down
1 change: 0 additions & 1 deletion packages/angular/ssr/schematics/ng-add/index_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { join } from 'node:path';
describe('@angular/ssr ng-add schematic', () => {
const defaultOptions = {
project: 'test-app',
serverRouting: false,
};

const schematicRunner = new SchematicTestRunner(
Expand Down
4 changes: 0 additions & 4 deletions packages/angular/ssr/schematics/ng-add/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@
"description": "Skip the automatic installation of packages. You will need to manually install the dependencies later.",
"type": "boolean",
"default": false
},
"serverRouting": {
"description": "Configure the server application to use the Angular Server Routing API and App Engine APIs (currently in Developer Preview).",
"type": "boolean"
}
},
"required": ["project"],
Expand Down
2 changes: 0 additions & 2 deletions packages/angular/ssr/src/app-engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ import { joinUrlParts } from './utils/url';
*
* @remarks This class should be instantiated once and used as a singleton across the server-side
* application to ensure consistent handling of rendering requests and resource management.
*
* @developerPreview
*/
export class AngularAppEngine {
/**
Expand Down
2 changes: 0 additions & 2 deletions packages/angular/ssr/src/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
* @param request - The incoming HTTP request object.
* @returns A Promise resolving to a `Response` object, `null`, or directly a `Response`,
* supporting both synchronous and asynchronous handling.
* @developerPreview
*/
export type RequestHandlerFunction = (
request: Request,
Expand All @@ -39,7 +38,6 @@ export type RequestHandlerFunction = (
* const handler = toWebHandler(app);
* export default createRequestHandler(handler);
* ```
* @developerPreview
*/
export function createRequestHandler(handler: RequestHandlerFunction): RequestHandlerFunction {
(handler as RequestHandlerFunction & { __ng_request_handler__?: boolean })[
Expand Down
11 changes: 0 additions & 11 deletions packages/angular/ssr/src/routes/route-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ const APP_SHELL_ROUTE = 'ng-app-shell';
/**
* Identifies a particular kind of `ServerRoutesFeatureKind`.
* @see {@link ServerRoutesFeature}
* @developerPreview
*/
enum ServerRoutesFeatureKind {
AppShell,
Expand All @@ -33,7 +32,6 @@ enum ServerRoutesFeatureKind {
/**
* Helper type to represent a server routes feature.
* @see {@link ServerRoutesFeatureKind}
* @developerPreview
*/
interface ServerRoutesFeature<FeatureKind extends ServerRoutesFeatureKind> {
ɵkind: FeatureKind;
Expand All @@ -44,7 +42,6 @@ interface ServerRoutesFeature<FeatureKind extends ServerRoutesFeatureKind> {
* Different rendering modes for server routes.
* @see {@link provideServerRouting}
* @see {@link ServerRoute}
* @developerPreview
*/
export enum RenderMode {
/** Server-Side Rendering (SSR) mode, where content is rendered on the server for each request. */
Expand All @@ -61,7 +58,6 @@ export enum RenderMode {
* Defines the fallback strategies for Static Site Generation (SSG) routes when a pre-rendered path is not available.
* This is particularly relevant for routes with parameterized URLs where some paths might not be pre-rendered at build time.
* @see {@link ServerRoutePrerenderWithParams}
* @developerPreview
*/
export enum PrerenderFallback {
/**
Expand All @@ -85,7 +81,6 @@ export enum PrerenderFallback {

/**
* Common interface for server routes, providing shared properties.
* @developerPreview
*/
export interface ServerRouteCommon {
/** The path associated with this route. */
Expand All @@ -101,7 +96,6 @@ export interface ServerRouteCommon {
/**
* A server route that uses Client-Side Rendering (CSR) mode.
* @see {@link RenderMode}
* @developerPreview
*/
export interface ServerRouteClient extends ServerRouteCommon {
/** Specifies that the route uses Client-Side Rendering (CSR) mode. */
Expand All @@ -111,7 +105,6 @@ export interface ServerRouteClient extends ServerRouteCommon {
/**
* A server route that uses Static Site Generation (SSG) mode.
* @see {@link RenderMode}
* @developerPreview
*/
export interface ServerRoutePrerender extends Omit<ServerRouteCommon, 'status'> {
/** Specifies that the route uses Static Site Generation (SSG) mode. */
Expand All @@ -126,7 +119,6 @@ export interface ServerRoutePrerender extends Omit<ServerRouteCommon, 'status'>
* @see {@link RenderMode}
* @see {@link ServerRoutePrerender}
* @see {@link PrerenderFallback}
* @developerPreview
*/
export interface ServerRoutePrerenderWithParams extends Omit<ServerRoutePrerender, 'fallback'> {
/**
Expand Down Expand Up @@ -171,7 +163,6 @@ export interface ServerRoutePrerenderWithParams extends Omit<ServerRoutePrerende
/**
* A server route that uses Server-Side Rendering (SSR) mode.
* @see {@link RenderMode}
* @developerPreview
*/
export interface ServerRouteServer extends ServerRouteCommon {
/** Specifies that the route uses Server-Side Rendering (SSR) mode. */
Expand All @@ -181,7 +172,6 @@ export interface ServerRouteServer extends ServerRouteCommon {
/**
* Server route configuration.
* @see {@link provideServerRouting}
* @developerPreview
*/
export type ServerRoute =
| ServerRouteClient
Expand Down Expand Up @@ -221,7 +211,6 @@ export const SERVER_ROUTES_CONFIG = new InjectionToken<ServerRoutesConfig>('SERV
*
* @see {@link ServerRoute}
* @see {@link withAppShell}
* @developerPreview
*/
export function provideServerRouting(
routes: ServerRoute[],
Expand Down
39 changes: 10 additions & 29 deletions packages/schematics/angular/app-shell/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ import {
} from '../utility/ast-utils';
import { applyToUpdateRecorder } from '../utility/change';
import { getAppModulePath, isStandaloneApp } from '../utility/ng-ast-utils';
import { isUsingApplicationBuilder, targetBuildNotFoundError } from '../utility/project-targets';
import { findBootstrapApplicationCall, getMainFilePath } from '../utility/standalone/util';
import { getWorkspace, updateWorkspace } from '../utility/workspace';
import { Builders } from '../utility/workspace-models';
import { getWorkspace } from '../utility/workspace';
import { Schema as AppShellOptions } from './schema';

const APP_SHELL_ROUTE = 'shell';
Expand Down Expand Up @@ -156,29 +156,6 @@ function getMetadataProperty(metadata: ts.Node, propertyName: string): ts.Proper
return property;
}

function addAppShellConfigToWorkspace(options: AppShellOptions): Rule {
return updateWorkspace((workspace) => {
const project = workspace.projects.get(options.project);
if (!project) {
return;
}
const buildTarget = project.targets.get('build');
if (
buildTarget?.builder === Builders.Application ||
buildTarget?.builder === Builders.BuildApplication
) {
// Application builder configuration.
const prodConfig = buildTarget.configurations?.production;
if (!prodConfig) {
throw new SchematicsException(
`A "production" configuration is not defined for the "build" builder.`,
);
}
prodConfig.appShell = true;
}
});
}

function addServerRoutes(options: AppShellOptions): Rule {
return async (host: Tree) => {
// The workspace gets updated so this needs to be reloaded
Expand Down Expand Up @@ -359,17 +336,21 @@ export default function (options: AppShellOptions): Rule {
const browserEntryPoint = await getMainFilePath(tree, options.project);
const isStandalone = isStandaloneApp(tree, browserEntryPoint);

const workspace = await getWorkspace(tree);
const project = workspace.projects.get(options.project);
if (!project) {
throw targetBuildNotFoundError();
}

return chain([
validateProject(browserEntryPoint),
schematic('server', options),
...(options.serverRouting
...(isUsingApplicationBuilder(project)
? [noop()]
: isStandalone
? [addStandaloneServerRoute(options)]
: [addServerRoutes(options)]),
options.serverRouting
? addServerRoutingConfig(options, isStandalone)
: addAppShellConfigToWorkspace(options),
addServerRoutingConfig(options, isStandalone),
schematic('component', {
name: 'app-shell',
module: 'app.module.server.ts',
Expand Down
1 change: 0 additions & 1 deletion packages/schematics/angular/app-shell/index_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ describe('App Shell Schematic', () => {
);
const defaultOptions: AppShellOptions = {
project: 'bar',
serverRouting: true,
};

const workspaceOptions: WorkspaceOptions = {
Expand Down
5 changes: 0 additions & 5 deletions packages/schematics/angular/app-shell/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@
"$default": {
"$source": "projectName"
}
},
"serverRouting": {
"description": "Set up a server application using the Server Routing and App Engine APIs (Developer Preview).",
"type": "boolean",
"default": false
}
},
"required": ["project"]
Expand Down
1 change: 0 additions & 1 deletion packages/schematics/angular/application/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ export default function (options: ApplicationOptions): Rule {
options.ssr
? schematic('ssr', {
project: options.name,
serverRouting: options.serverRouting,
skipInstall: true,
})
: noop(),
Expand Down
1 change: 0 additions & 1 deletion packages/schematics/angular/application/index_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ describe('Application Schematic', () => {
const defaultOptions: ApplicationOptions = {
name: 'foo',
skipPackageJson: false,
serverRouting: false,
};

let workspaceTree: UnitTestTree;
Expand Down
4 changes: 0 additions & 4 deletions packages/schematics/angular/application/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,6 @@
"default": false,
"x-user-analytics": "ep.ng_ssr"
},
"serverRouting": {
"description": "Set up a server application using the Server Routing and App Engine APIs (Developer Preview).",
"type": "boolean"
},
"experimentalZoneless": {
"description": "Generate an application that does not use `zone.js`.",
"type": "boolean",
Expand Down
1 change: 0 additions & 1 deletion packages/schematics/angular/ng-new/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ export default function (options: NgNewOptions): Rule {
minimal: options.minimal,
standalone: options.standalone,
ssr: options.ssr,
serverRouting: options.serverRouting,
experimentalZoneless: options.experimentalZoneless,
};

Expand Down
4 changes: 0 additions & 4 deletions packages/schematics/angular/ng-new/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,6 @@
"type": "boolean",
"x-user-analytics": "ep.ng_ssr"
},
"serverRouting": {
"description": "Create a server application in the initial project using the Server Routing and App Engine APIs (Developer Preview).",
"type": "boolean"
},
"experimentalZoneless": {
"description": "Create an initial application that does not utilize `zone.js`.",
"type": "boolean",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { NgModule } from '@angular/core';
import { ServerModule } from '@angular/platform-server';<% if(serverRouting) { %>
import { provideServerRouting } from '@angular/ssr';<% } %>
import { ServerModule } from '@angular/platform-server';
import { provideServerRouting } from '@angular/ssr';
import { AppComponent } from './app.component';
import { AppModule } from './app.module';<% if(serverRouting) { %>
import { serverRoutes } from './app.routes.server';<% } %>
import { AppModule } from './app.module';
import { serverRoutes } from './app.routes.server';

@NgModule({
imports: [AppModule, ServerModule],<% if(serverRouting) { %>
providers: [provideServerRouting(serverRoutes)],<% } %>
imports: [AppModule, ServerModule],
providers: [provideServerRouting(serverRoutes)],
bootstrap: [AppComponent],
})
export class AppServerModule {}
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { mergeApplicationConfig, ApplicationConfig } from '@angular/core';
import { provideServerRendering } from '@angular/platform-server';<% if(serverRouting) { %>
import { provideServerRouting } from '@angular/ssr';<% } %>
import { appConfig } from './app.config';<% if(serverRouting) { %>
import { serverRoutes } from './app.routes.server';<% } %>
import { provideServerRendering } from '@angular/platform-server';
import { provideServerRouting } from '@angular/ssr';
import { appConfig } from './app.config';
import { serverRoutes } from './app.routes.server';

const serverConfig: ApplicationConfig = {
providers: [
provideServerRendering(),<% if(serverRouting) { %>
provideServerRouting(serverRoutes)<% } %>
provideServerRendering(),
provideServerRouting(serverRoutes)
]
};

Expand Down
Loading