Debian Codegraph @

packages/babel-core/src/index.ts

raw
1 declare const PACKAGE_JSON: { name: string; version: string };
2 export const version = PACKAGE_JSON.version;
3
4 export { default as File } from "./transformation/file/file";
5 export type { default as PluginPass } from "./transformation/plugin-pass";
6 export { default as buildExternalHelpers } from "./tools/build-external-helpers";
7 export { resolvePlugin, resolvePreset } from "./config/files";
8
9 export { getEnv } from "./config/helpers/environment";
10
11 // NOTE: Lazy re-exports aren't detected by the Node.js CJS-ESM interop.
12 // These are handled by pluginInjectNodeReexportsHints in our babel.config.js
13 // so that they can work well.
14 export * as types from "@babel/types";
15 export { tokTypes } from "@babel/parser";
16 export { default as traverse } from "@babel/traverse";
17 export { default as template } from "@babel/template";
18
19 export {
20 createConfigItem,
21 createConfigItemSync,
22 createConfigItemAsync,
23 } from "./config";
24
25 export {
26 loadPartialConfig,
27 loadPartialConfigSync,
28 loadPartialConfigAsync,
29 loadOptions,
30 loadOptionsSync,
31 loadOptionsAsync,
32 } from "./config";
33
34 export type {
35 CallerMetadata,
36 InputOptions,
37 PluginAPI,
38 PluginObject,
39 PresetAPI,
40 PresetObject,
41 } from "./config";
42
43 export {
44 transform,
45 transformSync,
46 transformAsync,
47 type FileResult,
48 } from "./transform";
49 export {
50 transformFile,
51 transformFileSync,
52 transformFileAsync,
53 } from "./transform-file";
54 export {
55 transformFromAst,
56 transformFromAstSync,
57 transformFromAstAsync,
58 } from "./transform-ast";
59 export { parse, parseSync, parseAsync } from "./parse";
60
61 /**
62 * Recommended set of compilable extensions. Not used in @babel/core directly, but meant as
63 * as an easy source for tooling making use of @babel/core.
64 */
65 export const DEFAULT_EXTENSIONS = Object.freeze([
66 ".js",
67 ".jsx",
68 ".es6",
69 ".es",
70 ".mjs",
71 ".cjs",
72 ] as const);
73
74 // For easier backward-compatibility, provide an API like the one we exposed in Babel 6.
75 import { loadOptionsSync } from "./config";
76 export class OptionManager {
77 init(opts: {}) {
78 return loadOptionsSync(opts);
79 }
80 }
81
82 export function Plugin(alias: string) {
83 throw new Error(
84 `The (${alias}) Babel 5 plugin is being run with an unsupported Babel version.`,
85 );
86 }