mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-11 12:30:18 +00:00
feat: upgrade to v3.0.0
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import resolve = require('enhanced-resolve');
|
||||
import { ResolveResult } from 'enhanced-resolve/lib/common-types'
|
||||
import { ResolveResult, AbstractInputFileSystem } from 'enhanced-resolve/lib/common-types'
|
||||
import Resolver = require('enhanced-resolve/lib/Resolver')
|
||||
|
||||
resolve('lib', 'string', function (err) { });
|
||||
@@ -13,15 +13,12 @@ resolve(context, 'path', 'string', function () { });
|
||||
let resolver: Resolver
|
||||
resolver = resolve.ResolverFactory.createResolver({
|
||||
extensions: ['.js'],
|
||||
fileSystem: {} as resolve.CachedInputFileSystem
|
||||
fileSystem: {} as AbstractInputFileSystem
|
||||
});
|
||||
|
||||
const nfs = new resolve.NodeJsInputFileSystem();
|
||||
|
||||
const snfs = new resolve.SyncNodeJsInputFileSystem();
|
||||
|
||||
const cfs = new resolve.CachedInputFileSystem(nfs, 4);
|
||||
const cfs2 = new resolve.CachedInputFileSystem(snfs, 4);
|
||||
|
||||
let result: ResolveResult
|
||||
|
||||
|
||||
Vendored
+34
-36
@@ -1,4 +1,4 @@
|
||||
// Type definitions for enhanced-resolve v2.3.0
|
||||
// Type definitions for enhanced-resolve v3.0.0
|
||||
// Project: http://github.com/webpack/enhanced-resolve.git
|
||||
// Definitions by: e-cloud <https://github.com/e-cloud>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@@ -10,14 +10,13 @@ import fs = require('fs');
|
||||
import {
|
||||
ResolveResult,
|
||||
LoggingCallbackWrapper,
|
||||
CommonFileSystemMethod,
|
||||
ResolverRequest,
|
||||
ResolveContext,
|
||||
AbstractInputFileSystem
|
||||
} from './lib/common-types'
|
||||
import { Dictionary } from './lib/concord'
|
||||
import Resolver = require('./lib/Resolver');
|
||||
import Tapable = require('tapable')
|
||||
import Tapable = require('tapable');
|
||||
|
||||
declare namespace Resolve {
|
||||
function sync(path: string, request: string): ResolveResult;
|
||||
@@ -66,6 +65,7 @@ declare namespace Resolve {
|
||||
resolveToContext?: boolean;
|
||||
symlinks?: string[] | boolean;
|
||||
unsafeCache?: boolean | Dictionary<any>;
|
||||
useSyncFileSystemCalls?: boolean;
|
||||
}
|
||||
interface AliasItem {
|
||||
alias: string;
|
||||
@@ -76,12 +76,9 @@ declare namespace Resolve {
|
||||
}
|
||||
|
||||
class NodeJsInputFileSystem {
|
||||
isSync(): boolean;
|
||||
|
||||
readdir(path: string, callback: (err: Error, files: string[]) => void): void;
|
||||
|
||||
stat(path: string, callback?: (err: NodeJS.ErrnoException, stats: fs.Stats) => any): void;
|
||||
|
||||
readdir(path: string, callback: (err: Error, files: string[]) => void): void
|
||||
readFile(
|
||||
filename: string, encoding: string,
|
||||
callback: (err: NodeJS.ErrnoException, data: string) => void
|
||||
@@ -100,32 +97,25 @@ declare namespace Resolve {
|
||||
readFile(filename: string, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void;
|
||||
|
||||
readlink(path: string, callback?: (err: NodeJS.ErrnoException, linkString: string) => any): void;
|
||||
}
|
||||
|
||||
class SyncNodeJsInputFileSystem {
|
||||
isSync(): boolean;
|
||||
statSync(path: string | Buffer): fs.Stats;
|
||||
|
||||
stat: CommonFileSystemMethod;
|
||||
readdir: CommonFileSystemMethod;
|
||||
readdirSync(path: string): string[];
|
||||
|
||||
readFile(
|
||||
filename: string, encoding: string,
|
||||
callback: (err: NodeJS.ErrnoException, data: string) => void
|
||||
): void;
|
||||
readFile(
|
||||
readFileSync(filename: string, encoding: string): string;
|
||||
readFileSync(
|
||||
filename: string, options: {
|
||||
encoding: string;
|
||||
flag?: string;
|
||||
}, callback: (err: NodeJS.ErrnoException, data: string) => void
|
||||
): void;
|
||||
readFile(
|
||||
filename: string, options: {
|
||||
}
|
||||
): string;
|
||||
readFileSync(
|
||||
filename: string, options?: {
|
||||
flag?: string;
|
||||
}, callback: (err: NodeJS.ErrnoException, data: Buffer) => void
|
||||
): void;
|
||||
readFile(filename: string, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void;
|
||||
}
|
||||
): Buffer;
|
||||
|
||||
readlink: CommonFileSystemMethod;
|
||||
readlinkSync(path: string | Buffer): string;
|
||||
}
|
||||
|
||||
class CachedInputFileSystem {
|
||||
@@ -133,19 +123,27 @@ declare namespace Resolve {
|
||||
|
||||
constructor(fileSystem: AbstractInputFileSystem, duration: number);
|
||||
|
||||
isSync(): boolean;
|
||||
stat?(path: string, callback: (err: NodeJS.ErrnoException, stats: fs.Stats) => void): void;
|
||||
|
||||
readdir?(path: string, callback: (err: NodeJS.ErrnoException, files: string[]) => void): void;
|
||||
|
||||
readFile?(path: string, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void;
|
||||
|
||||
readJson?(path: string, callback: (err: NodeJS.ErrnoException, data: any) => void): void;
|
||||
|
||||
readlink?(path: string, callback: (err: NodeJS.ErrnoException, linkString: string) => void): void;
|
||||
|
||||
statSync?(path: string | Buffer): fs.Stats;
|
||||
|
||||
readdirSync?(path: string): string[];
|
||||
|
||||
readFileSync?(filename: string, options?: { flag?: string; }): Buffer;
|
||||
|
||||
readlinkSync?(path: string | Buffer): string;
|
||||
|
||||
readJsonSync?(path: string): any;
|
||||
|
||||
purge(what?: string | string[]): void;
|
||||
|
||||
readdir(path: string, callback: (err: NodeJS.ErrnoException, files: string[]) => void): void;
|
||||
|
||||
readFile(path: string, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void;
|
||||
|
||||
readJson(path: string, callback: (err: NodeJS.ErrnoException, data: any) => void): void;
|
||||
|
||||
readlink(path: string, callback: (err: NodeJS.ErrnoException, linkString: string) => void): void;
|
||||
|
||||
stat(path: string, callback: (err: NodeJS.ErrnoException, stats: fs.Stats) => void): void;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
+11
-8
@@ -1,26 +1,29 @@
|
||||
/// <reference types="node" />
|
||||
import { CommonFileSystemMethod } from './common-types';
|
||||
import { Dictionary } from './concord';
|
||||
|
||||
import { CommonFileSystemMethod } from './common-types'
|
||||
import { Dictionary } from './concord'
|
||||
declare class Storage {
|
||||
duration: number;
|
||||
running: Dictionary<Function[]>;
|
||||
data: Dictionary<any>;
|
||||
levels: string[][];
|
||||
count: number;
|
||||
data: Dictionary<any>;
|
||||
duration: number;
|
||||
interval: NodeJS.Timer | null;
|
||||
levels: string[][];
|
||||
needTickCheck: boolean;
|
||||
nextTick: number | null;
|
||||
passive: boolean;
|
||||
running: Dictionary<Function[]>;
|
||||
|
||||
constructor(duration: number);
|
||||
|
||||
ensureTick(): void;
|
||||
|
||||
finished(name: string): void;
|
||||
finished(name: string, err: NodeJS.ErrnoException | null, result: any): void;
|
||||
|
||||
finishedSync(name: string, err: NodeJS.ErrnoException | null, result?: any): void;
|
||||
|
||||
provide(name: string, provider: CommonFileSystemMethod, callback: (...args: any[]) => any): any;
|
||||
|
||||
provideSync(name: string, provider: (name: string) => any): any;
|
||||
|
||||
tick(): true | undefined;
|
||||
|
||||
checkTicks(): void;
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
/// <reference types="node" />
|
||||
import fs = require('fs');
|
||||
import { AbstractInputFileSystem } from './common-types';
|
||||
|
||||
declare class SyncAsyncFileSystemDecorator {
|
||||
fs: AbstractInputFileSystem;
|
||||
|
||||
readdir?(path: string, callback: (err: NodeJS.ErrnoException | null, files?: string[]) => void): void;
|
||||
|
||||
readFile?(filename: string, callback: (err: NodeJS.ErrnoException | null, data?: Buffer) => void): void;
|
||||
|
||||
readJson?(path: string, callback: (err: NodeJS.ErrnoException | null, data?: any) => void): void;
|
||||
|
||||
readlink?(path: string, callback: (err: NodeJS.ErrnoException | null, linkString?: string) => void): void;
|
||||
|
||||
stat?(path: string, callback: (err: NodeJS.ErrnoException | null, stats?: fs.Stats) => void): void;
|
||||
|
||||
constructor(fs: AbstractInputFileSystem);
|
||||
}
|
||||
|
||||
export = SyncAsyncFileSystemDecorator;
|
||||
+20
-1
@@ -39,6 +39,9 @@ export interface ResolverRequest {
|
||||
query?: string;
|
||||
relativePath?: string;
|
||||
request: string;
|
||||
__innerRequest?: string;
|
||||
__innerRequest_request?: string;
|
||||
__innerRequest_relativePath?: string;
|
||||
}
|
||||
|
||||
export interface LoggingCallbackTools {
|
||||
@@ -58,13 +61,29 @@ export interface ErrorCallback<T> {
|
||||
}
|
||||
|
||||
export interface AbstractInputFileSystem {
|
||||
isSync(): boolean;
|
||||
purge?(what?: string | string[]): void;
|
||||
readdir(path: string, callback: (err: NodeJS.ErrnoException, files: string[]) => void): void;
|
||||
readdirSync?(path: string): string[];
|
||||
readFile(filename: string, encoding: string, callback: (err: NodeJS.ErrnoException, data: string) => void): void;
|
||||
readFile(
|
||||
filename: string, options: {
|
||||
encoding: string;
|
||||
flag?: string;
|
||||
}, callback: (err: NodeJS.ErrnoException, data: string) => void
|
||||
): void;
|
||||
readFile(
|
||||
filename: string, options: {
|
||||
flag?: string;
|
||||
}, callback: (err: NodeJS.ErrnoException, data: Buffer) => void
|
||||
): void;
|
||||
readFile(filename: string, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void;
|
||||
readFileSync?(filename: string): Buffer;
|
||||
readJson?(path: string, callback: (err: NodeJS.ErrnoException, data: any) => void): void;
|
||||
readJsonSync?(path: string): any;
|
||||
readlink(path: string, callback: (err: NodeJS.ErrnoException, linkString: string) => void): void;
|
||||
readlinkSync?(path: string): string;
|
||||
stat(path: string, callback: (err: NodeJS.ErrnoException, stats: fs.Stats) => void): void;
|
||||
statSync?(path: string): fs.Stats;
|
||||
}
|
||||
|
||||
export interface CommonFileSystemMethod {
|
||||
|
||||
Reference in New Issue
Block a user