File tree Expand file tree Collapse file tree 19 files changed +25
-31
lines changed
build_angular/src/builders/dev-server/tests
cli/src/command-builder/utilities Expand file tree Collapse file tree 19 files changed +25
-31
lines changed Original file line number Diff line number Diff line change @@ -105,8 +105,7 @@ DDIy4xXPW1STWfsmSYJfYW3wa0wk+pJQ3j2cTzkPQQ8gwpvM3U9DJl43uwb37v6I
105105
106106async function goToPageAndWaitForWS ( page : Page , url : string ) : Promise < void > {
107107 const baseUrl = url . replace ( / ^ h t t p / , 'ws' ) ;
108- const socksRequest =
109- baseUrl [ baseUrl . length - 1 ] === '/' ? `${ baseUrl } ng-cli-ws` : `${ baseUrl } /ng-cli-ws` ;
108+ const socksRequest = baseUrl . at ( - 1 ) === '/' ? `${ baseUrl } ng-cli-ws` : `${ baseUrl } /ng-cli-ws` ;
110109 // Create a Chrome dev tools session so that we can capturing websocket request.
111110 // https://github.com/puppeteer/puppeteer/issues/2974
112111
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ export async function executeOnceAndFetch<T>(
2828 let content = undefined ;
2929 if ( executionResult . result ?. success ) {
3030 let baseUrl = `${ executionResult . result . baseUrl } ` ;
31- baseUrl = baseUrl [ baseUrl . length - 1 ] === '/' ? baseUrl : `${ baseUrl } /` ;
31+ baseUrl = baseUrl . at ( - 1 ) === '/' ? baseUrl : `${ baseUrl } /` ;
3232 const resolvedUrl = new URL ( url , baseUrl ) ;
3333 const originalResponse = await fetch ( resolvedUrl , options ?. request ) ;
3434 response = originalResponse . clone ( ) ;
@@ -68,7 +68,7 @@ export async function executeOnceAndGet<T>(
6868 let content = undefined ;
6969 if ( executionResult . result ?. success ) {
7070 let baseUrl = `${ executionResult . result . baseUrl } ` ;
71- baseUrl = baseUrl [ baseUrl . length - 1 ] === '/' ? baseUrl : `${ baseUrl } /` ;
71+ baseUrl = baseUrl . at ( - 1 ) === '/' ? baseUrl : `${ baseUrl } /` ;
7272 const resolvedUrl = new URL ( url , baseUrl ) ;
7373
7474 response = await new Promise < IncomingMessage > ( ( resolve ) =>
Original file line number Diff line number Diff line change @@ -243,9 +243,7 @@ export async function* serveWithVite(
243243 const baseHref = result . detail [ 'htmlBaseHref' ] as string ;
244244 // Remove trailing slash
245245 serverOptions . servePath =
246- baseHref !== './' && baseHref [ baseHref . length - 1 ] === '/'
247- ? baseHref . slice ( 0 , - 1 )
248- : baseHref ;
246+ baseHref !== './' && baseHref . at ( - 1 ) === '/' ? baseHref . slice ( 0 , - 1 ) : baseHref ;
249247 }
250248
251249 assetFiles . clear ( ) ;
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ export function createAngularAssetsMiddleware(
4040 // The base of the URL is unused but required to parse the URL.
4141 const pathname = pathnameWithoutBasePath ( req . url , server . config . base ) ;
4242 const extension = extname ( pathname ) ;
43- const pathnameHasTrailingSlash = pathname [ pathname . length - 1 ] === '/' ;
43+ const pathnameHasTrailingSlash = pathname . at ( - 1 ) === '/' ;
4444
4545 // Rewrite all build assets to a vite raw fs URL
4646 const asset = assets . get ( pathname ) ;
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ import { join } from 'node:path';
1515 * @returns A normalized path string.
1616 */
1717export function normalizeDirectoryPath ( path : string ) : string {
18- const last = path [ path . length - 1 ] ;
18+ const last = path . at ( - 1 ) ;
1919 if ( last === '/' || last === '\\' ) {
2020 return path . slice ( 0 , - 1 ) ;
2121 }
Original file line number Diff line number Diff line change @@ -77,7 +77,7 @@ export function generateAngularServerAppEngineManifest(
7777
7878 // Remove trailing slash but retain leading slash.
7979 let basePath = baseHref || '/' ;
80- if ( basePath . length > 1 && basePath [ basePath . length - 1 ] === '/' ) {
80+ if ( basePath . length > 1 && basePath . at ( - 1 ) === '/' ) {
8181 basePath = basePath . slice ( 0 , - 1 ) ;
8282 }
8383
Original file line number Diff line number Diff line change 2222 */
2323export function stripTrailingSlash ( url : string ) : string {
2424 // Check if the last character of the URL is a slash
25- return url . length > 1 && url [ url . length - 1 ] === '/' ? url . slice ( 0 , - 1 ) : url ;
25+ return url . length > 1 && url . at ( - 1 ) === '/' ? url . slice ( 0 , - 1 ) : url ;
2626}
2727
2828/**
@@ -75,7 +75,7 @@ export function addLeadingSlash(url: string): string {
7575 */
7676export function addTrailingSlash ( url : string ) : string {
7777 // Check if the URL already end with a slash
78- return url [ url . length - 1 ] === '/' ? url : `${ url } /` ;
78+ return url . at ( - 1 ) === '/' ? url : `${ url } /` ;
7979}
8080
8181/**
@@ -107,7 +107,7 @@ export function joinUrlParts(...parts: string[]): string {
107107 if ( part [ 0 ] === '/' ) {
108108 normalizedPart = normalizedPart . slice ( 1 ) ;
109109 }
110- if ( part [ part . length - 1 ] === '/' ) {
110+ if ( part . at ( - 1 ) === '/' ) {
111111 normalizedPart = normalizedPart . slice ( 0 , - 1 ) ;
112112 }
113113 if ( normalizedPart !== '' ) {
Original file line number Diff line number Diff line change @@ -334,7 +334,7 @@ export async function parseJsonSchemaToOptions(
334334 // Skip any non-property items.
335335 return ;
336336 }
337- const name = ptr [ ptr . length - 1 ] ;
337+ const name = ptr . at ( - 1 ) as string ;
338338
339339 const types = getSupportedTypes ( current ) ;
340340
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ ts_project(
2020 ),
2121 args = [
2222 "--lib" ,
23- "dom,es2020 " ,
23+ "dom,es2022 " ,
2424 ],
2525 data = [
2626 "//packages/angular/ssr/third_party/beasties:beasties_bundled" ,
Original file line number Diff line number Diff line change 2222 */
2323export function stripTrailingSlash ( url : string ) : string {
2424 // Check if the last character of the URL is a slash
25- return url . length > 1 && url [ url . length - 1 ] === '/' ? url . slice ( 0 , - 1 ) : url ;
25+ return url . length > 1 && url . at ( - 1 ) === '/' ? url . slice ( 0 , - 1 ) : url ;
2626}
2727
2828/**
@@ -75,7 +75,7 @@ export function addLeadingSlash(url: string): string {
7575 */
7676export function addTrailingSlash ( url : string ) : string {
7777 // Check if the URL already end with a slash
78- return url [ url . length - 1 ] === '/' ? url : `${ url } /` ;
78+ return url . at ( - 1 ) === '/' ? url : `${ url } /` ;
7979}
8080
8181/**
@@ -106,7 +106,7 @@ export function joinUrlParts(...parts: string[]): string {
106106 if ( part [ 0 ] === '/' ) {
107107 normalizedPart = normalizedPart . slice ( 1 ) ;
108108 }
109- if ( part [ part . length - 1 ] === '/' ) {
109+ if ( part . at ( - 1 ) === '/' ) {
110110 normalizedPart = normalizedPart . slice ( 0 , - 1 ) ;
111111 }
112112 if ( normalizedPart !== '' ) {
You can’t perform that action at this time.
0 commit comments