id
stringlengths 6
6
| text
stringlengths 20
17.2k
| title
stringclasses 1
value |
|---|---|---|
000077
|
import { match } from 'node:assert';
import { createProjectFromAsset } from '../../utils/assets';
import {
expectFileMatchToExist,
expectFileNotToExist,
expectFileToExist,
expectFileToMatch,
} from '../../utils/fs';
import { execAndWaitForOutputToMatch, ng, noSilentNg } from '../../utils/process';
import { findFreePort } from '../../utils/network';
export default async function () {
await createProjectFromAsset('19-ssr-project-webpack', false, false);
await ng('update', `@angular/cli`, '--name=use-application-builder');
await Promise.all([
expectFileNotToExist('tsconfig.server.json'),
expectFileToMatch('tsconfig.json', 'esModuleInterop'),
expectFileToMatch('src/server.ts', 'import.meta.url'),
]);
// Verify project now creates bundles
await noSilentNg('build', '--configuration=production');
await Promise.all([
expectFileToExist('dist/18-ssr-project-webpack/server/server.mjs'),
expectFileMatchToExist('dist/18-ssr-project-webpack/browser', /main-[a-zA-Z0-9]{8}\.js/),
]);
// Verify that the app runs
const port = await findFreePort();
await execAndWaitForOutputToMatch('ng', ['serve', '--port', String(port)], /complete\./);
const response = await fetch(`http://localhost:${port}/`);
const text = await response.text();
match(text, /app is running!/);
}
| |
000090
|
import assert from 'node:assert';
import { setTimeout } from 'node:timers/promises';
import { replaceInFile, writeMultipleFiles } from '../../utils/fs';
import { ng, silentNg, waitForAnyProcessOutputToMatch } from '../../utils/process';
import { installWorkspacePackages, uninstallPackage } from '../../utils/packages';
import { ngServe, updateJsonFile, useSha } from '../../utils/project';
import { getGlobalVariable } from '../../utils/env';
export default async function () {
assert(
getGlobalVariable('argv')['esbuild'],
'This test should not be called in the Webpack suite.',
);
// Forcibly remove in case another test doesn't clean itself up.
await uninstallPackage('@angular/ssr');
await ng('add', '@angular/ssr', '--server-routing', '--skip-confirmation', '--skip-install');
await useSha();
await installWorkspacePackages();
// Update angular.json
await updateJsonFile('angular.json', (workspaceJson) => {
const appArchitect = workspaceJson.projects['test-project'].architect;
const options = appArchitect.build.options;
options.outputMode = 'server';
});
await writeMultipleFiles({
// Replace the template of app.component.html as it makes it harder to debug
'src/app/app.component.html': '<router-outlet />',
'src/app/app.routes.ts': `
import { Routes } from '@angular/router';
import { HomeComponent } from './home/home.component';
export const routes: Routes = [
{ path: 'home', component: HomeComponent }
];
`,
'src/app/app.routes.server.ts': `
import { RenderMode, ServerRoute } from '@angular/ssr';
export const serverRoutes: ServerRoute[] = [
{ path: '**', renderMode: RenderMode.Server }
];
`,
'src/server.ts': `
import { AngularNodeAppEngine, writeResponseToNodeResponse, isMainModule, createNodeRequestHandler } from '@angular/ssr/node';
import express from 'express';
import { fileURLToPath } from 'node:url';
import { dirname, resolve } from 'node:path';
export function app(): express.Express {
const server = express();
const serverDistFolder = dirname(fileURLToPath(import.meta.url));
const browserDistFolder = resolve(serverDistFolder, '../browser');
const angularNodeAppEngine = new AngularNodeAppEngine();
server.use('/api/**', (req, res) => res.json({ hello: 'foo' }));
server.get('**', express.static(browserDistFolder, {
maxAge: '1y',
index: 'index.html'
}));
server.get('**', (req, res, next) => {
angularNodeAppEngine.render(req)
.then((response) => response ? writeResponseToNodeResponse(response, res) : next())
.catch(next);
});
return server;
}
const server = app();
if (isMainModule(import.meta.url)) {
const port = process.env['PORT'] || 4000;
server.listen(port, () => {
console.log(\`Node Express server listening on http://localhost:\${port}\`);
});
}
export const reqHandler = createNodeRequestHandler(server);
`,
});
await silentNg('generate', 'component', 'home');
const port = await ngServe();
// Verify the server is running and the API response is correct.
await validateResponse('/main.js', /bootstrapApplication/);
await validateResponse('/api/test', /foo/);
await validateResponse('/home', /home works/);
// Modify the home component and validate the change.
await modifyFileAndWaitUntilUpdated(
'src/app/home/home.component.html',
'home works',
'yay home works!!!',
);
await validateResponse('/api/test', /foo/);
await validateResponse('/home', /yay home works/);
// Modify the API response and validate the change.
await modifyFileAndWaitUntilUpdated('src/server.ts', `{ hello: 'foo' }`, `{ hello: 'bar' }`);
await validateResponse('/api/test', /bar/);
await validateResponse('/home', /yay home works/);
async function validateResponse(pathname: string, match: RegExp): Promise<void> {
const response = await fetch(new URL(pathname, `http://localhost:${port}`));
const text = await response.text();
assert.match(text, match);
assert.equal(response.status, 200);
}
}
async function modifyFileAndWaitUntilUpdated(
filePath: string,
searchValue: string,
replaceValue: string,
): Promise<void> {
await Promise.all([
waitForAnyProcessOutputToMatch(/Page reload sent to client/),
setTimeout(100).then(() => replaceInFile(filePath, searchValue, replaceValue)),
]);
}
| |
000095
|
import assert from 'node:assert';
import { setTimeout } from 'node:timers/promises';
import { replaceInFile, writeMultipleFiles } from '../../utils/fs';
import { ng, silentNg, waitForAnyProcessOutputToMatch } from '../../utils/process';
import { installPackage, installWorkspacePackages, uninstallPackage } from '../../utils/packages';
import { ngServe, updateJsonFile, useSha } from '../../utils/project';
import { getGlobalVariable } from '../../utils/env';
export default async function () {
assert(
getGlobalVariable('argv')['esbuild'],
'This test should not be called in the Webpack suite.',
);
// Forcibly remove in case another test doesn't clean itself up.
await uninstallPackage('@angular/ssr');
await ng('add', '@angular/ssr', '--server-routing', '--skip-confirmation', '--skip-install');
await useSha();
await installWorkspacePackages();
await installPackage('fastify@5');
// Update angular.json
await updateJsonFile('angular.json', (workspaceJson) => {
const appArchitect = workspaceJson.projects['test-project'].architect;
const options = appArchitect.build.options;
options.outputMode = 'server';
});
await writeMultipleFiles({
// Replace the template of app.component.html as it makes it harder to debug
'src/app/app.component.html': '<router-outlet />',
'src/app/app.routes.ts': `
import { Routes } from '@angular/router';
import { HomeComponent } from './home/home.component';
export const routes: Routes = [
{ path: 'home', component: HomeComponent }
];
`,
'src/app/app.routes.server.ts': `
import { RenderMode, ServerRoute } from '@angular/ssr';
export const serverRoutes: ServerRoute[] = [
{ path: '**', renderMode: RenderMode.Server }
];
`,
'src/server.ts': `
import { AngularNodeAppEngine, writeResponseToNodeResponse, isMainModule, createNodeRequestHandler } from '@angular/ssr/node';
import fastify from 'fastify';
export function app() {
const server = fastify();
const angularNodeAppEngine = new AngularNodeAppEngine();
server.get('/api/*', (req, reply) => reply.send({ hello: 'foo' }));
server.get('*', async (req, reply) => {
try {
const response = await angularNodeAppEngine.render(req.raw);
if (response) {
await writeResponseToNodeResponse(response, reply.raw);
} else {
reply.callNotFound();
}
} catch (error) {
reply.send(error);
}
});
return server;
}
const server = app();
if (isMainModule(import.meta.url)) {
const port = +(process.env['PORT'] || 4000);
server.listen({ port }, () => {
console.log(\`Fastify server listening on http://localhost:\${port}\`);
});
}
export const reqHandler = createNodeRequestHandler(async (req, res) => {
await server.ready();
server.server.emit('request', req, res);
});
`,
});
await silentNg('generate', 'component', 'home');
const port = await ngServe();
// Verify the server is running and the API response is correct.
await validateResponse('/main.js', /bootstrapApplication/);
await validateResponse('/api/test', /foo/);
await validateResponse('/home', /home works/);
// Modify the home component and validate the change.
await modifyFileAndWaitUntilUpdated(
'src/app/home/home.component.html',
'home works',
'yay home works!!!',
);
await validateResponse('/api/test', /foo/);
await validateResponse('/home', /yay home works/);
// Modify the API response and validate the change.
await modifyFileAndWaitUntilUpdated('src/server.ts', `{ hello: 'foo' }`, `{ hello: 'bar' }`);
await validateResponse('/api/test', /bar/);
await validateResponse('/home', /yay home works/);
async function validateResponse(pathname: string, match: RegExp): Promise<void> {
const response = await fetch(new URL(pathname, `http://localhost:${port}`));
const text = await response.text();
assert.match(text, match);
assert.equal(response.status, 200);
}
}
async function modifyFileAndWaitUntilUpdated(
filePath: string,
searchValue: string,
replaceValue: string,
): Promise<void> {
await Promise.all([
waitForAnyProcessOutputToMatch(/Page reload sent to client/),
setTimeout(100).then(() => replaceInFile(filePath, searchValue, replaceValue)),
]);
}
| |
000124
|
import { ng } from '../../../utils/process';
import { useCIChrome } from '../../../utils/project';
export default async function () {
await ng('generate', 'app', 'standalone', '--experimental-zoneless', '--standalone');
await useCIChrome('standalone', 'projects/standalone');
await ng('test', 'standalone', '--watch=false');
await ng('build', 'standalone');
await ng(
'generate',
'app',
'ngmodules',
'--experimental-zoneless',
'--no-standalone',
'--skip-install',
);
await useCIChrome('ngmodules', 'projects/ngmodules');
await ng('test', 'ngmodules', '--watch=false');
await ng('build', 'ngmodules');
}
| |
000171
|
import assert from 'node:assert';
import { killAllProcesses, ng } from '../../../utils/process';
import { rimraf, writeMultipleFiles } from '../../../utils/fs';
import { installWorkspacePackages } from '../../../utils/packages';
import { ngServe, useSha } from '../../../utils/project';
export default async function () {
// Forcibly remove in case another test doesn't clean itself up.
await rimraf('node_modules/@angular/ssr');
await ng('add', '@angular/ssr', '--server-routing', '--skip-confirmation');
await useSha();
await installWorkspacePackages();
await writeMultipleFiles({
// Add http client and route
'src/app/app.config.ts': `
import { ApplicationConfig } from '@angular/core';
import { provideRouter } from '@angular/router';
import { HomeComponent } from './home/home.component';
import { provideClientHydration } from '@angular/platform-browser';
import { provideHttpClient, withFetch } from '@angular/common/http';
export const appConfig: ApplicationConfig = {
providers: [
provideRouter([{
path: '',
component: HomeComponent,
}]),
provideClientHydration(),
provideHttpClient(withFetch()),
],
};
`,
// Add asset
'public/media.json': JSON.stringify({ dataFromAssets: true }),
// Update component to do an HTTP call to asset.
'src/app/app.component.ts': `
import { Component, inject } from '@angular/core';
import { CommonModule } from '@angular/common';
import { RouterOutlet } from '@angular/router';
import { HttpClient } from '@angular/common/http';
@Component({
selector: 'app-root',
standalone: true,
imports: [CommonModule, RouterOutlet],
template: \`
<p>{{ data | json }}</p>
<router-outlet></router-outlet>
\`,
})
export class AppComponent {
data: any;
constructor() {
const http = inject(HttpClient);
http.get('/media.json').toPromise().then((d) => {
this.data = d;
});
}
}
`,
});
await ng('generate', 'component', 'home');
const match = /<p>{[\S\s]*"dataFromAssets":[\s\S]*true[\S\s]*}<\/p>/;
const port = await ngServe('--no-ssl');
assert.match(await (await fetch(`http://localhost:${port}/`)).text(), match);
await killAllProcesses();
try {
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
const sslPort = await ngServe('--ssl');
assert.match(await (await fetch(`https://localhost:${sslPort}/`)).text(), match);
} finally {
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '1';
}
}
| |
000223
|
import { writeMultipleFiles } from '../../../utils/fs';
import { silentNg } from '../../../utils/process';
export async function libraryConsumptionSetup(): Promise<void> {
await silentNg('generate', 'library', 'my-lib');
// Force an external template
await writeMultipleFiles({
'projects/my-lib/src/lib/my-lib.component.html': `<p>my-lib works!</p>`,
'projects/my-lib/src/lib/my-lib.component.ts': `import { Component } from '@angular/core';
@Component({
standalone: true,
selector: 'lib-my-lib',
templateUrl: './my-lib.component.html',
})
export class MyLibComponent {}`,
'./src/app/app.component.ts': `
import { Component } from '@angular/core';
import { MyLibService, MyLibComponent } from 'my-lib';
@Component({
standalone: true,
selector: 'app-root',
template: '<lib-my-lib></lib-my-lib>',
imports: [MyLibComponent],
})
export class AppComponent {
title = 'test-project';
constructor(myLibService: MyLibService) {
console.log(myLibService);
}
}
`,
'e2e/src/app.e2e-spec.ts': `
import { browser, logging, element, by } from 'protractor';
import { AppPage } from './app.po';
describe('workspace-project App', () => {
let page: AppPage;
beforeEach(() => {
page = new AppPage();
});
it('should display text from library component', async () => {
await page.navigateTo();
expect(await element(by.css('lib-my-lib p')).getText()).toEqual('my-lib works!');
});
afterEach(async () => {
// Assert that there are no errors emitted from the browser
const logs = await browser.manage().logs().get(logging.Type.BROWSER);
expect(logs).not.toContain(jasmine.objectContaining({
level: logging.Level.SEVERE,
}));
});
});
`,
});
}
| |
000240
|
import assert, { match } from 'node:assert';
import { readFile, writeMultipleFiles } from '../../../utils/fs';
import { ng, noSilentNg, silentNg } from '../../../utils/process';
import { getGlobalVariable } from '../../../utils/env';
import { installWorkspacePackages, uninstallPackage } from '../../../utils/packages';
import { useSha } from '../../../utils/project';
export default async function () {
assert(
getGlobalVariable('argv')['esbuild'],
'This test should not be called in the Webpack suite.',
);
// Forcibly remove in case another test doesn't clean itself up.
await uninstallPackage('@angular/ssr');
await ng('add', '@angular/ssr', '--server-routing', '--skip-confirmation', '--skip-install');
await useSha();
await installWorkspacePackages();
await writeMultipleFiles({
// Add asset
'public/media.json': JSON.stringify({ dataFromAssets: true }),
// Update component to do an HTTP call to asset and API.
'src/app/app.component.ts': `
import { Component, inject } from '@angular/core';
import { JsonPipe } from '@angular/common';
import { RouterOutlet } from '@angular/router';
import { HttpClient } from '@angular/common/http';
@Component({
selector: 'app-root',
standalone: true,
imports: [JsonPipe, RouterOutlet],
template: \`
<p>{{ assetsData | json }}</p>
<p>{{ apiData | json }}</p>
<router-outlet></router-outlet>
\`,
})
export class AppComponent {
assetsData: any;
apiData: any;
constructor() {
const http = inject(HttpClient);
http.get('/media.json').toPromise().then((d) => {
this.assetsData = d;
});
http.get('/api').toPromise().then((d) => {
this.apiData = d;
});
}
}
`,
// Add http client and route
'src/app/app.config.ts': `
import { ApplicationConfig } from '@angular/core';
import { provideRouter } from '@angular/router';
import { HomeComponent } from './home/home.component';
import { provideClientHydration } from '@angular/platform-browser';
import { provideHttpClient, withFetch } from '@angular/common/http';
export const appConfig: ApplicationConfig = {
providers: [
provideRouter([{
path: 'home',
component: HomeComponent,
}]),
provideClientHydration(),
provideHttpClient(withFetch()),
],
};
`,
'src/server.ts': `
import { AngularNodeAppEngine, writeResponseToNodeResponse, isMainModule, createNodeRequestHandler } from '@angular/ssr/node';
import express from 'express';
import { fileURLToPath } from 'node:url';
import { dirname, resolve } from 'node:path';
export function app(): express.Express {
const server = express();
const serverDistFolder = dirname(fileURLToPath(import.meta.url));
const browserDistFolder = resolve(serverDistFolder, '../browser');
const angularNodeAppEngine = new AngularNodeAppEngine();
server.get('/api', (req, res) => res.json({ dataFromAPI: true }));
server.get('**', express.static(browserDistFolder, {
maxAge: '1y',
index: 'index.html'
}));
server.get('**', (req, res, next) => {
angularNodeAppEngine.render(req)
.then((response) => response ? writeResponseToNodeResponse(response, res) : next())
.catch(next);
});
return server;
}
const server = app();
if (isMainModule(import.meta.url)) {
const port = process.env['PORT'] || 4000;
server.listen(port, () => {
console.log(\`Node Express server listening on http://localhost:\${port}\`);
});
}
export const reqHandler = createNodeRequestHandler(server);
`,
});
await silentNg('generate', 'component', 'home');
await noSilentNg('build', '--output-mode=static');
const contents = await readFile('dist/test-project/browser/home/index.html');
match(contents, /<p>{[\S\s]*"dataFromAssets":[\s\S]*true[\S\s]*}<\/p>/);
match(contents, /<p>{[\S\s]*"dataFromAPI":[\s\S]*true[\S\s]*}<\/p>/);
match(contents, /home works!/);
}
| |
000242
|
import { join } from 'node:path';
import { existsSync } from 'node:fs';
import assert from 'node:assert';
import { expectFileToMatch, writeFile } from '../../../utils/fs';
import { execAndWaitForOutputToMatch, ng, noSilentNg, silentNg } from '../../../utils/process';
import { installWorkspacePackages, uninstallPackage } from '../../../utils/packages';
import { useSha } from '../../../utils/project';
import { getGlobalVariable } from '../../../utils/env';
import { findFreePort } from '../../../utils/network';
export default async function () {
assert(
getGlobalVariable('argv')['esbuild'],
'This test should not be called in the Webpack suite.',
);
// Forcibly remove in case another test doesn't clean itself up.
await uninstallPackage('@angular/ssr');
await ng('add', '@angular/ssr', '--server-routing', '--skip-confirmation', '--skip-install');
await useSha();
await installWorkspacePackages();
// Add routes
await writeFile(
'src/app/app.routes.ts',
`
import { Routes } from '@angular/router';
import { HomeComponent } from './home/home.component';
import { CsrComponent } from './csr/csr.component';
import { SsrComponent } from './ssr/ssr.component';
import { SsgComponent } from './ssg/ssg.component';
import { AppShellComponent } from './app-shell/app-shell.component';
import { SsgWithParamsComponent } from './ssg-with-params/ssg-with-params.component';
export const routes: Routes = [
{
path: 'app-shell',
component: AppShellComponent
},
{
path: '',
component: HomeComponent,
},
{
path: 'ssg',
component: SsgComponent,
},
{
path: 'ssr',
component: SsrComponent,
},
{
path: 'csr',
component: CsrComponent,
},
{
path: 'redirect',
redirectTo: 'ssg'
},
{
path: 'ssg/:id',
component: SsgWithParamsComponent,
},
];
`,
);
// Add server routing
await writeFile(
'src/app/app.routes.server.ts',
`
import { RenderMode, ServerRoute } from '@angular/ssr';
export const serverRoutes: ServerRoute[] = [
{
path: 'ssg/:id',
renderMode: RenderMode.Prerender,
headers: { 'x-custom': 'ssg-with-params' },
getPrerenderParams: async() => [{id: 'one'}, {id: 'two'}],
},
{
path: 'ssr',
renderMode: RenderMode.Server,
headers: { 'x-custom': 'ssr' },
},
{
path: 'csr',
renderMode: RenderMode.Client,
headers: { 'x-custom': 'csr' },
},
{
path: 'app-shell',
renderMode: RenderMode.AppShell,
},
{
path: '**',
renderMode: RenderMode.Prerender,
headers: { 'x-custom': 'ssg' },
},
];
`,
);
// Generate components for the above routes
const componentNames: string[] = ['home', 'ssg', 'ssg-with-params', 'csr', 'ssr', 'app-shell'];
for (const componentName of componentNames) {
await silentNg('generate', 'component', componentName);
}
await noSilentNg('build', '--output-mode=server');
const expects: Record<string, string> = {
'index.html': 'home works!',
'ssg/index.html': 'ssg works!',
'ssg/one/index.html': 'ssg-with-params works!',
'ssg/two/index.html': 'ssg-with-params works!',
};
for (const [filePath, fileMatch] of Object.entries(expects)) {
await expectFileToMatch(join('dist/test-project/browser', filePath), fileMatch);
}
const filesDoNotExist: string[] = ['csr/index.html', 'ssr/index.html', 'redirect/index.html'];
for (const filePath of filesDoNotExist) {
const file = join('dist/test-project/browser', filePath);
assert.equal(existsSync(file), false, `Expected '${file}' to not exist.`);
}
// Tests responses
const responseExpects: Record<
string,
{ headers: Record<string, string>; content: string; serverContext: string }
> = {
'/': {
content: 'home works',
serverContext: 'ng-server-context="ssg"',
headers: {
'x-custom': 'ssg',
},
},
'/ssg': {
content: 'ssg works!',
serverContext: 'ng-server-context="ssg"',
headers: {
'x-custom': 'ssg',
},
},
'/ssr': {
content: 'ssr works!',
serverContext: 'ng-server-context="ssr"',
headers: {
'x-custom': 'ssr',
},
},
'/csr': {
content: 'app-shell works',
serverContext: 'ng-server-context="app-shell"',
headers: {
'x-custom': 'csr',
},
},
};
const port = await spawnServer();
for (const [pathname, { content, headers, serverContext }] of Object.entries(responseExpects)) {
const res = await fetch(`http://localhost:${port}${pathname}`);
const text = await res.text();
assert.match(
text,
new RegExp(content),
`Response for '${pathname}': ${content} was not matched in content.`,
);
assert.match(
text,
new RegExp(serverContext),
`Response for '${pathname}': ${serverContext} was not matched in content.`,
);
for (const [name, value] of Object.entries(headers)) {
assert.equal(
res.headers.get(name),
value,
`Response for '${pathname}': ${name} header value did not match expected.`,
);
}
}
}
async function spawnServer(): Promise<number> {
const port = await findFreePort();
await execAndWaitForOutputToMatch(
'npm',
['run', 'serve:ssr:test-project'],
/Node Express server listening on/,
{
'PORT': String(port),
},
);
return port;
}
| |
000250
|
import { ng } from '../../../utils/process';
import { getGlobalVariable } from '../../../utils/env';
import { expectFileToMatch, rimraf, writeMultipleFiles } from '../../../utils/fs';
import { installWorkspacePackages } from '../../../utils/packages';
import { useSha } from '../../../utils/project';
export default async function () {
const useWebpackBuilder = !getGlobalVariable('argv')['esbuild'];
if (useWebpackBuilder) {
// Not supported by the webpack based builder.
return;
}
// Forcibly remove in case another test doesn't clean itself up.
await rimraf('node_modules/@angular/ssr');
await ng('add', '@angular/ssr', '--server-routing', '--skip-confirmation');
await useSha();
await installWorkspacePackages();
await writeMultipleFiles({
// Add http client and route
'src/app/app.config.ts': `
import { ApplicationConfig } from '@angular/core';
import { provideRouter } from '@angular/router';
import {HomeComponent} from './home/home.component';
import { provideClientHydration } from '@angular/platform-browser';
import { provideHttpClient, withFetch } from '@angular/common/http';
export const appConfig: ApplicationConfig = {
providers: [
provideRouter([{
path: '',
component: HomeComponent,
}]),
provideClientHydration(),
provideHttpClient(withFetch()),
],
};
`,
// Add asset
'public/media.json': JSON.stringify({ dataFromAssets: true }),
'public/media with-space.json': JSON.stringify({ dataFromAssetsWithSpace: true }),
// Update component to do an HTTP call to asset.
'src/app/app.component.ts': `
import { Component, inject } from '@angular/core';
import { CommonModule } from '@angular/common';
import { RouterOutlet } from '@angular/router';
import { HttpClient } from '@angular/common/http';
@Component({
selector: 'app-root',
standalone: true,
imports: [CommonModule, RouterOutlet],
template: \`
<p>{{ data | json }}</p>
<p>{{ dataWithSpace | json }}</p>
<router-outlet></router-outlet>
\`,
})
export class AppComponent {
data: any;
dataWithSpace: any;
constructor() {
const http = inject(HttpClient);
http.get('/media.json').subscribe((d) => {
this.data = d;
});
http.get('/media%20with-space.json').subscribe((d) => {
this.dataWithSpace = d;
});
}
}
`,
});
await ng('generate', 'component', 'home');
await ng('build', '--configuration=production', '--prerender');
await expectFileToMatch(
'dist/test-project/browser/index.html',
/<p>{[\S\s]*"dataFromAssets":[\s\S]*true[\S\s]*}<\/p>/,
);
await expectFileToMatch(
'dist/test-project/browser/index.html',
/<p>{[\S\s]*"dataFromAssetsWithSpace":[\s\S]*true[\S\s]*}<\/p>/,
);
}
| |
000251
|
import { ng } from '../../../utils/process';
import { getGlobalVariable } from '../../../utils/env';
import { rimraf, writeMultipleFiles } from '../../../utils/fs';
import { match } from 'node:assert';
import { expectToFail } from '../../../utils/utils';
import { useSha } from '../../../utils/project';
import { installWorkspacePackages } from '../../../utils/packages';
export default async function () {
const useWebpackBuilder = !getGlobalVariable('argv')['esbuild'];
if (useWebpackBuilder) {
return;
}
// Forcibly remove in case another test doesn't clean itself up.
await rimraf('node_modules/@angular/ssr');
await ng('add', '@angular/ssr', '--skip-confirmation');
await useSha();
await installWorkspacePackages();
await writeMultipleFiles({
'src/app/app.component.ts': `
import { Component } from '@angular/core';
import { CommonModule } from '@angular/common';
import { RouterOutlet } from '@angular/router';
@Component({
selector: 'app-root',
standalone: true,
imports: [CommonModule, RouterOutlet],
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'test-ssr';
constructor() {
console.log(window)
}
}
`,
});
const { message } = await expectToFail(() =>
ng('build', '--configuration', 'development', '--prerender'),
);
match(
message,
// When babel is used it will add names to the sourcemap and `constructor` will be used in the stack trace.
// This will currently only happen if AOT and script optimizations are set which enables advanced optimizations.
/window is not defined[.\s\S]*(?:constructor|_AppComponent) \(.*app\.component\.ts\:\d+:\d+\)/,
);
}
| |
000264
|
import express from 'express';
import { dirname, resolve } from 'path';
import { getGlobalVariable } from '../../utils/env';
import { appendToFile, copyFile, createDir, replaceInFile, writeFile } from '../../utils/fs';
import { installPackage } from '../../utils/packages';
import { updateJsonFile } from '../../utils/project';
import { readNgVersion } from '../../utils/version';
import { Server } from 'http';
import { AddressInfo } from 'net';
// Configurations for each locale.
const translationFile = 'src/locale/messages.xlf';
export const baseDir = 'dist/test-project/browser';
export const langTranslations = [
{
lang: 'en-US',
outputPath: `${baseDir}/en-US`,
translation: {
helloPartial: 'Hello',
hello: 'Hello i18n!',
plural: 'Updated 3 minutes ago',
date: 'January',
},
},
{
lang: 'fr',
outputPath: `${baseDir}/fr`,
translation: {
helloPartial: 'Bonjour',
hello: 'Bonjour i18n!',
plural: 'Mis à jour il y a 3 minutes',
date: 'janvier',
},
translationReplacements: [
['Hello', 'Bonjour'],
['Updated', 'Mis à jour'],
['just now', 'juste maintenant'],
['one minute ago', 'il y a une minute'],
[/other {/g, 'other {il y a '],
['minutes ago', 'minutes'],
],
},
{
lang: 'de',
outputPath: `${baseDir}/de`,
translation: {
helloPartial: 'Hallo',
hello: 'Hallo i18n!',
plural: 'Aktualisiert vor 3 Minuten',
date: 'Januar',
},
translationReplacements: [
['Hello', 'Hallo'],
['Updated', 'Aktualisiert'],
['just now', 'gerade jetzt'],
['one minute ago', 'vor einer Minute'],
[/other {/g, 'other {vor '],
['minutes ago', 'Minuten'],
],
},
];
export const sourceLocale = langTranslations[0].lang;
export interface ExternalServer {
readonly server: Server;
readonly port: number;
readonly url: string;
}
/**
* Create an `express` `http.Server` listening on a random port.
*
* Call .close() on the server return value to close the server.
*/
export async function externalServer(outputPath: string, baseUrl = '/'): Promise<ExternalServer> {
const app = express();
app.use(baseUrl, express.static(resolve(outputPath)));
return new Promise((resolve) => {
const server = app.listen(0, 'localhost', () => {
const { port } = server.address() as AddressInfo;
resolve({
server,
port,
url: `http://localhost:${port}${baseUrl}`,
});
});
});
}
export const baseHrefs: { [l: string]: string } = {
'en-US': '/en/',
fr: '/fr-FR/',
de: '',
};
| |
000274
|
export function updateServerFileForWebpack(filepath: string): Promise<void> {
return writeFile(
filepath,
`
import { APP_BASE_HREF } from '@angular/common';
import { CommonEngine } from '@angular/ssr/node';
import express from 'express';
import { fileURLToPath } from 'node:url';
import { dirname, join, resolve } from 'node:path';
import bootstrap from './main.server';
// The Express app is exported so that it can be used by serverless Functions.
export function app(): express.Express {
const server = express();
const serverDistFolder = dirname(fileURLToPath(import.meta.url));
const browserDistFolder = resolve(serverDistFolder, '../browser');
const indexHtml = join(serverDistFolder, 'index.server.html');
const commonEngine = new CommonEngine();
server.set('view engine', 'html');
server.set('views', browserDistFolder);
server.get('**', express.static(browserDistFolder, {
maxAge: '1y',
index: 'index.html',
}));
// All regular routes use the Angular engine
server.get('**', (req, res, next) => {
const { protocol, originalUrl, baseUrl, headers } = req;
commonEngine
.render({
bootstrap,
documentFilePath: indexHtml,
url: \`\${protocol}://\${headers.host}\${originalUrl}\`,
publicPath: browserDistFolder,
providers: [{ provide: APP_BASE_HREF, useValue: baseUrl }],
})
.then((html) => res.send(html))
.catch((err) => next(err));
});
return server;
}
function run(): void {
const port = process.env['PORT'] || 4000;
const server = app();
server.listen(port, () => {
console.log(\`Node Express server listening on http://localhost:\${port}\`);
});
}
run();
`,
);
}
| |
000318
|
import 'zone.js/node';
import { APP_BASE_HREF } from '@angular/common';
import { CommonEngine } from '@angular/ssr';
import * as express from 'express';
import { existsSync } from 'node:fs';
import { join } from 'node:path';
import AppServerModule from './src/main.server';
// The Express app is exported so that it can be used by serverless Functions.
export function app(): express.Express {
const server = express();
const distFolder = join(process.cwd(), 'dist/18-ssr-project-webpack/browser');
const indexHtml = existsSync(join(distFolder, 'index.original.html'))
? join(distFolder, 'index.original.html')
: join(distFolder, 'index.html');
const commonEngine = new CommonEngine();
server.set('view engine', 'html');
server.set('views', distFolder);
// Example Express Rest API endpoints
// server.get('/api/**', (req, res) => { });
// Serve static files from /browser
server.get('*.*', express.static(distFolder, {
maxAge: '1y'
}));
// All regular routes use the Angular engine
server.get('*', (req, res, next) => {
const { protocol, originalUrl, baseUrl, headers } = req;
commonEngine
.render({
bootstrap: AppServerModule,
documentFilePath: indexHtml,
url: `${protocol}://${headers.host}${originalUrl}`,
publicPath: distFolder,
providers: [{ provide: APP_BASE_HREF, useValue: baseUrl }],
})
.then((html) => res.send(html))
.catch((err) => next(err));
});
return server;
}
function run(): void {
const port = process.env['PORT'] || 4000;
// Start up the Node server
const server = app();
server.listen(port, () => {
console.log(`Node Express server listening on http://localhost:${port}`);
});
}
// Webpack will replace 'require' with '__webpack_require__'
// '__non_webpack_require__' is a proxy to Node 'require'
// The below code is to ensure that the server is run only when not requiring the bundle.
declare const __non_webpack_require__: NodeRequire;
const mainModule = __non_webpack_require__.main;
const moduleFilename = mainModule && mainModule.filename || '';
if (moduleFilename === __filename || moduleFilename.includes('iisnode')) {
run();
}
export default AppServerModule;
| |
000337
|
import 'zone.js/node';
import { APP_BASE_HREF } from '@angular/common';
import { CommonEngine } from '@angular/ssr/node';
import * as express from 'express';
import { existsSync } from 'node:fs';
import { join } from 'node:path';
import AppServerModule from './src/main.server';
// The Express app is exported so that it can be used by serverless Functions.
export function app(): express.Express {
const server = express();
const distFolder = join(process.cwd(), 'dist/18-ssr-project-webpack/browser');
const indexHtml = existsSync(join(distFolder, 'index.original.html'))
? join(distFolder, 'index.original.html')
: join(distFolder, 'index.html');
const commonEngine = new CommonEngine();
server.set('view engine', 'html');
server.set('views', distFolder);
// Example Express Rest API endpoints
// server.get('/api/**', (req, res) => { });
// Serve static files from /browser
server.get('*.*', express.static(distFolder, {
maxAge: '1y'
}));
// All regular routes use the Angular engine
server.get('*', (req, res, next) => {
const { protocol, originalUrl, baseUrl, headers } = req;
commonEngine
.render({
bootstrap: AppServerModule,
documentFilePath: indexHtml,
url: `${protocol}://${headers.host}${originalUrl}`,
publicPath: distFolder,
providers: [{ provide: APP_BASE_HREF, useValue: baseUrl }],
})
.then((html) => res.send(html))
.catch((err) => next(err));
});
return server;
}
function run(): void {
const port = process.env['PORT'] || 4000;
// Start up the Node server
const server = app();
server.listen(port, () => {
console.log(`Node Express server listening on http://localhost:${port}`);
});
}
// Webpack will replace 'require' with '__webpack_require__'
// '__non_webpack_require__' is a proxy to Node 'require'
// The below code is to ensure that the server is run only when not requiring the bundle.
declare const __non_webpack_require__: NodeRequire;
const mainModule = __non_webpack_require__.main;
const moduleFilename = mainModule && mainModule.filename || '';
if (moduleFilename === __filename || moduleFilename.includes('iisnode')) {
run();
}
export default AppServerModule;
| |
000366
|
# Building and Testing Angular CLI
## Installation
To get started locally, follow these instructions:
1. If you haven't done it already, [make a fork of this repo](https://github.com/angular/angular-cli/fork).
1. Clone to your local computer using `git`.
1. Make sure that you have Node `v18.19` or higher installed. See instructions [here](https://nodejs.org/en/download/).
1. Make sure that you have `yarn` installed; see instructions [here](https://yarnpkg.com/lang/en/docs/install/).
1. Run `yarn` (no arguments) from the root of your clone of this project to install dependencies.
## Building and Installing the CLI
To make a local build:
```shell
yarn build --local
```
This generates a number of tarballs in the `dist/` directory. To actually use
the locally built tools, switch to another repository reproducing the specific
issue you want to fix (or just generate a local repo with `ng new`). Then
install the locally built packages:
```shell
cd "${EXAMPLE_ANGULAR_PROJECT_REPO}"
npm install -D ${CLI_REPO}/dist/*.tgz
```
Builds of this example project will use tooling created from the previous local
build and include any local changes. When using the CLI, it will automatically
check for a local install and use that if present. This means you can just run:
```shell
npm install -g @angular/cli
```
to get a global install of the latest CLI release. Then running any `ng` command
in the example project will automatically find and use the local build of the
CLI.
Note: If you are testing `ng update`, be aware that installing all the tarballs
will also update the framework (`@angular/core`) to the latest version. In this
case, simply install the CLI alone with
`npm install -D ${CLI_REPO}/dist/_angular_cli.tgz`, that way the rest of the
project remains to be upgraded with `ng update`.
## Debugging
To debug an invocation of the CLI, [build and install the CLI for an example
project](#building-and-installing-the-cli), then run the desired `ng` command
as:
```shell
node --inspect-brk node_modules/.bin/ng ...
```
This will trigger a breakpoint as the CLI starts up. You can connect to this
using the supported mechanisms for your IDE, but the simplest option is to open
Chrome to [chrome://inspect](chrome://inspect) and then click on the `inspect`
link for the `node_modules/.bin/ng` Node target.
Unfortunately, the CLI dynamically `require()`'s other files mid-execution, so
the debugger is not aware of all the source code files before hand. As a result,
it is tough to put breakpoints on files before the CLI loads them. The easiest
workaround is to use the `debugger;` statement to stop execution in the file you
are interested in, and then you should be able to step around and set breakpoints
as expected.
## Testing
There are two different test suites which can be run locally:
### Unit tests
- Run all tests: `yarn bazel test //packages/...`
- Run a subset of the tests, use the full Bazel target example: `yarn bazel test //packages/schematics/angular:angular_test`
- For a complete list of test targets use the following Bazel query: `yarn bazel query "tests(//packages/...)"`
When debugging a specific test, change `describe()` or `it()` to `fdescribe()`
and `fit()` to focus execution to just that one test. This will keep the output clean and speed up execution by not running irrelevant tests.
You can find more info about debugging [tests with Bazel in the docs.](https://github.com/angular/angular-cli/blob/main/docs/process/bazel.md#debugging-jasmine_node_test)
### End to end tests
- For a complete list of test targets use the following Bazel query: `yarn bazel query "tests(//tests/...)"`
- Run a subset of the tests: `yarn bazel test //tests/legacy-cli:e2e_node18 --config=e2e --test_filter="tests/i18n/ivy-localize-*"`
- Use `bazel run` to debug failing tests debugging: `yarn bazel run //tests/legacy-cli:e2e_node18 --config=e2e --test_arg="--glob=tests/basic/aot.ts"`
- Provide additional `e2e_runner` options using `--test_arg`: `--test_arg="--package-manager=yarn"`
When running the debug commands, Node will stop and wait for a debugger to attach.
You can attach your IDE to the debugger to stop on breakpoints and step through the code. Also, see [IDE Specific Usage](#ide-specific-usage) for a
simpler debug story.
## IDE Specific Usage
Some additional tips for developing in specific IDEs.
### Intellij IDEA / WebStorm
To load the project in Intellij products, simply `Open` the repository folder.
Do **not** `Import Project`, because that will overwrite the existing
configuration.
Once opened, the editor should automatically detect run configurations in the
workspace. Use the drop down to choose which one to run and then click the `Run`
button to start it. When executing a debug target, make sure to click the
`Debug` icon to automatically attach the debugger (if you click `Run`, Node will
wait forever for a debugger to attach).

### VS Code
In order to debug some Angular CLI behaviour using Visual Studio Code, you can run `npm run build`, and then use a launch configuration like the following:
```json
{
"type": "node",
"request": "launch",
"name": "ng serve",
"cwd": "<path to an Angular project generated with Angular-CLI>",
"program": "${workspaceFolder}/dist/@angular/cli/bin/ng",
"args": [
"<ng command>",
...other arguments
],
"console": "integratedTerminal"
}
```
Then you can add breakpoints in `dist/@angular` files.
For more information about Node.js debugging in VS Code, see the related [VS Code Documentation](https://code.visualstudio.com/docs/nodejs/nodejs-debugging).
## CPU Profiling
In order to investigate performance issues, CPU profiling is often useful.
### Creating a profile
Node.js 16+ users can use the Node.js command line argument `--cpu-prof` to create a CPU profile.
```bash
node --cpu-prof node_modules/.bin/ng build
```
In addition to this one, another, more elaborated way to capture a CPU profile using the Chrome Devtools is detailed in https://github.com/angular/angular-cli/issues/8259#issue-269908550.
#### Opening a profile
You can use the Chrome Devtools to process it. To do so:
1. open `chrome://inspect` in Chrome
1. click on "Open dedicated DevTools for Node"
1. go to the "profiler" tab
1. click on the "Load" button and select the generated `.cpuprofile` file
1. on the left panel, select the associated file
## Creating New Packages
Adding a package to this repository means running two separate commands:
1. `schematics devkit:package PACKAGE_NAME`. This will update the `.monorepo` file, and create the
base files for the new package (package.json, src/index, etc).
1. `devkit-admin templates`. This will update the README and all other template files that might
have changed when adding a new package.
For private packages, you will need to add a `"private": true` key to your package.json manually.
This will require re-running the template admin script.
| |
000372
|
| | Deploy URL | Base HREF |
| ------------------------------------------- | :--------: | :-------: |
| Initial scripts (index.html) | ✅ 👍 | ✅ 👍 |
| Initial stylesheets (index.html) | ✅ 👍 | ✅ 👍 |
| Lazy scripts (routes/import()/etc.) | ✅ 👍 | ✅ 👍 |
| Processed CSS resources (images/fonts/etc.) | ✅ 👍 | ✅ 👍 |
| Relative template (HTML) assets | ❌ 👎 | ✅ 👍 |
| Angular Router Default Base (APP_BASE_HREF) | ❌ | ✅ \*1 |
| Single reference in deployed Application | ❌ 👎 | ✅ 👍 |
| Special resource logic within CLI | ✅ 👎 | ❌ 👍 |
| Relative fetch/XMLHttpRequest | ❌ | ✅ |
✅ - has/affects the item/trait
❌ - does not have/affect the item/trait
👍 - favorable behavior
👎 - unfavorable behavior
\*1 -- Users with more complicated setups may need to manually configure the `APP_BASE_HREF` token within the application. (e.g., application routing base is `/` but assets/scripts/etc. are at `/assets/`)
| |
000377
|
# Important Considerations when Using Angular Universal
## Introduction
Although the goal of the Universal project is the ability to seamlessly render an Angular
application on the server, there are some inconsistencies that you should consider. First,
there is the obvious discrepancy between the server and browser environments. When rendering
on the server, your application is in an ephemeral or "snapshot" state. The application is
fully rendered once, with the resulting HTML returned, and the remaining application state
destroyed until the next render. Next, the server environment inherently does not have the
same capabilities as the browser (and has some that likewise the browser does not). For
instance, the server does not have any concept of cookies. You can polyfill this and other
functionality, but there is no perfect solution for this. In later sections, we'll walk
through potential mitigations to reduce the scope of errors when rendering on the server.
Please also note the goal of SSR: improved initial render time for your application. This
means that anything that has the potential to reduce the speed of your application in this
initial render should be avoided or sufficiently guarded against. Again, we'll review how
to accomplish this in later sections.
## "window is not defined"
One of the most common issues when using Angular Universal is the lack of browser global
variables in the server environment. This is because the Universal project uses
[domino](https://github.com/fgnass/domino) as the server DOM rendering engine. As a result,
there is certain functionality that won't be present or supported on the server. This
includes the `window` and `document` global objects, cookies, certain HTML elements (like canvas),
and several others. There is no exhaustive list, so please be aware of the fact that if you
see an error like this, where a previously-accessible global is not defined, it's likely because
that global is not available through domino.
> Fun fact: Domino stands for "DOM in Node"
### How to fix?
#### Strategy 1: Injection
Frequently, the needed global is available through the Angular platform via Dependency Injection (DI).
For instance, the global `document` is available through the `DOCUMENT` token. Additionally, a _very_
primitive version of both `window` and `location` exist through the `DOCUMENT` object. For example:
```ts
// example.service.ts
import { Injectable, Inject } from '@angular/core';
import { DOCUMENT } from '@angular/common';
@Injectable()
export class ExampleService {
constructor(@Inject(DOCUMENT) private _doc: Document) {}
getWindow(): Window | null {
return this._doc.defaultView;
}
getLocation(): Location {
return this._doc.location;
}
createElement(tag: string): HTMLElement {
return this._doc.createElement(tag);
}
}
```
Please be judicious about using these references, and lower your expectations about their capabilities. `localStorage`
is one frequently-requested API that won't work how you want it to out of the box. If you need to write your own library
components, please consider using this method to provide similar functionality on the server (this is what Angular CDK
and Material do).
#### Strategy 2: Guards
If you can't inject the proper global value you need from the Angular platform, you can "guard" against
invocation of browser code, so long as you don't need to access that code on the server. For instance,
often invocations of the global `window` element are to get window size, or some other visual aspect.
However, on the server, there is no concept of "screen", and so this functionality is rarely needed.
You may read online and elsewhere that the recommended approach is to use `isPlatformBrowser` or
`isPlatformServer`. This guidance is **incorrect**. This is because you wind up creating platform-specific
code branches in your application code. This not only increases the size of your application unnecessarily,
but it also adds complexity that then has to be maintained. By separating code into separate platform-specific
modules and implementations, your base code can remain about business logic, and platform-specific exceptions
are handled as they should be: on a case-by-case abstraction basis. This can be accomplished using Angular's Dependency
Injection (DI) in order to remove the offending code and drop in a replacement at runtime. Here's an example:
```ts
// window-service.ts
import { Injectable } from '@angular/core';
@Injectable()
export class WindowService {
getWidth(): number {
return window.innerWidth;
}
}
```
```ts
// server-window.service.ts
import { Injectable } from '@angular/core';
import { WindowService } from './window.service';
@Injectable()
export class ServerWindowService extends WindowService {
getWidth(): number {
return 0;
}
}
```
```ts
// app-server.module.ts
import {NgModule} from '@angular/core';
import {WindowService} from './window.service';
import {ServerWindowService} from './server-window.service';
@NgModule({
providers: [{
provide: WindowService,
useClass: ServerWindowService,
}]
})
```
If you have a component provided by a third-party that is not Universal-compatible out of the box,
you can create two separate modules for browser and server (the server module you should already have),
in addition to your base app module. The base app module will contain all of your platform-agnostic code,
the browser module will contain all of your browser-specific/server-incompatible code, and vice-versa for
your server module. In order to avoid editing too much template code, you can create a no-op component
to drop in for the library component. Here's an example:
```ts
// example.component.ts
import { Component } from '@angular/core';
@Component({
selector: 'example-component',
template: `<library-component></library-component>`, // this is provided by a third-party lib
// that causes issues rendering on Universal
})
export class ExampleComponent {}
```
```ts
// app.module.ts
import {NgModule} from '@angular/core';
import {ExampleComponent} from './example.component';
@NgModule({
declarations: [ExampleComponent],
})
```
```ts
// browser-app.module.ts
import {NgModule} from '@angular/core';
import {LibraryModule} from 'some-lib';
import {AppModule} from './app.module';
@NgModule({
imports: [AppModule, LibraryModule],
})
```
```ts
// library-shim.component.ts
import { Component } from '@angular/core';
@Component({
selector: 'library-component',
template: '',
})
export class LibraryShimComponent {}
```
```ts
// server.app.module.ts
import { NgModule } from '@angular/core';
import { LibraryShimComponent } from './library-shim.component';
import { AppModule } from './app.module';
@NgModule({
imports: [AppModule],
declarations: [LibraryShimComponent],
})
export class ServerAppModule {}
```
#### Strategy 3: Shims
If all else fails, and you simply must have access to some sort of browser functionality, you can patch
the global scope of the server environment to include the globals you need. For instance:
```ts
// server.ts
global['window'] = {
// properties you need implemented here...
};
```
This can be applied to any undefined element. Please be careful when you do this, as playing with the global
scope is generally considered an anti-pattern.
> Fun fact: a shim is a patch for functionality that will never be supported on a given platform. A
> polyfill is a patch for functionality that is planned to be supported, or is supported on newer versions
## Application is slow, or worse, won't render
The Angular Universal rendering process is straightforward, but just as simply can be blocked or slowed down
by well-meaning or innocent-looking code. First, some background on the rendering process. When a render
request is made for platform-server (the Angular Universal platform), a single route navigation is executed.
When that navigation completes, meaning that all Zone.js macrotasks are completed, the DOM in whatever state
it's in at that time is returned to the user.
> A Zone.js macrotask is just a JavaScript macrotask that executes in/is patched by Zone.js
This means that if there is a process, like a microtask, that takes up ticks to complete, or a long-standing
HTTP request, the rendering process will not complete, or will take longer. Macrotasks include calls to globals
like `setTimeout` and `setInterval`, and `Observables`. Calling these without cancelling them, or letting them run
longer than needed on the server could result in suboptimal rendering.
> It may be worth brushing up on the JavaScript event loop and learning the difference between microtasks
> and macrotasks, if you don't know it already. [Here's](https://javascript.info/event-loop) a good reference.
## My HTTP, Firebase, WebSocket, etc. won't finish before render!
Similarly to the above section on waiting for macrotasks to complete, the flip-side is that the platform will
not wait for microtasks to complete before finishing the render. In Angular Universal, we have patched the
Angular HTTP client to turn it into a macrotask, to ensure that any needed HTTP requests complete for a given
render. However, this type of patch may not be appropriate for all microtasks, and so it is recommended you use
your best judgment on how to proceed. You can look at the code reference for how Universal wraps a task to turn
it into a macrotask, or you can simply opt to change the server behavior of the given tasks.
| |
000380
|
# Setting Up Local Repository
1. Clone the Angular-CLI repo. A local copy works just fine.
1. Create an upstream remote:
```bash
$ git remote add upstream https://github.com/angular/angular-cli.git
```
# Caretaker
The caretaker should triage issues, merge PR, and sheppard the release.
Caretaker rotation can be found
[here](https://rotations.corp.google.com/rotation/5117919353110528) and individual shifts can
be modified as necessary to accommodate caretaker's schedules. This automatically syncs to a
Google Calendar
[here](https://calendar.google.com/calendar/u/0/[email protected]).
Click the "+" button in the bottom right to add it to your calendar to see shifts alongside the
rest of your schedule.
The primary caretaker is responsible for both merging PRs and performing the weekly release.
The secondary caretaker does not have any _direct_ responsibilities, but they may need to take
over the primary's responsibilities if the primary is unavailable for an extended time (a day
or more) or in the event of an emergency.
At the end of each caretaker's rotation, the primary should perform a handoff in which they
provide information to the next caretaker about the current state of the repository and update
the access group to now include the next caretakers. To perform this update to the access group,
the caretaker can run:
```bash
$ yarn ng-dev caretaker handoff
```
## Merging PRs
The list of PRs which are currently ready to merge (approved with passing status checks) can
be found with [this search](https://github.com/angular/angular-cli/pulls?q=is%3Apr+is%3Aopen+label%3A%22action%3A+merge%22+-is%3Adraft).
This list should be checked daily and any ready PRs should be merged. For each PR, check the
`target` label to understand where it should be merged to. You can find which branches a specific
PR will be merged into with the `yarn ng-dev pr check-target-branches <pr>` command.
When ready to merge a PR, run the following command:
```
yarn ng-dev pr merge <pr>
```
### Maintaining LTS branches
Releases that are under Long Term Support (LTS) are listed on [angular.dev](https://angular.dev/reference/releases#support-policy-and-schedule).
Since there could be more than one LTS branch at any one time, PR authors who want to
merge commits into LTS branches must open a pull request against the specific base branch they'd like to target.
In general, cherry picks for LTS should only be done if it meets one of the criteria below:
1. It addresses a critical security vulnerability.
2. It fixes a breaking change in the external environment.
For example, this could happen if one of the dependencies is deleted from NPM.
3. It fixes a legitimate failure on CI for a particular LTS branch.
# Release
Releasing is performed using Angular's unified release tooling. Each week, two releases are expected, `latest` and `next` on npm. For major
and minor releases, some dependencies need to be manually bumped. The following files contain all the version numbers which need to be
manually updated:
- [`latest-versions.ts`](/packages/schematics/angular/utility/latest-versions.ts#L=18)
- [`latest-versions/package.json`](/packages/schematics/angular/utility/latest-versions/package.json)
- [`@angular/pwa`](/packages/angular/pwa/package.json)
- [`@angular-devkit/build-angular`](/packages/angular_devkit/build_angular/package.json)
- [`@ngtools/webpack`](/packages/ngtools/webpack/package.json)
**DURING a minor OR major CLI release:**
Once FW releases the actual minor/major release (for example: `13.0.0` or `13.1.0`), the above versions should be updated to match (remove
`-rc.0` and `-next.0`). This **must** be done as a separate PR which lands _after_ FW releases (or else CI will fail) but _before_ the CLI
release PR. Releases are built before the PR is sent for review, so any changes after that point won't be included in the release.
**AFTER a major CLI release:**
Once a major release is complete, peer dependencies in the above files will need to be updated to "undo" the above change and add the
prerelease version segment on `main`. For example, `"@angular/compiler-cli": "^13.0.0-next.0"` should become
`"@angular/compiler-cli": "^13.0.0 || ^13.1.0-next.0"`. This should be done for all the peer deps in the above files.
**AFTER a minor OR major CLI release:**
`latest-versions.ts` also needs to be updated to use `-next.0` after a major or minor release. However this needs to happen _after_ FW
publishes the initial `-next.0` release, which will happen 1 week after the major or minor release.
## Releasing the CLI
Typical patch and next releases do not require FW to release in advance, as CLI does not pin the FW
dependency.
After confirming that the above steps have been done or are not necessary, run the following and
navigate the prompts:
```sh
yarn ng-dev release publish
```
Releases should be done in "reverse semver order", meaning they should follow:
Oldest LTS -> Newest LTS -> Patch -> RC -> Next
This can skip any versions which don't need releases, so most weeks are just "Patch -> Next".
## Releasing a new package
Wombat has some special access requirements which need to be configured to publish a new NPM package.
See [this Wombat doc](http://g3doc/company/teams/cloud-client-libraries/team/automation/docs/npm-publish-service#existing-package)
and [this postmortem](http://docs/document/d/1emx2mhvF5xMzNUlDrVRYKI_u4iUOnVrg3rV6c5jk2is?resourcekey=0-qpsFbBfwioYT4f6kyUm8ZA&tab=t.0)
for more info.
Angular is _not_ an organization on NPM, therefore each package is published
independently and Wombat access needs to be managed individually. This also means
we can't rely on Wombat already having access to a new package.
In order to configure a brand new NPM package, it first needs to be published
manually so we can add Wombat access to it. Note that this step can and should be
done prior to weekly releases. The sooner this can be done, the less likely it
will block the next weekly release.
1. Check out the `main` branch, which should always have a `-next` version.
- This avoids having the initial publish actually be used in production.
1. Trigger a release build locally.
```shell
nvm install
yarn --frozen-lockfile
yarn -s ng-dev release build
```
1. Log in to NPM as `angular`.
```shell
npm login
```
- See these two Valentine entries for authentication details:
- https://valentine.corp.google.com/#/show/1460636514618735
- https://valentine.corp.google.com/#/show/1531867371192103
1. Publish the release.
```shell
(cd dist/releases/my-scope/my-pkg/ && npm publish --access public)
```
1. Add Wombat to the package.
```shell
npm owner add google-wombot @my-scope/my-pkg
```
1. Don't forget to logout.
```shell
npm logout
```
1. File a bug like [b/336626936](http://b/336626936) to ask Wombat maintainers to
accept the invite for the new package.
Once Wombat accepts the invite, regular automated releases should work as expected.
| |
000408
|
#!/usr/bin/env node
/**
* @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
*/
/* eslint-disable no-console */
/* eslint-disable import/no-unassigned-import */
'use strict';
const path = require('path');
// Error if the external CLI appears to be used inside a google3 context.
if (process.cwd().split(path.sep).includes('google3')) {
console.error(
'This is the external Angular CLI, but you appear to be running in google3. There is a separate, internal version of the CLI which should be used instead. See http://go/angular/cli.',
);
process.exit();
}
// Provide a title to the process in `ps`.
// Due to an obscure Mac bug, do not start this title with any symbol.
try {
process.title = 'ng ' + Array.from(process.argv).slice(2).join(' ');
} catch (_) {
// If an error happened above, use the most basic title.
process.title = 'ng';
}
const rawCommandName = process.argv[2];
if (rawCommandName === '--get-yargs-completions' || rawCommandName === 'completion') {
// Skip Node.js supported checks when running ng completion.
// A warning at this stage could cause a broken source action (`source <(ng completion script)`) when in the shell init script.
require('./bootstrap');
return;
}
// This node version check ensures that extremely old versions of node are not used.
// These may not support ES2015 features such as const/let/async/await/etc.
// These would then crash with a hard to diagnose error message.
var version = process.versions.node.split('.').map((part) => Number(part));
if (version[0] % 2 === 1) {
// Allow new odd numbered releases with a warning (currently v17+)
console.warn(
'Node.js version ' +
process.version +
' detected.\n' +
'Odd numbered Node.js versions will not enter LTS status and should not be used for production.' +
' For more information, please see https://nodejs.org/en/about/previous-releases/.',
);
require('./bootstrap');
} else if (version[0] < 18 || (version[0] === 18 && version[1] < 19)) {
// Error and exit if less than 18.19
console.error(
'Node.js version ' +
process.version +
' detected.\n' +
'The Angular CLI requires a minimum Node.js version of v18.19.\n\n' +
'Please update your Node.js version or visit https://nodejs.org/ for additional instructions.\n',
);
process.exitCode = 3;
} else {
require('./bootstrap');
}
| |
000496
|
The command can be used to build a project of type "application" or "library".
When used to build a library, a different builder is invoked, and only the `ts-config`, `configuration`, `poll` and `watch` options are applied.
All other options apply only to building applications.
The application builder uses the [esbuild](https://esbuild.github.io/) build tool, with default configuration options specified in the workspace configuration file (`angular.json`) or with a named alternative configuration.
A "development" configuration is created by default when you use the CLI to create the project, and you can use that configuration by specifying the `--configuration development`.
The configuration options generally correspond to the command options.
You can override individual configuration defaults by specifying the corresponding options on the command line.
The command can accept option names given in dash-case.
Note that in the configuration file, you must specify names in camelCase.
Some additional options can only be set through the configuration file,
either by direct editing or with the `ng config` command.
These include `assets`, `styles`, and `scripts` objects that provide runtime-global resources to include in the project.
Resources in CSS, such as images and fonts, are automatically written and fingerprinted at the root of the output folder.
For further details, see [Workspace Configuration](reference/configs/workspace-config).
| |
000510
|
# Angular SSR
Read the dev guide [here](https://angular.dev/guide/ssr).
| |
000517
|
/**
* @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
*/
import { getPotentialLocaleIdFromUrl } from '../src/i18n';
describe('getPotentialLocaleIdFromUrl', () => {
it('should extract locale ID correctly when basePath is present', () => {
const url = new URL('https://example.com/base/en/page');
const basePath = '/base';
const localeId = getPotentialLocaleIdFromUrl(url, basePath);
expect(localeId).toBe('en');
});
it('should extract locale ID correctly when basePath has trailing slash', () => {
const url = new URL('https://example.com/base/en/page');
const basePath = '/base/';
const localeId = getPotentialLocaleIdFromUrl(url, basePath);
expect(localeId).toBe('en');
});
it('should extract locale ID correctly when url has no trailing slash', () => {
const url = new URL('https://example.com/base/en');
const basePath = '/base/';
const localeId = getPotentialLocaleIdFromUrl(url, basePath);
expect(localeId).toBe('en');
});
it('should extract locale ID correctly when url no trailing slash', () => {
const url = new URL('https://example.com/base/en/');
const basePath = '/base/';
const localeId = getPotentialLocaleIdFromUrl(url, basePath);
expect(localeId).toBe('en');
});
it('should handle URL with no pathname after basePath', () => {
const url = new URL('https://example.com/base/');
const basePath = '/base';
const localeId = getPotentialLocaleIdFromUrl(url, basePath);
expect(localeId).toBe('');
});
it('should handle URL where basePath is the entire pathname', () => {
const url = new URL('https://example.com/base');
const basePath = '/base';
const localeId = getPotentialLocaleIdFromUrl(url, basePath);
expect(localeId).toBe('');
});
it('should handle complex basePath correctly', () => {
const url = new URL('https://example.com/base/path/en/page');
const basePath = '/base/path';
const localeId = getPotentialLocaleIdFromUrl(url, basePath);
expect(localeId).toBe('en');
});
it('should handle URL with query parameters and hash', () => {
const url = new URL('https://example.com/base/en?query=param#hash');
const basePath = '/base';
const localeId = getPotentialLocaleIdFromUrl(url, basePath);
expect(localeId).toBe('en');
});
});
| |
000648
|
/**
* @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
*/
import { RootDatabase, open } from 'lmdb';
import { Cache, CacheStore } from './cache';
export class LmbdCacheStore implements CacheStore<unknown> {
readonly #cacheFileUrl;
#db: RootDatabase | undefined;
constructor(readonly cachePath: string) {
this.#cacheFileUrl = cachePath;
}
#ensureCacheFile(): RootDatabase {
this.#db ??= open({
path: this.#cacheFileUrl,
compression: true,
});
return this.#db;
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
async get(key: string): Promise<any> {
const db = this.#ensureCacheFile();
const value = db.get(key);
return value;
}
has(key: string): boolean {
return this.#ensureCacheFile().doesExist(key);
}
async set(key: string, value: unknown): Promise<this> {
const db = this.#ensureCacheFile();
await db.put(key, value);
return this;
}
createCache<V = unknown>(namespace: string): Cache<V> {
return new Cache(this, namespace);
}
async close() {
try {
await this.#db?.close();
} catch {
// Failure to close should not be fatal
}
}
}
| |
000657
|
/**
* @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
*/
/**
* @fileoverview
* Provides infrastructure for common caching functionality within the build system.
*/
/**
* A backing data store for one or more Cache instances.
* The interface is intentionally designed to support using a JavaScript
* Map instance as a potential cache store.
*/
export interface CacheStore<V> {
/**
* Returns the specified value from the cache store or `undefined` if not found.
* @param key The key to retrieve from the store.
*/
get(key: string): V | undefined | Promise<V | undefined>;
/**
* Returns whether the provided key is present in the cache store.
* @param key The key to check from the store.
*/
has(key: string): boolean | Promise<boolean>;
/**
* Adds a new value to the cache store if the key is not present.
* Updates the value for the key if already present.
* @param key The key to associate with the value in the cache store.
* @param value The value to add to the cache store.
*/
set(key: string, value: V): this | Promise<this>;
}
/**
* A cache object that allows accessing and storing key/value pairs in
* an underlying CacheStore. This class is the primary method for consumers
* to use a cache.
*/
export class Cache<V, S extends CacheStore<V> = CacheStore<V>> {
constructor(
protected readonly store: S,
readonly namespace?: string,
) {}
/**
* Prefixes a key with the cache namespace if present.
* @param key A key string to prefix.
* @returns A prefixed key if a namespace is present. Otherwise the provided key.
*/
protected withNamespace(key: string): string {
if (this.namespace) {
return `${this.namespace}:${key}`;
}
return key;
}
/**
* Gets the value associated with a provided key if available.
* Otherwise, creates a value using the factory creator function, puts the value
* in the cache, and returns the new value.
* @param key A key associated with the value.
* @param creator A factory function for the value if no value is present.
* @returns A value associated with the provided key.
*/
async getOrCreate(key: string, creator: () => V | Promise<V>): Promise<V> {
const namespacedKey = this.withNamespace(key);
let value = await this.store.get(namespacedKey);
if (value === undefined) {
value = await creator();
await this.store.set(namespacedKey, value);
}
return value;
}
/**
* Gets the value associated with a provided key if available.
* @param key A key associated with the value.
* @returns A value associated with the provided key if present. Otherwise, `undefined`.
*/
async get(key: string): Promise<V | undefined> {
const value = await this.store.get(this.withNamespace(key));
return value;
}
/**
* Puts a value in the cache and associates it with the provided key.
* If the key is already present, the value is updated instead.
* @param key A key associated with the value.
* @param value A value to put in the cache.
*/
async put(key: string, value: V): Promise<void> {
await this.store.set(this.withNamespace(key), value);
}
}
/**
* A lightweight in-memory cache implementation based on a JavaScript Map object.
*/
export class MemoryCache<V> extends Cache<V, Map<string, V>> {
constructor() {
super(new Map());
}
/**
* Removes all entries from the cache instance.
*/
clear() {
this.store.clear();
}
/**
* Provides all the values currently present in the cache instance.
* @returns An iterable of all values in the cache.
*/
values() {
return this.store.values();
}
/**
* Provides all the keys/values currently present in the cache instance.
* @returns An iterable of all key/value pairs in the cache.
*/
entries() {
return this.store.entries();
}
}
| |
000663
|
/**
* @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
*/
import type { Metafile, PartialMessage } from 'esbuild';
/**
* Checks the input files of a build to determine if any of the files included
* in the build are not ESM. ESM files can be tree-shaken and otherwise optimized
* in ways that CommonJS and other module formats cannot. The esbuild metafile
* information is used as the basis for the analysis as it contains information
* for each input file including its respective format.
*
* If any allowed dependencies are provided via the `allowedCommonJsDependencies`
* parameter, both the direct import and any deep imports will be ignored and no
* diagnostic will be generated. Use `'*'` as entry to skip the check.
*
* If a module has been issued a diagnostic message, then all descendant modules
* will not be checked. This prevents a potential massive amount of inactionable
* messages since the initial module import is the cause of the problem.
*
* @param metafile An esbuild metafile object to check.
* @param allowedCommonJsDependencies An optional list of allowed dependencies.
* @returns Zero or more diagnostic messages for any non-ESM modules.
*/
export function checkCommonJSModules(
metafile: Metafile,
allowedCommonJsDependencies?: string[],
): PartialMessage[] {
const messages: PartialMessage[] = [];
const allowedRequests = new Set(allowedCommonJsDependencies);
if (allowedRequests.has('*')) {
return messages;
}
// Ignore Angular locale definitions which are currently UMD
allowedRequests.add('@angular/common/locales');
// Ignore zone.js due to it currently being built with a UMD like structure.
// Once the build output is updated to be fully ESM, this can be removed.
allowedRequests.add('zone.js');
// Used by '@angular/platform-server' and is in a seperate chunk that is unused when
// using `provideHttpClient(withFetch())`.
allowedRequests.add('xhr2');
// Packages used by @angular/ssr.
// While beasties is ESM it has a number of direct and transtive CJS deps.
allowedRequests.add('express');
allowedRequests.add('beasties');
// Find all entry points that contain code (JS/TS)
const files: string[] = [];
for (const { entryPoint } of Object.values(metafile.outputs)) {
if (!entryPoint) {
continue;
}
if (!isPathCode(entryPoint)) {
continue;
}
files.push(entryPoint);
}
// Track seen files so they are only analyzed once.
// Bundler runtime code is also ignored since it cannot be actionable.
const seenFiles = new Set<string>(['<runtime>']);
// Analyze the files present by walking the import graph
let currentFile: string | undefined;
while ((currentFile = files.shift())) {
const input = metafile.inputs[currentFile];
for (const imported of input.imports) {
// Ignore imports that were already seen or not originally in the code (bundler injected)
if (!imported.original || seenFiles.has(imported.path)) {
continue;
}
seenFiles.add(imported.path);
// If the dependency is allowed ignore all other checks
if (allowedRequests.has(imported.original)) {
continue;
}
// Only check actual code files
if (!isPathCode(imported.path)) {
continue;
}
// Check if non-relative import is ESM format and issue a diagnostic if the file is not allowed
if (
!isPotentialRelative(imported.original) &&
metafile.inputs[imported.path].format !== 'esm'
) {
const request = imported.original;
let notAllowed = true;
if (allowedRequests.has(request)) {
notAllowed = false;
} else {
// Check for deep imports of allowed requests
for (const allowed of allowedRequests) {
if (request.startsWith(allowed + '/')) {
notAllowed = false;
break;
}
}
}
if (notAllowed) {
// Issue a diagnostic message for CommonJS module
messages.push(createCommonJSModuleError(request, currentFile));
}
// Skip all descendants since they are also most likely not ESM but solved by addressing this import
continue;
}
// Add the path so that its imports can be checked
files.push(imported.path);
}
}
return messages;
}
/**
* Determines if a file path has an extension that is a JavaScript or TypeScript
* code file.
*
* @param name A path to check for code file extensions.
* @returns True, if a code file path; false, otherwise.
*/
function isPathCode(name: string): boolean {
return /\.[cm]?[jt]sx?$/.test(name);
}
/**
* Test an import module specifier to determine if the string potentially references a relative file.
* npm packages should not start with a period so if the first character is a period than it is not a
* package. While this is sufficient for the use case in the CommmonJS checker, only checking the
* first character does not definitely indicate the specifier is a relative path.
*
* @param specifier An import module specifier.
* @returns True, if specifier is potentially relative; false, otherwise.
*/
function isPotentialRelative(specifier: string): boolean {
return specifier[0] === '.';
}
/**
* Creates an esbuild diagnostic message for a given non-ESM module request.
*
* @param request The requested non-ESM module name.
* @param importer The path of the file containing the import.
* @returns A message representing the diagnostic.
*/
function createCommonJSModuleError(request: string, importer: string): PartialMessage {
const error = {
text: `Module '${request}' used by '${importer}' is not ESM`,
notes: [
{
text:
'CommonJS or AMD dependencies can cause optimization bailouts.\n' +
'For more information see: https://angular.dev/tools/cli/build#configuring-commonjs-dependencies',
},
],
};
return error;
}
| |
000747
|
export function getLocaleBaseHref(
baseHref: string | undefined,
i18n: NormalizedApplicationBuildOptions['i18nOptions'],
locale: string,
): string | undefined {
if (i18n.flatOutput) {
return undefined;
}
if (i18n.locales[locale] && i18n.locales[locale].baseHref !== '') {
return urlJoin(baseHref || '', i18n.locales[locale].baseHref ?? `/${locale}/`);
}
return undefined;
}
| |
000786
|
/**
* @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
*/
import { buildApplication } from '../../index';
import { APPLICATION_BUILDER_INFO, BASE_OPTIONS, describeBuilder } from '../setup';
describeBuilder(buildApplication, APPLICATION_BUILDER_INFO, (harness) => {
describe('Option: "baseHref"', () => {
beforeEach(async () => {
// Application code is not needed for asset tests
await harness.writeFile('src/main.ts', 'console.log("TEST");');
});
it('should update the base element href attribute when option is set', async () => {
harness.useTarget('build', {
...BASE_OPTIONS,
baseHref: '/abc',
});
const { result } = await harness.executeOnce();
expect(result?.success).toBe(true);
harness.expectFile('dist/browser/index.html').content.toContain('<base href="/abc">');
});
it('should update the base element with no href attribute when option is set', async () => {
await harness.writeFile(
'src/index.html',
`
<html>
<head><base></head>
<body></body>
</html>
`,
);
harness.useTarget('build', {
...BASE_OPTIONS,
baseHref: '/abc',
});
const { result } = await harness.executeOnce();
expect(result?.success).toBe(true);
harness.expectFile('dist/browser/index.html').content.toContain('<base href="/abc">');
});
it('should add the base element href attribute when option is set', async () => {
await harness.writeFile(
'src/index.html',
`
<html>
<head></head>
<body></body>
</html>
`,
);
harness.useTarget('build', {
...BASE_OPTIONS,
baseHref: '/abc',
});
const { result } = await harness.executeOnce();
expect(result?.success).toBe(true);
harness.expectFile('dist/browser/index.html').content.toContain('<base href="/abc">');
});
it('should update the base element href attribute when option is set to an empty string', async () => {
harness.useTarget('build', {
...BASE_OPTIONS,
baseHref: '',
});
const { result } = await harness.executeOnce();
expect(result?.success).toBe(true);
harness.expectFile('dist/browser/index.html').content.toContain('<base href="">');
});
it('should not update the base element href attribute when option is not present', async () => {
harness.useTarget('build', {
...BASE_OPTIONS,
});
const { result } = await harness.executeOnce();
expect(result?.success).toBe(true);
harness.expectFile('dist/browser/index.html').content.toContain('<base href="/">');
});
it('should not change the base element href attribute when option is not present', async () => {
await harness.writeFile(
'src/index.html',
`
<html>
<head><base href="."></head>
<body></body>
</html>
`,
);
harness.useTarget('build', {
...BASE_OPTIONS,
});
const { result } = await harness.executeOnce();
expect(result?.success).toBe(true);
harness.expectFile('dist/browser/index.html').content.toContain('<base href=".">');
});
});
});
| |
000811
|
/**
* @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
*/
import { buildApplication } from '../../index';
import { CrossOrigin } from '../../schema';
import { APPLICATION_BUILDER_INFO, BASE_OPTIONS, describeBuilder } from '../setup';
describeBuilder(buildApplication, APPLICATION_BUILDER_INFO, (harness) => {
describe('Option: "crossOrigin"', () => {
beforeEach(async () => {
// Application code is not needed for asset tests
await harness.writeFile('src/main.ts', 'console.log("TEST");');
// Add a global stylesheet to test link elements
await harness.writeFile('src/styles.css', '/* Global styles */');
// Reduce the input index HTML to a single line to simplify comparing
await harness.writeFile(
'src/index.html',
'<html><head><base href="/"></head><body><app-root></app-root></body></html>',
);
});
it('should add the use-credentials crossorigin attribute when option is set to use-credentials', async () => {
harness.useTarget('build', {
...BASE_OPTIONS,
styles: ['src/styles.css'],
crossOrigin: CrossOrigin.UseCredentials,
});
const { result } = await harness.executeOnce();
expect(result?.success).toBe(true);
harness
.expectFile('dist/browser/index.html')
.content.toEqual(
`<html><head><base href="/"><link rel="stylesheet" href="styles.css" crossorigin="use-credentials"></head>` +
`<body><app-root></app-root>` +
`<script src="main.js" type="module" crossorigin="use-credentials"></script></body></html>`,
);
});
it('should add the anonymous crossorigin attribute when option is set to anonymous', async () => {
harness.useTarget('build', {
...BASE_OPTIONS,
styles: ['src/styles.css'],
crossOrigin: CrossOrigin.Anonymous,
});
const { result } = await harness.executeOnce();
expect(result?.success).toBe(true);
harness
.expectFile('dist/browser/index.html')
.content.toEqual(
`<html><head><base href="/">` +
`<link rel="stylesheet" href="styles.css" crossorigin="anonymous"></head>` +
`<body><app-root></app-root>` +
`<script src="main.js" type="module" crossorigin="anonymous"></script></body></html>`,
);
});
it('should not add a crossorigin attribute when option is set to none', async () => {
harness.useTarget('build', {
...BASE_OPTIONS,
styles: ['src/styles.css'],
crossOrigin: CrossOrigin.None,
});
const { result } = await harness.executeOnce();
expect(result?.success).toBe(true);
harness
.expectFile('dist/browser/index.html')
.content.toEqual(
`<html><head><base href="/">` +
`<link rel="stylesheet" href="styles.css"></head>` +
`<body><app-root></app-root>` +
`<script src="main.js" type="module"></script></body></html>`,
);
});
it('should not add a crossorigin attribute when option is not present', async () => {
harness.useTarget('build', {
...BASE_OPTIONS,
styles: ['src/styles.css'],
});
const { result } = await harness.executeOnce();
expect(result?.success).toBe(true);
harness
.expectFile('dist/browser/index.html')
.content.toEqual(
`<html><head><base href="/">` +
`<link rel="stylesheet" href="styles.css"></head>` +
`<body><app-root></app-root>` +
`<script src="main.js" type="module"></script></body></html>`,
);
});
});
});
| |
000826
|
/**
* @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
*/
import browserslist from 'browserslist';
export function getSupportedBrowsers(
projectRoot: string,
logger: { warn(message: string): void },
): string[] {
browserslist.defaults = [
'last 2 Chrome versions',
'last 1 Firefox version',
'last 2 Edge major versions',
'last 2 Safari major versions',
'last 2 iOS major versions',
'last 2 Android major versions',
'Firefox ESR',
];
// Get browsers from config or default.
const browsersFromConfigOrDefault = new Set(browserslist(undefined, { path: projectRoot }));
// Get browsers that support ES6 modules.
const browsersThatSupportEs6 = new Set(browserslist('supports es6-module'));
const unsupportedBrowsers: string[] = [];
for (const browser of browsersFromConfigOrDefault) {
if (!browsersThatSupportEs6.has(browser)) {
browsersFromConfigOrDefault.delete(browser);
unsupportedBrowsers.push(browser);
}
}
if (unsupportedBrowsers.length) {
logger.warn(
`One or more browsers which are configured in the project's Browserslist configuration ` +
'will be ignored as ES5 output is not supported by the Angular CLI.\n' +
`Ignored browsers: ${unsupportedBrowsers.join(', ')}`,
);
}
return Array.from(browsersFromConfigOrDefault);
}
| |
000953
|
describe('lazy route generator', () => {
const options = {
...defaultOptions,
route: '/new-route',
module: 'app',
};
it('should generate a lazy loaded module with a routing module', async () => {
const tree = await schematicRunner.runSchematic('module', options, appTree);
const files = tree.files;
expect(files).toEqual(
jasmine.arrayContaining([
'/projects/bar/src/app/foo/foo.module.ts',
'/projects/bar/src/app/foo/foo-routing.module.ts',
'/projects/bar/src/app/foo/foo.component.ts',
'/projects/bar/src/app/foo/foo.component.html',
'/projects/bar/src/app/foo/foo.component.css',
]),
);
const appRoutingModuleContent = tree.readContent(
'/projects/bar/src/app/app-routing.module.ts',
);
expect(appRoutingModuleContent).toMatch(
/path: '\/new-route', loadChildren: \(\) => import\('.\/foo\/foo.module'\).then\(m => m.FooModule\)/,
);
const fooRoutingModuleContent = tree.readContent(
'/projects/bar/src/app/foo/foo-routing.module.ts',
);
expect(fooRoutingModuleContent).toMatch(/RouterModule.forChild\(routes\)/);
expect(fooRoutingModuleContent).toMatch(
/const routes: Routes = \[\r?\n?\s*{ path: '', component: FooComponent }\r?\n?\s*\];/,
);
});
it('should generate a lazy loaded module with embedded route declarations', async () => {
appTree.overwrite(
'/projects/bar/src/app/app.module.ts',
`
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
RouterModule.forRoot([])
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
`,
);
appTree.delete('/projects/bar/src/app/app-routing.module.ts');
const tree = await schematicRunner.runSchematic('module', options, appTree);
const files = tree.files;
expect(files).toContain('/projects/bar/src/app/foo/foo.module.ts');
expect(files).not.toContain('/projects/bar/src/app/foo/foo-routing.module.ts');
expect(files).toContain('/projects/bar/src/app/foo/foo.component.ts');
expect(files).toContain('/projects/bar/src/app/foo/foo.component.html');
expect(files).toContain('/projects/bar/src/app/foo/foo.component.css');
const appModuleContent = tree.readContent('/projects/bar/src/app/app.module.ts');
expect(appModuleContent).toMatch(
/path: '\/new-route', loadChildren: \(\) => import\('.\/foo\/foo.module'\).then\(m => m.FooModule\)/,
);
const fooModuleContent = tree.readContent('/projects/bar/src/app/foo/foo.module.ts');
expect(fooModuleContent).toMatch(/RouterModule.forChild\(routes\)/);
expect(fooModuleContent).toMatch(
/const routes: Routes = \[\r?\n?\s*{ path: '', component: FooComponent }\r?\n?\s*\];/,
);
});
it('should generate a lazy loaded module when "flat" flag is true', async () => {
const tree = await schematicRunner.runSchematic(
'module',
{ ...options, flat: true },
appTree,
);
const files = tree.files;
expect(files).toEqual(
jasmine.arrayContaining([
'/projects/bar/src/app/foo.module.ts',
'/projects/bar/src/app/foo-routing.module.ts',
'/projects/bar/src/app/foo.component.ts',
'/projects/bar/src/app/foo.component.html',
'/projects/bar/src/app/foo.component.css',
]),
);
const appRoutingModuleContent = tree.readContent(
'/projects/bar/src/app/app-routing.module.ts',
);
expect(appRoutingModuleContent).toMatch(
/path: '\/new-route', loadChildren: \(\) => import\('.\/foo.module'\).then\(m => m.FooModule\)/,
);
});
it('should generate a lazy loaded module and add route in another parallel routing module', async () => {
await schematicRunner.runSchematic(
'module',
{
...defaultOptions,
name: 'foo',
routing: true,
},
appTree,
);
const tree = await schematicRunner.runSchematic(
'module',
{
...defaultOptions,
name: 'bar',
module: 'foo',
route: 'new-route',
},
appTree,
);
expect(tree.files).toEqual(
jasmine.arrayContaining([
'/projects/bar/src/app/foo/foo-routing.module.ts',
'/projects/bar/src/app/foo/foo.module.ts',
'/projects/bar/src/app/bar/bar-routing.module.ts',
'/projects/bar/src/app/bar/bar.module.ts',
'/projects/bar/src/app/bar/bar.component.ts',
]),
);
const barRoutingModuleContent = tree.readContent(
'/projects/bar/src/app/bar/bar-routing.module.ts',
);
expect(barRoutingModuleContent).toContain(`path: '', component: BarComponent `);
const fooRoutingModuleContent = tree.readContent(
'/projects/bar/src/app/foo/foo-routing.module.ts',
);
expect(fooRoutingModuleContent).toContain(
`loadChildren: () => import('../bar/bar.module').then(m => m.BarModule)`,
);
});
it('should not add reference to RouterModule when referencing lazy routing module', async () => {
// Delete routing module
appTree.delete('/projects/bar/src/app/app-routing.module.ts');
// Update app.module to contain the route config.
appTree.overwrite(
'projects/bar/src/app/app.module.ts',
`
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { BrowserModule } from '@angular/platform-browser';
import { AppComponent } from './app.component';
@NgModule({
imports: [BrowserModule, RouterModule.forRoot([])],
declarations: [AppComponent],
})
export class AppModule {}
`,
);
const tree = await schematicRunner.runSchematic(
'module',
{
...defaultOptions,
name: 'bar',
route: 'bar',
routing: true,
module: 'app.module.ts',
},
appTree,
);
const content = tree.readContent('/projects/bar/src/app/bar/bar.module.ts');
expect(content).toContain('RouterModule.forChild(routes)');
expect(content).not.toContain('BarRoutingModule');
});
});
});
| |
000976
|
import { <% if(changeDetection !== 'Default') { %>ChangeDetectionStrategy, <% }%>Component<% if(!!viewEncapsulation) { %>, ViewEncapsulation<% }%> } from '@angular/core';
@Component({<% if(!skipSelector) {%>
selector: '<%= selector %>',<%}%><% if(standalone) {%>
imports: [],<%} else { %>
standalone: false,
<% }%><% if(inlineTemplate) { %>
template: `
<p>
<%= dasherize(name) %> works!
</p>
`<% } else { %>
templateUrl: './<%= dasherize(name) %><%= type ? '.' + dasherize(type): '' %>.html'<% } if(inlineStyle) { %>,
styles: `<% if(displayBlock){ %>
:host {
display: block;
}
<% } %>`<% } else if (style !== 'none') { %>,
styleUrl: './<%= dasherize(name) %><%= type ? '.' + dasherize(type): '' %>.<%= style %>'<% } %><% if(!!viewEncapsulation) { %>,
encapsulation: ViewEncapsulation.<%= viewEncapsulation %><% } if (changeDetection !== 'Default') { %>,
changeDetection: ChangeDetectionStrategy.<%= changeDetection %><% } %>
})
export <% if(exportDefault) {%>default <%}%>class <%= classify(name) %><%= classify(type) %> {
}
| |
000985
|
import { mergeApplicationConfig, ApplicationConfig } from '@angular/core';
import { provideServerRendering } from '@angular/platform-server';
import { appConfig } from './app.config';
const serverConfig: ApplicationConfig = {
providers: [
provideServerRendering()
]
};
export const config = mergeApplicationConfig(appConfig, serverConfig);
| |
000991
|
import { mergeApplicationConfig, ApplicationConfig } from '@angular/core';
import { provideServerRendering } from '@angular/platform-server';<% if(serverRouting) { %>
import { provideServerRoutesConfig } from '@angular/ssr';<% } %>
import { appConfig } from './app.config';<% if(serverRouting) { %>
import { serverRoutes } from './app.routes.server';<% } %>
const serverConfig: ApplicationConfig = {
providers: [
provideServerRendering(),<% if(serverRouting) { %>
provideServerRoutesConfig(serverRoutes)<% } %>
]
};
export const config = mergeApplicationConfig(appConfig, serverConfig);
| |
000998
|
# <%= classify(name) %>
This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version <%= angularLatestVersion %>.
## Code scaffolding
Angular CLI includes powerful code scaffolding tools. To generate a new component, run:
```bash
ng generate component component-name
```
For a complete list of available schematics (such as `components`, `directives`, or `pipes`), run:
```bash
ng generate --help
```
## Building
To build the library, run:
```bash
ng build <%= name %>
```
This command will compile your project, and the build artifacts will be placed in the `dist/` directory.
### Publishing the Library
Once the project is built, you can publish your library by following these steps:
1. Navigate to the `dist` directory:
```bash
cd dist/<%= dasherize(name) %>
```
2. Run the `npm publish` command to publish your library to the npm registry:
```bash
npm publish
```
## Running unit tests
To execute unit tests with the [Karma](https://karma-runner.github.io) test runner, use the following command:
```bash
ng test
```
## Running end-to-end tests
For end-to-end (e2e) testing, run:
```bash
ng e2e
```
Angular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs.
## Additional Resources
For more information on using the Angular CLI, including detailed command references, visit the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.
| |
001005
|
/**
* @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
*/
import { SchematicTestRunner, UnitTestTree } from '@angular-devkit/schematics/testing';
import { join } from 'node:path';
import { Schema as ServerOptions } from './schema';
describe('SSR Schematic', () => {
const defaultOptions: ServerOptions = {
project: 'test-app',
};
const schematicRunner = new SchematicTestRunner(
'@schematics/angular',
require.resolve(join(__dirname, '../collection.json')),
);
let appTree: UnitTestTree;
const workspaceOptions = {
name: 'workspace',
newProjectRoot: 'projects',
version: '6.0.0',
};
beforeEach(async () => {
appTree = await schematicRunner.runExternalSchematic(
'@schematics/angular',
'workspace',
workspaceOptions,
);
});
describe('non standalone application', () => {
beforeEach(async () => {
appTree = await schematicRunner.runExternalSchematic(
'@schematics/angular',
'application',
{
name: 'test-app',
inlineStyle: false,
inlineTemplate: false,
routing: false,
style: 'css',
skipTests: false,
standalone: false,
},
appTree,
);
});
it('should add dependency: express', async () => {
const tree = await schematicRunner.runSchematic('ssr', defaultOptions, appTree);
const filePath = '/package.json';
const contents = tree.readContent(filePath);
expect(contents).toContain('express');
});
it('should install npm dependencies', async () => {
await schematicRunner.runSchematic('ssr', defaultOptions, appTree);
expect(schematicRunner.tasks.length).toBe(1);
expect(schematicRunner.tasks[0].name).toBe('node-package');
expect((schematicRunner.tasks[0].options as { command: string }).command).toBe('install');
});
it(`should update 'tsconfig.app.json' files with Express main file`, async () => {
const tree = await schematicRunner.runSchematic('ssr', defaultOptions, appTree);
const { files } = tree.readJson('/projects/test-app/tsconfig.app.json') as {
files: string[];
};
expect(files).toEqual(['src/main.ts', 'src/main.server.ts', 'src/server.ts']);
});
});
describe('standalone application', () => {
beforeEach(async () => {
appTree = await schematicRunner.runExternalSchematic(
'@schematics/angular',
'application',
{
name: 'test-app',
inlineStyle: false,
inlineTemplate: false,
routing: false,
style: 'css',
skipTests: false,
standalone: true,
},
appTree,
);
});
it('should add script section in package.json', async () => {
const tree = await schematicRunner.runSchematic('ssr', defaultOptions, appTree);
const { scripts } = tree.readJson('/package.json') as { scripts: Record<string, string> };
expect(scripts['serve:ssr:test-app']).toBe(`node dist/test-app/server/server.mjs`);
});
it('works when using a custom "outputPath.browser" and "outputPath.server" values', async () => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const config = appTree.readJson('/angular.json') as any;
const build = config.projects['test-app'].architect.build;
build.options.outputPath = {
base: build.options.outputPath,
browser: 'public',
server: 'node-server',
};
appTree.overwrite('/angular.json', JSON.stringify(config, undefined, 2));
const tree = await schematicRunner.runSchematic('ssr', defaultOptions, appTree);
const { scripts } = tree.readJson('/package.json') as { scripts: Record<string, string> };
expect(scripts['serve:ssr:test-app']).toBe(`node dist/test-app/node-server/server.mjs`);
const serverFileContent = tree.readContent('/projects/test-app/src/server.ts');
expect(serverFileContent).toContain(`resolve(serverDistFolder, '../public')`);
});
it(`removes "outputPath.browser" when it's an empty string`, async () => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const config = appTree.readJson('/angular.json') as any;
const build = config.projects['test-app'].architect.build;
build.options.outputPath = {
base: build.options.outputPath,
browser: '',
server: 'node-server',
};
appTree.overwrite('/angular.json', JSON.stringify(config, undefined, 2));
const tree = await schematicRunner.runSchematic('ssr', defaultOptions, appTree);
const { scripts } = tree.readJson('/package.json') as { scripts: Record<string, string> };
expect(scripts['serve:ssr:test-app']).toBe(`node dist/test-app/node-server/server.mjs`);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const updatedConfig = tree.readJson('/angular.json') as any;
expect(updatedConfig.projects['test-app'].architect.build.options.outputPath).toEqual({
base: 'dist/test-app',
server: 'node-server',
});
});
});
describe('Legacy browser builder', () => {
function convertBuilderToLegacyBrowser(): void {
const config = JSON.parse(appTree.readContent('/angular.json'));
const build = config.projects['test-app'].architect.build;
build.builder = '@angular-devkit/build-angular:browser';
build.options = {
...build.options,
main: build.options.browser,
browser: undefined,
};
build.configurations.development = {
...build.configurations.development,
vendorChunk: true,
namedChunks: true,
buildOptimizer: false,
};
appTree.overwrite('/angular.json', JSON.stringify(config, undefined, 2));
}
beforeEach(async () => {
appTree = await schematicRunner.runExternalSchematic(
'@schematics/angular',
'application',
{
name: 'test-app',
inlineStyle: false,
inlineTemplate: false,
routing: false,
style: 'css',
skipTests: false,
standalone: false,
},
appTree,
);
convertBuilderToLegacyBrowser();
});
it(`should update 'tsconfig.server.json' files with Express main file`, async () => {
const tree = await schematicRunner.runSchematic('ssr', defaultOptions, appTree);
const { files } = tree.readJson('/projects/test-app/tsconfig.server.json') as {
files: string[];
};
expect(files).toEqual(['src/main.server.ts', 'src/server.ts']);
});
it(`should add export to main file in 'server.ts'`, async () => {
const tree = await schematicRunner.runSchematic('ssr', defaultOptions, appTree);
const content = tree.readContent('/projects/test-app/src/server.ts');
expect(content).toContain(`export default AppServerModule`);
});
it(`should add correct value to 'distFolder'`, async () => {
const tree = await schematicRunner.runSchematic('ssr', defaultOptions, appTree);
const content = tree.readContent('/projects/test-app/src/server.ts');
expect(content).toContain(`const distFolder = join(process.cwd(), 'dist/test-app/browser');`);
});
});
});
| |
001006
|
import 'zone.js/node';
import { APP_BASE_HREF } from '@angular/common';
import { CommonEngine } from '@angular/ssr/node';
import * as express from 'express';
import { existsSync } from 'node:fs';
import { join } from 'node:path';
import <% if (isStandalone) { %>bootstrap<% } else { %>AppServerModule<% } %> from './main.server';
// The Express app is exported so that it can be used by serverless Functions.
export function app(): express.Express {
const server = express();
const distFolder = join(process.cwd(), '<%= browserDistDirectory %>');
const indexHtml = existsSync(join(distFolder, 'index.original.html'))
? join(distFolder, 'index.original.html')
: join(distFolder, 'index.html');
const commonEngine = new CommonEngine();
server.set('view engine', 'html');
server.set('views', distFolder);
// Example Express Rest API endpoints
// server.get('/api/**', (req, res) => { });
// Serve static files from /browser
server.get('*.*', express.static(distFolder, {
maxAge: '1y'
}));
// All regular routes use the Angular engine
server.get('*', (req, res, next) => {
const { protocol, originalUrl, baseUrl, headers } = req;
commonEngine
.render({
<% if (isStandalone) { %>bootstrap<% } else { %>bootstrap: AppServerModule<% } %>,
documentFilePath: indexHtml,
url: `${protocol}://${headers.host}${originalUrl}`,
publicPath: distFolder,
providers: [{ provide: APP_BASE_HREF, useValue: baseUrl }],
})
.then((html) => res.send(html))
.catch((err) => next(err));
});
return server;
}
function run(): void {
const port = process.env['PORT'] || 4000;
// Start up the Node server
const server = app();
server.listen(port, () => {
console.log(`Node Express server listening on http://localhost:${port}`);
});
}
// Webpack will replace 'require' with '__webpack_require__'
// '__non_webpack_require__' is a proxy to Node 'require'
// The below code is to ensure that the server is run only when not requiring the bundle.
declare const __non_webpack_require__: NodeRequire;
const mainModule = __non_webpack_require__.main;
const moduleFilename = mainModule && mainModule.filename || '';
if (moduleFilename === __filename || moduleFilename.includes('iisnode')) {
run();
}
export default <% if (isStandalone) { %>bootstrap<% } else { %>AppServerModule<% } %>;
| |
001007
|
import { APP_BASE_HREF } from '@angular/common';
import { CommonEngine, isMainModule } from '@angular/ssr/node';
import express from 'express';
import { dirname, join, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
import <% if (isStandalone) { %>bootstrap<% } else { %>AppServerModule<% } %> from './main.server';
const serverDistFolder = dirname(fileURLToPath(import.meta.url));
const browserDistFolder = resolve(serverDistFolder, '../<%= browserDistDirectory %>');
const indexHtml = join(serverDistFolder, 'index.server.html');
const app = express();
const commonEngine = new CommonEngine();
/**
* Example Express Rest API endpoints can be defined here.
* Uncomment and define endpoints as necessary.
*
* Example:
* ```ts
* app.get('/api/**', (req, res) => {
* // Handle API request
* });
* ```
*/
/**
* Serve static files from /<%= browserDistDirectory %>
*/
app.get(
'**',
express.static(browserDistFolder, {
maxAge: '1y',
index: 'index.html'
}),
);
/**
* Handle all other requests by rendering the Angular application.
*/
app.get('**', (req, res, next) => {
const { protocol, originalUrl, baseUrl, headers } = req;
commonEngine
.render({
<% if (isStandalone) { %>bootstrap<% } else { %>bootstrap: AppServerModule<% } %>,
documentFilePath: indexHtml,
url: `${protocol}://${headers.host}${originalUrl}`,
publicPath: browserDistFolder,
providers: [{ provide: APP_BASE_HREF, useValue: baseUrl }],
})
.then((html) => res.send(html))
.catch((err) => next(err));
});
/**
* Start the server if this module is the main entry point.
* The server listens on the port defined by the `PORT` environment variable, or defaults to 4000.
*/
if (isMainModule(import.meta.url)) {
const port = process.env['PORT'] || 4000;
app.listen(port, () => {
console.log(`Node Express server listening on http://localhost:${port}`);
});
}
| |
001008
|
import {
AngularNodeAppEngine,
createNodeRequestHandler,
isMainModule,
writeResponseToNodeResponse,
} from '@angular/ssr/node';
import express from 'express';
import { dirname, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
const serverDistFolder = dirname(fileURLToPath(import.meta.url));
const browserDistFolder = resolve(serverDistFolder, '../<%= browserDistDirectory %>');
const app = express();
const angularApp = new AngularNodeAppEngine();
/**
* Example Express Rest API endpoints can be defined here.
* Uncomment and define endpoints as necessary.
*
* Example:
* ```ts
* app.get('/api/**', (req, res) => {
* // Handle API request
* });
* ```
*/
/**
* Serve static files from /<%= browserDistDirectory %>
*/
app.get(
'**',
express.static(browserDistFolder, {
maxAge: '1y',
index: 'index.html',
setHeaders: (res) => {
const headers = angularApp.getPrerenderHeaders(res.req);
for (const [key, value] of headers) {
res.setHeader(key, value);
}
},
}),
);
/**
* Handle all other requests by rendering the Angular application.
*/
app.get('**', (req, res, next) => {
angularApp
.render(req)
.then((response) =>
response ? writeResponseToNodeResponse(response, res) : next(),
)
.catch(next);
});
/**
* Start the server if this module is the main entry point.
* The server listens on the port defined by the `PORT` environment variable, or defaults to 4000.
*/
if (isMainModule(import.meta.url)) {
const port = process.env['PORT'] || 4000;
app.listen(port, () => {
console.log(`Node Express server listening on http://localhost:${port}`);
});
}
/**
* The request handler used by the Angular CLI (dev-server and during build).
*/
export const reqHandler = createNodeRequestHandler(app);
| |
001089
|
/**
* @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
*/
import { SchematicTestRunner, UnitTestTree } from '@angular-devkit/schematics/testing';
import { parse as parseJson } from 'jsonc-parser';
import { latestVersions } from '../utility/latest-versions';
import { Schema as WorkspaceOptions } from '../workspace/schema';
import { Schema as ApplicationOptions, Style, ViewEncapsulation } from './schema';
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function readJsonFile(tree: UnitTestTree, path: string): any {
return parseJson(tree.readContent(path).toString());
}
describe('Application Schematic', () => {
const schematicRunner = new SchematicTestRunner(
'@schematics/angular',
require.resolve('../collection.json'),
);
const workspaceOptions: WorkspaceOptions = {
name: 'workspace',
newProjectRoot: 'projects',
version: '6.0.0',
};
const defaultOptions: ApplicationOptions = {
name: 'foo',
skipPackageJson: false,
};
let workspaceTree: UnitTestTree;
beforeEach(async () => {
workspaceTree = await schematicRunner.runSchematic('workspace', workspaceOptions);
});
it('should create all files of an application', async () => {
const tree = await schematicRunner.runSchematic(
'application',
{ ...defaultOptions, standalone: false },
workspaceTree,
);
expect(tree.files).toEqual(
jasmine.arrayContaining([
'/projects/foo/tsconfig.app.json',
'/projects/foo/tsconfig.spec.json',
'/projects/foo/public/favicon.ico',
'/projects/foo/src/index.html',
'/projects/foo/src/main.ts',
'/projects/foo/src/styles.css',
'/projects/foo/src/app/app.module.ts',
'/projects/foo/src/app/app.component.css',
'/projects/foo/src/app/app.component.html',
'/projects/foo/src/app/app.component.spec.ts',
'/projects/foo/src/app/app.component.ts',
]),
);
});
it('should add the application to the workspace', async () => {
const options = { ...defaultOptions };
const tree = await schematicRunner.runSchematic('application', options, workspaceTree);
const workspace = JSON.parse(tree.readContent('/angular.json'));
expect(workspace.projects.foo).toBeDefined();
});
it('should set the prefix to app if none is set', async () => {
const options = { ...defaultOptions };
const tree = await schematicRunner.runSchematic('application', options, workspaceTree);
const workspace = JSON.parse(tree.readContent('/angular.json'));
expect(workspace.projects.foo.prefix).toEqual('app');
});
it('should set the prefix correctly', async () => {
const options = { ...defaultOptions, prefix: 'pre' };
const tree = await schematicRunner.runSchematic('application', options, workspaceTree);
const workspace = JSON.parse(tree.readContent('/angular.json'));
expect(workspace.projects.foo.prefix).toEqual('pre');
});
it('should set the right paths in the tsconfig.app.json', async () => {
const tree = await schematicRunner.runSchematic('application', defaultOptions, workspaceTree);
const { files, extends: _extends } = readJsonFile(tree, '/projects/foo/tsconfig.app.json');
expect(files).toEqual(['src/main.ts']);
expect(_extends).toBe('../../tsconfig.json');
});
it('should set the right paths in the tsconfig.spec.json', async () => {
const tree = await schematicRunner.runSchematic('application', defaultOptions, workspaceTree);
const { extends: _extends } = readJsonFile(tree, '/projects/foo/tsconfig.spec.json');
expect(_extends).toBe('../../tsconfig.json');
});
it('should install npm dependencies when `skipInstall` is false', async () => {
await schematicRunner.runSchematic(
'application',
{ ...defaultOptions, ssr: true, skipInstall: false },
workspaceTree,
);
expect(schematicRunner.tasks.length).toBe(1);
expect(schematicRunner.tasks[0].name).toBe('node-package');
expect((schematicRunner.tasks[0].options as { command: string }).command).toBe('install');
});
it('should not install npm dependencies when `skipInstall` is true', async () => {
await schematicRunner.runSchematic(
'application',
{ ...defaultOptions, ssr: true, skipInstall: true },
workspaceTree,
);
expect(schematicRunner.tasks.length).toBe(0);
});
it('should set the skipTests flag for other schematics when using --skipTests=true', async () => {
const options: ApplicationOptions = { ...defaultOptions, skipTests: true };
const tree = await schematicRunner.runSchematic('application', options, workspaceTree);
const config = JSON.parse(tree.readContent('/angular.json'));
const schematics = config.projects.foo.schematics;
expect(schematics['@schematics/angular:class']).toEqual({ skipTests: true });
expect(schematics['@schematics/angular:component']).toEqual({ skipTests: true });
expect(schematics['@schematics/angular:directive']).toEqual({ skipTests: true });
expect(schematics['@schematics/angular:guard']).toEqual({ skipTests: true });
expect(schematics['@schematics/angular:interceptor']).toEqual({ skipTests: true });
expect(schematics['@schematics/angular:pipe']).toEqual({ skipTests: true });
expect(schematics['@schematics/angular:resolver']).toEqual({ skipTests: true });
expect(schematics['@schematics/angular:service']).toEqual({ skipTests: true });
});
it('minimal=true should not create e2e and test targets', async () => {
const options = { ...defaultOptions, minimal: true };
const tree = await schematicRunner.runSchematic('application', options, workspaceTree);
const config = JSON.parse(tree.readContent('/angular.json'));
const architect = config.projects.foo.architect;
expect(architect.test).not.toBeDefined();
expect(architect.e2e).not.toBeDefined();
});
it('minimal=true should configure the schematics options for components', async () => {
const options = { ...defaultOptions, minimal: true };
const tree = await schematicRunner.runSchematic('application', options, workspaceTree);
const config = JSON.parse(tree.readContent('/angular.json'));
const schematics = config.projects.foo.schematics;
expect(schematics['@schematics/angular:component']).toEqual({
inlineTemplate: true,
inlineStyle: true,
skipTests: true,
});
});
it('minimal=true allows inlineStyle=false when configuring the schematics options for components', async () => {
const options = { ...defaultOptions, minimal: true, inlineStyle: false };
const tree = await schematicRunner.runSchematic('application', options, workspaceTree);
const config = JSON.parse(tree.readContent('/angular.json'));
const schematics = config.projects.foo.schematics;
expect(schematics['@schematics/angular:component']).toEqual({
inlineTemplate: true,
skipTests: true,
});
});
it('minimal=true allows inlineTemplate=false when configuring the schematics options for components', async () => {
const options = { ...defaultOptions, minimal: true, inlineTemplate: false };
const tree = await schematicRunner.runSchematic('application', options, workspaceTree);
const config = JSON.parse(tree.readContent('/angular.json'));
const schematics = config.projects.foo.schematics;
expect(schematics['@schematics/angular:component']).toEqual({
inlineStyle: true,
skipTests: true,
});
});
it(`should create an application with SSR features when 'ssr=true'`, async () => {
const options = { ...defaultOptions, ssr: true };
const filePath = '/projects/foo/src/server.ts';
expect(workspaceTree.exists(filePath)).toBeFalse();
const tree = await schematicRunner.runSchematic('application', options, workspaceTree);
expect(tree.exists(filePath)).toBeTrue();
});
it(`should not create an application with SSR features when 'ssr=false'`, async () => {
const options = { ...defaultOptions, ssr: false };
const tree = await schematicRunner.runSchematic('application', options, workspaceTree);
expect(tree.exists('/projects/foo/src/server.ts')).toBeFalse();
});
| |
001091
|
it(`should create kebab-case project folder names with PascalCase project name`, async () => {
const options: ApplicationOptions = { ...defaultOptions, name: 'MyCool' };
const tree = await schematicRunner.runSchematic('application', options, workspaceTree);
const exists = tree.exists('/projects/my-cool/tsconfig.app.json');
expect(exists).toBeTrue();
});
it(`should create scoped kebab-case project folder names with PascalCase project name`, async () => {
const options: ApplicationOptions = { ...defaultOptions, name: '@foo/MyCool' };
const tree = await schematicRunner.runSchematic('application', options, workspaceTree);
const exists = tree.exists('/projects/foo/my-cool/tsconfig.app.json');
expect(exists).toBeTrue();
});
it('should support creating applications with `_` and `.` in name', async () => {
const options = { ...defaultOptions, name: 'foo.bar_buz' };
const tree = await schematicRunner.runSchematic('application', options, workspaceTree);
expect(tree.exists('/projects/foo.bar_buz/tsconfig.app.json')).toBeTrue();
});
it('should support creating scoped application', async () => {
const scopedName = '@myscope/myapp';
const options = { ...defaultOptions, name: scopedName };
const tree = await schematicRunner.runSchematic('application', options, workspaceTree);
const cfg = JSON.parse(tree.readContent('/angular.json'));
expect(cfg.projects['@myscope/myapp']).toBeDefined();
});
it('should create correct files when using minimal', async () => {
const options = { ...defaultOptions, minimal: true };
const tree = await schematicRunner.runSchematic('application', options, workspaceTree);
const files = tree.files;
[
'/projects/foo/tsconfig.spec.json',
'/projects/foo/src/app/app.component.css',
'/projects/foo/src/app/app.component.html',
'/projects/foo/src/app/app.component.spec.ts',
].forEach((x) => expect(files).not.toContain(x));
expect(files).toEqual(
jasmine.arrayContaining([
'/projects/foo/tsconfig.app.json',
'/projects/foo/public/favicon.ico',
'/projects/foo/src/index.html',
'/projects/foo/src/main.ts',
'/projects/foo/src/styles.css',
'/projects/foo/src/app/app.component.ts',
]),
);
});
it('should create correct files when using minimal and inlineStyle=false', async () => {
const options = { ...defaultOptions, minimal: true, inlineStyle: false };
const tree = await schematicRunner.runSchematic('application', options, workspaceTree);
const files = tree.files;
[
'/projects/foo/tsconfig.spec.json',
'/projects/foo/karma.conf.js',
'/projects/foo/src/test.ts',
'/projects/foo/src/app/app.component.html',
'/projects/foo/src/app/app.component.spec.ts',
].forEach((x) => expect(files).not.toContain(x));
expect(files).toEqual(
jasmine.arrayContaining([
'/projects/foo/tsconfig.app.json',
'/projects/foo/public/favicon.ico',
'/projects/foo/src/index.html',
'/projects/foo/src/main.ts',
'/projects/foo/src/styles.css',
'/projects/foo/src/app/app.component.css',
'/projects/foo/src/app/app.component.ts',
]),
);
});
it('should create correct files when using minimal and inlineTemplate=false', async () => {
const options = { ...defaultOptions, minimal: true, inlineTemplate: false };
const tree = await schematicRunner.runSchematic('application', options, workspaceTree);
const files = tree.files;
[
'/projects/foo/tsconfig.spec.json',
'/projects/foo/karma.conf.js',
'/projects/foo/src/test.ts',
'/projects/foo/src/app/app.component.css',
'/projects/foo/src/app/app.component.spec.ts',
].forEach((x) => expect(files).not.toContain(x));
expect(files).toEqual(
jasmine.arrayContaining([
'/projects/foo/tsconfig.app.json',
'/projects/foo/public/favicon.ico',
'/projects/foo/src/index.html',
'/projects/foo/src/main.ts',
'/projects/foo/src/styles.css',
'/projects/foo/src/app/app.component.html',
'/projects/foo/src/app/app.component.ts',
]),
);
});
it('should create all files of a standalone application', async () => {
const options = { ...defaultOptions, standalone: true };
const tree = await schematicRunner.runSchematic('application', options, workspaceTree);
const files = tree.files;
expect(files).toEqual(
jasmine.arrayContaining([
'/projects/foo/tsconfig.app.json',
'/projects/foo/tsconfig.spec.json',
'/projects/foo/public/favicon.ico',
'/projects/foo/src/index.html',
'/projects/foo/src/main.ts',
'/projects/foo/src/styles.css',
'/projects/foo/src/app/app.config.ts',
'/projects/foo/src/app/app.component.css',
'/projects/foo/src/app/app.component.html',
'/projects/foo/src/app/app.component.spec.ts',
'/projects/foo/src/app/app.component.ts',
]),
);
});
it('should not create any module files', async () => {
const options = { ...defaultOptions, standalone: true };
const tree = await schematicRunner.runSchematic('application', options, workspaceTree);
const moduleFiles = tree.files.filter((file) => file.endsWith('.module.ts'));
expect(moduleFiles.length).toEqual(0);
});
it('should enable zone event coalescing by default', async () => {
const options = { ...defaultOptions, standalone: true };
const tree = await schematicRunner.runSchematic('application', options, workspaceTree);
const appConfig = tree.readContent('/projects/foo/src/app/app.config.ts');
expect(appConfig).toContain('provideZoneChangeDetection({ eventCoalescing: true })');
});
it('should create a standalone component', async () => {
const options = { ...defaultOptions, standalone: true };
const tree = await schematicRunner.runSchematic('application', options, workspaceTree);
const component = tree.readContent('/projects/foo/src/app/app.component.ts');
expect(component).not.toContain('standalone');
});
it('should create routing information by default', async () => {
const options = { ...defaultOptions, standalone: true };
const tree = await schematicRunner.runSchematic('application', options, workspaceTree);
expect(tree.files).toContain('/projects/foo/src/app/app.routes.ts');
const component = tree.readContent('/projects/foo/src/app/app.component.ts');
expect(component).toContain(`import { RouterOutlet } from '@angular/router';`);
expect(component).toContain(`imports: [RouterOutlet]`);
const config = tree.readContent('/projects/foo/src/app/app.config.ts');
expect(config).toContain(`import { provideRouter } from '@angular/router';`);
expect(config).toContain(`import { routes } from './app.routes';`);
expect(config).toContain('provideRouter(routes)');
});
it('should create a main.ts', async () => {
const options = { ...defaultOptions, standalone: true };
const tree = await schematicRunner.runSchematic('application', options, workspaceTree);
const main = tree.readContent('/projects/foo/src/main.ts');
expect(main).toContain('bootstrapApplication');
});
| |
001099
|
import { Routes } from '@angular/router';
export const routes: Routes = [];
| |
001121
|
/**
* @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
*/
import { SchematicTestRunner, UnitTestTree } from '@angular-devkit/schematics/testing';
import { Schema as ApplicationOptions } from '../application/schema';
import { Schema as WorkspaceOptions } from '../workspace/schema';
import { Schema as GuardOptions } from './schema';
describe('Guard Schematic', () => {
const schematicRunner = new SchematicTestRunner(
'@schematics/angular',
require.resolve('../collection.json'),
);
const defaultOptions: GuardOptions = {
name: 'foo',
flat: true,
project: 'bar',
};
const workspaceOptions: WorkspaceOptions = {
name: 'workspace',
newProjectRoot: 'projects',
version: '6.0.0',
};
const appOptions: ApplicationOptions = {
name: 'bar',
inlineStyle: false,
inlineTemplate: false,
routing: false,
skipTests: false,
skipPackageJson: false,
};
let appTree: UnitTestTree;
beforeEach(async () => {
appTree = await schematicRunner.runSchematic('workspace', workspaceOptions);
appTree = await schematicRunner.runSchematic('application', appOptions, appTree);
});
it('should create a (deprecated) class-based guard with --no-functional', async () => {
const tree = await schematicRunner.runSchematic(
'guard',
{ ...defaultOptions, functional: false },
appTree,
);
const files = tree.files;
expect(files).toContain('/projects/bar/src/app/foo.guard.spec.ts');
expect(files).toContain('/projects/bar/src/app/foo.guard.ts');
});
it('should respect the skipTests flag', async () => {
const options = { ...defaultOptions, skipTests: true };
const tree = await schematicRunner.runSchematic('guard', options, appTree);
const files = tree.files;
expect(files).not.toContain('/projects/bar/src/app/foo.guard.spec.ts');
expect(files).toContain('/projects/bar/src/app/foo.guard.ts');
});
it('should respect the flat flag', async () => {
const options = { ...defaultOptions, flat: false };
const tree = await schematicRunner.runSchematic('guard', options, appTree);
const files = tree.files;
expect(files).toContain('/projects/bar/src/app/foo/foo.guard.spec.ts');
expect(files).toContain('/projects/bar/src/app/foo/foo.guard.ts');
});
it('should respect the sourceRoot value', async () => {
const config = JSON.parse(appTree.readContent('/angular.json'));
config.projects.bar.sourceRoot = 'projects/bar/custom';
appTree.overwrite('/angular.json', JSON.stringify(config, null, 2));
appTree = await schematicRunner.runSchematic('guard', defaultOptions, appTree);
expect(appTree.files).toContain('/projects/bar/custom/app/foo.guard.ts');
});
it('should respect the implements value', async () => {
const options = { ...defaultOptions, implements: ['CanActivate'], functional: false };
const tree = await schematicRunner.runSchematic('guard', options, appTree);
const fileString = tree.readContent('/projects/bar/src/app/foo.guard.ts');
expect(fileString).toContain('CanActivate');
expect(fileString).toContain('canActivate');
expect(fileString).not.toContain('CanActivateChild');
expect(fileString).not.toContain('canActivateChild');
expect(fileString).not.toContain('CanMatch');
expect(fileString).not.toContain('canMatch');
});
it('should generate a functional guard by default', async () => {
const options = { ...defaultOptions, implements: ['CanActivate'] };
const tree = await schematicRunner.runSchematic('guard', options, appTree);
const fileString = tree.readContent('/projects/bar/src/app/foo.guard.ts');
expect(fileString).toContain('export const fooGuard: CanActivateFn = (route, state) => {');
expect(fileString).not.toContain('CanActivateChild');
expect(fileString).not.toContain('canActivateChild');
expect(fileString).not.toContain('CanMatch');
expect(fileString).not.toContain('canMatch');
});
it('should generate a helper function to execute the guard in a test', async () => {
const options = { ...defaultOptions, implements: ['CanActivate'] };
const tree = await schematicRunner.runSchematic('guard', options, appTree);
const fileString = tree.readContent('/projects/bar/src/app/foo.guard.spec.ts');
expect(fileString).toContain('const executeGuard: CanActivateFn = (...guardParameters) => ');
expect(fileString).toContain(
'TestBed.runInInjectionContext(() => fooGuard(...guardParameters));',
);
});
it('should generate CanDeactivateFn with unknown functional guard', async () => {
const options = { ...defaultOptions, implements: ['CanDeactivate'] };
const tree = await schematicRunner.runSchematic('guard', options, appTree);
const fileString = tree.readContent('/projects/bar/src/app/foo.guard.ts');
expect(fileString).toContain(
'export const fooGuard: CanDeactivateFn<unknown> = ' +
'(component, currentRoute, currentState, nextState) => {',
);
});
it('should respect the implements values in (deprecated) class-based guards', async () => {
const implementationOptions = ['CanActivate', 'CanDeactivate', 'CanActivateChild'];
const options = { ...defaultOptions, implements: implementationOptions, functional: false };
const tree = await schematicRunner.runSchematic('guard', options, appTree);
const fileString = tree.readContent('/projects/bar/src/app/foo.guard.ts');
// Should contain all implementations
implementationOptions.forEach((implementation: string) => {
expect(fileString).toContain(implementation);
const functionName = `${implementation.charAt(0).toLowerCase()}${implementation.slice(1)}`;
expect(fileString).toContain(functionName);
});
});
it('should add correct imports based on CanMatch implementation in (deprecated) class-based guards', async () => {
const implementationOptions = ['CanMatch'];
const options = { ...defaultOptions, implements: implementationOptions, functional: false };
const tree = await schematicRunner.runSchematic('guard', options, appTree);
const fileString = tree.readContent('/projects/bar/src/app/foo.guard.ts');
const expectedImports = `import { CanMatch, GuardResult, MaybeAsync, Route, UrlSegment } from '@angular/router';`;
expect(fileString).toContain(expectedImports);
});
it('should add correct imports based on CanActivate implementation in (deprecated) class-based guards', async () => {
const implementationOptions = ['CanActivate'];
const options = { ...defaultOptions, implements: implementationOptions, functional: false };
const tree = await schematicRunner.runSchematic('guard', options, appTree);
const fileString = tree.readContent('/projects/bar/src/app/foo.guard.ts');
const expectedImports =
`import { ActivatedRouteSnapshot, CanActivate, GuardResult, ` +
`MaybeAsync, RouterStateSnapshot } from '@angular/router';`;
expect(fileString).toContain(expectedImports);
});
it('should add correct imports based on canActivate functional guard', async () => {
const options = { ...defaultOptions, implements: ['CanActivate'] };
const tree = await schematicRunner.runSchematic('guard', options, appTree);
const fileString = tree.readContent('/projects/bar/src/app/foo.guard.ts');
const expectedImports = `import { CanActivateFn } from '@angular/router';`;
expect(fileString).toContain(expectedImports);
});
it('should add correct imports if multiple implementations was selected in (deprecated) class-based guards', async () => {
const implementationOptions = ['CanActivate', 'CanMatch', 'CanActivateChild'];
const options = { ...defaultOptions, implements: implementationOptions, functional: false };
const tree = await schematicRunner.runSchematic('guard', options, appTree);
const fileString = tree.readContent('/projects/bar/src/app/foo.guard.ts');
const expectedImports =
`import { ActivatedRouteSnapshot, CanActivate, CanActivateChild, CanMatch, GuardResult, ` +
`MaybeAsync, Route, RouterStateSnapshot, UrlSegment } from '@angular/router';`;
expect(fileString).toContain(expectedImports);
});
});
| |
001123
|
import { TestBed } from '@angular/core/testing';
import { <%= classify(name) %>Guard } from './<%= dasherize(name) %>.guard';
describe('<%= classify(name) %>Guard', () => {
let guard: <%= classify(name) %>Guard;
beforeEach(() => {
TestBed.configureTestingModule({});
guard = TestBed.inject(<%= classify(name) %>Guard);
});
it('should be created', () => {
expect(guard).toBeTruthy();
});
});
| |
001125
|
import { TestBed } from '@angular/core/testing';
import { <%= guardType %> } from '@angular/router';
import { <%= camelize(name) %>Guard } from './<%= dasherize(name) %>.guard';
describe('<%= camelize(name) %>Guard', () => {
const executeGuard: <%= guardType %> = (...guardParameters) =>
TestBed.runInInjectionContext(() => <%= camelize(name) %>Guard(...guardParameters));
beforeEach(() => {
TestBed.configureTestingModule({});
});
it('should be created', () => {
expect(executeGuard).toBeTruthy();
});
});
| |
001133
|
/**
* @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
*/
import { SchematicTestRunner } from '@angular-devkit/schematics/testing';
import { Schema as NgNewOptions } from './schema';
describe('Ng New Schematic', () => {
const schematicRunner = new SchematicTestRunner(
'@schematics/angular',
require.resolve('../collection.json'),
);
const defaultOptions: NgNewOptions = {
name: 'foo',
directory: 'bar',
version: '6.0.0',
};
it('should create files of a workspace', async () => {
const options = { ...defaultOptions };
const tree = await schematicRunner.runSchematic('ng-new', options);
const files = tree.files;
expect(files).toContain('/bar/angular.json');
});
it('should create files of an application', async () => {
const options = { ...defaultOptions };
const tree = await schematicRunner.runSchematic('ng-new', options);
const files = tree.files;
expect(files).toEqual(
jasmine.arrayContaining([
'/bar/tsconfig.app.json',
'/bar/src/main.ts',
'/bar/src/app/app.config.ts',
]),
);
expect(files).not.toEqual(jasmine.arrayContaining(['/bar/src/app/app.module.ts']));
});
it('should create module files of a standalone=false application', async () => {
const options = { ...defaultOptions, standalone: false };
const tree = await schematicRunner.runSchematic('ng-new', options);
const files = tree.files;
expect(files).toEqual(
jasmine.arrayContaining([
'/bar/tsconfig.app.json',
'/bar/src/main.ts',
'/bar/src/app/app.module.ts',
]),
);
});
it('should should set the prefix in angular.json and in app.component.ts', async () => {
const options = { ...defaultOptions, prefix: 'pre' };
const tree = await schematicRunner.runSchematic('ng-new', options);
const content = tree.readContent('/bar/angular.json');
expect(content).toMatch(/"prefix": "pre"/);
});
it('should set up the app module when standalone=false', async () => {
const options: NgNewOptions = {
name: 'foo',
version: '6.0.0',
standalone: false,
};
const tree = await schematicRunner.runSchematic('ng-new', options);
const moduleContent = tree.readContent('/foo/src/app/app.module.ts');
expect(moduleContent).toMatch(/declarations:\s*\[\s*AppComponent\s*\]/m);
});
it('createApplication=false should create an empty workspace', async () => {
const options = { ...defaultOptions, createApplication: false };
const tree = await schematicRunner.runSchematic('ng-new', options);
const files = tree.files;
expect(files).toContain('/bar/angular.json');
expect(files).not.toContain('/bar/src');
});
it('minimal=true should not create an e2e target', async () => {
const options = { ...defaultOptions, minimal: true };
const tree = await schematicRunner.runSchematic('ng-new', options);
const confContent = JSON.parse(tree.readContent('/bar/angular.json'));
expect(confContent.projects.foo.e2e).toBeUndefined();
});
it('should add packageManager option in angular.json', async () => {
const tree = await schematicRunner.runSchematic('ng-new', {
...defaultOptions,
packageManager: 'npm',
});
const { cli } = JSON.parse(tree.readContent('/bar/angular.json'));
expect(cli.packageManager).toBe('npm');
});
});
| |
001196
|
describe('addRootImport', () => {
it('should add a root import to an NgModule-based app', async () => {
await setupProject();
await testRule(
addRootImport(
projectName,
({ code, external }) => code`${external('MyModule', '@my/module')}.forRoot([])`,
),
host,
);
const content = readFile('app/app.module.ts');
assertContains(content, `import { MyModule } from '@my/module';`);
assertContains(content, `imports: [BrowserModule, MyModule.forRoot([])]`);
});
it('should add a root import to a standalone app', async () => {
await setupProject(true);
await testRule(
addRootImport(
projectName,
({ code, external }) => code`${external('MyModule', '@my/module')}`,
),
host,
);
const content = readFile('app/app.config.ts');
assertContains(content, `importProvidersFrom`);
assertContains(content, `import { MyModule } from '@my/module';`);
assertContains(content, `importProvidersFrom(MyModule)`);
});
it('should add a root import to a standalone app whose app config does not have a providers array', async () => {
await setupProject(true);
host.overwrite(
getPathWithinProject('app/app.config.ts'),
`
import { ApplicationConfig } from '@angular/core';
export const appConfig: ApplicationConfig = {};
`,
);
await testRule(
addRootImport(
projectName,
({ code, external }) => code`${external('MyModule', '@my/module')}`,
),
host,
);
const content = readFile('app/app.config.ts');
assertContains(
content,
`import { ApplicationConfig, importProvidersFrom } from '@angular/core';`,
);
assertContains(content, `import { MyModule } from '@my/module';`);
assertContains(content, `providers: [importProvidersFrom(MyModule)]`);
});
it('should add a root import to a standalone app with a config with providers', async () => {
await setupProject(true);
host.overwrite(
getPathWithinProject('app/app.config.ts'),
`
import { ApplicationConfig } from '@angular/core';
export const appConfig: ApplicationConfig = {
providers: [
{provide: 'foo', useValue: 123}
]
};
`,
);
await testRule(
addRootImport(
projectName,
({ code, external }) => code`${external('MyModule', '@my/module')}`,
),
host,
);
const content = readFile('app/app.config.ts');
assertContains(
content,
`import { ApplicationConfig, importProvidersFrom } from '@angular/core';`,
);
assertContains(content, `import { MyModule } from '@my/module';`);
assertContains(
content,
`providers: [
{provide: 'foo', useValue: 123},
importProvidersFrom(MyModule)
]`,
);
});
it(
'should add a root import to a standalone app whose app config does not have have ' +
'a providers array, but has another property',
async () => {
await setupProject(true);
host.overwrite(
getPathWithinProject('app/app.config.ts'),
`
import { ApplicationConfig } from '@angular/core';
export const appConfig: ApplicationConfig = {
otherProp: {},
};
`,
);
await testRule(
addRootImport(
projectName,
({ code, external }) => code`${external('MyModule', '@my/module')}`,
),
host,
);
const content = readFile('app/app.config.ts');
assertContains(
content,
`import { ApplicationConfig, importProvidersFrom } from '@angular/core';`,
);
assertContains(content, `import { MyModule } from '@my/module';`);
assertContains(
content,
`
export const appConfig: ApplicationConfig = {
otherProp: {},
providers: [importProvidersFrom(MyModule)]
};
`,
);
},
);
it('should add a root import to a standalone app with an inline app config', async () => {
await setupProject(true);
host.overwrite(
getPathWithinProject('main.ts'),
`
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app/app.component';
bootstrapApplication(AppComponent, {});
`,
);
await testRule(
addRootImport(
projectName,
({ code, external }) => code`${external('MyModule', '@my/module')}`,
),
host,
);
const content = readFile('main.ts');
assertContains(content, `import { importProvidersFrom } from '@angular/core';`);
assertContains(content, `import { MyModule } from '@my/module';`);
assertContains(
content,
`bootstrapApplication(AppComponent, {
providers: [importProvidersFrom(MyModule)]
});`,
);
});
it('should add a root import to a standalone app without an app config', async () => {
await setupProject(true);
host.overwrite(
getPathWithinProject('main.ts'),
`
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app/app.component';
bootstrapApplication(AppComponent);
`,
);
await testRule(
addRootImport(
projectName,
({ code, external }) => code`${external('MyModule', '@my/module')}`,
),
host,
);
const content = readFile('main.ts');
assertContains(content, `import { importProvidersFrom } from '@angular/core';`);
assertContains(content, `import { MyModule } from '@my/module';`);
assertContains(
content,
`bootstrapApplication(AppComponent, {
providers: [importProvidersFrom(MyModule)]
});`,
);
});
it('should add a root import to a standalone app with a merged app config', async () => {
await setupProject(true);
host.overwrite(
getPathWithinProject('main.ts'),
`
import { mergeApplicationConfig } from '@angular/core';
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app.component';
bootstrapApplication(AppComponent, mergeApplicationConfig(a, b));
`,
);
await testRule(
addRootImport(
projectName,
({ code, external }) => code`${external('MyModule', '@my/module')}`,
),
host,
);
const content = readFile('main.ts');
assertContains(
content,
`import { mergeApplicationConfig, importProvidersFrom } from '@angular/core';`,
);
assertContains(content, `import { MyModule } from '@my/module';`);
assertContains(
content,
`bootstrapApplication(AppComponent, mergeApplicationConfig(a, b, {
providers: [importProvidersFrom(MyModule)]
}));`,
);
});
it('should alias symbols that conflict with existing code', async () => {
await setupProject();
await testRule(
addRootImport(
projectName,
({ code, external }) => code`${external('BrowserModule', '@my/module')}.forRoot([])`,
),
host,
);
const content = readFile('app/app.module.ts');
assertContains(content, `import { BrowserModule as BrowserModule_alias } from '@my/module';`);
assertContains(content, `imports: [BrowserModule, BrowserModule_alias.forRoot([])]`);
});
it('should throw an error if the bootstrapApplication code has no arguments', async () => {
await setupProject(true);
const mainPath = getPathWithinProject('main.ts');
host.overwrite(
mainPath,
`
import { bootstrapApplication } from '@angular/platform-browser';
bootstrapApplication();
`,
);
const promise = testRule(
addRootImport(
projectName,
({ code, external }) => code`${external('MyModule', '@my/module')}`,
),
host,
);
// eslint-disable-next-line @typescript-eslint/no-floating-promises
await expectAsync(promise).toBeRejectedWithError(
`Cannot add provider to invalid bootstrapApplication call in ${mainPath}`,
);
});
it('should throw an error if the bootstrapApplication call cannot be analyzed', async () => {
await setupProject(true);
const mainPath = getPathWithinProject('main.ts');
host.overwrite(
mainPath,
`
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app/app.component';
import { appConfig } from '@external/app-config';
bootstrapApplication(AppComponent, appConfig);
`,
);
const promise = testRule(
addRootImport(
projectName,
({ code, external }) => code`${external('MyModule', '@my/module')}`,
),
host,
);
// eslint-disable-next-line @typescript-eslint/no-floating-promises
await expectAsync(promise).toBeRejectedWithError(
`Cannot statically analyze bootstrapApplication call in ${mainPath}`,
);
});
| |
001297
|
# @angular-devkit/build-angular
This package contains [Architect builders](/packages/angular_devkit/architect/README.md) used to build and test Angular applications and libraries.
## Builders
| Name | Description |
| --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| application | Build an Angular application targeting a browser and server environment using [esbuild](https://esbuild.github.io). |
| app-shell | Build an Angular [App shell](https://angular.dev/ecosystem/service-workers/app-shell). |
| browser | Build an Angular application targeting a browser environment using [Webpack](https://webpack.js.org). |
| browser-esbuild | Build an Angular application targeting a browser environment using [esbuild](https://esbuild.github.io). |
| dev-server | A development server that provides live reloading. |
| extract-i18n | Extract i18n messages from an Angular application. |
| karma | Execute unit tests using [Karma](https://github.com/karma-runner/karma) test runner. |
| ng-packagr | Build and package an Angular library in [Angular Package Format (APF)](https://angular.dev/tools/libraries/angular-package-format) format using [ng-packagr](https://github.com/ng-packagr/ng-packagr). |
| prerender | [Prerender](https://angular.dev/guide/prerendering) pages of your application. Prerendering is the process where a dynamic page is processed at build time generating static HTML. |
| server | Build an Angular application targeting a [Node.js](https://nodejs.org) environment. |
| ssr-dev-server | A development server which offers live reload during development, but uses server-side rendering. |
| protractor | **Deprecated** - Run end-to-end tests using [Protractor](https://www.protractortest.org/) framework. |
## Disclaimer
While the builders when executed via the Angular CLI and their associated options are considered stable, the programmatic APIs are not considered officially supported and are not subject to the breaking change guarantees of SemVer.
| |
001348
|
export async function getCommonConfig(wco: WebpackConfigOptions): Promise<Configuration> {
const { root, projectRoot, buildOptions, tsConfig, projectName, sourceRoot, tsConfigPath } = wco;
const {
cache,
codeCoverage,
crossOrigin = 'none',
platform = 'browser',
aot = true,
codeCoverageExclude = [],
main,
sourceMap: {
styles: stylesSourceMap,
scripts: scriptsSourceMap,
vendor: vendorSourceMap,
hidden: hiddenSourceMap,
},
optimization: { styles: stylesOptimization, scripts: scriptsOptimization },
commonChunk,
vendorChunk,
subresourceIntegrity,
verbose,
poll,
webWorkerTsConfig,
externalDependencies = [],
allowedCommonJsDependencies,
} = buildOptions;
const isPlatformServer = buildOptions.platform === 'server';
const extraPlugins: { apply(compiler: Compiler): void }[] = [];
const extraRules: RuleSetRule[] = [];
const entryPoints: Configuration['entry'] = {};
// Load ESM `@angular/compiler-cli` using the TypeScript dynamic import workaround.
// Once TypeScript provides support for keeping the dynamic import this workaround can be
// changed to a direct dynamic import.
const { VERSION: NG_VERSION } =
await loadEsmModule<typeof import('@angular/compiler-cli')>('@angular/compiler-cli');
const { GLOBAL_DEFS_FOR_TERSER, GLOBAL_DEFS_FOR_TERSER_WITH_AOT } = await loadEsmModule<
typeof import('@angular/compiler-cli/private/tooling')
>('@angular/compiler-cli/private/tooling');
// determine hashing format
const hashFormat = getOutputHashFormat(buildOptions.outputHashing);
if (buildOptions.progress) {
extraPlugins.push(new ProgressPlugin(platform));
}
const localizePackageInitEntryPoint = '@angular/localize/init';
const hasLocalizeType = tsConfig.options.types?.some(
(t) => t === '@angular/localize' || t === localizePackageInitEntryPoint,
);
if (hasLocalizeType) {
entryPoints['main'] = [localizePackageInitEntryPoint];
}
if (buildOptions.main) {
const mainPath = path.resolve(root, buildOptions.main);
if (Array.isArray(entryPoints['main'])) {
entryPoints['main'].push(mainPath);
} else {
entryPoints['main'] = [mainPath];
}
}
if (isPlatformServer) {
// Fixes Critical dependency: the request of a dependency is an expression
extraPlugins.push(new ContextReplacementPlugin(/@?hapi|express[\\/]/));
if (
isPackageInstalled(wco.root, '@angular/platform-server') &&
Array.isArray(entryPoints['main'])
) {
// This import must come before any imports (direct or transitive) that rely on DOM built-ins being
// available, such as `@angular/elements`.
entryPoints['main'].unshift('@angular/platform-server/init');
}
}
const polyfills = [...buildOptions.polyfills];
if (!aot) {
polyfills.push('@angular/compiler');
}
if (polyfills.length) {
// `zone.js/testing` is a **special** polyfill because when not imported in the main it fails with the below errors:
// `Error: Expected to be running in 'ProxyZone', but it was not found.`
// This was also the reason why previously it was imported in `test.ts` as the first module.
// From Jia li:
// This is because the jasmine functions such as beforeEach/it will not be patched by zone.js since
// jasmine will not be loaded yet, so the ProxyZone will not be there. We have to load zone-testing.js after
// jasmine is ready.
// We could force loading 'zone.js/testing' prior to jasmine by changing the order of scripts in 'karma-context.html'.
// But this has it's own problems as zone.js needs to be loaded prior to jasmine due to patching of timing functions
// See: https://github.com/jasmine/jasmine/issues/1944
// Thus the correct order is zone.js -> jasmine -> zone.js/testing.
const zoneTestingEntryPoint = 'zone.js/testing';
const polyfillsExludingZoneTesting = polyfills.filter((p) => p !== zoneTestingEntryPoint);
if (Array.isArray(entryPoints['polyfills'])) {
entryPoints['polyfills'].push(...polyfillsExludingZoneTesting);
} else {
entryPoints['polyfills'] = polyfillsExludingZoneTesting;
}
if (polyfillsExludingZoneTesting.length !== polyfills.length) {
if (Array.isArray(entryPoints['main'])) {
entryPoints['main'].unshift(zoneTestingEntryPoint);
} else {
entryPoints['main'] = [zoneTestingEntryPoint];
}
}
}
if (allowedCommonJsDependencies) {
// When this is not defined it means the builder doesn't support showing common js usages.
// When it does it will be an array.
extraPlugins.push(
new CommonJsUsageWarnPlugin({
allowedDependencies: allowedCommonJsDependencies,
}),
);
}
// process global scripts
// Add a new asset for each entry.
for (const { bundleName, inject, paths } of globalScriptsByBundleName(buildOptions.scripts)) {
// Lazy scripts don't get a hash, otherwise they can't be loaded by name.
const hash = inject ? hashFormat.script : '';
extraPlugins.push(
new ScriptsWebpackPlugin({
name: bundleName,
sourceMap: scriptsSourceMap,
scripts: paths,
filename: `${path.basename(bundleName)}${hash}.js`,
basePath: root,
}),
);
}
// process asset entries
if (buildOptions.assets.length) {
extraPlugins.push(
new CopyWebpackPlugin({
patterns: assetPatterns(root, buildOptions.assets),
}),
);
}
if (buildOptions.extractLicenses) {
const LicenseWebpackPlugin = require('license-webpack-plugin').LicenseWebpackPlugin;
extraPlugins.push(
new LicenseWebpackPlugin({
stats: {
warnings: false,
errors: false,
},
perChunkOutput: false,
outputFilename: '3rdpartylicenses.txt',
skipChildCompilers: true,
}),
);
}
if (scriptsSourceMap || stylesSourceMap) {
const include = [];
if (scriptsSourceMap) {
include.push(/js$/);
}
if (stylesSourceMap) {
include.push(/css$/);
}
extraPlugins.push(new DevToolsIgnorePlugin());
extraPlugins.push(
new SourceMapDevToolPlugin({
filename: '[file].map',
include,
// We want to set sourceRoot to `webpack:///` for non
// inline sourcemaps as otherwise paths to sourcemaps will be broken in browser
// `webpack:///` is needed for Visual Studio breakpoints to work properly as currently
// there is no way to set the 'webRoot'
sourceRoot: 'webpack:///',
moduleFilenameTemplate: '[resource-path]',
append: hiddenSourceMap ? false : undefined,
}),
);
}
if (verbose) {
extraPlugins.push(new WatchFilesLogsPlugin());
}
if (buildOptions.statsJson) {
extraPlugins.push(
new JsonStatsPlugin(path.resolve(root, buildOptions.outputPath, 'stats.json')),
);
}
if (subresourceIntegrity) {
extraPlugins.push(
new SubresourceIntegrityPlugin({
hashFuncNames: ['sha384'],
}),
);
}
if (scriptsSourceMap || stylesSourceMap) {
extraRules.push({
test: /\.[cm]?jsx?$/,
enforce: 'pre',
loader: require.resolve('source-map-loader'),
options: {
filterSourceMappingUrl: (_mapUri: string, resourcePath: string) => {
if (vendorSourceMap) {
// Consume all sourcemaps when vendor option is enabled.
return true;
}
// Don't consume sourcemaps in node_modules when vendor is disabled.
// But, do consume local libraries sourcemaps.
return !resourcePath.includes('node_modules');
},
},
});
}
if (main || polyfills) {
extraRules.push({
test: tsConfig.options.allowJs ? /\.[cm]?[tj]sx?$/ : /\.[cm]?tsx?$/,
loader: AngularWebpackLoaderPath,
// The below are known paths that are not part of the TypeScript compilation even when allowJs is enabled.
exclude: [
/[\\/]node_modules[/\\](?:css-loader|mini-css-extract-plugin|webpack-dev-server|webpack)[/\\]/,
],
});
extraPlugins.push(createIvyPlugin(wco, aot, tsConfigPath));
}
if (webWorkerTsConfig) {
extraPlugins.push(createIvyPlugin(wco, false, path.resolve(wco.root, webWorkerTsConfig)));
}
const extraMinimizers = [];
| |
001618
|
# Overview
Jobs is a high-order API that adds inputs, runtime type checking, sequencing, and other
functionality on top of RxJS' `Observable`s.
# Background
An `Observable` (at a higher level) is a function that receives a `Subscriber`, and outputs
multiple values, and finishes once it calls the `Subscriber.prototype.complete()` method (in
JavaScript):
```javascript
const output1To10EverySecond = function (subscriber) {
let t = 0;
const i = setInterval(() => {
t++;
subscriber.next(t);
if (t === 10) {
subscriber.complete(t);
}
}, 1000);
return () => clearInterval(i);
};
const stream$ = new Observable(output1To10EverySecond);
// Start the function, and output 1 to 100, once per line.
stream$.subscribe((x) => console.log(x));
```
This, of course, can be typed in TypeScript, but those types are not enforced at runtime.
# Glossary
- `job handler`. The function that implements the job's logic.
- `raw input`. The input observable sending messages to the job. These messages are of type
`JobInboundMessage`.
- `raw output`. The output observer returned from the `job handler`. Messages on this observable
are of type `JobOutboundMessage`.
# Description
A `JobHandler`, similar to observables, is a function that receives an argument and a context, and
returns an `Observable` of messages, which can include outputs that are typed at runtime (using a
Json Schema):
```javascript
const output1ToXEverySecond = function (x, context) {
return new Observable((subscriber) => {
let t = 0;
// Notify our users that the actual work is started.
subscriber.next({ kind: JobOutboundMessageKind.Start });
const i = setInterval(() => {
t++;
subscriber.next({ kind: JobOutboundMessageKind.Output, value: t });
if (t === x) {
subscriber.next({ kind: JobOutboundMessageKind.End });
subscriber.complete();
}
}, 1000);
return () => {
clearInterval(i);
};
});
};
// For now, jobs can not be called without a registry and scheduler.
const registry = new SimpleJobRegistry();
registry.register('output-from-1-to-x', output1ToXEverySecond, {
argument: { type: 'number' },
output: { type: 'number' },
});
const scheduler = new SimpleScheduler(registry);
// Need to keep the same name that the registry would understand.
// Count from 1 to 10.
const job = scheduler.schedule('output-from-1-to-x', 10);
// A Job<> instance has more members, but we only want the output values here.
job.output.subscribe((x) => console.log(x));
```
This seems like a lot of boilerplate in comparison, but there are a few advantages;
1. lifecycle. Jobs can tell when they start doing work and when work is done.
1. everything is typed, even at runtime.
1. the context also contains an input Observable that receives typed input messages, including
input values, and stop requests.
1. jobs can also schedule other jobs and wait for them, even if they don't know if a job is
implemented in the system.
## Diagram
A simpler way to think about jobs in contrast to observables is that job are closer to a Unix
process. It has an argument (command line flags), receive inputs (STDIN and interrupt signals),
and output values (STDOUT) as well as diagnostic (STDERR). They can be plugged one into another
(piping), and can be transformed, synchronized and scheduled (fork, exec, cron).
```plain
- given A the type of the argument
- given I the type of the input
- given O the type of the output
,______________________
JobInboundMessage<I> --> | handler(argument: A) | --> JobOutboundMessage<O>
- JobOutboundMessageKind.Output
- ...
```
`JobInboundMessage` includes:
1. `JobInboundMessageKind.Ping`. A simple message that should be answered with
`JobOutboundMessageKind.Pong` when the job is responsive. The `id` field of the message should
be used when returning `Pong`.
1. `JobInboundMessageKind.Stop`. The job should be stopped. This is used when
cancelling/unsubscribing from the `output` (or by calling `stop()`). Any inputs or outputs
after this message will be ignored.
1. `JobInboundMessageKind.Input` is used when sending inputs to a job. These correspond to the
`next` methods of an `Observer` and are reported to the job through its `context.input`
Observable. There is no way to communicate an error to the job.
`JobOutboundMessage` includes:
1. `JobOutboundMessageKind.Ready`. The `Job<>` was created, its dependencies are done, and the
library is validating Argument and calling the internal job code.
1. `JobOutboundMessageKind.Start`. The job code itself should send that message when started.
`createJobHandler()` will do it automatically.
1. `JobOutboundMessageKind.End`. The job has ended. This is done by the job itself and should
always be sent when completed. The scheduler will listen to this message to set the state and
unblock dependent jobs. `createJobHandler()` automatically send this message.
1. `JobOutboundMessageKind.Pong`. The job should answer a `JobInboundMessageKind.Ping` message with
this. Automatically done by `createJobHandler()`.
1. `JobOutboundMessageKind.Output`. An `Output` has been generated by the job.
1. `JobOutboundMessageKind.ChannelMessage`, `JobOutboundMessageKind.ChannelError` and
`JobOutboundMessageKind.ChannelComplete` are used for output channels. These correspond to
the `next`, `error` and `complete` methods of an `Observer` and are available to the callee
through the `job.channels` map of Observable.
Utilities should have some filtering and dispatching to separate observables, as a convenience for
the user. An example of this would be the `Job.prototype.output` observable which only contains
the value contained by messages of type `JobOutboundMessageKind.Output`.
| |
001630
|
# Creating Jobs
A job is at its core a function with a description object attached to it. The description object
stores the JSON schemas used to validate the types of the argument passed in, the input and
output values. By default, a job accepts and can output any JSON object.
```typescript
import { Observable } from 'rxjs';
import { jobs } from '@angular-devkit/core';
const argument = {
type: 'array',
items: { type: 'number' },
};
const output = {
type: 'number',
};
export function add(argument: number[]): Observable<jobs.JobOutboundMessage<number>> {
return new Observable((o) => {
o.next({ kind: jobs.JobOutboundMessageKind.Start });
o.next({
kind: jobs.JobOutboundMessageKind.Output,
output: argument.reduce((total, curr) => total + curr, 0),
});
o.next({ kind: jobs.JobOutboundMessageKind.End });
o.complete();
});
}
// Add a property to `add` to make it officially a JobHandler. The Job system does not recognize
// any function as a JobHandler.
add.jobDescription = {
argument: argument,
output: output,
};
// Call the job with an array as argument, and log its output.
declare const scheduler: jobs.Scheduler;
scheduler.schedule('add', [1, 2, 3, 4]).output.subscribe((x) => console.log(x)); // Will output 10.
```
This is a lot of boilerplate, so we made some helpers to improve readability and manage argument,
input and output automatically:
```typescript
// Add is a JobHandler function, like the above.
export const add = jobs.createJobHandler<number[], number>((argument) =>
argument.reduce((total, curr) => total + curr, 0),
);
// Schedule like above.
```
You can also return a Promise or an Observable, as jobs are asynchronous. This helper will set
start and end messages appropriately. It will also manage channels automatically (see below).
A more complex job can be declared like this:
```typescript
import { Observable } from 'rxjs';
import { jobs } from '@angular-devkit/core';
// Show progress with each count in a separate output channel. Output "more" in a channel.
export const count = jobs.createJobHandler<number, number>(
// Receive a context that contains additional methods to create channels.
(argument: number, { createChannel }) =>
new Observable<number>((o) => {
const side = createChannel('side', { type: 'string', const: 'more' });
const progress = createChannel('progress', { type: 'number' });
let i = 0;
function doCount() {
o.next(i++);
progress.next(i / argument);
side.next('more');
if (i < argument) {
setTimeout(doCount, 100);
} else {
o.complete();
}
}
setTimeout(doCount, 100);
}),
{
argument: { type: 'number' },
output: { type: 'number' },
},
);
// Get a hold of a scheduler that refers to the job above.
declare const scheduler: jobs.Scheduler;
const job = scheduler.schedule('count', 0);
job.getChannel('side').subscribe((x) => console.log(x));
// You can type a channel too. Messages will be filtered out.
job.getChannel<number>('progress', { type: 'number' }).subscribe((x) => console.log(x));
```
## <a name="Communicating"></a>Communicating With Jobs
Jobs can be started and updated in a separate process or thread, and as such communication with a
job should avoid using global objects (which might not be shared). The jobs API and schedulers
provide 2 communication streams (one for input and the other for output), named `inboundBus` and
`outboundBus`.
### Raw Input Stream
The `schedule()` function returns a `Job<>` interface that contains a `inboundBus` member of type
`Observer<JobInboundMessage>`. All messages sent _to_ the job goes through this stream. The `kind`
member of the `JobInboundMessage` interface dictates what kind of message it is sending:
1. `JobInboundMessageKind.Ping`. A simple message that should be answered with
`JobOutboundMessageKind.Pong` when the job is responsive. The `id` field of the message should
be used when returning `Pong`.
1. `JobInboundMessageKind.Stop`. The job should be stopped. This is used when
cancelling/unsubscribing from the `output` (or by calling `stop()`). Any inputs or outputs
after this message will be ignored.
1. `JobInboundMessageKind.Input` is used when sending inputs to a job. These correspond to the
`next` methods of an `Observer` and are reported to the job through its `context.input`
Observable. There is no way to communicate an error to the job.
Using the `createJobHandler()` helper, all those messages are automatically handled by the
boilerplate code. If you need direct access to raw inputs, you should subscribe to the
`context.inboundBus` Observable.
### Raw Output Stream
The `Job<>` interface also contains a `outboundBus` member (of type
`Observable<JobOutboundMessage<O>>` where `O` is the typed output of the job) which is the output
complement of `inboundBus`. All messages sent _from_ the job goes through this stream. The `kind`
member of the `JobOutboundMessage<O>` interface dictates what kind of message it is sending:
1. `JobOutboundMessageKind.Create`. The `Job<>` was created, its dependencies are done, and the
library is validating Argument and calling the internal job code.
1. `JobOutboundMessageKind.Start`. The job code itself should send that message when started.
`createJobHandler()` will do it automatically.
1. `JobOutboundMessageKind.End`. The job has ended. This is done by the job itself and should always
be sent when completed. The scheduler will listen to this message to set the state and unblock
dependent jobs. `createJobHandler()` automatically send this message.
1. `JobOutboundMessageKind.Pong`. The job should answer a `JobInboundMessageKind.Ping` message with
this. Automatically done by `createJobHandler()`.
1. `JobOutboundMessageKind.Output`. An `Output` has been generated by the job.
1. `JobOutboundMessageKind.ChannelMessage`, `JobOutboundMessageKind.ChannelError` and
`JobOutboundMessageKind.ChannelComplete` are used for output channels. These correspond to the
`next`, `error` and `complete` methods of an `Observer` and are available to the callee through
the `job.channels` map of Observable.
Those messages can be accessed directly through the `job.outboundBus` member. The job itself should
return an `Observable<JobOutboundMessage<O>>`. The `createJobHandler()` helper handles most of use
cases of this and makes it easier for jobs to handle this.
## Job Dispatchers
Dispatchers are a helper that redirect to different jobs given conditions. To create a job
dispatcher, use the `createDispatcher()` function:
```typescript
import { jobs } from '@angular-devkit/core';
// A dispatcher that installs node modules given a user's preference.
const dispatcher = jobs.createDispatcher({
name: 'node-install',
argument: { properties: { moduleName: { type: 'string' } } },
output: { type: 'boolean' },
});
const npmInstall = jobs.createJobHandler(/* ... */, { name: 'npm-install' });
const yarnInstall = jobs.createJobHandler(/* ... */, { name: 'yarn-install' });
const pnpmInstall = jobs.createJobHandler(/* ... */, { name: 'pnpm-install' });
declare const registry: jobs.SimpleJobRegistry;
registry.register(dispatcher);
registry.register(npmInstall);
registry.register(yarnInstall);
registry.register(pnpmInstall);
// Default to npm.
dispatcher.setDefaultDelegate(npmInstall.name);
// If the user is asking for yarn over npm, uses it.
dispatcher.addConditionalDelegate(() => userWantsYarn, yarnInstall.name);
```
| |
001649
|
/**
* @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
*/
/**
* This file includes polyfills needed by Angular and is loaded before the app.
* You can add your own extra polyfills to this file.
*
* This file is divided into 2 sections:
* 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
* 2. Application imports. Files imported after ZoneJS that should be loaded before your main
* file.
*
* The current setup is for so-called "evergreen" browsers; the last versions of browsers that
* automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
* Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
*
* Learn more in https://angular.dev/reference/versions#browser-support
*/
/***************************************************************************************************
* BROWSER POLYFILLS
*/
/**
* Required to support Web Animations `@angular/platform-browser/animations`.
* Needed for: All but Chrome, Firefox and Opera. http://caniuse.com/#feat=web-animation
**/
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.
/***************************************************************************************************
* Zone JS is required by default for Angular itself.
*/
import 'zone.js'; // Included with Angular CLI.
/***************************************************************************************************
* APPLICATION IMPORTS
*/
| |
001654
|
/**
* @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
*/
import { existsSync } from 'fs';
import * as path from 'path';
import { URL, pathToFileURL } from 'url';
import { Compilation, Configuration } from 'webpack';
export interface EmittedFiles {
id?: string;
name?: string;
file: string;
initial: boolean;
asset?: boolean;
extension: string;
}
export function getEmittedFiles(compilation: Compilation): EmittedFiles[] {
const files: EmittedFiles[] = [];
const chunkFileNames = new Set<string>();
// adds all chunks to the list of emitted files such as lazy loaded modules
for (const chunk of compilation.chunks) {
for (const file of chunk.files) {
if (chunkFileNames.has(file)) {
continue;
}
chunkFileNames.add(file);
files.push({
id: chunk.id?.toString(),
name: chunk.name,
file,
extension: path.extname(file),
initial: chunk.isOnlyInitial(),
});
}
}
// add all other files
for (const file of Object.keys(compilation.assets)) {
// Chunk files have already been added to the files list above
if (chunkFileNames.has(file)) {
continue;
}
files.push({ file, extension: path.extname(file), initial: false, asset: true });
}
return files;
}
/**
* This uses a dynamic import to load a module which may be ESM.
* CommonJS code can load ESM code via a dynamic import. Unfortunately, TypeScript
* will currently, unconditionally downlevel dynamic import into a require call.
* require calls cannot load ESM code and will result in a runtime error. To workaround
* this, a Function constructor is used to prevent TypeScript from changing the dynamic import.
* Once TypeScript provides support for keeping the dynamic import this workaround can
* be dropped.
*
* @param modulePath The path of the module to load.
* @returns A Promise that resolves to the dynamically imported module.
*/
function loadEsmModule<T>(modulePath: string | URL): Promise<T> {
return new Function('modulePath', `return import(modulePath);`)(modulePath) as Promise<T>;
}
export async function getWebpackConfig(configPath: string): Promise<Configuration> {
if (!existsSync(configPath)) {
throw new Error(`Webpack configuration file ${configPath} does not exist.`);
}
switch (path.extname(configPath)) {
case '.mjs':
// Load the ESM configuration file using the TypeScript dynamic import workaround.
// Once TypeScript provides support for keeping the dynamic import this workaround can be
// changed to a direct dynamic import.
return (await loadEsmModule<{ default: Configuration }>(pathToFileURL(configPath))).default;
case '.cjs':
return require(configPath);
default:
// The file could be either CommonJS or ESM.
// CommonJS is tried first then ESM if loading fails.
try {
return require(configPath);
} catch (e) {
if ((e as NodeJS.ErrnoException).code === 'ERR_REQUIRE_ESM') {
// Load the ESM configuration file using the TypeScript dynamic import workaround.
// Once TypeScript provides support for keeping the dynamic import this workaround can be
// changed to a direct dynamic import.
return (await loadEsmModule<{ default: Configuration }>(pathToFileURL(configPath)))
.default;
}
throw e;
}
}
}
| |
001815
|
/**
* @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
*/
/**
* This file includes polyfills needed by Angular and is loaded before the app.
* You can add your own extra polyfills to this file.
*
* This file is divided into 2 sections:
* 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
* 2. Application imports. Files imported after ZoneJS that should be loaded before your main
* file.
*
* The current setup is for so-called "evergreen" browsers; the last versions of browsers that
* automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
* Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
*
* Learn more in https://angular.dev/reference/versions#browser-support
*/
/***************************************************************************************************
* BROWSER POLYFILLS
*/
/** IE10 and IE11 requires the following for NgClass support on SVG elements */
// import 'classlist.js'; // Run `npm install --save classlist.js`.
/**
* Web Animations `@angular/platform-browser/animations`
* Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.
* Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0).
*/
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.
/**
* By default, zone.js will patch all possible macroTask and DomEvents
* user can disable parts of macroTask/DomEvents patch by setting following flags
* because those flags need to be set before `zone.js` being loaded, and webpack
* will put import in the top of bundle, so user need to create a separate file
* in this directory (for example: zone-flags.ts), and put the following flags
* into that file, and then add the following code before importing zone.js.
* import './zone-flags.ts';
*
* The flags allowed in zone-flags.ts are listed here.
*
* The following flags will work for all browsers.
*
* (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
* (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
* (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
*
* in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
* with the following flag, it will bypass `zone.js` patch for IE/Edge
*
* (window as any).__Zone_enable_cross_context_check = true;
*
*/
/***************************************************************************************************
* Zone JS is required by default for Angular itself.
*/
import 'zone.js'; // Included with Angular CLI.
/***************************************************************************************************
* APPLICATION IMPORTS
*/
| |
001836
|
# 19.0.0-next.9 (2024-10-10)
## Breaking Changes
### compiler
- `this.foo` property reads no longer refer to template context variables. If you intended to read the template variable, do not use `this.`.
### core
- The deprecated `factories` property in `KeyValueDiffers` has been removed.
### localize
- The `name` option in the `ng add @localize` schematic has been removed in favor of the `project` option.
### platform-browser
- The deprecated `BrowserModule.withServerTransition` method has been removed. Please use the `APP_ID` DI token to set the application id instead.
### compiler
| Commit | Type | Description |
| -- | -- | -- |
| [09f589f000](https://github.com/angular/angular/commit/09f589f0006f4b428b675b83c12c0dc8ebb7e45f) | fix | `this.a` should always refer to class property `a` ([#55183](https://github.com/angular/angular/pull/55183)) |
| [e8d1944999](https://github.com/angular/angular/commit/e8d1944999e1fdfbd67630d475334c0d7f41a0eb) | fix | add multiple :host and nested selectors support ([#57796](https://github.com/angular/angular/pull/57796)) |
| [82144b6d63](https://github.com/angular/angular/commit/82144b6d63d072d112d1a7f4dcc018a1d64bb994) | fix | allow combinators inside pseudo selectors ([#57796](https://github.com/angular/angular/pull/57796)) |
| [292ea4714f](https://github.com/angular/angular/commit/292ea4714fb7e76cf1748d2f9059991e05c42574) | fix | fix comment typo ([#57796](https://github.com/angular/angular/pull/57796)) |
| [69529d8873](https://github.com/angular/angular/commit/69529d8873fbd7888ab68fddc6e7c654c5065764) | fix | fix parsing of the :host-context with pseudo selectors ([#57796](https://github.com/angular/angular/pull/57796)) |
| [2374b87b64](https://github.com/angular/angular/commit/2374b87b643e0373f85cf126d4b01b2fff785f64) | fix | preserve attributes attached to :host selector ([#57796](https://github.com/angular/angular/pull/57796)) |
| [46a6324c82](https://github.com/angular/angular/commit/46a6324c82a41b69c16a4c8c9f3fc52d1ecf6917) | fix | scope :host-context inside pseudo selectors, do not decrease specificity ([#57796](https://github.com/angular/angular/pull/57796)) |
| [bc5f1175e9](https://github.com/angular/angular/commit/bc5f1175e9f39dfa2699c4de19ee9af4ce4b50d1) | fix | transform pseudo selectors correctly for the encapsulated view ([#57796](https://github.com/angular/angular/pull/57796)) |
### compiler-cli
| Commit | Type | Description |
| -- | -- | -- |
| [8d8c03abc4](https://github.com/angular/angular/commit/8d8c03abc40099da268d7301f029954f3e3f1c90) | fix | defer symbols only used in types ([#58104](https://github.com/angular/angular/pull/58104)) |
### core
| Commit | Type | Description |
| -- | -- | -- |
| [ee426c62f0](https://github.com/angular/angular/commit/ee426c62f07579ec7dc89ce9582972cc1e3471d4) | fix | allow signal write error ([#57973](https://github.com/angular/angular/pull/57973)) |
| [67db4305c2](https://github.com/angular/angular/commit/67db4305c2261625fd54d284c29e94e26cb19488) | fix | clean up afterRender after it is executed ([#58119](https://github.com/angular/angular/pull/58119)) |
| [656b5d3e78](https://github.com/angular/angular/commit/656b5d3e78004229a76488e0de1eb1d3508d8f6d) | fix | Re-assign error codes to be within core bounds (<1000) ([#53455](https://github.com/angular/angular/pull/53455)) |
| [97fb86d331](https://github.com/angular/angular/commit/97fb86d3310ae891ba4d894a8d3479eda08bd4c2) | perf | set encapsulation to `None` for empty component styles ([#57130](https://github.com/angular/angular/pull/57130)) |
| [c15ec36bd1](https://github.com/angular/angular/commit/c15ec36bd1dcff4c7c387337a5bcfd928994db2f) | refactor | remove deprecated `factories` Property in `KeyValueDiffers` ([#58064](https://github.com/angular/angular/pull/58064)) |
### language-service
| Commit | Type | Description |
| -- | -- | -- |
| [bc83fc1e2e](https://github.com/angular/angular/commit/bc83fc1e2ebac1a99b6e8ed63cea48f48dd7c863) | feat | support converting to signal queries in VSCode extension ([#58106](https://github.com/angular/angular/pull/58106)) |
### localize
| Commit | Type | Description |
| -- | -- | -- |
| [9c3bd1b5d1](https://github.com/angular/angular/commit/9c3bd1b5d119bdcd4818892deae7f8a17861da42) | refactor | remove deprecated `name` option. ([#58063](https://github.com/angular/angular/pull/58063)) |
### migrations
| Commit | Type | Description |
| -- | -- | -- |
| [c1aa411cf1](https://github.com/angular/angular/commit/c1aa411cf13259d991c8f224a2bafc3e9763fe8d) | fix | properly resolve tsconfig paths on windows ([#58137](https://github.com/angular/angular/pull/58137)) |
### platform-browser
| Commit | Type | Description |
| -- | -- | -- |
| [5c61f46409](https://github.com/angular/angular/commit/5c61f46409855bb8fe66d71a9c16c00753032987) | refactor | remove deprecated `BrowserModule.withServerTransition` method ([#58062](https://github.com/angular/angular/pull/58062)) |
### platform-server
| Commit | Type | Description |
| -- | -- | -- |
| [9e82559de4](https://github.com/angular/angular/commit/9e82559de4e99a1aedf645a05b01fc08d3f4b1b1) | fix | destroy `PlatformRef` when error happens during the `bootstrap()` phase ([#58112](https://github.com/angular/angular/pull/58112)) |
### service-worker
| Commit | Type | Description |
| -- | -- | -- |
| [1479af978c](https://github.com/angular/angular/commit/1479af978cd2bbe4ee9f1ca9682684b8e5135fa7) | feat | finish implementation of refreshAhead feature ([#53356](https://github.com/angular/angular/pull/53356)) |
<!-- CHANGELOG SPLIT MARKER -->
<a name="18.2.8"></a>
| |
001839
|
# 19.0.0-next.6 (2024-09-18)
### compiler-cli
| Commit | Type | Description |
| -- | -- | -- |
| [f611faadfe](https://github.com/angular/angular/commit/f611faadfedd8dc2c3291da98e2c2c60fe3984bd) | fix | extended diagnostics not validating ICUs ([#57845](https://github.com/angular/angular/pull/57845)) |
### core
| Commit | Type | Description |
| -- | -- | -- |
| [3ebe6b4ad4](https://github.com/angular/angular/commit/3ebe6b4ad401337e18619edc34477ae98226fa3e) | feat | Add async `run` method on `ExperimentalPendingTasks` ([#56546](https://github.com/angular/angular/pull/56546)) |
| [1b1519224d](https://github.com/angular/angular/commit/1b1519224d10c1cd25d05d7b958772b9adee1e1a) | feat | mark input, output and model APIs as stable ([#57804](https://github.com/angular/angular/pull/57804)) |
| [e5adf92965](https://github.com/angular/angular/commit/e5adf9296595644e415d5c147df08890be01ba77) | feat | stabilize `@let` syntax ([#57813](https://github.com/angular/angular/pull/57813)) |
| [4231e8f28f](https://github.com/angular/angular/commit/4231e8f28ffe8f55dddc2af0647b5b04fa8445d7) | fix | Handle `@let` declaration with array when `preparingForHydration` ([#57816](https://github.com/angular/angular/pull/57816)) |
### migrations
| Commit | Type | Description |
| -- | -- | -- |
| [59fe9bc772](https://github.com/angular/angular/commit/59fe9bc77236f1374427a851e55b0fa5216d9cf9) | feat | introduce signal input migration as `ng generate` schematic ([#57805](https://github.com/angular/angular/pull/57805)) |
| [6144612940](https://github.com/angular/angular/commit/614461294041d7a2331bf7528907f37353205115) | fix | account for explicit standalone: false in migration ([#57803](https://github.com/angular/angular/pull/57803)) |
<!-- CHANGELOG SPLIT MARKER -->
<a name="18.2.5"></a>
# 18.2.5 (2024-09-18)
### compiler-cli
| Commit | Type | Description |
| -- | -- | -- |
| [e685ed883a](https://github.com/angular/angular/commit/e685ed883a09628c2b87a11a17ffb6d858d51c54) | fix | extended diagnostics not validating ICUs ([#57845](https://github.com/angular/angular/pull/57845)) |
### core
| Commit | Type | Description |
| -- | -- | -- |
| [76709d5d6e](https://github.com/angular/angular/commit/76709d5d6ec1f83e3f44641704b540636f91b5f4) | fix | Handle `@let` declaration with array when `preparingForHydration` ([#57816](https://github.com/angular/angular/pull/57816)) |
### migrations
| Commit | Type | Description |
| -- | -- | -- |
| [5c866942a1](https://github.com/angular/angular/commit/5c866942a1b8a60e3a024385048bbb2f52f84513) | fix | account for explicit standalone: false in migration ([#57803](https://github.com/angular/angular/pull/57803)) |
<!-- CHANGELOG SPLIT MARKER -->
<a name="19.0.0-next.5"></a>
# 19.0.0-next.5 (2024-09-11)
### core
| Commit | Type | Description |
| -- | -- | -- |
| [c93b510f9b](https://github.com/angular/angular/commit/c93b510f9b2e23aa7a3848a04c05249fde14a9b1) | feat | allow passing `undefined` without needing to include it in the type argument of `input` ([#57621](https://github.com/angular/angular/pull/57621)) |
<!-- CHANGELOG SPLIT MARKER -->
<a name="18.2.4"></a>
# 18.2.4 (2024-09-11)
### compiler
| Commit | Type | Description |
| -- | -- | -- |
| [b619d6987e](https://github.com/angular/angular/commit/b619d6987efe054b9b37c24e578f58792b25d146) | fix | produce less noisy errors when parsing control flow ([#57711](https://github.com/angular/angular/pull/57711)) |
### migrations
| Commit | Type | Description |
| -- | -- | -- |
| [9895e4492f](https://github.com/angular/angular/commit/9895e4492fbe357b584ca5a6dd86d2c9d50d9fda) | fix | replace leftover modules with their exports during pruning ([#57684](https://github.com/angular/angular/pull/57684)) |
<!-- CHANGELOG SPLIT MARKER -->
<a name="19.0.0-next.4"></a>
# 19.0.0-next.4 (2024-09-09)
### compiler
| Commit | Type | Description |
| -- | -- | -- |
| [40ff18f87a](https://github.com/angular/angular/commit/40ff18f87a04fd1c00dea9fee1568bfe52acf25c) | fix | produce less noisy errors when parsing control flow ([#57711](https://github.com/angular/angular/pull/57711)) |
### core
| Commit | Type | Description |
| -- | -- | -- |
| [6ea8e1e9aa](https://github.com/angular/angular/commit/6ea8e1e9aae028572873cf97aa1949c8153f458f) | feat | Add a schematics to migrate to `standalone: false`. ([#57643](https://github.com/angular/angular/pull/57643)) |
### migrations
| Commit | Type | Description |
| -- | -- | -- |
| [cbec46a51d](https://github.com/angular/angular/commit/cbec46a51d22a1238cc8bf1ebdf343d031b8f0ba) | feat | migrate .pipe calls in outputs used in tests ([#57691](https://github.com/angular/angular/pull/57691)) |
| [68e5370a66](https://github.com/angular/angular/commit/68e5370a66633f4b069d6adffa95c2ea94291820) | feat | remove complete calls for migrated outputs ([#57671](https://github.com/angular/angular/pull/57671)) |
| [9da21f798d](https://github.com/angular/angular/commit/9da21f798de2033af9d39a8a9b255ef2fe74f948) | feat | replace .next usage on outputs ([#57654](https://github.com/angular/angular/pull/57654)) |
| [71f5ef2aa5](https://github.com/angular/angular/commit/71f5ef2aa53a74bab7d0543f98870d81c44c4978) | fix | change imports to be G3 compatible ([#57654](https://github.com/angular/angular/pull/57654)) |
| [3a264db866](https://github.com/angular/angular/commit/3a264db86611cba9b69780d7f01ee25787278320) | fix | properly handle comments in output migration ([#57691](https://github.com/angular/angular/pull/57691)) |
| [fc95a9adff](https://github.com/angular/angular/commit/fc95a9adff42da53dfeee5df8c42be25e8559708) | fix | replace leftover modules with their exports during pruning ([#57684](https://github.com/angular/angular/pull/57684)) |
<!-- CHANGELOG SPLIT MARKER -->
<a name="19.0.0-next.3"></a>
| |
001843
|
# 18.2.0 (2024-08-14)
### compiler
| Commit | Type | Description |
| -- | -- | -- |
| [c8e2885136](https://github.com/angular/angular/commit/c8e2885136b08981333a336b7b2ba553266eba63) | feat | Add extended diagnostic to warn when there are uncalled functions in event bindings ([#56295](https://github.com/angular/angular/pull/56295)) ([#56295](https://github.com/angular/angular/pull/56295)) |
### compiler-cli
| Commit | Type | Description |
| -- | -- | -- |
| [98ed5b609e](https://github.com/angular/angular/commit/98ed5b609e76d3d2b464abfe49d70413c54d3eee) | feat | run JIT transform on classes with `jit: true` opt-out ([#56892](https://github.com/angular/angular/pull/56892)) |
| [c76b440ac0](https://github.com/angular/angular/commit/c76b440ac007128c53699797811bc586220ccbe9) | fix | add warning for unused let declarations ([#57033](https://github.com/angular/angular/pull/57033)) |
| [0f0a1f2836](https://github.com/angular/angular/commit/0f0a1f28365cdb2dc6abed5ec75d4f6ba7ff1578) | fix | emitting references to ngtypecheck files ([#57138](https://github.com/angular/angular/pull/57138)) |
| [6c2fbda694](https://github.com/angular/angular/commit/6c2fbda6942adbc7b21f3dfc1db0a42638223a1a) | fix | extended diagnostic visitor not visiting template attributes ([#57033](https://github.com/angular/angular/pull/57033)) |
| [e11c0c42d2](https://github.com/angular/angular/commit/e11c0c42d2cbcdf8a5d75a4e24a6a5dbed33943e) | fix | run JIT transforms on `@NgModule` classes with `jit: true` ([#57212](https://github.com/angular/angular/pull/57212)) |
### core
| Commit | Type | Description |
| -- | -- | -- |
| [f7918f5272](https://github.com/angular/angular/commit/f7918f52720d3e903281154725cb257a952e8896) | feat | Add 'flush' parameter option to fakeAsync to flush after the test ([#57239](https://github.com/angular/angular/pull/57239)) |
| [fab673a1dd](https://github.com/angular/angular/commit/fab673a1ddbca19ff9734f92a5ef0cc16be5708c) | feat | add ng generate schematic to convert to inject ([#57056](https://github.com/angular/angular/pull/57056)) |
| [7919982063](https://github.com/angular/angular/commit/7919982063e7638ffabe2127d4803bb930c791bc) | feat | Add whenStable helper on ApplicationRef ([#57190](https://github.com/angular/angular/pull/57190)) |
| [3459289ef0](https://github.com/angular/angular/commit/3459289ef079a80e84bb92e20c25fb6cae18aaf8) | feat | bootstrapModule can configure NgZone in providers ([#57060](https://github.com/angular/angular/pull/57060)) |
| [296216cbe1](https://github.com/angular/angular/commit/296216cbe1c70822d4b444321d218d57c89621b2) | fix | Allow hybrid CD scheduling to support multiple "Angular zones" ([#57267](https://github.com/angular/angular/pull/57267)) |
| [8718abce90](https://github.com/angular/angular/commit/8718abce900617275d80ca56141d4e4436481b69) | fix | Deprecate ignoreChangesOutsideZone option ([#57029](https://github.com/angular/angular/pull/57029)) |
| [827070e331](https://github.com/angular/angular/commit/827070e3314d4c3acee77920dc0d5375398917ab) | fix | Do not run image performance warning checks on server ([#57234](https://github.com/angular/angular/pull/57234)) |
| [ca89ef9141](https://github.com/angular/angular/commit/ca89ef9141191d56415bdf62354f5125800a4039) | fix | handle shorthand assignment in the inject migration ([#57134](https://github.com/angular/angular/pull/57134)) |
| [5dcdbfcba9](https://github.com/angular/angular/commit/5dcdbfcba934a930468aec140a7183b034466bdf) | fix | rename the equality function option in toSignal ([#56769](https://github.com/angular/angular/pull/56769)) |
| [2a4f488a6c](https://github.com/angular/angular/commit/2a4f488a6cb8bdadece70c8aa076c02fae801688) | fix | warnings for oversized images and lazy-lcp present with bootstrapModule ([#57060](https://github.com/angular/angular/pull/57060)) |
### language-service
| Commit | Type | Description |
| -- | -- | -- |
| [4bb558ab0c](https://github.com/angular/angular/commit/4bb558ab0cbf2e5e34816377e977128a177a977a) | feat | support writing code refactorings ([#56895](https://github.com/angular/angular/pull/56895)) |
| [7663debce1](https://github.com/angular/angular/commit/7663debce1a8411a763a27b7cf8bc5955f8ea2ed) | perf | quick exit if no code fixes can exist ([#57000](https://github.com/angular/angular/pull/57000)) |
| |
001846
|
# 18.1.0 (2024-07-10)
### common
| Commit | Type | Description |
| -- | -- | -- |
| [f25653e231](https://github.com/angular/angular/commit/f25653e2311152d30b14d25acb0dccb4e2b5ea56) | fix | typo in NgOptimizedImage warning ([#56756](https://github.com/angular/angular/pull/56756)) |
| [9b35726e42](https://github.com/angular/angular/commit/9b35726e42ebdeed138a25581e0a7eefff466206) | fix | typo in warning for NgOptimizedDirective ([#56817](https://github.com/angular/angular/pull/56817)) |
### compiler
| Commit | Type | Description |
| -- | -- | -- |
| [fd6cd0422d](https://github.com/angular/angular/commit/fd6cd0422d2d761d2c6cc0cd41838fbba8a3f010) | feat | Add extended diagnostic to warn when there are uncalled functions in event bindings ([#56295](https://github.com/angular/angular/pull/56295)) |
| [341a116d61](https://github.com/angular/angular/commit/341a116d611c095ed414c82612adb529e7be310c) | fix | allow more characters in let declaration name ([#56764](https://github.com/angular/angular/pull/56764)) |
| [2a1291e942](https://github.com/angular/angular/commit/2a1291e942a3cd645ee635e72e7d83722383d39b) | fix | give precedence to local let declarations over parent ones ([#56752](https://github.com/angular/angular/pull/56752)) |
### compiler-cli
| Commit | Type | Description |
| -- | -- | -- |
| [66e582551e](https://github.com/angular/angular/commit/66e582551eb081e422e0df41badce1821c46dc62) | fix | avoid duplicate diagnostics for let declarations read before definition ([#56843](https://github.com/angular/angular/pull/56843)) |
| [4d18c5bfd5](https://github.com/angular/angular/commit/4d18c5bfd54c53655955c8cd90472081ade40b34) | fix | flag all conflicts between let declarations and local symbols ([#56752](https://github.com/angular/angular/pull/56752)) |
| [9e21582456](https://github.com/angular/angular/commit/9e215824565f0d30da7edb20087c4460069a6660) | fix | Show template syntax errors in local compilation modified ([#55855](https://github.com/angular/angular/pull/55855)) |
| [5996502921](https://github.com/angular/angular/commit/599650292107f8856c7cd41791bd0856f9d14eb1) | fix | type check let declarations nested inside nodes ([#56752](https://github.com/angular/angular/pull/56752)) |
| [cdebf751e4](https://github.com/angular/angular/commit/cdebf751e4949048b01acc92de2517f46fcd5d37) | fix | used before declared diagnostic not firing for control flow blocks ([#56843](https://github.com/angular/angular/pull/56843)) |
### core
| Commit | Type | Description |
| -- | -- | -- |
| [ea3c802056](https://github.com/angular/angular/commit/ea3c80205653af109c688a4d4808143b34591d54) | feat | Add a schematic to migrate afterRender phase flag ([#55648](https://github.com/angular/angular/pull/55648)) |
| [5df3e78c99](https://github.com/angular/angular/commit/5df3e78c9907f522f2f96c087b10ca12d57f7028) | feat | add equality function to rxjs-interop `toSignal` ([#56447](https://github.com/angular/angular/pull/56447)) |
| [0a48d584f2](https://github.com/angular/angular/commit/0a48d584f2ffeebb9402032182d4fc13a260c5cf) | feat | add support for let syntax ([#56715](https://github.com/angular/angular/pull/56715)) |
| [352e0782ec](https://github.com/angular/angular/commit/352e0782ec37d2adcc662cfc69c83d38058a34bf) | feat | expose signal input metadata in `ComponentMirror` ([#56402](https://github.com/angular/angular/pull/56402)) |
| [a655e46447](https://github.com/angular/angular/commit/a655e46447962bf56bf0184e3104328b9f7c1531) | feat | Redesign the `afterRender` & `afterNextRender` phases API ([#55648](https://github.com/angular/angular/pull/55648)) |
| [e5a6f91722](https://github.com/angular/angular/commit/e5a6f917225aafa7c5c860f280d2aafe3615727e) | feat | support TypeScript 5.5 ([#56096](https://github.com/angular/angular/pull/56096)) |
| [38effcc63e](https://github.com/angular/angular/commit/38effcc63eea360e948dc22860add72d3aa02288) | fix | Add back phase flag option as a deprecated API ([#55648](https://github.com/angular/angular/pull/55648)) |
| [86bcfd3e49](https://github.com/angular/angular/commit/86bcfd3e498b8ec1de1a2a1ad0847fe567f7e9d4) | fix | improve docs on afterRender hooks ([#56522](https://github.com/angular/angular/pull/56522)) |
| [b2445a0953](https://github.com/angular/angular/commit/b2445a095314aa66da038d3093e6a1b18fe5768b) | fix | link errors to ADEV ([#55554](https://github.com/angular/angular/pull/55554)) ([#56038](https://github.com/angular/angular/pull/56038)) |
| [03a2acd2a3](https://github.com/angular/angular/commit/03a2acd2a3bdc87aaeb6b835a7c1016f800b31cb) | fix | properly remove imports in the afterRender phase migration ([#56524](https://github.com/angular/angular/pull/56524)) |
| [4d87b9e899](https://github.com/angular/angular/commit/4d87b9e899381894a1de90f251da58613a96eed0) | fix | rename the equality function option in toSignal ([#56769](https://github.com/angular/angular/pull/56769)) ([#56922](https://github.com/angular/angular/pull/56922)) |
| [8bd4c074af](https://github.com/angular/angular/commit/8bd4c074afe85b739dff4d3c4dcc19384c42b85e) | fix | toSignal equal option should be passed to inner computed ([#56903](https://github.com/angular/angular/pull/56903)) |
### forms
| Commit | Type | Description |
| -- | -- | -- |
| [00bde8b1c2](https://github.com/angular/angular/commit/00bde8b1c2d1511da40526a374d4e94d31e0d575) | fix | Make `NgControlStatus` host bindings `OnPush` compatible ([#55720](https://github.com/angular/angular/pull/55720)) |
### http
| Commit | Type | Description |
| -- | -- | -- |
| [cc21989132](https://github.com/angular/angular/commit/cc21989132bc64b981df83cb6ff6e1506b42a1d0) | fix | Make `Content-Type` header case insensitive ([#56541](https://github.com/angular/angular/pull/56541)) |
| |
001864
|
# 17.0.6 (2023-12-06)
### compiler
| Commit | Type | Description |
| -- | -- | -- |
| [a2e5f483f5](https://github.com/angular/angular/commit/a2e5f483f5a869c0cca205f092049e252a02b710) | fix | generate proper code for nullish coalescing in styling host bindings ([#53305](https://github.com/angular/angular/pull/53305)) |
### compiler-cli
| Commit | Type | Description |
| -- | -- | -- |
| [66ecf4c274](https://github.com/angular/angular/commit/66ecf4c2748b43b7e53af00499b153bbe70dd684) | fix | add compiler option to disable control flow content projection diagnostic ([#53387](https://github.com/angular/angular/pull/53387)) |
| [74e6ce5d23](https://github.com/angular/angular/commit/74e6ce5d233c8763b6c437fab5d81d7b89ae6cd4) | fix | add diagnostic for control flow that prevents content projection ([#53387](https://github.com/angular/angular/pull/53387)) |
| [6ec7a42b95](https://github.com/angular/angular/commit/6ec7a42b9578aa34a66bb7c81ac491bb18f98941) | fix | avoid conflicts with built-in global variables in for loop blocks ([#53319](https://github.com/angular/angular/pull/53319)) |
### core
| Commit | Type | Description |
| -- | -- | -- |
| [0a53f96094](https://github.com/angular/angular/commit/0a53f9609462fc59cf20c7fe1436d153c23e0412) | fix | cleanup signal consumers for all views ([#53351](https://github.com/angular/angular/pull/53351)) |
| [4fc1581bbc](https://github.com/angular/angular/commit/4fc1581bbcd98e607eb2bbd9976c64c92a70d827) | fix | handle hydration of multiple nodes projected in a single slot ([#53270](https://github.com/angular/angular/pull/53270)) |
| [14e66533ec](https://github.com/angular/angular/commit/14e66533ec49184723a66652253e9ae863a972e0) | fix | support hydration for cases when content is re-projected using ng-template ([#53304](https://github.com/angular/angular/pull/53304)) |
| [8e366e8911](https://github.com/angular/angular/commit/8e366e8911434d5b91e83e215320caae72f6adf8) | fix | support swapping hydrated views in `@for` loops ([#53274](https://github.com/angular/angular/pull/53274)) |
### migrations
| Commit | Type | Description |
| -- | -- | -- |
| [45064f1ae1](https://github.com/angular/angular/commit/45064f1ae1ceb9c5a1f1053077f77370e3e9fdb2) | fix | CF migration - ensure NgIfElse attributes are properly removed ([#53298](https://github.com/angular/angular/pull/53298)) |
| [a6275cfa54](https://github.com/angular/angular/commit/a6275cfa54d680d6612a1c91e5d3f6b86b828fbc) | fix | CF Migration - Fix case of aliases on i18n ng-templates preventing removal ([#53299](https://github.com/angular/angular/pull/53299)) |
| [58a96e0f50](https://github.com/angular/angular/commit/58a96e0f50f2d59376aa357188ad0792b39e4e70) | fix | CF Migration add support for ngIf with just a then ([#53297](https://github.com/angular/angular/pull/53297)) |
| [26e40c7f89](https://github.com/angular/angular/commit/26e40c7f8916612034b03dae4f74e53b61d39d86) | fix | CF Migration fix missing alias for bound ngifs ([#53296](https://github.com/angular/angular/pull/53296)) |
| [836aeba01d](https://github.com/angular/angular/commit/836aeba01db526676610802daff4e8ebca8cef1e) | fix | Change CF Migration ng-template placeholder generation and handling ([#53394](https://github.com/angular/angular/pull/53394)) |
| [72d22ba7ee](https://github.com/angular/angular/commit/72d22ba7eea87e2873a765aa69b3d923b9d6cc6d) | fix | fix regexp for else and then in cf migration ([#53257](https://github.com/angular/angular/pull/53257)) |
| [7a2facae8a](https://github.com/angular/angular/commit/7a2facae8af3240b21fc17857a770dad793b7b6d) | fix | handle aliases on bound ngIf migrations ([#53261](https://github.com/angular/angular/pull/53261)) |
| [5104a89b30](https://github.com/angular/angular/commit/5104a89b3035fb07ce23e09974dc9998ef6932ca) | fix | handle nested ng-template replacement safely in CF migration ([#53368](https://github.com/angular/angular/pull/53368)) |
| [2a4e3f5373](https://github.com/angular/angular/commit/2a4e3f5373dfbc2a1634d67e646c30d8bbe4fea8) | fix | handle templates outside of component in cf migration ([#53368](https://github.com/angular/angular/pull/53368)) |
| [0db75ab5b1](https://github.com/angular/angular/commit/0db75ab5b1c8c79a0e7ca1d6094092f0cb3e3939) | fix | remove setting that removes comments in CF migration ([#53350](https://github.com/angular/angular/pull/53350)) |
### router
| Commit | Type | Description |
| -- | -- | -- |
| [13ade13a15](https://github.com/angular/angular/commit/13ade13a15f0c5b5f782d2fda0f7a96b3c606198) | fix | Ensure canMatch guards run on wildcard routes ([#53239](https://github.com/angular/angular/pull/53239)) |
<!-- CHANGELOG SPLIT MARKER -->
<a name="17.0.5"></a>
| |
001866
|
# 17.0.4 (2023-11-20)
### common
| Commit | Type | Description |
| -- | -- | -- |
| [7f1c55755d](https://github.com/angular/angular/commit/7f1c55755d94444aa2c07fc62c276bb158e69f24) | fix | remove `load` on image once it fails to load ([#52990](https://github.com/angular/angular/pull/52990)) |
| [fafcb0d23f](https://github.com/angular/angular/commit/fafcb0d23f1f687a2fe5c8349b916586ffadc375) | fix | scan images once page is loaded ([#52991](https://github.com/angular/angular/pull/52991)) |
### compiler
| Commit | Type | Description |
| -- | -- | -- |
| [98376f2c09](https://github.com/angular/angular/commit/98376f2c09e9c28d1473123a2a1f4fb1c9d1cb1e) | fix | changed after checked error in for loops ([#52935](https://github.com/angular/angular/pull/52935)) |
| [291deac663](https://github.com/angular/angular/commit/291deac6636a6f99a98dd0c9096ebe3b0547bb9e) | fix | generate i18n instructions for blocks ([#52958](https://github.com/angular/angular/pull/52958)) |
| [49dca36880](https://github.com/angular/angular/commit/49dca36880a1c1c394533e8a94db9c5ef412ebd2) | fix | nested for loops incorrectly calculating computed variables ([#52931](https://github.com/angular/angular/pull/52931)) |
| [f01b7183d2](https://github.com/angular/angular/commit/f01b7183d2064f41c0f5e30ee976cc91c15e06c5) | fix | produce placeholder for blocks in i18n bundles ([#52958](https://github.com/angular/angular/pull/52958)) |
### compiler-cli
| Commit | Type | Description |
| -- | -- | -- |
| [f671f86ac2](https://github.com/angular/angular/commit/f671f86ac28d434b2fd492ef005749fe0275ece9) | fix | add diagnostic for control flow that prevents content projection ([#52726](https://github.com/angular/angular/pull/52726)) |
### core
| Commit | Type | Description |
| -- | -- | -- |
| [db1a8ebdb4](https://github.com/angular/angular/commit/db1a8ebdb4da8673107ba4ba08c42d484b733c03) | fix | cleanup loading promise when no dependencies are defined ([#53031](https://github.com/angular/angular/pull/53031)) |
| [31a1575334](https://github.com/angular/angular/commit/31a1575334ef78822d947ed858d8365ca5665f2f) | fix | handle local refs when `getDeferBlocks` is invoked in tests ([#52973](https://github.com/angular/angular/pull/52973)) |
### migrations
| Commit | Type | Description |
| -- | -- | -- |
| [ac9cd6108f](https://github.com/angular/angular/commit/ac9cd6108f6fe25e9c7a11db9816c6e07d241515) | fix | control flow migration fails for async pipe with unboxing of observable ([#52756](https://github.com/angular/angular/pull/52756)) ([#52972](https://github.com/angular/angular/pull/52972)) |
| [13bf5b7007](https://github.com/angular/angular/commit/13bf5b700739aadb2e5a210441fb815a8501ad65) | fix | Fixes control flow migration if then else case ([#53006](https://github.com/angular/angular/pull/53006)) |
| [492ad4698a](https://github.com/angular/angular/commit/492ad4698aaef51a3d24ae90f617a2ba3fae901e) | fix | fixes migrations of nested switches in control flow ([#53010](https://github.com/angular/angular/pull/53010)) |
| [0fad36eff2](https://github.com/angular/angular/commit/0fad36eff2b228baa3b8868810d4ac86eb6db459) | fix | tweaks to formatting in control flow migration ([#53058](https://github.com/angular/angular/pull/53058)) |
<!-- CHANGELOG SPLIT MARKER -->
<a name="17.0.3"></a>
# 17.0.3 (2023-11-15)
### animations
| Commit | Type | Description |
| -- | -- | -- |
| [f5872c9921](https://github.com/angular/angular/commit/f5872c992181a2c231890b83f92ec03ec9606802) | fix | prevent the AsyncAnimationRenderer from calling the delegate when there is no element. ([#52570](https://github.com/angular/angular/pull/52570)) |
### core
| Commit | Type | Description |
| -- | -- | -- |
| [6a1d4ed667](https://github.com/angular/angular/commit/6a1d4ed6670f5965a654e40997aa266a99925f50) | fix | handle non-container environment injector cases ([#52774](https://github.com/angular/angular/pull/52774)) |
| [5de7575be8](https://github.com/angular/angular/commit/5de7575be83b9829e65ad245034ee7ab1d966044) | fix | reset cached scope for components that were overridden using TestBed ([#52916](https://github.com/angular/angular/pull/52916)) |
### http
| Commit | Type | Description |
| -- | -- | -- |
| [7c066a4af4](https://github.com/angular/angular/commit/7c066a4af4faae25ee722c19576c63c3833066ee) | fix | Use the response `content-type` to set the blob `type`. ([#52840](https://github.com/angular/angular/pull/52840)) |
### migrations
| Commit | Type | Description |
| -- | -- | -- |
| [4e200bf13b](https://github.com/angular/angular/commit/4e200bf13b284fa89bbb0854cbb85dc8fe94d8bb) | fix | Add missing support for ngForOf ([#52903](https://github.com/angular/angular/pull/52903)) |
| [d033540d0f](https://github.com/angular/angular/commit/d033540d0f874a7a05b79c00e3151ed076fa71c3) | fix | Add support for bound versions of NgIfElse and NgIfThenElse ([#52869](https://github.com/angular/angular/pull/52869)) |
| [aa2d815648](https://github.com/angular/angular/commit/aa2d815648dbf3303cfe72bf976a4a87de406ee0) | fix | Add support for removing imports post migration ([#52763](https://github.com/angular/angular/pull/52763)) |
| [3831942771](https://github.com/angular/angular/commit/38319427711f4dab4e4d64ff48aecc7727085031) | fix | Fixes issue with multiple if elses with same template ([#52863](https://github.com/angular/angular/pull/52863)) |
| [e1f84a31dc](https://github.com/angular/angular/commit/e1f84a31dcac413251329c3b695a253234c6aae6) | fix | passed in paths will be respected in nx workspaces ([#52796](https://github.com/angular/angular/pull/52796)) |
<!-- CHANGELOG SPLIT MARKER -->
<a name="17.0.2"></a>
| |
001867
|
# 17.0.2 (2023-11-09)
### compiler-cli
| Commit | Type | Description |
| -- | -- | -- |
| [7a95cccf50](https://github.com/angular/angular/commit/7a95cccf50c01a3733c6015551f8864e246d9239) | fix | add interpolatedSignalNotInvoked to diagnostics ([#52687](https://github.com/angular/angular/pull/52687)) |
| [a548c0333e](https://github.com/angular/angular/commit/a548c0333ecc993073ee7df054119a6fdde1d27b) | fix | incorrect inferred type of for loop implicit variables ([#52732](https://github.com/angular/angular/pull/52732)) |
### core
| Commit | Type | Description |
| -- | -- | -- |
| [2cea80c6e2](https://github.com/angular/angular/commit/2cea80c6e21c113d12c38c4b3219c5f3f5944bd8) | fix | error code in image performance warning ([#52727](https://github.com/angular/angular/pull/52727)) |
| [b16fc2610a](https://github.com/angular/angular/commit/b16fc2610a37b7407713e1e0018d92372f1349e9) | fix | limit rate of markers invocations ([#52742](https://github.com/angular/angular/pull/52742)) |
| [44c48a4835](https://github.com/angular/angular/commit/44c48a48358c92c32301b578966a8e1ee9a867d8) | fix | properly update collection with repeated keys in `@for` ([#52697](https://github.com/angular/angular/pull/52697)) |
<!-- CHANGELOG SPLIT MARKER -->
<a name="17.0.1"></a>
# 17.0.1 (2023-11-08)
### http
| Commit | Type | Description |
| -- | -- | -- |
| [5c6f3f8ec0](https://github.com/angular/angular/commit/5c6f3f8ec0f1dd9b5505f3c94e654a675e75f147) | fix | Don't override the backend when using the InMemoryWebAPI ([#52425](https://github.com/angular/angular/pull/52425)) |
### migrations
| Commit | Type | Description |
| -- | -- | -- |
| [70d30c28e0](https://github.com/angular/angular/commit/70d30c28e04f4ead51145e4e47df342492bfb336) | fix | Add support for ng-templates with i18n attributes ([#52597](https://github.com/angular/angular/pull/52597)) |
| [4f125c5f9a](https://github.com/angular/angular/commit/4f125c5f9ae572a8216ec1fbb88f52e47b875e1e) | fix | Switches to multiple passes to fix several reported bugs ([#52592](https://github.com/angular/angular/pull/52592)) |
Web Frameworks: the internet frontier.<br/>
These are the voyages of the framework Angular.<br/>
Its continuing mission:<br/>
To explore strange, new technologies.<br/>
To seek out new users and new applications.<br/>
To boldly go where no web framework has gone before.<br/>
In honor of v17.0.1
```
______
___.--------'------`---------.____
_.---'----------------------------------`---.__
.'___=]===========================================
,-----------------------..__/.' >--.______ _______.---'
]====================<==||(__) .' `------'
`-----------------------`' ----.___--/
/ /---' `/
/_______(______________________/
`-------------.--------------.'
\________|_.-'
```
Live long and prosper 🖖🏻
<!-- CHANGELOG SPLIT MARKER -->
<a name="17.0.0"></a>
# 17.0.0 (2023-11-08)
[Blog post "Angular v17 is now available"](http://goo.gle/angular-v17).
## Breaking Changes
###
- Node.js v16 support has been removed and the minimum support version has been bumped to 18.13.0.
Node.js v16 is planned to be End-of-Life on 2023-09-11. Angular will stop supporting Node.js v16 in Angular v17. For Node.js release schedule details, please see: https://github.com/nodejs/release#release-schedule
### common
- the NgSwitch directive now defaults to the === equality operator,
migrating from the previously used == operator. NgSwitch expressions and / or
individual condition values need adjusting to this stricter equality
check. The added warning message should help pin-pointing NgSwitch
usages where adjustments are needed.
### core
- Angular now requires `zone.js` version `~0.14.0`
- Versions of TypeScript older than 5.2 are no longer supported.
- The `mutate` method was removed from the `WritableSignal` interface and completely
dropped from the public API surface. As an alternative, please use the `update` method and
make immutable changes to the object.
Example before:
```typescript
items.mutate(itemsArray => itemsArray.push(newItem));
```
Example after:
```typescript
items.update(itemsArray => [itemsArray, …newItem]);
```
- `OnPush` components that are created dynamically now
only have their host bindings refreshed and `ngDoCheck run` during change
detection if they are dirty.
Previously, a bug in the change detection would result in the `OnPush`
configuration of dynamically created components to be ignored when
executing host bindings and the `ngDoCheck` function. This is
rarely encountered but can happen if code has a handle on the
`ComponentRef` instance and updates values read in the `OnPush`
component template without then calling either `markForCheck` or
`detectChanges` on that component's `ChangeDetectorRef`.
### platform-browser
- `REMOVE_STYLES_ON_COMPONENT_DESTROY` default value is now `true`. This causes CSS of components to be removed from the DOM when destroyed. You retain the previous behaviour by providing the `REMOVE_STYLES_ON_COMPONENT_DESTROY` injection token.
```ts
import {REMOVE_STYLES_ON_COMPONENT_DESTROY} from '@angular/platform-browser';
...
providers: [{
provide: REMOVE_STYLES_ON_COMPONENT_DESTROY,
useValue: false,
}]
```
- The `withNoDomReuse()` function was removed from the public API. If you need to disable hydration, you can exclude the `provideClientHydration()` call from provider list in your application (which would disable hydration features for the entire application) or use `ngSkipHydration` attribute to disable hydration for particular components. See this guide for additional information: https://angular.io/guide/hydration#how-to-skip-hydration-for-particular-components.
### router
- Absolute redirects no longer prevent further redirects.
Route configurations may need to be adjusted to prevent infinite
redirects where additional redirects were previously ignored after an
absolute redirect occurred.
- Routes with `loadComponent` would incorrectly cause
child routes to inherit their data by default. The default
`paramsInheritanceStrategy` is `emptyOnly`. If parent data should be
inherited in child routes, this should be manually set to `always`.
- `urlHandlingStrategy` has been removed from the Router public API.
This should instead be configured through the provideRouter or RouterModule.forRoot APIs.
- The following Router properties have been removed from
the public API:
- canceledNavigationResolution
- paramsInheritanceStrategy
- titleStrategy
- urlUpdateStrategy
- malformedUriErrorHandler
These should instead be configured through the `provideRouter` or
`RouterModule.forRoot` APIs.
- The `setupTestingRouter` function has been removed. Use
`RouterModule.forRoot` or `provideRouter` to setup the `Router` for
tests instead.
- `malformedUriErrorHandler` is no longer available in
the `RouterModule.forRoot` options. URL parsing errors should instead be
handled in the `UrlSerializer.parse` method.
### zone.js
- Deep and legacy `dist/` imports like `zone.js/bundles/zone-testing.js` and `zone.js/dist/zone` are no longer allowed. `zone-testing-bundle` and `zone-testing-node-bundle` are also no longer part of the package.
The proper way to import `zone.js` and `zone.js/testing` is:
```js
import 'zone.js';
import 'zone.js/testing';
```
## Depre
| |
001879
|
(2023-06-01)
### animations
| Commit | Type | Description |
| -- | -- | -- |
| [df65c4fc8f](https://github.com/angular/angular/commit/df65c4fc8f71ab9bf59ec4e5e820d136b12fb570) | fix | Trigger leave animation when ViewContainerRef is injected ([#48705](https://github.com/angular/angular/pull/48705)) |
### common
| Commit | Type | Description |
| -- | -- | -- |
| [7e1bc513de](https://github.com/angular/angular/commit/7e1bc513dead7d809f5ba2e6edc45b85af12f828) | fix | untrack subscription and unsubscription in async pipe ([#50522](https://github.com/angular/angular/pull/50522)) |
### core
| Commit | Type | Description |
| -- | -- | -- |
| [9970b29ace](https://github.com/angular/angular/commit/9970b29acef11f1dfedd2640520b4bca4b996f81) | fix | update `ApplicationRef.isStable` to account for rendering pending tasks ([#50425](https://github.com/angular/angular/pull/50425)) |
<!-- CHANGELOG SPLIT MARKER -->
<a name="16.0.3"></a>
# 16.0.3 (2023-05-24)
### core
| Commit | Type | Description |
| -- | -- | -- |
| [c11041e372](https://github.com/angular/angular/commit/c11041e37260ac658e96e98fde5dea6d85b24aae) | fix | adds missing symbols for animation standalone bundling test ([#50434](https://github.com/angular/angular/pull/50434)) |
| [98e8fdf40e](https://github.com/angular/angular/commit/98e8fdf40e598f2c2a4d0c11de302ea13e586a1a) | fix | fix `Self` flag inside embedded views with custom injectors ([#50270](https://github.com/angular/angular/pull/50270)) |
| [199ff4fe7f](https://github.com/angular/angular/commit/199ff4fe7f2cd4b561703e8520c2d6ccc1e2afb7) | fix | host directives incorrectly validating aliased bindings ([#50364](https://github.com/angular/angular/pull/50364)) |
### http
| Commit | Type | Description |
| -- | -- | -- |
| [080bbd2137](https://github.com/angular/angular/commit/080bbd21377d099c91aa0c6ea8ca634423cd8125) | fix | create macrotask during request handling instead of load start ([#50406](https://github.com/angular/angular/pull/50406)) |
<!-- CHANGELOG SPLIT MARKER -->
<a name="16.0.2"></a>
# 16.0.2 (2023-05-17)
### core
| Commit | Type | Description |
| -- | -- | -- |
| [c1016d4e57](https://github.com/angular/angular/commit/c1016d4e578152dcdfe7c4a4673f27e12bfabf8d) | fix | add additional component metadata to component ID generation ([#50340](https://github.com/angular/angular/pull/50340)) |
| [cc41758b59](https://github.com/angular/angular/commit/cc41758b595da46a3fd14a58b3832c77b251b940) | fix | allow onDestroy unregistration while destroying ([#50237](https://github.com/angular/angular/pull/50237)) |
| [7d679bdb59](https://github.com/angular/angular/commit/7d679bdb59815e7e816337532d069d68cf45a6d8) | fix | allow passing value of any type to `isSignal` function ([#50035](https://github.com/angular/angular/pull/50035)) |
<!-- CHANGELOG SPLIT MARKER -->
<a name="16.0.1"></a>
# 16.0.1 (2023-05-10)
### core
| Commit | Type | Description |
| -- | -- | -- |
| [52c74d3b4a](https://github.com/angular/angular/commit/52c74d3b4a8d60b60c9e572541b6ccae0d704754) | fix | add additional component metadata to component ID generation ([#50203](https://github.com/angular/angular/pull/50203)) |
| [048b6b1e0d](https://github.com/angular/angular/commit/048b6b1e0d9d93d63e6fde2c16a9c3e2b221b581) | fix | bootstrapApplication call not rejected when error is thrown in importProvidersFrom module ([#50120](https://github.com/angular/angular/pull/50120)) |
| [d68796782f](https://github.com/angular/angular/commit/d68796782ff4ce1f389f14dcff31d393ddaa195d) | fix | handle hydration of root components with injected ViewContainerRef ([#50136](https://github.com/angular/angular/pull/50136)) |
| [f751ce6445](https://github.com/angular/angular/commit/f751ce64453f6ccede13b7bfd02b817eda0b40f7) | fix | handle projection of hydrated containters into components that skip hydration ([#50199](https://github.com/angular/angular/pull/50199)) |
| [346ab73dd9](https://github.com/angular/angular/commit/346ab73dd95fd2adfd8cb4064b9f12a6171e51d5) | fix | only try to retrieve transferred state on the browser ([#50144](https://github.com/angular/angular/pull/50144)) |
<!-- CHANGELOG SPLIT MARKER -->
<a name="16.0.0"></a>
# 16.0.0
| |
001880
|
(2023-05-03)
[Blog post "Angular v16 is now available"](https://goo.gle/angular-v16).
## Breaking Changes
###
- Angular Compatibility Compiler (ngcc) has been removed and as a result Angular View Engine libraries will no longer work
- Deprecated `EventManager` method `addGlobalEventListener` has been removed as it is not used by Ivy.
### bazel
- Several changes to the Angular Package Format (APF)
- Removal of FESM2015
- Replacing ES2020 with ES2022
- Replacing FESM2020 with FESM2022
- Several changes to the Angular Package Format (APF)
- Removal of FESM2015
- Replacing ES2020 with ES2022
- Replacing FESM2020 with FESM2022
### common
- `MockPlatformLocation` is now provided by default in tests.
Existing tests may have behaviors which rely on
`BrowserPlatformLocation` instead. For example, direct access to the
`window.history` in either the test or the component rather than going
through the Angular APIs (`Location.getState()`). The quickest fix is to
update the providers in the test suite to override the provider again
`TestBed.configureTestingModule({providers: [{provide: PlatformLocation, useClass: BrowserPlatformLocation}]})`.
The ideal fix would be to update the code to instead be compatible with
`MockPlatformLocation` instead.
- If the 'ngTemplateOutletContext' is different from the context, it will result in a compile-time error.
Before the change, the following template was compiling:
```typescript
interface MyContext {
$implicit: string;
}
@Component({
standalone: true,
imports: [NgTemplateOutlet],
selector: 'person',
template: `
<ng-container
*ngTemplateOutlet="
myTemplateRef;
context: { $implicit: 'test', xxx: 'xxx' }
"></ng-container>
`,
})
export class PersonComponent {
myTemplateRef!: TemplateRef<MyContext>;
}
```
However, it does not compile now because the 'xxx' property does not exist in 'MyContext', resulting in the error: 'Type '{ $implicit: string; xxx: string; }' is not assignable to type 'MyContext'.'
The solution is either:
- add the 'xxx' property to 'MyContext' with the correct type or
- add '$any(...)' inside the template to make the error disappear. However, adding '$any(...)' does not correct the error but only preserves the previous behavior of the code.
- Deprecated `XhrFactory` export from `@angular/common/http` has been removed. Use `XhrFactory` from `@angular/common` instead.
### compiler
- * TypeScript 4.8 is no longer supported.
### core
- QueryList.filter now supports type guard functions, which will result in type narrowing. Previously if you used type guard functions, it resulted in no changes to the return type. Now the type would be narrowed, which might require updates to the application code that relied on the old behavior.
- `zone.js` versions `0.11.x` and `0.12.x` are not longer supported.
- * `entryComponents` has been deleted from the `@NgModule` and `@Component` public APIs. Any usages can be removed since they weren't doing anyting.
* `ANALYZE_FOR_ENTRY_COMPONENTS` injection token has been deleted. Any references can be removed.
- ComponentRef.setInput will only set the input on the
component if it is different from the previous value (based on `Object.is`
equality). If code relies on the input always being set, it should be
updated to copy objects or wrap primitives in order to ensure the input
value differs from the previous call to `setInput`.
- `RendererType2.styles` no longer accepts a nested arrays.
- The `APP_ID` token value is no longer randomly generated. If you are bootstrapping multiple application on the same page you will need to set to provide the `APP_ID` yourself.
```ts
bootstrapApplication(ComponentA, {
providers: [
{ provide: APP_ID, useValue: 'app-a' },
// ... other providers ...
]
});
```
- The `ReflectiveInjector` and related symbols were removed. Please update the code to avoid references to the `ReflectiveInjector` symbol. Use `Injector.create` as a replacement to create an injector instead.
- Node.js v14 support has been removed
Node.js v14 is planned to be End-of-Life on 2023-04-30. Angular will stop supporting Node.js v14 in Angular v16. Angular v16 will continue to officially support Node.js versions v16 and v18.
### platform-browser
- The deprecated `BrowserTransferStateModule` was removed, since it's no longer needed. The `TransferState` class can be injected without providing the module. The `BrowserTransferStateModule` was empty starting from v14 and you can just remove the reference to that module from your applications.
### platform-server
- Users that are using SSR with JIT mode will now need to add `import to @angular/compiler` before bootstrapping the application.
**NOTE:** this does not effect users using the Angular CLI.
- `renderApplication` method no longer accepts a root component as first argument. Instead, provide a bootstrapping function that returns a `Promise<ApplicationRef>`.
Before
```ts
const output: string = await renderApplication(RootComponent, options);
```
Now
```ts
const bootstrap = () => bootstrapApplication(RootComponent, appConfig);
const output: string = await renderApplication(bootstrap, options);
```
- `renderModuleFactory` has been removed. Use `renderModule` instead.
### router
- The `Scroll` event's `routerEvent` property may also be
a `NavigationSkipped` event. Previously, it was only a `NavigationEnd`
event.
- `ComponentFactoryResolver` has been removed from Router APIs.
Component factories are not required to create an instance of a component
dynamically. Passing a factory resolver via resolver argument is no longer needed
and code can instead use `ViewContainerRef.createComponent` without the
factory resolver.
- The `RouterEvent` type is no longer present in the `Event` union type representing all router event types. If you have code using something like `filter((e: Event): e is RouterEvent => e instanceof RouterEvent)`, you'll need to update it to `filter((e: Event|RouterEvent): e is RouterEvent => e instanceof RouterEvent)`.
- Tests which mock `ActivatedRoute` instances may need to be adjusted
because Router.createUrlTree now does the right thing in more
scenarios. This means that tests with invalid/incomplete ActivatedRoute mocks
may behave differently than before. Additionally, tests may now navigate
to a real URL where before they would navigate to the root. Ensure that
tests provide expected routes to match.
There is rarely production impact, but it has been found that relative
navigations when using an `ActivatedRoute` that does not appear in the
current router state were effectively ignored in the past. By creating
the correct URLs, this sometimes resulted in different navigation
behavior in the application. Most often, this happens when attempting to
create a navigation that only updates query params using an empty
command array, for example `router.navigate([], {relativeTo: route,
queryParams: newQueryParams})`. In this case, the `relativeTo` property
should be removed.
## Deprec
| |
001881
|
ations
### core
- `makeStateKey`, `StateKey` and `TransferState` exports have been moved from `@angular/platform-browser` to `@angular/core`. Please update the imports.
```diff
- import {makeStateKey, StateKey, TransferState} from '@angular/platform-browser';
+ import {makeStateKey, StateKey, TransferState} from '@angular/core';
```
- `EnvironmentInjector.runInContext` is now deprecated, with
`runInInjectionContext` functioning as a direct replacement:
```typescript
// Previous method version (deprecated):
envInjector.runInContext(fn);
// New standalone function:
runInInjectionContext(envInjector, fn);
```
- The `@Directive`/`@Component` `moduleId` property is now
deprecated. It did not have any effect for multiple major versions and
will be removed in v17.
### platform-browser
- `BrowserModule.withServerTransition` has been deprecated. `APP_ID` should be used instead to set the application ID.
NB: Unless, you render multiple Angular applications on the same page, setting an application ID is not necessary.
Before:
```ts
imports: [
BrowserModule.withServerTransition({ appId: 'serverApp' }),
...
]
```
After:
```ts
imports: [
BrowserModule,
{ provide: APP_ID, useValue: 'serverApp' },
...
],
```
- `ApplicationConfig` has moved, please import `ApplicationConfig` from `@angular/core` instead.
### platform-server
- `PlatformConfig.baseUrl` and `PlatformConfig.useAbsoluteUrl` platform-server config options are deprecated as these were not used.
###
| Commit | Type | Description |
| -- | -- | -- |
| [48aa96ea13](https://github.com/angular/angular/commit/48aa96ea13ebfadf2f6b13516c7702dae740a7be) | refactor | remove Angular Compatibility Compiler (ngcc) ([#49101](https://github.com/angular/angular/pull/49101)) |
| [2703fd6260](https://github.com/angular/angular/commit/2703fd626040c5e65401ebd776404a3b9e284724) | refactor | remove deprecated `EventManager` method `addGlobalEventListener` ([#49645](https://github.com/angular/angular/pull/49645)) |
### common
| Commit | Type | Description |
| -- | -- | -- |
| [5dce2a5a3a](https://github.com/angular/angular/commit/5dce2a5a3a00693d835a57934b9abacce5a33dfa) | feat | Provide MockPlatformLocation by default in BrowserTestingModule ([#49137](https://github.com/angular/angular/pull/49137)) |
| [d47fef72cb](https://github.com/angular/angular/commit/d47fef72cb497db555e67db50997b3b1cc3ee590) | fix | strict type checking for ngtemplateoutlet ([#48374](https://github.com/angular/angular/pull/48374)) |
| [c41a21658c](https://github.com/angular/angular/commit/c41a21658c9a56044b5d7f62cab4fcad5a5732c7) | refactor | remove deprecated `XhrFactory` export from `http` entrypoint ([#49251](https://github.com/angular/angular/pull/49251)) |
### compiler
| Commit | Type | Description |
| -- | -- | -- |
| [1a6ca68154](https://github.com/angular/angular/commit/1a6ca68154dd73bac4b8d2e094d97952f60b3e30) | feat | add support for compile-time required inputs ([#49304](https://github.com/angular/angular/pull/49304)) |
| [13dd614cd1](https://github.com/angular/angular/commit/13dd614cd1da65eee947fd6971b7d6e1d6def207) | feat | add support for compile-time required inputs ([#49453](https://github.com/angular/angular/pull/49453)) |
| [8f539c11f4](https://github.com/angular/angular/commit/8f539c11f40be12207ab42bdf1f87a154a5a2d04) | feat | add support for compile-time required inputs ([#49468](https://github.com/angular/angular/pull/49468)) |
| [79cdfeb392](https://github.com/angular/angular/commit/79cdfeb3921687dfbc8fea8d9f7ba4dbb14a7193) | feat | drop support for TypeScript 4.8 ([#49155](https://github.com/angular/angular/pull/49155)) |
| [1407a9aeaf](https://github.com/angular/angular/commit/1407a9aeaf5edf33dfb9b52d7b2baaebef9b80ed) | feat | support multiple configuration files in `extends` ([#49125](https://github.com/angular/angular/pull/49125)) |
| [9de1e9da8f](https://github.com/angular/angular/commit/9de1e9da8fc7d102f74389d9a270c4608bf0dd64) | fix | incorrectly matching directives on attribute bindings ([#49713](https://github.com/angular/angular/pull/49713)) |
| [6623810e4d](https://github.com/angular/angular/commit/6623810e4d3347edaccbbb214fa883ab6a669936) | fix | Produce diagnositc if directive used in host binding is not exported ([#49527](https://github.com/angular/angular/pull/49527)) |
### compiler-cli
| Commit | Type | Description |
| -- | -- | -- |
| [03d1d00ad9](https://github.com/angular/angular/commit/03d1d00ad9f88a2c449cceab64c1328787576162) | feat | Add an extended diagnostic for `nSkipHydration` ([#49512](https://github.com/angular/angular/pull/49512)) |
| [ed817e32fe](https://github.com/angular/angular/commit/ed817e32fe0239c0f08ce342c7ad224055d56f84) | fix | Catch FatalDiagnosticError during template type checking ([#49527](https://github.com/angular/angular/pull/49527)) |
| [49fe974501](https://github.com/angular/angular/commit/49fe974501b6f446eaedf2490f2d456a5967318f) | perf | optimize NgModule emit for standalone components ([#49837](https://github.com/angular/angular/pull/49837)) |
### core
| |
001888
|
s
| Commit | Type | Description |
| -- | -- | -- |
| [2796230e95](https://github.com/angular/angular/commit/2796230e953eb8c29d6227a1a3858f5f08a8f200) | fix | add `enum` in `mode` option in `standalone` schema ([#48851](https://github.com/angular/angular/pull/48851)) |
| [816e76a578](https://github.com/angular/angular/commit/816e76a5789b041fee78ddd278c0e0d19b9a617a) | fix | automatically prune root module after bootstrap step ([#49030](https://github.com/angular/angular/pull/49030)) |
| [bdbf21d04b](https://github.com/angular/angular/commit/bdbf21d04ba74a6f73469242076d6ce697c57edf) | fix | avoid generating imports with forward slashes ([#48993](https://github.com/angular/angular/pull/48993)) |
| [32cf4e5cb9](https://github.com/angular/angular/commit/32cf4e5cb989f365296d519dddf72fb38ca47c40) | fix | avoid internal modules when generating imports ([#48958](https://github.com/angular/angular/pull/48958)) |
| [521ccfbe6c](https://github.com/angular/angular/commit/521ccfbe6ce9af1a7ddd6ab5e70151b7198f82ef) | fix | avoid interrupting the migration if language service lookup fails ([#49010](https://github.com/angular/angular/pull/49010)) |
| [a40cd47aa7](https://github.com/angular/angular/commit/a40cd47aa7ebccfbeeb26e397e03f1372aa10a55) | fix | avoid modifying testing modules without declarations ([#48921](https://github.com/angular/angular/pull/48921)) |
| [1afa6ed322](https://github.com/angular/angular/commit/1afa6ed3227e784e3fe2b4b31443961589cb6332) | fix | don't add ModuleWithProviders to standalone test components ([#48987](https://github.com/angular/angular/pull/48987)) |
| [c98c6a8452](https://github.com/angular/angular/commit/c98c6a845286b9b89daf275a9c4a2bdbc7ad77a7) | fix | don't copy animations modules into the imports of test components ([#49147](https://github.com/angular/angular/pull/49147)) |
| [8389557848](https://github.com/angular/angular/commit/83895578488bd35c7e47609f092907eb0f53f435) | fix | don't copy unmigrated declarations into imports array ([#48882](https://github.com/angular/angular/pull/48882)) |
| [f82bdc4b01](https://github.com/angular/angular/commit/f82bdc4b01f93a7103870449d37da61cc4c4f179) | fix | don't delete classes that may provide dependencies transitively ([#48866](https://github.com/angular/angular/pull/48866)) |
| [759db12e0b](https://github.com/angular/angular/commit/759db12e0b618fcb51f4cb141adeb49bfa495a60) | fix | duplicated comments on migrated classes ([#48966](https://github.com/angular/angular/pull/48966)) |
| [ba38178d19](https://github.com/angular/angular/commit/ba38178d1918d413f9c2260c40eb6542eadfddba) | fix | generate forwardRef for same file imports ([#48898](https://github.com/angular/angular/pull/48898)) |
| [03fcb36cfd](https://github.com/angular/angular/commit/03fcb36cfd36731028bf288f156e16cb8ac4c758) | fix | migrate HttpClientModule to provideHttpClient() ([#48949](https://github.com/angular/angular/pull/48949)) |
| [2de6dae16d](https://github.com/angular/angular/commit/2de6dae16d4b0b83f0517a3033cda44ba44154ed) | fix | migrate RouterModule.forRoot with a config object to use features ([#48935](https://github.com/angular/angular/pull/48935)) |
| [770191cf1f](https://github.com/angular/angular/commit/770191cf1f1254546625dfa7a882b716c3f0aab3) | fix | migrate tests when switching to standalone bootstrap API ([#48987](https://github.com/angular/angular/pull/48987)) |
| [c7926b5773](https://github.com/angular/angular/commit/c7926b57730c23f765a00d3dd9f92079c95e87e0) | fix | move standalone migrations into imports ([#48987](https://github.com/angular/angular/pull/48987)) |
| [65c74ed93e](https://github.com/angular/angular/commit/65c74ed93e04cb560c27838d440c6aa7a9859a4e) | fix | normalize paths to posix ([#48850](https://github.com/angular/angular/pull/48850)) |
| [6377487b1a](https://github.com/angular/angular/commit/6377487b1ab7679cef9a44f88440fe5e8eb97480) | fix | only exclude bootstrapped declarations from initial standalone migration ([#48987](https://github.com/angular/angular/pull/48987)) |
| [e9e4449a43](https://github.com/angular/angular/commit/e9e4449a43430e026e61b0f05ebd32dd830fa916) | fix | preserve tsconfig in standalone migration ([#48987](https://github.com/angular/angular/pull/48987)) |
| [ffad1b49d9](https://github.com/angular/angular/commit/ffad1b49d95ab90637e7184f92cb5136d490d865) | fix | reduce number of files that need to be checked ([#48987](https://github.com/angular/angular/pull/48987)) |
| [ba7a757cc5](https://github.com/angular/angular/commit/ba7a757cc5a2f3f942adcbabdcd5b7aef33ea493) | fix | return correct alias when conflicting import exists ([#49139](https://github.com/angular/angular/pull/49139)) |
| [49a7c9f94a](https://github.com/angular/angular/commit/49a7c9f94ae8f89907da8b3620242e62f87ec5a4) | fix | standalone migration incorrectly throwing path error for multi app projects ([#48958](https://github.com/angular/angular/pull/48958)) |
| [584976e6c8](https://github.com/angular/angular/commit/584976e6c8a783d40578ab191132673300394a52) | fix | support --defaults in standalone migration ([#48921](https://github.com/angular/angular/pull/48921)) |
| [03f47ac901](https://github.com/angular/angular/commit/03f47ac9019eddbcb373b50c41bc6f523293ece1) | fix | use consistent quotes in generated imports ([#48876](https://github.com/angular/angular/pull/48876)) |
| [ebae506d89](https://github.com/angular/angular/commit/ebae506d894a90c38e0f2dd1e948acabdb0fdf2e) | fix | use import remapper in root component ([#49046](https://github.com/angular/angular/pull/49046)) |
| [40c976c909](https://github.com/angular/angular/commit/40c976c90975878852a87b7722076eb78944098b) | fix | use NgForOf instead of NgFor ([#49022](https://github.com/angular/angular/pull/49022)) |
| [4ac25b2aff](https://github.com/angular/angular/commit/4ac25b2affab4f959ad8c111f1e429a05b435422) | perf | avoid re-traversing nodes when resolving bootstrap call dependencies ([#49010](https://github.com/angular/angular/pull/49010)) |
| [26cb7ab2e6](https://github.com/angular/angular/commit/26cb7ab2e6ac9b61904361a8a544467b69eef3f3) | perf | speed up language service lookups ([#49010](https://github.com/angular/angular/pull/49010)) |
### platform-
| |
001894
|
[Blog post "Angular v15 is now available"](https://goo.gle/angular-v15).
## Breaking Changes
### compiler
- Keyframes names are now prefixed with the component's "scope name".
For example, the following keyframes rule in a component definition,
whose "scope name" is host-my-cmp:
@keyframes foo { ... }
will become:
@keyframes host-my-cmp_foo { ... }
Any TypeScript/JavaScript code which relied on the names of keyframes rules
will no longer match.
The recommended solutions in this case are to either:
- change the component's view encapsulation to the `None` or `ShadowDom`
- define keyframes rules in global stylesheets (e.g styles.css)
- define keyframes rules programmatically in code.
### compiler-cli
- Invalid constructors for DI may now report compilation errors
When a class inherits its constructor from a base class, the compiler may now
report an error when that constructor cannot be used for DI purposes. This may
either be because the base class is missing an Angular decorator such as
`@Injectable()` or `@Directive()`, or because the constructor contains parameters
which do not have an associated token (such as primitive types like `string`).
These situations used to behave unexpectedly at runtime, where the class may be
constructed without any of its constructor parameters, so this is now reported
as an error during compilation.
Any new errors that may be reported because of this change can be resolved either
by decorating the base class from which the constructor is inherited, or by adding
an explicit constructor to the class for which the error is reported.
- Angular compiler option `enableIvy` has been removed as Ivy is the only rendering engine.
### core
- Angular no longer supports Node.js versions `14.[15-19].x` and `16.[10-12].x`. Current supported versions of Node.js are `14.20.x`, `16.13.x` and `18.10.x`.
- TypeScript versions older than 4.8 are no longer supported.
- Existing iframe usages may have security-sensitive attributes applied as an attribute or property binding in a template or via host bindings in a directive. Such usages would require an update to ensure compliance with the new stricter rules around iframe bindings.
- Existing iframe usages may have `src` or `srcdoc` preceding other attributes. Such usages may need to be updated to ensure compliance with the new stricter rules around iframe bindings.
### forms
- setDisabledState will always be called when a `ControlValueAccessor` is attached. You can opt-out with `FormsModule.withConfig` or `ReactiveFormsModule.withConfig`.
### localize
- - `canParse` method has been removed from all translation parsers in `@angular/localize/tools`. `analyze` should be used instead.
- the `hint` parameter in the`parse` methods is now mandatory.
### router
- Previously, the `RouterOutlet` would immediately
instantiate the component being activated during navigation. Now the
component is not instantiated until the change detection runs. This
could affect tests which do not trigger change detection after a router
navigation. In rarer cases, this can affect production code that relies
on the exact timing of component availability.
- The title property is now required on ActivatedRouteSnapshot
- `relativeLinkResolution` is no longer configurable in
the Router. This option was used as a means to opt out of a bug fix.
## Deprecations
### com
| |
001918
|
<h1 align="center">Angular - The modern web developer's platform</h1>
<p align="center">
<img src="adev/src/assets/images/press-kit/angular_icon_gradient.gif" alt="angular-logo" width="120px" height="120px"/>
<br>
<em>Angular is a development platform for building mobile and desktop web applications
<br> using TypeScript/JavaScript and other languages.</em>
<br>
</p>
<p align="center">
<a href="https://angular.dev/"><strong>angular.dev</strong></a>
<br>
</p>
<p align="center">
<a href="CONTRIBUTING.md">Contributing Guidelines</a>
·
<a href="https://github.com/angular/angular/issues">Submit an Issue</a>
·
<a href="https://blog.angular.dev/">Blog</a>
<br>
<br>
</p>
<p align="center">
<a href="https://circleci.com/gh/angular/workflows/angular/tree/main">
<img src="https://img.shields.io/circleci/build/github/angular/angular/main.svg?logo=circleci&logoColor=fff&label=CircleCI" alt="CI status" />
</a>
<a href="https://www.npmjs.com/@angular/core">
<img src="https://img.shields.io/npm/v/@angular/core.svg?logo=npm&logoColor=fff&label=NPM+package&color=limegreen" alt="Angular on npm" />
</a>
<a href="https://discord.gg/angular">
<img src="https://img.shields.io/discord/463752820026376202.svg?logo=discord&logoColor=fff&label=Discord&color=7389d8" alt="Discord conversation" />
</a>
</p>
<p align="center">
<a href="https://app.circleci.com/insights/github/angular/angular/workflows/default_workflow?branch=main">
<img src="https://dl.circleci.com/insights-snapshot/gh/angular/angular/main/default_workflow/badge.svg" alt="InsightsSnapshot" />
</a>
</p>
<hr>
## Documentation
Get started with Angular, learn the fundamentals and explore advanced topics on our documentation website.
- [Getting Started][quickstart]
- [Architecture][architecture]
- [Components and Templates][componentstemplates]
- [Forms][forms]
- [API][api]
### Advanced
- [Angular Elements][angularelements]
- [Server Side Rendering][ssr]
- [Schematics][schematics]
- [Lazy Loading][lazyloading]
- [Animations][animations]
### Local Development
To contribute to the Angular Docs, check out the [Angular.dev README](adev/README.md)
## Development Setup
### Prerequisites
- Install [Node.js] which includes [Node Package Manager][npm]
### Setting Up a Project
Install the Angular CLI globally:
```
npm install -g @angular/cli
```
Create workspace:
```
ng new [PROJECT NAME]
```
Run the application:
```
cd [PROJECT NAME]
ng serve
```
Angular is cross-platform, fast, scalable, has incredible tooling, and is loved by millions.
## Quickstart
[Get started in 5 minutes][quickstart].
## Ecosystem
<p>
<img src="/contributing-docs/images/angular-ecosystem-logos.png" alt="angular ecosystem logos" width="500px" height="auto">
</p>
- [Angular Command Line (CLI)][cli]
- [Angular Material][angularmaterial]
## Changelog
[Learn about the latest improvements][changelog].
## Upgrading
Check out our [upgrade guide](https://angular.dev/update-guide/) to find out the best way to upgrade your project.
## Contributing
### Contributing Guidelines
Read through our [contributing guidelines][contributing] to learn about our submission process, coding rules, and more.
### Want to Help?
Want to report a bug, contribute some code, or improve the documentation? Excellent! Read up on our guidelines for [contributing][contributing] and then check out one of our issues labeled as <kbd>[help wanted](https://github.com/angular/angular/labels/help%20wanted)</kbd> or <kbd>[good first issue](https://github.com/angular/angular/labels/good%20first%20issue)</kbd>.
### Code of Conduct
Help us keep Angular open and inclusive. Please read and follow our [Code of Conduct][codeofconduct].
## Community
Join the conversation and help the community.
- [X (formerly Twitter)][X (formerly Twitter)]
- [Discord][discord]
- [Gitter][gitter]
- [YouTube][youtube]
- [StackOverflow][stackoverflow]
- Find a Local [Meetup][meetup]
[](https://www.github.com/angular/angular)
**Love Angular? Give our repo a star :star: :arrow_up:.**
[contributing]: CONTRIBUTING.md
[quickstart]: https://angular.dev/tutorials/learn-angular
[changelog]: CHANGELOG.md
[ng]: https://angular.dev
[documentation]: https://angular.dev/overview
[angularmaterial]: https://material.angular.io/
[cli]: https://angular.dev/tools/cli
[architecture]: https://angular.dev/essentials
[componentstemplates]: https://angular.dev/tutorials/learn-angular/1-components-in-angular
[forms]: https://angular.dev/tutorials/learn-angular/15-forms
[api]: https://angular.dev/api
[angularelements]: https://angular.dev/guide/elements
[ssr]: https://angular.dev/guide/ssr
[schematics]: https://angular.dev/tools/cli/schematics
[lazyloading]: https://angular.dev/guide/ngmodules/lazy-loading
[node.js]: https://nodejs.org/
[npm]: https://www.npmjs.com/get-npm
[codeofconduct]: CODE_OF_CONDUCT.md
[X (formerly Twitter)]: https://www.twitter.com/angular
[discord]: https://discord.gg/angular
[gitter]: https://gitter.im/angular/angular
[stackoverflow]: https://stackoverflow.com/questions/tagged/angular
[youtube]: https://youtube.com/angular
[meetup]: https://www.meetup.com/find/?keywords=angular
[animations]: https://angular.dev/guide/animations
| |
002007
|
A type of [block](api/core/@defer) that can be used to defer load the JavaScript for components,
directives and pipes used inside a component template.
## Syntax
```angular-html
@defer ( on <trigger>; when <condition>; prefetch on <trigger>; prefetch when <condition> ) {
<!-- deferred template fragment -->
<calendar-cmp />
} @placeholder ( minimum? <duration> ) {
<!-- placeholder template fragment -->
<p>Placeholder</p>
} @loading ( minimum? <duration>; after? <duration> ) {
<!-- loading template fragment -->
<img alt="loading image" src="loading.gif" />
} @error {
<!-- error template fragment -->
<p>An loading error occurred</p>
}
```
## Description
### Blocks
Supported sections of a defer block. Note: only the @defer block template fragment is deferred
loaded. The remaining optional blocks are eagerly loaded.
| block | Description |
|----------------|----------------------------------------------------------|
| `@defer` | The defer loaded block of content |
| `@placeholder` | Content shown prior to defer loading (Optional) |
| `@loading` | Content shown during defer loading (Optional) |
| `@error` | Content shown when defer loading errors occur (Optional) |
<h3>Triggers</h3>
Triggers provide conditions for when defer loading occurs. Some allow a template reference variable
as an optional parameter. Separate multiple triggers with a semicolon.
| trigger | Triggers... |
|---------------------------------|-----------------------------------------------|
| `on idle` | when the browser reports idle state (default) |
| `on viewport(<elementRef>?)` | when the element enters the viewport |
| `on interaction(<elementRef>?)` | when clicked, touched, or focused |
| `on hover(<elementRef>?)` | when element has been hovered |
| `on immediate` | when the page finishes rendering |
| `on timer(<duration>)` | after a specific timeout |
| `when <condition>` | on a custom condition |
<h2>Prefetch</h2>
Configures prefetching of the defer block used in the `@defer` parameters, but does not affect
rendering. Rendering is handled by the standard `on` and `when` conditions. Separate multiple
prefetch configurations with a semicolon.
```angular-html
@defer (prefetch on <trigger>; prefetch when <condition>) {
<!-- deferred template fragment -->
}
```
Learn more in the [defer loading guide](guide/defer).
| |
002009
|
The `@if` block conditionally displays its content when its condition expression is truthy.
## Syntax
```angular-html
@if (a > b) {
{{a}} is greater than {{b}}
} @else if (b > a) {
{{a}} is less than {{b}}
} @else {
{{a}} is equal to {{b}}
}
```
## Description
Content is added and removed from the DOM based on the evaluation of conditional expressions in
the `@if` and `@else` blocks.
The built-in `@if` supports referencing of expression results to keep a solution for common coding
patterns:
```angular-html
@if (users$ | async; as users) {
{{ users.length }}
}
```
| |
002010
|
The `@for` block repeatedly renders content of a block for each item in a collection.
## Syntax
```angular-html
@for (item of items; track item.name) {
<li>{{ item.name }}</li>
} @empty {
<li>There are no items.</li>
}
```
## Description
The `@for` block renders its content in response to changes in a collection. Collections can be any
JavaScript [iterable](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols),
but there are performance advantages of using a regular `Array`.
You can optionally include an `@empty` section immediately after the `@for` block content. The
content of the `@empty` block displays when there are no items.
### `track` and objects identity
The value of the `track` expression determines a key used to associate array items with the views in
the DOM. Having clear indication of the item identity allows Angular to execute a minimal set of DOM
operations as items are added, removed or moved in a collection.
To optimize performance, especially in loops over immutable data, ensure the track expression is effectively used to
identify each item uniquely. Because of the potential for poor performance, the `track` expression
is required for the `@for` loops.
For collections that remain static , `track $index` provides a straightforward tracking mechanism. For dynamic
collections experiencing additions, deletions, or reordering, opt for a
unique property of each item as the tracking key.
### `$index` and other contextual variables
Inside `@for` contents, several implicit variables are always available:
| Variable | Meaning |
|----------|-----------------------------------------------|
| `$count` | Number of items in a collection iterated over |
| `$index` | Index of the current row |
| `$first` | Whether the current row is the first row |
| `$last` | Whether the current row is the last row |
| `$even` | Whether the current row index is even |
| `$odd` | Whether the current row index is odd |
These variables are always available with these names, but can be aliased via a `let` segment:
```angular-html
@for (item of items; track item.id; let idx = $index, e = $even) {
Item #{{ idx }}: {{ item.name }}
}
```
The aliasing is especially useful in case of using nested `@for` blocks where contextual variable
names could collide.
| |
002015
|
The `<ng-content>` element specifies where to project content inside a component template.
## Attributes
| Attribute | Description |
|---------------|-------------------------------------------------------------------------|
| `select` | CSS selector. Matching elements are projected into this `<ng-content>`. |
Only select elements from the projected content that match the given CSS `selector`.
Angular supports [selectors](https://developer.mozilla.org/docs/Web/CSS/CSS_Selectors) for any
combination of tag name, attribute, CSS class, and the `:not` pseudo-class.
| |
002016
|
A special element that can hold structural directives without adding new elements to the DOM.
The `<ng-container>` allows us to use structural directives without any extra element, making sure
that the only DOM changes being applied are those dictated by the directives themselves.
This not only increases performance \(even so slightly\) since the browser ends up rendering less
elements but can also be a valuable asset in having cleaner DOMs and styles alike.
It can for example enable us to use structural directives without breaking styling dependent on a
precise DOM structure \(as for example the ones we get when using flex containers, margins, the
child combinator selector, etc.\).
## Usage notes
### With `*NgIf`s
One common use case of `<ng-container>` is alongside the `*ngIf` structural directive. By using the
special element we can produce very clean templates easy to understand and work with.
For example, we may want to have a number of elements shown conditionally but they do not need to be
all under the same root element. That can be easily done by wrapping them in such a block:
<code-example format="html" language="html">
<ng-container *ngIf="condition">
…
</ng-container>
</code-example>
This can also be augmented with an `else` statement alongside an `<ng-template>` as:
<code-example format="html" language="html">
<ng-container *ngIf="condition; else templateA">
…
</ng-container>
<ng-template #templateA>
…
</ng-template>
</code-example>
### Combination of multiple structural directives
Multiple structural directives cannot be used on the same element; if you need to take advantage of
more than one structural directive, it is advised to use an `<ng-container>` per structural
directive.
The most common scenario is with `*ngIf` and `*ngFor`. For example, let's imagine that we have a
list of items but each item needs to be displayed only if a certain condition is true. We could be
tempted to try something like:
<code-example format="html" language="html">
<ul>
<li *ngFor="let item of items" *ngIf="item.isValid">
{{ item.name }}
</li>
</ul>
</code-example>
As we said that would not work, what we can do is to simply move one of the structural directives to
an `<ng-container>` element, which would then wrap the other one, like so:
<code-example format="html" language="html">
<ul>
<ng-container *ngFor="let item of items">
<li *ngIf="item.isValid">
{{ item.name }}
</li>
</ng-container>
</ul>
</code-example>
This would work as intended without introducing any new unnecessary elements in the DOM.
For more information see [one structural directive per element](guide/directives/structural-directives#one-structural-directive-per-element).
### Use alongside ngTemplateOutlet
The `NgTemplateOutlet` directive can be applied to any element but most of the time it's applied
to `<ng-container>` ones. By combining the two, we get a very clear and easy to follow HTML and DOM
structure in which no extra elements are necessary and template views are instantiated where
requested.
For example, imagine a situation in which we have a large HTML, in which a small portion needs to be
repeated in different places. A simple solution is to define an `<ng-template>` containing our
repeating HTML and render that where necessary by using `<ng-container>` alongside
an `NgTemplateOutlet`.
Like so:
<code-example format="html" language="html">
<!-- … -->
<ng-container *ngTemplateOutlet="tmpl; context: {$implicit: 'Hello'}">
</ng-container>
<!-- … -->
<ng-container *ngTemplateOutlet="tmpl; context: {$implicit: 'World'}">
</ng-container>
<!-- … -->
<ng-template #tmpl let-text>
<h1>{{ text }}</h1>
</ng-template>
</code-example>
For more information regarding `NgTemplateOutlet`, see
the [`NgTemplateOutlet`s api documentation page](api/common/NgTemplateOutlet).
| |
002128
|
import {isPlatformBrowser} from '@angular/common';
import {CUSTOM_ELEMENTS_SCHEMA, Inject, Injector, NgModule, PLATFORM_ID} from '@angular/core';
import {createCustomElement} from '@angular/elements';
import {BrowserModule} from '@angular/platform-browser';
import {RouterModule} from '@angular/router';
import {AppComponent} from './app.component';
import {TitleComponent} from './title.component';
@NgModule({
bootstrap: [AppComponent],
declarations: [AppComponent, TitleComponent],
imports: [BrowserModule, RouterModule.forRoot([])],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {
constructor(injector: Injector, @Inject(PLATFORM_ID) platformId: object) {
if (isPlatformBrowser(platformId)) {
customElements.define('app-title-ce', createCustomElement(TitleComponent, {injector}));
}
}
}
| |
002146
|
"@ampproject/[email protected]", "@ampproject/remapping@^2.2.0":
version "2.3.0"
resolved "https://registry.yarnpkg.com/@ampproject/remapping/-/remapping-2.3.0.tgz#ed441b6fa600072520ce18b43d2c8cc8caecc7f4"
integrity sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==
dependencies:
"@jridgewell/gen-mapping" "^0.3.5"
"@jridgewell/trace-mapping" "^0.3.24"
"@angular-devkit/[email protected]":
version "0.1900.0-next.5"
resolved "https://registry.yarnpkg.com/@angular-devkit/architect/-/architect-0.1900.0-next.5.tgz#4bf510e52fd6542c5b80e677bf8643828586b2de"
integrity sha512-VX9rM05f2pbonjNjwZZv/kY0XVA5I5imwlshPf05wu4MSUsWJLBgugr/MwsYGyLjyT6PPredB6F+QEYvijNIiw==
dependencies:
"@angular-devkit/core" "19.0.0-next.5"
rxjs "7.8.1"
"@angular-devkit/build-angular@file:../../node_modules/@angular-devkit/build-angular":
version "19.0.0-next.5"
dependencies:
"@ampproject/remapping" "2.3.0"
"@angular-devkit/architect" "0.1900.0-next.5"
"@angular-devkit/build-webpack" "0.1900.0-next.5"
"@angular-devkit/core" "19.0.0-next.5"
"@angular/build" "19.0.0-next.5"
"@babel/core" "7.25.2"
"@babel/generator" "7.25.6"
"@babel/helper-annotate-as-pure" "7.24.7"
"@babel/helper-split-export-declaration" "7.24.7"
"@babel/plugin-transform-async-generator-functions" "7.25.4"
"@babel/plugin-transform-async-to-generator" "7.24.7"
"@babel/plugin-transform-runtime" "7.25.4"
"@babel/preset-env" "7.25.4"
"@babel/runtime" "7.25.6"
"@discoveryjs/json-ext" "0.6.1"
"@ngtools/webpack" "19.0.0-next.5"
"@vitejs/plugin-basic-ssl" "1.1.0"
ansi-colors "4.1.3"
autoprefixer "10.4.20"
babel-loader "9.1.3"
browserslist "^4.21.5"
copy-webpack-plugin "12.0.2"
critters "0.0.24"
css-loader "7.1.2"
esbuild-wasm "0.23.1"
fast-glob "3.3.2"
http-proxy-middleware "3.0.2"
https-proxy-agent "7.0.5"
istanbul-lib-instrument "6.0.3"
jsonc-parser "3.3.1"
karma-source-map-support "1.4.0"
less "4.2.0"
less-loader "12.2.0"
license-webpack-plugin "4.0.2"
loader-utils "3.3.1"
magic-string "0.30.11"
mini-css-extract-plugin "2.9.1"
mrmime "2.0.0"
open "10.1.0"
ora "5.4.1"
parse5-html-rewriting-stream "7.0.0"
picomatch "4.0.2"
piscina "4.6.1"
postcss "8.4.45"
postcss-loader "8.1.1"
resolve-url-loader "5.0.0"
rxjs "7.8.1"
sass "1.78.0"
sass-loader "16.0.1"
semver "7.6.3"
source-map-loader "5.0.0"
source-map-support "0.5.21"
terser "5.32.0"
tree-kill "1.2.2"
tslib "2.7.0"
vite "5.4.4"
watchpack "2.4.2"
webpack "5.94.0"
webpack-dev-middleware "7.4.2"
webpack-dev-server "5.1.0"
webpack-merge "6.0.1"
webpack-subresource-integrity "5.1.0"
optionalDependencies:
esbuild "0.23.1"
"@angular-devkit/[email protected]":
version "0.1900.0-next.5"
resolved "https://registry.yarnpkg.com/@angular-devkit/build-webpack/-/build-webpack-0.1900.0-next.5.tgz#b1a974dc4f54e7f45d915081508e60be746df5c1"
integrity sha512-DMf3rr0Lh/bwhCcRyLvKl9UEnOFd8tkgu9X6sMgFSLRYDIThlUm+jntjQPIGcdN21wQTFgl+O1y/Ck6WYe7Jyw==
dependencies:
"@angular-devkit/architect" "0.1900.0-next.5"
rxjs "7.8.1"
"@angular-devkit/[email protected]":
version "19.0.0-next.5"
resolved "https://registry.yarnpkg.com/@angular-devkit/core/-/core-19.0.0-next.5.tgz#710ae0e618cb04fa2e4c38e83d4ad1542968e3cb"
integrity sha512-WEVlMZPvE7AQPKwfEdH4nuREkIAVwhVhkAD6EAZDYI0U2thLoDcPmNVgFgrrUxdxYE/+VTfXTCBSk6Eu2UkZKQ==
dependencies:
ajv "8.17.1"
ajv-formats "3.0.1"
jsonc-parser "3.3.1"
picomatch "4.0.2"
rxjs "7.8.1"
source-map "0.7.4"
"@angular-devkit/[email protected]":
version "19.0.0-next.5"
resolved "https://registry.yarnpkg.com/@angular-devkit/schematics/-/schematics-19.0.0-next.5.tgz#ade97e2d7218d3365a01c6cfa3c56d9d116b39d8"
integrity sha512-WCJ6uW4JqnSx0nKoPc4himv0srjvOeKHsKEVjVBNW9vuEv70zXpWa7/ggpTdOUt955umqy0NdObTFWmOBBV6jw==
dependencies:
"@angular-devkit/core" "19.0.0-next.5"
jsonc-parser "3.3.1"
magic-string "0.30.11"
ora "5.4.1"
rxjs "7.8.1"
"@angular/animations@file:../../dist/packages-dist/animations":
version "19.0.0-next.1"
dependencies:
tslib "^2.3.0"
| |
002248
|
"@ampproject/[email protected]", "@ampproject/remapping@^2.2.0":
version "2.3.0"
resolved "https://registry.yarnpkg.com/@ampproject/remapping/-/remapping-2.3.0.tgz#ed441b6fa600072520ce18b43d2c8cc8caecc7f4"
integrity sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==
dependencies:
"@jridgewell/gen-mapping" "^0.3.5"
"@jridgewell/trace-mapping" "^0.3.24"
"@angular-devkit/[email protected]":
version "0.1900.0-next.5"
resolved "https://registry.yarnpkg.com/@angular-devkit/architect/-/architect-0.1900.0-next.5.tgz#4bf510e52fd6542c5b80e677bf8643828586b2de"
integrity sha512-VX9rM05f2pbonjNjwZZv/kY0XVA5I5imwlshPf05wu4MSUsWJLBgugr/MwsYGyLjyT6PPredB6F+QEYvijNIiw==
dependencies:
"@angular-devkit/core" "19.0.0-next.5"
rxjs "7.8.1"
"@angular-devkit/build-angular@file:../../node_modules/@angular-devkit/build-angular":
version "19.0.0-next.5"
dependencies:
"@ampproject/remapping" "2.3.0"
"@angular-devkit/architect" "0.1900.0-next.5"
"@angular-devkit/build-webpack" "0.1900.0-next.5"
"@angular-devkit/core" "19.0.0-next.5"
"@angular/build" "19.0.0-next.5"
"@babel/core" "7.25.2"
"@babel/generator" "7.25.6"
"@babel/helper-annotate-as-pure" "7.24.7"
"@babel/helper-split-export-declaration" "7.24.7"
"@babel/plugin-transform-async-generator-functions" "7.25.4"
"@babel/plugin-transform-async-to-generator" "7.24.7"
"@babel/plugin-transform-runtime" "7.25.4"
"@babel/preset-env" "7.25.4"
"@babel/runtime" "7.25.6"
"@discoveryjs/json-ext" "0.6.1"
"@ngtools/webpack" "19.0.0-next.5"
"@vitejs/plugin-basic-ssl" "1.1.0"
ansi-colors "4.1.3"
autoprefixer "10.4.20"
babel-loader "9.1.3"
browserslist "^4.21.5"
copy-webpack-plugin "12.0.2"
critters "0.0.24"
css-loader "7.1.2"
esbuild-wasm "0.23.1"
fast-glob "3.3.2"
http-proxy-middleware "3.0.2"
https-proxy-agent "7.0.5"
istanbul-lib-instrument "6.0.3"
jsonc-parser "3.3.1"
karma-source-map-support "1.4.0"
less "4.2.0"
less-loader "12.2.0"
license-webpack-plugin "4.0.2"
loader-utils "3.3.1"
magic-string "0.30.11"
mini-css-extract-plugin "2.9.1"
mrmime "2.0.0"
open "10.1.0"
ora "5.4.1"
parse5-html-rewriting-stream "7.0.0"
picomatch "4.0.2"
piscina "4.6.1"
postcss "8.4.45"
postcss-loader "8.1.1"
resolve-url-loader "5.0.0"
rxjs "7.8.1"
sass "1.78.0"
sass-loader "16.0.1"
semver "7.6.3"
source-map-loader "5.0.0"
source-map-support "0.5.21"
terser "5.32.0"
tree-kill "1.2.2"
tslib "2.7.0"
vite "5.4.4"
watchpack "2.4.2"
webpack "5.94.0"
webpack-dev-middleware "7.4.2"
webpack-dev-server "5.1.0"
webpack-merge "6.0.1"
webpack-subresource-integrity "5.1.0"
optionalDependencies:
esbuild "0.23.1"
"@angular-devkit/[email protected]":
version "0.1900.0-next.5"
resolved "https://registry.yarnpkg.com/@angular-devkit/build-webpack/-/build-webpack-0.1900.0-next.5.tgz#b1a974dc4f54e7f45d915081508e60be746df5c1"
integrity sha512-DMf3rr0Lh/bwhCcRyLvKl9UEnOFd8tkgu9X6sMgFSLRYDIThlUm+jntjQPIGcdN21wQTFgl+O1y/Ck6WYe7Jyw==
dependencies:
"@angular-devkit/architect" "0.1900.0-next.5"
rxjs "7.8.1"
"@angular-devkit/[email protected]":
version "19.0.0-next.5"
resolved "https://registry.yarnpkg.com/@angular-devkit/core/-/core-19.0.0-next.5.tgz#710ae0e618cb04fa2e4c38e83d4ad1542968e3cb"
integrity sha512-WEVlMZPvE7AQPKwfEdH4nuREkIAVwhVhkAD6EAZDYI0U2thLoDcPmNVgFgrrUxdxYE/+VTfXTCBSk6Eu2UkZKQ==
dependencies:
ajv "8.17.1"
ajv-formats "3.0.1"
jsonc-parser "3.3.1"
picomatch "4.0.2"
rxjs "7.8.1"
source-map "0.7.4"
"@angular-devkit/[email protected]":
version "19.0.0-next.5"
resolved "https://registry.yarnpkg.com/@angular-devkit/schematics/-/schematics-19.0.0-next.5.tgz#ade97e2d7218d3365a01c6cfa3c56d9d116b39d8"
integrity sha512-WCJ6uW4JqnSx0nKoPc4himv0srjvOeKHsKEVjVBNW9vuEv70zXpWa7/ggpTdOUt955umqy0NdObTFWmOBBV6jw==
dependencies:
"@angular-devkit/core" "19.0.0-next.5"
jsonc-parser "3.3.1"
magic-string "0.30.11"
ora "5.4.1"
rxjs "7.8.1"
"@angular/animations@file:../../dist/packages-dist/animations":
version "19.0.0-next.1"
dependencies:
tslib "^2.3.0"
| |
002340
|
import {mergeApplicationConfig, ApplicationConfig} from '@angular/core';
import {provideServerRendering} from '@angular/platform-server';
import {appConfig} from './app.config';
const serverConfig: ApplicationConfig = {
providers: [provideServerRendering()],
};
export const config = mergeApplicationConfig(appConfig, serverConfig);
| |
002341
|
import {Routes} from '@angular/router';
export const routes: Routes = [];
| |
002347
|
"@ampproject/[email protected]", "@ampproject/remapping@^2.2.0":
version "2.3.0"
resolved "https://registry.yarnpkg.com/@ampproject/remapping/-/remapping-2.3.0.tgz#ed441b6fa600072520ce18b43d2c8cc8caecc7f4"
integrity sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==
dependencies:
"@jridgewell/gen-mapping" "^0.3.5"
"@jridgewell/trace-mapping" "^0.3.24"
"@angular-devkit/[email protected]":
version "0.1900.0-next.5"
resolved "https://registry.yarnpkg.com/@angular-devkit/architect/-/architect-0.1900.0-next.5.tgz#4bf510e52fd6542c5b80e677bf8643828586b2de"
integrity sha512-VX9rM05f2pbonjNjwZZv/kY0XVA5I5imwlshPf05wu4MSUsWJLBgugr/MwsYGyLjyT6PPredB6F+QEYvijNIiw==
dependencies:
"@angular-devkit/core" "19.0.0-next.5"
rxjs "7.8.1"
"@angular-devkit/build-angular@file:../../node_modules/@angular-devkit/build-angular":
version "19.0.0-next.5"
dependencies:
"@ampproject/remapping" "2.3.0"
"@angular-devkit/architect" "0.1900.0-next.5"
"@angular-devkit/build-webpack" "0.1900.0-next.5"
"@angular-devkit/core" "19.0.0-next.5"
"@angular/build" "19.0.0-next.5"
"@babel/core" "7.25.2"
"@babel/generator" "7.25.6"
"@babel/helper-annotate-as-pure" "7.24.7"
"@babel/helper-split-export-declaration" "7.24.7"
"@babel/plugin-transform-async-generator-functions" "7.25.4"
"@babel/plugin-transform-async-to-generator" "7.24.7"
"@babel/plugin-transform-runtime" "7.25.4"
"@babel/preset-env" "7.25.4"
"@babel/runtime" "7.25.6"
"@discoveryjs/json-ext" "0.6.1"
"@ngtools/webpack" "19.0.0-next.5"
"@vitejs/plugin-basic-ssl" "1.1.0"
ansi-colors "4.1.3"
autoprefixer "10.4.20"
babel-loader "9.1.3"
browserslist "^4.21.5"
copy-webpack-plugin "12.0.2"
critters "0.0.24"
css-loader "7.1.2"
esbuild-wasm "0.23.1"
fast-glob "3.3.2"
http-proxy-middleware "3.0.2"
https-proxy-agent "7.0.5"
istanbul-lib-instrument "6.0.3"
jsonc-parser "3.3.1"
karma-source-map-support "1.4.0"
less "4.2.0"
less-loader "12.2.0"
license-webpack-plugin "4.0.2"
loader-utils "3.3.1"
magic-string "0.30.11"
mini-css-extract-plugin "2.9.1"
mrmime "2.0.0"
open "10.1.0"
ora "5.4.1"
parse5-html-rewriting-stream "7.0.0"
picomatch "4.0.2"
piscina "4.6.1"
postcss "8.4.45"
postcss-loader "8.1.1"
resolve-url-loader "5.0.0"
rxjs "7.8.1"
sass "1.78.0"
sass-loader "16.0.1"
semver "7.6.3"
source-map-loader "5.0.0"
source-map-support "0.5.21"
terser "5.32.0"
tree-kill "1.2.2"
tslib "2.7.0"
vite "5.4.4"
watchpack "2.4.2"
webpack "5.94.0"
webpack-dev-middleware "7.4.2"
webpack-dev-server "5.1.0"
webpack-merge "6.0.1"
webpack-subresource-integrity "5.1.0"
optionalDependencies:
esbuild "0.23.1"
"@angular-devkit/[email protected]":
version "0.1900.0-next.5"
resolved "https://registry.yarnpkg.com/@angular-devkit/build-webpack/-/build-webpack-0.1900.0-next.5.tgz#b1a974dc4f54e7f45d915081508e60be746df5c1"
integrity sha512-DMf3rr0Lh/bwhCcRyLvKl9UEnOFd8tkgu9X6sMgFSLRYDIThlUm+jntjQPIGcdN21wQTFgl+O1y/Ck6WYe7Jyw==
dependencies:
"@angular-devkit/architect" "0.1900.0-next.5"
rxjs "7.8.1"
"@angular-devkit/[email protected]":
version "19.0.0-next.5"
resolved "https://registry.yarnpkg.com/@angular-devkit/core/-/core-19.0.0-next.5.tgz#710ae0e618cb04fa2e4c38e83d4ad1542968e3cb"
integrity sha512-WEVlMZPvE7AQPKwfEdH4nuREkIAVwhVhkAD6EAZDYI0U2thLoDcPmNVgFgrrUxdxYE/+VTfXTCBSk6Eu2UkZKQ==
dependencies:
ajv "8.17.1"
ajv-formats "3.0.1"
jsonc-parser "3.3.1"
picomatch "4.0.2"
rxjs "7.8.1"
source-map "0.7.4"
"@angular-devkit/[email protected]":
version "19.0.0-next.5"
resolved "https://registry.yarnpkg.com/@angular-devkit/schematics/-/schematics-19.0.0-next.5.tgz#ade97e2d7218d3365a01c6cfa3c56d9d116b39d8"
integrity sha512-WCJ6uW4JqnSx0nKoPc4himv0srjvOeKHsKEVjVBNW9vuEv70zXpWa7/ggpTdOUt955umqy0NdObTFWmOBBV6jw==
dependencies:
"@angular-devkit/core" "19.0.0-next.5"
jsonc-parser "3.3.1"
magic-string "0.30.11"
ora "5.4.1"
rxjs "7.8.1"
"@angular/animations@file:../../dist/packages-dist/animations":
version "19.0.0-next.1"
dependencies:
tslib "^2.3.0"
| |
002447
|
import {CommonModule} from '@angular/common';
import {NgModule} from '@angular/core';
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
import {BrowserModule} from '@angular/platform-browser';
import {AppComponent, ReactiveFormsComponent, TemplateFormsComponent} from './app.component';
@NgModule({
declarations: [AppComponent, TemplateFormsComponent, ReactiveFormsComponent],
imports: [BrowserModule, CommonModule, FormsModule, ReactiveFormsModule],
bootstrap: [AppComponent],
})
export class AppModule {}
| |
002448
|
import {Component} from '@angular/core';
import {FormArray, FormBuilder, FormControl, FormGroup, Validators} from '@angular/forms';
@Component({
selector: 'app-template-forms',
template: `
<form novalidate>
<div ngModelGroup="profileForm">
<div>
First Name:
<input name="first" ngModel required />
</div>
<div>
Last Name:
<input name="last" ngModel />
</div>
<div>
Subscribe:
<input name="subscribed" type="checkbox" ngModel />
</div>
<div>Disabled: <input name="foo" ngModel disabled /></div>
<div *ngFor="let city of addresses; let i = index">
City <input [(ngModel)]="addresses[i].city" name="name" />
</div>
<button (click)="addCity()">Add City</button>
</div>
</form>`,
standalone: false,
})
export class TemplateFormsComponent {
name = {first: 'Nancy', last: 'Drew', subscribed: true};
addresses = [{city: 'Toronto'}];
constructor() {
// We use this reference in our test
(window as any).templateFormsComponent = this;
}
addCity() {
this.addresses.push({city: ''});
}
}
@Component({
selector: 'app-reactive-forms',
template: `
<form [formGroup]="profileForm">
<div>
First Name:
<input type="text" formControlName="firstName" />
</div>
<div>
Last Name:
<input type="text" formControlName="lastName" />
</div>
<div>
Subscribe:
<input type="checkbox" formControlName="subscribed" />
</div>
<div>Disabled: <input formControlName="disabledInput" /></div>
<div formArrayName="addresses">
<div *ngFor="let item of itemControls; let i = index" [formGroupName]="i">
<div>City: <input formControlName="city" /></div>
</div>
</div>
<button (click)="addCity()">Add City</button>
</form>`,
standalone: false,
})
export class ReactiveFormsComponent {
profileForm!: FormGroup;
addresses!: FormArray;
get itemControls() {
return (this.profileForm.get('addresses') as FormArray).controls;
}
constructor(private formBuilder: FormBuilder) {
// We use this reference in our test
(window as any).reactiveFormsComponent = this;
}
ngOnInit() {
this.profileForm = new FormGroup({
firstName: new FormControl('', Validators.required),
lastName: new FormControl(''),
addresses: new FormArray([]),
subscribed: new FormControl(),
disabledInput: new FormControl({value: '', disabled: true}),
});
this.addCity();
}
createItem(): FormGroup {
return this.formBuilder.group({
city: '',
});
}
addCity(): void {
this.addresses = this.profileForm.get('addresses') as FormArray;
this.addresses.push(this.createItem());
}
}
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
standalone: false,
})
export class AppComponent {}
| |
002452
|
"@ampproject/[email protected]", "@ampproject/remapping@^2.2.0":
version "2.3.0"
resolved "https://registry.yarnpkg.com/@ampproject/remapping/-/remapping-2.3.0.tgz#ed441b6fa600072520ce18b43d2c8cc8caecc7f4"
integrity sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==
dependencies:
"@jridgewell/gen-mapping" "^0.3.5"
"@jridgewell/trace-mapping" "^0.3.24"
"@angular-devkit/[email protected]":
version "0.1900.0-next.5"
resolved "https://registry.yarnpkg.com/@angular-devkit/architect/-/architect-0.1900.0-next.5.tgz#4bf510e52fd6542c5b80e677bf8643828586b2de"
integrity sha512-VX9rM05f2pbonjNjwZZv/kY0XVA5I5imwlshPf05wu4MSUsWJLBgugr/MwsYGyLjyT6PPredB6F+QEYvijNIiw==
dependencies:
"@angular-devkit/core" "19.0.0-next.5"
rxjs "7.8.1"
"@angular-devkit/build-angular@file:../../node_modules/@angular-devkit/build-angular":
version "19.0.0-next.5"
dependencies:
"@ampproject/remapping" "2.3.0"
"@angular-devkit/architect" "0.1900.0-next.5"
"@angular-devkit/build-webpack" "0.1900.0-next.5"
"@angular-devkit/core" "19.0.0-next.5"
"@angular/build" "19.0.0-next.5"
"@babel/core" "7.25.2"
"@babel/generator" "7.25.6"
"@babel/helper-annotate-as-pure" "7.24.7"
"@babel/helper-split-export-declaration" "7.24.7"
"@babel/plugin-transform-async-generator-functions" "7.25.4"
"@babel/plugin-transform-async-to-generator" "7.24.7"
"@babel/plugin-transform-runtime" "7.25.4"
"@babel/preset-env" "7.25.4"
"@babel/runtime" "7.25.6"
"@discoveryjs/json-ext" "0.6.1"
"@ngtools/webpack" "19.0.0-next.5"
"@vitejs/plugin-basic-ssl" "1.1.0"
ansi-colors "4.1.3"
autoprefixer "10.4.20"
babel-loader "9.1.3"
browserslist "^4.21.5"
copy-webpack-plugin "12.0.2"
critters "0.0.24"
css-loader "7.1.2"
esbuild-wasm "0.23.1"
fast-glob "3.3.2"
http-proxy-middleware "3.0.2"
https-proxy-agent "7.0.5"
istanbul-lib-instrument "6.0.3"
jsonc-parser "3.3.1"
karma-source-map-support "1.4.0"
less "4.2.0"
less-loader "12.2.0"
license-webpack-plugin "4.0.2"
loader-utils "3.3.1"
magic-string "0.30.11"
mini-css-extract-plugin "2.9.1"
mrmime "2.0.0"
open "10.1.0"
ora "5.4.1"
parse5-html-rewriting-stream "7.0.0"
picomatch "4.0.2"
piscina "4.6.1"
postcss "8.4.45"
postcss-loader "8.1.1"
resolve-url-loader "5.0.0"
rxjs "7.8.1"
sass "1.78.0"
sass-loader "16.0.1"
semver "7.6.3"
source-map-loader "5.0.0"
source-map-support "0.5.21"
terser "5.32.0"
tree-kill "1.2.2"
tslib "2.7.0"
vite "5.4.4"
watchpack "2.4.2"
webpack "5.94.0"
webpack-dev-middleware "7.4.2"
webpack-dev-server "5.1.0"
webpack-merge "6.0.1"
webpack-subresource-integrity "5.1.0"
optionalDependencies:
esbuild "0.23.1"
"@angular-devkit/[email protected]":
version "0.1900.0-next.5"
resolved "https://registry.yarnpkg.com/@angular-devkit/build-webpack/-/build-webpack-0.1900.0-next.5.tgz#b1a974dc4f54e7f45d915081508e60be746df5c1"
integrity sha512-DMf3rr0Lh/bwhCcRyLvKl9UEnOFd8tkgu9X6sMgFSLRYDIThlUm+jntjQPIGcdN21wQTFgl+O1y/Ck6WYe7Jyw==
dependencies:
"@angular-devkit/architect" "0.1900.0-next.5"
rxjs "7.8.1"
"@angular-devkit/[email protected]":
version "19.0.0-next.5"
resolved "https://registry.yarnpkg.com/@angular-devkit/core/-/core-19.0.0-next.5.tgz#710ae0e618cb04fa2e4c38e83d4ad1542968e3cb"
integrity sha512-WEVlMZPvE7AQPKwfEdH4nuREkIAVwhVhkAD6EAZDYI0U2thLoDcPmNVgFgrrUxdxYE/+VTfXTCBSk6Eu2UkZKQ==
dependencies:
ajv "8.17.1"
ajv-formats "3.0.1"
jsonc-parser "3.3.1"
picomatch "4.0.2"
rxjs "7.8.1"
source-map "0.7.4"
"@angular-devkit/[email protected]":
version "19.0.0-next.5"
resolved "https://registry.yarnpkg.com/@angular-devkit/schematics/-/schematics-19.0.0-next.5.tgz#ade97e2d7218d3365a01c6cfa3c56d9d116b39d8"
integrity sha512-WCJ6uW4JqnSx0nKoPc4himv0srjvOeKHsKEVjVBNW9vuEv70zXpWa7/ggpTdOUt955umqy0NdObTFWmOBBV6jw==
dependencies:
"@angular-devkit/core" "19.0.0-next.5"
jsonc-parser "3.3.1"
magic-string "0.30.11"
ora "5.4.1"
rxjs "7.8.1"
"@angular/animations@file:../../dist/packages-dist/animations":
version "19.0.0-next.1"
dependencies:
tslib "^2.3.0"
| |
002509
|
parseurl@~1.3.2, parseurl@~1.3.3:
version "1.3.3"
resolved "https://registry.yarnpkg.com/parseurl/-/parseurl-1.3.3.tgz#9da19e7bee8d12dff0513ed5b76957793bc2e8d4"
integrity sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==
path-exists@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-5.0.0.tgz#a6aad9489200b21fab31e49cf09277e5116fb9e7"
integrity sha512-RjhtfwJOxzcFmNOi6ltcbcu4Iu+FL3zEj83dk4kAS+fVpTxXLO1b38RvJgT/0QwvV/L3aY9TAnyv0EOqW4GoMQ==
path-is-absolute@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f"
integrity sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==
path-key@^3.1.0:
version "3.1.1"
resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375"
integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==
path-parse@^1.0.7:
version "1.0.7"
resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735"
integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==
path-scurry@^1.11.1:
version "1.11.1"
resolved "https://registry.yarnpkg.com/path-scurry/-/path-scurry-1.11.1.tgz#7960a668888594a0720b12a911d1a742ab9f11d2"
integrity sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==
dependencies:
lru-cache "^10.2.0"
minipass "^5.0.0 || ^6.0.2 || ^7.0.0"
[email protected]:
version "0.1.10"
resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.10.tgz#67e9108c5c0551b9e5326064387de4763c4d5f8b"
integrity sha512-7lf7qcQidTku0Gu3YDPc8DJ1q7OOucfa/BSsIwjuh56VU7katFvuM8hULfkwB3Fns/rsVF7PwPKVw1sl5KQS9w==
path-type@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/path-type/-/path-type-5.0.0.tgz#14b01ed7aea7ddf9c7c3f46181d4d04f9c785bb8"
integrity sha512-5HviZNaZcfqP95rwpv+1HDgUamezbqdSYTyzjTvwtJSnIH+3vnbmWsItli8OFEndS984VT55M3jduxZbX351gg==
picocolors@^1.0.0, picocolors@^1.0.1:
version "1.1.0"
resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.1.0.tgz#5358b76a78cde483ba5cef6a9dc9671440b27d59"
integrity sha512-TQ92mBOW0l3LeMeyLV6mzy/kWr8lkd/hp3mTg7wYK7zJhuBStmGMBG0BdeDZS/dZx1IukaX6Bk11zcln25o1Aw==
[email protected]:
version "4.0.2"
resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-4.0.2.tgz#77c742931e8f3b8820946c76cd0c1f13730d1dab"
integrity sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==
picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.3.1:
version "2.3.1"
resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42"
integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==
pify@^4.0.1:
version "4.0.1"
resolved "https://registry.yarnpkg.com/pify/-/pify-4.0.1.tgz#4b2cd25c50d598735c50292224fd8c6df41e3231"
integrity sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==
[email protected]:
version "4.6.1"
resolved "https://registry.yarnpkg.com/piscina/-/piscina-4.6.1.tgz#4de673b0ff84bf641b31b07b3348669383b51c9a"
integrity sha512-z30AwWGtQE+Apr+2WBZensP2lIvwoaMcOPkQlIEmSGMJNUvaYACylPYrQM6wSdUNJlnDVMSpLv7xTMJqlVshOA==
optionalDependencies:
nice-napi "^1.0.2"
| |
002539
|
"@ampproject/[email protected]", "@ampproject/remapping@^2.2.0":
version "2.3.0"
resolved "https://registry.yarnpkg.com/@ampproject/remapping/-/remapping-2.3.0.tgz#ed441b6fa600072520ce18b43d2c8cc8caecc7f4"
integrity sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==
dependencies:
"@jridgewell/gen-mapping" "^0.3.5"
"@jridgewell/trace-mapping" "^0.3.24"
"@angular-devkit/[email protected]":
version "0.1900.0-next.5"
resolved "https://registry.yarnpkg.com/@angular-devkit/architect/-/architect-0.1900.0-next.5.tgz#4bf510e52fd6542c5b80e677bf8643828586b2de"
integrity sha512-VX9rM05f2pbonjNjwZZv/kY0XVA5I5imwlshPf05wu4MSUsWJLBgugr/MwsYGyLjyT6PPredB6F+QEYvijNIiw==
dependencies:
"@angular-devkit/core" "19.0.0-next.5"
rxjs "7.8.1"
"@angular-devkit/build-angular@file:../../node_modules/@angular-devkit/build-angular":
version "19.0.0-next.5"
dependencies:
"@ampproject/remapping" "2.3.0"
"@angular-devkit/architect" "0.1900.0-next.5"
"@angular-devkit/build-webpack" "0.1900.0-next.5"
"@angular-devkit/core" "19.0.0-next.5"
"@angular/build" "19.0.0-next.5"
"@babel/core" "7.25.2"
"@babel/generator" "7.25.6"
"@babel/helper-annotate-as-pure" "7.24.7"
"@babel/helper-split-export-declaration" "7.24.7"
"@babel/plugin-transform-async-generator-functions" "7.25.4"
"@babel/plugin-transform-async-to-generator" "7.24.7"
"@babel/plugin-transform-runtime" "7.25.4"
"@babel/preset-env" "7.25.4"
"@babel/runtime" "7.25.6"
"@discoveryjs/json-ext" "0.6.1"
"@ngtools/webpack" "19.0.0-next.5"
"@vitejs/plugin-basic-ssl" "1.1.0"
ansi-colors "4.1.3"
autoprefixer "10.4.20"
babel-loader "9.1.3"
browserslist "^4.21.5"
copy-webpack-plugin "12.0.2"
critters "0.0.24"
css-loader "7.1.2"
esbuild-wasm "0.23.1"
fast-glob "3.3.2"
http-proxy-middleware "3.0.2"
https-proxy-agent "7.0.5"
istanbul-lib-instrument "6.0.3"
jsonc-parser "3.3.1"
karma-source-map-support "1.4.0"
less "4.2.0"
less-loader "12.2.0"
license-webpack-plugin "4.0.2"
loader-utils "3.3.1"
magic-string "0.30.11"
mini-css-extract-plugin "2.9.1"
mrmime "2.0.0"
open "10.1.0"
ora "5.4.1"
parse5-html-rewriting-stream "7.0.0"
picomatch "4.0.2"
piscina "4.6.1"
postcss "8.4.45"
postcss-loader "8.1.1"
resolve-url-loader "5.0.0"
rxjs "7.8.1"
sass "1.78.0"
sass-loader "16.0.1"
semver "7.6.3"
source-map-loader "5.0.0"
source-map-support "0.5.21"
terser "5.32.0"
tree-kill "1.2.2"
tslib "2.7.0"
vite "5.4.4"
watchpack "2.4.2"
webpack "5.94.0"
webpack-dev-middleware "7.4.2"
webpack-dev-server "5.1.0"
webpack-merge "6.0.1"
webpack-subresource-integrity "5.1.0"
optionalDependencies:
esbuild "0.23.1"
"@angular-devkit/[email protected]":
version "0.1900.0-next.5"
resolved "https://registry.yarnpkg.com/@angular-devkit/build-webpack/-/build-webpack-0.1900.0-next.5.tgz#b1a974dc4f54e7f45d915081508e60be746df5c1"
integrity sha512-DMf3rr0Lh/bwhCcRyLvKl9UEnOFd8tkgu9X6sMgFSLRYDIThlUm+jntjQPIGcdN21wQTFgl+O1y/Ck6WYe7Jyw==
dependencies:
"@angular-devkit/architect" "0.1900.0-next.5"
rxjs "7.8.1"
"@angular-devkit/[email protected]":
version "19.0.0-next.5"
resolved "https://registry.yarnpkg.com/@angular-devkit/core/-/core-19.0.0-next.5.tgz#710ae0e618cb04fa2e4c38e83d4ad1542968e3cb"
integrity sha512-WEVlMZPvE7AQPKwfEdH4nuREkIAVwhVhkAD6EAZDYI0U2thLoDcPmNVgFgrrUxdxYE/+VTfXTCBSk6Eu2UkZKQ==
dependencies:
ajv "8.17.1"
ajv-formats "3.0.1"
jsonc-parser "3.3.1"
picomatch "4.0.2"
rxjs "7.8.1"
source-map "0.7.4"
"@angular-devkit/[email protected]":
version "19.0.0-next.5"
resolved "https://registry.yarnpkg.com/@angular-devkit/schematics/-/schematics-19.0.0-next.5.tgz#ade97e2d7218d3365a01c6cfa3c56d9d116b39d8"
integrity sha512-WCJ6uW4JqnSx0nKoPc4himv0srjvOeKHsKEVjVBNW9vuEv70zXpWa7/ggpTdOUt955umqy0NdObTFWmOBBV6jw==
dependencies:
"@angular-devkit/core" "19.0.0-next.5"
jsonc-parser "3.3.1"
magic-string "0.30.11"
ora "5.4.1"
rxjs "7.8.1"
"@angular/animations@file:../../dist/packages-dist/animations":
version "19.0.0-next.1"
dependencies:
tslib "^2.3.0"
| |
002671
|
"@angular/[email protected]":
version "19.0.0-next.5"
resolved "https://registry.yarnpkg.com/@angular/build/-/build-19.0.0-next.5.tgz#93164c08207e1a7f1f3f89383b67378b83acefbd"
integrity sha512-HtNagdxJ9RqZ+TcMmfdh8/ok5KOWLWYGFRYwyyo3NDyqtny2+NsZFevxFM9rk55oEe0fyqMUtnApHh6wH1rUDA==
dependencies:
"@ampproject/remapping" "2.3.0"
"@angular-devkit/architect" "0.1900.0-next.5"
"@babel/core" "7.25.2"
"@babel/helper-annotate-as-pure" "7.24.7"
"@babel/helper-split-export-declaration" "7.24.7"
"@babel/plugin-syntax-import-attributes" "7.25.6"
"@inquirer/confirm" "3.2.0"
"@vitejs/plugin-basic-ssl" "1.1.0"
browserslist "^4.23.0"
critters "0.0.24"
esbuild "0.23.1"
fast-glob "3.3.2"
https-proxy-agent "7.0.5"
listr2 "8.2.4"
lmdb "3.1.0"
magic-string "0.30.11"
mrmime "2.0.0"
parse5-html-rewriting-stream "7.0.0"
picomatch "4.0.2"
piscina "4.6.1"
rollup "4.21.3"
sass "1.78.0"
semver "7.6.3"
vite "5.4.4"
watchpack "2.4.2"
"@angular/build@file:../../node_modules/@angular/build":
version "19.0.0-next.5"
dependencies:
"@ampproject/remapping" "2.3.0"
"@angular-devkit/architect" "0.1900.0-next.5"
"@babel/core" "7.25.2"
"@babel/helper-annotate-as-pure" "7.24.7"
"@babel/helper-split-export-declaration" "7.24.7"
"@babel/plugin-syntax-import-attributes" "7.25.6"
"@inquirer/confirm" "3.2.0"
"@vitejs/plugin-basic-ssl" "1.1.0"
browserslist "^4.23.0"
critters "0.0.24"
esbuild "0.23.1"
fast-glob "3.3.2"
https-proxy-agent "7.0.5"
listr2 "8.2.4"
lmdb "3.1.0"
magic-string "0.30.11"
mrmime "2.0.0"
parse5-html-rewriting-stream "7.0.0"
picomatch "4.0.2"
piscina "4.6.1"
rollup "4.21.3"
sass "1.78.0"
semver "7.6.3"
vite "5.4.4"
watchpack "2.4.2"
"@angular/cli@file:../../node_modules/@angular/cli":
version "19.0.0-next.5"
dependencies:
"@angular-devkit/architect" "0.1900.0-next.5"
"@angular-devkit/core" "19.0.0-next.5"
"@angular-devkit/schematics" "19.0.0-next.5"
"@inquirer/prompts" "5.5.0"
"@listr2/prompt-adapter-inquirer" "2.0.15"
"@schematics/angular" "19.0.0-next.5"
"@yarnpkg/lockfile" "1.1.0"
ini "5.0.0"
jsonc-parser "3.3.1"
listr2 "8.2.4"
npm-package-arg "11.0.3"
npm-pick-manifest "9.1.0"
pacote "18.0.6"
resolve "1.22.8"
semver "7.6.3"
symbol-observable "4.0.0"
yargs "17.7.2"
"@angular/common@file:../../dist/packages-dist/common":
version "19.0.0-next.1"
dependencies:
tslib "^2.3.0"
"@angular/compiler-cli@file:../../dist/packages-dist/compiler-cli":
version "19.0.0-next.1"
dependencies:
"@babel/core" "7.25.2"
"@jridgewell/sourcemap-codec" "^1.4.14"
chokidar "^3.0.0"
convert-source-map "^1.5.1"
reflect-metadata "^0.2.0"
semver "^7.0.0"
tslib "^2.3.0"
yargs "^17.2.1"
"@angular/compiler@file:../../dist/packages-dist/compiler":
version "19.0.0-next.1"
dependencies:
tslib "^2.3.0"
"@angular/core@file:../../dist/packages-dist/core":
version "19.0.0-next.1"
dependencies:
tslib "^2.3.0"
"@angular/forms@file:../../dist/packages-dist/forms":
version "19.0.0-next.1"
dependencies:
tslib "^2.3.0"
"@angular/language-service@file:../../dist/packages-dist/language-service":
version "19.0.0-next.1"
"@angular/platform-browser-dynamic@file:../../dist/packages-dist/platform-browser-dynamic":
version "19.0.0-next.1"
dependencies:
tslib "^2.3.0"
"@angular/platform-browser@file:../../dist/packages-dist/platform-browser":
version "19.0.0-next.1"
dependencies:
tslib "^2.3.0"
"@angular/router@file:../../dist/packages-dist/router":
version "19.0.0-next.1"
dependencies:
tslib "^2.3.0"
"@angular/ssr@file:../../node_modules/@angular/ssr":
version "19.0.0-next.5"
dependencies:
tslib "^2.3.0"
"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.24.7":
version "7.24.7"
resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.24.7.tgz#882fd9e09e8ee324e496bd040401c6f046ef4465"
integrity sha512-BcYH1CVJBO9tvyIZ2jVeXgSIMvGZ2FDRvDdOIVQyuklNKSsx+eppDEBq/g47Ayw+RqNFE+URvOShmf+f/qwAlA==
dependencies:
"@babel/highlight" "^7.24.7"
picocolors "^1.0.0"
"@babel/compat-data@^7.22.6", "@babel/compat-data@^7.25.2", "@babel/compat-data@^7.25.4":
version "7.25.4"
resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.25.4.tgz#7d2a80ce229890edcf4cc259d4d696cb4dae2fcb"
integrity sha512-+LGRog6RAsCJrrrg/IO6LGmpphNe5DiK30dGjCoxxeGv49B10/3XYGxPsAwrDlMFcFEvdAUavDT8r9k/hSyQqQ==
| |
002795
|
"@ampproject/[email protected]", "@ampproject/remapping@^2.2.0":
version "2.3.0"
resolved "https://registry.yarnpkg.com/@ampproject/remapping/-/remapping-2.3.0.tgz#ed441b6fa600072520ce18b43d2c8cc8caecc7f4"
integrity sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==
dependencies:
"@jridgewell/gen-mapping" "^0.3.5"
"@jridgewell/trace-mapping" "^0.3.24"
"@angular-devkit/[email protected]":
version "0.1900.0-next.5"
resolved "https://registry.yarnpkg.com/@angular-devkit/architect/-/architect-0.1900.0-next.5.tgz#4bf510e52fd6542c5b80e677bf8643828586b2de"
integrity sha512-VX9rM05f2pbonjNjwZZv/kY0XVA5I5imwlshPf05wu4MSUsWJLBgugr/MwsYGyLjyT6PPredB6F+QEYvijNIiw==
dependencies:
"@angular-devkit/core" "19.0.0-next.5"
rxjs "7.8.1"
"@angular-devkit/build-angular@file:../../node_modules/@angular-devkit/build-angular":
version "19.0.0-next.5"
dependencies:
"@ampproject/remapping" "2.3.0"
"@angular-devkit/architect" "0.1900.0-next.5"
"@angular-devkit/build-webpack" "0.1900.0-next.5"
"@angular-devkit/core" "19.0.0-next.5"
"@angular/build" "19.0.0-next.5"
"@babel/core" "7.25.2"
"@babel/generator" "7.25.6"
"@babel/helper-annotate-as-pure" "7.24.7"
"@babel/helper-split-export-declaration" "7.24.7"
"@babel/plugin-transform-async-generator-functions" "7.25.4"
"@babel/plugin-transform-async-to-generator" "7.24.7"
"@babel/plugin-transform-runtime" "7.25.4"
"@babel/preset-env" "7.25.4"
"@babel/runtime" "7.25.6"
"@discoveryjs/json-ext" "0.6.1"
"@ngtools/webpack" "19.0.0-next.5"
"@vitejs/plugin-basic-ssl" "1.1.0"
ansi-colors "4.1.3"
autoprefixer "10.4.20"
babel-loader "9.1.3"
browserslist "^4.21.5"
copy-webpack-plugin "12.0.2"
critters "0.0.24"
css-loader "7.1.2"
esbuild-wasm "0.23.1"
fast-glob "3.3.2"
http-proxy-middleware "3.0.2"
https-proxy-agent "7.0.5"
istanbul-lib-instrument "6.0.3"
jsonc-parser "3.3.1"
karma-source-map-support "1.4.0"
less "4.2.0"
less-loader "12.2.0"
license-webpack-plugin "4.0.2"
loader-utils "3.3.1"
magic-string "0.30.11"
mini-css-extract-plugin "2.9.1"
mrmime "2.0.0"
open "10.1.0"
ora "5.4.1"
parse5-html-rewriting-stream "7.0.0"
picomatch "4.0.2"
piscina "4.6.1"
postcss "8.4.45"
postcss-loader "8.1.1"
resolve-url-loader "5.0.0"
rxjs "7.8.1"
sass "1.78.0"
sass-loader "16.0.1"
semver "7.6.3"
source-map-loader "5.0.0"
source-map-support "0.5.21"
terser "5.32.0"
tree-kill "1.2.2"
tslib "2.7.0"
vite "5.4.4"
watchpack "2.4.2"
webpack "5.94.0"
webpack-dev-middleware "7.4.2"
webpack-dev-server "5.1.0"
webpack-merge "6.0.1"
webpack-subresource-integrity "5.1.0"
optionalDependencies:
esbuild "0.23.1"
"@angular-devkit/[email protected]":
version "0.1900.0-next.5"
resolved "https://registry.yarnpkg.com/@angular-devkit/build-webpack/-/build-webpack-0.1900.0-next.5.tgz#b1a974dc4f54e7f45d915081508e60be746df5c1"
integrity sha512-DMf3rr0Lh/bwhCcRyLvKl9UEnOFd8tkgu9X6sMgFSLRYDIThlUm+jntjQPIGcdN21wQTFgl+O1y/Ck6WYe7Jyw==
dependencies:
"@angular-devkit/architect" "0.1900.0-next.5"
rxjs "7.8.1"
"@angular-devkit/[email protected]":
version "19.0.0-next.5"
resolved "https://registry.yarnpkg.com/@angular-devkit/core/-/core-19.0.0-next.5.tgz#710ae0e618cb04fa2e4c38e83d4ad1542968e3cb"
integrity sha512-WEVlMZPvE7AQPKwfEdH4nuREkIAVwhVhkAD6EAZDYI0U2thLoDcPmNVgFgrrUxdxYE/+VTfXTCBSk6Eu2UkZKQ==
dependencies:
ajv "8.17.1"
ajv-formats "3.0.1"
jsonc-parser "3.3.1"
picomatch "4.0.2"
rxjs "7.8.1"
source-map "0.7.4"
"@angular-devkit/[email protected]":
version "19.0.0-next.5"
resolved "https://registry.yarnpkg.com/@angular-devkit/schematics/-/schematics-19.0.0-next.5.tgz#ade97e2d7218d3365a01c6cfa3c56d9d116b39d8"
integrity sha512-WCJ6uW4JqnSx0nKoPc4himv0srjvOeKHsKEVjVBNW9vuEv70zXpWa7/ggpTdOUt955umqy0NdObTFWmOBBV6jw==
dependencies:
"@angular-devkit/core" "19.0.0-next.5"
jsonc-parser "3.3.1"
magic-string "0.30.11"
ora "5.4.1"
rxjs "7.8.1"
"@angular/animations@file:../../dist/packages-dist/animations":
version "19.0.0-next.1"
dependencies:
tslib "^2.3.0"
| |
002895
|
import {mergeApplicationConfig, ApplicationConfig} from '@angular/core';
import {provideServerRendering} from '@angular/platform-server';
import {appConfig} from './app.config';
const serverConfig: ApplicationConfig = {
providers: [provideServerRendering()],
};
export const config = mergeApplicationConfig(appConfig, serverConfig);
| |
002897
|
import {Component} from '@angular/core';
import {CommonModule} from '@angular/common';
import {RouterOutlet} from '@angular/router';
@Component({
selector: 'app-root',
standalone: true,
imports: [CommonModule, RouterOutlet],
template: '<router-outlet></router-outlet>',
})
export class AppComponent {}
| |
002898
|
import {provideHttpClient} from '@angular/common/http';
import {ApplicationConfig} from '@angular/core';
import {provideClientHydration} from '@angular/platform-browser';
import {provideRouter} from '@angular/router';
import {routes} from './app.routes';
export const appConfig: ApplicationConfig = {
providers: [provideRouter(routes), provideClientHydration(), provideHttpClient()],
};
| |
002902
|
/**
* @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
*/
import {isPlatformServer} from '@angular/common';
import {HttpClient} from '@angular/common/http';
import {Component, Inject, PLATFORM_ID, TransferState, makeStateKey} from '@angular/core';
const COUNTER_KEY = makeStateKey<number>('counter');
@Component({
selector: 'transfer-state',
standalone: true,
template: ` <div>{{ counter }}</div> `,
providers: [HttpClient],
})
export class TransferStateComponent {
counter = 0;
constructor(
@Inject(PLATFORM_ID) private platformId: {},
private transferState: TransferState,
) {}
ngOnInit() {
if (isPlatformServer(this.platformId)) {
// Set it to 5 in the server.
this.counter = 5;
this.transferState.set(COUNTER_KEY, 50);
} else {
// Get the transferred counter state in the client(should be 50 and not 0).
this.counter = this.transferState.get(COUNTER_KEY, 0);
}
}
}
| |
002910
|
import {NgModule} from '@angular/core';
import {RouterModule, Routes} from '@angular/router';
import {HelloWorldComponent} from './helloworld/hello-world.component';
import {TransferStateComponent} from './transferstate/transfer-state.component';
const routes: Routes = [
{
path: 'helloworld',
component: HelloWorldComponent,
},
{
path: 'transferstate',
component: TransferStateComponent,
},
{
path: 'http-transferstate-lazy',
loadChildren: () =>
import('./http-transferstate-lazy/http-transfer-state.module').then(
(m) => m.HttpTransferStateModule,
),
},
{
path: 'http-transferstate-lazy-on-init',
loadChildren: () =>
import('./http-transferstate-lazy-on-init/http-transferstate-lazy-on-init.module').then(
(m) => m.HttpTransferStateOnInitModule,
),
},
{
path: 'error',
component: HelloWorldComponent,
resolve: {
'id': () => {
throw new Error('Error in resolver.');
},
},
},
];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule],
})
export class AppRoutingModule {}
| |
002919
|
/**
* @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
*/
import {isPlatformServer} from '@angular/common';
import {Component, Inject, PLATFORM_ID, TransferState, makeStateKey} from '@angular/core';
const COUNTER_KEY = makeStateKey<number>('counter');
@Component({
selector: 'transfer-state',
template: ` <div>{{ counter }}</div> `,
standalone: false,
})
export class TransferStateComponent {
counter = 0;
constructor(
@Inject(PLATFORM_ID) private platformId: {},
private transferState: TransferState,
) {}
ngOnInit() {
if (isPlatformServer(this.platformId)) {
// Set it to 5 in the server.
this.counter = 5;
this.transferState.set(COUNTER_KEY, 50);
} else {
// Get the transferred counter state in the client(should be 50 and not 0).
this.counter = this.transferState.get(COUNTER_KEY, 0);
}
}
}
| |
003025
|
import {bootstrapApplication, provideProtractorTestingSupport} from '@angular/platform-browser';
import {provideRouter} from '@angular/router';
import {AppComponent} from './app/app.component';
import {appRoutes} from './app/app.routes';
bootstrapApplication(AppComponent, {
providers: [provideRouter(appRoutes), provideProtractorTestingSupport()],
}).catch(console.error);
| |
003042
|
"@ampproject/[email protected]", "@ampproject/remapping@^2.2.0":
version "2.3.0"
resolved "https://registry.yarnpkg.com/@ampproject/remapping/-/remapping-2.3.0.tgz#ed441b6fa600072520ce18b43d2c8cc8caecc7f4"
integrity sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==
dependencies:
"@jridgewell/gen-mapping" "^0.3.5"
"@jridgewell/trace-mapping" "^0.3.24"
"@angular-devkit/[email protected]":
version "0.1900.0-next.5"
resolved "https://registry.yarnpkg.com/@angular-devkit/architect/-/architect-0.1900.0-next.5.tgz#4bf510e52fd6542c5b80e677bf8643828586b2de"
integrity sha512-VX9rM05f2pbonjNjwZZv/kY0XVA5I5imwlshPf05wu4MSUsWJLBgugr/MwsYGyLjyT6PPredB6F+QEYvijNIiw==
dependencies:
"@angular-devkit/core" "19.0.0-next.5"
rxjs "7.8.1"
"@angular-devkit/build-angular@file:../../node_modules/@angular-devkit/build-angular":
version "19.0.0-next.5"
dependencies:
"@ampproject/remapping" "2.3.0"
"@angular-devkit/architect" "0.1900.0-next.5"
"@angular-devkit/build-webpack" "0.1900.0-next.5"
"@angular-devkit/core" "19.0.0-next.5"
"@angular/build" "19.0.0-next.5"
"@babel/core" "7.25.2"
"@babel/generator" "7.25.6"
"@babel/helper-annotate-as-pure" "7.24.7"
"@babel/helper-split-export-declaration" "7.24.7"
"@babel/plugin-transform-async-generator-functions" "7.25.4"
"@babel/plugin-transform-async-to-generator" "7.24.7"
"@babel/plugin-transform-runtime" "7.25.4"
"@babel/preset-env" "7.25.4"
"@babel/runtime" "7.25.6"
"@discoveryjs/json-ext" "0.6.1"
"@ngtools/webpack" "19.0.0-next.5"
"@vitejs/plugin-basic-ssl" "1.1.0"
ansi-colors "4.1.3"
autoprefixer "10.4.20"
babel-loader "9.1.3"
browserslist "^4.21.5"
copy-webpack-plugin "12.0.2"
critters "0.0.24"
css-loader "7.1.2"
esbuild-wasm "0.23.1"
fast-glob "3.3.2"
http-proxy-middleware "3.0.2"
https-proxy-agent "7.0.5"
istanbul-lib-instrument "6.0.3"
jsonc-parser "3.3.1"
karma-source-map-support "1.4.0"
less "4.2.0"
less-loader "12.2.0"
license-webpack-plugin "4.0.2"
loader-utils "3.3.1"
magic-string "0.30.11"
mini-css-extract-plugin "2.9.1"
mrmime "2.0.0"
open "10.1.0"
ora "5.4.1"
parse5-html-rewriting-stream "7.0.0"
picomatch "4.0.2"
piscina "4.6.1"
postcss "8.4.45"
postcss-loader "8.1.1"
resolve-url-loader "5.0.0"
rxjs "7.8.1"
sass "1.78.0"
sass-loader "16.0.1"
semver "7.6.3"
source-map-loader "5.0.0"
source-map-support "0.5.21"
terser "5.32.0"
tree-kill "1.2.2"
tslib "2.7.0"
vite "5.4.4"
watchpack "2.4.2"
webpack "5.94.0"
webpack-dev-middleware "7.4.2"
webpack-dev-server "5.1.0"
webpack-merge "6.0.1"
webpack-subresource-integrity "5.1.0"
optionalDependencies:
esbuild "0.23.1"
"@angular-devkit/[email protected]":
version "0.1900.0-next.5"
resolved "https://registry.yarnpkg.com/@angular-devkit/build-webpack/-/build-webpack-0.1900.0-next.5.tgz#b1a974dc4f54e7f45d915081508e60be746df5c1"
integrity sha512-DMf3rr0Lh/bwhCcRyLvKl9UEnOFd8tkgu9X6sMgFSLRYDIThlUm+jntjQPIGcdN21wQTFgl+O1y/Ck6WYe7Jyw==
dependencies:
"@angular-devkit/architect" "0.1900.0-next.5"
rxjs "7.8.1"
"@angular-devkit/[email protected]":
version "19.0.0-next.5"
resolved "https://registry.yarnpkg.com/@angular-devkit/core/-/core-19.0.0-next.5.tgz#710ae0e618cb04fa2e4c38e83d4ad1542968e3cb"
integrity sha512-WEVlMZPvE7AQPKwfEdH4nuREkIAVwhVhkAD6EAZDYI0U2thLoDcPmNVgFgrrUxdxYE/+VTfXTCBSk6Eu2UkZKQ==
dependencies:
ajv "8.17.1"
ajv-formats "3.0.1"
jsonc-parser "3.3.1"
picomatch "4.0.2"
rxjs "7.8.1"
source-map "0.7.4"
"@angular-devkit/[email protected]":
version "19.0.0-next.5"
resolved "https://registry.yarnpkg.com/@angular-devkit/schematics/-/schematics-19.0.0-next.5.tgz#ade97e2d7218d3365a01c6cfa3c56d9d116b39d8"
integrity sha512-WCJ6uW4JqnSx0nKoPc4himv0srjvOeKHsKEVjVBNW9vuEv70zXpWa7/ggpTdOUt955umqy0NdObTFWmOBBV6jw==
dependencies:
"@angular-devkit/core" "19.0.0-next.5"
jsonc-parser "3.3.1"
magic-string "0.30.11"
ora "5.4.1"
rxjs "7.8.1"
"@angular/animations@file:../../dist/packages-dist/animations":
version "19.0.0-next.1"
dependencies:
tslib "^2.3.0"
| |
003137
|
import {bootstrapApplication, provideProtractorTestingSupport} from '@angular/platform-browser';
import {AppComponent} from './app/app.component';
bootstrapApplication(AppComponent, {
providers: [provideProtractorTestingSupport()],
});
| |
003236
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Animations</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
</head>
<body>
<app-root></app-root>
</body>
</html>
| |
003244
|
"@ampproject/[email protected]", "@ampproject/remapping@^2.2.0":
version "2.3.0"
resolved "https://registry.yarnpkg.com/@ampproject/remapping/-/remapping-2.3.0.tgz#ed441b6fa600072520ce18b43d2c8cc8caecc7f4"
integrity sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==
dependencies:
"@jridgewell/gen-mapping" "^0.3.5"
"@jridgewell/trace-mapping" "^0.3.24"
"@angular-devkit/[email protected]":
version "0.1900.0-next.5"
resolved "https://registry.yarnpkg.com/@angular-devkit/architect/-/architect-0.1900.0-next.5.tgz#4bf510e52fd6542c5b80e677bf8643828586b2de"
integrity sha512-VX9rM05f2pbonjNjwZZv/kY0XVA5I5imwlshPf05wu4MSUsWJLBgugr/MwsYGyLjyT6PPredB6F+QEYvijNIiw==
dependencies:
"@angular-devkit/core" "19.0.0-next.5"
rxjs "7.8.1"
"@angular-devkit/build-angular@file:../../node_modules/@angular-devkit/build-angular":
version "19.0.0-next.5"
dependencies:
"@ampproject/remapping" "2.3.0"
"@angular-devkit/architect" "0.1900.0-next.5"
"@angular-devkit/build-webpack" "0.1900.0-next.5"
"@angular-devkit/core" "19.0.0-next.5"
"@angular/build" "19.0.0-next.5"
"@babel/core" "7.25.2"
"@babel/generator" "7.25.6"
"@babel/helper-annotate-as-pure" "7.24.7"
"@babel/helper-split-export-declaration" "7.24.7"
"@babel/plugin-transform-async-generator-functions" "7.25.4"
"@babel/plugin-transform-async-to-generator" "7.24.7"
"@babel/plugin-transform-runtime" "7.25.4"
"@babel/preset-env" "7.25.4"
"@babel/runtime" "7.25.6"
"@discoveryjs/json-ext" "0.6.1"
"@ngtools/webpack" "19.0.0-next.5"
"@vitejs/plugin-basic-ssl" "1.1.0"
ansi-colors "4.1.3"
autoprefixer "10.4.20"
babel-loader "9.1.3"
browserslist "^4.21.5"
copy-webpack-plugin "12.0.2"
critters "0.0.24"
css-loader "7.1.2"
esbuild-wasm "0.23.1"
fast-glob "3.3.2"
http-proxy-middleware "3.0.2"
https-proxy-agent "7.0.5"
istanbul-lib-instrument "6.0.3"
jsonc-parser "3.3.1"
karma-source-map-support "1.4.0"
less "4.2.0"
less-loader "12.2.0"
license-webpack-plugin "4.0.2"
loader-utils "3.3.1"
magic-string "0.30.11"
mini-css-extract-plugin "2.9.1"
mrmime "2.0.0"
open "10.1.0"
ora "5.4.1"
parse5-html-rewriting-stream "7.0.0"
picomatch "4.0.2"
piscina "4.6.1"
postcss "8.4.45"
postcss-loader "8.1.1"
resolve-url-loader "5.0.0"
rxjs "7.8.1"
sass "1.78.0"
sass-loader "16.0.1"
semver "7.6.3"
source-map-loader "5.0.0"
source-map-support "0.5.21"
terser "5.32.0"
tree-kill "1.2.2"
tslib "2.7.0"
vite "5.4.4"
watchpack "2.4.2"
webpack "5.94.0"
webpack-dev-middleware "7.4.2"
webpack-dev-server "5.1.0"
webpack-merge "6.0.1"
webpack-subresource-integrity "5.1.0"
optionalDependencies:
esbuild "0.23.1"
"@angular-devkit/[email protected]":
version "0.1900.0-next.5"
resolved "https://registry.yarnpkg.com/@angular-devkit/build-webpack/-/build-webpack-0.1900.0-next.5.tgz#b1a974dc4f54e7f45d915081508e60be746df5c1"
integrity sha512-DMf3rr0Lh/bwhCcRyLvKl9UEnOFd8tkgu9X6sMgFSLRYDIThlUm+jntjQPIGcdN21wQTFgl+O1y/Ck6WYe7Jyw==
dependencies:
"@angular-devkit/architect" "0.1900.0-next.5"
rxjs "7.8.1"
"@angular-devkit/[email protected]":
version "19.0.0-next.5"
resolved "https://registry.yarnpkg.com/@angular-devkit/core/-/core-19.0.0-next.5.tgz#710ae0e618cb04fa2e4c38e83d4ad1542968e3cb"
integrity sha512-WEVlMZPvE7AQPKwfEdH4nuREkIAVwhVhkAD6EAZDYI0U2thLoDcPmNVgFgrrUxdxYE/+VTfXTCBSk6Eu2UkZKQ==
dependencies:
ajv "8.17.1"
ajv-formats "3.0.1"
jsonc-parser "3.3.1"
picomatch "4.0.2"
rxjs "7.8.1"
source-map "0.7.4"
"@angular-devkit/[email protected]":
version "19.0.0-next.5"
resolved "https://registry.yarnpkg.com/@angular-devkit/schematics/-/schematics-19.0.0-next.5.tgz#ade97e2d7218d3365a01c6cfa3c56d9d116b39d8"
integrity sha512-WCJ6uW4JqnSx0nKoPc4himv0srjvOeKHsKEVjVBNW9vuEv70zXpWa7/ggpTdOUt955umqy0NdObTFWmOBBV6jw==
dependencies:
"@angular-devkit/core" "19.0.0-next.5"
jsonc-parser "3.3.1"
magic-string "0.30.11"
ora "5.4.1"
rxjs "7.8.1"
"@angular/animations@file:../../dist/packages-dist/animations":
version "19.0.0-next.1"
dependencies:
tslib "^2.3.0"
| |
003445
|
"@ampproject/[email protected]", "@ampproject/remapping@^2.2.0":
version "2.3.0"
resolved "https://registry.yarnpkg.com/@ampproject/remapping/-/remapping-2.3.0.tgz#ed441b6fa600072520ce18b43d2c8cc8caecc7f4"
integrity sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==
dependencies:
"@jridgewell/gen-mapping" "^0.3.5"
"@jridgewell/trace-mapping" "^0.3.24"
"@angular-devkit/[email protected]":
version "0.1900.0-next.5"
resolved "https://registry.yarnpkg.com/@angular-devkit/architect/-/architect-0.1900.0-next.5.tgz#4bf510e52fd6542c5b80e677bf8643828586b2de"
integrity sha512-VX9rM05f2pbonjNjwZZv/kY0XVA5I5imwlshPf05wu4MSUsWJLBgugr/MwsYGyLjyT6PPredB6F+QEYvijNIiw==
dependencies:
"@angular-devkit/core" "19.0.0-next.5"
rxjs "7.8.1"
"@angular-devkit/build-angular@file:../../node_modules/@angular-devkit/build-angular":
version "19.0.0-next.5"
dependencies:
"@ampproject/remapping" "2.3.0"
"@angular-devkit/architect" "0.1900.0-next.5"
"@angular-devkit/build-webpack" "0.1900.0-next.5"
"@angular-devkit/core" "19.0.0-next.5"
"@angular/build" "19.0.0-next.5"
"@babel/core" "7.25.2"
"@babel/generator" "7.25.6"
"@babel/helper-annotate-as-pure" "7.24.7"
"@babel/helper-split-export-declaration" "7.24.7"
"@babel/plugin-transform-async-generator-functions" "7.25.4"
"@babel/plugin-transform-async-to-generator" "7.24.7"
"@babel/plugin-transform-runtime" "7.25.4"
"@babel/preset-env" "7.25.4"
"@babel/runtime" "7.25.6"
"@discoveryjs/json-ext" "0.6.1"
"@ngtools/webpack" "19.0.0-next.5"
"@vitejs/plugin-basic-ssl" "1.1.0"
ansi-colors "4.1.3"
autoprefixer "10.4.20"
babel-loader "9.1.3"
browserslist "^4.21.5"
copy-webpack-plugin "12.0.2"
critters "0.0.24"
css-loader "7.1.2"
esbuild-wasm "0.23.1"
fast-glob "3.3.2"
http-proxy-middleware "3.0.2"
https-proxy-agent "7.0.5"
istanbul-lib-instrument "6.0.3"
jsonc-parser "3.3.1"
karma-source-map-support "1.4.0"
less "4.2.0"
less-loader "12.2.0"
license-webpack-plugin "4.0.2"
loader-utils "3.3.1"
magic-string "0.30.11"
mini-css-extract-plugin "2.9.1"
mrmime "2.0.0"
open "10.1.0"
ora "5.4.1"
parse5-html-rewriting-stream "7.0.0"
picomatch "4.0.2"
piscina "4.6.1"
postcss "8.4.45"
postcss-loader "8.1.1"
resolve-url-loader "5.0.0"
rxjs "7.8.1"
sass "1.78.0"
sass-loader "16.0.1"
semver "7.6.3"
source-map-loader "5.0.0"
source-map-support "0.5.21"
terser "5.32.0"
tree-kill "1.2.2"
tslib "2.7.0"
vite "5.4.4"
watchpack "2.4.2"
webpack "5.94.0"
webpack-dev-middleware "7.4.2"
webpack-dev-server "5.1.0"
webpack-merge "6.0.1"
webpack-subresource-integrity "5.1.0"
optionalDependencies:
esbuild "0.23.1"
"@angular-devkit/[email protected]":
version "0.1900.0-next.5"
resolved "https://registry.yarnpkg.com/@angular-devkit/build-webpack/-/build-webpack-0.1900.0-next.5.tgz#b1a974dc4f54e7f45d915081508e60be746df5c1"
integrity sha512-DMf3rr0Lh/bwhCcRyLvKl9UEnOFd8tkgu9X6sMgFSLRYDIThlUm+jntjQPIGcdN21wQTFgl+O1y/Ck6WYe7Jyw==
dependencies:
"@angular-devkit/architect" "0.1900.0-next.5"
rxjs "7.8.1"
"@angular-devkit/[email protected]":
version "19.0.0-next.5"
resolved "https://registry.yarnpkg.com/@angular-devkit/core/-/core-19.0.0-next.5.tgz#710ae0e618cb04fa2e4c38e83d4ad1542968e3cb"
integrity sha512-WEVlMZPvE7AQPKwfEdH4nuREkIAVwhVhkAD6EAZDYI0U2thLoDcPmNVgFgrrUxdxYE/+VTfXTCBSk6Eu2UkZKQ==
dependencies:
ajv "8.17.1"
ajv-formats "3.0.1"
jsonc-parser "3.3.1"
picomatch "4.0.2"
rxjs "7.8.1"
source-map "0.7.4"
"@angular-devkit/[email protected]":
version "19.0.0-next.5"
resolved "https://registry.yarnpkg.com/@angular-devkit/schematics/-/schematics-19.0.0-next.5.tgz#ade97e2d7218d3365a01c6cfa3c56d9d116b39d8"
integrity sha512-WCJ6uW4JqnSx0nKoPc4himv0srjvOeKHsKEVjVBNW9vuEv70zXpWa7/ggpTdOUt955umqy0NdObTFWmOBBV6jw==
dependencies:
"@angular-devkit/core" "19.0.0-next.5"
jsonc-parser "3.3.1"
magic-string "0.30.11"
ora "5.4.1"
rxjs "7.8.1"
"@angular/animations@file:../../dist/packages-dist/animations":
version "19.0.0-next.1"
dependencies:
tslib "^2.3.0"
| |
003564
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<app-root></app-root>
<script src="/node_modules/zone.js/bundles/zone.umd.js"></script>
<script type="module" src="/dist/main.bundle.js"></script>
</body>
</html>
| |
003602
|
import {AfterViewInit, Compiler, Component, ViewChild, ViewContainerRef} from '@angular/core';
@Component({
selector: 'app-root',
template: `
<h1>Hello world!</h1>
<div #vc></div>
`,
standalone: false,
})
export class AppComponent implements AfterViewInit {
@ViewChild('vc', {read: ViewContainerRef}) container: ViewContainerRef;
constructor(private compiler: Compiler) {}
ngAfterViewInit() {
import('./lazy.module').then((module) => {
this.compiler.compileModuleAndAllComponentsAsync(module.LazyModule).then((compiled) => {
const factory = compiled.componentFactories[0];
this.container.createComponent(factory);
});
});
}
}
| |
003640
|
"@ampproject/[email protected]", "@ampproject/remapping@^2.2.0":
version "2.3.0"
resolved "https://registry.yarnpkg.com/@ampproject/remapping/-/remapping-2.3.0.tgz#ed441b6fa600072520ce18b43d2c8cc8caecc7f4"
integrity sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==
dependencies:
"@jridgewell/gen-mapping" "^0.3.5"
"@jridgewell/trace-mapping" "^0.3.24"
"@angular-devkit/[email protected]":
version "0.1900.0-next.5"
resolved "https://registry.yarnpkg.com/@angular-devkit/architect/-/architect-0.1900.0-next.5.tgz#4bf510e52fd6542c5b80e677bf8643828586b2de"
integrity sha512-VX9rM05f2pbonjNjwZZv/kY0XVA5I5imwlshPf05wu4MSUsWJLBgugr/MwsYGyLjyT6PPredB6F+QEYvijNIiw==
dependencies:
"@angular-devkit/core" "19.0.0-next.5"
rxjs "7.8.1"
"@angular-devkit/build-angular@file:../../node_modules/@angular-devkit/build-angular":
version "19.0.0-next.5"
dependencies:
"@ampproject/remapping" "2.3.0"
"@angular-devkit/architect" "0.1900.0-next.5"
"@angular-devkit/build-webpack" "0.1900.0-next.5"
"@angular-devkit/core" "19.0.0-next.5"
"@angular/build" "19.0.0-next.5"
"@babel/core" "7.25.2"
"@babel/generator" "7.25.6"
"@babel/helper-annotate-as-pure" "7.24.7"
"@babel/helper-split-export-declaration" "7.24.7"
"@babel/plugin-transform-async-generator-functions" "7.25.4"
"@babel/plugin-transform-async-to-generator" "7.24.7"
"@babel/plugin-transform-runtime" "7.25.4"
"@babel/preset-env" "7.25.4"
"@babel/runtime" "7.25.6"
"@discoveryjs/json-ext" "0.6.1"
"@ngtools/webpack" "19.0.0-next.5"
"@vitejs/plugin-basic-ssl" "1.1.0"
ansi-colors "4.1.3"
autoprefixer "10.4.20"
babel-loader "9.1.3"
browserslist "^4.21.5"
copy-webpack-plugin "12.0.2"
critters "0.0.24"
css-loader "7.1.2"
esbuild-wasm "0.23.1"
fast-glob "3.3.2"
http-proxy-middleware "3.0.2"
https-proxy-agent "7.0.5"
istanbul-lib-instrument "6.0.3"
jsonc-parser "3.3.1"
karma-source-map-support "1.4.0"
less "4.2.0"
less-loader "12.2.0"
license-webpack-plugin "4.0.2"
loader-utils "3.3.1"
magic-string "0.30.11"
mini-css-extract-plugin "2.9.1"
mrmime "2.0.0"
open "10.1.0"
ora "5.4.1"
parse5-html-rewriting-stream "7.0.0"
picomatch "4.0.2"
piscina "4.6.1"
postcss "8.4.45"
postcss-loader "8.1.1"
resolve-url-loader "5.0.0"
rxjs "7.8.1"
sass "1.78.0"
sass-loader "16.0.1"
semver "7.6.3"
source-map-loader "5.0.0"
source-map-support "0.5.21"
terser "5.32.0"
tree-kill "1.2.2"
tslib "2.7.0"
vite "5.4.4"
watchpack "2.4.2"
webpack "5.94.0"
webpack-dev-middleware "7.4.2"
webpack-dev-server "5.1.0"
webpack-merge "6.0.1"
webpack-subresource-integrity "5.1.0"
optionalDependencies:
esbuild "0.23.1"
"@angular-devkit/[email protected]":
version "0.1900.0-next.5"
resolved "https://registry.yarnpkg.com/@angular-devkit/build-webpack/-/build-webpack-0.1900.0-next.5.tgz#b1a974dc4f54e7f45d915081508e60be746df5c1"
integrity sha512-DMf3rr0Lh/bwhCcRyLvKl9UEnOFd8tkgu9X6sMgFSLRYDIThlUm+jntjQPIGcdN21wQTFgl+O1y/Ck6WYe7Jyw==
dependencies:
"@angular-devkit/architect" "0.1900.0-next.5"
rxjs "7.8.1"
"@angular-devkit/[email protected]":
version "19.0.0-next.5"
resolved "https://registry.yarnpkg.com/@angular-devkit/core/-/core-19.0.0-next.5.tgz#710ae0e618cb04fa2e4c38e83d4ad1542968e3cb"
integrity sha512-WEVlMZPvE7AQPKwfEdH4nuREkIAVwhVhkAD6EAZDYI0U2thLoDcPmNVgFgrrUxdxYE/+VTfXTCBSk6Eu2UkZKQ==
dependencies:
ajv "8.17.1"
ajv-formats "3.0.1"
jsonc-parser "3.3.1"
picomatch "4.0.2"
rxjs "7.8.1"
source-map "0.7.4"
"@angular-devkit/[email protected]":
version "19.0.0-next.5"
resolved "https://registry.yarnpkg.com/@angular-devkit/schematics/-/schematics-19.0.0-next.5.tgz#ade97e2d7218d3365a01c6cfa3c56d9d116b39d8"
integrity sha512-WCJ6uW4JqnSx0nKoPc4himv0srjvOeKHsKEVjVBNW9vuEv70zXpWa7/ggpTdOUt955umqy0NdObTFWmOBBV6jw==
dependencies:
"@angular-devkit/core" "19.0.0-next.5"
jsonc-parser "3.3.1"
magic-string "0.30.11"
ora "5.4.1"
rxjs "7.8.1"
"@angular/animations@file:../../dist/packages-dist/animations":
version "19.0.0-next.1"
dependencies:
tslib "^2.3.0"
| |
003813
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Animations</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
</head>
<body>
<app-root></app-root>
</body>
</html>
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.