Skip to content

Remove "experimental" from zoneless and add prompt for new apps #30034

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@
"homepage": "https://github.com/angular/angular-cli",
"devDependencies": {
"@angular/animations": "20.0.0-next.8",
"@angular/cdk": "20.0.0-next.7",
"@angular/cdk": "20.0.0-next.8",
"@angular/common": "20.0.0-next.8",
"@angular/compiler": "20.0.0-next.8",
"@angular/compiler-cli": "20.0.0-next.8",
"@angular/core": "20.0.0-next.8",
"@angular/forms": "20.0.0-next.8",
"@angular/localize": "20.0.0-next.8",
"@angular/material": "20.0.0-next.7",
"@angular/material": "20.0.0-next.8",
"@angular/ng-dev": "https://github.com/angular/dev-infra-private-ng-dev-builds.git#a2f15a74df60d01395a3694ea1b7f9572f75343e",
"@angular/platform-browser": "20.0.0-next.8",
"@angular/platform-server": "20.0.0-next.8",
Expand Down
4 changes: 2 additions & 2 deletions packages/angular/ssr/test/testing-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
EnvironmentProviders,
Provider,
Type,
provideExperimentalZonelessChangeDetection,
provideZonelessChangeDetection,
} from '@angular/core';
import { bootstrapApplication } from '@angular/platform-browser';
import { RouterOutlet, Routes, provideRouter } from '@angular/router';
Expand Down Expand Up @@ -93,7 +93,7 @@ export function setAngularAppTestingManifest(
bootstrap: async () => () => {
return bootstrapApplication(rootComponent, {
providers: [
provideExperimentalZonelessChangeDetection(),
provideZonelessChangeDetection(),
provideRouter(routes),
provideServerRendering(withRoutes(serverRoutes)),
...extraProviders,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { NgModule, provideBrowserGlobalErrorListeners<% if(experimentalZoneless) { %>, provideExperimentalZonelessChangeDetection<% } %> } from '@angular/core';
import { NgModule, provideBrowserGlobalErrorListeners<% if(zoneless) { %>, provideZonelessChangeDetection<% } %> } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
<% if (routing) { %>
import { AppRoutingModule } from './app-routing-module';<% } %>
Expand All @@ -13,8 +13,8 @@ import { App } from './app';
AppRoutingModule<% } %>
],
providers: [
provideBrowserGlobalErrorListeners()<% if (experimentalZoneless) { %>,
provideExperimentalZonelessChangeDetection()<% } %>
provideBrowserGlobalErrorListeners()<% if (zoneless) { %>,
provideZonelessChangeDetection()<% } %>
],
bootstrap: [App]
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<% if(experimentalZoneless) { %>import { provideExperimentalZonelessChangeDetection } from '@angular/core';
<% if(zoneless) { %>import { provideZonelessChangeDetection } from '@angular/core';
<% } %>import { TestBed } from '@angular/core/testing';<% if (routing) { %>
import { RouterModule } from '@angular/router';<% } %>
import { App } from './app';
Expand All @@ -11,8 +11,8 @@ describe('App', () => {
],<% } %>
declarations: [
App
],<% if(experimentalZoneless) { %>
providers: [provideExperimentalZonelessChangeDetection()]<% } %>
],<% if(zoneless) { %>
providers: [provideZonelessChangeDetection()]<% } %>
}).compileComponents();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { AppModule } from './app/app-module';

platformBrowser().bootstrapModule(AppModule, {
<% if(!experimentalZoneless) { %>ngZoneEventCoalescing: true,<% } %><% if(!!viewEncapsulation) { %>
<% if(!zoneless) { %>ngZoneEventCoalescing: true,<% } %><% if(!!viewEncapsulation) { %>
defaultEncapsulation: ViewEncapsulation.<%= viewEncapsulation %><% } %>
})
.catch(err => console.error(err));
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { ApplicationConfig, provideBrowserGlobalErrorListeners, <% if(!experimentalZoneless) { %>provideZoneChangeDetection<% } else { %>provideExperimentalZonelessChangeDetection<% } %> } from '@angular/core';<% if (routing) { %>
import { ApplicationConfig, provideBrowserGlobalErrorListeners, <% if(!zoneless) { %>provideZoneChangeDetection<% } else { %>provideZonelessChangeDetection<% } %> } from '@angular/core';<% if (routing) { %>
import { provideRouter } from '@angular/router';

import { routes } from './app.routes';<% } %>

export const appConfig: ApplicationConfig = {
providers: [
provideBrowserGlobalErrorListeners(),
<% if(experimentalZoneless) { %>provideExperimentalZonelessChangeDetection()<% } else { %>provideZoneChangeDetection({ eventCoalescing: true })<% } %>,
<% if(zoneless) { %>provideZonelessChangeDetection()<% } else { %>provideZoneChangeDetection({ eventCoalescing: true })<% } %>,
<% if (routing) {%>provideRouter(routes)<% } %>
]
};
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<% if(experimentalZoneless) { %>import { provideExperimentalZonelessChangeDetection } from '@angular/core';
<% if(zoneless) { %>import { provideZonelessChangeDetection } from '@angular/core';
<% } %>import { TestBed } from '@angular/core/testing';
import { App } from './app';

describe('App', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [App],<% if(experimentalZoneless) { %>
providers: [provideExperimentalZonelessChangeDetection()]<% } %>
imports: [App],<% if(zoneless) { %>
providers: [provideZonelessChangeDetection()]<% } %>
}).compileComponents();
});

Expand Down
4 changes: 2 additions & 2 deletions packages/schematics/angular/application/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ function addAppToWorkspaceFile(
options: {
index: `${sourceRoot}/index.html`,
browser: `${sourceRoot}/main.ts`,
polyfills: options.experimentalZoneless ? [] : ['zone.js'],
polyfills: options.zoneless ? [] : ['zone.js'],
tsConfig: `${projectRoot}tsconfig.app.json`,
inlineStyleLanguage,
assets: [{ 'glob': '**/*', 'input': `${projectRoot}public` }],
Expand Down Expand Up @@ -297,7 +297,7 @@ function addAppToWorkspaceFile(
: {
builder: Builders.BuildKarma,
options: {
polyfills: options.experimentalZoneless ? [] : ['zone.js', 'zone.js/testing'],
polyfills: options.zoneless ? [] : ['zone.js', 'zone.js/testing'],
tsConfig: `${projectRoot}tsconfig.spec.json`,
inlineStyleLanguage,
assets: [{ 'glob': '**/*', 'input': `${projectRoot}public` }],
Expand Down
28 changes: 14 additions & 14 deletions packages/schematics/angular/application/index_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -729,70 +729,70 @@ describe('Application Schematic', () => {
);
});

it('should add provideExperimentalZonelessChangeDetection() in app-module.ts when experimentalZoneless is true', async () => {
it('should add provideZonelessChangeDetection() in app-module.ts when zoneless is true', async () => {
const tree = await schematicRunner.runSchematic(
'application',
{
...defaultOptions,
experimentalZoneless: true,
zoneless: true,
standalone: false,
},
workspaceTree,
);
const path = '/projects/foo/src/app/app-module.ts';
const fileContent = tree.readContent(path);
expect(fileContent).toContain('provideExperimentalZonelessChangeDetection()');
expect(fileContent).toContain('provideZonelessChangeDetection()');
});

it('should not add provideExperimentalZonelessChangeDetection() in app-module.ts when experimentalZoneless is false', async () => {
it('should not add provideZonelessChangeDetection() in app-module.ts when zoneless is false', async () => {
const tree = await schematicRunner.runSchematic(
'application',
{
...defaultOptions,
experimentalZoneless: false,
zoneless: false,
standalone: false,
},
workspaceTree,
);
const path = '/projects/foo/src/app/app-module.ts';
const fileContent = tree.readContent(path);
expect(fileContent).not.toContain('provideExperimentalZonelessChangeDetection()');
expect(fileContent).not.toContain('provideZonelessChangeDetection()');
});

it('should add provideExperimentalZonelessChangeDetection() when experimentalZoneless is true', async () => {
it('should add provideZonelessChangeDetection() when zoneless is true', async () => {
const tree = await schematicRunner.runSchematic(
'application',
{
...defaultOptions,
experimentalZoneless: true,
zoneless: true,
},
workspaceTree,
);
const path = '/projects/foo/src/app/app.config.ts';
const fileContent = tree.readContent(path);
expect(fileContent).toContain('provideExperimentalZonelessChangeDetection()');
expect(fileContent).toContain('provideZonelessChangeDetection()');
});

it('should not add provideExperimentalZonelessChangeDetection() when experimentalZoneless is false', async () => {
it('should not add provideZonelessChangeDetection() when zoneless is false', async () => {
const tree = await schematicRunner.runSchematic(
'application',
{
...defaultOptions,
experimentalZoneless: false,
zoneless: false,
},
workspaceTree,
);
const path = '/projects/foo/src/app/app.config.ts';
const fileContent = tree.readContent(path);
expect(fileContent).not.toContain('provideExperimentalZonelessChangeDetection()');
expect(fileContent).not.toContain('provideZonelessChangeDetection()');
});

it('should not add provideZoneChangeDetection when experimentalZoneless is true', async () => {
it('should not add provideZoneChangeDetection when zoneless is true', async () => {
const tree = await schematicRunner.runSchematic(
'application',
{
...defaultOptions,
experimentalZoneless: true,
zoneless: true,
},
workspaceTree,
);
Expand Down
3 changes: 2 additions & 1 deletion packages/schematics/angular/application/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,9 @@
"default": false,
"x-user-analytics": "ep.ng_ssr"
},
"experimentalZoneless": {
"zoneless": {
"description": "Generate an application that does not use `zone.js`.",
"x-prompt": "Do you want to create a 'zoneless' application without zone.js (Developer Preview)?",
"type": "boolean",
"default": false
}
Expand Down
2 changes: 1 addition & 1 deletion packages/schematics/angular/ng-new/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export default function (options: NgNewOptions): Rule {
minimal: options.minimal,
standalone: options.standalone,
ssr: options.ssr,
experimentalZoneless: options.experimentalZoneless,
zoneless: options.zoneless,
};

return chain([
Expand Down
3 changes: 2 additions & 1 deletion packages/schematics/angular/ng-new/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,9 @@
"type": "boolean",
"x-user-analytics": "ep.ng_ssr"
},
"experimentalZoneless": {
"zoneless": {
"description": "Create an initial application that does not utilize `zone.js`.",
"x-prompt": "Do you want to create a 'zoneless' application without zone.js (Developer Preview)?",
"type": "boolean",
"default": false
}
Expand Down
Loading
Loading