refactor(ivy): use `canonical-path` in ngcc (#25862)

It turns out that `path.posix` does not always reliably
return forward slash paths on Windows.

PR Close #25862
This commit is contained in:
Pete Bacon Darwin 2018-09-03 09:21:51 +01:00 committed by Ben Lesh
parent b99d7ed5bf
commit 6f1100a7e9
7 changed files with 2582 additions and 5 deletions

2562
integration/ngcc/yarn.lock Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,14 @@
declare module 'canonical-path' {
export function normalize(p: string): string;
export function join(...paths: any[]): string;
export function resolve(...pathSegments: any[]): string;
export function isAbsolute(p: string): boolean;
export function relative(from: string, to: string): string;
export function dirname(p: string): string;
export function basename(p: string, ext?: string): string;
export function extname(p: string): string;
export var sep: string;
export var delimiter: string;
export function parse(p: string): ParsedPath;
export function format(pP: ParsedPath): string;
}

View File

@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/
import {relative, resolve} from 'path';
import {relative, resolve} from 'canonical-path';
/**
* Map source files to their associated typings definitions files.

View File

@ -5,8 +5,8 @@
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import * as path from 'canonical-path';
import {existsSync, lstatSync, readFileSync, readdirSync} from 'fs';
import {posix as path} from 'path';
import {PackageTransformer} from './transform/package_transformer';

View File

@ -9,7 +9,7 @@ import {ConstantPool, Expression, Statement, WrappedNodeExpr, WritePropExpr} fro
import {SourceMapConverter, commentRegex, fromJSON, fromMapFileSource, fromObject, fromSource, generateMapFileComment, mapFileCommentRegex, removeComments, removeMapFileComments} from 'convert-source-map';
import {readFileSync, statSync} from 'fs';
import MagicString from 'magic-string';
import {basename, dirname} from 'path';
import {basename, dirname} from 'canonical-path';
import {SourceMapConsumer, SourceMapGenerator, RawSourceMap} from 'source-map';
import * as ts from 'typescript';

View File

@ -5,8 +5,8 @@
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {dirname, relative, resolve} from 'canonical-path';
import {existsSync, readFileSync, writeFileSync} from 'fs';
import {dirname, relative, resolve} from 'path';
import {mkdir, mv} from 'shelljs';
import * as ts from 'typescript';
@ -27,6 +27,7 @@ import {FileInfo, Renderer} from '../rendering/renderer';
import {checkMarkerFile, findAllPackageJsonFiles, getEntryPoints, writeMarkerFile} from './utils';
/**
* A Package is stored in a directory on disk and that directory can contain one or more package
* formats - e.g. fesm2015, UMD, etc. Additionally, each package provides typings (`.d.ts` files).

View File

@ -6,8 +6,8 @@
* found in the LICENSE file at https://angular.io/license
*/
import {dirname, resolve} from 'canonical-path';
import {existsSync, readFileSync, writeFileSync} from 'fs';
import {dirname, resolve} from 'path';
import {find} from 'shelljs';
import {isDefined} from '../utils';