From c1ea73d37199d3e5bb25c8b01d253ccd59d8fb1c Mon Sep 17 00:00:00 2001 From: Ignatius Bagus Date: Wed, 14 Sep 2022 02:42:22 +0700 Subject: [PATCH] chore: use `@types/babel__generator` package --- package.json | 3 +- typings/babel__generator.d.ts | 123 ---------------------------------- yarn.lock | 36 ++++++++-- 3 files changed, 33 insertions(+), 129 deletions(-) delete mode 100644 typings/babel__generator.d.ts diff --git a/package.json b/package.json index 98369077c..15fb784f7 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "dependencies": { "@babel/generator": "7.18.2", "@babel/parser": "7.18.4", - "@babel/types": "7.18.4", + "@babel/types": "7.19.0", "chalk": "^4.1.2", "fs-extra": "^9.1.0", "globby": "^11.1.0", @@ -36,6 +36,7 @@ }, "devDependencies": { "@babel/core": "7.18.2", + "@types/babel__generator": "7.6.4", "@types/escodegen": "0.0.7", "@types/fs-extra": "9.0.13", "@types/is-core-module": "2.2.0", diff --git a/typings/babel__generator.d.ts b/typings/babel__generator.d.ts deleted file mode 100644 index 69785d53f..000000000 --- a/typings/babel__generator.d.ts +++ /dev/null @@ -1,123 +0,0 @@ -declare module '@babel/generator' { - import type * as t from '@babel/types'; - import type { DecodedSourceMap, Mapping } from '@jridgewell/gen-mapping'; - - 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?: jsescOptions; - - /** - * For use with the recordAndTuple token. - */ - recordAndTupleSyntaxType?: 'hash' | 'bar'; - /** - * For use with the Hack-style pipe operator. - * Changes what token is used for pipe bodies’ topic references. - */ - topicToken?: '^^' | '@@' | '^' | '%' | '#'; - } - - export interface GeneratorResult { - code: string; - map: { - version: number; - sources: string[]; - names: string[]; - sourceRoot?: string; - sourcesContent?: string[]; - mappings: string; - file: string; - } | null; - decodedMap: DecodedSourceMap | undefined; - rawMappings: Mapping[] | undefined; - } - - export default function generate( - ast: t.Node, - opts?: GeneratorOptions, - code?: string | { [filename: string]: string } - ): GeneratorResult; -} diff --git a/yarn.lock b/yarn.lock index 0a0d00152..a0cd3c29e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -138,6 +138,11 @@ dependencies: "@babel/types" "^7.16.7" +"@babel/helper-string-parser@^7.18.10": + version "7.18.10" + resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.18.10.tgz#181f22d28ebe1b3857fa575f5c290b1aaf659b56" + integrity sha512-XtIfWmeNY3i4t7t4D2t02q50HvqHybPqW2ki1kosnvWCwuCMeo81Jf0gwr85jy/neUdg5XDdeFE/80DXiO+njw== + "@babel/helper-validator-identifier@^7.15.7": version "7.15.7" resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.15.7.tgz#220df993bfe904a4a6b02ab4f3385a5ebf6e2389" @@ -148,6 +153,11 @@ resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.16.7.tgz#e8c602438c4a8195751243da9031d1607d247cad" integrity sha512-hsEnFemeiW4D08A5gUAZxLBTXpZ39P+a+DGDsHw1yxqyQ/jzFEnxf5uTEGp+3bzAbNOxU1paTgYS4ECU/IgfDw== +"@babel/helper-validator-identifier@^7.18.6": + version "7.18.6" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.18.6.tgz#9c97e30d31b2b8c72a1d08984f2ca9b574d7a076" + integrity sha512-MmetCkz9ej86nJQV+sFCxoGGrUbU3q02kgLciwkrt9QqEB7cP39oKEY0PakknEO0Gu20SskMRi+AYZ3b1TpN9g== + "@babel/helper-validator-option@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.16.7.tgz#b203ce62ce5fe153899b617c08957de860de4d23" @@ -215,12 +225,13 @@ debug "^4.1.0" globals "^11.1.0" -"@babel/types@7.18.4", "@babel/types@^7.18.0", "@babel/types@^7.18.2": - version "7.18.4" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.18.4.tgz#27eae9b9fd18e9dccc3f9d6ad051336f307be354" - integrity sha512-ThN1mBcMq5pG/Vm2IcBmPPfyPXbd8S02rS+OBIDENdufvqC7Z/jHPCv9IcP01277aKtDI8g/2XysBN4hA8niiw== +"@babel/types@7.19.0", "@babel/types@^7.0.0": + version "7.19.0" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.19.0.tgz#75f21d73d73dc0351f3368d28db73465f4814600" + integrity sha512-YuGopBq3ke25BVSiS6fgF49Ul9gH1x70Bcr6bqRLjWCkcX8Hre1/5+z+IiWOIerRMSSEfGZVB9z9kyq7wVs9YA== dependencies: - "@babel/helper-validator-identifier" "^7.16.7" + "@babel/helper-string-parser" "^7.18.10" + "@babel/helper-validator-identifier" "^7.18.6" to-fast-properties "^2.0.0" "@babel/types@^7.16.7", "@babel/types@^7.17.0": @@ -231,6 +242,14 @@ "@babel/helper-validator-identifier" "^7.16.7" to-fast-properties "^2.0.0" +"@babel/types@^7.18.0", "@babel/types@^7.18.2": + version "7.18.4" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.18.4.tgz#27eae9b9fd18e9dccc3f9d6ad051336f307be354" + integrity sha512-ThN1mBcMq5pG/Vm2IcBmPPfyPXbd8S02rS+OBIDENdufvqC7Z/jHPCv9IcP01277aKtDI8g/2XysBN4hA8niiw== + dependencies: + "@babel/helper-validator-identifier" "^7.16.7" + to-fast-properties "^2.0.0" + "@eslint/eslintrc@^0.4.3": version "0.4.3" resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-0.4.3.tgz#9e42981ef035beb3dd49add17acb96e8ff6f394c" @@ -321,6 +340,13 @@ "@nodelib/fs.scandir" "2.1.5" fastq "^1.6.0" +"@types/babel__generator@7.6.4": + version "7.6.4" + resolved "https://registry.yarnpkg.com/@types/babel__generator/-/babel__generator-7.6.4.tgz#1f20ce4c5b1990b37900b63f050182d28c2439b7" + integrity sha512-tFkciB9j2K755yrTALxD44McOrk+gfpIpvC3sxHjRawj6PfnQxrse4Clq5y/Rq+G3mrBurMax/lG8Qn2t9mSsg== + dependencies: + "@babel/types" "^7.0.0" + "@types/escodegen@0.0.7": version "0.0.7" resolved "https://registry.yarnpkg.com/@types/escodegen/-/escodegen-0.0.7.tgz#a1c3e3dfd76da89f01d7d196eebe227ebe4b6eec"