ci: add golden-api file for core/node

This is necessary as we introduce namespaces in jobs.
This commit is contained in:
Hans 2018-12-13 15:00:38 -08:00 committed by Minko Gechev
parent 2b3f9de403
commit 6bf80edf54
5 changed files with 47 additions and 36 deletions

View File

@ -1,9 +1,8 @@
export declare function createConsoleLogger(verbose?: boolean, stdout?: ProcessOutput, stderr?: ProcessOutput): logging.Logger;
export declare namespace fs {
function isFile(filePath: string): boolean;
function isDirectory(filePath: string): boolean;
}
export declare function isDirectory(filePath: string): boolean;
export declare function isFile(filePath: string): boolean;
export declare class ModuleNotFoundException extends BaseException {
readonly basePath: string;

View File

@ -0,0 +1,11 @@
/**
* @license
* Copyright Google Inc. 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.io/license
*/
export * from './fs';
export * from './cli-logger';
export * from './host';
export { ModuleNotFoundException, ResolveOptions, resolve } from './resolve';

View File

@ -7,34 +7,31 @@
*/
import { statSync } from 'fs';
export namespace fs {
export function isFile(filePath: string): boolean {
let stat;
try {
stat = statSync(filePath);
} catch (e) {
if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) {
return false;
}
throw e;
export function isFile(filePath: string): boolean {
let stat;
try {
stat = statSync(filePath);
} catch (e) {
if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) {
return false;
}
return stat.isFile() || stat.isFIFO();
}
export function isDirectory(filePath: string): boolean {
let stat;
try {
stat = statSync(filePath);
} catch (e) {
if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) {
return false;
}
throw e;
}
return stat.isDirectory();
throw e;
}
return stat.isFile() || stat.isFIFO();
}
export function isDirectory(filePath: string): boolean {
let stat;
try {
stat = statSync(filePath);
} catch (e) {
if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) {
return false;
}
throw e;
}
return stat.isDirectory();
}

View File

@ -5,7 +5,11 @@
* 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
*/
export * from './fs';
import * as fs from './fs';
export * from './cli-logger';
export * from './host';
export { ModuleNotFoundException, ResolveOptions, resolve } from './resolve';
export {
fs,
};

View File

@ -8,7 +8,7 @@
import * as fs from 'fs';
import * as path from 'path';
import { BaseException } from '../src';
import { fs as devkitFs } from './fs';
import { isFile } from './fs';
/**
* Exception thrown when a module could not be resolved.
@ -204,16 +204,16 @@ export function resolve(x: string, options: ResolveOptions): string {
throw new ModuleNotFoundException(x, basePath);
function loadAsFileSync(x: string): string | null {
if (devkitFs.isFile(x)) {
if (isFile(x)) {
return x;
}
return extensions.map(ex => x + ex).find(f => devkitFs.isFile(f)) || null;
return extensions.map(ex => x + ex).find(f => isFile(f)) || null;
}
function loadAsDirectorySync(x: string): string | null {
const pkgfile = path.join(x, 'package.json');
if (devkitFs.isFile(pkgfile)) {
if (isFile(pkgfile)) {
if (options.resolvePackageJson) {
return pkgfile;
}