From 422eb14dc06b57d7c78e16b024e369df959eee15 Mon Sep 17 00:00:00 2001 From: Alex Eagle Date: Mon, 14 Oct 2019 18:00:17 -0700 Subject: [PATCH] build: remove vendored Babel typings (#33226) These were getting included in the @angular/localize package. Instead, patch the upstream files to work with TS typeRoots option See bazelbuild/rules_nodejs#1033 PR Close #33226 --- .../language_service_plugin/tsconfig.json | 2 +- integration/language_service_plugin/yarn.lock | 13 +- package.json | 3 +- .../flat_module/tsconfig-build.json | 3 +- .../third_party_src/tsconfig-build.json | 3 +- .../integrationtest/tsconfig-build.json | 3 +- .../integrationtest/tsconfig-xi18n.json | 3 +- packages/localize/src/tools/BUILD.bazel | 2 + .../source_files/source_file_utils.ts | 4 +- packages/localize/src/tools/test/BUILD.bazel | 3 + .../localize/src/tools/types/babel/LICENSE | 21 - .../localize/src/tools/types/babel/README.md | 11 - .../localize/src/tools/types/babel/core.d.ts | 734 ---------------- .../src/tools/types/babel/generator.d.ts | 123 --- .../src/tools/types/babel/template.d.ts | 78 -- .../src/tools/types/babel/traverse.d.ts | 827 ------------------ packages/zone.js/package.json | 1 + packages/zone.js/tsconfig.json | 3 +- tools/postinstall-patches.js | 19 +- yarn.lock | 137 ++- 20 files changed, 96 insertions(+), 1897 deletions(-) delete mode 100644 packages/localize/src/tools/types/babel/LICENSE delete mode 100644 packages/localize/src/tools/types/babel/README.md delete mode 100644 packages/localize/src/tools/types/babel/core.d.ts delete mode 100644 packages/localize/src/tools/types/babel/generator.d.ts delete mode 100644 packages/localize/src/tools/types/babel/template.d.ts delete mode 100644 packages/localize/src/tools/types/babel/traverse.d.ts diff --git a/integration/language_service_plugin/tsconfig.json b/integration/language_service_plugin/tsconfig.json index bb0a08cec4..69d3c6d8dc 100644 --- a/integration/language_service_plugin/tsconfig.json +++ b/integration/language_service_plugin/tsconfig.json @@ -40,7 +40,7 @@ // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ - // "typeRoots": [], /* List of folders to include type definitions from. */ + "typeRoots": ["node_modules/@types"], /* List of folders to include type definitions from. */ // "types": [], /* Type declaration files to be included in compilation. */ // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ diff --git a/integration/language_service_plugin/yarn.lock b/integration/language_service_plugin/yarn.lock index e5eef1f6d5..03faefe6ba 100644 --- a/integration/language_service_plugin/yarn.lock +++ b/integration/language_service_plugin/yarn.lock @@ -3,12 +3,10 @@ "@angular/core@file:../../dist/packages-dist/core": - version "8.0.0-beta.13" - dependencies: - tslib "^1.9.0" + version "9.0.0-next.10" "@angular/language-service@file:../../dist/packages-dist/language-service": - version "8.0.0-beta.13" + version "9.0.0-next.10" "@types/node@file:../../node_modules/@types/node": version "10.9.4" @@ -91,13 +89,8 @@ path-is-absolute@^1.0.0: resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18= -tslib@^1.9.0: - version "1.9.3" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.3.tgz#d7e4dd79245d85428c4d7e4822a79917954ca286" - integrity sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ== - "typescript@file:../../node_modules/typescript": - version "3.4.2" + version "3.5.3" wrappy@1: version "1.0.2" diff --git a/package.json b/package.json index 44eb0a90da..cfc25e91bd 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "@angular-devkit/core": "^8.0.0-beta.15", "@angular-devkit/schematics": "^8.0.0-beta.15", "@angular/bazel": "file:./tools/npm/@angular_bazel", - "@babel/core": "^7.5.5", + "@babel/core": "^7.6.4", "@bazel/jasmine": "0.38.3", "@bazel/karma": "0.38.3", "@bazel/protractor": "0.38.3", @@ -47,6 +47,7 @@ "@microsoft/api-extractor": "^7.3.9", "@schematics/angular": "^8.0.0-beta.15", "@types/angular": "^1.6.47", + "@types/babel__core": "^7.1.3", "@types/base64-js": "1.2.5", "@types/bluebird": "^3.5.27", "@types/chai": "^4.1.2", diff --git a/packages/compiler-cli/integrationtest/flat_module/tsconfig-build.json b/packages/compiler-cli/integrationtest/flat_module/tsconfig-build.json index 99a87c7df9..d2dca0bb49 100644 --- a/packages/compiler-cli/integrationtest/flat_module/tsconfig-build.json +++ b/packages/compiler-cli/integrationtest/flat_module/tsconfig-build.json @@ -15,7 +15,8 @@ "noImplicitAny": true, "outDir": "../node_modules/flat_module", "rootDir": "", - "target": "es5" + "target": "es5", + "typeRoots": ["../node_modules/@types"] }, "files": ["public-api.ts"] diff --git a/packages/compiler-cli/integrationtest/third_party_src/tsconfig-build.json b/packages/compiler-cli/integrationtest/third_party_src/tsconfig-build.json index aef5331e68..c68d662e04 100644 --- a/packages/compiler-cli/integrationtest/third_party_src/tsconfig-build.json +++ b/packages/compiler-cli/integrationtest/third_party_src/tsconfig-build.json @@ -13,6 +13,7 @@ "noImplicitAny": true, "outDir": "../node_modules/third_party", "rootDir": "", - "target": "es5" + "target": "es5", + "typeRoots": ["../node_modules/@types"] } } diff --git a/packages/compiler-cli/integrationtest/tsconfig-build.json b/packages/compiler-cli/integrationtest/tsconfig-build.json index 50f3bfc9ef..f9c08623f9 100644 --- a/packages/compiler-cli/integrationtest/tsconfig-build.json +++ b/packages/compiler-cli/integrationtest/tsconfig-build.json @@ -23,7 +23,8 @@ // compatible with the option. Disabled until the integration test support the strict flag. // TODO(devversion): this has been enabled without the integration test code being "strictPropertyInitialization": false, - "target": "es5" + "target": "es5", + "typeRoots": ["node_modules/@types"] }, "files": [ diff --git a/packages/compiler-cli/integrationtest/tsconfig-xi18n.json b/packages/compiler-cli/integrationtest/tsconfig-xi18n.json index 974b48da33..2247039bf0 100644 --- a/packages/compiler-cli/integrationtest/tsconfig-xi18n.json +++ b/packages/compiler-cli/integrationtest/tsconfig-xi18n.json @@ -15,7 +15,8 @@ "outDir": "./xi18n-out", "rootDir": "", "skipLibCheck": true, - "target": "es5" + "target": "es5", + "typeRoots": ["node_modules/@types"] }, "files": [ diff --git a/packages/localize/src/tools/BUILD.bazel b/packages/localize/src/tools/BUILD.bazel index ea79438ef2..3fb61ab0ea 100644 --- a/packages/localize/src/tools/BUILD.bazel +++ b/packages/localize/src/tools/BUILD.bazel @@ -22,6 +22,8 @@ ts_library( "//packages/localize", "@npm//@babel/core", "@npm//@babel/types", + "@npm//@types/babel__core", + "@npm//@types/babel__traverse", "@npm//@types/glob", "@npm//@types/node", "@npm//@types/yargs", diff --git a/packages/localize/src/tools/src/translate/source_files/source_file_utils.ts b/packages/localize/src/tools/src/translate/source_files/source_file_utils.ts index b3d5eb44ff..7ae3e04d1a 100644 --- a/packages/localize/src/tools/src/translate/source_files/source_file_utils.ts +++ b/packages/localize/src/tools/src/translate/source_files/source_file_utils.ts @@ -15,7 +15,7 @@ import {Diagnostics} from '../../diagnostics'; * @param expression The expression to check. */ export function isNamedIdentifier( - expression: NodePath, name: string): expression is NodePath { + expression: NodePath, name: string): expression is NodePath { return expression.isIdentifier() && expression.node.name === name; } @@ -309,7 +309,7 @@ export function translate( export class BabelParseError extends Error { private readonly type = 'BabelParseError'; - constructor(public node: t.BaseNode, message: string) { super(message); } + constructor(public node: t.Node, message: string) { super(message); } } export function isBabelParseError(e: any): e is BabelParseError { diff --git a/packages/localize/src/tools/test/BUILD.bazel b/packages/localize/src/tools/test/BUILD.bazel index f9765020ff..bec954aae2 100644 --- a/packages/localize/src/tools/test/BUILD.bazel +++ b/packages/localize/src/tools/test/BUILD.bazel @@ -12,6 +12,9 @@ ts_library( "//packages/localize", "//packages/localize/src/tools", "@npm//@babel/types", + "@npm//@types/babel__core", + "@npm//@types/babel__generator", + "@npm//@types/babel__template", "@npm//@types/glob", ], ) diff --git a/packages/localize/src/tools/types/babel/LICENSE b/packages/localize/src/tools/types/babel/LICENSE deleted file mode 100644 index d1ca00f20a..0000000000 --- a/packages/localize/src/tools/types/babel/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ - 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 \ No newline at end of file diff --git a/packages/localize/src/tools/types/babel/README.md b/packages/localize/src/tools/types/babel/README.md deleted file mode 100644 index d3e038d694..0000000000 --- a/packages/localize/src/tools/types/babel/README.md +++ /dev/null @@ -1,11 +0,0 @@ -# @babel/... external types - -The Bazel `ts_library` rule does not understand how to map imports of the form `@babel/core` to -external typings of the form `@types/babel__core`. Note the double underscore to account for the -namespaced package. - -See https://github.com/bazelbuild/rules_nodejs/issues/1033. - -This folder is a workaround to this by copying the typings directly into the project. Once the -issue with `ts_library` is resolved we can remove this folder and add appropriate npm dependencies -for the typings \ No newline at end of file diff --git a/packages/localize/src/tools/types/babel/core.d.ts b/packages/localize/src/tools/types/babel/core.d.ts deleted file mode 100644 index 6fa5aff387..0000000000 --- a/packages/localize/src/tools/types/babel/core.d.ts +++ /dev/null @@ -1,734 +0,0 @@ -declare module '@babel/core' { - // 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 - // Marvin Hagemeister - // Melvin Groenhoff - // Jessica Franco - // 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|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; - - /** - * 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; - - /** - * 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; - - // 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 { - name?: string; - manipulateOptions?(opts: any, parserOpts: any): void; - pre?(this: S, state: any): void; - visitor: Visitor; - 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; - - /** - * 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` - See below. - * * `presets: Array` - 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|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| PluginTarget | - [PluginTarget, PluginOptions] | [PluginTarget, PluginOptions, string | undefined]; - - 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(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 - // (callback: CacheCallback): 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(callback: SimpleCacheCallback): 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(callback: SimpleCacheCallback): 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; - - /** - * 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): 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. - ( - envCallback: (envName: NonNullable) => T): T; - } - - export type ConfigFunction = (api: ConfigAPI) => TransformOptions; -} diff --git a/packages/localize/src/tools/types/babel/generator.d.ts b/packages/localize/src/tools/types/babel/generator.d.ts deleted file mode 100644 index 9b78f812b6..0000000000 --- a/packages/localize/src/tools/types/babel/generator.d.ts +++ /dev/null @@ -1,123 +0,0 @@ -declare module '@babel/generator' { - // Type definitions for @babel/generator 7.0 - // Project: https://github.com/babel/babel/tree/master/packages/babel-generator, - // https://babeljs.io - // Definitions by: Troy Gerwien - // Johnny Estilles - // Melvin Groenhoff - // 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; - - /** - * 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; - - /** - * The type of quote to use in the output. If omitted, autodetects based on `ast.tokens`. - */ - quotes?: 'single'|'double'; - - /** - * Used in warning messages - */ - filename?: string; - - /** - * Enable generating source maps. Defaults to `false`. - */ - sourceMaps?: boolean; - - /** - * The filename of the generated code that the source map will be associated with. - */ - sourceMapTarget?: string; - - /** - * 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; - } - - 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; - } -} \ No newline at end of file diff --git a/packages/localize/src/tools/types/babel/template.d.ts b/packages/localize/src/tools/types/babel/template.d.ts deleted file mode 100644 index 2674764908..0000000000 --- a/packages/localize/src/tools/types/babel/template.d.ts +++ /dev/null @@ -1,78 +0,0 @@ -declare module '@babel/template' { - // Type definitions for @babel/template 7.0 - // Project: https://github.com/babel/babel/tree/master/packages/babel-template, https://babeljs.io - // Definitions by: Troy Gerwien - // Marvin Hagemeister - // Melvin Groenhoff - // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - // TypeScript Version: 2.9 - - import {ParserOptions} from '@babel/parser'; - import {Expression, File, Program, Statement} from '@babel/types'; - - export interface TemplateBuilderOptions extends ParserOptions { - /** - * A set of placeholder names to automatically accept. Items in this list do not need to match - * the given placeholder pattern. - */ - placeholderWhitelist?: Set; - - /** - * A pattern to search for when looking for Identifier and StringLiteral nodes that should be - * considered placeholders. `false` will - * disable placeholder searching entirely, leaving only the `placeholderWhitelist` value to find - * placeholders. - */ - placeholderPattern?: RegExp|false; - - /** - * Set this to `true` to preserve any comments from the `code` parameter. - */ - preserveComments?: boolean; - } - - export interface TemplateBuilder { - /** - * Build a new builder, merging the given options with the previous ones. - */ - (opts: TemplateBuilderOptions): TemplateBuilder; - - /** - * Building from a string produces an AST builder function by default. - */ - (code: string, opts?: TemplateBuilderOptions): (arg?: PublicReplacements) => T; - - /** - * Building from a template literal produces an AST builder function by default. - */ - (tpl: TemplateStringsArray, ...args: any[]): (arg?: PublicReplacements) => T; - - // Allow users to explicitly create templates that produce ASTs, skipping the need for an - // intermediate function. - ast: { - (tpl: string, opts?: TemplateBuilderOptions): T; - (tpl: TemplateStringsArray, ...args: any[]): T; - }; - } - - export type PublicReplacements = {[index: string]: any;} | any[]; - - export const smart: TemplateBuilder; - export const statement: TemplateBuilder; - export const statements: TemplateBuilder; - export const expression: TemplateBuilder; - export const program: TemplateBuilder; - - type DefaultTemplateBuilder = typeof smart & { - smart: typeof smart; - statement: typeof statement; - statements: typeof statements; - expression: typeof expression; - program: typeof program; - ast: typeof smart.ast; - }; - - const templateBuilder: DefaultTemplateBuilder; - - export default templateBuilder; -} \ No newline at end of file diff --git a/packages/localize/src/tools/types/babel/traverse.d.ts b/packages/localize/src/tools/types/babel/traverse.d.ts deleted file mode 100644 index 8813183980..0000000000 --- a/packages/localize/src/tools/types/babel/traverse.d.ts +++ /dev/null @@ -1,827 +0,0 @@ -declare module '@babel/traverse' { - // Type definitions for @babel/traverse 7.0 - // Project: https://github.com/babel/babel/tree/master/packages/babel-traverse, https://babeljs.io - // Definitions by: Troy Gerwien - // Marvin Hagemeister - // Ryan Petrich - // Melvin Groenhoff - // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - // TypeScript Version: 2.9 - - import * as t from '@babel/types'; - - export type Node = t.Node; - - export default function traverse( - parent: Node | Node[], opts: TraverseOptions, scope: Scope | undefined, state: S, - parentPath?: NodePath, ): void; - export default function traverse( - parent: Node | Node[], opts: TraverseOptions, scope?: Scope, state?: any, - parentPath?: NodePath, ): void; - - export interface TraverseOptions extends Visitor { - scope?: Scope; - noScope?: boolean; - } - - export class Scope { - constructor(path: NodePath, parentScope?: Scope); - path: NodePath; - block: Node; - parentBlock: Node; - parent: Scope; - hub: Hub; - bindings: {[name: string]: Binding;}; - - /** Traverse node with current scope and path. */ - traverse(node: Node|Node[], opts: TraverseOptions, state: S): void; - traverse(node: Node|Node[], opts?: TraverseOptions, state?: any): void; - - /** Generate a unique identifier and add it to the current scope. */ - generateDeclaredUidIdentifier(name?: string): t.Identifier; - - /** Generate a unique identifier. */ - generateUidIdentifier(name?: string): t.Identifier; - - /** Generate a unique `_id1` binding. */ - generateUid(name?: string): string; - - /** Generate a unique identifier based on a node. */ - generateUidIdentifierBasedOnNode(parent: Node, defaultName?: string): t.Identifier; - - /** - * Determine whether evaluating the specific input `node` is a consequenceless reference. ie. - * evaluating it wont result in potentially arbitrary code from being ran. The following are - * whitelisted and determined not to cause side effects: - * - * - `this` expressions - * - `super` expressions - * - Bound identifiers - */ - isStatic(node: Node): boolean; - - /** Possibly generate a memoised identifier if it is not static and has consequences. */ - maybeGenerateMemoised(node: Node, dontPush?: boolean): t.Identifier; - - checkBlockScopedCollisions(local: Node, kind: string, name: string, id: object): void; - - rename(oldName: string, newName?: string, block?: Node): void; - - dump(): void; - - toArray(node: Node, i?: number): Node; - - registerDeclaration(path: NodePath): void; - - buildUndefinedNode(): Node; - - registerConstantViolation(path: NodePath): void; - - registerBinding(kind: string, path: NodePath, bindingPath?: NodePath): void; - - addGlobal(node: Node): void; - - hasUid(name: string): boolean; - - hasGlobal(name: string): boolean; - - hasReference(name: string): boolean; - - isPure(node: Node, constantsOnly?: boolean): boolean; - - setData(key: string, val: any): any; - - getData(key: string): any; - - removeData(key: string): void; - - push(opts: { - id: t.LVal, - init?: t.Expression, - unique?: boolean, - kind?: 'var'|'let'|'const', - }): void; - - getProgramParent(): Scope; - - getFunctionParent(): Scope|null; - - getBlockParent(): Scope; - - /** Walks the scope tree and gathers **all** bindings. */ - getAllBindings(...kinds: string[]): object; - - bindingIdentifierEquals(name: string, node: Node): boolean; - - getBinding(name: string): Binding|undefined; - - getOwnBinding(name: string): Binding|undefined; - - getBindingIdentifier(name: string): t.Identifier; - - getOwnBindingIdentifier(name: string): t.Identifier; - - hasOwnBinding(name: string): boolean; - - hasBinding(name: string, noGlobals?: boolean): boolean; - - parentHasBinding(name: string, noGlobals?: boolean): boolean; - - /** Move a binding of `name` to another `scope`. */ - moveBindingTo(name: string, scope: Scope): void; - - removeOwnBinding(name: string): void; - - removeBinding(name: string): void; - } - - export class Binding { - constructor(opts: { - existing: Binding; identifier: t.Identifier; scope: Scope; path: NodePath; - kind: 'var' | 'let' | 'const'; - }); - identifier: t.Identifier; - scope: Scope; - path: NodePath; - kind: 'var'|'let'|'const'|'module'; - referenced: boolean; - references: number; - referencePaths: NodePath[]; - constant: boolean; - constantViolations: NodePath[]; - } - - export type Visitor = VisitNodeObject& { - [Type in Node['type']]?: VisitNode < S, Extract < Node, { type: Type; } - >> ; - } - &{[K in keyof t.Aliases]?: VisitNode}; - - export type VisitNode = VisitNodeFunction| VisitNodeObject; - - export type VisitNodeFunction = (this: S, path: NodePath

, state: S) => void; - - export interface VisitNodeObject { - enter?: VisitNodeFunction; - exit?: VisitNodeFunction; - } - - export class NodePath { - constructor(hub: Hub, parent: Node); - parent: Node; - hub: Hub; - contexts: TraversalContext[]; - data: object; - shouldSkip: boolean; - shouldStop: boolean; - removed: boolean; - state: any; - opts: object; - skipKeys: object; - parentPath: NodePath; - context: TraversalContext; - container: object|object[]; - listKey: string; - inList: boolean; - parentKey: string; - key: string|number; - node: T; - scope: Scope; - type: T extends undefined|null? string|null: string; - typeAnnotation: object; - - getScope(scope: Scope): Scope; - - setData(key: string, val: any): any; - - getData(key: string, def?: any): any; - - buildCodeFrameError(msg: string, Error?: new (msg: string) => TError): - TError; - - traverse(visitor: Visitor, state: T): void; - traverse(visitor: Visitor): void; - - set(key: string, node: Node): void; - - getPathLocation(): string; - - // Example: - // https://github.com/babel/babel/blob/63204ae51e020d84a5b246312f5eeb4d981ab952/packages/babel-traverse/src/path/modification.js#L83 - debug(buildMessage: () => string): void; - - // ------------------------- ancestry ------------------------- - /** - * Call the provided `callback` with the `NodePath`s of all the parents. - * When the `callback` returns a truthy value, we return that node path. - */ - findParent(callback: (path: NodePath) => boolean): NodePath; - - find(callback: (path: NodePath) => boolean): NodePath; - - /** Get the parent function of the current path. */ - getFunctionParent(): NodePath; - - /** Walk up the tree until we hit a parent node path in a list. */ - getStatementParent(): NodePath; - - /** - * Get the deepest common ancestor and then from it, get the earliest relationship path - * to that ancestor. - * - * Earliest is defined as being "before" all the other nodes in terms of list container - * position and visiting key. - */ - getEarliestCommonAncestorFrom(paths: NodePath[]): NodePath[]; - - /** Get the earliest path in the tree where the provided `paths` intersect. */ - getDeepestCommonAncestorFrom( - paths: NodePath[], - filter?: (deepest: Node, i: number, ancestries: NodePath[]) => NodePath): NodePath; - - /** - * Build an array of node paths containing the entire ancestry of the current node path. - * - * NOTE: The current node path is included in this. - */ - getAncestry(): NodePath[]; - - inType(...candidateTypes: string[]): boolean; - - // ------------------------- inference ------------------------- - /** Infer the type of the current `NodePath`. */ - getTypeAnnotation(): t.FlowType; - - isBaseType(baseName: string, soft?: boolean): boolean; - - couldBeBaseType(name: string): boolean; - - baseTypeStrictlyMatches(right: NodePath): boolean; - - isGenericType(genericName: string): boolean; - - // ------------------------- replacement ------------------------- - /** - * Replace a node with an array of multiple. This method performs the following steps: - * - * - Inherit the comments of first provided node with that of the current node. - * - Insert the provided nodes after the current node. - * - Remove the current node. - */ - replaceWithMultiple(nodes: Node[]): void; - - /** - * Parse a string as an expression and replace the current node with the result. - * - * NOTE: This is typically not a good idea to use. Building source strings when - * transforming ASTs is an antipattern and SHOULD NOT be encouraged. Even if it's - * easier to use, your transforms will be extremely brittle. - */ - replaceWithSourceString(replacement: any): void; - - /** Replace the current node with another. */ - replaceWith(replacement: Node|NodePath): void; - - /** - * This method takes an array of statements nodes and then explodes it - * into expressions. This method retains completion records which is - * extremely important to retain original semantics. - */ - replaceExpressionWithStatements(nodes: Node[]): Node; - - replaceInline(nodes: Node|Node[]): void; - - // ------------------------- evaluation ------------------------- - /** - * Walk the input `node` and statically evaluate if it's truthy. - * - * Returning `true` when we're sure that the expression will evaluate to a - * truthy value, `false` if we're sure that it will evaluate to a falsy - * value and `undefined` if we aren't sure. Because of this please do not - * rely on coercion when using this method and check with === if it's false. - */ - evaluateTruthy(): boolean; - - /** - * Walk the input `node` and statically evaluate it. - * - * Returns an object in the form `{ confident, value }`. `confident` indicates - * whether or not we had to drop out of evaluating the expression because of - * hitting an unknown node that we couldn't confidently find the value of. - * - * Example: - * - * t.evaluate(parse("5 + 5")) // { confident: true, value: 10 } - * t.evaluate(parse("!true")) // { confident: true, value: false } - * t.evaluate(parse("foo + foo")) // { confident: false, value: undefined } - */ - evaluate(): {confident: boolean; value: any}; - - // ------------------------- introspection ------------------------- - /** - * Match the current node if it matches the provided `pattern`. - * - * For example, given the match `React.createClass` it would match the - * parsed nodes of `React.createClass` and `React["createClass"]`. - */ - matchesPattern(pattern: string, allowPartial?: boolean): boolean; - - /** - * Check whether we have the input `key`. If the `key` references an array then we check - * if the array has any items, otherwise we just check if it's falsy. - */ - has(key: string): boolean; - - isStatic(): boolean; - - /** Alias of `has`. */ - is(key: string): boolean; - - /** Opposite of `has`. */ - isnt(key: string): boolean; - - /** Check whether the path node `key` strict equals `value`. */ - equals(key: string, value: any): boolean; - - /** - * Check the type against our stored internal type of the node. This is handy when a node has - * been removed yet we still internally know the type and need it to calculate node replacement. - */ - isNodeType(type: string): boolean; - - /** - * This checks whether or not we're in one of the following positions: - * - * for (KEY in right); - * for (KEY;;); - * - * This is because these spots allow VariableDeclarations AND normal expressions so we need - * to tell the path replacement that it's ok to replace this with an expression. - */ - canHaveVariableDeclarationOrExpression(): boolean; - - /** - * This checks whether we are swapping an arrow function's body between an - * expression and a block statement (or vice versa). - * - * This is because arrow functions may implicitly return an expression, which - * is the same as containing a block statement. - */ - canSwapBetweenExpressionAndStatement(replacement: Node): boolean; - - /** Check whether the current path references a completion record */ - isCompletionRecord(allowInsideFunction?: boolean): boolean; - - /** - * Check whether or not the current `key` allows either a single statement or block statement - * so we can explode it if necessary. - */ - isStatementOrBlock(): boolean; - - /** Check if the currently assigned path references the `importName` of `moduleSource`. */ - referencesImport(moduleSource: string, importName: string): boolean; - - /** Get the source code associated with this node. */ - getSource(): string; - - /** Check if the current path will maybe execute before another path */ - willIMaybeExecuteBefore(path: NodePath): boolean; - - // ------------------------- context ------------------------- - call(key: string): boolean; - - isBlacklisted(): boolean; - - visit(): boolean; - - skip(): void; - - skipKey(key: string): void; - - stop(): void; - - setScope(): void; - - setContext(context: TraversalContext): NodePath; - - popContext(): void; - - pushContext(context: TraversalContext): void; - - // ------------------------- removal ------------------------- - remove(): void; - - // ------------------------- modification ------------------------- - /** Insert the provided nodes before the current one. */ - insertBefore(nodes: Node|Node[]): any; - - /** - * Insert the provided nodes after the current one. When inserting nodes after an - * expression, ensure that the completion record is correct by pushing the current node. - */ - insertAfter(nodes: Node|Node[]): any; - - /** Update all sibling node paths after `fromIndex` by `incrementBy`. */ - updateSiblingKeys(fromIndex: number, incrementBy: number): void; - - /** Hoist the current node to the highest scope possible and return a UID referencing it. */ - hoist(scope: Scope): void; - - // ------------------------- family ------------------------- - getOpposite(): NodePath; - - getCompletionRecords(): NodePath[]; - - getSibling(key: string|number): NodePath; - getAllPrevSiblings(): NodePath[]; - getAllNextSiblings(): NodePath[]; - - get(key: K, context?: boolean|TraversalContext): - T[K] extends Array? Array>: T[K] extends Node - |null|undefined? NodePath: never; - get(key: string, context?: boolean|TraversalContext): NodePath|NodePath[]; - - getBindingIdentifiers(duplicates?: boolean): Node[]; - - getOuterBindingIdentifiers(duplicates?: boolean): Node[]; - - // ------------------------- comments ------------------------- - /** Share comments amongst siblings. */ - shareCommentsWithSiblings(): void; - - addComment(type: string, content: string, line?: boolean): void; - - /** Give node `comments` of the specified `type`. */ - addComments(type: string, comments: any[]): void; - - // ------------------------- isXXX ------------------------- - isArrayExpression(opts?: object): this is NodePath; - isAssignmentExpression(opts?: object): this is NodePath; - isBinaryExpression(opts?: object): this is NodePath; - isDirective(opts?: object): this is NodePath; - isDirectiveLiteral(opts?: object): this is NodePath; - isBlockStatement(opts?: object): this is NodePath; - isBreakStatement(opts?: object): this is NodePath; - isCallExpression(opts?: object): this is NodePath; - isCatchClause(opts?: object): this is NodePath; - isConditionalExpression(opts?: object): this is NodePath; - isContinueStatement(opts?: object): this is NodePath; - isDebuggerStatement(opts?: object): this is NodePath; - isDoWhileStatement(opts?: object): this is NodePath; - isEmptyStatement(opts?: object): this is NodePath; - isExpressionStatement(opts?: object): this is NodePath; - isFile(opts?: object): this is NodePath; - isForInStatement(opts?: object): this is NodePath; - isForStatement(opts?: object): this is NodePath; - isFunctionDeclaration(opts?: object): this is NodePath; - isFunctionExpression(opts?: object): this is NodePath; - isIdentifier(opts?: object): this is NodePath; - isIfStatement(opts?: object): this is NodePath; - isLabeledStatement(opts?: object): this is NodePath; - isStringLiteral(opts?: object): this is NodePath; - isNumericLiteral(opts?: object): this is NodePath; - isNullLiteral(opts?: object): this is NodePath; - isBooleanLiteral(opts?: object): this is NodePath; - isRegExpLiteral(opts?: object): this is NodePath; - isLogicalExpression(opts?: object): this is NodePath; - isMemberExpression(opts?: object): this is NodePath; - isNewExpression(opts?: object): this is NodePath; - isProgram(opts?: object): this is NodePath; - isObjectExpression(opts?: object): this is NodePath; - isObjectMethod(opts?: object): this is NodePath; - isObjectProperty(opts?: object): this is NodePath; - isRestElement(opts?: object): this is NodePath; - isReturnStatement(opts?: object): this is NodePath; - isSequenceExpression(opts?: object): this is NodePath; - isSwitchCase(opts?: object): this is NodePath; - isSwitchStatement(opts?: object): this is NodePath; - isThisExpression(opts?: object): this is NodePath; - isThrowStatement(opts?: object): this is NodePath; - isTryStatement(opts?: object): this is NodePath; - isUnaryExpression(opts?: object): this is NodePath; - isUpdateExpression(opts?: object): this is NodePath; - isVariableDeclaration(opts?: object): this is NodePath; - isVariableDeclarator(opts?: object): this is NodePath; - isWhileStatement(opts?: object): this is NodePath; - isWithStatement(opts?: object): this is NodePath; - isAssignmentPattern(opts?: object): this is NodePath; - isArrayPattern(opts?: object): this is NodePath; - isArrowFunctionExpression(opts?: object): this is NodePath; - isClassBody(opts?: object): this is NodePath; - isClassDeclaration(opts?: object): this is NodePath; - isClassExpression(opts?: object): this is NodePath; - isExportAllDeclaration(opts?: object): this is NodePath; - isExportDefaultDeclaration(opts?: object): this is NodePath; - isExportNamedDeclaration(opts?: object): this is NodePath; - isExportSpecifier(opts?: object): this is NodePath; - isForOfStatement(opts?: object): this is NodePath; - isImportDeclaration(opts?: object): this is NodePath; - isImportDefaultSpecifier(opts?: object): this is NodePath; - isImportNamespaceSpecifier(opts?: object): this is NodePath; - isImportSpecifier(opts?: object): this is NodePath; - isMetaProperty(opts?: object): this is NodePath; - isClassMethod(opts?: object): this is NodePath; - isObjectPattern(opts?: object): this is NodePath; - isSpreadElement(opts?: object): this is NodePath; - isSuper(opts?: object): this is NodePath; - isTaggedTemplateExpression(opts?: object): this is NodePath; - isTemplateElement(opts?: object): this is NodePath; - isTemplateLiteral(opts?: object): this is NodePath; - isYieldExpression(opts?: object): this is NodePath; - isAnyTypeAnnotation(opts?: object): this is NodePath; - isArrayTypeAnnotation(opts?: object): this is NodePath; - isBooleanTypeAnnotation(opts?: object): this is NodePath; - isBooleanLiteralTypeAnnotation(opts?: object): this is NodePath; - isNullLiteralTypeAnnotation(opts?: object): this is NodePath; - isClassImplements(opts?: object): this is NodePath; - isClassProperty(opts?: object): this is NodePath; - isDeclareClass(opts?: object): this is NodePath; - isDeclareFunction(opts?: object): this is NodePath; - isDeclareInterface(opts?: object): this is NodePath; - isDeclareModule(opts?: object): this is NodePath; - isDeclareTypeAlias(opts?: object): this is NodePath; - isDeclareVariable(opts?: object): this is NodePath; - isFunctionTypeAnnotation(opts?: object): this is NodePath; - isFunctionTypeParam(opts?: object): this is NodePath; - isGenericTypeAnnotation(opts?: object): this is NodePath; - isInterfaceExtends(opts?: object): this is NodePath; - isInterfaceDeclaration(opts?: object): this is NodePath; - isIntersectionTypeAnnotation(opts?: object): this is NodePath; - isMixedTypeAnnotation(opts?: object): this is NodePath; - isNullableTypeAnnotation(opts?: object): this is NodePath; - isNumberTypeAnnotation(opts?: object): this is NodePath; - isStringLiteralTypeAnnotation(opts?: object): this is NodePath; - isStringTypeAnnotation(opts?: object): this is NodePath; - isThisTypeAnnotation(opts?: object): this is NodePath; - isTupleTypeAnnotation(opts?: object): this is NodePath; - isTypeofTypeAnnotation(opts?: object): this is NodePath; - isTypeAlias(opts?: object): this is NodePath; - isTypeAnnotation(opts?: object): this is NodePath; - isTypeCastExpression(opts?: object): this is NodePath; - isTypeParameterDeclaration(opts?: object): this is NodePath; - isTypeParameterInstantiation(opts?: object): this is NodePath; - isObjectTypeAnnotation(opts?: object): this is NodePath; - isObjectTypeCallProperty(opts?: object): this is NodePath; - isObjectTypeIndexer(opts?: object): this is NodePath; - isObjectTypeProperty(opts?: object): this is NodePath; - isQualifiedTypeIdentifier(opts?: object): this is NodePath; - isUnionTypeAnnotation(opts?: object): this is NodePath; - isVoidTypeAnnotation(opts?: object): this is NodePath; - isJSXAttribute(opts?: object): this is NodePath; - isJSXClosingElement(opts?: object): this is NodePath; - isJSXElement(opts?: object): this is NodePath; - isJSXEmptyExpression(opts?: object): this is NodePath; - isJSXExpressionContainer(opts?: object): this is NodePath; - isJSXIdentifier(opts?: object): this is NodePath; - isJSXMemberExpression(opts?: object): this is NodePath; - isJSXNamespacedName(opts?: object): this is NodePath; - isJSXOpeningElement(opts?: object): this is NodePath; - isJSXSpreadAttribute(opts?: object): this is NodePath; - isJSXText(opts?: object): this is NodePath; - isNoop(opts?: object): this is NodePath; - isParenthesizedExpression(opts?: object): this is NodePath; - isAwaitExpression(opts?: object): this is NodePath; - isBindExpression(opts?: object): this is NodePath; - isDecorator(opts?: object): this is NodePath; - isDoExpression(opts?: object): this is NodePath; - isExportDefaultSpecifier(opts?: object): this is NodePath; - isExportNamespaceSpecifier(opts?: object): this is NodePath; - isRestProperty(opts?: object): this is NodePath; - isSpreadProperty(opts?: object): this is NodePath; - isExpression(opts?: object): this is NodePath; - isBinary(opts?: object): this is NodePath; - isScopable(opts?: object): this is NodePath; - isBlockParent(opts?: object): this is NodePath; - isBlock(opts?: object): this is NodePath; - isStatement(opts?: object): this is NodePath; - isTerminatorless(opts?: object): this is NodePath; - isCompletionStatement(opts?: object): this is NodePath; - isConditional(opts?: object): this is NodePath; - isLoop(opts?: object): this is NodePath; - isWhile(opts?: object): this is NodePath; - isExpressionWrapper(opts?: object): this is NodePath; - isFor(opts?: object): this is NodePath; - isForXStatement(opts?: object): this is NodePath; - isFunction(opts?: object): this is NodePath; - isFunctionParent(opts?: object): this is NodePath; - isPureish(opts?: object): this is NodePath; - isDeclaration(opts?: object): this is NodePath; - isLVal(opts?: object): this is NodePath; - isLiteral(opts?: object): this is NodePath; - isImmutable(opts?: object): this is NodePath; - isUserWhitespacable(opts?: object): this is NodePath; - isMethod(opts?: object): this is NodePath; - isObjectMember(opts?: object): this is NodePath; - isProperty(opts?: object): this is NodePath; - isUnaryLike(opts?: object): this is NodePath; - isPattern(opts?: object): this is NodePath; - isClass(opts?: object): this is NodePath; - isModuleDeclaration(opts?: object): this is NodePath; - isExportDeclaration(opts?: object): this is NodePath; - isModuleSpecifier(opts?: object): this is NodePath; - isFlow(opts?: object): this is NodePath; - isFlowBaseAnnotation(opts?: object): this is NodePath; - isFlowDeclaration(opts?: object): this is NodePath; - isJSX(opts?: object): this is NodePath; - isNumberLiteral(opts?: object): this is NodePath; - isRegexLiteral(opts?: object): this is NodePath; - isReferencedIdentifier(opts?: object): this is NodePath; - isReferencedMemberExpression(opts?: object): this is NodePath; - isBindingIdentifier(opts?: object): this is NodePath; - isScope(opts?: object): this is NodePath; - isReferenced(opts?: object): boolean; - isBlockScoped(opts?: object): - this is NodePath; - isVar(opts?: object): this is NodePath; - isUser(opts?: object): boolean; - isGenerated(opts?: object): boolean; - isPure(opts?: object): boolean; - - // ------------------------- assertXXX ------------------------- - assertArrayExpression(opts?: object): void; - assertAssignmentExpression(opts?: object): void; - assertBinaryExpression(opts?: object): void; - assertDirective(opts?: object): void; - assertDirectiveLiteral(opts?: object): void; - assertBlockStatement(opts?: object): void; - assertBreakStatement(opts?: object): void; - assertCallExpression(opts?: object): void; - assertCatchClause(opts?: object): void; - assertConditionalExpression(opts?: object): void; - assertContinueStatement(opts?: object): void; - assertDebuggerStatement(opts?: object): void; - assertDoWhileStatement(opts?: object): void; - assertEmptyStatement(opts?: object): void; - assertExpressionStatement(opts?: object): void; - assertFile(opts?: object): void; - assertForInStatement(opts?: object): void; - assertForStatement(opts?: object): void; - assertFunctionDeclaration(opts?: object): void; - assertFunctionExpression(opts?: object): void; - assertIdentifier(opts?: object): void; - assertIfStatement(opts?: object): void; - assertLabeledStatement(opts?: object): void; - assertStringLiteral(opts?: object): void; - assertNumericLiteral(opts?: object): void; - assertNullLiteral(opts?: object): void; - assertBooleanLiteral(opts?: object): void; - assertRegExpLiteral(opts?: object): void; - assertLogicalExpression(opts?: object): void; - assertMemberExpression(opts?: object): void; - assertNewExpression(opts?: object): void; - assertProgram(opts?: object): void; - assertObjectExpression(opts?: object): void; - assertObjectMethod(opts?: object): void; - assertObjectProperty(opts?: object): void; - assertRestElement(opts?: object): void; - assertReturnStatement(opts?: object): void; - assertSequenceExpression(opts?: object): void; - assertSwitchCase(opts?: object): void; - assertSwitchStatement(opts?: object): void; - assertThisExpression(opts?: object): void; - assertThrowStatement(opts?: object): void; - assertTryStatement(opts?: object): void; - assertUnaryExpression(opts?: object): void; - assertUpdateExpression(opts?: object): void; - assertVariableDeclaration(opts?: object): void; - assertVariableDeclarator(opts?: object): void; - assertWhileStatement(opts?: object): void; - assertWithStatement(opts?: object): void; - assertAssignmentPattern(opts?: object): void; - assertArrayPattern(opts?: object): void; - assertArrowFunctionExpression(opts?: object): void; - assertClassBody(opts?: object): void; - assertClassDeclaration(opts?: object): void; - assertClassExpression(opts?: object): void; - assertExportAllDeclaration(opts?: object): void; - assertExportDefaultDeclaration(opts?: object): void; - assertExportNamedDeclaration(opts?: object): void; - assertExportSpecifier(opts?: object): void; - assertForOfStatement(opts?: object): void; - assertImportDeclaration(opts?: object): void; - assertImportDefaultSpecifier(opts?: object): void; - assertImportNamespaceSpecifier(opts?: object): void; - assertImportSpecifier(opts?: object): void; - assertMetaProperty(opts?: object): void; - assertClassMethod(opts?: object): void; - assertObjectPattern(opts?: object): void; - assertSpreadElement(opts?: object): void; - assertSuper(opts?: object): void; - assertTaggedTemplateExpression(opts?: object): void; - assertTemplateElement(opts?: object): void; - assertTemplateLiteral(opts?: object): void; - assertYieldExpression(opts?: object): void; - assertAnyTypeAnnotation(opts?: object): void; - assertArrayTypeAnnotation(opts?: object): void; - assertBooleanTypeAnnotation(opts?: object): void; - assertBooleanLiteralTypeAnnotation(opts?: object): void; - assertNullLiteralTypeAnnotation(opts?: object): void; - assertClassImplements(opts?: object): void; - assertClassProperty(opts?: object): void; - assertDeclareClass(opts?: object): void; - assertDeclareFunction(opts?: object): void; - assertDeclareInterface(opts?: object): void; - assertDeclareModule(opts?: object): void; - assertDeclareTypeAlias(opts?: object): void; - assertDeclareVariable(opts?: object): void; - assertExistentialTypeParam(opts?: object): void; - assertFunctionTypeAnnotation(opts?: object): void; - assertFunctionTypeParam(opts?: object): void; - assertGenericTypeAnnotation(opts?: object): void; - assertInterfaceExtends(opts?: object): void; - assertInterfaceDeclaration(opts?: object): void; - assertIntersectionTypeAnnotation(opts?: object): void; - assertMixedTypeAnnotation(opts?: object): void; - assertNullableTypeAnnotation(opts?: object): void; - assertNumericLiteralTypeAnnotation(opts?: object): void; - assertNumberTypeAnnotation(opts?: object): void; - assertStringLiteralTypeAnnotation(opts?: object): void; - assertStringTypeAnnotation(opts?: object): void; - assertThisTypeAnnotation(opts?: object): void; - assertTupleTypeAnnotation(opts?: object): void; - assertTypeofTypeAnnotation(opts?: object): void; - assertTypeAlias(opts?: object): void; - assertTypeAnnotation(opts?: object): void; - assertTypeCastExpression(opts?: object): void; - assertTypeParameterDeclaration(opts?: object): void; - assertTypeParameterInstantiation(opts?: object): void; - assertObjectTypeAnnotation(opts?: object): void; - assertObjectTypeCallProperty(opts?: object): void; - assertObjectTypeIndexer(opts?: object): void; - assertObjectTypeProperty(opts?: object): void; - assertQualifiedTypeIdentifier(opts?: object): void; - assertUnionTypeAnnotation(opts?: object): void; - assertVoidTypeAnnotation(opts?: object): void; - assertJSXAttribute(opts?: object): void; - assertJSXClosingElement(opts?: object): void; - assertJSXElement(opts?: object): void; - assertJSXEmptyExpression(opts?: object): void; - assertJSXExpressionContainer(opts?: object): void; - assertJSXIdentifier(opts?: object): void; - assertJSXMemberExpression(opts?: object): void; - assertJSXNamespacedName(opts?: object): void; - assertJSXOpeningElement(opts?: object): void; - assertJSXSpreadAttribute(opts?: object): void; - assertJSXText(opts?: object): void; - assertNoop(opts?: object): void; - assertParenthesizedExpression(opts?: object): void; - assertAwaitExpression(opts?: object): void; - assertBindExpression(opts?: object): void; - assertDecorator(opts?: object): void; - assertDoExpression(opts?: object): void; - assertExportDefaultSpecifier(opts?: object): void; - assertExportNamespaceSpecifier(opts?: object): void; - assertRestProperty(opts?: object): void; - assertSpreadProperty(opts?: object): void; - assertExpression(opts?: object): void; - assertBinary(opts?: object): void; - assertScopable(opts?: object): void; - assertBlockParent(opts?: object): void; - assertBlock(opts?: object): void; - assertStatement(opts?: object): void; - assertTerminatorless(opts?: object): void; - assertCompletionStatement(opts?: object): void; - assertConditional(opts?: object): void; - assertLoop(opts?: object): void; - assertWhile(opts?: object): void; - assertExpressionWrapper(opts?: object): void; - assertFor(opts?: object): void; - assertForXStatement(opts?: object): void; - assertFunction(opts?: object): void; - assertFunctionParent(opts?: object): void; - assertPureish(opts?: object): void; - assertDeclaration(opts?: object): void; - assertLVal(opts?: object): void; - assertLiteral(opts?: object): void; - assertImmutable(opts?: object): void; - assertUserWhitespacable(opts?: object): void; - assertMethod(opts?: object): void; - assertObjectMember(opts?: object): void; - assertProperty(opts?: object): void; - assertUnaryLike(opts?: object): void; - assertPattern(opts?: object): void; - assertClass(opts?: object): void; - assertModuleDeclaration(opts?: object): void; - assertExportDeclaration(opts?: object): void; - assertModuleSpecifier(opts?: object): void; - assertFlow(opts?: object): void; - assertFlowBaseAnnotation(opts?: object): void; - assertFlowDeclaration(opts?: object): void; - assertJSX(opts?: object): void; - assertNumberLiteral(opts?: object): void; - assertRegexLiteral(opts?: object): void; - } - - export class Hub { - constructor(file: any, options: any); - file: any; - options: any; - } - - export interface TraversalContext { - parentPath: NodePath; - scope: Scope; - state: any; - opts: any; - } -} \ No newline at end of file diff --git a/packages/zone.js/package.json b/packages/zone.js/package.json index 883864afdc..e867922584 100644 --- a/packages/zone.js/package.json +++ b/packages/zone.js/package.json @@ -15,6 +15,7 @@ "test": "test" }, "devDependencies": { + "@types/node": "^10.9.4", "domino": "2.1.2", "mocha": "^3.1.2", "mock-require": "3.0.3", diff --git a/packages/zone.js/tsconfig.json b/packages/zone.js/tsconfig.json index 7e30348b69..6ee93c8e1e 100644 --- a/packages/zone.js/tsconfig.json +++ b/packages/zone.js/tsconfig.json @@ -16,7 +16,8 @@ "es2015.promise", "es2015.symbol", "es2015.symbol.wellknown" - ] + ], + "typeRoots": ["node_modules/@types"], }, "exclude": [ "node_modules", diff --git a/tools/postinstall-patches.js b/tools/postinstall-patches.js index 04c8e9171f..d5d3fcdb3c 100644 --- a/tools/postinstall-patches.js +++ b/tools/postinstall-patches.js @@ -20,7 +20,8 @@ try { process.exit(0); } -const {set, cd, sed, rm} = require('shelljs'); +const {set, cd, sed, echo, ls} = require('shelljs'); +const {readFileSync} = require('fs'); const path = require('path'); const log = console.log; @@ -51,4 +52,20 @@ sed('-i', 'process.platform !== \'linux\'', 'process.platform !== \'linux\' && process.platform !== \'darwin\'', 'node_modules/@bazel/karma/karma.conf.js'); +// Workaround https://github.com/bazelbuild/rules_nodejs/issues/1033 +// TypeScript doesn't understand typings without "declare module" unless +// they are actually resolved by the @types default mechanism +log('\n# patch: @types/babel__* adding declare module wrappers'); +ls('node_modules/@types').filter(f => f.startsWith('babel__')).forEach(pkg => { + const modName = '@' + pkg.replace('__', '/'); + const typingsFile = `node_modules/@types/${pkg}/index.d.ts`; + // Only add the patch if it is not already there. + if (readFileSync(typingsFile, 'utf8').indexOf('/*added by tools/postinstall_patches.js*/') === + -1) { + const insertPrefix = `/*added by tools/postinstall_patches.js*/ declare module "${modName}" { `; + sed('-i', `(// Type definitions for ${modName})`, insertPrefix + '$1', typingsFile); + echo('}').toEnd(typingsFile); + } +}); + log('===== finished running the postinstall-patches.js script ====='); diff --git a/yarn.lock b/yarn.lock index b16cebd175..317c7565b2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -88,15 +88,15 @@ dependencies: "@babel/highlight" "^7.0.0" -"@babel/core@^7.5.5": - version "7.6.3" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.6.3.tgz#44de824e89eaa089bb12da7337bc9bdff2ab68f9" - integrity sha512-QfQ5jTBgXLzJuo7Mo8bZK/ePywmgNRgk/UQykiKwEtZPiFIn8ZqE6jB+AnD1hbB1S2xQyL4//it5vuAUOVAMTw== +"@babel/core@^7.6.4": + version "7.6.4" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.6.4.tgz#6ebd9fe00925f6c3e177bb726a188b5f578088ff" + integrity sha512-Rm0HGw101GY8FTzpWSyRbki/jzq+/PkNQJ+nSulrdY6gFGOsNseCqD6KHRYe2E+EdzuBdr2pxCp6s4Uk6eJ+XQ== dependencies: "@babel/code-frame" "^7.5.5" - "@babel/generator" "^7.6.3" + "@babel/generator" "^7.6.4" "@babel/helpers" "^7.6.2" - "@babel/parser" "^7.6.3" + "@babel/parser" "^7.6.4" "@babel/template" "^7.6.0" "@babel/traverse" "^7.6.3" "@babel/types" "^7.6.3" @@ -106,27 +106,17 @@ lodash "^4.17.13" resolve "^1.3.2" semver "^5.4.1" - source-map "^0.6.1" - -"@babel/generator@^7.6.2": - version "7.6.2" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.6.2.tgz#dac8a3c2df118334c2a29ff3446da1636a8f8c03" - integrity sha512-j8iHaIW4gGPnViaIHI7e9t/Hl8qLjERI6DcV9kEpAIDJsAOrcnXqRS7t+QbhL76pwbtqP+QCQLL0z1CyVmtjjQ== - dependencies: - "@babel/types" "^7.6.0" - jsesc "^2.5.1" - lodash "^4.17.13" source-map "^0.5.0" -"@babel/generator@^7.6.3": - version "7.6.3" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.6.3.tgz#71d5375264f93ec7bac7d9f35a67067733f5578e" - integrity sha512-hLhYbAb3pHwxjlijC4AQ7mqZdcoujiNaW7izCT04CIowHK8psN0IN8QjDv0iyFtycF5FowUOTwDloIheI25aMw== +"@babel/generator@^7.6.3", "@babel/generator@^7.6.4": + version "7.6.4" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.6.4.tgz#a4f8437287bf9671b07f483b76e3bb731bc97671" + integrity sha512-jsBuXkFoZxk0yWLyGI9llT9oiQ2FeTASmRFE32U+aaDTfoE92t78eroO7PTpU/OrYq38hlcDM6vbfLDaOLy+7w== dependencies: "@babel/types" "^7.6.3" jsesc "^2.5.1" lodash "^4.17.13" - source-map "^0.6.1" + source-map "^0.5.0" "@babel/helper-function-name@^7.1.0": version "7.1.0" @@ -169,31 +159,12 @@ esutils "^2.0.2" js-tokens "^4.0.0" -"@babel/parser@^7.4.4": - version "7.5.5" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.5.5.tgz#02f077ac8817d3df4a832ef59de67565e71cca4b" - integrity sha512-E5BN68cqR7dhKan1SfqgPGhQ178bkVKpXTPEXnFJBrEt8/DKRZlybmy+IgYLTeN7tp1R5Ccmbm2rBk17sHYU3g== +"@babel/parser@^7.1.0", "@babel/parser@^7.6.0", "@babel/parser@^7.6.3", "@babel/parser@^7.6.4": + version "7.6.4" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.6.4.tgz#cb9b36a7482110282d5cb6dd424ec9262b473d81" + integrity sha512-D8RHPW5qd0Vbyo3qb+YjO5nvUVRTXFLQ/FsDxJU2Nqz4uB5EnUN0ZQSEYpvTIbRuttig1XbHWU5oMeQwQSAA+A== -"@babel/parser@^7.6.0", "@babel/parser@^7.6.2": - version "7.6.2" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.6.2.tgz#205e9c95e16ba3b8b96090677a67c9d6075b70a1" - integrity sha512-mdFqWrSPCmikBoaBYMuBulzTIKuXVPtEISFbRRVNwMWpCms/hmE2kRq0bblUHaNRKrjRlmVbx1sDHmjmRgD2Xg== - -"@babel/parser@^7.6.3": - version "7.6.3" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.6.3.tgz#9eff8b9c3eeae16a74d8d4ff30da2bd0d6f0487e" - integrity sha512-sUZdXlva1dt2Vw2RqbMkmfoImubO0D0gaCrNngV6Hi0DA4x3o4mlrq0tbfY0dZEUIccH8I6wQ4qgEtwcpOR6Qg== - -"@babel/template@^7.1.0": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.4.4.tgz#f4b88d1225689a08f5bc3a17483545be9e4ed237" - integrity sha512-CiGzLN9KgAvgZsnivND7rkA+AeJ9JB0ciPOD4U59GKbQP2iQl+olF1l76kJOupqidozfZ32ghwBEJDhnk9MEcw== - dependencies: - "@babel/code-frame" "^7.0.0" - "@babel/parser" "^7.4.4" - "@babel/types" "^7.4.4" - -"@babel/template@^7.6.0": +"@babel/template@^7.1.0", "@babel/template@^7.6.0": version "7.6.0" resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.6.0.tgz#7f0159c7f5012230dad64cca42ec9bdb5c9536e6" integrity sha512-5AEH2EXD8euCk446b7edmgFdub/qfH1SN6Nii3+fyXP807QRx9Q73A2N5hNwRRslC2H9sNzaFhsPubkS4L8oNQ== @@ -202,22 +173,7 @@ "@babel/parser" "^7.6.0" "@babel/types" "^7.6.0" -"@babel/traverse@^7.6.2": - version "7.6.2" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.6.2.tgz#b0e2bfd401d339ce0e6c05690206d1e11502ce2c" - integrity sha512-8fRE76xNwNttVEF2TwxJDGBLWthUkHWSldmfuBzVRmEDWOtu4XdINTgN7TDWzuLg4bbeIMLvfMFD9we5YcWkRQ== - dependencies: - "@babel/code-frame" "^7.5.5" - "@babel/generator" "^7.6.2" - "@babel/helper-function-name" "^7.1.0" - "@babel/helper-split-export-declaration" "^7.4.4" - "@babel/parser" "^7.6.2" - "@babel/types" "^7.6.0" - debug "^4.1.0" - globals "^11.1.0" - lodash "^4.17.13" - -"@babel/traverse@^7.6.3": +"@babel/traverse@^7.6.2", "@babel/traverse@^7.6.3": version "7.6.3" resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.6.3.tgz#66d7dba146b086703c0fb10dd588b7364cec47f9" integrity sha512-unn7P4LGsijIxaAJo/wpoU11zN+2IaClkQAxcJWBNCMS6cmVh802IyLHNkAjQ0iYnRS3nnxk5O3fuXW28IMxTw== @@ -232,25 +188,7 @@ globals "^11.1.0" lodash "^4.17.13" -"@babel/types@^7.0.0", "@babel/types@^7.4.4": - version "7.5.5" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.5.5.tgz#97b9f728e182785909aa4ab56264f090a028d18a" - integrity sha512-s63F9nJioLqOlW3UkyMd+BYhXt44YuaFm/VV0VwuteqjYwRrObkU7ra9pY4wAJR3oXi8hJrMcrcJdO/HH33vtw== - dependencies: - esutils "^2.0.2" - lodash "^4.17.13" - to-fast-properties "^2.0.0" - -"@babel/types@^7.6.0": - version "7.6.1" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.6.1.tgz#53abf3308add3ac2a2884d539151c57c4b3ac648" - integrity sha512-X7gdiuaCmA0uRjCmRtYJNAVCc/q+5xSgsfKJHqMN4iNLILX39677fJE1O40arPMh0TTtS9ItH67yre6c7k6t0g== - dependencies: - esutils "^2.0.2" - lodash "^4.17.13" - to-fast-properties "^2.0.0" - -"@babel/types@^7.6.3": +"@babel/types@^7.0.0", "@babel/types@^7.3.0", "@babel/types@^7.4.4", "@babel/types@^7.6.0", "@babel/types@^7.6.3": version "7.6.3" resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.6.3.tgz#3f07d96f854f98e2fbd45c64b0cb942d11e8ba09" integrity sha512-CqbcpTxMcpuQTMhjI37ZHVgjBkysg5icREQIEZ0eG1yCNwg3oy+5AaLiOKmjsCj6nqOsa6Hf0ObjRVwokb7srA== @@ -613,6 +551,39 @@ resolved "https://registry.yarnpkg.com/@types/argparse/-/argparse-1.0.33.tgz#2728669427cdd74a99e53c9f457ca2866a37c52d" integrity sha512-VQgHxyPMTj3hIlq9SY1mctqx+Jj8kpQfoLvDlVSDNOyuYs8JYfkuY3OW/4+dO657yPmNhHpePRx0/Tje5ImNVQ== +"@types/babel__core@^7.1.3": + version "7.1.3" + resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.1.3.tgz#e441ea7df63cd080dfcd02ab199e6d16a735fc30" + integrity sha512-8fBo0UR2CcwWxeX7WIIgJ7lXjasFxoYgRnFHUj+hRvKkpiBJbxhdAPTCY6/ZKM0uxANFVzt4yObSLuTiTnazDA== + dependencies: + "@babel/parser" "^7.1.0" + "@babel/types" "^7.0.0" + "@types/babel__generator" "*" + "@types/babel__template" "*" + "@types/babel__traverse" "*" + +"@types/babel__generator@*": + version "7.6.0" + resolved "https://registry.yarnpkg.com/@types/babel__generator/-/babel__generator-7.6.0.tgz#f1ec1c104d1bb463556ecb724018ab788d0c172a" + integrity sha512-c1mZUu4up5cp9KROs/QAw0gTeHrw/x7m52LcnvMxxOZ03DmLwPV0MlGmlgzV3cnSdjhJOZsj7E7FHeioai+egw== + dependencies: + "@babel/types" "^7.0.0" + +"@types/babel__template@*": + version "7.0.2" + resolved "https://registry.yarnpkg.com/@types/babel__template/-/babel__template-7.0.2.tgz#4ff63d6b52eddac1de7b975a5223ed32ecea9307" + integrity sha512-/K6zCpeW7Imzgab2bLkLEbz0+1JlFSrUMdw7KoIIu+IUdu51GWaBZpd3y1VXGVXzynvGa4DaIaxNZHiON3GXUg== + dependencies: + "@babel/parser" "^7.1.0" + "@babel/types" "^7.0.0" + +"@types/babel__traverse@*": + version "7.0.7" + resolved "https://registry.yarnpkg.com/@types/babel__traverse/-/babel__traverse-7.0.7.tgz#2496e9ff56196cc1429c72034e07eab6121b6f3f" + integrity sha512-CeBpmX1J8kWLcDEnI3Cl2Eo6RfbGvzUctA+CjZUhOKDFbLfcr7fc4usEqLNWetrlJd7RhAkyYe2czXop4fICpw== + dependencies: + "@babel/types" "^7.3.0" + "@types/base64-js@1.2.5": version "1.2.5" resolved "https://registry.yarnpkg.com/@types/base64-js/-/base64-js-1.2.5.tgz#582b2476169a6cba460a214d476c744441d873d5" @@ -6578,9 +6549,9 @@ json5@^1.0.1: minimist "^1.2.0" json5@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/json5/-/json5-2.1.0.tgz#e7a0c62c48285c628d20a10b85c89bb807c32850" - integrity sha512-8Mh9h6xViijj36g7Dxi+Y4S6hNGV96vcJZr/SrlHh1LR/pEn/8j/+qIBbs44YKl69Lrfctp4QD+AdWLTMqEZAQ== + version "2.1.1" + resolved "https://registry.yarnpkg.com/json5/-/json5-2.1.1.tgz#81b6cb04e9ba496f1c7005d07b4368a2638f90b6" + integrity sha512-l+3HXD0GEI3huGq1njuqtzYK8OYJyXMkOLtQ53pjWh89tvWS2h6l+1zMkYWqlb57+SiQodKZyvMEFb2X+KrFhQ== dependencies: minimist "^1.2.0"