mirror of
https://github.com/crazy-max/ghaction-upx.git
synced 2025-12-11 07:20:42 -07:00
Update node_modules
This commit is contained in:
21
node_modules/@types/babel__core/LICENSE
generated
vendored
Normal file
21
node_modules/@types/babel__core/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE
|
||||
16
node_modules/@types/babel__core/README.md
generated
vendored
Normal file
16
node_modules/@types/babel__core/README.md
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
# Installation
|
||||
> `npm install --save @types/babel__core`
|
||||
|
||||
# Summary
|
||||
This package contains type definitions for @babel/core (https://github.com/babel/babel/tree/master/packages/babel-core).
|
||||
|
||||
# Details
|
||||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/babel__core
|
||||
|
||||
Additional Details
|
||||
* Last updated: Wed, 04 Sep 2019 17:40:11 GMT
|
||||
* Dependencies: @types/babel__generator, @types/babel__traverse, @types/babel__template, @types/babel__types, @types/babel__parser
|
||||
* Global values: babel
|
||||
|
||||
# Credits
|
||||
These definitions were written by Troy Gerwien <https://github.com/yortus>, Marvin Hagemeister <https://github.com/marvinhagemeister>, Melvin Groenhoff <https://github.com/mgroenhoff>, and Jessica Franco <https://github.com/Jessidhia>.
|
||||
687
node_modules/@types/babel__core/index.d.ts
generated
vendored
Normal file
687
node_modules/@types/babel__core/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,687 @@
|
||||
// Type definitions for @babel/core 7.1
|
||||
// Project: https://github.com/babel/babel/tree/master/packages/babel-core, https://babeljs.io
|
||||
// Definitions by: Troy Gerwien <https://github.com/yortus>
|
||||
// Marvin Hagemeister <https://github.com/marvinhagemeister>
|
||||
// Melvin Groenhoff <https://github.com/mgroenhoff>
|
||||
// Jessica Franco <https://github.com/Jessidhia>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// 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 { ParserOptions } from "@babel/parser";
|
||||
|
||||
export {
|
||||
ParserOptions,
|
||||
GeneratorOptions,
|
||||
t as types,
|
||||
template,
|
||||
traverse,
|
||||
NodePath,
|
||||
Visitor
|
||||
};
|
||||
|
||||
export type Node = t.Node;
|
||||
export type ParseResult = t.File | t.Program;
|
||||
export const version: string;
|
||||
export const DEFAULT_EXTENSIONS: ['.js', '.jsx', '.es6', '.es', '.mjs'];
|
||||
|
||||
export interface TransformOptions {
|
||||
/**
|
||||
* Include the AST in the returned object
|
||||
*
|
||||
* Default: `false`
|
||||
*/
|
||||
ast?: boolean | null;
|
||||
|
||||
/**
|
||||
* Attach a comment after all non-user injected code
|
||||
*
|
||||
* Default: `null`
|
||||
*/
|
||||
auxiliaryCommentAfter?: string | null;
|
||||
|
||||
/**
|
||||
* Attach a comment before all non-user injected code
|
||||
*
|
||||
* Default: `null`
|
||||
*/
|
||||
auxiliaryCommentBefore?: string | null;
|
||||
|
||||
/**
|
||||
* Specify the "root" folder that defines the location to search for "babel.config.js", and the default folder to allow `.babelrc` files inside of.
|
||||
*
|
||||
* Default: `"."`
|
||||
*/
|
||||
root?: string | null;
|
||||
|
||||
/**
|
||||
* This option, combined with the "root" value, defines how Babel chooses its project root.
|
||||
* The different modes define different ways that Babel can process the "root" value to get
|
||||
* the final project root.
|
||||
*
|
||||
* @see https://babeljs.io/docs/en/next/options#rootmode
|
||||
*/
|
||||
rootMode?: 'root' | 'upward' | 'upward-optional';
|
||||
|
||||
/**
|
||||
* The config file to load Babel's config from. Defaults to searching for "babel.config.js" inside the "root" folder. `false` will disable searching for config files.
|
||||
*
|
||||
* Default: `undefined`
|
||||
*/
|
||||
configFile?: string | false | null;
|
||||
|
||||
/**
|
||||
* Specify whether or not to use .babelrc and
|
||||
* .babelignore files.
|
||||
*
|
||||
* Default: `true`
|
||||
*/
|
||||
babelrc?: boolean | null;
|
||||
|
||||
/**
|
||||
* Specify which packages should be search for .babelrc files when they are being compiled. `true` to always search, or a path string or an array of paths to packages to search
|
||||
* inside of. Defaults to only searching the "root" package.
|
||||
*
|
||||
* Default: `(root)`
|
||||
*/
|
||||
babelrcRoots?: true | string | string[] | null;
|
||||
|
||||
/**
|
||||
* Defaults to environment variable `BABEL_ENV` if set, or else `NODE_ENV` if set, or else it defaults to `"development"`
|
||||
*
|
||||
* Default: env vars
|
||||
*/
|
||||
envName?: string;
|
||||
|
||||
/**
|
||||
* Enable code generation
|
||||
*
|
||||
* Default: `true`
|
||||
*/
|
||||
code?: boolean | null;
|
||||
|
||||
/**
|
||||
* Output comments in generated output
|
||||
*
|
||||
* Default: `true`
|
||||
*/
|
||||
comments?: boolean | null;
|
||||
|
||||
/**
|
||||
* Do not include superfluous whitespace characters and line terminators. When set to `"auto"` compact is set to `true` on input sizes of >500KB
|
||||
*
|
||||
* Default: `"auto"`
|
||||
*/
|
||||
compact?: boolean | "auto" | null;
|
||||
|
||||
/**
|
||||
* The working directory that Babel's programmatic options are loaded relative to.
|
||||
*
|
||||
* Default: `"."`
|
||||
*/
|
||||
cwd?: string | null;
|
||||
|
||||
/**
|
||||
* Utilities may pass a caller object to identify themselves to Babel and
|
||||
* pass capability-related flags for use by configs, presets and plugins.
|
||||
*
|
||||
* @see https://babeljs.io/docs/en/next/options#caller
|
||||
*/
|
||||
caller?: TransformCaller;
|
||||
|
||||
/**
|
||||
* This is an object of keys that represent different environments. For example, you may have: `{ env: { production: { \/* specific options *\/ } } }`
|
||||
* which will use those options when the `envName` is `production`
|
||||
*
|
||||
* Default: `{}`
|
||||
*/
|
||||
env?: { [index: string]: TransformOptions | null | undefined; } | null;
|
||||
|
||||
/**
|
||||
* A path to a `.babelrc` file to extend
|
||||
*
|
||||
* Default: `null`
|
||||
*/
|
||||
extends?: string | null;
|
||||
|
||||
/**
|
||||
* Filename for use in errors etc
|
||||
*
|
||||
* Default: `"unknown"`
|
||||
*/
|
||||
filename?: string | null;
|
||||
|
||||
/**
|
||||
* Filename relative to `sourceRoot`
|
||||
*
|
||||
* Default: `(filename)`
|
||||
*/
|
||||
filenameRelative?: string | null;
|
||||
|
||||
/**
|
||||
* An object containing the options to be passed down to the babel code generator, @babel/generator
|
||||
*
|
||||
* Default: `{}`
|
||||
*/
|
||||
generatorOpts?: GeneratorOptions | null;
|
||||
|
||||
/**
|
||||
* Specify a custom callback to generate a module id with. Called as `getModuleId(moduleName)`. If falsy value is returned then the generated module id is used
|
||||
*
|
||||
* Default: `null`
|
||||
*/
|
||||
getModuleId?: ((moduleName: string) => string | null | undefined) | null;
|
||||
|
||||
/**
|
||||
* ANSI highlight syntax error code frames
|
||||
*
|
||||
* Default: `true`
|
||||
*/
|
||||
highlightCode?: boolean | null;
|
||||
|
||||
/**
|
||||
* Opposite to the `only` option. `ignore` is disregarded if `only` is specified
|
||||
*
|
||||
* Default: `null`
|
||||
*/
|
||||
ignore?: string[] | null;
|
||||
|
||||
/**
|
||||
* A source map object that the output source map will be based on
|
||||
*
|
||||
* Default: `null`
|
||||
*/
|
||||
inputSourceMap?: object | null;
|
||||
|
||||
/**
|
||||
* Should the output be minified (not printing last semicolons in blocks, printing literal string values instead of escaped ones, stripping `()` from `new` when safe)
|
||||
*
|
||||
* Default: `false`
|
||||
*/
|
||||
minified?: boolean | null;
|
||||
|
||||
/**
|
||||
* Specify a custom name for module ids
|
||||
*
|
||||
* Default: `null`
|
||||
*/
|
||||
moduleId?: string | null;
|
||||
|
||||
/**
|
||||
* If truthy, insert an explicit id for modules. By default, all modules are anonymous. (Not available for `common` modules)
|
||||
*
|
||||
* Default: `false`
|
||||
*/
|
||||
moduleIds?: boolean | null;
|
||||
|
||||
/**
|
||||
* Optional prefix for the AMD module formatter that will be prepend to the filename on module definitions
|
||||
*
|
||||
* Default: `(sourceRoot)`
|
||||
*/
|
||||
moduleRoot?: string | null;
|
||||
|
||||
/**
|
||||
* A glob, regex, or mixed array of both, matching paths to **only** compile. Can also be an array of arrays containing paths to explicitly match. When attempting to compile
|
||||
* a non-matching file it's returned verbatim
|
||||
*
|
||||
* Default: `null`
|
||||
*/
|
||||
only?: string | RegExp | Array<string | RegExp> | null;
|
||||
|
||||
/**
|
||||
* An object containing the options to be passed down to the babel parser, @babel/parser
|
||||
*
|
||||
* Default: `{}`
|
||||
*/
|
||||
parserOpts?: ParserOptions | null;
|
||||
|
||||
/**
|
||||
* List of plugins to load and use
|
||||
*
|
||||
* Default: `[]`
|
||||
*/
|
||||
plugins?: PluginItem[] | null;
|
||||
|
||||
/**
|
||||
* List of presets (a set of plugins) to load and use
|
||||
*
|
||||
* Default: `[]`
|
||||
*/
|
||||
presets?: PluginItem[] | null;
|
||||
|
||||
/**
|
||||
* Retain line numbers. This will lead to wacky code but is handy for scenarios where you can't use source maps. (**NOTE**: This will not retain the columns)
|
||||
*
|
||||
* Default: `false`
|
||||
*/
|
||||
retainLines?: boolean | null;
|
||||
|
||||
/**
|
||||
* An optional callback that controls whether a comment should be output or not. Called as `shouldPrintComment(commentContents)`. **NOTE**: This overrides the `comment` option when used
|
||||
*
|
||||
* Default: `null`
|
||||
*/
|
||||
shouldPrintComment?: ((commentContents: string) => boolean) | null;
|
||||
|
||||
/**
|
||||
* Set `sources[0]` on returned source map
|
||||
*
|
||||
* Default: `(filenameRelative)`
|
||||
*/
|
||||
sourceFileName?: string | null;
|
||||
|
||||
/**
|
||||
* If truthy, adds a `map` property to returned output. If set to `"inline"`, a comment with a sourceMappingURL directive is added to the bottom of the returned code. If set to `"both"`
|
||||
* then a `map` property is returned as well as a source map comment appended. **This does not emit sourcemap files by itself!**
|
||||
*
|
||||
* Default: `false`
|
||||
*/
|
||||
sourceMaps?: boolean | "inline" | "both" | null;
|
||||
|
||||
/**
|
||||
* The root from which all sources are relative
|
||||
*
|
||||
* Default: `(moduleRoot)`
|
||||
*/
|
||||
sourceRoot?: string | null;
|
||||
|
||||
/**
|
||||
* Indicate the mode the code should be parsed in. Can be one of "script", "module", or "unambiguous". `"unambiguous"` will make Babel attempt to guess, based on the presence of ES6
|
||||
* `import` or `export` statements. Files with ES6 `import`s and `export`s are considered `"module"` and are otherwise `"script"`.
|
||||
*
|
||||
* Default: `("module")`
|
||||
*/
|
||||
sourceType?: "script" | "module" | "unambiguous" | null;
|
||||
|
||||
/**
|
||||
* An optional callback that can be used to wrap visitor methods. **NOTE**: This is useful for things like introspection, and not really needed for implementing anything. Called as
|
||||
* `wrapPluginVisitorMethod(pluginAlias, visitorType, callback)`.
|
||||
*/
|
||||
wrapPluginVisitorMethod?: ((pluginAlias: string, visitorType: "enter" | "exit", callback: (path: NodePath, state: any) => void) => (path: NodePath, state: any) => void) | null;
|
||||
}
|
||||
|
||||
export interface TransformCaller {
|
||||
// the only required property
|
||||
name: string;
|
||||
// e.g. set to true by `babel-loader` and false by `babel-jest`
|
||||
supportsStaticESM?: boolean;
|
||||
// augment this with a "declare module '@babel/core' { ... }" if you need more keys
|
||||
}
|
||||
|
||||
export type FileResultCallback = (err: Error | null, result: BabelFileResult | null) => any;
|
||||
|
||||
/**
|
||||
* Transforms the passed in code. Calling a callback with an object with the generated code, source map, and AST.
|
||||
*/
|
||||
export function transform(code: string, callback: FileResultCallback): void;
|
||||
|
||||
/**
|
||||
* Transforms the passed in code. Calling a callback with an object with the generated code, source map, and AST.
|
||||
*/
|
||||
export function transform(code: string, opts: TransformOptions | undefined, callback: FileResultCallback): void;
|
||||
|
||||
/**
|
||||
* Here for backward-compatibility. Ideally use `transformSync` if you want a synchronous API.
|
||||
*/
|
||||
export function transform(code: string, opts?: TransformOptions): BabelFileResult | null;
|
||||
|
||||
/**
|
||||
* Transforms the passed in code. Returning an object with the generated code, source map, and AST.
|
||||
*/
|
||||
export function transformSync(code: string, opts?: TransformOptions): BabelFileResult | null;
|
||||
|
||||
/**
|
||||
* Transforms the passed in code. Calling a callback with an object with the generated code, source map, and AST.
|
||||
*/
|
||||
export function transformAsync(code: string, opts?: TransformOptions): Promise<BabelFileResult | null>;
|
||||
|
||||
/**
|
||||
* Asynchronously transforms the entire contents of a file.
|
||||
*/
|
||||
export function transformFile(filename: string, callback: FileResultCallback): void;
|
||||
|
||||
/**
|
||||
* Asynchronously transforms the entire contents of a file.
|
||||
*/
|
||||
export function transformFile(filename: string, opts: TransformOptions | undefined, callback: FileResultCallback): void;
|
||||
|
||||
/**
|
||||
* Synchronous version of `babel.transformFile`. Returns the transformed contents of the `filename`.
|
||||
*/
|
||||
export function transformFileSync(filename: string, opts?: TransformOptions): BabelFileResult | null;
|
||||
|
||||
/**
|
||||
* Asynchronously transforms the entire contents of a file.
|
||||
*/
|
||||
export function transformFileAsync(filename: string, opts?: TransformOptions): Promise<BabelFileResult | null>;
|
||||
|
||||
/**
|
||||
* Given an AST, transform it.
|
||||
*/
|
||||
export function transformFromAst(ast: Node, code: string | undefined, callback: FileResultCallback): void;
|
||||
|
||||
/**
|
||||
* Given an AST, transform it.
|
||||
*/
|
||||
export function transformFromAst(ast: Node, code: string | undefined, opts: TransformOptions | undefined, callback: FileResultCallback): void;
|
||||
|
||||
/**
|
||||
* Here for backward-compatibility. Ideally use ".transformSync" if you want a synchronous API.
|
||||
*/
|
||||
export function transformFromAstSync(ast: Node, code?: string, opts?: TransformOptions): BabelFileResult | null;
|
||||
|
||||
/**
|
||||
* Given an AST, transform it.
|
||||
*/
|
||||
export function transformFromAstAsync(ast: Node, code?: string, opts?: TransformOptions): Promise<BabelFileResult | null>;
|
||||
|
||||
// A babel plugin is a simple function which must return an object matching
|
||||
// the following interface. Babel will throw if it finds unknown properties.
|
||||
// The list of allowed plugin keys is here:
|
||||
// https://github.com/babel/babel/blob/4e50b2d9d9c376cee7a2cbf56553fe5b982ea53c/packages/babel-core/src/config/option-manager.js#L71
|
||||
export interface PluginObj<S = {}> {
|
||||
name?: string;
|
||||
manipulateOptions?(opts: any, parserOpts: any): void;
|
||||
pre?(this: S, state: any): void;
|
||||
visitor: Visitor<S>;
|
||||
post?(this: S, state: any): void;
|
||||
inherits?: any;
|
||||
}
|
||||
|
||||
export interface BabelFileResult {
|
||||
ast?: t.File | null;
|
||||
code?: string | null;
|
||||
ignored?: boolean;
|
||||
map?: {
|
||||
version: number;
|
||||
sources: string[];
|
||||
names: string[];
|
||||
sourceRoot?: string;
|
||||
sourcesContent?: string[];
|
||||
mappings: string;
|
||||
file: string;
|
||||
} | null;
|
||||
metadata?: BabelFileMetadata;
|
||||
}
|
||||
|
||||
export interface BabelFileMetadata {
|
||||
usedHelpers: string[];
|
||||
marked: Array<{
|
||||
type: string;
|
||||
message: string;
|
||||
loc: object;
|
||||
}>;
|
||||
modules: BabelFileModulesMetadata;
|
||||
}
|
||||
|
||||
export interface BabelFileModulesMetadata {
|
||||
imports: object[];
|
||||
exports: {
|
||||
exported: object[];
|
||||
specifiers: object[];
|
||||
};
|
||||
}
|
||||
|
||||
export type FileParseCallback = (err: Error | null, result: ParseResult | null) => any;
|
||||
|
||||
/**
|
||||
* Given some code, parse it using Babel's standard behavior.
|
||||
* Referenced presets and plugins will be loaded such that optional syntax plugins are automatically enabled.
|
||||
*/
|
||||
export function parse(code: string, callback: FileParseCallback): void;
|
||||
|
||||
/**
|
||||
* Given some code, parse it using Babel's standard behavior.
|
||||
* Referenced presets and plugins will be loaded such that optional syntax plugins are automatically enabled.
|
||||
*/
|
||||
export function parse(code: string, options: TransformOptions | undefined, callback: FileParseCallback): void;
|
||||
|
||||
/**
|
||||
* Given some code, parse it using Babel's standard behavior.
|
||||
* Referenced presets and plugins will be loaded such that optional syntax plugins are automatically enabled.
|
||||
*/
|
||||
export function parse(code: string, options?: TransformOptions): ParseResult | null;
|
||||
|
||||
/**
|
||||
* Given some code, parse it using Babel's standard behavior.
|
||||
* Referenced presets and plugins will be loaded such that optional syntax plugins are automatically enabled.
|
||||
*/
|
||||
export function parseSync(code: string, options?: TransformOptions): ParseResult | null;
|
||||
|
||||
/**
|
||||
* Given some code, parse it using Babel's standard behavior.
|
||||
* Referenced presets and plugins will be loaded such that optional syntax plugins are automatically enabled.
|
||||
*/
|
||||
export function parseAsync(code: string, options?: TransformOptions): Promise<ParseResult | null>;
|
||||
|
||||
/**
|
||||
* Resolve Babel's options fully, resulting in an options object where:
|
||||
*
|
||||
* * opts.plugins is a full list of Plugin instances.
|
||||
* * opts.presets is empty and all presets are flattened into opts.
|
||||
* * It can be safely passed back to Babel. Fields like babelrc have been set to false so that later calls to Babel
|
||||
* will not make a second attempt to load config files.
|
||||
*
|
||||
* Plugin instances aren't meant to be manipulated directly, but often callers will serialize this opts to JSON to
|
||||
* use it as a cache key representing the options Babel has received. Caching on this isn't 100% guaranteed to
|
||||
* invalidate properly, but it is the best we have at the moment.
|
||||
*/
|
||||
export function loadOptions(options?: TransformOptions): object | null;
|
||||
|
||||
/**
|
||||
* To allow systems to easily manipulate and validate a user's config, this function resolves the plugins and
|
||||
* presets and proceeds no further. The expectation is that callers will take the config's .options, manipulate it
|
||||
* as then see fit and pass it back to Babel again.
|
||||
*
|
||||
* * `babelrc: string | void` - The path of the `.babelrc` file, if there was one.
|
||||
* * `babelignore: string | void` - The path of the `.babelignore` file, if there was one.
|
||||
* * `options: ValidatedOptions` - The partially resolved options, which can be manipulated and passed back
|
||||
* to Babel again.
|
||||
* * `plugins: Array<ConfigItem>` - See below.
|
||||
* * `presets: Array<ConfigItem>` - See below.
|
||||
* * It can be safely passed back to Babel. Fields like `babelrc` have been set to false so that later calls to
|
||||
* Babel will not make a second attempt to load config files.
|
||||
*
|
||||
* `ConfigItem` instances expose properties to introspect the values, but each item should be treated as
|
||||
* immutable. If changes are desired, the item should be removed from the list and replaced with either a normal
|
||||
* Babel config value, or with a replacement item created by `babel.createConfigItem`. See that function for
|
||||
* information about `ConfigItem` fields.
|
||||
*/
|
||||
export function loadPartialConfig(options?: TransformOptions): Readonly<PartialConfig> | null;
|
||||
|
||||
export interface PartialConfig {
|
||||
options: TransformOptions;
|
||||
babelrc?: string;
|
||||
babelignore?: string;
|
||||
config?: string;
|
||||
}
|
||||
|
||||
export interface ConfigItem {
|
||||
/**
|
||||
* The name that the user gave the plugin instance, e.g. `plugins: [ ['env', {}, 'my-env'] ]`
|
||||
*/
|
||||
name?: string;
|
||||
|
||||
/**
|
||||
* The resolved value of the plugin.
|
||||
*/
|
||||
value: object | ((...args: any[]) => any);
|
||||
|
||||
/**
|
||||
* The options object passed to the plugin.
|
||||
*/
|
||||
options?: object | false;
|
||||
|
||||
/**
|
||||
* The path that the options are relative to.
|
||||
*/
|
||||
dirname: string;
|
||||
|
||||
/**
|
||||
* Information about the plugin's file, if Babel knows it.
|
||||
* *
|
||||
*/
|
||||
file?: {
|
||||
/**
|
||||
* The file that the user requested, e.g. `"@babel/env"`
|
||||
*/
|
||||
request: string;
|
||||
|
||||
/**
|
||||
* The full path of the resolved file, e.g. `"/tmp/node_modules/@babel/preset-env/lib/index.js"`
|
||||
*/
|
||||
resolved: string;
|
||||
} | null;
|
||||
}
|
||||
|
||||
export type PluginOptions = object | undefined | false;
|
||||
|
||||
export type PluginTarget = string | object | ((...args: any[]) => any);
|
||||
|
||||
export type PluginItem = ConfigItem | PluginObj<any> | PluginTarget | [PluginTarget, PluginOptions] | [PluginTarget, PluginOptions, string | undefined];
|
||||
|
||||
export function resolvePlugin(name: string, dirname: string): string | null;
|
||||
export function resolvePreset(name: string, dirname: string): string | null;
|
||||
|
||||
export interface CreateConfigItemOptions {
|
||||
dirname?: string;
|
||||
type?: "preset" | "plugin";
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows build tooling to create and cache config items up front. If this function is called multiple times for a
|
||||
* given plugin, Babel will call the plugin's function itself multiple times. If you have a clear set of expected
|
||||
* plugins and presets to inject, pre-constructing the config items would be recommended.
|
||||
*/
|
||||
export function createConfigItem(value: PluginTarget | [PluginTarget, PluginOptions] | [PluginTarget, PluginOptions, string | undefined], options?: CreateConfigItemOptions): ConfigItem;
|
||||
|
||||
// NOTE: the documentation says the ConfigAPI also exposes @babel/core's exports, but it actually doesn't
|
||||
/**
|
||||
* @see https://babeljs.io/docs/en/next/config-files#config-function-api
|
||||
*/
|
||||
export interface ConfigAPI {
|
||||
/**
|
||||
* The version string for the Babel version that is loading the config file.
|
||||
*
|
||||
* @see https://babeljs.io/docs/en/next/config-files#apiversion
|
||||
*/
|
||||
version: string;
|
||||
/**
|
||||
* @see https://babeljs.io/docs/en/next/config-files#apicache
|
||||
*/
|
||||
cache: SimpleCacheConfigurator;
|
||||
/**
|
||||
* @see https://babeljs.io/docs/en/next/config-files#apienv
|
||||
*/
|
||||
env: EnvFunction;
|
||||
// undocumented; currently hardcoded to return 'false'
|
||||
// async(): boolean
|
||||
/**
|
||||
* This API is used as a way to access the `caller` data that has been passed to Babel.
|
||||
* Since many instances of Babel may be running in the same process with different `caller` values,
|
||||
* this API is designed to automatically configure `api.cache`, the same way `api.env()` does.
|
||||
*
|
||||
* The `caller` value is available as the first parameter of the callback function.
|
||||
* It is best used with something like this to toggle configuration behavior
|
||||
* based on a specific environment:
|
||||
*
|
||||
* @example
|
||||
* function isBabelRegister(caller?: { name: string }) {
|
||||
* return !!(caller && caller.name === "@babel/register")
|
||||
* }
|
||||
* api.caller(isBabelRegister)
|
||||
*
|
||||
* @see https://babeljs.io/docs/en/next/config-files#apicallercb
|
||||
*/
|
||||
caller<T extends SimpleCacheKey>(callerCallback: (caller: TransformOptions['caller']) => T): T;
|
||||
/**
|
||||
* While `api.version` can be useful in general, it's sometimes nice to just declare your version.
|
||||
* This API exposes a simple way to do that with:
|
||||
*
|
||||
* @example
|
||||
* api.assertVersion(7) // major version only
|
||||
* api.assertVersion("^7.2")
|
||||
*
|
||||
* @see https://babeljs.io/docs/en/next/config-files#apiassertversionrange
|
||||
*/
|
||||
assertVersion(versionRange: number | string): boolean;
|
||||
// NOTE: this is an undocumented reexport from "@babel/parser" but it's missing from its types
|
||||
// tokTypes: typeof tokTypes
|
||||
}
|
||||
|
||||
/**
|
||||
* JS configs are great because they can compute a config on the fly,
|
||||
* but the downside there is that it makes caching harder.
|
||||
* Babel wants to avoid re-executing the config function every time a file is compiled,
|
||||
* because then it would also need to re-execute any plugin and preset functions
|
||||
* referenced in that config.
|
||||
*
|
||||
* To avoid this, Babel expects users of config functions to tell it how to manage caching
|
||||
* within a config file.
|
||||
*
|
||||
* @see https://babeljs.io/docs/en/next/config-files#apicache
|
||||
*/
|
||||
export interface SimpleCacheConfigurator {
|
||||
// there is an undocumented call signature that is a shorthand for forever()/never()/using().
|
||||
// (ever: boolean): void
|
||||
// <T extends SimpleCacheKey>(callback: CacheCallback<T>): T
|
||||
/**
|
||||
* Permacache the computed config and never call the function again.
|
||||
*/
|
||||
forever(): void;
|
||||
/**
|
||||
* Do not cache this config, and re-execute the function every time.
|
||||
*/
|
||||
never(): void;
|
||||
/**
|
||||
* Any time the using callback returns a value other than the one that was expected,
|
||||
* the overall config function will be called again and a new entry will be added to the cache.
|
||||
*
|
||||
* @example
|
||||
* api.cache.using(() => process.env.NODE_ENV)
|
||||
*/
|
||||
using<T extends SimpleCacheKey>(callback: SimpleCacheCallback<T>): T;
|
||||
/**
|
||||
* Any time the using callback returns a value other than the one that was expected,
|
||||
* the overall config function will be called again and all entries in the cache will
|
||||
* be replaced with the result.
|
||||
*
|
||||
* @example
|
||||
* api.cache.invalidate(() => process.env.NODE_ENV)
|
||||
*/
|
||||
invalidate<T extends SimpleCacheKey>(callback: SimpleCacheCallback<T>): T;
|
||||
}
|
||||
|
||||
// https://github.com/babel/babel/blob/v7.3.3/packages/babel-core/src/config/caching.js#L231
|
||||
export type SimpleCacheKey = string | boolean | number | null | undefined;
|
||||
export type SimpleCacheCallback<T extends SimpleCacheKey> = () => T;
|
||||
|
||||
/**
|
||||
* Since `NODE_ENV` is a fairly common way to toggle behavior, Babel also includes an API function
|
||||
* meant specifically for that. This API is used as a quick way to check the `"envName"` that Babel
|
||||
* was loaded with, which takes `NODE_ENV` into account if no other overriding environment is set.
|
||||
*
|
||||
* @see https://babeljs.io/docs/en/next/config-files#apienv
|
||||
*/
|
||||
export interface EnvFunction {
|
||||
/**
|
||||
* @returns the current `envName` string
|
||||
*/
|
||||
(): string;
|
||||
/**
|
||||
* @returns `true` if the `envName` is `===` any of the given strings
|
||||
*/
|
||||
(envName: string | ReadonlyArray<string>): boolean;
|
||||
// the official documentation is misleading for this one...
|
||||
// this just passes the callback to `cache.using` but with an additional argument.
|
||||
// it returns its result instead of necessarily returning a boolean.
|
||||
<T extends SimpleCacheKey>(envCallback: (envName: NonNullable<TransformOptions['envName']>) => T): T;
|
||||
}
|
||||
|
||||
export type ConfigFunction = (api: ConfigAPI) => TransformOptions;
|
||||
|
||||
export as namespace babel;
|
||||
71
node_modules/@types/babel__core/package.json
generated
vendored
Normal file
71
node_modules/@types/babel__core/package.json
generated
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
{
|
||||
"_from": "@types/babel__core@^7.1.0",
|
||||
"_id": "@types/babel__core@7.1.3",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-8fBo0UR2CcwWxeX7WIIgJ7lXjasFxoYgRnFHUj+hRvKkpiBJbxhdAPTCY6/ZKM0uxANFVzt4yObSLuTiTnazDA==",
|
||||
"_location": "/@types/babel__core",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "@types/babel__core@^7.1.0",
|
||||
"name": "@types/babel__core",
|
||||
"escapedName": "@types%2fbabel__core",
|
||||
"scope": "@types",
|
||||
"rawSpec": "^7.1.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^7.1.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/babel-jest"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.1.3.tgz",
|
||||
"_shasum": "e441ea7df63cd080dfcd02ab199e6d16a735fc30",
|
||||
"_spec": "@types/babel__core@^7.1.0",
|
||||
"_where": "/home/runner/work/ghaction-upx/ghaction-upx/node_modules/babel-jest",
|
||||
"bugs": {
|
||||
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Troy Gerwien",
|
||||
"url": "https://github.com/yortus"
|
||||
},
|
||||
{
|
||||
"name": "Marvin Hagemeister",
|
||||
"url": "https://github.com/marvinhagemeister"
|
||||
},
|
||||
{
|
||||
"name": "Melvin Groenhoff",
|
||||
"url": "https://github.com/mgroenhoff"
|
||||
},
|
||||
{
|
||||
"name": "Jessica Franco",
|
||||
"url": "https://github.com/Jessidhia"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"@babel/parser": "^7.1.0",
|
||||
"@babel/types": "^7.0.0",
|
||||
"@types/babel__generator": "*",
|
||||
"@types/babel__template": "*",
|
||||
"@types/babel__traverse": "*"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "TypeScript definitions for @babel/core",
|
||||
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped#readme",
|
||||
"license": "MIT",
|
||||
"main": "",
|
||||
"name": "@types/babel__core",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
||||
"directory": "types/babel__core"
|
||||
},
|
||||
"scripts": {},
|
||||
"typeScriptVersion": "2.9",
|
||||
"types": "index",
|
||||
"typesPublisherContentHash": "478fc636b3b91d2d8148bbc98176f96231386926f4af91893dbe95d3812775a5",
|
||||
"version": "7.1.3"
|
||||
}
|
||||
21
node_modules/@types/babel__generator/LICENSE
generated
vendored
Normal file
21
node_modules/@types/babel__generator/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE
|
||||
16
node_modules/@types/babel__generator/README.md
generated
vendored
Normal file
16
node_modules/@types/babel__generator/README.md
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
# Installation
|
||||
> `npm install --save @types/babel__generator`
|
||||
|
||||
# Summary
|
||||
This package contains type definitions for @babel/generator (https://github.com/babel/babel/tree/master/packages/babel-generator).
|
||||
|
||||
# Details
|
||||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/babel__generator.
|
||||
|
||||
### Additional Details
|
||||
* Last updated: Tue, 10 Dec 2019 19:31:19 GMT
|
||||
* Dependencies: [@types/babel__types](https://npmjs.com/package/@types/babel__types)
|
||||
* Global values: none
|
||||
|
||||
# Credits
|
||||
These definitions were written by Troy Gerwien (https://github.com/yortus), Johnny Estilles (https://github.com/johnnyestilles), Melvin Groenhoff (https://github.com/mgroenhoff), Cameron Yan (https://github.com/khell), and Lyanbin (https://github.com/Lyanbin).
|
||||
212
node_modules/@types/babel__generator/index.d.ts
generated
vendored
Normal file
212
node_modules/@types/babel__generator/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,212 @@
|
||||
// Type definitions for @babel/generator 7.6
|
||||
// Project: https://github.com/babel/babel/tree/master/packages/babel-generator, https://babeljs.io
|
||||
// Definitions by: Troy Gerwien <https://github.com/yortus>
|
||||
// Johnny Estilles <https://github.com/johnnyestilles>
|
||||
// Melvin Groenhoff <https://github.com/mgroenhoff>
|
||||
// Cameron Yan <https://github.com/khell>
|
||||
// Lyanbin <https://github.com/Lyanbin>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.9
|
||||
|
||||
import * as t from '@babel/types';
|
||||
|
||||
export interface GeneratorOptions {
|
||||
/**
|
||||
* Optional string to add as a block comment at the start of the output file.
|
||||
*/
|
||||
auxiliaryCommentBefore?: string;
|
||||
|
||||
/**
|
||||
* Optional string to add as a block comment at the end of the output file.
|
||||
*/
|
||||
auxiliaryCommentAfter?: string;
|
||||
|
||||
/**
|
||||
* Function that takes a comment (as a string) and returns true if the comment should be included in the output.
|
||||
* By default, comments are included if `opts.comments` is `true` or if `opts.minifed` is `false` and the comment
|
||||
* contains `@preserve` or `@license`.
|
||||
*/
|
||||
shouldPrintComment?(comment: string): boolean;
|
||||
|
||||
/**
|
||||
* Attempt to use the same line numbers in the output code as in the source code (helps preserve stack traces).
|
||||
* Defaults to `false`.
|
||||
*/
|
||||
retainLines?: boolean;
|
||||
|
||||
/**
|
||||
* Retain parens around function expressions (could be used to change engine parsing behavior)
|
||||
* Defaults to `false`.
|
||||
*/
|
||||
retainFunctionParens?: boolean;
|
||||
|
||||
/**
|
||||
* Should comments be included in output? Defaults to `true`.
|
||||
*/
|
||||
comments?: boolean;
|
||||
|
||||
/**
|
||||
* Set to true to avoid adding whitespace for formatting. Defaults to the value of `opts.minified`.
|
||||
*/
|
||||
compact?: boolean | 'auto';
|
||||
|
||||
/**
|
||||
* Should the output be minified. Defaults to `false`.
|
||||
*/
|
||||
minified?: boolean;
|
||||
|
||||
/**
|
||||
* Set to true to reduce whitespace (but not as much as opts.compact). Defaults to `false`.
|
||||
*/
|
||||
concise?: boolean;
|
||||
|
||||
/**
|
||||
* Used in warning messages
|
||||
*/
|
||||
filename?: string;
|
||||
|
||||
/**
|
||||
* Enable generating source maps. Defaults to `false`.
|
||||
*/
|
||||
sourceMaps?: boolean;
|
||||
|
||||
/**
|
||||
* A root for all relative URLs in the source map.
|
||||
*/
|
||||
sourceRoot?: string;
|
||||
|
||||
/**
|
||||
* The filename for the source code (i.e. the code in the `code` argument).
|
||||
* This will only be used if `code` is a string.
|
||||
*/
|
||||
sourceFileName?: string;
|
||||
|
||||
/**
|
||||
* Set to true to run jsesc with "json": true to print "\u00A9" vs. "©";
|
||||
*/
|
||||
jsonCompatibleStrings?: boolean;
|
||||
|
||||
/**
|
||||
* Set to true to enable support for experimental decorators syntax before module exports.
|
||||
* Defaults to `false`.
|
||||
*/
|
||||
decoratorsBeforeExport?: boolean;
|
||||
|
||||
/**
|
||||
* Options for outputting jsesc representation.
|
||||
*/
|
||||
jsescOption?: {
|
||||
/**
|
||||
* The default value for the quotes option is 'single'. This means that any occurrences of ' in the input
|
||||
* string are escaped as \', so that the output can be used in a string literal wrapped in single quotes.
|
||||
*/
|
||||
quotes?: 'single' | 'double' | 'backtick';
|
||||
|
||||
/**
|
||||
* The default value for the numbers option is 'decimal'. This means that any numeric values are represented
|
||||
* using decimal integer literals. Other valid options are binary, octal, and hexadecimal, which result in
|
||||
* binary integer literals, octal integer literals, and hexadecimal integer literals, respectively.
|
||||
*/
|
||||
numbers?: 'binary' | 'octal' | 'decimal' | 'hexadecimal';
|
||||
|
||||
/**
|
||||
* The wrap option takes a boolean value (true or false), and defaults to false (disabled). When enabled, the
|
||||
* output is a valid JavaScript string literal wrapped in quotes. The type of quotes can be specified through
|
||||
* the quotes setting.
|
||||
*/
|
||||
wrap?: boolean;
|
||||
|
||||
/**
|
||||
* The es6 option takes a boolean value (true or false), and defaults to false (disabled). When enabled, any
|
||||
* astral Unicode symbols in the input are escaped using ECMAScript 6 Unicode code point escape sequences
|
||||
* instead of using separate escape sequences for each surrogate half. If backwards compatibility with ES5
|
||||
* environments is a concern, don’t enable this setting. If the json setting is enabled, the value for the es6
|
||||
* setting is ignored (as if it was false).
|
||||
*/
|
||||
es6?: boolean;
|
||||
|
||||
/**
|
||||
* The escapeEverything option takes a boolean value (true or false), and defaults to false (disabled). When
|
||||
* enabled, all the symbols in the output are escaped — even printable ASCII symbols.
|
||||
*/
|
||||
escapeEverything?: boolean;
|
||||
|
||||
/**
|
||||
* The minimal option takes a boolean value (true or false), and defaults to false (disabled). When enabled,
|
||||
* only a limited set of symbols in the output are escaped: \0, \b, \t, \n, \f, \r, \\, \u2028, \u2029.
|
||||
*/
|
||||
minimal?: boolean;
|
||||
|
||||
/**
|
||||
* The isScriptContext option takes a boolean value (true or false), and defaults to false (disabled). When
|
||||
* enabled, occurrences of </script and </style in the output are escaped as <\/script and <\/style, and <!--
|
||||
* is escaped as \x3C!-- (or \u003C!-- when the json option is enabled). This setting is useful when jsesc’s
|
||||
* output ends up as part of a <script> or <style> element in an HTML document.
|
||||
*/
|
||||
isScriptContext?: boolean;
|
||||
|
||||
/**
|
||||
* The compact option takes a boolean value (true or false), and defaults to true (enabled). When enabled,
|
||||
* the output for arrays and objects is as compact as possible; it’s not formatted nicely.
|
||||
*/
|
||||
compact?: boolean;
|
||||
|
||||
/**
|
||||
* The indent option takes a string value, and defaults to '\t'. When the compact setting is enabled (true),
|
||||
* the value of the indent option is used to format the output for arrays and objects.
|
||||
*/
|
||||
indent?: string;
|
||||
|
||||
/**
|
||||
* The indentLevel option takes a numeric value, and defaults to 0. It represents the current indentation level,
|
||||
* i.e. the number of times the value of the indent option is repeated.
|
||||
*/
|
||||
indentLevel?: number;
|
||||
|
||||
/**
|
||||
* The json option takes a boolean value (true or false), and defaults to false (disabled). When enabled, the
|
||||
* output is valid JSON. Hexadecimal character escape sequences and the \v or \0 escape sequences are not used.
|
||||
* Setting json: true implies quotes: 'double', wrap: true, es6: false, although these values can still be
|
||||
* overridden if needed — but in such cases, the output won’t be valid JSON anymore.
|
||||
*/
|
||||
json?: boolean;
|
||||
|
||||
/**
|
||||
* The lowercaseHex option takes a boolean value (true or false), and defaults to false (disabled). When enabled,
|
||||
* any alphabetical hexadecimal digits in escape sequences as well as any hexadecimal integer literals (see the
|
||||
* numbers option) in the output are in lowercase.
|
||||
*/
|
||||
lowercaseHex?: boolean;
|
||||
};
|
||||
}
|
||||
|
||||
export class CodeGenerator {
|
||||
constructor(ast: t.Node, opts?: GeneratorOptions, code?: string);
|
||||
generate(): GeneratorResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* Turns an AST into code, maintaining sourcemaps, user preferences, and valid output.
|
||||
* @param ast - the abstract syntax tree from which to generate output code.
|
||||
* @param opts - used for specifying options for code generation.
|
||||
* @param code - the original source code, used for source maps.
|
||||
* @returns - an object containing the output code and source map.
|
||||
*/
|
||||
export default function generate(
|
||||
ast: t.Node,
|
||||
opts?: GeneratorOptions,
|
||||
code?: string | { [filename: string]: string },
|
||||
): GeneratorResult;
|
||||
|
||||
export interface GeneratorResult {
|
||||
code: string;
|
||||
map: {
|
||||
version: number;
|
||||
sources: string[];
|
||||
names: string[];
|
||||
sourceRoot?: string;
|
||||
sourcesContent?: string[];
|
||||
mappings: string;
|
||||
file: string;
|
||||
} | null;
|
||||
}
|
||||
22
node_modules/@types/babel__generator/node_modules/@babel/types/LICENSE
generated
vendored
Normal file
22
node_modules/@types/babel__generator/node_modules/@babel/types/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2014-present Sebastian McKenzie and other contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
19
node_modules/@types/babel__generator/node_modules/@babel/types/README.md
generated
vendored
Normal file
19
node_modules/@types/babel__generator/node_modules/@babel/types/README.md
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
# @babel/types
|
||||
|
||||
> Babel Types is a Lodash-esque utility library for AST nodes
|
||||
|
||||
See our website [@babel/types](https://babeljs.io/docs/en/next/babel-types.html) for more information or the [issues](https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22pkg%3A%20types%22+is%3Aopen) associated with this package.
|
||||
|
||||
## Install
|
||||
|
||||
Using npm:
|
||||
|
||||
```sh
|
||||
npm install --save-dev @babel/types
|
||||
```
|
||||
|
||||
or using yarn:
|
||||
|
||||
```sh
|
||||
yarn add @babel/types --dev
|
||||
```
|
||||
17
node_modules/@types/babel__generator/node_modules/@babel/types/lib/asserts/assertNode.js
generated
vendored
Normal file
17
node_modules/@types/babel__generator/node_modules/@babel/types/lib/asserts/assertNode.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = assertNode;
|
||||
|
||||
var _isNode = _interopRequireDefault(require("../validators/isNode"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function assertNode(node) {
|
||||
if (!(0, _isNode.default)(node)) {
|
||||
const type = node && node.type || JSON.stringify(node);
|
||||
throw new TypeError(`Not a valid node of type "${type}"`);
|
||||
}
|
||||
}
|
||||
1429
node_modules/@types/babel__generator/node_modules/@babel/types/lib/asserts/generated/index.js
generated
vendored
Normal file
1429
node_modules/@types/babel__generator/node_modules/@babel/types/lib/asserts/generated/index.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
42
node_modules/@types/babel__generator/node_modules/@babel/types/lib/builders/builder.js
generated
vendored
Normal file
42
node_modules/@types/babel__generator/node_modules/@babel/types/lib/builders/builder.js
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = builder;
|
||||
|
||||
var _clone = _interopRequireDefault(require("lodash/clone"));
|
||||
|
||||
var _definitions = require("../definitions");
|
||||
|
||||
var _validate = _interopRequireDefault(require("../validators/validate"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function builder(type, ...args) {
|
||||
const keys = _definitions.BUILDER_KEYS[type];
|
||||
const countArgs = args.length;
|
||||
|
||||
if (countArgs > keys.length) {
|
||||
throw new Error(`${type}: Too many arguments passed. Received ${countArgs} but can receive no more than ${keys.length}`);
|
||||
}
|
||||
|
||||
const node = {
|
||||
type
|
||||
};
|
||||
let i = 0;
|
||||
keys.forEach(key => {
|
||||
const field = _definitions.NODE_FIELDS[type][key];
|
||||
let arg;
|
||||
if (i < countArgs) arg = args[i];
|
||||
if (arg === undefined) arg = (0, _clone.default)(field.default);
|
||||
node[key] = arg;
|
||||
i++;
|
||||
});
|
||||
|
||||
for (const key of Object.keys(node)) {
|
||||
(0, _validate.default)(node, key, node[key]);
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
28
node_modules/@types/babel__generator/node_modules/@babel/types/lib/builders/flow/createTypeAnnotationBasedOnTypeof.js
generated
vendored
Normal file
28
node_modules/@types/babel__generator/node_modules/@babel/types/lib/builders/flow/createTypeAnnotationBasedOnTypeof.js
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = createTypeAnnotationBasedOnTypeof;
|
||||
|
||||
var _generated = require("../generated");
|
||||
|
||||
function createTypeAnnotationBasedOnTypeof(type) {
|
||||
if (type === "string") {
|
||||
return (0, _generated.stringTypeAnnotation)();
|
||||
} else if (type === "number") {
|
||||
return (0, _generated.numberTypeAnnotation)();
|
||||
} else if (type === "undefined") {
|
||||
return (0, _generated.voidTypeAnnotation)();
|
||||
} else if (type === "boolean") {
|
||||
return (0, _generated.booleanTypeAnnotation)();
|
||||
} else if (type === "function") {
|
||||
return (0, _generated.genericTypeAnnotation)((0, _generated.identifier)("Function"));
|
||||
} else if (type === "object") {
|
||||
return (0, _generated.genericTypeAnnotation)((0, _generated.identifier)("Object"));
|
||||
} else if (type === "symbol") {
|
||||
return (0, _generated.genericTypeAnnotation)((0, _generated.identifier)("Symbol"));
|
||||
} else {
|
||||
throw new Error("Invalid typeof value");
|
||||
}
|
||||
}
|
||||
22
node_modules/@types/babel__generator/node_modules/@babel/types/lib/builders/flow/createUnionTypeAnnotation.js
generated
vendored
Normal file
22
node_modules/@types/babel__generator/node_modules/@babel/types/lib/builders/flow/createUnionTypeAnnotation.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = createUnionTypeAnnotation;
|
||||
|
||||
var _generated = require("../generated");
|
||||
|
||||
var _removeTypeDuplicates = _interopRequireDefault(require("../../modifications/flow/removeTypeDuplicates"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function createUnionTypeAnnotation(types) {
|
||||
const flattened = (0, _removeTypeDuplicates.default)(types);
|
||||
|
||||
if (flattened.length === 1) {
|
||||
return flattened[0];
|
||||
} else {
|
||||
return (0, _generated.unionTypeAnnotation)(flattened);
|
||||
}
|
||||
}
|
||||
1203
node_modules/@types/babel__generator/node_modules/@babel/types/lib/builders/generated/index.js
generated
vendored
Normal file
1203
node_modules/@types/babel__generator/node_modules/@babel/types/lib/builders/generated/index.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
31
node_modules/@types/babel__generator/node_modules/@babel/types/lib/builders/react/buildChildren.js
generated
vendored
Normal file
31
node_modules/@types/babel__generator/node_modules/@babel/types/lib/builders/react/buildChildren.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = buildChildren;
|
||||
|
||||
var _generated = require("../../validators/generated");
|
||||
|
||||
var _cleanJSXElementLiteralChild = _interopRequireDefault(require("../../utils/react/cleanJSXElementLiteralChild"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function buildChildren(node) {
|
||||
const elements = [];
|
||||
|
||||
for (let i = 0; i < node.children.length; i++) {
|
||||
let child = node.children[i];
|
||||
|
||||
if ((0, _generated.isJSXText)(child)) {
|
||||
(0, _cleanJSXElementLiteralChild.default)(child, elements);
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((0, _generated.isJSXExpressionContainer)(child)) child = child.expression;
|
||||
if ((0, _generated.isJSXEmptyExpression)(child)) continue;
|
||||
elements.push(child);
|
||||
}
|
||||
|
||||
return elements;
|
||||
}
|
||||
14
node_modules/@types/babel__generator/node_modules/@babel/types/lib/clone/clone.js
generated
vendored
Normal file
14
node_modules/@types/babel__generator/node_modules/@babel/types/lib/clone/clone.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = clone;
|
||||
|
||||
var _cloneNode = _interopRequireDefault(require("./cloneNode"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function clone(node) {
|
||||
return (0, _cloneNode.default)(node, false);
|
||||
}
|
||||
14
node_modules/@types/babel__generator/node_modules/@babel/types/lib/clone/cloneDeep.js
generated
vendored
Normal file
14
node_modules/@types/babel__generator/node_modules/@babel/types/lib/clone/cloneDeep.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = cloneDeep;
|
||||
|
||||
var _cloneNode = _interopRequireDefault(require("./cloneNode"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function cloneDeep(node) {
|
||||
return (0, _cloneNode.default)(node);
|
||||
}
|
||||
78
node_modules/@types/babel__generator/node_modules/@babel/types/lib/clone/cloneNode.js
generated
vendored
Normal file
78
node_modules/@types/babel__generator/node_modules/@babel/types/lib/clone/cloneNode.js
generated
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = cloneNode;
|
||||
|
||||
var _definitions = require("../definitions");
|
||||
|
||||
const has = Function.call.bind(Object.prototype.hasOwnProperty);
|
||||
|
||||
function cloneIfNode(obj, deep) {
|
||||
if (obj && typeof obj.type === "string" && obj.type !== "CommentLine" && obj.type !== "CommentBlock") {
|
||||
return cloneNode(obj, deep);
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
function cloneIfNodeOrArray(obj, deep) {
|
||||
if (Array.isArray(obj)) {
|
||||
return obj.map(node => cloneIfNode(node, deep));
|
||||
}
|
||||
|
||||
return cloneIfNode(obj, deep);
|
||||
}
|
||||
|
||||
function cloneNode(node, deep = true) {
|
||||
if (!node) return node;
|
||||
const {
|
||||
type
|
||||
} = node;
|
||||
const newNode = {
|
||||
type
|
||||
};
|
||||
|
||||
if (type === "Identifier") {
|
||||
newNode.name = node.name;
|
||||
|
||||
if (has(node, "optional") && typeof node.optional === "boolean") {
|
||||
newNode.optional = node.optional;
|
||||
}
|
||||
|
||||
if (has(node, "typeAnnotation")) {
|
||||
newNode.typeAnnotation = deep ? cloneIfNodeOrArray(node.typeAnnotation, true) : node.typeAnnotation;
|
||||
}
|
||||
} else if (!has(_definitions.NODE_FIELDS, type)) {
|
||||
throw new Error(`Unknown node type: "${type}"`);
|
||||
} else {
|
||||
for (const field of Object.keys(_definitions.NODE_FIELDS[type])) {
|
||||
if (has(node, field)) {
|
||||
newNode[field] = deep ? cloneIfNodeOrArray(node[field], true) : node[field];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (has(node, "loc")) {
|
||||
newNode.loc = node.loc;
|
||||
}
|
||||
|
||||
if (has(node, "leadingComments")) {
|
||||
newNode.leadingComments = node.leadingComments;
|
||||
}
|
||||
|
||||
if (has(node, "innerComments")) {
|
||||
newNode.innerComments = node.innerComments;
|
||||
}
|
||||
|
||||
if (has(node, "trailingComments")) {
|
||||
newNode.trailingComments = node.trailingComments;
|
||||
}
|
||||
|
||||
if (has(node, "extra")) {
|
||||
newNode.extra = Object.assign({}, node.extra);
|
||||
}
|
||||
|
||||
return newNode;
|
||||
}
|
||||
16
node_modules/@types/babel__generator/node_modules/@babel/types/lib/clone/cloneWithoutLoc.js
generated
vendored
Normal file
16
node_modules/@types/babel__generator/node_modules/@babel/types/lib/clone/cloneWithoutLoc.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = cloneWithoutLoc;
|
||||
|
||||
var _clone = _interopRequireDefault(require("./clone"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function cloneWithoutLoc(node) {
|
||||
const newNode = (0, _clone.default)(node);
|
||||
newNode.loc = null;
|
||||
return newNode;
|
||||
}
|
||||
17
node_modules/@types/babel__generator/node_modules/@babel/types/lib/comments/addComment.js
generated
vendored
Normal file
17
node_modules/@types/babel__generator/node_modules/@babel/types/lib/comments/addComment.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = addComment;
|
||||
|
||||
var _addComments = _interopRequireDefault(require("./addComments"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function addComment(node, type, content, line) {
|
||||
return (0, _addComments.default)(node, type, [{
|
||||
type: line ? "CommentLine" : "CommentBlock",
|
||||
value: content
|
||||
}]);
|
||||
}
|
||||
23
node_modules/@types/babel__generator/node_modules/@babel/types/lib/comments/addComments.js
generated
vendored
Normal file
23
node_modules/@types/babel__generator/node_modules/@babel/types/lib/comments/addComments.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = addComments;
|
||||
|
||||
function addComments(node, type, comments) {
|
||||
if (!comments || !node) return node;
|
||||
const key = `${type}Comments`;
|
||||
|
||||
if (node[key]) {
|
||||
if (type === "leading") {
|
||||
node[key] = comments.concat(node[key]);
|
||||
} else {
|
||||
node[key] = node[key].concat(comments);
|
||||
}
|
||||
} else {
|
||||
node[key] = comments;
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
14
node_modules/@types/babel__generator/node_modules/@babel/types/lib/comments/inheritInnerComments.js
generated
vendored
Normal file
14
node_modules/@types/babel__generator/node_modules/@babel/types/lib/comments/inheritInnerComments.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = inheritInnerComments;
|
||||
|
||||
var _inherit = _interopRequireDefault(require("../utils/inherit"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function inheritInnerComments(child, parent) {
|
||||
(0, _inherit.default)("innerComments", child, parent);
|
||||
}
|
||||
14
node_modules/@types/babel__generator/node_modules/@babel/types/lib/comments/inheritLeadingComments.js
generated
vendored
Normal file
14
node_modules/@types/babel__generator/node_modules/@babel/types/lib/comments/inheritLeadingComments.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = inheritLeadingComments;
|
||||
|
||||
var _inherit = _interopRequireDefault(require("../utils/inherit"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function inheritLeadingComments(child, parent) {
|
||||
(0, _inherit.default)("leadingComments", child, parent);
|
||||
}
|
||||
14
node_modules/@types/babel__generator/node_modules/@babel/types/lib/comments/inheritTrailingComments.js
generated
vendored
Normal file
14
node_modules/@types/babel__generator/node_modules/@babel/types/lib/comments/inheritTrailingComments.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = inheritTrailingComments;
|
||||
|
||||
var _inherit = _interopRequireDefault(require("../utils/inherit"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function inheritTrailingComments(child, parent) {
|
||||
(0, _inherit.default)("trailingComments", child, parent);
|
||||
}
|
||||
21
node_modules/@types/babel__generator/node_modules/@babel/types/lib/comments/inheritsComments.js
generated
vendored
Normal file
21
node_modules/@types/babel__generator/node_modules/@babel/types/lib/comments/inheritsComments.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = inheritsComments;
|
||||
|
||||
var _inheritTrailingComments = _interopRequireDefault(require("./inheritTrailingComments"));
|
||||
|
||||
var _inheritLeadingComments = _interopRequireDefault(require("./inheritLeadingComments"));
|
||||
|
||||
var _inheritInnerComments = _interopRequireDefault(require("./inheritInnerComments"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function inheritsComments(child, parent) {
|
||||
(0, _inheritTrailingComments.default)(child, parent);
|
||||
(0, _inheritLeadingComments.default)(child, parent);
|
||||
(0, _inheritInnerComments.default)(child, parent);
|
||||
return child;
|
||||
}
|
||||
16
node_modules/@types/babel__generator/node_modules/@babel/types/lib/comments/removeComments.js
generated
vendored
Normal file
16
node_modules/@types/babel__generator/node_modules/@babel/types/lib/comments/removeComments.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = removeComments;
|
||||
|
||||
var _constants = require("../constants");
|
||||
|
||||
function removeComments(node) {
|
||||
_constants.COMMENT_KEYS.forEach(key => {
|
||||
node[key] = null;
|
||||
});
|
||||
|
||||
return node;
|
||||
}
|
||||
97
node_modules/@types/babel__generator/node_modules/@babel/types/lib/constants/generated/index.js
generated
vendored
Normal file
97
node_modules/@types/babel__generator/node_modules/@babel/types/lib/constants/generated/index.js
generated
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.TSTYPE_TYPES = exports.TSTYPEELEMENT_TYPES = exports.PRIVATE_TYPES = exports.JSX_TYPES = exports.ENUMMEMBER_TYPES = exports.ENUMBODY_TYPES = exports.FLOWPREDICATE_TYPES = exports.FLOWDECLARATION_TYPES = exports.FLOWBASEANNOTATION_TYPES = exports.FLOWTYPE_TYPES = exports.FLOW_TYPES = exports.MODULESPECIFIER_TYPES = exports.EXPORTDECLARATION_TYPES = exports.MODULEDECLARATION_TYPES = exports.CLASS_TYPES = exports.PATTERN_TYPES = exports.UNARYLIKE_TYPES = exports.PROPERTY_TYPES = exports.OBJECTMEMBER_TYPES = exports.METHOD_TYPES = exports.USERWHITESPACABLE_TYPES = exports.IMMUTABLE_TYPES = exports.LITERAL_TYPES = exports.TSENTITYNAME_TYPES = exports.LVAL_TYPES = exports.PATTERNLIKE_TYPES = exports.DECLARATION_TYPES = exports.PUREISH_TYPES = exports.FUNCTIONPARENT_TYPES = exports.FUNCTION_TYPES = exports.FORXSTATEMENT_TYPES = exports.FOR_TYPES = exports.EXPRESSIONWRAPPER_TYPES = exports.WHILE_TYPES = exports.LOOP_TYPES = exports.CONDITIONAL_TYPES = exports.COMPLETIONSTATEMENT_TYPES = exports.TERMINATORLESS_TYPES = exports.STATEMENT_TYPES = exports.BLOCK_TYPES = exports.BLOCKPARENT_TYPES = exports.SCOPABLE_TYPES = exports.BINARY_TYPES = exports.EXPRESSION_TYPES = void 0;
|
||||
|
||||
var _definitions = require("../../definitions");
|
||||
|
||||
const EXPRESSION_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Expression"];
|
||||
exports.EXPRESSION_TYPES = EXPRESSION_TYPES;
|
||||
const BINARY_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Binary"];
|
||||
exports.BINARY_TYPES = BINARY_TYPES;
|
||||
const SCOPABLE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Scopable"];
|
||||
exports.SCOPABLE_TYPES = SCOPABLE_TYPES;
|
||||
const BLOCKPARENT_TYPES = _definitions.FLIPPED_ALIAS_KEYS["BlockParent"];
|
||||
exports.BLOCKPARENT_TYPES = BLOCKPARENT_TYPES;
|
||||
const BLOCK_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Block"];
|
||||
exports.BLOCK_TYPES = BLOCK_TYPES;
|
||||
const STATEMENT_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Statement"];
|
||||
exports.STATEMENT_TYPES = STATEMENT_TYPES;
|
||||
const TERMINATORLESS_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Terminatorless"];
|
||||
exports.TERMINATORLESS_TYPES = TERMINATORLESS_TYPES;
|
||||
const COMPLETIONSTATEMENT_TYPES = _definitions.FLIPPED_ALIAS_KEYS["CompletionStatement"];
|
||||
exports.COMPLETIONSTATEMENT_TYPES = COMPLETIONSTATEMENT_TYPES;
|
||||
const CONDITIONAL_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Conditional"];
|
||||
exports.CONDITIONAL_TYPES = CONDITIONAL_TYPES;
|
||||
const LOOP_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Loop"];
|
||||
exports.LOOP_TYPES = LOOP_TYPES;
|
||||
const WHILE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["While"];
|
||||
exports.WHILE_TYPES = WHILE_TYPES;
|
||||
const EXPRESSIONWRAPPER_TYPES = _definitions.FLIPPED_ALIAS_KEYS["ExpressionWrapper"];
|
||||
exports.EXPRESSIONWRAPPER_TYPES = EXPRESSIONWRAPPER_TYPES;
|
||||
const FOR_TYPES = _definitions.FLIPPED_ALIAS_KEYS["For"];
|
||||
exports.FOR_TYPES = FOR_TYPES;
|
||||
const FORXSTATEMENT_TYPES = _definitions.FLIPPED_ALIAS_KEYS["ForXStatement"];
|
||||
exports.FORXSTATEMENT_TYPES = FORXSTATEMENT_TYPES;
|
||||
const FUNCTION_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Function"];
|
||||
exports.FUNCTION_TYPES = FUNCTION_TYPES;
|
||||
const FUNCTIONPARENT_TYPES = _definitions.FLIPPED_ALIAS_KEYS["FunctionParent"];
|
||||
exports.FUNCTIONPARENT_TYPES = FUNCTIONPARENT_TYPES;
|
||||
const PUREISH_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Pureish"];
|
||||
exports.PUREISH_TYPES = PUREISH_TYPES;
|
||||
const DECLARATION_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Declaration"];
|
||||
exports.DECLARATION_TYPES = DECLARATION_TYPES;
|
||||
const PATTERNLIKE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["PatternLike"];
|
||||
exports.PATTERNLIKE_TYPES = PATTERNLIKE_TYPES;
|
||||
const LVAL_TYPES = _definitions.FLIPPED_ALIAS_KEYS["LVal"];
|
||||
exports.LVAL_TYPES = LVAL_TYPES;
|
||||
const TSENTITYNAME_TYPES = _definitions.FLIPPED_ALIAS_KEYS["TSEntityName"];
|
||||
exports.TSENTITYNAME_TYPES = TSENTITYNAME_TYPES;
|
||||
const LITERAL_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Literal"];
|
||||
exports.LITERAL_TYPES = LITERAL_TYPES;
|
||||
const IMMUTABLE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Immutable"];
|
||||
exports.IMMUTABLE_TYPES = IMMUTABLE_TYPES;
|
||||
const USERWHITESPACABLE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["UserWhitespacable"];
|
||||
exports.USERWHITESPACABLE_TYPES = USERWHITESPACABLE_TYPES;
|
||||
const METHOD_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Method"];
|
||||
exports.METHOD_TYPES = METHOD_TYPES;
|
||||
const OBJECTMEMBER_TYPES = _definitions.FLIPPED_ALIAS_KEYS["ObjectMember"];
|
||||
exports.OBJECTMEMBER_TYPES = OBJECTMEMBER_TYPES;
|
||||
const PROPERTY_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Property"];
|
||||
exports.PROPERTY_TYPES = PROPERTY_TYPES;
|
||||
const UNARYLIKE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["UnaryLike"];
|
||||
exports.UNARYLIKE_TYPES = UNARYLIKE_TYPES;
|
||||
const PATTERN_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Pattern"];
|
||||
exports.PATTERN_TYPES = PATTERN_TYPES;
|
||||
const CLASS_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Class"];
|
||||
exports.CLASS_TYPES = CLASS_TYPES;
|
||||
const MODULEDECLARATION_TYPES = _definitions.FLIPPED_ALIAS_KEYS["ModuleDeclaration"];
|
||||
exports.MODULEDECLARATION_TYPES = MODULEDECLARATION_TYPES;
|
||||
const EXPORTDECLARATION_TYPES = _definitions.FLIPPED_ALIAS_KEYS["ExportDeclaration"];
|
||||
exports.EXPORTDECLARATION_TYPES = EXPORTDECLARATION_TYPES;
|
||||
const MODULESPECIFIER_TYPES = _definitions.FLIPPED_ALIAS_KEYS["ModuleSpecifier"];
|
||||
exports.MODULESPECIFIER_TYPES = MODULESPECIFIER_TYPES;
|
||||
const FLOW_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Flow"];
|
||||
exports.FLOW_TYPES = FLOW_TYPES;
|
||||
const FLOWTYPE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["FlowType"];
|
||||
exports.FLOWTYPE_TYPES = FLOWTYPE_TYPES;
|
||||
const FLOWBASEANNOTATION_TYPES = _definitions.FLIPPED_ALIAS_KEYS["FlowBaseAnnotation"];
|
||||
exports.FLOWBASEANNOTATION_TYPES = FLOWBASEANNOTATION_TYPES;
|
||||
const FLOWDECLARATION_TYPES = _definitions.FLIPPED_ALIAS_KEYS["FlowDeclaration"];
|
||||
exports.FLOWDECLARATION_TYPES = FLOWDECLARATION_TYPES;
|
||||
const FLOWPREDICATE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["FlowPredicate"];
|
||||
exports.FLOWPREDICATE_TYPES = FLOWPREDICATE_TYPES;
|
||||
const ENUMBODY_TYPES = _definitions.FLIPPED_ALIAS_KEYS["EnumBody"];
|
||||
exports.ENUMBODY_TYPES = ENUMBODY_TYPES;
|
||||
const ENUMMEMBER_TYPES = _definitions.FLIPPED_ALIAS_KEYS["EnumMember"];
|
||||
exports.ENUMMEMBER_TYPES = ENUMMEMBER_TYPES;
|
||||
const JSX_TYPES = _definitions.FLIPPED_ALIAS_KEYS["JSX"];
|
||||
exports.JSX_TYPES = JSX_TYPES;
|
||||
const PRIVATE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Private"];
|
||||
exports.PRIVATE_TYPES = PRIVATE_TYPES;
|
||||
const TSTYPEELEMENT_TYPES = _definitions.FLIPPED_ALIAS_KEYS["TSTypeElement"];
|
||||
exports.TSTYPEELEMENT_TYPES = TSTYPEELEMENT_TYPES;
|
||||
const TSTYPE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["TSType"];
|
||||
exports.TSTYPE_TYPES = TSTYPE_TYPES;
|
||||
49
node_modules/@types/babel__generator/node_modules/@babel/types/lib/constants/index.js
generated
vendored
Normal file
49
node_modules/@types/babel__generator/node_modules/@babel/types/lib/constants/index.js
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.NOT_LOCAL_BINDING = exports.BLOCK_SCOPED_SYMBOL = exports.INHERIT_KEYS = exports.UNARY_OPERATORS = exports.STRING_UNARY_OPERATORS = exports.NUMBER_UNARY_OPERATORS = exports.BOOLEAN_UNARY_OPERATORS = exports.ASSIGNMENT_OPERATORS = exports.BINARY_OPERATORS = exports.NUMBER_BINARY_OPERATORS = exports.BOOLEAN_BINARY_OPERATORS = exports.COMPARISON_BINARY_OPERATORS = exports.EQUALITY_BINARY_OPERATORS = exports.BOOLEAN_NUMBER_BINARY_OPERATORS = exports.UPDATE_OPERATORS = exports.LOGICAL_OPERATORS = exports.COMMENT_KEYS = exports.FOR_INIT_KEYS = exports.FLATTENABLE_KEYS = exports.STATEMENT_OR_BLOCK_KEYS = void 0;
|
||||
const STATEMENT_OR_BLOCK_KEYS = ["consequent", "body", "alternate"];
|
||||
exports.STATEMENT_OR_BLOCK_KEYS = STATEMENT_OR_BLOCK_KEYS;
|
||||
const FLATTENABLE_KEYS = ["body", "expressions"];
|
||||
exports.FLATTENABLE_KEYS = FLATTENABLE_KEYS;
|
||||
const FOR_INIT_KEYS = ["left", "init"];
|
||||
exports.FOR_INIT_KEYS = FOR_INIT_KEYS;
|
||||
const COMMENT_KEYS = ["leadingComments", "trailingComments", "innerComments"];
|
||||
exports.COMMENT_KEYS = COMMENT_KEYS;
|
||||
const LOGICAL_OPERATORS = ["||", "&&", "??"];
|
||||
exports.LOGICAL_OPERATORS = LOGICAL_OPERATORS;
|
||||
const UPDATE_OPERATORS = ["++", "--"];
|
||||
exports.UPDATE_OPERATORS = UPDATE_OPERATORS;
|
||||
const BOOLEAN_NUMBER_BINARY_OPERATORS = [">", "<", ">=", "<="];
|
||||
exports.BOOLEAN_NUMBER_BINARY_OPERATORS = BOOLEAN_NUMBER_BINARY_OPERATORS;
|
||||
const EQUALITY_BINARY_OPERATORS = ["==", "===", "!=", "!=="];
|
||||
exports.EQUALITY_BINARY_OPERATORS = EQUALITY_BINARY_OPERATORS;
|
||||
const COMPARISON_BINARY_OPERATORS = [...EQUALITY_BINARY_OPERATORS, "in", "instanceof"];
|
||||
exports.COMPARISON_BINARY_OPERATORS = COMPARISON_BINARY_OPERATORS;
|
||||
const BOOLEAN_BINARY_OPERATORS = [...COMPARISON_BINARY_OPERATORS, ...BOOLEAN_NUMBER_BINARY_OPERATORS];
|
||||
exports.BOOLEAN_BINARY_OPERATORS = BOOLEAN_BINARY_OPERATORS;
|
||||
const NUMBER_BINARY_OPERATORS = ["-", "/", "%", "*", "**", "&", "|", ">>", ">>>", "<<", "^"];
|
||||
exports.NUMBER_BINARY_OPERATORS = NUMBER_BINARY_OPERATORS;
|
||||
const BINARY_OPERATORS = ["+", ...NUMBER_BINARY_OPERATORS, ...BOOLEAN_BINARY_OPERATORS];
|
||||
exports.BINARY_OPERATORS = BINARY_OPERATORS;
|
||||
const ASSIGNMENT_OPERATORS = ["=", "+=", ...NUMBER_BINARY_OPERATORS.map(op => op + "=")];
|
||||
exports.ASSIGNMENT_OPERATORS = ASSIGNMENT_OPERATORS;
|
||||
const BOOLEAN_UNARY_OPERATORS = ["delete", "!"];
|
||||
exports.BOOLEAN_UNARY_OPERATORS = BOOLEAN_UNARY_OPERATORS;
|
||||
const NUMBER_UNARY_OPERATORS = ["+", "-", "~"];
|
||||
exports.NUMBER_UNARY_OPERATORS = NUMBER_UNARY_OPERATORS;
|
||||
const STRING_UNARY_OPERATORS = ["typeof"];
|
||||
exports.STRING_UNARY_OPERATORS = STRING_UNARY_OPERATORS;
|
||||
const UNARY_OPERATORS = ["void", "throw", ...BOOLEAN_UNARY_OPERATORS, ...NUMBER_UNARY_OPERATORS, ...STRING_UNARY_OPERATORS];
|
||||
exports.UNARY_OPERATORS = UNARY_OPERATORS;
|
||||
const INHERIT_KEYS = {
|
||||
optional: ["typeAnnotation", "typeParameters", "returnType"],
|
||||
force: ["start", "loc", "end"]
|
||||
};
|
||||
exports.INHERIT_KEYS = INHERIT_KEYS;
|
||||
const BLOCK_SCOPED_SYMBOL = Symbol.for("var used to be block scoped");
|
||||
exports.BLOCK_SCOPED_SYMBOL = BLOCK_SCOPED_SYMBOL;
|
||||
const NOT_LOCAL_BINDING = Symbol.for("should not be considered a local binding");
|
||||
exports.NOT_LOCAL_BINDING = NOT_LOCAL_BINDING;
|
||||
14
node_modules/@types/babel__generator/node_modules/@babel/types/lib/converters/ensureBlock.js
generated
vendored
Normal file
14
node_modules/@types/babel__generator/node_modules/@babel/types/lib/converters/ensureBlock.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = ensureBlock;
|
||||
|
||||
var _toBlock = _interopRequireDefault(require("./toBlock"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function ensureBlock(node, key = "body") {
|
||||
return node[key] = (0, _toBlock.default)(node[key], node);
|
||||
}
|
||||
73
node_modules/@types/babel__generator/node_modules/@babel/types/lib/converters/gatherSequenceExpressions.js
generated
vendored
Normal file
73
node_modules/@types/babel__generator/node_modules/@babel/types/lib/converters/gatherSequenceExpressions.js
generated
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = gatherSequenceExpressions;
|
||||
|
||||
var _getBindingIdentifiers = _interopRequireDefault(require("../retrievers/getBindingIdentifiers"));
|
||||
|
||||
var _generated = require("../validators/generated");
|
||||
|
||||
var _generated2 = require("../builders/generated");
|
||||
|
||||
var _cloneNode = _interopRequireDefault(require("../clone/cloneNode"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function gatherSequenceExpressions(nodes, scope, declars) {
|
||||
const exprs = [];
|
||||
let ensureLastUndefined = true;
|
||||
|
||||
for (const node of nodes) {
|
||||
ensureLastUndefined = false;
|
||||
|
||||
if ((0, _generated.isExpression)(node)) {
|
||||
exprs.push(node);
|
||||
} else if ((0, _generated.isExpressionStatement)(node)) {
|
||||
exprs.push(node.expression);
|
||||
} else if ((0, _generated.isVariableDeclaration)(node)) {
|
||||
if (node.kind !== "var") return;
|
||||
|
||||
for (const declar of node.declarations) {
|
||||
const bindings = (0, _getBindingIdentifiers.default)(declar);
|
||||
|
||||
for (const key of Object.keys(bindings)) {
|
||||
declars.push({
|
||||
kind: node.kind,
|
||||
id: (0, _cloneNode.default)(bindings[key])
|
||||
});
|
||||
}
|
||||
|
||||
if (declar.init) {
|
||||
exprs.push((0, _generated2.assignmentExpression)("=", declar.id, declar.init));
|
||||
}
|
||||
}
|
||||
|
||||
ensureLastUndefined = true;
|
||||
} else if ((0, _generated.isIfStatement)(node)) {
|
||||
const consequent = node.consequent ? gatherSequenceExpressions([node.consequent], scope, declars) : scope.buildUndefinedNode();
|
||||
const alternate = node.alternate ? gatherSequenceExpressions([node.alternate], scope, declars) : scope.buildUndefinedNode();
|
||||
if (!consequent || !alternate) return;
|
||||
exprs.push((0, _generated2.conditionalExpression)(node.test, consequent, alternate));
|
||||
} else if ((0, _generated.isBlockStatement)(node)) {
|
||||
const body = gatherSequenceExpressions(node.body, scope, declars);
|
||||
if (!body) return;
|
||||
exprs.push(body);
|
||||
} else if ((0, _generated.isEmptyStatement)(node)) {
|
||||
ensureLastUndefined = true;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (ensureLastUndefined) {
|
||||
exprs.push(scope.buildUndefinedNode());
|
||||
}
|
||||
|
||||
if (exprs.length === 1) {
|
||||
return exprs[0];
|
||||
} else {
|
||||
return (0, _generated2.sequenceExpression)(exprs);
|
||||
}
|
||||
}
|
||||
16
node_modules/@types/babel__generator/node_modules/@babel/types/lib/converters/toBindingIdentifierName.js
generated
vendored
Normal file
16
node_modules/@types/babel__generator/node_modules/@babel/types/lib/converters/toBindingIdentifierName.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = toBindingIdentifierName;
|
||||
|
||||
var _toIdentifier = _interopRequireDefault(require("./toIdentifier"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function toBindingIdentifierName(name) {
|
||||
name = (0, _toIdentifier.default)(name);
|
||||
if (name === "eval" || name === "arguments") name = "_" + name;
|
||||
return name;
|
||||
}
|
||||
34
node_modules/@types/babel__generator/node_modules/@babel/types/lib/converters/toBlock.js
generated
vendored
Normal file
34
node_modules/@types/babel__generator/node_modules/@babel/types/lib/converters/toBlock.js
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = toBlock;
|
||||
|
||||
var _generated = require("../validators/generated");
|
||||
|
||||
var _generated2 = require("../builders/generated");
|
||||
|
||||
function toBlock(node, parent) {
|
||||
if ((0, _generated.isBlockStatement)(node)) {
|
||||
return node;
|
||||
}
|
||||
|
||||
let blockNodes = [];
|
||||
|
||||
if ((0, _generated.isEmptyStatement)(node)) {
|
||||
blockNodes = [];
|
||||
} else {
|
||||
if (!(0, _generated.isStatement)(node)) {
|
||||
if ((0, _generated.isFunction)(parent)) {
|
||||
node = (0, _generated2.returnStatement)(node);
|
||||
} else {
|
||||
node = (0, _generated2.expressionStatement)(node);
|
||||
}
|
||||
}
|
||||
|
||||
blockNodes = [node];
|
||||
}
|
||||
|
||||
return (0, _generated2.blockStatement)(blockNodes);
|
||||
}
|
||||
15
node_modules/@types/babel__generator/node_modules/@babel/types/lib/converters/toComputedKey.js
generated
vendored
Normal file
15
node_modules/@types/babel__generator/node_modules/@babel/types/lib/converters/toComputedKey.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = toComputedKey;
|
||||
|
||||
var _generated = require("../validators/generated");
|
||||
|
||||
var _generated2 = require("../builders/generated");
|
||||
|
||||
function toComputedKey(node, key = node.key || node.property) {
|
||||
if (!node.computed && (0, _generated.isIdentifier)(key)) key = (0, _generated2.stringLiteral)(key.name);
|
||||
return key;
|
||||
}
|
||||
30
node_modules/@types/babel__generator/node_modules/@babel/types/lib/converters/toExpression.js
generated
vendored
Normal file
30
node_modules/@types/babel__generator/node_modules/@babel/types/lib/converters/toExpression.js
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = toExpression;
|
||||
|
||||
var _generated = require("../validators/generated");
|
||||
|
||||
function toExpression(node) {
|
||||
if ((0, _generated.isExpressionStatement)(node)) {
|
||||
node = node.expression;
|
||||
}
|
||||
|
||||
if ((0, _generated.isExpression)(node)) {
|
||||
return node;
|
||||
}
|
||||
|
||||
if ((0, _generated.isClass)(node)) {
|
||||
node.type = "ClassExpression";
|
||||
} else if ((0, _generated.isFunction)(node)) {
|
||||
node.type = "FunctionExpression";
|
||||
}
|
||||
|
||||
if (!(0, _generated.isExpression)(node)) {
|
||||
throw new Error(`cannot turn ${node.type} to an expression`);
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
25
node_modules/@types/babel__generator/node_modules/@babel/types/lib/converters/toIdentifier.js
generated
vendored
Normal file
25
node_modules/@types/babel__generator/node_modules/@babel/types/lib/converters/toIdentifier.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = toIdentifier;
|
||||
|
||||
var _isValidIdentifier = _interopRequireDefault(require("../validators/isValidIdentifier"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function toIdentifier(name) {
|
||||
name = name + "";
|
||||
name = name.replace(/[^a-zA-Z0-9$_]/g, "-");
|
||||
name = name.replace(/^[-0-9]+/, "");
|
||||
name = name.replace(/[-\s]+(.)?/g, function (match, c) {
|
||||
return c ? c.toUpperCase() : "";
|
||||
});
|
||||
|
||||
if (!(0, _isValidIdentifier.default)(name)) {
|
||||
name = `_${name}`;
|
||||
}
|
||||
|
||||
return name || "_";
|
||||
}
|
||||
48
node_modules/@types/babel__generator/node_modules/@babel/types/lib/converters/toKeyAlias.js
generated
vendored
Normal file
48
node_modules/@types/babel__generator/node_modules/@babel/types/lib/converters/toKeyAlias.js
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = toKeyAlias;
|
||||
|
||||
var _generated = require("../validators/generated");
|
||||
|
||||
var _cloneNode = _interopRequireDefault(require("../clone/cloneNode"));
|
||||
|
||||
var _removePropertiesDeep = _interopRequireDefault(require("../modifications/removePropertiesDeep"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function toKeyAlias(node, key = node.key) {
|
||||
let alias;
|
||||
|
||||
if (node.kind === "method") {
|
||||
return toKeyAlias.increment() + "";
|
||||
} else if ((0, _generated.isIdentifier)(key)) {
|
||||
alias = key.name;
|
||||
} else if ((0, _generated.isStringLiteral)(key)) {
|
||||
alias = JSON.stringify(key.value);
|
||||
} else {
|
||||
alias = JSON.stringify((0, _removePropertiesDeep.default)((0, _cloneNode.default)(key)));
|
||||
}
|
||||
|
||||
if (node.computed) {
|
||||
alias = `[${alias}]`;
|
||||
}
|
||||
|
||||
if (node.static) {
|
||||
alias = `static:${alias}`;
|
||||
}
|
||||
|
||||
return alias;
|
||||
}
|
||||
|
||||
toKeyAlias.uid = 0;
|
||||
|
||||
toKeyAlias.increment = function () {
|
||||
if (toKeyAlias.uid >= Number.MAX_SAFE_INTEGER) {
|
||||
return toKeyAlias.uid = 0;
|
||||
} else {
|
||||
return toKeyAlias.uid++;
|
||||
}
|
||||
};
|
||||
23
node_modules/@types/babel__generator/node_modules/@babel/types/lib/converters/toSequenceExpression.js
generated
vendored
Normal file
23
node_modules/@types/babel__generator/node_modules/@babel/types/lib/converters/toSequenceExpression.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = toSequenceExpression;
|
||||
|
||||
var _gatherSequenceExpressions = _interopRequireDefault(require("./gatherSequenceExpressions"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function toSequenceExpression(nodes, scope) {
|
||||
if (!nodes || !nodes.length) return;
|
||||
const declars = [];
|
||||
const result = (0, _gatherSequenceExpressions.default)(nodes, scope, declars);
|
||||
if (!result) return;
|
||||
|
||||
for (const declar of declars) {
|
||||
scope.push(declar);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
44
node_modules/@types/babel__generator/node_modules/@babel/types/lib/converters/toStatement.js
generated
vendored
Normal file
44
node_modules/@types/babel__generator/node_modules/@babel/types/lib/converters/toStatement.js
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = toStatement;
|
||||
|
||||
var _generated = require("../validators/generated");
|
||||
|
||||
var _generated2 = require("../builders/generated");
|
||||
|
||||
function toStatement(node, ignore) {
|
||||
if ((0, _generated.isStatement)(node)) {
|
||||
return node;
|
||||
}
|
||||
|
||||
let mustHaveId = false;
|
||||
let newType;
|
||||
|
||||
if ((0, _generated.isClass)(node)) {
|
||||
mustHaveId = true;
|
||||
newType = "ClassDeclaration";
|
||||
} else if ((0, _generated.isFunction)(node)) {
|
||||
mustHaveId = true;
|
||||
newType = "FunctionDeclaration";
|
||||
} else if ((0, _generated.isAssignmentExpression)(node)) {
|
||||
return (0, _generated2.expressionStatement)(node);
|
||||
}
|
||||
|
||||
if (mustHaveId && !node.id) {
|
||||
newType = false;
|
||||
}
|
||||
|
||||
if (!newType) {
|
||||
if (ignore) {
|
||||
return false;
|
||||
} else {
|
||||
throw new Error(`cannot turn ${node.type} to a statement`);
|
||||
}
|
||||
}
|
||||
|
||||
node.type = newType;
|
||||
return node;
|
||||
}
|
||||
88
node_modules/@types/babel__generator/node_modules/@babel/types/lib/converters/valueToNode.js
generated
vendored
Normal file
88
node_modules/@types/babel__generator/node_modules/@babel/types/lib/converters/valueToNode.js
generated
vendored
Normal file
@@ -0,0 +1,88 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = valueToNode;
|
||||
|
||||
var _isPlainObject = _interopRequireDefault(require("lodash/isPlainObject"));
|
||||
|
||||
var _isRegExp = _interopRequireDefault(require("lodash/isRegExp"));
|
||||
|
||||
var _isValidIdentifier = _interopRequireDefault(require("../validators/isValidIdentifier"));
|
||||
|
||||
var _generated = require("../builders/generated");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function valueToNode(value) {
|
||||
if (value === undefined) {
|
||||
return (0, _generated.identifier)("undefined");
|
||||
}
|
||||
|
||||
if (value === true || value === false) {
|
||||
return (0, _generated.booleanLiteral)(value);
|
||||
}
|
||||
|
||||
if (value === null) {
|
||||
return (0, _generated.nullLiteral)();
|
||||
}
|
||||
|
||||
if (typeof value === "string") {
|
||||
return (0, _generated.stringLiteral)(value);
|
||||
}
|
||||
|
||||
if (typeof value === "number") {
|
||||
let result;
|
||||
|
||||
if (Number.isFinite(value)) {
|
||||
result = (0, _generated.numericLiteral)(Math.abs(value));
|
||||
} else {
|
||||
let numerator;
|
||||
|
||||
if (Number.isNaN(value)) {
|
||||
numerator = (0, _generated.numericLiteral)(0);
|
||||
} else {
|
||||
numerator = (0, _generated.numericLiteral)(1);
|
||||
}
|
||||
|
||||
result = (0, _generated.binaryExpression)("/", numerator, (0, _generated.numericLiteral)(0));
|
||||
}
|
||||
|
||||
if (value < 0 || Object.is(value, -0)) {
|
||||
result = (0, _generated.unaryExpression)("-", result);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
if ((0, _isRegExp.default)(value)) {
|
||||
const pattern = value.source;
|
||||
const flags = value.toString().match(/\/([a-z]+|)$/)[1];
|
||||
return (0, _generated.regExpLiteral)(pattern, flags);
|
||||
}
|
||||
|
||||
if (Array.isArray(value)) {
|
||||
return (0, _generated.arrayExpression)(value.map(valueToNode));
|
||||
}
|
||||
|
||||
if ((0, _isPlainObject.default)(value)) {
|
||||
const props = [];
|
||||
|
||||
for (const key of Object.keys(value)) {
|
||||
let nodeKey;
|
||||
|
||||
if ((0, _isValidIdentifier.default)(key)) {
|
||||
nodeKey = (0, _generated.identifier)(key);
|
||||
} else {
|
||||
nodeKey = (0, _generated.stringLiteral)(key);
|
||||
}
|
||||
|
||||
props.push((0, _generated.objectProperty)(nodeKey, valueToNode(value[key])));
|
||||
}
|
||||
|
||||
return (0, _generated.objectExpression)(props);
|
||||
}
|
||||
|
||||
throw new Error("don't know how to turn this value into a node");
|
||||
}
|
||||
856
node_modules/@types/babel__generator/node_modules/@babel/types/lib/definitions/core.js
generated
vendored
Normal file
856
node_modules/@types/babel__generator/node_modules/@babel/types/lib/definitions/core.js
generated
vendored
Normal file
@@ -0,0 +1,856 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.patternLikeCommon = exports.functionDeclarationCommon = exports.functionTypeAnnotationCommon = exports.functionCommon = void 0;
|
||||
|
||||
var _esutils = _interopRequireDefault(require("esutils"));
|
||||
|
||||
var _is = _interopRequireDefault(require("../validators/is"));
|
||||
|
||||
var _constants = require("../constants");
|
||||
|
||||
var _utils = _interopRequireWildcard(require("./utils"));
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
(0, _utils.default)("ArrayExpression", {
|
||||
fields: {
|
||||
elements: {
|
||||
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeOrValueType)("null", "Expression", "SpreadElement"))),
|
||||
default: !process.env.BABEL_TYPES_8_BREAKING ? [] : undefined
|
||||
}
|
||||
},
|
||||
visitor: ["elements"],
|
||||
aliases: ["Expression"]
|
||||
});
|
||||
(0, _utils.default)("AssignmentExpression", {
|
||||
fields: {
|
||||
operator: {
|
||||
validate: function () {
|
||||
if (!process.env.BABEL_TYPES_8_BREAKING) {
|
||||
return (0, _utils.assertValueType)("string");
|
||||
}
|
||||
|
||||
const identifier = (0, _utils.assertOneOf)(..._constants.ASSIGNMENT_OPERATORS);
|
||||
const pattern = (0, _utils.assertOneOf)("=");
|
||||
return function (node, key, val) {
|
||||
const validator = (0, _is.default)("Pattern", node.left) ? pattern : identifier;
|
||||
validator(node, key, val);
|
||||
};
|
||||
}()
|
||||
},
|
||||
left: {
|
||||
validate: !process.env.BABEL_TYPES_8_BREAKING ? (0, _utils.assertNodeType)("LVal") : (0, _utils.assertNodeType)("Identifier", "MemberExpression", "ArrayPattern", "ObjectPattern")
|
||||
},
|
||||
right: {
|
||||
validate: (0, _utils.assertNodeType)("Expression")
|
||||
}
|
||||
},
|
||||
builder: ["operator", "left", "right"],
|
||||
visitor: ["left", "right"],
|
||||
aliases: ["Expression"]
|
||||
});
|
||||
(0, _utils.default)("BinaryExpression", {
|
||||
builder: ["operator", "left", "right"],
|
||||
fields: {
|
||||
operator: {
|
||||
validate: (0, _utils.assertOneOf)(..._constants.BINARY_OPERATORS)
|
||||
},
|
||||
left: {
|
||||
validate: (0, _utils.assertNodeType)("Expression")
|
||||
},
|
||||
right: {
|
||||
validate: (0, _utils.assertNodeType)("Expression")
|
||||
}
|
||||
},
|
||||
visitor: ["left", "right"],
|
||||
aliases: ["Binary", "Expression"]
|
||||
});
|
||||
(0, _utils.default)("InterpreterDirective", {
|
||||
builder: ["value"],
|
||||
fields: {
|
||||
value: {
|
||||
validate: (0, _utils.assertValueType)("string")
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("Directive", {
|
||||
visitor: ["value"],
|
||||
fields: {
|
||||
value: {
|
||||
validate: (0, _utils.assertNodeType)("DirectiveLiteral")
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("DirectiveLiteral", {
|
||||
builder: ["value"],
|
||||
fields: {
|
||||
value: {
|
||||
validate: (0, _utils.assertValueType)("string")
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("BlockStatement", {
|
||||
builder: ["body", "directives"],
|
||||
visitor: ["directives", "body"],
|
||||
fields: {
|
||||
directives: {
|
||||
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Directive"))),
|
||||
default: []
|
||||
},
|
||||
body: {
|
||||
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Statement")))
|
||||
}
|
||||
},
|
||||
aliases: ["Scopable", "BlockParent", "Block", "Statement"]
|
||||
});
|
||||
(0, _utils.default)("BreakStatement", {
|
||||
visitor: ["label"],
|
||||
fields: {
|
||||
label: {
|
||||
validate: (0, _utils.assertNodeType)("Identifier"),
|
||||
optional: true
|
||||
}
|
||||
},
|
||||
aliases: ["Statement", "Terminatorless", "CompletionStatement"]
|
||||
});
|
||||
(0, _utils.default)("CallExpression", {
|
||||
visitor: ["callee", "arguments", "typeParameters", "typeArguments"],
|
||||
builder: ["callee", "arguments"],
|
||||
aliases: ["Expression"],
|
||||
fields: Object.assign({
|
||||
callee: {
|
||||
validate: (0, _utils.assertNodeType)("Expression", "V8IntrinsicIdentifier")
|
||||
},
|
||||
arguments: {
|
||||
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Expression", "SpreadElement", "JSXNamespacedName", "ArgumentPlaceholder")))
|
||||
}
|
||||
}, !process.env.BABEL_TYPES_8_BREAKING ? {
|
||||
optional: {
|
||||
validate: (0, _utils.assertOneOf)(true, false),
|
||||
optional: true
|
||||
}
|
||||
} : {}, {
|
||||
typeArguments: {
|
||||
validate: (0, _utils.assertNodeType)("TypeParameterInstantiation"),
|
||||
optional: true
|
||||
},
|
||||
typeParameters: {
|
||||
validate: (0, _utils.assertNodeType)("TSTypeParameterInstantiation"),
|
||||
optional: true
|
||||
}
|
||||
})
|
||||
});
|
||||
(0, _utils.default)("CatchClause", {
|
||||
visitor: ["param", "body"],
|
||||
fields: {
|
||||
param: {
|
||||
validate: (0, _utils.assertNodeType)("Identifier", "ArrayPattern", "ObjectPattern"),
|
||||
optional: true
|
||||
},
|
||||
body: {
|
||||
validate: (0, _utils.assertNodeType)("BlockStatement")
|
||||
}
|
||||
},
|
||||
aliases: ["Scopable", "BlockParent"]
|
||||
});
|
||||
(0, _utils.default)("ConditionalExpression", {
|
||||
visitor: ["test", "consequent", "alternate"],
|
||||
fields: {
|
||||
test: {
|
||||
validate: (0, _utils.assertNodeType)("Expression")
|
||||
},
|
||||
consequent: {
|
||||
validate: (0, _utils.assertNodeType)("Expression")
|
||||
},
|
||||
alternate: {
|
||||
validate: (0, _utils.assertNodeType)("Expression")
|
||||
}
|
||||
},
|
||||
aliases: ["Expression", "Conditional"]
|
||||
});
|
||||
(0, _utils.default)("ContinueStatement", {
|
||||
visitor: ["label"],
|
||||
fields: {
|
||||
label: {
|
||||
validate: (0, _utils.assertNodeType)("Identifier"),
|
||||
optional: true
|
||||
}
|
||||
},
|
||||
aliases: ["Statement", "Terminatorless", "CompletionStatement"]
|
||||
});
|
||||
(0, _utils.default)("DebuggerStatement", {
|
||||
aliases: ["Statement"]
|
||||
});
|
||||
(0, _utils.default)("DoWhileStatement", {
|
||||
visitor: ["test", "body"],
|
||||
fields: {
|
||||
test: {
|
||||
validate: (0, _utils.assertNodeType)("Expression")
|
||||
},
|
||||
body: {
|
||||
validate: (0, _utils.assertNodeType)("Statement")
|
||||
}
|
||||
},
|
||||
aliases: ["Statement", "BlockParent", "Loop", "While", "Scopable"]
|
||||
});
|
||||
(0, _utils.default)("EmptyStatement", {
|
||||
aliases: ["Statement"]
|
||||
});
|
||||
(0, _utils.default)("ExpressionStatement", {
|
||||
visitor: ["expression"],
|
||||
fields: {
|
||||
expression: {
|
||||
validate: (0, _utils.assertNodeType)("Expression")
|
||||
}
|
||||
},
|
||||
aliases: ["Statement", "ExpressionWrapper"]
|
||||
});
|
||||
(0, _utils.default)("File", {
|
||||
builder: ["program", "comments", "tokens"],
|
||||
visitor: ["program"],
|
||||
fields: {
|
||||
program: {
|
||||
validate: (0, _utils.assertNodeType)("Program")
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("ForInStatement", {
|
||||
visitor: ["left", "right", "body"],
|
||||
aliases: ["Scopable", "Statement", "For", "BlockParent", "Loop", "ForXStatement"],
|
||||
fields: {
|
||||
left: {
|
||||
validate: !process.env.BABEL_TYPES_8_BREAKING ? (0, _utils.assertNodeType)("VariableDeclaration", "LVal") : (0, _utils.assertNodeType)("VariableDeclaration", "Identifier", "MemberExpression", "ArrayPattern", "ObjectPattern")
|
||||
},
|
||||
right: {
|
||||
validate: (0, _utils.assertNodeType)("Expression")
|
||||
},
|
||||
body: {
|
||||
validate: (0, _utils.assertNodeType)("Statement")
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("ForStatement", {
|
||||
visitor: ["init", "test", "update", "body"],
|
||||
aliases: ["Scopable", "Statement", "For", "BlockParent", "Loop"],
|
||||
fields: {
|
||||
init: {
|
||||
validate: (0, _utils.assertNodeType)("VariableDeclaration", "Expression"),
|
||||
optional: true
|
||||
},
|
||||
test: {
|
||||
validate: (0, _utils.assertNodeType)("Expression"),
|
||||
optional: true
|
||||
},
|
||||
update: {
|
||||
validate: (0, _utils.assertNodeType)("Expression"),
|
||||
optional: true
|
||||
},
|
||||
body: {
|
||||
validate: (0, _utils.assertNodeType)("Statement")
|
||||
}
|
||||
}
|
||||
});
|
||||
const functionCommon = {
|
||||
params: {
|
||||
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Identifier", "Pattern", "RestElement", "TSParameterProperty")))
|
||||
},
|
||||
generator: {
|
||||
default: false
|
||||
},
|
||||
async: {
|
||||
default: false
|
||||
}
|
||||
};
|
||||
exports.functionCommon = functionCommon;
|
||||
const functionTypeAnnotationCommon = {
|
||||
returnType: {
|
||||
validate: (0, _utils.assertNodeType)("TypeAnnotation", "TSTypeAnnotation", "Noop"),
|
||||
optional: true
|
||||
},
|
||||
typeParameters: {
|
||||
validate: (0, _utils.assertNodeType)("TypeParameterDeclaration", "TSTypeParameterDeclaration", "Noop"),
|
||||
optional: true
|
||||
}
|
||||
};
|
||||
exports.functionTypeAnnotationCommon = functionTypeAnnotationCommon;
|
||||
const functionDeclarationCommon = Object.assign({}, functionCommon, {
|
||||
declare: {
|
||||
validate: (0, _utils.assertValueType)("boolean"),
|
||||
optional: true
|
||||
},
|
||||
id: {
|
||||
validate: (0, _utils.assertNodeType)("Identifier"),
|
||||
optional: true
|
||||
}
|
||||
});
|
||||
exports.functionDeclarationCommon = functionDeclarationCommon;
|
||||
(0, _utils.default)("FunctionDeclaration", {
|
||||
builder: ["id", "params", "body", "generator", "async"],
|
||||
visitor: ["id", "params", "body", "returnType", "typeParameters"],
|
||||
fields: Object.assign({}, functionDeclarationCommon, {}, functionTypeAnnotationCommon, {
|
||||
body: {
|
||||
validate: (0, _utils.assertNodeType)("BlockStatement")
|
||||
}
|
||||
}),
|
||||
aliases: ["Scopable", "Function", "BlockParent", "FunctionParent", "Statement", "Pureish", "Declaration"],
|
||||
validate: function () {
|
||||
if (!process.env.BABEL_TYPES_8_BREAKING) return () => {};
|
||||
const identifier = (0, _utils.assertNodeType)("Identifier");
|
||||
return function (parent, key, node) {
|
||||
if (!(0, _is.default)("ExportDefaultDeclaration", parent)) {
|
||||
identifier(node, "id", node.id);
|
||||
}
|
||||
};
|
||||
}()
|
||||
});
|
||||
(0, _utils.default)("FunctionExpression", {
|
||||
inherits: "FunctionDeclaration",
|
||||
aliases: ["Scopable", "Function", "BlockParent", "FunctionParent", "Expression", "Pureish"],
|
||||
fields: Object.assign({}, functionCommon, {}, functionTypeAnnotationCommon, {
|
||||
id: {
|
||||
validate: (0, _utils.assertNodeType)("Identifier"),
|
||||
optional: true
|
||||
},
|
||||
body: {
|
||||
validate: (0, _utils.assertNodeType)("BlockStatement")
|
||||
}
|
||||
})
|
||||
});
|
||||
const patternLikeCommon = {
|
||||
typeAnnotation: {
|
||||
validate: (0, _utils.assertNodeType)("TypeAnnotation", "TSTypeAnnotation", "Noop"),
|
||||
optional: true
|
||||
},
|
||||
decorators: {
|
||||
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Decorator")))
|
||||
}
|
||||
};
|
||||
exports.patternLikeCommon = patternLikeCommon;
|
||||
(0, _utils.default)("Identifier", {
|
||||
builder: ["name"],
|
||||
visitor: ["typeAnnotation", "decorators"],
|
||||
aliases: ["Expression", "PatternLike", "LVal", "TSEntityName"],
|
||||
fields: Object.assign({}, patternLikeCommon, {
|
||||
name: {
|
||||
validate: (0, _utils.chain)((0, _utils.assertValueType)("string"), function (node, key, val) {
|
||||
if (!process.env.BABEL_TYPES_8_BREAKING) return;
|
||||
|
||||
if (!_esutils.default.keyword.isIdentifierNameES6(val)) {
|
||||
throw new TypeError(`"${val}" is not a valid identifier name`);
|
||||
}
|
||||
})
|
||||
},
|
||||
optional: {
|
||||
validate: (0, _utils.assertValueType)("boolean"),
|
||||
optional: true
|
||||
}
|
||||
}),
|
||||
|
||||
validate(parent, key, node) {
|
||||
if (!process.env.BABEL_TYPES_8_BREAKING) return;
|
||||
const match = /\.(\w+)$/.exec(key);
|
||||
if (!match) return;
|
||||
const [, parentKey] = match;
|
||||
const nonComp = {
|
||||
computed: false
|
||||
};
|
||||
|
||||
if (parentKey === "property") {
|
||||
if ((0, _is.default)("MemberExpression", parent, nonComp)) return;
|
||||
if ((0, _is.default)("OptionalMemberExpression", parent, nonComp)) return;
|
||||
} else if (parentKey === "key") {
|
||||
if ((0, _is.default)("Property", parent, nonComp)) return;
|
||||
if ((0, _is.default)("Method", parent, nonComp)) return;
|
||||
} else if (parentKey === "exported") {
|
||||
if ((0, _is.default)("ExportSpecifier", parent)) return;
|
||||
} else if (parentKey === "imported") {
|
||||
if ((0, _is.default)("ImportSpecifier", parent, {
|
||||
imported: node
|
||||
})) return;
|
||||
} else if (parentKey === "meta") {
|
||||
if ((0, _is.default)("MetaProperty", parent, {
|
||||
meta: node
|
||||
})) return;
|
||||
}
|
||||
|
||||
if (_esutils.default.keyword.isReservedWordES6(node.name, false) && node.name !== "this") {
|
||||
throw new TypeError(`"${node.name}" is not a valid identifer`);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
(0, _utils.default)("IfStatement", {
|
||||
visitor: ["test", "consequent", "alternate"],
|
||||
aliases: ["Statement", "Conditional"],
|
||||
fields: {
|
||||
test: {
|
||||
validate: (0, _utils.assertNodeType)("Expression")
|
||||
},
|
||||
consequent: {
|
||||
validate: (0, _utils.assertNodeType)("Statement")
|
||||
},
|
||||
alternate: {
|
||||
optional: true,
|
||||
validate: (0, _utils.assertNodeType)("Statement")
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("LabeledStatement", {
|
||||
visitor: ["label", "body"],
|
||||
aliases: ["Statement"],
|
||||
fields: {
|
||||
label: {
|
||||
validate: (0, _utils.assertNodeType)("Identifier")
|
||||
},
|
||||
body: {
|
||||
validate: (0, _utils.assertNodeType)("Statement")
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("StringLiteral", {
|
||||
builder: ["value"],
|
||||
fields: {
|
||||
value: {
|
||||
validate: (0, _utils.assertValueType)("string")
|
||||
}
|
||||
},
|
||||
aliases: ["Expression", "Pureish", "Literal", "Immutable"]
|
||||
});
|
||||
(0, _utils.default)("NumericLiteral", {
|
||||
builder: ["value"],
|
||||
deprecatedAlias: "NumberLiteral",
|
||||
fields: {
|
||||
value: {
|
||||
validate: (0, _utils.assertValueType)("number")
|
||||
}
|
||||
},
|
||||
aliases: ["Expression", "Pureish", "Literal", "Immutable"]
|
||||
});
|
||||
(0, _utils.default)("NullLiteral", {
|
||||
aliases: ["Expression", "Pureish", "Literal", "Immutable"]
|
||||
});
|
||||
(0, _utils.default)("BooleanLiteral", {
|
||||
builder: ["value"],
|
||||
fields: {
|
||||
value: {
|
||||
validate: (0, _utils.assertValueType)("boolean")
|
||||
}
|
||||
},
|
||||
aliases: ["Expression", "Pureish", "Literal", "Immutable"]
|
||||
});
|
||||
(0, _utils.default)("RegExpLiteral", {
|
||||
builder: ["pattern", "flags"],
|
||||
deprecatedAlias: "RegexLiteral",
|
||||
aliases: ["Expression", "Literal"],
|
||||
fields: {
|
||||
pattern: {
|
||||
validate: (0, _utils.assertValueType)("string")
|
||||
},
|
||||
flags: {
|
||||
validate: (0, _utils.chain)((0, _utils.assertValueType)("string"), function (node, key, val) {
|
||||
if (!process.env.BABEL_TYPES_8_BREAKING) return;
|
||||
const invalid = /[^gimsuy]/.exec(val);
|
||||
|
||||
if (invalid) {
|
||||
throw new TypeError(`"${invalid[0]}" is not a valid RegExp flag`);
|
||||
}
|
||||
}),
|
||||
default: ""
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("LogicalExpression", {
|
||||
builder: ["operator", "left", "right"],
|
||||
visitor: ["left", "right"],
|
||||
aliases: ["Binary", "Expression"],
|
||||
fields: {
|
||||
operator: {
|
||||
validate: (0, _utils.assertOneOf)(..._constants.LOGICAL_OPERATORS)
|
||||
},
|
||||
left: {
|
||||
validate: (0, _utils.assertNodeType)("Expression")
|
||||
},
|
||||
right: {
|
||||
validate: (0, _utils.assertNodeType)("Expression")
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("MemberExpression", {
|
||||
builder: ["object", "property", "computed", "optional"],
|
||||
visitor: ["object", "property"],
|
||||
aliases: ["Expression", "LVal"],
|
||||
fields: Object.assign({
|
||||
object: {
|
||||
validate: (0, _utils.assertNodeType)("Expression")
|
||||
},
|
||||
property: {
|
||||
validate: function () {
|
||||
const normal = (0, _utils.assertNodeType)("Identifier", "PrivateName");
|
||||
const computed = (0, _utils.assertNodeType)("Expression");
|
||||
return function (node, key, val) {
|
||||
const validator = node.computed ? computed : normal;
|
||||
validator(node, key, val);
|
||||
};
|
||||
}()
|
||||
},
|
||||
computed: {
|
||||
default: false
|
||||
}
|
||||
}, !process.env.BABEL_TYPES_8_BREAKING ? {
|
||||
optional: {
|
||||
validate: (0, _utils.assertOneOf)(true, false),
|
||||
optional: true
|
||||
}
|
||||
} : {})
|
||||
});
|
||||
(0, _utils.default)("NewExpression", {
|
||||
inherits: "CallExpression"
|
||||
});
|
||||
(0, _utils.default)("Program", {
|
||||
visitor: ["directives", "body"],
|
||||
builder: ["body", "directives", "sourceType", "interpreter"],
|
||||
fields: {
|
||||
sourceFile: {
|
||||
validate: (0, _utils.assertValueType)("string")
|
||||
},
|
||||
sourceType: {
|
||||
validate: (0, _utils.assertOneOf)("script", "module"),
|
||||
default: "script"
|
||||
},
|
||||
interpreter: {
|
||||
validate: (0, _utils.assertNodeType)("InterpreterDirective"),
|
||||
default: null,
|
||||
optional: true
|
||||
},
|
||||
directives: {
|
||||
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Directive"))),
|
||||
default: []
|
||||
},
|
||||
body: {
|
||||
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Statement")))
|
||||
}
|
||||
},
|
||||
aliases: ["Scopable", "BlockParent", "Block"]
|
||||
});
|
||||
(0, _utils.default)("ObjectExpression", {
|
||||
visitor: ["properties"],
|
||||
aliases: ["Expression"],
|
||||
fields: {
|
||||
properties: {
|
||||
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("ObjectMethod", "ObjectProperty", "SpreadElement")))
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("ObjectMethod", {
|
||||
builder: ["kind", "key", "params", "body", "computed", "generator", "async"],
|
||||
fields: Object.assign({}, functionCommon, {}, functionTypeAnnotationCommon, {
|
||||
kind: Object.assign({
|
||||
validate: (0, _utils.assertOneOf)("method", "get", "set")
|
||||
}, !process.env.BABEL_TYPES_8_BREAKING ? {
|
||||
default: "method"
|
||||
} : {}),
|
||||
computed: {
|
||||
default: false
|
||||
},
|
||||
key: {
|
||||
validate: function () {
|
||||
const normal = (0, _utils.assertNodeType)("Identifier", "StringLiteral", "NumericLiteral");
|
||||
const computed = (0, _utils.assertNodeType)("Expression");
|
||||
return function (node, key, val) {
|
||||
const validator = node.computed ? computed : normal;
|
||||
validator(node, key, val);
|
||||
};
|
||||
}()
|
||||
},
|
||||
decorators: {
|
||||
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Decorator"))),
|
||||
optional: true
|
||||
},
|
||||
body: {
|
||||
validate: (0, _utils.assertNodeType)("BlockStatement")
|
||||
}
|
||||
}),
|
||||
visitor: ["key", "params", "body", "decorators", "returnType", "typeParameters"],
|
||||
aliases: ["UserWhitespacable", "Function", "Scopable", "BlockParent", "FunctionParent", "Method", "ObjectMember"]
|
||||
});
|
||||
(0, _utils.default)("ObjectProperty", {
|
||||
builder: ["key", "value", "computed", "shorthand", ...(!process.env.BABEL_TYPES_8_BREAKING ? ["decorators"] : [])],
|
||||
fields: {
|
||||
computed: {
|
||||
default: false
|
||||
},
|
||||
key: {
|
||||
validate: function () {
|
||||
const normal = (0, _utils.assertNodeType)("Identifier", "StringLiteral", "NumericLiteral");
|
||||
const computed = (0, _utils.assertNodeType)("Expression");
|
||||
return function (node, key, val) {
|
||||
const validator = node.computed ? computed : normal;
|
||||
validator(node, key, val);
|
||||
};
|
||||
}()
|
||||
},
|
||||
value: {
|
||||
validate: (0, _utils.assertNodeType)("Expression", "PatternLike")
|
||||
},
|
||||
shorthand: {
|
||||
validate: (0, _utils.chain)((0, _utils.assertValueType)("boolean"), function (node, key, val) {
|
||||
if (!process.env.BABEL_TYPES_8_BREAKING) return;
|
||||
|
||||
if (val && node.computed) {
|
||||
throw new TypeError("Property shorthand of ObjectProperty cannot be true if computed is true");
|
||||
}
|
||||
}, function (node, key, val) {
|
||||
if (!process.env.BABEL_TYPES_8_BREAKING) return;
|
||||
|
||||
if (val && !(0, _is.default)("Identifier", node.key)) {
|
||||
throw new TypeError("Property shorthand of ObjectProperty cannot be true if key is not an Identifier");
|
||||
}
|
||||
}),
|
||||
default: false
|
||||
},
|
||||
decorators: {
|
||||
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Decorator"))),
|
||||
optional: true
|
||||
}
|
||||
},
|
||||
visitor: ["key", "value", "decorators"],
|
||||
aliases: ["UserWhitespacable", "Property", "ObjectMember"],
|
||||
validate: function () {
|
||||
const pattern = (0, _utils.assertNodeType)("Identifier", "Pattern");
|
||||
const expression = (0, _utils.assertNodeType)("Expression");
|
||||
return function (parent, key, node) {
|
||||
if (!process.env.BABEL_TYPES_8_BREAKING) return;
|
||||
const validator = (0, _is.default)("ObjectPattern", parent) ? pattern : expression;
|
||||
validator(node, "value", node.value);
|
||||
};
|
||||
}()
|
||||
});
|
||||
(0, _utils.default)("RestElement", {
|
||||
visitor: ["argument", "typeAnnotation"],
|
||||
builder: ["argument"],
|
||||
aliases: ["LVal", "PatternLike"],
|
||||
deprecatedAlias: "RestProperty",
|
||||
fields: Object.assign({}, patternLikeCommon, {
|
||||
argument: {
|
||||
validate: !process.env.BABEL_TYPES_8_BREAKING ? (0, _utils.assertNodeType)("LVal") : (0, _utils.assertNodeType)("Identifier", "Pattern", "MemberExpression")
|
||||
}
|
||||
}),
|
||||
|
||||
validate(parent, key) {
|
||||
if (!process.env.BABEL_TYPES_8_BREAKING) return;
|
||||
const match = /(\w+)\[(\d+)\]/.exec(key);
|
||||
if (!match) throw new Error("Internal Babel error: malformed key.");
|
||||
const [, listKey, index] = match;
|
||||
|
||||
if (parent[listKey].length > index + 1) {
|
||||
throw new TypeError(`RestElement must be last element of ${listKey}`);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
(0, _utils.default)("ReturnStatement", {
|
||||
visitor: ["argument"],
|
||||
aliases: ["Statement", "Terminatorless", "CompletionStatement"],
|
||||
fields: {
|
||||
argument: {
|
||||
validate: (0, _utils.assertNodeType)("Expression"),
|
||||
optional: true
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("SequenceExpression", {
|
||||
visitor: ["expressions"],
|
||||
fields: {
|
||||
expressions: {
|
||||
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Expression")))
|
||||
}
|
||||
},
|
||||
aliases: ["Expression"]
|
||||
});
|
||||
(0, _utils.default)("ParenthesizedExpression", {
|
||||
visitor: ["expression"],
|
||||
aliases: ["Expression", "ExpressionWrapper"],
|
||||
fields: {
|
||||
expression: {
|
||||
validate: (0, _utils.assertNodeType)("Expression")
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("SwitchCase", {
|
||||
visitor: ["test", "consequent"],
|
||||
fields: {
|
||||
test: {
|
||||
validate: (0, _utils.assertNodeType)("Expression"),
|
||||
optional: true
|
||||
},
|
||||
consequent: {
|
||||
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Statement")))
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("SwitchStatement", {
|
||||
visitor: ["discriminant", "cases"],
|
||||
aliases: ["Statement", "BlockParent", "Scopable"],
|
||||
fields: {
|
||||
discriminant: {
|
||||
validate: (0, _utils.assertNodeType)("Expression")
|
||||
},
|
||||
cases: {
|
||||
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("SwitchCase")))
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("ThisExpression", {
|
||||
aliases: ["Expression"]
|
||||
});
|
||||
(0, _utils.default)("ThrowStatement", {
|
||||
visitor: ["argument"],
|
||||
aliases: ["Statement", "Terminatorless", "CompletionStatement"],
|
||||
fields: {
|
||||
argument: {
|
||||
validate: (0, _utils.assertNodeType)("Expression")
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TryStatement", {
|
||||
visitor: ["block", "handler", "finalizer"],
|
||||
aliases: ["Statement"],
|
||||
fields: {
|
||||
block: {
|
||||
validate: (0, _utils.chain)((0, _utils.assertNodeType)("BlockStatement"), function (node) {
|
||||
if (!process.env.BABEL_TYPES_8_BREAKING) return;
|
||||
|
||||
if (!node.handler && !node.finalizer) {
|
||||
throw new TypeError("TryStatement expects either a handler or finalizer, or both");
|
||||
}
|
||||
})
|
||||
},
|
||||
handler: {
|
||||
optional: true,
|
||||
validate: (0, _utils.assertNodeType)("CatchClause")
|
||||
},
|
||||
finalizer: {
|
||||
optional: true,
|
||||
validate: (0, _utils.assertNodeType)("BlockStatement")
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("UnaryExpression", {
|
||||
builder: ["operator", "argument", "prefix"],
|
||||
fields: {
|
||||
prefix: {
|
||||
default: true
|
||||
},
|
||||
argument: {
|
||||
validate: (0, _utils.assertNodeType)("Expression")
|
||||
},
|
||||
operator: {
|
||||
validate: (0, _utils.assertOneOf)(..._constants.UNARY_OPERATORS)
|
||||
}
|
||||
},
|
||||
visitor: ["argument"],
|
||||
aliases: ["UnaryLike", "Expression"]
|
||||
});
|
||||
(0, _utils.default)("UpdateExpression", {
|
||||
builder: ["operator", "argument", "prefix"],
|
||||
fields: {
|
||||
prefix: {
|
||||
default: false
|
||||
},
|
||||
argument: {
|
||||
validate: !process.env.BABEL_TYPES_8_BREAKING ? (0, _utils.assertNodeType)("Expression") : (0, _utils.assertNodeType)("Identifier", "MemberExpression")
|
||||
},
|
||||
operator: {
|
||||
validate: (0, _utils.assertOneOf)(..._constants.UPDATE_OPERATORS)
|
||||
}
|
||||
},
|
||||
visitor: ["argument"],
|
||||
aliases: ["Expression"]
|
||||
});
|
||||
(0, _utils.default)("VariableDeclaration", {
|
||||
builder: ["kind", "declarations"],
|
||||
visitor: ["declarations"],
|
||||
aliases: ["Statement", "Declaration"],
|
||||
fields: {
|
||||
declare: {
|
||||
validate: (0, _utils.assertValueType)("boolean"),
|
||||
optional: true
|
||||
},
|
||||
kind: {
|
||||
validate: (0, _utils.assertOneOf)("var", "let", "const")
|
||||
},
|
||||
declarations: {
|
||||
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("VariableDeclarator")))
|
||||
}
|
||||
},
|
||||
|
||||
validate(parent, key, node) {
|
||||
if (!process.env.BABEL_TYPES_8_BREAKING) return;
|
||||
if (!(0, _is.default)("ForXStatement", parent, {
|
||||
left: node
|
||||
})) return;
|
||||
|
||||
if (node.declarations.length !== 1) {
|
||||
throw new TypeError(`Exactly one VariableDeclarator is required in the VariableDeclaration of a ${parent.type}`);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
(0, _utils.default)("VariableDeclarator", {
|
||||
visitor: ["id", "init"],
|
||||
fields: {
|
||||
id: {
|
||||
validate: function () {
|
||||
if (!process.env.BABEL_TYPES_8_BREAKING) {
|
||||
return (0, _utils.assertNodeType)("LVal");
|
||||
}
|
||||
|
||||
const normal = (0, _utils.assertNodeType)("Identifier", "ArrayPattern", "ObjectPattern");
|
||||
const without = (0, _utils.assertNodeType)("Identifier");
|
||||
return function (node, key, val) {
|
||||
const validator = node.init ? normal : without;
|
||||
validator(node, key, val);
|
||||
};
|
||||
}()
|
||||
},
|
||||
definite: {
|
||||
optional: true,
|
||||
validate: (0, _utils.assertValueType)("boolean")
|
||||
},
|
||||
init: {
|
||||
optional: true,
|
||||
validate: (0, _utils.assertNodeType)("Expression")
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("WhileStatement", {
|
||||
visitor: ["test", "body"],
|
||||
aliases: ["Statement", "BlockParent", "Loop", "While", "Scopable"],
|
||||
fields: {
|
||||
test: {
|
||||
validate: (0, _utils.assertNodeType)("Expression")
|
||||
},
|
||||
body: {
|
||||
validate: (0, _utils.assertNodeType)("Statement")
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("WithStatement", {
|
||||
visitor: ["object", "body"],
|
||||
aliases: ["Statement"],
|
||||
fields: {
|
||||
object: {
|
||||
validate: (0, _utils.assertNodeType)("Expression")
|
||||
},
|
||||
body: {
|
||||
validate: (0, _utils.assertNodeType)("Statement")
|
||||
}
|
||||
}
|
||||
});
|
||||
467
node_modules/@types/babel__generator/node_modules/@babel/types/lib/definitions/es2015.js
generated
vendored
Normal file
467
node_modules/@types/babel__generator/node_modules/@babel/types/lib/definitions/es2015.js
generated
vendored
Normal file
@@ -0,0 +1,467 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.classMethodOrDeclareMethodCommon = exports.classMethodOrPropertyCommon = void 0;
|
||||
|
||||
var _utils = _interopRequireWildcard(require("./utils"));
|
||||
|
||||
var _core = require("./core");
|
||||
|
||||
var _is = _interopRequireDefault(require("../validators/is"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
(0, _utils.default)("AssignmentPattern", {
|
||||
visitor: ["left", "right", "decorators"],
|
||||
builder: ["left", "right"],
|
||||
aliases: ["Pattern", "PatternLike", "LVal"],
|
||||
fields: Object.assign({}, _core.patternLikeCommon, {
|
||||
left: {
|
||||
validate: (0, _utils.assertNodeType)("Identifier", "ObjectPattern", "ArrayPattern", "MemberExpression")
|
||||
},
|
||||
right: {
|
||||
validate: (0, _utils.assertNodeType)("Expression")
|
||||
},
|
||||
decorators: {
|
||||
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Decorator"))),
|
||||
optional: true
|
||||
}
|
||||
})
|
||||
});
|
||||
(0, _utils.default)("ArrayPattern", {
|
||||
visitor: ["elements", "typeAnnotation"],
|
||||
builder: ["elements"],
|
||||
aliases: ["Pattern", "PatternLike", "LVal"],
|
||||
fields: Object.assign({}, _core.patternLikeCommon, {
|
||||
elements: {
|
||||
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeOrValueType)("null", "PatternLike")))
|
||||
},
|
||||
decorators: {
|
||||
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Decorator"))),
|
||||
optional: true
|
||||
}
|
||||
})
|
||||
});
|
||||
(0, _utils.default)("ArrowFunctionExpression", {
|
||||
builder: ["params", "body", "async"],
|
||||
visitor: ["params", "body", "returnType", "typeParameters"],
|
||||
aliases: ["Scopable", "Function", "BlockParent", "FunctionParent", "Expression", "Pureish"],
|
||||
fields: Object.assign({}, _core.functionCommon, {}, _core.functionTypeAnnotationCommon, {
|
||||
expression: {
|
||||
validate: (0, _utils.assertValueType)("boolean")
|
||||
},
|
||||
body: {
|
||||
validate: (0, _utils.assertNodeType)("BlockStatement", "Expression")
|
||||
}
|
||||
})
|
||||
});
|
||||
(0, _utils.default)("ClassBody", {
|
||||
visitor: ["body"],
|
||||
fields: {
|
||||
body: {
|
||||
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("ClassMethod", "ClassPrivateMethod", "ClassProperty", "ClassPrivateProperty", "TSDeclareMethod", "TSIndexSignature")))
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("ClassExpression", {
|
||||
builder: ["id", "superClass", "body", "decorators"],
|
||||
visitor: ["id", "body", "superClass", "mixins", "typeParameters", "superTypeParameters", "implements", "decorators"],
|
||||
aliases: ["Scopable", "Class", "Expression", "Pureish"],
|
||||
fields: {
|
||||
id: {
|
||||
validate: (0, _utils.assertNodeType)("Identifier"),
|
||||
optional: true
|
||||
},
|
||||
typeParameters: {
|
||||
validate: (0, _utils.assertNodeType)("TypeParameterDeclaration", "TSTypeParameterDeclaration", "Noop"),
|
||||
optional: true
|
||||
},
|
||||
body: {
|
||||
validate: (0, _utils.assertNodeType)("ClassBody")
|
||||
},
|
||||
superClass: {
|
||||
optional: true,
|
||||
validate: (0, _utils.assertNodeType)("Expression")
|
||||
},
|
||||
superTypeParameters: {
|
||||
validate: (0, _utils.assertNodeType)("TypeParameterInstantiation", "TSTypeParameterInstantiation"),
|
||||
optional: true
|
||||
},
|
||||
implements: {
|
||||
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("TSExpressionWithTypeArguments", "ClassImplements"))),
|
||||
optional: true
|
||||
},
|
||||
decorators: {
|
||||
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Decorator"))),
|
||||
optional: true
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("ClassDeclaration", {
|
||||
inherits: "ClassExpression",
|
||||
aliases: ["Scopable", "Class", "Statement", "Declaration", "Pureish"],
|
||||
fields: {
|
||||
declare: {
|
||||
validate: (0, _utils.assertValueType)("boolean"),
|
||||
optional: true
|
||||
},
|
||||
abstract: {
|
||||
validate: (0, _utils.assertValueType)("boolean"),
|
||||
optional: true
|
||||
}
|
||||
},
|
||||
validate: function () {
|
||||
const identifier = (0, _utils.assertNodeType)("Identifier");
|
||||
return function (parent, key, node) {
|
||||
if (!process.env.BABEL_TYPES_8_BREAKING) return;
|
||||
|
||||
if (!(0, _is.default)("ExportDefaultDeclaration", parent)) {
|
||||
identifier(node, "id", node.id);
|
||||
}
|
||||
};
|
||||
}()
|
||||
});
|
||||
(0, _utils.default)("ExportAllDeclaration", {
|
||||
visitor: ["source"],
|
||||
aliases: ["Statement", "Declaration", "ModuleDeclaration", "ExportDeclaration"],
|
||||
fields: {
|
||||
source: {
|
||||
validate: (0, _utils.assertNodeType)("StringLiteral")
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("ExportDefaultDeclaration", {
|
||||
visitor: ["declaration"],
|
||||
aliases: ["Statement", "Declaration", "ModuleDeclaration", "ExportDeclaration"],
|
||||
fields: {
|
||||
declaration: {
|
||||
validate: (0, _utils.assertNodeType)("FunctionDeclaration", "TSDeclareFunction", "ClassDeclaration", "Expression")
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("ExportNamedDeclaration", {
|
||||
visitor: ["declaration", "specifiers", "source"],
|
||||
aliases: ["Statement", "Declaration", "ModuleDeclaration", "ExportDeclaration"],
|
||||
fields: {
|
||||
declaration: {
|
||||
optional: true,
|
||||
validate: (0, _utils.chain)((0, _utils.assertNodeType)("Declaration"), function (node, key, val) {
|
||||
if (!process.env.BABEL_TYPES_8_BREAKING) return;
|
||||
|
||||
if (val && node.specifiers.length) {
|
||||
throw new TypeError("Only declaration or specifiers is allowed on ExportNamedDeclaration");
|
||||
}
|
||||
}, function (node, key, val) {
|
||||
if (!process.env.BABEL_TYPES_8_BREAKING) return;
|
||||
|
||||
if (val && node.source) {
|
||||
throw new TypeError("Cannot export a declaration from a source");
|
||||
}
|
||||
})
|
||||
},
|
||||
specifiers: {
|
||||
default: [],
|
||||
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)(function () {
|
||||
const sourced = (0, _utils.assertNodeType)("ExportSpecifier", "ExportDefaultSpecifier", "ExportNamespaceSpecifier");
|
||||
const sourceless = (0, _utils.assertNodeType)("ExportSpecifier");
|
||||
if (!process.env.BABEL_TYPES_8_BREAKING) return sourced;
|
||||
return function (node, key, val) {
|
||||
const validator = node.source ? sourced : sourceless;
|
||||
validator(node, key, val);
|
||||
};
|
||||
}()))
|
||||
},
|
||||
source: {
|
||||
validate: (0, _utils.assertNodeType)("StringLiteral"),
|
||||
optional: true
|
||||
},
|
||||
exportKind: (0, _utils.validateOptional)((0, _utils.assertOneOf)("type", "value"))
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("ExportSpecifier", {
|
||||
visitor: ["local", "exported"],
|
||||
aliases: ["ModuleSpecifier"],
|
||||
fields: {
|
||||
local: {
|
||||
validate: (0, _utils.assertNodeType)("Identifier")
|
||||
},
|
||||
exported: {
|
||||
validate: (0, _utils.assertNodeType)("Identifier")
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("ForOfStatement", {
|
||||
visitor: ["left", "right", "body"],
|
||||
builder: ["left", "right", "body", "await"],
|
||||
aliases: ["Scopable", "Statement", "For", "BlockParent", "Loop", "ForXStatement"],
|
||||
fields: {
|
||||
left: {
|
||||
validate: function () {
|
||||
if (!process.env.BABEL_TYPES_8_BREAKING) {
|
||||
return (0, _utils.assertNodeType)("VariableDeclaration", "LVal");
|
||||
}
|
||||
|
||||
const declaration = (0, _utils.assertNodeType)("VariableDeclaration");
|
||||
const lval = (0, _utils.assertNodeType)("Identifier", "MemberExpression", "ArrayPattern", "ObjectPattern");
|
||||
return function (node, key, val) {
|
||||
if ((0, _is.default)("VariableDeclaration", val)) {
|
||||
declaration(node, key, val);
|
||||
} else {
|
||||
lval(node, key, val);
|
||||
}
|
||||
};
|
||||
}()
|
||||
},
|
||||
right: {
|
||||
validate: (0, _utils.assertNodeType)("Expression")
|
||||
},
|
||||
body: {
|
||||
validate: (0, _utils.assertNodeType)("Statement")
|
||||
},
|
||||
await: {
|
||||
default: false
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("ImportDeclaration", {
|
||||
visitor: ["specifiers", "source"],
|
||||
aliases: ["Statement", "Declaration", "ModuleDeclaration"],
|
||||
fields: {
|
||||
specifiers: {
|
||||
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("ImportSpecifier", "ImportDefaultSpecifier", "ImportNamespaceSpecifier")))
|
||||
},
|
||||
source: {
|
||||
validate: (0, _utils.assertNodeType)("StringLiteral")
|
||||
},
|
||||
importKind: {
|
||||
validate: (0, _utils.assertOneOf)("type", "typeof", "value"),
|
||||
optional: true
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("ImportDefaultSpecifier", {
|
||||
visitor: ["local"],
|
||||
aliases: ["ModuleSpecifier"],
|
||||
fields: {
|
||||
local: {
|
||||
validate: (0, _utils.assertNodeType)("Identifier")
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("ImportNamespaceSpecifier", {
|
||||
visitor: ["local"],
|
||||
aliases: ["ModuleSpecifier"],
|
||||
fields: {
|
||||
local: {
|
||||
validate: (0, _utils.assertNodeType)("Identifier")
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("ImportSpecifier", {
|
||||
visitor: ["local", "imported"],
|
||||
aliases: ["ModuleSpecifier"],
|
||||
fields: {
|
||||
local: {
|
||||
validate: (0, _utils.assertNodeType)("Identifier")
|
||||
},
|
||||
imported: {
|
||||
validate: (0, _utils.assertNodeType)("Identifier")
|
||||
},
|
||||
importKind: {
|
||||
validate: (0, _utils.assertOneOf)("type", "typeof"),
|
||||
optional: true
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("MetaProperty", {
|
||||
visitor: ["meta", "property"],
|
||||
aliases: ["Expression"],
|
||||
fields: {
|
||||
meta: {
|
||||
validate: (0, _utils.chain)((0, _utils.assertNodeType)("Identifier"), function (node, key, val) {
|
||||
if (!process.env.BABEL_TYPES_8_BREAKING) return;
|
||||
let property;
|
||||
|
||||
switch (val.name) {
|
||||
case "function":
|
||||
property = "sent";
|
||||
break;
|
||||
|
||||
case "new":
|
||||
property = "target";
|
||||
break;
|
||||
|
||||
case "import":
|
||||
property = "meta";
|
||||
break;
|
||||
}
|
||||
|
||||
if (!(0, _is.default)("Identifier", node.property, {
|
||||
name: property
|
||||
})) {
|
||||
throw new TypeError("Unrecognised MetaProperty");
|
||||
}
|
||||
})
|
||||
},
|
||||
property: {
|
||||
validate: (0, _utils.assertNodeType)("Identifier")
|
||||
}
|
||||
}
|
||||
});
|
||||
const classMethodOrPropertyCommon = {
|
||||
abstract: {
|
||||
validate: (0, _utils.assertValueType)("boolean"),
|
||||
optional: true
|
||||
},
|
||||
accessibility: {
|
||||
validate: (0, _utils.assertOneOf)("public", "private", "protected"),
|
||||
optional: true
|
||||
},
|
||||
static: {
|
||||
default: false
|
||||
},
|
||||
computed: {
|
||||
default: false
|
||||
},
|
||||
optional: {
|
||||
validate: (0, _utils.assertValueType)("boolean"),
|
||||
optional: true
|
||||
},
|
||||
key: {
|
||||
validate: (0, _utils.chain)(function () {
|
||||
const normal = (0, _utils.assertNodeType)("Identifier", "StringLiteral", "NumericLiteral");
|
||||
const computed = (0, _utils.assertNodeType)("Expression");
|
||||
return function (node, key, val) {
|
||||
const validator = node.computed ? computed : normal;
|
||||
validator(node, key, val);
|
||||
};
|
||||
}(), (0, _utils.assertNodeType)("Identifier", "StringLiteral", "NumericLiteral", "Expression"))
|
||||
}
|
||||
};
|
||||
exports.classMethodOrPropertyCommon = classMethodOrPropertyCommon;
|
||||
const classMethodOrDeclareMethodCommon = Object.assign({}, _core.functionCommon, {}, classMethodOrPropertyCommon, {
|
||||
kind: {
|
||||
validate: (0, _utils.assertOneOf)("get", "set", "method", "constructor"),
|
||||
default: "method"
|
||||
},
|
||||
access: {
|
||||
validate: (0, _utils.chain)((0, _utils.assertValueType)("string"), (0, _utils.assertOneOf)("public", "private", "protected")),
|
||||
optional: true
|
||||
},
|
||||
decorators: {
|
||||
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Decorator"))),
|
||||
optional: true
|
||||
}
|
||||
});
|
||||
exports.classMethodOrDeclareMethodCommon = classMethodOrDeclareMethodCommon;
|
||||
(0, _utils.default)("ClassMethod", {
|
||||
aliases: ["Function", "Scopable", "BlockParent", "FunctionParent", "Method"],
|
||||
builder: ["kind", "key", "params", "body", "computed", "static", "generator", "async"],
|
||||
visitor: ["key", "params", "body", "decorators", "returnType", "typeParameters"],
|
||||
fields: Object.assign({}, classMethodOrDeclareMethodCommon, {}, _core.functionTypeAnnotationCommon, {
|
||||
body: {
|
||||
validate: (0, _utils.assertNodeType)("BlockStatement")
|
||||
}
|
||||
})
|
||||
});
|
||||
(0, _utils.default)("ObjectPattern", {
|
||||
visitor: ["properties", "typeAnnotation", "decorators"],
|
||||
builder: ["properties"],
|
||||
aliases: ["Pattern", "PatternLike", "LVal"],
|
||||
fields: Object.assign({}, _core.patternLikeCommon, {
|
||||
properties: {
|
||||
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("RestElement", "ObjectProperty")))
|
||||
}
|
||||
})
|
||||
});
|
||||
(0, _utils.default)("SpreadElement", {
|
||||
visitor: ["argument"],
|
||||
aliases: ["UnaryLike"],
|
||||
deprecatedAlias: "SpreadProperty",
|
||||
fields: {
|
||||
argument: {
|
||||
validate: (0, _utils.assertNodeType)("Expression")
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("Super", {
|
||||
aliases: ["Expression"]
|
||||
});
|
||||
(0, _utils.default)("TaggedTemplateExpression", {
|
||||
visitor: ["tag", "quasi"],
|
||||
aliases: ["Expression"],
|
||||
fields: {
|
||||
tag: {
|
||||
validate: (0, _utils.assertNodeType)("Expression")
|
||||
},
|
||||
quasi: {
|
||||
validate: (0, _utils.assertNodeType)("TemplateLiteral")
|
||||
},
|
||||
typeParameters: {
|
||||
validate: (0, _utils.assertNodeType)("TypeParameterInstantiation", "TSTypeParameterInstantiation"),
|
||||
optional: true
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TemplateElement", {
|
||||
builder: ["value", "tail"],
|
||||
fields: {
|
||||
value: {
|
||||
validate: (0, _utils.assertShape)({
|
||||
raw: {
|
||||
validate: (0, _utils.assertValueType)("string")
|
||||
},
|
||||
cooked: {
|
||||
validate: (0, _utils.assertValueType)("string"),
|
||||
optional: true
|
||||
}
|
||||
})
|
||||
},
|
||||
tail: {
|
||||
default: false
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TemplateLiteral", {
|
||||
visitor: ["quasis", "expressions"],
|
||||
aliases: ["Expression", "Literal"],
|
||||
fields: {
|
||||
quasis: {
|
||||
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("TemplateElement")))
|
||||
},
|
||||
expressions: {
|
||||
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Expression")), function (node, key, val) {
|
||||
if (node.quasis.length !== val.length + 1) {
|
||||
throw new TypeError(`Number of ${node.type} quasis should be exactly one more than the number of expressions.\nExpected ${val.length + 1} quasis but got ${node.quasis.length}`);
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("YieldExpression", {
|
||||
builder: ["argument", "delegate"],
|
||||
visitor: ["argument"],
|
||||
aliases: ["Expression", "Terminatorless"],
|
||||
fields: {
|
||||
delegate: {
|
||||
validate: (0, _utils.chain)((0, _utils.assertValueType)("boolean"), function (node, key, val) {
|
||||
if (!process.env.BABEL_TYPES_8_BREAKING) return;
|
||||
|
||||
if (val && !node.argument) {
|
||||
throw new TypeError("Property delegate of YieldExpression cannot be true if there is no argument");
|
||||
}
|
||||
}),
|
||||
default: false
|
||||
},
|
||||
argument: {
|
||||
optional: true,
|
||||
validate: (0, _utils.assertNodeType)("Expression")
|
||||
}
|
||||
}
|
||||
});
|
||||
222
node_modules/@types/babel__generator/node_modules/@babel/types/lib/definitions/experimental.js
generated
vendored
Normal file
222
node_modules/@types/babel__generator/node_modules/@babel/types/lib/definitions/experimental.js
generated
vendored
Normal file
@@ -0,0 +1,222 @@
|
||||
"use strict";
|
||||
|
||||
var _utils = _interopRequireWildcard(require("./utils"));
|
||||
|
||||
var _es = require("./es2015");
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
(0, _utils.default)("ArgumentPlaceholder", {});
|
||||
(0, _utils.default)("AwaitExpression", {
|
||||
builder: ["argument"],
|
||||
visitor: ["argument"],
|
||||
aliases: ["Expression", "Terminatorless"],
|
||||
fields: {
|
||||
argument: {
|
||||
validate: (0, _utils.assertNodeType)("Expression")
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("BindExpression", {
|
||||
visitor: ["object", "callee"],
|
||||
aliases: ["Expression"],
|
||||
fields: !process.env.BABEL_TYPES_8_BREAKING ? {} : {
|
||||
object: {
|
||||
validate: (0, _utils.assertNodeType)("Expression")
|
||||
},
|
||||
callee: {
|
||||
validate: (0, _utils.assertNodeType)("Expression")
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("ClassProperty", {
|
||||
visitor: ["key", "value", "typeAnnotation", "decorators"],
|
||||
builder: ["key", "value", "typeAnnotation", "decorators", "computed", "static"],
|
||||
aliases: ["Property"],
|
||||
fields: Object.assign({}, _es.classMethodOrPropertyCommon, {
|
||||
value: {
|
||||
validate: (0, _utils.assertNodeType)("Expression"),
|
||||
optional: true
|
||||
},
|
||||
definite: {
|
||||
validate: (0, _utils.assertValueType)("boolean"),
|
||||
optional: true
|
||||
},
|
||||
typeAnnotation: {
|
||||
validate: (0, _utils.assertNodeType)("TypeAnnotation", "TSTypeAnnotation", "Noop"),
|
||||
optional: true
|
||||
},
|
||||
decorators: {
|
||||
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Decorator"))),
|
||||
optional: true
|
||||
},
|
||||
readonly: {
|
||||
validate: (0, _utils.assertValueType)("boolean"),
|
||||
optional: true
|
||||
},
|
||||
declare: {
|
||||
validate: (0, _utils.assertValueType)("boolean"),
|
||||
optional: true
|
||||
}
|
||||
})
|
||||
});
|
||||
(0, _utils.default)("OptionalMemberExpression", {
|
||||
builder: ["object", "property", "computed", "optional"],
|
||||
visitor: ["object", "property"],
|
||||
aliases: ["Expression"],
|
||||
fields: {
|
||||
object: {
|
||||
validate: (0, _utils.assertNodeType)("Expression")
|
||||
},
|
||||
property: {
|
||||
validate: function () {
|
||||
const normal = (0, _utils.assertNodeType)("Identifier");
|
||||
const computed = (0, _utils.assertNodeType)("Expression");
|
||||
return function (node, key, val) {
|
||||
const validator = node.computed ? computed : normal;
|
||||
validator(node, key, val);
|
||||
};
|
||||
}()
|
||||
},
|
||||
computed: {
|
||||
default: false
|
||||
},
|
||||
optional: {
|
||||
validate: (0, _utils.assertValueType)("boolean")
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("PipelineTopicExpression", {
|
||||
builder: ["expression"],
|
||||
visitor: ["expression"],
|
||||
fields: {
|
||||
expression: {
|
||||
validate: (0, _utils.assertNodeType)("Expression")
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("PipelineBareFunction", {
|
||||
builder: ["callee"],
|
||||
visitor: ["callee"],
|
||||
fields: {
|
||||
callee: {
|
||||
validate: (0, _utils.assertNodeType)("Expression")
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("PipelinePrimaryTopicReference", {
|
||||
aliases: ["Expression"]
|
||||
});
|
||||
(0, _utils.default)("OptionalCallExpression", {
|
||||
visitor: ["callee", "arguments", "typeParameters", "typeArguments"],
|
||||
builder: ["callee", "arguments", "optional"],
|
||||
aliases: ["Expression"],
|
||||
fields: {
|
||||
callee: {
|
||||
validate: (0, _utils.assertNodeType)("Expression")
|
||||
},
|
||||
arguments: {
|
||||
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Expression", "SpreadElement", "JSXNamespacedName")))
|
||||
},
|
||||
optional: {
|
||||
validate: (0, _utils.assertValueType)("boolean")
|
||||
},
|
||||
typeArguments: {
|
||||
validate: (0, _utils.assertNodeType)("TypeParameterInstantiation"),
|
||||
optional: true
|
||||
},
|
||||
typeParameters: {
|
||||
validate: (0, _utils.assertNodeType)("TSTypeParameterInstantiation"),
|
||||
optional: true
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("ClassPrivateProperty", {
|
||||
visitor: ["key", "value", "decorators"],
|
||||
builder: ["key", "value", "decorators"],
|
||||
aliases: ["Property", "Private"],
|
||||
fields: {
|
||||
key: {
|
||||
validate: (0, _utils.assertNodeType)("PrivateName")
|
||||
},
|
||||
value: {
|
||||
validate: (0, _utils.assertNodeType)("Expression"),
|
||||
optional: true
|
||||
},
|
||||
decorators: {
|
||||
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Decorator"))),
|
||||
optional: true
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("ClassPrivateMethod", {
|
||||
builder: ["kind", "key", "params", "body", "static"],
|
||||
visitor: ["key", "params", "body", "decorators", "returnType", "typeParameters"],
|
||||
aliases: ["Function", "Scopable", "BlockParent", "FunctionParent", "Method", "Private"],
|
||||
fields: Object.assign({}, _es.classMethodOrDeclareMethodCommon, {
|
||||
key: {
|
||||
validate: (0, _utils.assertNodeType)("PrivateName")
|
||||
},
|
||||
body: {
|
||||
validate: (0, _utils.assertNodeType)("BlockStatement")
|
||||
}
|
||||
})
|
||||
});
|
||||
(0, _utils.default)("Import", {
|
||||
aliases: ["Expression"]
|
||||
});
|
||||
(0, _utils.default)("Decorator", {
|
||||
visitor: ["expression"],
|
||||
fields: {
|
||||
expression: {
|
||||
validate: (0, _utils.assertNodeType)("Expression")
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("DoExpression", {
|
||||
visitor: ["body"],
|
||||
aliases: ["Expression"],
|
||||
fields: {
|
||||
body: {
|
||||
validate: (0, _utils.assertNodeType)("BlockStatement")
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("ExportDefaultSpecifier", {
|
||||
visitor: ["exported"],
|
||||
aliases: ["ModuleSpecifier"],
|
||||
fields: {
|
||||
exported: {
|
||||
validate: (0, _utils.assertNodeType)("Identifier")
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("ExportNamespaceSpecifier", {
|
||||
visitor: ["exported"],
|
||||
aliases: ["ModuleSpecifier"],
|
||||
fields: {
|
||||
exported: {
|
||||
validate: (0, _utils.assertNodeType)("Identifier")
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("PrivateName", {
|
||||
visitor: ["id"],
|
||||
aliases: ["Private"],
|
||||
fields: {
|
||||
id: {
|
||||
validate: (0, _utils.assertNodeType)("Identifier")
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("BigIntLiteral", {
|
||||
builder: ["value"],
|
||||
fields: {
|
||||
value: {
|
||||
validate: (0, _utils.assertValueType)("string")
|
||||
}
|
||||
},
|
||||
aliases: ["Expression", "Pureish", "Literal", "Immutable"]
|
||||
});
|
||||
458
node_modules/@types/babel__generator/node_modules/@babel/types/lib/definitions/flow.js
generated
vendored
Normal file
458
node_modules/@types/babel__generator/node_modules/@babel/types/lib/definitions/flow.js
generated
vendored
Normal file
@@ -0,0 +1,458 @@
|
||||
"use strict";
|
||||
|
||||
var _utils = _interopRequireWildcard(require("./utils"));
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
const defineInterfaceishType = (name, typeParameterType = "TypeParameterDeclaration") => {
|
||||
(0, _utils.default)(name, {
|
||||
builder: ["id", "typeParameters", "extends", "body"],
|
||||
visitor: ["id", "typeParameters", "extends", "mixins", "implements", "body"],
|
||||
aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
|
||||
fields: {
|
||||
id: (0, _utils.validateType)("Identifier"),
|
||||
typeParameters: (0, _utils.validateOptionalType)(typeParameterType),
|
||||
extends: (0, _utils.validateOptional)((0, _utils.arrayOfType)("InterfaceExtends")),
|
||||
mixins: (0, _utils.validateOptional)((0, _utils.arrayOfType)("InterfaceExtends")),
|
||||
implements: (0, _utils.validateOptional)((0, _utils.arrayOfType)("ClassImplements")),
|
||||
body: (0, _utils.validateType)("ObjectTypeAnnotation")
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
(0, _utils.default)("AnyTypeAnnotation", {
|
||||
aliases: ["Flow", "FlowType", "FlowBaseAnnotation"]
|
||||
});
|
||||
(0, _utils.default)("ArrayTypeAnnotation", {
|
||||
visitor: ["elementType"],
|
||||
aliases: ["Flow", "FlowType"],
|
||||
fields: {
|
||||
elementType: (0, _utils.validateType)("FlowType")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("BooleanTypeAnnotation", {
|
||||
aliases: ["Flow", "FlowType", "FlowBaseAnnotation"]
|
||||
});
|
||||
(0, _utils.default)("BooleanLiteralTypeAnnotation", {
|
||||
builder: ["value"],
|
||||
aliases: ["Flow", "FlowType"],
|
||||
fields: {
|
||||
value: (0, _utils.validate)((0, _utils.assertValueType)("boolean"))
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("NullLiteralTypeAnnotation", {
|
||||
aliases: ["Flow", "FlowType", "FlowBaseAnnotation"]
|
||||
});
|
||||
(0, _utils.default)("ClassImplements", {
|
||||
visitor: ["id", "typeParameters"],
|
||||
aliases: ["Flow"],
|
||||
fields: {
|
||||
id: (0, _utils.validateType)("Identifier"),
|
||||
typeParameters: (0, _utils.validateOptionalType)("TypeParameterInstantiation")
|
||||
}
|
||||
});
|
||||
defineInterfaceishType("DeclareClass");
|
||||
(0, _utils.default)("DeclareFunction", {
|
||||
visitor: ["id"],
|
||||
aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
|
||||
fields: {
|
||||
id: (0, _utils.validateType)("Identifier"),
|
||||
predicate: (0, _utils.validateOptionalType)("DeclaredPredicate")
|
||||
}
|
||||
});
|
||||
defineInterfaceishType("DeclareInterface");
|
||||
(0, _utils.default)("DeclareModule", {
|
||||
builder: ["id", "body", "kind"],
|
||||
visitor: ["id", "body"],
|
||||
aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
|
||||
fields: {
|
||||
id: (0, _utils.validateType)(["Identifier", "StringLiteral"]),
|
||||
body: (0, _utils.validateType)("BlockStatement"),
|
||||
kind: (0, _utils.validateOptional)((0, _utils.assertOneOf)("CommonJS", "ES"))
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("DeclareModuleExports", {
|
||||
visitor: ["typeAnnotation"],
|
||||
aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
|
||||
fields: {
|
||||
typeAnnotation: (0, _utils.validateType)("TypeAnnotation")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("DeclareTypeAlias", {
|
||||
visitor: ["id", "typeParameters", "right"],
|
||||
aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
|
||||
fields: {
|
||||
id: (0, _utils.validateType)("Identifier"),
|
||||
typeParameters: (0, _utils.validateOptionalType)("TypeParameterDeclaration"),
|
||||
right: (0, _utils.validateType)("FlowType")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("DeclareOpaqueType", {
|
||||
visitor: ["id", "typeParameters", "supertype"],
|
||||
aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
|
||||
fields: {
|
||||
id: (0, _utils.validateType)("Identifier"),
|
||||
typeParameters: (0, _utils.validateOptionalType)("TypeParameterDeclaration"),
|
||||
supertype: (0, _utils.validateOptionalType)("FlowType")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("DeclareVariable", {
|
||||
visitor: ["id"],
|
||||
aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
|
||||
fields: {
|
||||
id: (0, _utils.validateType)("Identifier")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("DeclareExportDeclaration", {
|
||||
visitor: ["declaration", "specifiers", "source"],
|
||||
aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
|
||||
fields: {
|
||||
declaration: (0, _utils.validateOptionalType)("Flow"),
|
||||
specifiers: (0, _utils.validateOptional)((0, _utils.arrayOfType)(["ExportSpecifier", "ExportNamespaceSpecifier"])),
|
||||
source: (0, _utils.validateOptionalType)("StringLiteral"),
|
||||
default: (0, _utils.validateOptional)((0, _utils.assertValueType)("boolean"))
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("DeclareExportAllDeclaration", {
|
||||
visitor: ["source"],
|
||||
aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
|
||||
fields: {
|
||||
source: (0, _utils.validateType)("StringLiteral"),
|
||||
exportKind: (0, _utils.validateOptional)((0, _utils.assertOneOf)("type", "value"))
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("DeclaredPredicate", {
|
||||
visitor: ["value"],
|
||||
aliases: ["Flow", "FlowPredicate"],
|
||||
fields: {
|
||||
value: (0, _utils.validateType)("Flow")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("ExistsTypeAnnotation", {
|
||||
aliases: ["Flow", "FlowType"]
|
||||
});
|
||||
(0, _utils.default)("FunctionTypeAnnotation", {
|
||||
visitor: ["typeParameters", "params", "rest", "returnType"],
|
||||
aliases: ["Flow", "FlowType"],
|
||||
fields: {
|
||||
typeParameters: (0, _utils.validateOptionalType)("TypeParameterDeclaration"),
|
||||
params: (0, _utils.validate)((0, _utils.arrayOfType)("FunctionTypeParam")),
|
||||
rest: (0, _utils.validateOptionalType)("FunctionTypeParam"),
|
||||
returnType: (0, _utils.validateType)("FlowType")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("FunctionTypeParam", {
|
||||
visitor: ["name", "typeAnnotation"],
|
||||
aliases: ["Flow"],
|
||||
fields: {
|
||||
name: (0, _utils.validateOptionalType)("Identifier"),
|
||||
typeAnnotation: (0, _utils.validateType)("FlowType"),
|
||||
optional: (0, _utils.validateOptional)((0, _utils.assertValueType)("boolean"))
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("GenericTypeAnnotation", {
|
||||
visitor: ["id", "typeParameters"],
|
||||
aliases: ["Flow", "FlowType"],
|
||||
fields: {
|
||||
id: (0, _utils.validateType)(["Identifier", "QualifiedTypeIdentifier"]),
|
||||
typeParameters: (0, _utils.validateOptionalType)("TypeParameterInstantiation")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("InferredPredicate", {
|
||||
aliases: ["Flow", "FlowPredicate"]
|
||||
});
|
||||
(0, _utils.default)("InterfaceExtends", {
|
||||
visitor: ["id", "typeParameters"],
|
||||
aliases: ["Flow"],
|
||||
fields: {
|
||||
id: (0, _utils.validateType)(["Identifier", "QualifiedTypeIdentifier"]),
|
||||
typeParameters: (0, _utils.validateOptionalType)("TypeParameterInstantiation")
|
||||
}
|
||||
});
|
||||
defineInterfaceishType("InterfaceDeclaration");
|
||||
(0, _utils.default)("InterfaceTypeAnnotation", {
|
||||
visitor: ["extends", "body"],
|
||||
aliases: ["Flow", "FlowType"],
|
||||
fields: {
|
||||
extends: (0, _utils.validateOptional)((0, _utils.arrayOfType)("InterfaceExtends")),
|
||||
body: (0, _utils.validateType)("ObjectTypeAnnotation")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("IntersectionTypeAnnotation", {
|
||||
visitor: ["types"],
|
||||
aliases: ["Flow", "FlowType"],
|
||||
fields: {
|
||||
types: (0, _utils.validate)((0, _utils.arrayOfType)("FlowType"))
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("MixedTypeAnnotation", {
|
||||
aliases: ["Flow", "FlowType", "FlowBaseAnnotation"]
|
||||
});
|
||||
(0, _utils.default)("EmptyTypeAnnotation", {
|
||||
aliases: ["Flow", "FlowType", "FlowBaseAnnotation"]
|
||||
});
|
||||
(0, _utils.default)("NullableTypeAnnotation", {
|
||||
visitor: ["typeAnnotation"],
|
||||
aliases: ["Flow", "FlowType"],
|
||||
fields: {
|
||||
typeAnnotation: (0, _utils.validateType)("FlowType")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("NumberLiteralTypeAnnotation", {
|
||||
builder: ["value"],
|
||||
aliases: ["Flow", "FlowType"],
|
||||
fields: {
|
||||
value: (0, _utils.validate)((0, _utils.assertValueType)("number"))
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("NumberTypeAnnotation", {
|
||||
aliases: ["Flow", "FlowType", "FlowBaseAnnotation"]
|
||||
});
|
||||
(0, _utils.default)("ObjectTypeAnnotation", {
|
||||
visitor: ["properties", "indexers", "callProperties", "internalSlots"],
|
||||
aliases: ["Flow", "FlowType"],
|
||||
builder: ["properties", "indexers", "callProperties", "internalSlots", "exact"],
|
||||
fields: {
|
||||
properties: (0, _utils.validate)((0, _utils.arrayOfType)(["ObjectTypeProperty", "ObjectTypeSpreadProperty"])),
|
||||
indexers: (0, _utils.validateOptional)((0, _utils.arrayOfType)("ObjectTypeIndexer")),
|
||||
callProperties: (0, _utils.validateOptional)((0, _utils.arrayOfType)("ObjectTypeCallProperty")),
|
||||
internalSlots: (0, _utils.validateOptional)((0, _utils.arrayOfType)("ObjectTypeInternalSlot")),
|
||||
exact: {
|
||||
validate: (0, _utils.assertValueType)("boolean"),
|
||||
default: false
|
||||
},
|
||||
inexact: (0, _utils.validateOptional)((0, _utils.assertValueType)("boolean"))
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("ObjectTypeInternalSlot", {
|
||||
visitor: ["id", "value", "optional", "static", "method"],
|
||||
aliases: ["Flow", "UserWhitespacable"],
|
||||
fields: {
|
||||
id: (0, _utils.validateType)("Identifier"),
|
||||
value: (0, _utils.validateType)("FlowType"),
|
||||
optional: (0, _utils.validate)((0, _utils.assertValueType)("boolean")),
|
||||
static: (0, _utils.validate)((0, _utils.assertValueType)("boolean")),
|
||||
method: (0, _utils.validate)((0, _utils.assertValueType)("boolean"))
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("ObjectTypeCallProperty", {
|
||||
visitor: ["value"],
|
||||
aliases: ["Flow", "UserWhitespacable"],
|
||||
fields: {
|
||||
value: (0, _utils.validateType)("FlowType"),
|
||||
static: (0, _utils.validate)((0, _utils.assertValueType)("boolean"))
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("ObjectTypeIndexer", {
|
||||
visitor: ["id", "key", "value", "variance"],
|
||||
aliases: ["Flow", "UserWhitespacable"],
|
||||
fields: {
|
||||
id: (0, _utils.validateOptionalType)("Identifier"),
|
||||
key: (0, _utils.validateType)("FlowType"),
|
||||
value: (0, _utils.validateType)("FlowType"),
|
||||
static: (0, _utils.validate)((0, _utils.assertValueType)("boolean")),
|
||||
variance: (0, _utils.validateOptionalType)("Variance")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("ObjectTypeProperty", {
|
||||
visitor: ["key", "value", "variance"],
|
||||
aliases: ["Flow", "UserWhitespacable"],
|
||||
fields: {
|
||||
key: (0, _utils.validateType)(["Identifier", "StringLiteral"]),
|
||||
value: (0, _utils.validateType)("FlowType"),
|
||||
kind: (0, _utils.validate)((0, _utils.assertOneOf)("init", "get", "set")),
|
||||
static: (0, _utils.validate)((0, _utils.assertValueType)("boolean")),
|
||||
proto: (0, _utils.validate)((0, _utils.assertValueType)("boolean")),
|
||||
optional: (0, _utils.validate)((0, _utils.assertValueType)("boolean")),
|
||||
variance: (0, _utils.validateOptionalType)("Variance")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("ObjectTypeSpreadProperty", {
|
||||
visitor: ["argument"],
|
||||
aliases: ["Flow", "UserWhitespacable"],
|
||||
fields: {
|
||||
argument: (0, _utils.validateType)("FlowType")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("OpaqueType", {
|
||||
visitor: ["id", "typeParameters", "supertype", "impltype"],
|
||||
aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
|
||||
fields: {
|
||||
id: (0, _utils.validateType)("Identifier"),
|
||||
typeParameters: (0, _utils.validateOptionalType)("TypeParameterDeclaration"),
|
||||
supertype: (0, _utils.validateOptionalType)("FlowType"),
|
||||
impltype: (0, _utils.validateType)("FlowType")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("QualifiedTypeIdentifier", {
|
||||
visitor: ["id", "qualification"],
|
||||
aliases: ["Flow"],
|
||||
fields: {
|
||||
id: (0, _utils.validateType)("Identifier"),
|
||||
qualification: (0, _utils.validateType)(["Identifier", "QualifiedTypeIdentifier"])
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("StringLiteralTypeAnnotation", {
|
||||
builder: ["value"],
|
||||
aliases: ["Flow", "FlowType"],
|
||||
fields: {
|
||||
value: (0, _utils.validate)((0, _utils.assertValueType)("string"))
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("StringTypeAnnotation", {
|
||||
aliases: ["Flow", "FlowType", "FlowBaseAnnotation"]
|
||||
});
|
||||
(0, _utils.default)("ThisTypeAnnotation", {
|
||||
aliases: ["Flow", "FlowType", "FlowBaseAnnotation"]
|
||||
});
|
||||
(0, _utils.default)("TupleTypeAnnotation", {
|
||||
visitor: ["types"],
|
||||
aliases: ["Flow", "FlowType"],
|
||||
fields: {
|
||||
types: (0, _utils.validate)((0, _utils.arrayOfType)("FlowType"))
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TypeofTypeAnnotation", {
|
||||
visitor: ["argument"],
|
||||
aliases: ["Flow", "FlowType"],
|
||||
fields: {
|
||||
argument: (0, _utils.validateType)("FlowType")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TypeAlias", {
|
||||
visitor: ["id", "typeParameters", "right"],
|
||||
aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
|
||||
fields: {
|
||||
id: (0, _utils.validateType)("Identifier"),
|
||||
typeParameters: (0, _utils.validateOptionalType)("TypeParameterDeclaration"),
|
||||
right: (0, _utils.validateType)("FlowType")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TypeAnnotation", {
|
||||
aliases: ["Flow"],
|
||||
visitor: ["typeAnnotation"],
|
||||
fields: {
|
||||
typeAnnotation: (0, _utils.validateType)("FlowType")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TypeCastExpression", {
|
||||
visitor: ["expression", "typeAnnotation"],
|
||||
aliases: ["Flow", "ExpressionWrapper", "Expression"],
|
||||
fields: {
|
||||
expression: (0, _utils.validateType)("Expression"),
|
||||
typeAnnotation: (0, _utils.validateType)("TypeAnnotation")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TypeParameter", {
|
||||
aliases: ["Flow"],
|
||||
visitor: ["bound", "default", "variance"],
|
||||
fields: {
|
||||
name: (0, _utils.validate)((0, _utils.assertValueType)("string")),
|
||||
bound: (0, _utils.validateOptionalType)("TypeAnnotation"),
|
||||
default: (0, _utils.validateOptionalType)("FlowType"),
|
||||
variance: (0, _utils.validateOptionalType)("Variance")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TypeParameterDeclaration", {
|
||||
aliases: ["Flow"],
|
||||
visitor: ["params"],
|
||||
fields: {
|
||||
params: (0, _utils.validate)((0, _utils.arrayOfType)("TypeParameter"))
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TypeParameterInstantiation", {
|
||||
aliases: ["Flow"],
|
||||
visitor: ["params"],
|
||||
fields: {
|
||||
params: (0, _utils.validate)((0, _utils.arrayOfType)("FlowType"))
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("UnionTypeAnnotation", {
|
||||
visitor: ["types"],
|
||||
aliases: ["Flow", "FlowType"],
|
||||
fields: {
|
||||
types: (0, _utils.validate)((0, _utils.arrayOfType)("FlowType"))
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("Variance", {
|
||||
aliases: ["Flow"],
|
||||
builder: ["kind"],
|
||||
fields: {
|
||||
kind: (0, _utils.validate)((0, _utils.assertOneOf)("minus", "plus"))
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("VoidTypeAnnotation", {
|
||||
aliases: ["Flow", "FlowType", "FlowBaseAnnotation"]
|
||||
});
|
||||
(0, _utils.default)("EnumDeclaration", {
|
||||
aliases: ["Declaration"],
|
||||
visitor: ["id", "body"],
|
||||
fields: {
|
||||
id: (0, _utils.validateType)("Identifier"),
|
||||
body: (0, _utils.validateType)(["EnumBooleanBody", "EnumNumberBody", "EnumStringBody", "EnumSymbolBody"])
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("EnumBooleanBody", {
|
||||
aliases: ["EnumBody"],
|
||||
visitor: ["members"],
|
||||
fields: {
|
||||
explicit: (0, _utils.validate)((0, _utils.assertValueType)("boolean")),
|
||||
members: (0, _utils.validateArrayOfType)("EnumBooleanMember")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("EnumNumberBody", {
|
||||
aliases: ["EnumBody"],
|
||||
visitor: ["members"],
|
||||
fields: {
|
||||
explicit: (0, _utils.validate)((0, _utils.assertValueType)("boolean")),
|
||||
members: (0, _utils.validateArrayOfType)("EnumNumberMember")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("EnumStringBody", {
|
||||
aliases: ["EnumBody"],
|
||||
visitor: ["members"],
|
||||
fields: {
|
||||
explicit: (0, _utils.validate)((0, _utils.assertValueType)("boolean")),
|
||||
members: (0, _utils.validateArrayOfType)(["EnumStringMember", "EnumDefaultedMember"])
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("EnumSymbolBody", {
|
||||
aliases: ["EnumBody"],
|
||||
visitor: ["members"],
|
||||
fields: {
|
||||
members: (0, _utils.validateArrayOfType)("EnumDefaultedMember")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("EnumBooleanMember", {
|
||||
aliases: ["EnumMember"],
|
||||
visitor: ["id"],
|
||||
fields: {
|
||||
id: (0, _utils.validateType)("Identifier"),
|
||||
init: (0, _utils.validateType)("BooleanLiteral")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("EnumNumberMember", {
|
||||
aliases: ["EnumMember"],
|
||||
visitor: ["id", "init"],
|
||||
fields: {
|
||||
id: (0, _utils.validateType)("Identifier"),
|
||||
init: (0, _utils.validateType)("NumericLiteral")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("EnumStringMember", {
|
||||
aliases: ["EnumMember"],
|
||||
visitor: ["id", "init"],
|
||||
fields: {
|
||||
id: (0, _utils.validateType)("Identifier"),
|
||||
init: (0, _utils.validateType)("StringLiteral")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("EnumDefaultedMember", {
|
||||
aliases: ["EnumMember"],
|
||||
visitor: ["id"],
|
||||
fields: {
|
||||
id: (0, _utils.validateType)("Identifier")
|
||||
}
|
||||
});
|
||||
99
node_modules/@types/babel__generator/node_modules/@babel/types/lib/definitions/index.js
generated
vendored
Normal file
99
node_modules/@types/babel__generator/node_modules/@babel/types/lib/definitions/index.js
generated
vendored
Normal file
@@ -0,0 +1,99 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "VISITOR_KEYS", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _utils.VISITOR_KEYS;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "ALIAS_KEYS", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _utils.ALIAS_KEYS;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "FLIPPED_ALIAS_KEYS", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _utils.FLIPPED_ALIAS_KEYS;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "NODE_FIELDS", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _utils.NODE_FIELDS;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "BUILDER_KEYS", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _utils.BUILDER_KEYS;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "DEPRECATED_KEYS", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _utils.DEPRECATED_KEYS;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "NODE_PARENT_VALIDATIONS", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _utils.NODE_PARENT_VALIDATIONS;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "PLACEHOLDERS", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _placeholders.PLACEHOLDERS;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "PLACEHOLDERS_ALIAS", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _placeholders.PLACEHOLDERS_ALIAS;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "PLACEHOLDERS_FLIPPED_ALIAS", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _placeholders.PLACEHOLDERS_FLIPPED_ALIAS;
|
||||
}
|
||||
});
|
||||
exports.TYPES = void 0;
|
||||
|
||||
var _toFastProperties = _interopRequireDefault(require("to-fast-properties"));
|
||||
|
||||
require("./core");
|
||||
|
||||
require("./es2015");
|
||||
|
||||
require("./flow");
|
||||
|
||||
require("./jsx");
|
||||
|
||||
require("./misc");
|
||||
|
||||
require("./experimental");
|
||||
|
||||
require("./typescript");
|
||||
|
||||
var _utils = require("./utils");
|
||||
|
||||
var _placeholders = require("./placeholders");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
(0, _toFastProperties.default)(_utils.VISITOR_KEYS);
|
||||
(0, _toFastProperties.default)(_utils.ALIAS_KEYS);
|
||||
(0, _toFastProperties.default)(_utils.FLIPPED_ALIAS_KEYS);
|
||||
(0, _toFastProperties.default)(_utils.NODE_FIELDS);
|
||||
(0, _toFastProperties.default)(_utils.BUILDER_KEYS);
|
||||
(0, _toFastProperties.default)(_utils.DEPRECATED_KEYS);
|
||||
(0, _toFastProperties.default)(_placeholders.PLACEHOLDERS_ALIAS);
|
||||
(0, _toFastProperties.default)(_placeholders.PLACEHOLDERS_FLIPPED_ALIAS);
|
||||
const TYPES = Object.keys(_utils.VISITOR_KEYS).concat(Object.keys(_utils.FLIPPED_ALIAS_KEYS)).concat(Object.keys(_utils.DEPRECATED_KEYS));
|
||||
exports.TYPES = TYPES;
|
||||
161
node_modules/@types/babel__generator/node_modules/@babel/types/lib/definitions/jsx.js
generated
vendored
Normal file
161
node_modules/@types/babel__generator/node_modules/@babel/types/lib/definitions/jsx.js
generated
vendored
Normal file
@@ -0,0 +1,161 @@
|
||||
"use strict";
|
||||
|
||||
var _utils = _interopRequireWildcard(require("./utils"));
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
(0, _utils.default)("JSXAttribute", {
|
||||
visitor: ["name", "value"],
|
||||
aliases: ["JSX", "Immutable"],
|
||||
fields: {
|
||||
name: {
|
||||
validate: (0, _utils.assertNodeType)("JSXIdentifier", "JSXNamespacedName")
|
||||
},
|
||||
value: {
|
||||
optional: true,
|
||||
validate: (0, _utils.assertNodeType)("JSXElement", "JSXFragment", "StringLiteral", "JSXExpressionContainer")
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("JSXClosingElement", {
|
||||
visitor: ["name"],
|
||||
aliases: ["JSX", "Immutable"],
|
||||
fields: {
|
||||
name: {
|
||||
validate: (0, _utils.assertNodeType)("JSXIdentifier", "JSXMemberExpression", "JSXNamespacedName")
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("JSXElement", {
|
||||
builder: ["openingElement", "closingElement", "children", "selfClosing"],
|
||||
visitor: ["openingElement", "children", "closingElement"],
|
||||
aliases: ["JSX", "Immutable", "Expression"],
|
||||
fields: {
|
||||
openingElement: {
|
||||
validate: (0, _utils.assertNodeType)("JSXOpeningElement")
|
||||
},
|
||||
closingElement: {
|
||||
optional: true,
|
||||
validate: (0, _utils.assertNodeType)("JSXClosingElement")
|
||||
},
|
||||
children: {
|
||||
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("JSXText", "JSXExpressionContainer", "JSXSpreadChild", "JSXElement", "JSXFragment")))
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("JSXEmptyExpression", {
|
||||
aliases: ["JSX"]
|
||||
});
|
||||
(0, _utils.default)("JSXExpressionContainer", {
|
||||
visitor: ["expression"],
|
||||
aliases: ["JSX", "Immutable"],
|
||||
fields: {
|
||||
expression: {
|
||||
validate: (0, _utils.assertNodeType)("Expression", "JSXEmptyExpression")
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("JSXSpreadChild", {
|
||||
visitor: ["expression"],
|
||||
aliases: ["JSX", "Immutable"],
|
||||
fields: {
|
||||
expression: {
|
||||
validate: (0, _utils.assertNodeType)("Expression")
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("JSXIdentifier", {
|
||||
builder: ["name"],
|
||||
aliases: ["JSX"],
|
||||
fields: {
|
||||
name: {
|
||||
validate: (0, _utils.assertValueType)("string")
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("JSXMemberExpression", {
|
||||
visitor: ["object", "property"],
|
||||
aliases: ["JSX"],
|
||||
fields: {
|
||||
object: {
|
||||
validate: (0, _utils.assertNodeType)("JSXMemberExpression", "JSXIdentifier")
|
||||
},
|
||||
property: {
|
||||
validate: (0, _utils.assertNodeType)("JSXIdentifier")
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("JSXNamespacedName", {
|
||||
visitor: ["namespace", "name"],
|
||||
aliases: ["JSX"],
|
||||
fields: {
|
||||
namespace: {
|
||||
validate: (0, _utils.assertNodeType)("JSXIdentifier")
|
||||
},
|
||||
name: {
|
||||
validate: (0, _utils.assertNodeType)("JSXIdentifier")
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("JSXOpeningElement", {
|
||||
builder: ["name", "attributes", "selfClosing"],
|
||||
visitor: ["name", "attributes"],
|
||||
aliases: ["JSX", "Immutable"],
|
||||
fields: {
|
||||
name: {
|
||||
validate: (0, _utils.assertNodeType)("JSXIdentifier", "JSXMemberExpression", "JSXNamespacedName")
|
||||
},
|
||||
selfClosing: {
|
||||
default: false
|
||||
},
|
||||
attributes: {
|
||||
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("JSXAttribute", "JSXSpreadAttribute")))
|
||||
},
|
||||
typeParameters: {
|
||||
validate: (0, _utils.assertNodeType)("TypeParameterInstantiation", "TSTypeParameterInstantiation"),
|
||||
optional: true
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("JSXSpreadAttribute", {
|
||||
visitor: ["argument"],
|
||||
aliases: ["JSX"],
|
||||
fields: {
|
||||
argument: {
|
||||
validate: (0, _utils.assertNodeType)("Expression")
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("JSXText", {
|
||||
aliases: ["JSX", "Immutable"],
|
||||
builder: ["value"],
|
||||
fields: {
|
||||
value: {
|
||||
validate: (0, _utils.assertValueType)("string")
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("JSXFragment", {
|
||||
builder: ["openingFragment", "closingFragment", "children"],
|
||||
visitor: ["openingFragment", "children", "closingFragment"],
|
||||
aliases: ["JSX", "Immutable", "Expression"],
|
||||
fields: {
|
||||
openingFragment: {
|
||||
validate: (0, _utils.assertNodeType)("JSXOpeningFragment")
|
||||
},
|
||||
closingFragment: {
|
||||
validate: (0, _utils.assertNodeType)("JSXClosingFragment")
|
||||
},
|
||||
children: {
|
||||
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("JSXText", "JSXExpressionContainer", "JSXSpreadChild", "JSXElement", "JSXFragment")))
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("JSXOpeningFragment", {
|
||||
aliases: ["JSX", "Immutable"]
|
||||
});
|
||||
(0, _utils.default)("JSXClosingFragment", {
|
||||
aliases: ["JSX", "Immutable"]
|
||||
});
|
||||
33
node_modules/@types/babel__generator/node_modules/@babel/types/lib/definitions/misc.js
generated
vendored
Normal file
33
node_modules/@types/babel__generator/node_modules/@babel/types/lib/definitions/misc.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
"use strict";
|
||||
|
||||
var _utils = _interopRequireWildcard(require("./utils"));
|
||||
|
||||
var _placeholders = require("./placeholders");
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
(0, _utils.default)("Noop", {
|
||||
visitor: []
|
||||
});
|
||||
(0, _utils.default)("Placeholder", {
|
||||
visitor: [],
|
||||
builder: ["expectedNode", "name"],
|
||||
fields: {
|
||||
name: {
|
||||
validate: (0, _utils.assertNodeType)("Identifier")
|
||||
},
|
||||
expectedNode: {
|
||||
validate: (0, _utils.assertOneOf)(..._placeholders.PLACEHOLDERS)
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("V8IntrinsicIdentifier", {
|
||||
builder: ["name"],
|
||||
fields: {
|
||||
name: {
|
||||
validate: (0, _utils.assertValueType)("string")
|
||||
}
|
||||
}
|
||||
});
|
||||
33
node_modules/@types/babel__generator/node_modules/@babel/types/lib/definitions/placeholders.js
generated
vendored
Normal file
33
node_modules/@types/babel__generator/node_modules/@babel/types/lib/definitions/placeholders.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.PLACEHOLDERS_FLIPPED_ALIAS = exports.PLACEHOLDERS_ALIAS = exports.PLACEHOLDERS = void 0;
|
||||
|
||||
var _utils = require("./utils");
|
||||
|
||||
const PLACEHOLDERS = ["Identifier", "StringLiteral", "Expression", "Statement", "Declaration", "BlockStatement", "ClassBody", "Pattern"];
|
||||
exports.PLACEHOLDERS = PLACEHOLDERS;
|
||||
const PLACEHOLDERS_ALIAS = {
|
||||
Declaration: ["Statement"],
|
||||
Pattern: ["PatternLike", "LVal"]
|
||||
};
|
||||
exports.PLACEHOLDERS_ALIAS = PLACEHOLDERS_ALIAS;
|
||||
|
||||
for (const type of PLACEHOLDERS) {
|
||||
const alias = _utils.ALIAS_KEYS[type];
|
||||
if (alias && alias.length) PLACEHOLDERS_ALIAS[type] = alias;
|
||||
}
|
||||
|
||||
const PLACEHOLDERS_FLIPPED_ALIAS = {};
|
||||
exports.PLACEHOLDERS_FLIPPED_ALIAS = PLACEHOLDERS_FLIPPED_ALIAS;
|
||||
Object.keys(PLACEHOLDERS_ALIAS).forEach(type => {
|
||||
PLACEHOLDERS_ALIAS[type].forEach(alias => {
|
||||
if (!Object.hasOwnProperty.call(PLACEHOLDERS_FLIPPED_ALIAS, alias)) {
|
||||
PLACEHOLDERS_FLIPPED_ALIAS[alias] = [];
|
||||
}
|
||||
|
||||
PLACEHOLDERS_FLIPPED_ALIAS[alias].push(type);
|
||||
});
|
||||
});
|
||||
417
node_modules/@types/babel__generator/node_modules/@babel/types/lib/definitions/typescript.js
generated
vendored
Normal file
417
node_modules/@types/babel__generator/node_modules/@babel/types/lib/definitions/typescript.js
generated
vendored
Normal file
@@ -0,0 +1,417 @@
|
||||
"use strict";
|
||||
|
||||
var _utils = _interopRequireWildcard(require("./utils"));
|
||||
|
||||
var _core = require("./core");
|
||||
|
||||
var _es = require("./es2015");
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
const bool = (0, _utils.assertValueType)("boolean");
|
||||
const tSFunctionTypeAnnotationCommon = {
|
||||
returnType: {
|
||||
validate: (0, _utils.assertNodeType)("TSTypeAnnotation", "Noop"),
|
||||
optional: true
|
||||
},
|
||||
typeParameters: {
|
||||
validate: (0, _utils.assertNodeType)("TSTypeParameterDeclaration", "Noop"),
|
||||
optional: true
|
||||
}
|
||||
};
|
||||
(0, _utils.default)("TSParameterProperty", {
|
||||
aliases: ["LVal"],
|
||||
visitor: ["parameter"],
|
||||
fields: {
|
||||
accessibility: {
|
||||
validate: (0, _utils.assertOneOf)("public", "private", "protected"),
|
||||
optional: true
|
||||
},
|
||||
readonly: {
|
||||
validate: (0, _utils.assertValueType)("boolean"),
|
||||
optional: true
|
||||
},
|
||||
parameter: {
|
||||
validate: (0, _utils.assertNodeType)("Identifier", "AssignmentPattern")
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TSDeclareFunction", {
|
||||
aliases: ["Statement", "Declaration"],
|
||||
visitor: ["id", "typeParameters", "params", "returnType"],
|
||||
fields: Object.assign({}, _core.functionDeclarationCommon, {}, tSFunctionTypeAnnotationCommon)
|
||||
});
|
||||
(0, _utils.default)("TSDeclareMethod", {
|
||||
visitor: ["decorators", "key", "typeParameters", "params", "returnType"],
|
||||
fields: Object.assign({}, _es.classMethodOrDeclareMethodCommon, {}, tSFunctionTypeAnnotationCommon)
|
||||
});
|
||||
(0, _utils.default)("TSQualifiedName", {
|
||||
aliases: ["TSEntityName"],
|
||||
visitor: ["left", "right"],
|
||||
fields: {
|
||||
left: (0, _utils.validateType)("TSEntityName"),
|
||||
right: (0, _utils.validateType)("Identifier")
|
||||
}
|
||||
});
|
||||
const signatureDeclarationCommon = {
|
||||
typeParameters: (0, _utils.validateOptionalType)("TSTypeParameterDeclaration"),
|
||||
parameters: (0, _utils.validateArrayOfType)(["Identifier", "RestElement"]),
|
||||
typeAnnotation: (0, _utils.validateOptionalType)("TSTypeAnnotation")
|
||||
};
|
||||
const callConstructSignatureDeclaration = {
|
||||
aliases: ["TSTypeElement"],
|
||||
visitor: ["typeParameters", "parameters", "typeAnnotation"],
|
||||
fields: signatureDeclarationCommon
|
||||
};
|
||||
(0, _utils.default)("TSCallSignatureDeclaration", callConstructSignatureDeclaration);
|
||||
(0, _utils.default)("TSConstructSignatureDeclaration", callConstructSignatureDeclaration);
|
||||
const namedTypeElementCommon = {
|
||||
key: (0, _utils.validateType)("Expression"),
|
||||
computed: (0, _utils.validate)(bool),
|
||||
optional: (0, _utils.validateOptional)(bool)
|
||||
};
|
||||
(0, _utils.default)("TSPropertySignature", {
|
||||
aliases: ["TSTypeElement"],
|
||||
visitor: ["key", "typeAnnotation", "initializer"],
|
||||
fields: Object.assign({}, namedTypeElementCommon, {
|
||||
readonly: (0, _utils.validateOptional)(bool),
|
||||
typeAnnotation: (0, _utils.validateOptionalType)("TSTypeAnnotation"),
|
||||
initializer: (0, _utils.validateOptionalType)("Expression")
|
||||
})
|
||||
});
|
||||
(0, _utils.default)("TSMethodSignature", {
|
||||
aliases: ["TSTypeElement"],
|
||||
visitor: ["key", "typeParameters", "parameters", "typeAnnotation"],
|
||||
fields: Object.assign({}, signatureDeclarationCommon, {}, namedTypeElementCommon)
|
||||
});
|
||||
(0, _utils.default)("TSIndexSignature", {
|
||||
aliases: ["TSTypeElement"],
|
||||
visitor: ["parameters", "typeAnnotation"],
|
||||
fields: {
|
||||
readonly: (0, _utils.validateOptional)(bool),
|
||||
parameters: (0, _utils.validateArrayOfType)("Identifier"),
|
||||
typeAnnotation: (0, _utils.validateOptionalType)("TSTypeAnnotation")
|
||||
}
|
||||
});
|
||||
const tsKeywordTypes = ["TSAnyKeyword", "TSBooleanKeyword", "TSBigIntKeyword", "TSNeverKeyword", "TSNullKeyword", "TSNumberKeyword", "TSObjectKeyword", "TSStringKeyword", "TSSymbolKeyword", "TSUndefinedKeyword", "TSUnknownKeyword", "TSVoidKeyword"];
|
||||
|
||||
for (const type of tsKeywordTypes) {
|
||||
(0, _utils.default)(type, {
|
||||
aliases: ["TSType"],
|
||||
visitor: [],
|
||||
fields: {}
|
||||
});
|
||||
}
|
||||
|
||||
(0, _utils.default)("TSThisType", {
|
||||
aliases: ["TSType"],
|
||||
visitor: [],
|
||||
fields: {}
|
||||
});
|
||||
const fnOrCtr = {
|
||||
aliases: ["TSType"],
|
||||
visitor: ["typeParameters", "parameters", "typeAnnotation"],
|
||||
fields: signatureDeclarationCommon
|
||||
};
|
||||
(0, _utils.default)("TSFunctionType", fnOrCtr);
|
||||
(0, _utils.default)("TSConstructorType", fnOrCtr);
|
||||
(0, _utils.default)("TSTypeReference", {
|
||||
aliases: ["TSType"],
|
||||
visitor: ["typeName", "typeParameters"],
|
||||
fields: {
|
||||
typeName: (0, _utils.validateType)("TSEntityName"),
|
||||
typeParameters: (0, _utils.validateOptionalType)("TSTypeParameterInstantiation")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TSTypePredicate", {
|
||||
aliases: ["TSType"],
|
||||
visitor: ["parameterName", "typeAnnotation"],
|
||||
builder: ["parameterName", "typeAnnotation", "asserts"],
|
||||
fields: {
|
||||
parameterName: (0, _utils.validateType)(["Identifier", "TSThisType"]),
|
||||
typeAnnotation: (0, _utils.validateOptionalType)("TSTypeAnnotation"),
|
||||
asserts: (0, _utils.validateOptional)(bool)
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TSTypeQuery", {
|
||||
aliases: ["TSType"],
|
||||
visitor: ["exprName"],
|
||||
fields: {
|
||||
exprName: (0, _utils.validateType)(["TSEntityName", "TSImportType"])
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TSTypeLiteral", {
|
||||
aliases: ["TSType"],
|
||||
visitor: ["members"],
|
||||
fields: {
|
||||
members: (0, _utils.validateArrayOfType)("TSTypeElement")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TSArrayType", {
|
||||
aliases: ["TSType"],
|
||||
visitor: ["elementType"],
|
||||
fields: {
|
||||
elementType: (0, _utils.validateType)("TSType")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TSTupleType", {
|
||||
aliases: ["TSType"],
|
||||
visitor: ["elementTypes"],
|
||||
fields: {
|
||||
elementTypes: (0, _utils.validateArrayOfType)("TSType")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TSOptionalType", {
|
||||
aliases: ["TSType"],
|
||||
visitor: ["typeAnnotation"],
|
||||
fields: {
|
||||
typeAnnotation: (0, _utils.validateType)("TSType")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TSRestType", {
|
||||
aliases: ["TSType"],
|
||||
visitor: ["typeAnnotation"],
|
||||
fields: {
|
||||
typeAnnotation: (0, _utils.validateType)("TSType")
|
||||
}
|
||||
});
|
||||
const unionOrIntersection = {
|
||||
aliases: ["TSType"],
|
||||
visitor: ["types"],
|
||||
fields: {
|
||||
types: (0, _utils.validateArrayOfType)("TSType")
|
||||
}
|
||||
};
|
||||
(0, _utils.default)("TSUnionType", unionOrIntersection);
|
||||
(0, _utils.default)("TSIntersectionType", unionOrIntersection);
|
||||
(0, _utils.default)("TSConditionalType", {
|
||||
aliases: ["TSType"],
|
||||
visitor: ["checkType", "extendsType", "trueType", "falseType"],
|
||||
fields: {
|
||||
checkType: (0, _utils.validateType)("TSType"),
|
||||
extendsType: (0, _utils.validateType)("TSType"),
|
||||
trueType: (0, _utils.validateType)("TSType"),
|
||||
falseType: (0, _utils.validateType)("TSType")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TSInferType", {
|
||||
aliases: ["TSType"],
|
||||
visitor: ["typeParameter"],
|
||||
fields: {
|
||||
typeParameter: (0, _utils.validateType)("TSTypeParameter")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TSParenthesizedType", {
|
||||
aliases: ["TSType"],
|
||||
visitor: ["typeAnnotation"],
|
||||
fields: {
|
||||
typeAnnotation: (0, _utils.validateType)("TSType")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TSTypeOperator", {
|
||||
aliases: ["TSType"],
|
||||
visitor: ["typeAnnotation"],
|
||||
fields: {
|
||||
operator: (0, _utils.validate)((0, _utils.assertValueType)("string")),
|
||||
typeAnnotation: (0, _utils.validateType)("TSType")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TSIndexedAccessType", {
|
||||
aliases: ["TSType"],
|
||||
visitor: ["objectType", "indexType"],
|
||||
fields: {
|
||||
objectType: (0, _utils.validateType)("TSType"),
|
||||
indexType: (0, _utils.validateType)("TSType")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TSMappedType", {
|
||||
aliases: ["TSType"],
|
||||
visitor: ["typeParameter", "typeAnnotation"],
|
||||
fields: {
|
||||
readonly: (0, _utils.validateOptional)(bool),
|
||||
typeParameter: (0, _utils.validateType)("TSTypeParameter"),
|
||||
optional: (0, _utils.validateOptional)(bool),
|
||||
typeAnnotation: (0, _utils.validateOptionalType)("TSType")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TSLiteralType", {
|
||||
aliases: ["TSType"],
|
||||
visitor: ["literal"],
|
||||
fields: {
|
||||
literal: (0, _utils.validateType)(["NumericLiteral", "StringLiteral", "BooleanLiteral"])
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TSExpressionWithTypeArguments", {
|
||||
aliases: ["TSType"],
|
||||
visitor: ["expression", "typeParameters"],
|
||||
fields: {
|
||||
expression: (0, _utils.validateType)("TSEntityName"),
|
||||
typeParameters: (0, _utils.validateOptionalType)("TSTypeParameterInstantiation")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TSInterfaceDeclaration", {
|
||||
aliases: ["Statement", "Declaration"],
|
||||
visitor: ["id", "typeParameters", "extends", "body"],
|
||||
fields: {
|
||||
declare: (0, _utils.validateOptional)(bool),
|
||||
id: (0, _utils.validateType)("Identifier"),
|
||||
typeParameters: (0, _utils.validateOptionalType)("TSTypeParameterDeclaration"),
|
||||
extends: (0, _utils.validateOptional)((0, _utils.arrayOfType)("TSExpressionWithTypeArguments")),
|
||||
body: (0, _utils.validateType)("TSInterfaceBody")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TSInterfaceBody", {
|
||||
visitor: ["body"],
|
||||
fields: {
|
||||
body: (0, _utils.validateArrayOfType)("TSTypeElement")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TSTypeAliasDeclaration", {
|
||||
aliases: ["Statement", "Declaration"],
|
||||
visitor: ["id", "typeParameters", "typeAnnotation"],
|
||||
fields: {
|
||||
declare: (0, _utils.validateOptional)(bool),
|
||||
id: (0, _utils.validateType)("Identifier"),
|
||||
typeParameters: (0, _utils.validateOptionalType)("TSTypeParameterDeclaration"),
|
||||
typeAnnotation: (0, _utils.validateType)("TSType")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TSAsExpression", {
|
||||
aliases: ["Expression"],
|
||||
visitor: ["expression", "typeAnnotation"],
|
||||
fields: {
|
||||
expression: (0, _utils.validateType)("Expression"),
|
||||
typeAnnotation: (0, _utils.validateType)("TSType")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TSTypeAssertion", {
|
||||
aliases: ["Expression"],
|
||||
visitor: ["typeAnnotation", "expression"],
|
||||
fields: {
|
||||
typeAnnotation: (0, _utils.validateType)("TSType"),
|
||||
expression: (0, _utils.validateType)("Expression")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TSEnumDeclaration", {
|
||||
aliases: ["Statement", "Declaration"],
|
||||
visitor: ["id", "members"],
|
||||
fields: {
|
||||
declare: (0, _utils.validateOptional)(bool),
|
||||
const: (0, _utils.validateOptional)(bool),
|
||||
id: (0, _utils.validateType)("Identifier"),
|
||||
members: (0, _utils.validateArrayOfType)("TSEnumMember"),
|
||||
initializer: (0, _utils.validateOptionalType)("Expression")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TSEnumMember", {
|
||||
visitor: ["id", "initializer"],
|
||||
fields: {
|
||||
id: (0, _utils.validateType)(["Identifier", "StringLiteral"]),
|
||||
initializer: (0, _utils.validateOptionalType)("Expression")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TSModuleDeclaration", {
|
||||
aliases: ["Statement", "Declaration"],
|
||||
visitor: ["id", "body"],
|
||||
fields: {
|
||||
declare: (0, _utils.validateOptional)(bool),
|
||||
global: (0, _utils.validateOptional)(bool),
|
||||
id: (0, _utils.validateType)(["Identifier", "StringLiteral"]),
|
||||
body: (0, _utils.validateType)(["TSModuleBlock", "TSModuleDeclaration"])
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TSModuleBlock", {
|
||||
aliases: ["Scopable", "Block", "BlockParent"],
|
||||
visitor: ["body"],
|
||||
fields: {
|
||||
body: (0, _utils.validateArrayOfType)("Statement")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TSImportType", {
|
||||
aliases: ["TSType"],
|
||||
visitor: ["argument", "qualifier", "typeParameters"],
|
||||
fields: {
|
||||
argument: (0, _utils.validateType)("StringLiteral"),
|
||||
qualifier: (0, _utils.validateOptionalType)("TSEntityName"),
|
||||
typeParameters: (0, _utils.validateOptionalType)("TSTypeParameterInstantiation")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TSImportEqualsDeclaration", {
|
||||
aliases: ["Statement"],
|
||||
visitor: ["id", "moduleReference"],
|
||||
fields: {
|
||||
isExport: (0, _utils.validate)(bool),
|
||||
id: (0, _utils.validateType)("Identifier"),
|
||||
moduleReference: (0, _utils.validateType)(["TSEntityName", "TSExternalModuleReference"])
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TSExternalModuleReference", {
|
||||
visitor: ["expression"],
|
||||
fields: {
|
||||
expression: (0, _utils.validateType)("StringLiteral")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TSNonNullExpression", {
|
||||
aliases: ["Expression"],
|
||||
visitor: ["expression"],
|
||||
fields: {
|
||||
expression: (0, _utils.validateType)("Expression")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TSExportAssignment", {
|
||||
aliases: ["Statement"],
|
||||
visitor: ["expression"],
|
||||
fields: {
|
||||
expression: (0, _utils.validateType)("Expression")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TSNamespaceExportDeclaration", {
|
||||
aliases: ["Statement"],
|
||||
visitor: ["id"],
|
||||
fields: {
|
||||
id: (0, _utils.validateType)("Identifier")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TSTypeAnnotation", {
|
||||
visitor: ["typeAnnotation"],
|
||||
fields: {
|
||||
typeAnnotation: {
|
||||
validate: (0, _utils.assertNodeType)("TSType")
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TSTypeParameterInstantiation", {
|
||||
visitor: ["params"],
|
||||
fields: {
|
||||
params: {
|
||||
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("TSType")))
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TSTypeParameterDeclaration", {
|
||||
visitor: ["params"],
|
||||
fields: {
|
||||
params: {
|
||||
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("TSTypeParameter")))
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TSTypeParameter", {
|
||||
builder: ["constraint", "default", "name"],
|
||||
visitor: ["constraint", "default"],
|
||||
fields: {
|
||||
name: {
|
||||
validate: (0, _utils.assertValueType)("string")
|
||||
},
|
||||
constraint: {
|
||||
validate: (0, _utils.assertNodeType)("TSType"),
|
||||
optional: true
|
||||
},
|
||||
default: {
|
||||
validate: (0, _utils.assertNodeType)("TSType"),
|
||||
optional: true
|
||||
}
|
||||
}
|
||||
});
|
||||
282
node_modules/@types/babel__generator/node_modules/@babel/types/lib/definitions/utils.js
generated
vendored
Normal file
282
node_modules/@types/babel__generator/node_modules/@babel/types/lib/definitions/utils.js
generated
vendored
Normal file
@@ -0,0 +1,282 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.validate = validate;
|
||||
exports.typeIs = typeIs;
|
||||
exports.validateType = validateType;
|
||||
exports.validateOptional = validateOptional;
|
||||
exports.validateOptionalType = validateOptionalType;
|
||||
exports.arrayOf = arrayOf;
|
||||
exports.arrayOfType = arrayOfType;
|
||||
exports.validateArrayOfType = validateArrayOfType;
|
||||
exports.assertEach = assertEach;
|
||||
exports.assertOneOf = assertOneOf;
|
||||
exports.assertNodeType = assertNodeType;
|
||||
exports.assertNodeOrValueType = assertNodeOrValueType;
|
||||
exports.assertValueType = assertValueType;
|
||||
exports.assertShape = assertShape;
|
||||
exports.chain = chain;
|
||||
exports.default = defineType;
|
||||
exports.NODE_PARENT_VALIDATIONS = exports.DEPRECATED_KEYS = exports.BUILDER_KEYS = exports.NODE_FIELDS = exports.FLIPPED_ALIAS_KEYS = exports.ALIAS_KEYS = exports.VISITOR_KEYS = void 0;
|
||||
|
||||
var _is = _interopRequireDefault(require("../validators/is"));
|
||||
|
||||
var _validate = require("../validators/validate");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
const VISITOR_KEYS = {};
|
||||
exports.VISITOR_KEYS = VISITOR_KEYS;
|
||||
const ALIAS_KEYS = {};
|
||||
exports.ALIAS_KEYS = ALIAS_KEYS;
|
||||
const FLIPPED_ALIAS_KEYS = {};
|
||||
exports.FLIPPED_ALIAS_KEYS = FLIPPED_ALIAS_KEYS;
|
||||
const NODE_FIELDS = {};
|
||||
exports.NODE_FIELDS = NODE_FIELDS;
|
||||
const BUILDER_KEYS = {};
|
||||
exports.BUILDER_KEYS = BUILDER_KEYS;
|
||||
const DEPRECATED_KEYS = {};
|
||||
exports.DEPRECATED_KEYS = DEPRECATED_KEYS;
|
||||
const NODE_PARENT_VALIDATIONS = {};
|
||||
exports.NODE_PARENT_VALIDATIONS = NODE_PARENT_VALIDATIONS;
|
||||
|
||||
function getType(val) {
|
||||
if (Array.isArray(val)) {
|
||||
return "array";
|
||||
} else if (val === null) {
|
||||
return "null";
|
||||
} else {
|
||||
return typeof val;
|
||||
}
|
||||
}
|
||||
|
||||
function validate(validate) {
|
||||
return {
|
||||
validate
|
||||
};
|
||||
}
|
||||
|
||||
function typeIs(typeName) {
|
||||
return typeof typeName === "string" ? assertNodeType(typeName) : assertNodeType(...typeName);
|
||||
}
|
||||
|
||||
function validateType(typeName) {
|
||||
return validate(typeIs(typeName));
|
||||
}
|
||||
|
||||
function validateOptional(validate) {
|
||||
return {
|
||||
validate,
|
||||
optional: true
|
||||
};
|
||||
}
|
||||
|
||||
function validateOptionalType(typeName) {
|
||||
return {
|
||||
validate: typeIs(typeName),
|
||||
optional: true
|
||||
};
|
||||
}
|
||||
|
||||
function arrayOf(elementType) {
|
||||
return chain(assertValueType("array"), assertEach(elementType));
|
||||
}
|
||||
|
||||
function arrayOfType(typeName) {
|
||||
return arrayOf(typeIs(typeName));
|
||||
}
|
||||
|
||||
function validateArrayOfType(typeName) {
|
||||
return validate(arrayOfType(typeName));
|
||||
}
|
||||
|
||||
function assertEach(callback) {
|
||||
function validator(node, key, val) {
|
||||
if (!Array.isArray(val)) return;
|
||||
|
||||
for (let i = 0; i < val.length; i++) {
|
||||
const subkey = `${key}[${i}]`;
|
||||
const v = val[i];
|
||||
callback(node, subkey, v);
|
||||
if (process.env.BABEL_TYPES_8_BREAKING) (0, _validate.validateChild)(node, subkey, v);
|
||||
}
|
||||
}
|
||||
|
||||
validator.each = callback;
|
||||
return validator;
|
||||
}
|
||||
|
||||
function assertOneOf(...values) {
|
||||
function validate(node, key, val) {
|
||||
if (values.indexOf(val) < 0) {
|
||||
throw new TypeError(`Property ${key} expected value to be one of ${JSON.stringify(values)} but got ${JSON.stringify(val)}`);
|
||||
}
|
||||
}
|
||||
|
||||
validate.oneOf = values;
|
||||
return validate;
|
||||
}
|
||||
|
||||
function assertNodeType(...types) {
|
||||
function validate(node, key, val) {
|
||||
for (const type of types) {
|
||||
if ((0, _is.default)(type, val)) {
|
||||
(0, _validate.validateChild)(node, key, val);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
throw new TypeError(`Property ${key} of ${node.type} expected node to be of a type ${JSON.stringify(types)} but instead got ${JSON.stringify(val && val.type)}`);
|
||||
}
|
||||
|
||||
validate.oneOfNodeTypes = types;
|
||||
return validate;
|
||||
}
|
||||
|
||||
function assertNodeOrValueType(...types) {
|
||||
function validate(node, key, val) {
|
||||
for (const type of types) {
|
||||
if (getType(val) === type || (0, _is.default)(type, val)) {
|
||||
(0, _validate.validateChild)(node, key, val);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
throw new TypeError(`Property ${key} of ${node.type} expected node to be of a type ${JSON.stringify(types)} but instead got ${JSON.stringify(val && val.type)}`);
|
||||
}
|
||||
|
||||
validate.oneOfNodeOrValueTypes = types;
|
||||
return validate;
|
||||
}
|
||||
|
||||
function assertValueType(type) {
|
||||
function validate(node, key, val) {
|
||||
const valid = getType(val) === type;
|
||||
|
||||
if (!valid) {
|
||||
throw new TypeError(`Property ${key} expected type of ${type} but got ${getType(val)}`);
|
||||
}
|
||||
}
|
||||
|
||||
validate.type = type;
|
||||
return validate;
|
||||
}
|
||||
|
||||
function assertShape(shape) {
|
||||
function validate(node, key, val) {
|
||||
const errors = [];
|
||||
|
||||
for (const property of Object.keys(shape)) {
|
||||
try {
|
||||
(0, _validate.validateField)(node, property, val[property], shape[property]);
|
||||
} catch (error) {
|
||||
if (error instanceof TypeError) {
|
||||
errors.push(error.message);
|
||||
continue;
|
||||
}
|
||||
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
if (errors.length) {
|
||||
throw new TypeError(`Property ${key} of ${node.type} expected to have the following:\n${errors.join("\n")}`);
|
||||
}
|
||||
}
|
||||
|
||||
validate.shapeOf = shape;
|
||||
return validate;
|
||||
}
|
||||
|
||||
function chain(...fns) {
|
||||
function validate(...args) {
|
||||
for (const fn of fns) {
|
||||
fn(...args);
|
||||
}
|
||||
}
|
||||
|
||||
validate.chainOf = fns;
|
||||
return validate;
|
||||
}
|
||||
|
||||
const validTypeOpts = ["aliases", "builder", "deprecatedAlias", "fields", "inherits", "visitor", "validate"];
|
||||
const validFieldKeys = ["default", "optional", "validate"];
|
||||
|
||||
function defineType(type, opts = {}) {
|
||||
const inherits = opts.inherits && store[opts.inherits] || {};
|
||||
let fields = opts.fields;
|
||||
|
||||
if (!fields) {
|
||||
fields = {};
|
||||
|
||||
if (inherits.fields) {
|
||||
const keys = Object.getOwnPropertyNames(inherits.fields);
|
||||
|
||||
for (const key of keys) {
|
||||
const field = inherits.fields[key];
|
||||
fields[key] = {
|
||||
default: field.default,
|
||||
optional: field.optional,
|
||||
validate: field.validate
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const visitor = opts.visitor || inherits.visitor || [];
|
||||
const aliases = opts.aliases || inherits.aliases || [];
|
||||
const builder = opts.builder || inherits.builder || opts.visitor || [];
|
||||
|
||||
for (const k of Object.keys(opts)) {
|
||||
if (validTypeOpts.indexOf(k) === -1) {
|
||||
throw new Error(`Unknown type option "${k}" on ${type}`);
|
||||
}
|
||||
}
|
||||
|
||||
if (opts.deprecatedAlias) {
|
||||
DEPRECATED_KEYS[opts.deprecatedAlias] = type;
|
||||
}
|
||||
|
||||
for (const key of visitor.concat(builder)) {
|
||||
fields[key] = fields[key] || {};
|
||||
}
|
||||
|
||||
for (const key of Object.keys(fields)) {
|
||||
const field = fields[key];
|
||||
|
||||
if (field.default !== undefined && builder.indexOf(key) === -1) {
|
||||
field.optional = true;
|
||||
}
|
||||
|
||||
if (field.default === undefined) {
|
||||
field.default = null;
|
||||
} else if (!field.validate && field.default != null) {
|
||||
field.validate = assertValueType(getType(field.default));
|
||||
}
|
||||
|
||||
for (const k of Object.keys(field)) {
|
||||
if (validFieldKeys.indexOf(k) === -1) {
|
||||
throw new Error(`Unknown field key "${k}" on ${type}.${key}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
VISITOR_KEYS[type] = opts.visitor = visitor;
|
||||
BUILDER_KEYS[type] = opts.builder = builder;
|
||||
NODE_FIELDS[type] = opts.fields = fields;
|
||||
ALIAS_KEYS[type] = opts.aliases = aliases;
|
||||
aliases.forEach(alias => {
|
||||
FLIPPED_ALIAS_KEYS[alias] = FLIPPED_ALIAS_KEYS[alias] || [];
|
||||
FLIPPED_ALIAS_KEYS[alias].push(type);
|
||||
});
|
||||
|
||||
if (opts.validate) {
|
||||
NODE_PARENT_VALIDATIONS[type] = opts.validate;
|
||||
}
|
||||
|
||||
store[type] = opts;
|
||||
}
|
||||
|
||||
const store = {};
|
||||
2531
node_modules/@types/babel__generator/node_modules/@babel/types/lib/index.d.ts
generated
vendored
Normal file
2531
node_modules/@types/babel__generator/node_modules/@babel/types/lib/index.d.ts
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
579
node_modules/@types/babel__generator/node_modules/@babel/types/lib/index.js
generated
vendored
Normal file
579
node_modules/@types/babel__generator/node_modules/@babel/types/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,579 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
var _exportNames = {
|
||||
react: true,
|
||||
assertNode: true,
|
||||
createTypeAnnotationBasedOnTypeof: true,
|
||||
createUnionTypeAnnotation: true,
|
||||
cloneNode: true,
|
||||
clone: true,
|
||||
cloneDeep: true,
|
||||
cloneWithoutLoc: true,
|
||||
addComment: true,
|
||||
addComments: true,
|
||||
inheritInnerComments: true,
|
||||
inheritLeadingComments: true,
|
||||
inheritsComments: true,
|
||||
inheritTrailingComments: true,
|
||||
removeComments: true,
|
||||
ensureBlock: true,
|
||||
toBindingIdentifierName: true,
|
||||
toBlock: true,
|
||||
toComputedKey: true,
|
||||
toExpression: true,
|
||||
toIdentifier: true,
|
||||
toKeyAlias: true,
|
||||
toSequenceExpression: true,
|
||||
toStatement: true,
|
||||
valueToNode: true,
|
||||
appendToMemberExpression: true,
|
||||
inherits: true,
|
||||
prependToMemberExpression: true,
|
||||
removeProperties: true,
|
||||
removePropertiesDeep: true,
|
||||
removeTypeDuplicates: true,
|
||||
getBindingIdentifiers: true,
|
||||
getOuterBindingIdentifiers: true,
|
||||
traverse: true,
|
||||
traverseFast: true,
|
||||
shallowEqual: true,
|
||||
is: true,
|
||||
isBinding: true,
|
||||
isBlockScoped: true,
|
||||
isImmutable: true,
|
||||
isLet: true,
|
||||
isNode: true,
|
||||
isNodesEquivalent: true,
|
||||
isPlaceholderType: true,
|
||||
isReferenced: true,
|
||||
isScope: true,
|
||||
isSpecifierDefault: true,
|
||||
isType: true,
|
||||
isValidES3Identifier: true,
|
||||
isValidIdentifier: true,
|
||||
isVar: true,
|
||||
matchesPattern: true,
|
||||
validate: true,
|
||||
buildMatchMemberExpression: true
|
||||
};
|
||||
Object.defineProperty(exports, "assertNode", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _assertNode.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "createTypeAnnotationBasedOnTypeof", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _createTypeAnnotationBasedOnTypeof.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "createUnionTypeAnnotation", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _createUnionTypeAnnotation.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "cloneNode", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _cloneNode.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "clone", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _clone.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "cloneDeep", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _cloneDeep.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "cloneWithoutLoc", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _cloneWithoutLoc.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "addComment", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _addComment.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "addComments", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _addComments.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "inheritInnerComments", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _inheritInnerComments.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "inheritLeadingComments", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _inheritLeadingComments.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "inheritsComments", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _inheritsComments.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "inheritTrailingComments", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _inheritTrailingComments.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "removeComments", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _removeComments.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "ensureBlock", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _ensureBlock.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "toBindingIdentifierName", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _toBindingIdentifierName.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "toBlock", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _toBlock.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "toComputedKey", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _toComputedKey.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "toExpression", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _toExpression.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "toIdentifier", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _toIdentifier.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "toKeyAlias", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _toKeyAlias.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "toSequenceExpression", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _toSequenceExpression.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "toStatement", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _toStatement.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "valueToNode", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _valueToNode.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "appendToMemberExpression", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _appendToMemberExpression.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "inherits", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _inherits.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "prependToMemberExpression", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _prependToMemberExpression.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "removeProperties", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _removeProperties.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "removePropertiesDeep", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _removePropertiesDeep.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "removeTypeDuplicates", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _removeTypeDuplicates.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "getBindingIdentifiers", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _getBindingIdentifiers.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "getOuterBindingIdentifiers", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _getOuterBindingIdentifiers.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "traverse", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _traverse.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "traverseFast", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _traverseFast.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "shallowEqual", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _shallowEqual.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "is", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _is.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "isBinding", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _isBinding.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "isBlockScoped", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _isBlockScoped.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "isImmutable", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _isImmutable.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "isLet", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _isLet.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "isNode", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _isNode.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "isNodesEquivalent", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _isNodesEquivalent.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "isPlaceholderType", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _isPlaceholderType.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "isReferenced", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _isReferenced.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "isScope", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _isScope.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "isSpecifierDefault", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _isSpecifierDefault.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "isType", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _isType.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "isValidES3Identifier", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _isValidES3Identifier.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "isValidIdentifier", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _isValidIdentifier.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "isVar", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _isVar.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "matchesPattern", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _matchesPattern.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "validate", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _validate.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "buildMatchMemberExpression", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _buildMatchMemberExpression.default;
|
||||
}
|
||||
});
|
||||
exports.react = void 0;
|
||||
|
||||
var _isReactComponent = _interopRequireDefault(require("./validators/react/isReactComponent"));
|
||||
|
||||
var _isCompatTag = _interopRequireDefault(require("./validators/react/isCompatTag"));
|
||||
|
||||
var _buildChildren = _interopRequireDefault(require("./builders/react/buildChildren"));
|
||||
|
||||
var _assertNode = _interopRequireDefault(require("./asserts/assertNode"));
|
||||
|
||||
var _generated = require("./asserts/generated");
|
||||
|
||||
Object.keys(_generated).forEach(function (key) {
|
||||
if (key === "default" || key === "__esModule") return;
|
||||
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
||||
Object.defineProperty(exports, key, {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _generated[key];
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
var _createTypeAnnotationBasedOnTypeof = _interopRequireDefault(require("./builders/flow/createTypeAnnotationBasedOnTypeof"));
|
||||
|
||||
var _createUnionTypeAnnotation = _interopRequireDefault(require("./builders/flow/createUnionTypeAnnotation"));
|
||||
|
||||
var _generated2 = require("./builders/generated");
|
||||
|
||||
Object.keys(_generated2).forEach(function (key) {
|
||||
if (key === "default" || key === "__esModule") return;
|
||||
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
||||
Object.defineProperty(exports, key, {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _generated2[key];
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
var _cloneNode = _interopRequireDefault(require("./clone/cloneNode"));
|
||||
|
||||
var _clone = _interopRequireDefault(require("./clone/clone"));
|
||||
|
||||
var _cloneDeep = _interopRequireDefault(require("./clone/cloneDeep"));
|
||||
|
||||
var _cloneWithoutLoc = _interopRequireDefault(require("./clone/cloneWithoutLoc"));
|
||||
|
||||
var _addComment = _interopRequireDefault(require("./comments/addComment"));
|
||||
|
||||
var _addComments = _interopRequireDefault(require("./comments/addComments"));
|
||||
|
||||
var _inheritInnerComments = _interopRequireDefault(require("./comments/inheritInnerComments"));
|
||||
|
||||
var _inheritLeadingComments = _interopRequireDefault(require("./comments/inheritLeadingComments"));
|
||||
|
||||
var _inheritsComments = _interopRequireDefault(require("./comments/inheritsComments"));
|
||||
|
||||
var _inheritTrailingComments = _interopRequireDefault(require("./comments/inheritTrailingComments"));
|
||||
|
||||
var _removeComments = _interopRequireDefault(require("./comments/removeComments"));
|
||||
|
||||
var _generated3 = require("./constants/generated");
|
||||
|
||||
Object.keys(_generated3).forEach(function (key) {
|
||||
if (key === "default" || key === "__esModule") return;
|
||||
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
||||
Object.defineProperty(exports, key, {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _generated3[key];
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
var _constants = require("./constants");
|
||||
|
||||
Object.keys(_constants).forEach(function (key) {
|
||||
if (key === "default" || key === "__esModule") return;
|
||||
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
||||
Object.defineProperty(exports, key, {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _constants[key];
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
var _ensureBlock = _interopRequireDefault(require("./converters/ensureBlock"));
|
||||
|
||||
var _toBindingIdentifierName = _interopRequireDefault(require("./converters/toBindingIdentifierName"));
|
||||
|
||||
var _toBlock = _interopRequireDefault(require("./converters/toBlock"));
|
||||
|
||||
var _toComputedKey = _interopRequireDefault(require("./converters/toComputedKey"));
|
||||
|
||||
var _toExpression = _interopRequireDefault(require("./converters/toExpression"));
|
||||
|
||||
var _toIdentifier = _interopRequireDefault(require("./converters/toIdentifier"));
|
||||
|
||||
var _toKeyAlias = _interopRequireDefault(require("./converters/toKeyAlias"));
|
||||
|
||||
var _toSequenceExpression = _interopRequireDefault(require("./converters/toSequenceExpression"));
|
||||
|
||||
var _toStatement = _interopRequireDefault(require("./converters/toStatement"));
|
||||
|
||||
var _valueToNode = _interopRequireDefault(require("./converters/valueToNode"));
|
||||
|
||||
var _definitions = require("./definitions");
|
||||
|
||||
Object.keys(_definitions).forEach(function (key) {
|
||||
if (key === "default" || key === "__esModule") return;
|
||||
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
||||
Object.defineProperty(exports, key, {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _definitions[key];
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
var _appendToMemberExpression = _interopRequireDefault(require("./modifications/appendToMemberExpression"));
|
||||
|
||||
var _inherits = _interopRequireDefault(require("./modifications/inherits"));
|
||||
|
||||
var _prependToMemberExpression = _interopRequireDefault(require("./modifications/prependToMemberExpression"));
|
||||
|
||||
var _removeProperties = _interopRequireDefault(require("./modifications/removeProperties"));
|
||||
|
||||
var _removePropertiesDeep = _interopRequireDefault(require("./modifications/removePropertiesDeep"));
|
||||
|
||||
var _removeTypeDuplicates = _interopRequireDefault(require("./modifications/flow/removeTypeDuplicates"));
|
||||
|
||||
var _getBindingIdentifiers = _interopRequireDefault(require("./retrievers/getBindingIdentifiers"));
|
||||
|
||||
var _getOuterBindingIdentifiers = _interopRequireDefault(require("./retrievers/getOuterBindingIdentifiers"));
|
||||
|
||||
var _traverse = _interopRequireDefault(require("./traverse/traverse"));
|
||||
|
||||
var _traverseFast = _interopRequireDefault(require("./traverse/traverseFast"));
|
||||
|
||||
var _shallowEqual = _interopRequireDefault(require("./utils/shallowEqual"));
|
||||
|
||||
var _is = _interopRequireDefault(require("./validators/is"));
|
||||
|
||||
var _isBinding = _interopRequireDefault(require("./validators/isBinding"));
|
||||
|
||||
var _isBlockScoped = _interopRequireDefault(require("./validators/isBlockScoped"));
|
||||
|
||||
var _isImmutable = _interopRequireDefault(require("./validators/isImmutable"));
|
||||
|
||||
var _isLet = _interopRequireDefault(require("./validators/isLet"));
|
||||
|
||||
var _isNode = _interopRequireDefault(require("./validators/isNode"));
|
||||
|
||||
var _isNodesEquivalent = _interopRequireDefault(require("./validators/isNodesEquivalent"));
|
||||
|
||||
var _isPlaceholderType = _interopRequireDefault(require("./validators/isPlaceholderType"));
|
||||
|
||||
var _isReferenced = _interopRequireDefault(require("./validators/isReferenced"));
|
||||
|
||||
var _isScope = _interopRequireDefault(require("./validators/isScope"));
|
||||
|
||||
var _isSpecifierDefault = _interopRequireDefault(require("./validators/isSpecifierDefault"));
|
||||
|
||||
var _isType = _interopRequireDefault(require("./validators/isType"));
|
||||
|
||||
var _isValidES3Identifier = _interopRequireDefault(require("./validators/isValidES3Identifier"));
|
||||
|
||||
var _isValidIdentifier = _interopRequireDefault(require("./validators/isValidIdentifier"));
|
||||
|
||||
var _isVar = _interopRequireDefault(require("./validators/isVar"));
|
||||
|
||||
var _matchesPattern = _interopRequireDefault(require("./validators/matchesPattern"));
|
||||
|
||||
var _validate = _interopRequireDefault(require("./validators/validate"));
|
||||
|
||||
var _buildMatchMemberExpression = _interopRequireDefault(require("./validators/buildMatchMemberExpression"));
|
||||
|
||||
var _generated4 = require("./validators/generated");
|
||||
|
||||
Object.keys(_generated4).forEach(function (key) {
|
||||
if (key === "default" || key === "__esModule") return;
|
||||
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
||||
Object.defineProperty(exports, key, {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _generated4[key];
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
const react = {
|
||||
isReactComponent: _isReactComponent.default,
|
||||
isCompatTag: _isCompatTag.default,
|
||||
buildChildren: _buildChildren.default
|
||||
};
|
||||
exports.react = react;
|
||||
2117
node_modules/@types/babel__generator/node_modules/@babel/types/lib/index.js.flow
generated
vendored
Normal file
2117
node_modules/@types/babel__generator/node_modules/@babel/types/lib/index.js.flow
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
15
node_modules/@types/babel__generator/node_modules/@babel/types/lib/modifications/appendToMemberExpression.js
generated
vendored
Normal file
15
node_modules/@types/babel__generator/node_modules/@babel/types/lib/modifications/appendToMemberExpression.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = appendToMemberExpression;
|
||||
|
||||
var _generated = require("../builders/generated");
|
||||
|
||||
function appendToMemberExpression(member, append, computed = false) {
|
||||
member.object = (0, _generated.memberExpression)(member.object, member.property, member.computed);
|
||||
member.property = append;
|
||||
member.computed = !!computed;
|
||||
return member;
|
||||
}
|
||||
74
node_modules/@types/babel__generator/node_modules/@babel/types/lib/modifications/flow/removeTypeDuplicates.js
generated
vendored
Normal file
74
node_modules/@types/babel__generator/node_modules/@babel/types/lib/modifications/flow/removeTypeDuplicates.js
generated
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = removeTypeDuplicates;
|
||||
|
||||
var _generated = require("../../validators/generated");
|
||||
|
||||
function removeTypeDuplicates(nodes) {
|
||||
const generics = {};
|
||||
const bases = {};
|
||||
const typeGroups = [];
|
||||
const types = [];
|
||||
|
||||
for (let i = 0; i < nodes.length; i++) {
|
||||
const node = nodes[i];
|
||||
if (!node) continue;
|
||||
|
||||
if (types.indexOf(node) >= 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((0, _generated.isAnyTypeAnnotation)(node)) {
|
||||
return [node];
|
||||
}
|
||||
|
||||
if ((0, _generated.isFlowBaseAnnotation)(node)) {
|
||||
bases[node.type] = node;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((0, _generated.isUnionTypeAnnotation)(node)) {
|
||||
if (typeGroups.indexOf(node.types) < 0) {
|
||||
nodes = nodes.concat(node.types);
|
||||
typeGroups.push(node.types);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((0, _generated.isGenericTypeAnnotation)(node)) {
|
||||
const name = node.id.name;
|
||||
|
||||
if (generics[name]) {
|
||||
let existing = generics[name];
|
||||
|
||||
if (existing.typeParameters) {
|
||||
if (node.typeParameters) {
|
||||
existing.typeParameters.params = removeTypeDuplicates(existing.typeParameters.params.concat(node.typeParameters.params));
|
||||
}
|
||||
} else {
|
||||
existing = node.typeParameters;
|
||||
}
|
||||
} else {
|
||||
generics[name] = node;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
types.push(node);
|
||||
}
|
||||
|
||||
for (const type of Object.keys(bases)) {
|
||||
types.push(bases[type]);
|
||||
}
|
||||
|
||||
for (const name of Object.keys(generics)) {
|
||||
types.push(generics[name]);
|
||||
}
|
||||
|
||||
return types;
|
||||
}
|
||||
33
node_modules/@types/babel__generator/node_modules/@babel/types/lib/modifications/inherits.js
generated
vendored
Normal file
33
node_modules/@types/babel__generator/node_modules/@babel/types/lib/modifications/inherits.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = inherits;
|
||||
|
||||
var _constants = require("../constants");
|
||||
|
||||
var _inheritsComments = _interopRequireDefault(require("../comments/inheritsComments"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function inherits(child, parent) {
|
||||
if (!child || !parent) return child;
|
||||
|
||||
for (const key of _constants.INHERIT_KEYS.optional) {
|
||||
if (child[key] == null) {
|
||||
child[key] = parent[key];
|
||||
}
|
||||
}
|
||||
|
||||
for (const key of Object.keys(parent)) {
|
||||
if (key[0] === "_" && key !== "__clone") child[key] = parent[key];
|
||||
}
|
||||
|
||||
for (const key of _constants.INHERIT_KEYS.force) {
|
||||
child[key] = parent[key];
|
||||
}
|
||||
|
||||
(0, _inheritsComments.default)(child, parent);
|
||||
return child;
|
||||
}
|
||||
13
node_modules/@types/babel__generator/node_modules/@babel/types/lib/modifications/prependToMemberExpression.js
generated
vendored
Normal file
13
node_modules/@types/babel__generator/node_modules/@babel/types/lib/modifications/prependToMemberExpression.js
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = prependToMemberExpression;
|
||||
|
||||
var _generated = require("../builders/generated");
|
||||
|
||||
function prependToMemberExpression(member, prepend) {
|
||||
member.object = (0, _generated.memberExpression)(prepend, member.object);
|
||||
return member;
|
||||
}
|
||||
30
node_modules/@types/babel__generator/node_modules/@babel/types/lib/modifications/removeProperties.js
generated
vendored
Normal file
30
node_modules/@types/babel__generator/node_modules/@babel/types/lib/modifications/removeProperties.js
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = removeProperties;
|
||||
|
||||
var _constants = require("../constants");
|
||||
|
||||
const CLEAR_KEYS = ["tokens", "start", "end", "loc", "raw", "rawValue"];
|
||||
|
||||
const CLEAR_KEYS_PLUS_COMMENTS = _constants.COMMENT_KEYS.concat(["comments"]).concat(CLEAR_KEYS);
|
||||
|
||||
function removeProperties(node, opts = {}) {
|
||||
const map = opts.preserveComments ? CLEAR_KEYS : CLEAR_KEYS_PLUS_COMMENTS;
|
||||
|
||||
for (const key of map) {
|
||||
if (node[key] != null) node[key] = undefined;
|
||||
}
|
||||
|
||||
for (const key of Object.keys(node)) {
|
||||
if (key[0] === "_" && node[key] != null) node[key] = undefined;
|
||||
}
|
||||
|
||||
const symbols = Object.getOwnPropertySymbols(node);
|
||||
|
||||
for (const sym of symbols) {
|
||||
node[sym] = null;
|
||||
}
|
||||
}
|
||||
17
node_modules/@types/babel__generator/node_modules/@babel/types/lib/modifications/removePropertiesDeep.js
generated
vendored
Normal file
17
node_modules/@types/babel__generator/node_modules/@babel/types/lib/modifications/removePropertiesDeep.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = removePropertiesDeep;
|
||||
|
||||
var _traverseFast = _interopRequireDefault(require("../traverse/traverseFast"));
|
||||
|
||||
var _removeProperties = _interopRequireDefault(require("./removeProperties"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function removePropertiesDeep(tree, opts) {
|
||||
(0, _traverseFast.default)(tree, _removeProperties.default, opts);
|
||||
return tree;
|
||||
}
|
||||
103
node_modules/@types/babel__generator/node_modules/@babel/types/lib/retrievers/getBindingIdentifiers.js
generated
vendored
Normal file
103
node_modules/@types/babel__generator/node_modules/@babel/types/lib/retrievers/getBindingIdentifiers.js
generated
vendored
Normal file
@@ -0,0 +1,103 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = getBindingIdentifiers;
|
||||
|
||||
var _generated = require("../validators/generated");
|
||||
|
||||
function getBindingIdentifiers(node, duplicates, outerOnly) {
|
||||
let search = [].concat(node);
|
||||
const ids = Object.create(null);
|
||||
|
||||
while (search.length) {
|
||||
const id = search.shift();
|
||||
if (!id) continue;
|
||||
const keys = getBindingIdentifiers.keys[id.type];
|
||||
|
||||
if ((0, _generated.isIdentifier)(id)) {
|
||||
if (duplicates) {
|
||||
const _ids = ids[id.name] = ids[id.name] || [];
|
||||
|
||||
_ids.push(id);
|
||||
} else {
|
||||
ids[id.name] = id;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((0, _generated.isExportDeclaration)(id)) {
|
||||
if ((0, _generated.isDeclaration)(id.declaration)) {
|
||||
search.push(id.declaration);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (outerOnly) {
|
||||
if ((0, _generated.isFunctionDeclaration)(id)) {
|
||||
search.push(id.id);
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((0, _generated.isFunctionExpression)(id)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (keys) {
|
||||
for (let i = 0; i < keys.length; i++) {
|
||||
const key = keys[i];
|
||||
|
||||
if (id[key]) {
|
||||
search = search.concat(id[key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ids;
|
||||
}
|
||||
|
||||
getBindingIdentifiers.keys = {
|
||||
DeclareClass: ["id"],
|
||||
DeclareFunction: ["id"],
|
||||
DeclareModule: ["id"],
|
||||
DeclareVariable: ["id"],
|
||||
DeclareInterface: ["id"],
|
||||
DeclareTypeAlias: ["id"],
|
||||
DeclareOpaqueType: ["id"],
|
||||
InterfaceDeclaration: ["id"],
|
||||
TypeAlias: ["id"],
|
||||
OpaqueType: ["id"],
|
||||
CatchClause: ["param"],
|
||||
LabeledStatement: ["label"],
|
||||
UnaryExpression: ["argument"],
|
||||
AssignmentExpression: ["left"],
|
||||
ImportSpecifier: ["local"],
|
||||
ImportNamespaceSpecifier: ["local"],
|
||||
ImportDefaultSpecifier: ["local"],
|
||||
ImportDeclaration: ["specifiers"],
|
||||
ExportSpecifier: ["exported"],
|
||||
ExportNamespaceSpecifier: ["exported"],
|
||||
ExportDefaultSpecifier: ["exported"],
|
||||
FunctionDeclaration: ["id", "params"],
|
||||
FunctionExpression: ["id", "params"],
|
||||
ArrowFunctionExpression: ["params"],
|
||||
ObjectMethod: ["params"],
|
||||
ClassMethod: ["params"],
|
||||
ForInStatement: ["left"],
|
||||
ForOfStatement: ["left"],
|
||||
ClassDeclaration: ["id"],
|
||||
ClassExpression: ["id"],
|
||||
RestElement: ["argument"],
|
||||
UpdateExpression: ["argument"],
|
||||
ObjectProperty: ["value"],
|
||||
AssignmentPattern: ["left"],
|
||||
ArrayPattern: ["elements"],
|
||||
ObjectPattern: ["properties"],
|
||||
VariableDeclaration: ["declarations"],
|
||||
VariableDeclarator: ["id"]
|
||||
};
|
||||
14
node_modules/@types/babel__generator/node_modules/@babel/types/lib/retrievers/getOuterBindingIdentifiers.js
generated
vendored
Normal file
14
node_modules/@types/babel__generator/node_modules/@babel/types/lib/retrievers/getOuterBindingIdentifiers.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = getOuterBindingIdentifiers;
|
||||
|
||||
var _getBindingIdentifiers = _interopRequireDefault(require("./getBindingIdentifiers"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function getOuterBindingIdentifiers(node, duplicates) {
|
||||
return (0, _getBindingIdentifiers.default)(node, duplicates, true);
|
||||
}
|
||||
55
node_modules/@types/babel__generator/node_modules/@babel/types/lib/traverse/traverse.js
generated
vendored
Normal file
55
node_modules/@types/babel__generator/node_modules/@babel/types/lib/traverse/traverse.js
generated
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = traverse;
|
||||
|
||||
var _definitions = require("../definitions");
|
||||
|
||||
function traverse(node, handlers, state) {
|
||||
if (typeof handlers === "function") {
|
||||
handlers = {
|
||||
enter: handlers
|
||||
};
|
||||
}
|
||||
|
||||
const {
|
||||
enter,
|
||||
exit
|
||||
} = handlers;
|
||||
traverseSimpleImpl(node, enter, exit, state, []);
|
||||
}
|
||||
|
||||
function traverseSimpleImpl(node, enter, exit, state, ancestors) {
|
||||
const keys = _definitions.VISITOR_KEYS[node.type];
|
||||
if (!keys) return;
|
||||
if (enter) enter(node, ancestors, state);
|
||||
|
||||
for (const key of keys) {
|
||||
const subNode = node[key];
|
||||
|
||||
if (Array.isArray(subNode)) {
|
||||
for (let i = 0; i < subNode.length; i++) {
|
||||
const child = subNode[i];
|
||||
if (!child) continue;
|
||||
ancestors.push({
|
||||
node,
|
||||
key,
|
||||
index: i
|
||||
});
|
||||
traverseSimpleImpl(child, enter, exit, state, ancestors);
|
||||
ancestors.pop();
|
||||
}
|
||||
} else if (subNode) {
|
||||
ancestors.push({
|
||||
node,
|
||||
key
|
||||
});
|
||||
traverseSimpleImpl(subNode, enter, exit, state, ancestors);
|
||||
ancestors.pop();
|
||||
}
|
||||
}
|
||||
|
||||
if (exit) exit(node, ancestors, state);
|
||||
}
|
||||
28
node_modules/@types/babel__generator/node_modules/@babel/types/lib/traverse/traverseFast.js
generated
vendored
Normal file
28
node_modules/@types/babel__generator/node_modules/@babel/types/lib/traverse/traverseFast.js
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = traverseFast;
|
||||
|
||||
var _definitions = require("../definitions");
|
||||
|
||||
function traverseFast(node, enter, opts) {
|
||||
if (!node) return;
|
||||
const keys = _definitions.VISITOR_KEYS[node.type];
|
||||
if (!keys) return;
|
||||
opts = opts || {};
|
||||
enter(node, opts);
|
||||
|
||||
for (const key of keys) {
|
||||
const subNode = node[key];
|
||||
|
||||
if (Array.isArray(subNode)) {
|
||||
for (const node of subNode) {
|
||||
traverseFast(node, enter, opts);
|
||||
}
|
||||
} else {
|
||||
traverseFast(subNode, enter, opts);
|
||||
}
|
||||
}
|
||||
}
|
||||
16
node_modules/@types/babel__generator/node_modules/@babel/types/lib/utils/inherit.js
generated
vendored
Normal file
16
node_modules/@types/babel__generator/node_modules/@babel/types/lib/utils/inherit.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = inherit;
|
||||
|
||||
var _uniq = _interopRequireDefault(require("lodash/uniq"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function inherit(key, child, parent) {
|
||||
if (child && parent) {
|
||||
child[key] = (0, _uniq.default)([].concat(child[key], parent[key]).filter(Boolean));
|
||||
}
|
||||
}
|
||||
47
node_modules/@types/babel__generator/node_modules/@babel/types/lib/utils/react/cleanJSXElementLiteralChild.js
generated
vendored
Normal file
47
node_modules/@types/babel__generator/node_modules/@babel/types/lib/utils/react/cleanJSXElementLiteralChild.js
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = cleanJSXElementLiteralChild;
|
||||
|
||||
var _generated = require("../../builders/generated");
|
||||
|
||||
function cleanJSXElementLiteralChild(child, args) {
|
||||
const lines = child.value.split(/\r\n|\n|\r/);
|
||||
let lastNonEmptyLine = 0;
|
||||
|
||||
for (let i = 0; i < lines.length; i++) {
|
||||
if (lines[i].match(/[^ \t]/)) {
|
||||
lastNonEmptyLine = i;
|
||||
}
|
||||
}
|
||||
|
||||
let str = "";
|
||||
|
||||
for (let i = 0; i < lines.length; i++) {
|
||||
const line = lines[i];
|
||||
const isFirstLine = i === 0;
|
||||
const isLastLine = i === lines.length - 1;
|
||||
const isLastNonEmptyLine = i === lastNonEmptyLine;
|
||||
let trimmedLine = line.replace(/\t/g, " ");
|
||||
|
||||
if (!isFirstLine) {
|
||||
trimmedLine = trimmedLine.replace(/^[ ]+/, "");
|
||||
}
|
||||
|
||||
if (!isLastLine) {
|
||||
trimmedLine = trimmedLine.replace(/[ ]+$/, "");
|
||||
}
|
||||
|
||||
if (trimmedLine) {
|
||||
if (!isLastNonEmptyLine) {
|
||||
trimmedLine += " ";
|
||||
}
|
||||
|
||||
str += trimmedLine;
|
||||
}
|
||||
}
|
||||
|
||||
if (str) args.push((0, _generated.stringLiteral)(str));
|
||||
}
|
||||
18
node_modules/@types/babel__generator/node_modules/@babel/types/lib/utils/shallowEqual.js
generated
vendored
Normal file
18
node_modules/@types/babel__generator/node_modules/@babel/types/lib/utils/shallowEqual.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = shallowEqual;
|
||||
|
||||
function shallowEqual(actual, expected) {
|
||||
const keys = Object.keys(expected);
|
||||
|
||||
for (const key of keys) {
|
||||
if (actual[key] !== expected[key]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
15
node_modules/@types/babel__generator/node_modules/@babel/types/lib/validators/buildMatchMemberExpression.js
generated
vendored
Normal file
15
node_modules/@types/babel__generator/node_modules/@babel/types/lib/validators/buildMatchMemberExpression.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = buildMatchMemberExpression;
|
||||
|
||||
var _matchesPattern = _interopRequireDefault(require("./matchesPattern"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function buildMatchMemberExpression(match, allowPartial) {
|
||||
const parts = match.split(".");
|
||||
return member => (0, _matchesPattern.default)(member, parts, allowPartial);
|
||||
}
|
||||
4525
node_modules/@types/babel__generator/node_modules/@babel/types/lib/validators/generated/index.js
generated
vendored
Normal file
4525
node_modules/@types/babel__generator/node_modules/@babel/types/lib/validators/generated/index.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
35
node_modules/@types/babel__generator/node_modules/@babel/types/lib/validators/is.js
generated
vendored
Normal file
35
node_modules/@types/babel__generator/node_modules/@babel/types/lib/validators/is.js
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = is;
|
||||
|
||||
var _shallowEqual = _interopRequireDefault(require("../utils/shallowEqual"));
|
||||
|
||||
var _isType = _interopRequireDefault(require("./isType"));
|
||||
|
||||
var _isPlaceholderType = _interopRequireDefault(require("./isPlaceholderType"));
|
||||
|
||||
var _definitions = require("../definitions");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function is(type, node, opts) {
|
||||
if (!node) return false;
|
||||
const matches = (0, _isType.default)(node.type, type);
|
||||
|
||||
if (!matches) {
|
||||
if (!opts && node.type === "Placeholder" && type in _definitions.FLIPPED_ALIAS_KEYS) {
|
||||
return (0, _isPlaceholderType.default)(node.expectedNode, type);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (typeof opts === "undefined") {
|
||||
return true;
|
||||
} else {
|
||||
return (0, _shallowEqual.default)(node, opts);
|
||||
}
|
||||
}
|
||||
33
node_modules/@types/babel__generator/node_modules/@babel/types/lib/validators/isBinding.js
generated
vendored
Normal file
33
node_modules/@types/babel__generator/node_modules/@babel/types/lib/validators/isBinding.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = isBinding;
|
||||
|
||||
var _getBindingIdentifiers = _interopRequireDefault(require("../retrievers/getBindingIdentifiers"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function isBinding(node, parent, grandparent) {
|
||||
if (grandparent && node.type === "Identifier" && parent.type === "ObjectProperty" && grandparent.type === "ObjectExpression") {
|
||||
return false;
|
||||
}
|
||||
|
||||
const keys = _getBindingIdentifiers.default.keys[parent.type];
|
||||
|
||||
if (keys) {
|
||||
for (let i = 0; i < keys.length; i++) {
|
||||
const key = keys[i];
|
||||
const val = parent[key];
|
||||
|
||||
if (Array.isArray(val)) {
|
||||
if (val.indexOf(node) >= 0) return true;
|
||||
} else {
|
||||
if (val === node) return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
16
node_modules/@types/babel__generator/node_modules/@babel/types/lib/validators/isBlockScoped.js
generated
vendored
Normal file
16
node_modules/@types/babel__generator/node_modules/@babel/types/lib/validators/isBlockScoped.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = isBlockScoped;
|
||||
|
||||
var _generated = require("./generated");
|
||||
|
||||
var _isLet = _interopRequireDefault(require("./isLet"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function isBlockScoped(node) {
|
||||
return (0, _generated.isFunctionDeclaration)(node) || (0, _generated.isClassDeclaration)(node) || (0, _isLet.default)(node);
|
||||
}
|
||||
26
node_modules/@types/babel__generator/node_modules/@babel/types/lib/validators/isImmutable.js
generated
vendored
Normal file
26
node_modules/@types/babel__generator/node_modules/@babel/types/lib/validators/isImmutable.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = isImmutable;
|
||||
|
||||
var _isType = _interopRequireDefault(require("./isType"));
|
||||
|
||||
var _generated = require("./generated");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function isImmutable(node) {
|
||||
if ((0, _isType.default)(node.type, "Immutable")) return true;
|
||||
|
||||
if ((0, _generated.isIdentifier)(node)) {
|
||||
if (node.name === "undefined") {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
14
node_modules/@types/babel__generator/node_modules/@babel/types/lib/validators/isLet.js
generated
vendored
Normal file
14
node_modules/@types/babel__generator/node_modules/@babel/types/lib/validators/isLet.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = isLet;
|
||||
|
||||
var _generated = require("./generated");
|
||||
|
||||
var _constants = require("../constants");
|
||||
|
||||
function isLet(node) {
|
||||
return (0, _generated.isVariableDeclaration)(node) && (node.kind !== "var" || node[_constants.BLOCK_SCOPED_SYMBOL]);
|
||||
}
|
||||
12
node_modules/@types/babel__generator/node_modules/@babel/types/lib/validators/isNode.js
generated
vendored
Normal file
12
node_modules/@types/babel__generator/node_modules/@babel/types/lib/validators/isNode.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = isNode;
|
||||
|
||||
var _definitions = require("../definitions");
|
||||
|
||||
function isNode(node) {
|
||||
return !!(node && _definitions.VISITOR_KEYS[node.type]);
|
||||
}
|
||||
67
node_modules/@types/babel__generator/node_modules/@babel/types/lib/validators/isNodesEquivalent.js
generated
vendored
Normal file
67
node_modules/@types/babel__generator/node_modules/@babel/types/lib/validators/isNodesEquivalent.js
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = isNodesEquivalent;
|
||||
|
||||
var _definitions = require("../definitions");
|
||||
|
||||
function isNodesEquivalent(a, b) {
|
||||
if (typeof a !== "object" || typeof b !== "object" || a == null || b == null) {
|
||||
return a === b;
|
||||
}
|
||||
|
||||
if (a.type !== b.type) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const fields = Object.keys(_definitions.NODE_FIELDS[a.type] || a.type);
|
||||
const visitorKeys = _definitions.VISITOR_KEYS[a.type];
|
||||
|
||||
for (const field of fields) {
|
||||
if (typeof a[field] !== typeof b[field]) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (a[field] == null && b[field] == null) {
|
||||
continue;
|
||||
} else if (a[field] == null || b[field] == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Array.isArray(a[field])) {
|
||||
if (!Array.isArray(b[field])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (a[field].length !== b[field].length) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (let i = 0; i < a[field].length; i++) {
|
||||
if (!isNodesEquivalent(a[field][i], b[field][i])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (typeof a[field] === "object" && (!visitorKeys || !visitorKeys.includes(field))) {
|
||||
for (const key of Object.keys(a[field])) {
|
||||
if (a[field][key] !== b[field][key]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!isNodesEquivalent(a[field], b[field])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
21
node_modules/@types/babel__generator/node_modules/@babel/types/lib/validators/isPlaceholderType.js
generated
vendored
Normal file
21
node_modules/@types/babel__generator/node_modules/@babel/types/lib/validators/isPlaceholderType.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = isPlaceholderType;
|
||||
|
||||
var _definitions = require("../definitions");
|
||||
|
||||
function isPlaceholderType(placeholderType, targetType) {
|
||||
if (placeholderType === targetType) return true;
|
||||
const aliases = _definitions.PLACEHOLDERS_ALIAS[placeholderType];
|
||||
|
||||
if (aliases) {
|
||||
for (const alias of aliases) {
|
||||
if (targetType === alias) return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
112
node_modules/@types/babel__generator/node_modules/@babel/types/lib/validators/isReferenced.js
generated
vendored
Normal file
112
node_modules/@types/babel__generator/node_modules/@babel/types/lib/validators/isReferenced.js
generated
vendored
Normal file
@@ -0,0 +1,112 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = isReferenced;
|
||||
|
||||
function isReferenced(node, parent, grandparent) {
|
||||
switch (parent.type) {
|
||||
case "MemberExpression":
|
||||
case "JSXMemberExpression":
|
||||
case "OptionalMemberExpression":
|
||||
if (parent.property === node) {
|
||||
return !!parent.computed;
|
||||
}
|
||||
|
||||
return parent.object === node;
|
||||
|
||||
case "VariableDeclarator":
|
||||
return parent.init === node;
|
||||
|
||||
case "ArrowFunctionExpression":
|
||||
return parent.body === node;
|
||||
|
||||
case "ExportSpecifier":
|
||||
if (parent.source) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return parent.local === node;
|
||||
|
||||
case "PrivateName":
|
||||
return false;
|
||||
|
||||
case "ObjectProperty":
|
||||
case "ClassProperty":
|
||||
case "ClassPrivateProperty":
|
||||
case "ClassMethod":
|
||||
case "ClassPrivateMethod":
|
||||
case "ObjectMethod":
|
||||
if (parent.key === node) {
|
||||
return !!parent.computed;
|
||||
}
|
||||
|
||||
if (parent.value === node) {
|
||||
return !grandparent || grandparent.type !== "ObjectPattern";
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
case "ClassDeclaration":
|
||||
case "ClassExpression":
|
||||
return parent.superClass === node;
|
||||
|
||||
case "AssignmentExpression":
|
||||
return parent.right === node;
|
||||
|
||||
case "AssignmentPattern":
|
||||
return parent.right === node;
|
||||
|
||||
case "LabeledStatement":
|
||||
return false;
|
||||
|
||||
case "CatchClause":
|
||||
return false;
|
||||
|
||||
case "RestElement":
|
||||
return false;
|
||||
|
||||
case "BreakStatement":
|
||||
case "ContinueStatement":
|
||||
return false;
|
||||
|
||||
case "FunctionDeclaration":
|
||||
case "FunctionExpression":
|
||||
return false;
|
||||
|
||||
case "ExportNamespaceSpecifier":
|
||||
case "ExportDefaultSpecifier":
|
||||
return false;
|
||||
|
||||
case "ImportDefaultSpecifier":
|
||||
case "ImportNamespaceSpecifier":
|
||||
case "ImportSpecifier":
|
||||
return false;
|
||||
|
||||
case "JSXAttribute":
|
||||
return false;
|
||||
|
||||
case "ObjectPattern":
|
||||
case "ArrayPattern":
|
||||
return false;
|
||||
|
||||
case "MetaProperty":
|
||||
return false;
|
||||
|
||||
case "ObjectTypeProperty":
|
||||
return parent.key !== node;
|
||||
|
||||
case "TSEnumMember":
|
||||
return parent.id !== node;
|
||||
|
||||
case "TSPropertySignature":
|
||||
if (parent.key === node) {
|
||||
return !!parent.computed;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
28
node_modules/@types/babel__generator/node_modules/@babel/types/lib/validators/isScope.js
generated
vendored
Normal file
28
node_modules/@types/babel__generator/node_modules/@babel/types/lib/validators/isScope.js
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = isScope;
|
||||
|
||||
var _generated = require("./generated");
|
||||
|
||||
function isScope(node, parent) {
|
||||
if ((0, _generated.isBlockStatement)(node) && (0, _generated.isFunction)(parent, {
|
||||
body: node
|
||||
})) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((0, _generated.isBlockStatement)(node) && (0, _generated.isCatchClause)(parent, {
|
||||
body: node
|
||||
})) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((0, _generated.isPattern)(node) && (0, _generated.isFunction)(parent)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return (0, _generated.isScopable)(node);
|
||||
}
|
||||
14
node_modules/@types/babel__generator/node_modules/@babel/types/lib/validators/isSpecifierDefault.js
generated
vendored
Normal file
14
node_modules/@types/babel__generator/node_modules/@babel/types/lib/validators/isSpecifierDefault.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = isSpecifierDefault;
|
||||
|
||||
var _generated = require("./generated");
|
||||
|
||||
function isSpecifierDefault(specifier) {
|
||||
return (0, _generated.isImportDefaultSpecifier)(specifier) || (0, _generated.isIdentifier)(specifier.imported || specifier.exported, {
|
||||
name: "default"
|
||||
});
|
||||
}
|
||||
24
node_modules/@types/babel__generator/node_modules/@babel/types/lib/validators/isType.js
generated
vendored
Normal file
24
node_modules/@types/babel__generator/node_modules/@babel/types/lib/validators/isType.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = isType;
|
||||
|
||||
var _definitions = require("../definitions");
|
||||
|
||||
function isType(nodeType, targetType) {
|
||||
if (nodeType === targetType) return true;
|
||||
if (_definitions.ALIAS_KEYS[targetType]) return false;
|
||||
const aliases = _definitions.FLIPPED_ALIAS_KEYS[targetType];
|
||||
|
||||
if (aliases) {
|
||||
if (aliases[0] === nodeType) return true;
|
||||
|
||||
for (const alias of aliases) {
|
||||
if (nodeType === alias) return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
16
node_modules/@types/babel__generator/node_modules/@babel/types/lib/validators/isValidES3Identifier.js
generated
vendored
Normal file
16
node_modules/@types/babel__generator/node_modules/@babel/types/lib/validators/isValidES3Identifier.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = isValidES3Identifier;
|
||||
|
||||
var _isValidIdentifier = _interopRequireDefault(require("./isValidIdentifier"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
const RESERVED_WORDS_ES3_ONLY = new Set(["abstract", "boolean", "byte", "char", "double", "enum", "final", "float", "goto", "implements", "int", "interface", "long", "native", "package", "private", "protected", "public", "short", "static", "synchronized", "throws", "transient", "volatile"]);
|
||||
|
||||
function isValidES3Identifier(name) {
|
||||
return (0, _isValidIdentifier.default)(name) && !RESERVED_WORDS_ES3_ONLY.has(name);
|
||||
}
|
||||
24
node_modules/@types/babel__generator/node_modules/@babel/types/lib/validators/isValidIdentifier.js
generated
vendored
Normal file
24
node_modules/@types/babel__generator/node_modules/@babel/types/lib/validators/isValidIdentifier.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = isValidIdentifier;
|
||||
|
||||
var _esutils = _interopRequireDefault(require("esutils"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function isValidIdentifier(name, reserved = true) {
|
||||
if (typeof name !== "string") return false;
|
||||
|
||||
if (reserved) {
|
||||
if (_esutils.default.keyword.isReservedWordES6(name, true)) {
|
||||
return false;
|
||||
} else if (name === "await") {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return _esutils.default.keyword.isIdentifierNameES6(name);
|
||||
}
|
||||
16
node_modules/@types/babel__generator/node_modules/@babel/types/lib/validators/isVar.js
generated
vendored
Normal file
16
node_modules/@types/babel__generator/node_modules/@babel/types/lib/validators/isVar.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = isVar;
|
||||
|
||||
var _generated = require("./generated");
|
||||
|
||||
var _constants = require("../constants");
|
||||
|
||||
function isVar(node) {
|
||||
return (0, _generated.isVariableDeclaration)(node, {
|
||||
kind: "var"
|
||||
}) && !node[_constants.BLOCK_SCOPED_SYMBOL];
|
||||
}
|
||||
40
node_modules/@types/babel__generator/node_modules/@babel/types/lib/validators/matchesPattern.js
generated
vendored
Normal file
40
node_modules/@types/babel__generator/node_modules/@babel/types/lib/validators/matchesPattern.js
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = matchesPattern;
|
||||
|
||||
var _generated = require("./generated");
|
||||
|
||||
function matchesPattern(member, match, allowPartial) {
|
||||
if (!(0, _generated.isMemberExpression)(member)) return false;
|
||||
const parts = Array.isArray(match) ? match : match.split(".");
|
||||
const nodes = [];
|
||||
let node;
|
||||
|
||||
for (node = member; (0, _generated.isMemberExpression)(node); node = node.object) {
|
||||
nodes.push(node.property);
|
||||
}
|
||||
|
||||
nodes.push(node);
|
||||
if (nodes.length < parts.length) return false;
|
||||
if (!allowPartial && nodes.length > parts.length) return false;
|
||||
|
||||
for (let i = 0, j = nodes.length - 1; i < parts.length; i++, j--) {
|
||||
const node = nodes[j];
|
||||
let value;
|
||||
|
||||
if ((0, _generated.isIdentifier)(node)) {
|
||||
value = node.name;
|
||||
} else if ((0, _generated.isStringLiteral)(node)) {
|
||||
value = node.value;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (parts[i] !== value) return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
10
node_modules/@types/babel__generator/node_modules/@babel/types/lib/validators/react/isCompatTag.js
generated
vendored
Normal file
10
node_modules/@types/babel__generator/node_modules/@babel/types/lib/validators/react/isCompatTag.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = isCompatTag;
|
||||
|
||||
function isCompatTag(tagName) {
|
||||
return !!tagName && /^[a-z]/.test(tagName);
|
||||
}
|
||||
14
node_modules/@types/babel__generator/node_modules/@babel/types/lib/validators/react/isReactComponent.js
generated
vendored
Normal file
14
node_modules/@types/babel__generator/node_modules/@babel/types/lib/validators/react/isReactComponent.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _buildMatchMemberExpression = _interopRequireDefault(require("../buildMatchMemberExpression"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
const isReactComponent = (0, _buildMatchMemberExpression.default)("React.Component");
|
||||
var _default = isReactComponent;
|
||||
exports.default = _default;
|
||||
32
node_modules/@types/babel__generator/node_modules/@babel/types/lib/validators/validate.js
generated
vendored
Normal file
32
node_modules/@types/babel__generator/node_modules/@babel/types/lib/validators/validate.js
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = validate;
|
||||
exports.validateField = validateField;
|
||||
exports.validateChild = validateChild;
|
||||
|
||||
var _definitions = require("../definitions");
|
||||
|
||||
function validate(node, key, val) {
|
||||
if (!node) return;
|
||||
const fields = _definitions.NODE_FIELDS[node.type];
|
||||
if (!fields) return;
|
||||
const field = fields[key];
|
||||
validateField(node, key, val, field);
|
||||
validateChild(node, key, val);
|
||||
}
|
||||
|
||||
function validateField(node, key, val, field) {
|
||||
if (!field || !field.validate) return;
|
||||
if (field.optional && val == null) return;
|
||||
field.validate(node, key, val);
|
||||
}
|
||||
|
||||
function validateChild(node, key, val) {
|
||||
if (val == null) return;
|
||||
const validate = _definitions.NODE_PARENT_VALIDATIONS[val.type];
|
||||
if (!validate) return;
|
||||
validate(node, key, val);
|
||||
}
|
||||
60
node_modules/@types/babel__generator/node_modules/@babel/types/package.json
generated
vendored
Normal file
60
node_modules/@types/babel__generator/node_modules/@babel/types/package.json
generated
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"@babel/types@7.8.3",
|
||||
"/home/runner/work/ghaction-upx/ghaction-upx"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "@babel/types@7.8.3",
|
||||
"_id": "@babel/types@7.8.3",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-jBD+G8+LWpMBBWvVcdr4QysjUE4mU/syrhN17o1u3gx0/WzJB1kwiVZAXRtWbsIPOwW8pF/YJV5+nmetPzepXg==",
|
||||
"_location": "/@types/babel__generator/@babel/types",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "@babel/types@7.8.3",
|
||||
"name": "@babel/types",
|
||||
"escapedName": "@babel%2ftypes",
|
||||
"scope": "@babel",
|
||||
"rawSpec": "7.8.3",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "7.8.3"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@types/babel__generator"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@babel/types/-/types-7.8.3.tgz",
|
||||
"_spec": "7.8.3",
|
||||
"_where": "/home/runner/work/ghaction-upx/ghaction-upx",
|
||||
"author": {
|
||||
"name": "Sebastian McKenzie",
|
||||
"email": "sebmck@gmail.com"
|
||||
},
|
||||
"dependencies": {
|
||||
"esutils": "^2.0.2",
|
||||
"lodash": "^4.17.13",
|
||||
"to-fast-properties": "^2.0.0"
|
||||
},
|
||||
"description": "Babel Types is a Lodash-esque utility library for AST nodes",
|
||||
"devDependencies": {
|
||||
"@babel/generator": "^7.8.3",
|
||||
"@babel/parser": "^7.8.3"
|
||||
},
|
||||
"gitHead": "a7620bd266ae1345975767bbc7abf09034437017",
|
||||
"homepage": "https://babeljs.io/",
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
"name": "@babel/types",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/babel/babel/tree/master/packages/babel-types"
|
||||
},
|
||||
"types": "lib/index.d.ts",
|
||||
"version": "7.8.3"
|
||||
}
|
||||
29
node_modules/@types/babel__generator/node_modules/@babel/types/scripts/generateTypeHelpers.js
generated
vendored
Normal file
29
node_modules/@types/babel__generator/node_modules/@babel/types/scripts/generateTypeHelpers.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
"use strict";
|
||||
const path = require("path");
|
||||
const chalk = require("chalk");
|
||||
const generateBuilders = require("./generators/generateBuilders");
|
||||
const generateValidators = require("./generators/generateValidators");
|
||||
const generateAsserts = require("./generators/generateAsserts");
|
||||
const generateConstants = require("./generators/generateConstants");
|
||||
const format = require("../../../scripts/utils/formatCode");
|
||||
const writeFile = require("../../../scripts/utils/writeFileAndMkDir");
|
||||
|
||||
const baseDir = path.join(__dirname, "../src");
|
||||
|
||||
console.log("Generating @babel/types dynamic functions");
|
||||
|
||||
const buildersFile = path.join(baseDir, "builders/generated/index.js");
|
||||
writeFile(buildersFile, format(generateBuilders(), buildersFile));
|
||||
console.log(` ${chalk.green("✔")} Generated builders`);
|
||||
|
||||
const validatorsFile = path.join(baseDir, "validators/generated/index.js");
|
||||
writeFile(validatorsFile, format(generateValidators(), validatorsFile));
|
||||
console.log(` ${chalk.green("✔")} Generated validators`);
|
||||
|
||||
const assertsFile = path.join(baseDir, "asserts/generated/index.js");
|
||||
writeFile(assertsFile, format(generateAsserts(), assertsFile));
|
||||
console.log(` ${chalk.green("✔")} Generated asserts`);
|
||||
|
||||
const constantsFile = path.join(baseDir, "constants/generated/index.js");
|
||||
writeFile(constantsFile, format(generateConstants(), constantsFile));
|
||||
console.log(` ${chalk.green("✔")} Generated constants`);
|
||||
121
node_modules/@types/babel__generator/node_modules/@babel/types/scripts/generators/docs.js
generated
vendored
Normal file
121
node_modules/@types/babel__generator/node_modules/@babel/types/scripts/generators/docs.js
generated
vendored
Normal file
@@ -0,0 +1,121 @@
|
||||
"use strict";
|
||||
|
||||
const util = require("util");
|
||||
const stringifyValidator = require("../utils/stringifyValidator");
|
||||
const toFunctionName = require("../utils/toFunctionName");
|
||||
|
||||
const types = require("../../");
|
||||
|
||||
const readme = [
|
||||
`# @babel/types
|
||||
|
||||
> This module contains methods for building ASTs manually and for checking the types of AST nodes.
|
||||
|
||||
## Install
|
||||
|
||||
\`\`\`sh
|
||||
npm install --save-dev @babel/types
|
||||
\`\`\`
|
||||
|
||||
## API`,
|
||||
];
|
||||
|
||||
const customTypes = {
|
||||
ClassMethod: {
|
||||
key: "if computed then `Expression` else `Identifier | Literal`",
|
||||
},
|
||||
Identifier: {
|
||||
name: "`string`",
|
||||
},
|
||||
MemberExpression: {
|
||||
property: "if computed then `Expression` else `Identifier`",
|
||||
},
|
||||
ObjectMethod: {
|
||||
key: "if computed then `Expression` else `Identifier | Literal`",
|
||||
},
|
||||
ObjectProperty: {
|
||||
key: "if computed then `Expression` else `Identifier | Literal`",
|
||||
},
|
||||
};
|
||||
Object.keys(types.BUILDER_KEYS)
|
||||
.sort()
|
||||
.forEach(function(key) {
|
||||
readme.push("### " + key[0].toLowerCase() + key.substr(1));
|
||||
readme.push("```javascript");
|
||||
readme.push(
|
||||
"t." +
|
||||
toFunctionName(key) +
|
||||
"(" +
|
||||
types.BUILDER_KEYS[key].join(", ") +
|
||||
")"
|
||||
);
|
||||
readme.push("```");
|
||||
readme.push("");
|
||||
readme.push(
|
||||
"See also `t.is" +
|
||||
key +
|
||||
"(node, opts)` and `t.assert" +
|
||||
key +
|
||||
"(node, opts)`."
|
||||
);
|
||||
readme.push("");
|
||||
if (types.ALIAS_KEYS[key] && types.ALIAS_KEYS[key].length) {
|
||||
readme.push(
|
||||
"Aliases: " +
|
||||
types.ALIAS_KEYS[key]
|
||||
.map(function(key) {
|
||||
return "`" + key + "`";
|
||||
})
|
||||
.join(", ")
|
||||
);
|
||||
readme.push("");
|
||||
}
|
||||
Object.keys(types.NODE_FIELDS[key])
|
||||
.sort(function(fieldA, fieldB) {
|
||||
const indexA = types.BUILDER_KEYS[key].indexOf(fieldA);
|
||||
const indexB = types.BUILDER_KEYS[key].indexOf(fieldB);
|
||||
if (indexA === indexB) return fieldA < fieldB ? -1 : 1;
|
||||
if (indexA === -1) return 1;
|
||||
if (indexB === -1) return -1;
|
||||
return indexA - indexB;
|
||||
})
|
||||
.forEach(function(field) {
|
||||
const defaultValue = types.NODE_FIELDS[key][field].default;
|
||||
const fieldDescription = ["`" + field + "`"];
|
||||
const validator = types.NODE_FIELDS[key][field].validate;
|
||||
if (customTypes[key] && customTypes[key][field]) {
|
||||
fieldDescription.push(`: ${customTypes[key][field]}`);
|
||||
} else if (validator) {
|
||||
try {
|
||||
fieldDescription.push(
|
||||
": `" + stringifyValidator(validator, "") + "`"
|
||||
);
|
||||
} catch (ex) {
|
||||
if (ex.code === "UNEXPECTED_VALIDATOR_TYPE") {
|
||||
console.log(
|
||||
"Unrecognised validator type for " + key + "." + field
|
||||
);
|
||||
console.dir(ex.validator, { depth: 10, colors: true });
|
||||
}
|
||||
}
|
||||
}
|
||||
if (defaultValue !== null || types.NODE_FIELDS[key][field].optional) {
|
||||
fieldDescription.push(
|
||||
" (default: `" + util.inspect(defaultValue) + "`"
|
||||
);
|
||||
if (types.BUILDER_KEYS[key].indexOf(field) < 0) {
|
||||
fieldDescription.push(", excluded from builder function");
|
||||
}
|
||||
fieldDescription.push(")");
|
||||
} else {
|
||||
fieldDescription.push(" (required)");
|
||||
}
|
||||
readme.push(" - " + fieldDescription.join(""));
|
||||
});
|
||||
|
||||
readme.push("");
|
||||
readme.push("---");
|
||||
readme.push("");
|
||||
});
|
||||
|
||||
process.stdout.write(readme.join("\n"));
|
||||
248
node_modules/@types/babel__generator/node_modules/@babel/types/scripts/generators/flow.js
generated
vendored
Normal file
248
node_modules/@types/babel__generator/node_modules/@babel/types/scripts/generators/flow.js
generated
vendored
Normal file
@@ -0,0 +1,248 @@
|
||||
"use strict";
|
||||
|
||||
const t = require("../../");
|
||||
const stringifyValidator = require("../utils/stringifyValidator");
|
||||
const toFunctionName = require("../utils/toFunctionName");
|
||||
|
||||
const NODE_PREFIX = "BabelNode";
|
||||
|
||||
let code = `// NOTE: This file is autogenerated. Do not modify.
|
||||
// See packages/babel-types/scripts/generators/flow.js for script used.
|
||||
|
||||
declare class ${NODE_PREFIX}Comment {
|
||||
value: string;
|
||||
start: number;
|
||||
end: number;
|
||||
loc: ${NODE_PREFIX}SourceLocation;
|
||||
}
|
||||
|
||||
declare class ${NODE_PREFIX}CommentBlock extends ${NODE_PREFIX}Comment {
|
||||
type: "CommentBlock";
|
||||
}
|
||||
|
||||
declare class ${NODE_PREFIX}CommentLine extends ${NODE_PREFIX}Comment {
|
||||
type: "CommentLine";
|
||||
}
|
||||
|
||||
declare class ${NODE_PREFIX}SourceLocation {
|
||||
start: {
|
||||
line: number;
|
||||
column: number;
|
||||
};
|
||||
|
||||
end: {
|
||||
line: number;
|
||||
column: number;
|
||||
};
|
||||
}
|
||||
|
||||
declare class ${NODE_PREFIX} {
|
||||
leadingComments?: Array<${NODE_PREFIX}Comment>;
|
||||
innerComments?: Array<${NODE_PREFIX}Comment>;
|
||||
trailingComments?: Array<${NODE_PREFIX}Comment>;
|
||||
start: ?number;
|
||||
end: ?number;
|
||||
loc: ?${NODE_PREFIX}SourceLocation;
|
||||
}\n\n`;
|
||||
|
||||
//
|
||||
|
||||
const lines = [];
|
||||
|
||||
for (const type in t.NODE_FIELDS) {
|
||||
const fields = t.NODE_FIELDS[type];
|
||||
|
||||
const struct = ['type: "' + type + '";'];
|
||||
const args = [];
|
||||
const builderNames = t.BUILDER_KEYS[type];
|
||||
|
||||
Object.keys(t.NODE_FIELDS[type])
|
||||
.sort((fieldA, fieldB) => {
|
||||
const indexA = t.BUILDER_KEYS[type].indexOf(fieldA);
|
||||
const indexB = t.BUILDER_KEYS[type].indexOf(fieldB);
|
||||
if (indexA === indexB) return fieldA < fieldB ? -1 : 1;
|
||||
if (indexA === -1) return 1;
|
||||
if (indexB === -1) return -1;
|
||||
return indexA - indexB;
|
||||
})
|
||||
.forEach(fieldName => {
|
||||
const field = fields[fieldName];
|
||||
|
||||
let suffix = "";
|
||||
if (field.optional || field.default != null) suffix += "?";
|
||||
|
||||
let typeAnnotation = "any";
|
||||
|
||||
const validate = field.validate;
|
||||
if (validate) {
|
||||
typeAnnotation = stringifyValidator(validate, NODE_PREFIX);
|
||||
}
|
||||
|
||||
if (typeAnnotation) {
|
||||
suffix += ": " + typeAnnotation;
|
||||
}
|
||||
if (builderNames.includes(fieldName)) {
|
||||
args.push(t.toBindingIdentifierName(fieldName) + suffix);
|
||||
}
|
||||
|
||||
if (t.isValidIdentifier(fieldName)) {
|
||||
struct.push(fieldName + suffix + ";");
|
||||
}
|
||||
});
|
||||
|
||||
code += `declare class ${NODE_PREFIX}${type} extends ${NODE_PREFIX} {
|
||||
${struct.join("\n ").trim()}
|
||||
}\n\n`;
|
||||
|
||||
// Flow chokes on super() and import() :/
|
||||
if (type !== "Super" && type !== "Import") {
|
||||
lines.push(
|
||||
`declare function ${toFunctionName(type)}(${args.join(
|
||||
", "
|
||||
)}): ${NODE_PREFIX}${type};`
|
||||
);
|
||||
} else {
|
||||
const functionName = toFunctionName(type);
|
||||
lines.push(
|
||||
`declare function _${functionName}(${args.join(
|
||||
", "
|
||||
)}): ${NODE_PREFIX}${type};`,
|
||||
`declare export { _${functionName} as ${functionName} }`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
for (let i = 0; i < t.TYPES.length; i++) {
|
||||
let decl = `declare function is${t.TYPES[i]}(node: ?Object, opts?: ?Object): boolean`;
|
||||
|
||||
if (t.NODE_FIELDS[t.TYPES[i]]) {
|
||||
decl += ` %checks (node instanceof ${NODE_PREFIX}${t.TYPES[i]})`;
|
||||
}
|
||||
|
||||
lines.push(decl);
|
||||
}
|
||||
|
||||
lines.push(
|
||||
// builders/
|
||||
// eslint-disable-next-line max-len
|
||||
`declare function createTypeAnnotationBasedOnTypeof(type: 'string' | 'number' | 'undefined' | 'boolean' | 'function' | 'object' | 'symbol'): ${NODE_PREFIX}TypeAnnotation`,
|
||||
// eslint-disable-next-line max-len
|
||||
`declare function createUnionTypeAnnotation(types: Array<${NODE_PREFIX}FlowType>): ${NODE_PREFIX}UnionTypeAnnotation`,
|
||||
// this smells like "internal API"
|
||||
// eslint-disable-next-line max-len
|
||||
`declare function buildChildren(node: { children: Array<${NODE_PREFIX}JSXText | ${NODE_PREFIX}JSXExpressionContainer | ${NODE_PREFIX}JSXSpreadChild | ${NODE_PREFIX}JSXElement | ${NODE_PREFIX}JSXFragment | ${NODE_PREFIX}JSXEmptyExpression> }): Array<${NODE_PREFIX}JSXText | ${NODE_PREFIX}JSXExpressionContainer | ${NODE_PREFIX}JSXSpreadChild | ${NODE_PREFIX}JSXElement | ${NODE_PREFIX}JSXFragment>`,
|
||||
|
||||
// clone/
|
||||
`declare function clone<T>(n: T): T;`,
|
||||
`declare function cloneDeep<T>(n: T): T;`,
|
||||
`declare function cloneNode<T>(n: T, deep?: boolean): T;`,
|
||||
`declare function cloneWithoutLoc<T>(n: T): T;`,
|
||||
|
||||
// comments/
|
||||
`declare type CommentTypeShorthand = 'leading' | 'inner' | 'trailing'`,
|
||||
// eslint-disable-next-line max-len
|
||||
`declare function addComment<T: Node>(node: T, type: CommentTypeShorthand, content: string, line?: boolean): T`,
|
||||
// eslint-disable-next-line max-len
|
||||
`declare function addComments<T: Node>(node: T, type: CommentTypeShorthand, comments: Array<Comment>): T`,
|
||||
`declare function inheritInnerComments(node: Node, parent: Node): void`,
|
||||
`declare function inheritLeadingComments(node: Node, parent: Node): void`,
|
||||
`declare function inheritsComments<T: Node>(node: T, parent: Node): void`,
|
||||
`declare function inheritTrailingComments(node: Node, parent: Node): void`,
|
||||
`declare function removeComments<T: Node>(node: T): T`,
|
||||
|
||||
// converters/
|
||||
`declare function ensureBlock(node: ${NODE_PREFIX}, key: string): ${NODE_PREFIX}BlockStatement`,
|
||||
`declare function toBindingIdentifierName(name?: ?string): string`,
|
||||
// eslint-disable-next-line max-len
|
||||
`declare function toBlock(node: ${NODE_PREFIX}Statement | ${NODE_PREFIX}Expression, parent?: ${NODE_PREFIX}Function | null): ${NODE_PREFIX}BlockStatement`,
|
||||
// eslint-disable-next-line max-len
|
||||
`declare function toComputedKey(node: ${NODE_PREFIX}Method | ${NODE_PREFIX}Property, key?: ${NODE_PREFIX}Expression | ${NODE_PREFIX}Identifier): ${NODE_PREFIX}Expression`,
|
||||
// eslint-disable-next-line max-len
|
||||
`declare function toExpression(node: ${NODE_PREFIX}ExpressionStatement | ${NODE_PREFIX}Expression | ${NODE_PREFIX}Class | ${NODE_PREFIX}Function): ${NODE_PREFIX}Expression`,
|
||||
`declare function toIdentifier(name?: ?string): string`,
|
||||
// eslint-disable-next-line max-len
|
||||
`declare function toKeyAlias(node: ${NODE_PREFIX}Method | ${NODE_PREFIX}Property, key?: ${NODE_PREFIX}): string`,
|
||||
// toSequenceExpression relies on types that aren't declared in flow
|
||||
// eslint-disable-next-line max-len
|
||||
`declare function toStatement(node: ${NODE_PREFIX}Statement | ${NODE_PREFIX}Class | ${NODE_PREFIX}Function | ${NODE_PREFIX}AssignmentExpression, ignore?: boolean): ${NODE_PREFIX}Statement | void`,
|
||||
`declare function valueToNode(value: any): ${NODE_PREFIX}Expression`,
|
||||
|
||||
// modifications/
|
||||
// eslint-disable-next-line max-len
|
||||
`declare function removeTypeDuplicates(types: Array<${NODE_PREFIX}FlowType>): Array<${NODE_PREFIX}FlowType>`,
|
||||
// eslint-disable-next-line max-len
|
||||
`declare function appendToMemberExpression(member: ${NODE_PREFIX}MemberExpression, append: ${NODE_PREFIX}, computed?: boolean): ${NODE_PREFIX}MemberExpression`,
|
||||
// eslint-disable-next-line max-len
|
||||
`declare function inherits<T: Node>(child: T, parent: ${NODE_PREFIX} | null | void): T`,
|
||||
// eslint-disable-next-line max-len
|
||||
`declare function prependToMemberExpression(member: ${NODE_PREFIX}MemberExpression, prepend: ${NODE_PREFIX}Expression): ${NODE_PREFIX}MemberExpression`,
|
||||
`declare function removeProperties<T>(n: T, opts: ?{}): void;`,
|
||||
`declare function removePropertiesDeep<T>(n: T, opts: ?{}): T;`,
|
||||
|
||||
// retrievers/
|
||||
// eslint-disable-next-line max-len
|
||||
`declare function getBindingIdentifiers(node: ${NODE_PREFIX}, duplicates: boolean, outerOnly?: boolean): { [key: string]: ${NODE_PREFIX}Identifier | Array<${NODE_PREFIX}Identifier> }`,
|
||||
// eslint-disable-next-line max-len
|
||||
`declare function getOuterBindingIdentifiers(node: Node, duplicates: boolean): { [key: string]: ${NODE_PREFIX}Identifier | Array<${NODE_PREFIX}Identifier> }`,
|
||||
|
||||
// traverse/
|
||||
`declare type TraversalAncestors = Array<{
|
||||
node: BabelNode,
|
||||
key: string,
|
||||
index?: number,
|
||||
}>;
|
||||
declare type TraversalHandler<T> = (BabelNode, TraversalAncestors, T) => void;
|
||||
declare type TraversalHandlers<T> = {
|
||||
enter?: TraversalHandler<T>,
|
||||
exit?: TraversalHandler<T>,
|
||||
};`.replace(/(^|\n) {2}/g, "$1"),
|
||||
// eslint-disable-next-line
|
||||
`declare function traverse<T>(n: BabelNode, TraversalHandler<T> | TraversalHandlers<T>, state?: T): void;`,
|
||||
`declare function traverseFast<T>(n: Node, h: TraversalHandler<T>, state?: T): void;`,
|
||||
|
||||
// utils/
|
||||
// cleanJSXElementLiteralChild is not exported
|
||||
// inherit is not exported
|
||||
`declare function shallowEqual(actual: Object, expected: Object): boolean`,
|
||||
|
||||
// validators/
|
||||
// eslint-disable-next-line max-len
|
||||
`declare function buildMatchMemberExpression(match: string, allowPartial?: boolean): (?BabelNode) => boolean`,
|
||||
`declare function is(type: string, n: BabelNode, opts: Object): boolean;`,
|
||||
`declare function isBinding(node: BabelNode, parent: BabelNode, grandparent?: BabelNode): boolean`,
|
||||
`declare function isBlockScoped(node: BabelNode): boolean`,
|
||||
`declare function isImmutable(node: BabelNode): boolean`,
|
||||
`declare function isLet(node: BabelNode): boolean`,
|
||||
`declare function isNode(node: ?Object): boolean`,
|
||||
`declare function isNodesEquivalent(a: any, b: any): boolean`,
|
||||
`declare function isPlaceholderType(placeholderType: string, targetType: string): boolean`,
|
||||
`declare function isReferenced(node: BabelNode, parent: BabelNode, grandparent?: BabelNode): boolean`,
|
||||
`declare function isScope(node: BabelNode, parent: BabelNode): boolean`,
|
||||
`declare function isSpecifierDefault(specifier: BabelNodeModuleSpecifier): boolean`,
|
||||
`declare function isType(nodetype: ?string, targetType: string): boolean`,
|
||||
`declare function isValidES3Identifier(name: string): boolean`,
|
||||
`declare function isValidES3Identifier(name: string): boolean`,
|
||||
`declare function isValidIdentifier(name: string): boolean`,
|
||||
`declare function isVar(node: BabelNode): boolean`,
|
||||
// eslint-disable-next-line max-len
|
||||
`declare function matchesPattern(node: ?BabelNode, match: string | Array<string>, allowPartial?: boolean): boolean`,
|
||||
`declare function validate(n: BabelNode, key: string, value: mixed): void;`
|
||||
);
|
||||
|
||||
for (const type in t.FLIPPED_ALIAS_KEYS) {
|
||||
const types = t.FLIPPED_ALIAS_KEYS[type];
|
||||
code += `type ${NODE_PREFIX}${type} = ${types
|
||||
.map(type => `${NODE_PREFIX}${type}`)
|
||||
.join(" | ")};\n`;
|
||||
}
|
||||
|
||||
code += `\ndeclare module "@babel/types" {
|
||||
${lines
|
||||
.join("\n")
|
||||
.replace(/\n/g, "\n ")
|
||||
.trim()}
|
||||
}\n`;
|
||||
|
||||
//
|
||||
|
||||
process.stdout.write(code);
|
||||
44
node_modules/@types/babel__generator/node_modules/@babel/types/scripts/generators/generateAsserts.js
generated
vendored
Normal file
44
node_modules/@types/babel__generator/node_modules/@babel/types/scripts/generators/generateAsserts.js
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
"use strict";
|
||||
const definitions = require("../../lib/definitions");
|
||||
|
||||
function addAssertHelper(type) {
|
||||
return `export function assert${type}(node: Object, opts?: Object = {}): void {
|
||||
assert("${type}", node, opts) }
|
||||
`;
|
||||
}
|
||||
|
||||
module.exports = function generateAsserts() {
|
||||
let output = `// @flow
|
||||
/*
|
||||
* This file is auto-generated! Do not modify it directly.
|
||||
* To re-generate run 'make build'
|
||||
*/
|
||||
import is from "../../validators/is";
|
||||
|
||||
function assert(type: string, node: Object, opts?: Object): void {
|
||||
if (!is(type, node, opts)) {
|
||||
throw new Error(
|
||||
\`Expected type "\${type}" with option \${JSON.stringify((opts: any))}, \` +
|
||||
\`but instead got "\${node.type}".\`,
|
||||
);
|
||||
}
|
||||
}\n\n`;
|
||||
|
||||
Object.keys(definitions.VISITOR_KEYS).forEach(type => {
|
||||
output += addAssertHelper(type);
|
||||
});
|
||||
|
||||
Object.keys(definitions.FLIPPED_ALIAS_KEYS).forEach(type => {
|
||||
output += addAssertHelper(type);
|
||||
});
|
||||
|
||||
Object.keys(definitions.DEPRECATED_KEYS).forEach(type => {
|
||||
const newType = definitions.DEPRECATED_KEYS[type];
|
||||
output += `export function assert${type}(node: Object, opts: Object): void {
|
||||
console.trace("The node type ${type} has been renamed to ${newType}");
|
||||
assert("${type}", node, opts);
|
||||
}\n`;
|
||||
});
|
||||
|
||||
return output;
|
||||
};
|
||||
43
node_modules/@types/babel__generator/node_modules/@babel/types/scripts/generators/generateBuilders.js
generated
vendored
Normal file
43
node_modules/@types/babel__generator/node_modules/@babel/types/scripts/generators/generateBuilders.js
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
"use strict";
|
||||
const definitions = require("../../lib/definitions");
|
||||
const formatBuilderName = require("../utils/formatBuilderName");
|
||||
const lowerFirst = require("../utils/lowerFirst");
|
||||
|
||||
module.exports = function generateBuilders() {
|
||||
let output = `// @flow
|
||||
/*
|
||||
* This file is auto-generated! Do not modify it directly.
|
||||
* To re-generate run 'make build'
|
||||
*/
|
||||
import builder from "../builder";\n\n`;
|
||||
|
||||
Object.keys(definitions.BUILDER_KEYS).forEach(type => {
|
||||
output += `export function ${type}(...args: Array<any>): Object { return builder("${type}", ...args); }
|
||||
export { ${type} as ${formatBuilderName(type)} };\n`;
|
||||
|
||||
// This is needed for backwards compatibility.
|
||||
// It should be removed in the next major version.
|
||||
// JSXIdentifier -> jSXIdentifier
|
||||
if (/^[A-Z]{2}/.test(type)) {
|
||||
output += `export { ${type} as ${lowerFirst(type)} }\n`;
|
||||
}
|
||||
});
|
||||
|
||||
Object.keys(definitions.DEPRECATED_KEYS).forEach(type => {
|
||||
const newType = definitions.DEPRECATED_KEYS[type];
|
||||
output += `export function ${type}(...args: Array<any>): Object {
|
||||
console.trace("The node type ${type} has been renamed to ${newType}");
|
||||
return ${type}("${type}", ...args);
|
||||
}
|
||||
export { ${type} as ${formatBuilderName(type)} };\n`;
|
||||
|
||||
// This is needed for backwards compatibility.
|
||||
// It should be removed in the next major version.
|
||||
// JSXIdentifier -> jSXIdentifier
|
||||
if (/^[A-Z]{2}/.test(type)) {
|
||||
output += `export { ${type} as ${lowerFirst(type)} }\n`;
|
||||
}
|
||||
});
|
||||
|
||||
return output;
|
||||
};
|
||||
17
node_modules/@types/babel__generator/node_modules/@babel/types/scripts/generators/generateConstants.js
generated
vendored
Normal file
17
node_modules/@types/babel__generator/node_modules/@babel/types/scripts/generators/generateConstants.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
const definitions = require("../../lib/definitions");
|
||||
|
||||
module.exports = function generateConstants() {
|
||||
let output = `// @flow
|
||||
/*
|
||||
* This file is auto-generated! Do not modify it directly.
|
||||
* To re-generate run 'make build'
|
||||
*/
|
||||
import { FLIPPED_ALIAS_KEYS } from "../../definitions";\n\n`;
|
||||
|
||||
Object.keys(definitions.FLIPPED_ALIAS_KEYS).forEach(type => {
|
||||
output += `export const ${type.toUpperCase()}_TYPES = FLIPPED_ALIAS_KEYS["${type}"];\n`;
|
||||
});
|
||||
|
||||
return output;
|
||||
};
|
||||
78
node_modules/@types/babel__generator/node_modules/@babel/types/scripts/generators/generateValidators.js
generated
vendored
Normal file
78
node_modules/@types/babel__generator/node_modules/@babel/types/scripts/generators/generateValidators.js
generated
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
"use strict";
|
||||
const definitions = require("../../lib/definitions");
|
||||
|
||||
const has = Function.call.bind(Object.prototype.hasOwnProperty);
|
||||
|
||||
function joinComparisons(leftArr, right) {
|
||||
return (
|
||||
leftArr.map(JSON.stringify).join(` === ${right} || `) + ` === ${right}`
|
||||
);
|
||||
}
|
||||
|
||||
function addIsHelper(type, aliasKeys, deprecated) {
|
||||
const targetType = JSON.stringify(type);
|
||||
let aliasSource = "";
|
||||
if (aliasKeys) {
|
||||
aliasSource = " || " + joinComparisons(aliasKeys, "nodeType");
|
||||
}
|
||||
|
||||
let placeholderSource = "";
|
||||
const placeholderTypes = [];
|
||||
if (
|
||||
definitions.PLACEHOLDERS.includes(type) &&
|
||||
has(definitions.FLIPPED_ALIAS_KEYS, type)
|
||||
) {
|
||||
placeholderTypes.push(type);
|
||||
}
|
||||
if (has(definitions.PLACEHOLDERS_FLIPPED_ALIAS, type)) {
|
||||
placeholderTypes.push(...definitions.PLACEHOLDERS_FLIPPED_ALIAS[type]);
|
||||
}
|
||||
if (placeholderTypes.length > 0) {
|
||||
placeholderSource =
|
||||
' || nodeType === "Placeholder" && (' +
|
||||
joinComparisons(placeholderTypes, "node.expectedNode") +
|
||||
")";
|
||||
}
|
||||
|
||||
return `export function is${type}(node: ?Object, opts?: Object): boolean {
|
||||
${deprecated || ""}
|
||||
if (!node) return false;
|
||||
|
||||
const nodeType = node.type;
|
||||
if (nodeType === ${targetType}${aliasSource}${placeholderSource}) {
|
||||
if (typeof opts === "undefined") {
|
||||
return true;
|
||||
} else {
|
||||
return shallowEqual(node, opts);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
`;
|
||||
}
|
||||
|
||||
module.exports = function generateValidators() {
|
||||
let output = `// @flow
|
||||
/*
|
||||
* This file is auto-generated! Do not modify it directly.
|
||||
* To re-generate run 'make build'
|
||||
*/
|
||||
import shallowEqual from "../../utils/shallowEqual";\n\n`;
|
||||
|
||||
Object.keys(definitions.VISITOR_KEYS).forEach(type => {
|
||||
output += addIsHelper(type);
|
||||
});
|
||||
|
||||
Object.keys(definitions.FLIPPED_ALIAS_KEYS).forEach(type => {
|
||||
output += addIsHelper(type, definitions.FLIPPED_ALIAS_KEYS[type]);
|
||||
});
|
||||
|
||||
Object.keys(definitions.DEPRECATED_KEYS).forEach(type => {
|
||||
const newType = definitions.DEPRECATED_KEYS[type];
|
||||
const deprecated = `console.trace("The node type ${type} has been renamed to ${newType}");`;
|
||||
output += addIsHelper(type, null, deprecated);
|
||||
});
|
||||
|
||||
return output;
|
||||
};
|
||||
361
node_modules/@types/babel__generator/node_modules/@babel/types/scripts/generators/typescript.js
generated
vendored
Normal file
361
node_modules/@types/babel__generator/node_modules/@babel/types/scripts/generators/typescript.js
generated
vendored
Normal file
@@ -0,0 +1,361 @@
|
||||
"use strict";
|
||||
|
||||
const t = require("../../");
|
||||
const stringifyValidator = require("../utils/stringifyValidator");
|
||||
const toFunctionName = require("../utils/toFunctionName");
|
||||
|
||||
let code = `// NOTE: This file is autogenerated. Do not modify.
|
||||
// See packages/babel-types/scripts/generators/typescript.js for script used.
|
||||
|
||||
interface BaseComment {
|
||||
value: string;
|
||||
start: number;
|
||||
end: number;
|
||||
loc: SourceLocation;
|
||||
type: "CommentBlock" | "CommentLine";
|
||||
}
|
||||
|
||||
export interface CommentBlock extends BaseComment {
|
||||
type: "CommentBlock";
|
||||
}
|
||||
|
||||
export interface CommentLine extends BaseComment {
|
||||
type: "CommentLine";
|
||||
}
|
||||
|
||||
export type Comment = CommentBlock | CommentLine;
|
||||
|
||||
export interface SourceLocation {
|
||||
start: {
|
||||
line: number;
|
||||
column: number;
|
||||
};
|
||||
|
||||
end: {
|
||||
line: number;
|
||||
column: number;
|
||||
};
|
||||
}
|
||||
|
||||
interface BaseNode {
|
||||
leadingComments: ReadonlyArray<Comment> | null;
|
||||
innerComments: ReadonlyArray<Comment> | null;
|
||||
trailingComments: ReadonlyArray<Comment> | null;
|
||||
start: number | null;
|
||||
end: number | null;
|
||||
loc: SourceLocation | null;
|
||||
type: Node["type"];
|
||||
}
|
||||
|
||||
export type Node = ${t.TYPES.sort().join(" | ")};\n\n`;
|
||||
|
||||
//
|
||||
|
||||
const lines = [];
|
||||
|
||||
for (const type in t.NODE_FIELDS) {
|
||||
const fields = t.NODE_FIELDS[type];
|
||||
const fieldNames = sortFieldNames(Object.keys(t.NODE_FIELDS[type]), type);
|
||||
const builderNames = t.BUILDER_KEYS[type];
|
||||
|
||||
const struct = ['type: "' + type + '";'];
|
||||
const args = [];
|
||||
|
||||
fieldNames.forEach(fieldName => {
|
||||
const field = fields[fieldName];
|
||||
// Future / annoying TODO:
|
||||
// MemberExpression.property, ObjectProperty.key and ObjectMethod.key need special cases; either:
|
||||
// - convert the declaration to chain() like ClassProperty.key and ClassMethod.key,
|
||||
// - declare an alias type for valid keys, detect the case and reuse it here,
|
||||
// - declare a disjoint union with, for example, ObjectPropertyBase,
|
||||
// ObjectPropertyLiteralKey and ObjectPropertyComputedKey, and declare ObjectProperty
|
||||
// as "ObjectPropertyBase & (ObjectPropertyLiteralKey | ObjectPropertyComputedKey)"
|
||||
let typeAnnotation = stringifyValidator(field.validate, "");
|
||||
|
||||
if (isNullable(field) && !hasDefault(field)) {
|
||||
typeAnnotation += " | null";
|
||||
}
|
||||
|
||||
if (builderNames.includes(fieldName)) {
|
||||
if (areAllRemainingFieldsNullable(fieldName, builderNames, fields)) {
|
||||
args.push(
|
||||
`${t.toBindingIdentifierName(fieldName)}${
|
||||
isNullable(field) ? "?:" : ":"
|
||||
} ${typeAnnotation}`
|
||||
);
|
||||
} else {
|
||||
args.push(
|
||||
`${t.toBindingIdentifierName(fieldName)}: ${typeAnnotation}${
|
||||
isNullable(field) ? " | undefined" : ""
|
||||
}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const alphaNumeric = /^\w+$/;
|
||||
|
||||
if (t.isValidIdentifier(fieldName) || alphaNumeric.test(fieldName)) {
|
||||
struct.push(`${fieldName}: ${typeAnnotation};`);
|
||||
} else {
|
||||
struct.push(`"${fieldName}": ${typeAnnotation};`);
|
||||
}
|
||||
});
|
||||
|
||||
code += `export interface ${type} extends BaseNode {
|
||||
${struct.join("\n ").trim()}
|
||||
}\n\n`;
|
||||
|
||||
// super and import are reserved words in JavaScript
|
||||
if (type !== "Super" && type !== "Import") {
|
||||
lines.push(
|
||||
`export function ${toFunctionName(type)}(${args.join(", ")}): ${type};`
|
||||
);
|
||||
} else {
|
||||
const functionName = toFunctionName(type);
|
||||
lines.push(
|
||||
`declare function _${functionName}(${args.join(", ")}): ${type};`,
|
||||
`export { _${functionName} as ${functionName}}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
for (const typeName of t.TYPES) {
|
||||
const result =
|
||||
t.NODE_FIELDS[typeName] || t.FLIPPED_ALIAS_KEYS[typeName]
|
||||
? `node is ${typeName}`
|
||||
: "boolean";
|
||||
|
||||
lines.push(
|
||||
`export function is${typeName}(node: object | null | undefined, opts?: object | null): ${result};`,
|
||||
// TypeScript 3.7: https://github.com/microsoft/TypeScript/pull/32695 will allow assert declarations
|
||||
// eslint-disable-next-line max-len
|
||||
`// export function assert${typeName}(node: object | null | undefined, opts?: object | null): asserts ${
|
||||
result === "boolean" ? "node" : result
|
||||
};`
|
||||
);
|
||||
}
|
||||
|
||||
lines.push(
|
||||
// assert/
|
||||
// Commented out as this declaration requires TypeScript 3.7 (what do?)
|
||||
`// export function assertNode(obj: any): asserts obj is Node`,
|
||||
|
||||
// builders/
|
||||
// eslint-disable-next-line max-len
|
||||
`export function createTypeAnnotationBasedOnTypeof(type: 'string' | 'number' | 'undefined' | 'boolean' | 'function' | 'object' | 'symbol'): StringTypeAnnotation | VoidTypeAnnotation | NumberTypeAnnotation | BooleanTypeAnnotation | GenericTypeAnnotation`,
|
||||
`export function createUnionTypeAnnotation<T extends FlowType>(types: [T]): T`,
|
||||
// this probably misbehaves if there are 0 elements, and it's not a UnionTypeAnnotation if there's only 1
|
||||
// it is possible to require "2 or more" for this overload ([T, T, ...T[]]) but it requires typescript 3.0
|
||||
`export function createUnionTypeAnnotation(types: ReadonlyArray<FlowType>): UnionTypeAnnotation`,
|
||||
// this smells like "internal API"
|
||||
// eslint-disable-next-line max-len
|
||||
`export function buildChildren(node: { children: ReadonlyArray<JSXText | JSXExpressionContainer | JSXSpreadChild | JSXElement | JSXFragment | JSXEmptyExpression> }): JSXElement['children']`,
|
||||
|
||||
// clone/
|
||||
`export function clone<T extends Node>(n: T): T;`,
|
||||
`export function cloneDeep<T extends Node>(n: T): T;`,
|
||||
`export function cloneNode<T extends Node>(n: T, deep?: boolean): T;`,
|
||||
`export function cloneWithoutLoc<T extends Node>(n: T): T;`,
|
||||
|
||||
// comments/
|
||||
`export type CommentTypeShorthand = 'leading' | 'inner' | 'trailing'`,
|
||||
// eslint-disable-next-line max-len
|
||||
`export function addComment<T extends Node>(node: T, type: CommentTypeShorthand, content: string, line?: boolean): T`,
|
||||
// eslint-disable-next-line max-len
|
||||
`export function addComments<T extends Node>(node: T, type: CommentTypeShorthand, comments: ReadonlyArray<Comment>): T`,
|
||||
`export function inheritInnerComments(node: Node, parent: Node): void`,
|
||||
`export function inheritLeadingComments(node: Node, parent: Node): void`,
|
||||
`export function inheritsComments<T extends Node>(node: T, parent: Node): void`,
|
||||
`export function inheritTrailingComments(node: Node, parent: Node): void`,
|
||||
`export function removeComments<T extends Node>(node: T): T`,
|
||||
|
||||
// converters/
|
||||
// eslint-disable-next-line max-len
|
||||
`export function ensureBlock(node: Extract<Node, { body: BlockStatement | Statement | Expression }>): BlockStatement`,
|
||||
// too complex?
|
||||
// eslint-disable-next-line max-len
|
||||
`export function ensureBlock<K extends keyof Extract<Node, { body: BlockStatement | Statement | Expression }> = 'body'>(node: Extract<Node, Record<K, BlockStatement | Statement | Expression>>, key: K): BlockStatement`,
|
||||
// gatherSequenceExpressions is not exported
|
||||
`export function toBindingIdentifierName(name: { toString(): string } | null | undefined): string`,
|
||||
`export function toBlock(node: Statement | Expression, parent?: Function | null): BlockStatement`,
|
||||
// it is possible for `node` to be an arbitrary object if `key` is always provided,
|
||||
// but that doesn't look like intended API
|
||||
// eslint-disable-next-line max-len
|
||||
`export function toComputedKey<T extends Extract<Node, { computed: boolean | null }>>(node: T, key?: Expression | Identifier): Expression`,
|
||||
`export function toExpression(node: Function): FunctionExpression`,
|
||||
`export function toExpression(node: Class): ClassExpression`,
|
||||
`export function toExpression(node: ExpressionStatement | Expression | Class | Function): Expression`,
|
||||
`export function toIdentifier(name: { toString(): string } | null | undefined): string`,
|
||||
`export function toKeyAlias(node: Method | Property, key?: Node): string`,
|
||||
// NOTE: this actually uses Scope from @babel/traverse, but we can't add a dependency on its types,
|
||||
// as they live in @types. Declare the structural subset that is required.
|
||||
// eslint-disable-next-line max-len
|
||||
`export function toSequenceExpression(nodes: ReadonlyArray<Node>, scope: { push(value: { id: LVal; kind: 'var'; init?: Expression}): void; buildUndefinedNode(): Node }): SequenceExpression | undefined`,
|
||||
`export function toStatement(node: AssignmentExpression, ignore?: boolean): ExpressionStatement`,
|
||||
`export function toStatement(node: Statement | AssignmentExpression, ignore?: boolean): Statement`,
|
||||
`export function toStatement(node: Class, ignore: true): ClassDeclaration | undefined`,
|
||||
`export function toStatement(node: Class, ignore?: boolean): ClassDeclaration`,
|
||||
`export function toStatement(node: Function, ignore: true): FunctionDeclaration | undefined`,
|
||||
`export function toStatement(node: Function, ignore?: boolean): FunctionDeclaration`,
|
||||
// eslint-disable-next-line max-len
|
||||
`export function toStatement(node: Statement | Class | Function | AssignmentExpression, ignore: true): Statement | undefined`,
|
||||
// eslint-disable-next-line max-len
|
||||
`export function toStatement(node: Statement | Class | Function | AssignmentExpression, ignore?: boolean): Statement`,
|
||||
// eslint-disable-next-line max-len
|
||||
`export function valueToNode(value: undefined): Identifier`, // (should this not be a UnaryExpression to avoid shadowing?)
|
||||
`export function valueToNode(value: boolean): BooleanLiteral`,
|
||||
`export function valueToNode(value: null): NullLiteral`,
|
||||
`export function valueToNode(value: string): StringLiteral`,
|
||||
// Infinities and NaN need to use a BinaryExpression; negative values must be wrapped in UnaryExpression
|
||||
`export function valueToNode(value: number): NumericLiteral | BinaryExpression | UnaryExpression`,
|
||||
`export function valueToNode(value: RegExp): RegExpLiteral`,
|
||||
// eslint-disable-next-line max-len
|
||||
`export function valueToNode(value: ReadonlyArray<undefined | boolean | null | string | number | RegExp | object>): ArrayExpression`,
|
||||
// this throws with objects that are not PlainObject according to lodash,
|
||||
// or if there are non-valueToNode-able values
|
||||
`export function valueToNode(value: object): ObjectExpression`,
|
||||
// eslint-disable-next-line max-len
|
||||
`export function valueToNode(value: undefined | boolean | null | string | number | RegExp | object): Expression`,
|
||||
|
||||
// modifications/
|
||||
// eslint-disable-next-line max-len
|
||||
`export function removeTypeDuplicates(types: ReadonlyArray<FlowType | false | null | undefined>): FlowType[]`,
|
||||
// eslint-disable-next-line max-len
|
||||
`export function appendToMemberExpression<T extends Pick<MemberExpression, 'object' | 'property'>>(member: T, append: MemberExpression['property'], computed?: boolean): T`,
|
||||
// eslint-disable-next-line max-len
|
||||
`export function inherits<T extends Node | null | undefined>(child: T, parent: Node | null | undefined): T`,
|
||||
// eslint-disable-next-line max-len
|
||||
`export function prependToMemberExpression<T extends Pick<MemberExpression, 'object' | 'property'>>(member: T, prepend: MemberExpression['object']): T`,
|
||||
`export function removeProperties(
|
||||
n: Node,
|
||||
opts?: { preserveComments: boolean } | null
|
||||
): void;`,
|
||||
`export function removePropertiesDeep<T extends Node>(
|
||||
n: T,
|
||||
opts?: { preserveComments: boolean } | null
|
||||
): T;`,
|
||||
|
||||
// retrievers/
|
||||
// eslint-disable-next-line max-len
|
||||
`export function getBindingIdentifiers(node: Node, duplicates: true, outerOnly?: boolean): Record<string, Array<Identifier>>`,
|
||||
// eslint-disable-next-line max-len
|
||||
`export function getBindingIdentifiers(node: Node, duplicates?: false, outerOnly?: boolean): Record<string, Identifier>`,
|
||||
// eslint-disable-next-line max-len
|
||||
`export function getBindingIdentifiers(node: Node, duplicates: boolean, outerOnly?: boolean): Record<string, Identifier | Array<Identifier>>`,
|
||||
// eslint-disable-next-line max-len
|
||||
`export function getOuterBindingIdentifiers(node: Node, duplicates: true): Record<string, Array<Identifier>>`,
|
||||
`export function getOuterBindingIdentifiers(node: Node, duplicates?: false): Record<string, Identifier>`,
|
||||
// eslint-disable-next-line max-len
|
||||
`export function getOuterBindingIdentifiers(node: Node, duplicates: boolean): Record<string, Identifier | Array<Identifier>>`,
|
||||
|
||||
// traverse/
|
||||
`export type TraversalAncestors = ReadonlyArray<{
|
||||
node: Node,
|
||||
key: string,
|
||||
index?: number,
|
||||
}>;
|
||||
export type TraversalHandler<T> = (
|
||||
this: undefined, node: Node, parent: TraversalAncestors, type: T
|
||||
) => void;
|
||||
export type TraversalHandlers<T> = {
|
||||
enter?: TraversalHandler<T>,
|
||||
exit?: TraversalHandler<T>,
|
||||
};`.replace(/(^|\n) {2}/g, "$1"),
|
||||
// eslint-disable-next-line
|
||||
`export function traverse<T>(n: Node, h: TraversalHandler<T> | TraversalHandlers<T>, state?: T): void;`,
|
||||
`export function traverseFast<T>(n: Node, h: TraversalHandler<T>, state?: T): void;`,
|
||||
|
||||
// utils/
|
||||
// cleanJSXElementLiteralChild is not exported
|
||||
// inherit is not exported
|
||||
`export function shallowEqual<T extends object>(actual: object, expected: T): actual is T`,
|
||||
|
||||
// validators/
|
||||
// eslint-disable-next-line max-len
|
||||
`export function buildMatchMemberExpression(match: string, allowPartial?: boolean): (node: Node | null | undefined) => node is MemberExpression`,
|
||||
// eslint-disable-next-line max-len
|
||||
`export function is<T extends Node['type']>(type: T, n: Node | null | undefined, required?: undefined): n is Extract<Node, { type: T }>`,
|
||||
// eslint-disable-next-line max-len
|
||||
`export function is<T extends Node['type'], P extends Extract<Node, { type: T }>>(type: T, n: Node | null | undefined, required: Partial<P>): n is P`,
|
||||
// eslint-disable-next-line max-len
|
||||
`export function is<P extends Node>(type: string, n: Node | null | undefined, required: Partial<P>): n is P`,
|
||||
`export function is(type: string, n: Node | null | undefined, required?: Partial<Node>): n is Node`,
|
||||
`export function isBinding(node: Node, parent: Node, grandparent?: Node): boolean`,
|
||||
// eslint-disable-next-line max-len
|
||||
`export function isBlockScoped(node: Node): node is FunctionDeclaration | ClassDeclaration | VariableDeclaration`,
|
||||
`export function isImmutable(node: Node): node is Immutable`,
|
||||
`export function isLet(node: Node): node is VariableDeclaration`,
|
||||
`export function isNode(node: object | null | undefined): node is Node`,
|
||||
`export function isNodesEquivalent<T extends Partial<Node>>(a: T, b: any): b is T`,
|
||||
`export function isNodesEquivalent(a: any, b: any): boolean`,
|
||||
`export function isPlaceholderType(placeholderType: Node['type'], targetType: Node['type']): boolean`,
|
||||
`export function isReferenced(node: Node, parent: Node, grandparent?: Node): boolean`,
|
||||
`export function isScope(node: Node, parent: Node): node is Scopable`,
|
||||
`export function isSpecifierDefault(specifier: ModuleSpecifier): boolean`,
|
||||
`export function isType<T extends Node['type']>(nodetype: string, targetType: T): nodetype is T`,
|
||||
`export function isType(nodetype: string | null | undefined, targetType: string): boolean`,
|
||||
`export function isValidES3Identifier(name: string): boolean`,
|
||||
`export function isValidIdentifier(name: string): boolean`,
|
||||
`export function isVar(node: Node): node is VariableDeclaration`,
|
||||
// the MemberExpression implication is incidental, but it follows from the implementation
|
||||
// eslint-disable-next-line max-len
|
||||
`export function matchesPattern(node: Node | null | undefined, match: string | ReadonlyArray<string>, allowPartial?: boolean): node is MemberExpression`,
|
||||
// TypeScript 3.7: ": asserts n is T"
|
||||
// eslint-disable-next-line max-len
|
||||
`export function validate<T extends Node, K extends keyof T>(n: Node | null | undefined, key: K, value: T[K]): void`,
|
||||
`export function validate(n: Node, key: string, value: any): void;`
|
||||
);
|
||||
|
||||
for (const type in t.DEPRECATED_KEYS) {
|
||||
code += `/**
|
||||
* @deprecated Use \`${t.DEPRECATED_KEYS[type]}\`
|
||||
*/
|
||||
export type ${type} = ${t.DEPRECATED_KEYS[type]};\n
|
||||
`;
|
||||
}
|
||||
|
||||
for (const type in t.FLIPPED_ALIAS_KEYS) {
|
||||
const types = t.FLIPPED_ALIAS_KEYS[type];
|
||||
code += `export type ${type} = ${types
|
||||
.map(type => `${type}`)
|
||||
.join(" | ")};\n`;
|
||||
}
|
||||
code += "\n";
|
||||
|
||||
code += "export interface Aliases {\n";
|
||||
for (const type in t.FLIPPED_ALIAS_KEYS) {
|
||||
code += ` ${type}: ${type};\n`;
|
||||
}
|
||||
code += "}\n\n";
|
||||
|
||||
code += lines.join("\n") + "\n";
|
||||
|
||||
//
|
||||
|
||||
process.stdout.write(code);
|
||||
|
||||
//
|
||||
|
||||
function areAllRemainingFieldsNullable(fieldName, fieldNames, fields) {
|
||||
const index = fieldNames.indexOf(fieldName);
|
||||
return fieldNames.slice(index).every(_ => isNullable(fields[_]));
|
||||
}
|
||||
|
||||
function hasDefault(field) {
|
||||
return field.default != null;
|
||||
}
|
||||
|
||||
function isNullable(field) {
|
||||
return field.optional || hasDefault(field);
|
||||
}
|
||||
|
||||
function sortFieldNames(fields, type) {
|
||||
return fields.sort((fieldA, fieldB) => {
|
||||
const indexA = t.BUILDER_KEYS[type].indexOf(fieldA);
|
||||
const indexB = t.BUILDER_KEYS[type].indexOf(fieldB);
|
||||
if (indexA === indexB) return fieldA < fieldB ? -1 : 1;
|
||||
if (indexA === -1) return 1;
|
||||
if (indexB === -1) return -1;
|
||||
return indexA - indexB;
|
||||
});
|
||||
}
|
||||
10
node_modules/@types/babel__generator/node_modules/@babel/types/scripts/utils/formatBuilderName.js
generated
vendored
Normal file
10
node_modules/@types/babel__generator/node_modules/@babel/types/scripts/utils/formatBuilderName.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
"use strict";
|
||||
|
||||
const toLowerCase = Function.call.bind("".toLowerCase);
|
||||
|
||||
module.exports = function formatBuilderName(type) {
|
||||
// FunctionExpression -> functionExpression
|
||||
// JSXIdentifier -> jsxIdentifier
|
||||
// V8IntrinsicIdentifier -> v8IntrinsicIdentifier
|
||||
return type.replace(/^([A-Z](?=[a-z0-9])|[A-Z]+(?=[A-Z]))/, toLowerCase);
|
||||
};
|
||||
4
node_modules/@types/babel__generator/node_modules/@babel/types/scripts/utils/lowerFirst.js
generated
vendored
Normal file
4
node_modules/@types/babel__generator/node_modules/@babel/types/scripts/utils/lowerFirst.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
"use strict";
|
||||
module.exports = function lowerFirst(string) {
|
||||
return string[0].toLowerCase() + string.slice(1);
|
||||
};
|
||||
66
node_modules/@types/babel__generator/node_modules/@babel/types/scripts/utils/stringifyValidator.js
generated
vendored
Normal file
66
node_modules/@types/babel__generator/node_modules/@babel/types/scripts/utils/stringifyValidator.js
generated
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
module.exports = function stringifyValidator(validator, nodePrefix) {
|
||||
if (validator === undefined) {
|
||||
return "any";
|
||||
}
|
||||
|
||||
if (validator.each) {
|
||||
return `Array<${stringifyValidator(validator.each, nodePrefix)}>`;
|
||||
}
|
||||
|
||||
if (validator.chainOf) {
|
||||
return stringifyValidator(validator.chainOf[1], nodePrefix);
|
||||
}
|
||||
|
||||
if (validator.oneOf) {
|
||||
return validator.oneOf.map(JSON.stringify).join(" | ");
|
||||
}
|
||||
|
||||
if (validator.oneOfNodeTypes) {
|
||||
return validator.oneOfNodeTypes.map(_ => nodePrefix + _).join(" | ");
|
||||
}
|
||||
|
||||
if (validator.oneOfNodeOrValueTypes) {
|
||||
return validator.oneOfNodeOrValueTypes
|
||||
.map(_ => {
|
||||
return isValueType(_) ? _ : nodePrefix + _;
|
||||
})
|
||||
.join(" | ");
|
||||
}
|
||||
|
||||
if (validator.type) {
|
||||
return validator.type;
|
||||
}
|
||||
|
||||
if (validator.shapeOf) {
|
||||
return (
|
||||
"{ " +
|
||||
Object.keys(validator.shapeOf)
|
||||
.map(shapeKey => {
|
||||
const propertyDefinition = validator.shapeOf[shapeKey];
|
||||
if (propertyDefinition.validate) {
|
||||
const isOptional =
|
||||
propertyDefinition.optional || propertyDefinition.default != null;
|
||||
return (
|
||||
shapeKey +
|
||||
(isOptional ? "?: " : ": ") +
|
||||
stringifyValidator(propertyDefinition.validate)
|
||||
);
|
||||
}
|
||||
return null;
|
||||
})
|
||||
.filter(Boolean)
|
||||
.join(", ") +
|
||||
" }"
|
||||
);
|
||||
}
|
||||
|
||||
return ["any"];
|
||||
};
|
||||
|
||||
/**
|
||||
* Heuristic to decide whether or not the given type is a value type (eg. "null")
|
||||
* or a Node type (eg. "Expression").
|
||||
*/
|
||||
function isValueType(type) {
|
||||
return type.charAt(0).toLowerCase() === type.charAt(0);
|
||||
}
|
||||
4
node_modules/@types/babel__generator/node_modules/@babel/types/scripts/utils/toFunctionName.js
generated
vendored
Normal file
4
node_modules/@types/babel__generator/node_modules/@babel/types/scripts/utils/toFunctionName.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
module.exports = function toFunctionName(typeName) {
|
||||
const _ = typeName.replace(/^TS/, "ts").replace(/^JSX/, "jsx");
|
||||
return _.slice(0, 1).toLowerCase() + _.slice(1);
|
||||
};
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user