将 @babel/core 从 7.x 升级到 8.x
根据 TypeScript 类型自动比较 @babel/core 7.29.13 与 8.1.2 的公开 API。签名变化表示可能存在不兼容变更,并非确定结论。
概要
| 已删除的导入路径 | 0 |
|---|---|
| 已删除的导出 | 21 |
| 已修改的签名 | 27 |
| 已删除的类或接口成员 | 0 |
| 已修改的类或接口成员 | 9 |
| 新增弃用 | 0 |
| 要求变化(engines、peer 依赖) | 1 |
| 新增导出 | 23 |
已删除的导出
| import | export | kind | 之前 |
|---|---|---|---|
@babel/core | Node | type | t.Node |
@babel/core | BabelFile | interface | interface |
@babel/core | PluginObj | interface | interface |
@babel/core | EnvFunction | interface | interface |
@babel/core | ParseResult | type | any |
@babel/core | MatchPattern | type | string | RegExp | ((filename: string | undefined, context: MatchPatternContext) => boolean) |
@babel/core | ParserOptions | variable | any |
@babel/core | PluginOptions | type | false | object | undefined |
@babel/core | ConfigFunction | type | (api: ConfigAPI) => TransformOptions |
@babel/core | SimpleCacheKey | type | string | number | boolean | null | undefined |
@babel/core | BabelFileResult | interface | interface |
@babel/core | TransformCaller | interface | interface |
@babel/core | TransformOptions | interface | interface |
@babel/core | BabelFileMetadata | interface | interface |
@babel/core | FileParseCallback | type | (err: Error | null, result: any) => any |
@babel/core | FileResultCallback | type | (err: Error | null, result: BabelFileResult | null) => any |
@babel/core | MatchPatternContext | interface | interface |
@babel/core | SimpleCacheCallback | type | () => T |
@babel/core | CreateConfigItemOptions | interface | interface |
@babel/core | SimpleCacheConfigurator | interface | interface |
@babel/core | BabelFileModulesMetadata | interface | interface |
已修改的签名
| export | 之前 | 之后 |
|---|---|---|
@babel/core · parse | (code: string, callback: FileParseCallback): void | (code: string, options: TransformOptions | undefined, callback: FileParseCallback): void | (code: string, options?: TransformOptions | undefined): any | (code: string, callback: FileParseCallback): void | (code: string, opts: InputOptions | null | undefined, callback: FileParseCallback): void |
@babel/core · Visitor | any | _babel_traverse.Visitor<S> |
@babel/core · ConfigAPI | interface | { version: string; cache: SimpleCacheConfigurator; env: EnvFunction; async: () => boolean; assertVersion: (range: string | number) => void; caller: CallerFactory; } |
@babel/core · parseSync | (code: string, options?: TransformOptions | undefined): any | (...args: any): any |
@babel/core · transform | (code: string, callback: FileResultCallback): void | (code: string, opts: TransformOptions | undefined, callback: FileResultCallback): void | (code: string, opts?: TransformOptions | undefined): BabelFileResult | null | (code: string, callback: FileResultCallback): void | (code: string, opts: InputOptions | null | undefined, callback: FileResultCallback): void |
@babel/core · ConfigItem | interface | class |
@babel/core · PluginItem | PluginTarget | ConfigItem | PluginObj<any> | [PluginTarget, PluginOptions] | [PluginTarget, PluginOptions, string | undefined] | ConfigItem<PluginAPI> | PluginTarget<Option> | [PluginTarget<Option>, Option] | [PluginTarget<Option>, Option, string] |
@babel/core · PluginPass | interface | class |
@babel/core · parseAsync | (code: string, options?: TransformOptions | undefined): Promise<any> | (...args: any): Promise<any> |
@babel/core · loadOptions | (options?: TransformOptions | undefined): object | null | (opts: InputOptions | null | undefined, callback?: ((err: Error, val: ResolvedOptions | null) => void) | undefined): void |
@babel/core · PluginTarget | string | object | ((...args: any[]) => any) | string | MaybeDefaultProperty<(api: PluginAPI, options: Option, dirname: string) => PluginObject<PluginPass<object>>> |
@babel/core · PartialConfig | interface | class |
@babel/core · resolvePlugin | (name: string, dirname: string): string | null | (name: string, dirname: string): string |
@babel/core · resolvePreset | (name: string, dirname: string): string | null | (name: string, dirname: string): string |
@babel/core · transformFile | (filename: string, callback: FileResultCallback): void | (filename: string, opts: TransformOptions | undefined, callback: FileResultCallback): void | (filename: string, callback: FileResultCallback): void | (filename: string, opts: InputOptions | null | undefined, callback: FileResultCallback): void |
@babel/core · transformSync | (code: string, opts?: TransformOptions | undefined): BabelFileResult | null | (...args: any): FileResult | null |
@babel/core · transformAsync | (code: string, opts?: TransformOptions | undefined): Promise<BabelFileResult | null> | (...args: any): Promise<FileResult | null> |
@babel/core · GeneratorOptions | any | _babel_generator.GeneratorOptions |
@babel/core · createConfigItem | (value: PluginTarget | [PluginTarget, PluginOptions] | [PluginTarget, PluginOptions, string | undefined], options?: CreateConfigItemOptions | undefined): ConfigItem | (target: PluginTarget<object>, callback: CreateConfigItemCallback): void | (target: PluginTarget<object>, options: { dirname?: string | undefined; type?: "preset" | "plugin" | undefined; } | undefined, callback: CreateConfigItemCallback): void |
@babel/core · transformFromAst | (ast: t.Node, code: string | undefined, callback: FileResultCallback): void | (ast: t.Node, code: string | undefined, opts: TransformOptions | undefined, callback: FileResultCallback): void | (ast: any, code: string, callback: FileResultCallback): void | (ast: any, code: string, opts: InputOptions | null | undefined, callback: FileResultCallback): void |
@babel/core · loadPartialConfig | (options?: TransformOptions | undefined): Readonly<PartialConfig> | null | (opts: InputOptions | undefined, callback?: ((err: Error, val: PartialConfig | null) => void) | undefined): void |
@babel/core · transformFileSync | (filename: string, opts?: TransformOptions | undefined): BabelFileResult | null | (...args: any): FileResult | null |
@babel/core · DEFAULT_EXTENSIONS | [".js", ".jsx", ".es6", ".es", ".mjs"] | readonly [".js", ".jsx", ".es6", ".es", ".mjs", ".cjs"] |
@babel/core · transformFileAsync | (filename: string, opts?: TransformOptions | undefined): Promise<BabelFileResult | null> | (...args: any): Promise<FileResult | null> |
@babel/core · transformFromAstSync | (ast: t.Node, code?: string | undefined, opts?: TransformOptions | undefined): BabelFileResult | null | (...args: any): FileResult | null |
@babel/core · transformFromAstAsync | (ast: t.Node, code?: string | undefined, opts?: TransformOptions | undefined): Promise<BabelFileResult | null> | (...args: any): Promise<FileResult | null> |
@babel/core · loadPartialConfigAsync | (options?: TransformOptions | undefined): Promise<Readonly<PartialConfig> | null> | (...args: any): Promise<PartialConfig | null> |
已删除的类或接口成员
未发现。
已修改的类或接口成员
| member | 之前 | 之后 |
|---|---|---|
ConfigItem.file | { request: string; resolved: string; } | null | undefined | void | { request: string; resolved: string; } |
ConfigItem.name | string | undefined | string | void |
ConfigItem.value | object | ((...args: any[]) => any) | object | Function |
ConfigItem.options | false | object | undefined | false | void | object |
PluginPass.key | string | string | null | undefined |
PluginPass.set | (key: unknown, value: unknown): void | (key: unknown, val: unknown): void |
PluginPass.file | BabelFile | File |
PluginPass.opts | object | Partial<Options> |
PartialConfig.options | TransformOptions | NormalizedOptions |
新增弃用
未发现。
要求变化(engines、peer 依赖)
| 之前 | 之后 | |
|---|---|---|
engines.node | >=6.9.0 | — |
新增导出 (23)
| import | export | kind |
|---|---|---|
@babel/core | File | class |
@babel/core | Scope | variable |
@babel/core | getEnv | function |
@babel/core | generate | variable |
@babel/core | tokTypes | variable |
@babel/core | PluginAPI | type |
@babel/core | PresetAPI | type |
@babel/core | FileResult | type |
@babel/core | PresetItem | type |
@babel/core | VisitorBase | type |
@babel/core | InputOptions | type |
@babel/core | PluginObject | type |
@babel/core | PresetObject | type |
@babel/core | PresetTarget | type |
@babel/core | CallerMetadata | type |
@babel/core | GeneratorResult | type |
@babel/core | loadOptionsSync | function |
@babel/core | loadOptionsAsync | function |
@babel/core | NormalizedOptions | type |
@babel/core | buildExternalHelpers | function |
@babel/core | createConfigItemSync | function |
@babel/core | createConfigItemAsync | function |
@babel/core | loadPartialConfigSync | function |
把这些数据交给你的 AI 智能体
Vigia 是免费的 MCP 服务器:你的编程智能体在写代码之前就能检查版本、不兼容变更和安全漏洞。无需注册,无需 API 密钥。
claude mcp add --transport http vigia https://vigia.coredls.cloud/mcp
添加到 Cursor添加到 VS Code★ 在 GitHub 上加星
任何其他 MCP 客户端
{ "mcpServers": { "vigia": { "url": "https://vigia.coredls.cloud/mcp" } } }常见问题
将 @babel/core 从 7 升级到 8 有哪些不兼容变更?
在 @babel/core 7.29.13 与 8.1.2 之间,Vigia 发现 21 个已删除的导出、27 个已修改的签名,以及 9 个已删除或修改的类或接口成员。
@babel/core 8 中弃用了哪些内容?
@babel/core 8.1.2 中有 0 个导出或成员新被标记为弃用。
供智能体使用
GET https://vigia.coredls.cloud/v1/packages/npm/@babel/core/upgrade?from=7.29.13&to=8.1.2