* Lint against CJS globals in modules * Use `import.meta.url` instead of `__filename` in `src` files * Prepare fixtures runner for `import.meta.url` * Use `import.meta.url` instead of `__filename` in `test/index` files * Remove `__dirname` from remaining test files dirname * Avoid using `module` in `src` files * Avoid using `require` in `src` files * Avoid using `require` in `test` files * Update `@types/node` * Compile dynamic import in `@babel/node` * Fix windows * Use `@babel/plugin-proposal-dynamic-import` from npm
214 lines
4.8 KiB
Plaintext
214 lines
4.8 KiB
Plaintext
/**
|
|
* Basic declarations for the npm modules we use.
|
|
*/
|
|
|
|
declare module "module" {
|
|
declare export function createRequire(url: any): any;
|
|
}
|
|
|
|
declare module "debug" {
|
|
declare export default (namespace: string) => (formatter: string, ...args: any[]) => void;
|
|
}
|
|
|
|
declare var require: {
|
|
resolve(specifier: string, opts?: {
|
|
paths: string[]
|
|
}): string,
|
|
};
|
|
|
|
declare module "json5" {
|
|
declare export default {
|
|
parse: (string) => mixed,
|
|
};
|
|
}
|
|
|
|
declare module "lodash/defaults" {
|
|
declare export default <T: Object>(T, Object) => T;
|
|
}
|
|
|
|
declare module "lodash/clone" {
|
|
declare export default <T>(obj: T) => T;
|
|
}
|
|
|
|
declare module "lodash/merge" {
|
|
declare export default <T: Object>(T, Object) => T;
|
|
}
|
|
|
|
declare module "lodash/escapeRegExp" {
|
|
declare export default (toEscape?: string) => string;
|
|
}
|
|
|
|
declare module "semver" {
|
|
declare class SemVer {
|
|
build: Array<string>;
|
|
loose: ?boolean;
|
|
major: number;
|
|
minor: number;
|
|
patch: number;
|
|
prerelease: Array<string | number>;
|
|
raw: string;
|
|
version: string;
|
|
|
|
constructor(version: string | SemVer): SemVer;
|
|
}
|
|
|
|
declare module.exports: {
|
|
SemVer: SemVer;
|
|
|
|
coerce(version: string | SemVer): SemVer | null;
|
|
gt(v1: string, v2: string): boolean;
|
|
intersects(r1: string, r2: string): boolean;
|
|
lt(v1: string, v2: string): boolean;
|
|
major(v: string): number;
|
|
minor(v: string): number;
|
|
patch(v: string): number;
|
|
satisfies(v1: string, r1: string): boolean;
|
|
valid(v: string): boolean;
|
|
}
|
|
}
|
|
|
|
declare module "source-map" {
|
|
declare export type SourceMap = {
|
|
version: 3,
|
|
file: ?string,
|
|
sourceRoot: ?string,
|
|
sources: [?string],
|
|
sourcesContent: [?string],
|
|
names: [?string],
|
|
mappings: string,
|
|
};
|
|
|
|
declare module.exports: {
|
|
SourceMapConsumer: typeof SourceMapConsumer,
|
|
SourceMapGenerator: typeof SourceMapGenerator,
|
|
}
|
|
|
|
declare class SourceMapConsumer {
|
|
static GENERATED_ORDER: 1;
|
|
static ORIGINAL_ORDER: 2;
|
|
|
|
file: string | null;
|
|
sourceRoot: string | null;
|
|
sources: Array<string>;
|
|
|
|
constructor(?SourceMap): this;
|
|
|
|
computeColumnSpans(): string;
|
|
originalPositionFor({
|
|
line: number,
|
|
column: number,
|
|
}): {|
|
|
source: string,
|
|
line: number,
|
|
column: number,
|
|
name: string | null
|
|
|} | {|
|
|
source: null,
|
|
line: null,
|
|
column: null,
|
|
name: null
|
|
|};
|
|
|
|
generatedPositionFor({
|
|
source: string,
|
|
line: number,
|
|
column: number,
|
|
}): {|
|
|
line: number,
|
|
column: number,
|
|
lastColumn: number | null | void,
|
|
|} | {|
|
|
line: null,
|
|
column: null,
|
|
lastColumn: null | void,
|
|
|};
|
|
|
|
allGeneratedPositionsFor({
|
|
source: string,
|
|
line: number,
|
|
column: number,
|
|
}): Array<{|
|
|
line: number,
|
|
column: number,
|
|
lastColumn: number,
|
|
|}>;
|
|
|
|
sourceContentFor(string, boolean | void): string | null;
|
|
|
|
eachMapping(
|
|
({|
|
|
generatedLine: number,
|
|
generatedColumn: number,
|
|
source: string,
|
|
originalLine: number,
|
|
originalColumn: number,
|
|
name: string | null,
|
|
|} | {|
|
|
generatedLine: number,
|
|
generatedColumn: number,
|
|
source: null,
|
|
originalLine: null,
|
|
originalColumn: null,
|
|
name: null,
|
|
|}) => mixed,
|
|
context: mixed,
|
|
order: ?(1 | 2),
|
|
): void;
|
|
}
|
|
|
|
declare class SourceMapGenerator {
|
|
constructor(?{
|
|
file?: string | null,
|
|
sourceRoot?: string | null,
|
|
skipValidation?: boolean | null,
|
|
}): this;
|
|
|
|
addMapping({
|
|
generated: {
|
|
line: number,
|
|
column: number,
|
|
}
|
|
}): void;
|
|
|
|
setSourceContent(string, string): void;
|
|
|
|
toJSON(): SourceMap;
|
|
}
|
|
}
|
|
|
|
declare module "convert-source-map" {
|
|
import type { SourceMap, SourceMapGenerator } from "source-map";
|
|
|
|
declare class Converter {
|
|
toJSON(): string;
|
|
toBase64(): string;
|
|
toComment(): string;
|
|
toObject(): SourceMap
|
|
}
|
|
|
|
declare module.exports: {
|
|
SourceMap: SourceMap,
|
|
Converter: Converter,
|
|
fromObject(obj: SourceMap | SourceMapGenerator): Converter,
|
|
fromJSON(str: string | Buffer): Converter,
|
|
fromBase64(str: string): Converter,
|
|
fromComment(str: string): Converter,
|
|
fromMapFileComment(str: string, dir: string): Converter,
|
|
fromSource(str: string): Converter,
|
|
fromMapFileSource(str: string, dir: string): Converter,
|
|
removeComments(str: string): string,
|
|
removeMapFileComments(str: string): string,
|
|
generateMapFileComment(path: string, options?: ?{ multiline: boolean }): string,
|
|
};
|
|
}
|
|
|
|
declare module "core-js-compat/data" {
|
|
declare type Target = "node" | "chrome" | "opera" | "edge" | "firefox" | "safari" | "ie" | "ios" | "android" | "electron" | "samsung";
|
|
|
|
declare module.exports: {
|
|
[key: string]: {
|
|
[target: Target]: string;
|
|
}
|
|
}
|
|
}
|