6
6
* found in the LICENSE file at https://angular.io/license
7
7
*/
8
8
9
- import { dirname , join , normalize } from '@angular-devkit/core' ;
10
9
import {
11
10
Rule ,
12
11
SchematicsException ,
@@ -15,6 +14,7 @@ import {
15
14
noop ,
16
15
schematic ,
17
16
} from '@angular-devkit/schematics' ;
17
+ import { dirname , join } from 'node:path/posix' ;
18
18
import ts from '../third_party/github.com/Microsoft/TypeScript/lib/typescript' ;
19
19
import {
20
20
addImportToModule ,
@@ -43,14 +43,14 @@ function getSourceFile(host: Tree, path: string): ts.SourceFile {
43
43
}
44
44
45
45
function getServerModulePath ( host : Tree , sourceRoot : string , mainPath : string ) : string | null {
46
- const mainSource = getSourceFile ( host , join ( normalize ( sourceRoot ) , mainPath ) ) ;
46
+ const mainSource = getSourceFile ( host , join ( sourceRoot , mainPath ) ) ;
47
47
const allNodes = getSourceNodes ( mainSource ) ;
48
48
const expNode = allNodes . find ( ( node ) => ts . isExportDeclaration ( node ) ) ;
49
49
if ( ! expNode ) {
50
50
return null ;
51
51
}
52
52
const relativePath = ( expNode as ts . ExportDeclaration ) . moduleSpecifier as ts . StringLiteral ;
53
- const modulePath = normalize ( `/ ${ sourceRoot } / ${ relativePath . text } .ts`) ;
53
+ const modulePath = join ( sourceRoot , ` ${ relativePath . text } .ts`) ;
54
54
55
55
return modulePath ;
56
56
}
@@ -77,7 +77,7 @@ function getComponentTemplate(host: Tree, compPath: string, tmplInfo: TemplateIn
77
77
template = tmplInfo . templateProp . getFullText ( ) ;
78
78
} else if ( tmplInfo . templateUrlProp ) {
79
79
const templateUrl = ( tmplInfo . templateUrlProp . initializer as ts . StringLiteral ) . text ;
80
- const dir = dirname ( normalize ( compPath ) ) ;
80
+ const dir = dirname ( compPath ) ;
81
81
const templatePath = join ( dir , templateUrl ) ;
82
82
try {
83
83
template = host . readText ( templatePath ) ;
@@ -121,7 +121,7 @@ function getBootstrapComponentPath(host: Tree, mainPath: string): string {
121
121
return pathStringLiteral . text ;
122
122
} ) [ 0 ] ;
123
123
124
- return join ( dirname ( normalize ( bootstrappingFilePath ) ) , componentRelativeFilePath + '.ts' ) ;
124
+ return join ( dirname ( bootstrappingFilePath ) , componentRelativeFilePath + '.ts' ) ;
125
125
}
126
126
// end helper functions.
127
127
@@ -308,7 +308,7 @@ function addStandaloneServerRoute(options: AppShellOptions): Rule {
308
308
throw new SchematicsException ( `Project name "${ options . project } " doesn't not exist.` ) ;
309
309
}
310
310
311
- const configFilePath = join ( normalize ( project . sourceRoot ?? 'src' ) , 'app/app.config.server.ts' ) ;
311
+ const configFilePath = join ( project . sourceRoot ?? 'src' , 'app/app.config.server.ts' ) ;
312
312
if ( ! host . exists ( configFilePath ) ) {
313
313
throw new SchematicsException ( `Cannot find "${ configFilePath } ".` ) ;
314
314
}
0 commit comments