mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 14:20:12 +00:00
Use types that come with @babel/parser and remove @types/babel__parser (#29403)
* @babel/parser includes its own types * Update TypeScript version.
This commit is contained in:
committed by
Pranav Senthilnathan
parent
80d9c48f2d
commit
1733f6bed0
@@ -144,6 +144,12 @@
|
||||
"sourceRepoURL": "https://github.com/Azure/azure-mobile-apps-node/",
|
||||
"asOfVersion": "3.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "@babel/parser",
|
||||
"typingsPackageName": "babel__parser",
|
||||
"sourceRepoURL": "https://github.com/babel/babel",
|
||||
"asOfVersion": "7.1.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "BabylonJS",
|
||||
"typingsPackageName": "babylonjs",
|
||||
|
||||
8
types/babel__core/index.d.ts
vendored
8
types/babel__core/index.d.ts
vendored
@@ -4,16 +4,16 @@
|
||||
// Marvin Hagemeister <https://github.com/marvinhagemeister>
|
||||
// Melvin Groenhoff <https://github.com/mgroenhoff>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
// TypeScript Version: 2.9
|
||||
|
||||
import { GeneratorOptions } from "@babel/generator";
|
||||
import traverse, { Visitor, NodePath } from "@babel/traverse";
|
||||
import template from "@babel/template";
|
||||
import * as t from "@babel/types";
|
||||
import { ParseOptions } from "@babel/parser";
|
||||
import { ParserOptions } from "@babel/parser";
|
||||
|
||||
export {
|
||||
ParseOptions,
|
||||
ParserOptions,
|
||||
GeneratorOptions,
|
||||
t as types,
|
||||
template,
|
||||
@@ -217,7 +217,7 @@ export interface TransformOptions {
|
||||
*
|
||||
* Default: `{}`
|
||||
*/
|
||||
parserOpts?: ParseOptions | null;
|
||||
parserOpts?: ParserOptions | null;
|
||||
|
||||
/**
|
||||
* List of plugins to load and use
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@babel/types": "^7.0.0-beta.54"
|
||||
"@babel/parser": "^7.1.0",
|
||||
"@babel/types": "^7.0.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,9 +22,6 @@
|
||||
"@babel/generator": [
|
||||
"babel__generator"
|
||||
],
|
||||
"@babel/parser": [
|
||||
"babel__parser"
|
||||
],
|
||||
"@babel/template": [
|
||||
"babel__template"
|
||||
],
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
// Example from https://github.com/babel/babel/tree/master/packages/babel-generator
|
||||
import generate from "@babel/generator";
|
||||
import { parse } from "@babel/parser";
|
||||
import * as t from "@babel/types";
|
||||
|
||||
const code = "class Example {}";
|
||||
const ast = parse(code);
|
||||
declare const ast: t.Node;
|
||||
|
||||
ast.type;
|
||||
ast.loc!.start;
|
||||
|
||||
2
types/babel__generator/index.d.ts
vendored
2
types/babel__generator/index.d.ts
vendored
@@ -4,7 +4,7 @@
|
||||
// Johnny Estilles <https://github.com/johnnyestilles>
|
||||
// Melvin Groenhoff <https://github.com/mgroenhoff>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
// TypeScript Version: 2.9
|
||||
|
||||
import * as t from "@babel/types";
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@babel/types": "^7.0.0-beta.54"
|
||||
"@babel/types": "^7.0.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,9 +18,6 @@
|
||||
"paths": {
|
||||
"@babel/generator": [
|
||||
"babel__generator"
|
||||
],
|
||||
"@babel/parser": [
|
||||
"babel__parser"
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
import { parse, parseExpression } from "@babel/parser";
|
||||
|
||||
declare function assert(expr: boolean): void;
|
||||
|
||||
const code = `function square(n) {
|
||||
return n * n;
|
||||
}`;
|
||||
|
||||
const node = parse(code);
|
||||
assert(node.type === "File");
|
||||
assert(node.start === 0);
|
||||
assert(node.end === 38);
|
||||
assert(!!node.loc && node.loc.start > node.loc.end);
|
||||
|
||||
parse(code, {
|
||||
sourceType: "module", // default: "script"
|
||||
plugins: ["jsx"] // default: []
|
||||
});
|
||||
107
types/babel__parser/index.d.ts
vendored
107
types/babel__parser/index.d.ts
vendored
@@ -1,107 +0,0 @@
|
||||
// Type definitions for @babel/parser 7.0
|
||||
// Project: https://github.com/babel/babel/tree/master/packages/babel-parser
|
||||
// Definitions by: Troy Gerwien <https://github.com/yortus>
|
||||
// Marvin Hagemeister <https://github.com/marvinhagemeister>
|
||||
// Melvin Groenhoff <https://github.com/mgroenhoff>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
import { File, Expression } from "@babel/types";
|
||||
|
||||
export function parse(code: string, opts?: ParseOptions): File;
|
||||
|
||||
export function parseExpression(input: string, options?: ParseOptions): Expression;
|
||||
|
||||
export interface ParseOptions {
|
||||
/**
|
||||
* By default, import and export declarations can only appear at a program's top level.
|
||||
* Setting this option to true allows them anywhere where a statement is allowed.
|
||||
*/
|
||||
allowImportExportEverywhere?: boolean;
|
||||
|
||||
/**
|
||||
* By default, await use is not allowed outside of an async function. Set this to true to accept such code.
|
||||
*/
|
||||
allowAwaitOutsideFunction?: boolean;
|
||||
|
||||
/**
|
||||
* By default, a return statement at the top level raises an error. Set this to true to accept such code.
|
||||
*/
|
||||
allowReturnOutsideFunction?: boolean;
|
||||
|
||||
allowSuperOutsideMethod?: boolean;
|
||||
|
||||
/**
|
||||
* Indicate the mode the code should be parsed in. Can be one of "script", "module", or "unambiguous".
|
||||
* Defaults to "script". "unambiguous" will make @babel/parser attempt to guess, based on the presence of ES6 import or export
|
||||
* statements. Files with ES6 imports and exports are considered "module" and are otherwise "script".
|
||||
*/
|
||||
sourceType?: "script" | "module" | "unambiguous";
|
||||
|
||||
/**
|
||||
* Correlate output AST nodes with their source filename. Useful when
|
||||
* generating code and source maps from the ASTs of multiple input files.
|
||||
*/
|
||||
sourceFilename?: string;
|
||||
|
||||
/**
|
||||
* By default, the first line of code parsed is treated as line 1. You can provide a line number to alternatively start with. Useful
|
||||
* for integration with other source tools.
|
||||
*/
|
||||
startLine?: number;
|
||||
|
||||
/**
|
||||
* Array containing the plugins that you want to enable.
|
||||
*/
|
||||
plugins?: PluginList;
|
||||
|
||||
strictMode?: boolean;
|
||||
|
||||
/**
|
||||
* Adds a `ranges` property to each node: `[node.start, node.end]`
|
||||
*/
|
||||
ranges?: boolean;
|
||||
|
||||
/**
|
||||
* Adds all parsed tokens to a `tokens` property on the `File` node
|
||||
*/
|
||||
tokens?: boolean;
|
||||
}
|
||||
|
||||
export type PluginList = Array<PluginName | [PluginName, PluginOptions]>;
|
||||
|
||||
export type PluginName =
|
||||
"asyncGenerators" |
|
||||
"bigInt" |
|
||||
"classPrivateMethods" |
|
||||
"classPrivateProperties" |
|
||||
"classProperties" |
|
||||
"decorators" |
|
||||
"doExpressions" |
|
||||
"dynamicImport" |
|
||||
"estree" |
|
||||
"exportDefaultFrom" |
|
||||
"exportNamespaceFrom" |
|
||||
"flow" |
|
||||
"flowComments" |
|
||||
"functionBind" |
|
||||
"functionSent" |
|
||||
"importMeta" |
|
||||
"jsx" |
|
||||
"nullishCoalescingOperator" |
|
||||
"numericSeparator" |
|
||||
"objectRestSpread" |
|
||||
"optionalCatchBinding" |
|
||||
"optionalChaining" |
|
||||
"pipelineOperator" |
|
||||
"throwExpressions" |
|
||||
"typescript";
|
||||
|
||||
export interface PluginOptions {
|
||||
decorators?: {
|
||||
decoratorsBeforeExport?: boolean;
|
||||
};
|
||||
flow?: {
|
||||
all?: boolean;
|
||||
};
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@babel/types": "^7.0.0-beta.54"
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"paths": {
|
||||
"@babel/parser": [
|
||||
"babel__parser"
|
||||
]
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"babel__parser-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
6
types/babel__template/index.d.ts
vendored
6
types/babel__template/index.d.ts
vendored
@@ -4,12 +4,12 @@
|
||||
// Marvin Hagemeister <https://github.com/marvinhagemeister>
|
||||
// Melvin Groenhoff <https://github.com/mgroenhoff>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
// TypeScript Version: 2.9
|
||||
|
||||
import { ParseOptions } from "@babel/parser";
|
||||
import { ParserOptions } from "@babel/parser";
|
||||
import { Expression, File, Program, Statement } from "@babel/types";
|
||||
|
||||
export interface TemplateBuilderOptions extends ParseOptions {
|
||||
export interface TemplateBuilderOptions extends ParserOptions {
|
||||
/**
|
||||
* A set of placeholder names to automatically accept. Items in this list do not need to match the given placeholder pattern.
|
||||
*/
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@babel/types": "^7.0.0-beta.54"
|
||||
"@babel/parser": "^7.1.0",
|
||||
"@babel/types": "^7.0.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,9 +20,6 @@
|
||||
"@babel/generator": [
|
||||
"babel__generator"
|
||||
],
|
||||
"@babel/parser": [
|
||||
"babel__parser"
|
||||
],
|
||||
"@babel/template": [
|
||||
"babel__template"
|
||||
]
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { parse } from "@babel/parser";
|
||||
import traverse, { Visitor } from "@babel/traverse";
|
||||
import * as t from "@babel/types";
|
||||
|
||||
@@ -21,11 +20,7 @@ const MyVisitor2: Visitor = {
|
||||
};
|
||||
|
||||
// Example from https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#babel-traverse
|
||||
const code = `function square(n) {
|
||||
return n * n;
|
||||
}`;
|
||||
|
||||
const ast = parse(code);
|
||||
declare const ast: t.Node;
|
||||
|
||||
traverse(ast, {
|
||||
enter(path) {
|
||||
|
||||
2
types/babel__traverse/index.d.ts
vendored
2
types/babel__traverse/index.d.ts
vendored
@@ -5,7 +5,7 @@
|
||||
// Ryan Petrich <https://github.com/rpetrich>
|
||||
// Melvin Groenhoff <https://github.com/mgroenhoff>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
// TypeScript Version: 2.9
|
||||
|
||||
import * as t from "@babel/types";
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@babel/types": "^7.0.0-beta.54"
|
||||
"@babel/types": "^7.0.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,9 +17,6 @@
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"paths": {
|
||||
"@babel/parser": [
|
||||
"babel__parser"
|
||||
],
|
||||
"@babel/traverse": [
|
||||
"babel__traverse"
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user