-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add third party lib typings (#14580)
* add @babel/compat-data path mappings * add typings for third-party Babel plugins * fix typing errors * add regenerator-transform and dynamic-import-node
- Loading branch information
Showing
7 changed files
with
152 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import type { PluginAPI } from "@babel/core"; | ||
import type * as t from "@babel/types"; | ||
// https://github.com/airbnb/babel-plugin-dynamic-import-node/blob/master/src/utils.js | ||
declare module "babel-plugin-dynamic-import-node/utils" { | ||
function getImportSource( | ||
t: typeof import("@babel/types"), | ||
callNode: t.CallExpression | ||
): t.Expression; | ||
|
||
function createDynamicImportTransform({ | ||
template, | ||
types: t, | ||
}: PluginAPI): (context: PluginPass, path: NodePath) => void; | ||
|
||
export { getImportSource, createDynamicImportTransform }; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,50 @@ | ||
import type { PluginPass } from "@babel/core"; | ||
import { declare } from "@babel/helper-plugin-utils"; | ||
import type * as t from "@babel/types"; | ||
declare module "js-tokens" { | ||
// TODO(Babel 8): Remove this | ||
export { default } from "js-tokens-BABEL_8_BREAKING-true"; | ||
export * from "js-tokens-BABEL_8_BREAKING-true"; | ||
} | ||
|
||
declare module "@babel/preset-modules/lib/plugins/transform-async-arrows-in-class" { | ||
let plugin: ReturnType<typeof declare>; | ||
export = { default: plugin }; | ||
} | ||
declare module "@babel/preset-modules/lib/plugins/transform-edge-default-parameters" { | ||
let plugin: ReturnType<typeof declare>; | ||
export = { default: plugin }; | ||
} | ||
declare module "@babel/preset-modules/lib/plugins/transform-edge-function-name" { | ||
let plugin: ReturnType<typeof declare>; | ||
export = { default: plugin }; | ||
} | ||
declare module "@babel/preset-modules/lib/plugins/transform-tagged-template-caching" { | ||
let plugin: ReturnType<typeof declare>; | ||
export = { default: plugin }; | ||
} | ||
declare module "@babel/preset-modules/lib/plugins/transform-safari-block-shadowing" { | ||
let plugin: ReturnType<typeof declare>; | ||
export = { default: plugin }; | ||
} | ||
declare module "@babel/preset-modules/lib/plugins/transform-safari-for-shadowing" { | ||
let plugin: ReturnType<typeof declare>; | ||
export = { default: plugin }; | ||
} | ||
declare module "babel-plugin-polyfill-corejs2" { | ||
let plugin: ReturnType<typeof declare>; | ||
export = { default: plugin }; | ||
} | ||
declare module "babel-plugin-polyfill-corejs3" { | ||
let plugin: ReturnType<typeof declare>; | ||
export = { default: plugin }; | ||
} | ||
declare module "babel-plugin-polyfill-regenerator" { | ||
let plugin: ReturnType<typeof declare>; | ||
export = { default: plugin }; | ||
} | ||
|
||
declare module "regenerator-transform" { | ||
let plugin: ReturnType<typeof declare>; | ||
export = { default: plugin }; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters