mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-09-07 09:40:19 +00:00
Merge pull request #12597 from ts-webpack/types/enhanced-resolve
Types/enhanced-resolve
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
import resolve = require('enhanced-resolve');
|
||||
import { Context } from 'enhanced-resolve/lib/concord';
|
||||
import { ResolveResult } from 'enhanced-resolve/lib/common-types'
|
||||
import Resolver = require('enhanced-resolve/lib/Resolver')
|
||||
|
||||
resolve('lib', 'string', function (err) { });
|
||||
|
||||
let context: Context = {
|
||||
referrer: 'hi'
|
||||
};
|
||||
|
||||
resolve(context, 'path', 'string', function () { });
|
||||
|
||||
let resolver: Resolver
|
||||
resolver = resolve.ResolverFactory.createResolver({
|
||||
extensions: ['.js'],
|
||||
fileSystem: {}
|
||||
});
|
||||
|
||||
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
|
||||
|
||||
result = resolve.sync(context, 'path', 'string');
|
||||
result = resolve.sync('path', 'string');
|
||||
|
||||
resolve.context('lib', 'string', function (err) { });
|
||||
resolve.context(context, 'path', 'string', function () { });
|
||||
|
||||
result = resolve.context.sync(context, 'path', 'string');
|
||||
result = resolve.context.sync('path', 'string');
|
||||
|
||||
resolve.create('lib', 'string', function (err) { });
|
||||
resolve.create(context, 'path', 'string', function () { });
|
||||
|
||||
result = resolve.create.sync(context, 'path', 'string');
|
||||
result = resolve.create.sync('path', 'string');
|
||||
Vendored
+134
@@ -0,0 +1,134 @@
|
||||
// Type definitions for enhanced-resolve v2.3.0
|
||||
// Project: http://github.com/webpack/enhanced-resolve.git
|
||||
// Definitions by: e-cloud <https://github.com/e-cloud>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
/// <reference types="tapable" />
|
||||
|
||||
import fs = require('fs');
|
||||
import {
|
||||
ResolveResult,
|
||||
LoggingCallbackWrapper,
|
||||
ErrorCallback,
|
||||
CommonFileSystemMethod,
|
||||
BaseFileSystem,
|
||||
ResolverRequest
|
||||
} from './lib/common-types';
|
||||
import { Context } from './lib/concord';
|
||||
import Resolver = require('./lib/Resolver');
|
||||
|
||||
declare namespace Resolve {
|
||||
function sync(path: string, request: string): ResolveResult;
|
||||
function sync(context: Context, path: string, request: string): ResolveResult;
|
||||
|
||||
function context(path: string, request: string, callback: LoggingCallbackWrapper): void;
|
||||
function context(context: Context, path: string, request: string, callback: LoggingCallbackWrapper): void;
|
||||
|
||||
namespace context {
|
||||
function sync(path: string, request: string): ResolveResult;
|
||||
function sync(context: Context, path: string, request: string): ResolveResult;
|
||||
}
|
||||
|
||||
function loader(path: string, request: string, callback: LoggingCallbackWrapper): void;
|
||||
function loader(context: Context, path: string, request: string, callback: LoggingCallbackWrapper): void;
|
||||
|
||||
namespace context {
|
||||
function sync(path: string, request: string): ResolveResult;
|
||||
function sync(context: Context, path: string, request: string): ResolveResult;
|
||||
}
|
||||
|
||||
function create(path: string, request: string, callback: LoggingCallbackWrapper): void;
|
||||
function create(context: Context, path: string, request: string, callback: LoggingCallbackWrapper): void;
|
||||
|
||||
export namespace create {
|
||||
function sync(path: string, request: string): ResolveResult;
|
||||
function sync(context: Context, path: string, request: string): ResolveResult;
|
||||
}
|
||||
|
||||
export namespace ResolverFactory {
|
||||
interface ResolverOption {
|
||||
modules?: string[];
|
||||
descriptionFiles?: string[];
|
||||
plugins?: any[];
|
||||
mainFields?: string[];
|
||||
aliasFields?: string[];
|
||||
mainFiles?: string[];
|
||||
extensions: string[];
|
||||
enforceExtension?: boolean;
|
||||
moduleExtensions?: string[];
|
||||
enforceModuleExtension?: boolean;
|
||||
alias?: AliasItem[] | {};
|
||||
symlinks?: string[] | boolean;
|
||||
resolveToContext?: boolean;
|
||||
unsafeCache?: boolean | {};
|
||||
cachePredicate?: (val: ResolverRequest) => boolean;
|
||||
fileSystem: any;
|
||||
resolver?: Resolver;
|
||||
}
|
||||
interface AliasItem {
|
||||
name: string;
|
||||
alias: string;
|
||||
onlyModule: boolean;
|
||||
}
|
||||
function createResolver(options: ResolverOption): Resolver;
|
||||
}
|
||||
|
||||
class NodeJsInputFileSystem {
|
||||
readdir(path: string, callback: (err: Error, files: string[]) => void): void;
|
||||
|
||||
isSync(): boolean;
|
||||
|
||||
stat(path: string, callback?: (err: NodeJS.ErrnoException, stats: fs.Stats) => any): void;
|
||||
|
||||
readFile(filename: string, encoding: string, callback: (err: NodeJS.ErrnoException, data: string) => void): void;
|
||||
readFile(filename: string, callback: (err: NodeJS.ErrnoException, data: string) => void): void;
|
||||
|
||||
readlink(path: string, callback?: (err: NodeJS.ErrnoException, linkString: string) => any): void;
|
||||
}
|
||||
|
||||
class SyncNodeJsInputFileSystem {
|
||||
isSync(): boolean;
|
||||
|
||||
stat: CommonFileSystemMethod;
|
||||
readdir: CommonFileSystemMethod;
|
||||
readFile(path: string, encoding?: string, callback?: (err: NodeJS.ErrnoException, result: Buffer) => void): void;
|
||||
readFile(path: string, callback?: (err: NodeJS.ErrnoException, result: Buffer) => void): void;
|
||||
readlink: CommonFileSystemMethod;
|
||||
}
|
||||
|
||||
class CachedInputFileSystem {
|
||||
fileSystem: BaseFileSystem;
|
||||
_statStorage: Storage;
|
||||
_readdirStorage: Storage;
|
||||
_readFileStorage: Storage;
|
||||
_readJsonStorage: Storage;
|
||||
_readlinkStorage: Storage;
|
||||
_stat: CommonFileSystemMethod;
|
||||
_readdir: CommonFileSystemMethod;
|
||||
_readFile: CommonFileSystemMethod;
|
||||
_readJson: CommonFileSystemMethod;
|
||||
_readlink: CommonFileSystemMethod;
|
||||
|
||||
constructor(fileSystem: BaseFileSystem, duration: number);
|
||||
|
||||
isSync(): boolean;
|
||||
|
||||
stat(path: string, callback: ErrorCallback): void;
|
||||
|
||||
readdir(path: string, callback: ErrorCallback): void;
|
||||
|
||||
readFile(path: string, callback: ErrorCallback): void;
|
||||
|
||||
readJson(path: string, callback: ErrorCallback): void;
|
||||
|
||||
readlink(path: string, callback: ErrorCallback): void;
|
||||
|
||||
purge(what?: string | string[]): void;
|
||||
}
|
||||
}
|
||||
|
||||
declare function Resolve(path: string, request: string, callback: LoggingCallbackWrapper): void;
|
||||
declare function Resolve(context: Context, path: string, request: string, callback: LoggingCallbackWrapper): void;
|
||||
|
||||
export = Resolve;
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
import Resolver = require('./Resolver');
|
||||
declare class AliasFieldPlugin {
|
||||
source: string;
|
||||
field: string;
|
||||
target: string;
|
||||
|
||||
constructor(source: string, field: string, target: string);
|
||||
|
||||
apply(resolver: Resolver): void;
|
||||
}
|
||||
export = AliasFieldPlugin;
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
import Resolver = require('./Resolver');
|
||||
import Resolve = require('../');
|
||||
|
||||
declare class AliasPlugin {
|
||||
source: string;
|
||||
options: Resolve.ResolverFactory.AliasItem;
|
||||
target: string;
|
||||
name: string;
|
||||
alias: string;
|
||||
onlyModule: boolean;
|
||||
|
||||
constructor(source: string, options: Resolve.ResolverFactory.AliasItem, target: string);
|
||||
|
||||
apply(resolver: Resolver): void;
|
||||
}
|
||||
|
||||
export = AliasPlugin;
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
import Resolver = require('./Resolver');
|
||||
declare class AppendPlugin {
|
||||
source: string;
|
||||
appending: string;
|
||||
target: string;
|
||||
|
||||
constructor(source: string, appending: string, target: string);
|
||||
|
||||
apply(resolver: Resolver): void;
|
||||
}
|
||||
export = AppendPlugin;
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
import Resolver = require('./Resolver');
|
||||
declare class CloneBasenamePlugin {
|
||||
source: string;
|
||||
target: string;
|
||||
|
||||
constructor(source: string, target: string);
|
||||
|
||||
apply(resolver: Resolver): void;
|
||||
}
|
||||
export = CloneBasenamePlugin;
|
||||
@@ -0,0 +1,11 @@
|
||||
import Resolver = require('./Resolver');
|
||||
declare class ConcordExtensionsPlugin {
|
||||
source: string;
|
||||
options: {};
|
||||
target: string;
|
||||
|
||||
constructor(source: string, options: {}, target: string);
|
||||
|
||||
apply(resolver: Resolver): void;
|
||||
}
|
||||
export = ConcordExtensionsPlugin;
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
import Resolver = require('./Resolver');
|
||||
declare class ConcordMainPlugin {
|
||||
source: string;
|
||||
options: {};
|
||||
target: string;
|
||||
|
||||
constructor(source: string, options: {}, target: string);
|
||||
|
||||
apply(resolver: Resolver): void;
|
||||
}
|
||||
export = ConcordMainPlugin;
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
import Resolver = require('./Resolver');
|
||||
declare class ConcordModulesPlugin {
|
||||
source: string;
|
||||
options: {};
|
||||
target: string;
|
||||
|
||||
constructor(source: string, options: {}, target: string);
|
||||
|
||||
apply(resolver: Resolver): void;
|
||||
}
|
||||
export = ConcordModulesPlugin;
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
import Resolver = require('./Resolver');
|
||||
declare class DescriptionFilePlugin {
|
||||
source: string;
|
||||
target: string;
|
||||
filenames: string[];
|
||||
|
||||
constructor(source: string, filenames: string[] | string, target: string);
|
||||
|
||||
apply(resolver: Resolver): void;
|
||||
}
|
||||
export = DescriptionFilePlugin;
|
||||
@@ -0,0 +1,8 @@
|
||||
import Resolver = require('./Resolver');
|
||||
declare function loadDescriptionFile(
|
||||
resolver: Resolver, directory: string, filenames: string[],
|
||||
callback: (...args: any[]) => any
|
||||
): void;
|
||||
declare function getField(content: any, field: string): any;
|
||||
declare function cdUp(directory: string): string | null;
|
||||
export { loadDescriptionFile, getField, cdUp };
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
import Resolver = require('./Resolver');
|
||||
declare class DirectoryExistsPlugin {
|
||||
source: string;
|
||||
target: string;
|
||||
|
||||
constructor(source: string, target: string);
|
||||
|
||||
apply(resolver: Resolver): void;
|
||||
}
|
||||
export = DirectoryExistsPlugin;
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
import Resolver = require('./Resolver');
|
||||
declare class FileExistsPlugin {
|
||||
source: string;
|
||||
target: string;
|
||||
|
||||
constructor(source: string, target: string);
|
||||
|
||||
apply(resolver: Resolver): void;
|
||||
}
|
||||
export = FileExistsPlugin;
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
import Resolver = require('./Resolver');
|
||||
declare class FileKindPlugin {
|
||||
source: string;
|
||||
target: string;
|
||||
|
||||
constructor(source: string, target: string);
|
||||
|
||||
apply(resolver: Resolver): void;
|
||||
}
|
||||
export = FileKindPlugin;
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
import Resolver = require('./Resolver');
|
||||
declare class JoinRequestPlugin {
|
||||
source: string;
|
||||
target: string;
|
||||
|
||||
constructor(source: string, target: string);
|
||||
|
||||
apply(resolver: Resolver): void;
|
||||
}
|
||||
export = JoinRequestPlugin;
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
import Resolver = require('./Resolver');
|
||||
declare class LogInfoPlugin {
|
||||
source: string;
|
||||
|
||||
constructor(source: string);
|
||||
|
||||
apply(resolver: Resolver): void;
|
||||
}
|
||||
export = LogInfoPlugin;
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
import Resolver = require('./Resolver');
|
||||
declare class MainFieldPlugin {
|
||||
source: string;
|
||||
options: {
|
||||
name: string;
|
||||
forceRelative: boolean;
|
||||
};
|
||||
target: string;
|
||||
|
||||
constructor(
|
||||
source: string, options: {
|
||||
name: string;
|
||||
forceRelative: boolean;
|
||||
}, target: string
|
||||
);
|
||||
|
||||
apply(resolver: Resolver): void;
|
||||
}
|
||||
export = MainFieldPlugin;
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
import Resolver = require('./Resolver');
|
||||
declare class ModuleAppendPlugin {
|
||||
source: string;
|
||||
appending: string;
|
||||
target: string;
|
||||
|
||||
constructor(source: string, appending: string, target: string);
|
||||
|
||||
apply(resolver: Resolver): void;
|
||||
}
|
||||
export = ModuleAppendPlugin;
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
import Resolver = require('./Resolver');
|
||||
declare class ModuleKindPlugin {
|
||||
source: string;
|
||||
target: string;
|
||||
|
||||
constructor(source: string, target: string);
|
||||
|
||||
apply(resolver: Resolver): void;
|
||||
}
|
||||
export = ModuleKindPlugin;
|
||||
@@ -0,0 +1,11 @@
|
||||
import Resolver = require('./Resolver');
|
||||
declare class ModulesInHierachicDirectoriesPlugin {
|
||||
source: string;
|
||||
target: string;
|
||||
directories: string[];
|
||||
|
||||
constructor(source: string, directories: string[], target: string);
|
||||
|
||||
apply(resolver: Resolver): void;
|
||||
}
|
||||
export = ModulesInHierachicDirectoriesPlugin;
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
import Resolver = require('./Resolver');
|
||||
declare class ModulesInRootPlugin {
|
||||
source: string;
|
||||
path: string;
|
||||
target: string;
|
||||
|
||||
constructor(source: string, path: string, target: string);
|
||||
|
||||
apply(resolver: Resolver): void;
|
||||
}
|
||||
export = ModulesInRootPlugin;
|
||||
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
import Resolver = require('./Resolver');
|
||||
declare class NextPlugin {
|
||||
source: string;
|
||||
target: string;
|
||||
|
||||
constructor(source: string, target: string);
|
||||
|
||||
apply(resolver: Resolver): void;
|
||||
}
|
||||
export = NextPlugin;
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
import Resolver = require('./Resolver');
|
||||
declare class ParsePlugin {
|
||||
source: string;
|
||||
target: string;
|
||||
|
||||
constructor(source: string, target: string);
|
||||
|
||||
apply(resolver: Resolver): void;
|
||||
}
|
||||
export = ParsePlugin;
|
||||
Vendored
+26
@@ -0,0 +1,26 @@
|
||||
/// <reference types="tapable" />
|
||||
import Tapable = require('tapable');
|
||||
import { ResolveParseResult, ResolverRequest, LoggingCallbackWrapper, BaseFileSystem } from './common-types';
|
||||
import { Context } from './concord';
|
||||
declare class Resolver extends Tapable {
|
||||
fileSystem: BaseFileSystem;
|
||||
|
||||
constructor(fileSystem: BaseFileSystem);
|
||||
|
||||
resolveSync(context: Context, path: string, request: string): null;
|
||||
|
||||
resolve(context: Context, path: string, request: string, callback: LoggingCallbackWrapper): any;
|
||||
|
||||
doResolve(type: string, request: ResolverRequest, message: string | null, callback: LoggingCallbackWrapper): any;
|
||||
|
||||
parse(identifier: string): ResolveParseResult | null;
|
||||
|
||||
isModule(path: string): boolean;
|
||||
|
||||
isDirectory(path: string): boolean;
|
||||
|
||||
join(path: string, request: string): string;
|
||||
|
||||
normalize(path: string): string;
|
||||
}
|
||||
export = Resolver;
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
import Resolver = require('./Resolver');
|
||||
declare class ResultPlugin {
|
||||
source: string;
|
||||
|
||||
constructor(source: string);
|
||||
|
||||
apply(resolver: Resolver): void;
|
||||
}
|
||||
export = ResultPlugin;
|
||||
Vendored
+34
@@ -0,0 +1,34 @@
|
||||
/// <reference types="node" />
|
||||
import { CommonFileSystemMethod } from './common-types';
|
||||
|
||||
declare class Storage {
|
||||
duration: number;
|
||||
running: {
|
||||
[name: string]: ((...args: any[]) => any)[]
|
||||
};
|
||||
data: {
|
||||
[name: string]: any[]
|
||||
};
|
||||
levels: string[][];
|
||||
count: number;
|
||||
interval: NodeJS.Timer | null;
|
||||
needTickCheck: boolean;
|
||||
nextTick: number | null;
|
||||
passive: boolean;
|
||||
|
||||
constructor(duration: number);
|
||||
|
||||
ensureTick(): void;
|
||||
|
||||
finished(name: string): void;
|
||||
|
||||
provide(name: string, provider: CommonFileSystemMethod, callback: (...args: any[]) => any): any;
|
||||
|
||||
tick(): true | undefined;
|
||||
|
||||
checkTicks(): void;
|
||||
|
||||
purge(what?: string | string[]): void;
|
||||
}
|
||||
|
||||
export default Storage;
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
import Resolver = require('./Resolver');
|
||||
declare class SymlinkPlugin {
|
||||
source: string;
|
||||
target: string;
|
||||
|
||||
constructor(source: string, target: string);
|
||||
|
||||
apply(resolver: Resolver): void;
|
||||
}
|
||||
export = SymlinkPlugin;
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
import Resolver = require('./Resolver');
|
||||
declare class TryNextPlugin {
|
||||
source: string;
|
||||
message: string | null;
|
||||
target: string;
|
||||
|
||||
constructor(source: string, message: string | null, target: string);
|
||||
|
||||
apply(resolver: Resolver): void;
|
||||
}
|
||||
export = TryNextPlugin;
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
import Resolver = require('./Resolver');
|
||||
import { ResolverRequest } from './common-types';
|
||||
declare class UnsafeCachePlugin {
|
||||
source: string;
|
||||
filterPredicate: (str: ResolverRequest) => boolean;
|
||||
cache: {};
|
||||
target: string;
|
||||
|
||||
constructor(source: string, filterPredicate: (str: ResolverRequest) => boolean, cache: {}, target: string);
|
||||
|
||||
apply(resolver: Resolver): void;
|
||||
}
|
||||
export = UnsafeCachePlugin;
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
import Resolver = require('./Resolver');
|
||||
declare class UseFilePlugin {
|
||||
source: string;
|
||||
filename: string;
|
||||
target: string;
|
||||
|
||||
constructor(source: string, filename: string, target: string);
|
||||
|
||||
apply(resolver: Resolver): void;
|
||||
}
|
||||
export = UseFilePlugin;
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
import { Context } from './concord';
|
||||
|
||||
export interface ResolveError extends Error {
|
||||
details: string;
|
||||
missing: string[];
|
||||
recursion: boolean;
|
||||
}
|
||||
|
||||
export interface ResolveParseResult {
|
||||
request: string;
|
||||
query: string;
|
||||
module: boolean;
|
||||
directory: boolean;
|
||||
file: boolean;
|
||||
}
|
||||
|
||||
export interface ResolveResult {
|
||||
path: boolean | string;
|
||||
query: string;
|
||||
}
|
||||
|
||||
export interface ResolverRequest {
|
||||
request: string;
|
||||
relativePath?: string;
|
||||
descriptionFileData?: any;
|
||||
descriptionFileRoot?: string;
|
||||
descriptionFilePath?: string;
|
||||
context: Context;
|
||||
path: string;
|
||||
query?: string;
|
||||
directory?: boolean;
|
||||
module?: boolean;
|
||||
}
|
||||
|
||||
export interface LoggingCallbackTools {
|
||||
log?(msg: string): void;
|
||||
stack?: string[];
|
||||
missing?: string[] | {
|
||||
push: (item: string) => void;
|
||||
};
|
||||
}
|
||||
|
||||
export interface LoggingCallbackWrapper extends LoggingCallbackTools {
|
||||
(err?: Error | null, ...args: any[]): any;
|
||||
}
|
||||
|
||||
export interface ErrorCallback {
|
||||
(err: Error | null, ...args: any[]): any;
|
||||
}
|
||||
|
||||
export interface CommonFileSystemMethod {
|
||||
(name: string, callback: (err: Error | null, ...args: any[]) => void): void;
|
||||
}
|
||||
|
||||
export interface BaseFileSystem {
|
||||
stat: CommonFileSystemMethod;
|
||||
readdir?: CommonFileSystemMethod;
|
||||
readFile?(path: string, encoding: string, callback: ErrorCallback): void;
|
||||
readFile?(path: string, callback: ErrorCallback): void;
|
||||
readJson?: CommonFileSystemMethod;
|
||||
readlink?: CommonFileSystemMethod;
|
||||
isSync: () => boolean;
|
||||
}
|
||||
Vendored
+38
@@ -0,0 +1,38 @@
|
||||
export interface Type {
|
||||
type: string | null | undefined;
|
||||
features: string[];
|
||||
}
|
||||
|
||||
export interface Context {
|
||||
supportedResourceTypes?: string[];
|
||||
environments?: string[];
|
||||
referrer: string;
|
||||
}
|
||||
|
||||
declare function parseType(type: string): Type;
|
||||
declare function isTypeMatched(baseType: string | Type, testedType: string | Type): boolean;
|
||||
declare function isResourceTypeSupported(context: Context, type: string): boolean | undefined;
|
||||
declare function isEnvironment(context: Context, env: string | Type): boolean | undefined;
|
||||
declare function isGlobMatched(glob: string, relativePath: string): boolean;
|
||||
declare function isConditionMatched(context: Context, condition: string): boolean;
|
||||
declare function isKeyMatched(context: Context, key: string): string | boolean;
|
||||
declare function getField(context: Context, configuration: any, field: string): undefined;
|
||||
declare function getMain(context: Context, configuration: any): undefined;
|
||||
declare function getExtensions(context: Context, configuration: any): undefined;
|
||||
declare function matchModule(context: Context, configuration: any, request: string): any;
|
||||
declare function matchType(context: Context, configuration: any, relativePath: string): undefined;
|
||||
|
||||
export {
|
||||
parseType,
|
||||
isTypeMatched,
|
||||
isResourceTypeSupported,
|
||||
isEnvironment,
|
||||
isGlobMatched,
|
||||
isConditionMatched,
|
||||
isKeyMatched,
|
||||
getField,
|
||||
getMain,
|
||||
getExtensions,
|
||||
matchModule,
|
||||
matchType
|
||||
};
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
export default function getPaths(path: string): {
|
||||
paths: string[];
|
||||
seqments: string[];
|
||||
};
|
||||
export declare function basename(path: string): string | null;
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
declare function globToRegExp(glob: string): RegExp;
|
||||
export { globToRegExp };
|
||||
@@ -0,0 +1,149 @@
|
||||
import AliasFieldPlugin = require('enhanced-resolve/lib/AliasFieldPlugin');
|
||||
|
||||
import AliasPlugin = require('enhanced-resolve/lib/AliasPlugin');
|
||||
|
||||
import AppendPlugin = require('enhanced-resolve/lib/AppendPlugin');
|
||||
|
||||
import CloneBasenamePlugin = require('enhanced-resolve/lib/CloneBasenamePlugin');
|
||||
|
||||
import ConcordExtensionsPlugin = require('enhanced-resolve/lib/ConcordExtensionsPlugin');
|
||||
|
||||
import ConcordMainPlugin = require('enhanced-resolve/lib/ConcordMainPlugin');
|
||||
|
||||
import ConcordModulesPlugin = require('enhanced-resolve/lib/ConcordModulesPlugin');
|
||||
|
||||
import DescriptionFilePlugin = require('enhanced-resolve/lib/DescriptionFilePlugin');
|
||||
|
||||
import DescriptionFileUtils = require('enhanced-resolve/lib/DescriptionFileUtils');
|
||||
|
||||
import DirectoryExistsPlugin = require('enhanced-resolve/lib/DirectoryExistsPlugin');
|
||||
|
||||
import FileExistsPlugin = require('enhanced-resolve/lib/FileExistsPlugin');
|
||||
|
||||
import FileKindPlugin = require('enhanced-resolve/lib/FileKindPlugin');
|
||||
|
||||
import getPaths, { basename } from 'enhanced-resolve/lib/getPaths';
|
||||
|
||||
import { globToRegExp } from 'enhanced-resolve/lib/globToRegExp';
|
||||
|
||||
import JoinRequestPlugin = require('enhanced-resolve/lib/JoinRequestPlugin');
|
||||
|
||||
import LogInfoPlugin = require('enhanced-resolve/lib/LogInfoPlugin');
|
||||
|
||||
import MainFieldPlugin = require('enhanced-resolve/lib/MainFieldPlugin');
|
||||
|
||||
import ModuleAppendPlugin = require('enhanced-resolve/lib/ModuleAppendPlugin');
|
||||
|
||||
import ModuleKindPlugin = require('enhanced-resolve/lib/ModuleKindPlugin');
|
||||
|
||||
import ModulesInHierachicDirectoriesPlugin = require('enhanced-resolve/lib/ModulesInHierachicDirectoriesPlugin');
|
||||
|
||||
import ModulesInRootPlugin = require('enhanced-resolve/lib/ModulesInRootPlugin');
|
||||
|
||||
import NextPlugin = require('enhanced-resolve/lib/NextPlugin');
|
||||
|
||||
import ParsePlugin = require('enhanced-resolve/lib/ParsePlugin');
|
||||
|
||||
import Resolver = require('enhanced-resolve/lib/Resolver');
|
||||
|
||||
import ResultPlugin = require('enhanced-resolve/lib/ResultPlugin');
|
||||
|
||||
import Storage from 'enhanced-resolve/lib/Storage'
|
||||
|
||||
import SymlinkPlugin = require('enhanced-resolve/lib/SymlinkPlugin');
|
||||
|
||||
import TryNextPlugin = require('enhanced-resolve/lib/TryNextPlugin');
|
||||
|
||||
import UnsafeCachePlugin = require('enhanced-resolve/lib/UnsafeCachePlugin');
|
||||
|
||||
import UseFilePlugin = require('enhanced-resolve/lib/UseFilePlugin');
|
||||
|
||||
import resolve = require('../');
|
||||
|
||||
import { BaseFileSystem } from 'enhanced-resolve/lib/common-types'
|
||||
|
||||
const aplugin = new AliasFieldPlugin('a', 'b', 'c');
|
||||
|
||||
const aplugin2 = new AliasPlugin('a', {
|
||||
onlyModule: false,
|
||||
name: 'a',
|
||||
alias: 'b'
|
||||
}, 'string')
|
||||
|
||||
const aplugin3 = new AppendPlugin('a', 'b', 'c');
|
||||
|
||||
const cplugin = new CloneBasenamePlugin('a', 'c');
|
||||
|
||||
const cplugin2 = new ConcordExtensionsPlugin('a', {
|
||||
any: 'string',
|
||||
right: false
|
||||
}, 'b');
|
||||
|
||||
const cplugin3 = new ConcordMainPlugin('string', {
|
||||
any: 'string',
|
||||
right: false
|
||||
}, 'string');
|
||||
|
||||
const cplugin4 = new ConcordModulesPlugin('string', {
|
||||
any: 'string',
|
||||
right: false
|
||||
}, 'string');
|
||||
|
||||
const dplugin = new DescriptionFilePlugin('string', 'string', 'string');
|
||||
|
||||
DescriptionFileUtils.cdUp('./lib');
|
||||
DescriptionFileUtils.getField({}, 'hi');
|
||||
DescriptionFileUtils.loadDescriptionFile(resolve.ResolverFactory.createResolver({
|
||||
extensions: [''],
|
||||
fileSystem: {}
|
||||
}), './lib', ['file'], function () { });
|
||||
|
||||
const dplugin1 = new DirectoryExistsPlugin('string', 'string');
|
||||
|
||||
const fplugin = new FileExistsPlugin('string', 's');
|
||||
|
||||
const fplugin2 = new FileKindPlugin('string', 's');
|
||||
|
||||
getPaths('./lib');
|
||||
|
||||
basename('./lib');
|
||||
|
||||
globToRegExp('lib/**');
|
||||
|
||||
const jplugin = new JoinRequestPlugin('string', 's');
|
||||
|
||||
const lplugin = new LogInfoPlugin('string');
|
||||
|
||||
const mplugin = new MainFieldPlugin('string', {
|
||||
name: 'hi',
|
||||
forceRelative: false
|
||||
}, 's');
|
||||
|
||||
const mplugin2 = new ModuleAppendPlugin('string', 'ap', 's');
|
||||
|
||||
const mplugin3 = new ModuleKindPlugin('string', 's');
|
||||
|
||||
const mplugin4 = new ModulesInHierachicDirectoriesPlugin('string', ['arr'], 's');
|
||||
|
||||
const mplugin5 = new ModulesInRootPlugin('string', 'ap', 's');
|
||||
|
||||
const nplugin = new NextPlugin('string', 'ap');
|
||||
|
||||
const pplugin = new ParsePlugin('string', 'ap');
|
||||
|
||||
const resolver = new Resolver({} as BaseFileSystem);
|
||||
|
||||
const rplugin = new ResultPlugin('string');
|
||||
|
||||
const splugin = new SymlinkPlugin('string', 's');
|
||||
|
||||
const tplugin = new TryNextPlugin('string', 'ap', 's');
|
||||
|
||||
const uplugin = new UnsafeCachePlugin('string', function (e) { return false }, {
|
||||
hi: 'string',
|
||||
hello: true
|
||||
}, 's');
|
||||
|
||||
const uplugin2 = new UseFilePlugin('string', 'ap', 's');
|
||||
|
||||
const s = new Storage(4);
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"include": [
|
||||
"index.d.ts",
|
||||
"enhanced-resolve-tests.ts",
|
||||
"lib/*.ts"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user