### `@babel/runtime` - Added `@babel/runtime-corejs3` package and `corejs: 3` options to `@babel/plugin-transform-runtime`. - Added support of instance methods, fixes #8928. - Added flag `proposals` (in `corejs: { version: 3, proposals: true }` format) for support all proposals polyfills from `core-js`. - Used separate directories in runtime for `core-js` entry points with proposals and without. - Used `get-iterator-method` helper for getting iterators, fixes #2500. - As a cheap bonus, added support of IE8- (except some cases of `regenerator`). ### `@babel/polyfill` - Should be deprecated in favor of separate usage required features from `core-js` and `regenerator-runtime` with an informative message. ### `@babel/preset-env` - Uses for built-ins data from [`core-js-compat`](https://github.com/zloirock/core-js/tree/master/packages/core-js-compat) instead of `compat-table` since information from `compat-table` [is not enough](https://github.com/zloirock/core-js/tree/master/packages/core-js-compat). - `useBuilIns` now requires direct setting of `corejs` version option, without it will be used `2` by default and shown deprecation warning. - Added support of minor `core-js` versions for simplify updating in the future. - For preventing some order-related problems, polyfills in the both `core-js@3` plugins added on `post` stage in the order of `core-js-compat` data. - Divided plugins and polyfills parts of `preset-env`, instead of 2 internal plugins for adding polyfills, we have 6: usage and entry versions of plugins for `core-js@2`, ### Current state: `core-js@3`, `regenerator-runtime`. - Added support `samsung` target (for Samsung Internet) since `core-js-compat` and `compat-table` now contains mapping for this, fixes #6602. #### `useBuilIns: entry` with `corejs: 3` - No longer transforms `@babel/polyfill`. - Transforms **all possible** `core-js` entry points to import of related modules (based on data from [`core-js-compat`](https://unpkg.com/core-js-compat@3.0.0-beta.15/entries.json)). - Since of this, we no longer need `shippedProposals` / `proposals` flags with `useBuilIns: entry`. - Removes `regenerator-runtime/runtime` import where it's not required. #### `useBuilIns: usage` with `corejs: 3` - In addition to `shippedProposals`, added flag `proposals` (in `corejs: { version: 3, proposals: true }` format) for polyfill all proposals from `core-js`. - Fixed list of dependencies in built-in definitions. - Improved the way of determination method / built-in name and source of this method. - Adds import of required polyfills on `MemberExpression`, `ObjectPattern`, `in` operator. - Adds import of required polyfills on access to global object properties. - Adds import of all required common iterators on all syntax features which use iterators protocol (`for-of`, destructuring, spread, `yield` delegation, etc.). - Adds import of promises on syntax features which use promises (async functions/generators, dynamic import, etc.), fixes #9250, #7402, etc. ### `core-js@2` stuff I didn't want to tough `core-js@2`-related stuff, however - Fixed some serious errors in definitions which breaks `Object.getOwnPropertySymbols`, `Symbol.toStringTag` logic, `Promise#finally`, `Array#forEach`, etc. - `Array#flatMap` and trim methods moved to stable features as a part of ES2019 and loaded by deprecated `@babel/polyfill` and `@babel/preset-env` with `corejs: 2` option.
208 lines
4.5 KiB
Plaintext
208 lines
4.5 KiB
Plaintext
/**
|
|
* Basic declarations for the npm modules we use.
|
|
*/
|
|
|
|
declare module "resolve" {
|
|
declare export default {
|
|
sync: (string, {| basedir: 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 "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 } from "source-map";
|
|
|
|
declare class Converter {
|
|
toJSON(): string;
|
|
toBase64(): string;
|
|
toComment(): string;
|
|
toObject(): SourceMap
|
|
}
|
|
|
|
declare module.exports: {
|
|
SourceMap: SourceMap,
|
|
Converter: Converter,
|
|
fromObject(obj: SourceMap): Converter,
|
|
fromJSON(str: string): Converter,
|
|
fromBase64(str: string): Converter,
|
|
fromComment(str: string): Converter,
|
|
fromMapFileComment(str: 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 "js-levenshtein" {
|
|
declare module.exports: {
|
|
(string, string): number,
|
|
};
|
|
}
|
|
|
|
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;
|
|
}
|
|
}
|
|
}
|