diff --git a/Gulpfile.mjs b/Gulpfile.mjs index 929a61f699e9..7c57ef68650e 100644 --- a/Gulpfile.mjs +++ b/Gulpfile.mjs @@ -182,7 +182,7 @@ function generateStandalone() { through.obj(async (file, enc, callback) => { log("Generating @babel/standalone files"); const pluginConfig = JSON.parse(file.contents); - let imports = `import makeNoopPlugin from "../make-noop-plugin";`; + let imports = `import makeNoopPlugin from "../make-noop-plugin.ts";`; let exportDecls = ""; let exportsList = ""; let allList = ""; diff --git a/babel.config.js b/babel.config.js index e327de7516c2..4343cf9af0f0 100644 --- a/babel.config.js +++ b/babel.config.js @@ -77,8 +77,7 @@ module.exports = function (api) { let targets = {}; let convertESM = outputType === "script"; - /** @type {false | "externals" | "always"} */ - let addImportExtension = convertESM ? false : "always"; + let replaceTSImportExtension = true; let ignoreLib = true; let includeRegeneratorRuntime = false; let needsPolyfillsForOldNode = false; @@ -107,7 +106,7 @@ module.exports = function (api) { case "standalone": includeRegeneratorRuntime = true; convertESM = false; - addImportExtension = false; + replaceTSImportExtension = false; ignoreLib = false; // rollup-commonjs will converts node_modules to ESM unambiguousSources.push( @@ -120,7 +119,7 @@ module.exports = function (api) { break; case "rollup": convertESM = false; - addImportExtension = "externals"; + replaceTSImportExtension = false; ignoreLib = false; // rollup-commonjs will converts node_modules to ESM unambiguousSources.push( @@ -230,9 +229,7 @@ module.exports = function (api) { assumptions: sourceAssumptions, plugins: [ transformNamedBabelTypesImportToDestructuring, - addImportExtension - ? [pluginAddImportExtension, { when: addImportExtension }] - : null, + replaceTSImportExtension ? pluginReplaceTSImportExtension : null, [ pluginToggleBooleanFlag, @@ -787,56 +784,13 @@ function pluginImportMetaUrl({ types: t, template }) { }; } -function pluginAddImportExtension(api, { when }) { +function pluginReplaceTSImportExtension() { return { visitor: { "ImportDeclaration|ExportDeclaration"({ node }) { const { source } = node; - if (!source) return; - - if ( - when === "always" && - source.value.startsWith(".") && - !/\.[a-z]+$/.test(source.value) - ) { - const dir = pathUtils.dirname(this.filename); - - try { - const pkg = JSON.parse( - fs.readFileSync( - pathUtils.join(dir, `${source.value}/package.json`) - ), - "utf8" - ); - - if (pkg.main) source.value = pathUtils.join(source.value, pkg.main); - } catch (_) {} - - try { - if (fs.statSync(pathUtils.join(dir, source.value)).isFile()) return; - } catch (_) {} - - for (const [src, lib = src] of [["ts", "js"], ["js"], ["cjs"]]) { - try { - fs.statSync(pathUtils.join(dir, `${source.value}.${src}`)); - source.value += `.${lib}`; - return; - } catch (_) {} - } - - source.value += "/index.js"; - } - if ( - source.value.startsWith("lodash/") || - source.value.startsWith("core-js-compat/") || - source.value === "core-js/stable/index" || - source.value === "regenerator-runtime/runtime" || - source.value === "babel-plugin-dynamic-import-node/utils" - ) { - source.value += ".js"; - } - if (source.value.startsWith("@babel/preset-modules/")) { - source.value += "/index.js"; + if (source) { + source.value = source.value.replace(/(\.[mc]?)ts$/, "$1js"); } }, }, diff --git a/eslint.config.js b/eslint.config.js index 3c744c657075..a116d6eba52e 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -173,7 +173,7 @@ module.exports = [ "@babel/development/no-undefined-identifier": "error", "@babel/development/no-deprecated-clone": "error", "guard-for-in": "error", - "import/extensions": ["error", { json: "always", cjs: "always" }], + "import/extensions": ["error", "ignorePackages"], }, }, ...compat.extends("plugin:jest/recommended").map(config => { diff --git a/lib/third-party-libs.d.ts b/lib/third-party-libs.d.ts index 0cd19dbd4bb1..a6f14769fe2c 100644 --- a/lib/third-party-libs.d.ts +++ b/lib/third-party-libs.d.ts @@ -1,67 +1,69 @@ +/* eslint-disable import/no-extraneous-dependencies */ + declare module "js-tokens" { // TODO(Babel 8): Remove this export { default } from "js-tokens-BABEL_8_BREAKING-true"; export * from "js-tokens-BABEL_8_BREAKING-true"; } -declare module "@babel/preset-modules/lib/plugins/transform-async-arrows-in-class" { - import { declare } from "@babel/helper-plugin-utils"; +declare module "@babel/preset-modules/lib/plugins/transform-async-arrows-in-class/index.js" { + import type { declare } from "@babel/helper-plugin-utils"; let plugin: ReturnType; - let exports: {default: typeof plugin}; + let exports: { default: typeof plugin }; export = exports; } -declare module "@babel/preset-modules/lib/plugins/transform-edge-default-parameters" { - import { declare } from "@babel/helper-plugin-utils"; +declare module "@babel/preset-modules/lib/plugins/transform-edge-default-parameters/index.js" { + import type { declare } from "@babel/helper-plugin-utils"; let plugin: ReturnType; - let exports: {default: typeof plugin}; + let exports: { default: typeof plugin }; export = exports; } -declare module "@babel/preset-modules/lib/plugins/transform-edge-function-name" { - import { declare } from "@babel/helper-plugin-utils"; +declare module "@babel/preset-modules/lib/plugins/transform-edge-function-name/index.js" { + import type { declare } from "@babel/helper-plugin-utils"; let plugin: ReturnType; - let exports: {default: typeof plugin}; + let exports: { default: typeof plugin }; export = exports; } -declare module "@babel/preset-modules/lib/plugins/transform-tagged-template-caching" { - import { declare } from "@babel/helper-plugin-utils"; +declare module "@babel/preset-modules/lib/plugins/transform-tagged-template-caching/index.js" { + import type { declare } from "@babel/helper-plugin-utils"; let plugin: ReturnType; - let exports: {default: typeof plugin}; + let exports: { default: typeof plugin }; export = exports; } -declare module "@babel/preset-modules/lib/plugins/transform-safari-block-shadowing" { - import { declare } from "@babel/helper-plugin-utils"; +declare module "@babel/preset-modules/lib/plugins/transform-safari-block-shadowing/index.js" { + import type { declare } from "@babel/helper-plugin-utils"; let plugin: ReturnType; - let exports: {default: typeof plugin}; + let exports: { default: typeof plugin }; export = exports; } -declare module "@babel/preset-modules/lib/plugins/transform-safari-for-shadowing" { - import { declare } from "@babel/helper-plugin-utils"; +declare module "@babel/preset-modules/lib/plugins/transform-safari-for-shadowing/index.js" { + import type { declare } from "@babel/helper-plugin-utils"; let plugin: ReturnType; - let exports: {default: typeof plugin}; + let exports: { default: typeof plugin }; export = exports; } declare module "babel-plugin-polyfill-corejs2" { - import { declare } from "@babel/helper-plugin-utils"; + import type { declare } from "@babel/helper-plugin-utils"; let plugin: ReturnType; - let exports: {default: typeof plugin}; + let exports: { default: typeof plugin }; export = exports; } declare module "babel-plugin-polyfill-corejs3" { - import { declare } from "@babel/helper-plugin-utils"; + import type { declare } from "@babel/helper-plugin-utils"; let plugin: ReturnType; - let exports: {default: typeof plugin}; + let exports: { default: typeof plugin }; export = exports; } declare module "babel-plugin-polyfill-regenerator" { - import { declare } from "@babel/helper-plugin-utils"; + import type { declare } from "@babel/helper-plugin-utils"; let plugin: ReturnType; - let exports: {default: typeof plugin}; + let exports: { default: typeof plugin }; export = exports; } declare module "regenerator-transform" { - import { declare } from "@babel/helper-plugin-utils"; + import type { declare } from "@babel/helper-plugin-utils"; let plugin: ReturnType; - let exports: {default: typeof plugin}; + let exports: { default: typeof plugin }; export = exports; } diff --git a/packages/babel-cli/src/babel/dir.ts b/packages/babel-cli/src/babel/dir.ts index d987408da3dc..87bd9f2eb311 100644 --- a/packages/babel-cli/src/babel/dir.ts +++ b/packages/babel-cli/src/babel/dir.ts @@ -2,9 +2,9 @@ import slash from "slash"; import path from "path"; import fs from "fs"; -import * as util from "./util"; -import * as watcher from "./watcher"; -import type { CmdOptions } from "./options"; +import * as util from "./util.ts"; +import * as watcher from "./watcher.ts"; +import type { CmdOptions } from "./options.ts"; const FILE_TYPE = Object.freeze({ NON_COMPILABLE: "NON_COMPILABLE", diff --git a/packages/babel-cli/src/babel/file.ts b/packages/babel-cli/src/babel/file.ts index b41d81d7a1f1..4ac31d77c107 100644 --- a/packages/babel-cli/src/babel/file.ts +++ b/packages/babel-cli/src/babel/file.ts @@ -4,9 +4,9 @@ import slash from "slash"; import path from "path"; import fs from "fs"; -import * as util from "./util"; -import type { CmdOptions } from "./options"; -import * as watcher from "./watcher"; +import * as util from "./util.ts"; +import type { CmdOptions } from "./options.ts"; +import * as watcher from "./watcher.ts"; import type { EncodedSourceMap, diff --git a/packages/babel-cli/src/babel/index.ts b/packages/babel-cli/src/babel/index.ts index a740bcdedadf..bf351f7f9478 100755 --- a/packages/babel-cli/src/babel/index.ts +++ b/packages/babel-cli/src/babel/index.ts @@ -1,8 +1,8 @@ #!/usr/bin/env node -import parseArgv from "./options"; -import dirCommand from "./dir"; -import fileCommand from "./file"; +import parseArgv from "./options.ts"; +import dirCommand from "./dir.ts"; +import fileCommand from "./file.ts"; const opts = parseArgv(process.argv); diff --git a/packages/babel-cli/src/babel/util.ts b/packages/babel-cli/src/babel/util.ts index 053e1b3543a1..7e5919956dc7 100644 --- a/packages/babel-cli/src/babel/util.ts +++ b/packages/babel-cli/src/babel/util.ts @@ -3,7 +3,7 @@ import * as babel from "@babel/core"; import path from "path"; import fs from "fs"; -import * as watcher from "./watcher"; +import * as watcher from "./watcher.ts"; import type { FileResult, InputOptions } from "@babel/core"; diff --git a/packages/babel-core/src/config/cache-contexts.ts b/packages/babel-core/src/config/cache-contexts.ts index 1c7e1553bac3..e67ddc6a8a70 100644 --- a/packages/babel-core/src/config/cache-contexts.ts +++ b/packages/babel-core/src/config/cache-contexts.ts @@ -1,7 +1,7 @@ import type { Targets } from "@babel/helper-compilation-targets"; -import type { ConfigContext } from "./config-chain"; -import type { CallerMetadata } from "./validation/options"; +import type { ConfigContext } from "./config-chain.ts"; +import type { CallerMetadata } from "./validation/options.ts"; export type { ConfigContext as FullConfig }; diff --git a/packages/babel-core/src/config/caching.ts b/packages/babel-core/src/config/caching.ts index 7eecceb657e0..521225fbb2cf 100644 --- a/packages/babel-core/src/config/caching.ts +++ b/packages/babel-core/src/config/caching.ts @@ -6,8 +6,8 @@ import { onFirstPause, waitFor, isThenable, -} from "../gensync-utils/async"; -import { isIterableIterator } from "./util"; +} from "../gensync-utils/async.ts"; +import { isIterableIterator } from "./util.ts"; export type { CacheConfigurator }; diff --git a/packages/babel-core/src/config/config-chain.ts b/packages/babel-core/src/config/config-chain.ts index 785c8859d9ca..85352d4508d1 100644 --- a/packages/babel-core/src/config/config-chain.ts +++ b/packages/babel-core/src/config/config-chain.ts @@ -3,7 +3,7 @@ import path from "path"; import buildDebug from "debug"; import type { Handler } from "gensync"; -import { validate } from "./validation/options"; +import { validate } from "./validation/options.ts"; import type { ValidatedOptions, IgnoreList, @@ -11,14 +11,14 @@ import type { BabelrcSearch, CallerMetadata, IgnoreItem, -} from "./validation/options"; -import pathPatternToRegex from "./pattern-to-regex"; -import { ConfigPrinter, ChainFormatter } from "./printer"; -import type { ReadonlyDeepArray } from "./helpers/deep-array"; +} from "./validation/options.ts"; +import pathPatternToRegex from "./pattern-to-regex.ts"; +import { ConfigPrinter, ChainFormatter } from "./printer.ts"; +import type { ReadonlyDeepArray } from "./helpers/deep-array.ts"; -import { endHiddenCallStack } from "../errors/rewrite-stack-trace"; -import ConfigError from "../errors/config-error"; -import type { PluginAPI, PresetAPI } from "./helpers/config-api"; +import { endHiddenCallStack } from "../errors/rewrite-stack-trace.ts"; +import ConfigError from "../errors/config-error.ts"; +import type { PluginAPI, PresetAPI } from "./helpers/config-api.ts"; const debug = buildDebug("babel:config:config-chain"); @@ -27,20 +27,20 @@ import { findRelativeConfig, findRootConfig, loadConfig, -} from "./files"; -import type { ConfigFile, IgnoreFile, FilePackageData } from "./files"; +} from "./files/index.ts"; +import type { ConfigFile, IgnoreFile, FilePackageData } from "./files/index.ts"; -import { makeWeakCacheSync, makeStrongCacheSync } from "./caching"; +import { makeWeakCacheSync, makeStrongCacheSync } from "./caching.ts"; import { createCachedDescriptors, createUncachedDescriptors, -} from "./config-descriptors"; +} from "./config-descriptors.ts"; import type { UnloadedDescriptor, OptionsAndDescriptors, ValidatedFile, -} from "./config-descriptors"; +} from "./config-descriptors.ts"; export type ConfigChain = { plugins: Array>; diff --git a/packages/babel-core/src/config/config-descriptors.ts b/packages/babel-core/src/config/config-descriptors.ts index d8327845e141..5f6f01103da5 100644 --- a/packages/babel-core/src/config/config-descriptors.ts +++ b/packages/babel-core/src/config/config-descriptors.ts @@ -1,25 +1,25 @@ import gensync, { type Handler } from "gensync"; -import { once } from "../gensync-utils/functional"; +import { once } from "../gensync-utils/functional.ts"; -import { loadPlugin, loadPreset } from "./files"; +import { loadPlugin, loadPreset } from "./files/index.ts"; -import { getItemDescriptor } from "./item"; +import { getItemDescriptor } from "./item.ts"; import { makeWeakCacheSync, makeStrongCacheSync, makeStrongCache, -} from "./caching"; -import type { CacheConfigurator } from "./caching"; +} from "./caching.ts"; +import type { CacheConfigurator } from "./caching.ts"; import type { ValidatedOptions, PluginList, PluginItem, -} from "./validation/options"; +} from "./validation/options.ts"; -import { resolveBrowserslistConfigFile } from "./resolve-targets"; -import type { PluginAPI, PresetAPI } from "./helpers/config-api"; +import { resolveBrowserslistConfigFile } from "./resolve-targets.ts"; +import type { PluginAPI, PresetAPI } from "./helpers/config-api.ts"; // Represents a config object and functions to lazily load the descriptors // for the plugins and presets so we don't load the plugins/presets unless diff --git a/packages/babel-core/src/config/files/configuration.ts b/packages/babel-core/src/config/files/configuration.ts index b488dbc91239..1facc9aef8b2 100644 --- a/packages/babel-core/src/config/files/configuration.ts +++ b/packages/babel-core/src/config/files/configuration.ts @@ -4,21 +4,21 @@ import path from "path"; import json5 from "json5"; import gensync from "gensync"; import type { Handler } from "gensync"; -import { makeWeakCache, makeWeakCacheSync } from "../caching"; -import type { CacheConfigurator } from "../caching"; -import { makeConfigAPI } from "../helpers/config-api"; -import type { ConfigAPI } from "../helpers/config-api"; -import { makeStaticFileCache } from "./utils"; -import loadCodeDefault from "./module-types"; -import pathPatternToRegex from "../pattern-to-regex"; -import type { FilePackageData, RelativeConfig, ConfigFile } from "./types"; -import type { CallerMetadata, InputOptions } from "../validation/options"; -import ConfigError from "../../errors/config-error"; - -import * as fs from "../../gensync-utils/fs"; +import { makeWeakCache, makeWeakCacheSync } from "../caching.ts"; +import type { CacheConfigurator } from "../caching.ts"; +import { makeConfigAPI } from "../helpers/config-api.ts"; +import type { ConfigAPI } from "../helpers/config-api.ts"; +import { makeStaticFileCache } from "./utils.ts"; +import loadCodeDefault from "./module-types.ts"; +import pathPatternToRegex from "../pattern-to-regex.ts"; +import type { FilePackageData, RelativeConfig, ConfigFile } from "./types.ts"; +import type { CallerMetadata, InputOptions } from "../validation/options.ts"; +import ConfigError from "../../errors/config-error.ts"; + +import * as fs from "../../gensync-utils/fs.ts"; import { createRequire } from "module"; -import { endHiddenCallStack } from "../../errors/rewrite-stack-trace"; +import { endHiddenCallStack } from "../../errors/rewrite-stack-trace.ts"; const require = createRequire(import.meta.url); const debug = buildDebug("babel:config:loading:files:configuration"); diff --git a/packages/babel-core/src/config/files/import-meta-resolve.ts b/packages/babel-core/src/config/files/import-meta-resolve.ts index e436c201ca93..99bcc96500c8 100644 --- a/packages/babel-core/src/config/files/import-meta-resolve.ts +++ b/packages/babel-core/src/config/files/import-meta-resolve.ts @@ -1,4 +1,4 @@ -import { resolve as polyfill } from "../../vendor/import-meta-resolve"; +import { resolve as polyfill } from "../../vendor/import-meta-resolve.ts"; let importMetaResolve: (specifier: string, parent: string) => string; diff --git a/packages/babel-core/src/config/files/index-browser.ts b/packages/babel-core/src/config/files/index-browser.ts index 08f91f6a6751..d25736325575 100644 --- a/packages/babel-core/src/config/files/index-browser.ts +++ b/packages/babel-core/src/config/files/index-browser.ts @@ -5,9 +5,9 @@ import type { IgnoreFile, RelativeConfig, FilePackageData, -} from "./types"; +} from "./types.ts"; -import type { CallerMetadata } from "../validation/options"; +import type { CallerMetadata } from "../validation/options.ts"; export type { ConfigFile, IgnoreFile, RelativeConfig, FilePackageData }; diff --git a/packages/babel-core/src/config/files/index.ts b/packages/babel-core/src/config/files/index.ts index 55f68cb73f4e..b138e8da9a7c 100644 --- a/packages/babel-core/src/config/files/index.ts +++ b/packages/babel-core/src/config/files/index.ts @@ -5,7 +5,7 @@ type indexType = typeof import("./index"); // exports of index-browser, since this file may be replaced at bundle time with index-browser. ({}) as any as indexBrowserType as indexType; -export { findPackageData } from "./package"; +export { findPackageData } from "./package.ts"; export { findConfigUpwards, @@ -14,16 +14,16 @@ export { loadConfig, resolveShowConfigPath, ROOT_CONFIG_FILENAMES, -} from "./configuration"; +} from "./configuration.ts"; export type { ConfigFile, IgnoreFile, RelativeConfig, FilePackageData, -} from "./types"; +} from "./types.ts"; export { loadPlugin, loadPreset, resolvePlugin, resolvePreset, -} from "./plugins"; +} from "./plugins.ts"; diff --git a/packages/babel-core/src/config/files/module-types.ts b/packages/babel-core/src/config/files/module-types.ts index 8e99c4d13d05..1494a920ffe0 100644 --- a/packages/babel-core/src/config/files/module-types.ts +++ b/packages/babel-core/src/config/files/module-types.ts @@ -1,15 +1,15 @@ -import { isAsync, waitFor } from "../../gensync-utils/async"; +import { isAsync, waitFor } from "../../gensync-utils/async.ts"; import type { Handler } from "gensync"; import path from "path"; import { pathToFileURL } from "url"; import { createRequire } from "module"; import semver from "semver"; -import { endHiddenCallStack } from "../../errors/rewrite-stack-trace"; -import ConfigError from "../../errors/config-error"; +import { endHiddenCallStack } from "../../errors/rewrite-stack-trace.ts"; +import ConfigError from "../../errors/config-error.ts"; -import type { InputOptions } from ".."; -import { transformFileSync } from "../../transform-file"; +import type { InputOptions } from "../index.ts"; +import { transformFileSync } from "../../transform-file.ts"; const require = createRequire(import.meta.url); diff --git a/packages/babel-core/src/config/files/package.ts b/packages/babel-core/src/config/files/package.ts index b8867eb4f92f..77b06e8f2890 100644 --- a/packages/babel-core/src/config/files/package.ts +++ b/packages/babel-core/src/config/files/package.ts @@ -1,10 +1,10 @@ import path from "path"; import type { Handler } from "gensync"; -import { makeStaticFileCache } from "./utils"; +import { makeStaticFileCache } from "./utils.ts"; -import type { ConfigFile, FilePackageData } from "./types"; +import type { ConfigFile, FilePackageData } from "./types.ts"; -import ConfigError from "../../errors/config-error"; +import ConfigError from "../../errors/config-error.ts"; const PACKAGE_FILENAME = "package.json"; diff --git a/packages/babel-core/src/config/files/plugins.ts b/packages/babel-core/src/config/files/plugins.ts index cf1099134453..dee3b67336ba 100644 --- a/packages/babel-core/src/config/files/plugins.ts +++ b/packages/babel-core/src/config/files/plugins.ts @@ -5,11 +5,11 @@ import buildDebug from "debug"; import path from "path"; import type { Handler } from "gensync"; -import { isAsync } from "../../gensync-utils/async"; -import loadCodeDefault, { supportsESM } from "./module-types"; +import { isAsync } from "../../gensync-utils/async.ts"; +import loadCodeDefault, { supportsESM } from "./module-types.ts"; import { fileURLToPath, pathToFileURL } from "url"; -import importMetaResolve from "./import-meta-resolve"; +import importMetaResolve from "./import-meta-resolve.ts"; import { createRequire } from "module"; const require = createRequire(import.meta.url); diff --git a/packages/babel-core/src/config/files/types.ts b/packages/babel-core/src/config/files/types.ts index 3edf65b58f69..2dfefef79674 100644 --- a/packages/babel-core/src/config/files/types.ts +++ b/packages/babel-core/src/config/files/types.ts @@ -1,4 +1,4 @@ -import type { InputOptions } from ".."; +import type { InputOptions } from "../index.ts"; export type ConfigFile = { filepath: string; diff --git a/packages/babel-core/src/config/files/utils.ts b/packages/babel-core/src/config/files/utils.ts index 160439168709..c72c3cc7d4a6 100644 --- a/packages/babel-core/src/config/files/utils.ts +++ b/packages/babel-core/src/config/files/utils.ts @@ -1,8 +1,8 @@ import type { Handler } from "gensync"; -import { makeStrongCache } from "../caching"; -import type { CacheConfigurator } from "../caching"; -import * as fs from "../../gensync-utils/fs"; +import { makeStrongCache } from "../caching.ts"; +import type { CacheConfigurator } from "../caching.ts"; +import * as fs from "../../gensync-utils/fs.ts"; import nodeFs from "fs"; export function makeStaticFileCache( diff --git a/packages/babel-core/src/config/full.ts b/packages/babel-core/src/config/full.ts index c50487ee0dde..b56872791a9f 100644 --- a/packages/babel-core/src/config/full.ts +++ b/packages/babel-core/src/config/full.ts @@ -1,36 +1,40 @@ import gensync, { type Handler } from "gensync"; -import { forwardAsync, maybeAsync, isThenable } from "../gensync-utils/async"; - -import { mergeOptions } from "./util"; -import * as context from "../index"; -import Plugin from "./plugin"; -import { getItemDescriptor } from "./item"; -import { buildPresetChain } from "./config-chain"; -import { finalize as freezeDeepArray } from "./helpers/deep-array"; -import type { DeepArray, ReadonlyDeepArray } from "./helpers/deep-array"; +import { + forwardAsync, + maybeAsync, + isThenable, +} from "../gensync-utils/async.ts"; + +import { mergeOptions } from "./util.ts"; +import * as context from "../index.ts"; +import Plugin from "./plugin.ts"; +import { getItemDescriptor } from "./item.ts"; +import { buildPresetChain } from "./config-chain.ts"; +import { finalize as freezeDeepArray } from "./helpers/deep-array.ts"; +import type { DeepArray, ReadonlyDeepArray } from "./helpers/deep-array.ts"; import type { ConfigContext, ConfigChain, PresetInstance, -} from "./config-chain"; -import type { UnloadedDescriptor } from "./config-descriptors"; +} from "./config-chain.ts"; +import type { UnloadedDescriptor } from "./config-descriptors.ts"; import traverse from "@babel/traverse"; -import { makeWeakCache, makeWeakCacheSync } from "./caching"; -import type { CacheConfigurator } from "./caching"; +import { makeWeakCache, makeWeakCacheSync } from "./caching.ts"; +import type { CacheConfigurator } from "./caching.ts"; import { validate, checkNoUnwrappedItemOptionPairs, -} from "./validation/options"; -import type { PluginItem } from "./validation/options"; -import { validatePluginObject } from "./validation/plugins"; -import { makePluginAPI, makePresetAPI } from "./helpers/config-api"; -import type { PluginAPI, PresetAPI } from "./helpers/config-api"; +} from "./validation/options.ts"; +import type { PluginItem } from "./validation/options.ts"; +import { validatePluginObject } from "./validation/plugins.ts"; +import { makePluginAPI, makePresetAPI } from "./helpers/config-api.ts"; +import type { PluginAPI, PresetAPI } from "./helpers/config-api.ts"; -import loadPrivatePartialConfig from "./partial"; -import type { ValidatedOptions } from "./validation/options"; +import loadPrivatePartialConfig from "./partial.ts"; +import type { ValidatedOptions } from "./validation/options.ts"; -import type * as Context from "./cache-contexts"; -import ConfigError from "../errors/config-error"; +import type * as Context from "./cache-contexts.ts"; +import ConfigError from "../errors/config-error.ts"; type LoadedDescriptor = { value: {}; @@ -40,7 +44,7 @@ type LoadedDescriptor = { externalDependencies: ReadonlyDeepArray; }; -export type { InputOptions } from "./validation/options"; +export type { InputOptions } from "./validation/options.ts"; export type ResolvedConfig = { options: any; diff --git a/packages/babel-core/src/config/helpers/config-api.ts b/packages/babel-core/src/config/helpers/config-api.ts index 1fc4bc257edb..d9715a7b9e44 100644 --- a/packages/babel-core/src/config/helpers/config-api.ts +++ b/packages/babel-core/src/config/helpers/config-api.ts @@ -1,15 +1,15 @@ import semver from "semver"; import type { Targets } from "@babel/helper-compilation-targets"; -import { version as coreVersion } from "../../"; -import { assertSimpleType } from "../caching"; +import { version as coreVersion } from "../../index.ts"; +import { assertSimpleType } from "../caching.ts"; import type { CacheConfigurator, SimpleCacheConfigurator, SimpleType, -} from "../caching"; +} from "../caching.ts"; -import type { AssumptionName, CallerMetadata } from "../validation/options"; +import type { AssumptionName, CallerMetadata } from "../validation/options.ts"; import type * as Context from "../cache-contexts"; diff --git a/packages/babel-core/src/config/index.ts b/packages/babel-core/src/config/index.ts index f5650c8a8cc4..ed27669a2b9c 100644 --- a/packages/babel-core/src/config/index.ts +++ b/packages/babel-core/src/config/index.ts @@ -5,15 +5,15 @@ export type { InputOptions, PluginPasses, Plugin, -} from "./full"; +} from "./full.ts"; -import type { PluginTarget } from "./validation/options"; +import type { PluginTarget } from "./validation/options.ts"; import type { PluginAPI as basePluginAPI, PresetAPI as basePresetAPI, -} from "./helpers/config-api"; -export type { PluginObject } from "./validation/plugins"; +} from "./helpers/config-api.ts"; +export type { PluginObject } from "./validation/plugins.ts"; type PluginAPI = basePluginAPI & typeof import(".."); type PresetAPI = basePresetAPI & typeof import(".."); export type { PluginAPI, PresetAPI }; @@ -21,21 +21,21 @@ export type { PluginAPI, PresetAPI }; export type { CallerMetadata, ValidatedOptions as PresetObject, -} from "./validation/options"; +} from "./validation/options.ts"; -import loadFullConfig, { type ResolvedConfig } from "./full"; +import loadFullConfig, { type ResolvedConfig } from "./full.ts"; import { type PartialConfig, loadPartialConfig as loadPartialConfigImpl, -} from "./partial"; +} from "./partial.ts"; export { loadFullConfig as default }; -export type { PartialConfig } from "./partial"; +export type { PartialConfig } from "./partial.ts"; -import { createConfigItem as createConfigItemImpl } from "./item"; -import type { ConfigItem } from "./item"; +import { createConfigItem as createConfigItemImpl } from "./item.ts"; +import type { ConfigItem } from "./item.ts"; -import { beginHiddenCallStack } from "../errors/rewrite-stack-trace"; +import { beginHiddenCallStack } from "../errors/rewrite-stack-trace.ts"; const loadPartialConfigRunner = gensync(loadPartialConfigImpl); export function loadPartialConfigAsync( diff --git a/packages/babel-core/src/config/item.ts b/packages/babel-core/src/config/item.ts index 4b13324a792c..773552d9fd9d 100644 --- a/packages/babel-core/src/config/item.ts +++ b/packages/babel-core/src/config/item.ts @@ -1,10 +1,10 @@ import type { Handler } from "gensync"; -import type { PluginTarget, PluginOptions } from "./validation/options"; +import type { PluginTarget, PluginOptions } from "./validation/options.ts"; import path from "path"; -import { createDescriptor } from "./config-descriptors"; +import { createDescriptor } from "./config-descriptors.ts"; -import type { UnloadedDescriptor } from "./config-descriptors"; +import type { UnloadedDescriptor } from "./config-descriptors.ts"; export function createItemFromDescriptor( desc: UnloadedDescriptor, diff --git a/packages/babel-core/src/config/partial.ts b/packages/babel-core/src/config/partial.ts index 8e5bd40ab930..68a541ea38ec 100644 --- a/packages/babel-core/src/config/partial.ts +++ b/packages/babel-core/src/config/partial.ts @@ -1,26 +1,26 @@ import path from "path"; import type { Handler } from "gensync"; -import Plugin from "./plugin"; -import { mergeOptions } from "./util"; -import { createItemFromDescriptor } from "./item"; -import { buildRootChain } from "./config-chain"; -import type { ConfigContext, FileHandling } from "./config-chain"; -import { getEnv } from "./helpers/environment"; -import { validate } from "./validation/options"; +import Plugin from "./plugin.ts"; +import { mergeOptions } from "./util.ts"; +import { createItemFromDescriptor } from "./item.ts"; +import { buildRootChain } from "./config-chain.ts"; +import type { ConfigContext, FileHandling } from "./config-chain.ts"; +import { getEnv } from "./helpers/environment.ts"; +import { validate } from "./validation/options.ts"; import type { ValidatedOptions, NormalizedOptions, RootMode, -} from "./validation/options"; +} from "./validation/options.ts"; import { findConfigUpwards, resolveShowConfigPath, ROOT_CONFIG_FILENAMES, -} from "./files"; -import type { ConfigFile, IgnoreFile } from "./files"; -import { resolveTargets } from "./resolve-targets"; +} from "./files/index.ts"; +import type { ConfigFile, IgnoreFile } from "./files/index.ts"; +import { resolveTargets } from "./resolve-targets.ts"; function resolveRootMode(rootDir: string, rootMode: RootMode): string { switch (rootMode) { diff --git a/packages/babel-core/src/config/plugin.ts b/packages/babel-core/src/config/plugin.ts index 782b57ec6175..8ee23fc31226 100644 --- a/packages/babel-core/src/config/plugin.ts +++ b/packages/babel-core/src/config/plugin.ts @@ -1,6 +1,6 @@ -import { finalize } from "./helpers/deep-array"; -import type { ReadonlyDeepArray } from "./helpers/deep-array"; -import type { PluginObject } from "./validation/plugins"; +import { finalize } from "./helpers/deep-array.ts"; +import type { ReadonlyDeepArray } from "./helpers/deep-array.ts"; +import type { PluginObject } from "./validation/plugins.ts"; export default class Plugin { key: string | undefined | null; diff --git a/packages/babel-core/src/config/printer.ts b/packages/babel-core/src/config/printer.ts index 5634e79a6127..51b6a3964000 100644 --- a/packages/babel-core/src/config/printer.ts +++ b/packages/babel-core/src/config/printer.ts @@ -5,7 +5,7 @@ import type { Handler } from "gensync"; import type { OptionsAndDescriptors, UnloadedDescriptor, -} from "./config-descriptors"; +} from "./config-descriptors.ts"; // todo: Use flow enums when @babel/transform-flow-types supports it export const ChainFormatter = { diff --git a/packages/babel-core/src/config/resolve-targets-browser.ts b/packages/babel-core/src/config/resolve-targets-browser.ts index 60745dd7dca6..f93294d29814 100644 --- a/packages/babel-core/src/config/resolve-targets-browser.ts +++ b/packages/babel-core/src/config/resolve-targets-browser.ts @@ -1,4 +1,4 @@ -import type { ValidatedOptions } from "./validation/options"; +import type { ValidatedOptions } from "./validation/options.ts"; import getTargets, { type InputTargets, } from "@babel/helper-compilation-targets"; diff --git a/packages/babel-core/src/config/resolve-targets.ts b/packages/babel-core/src/config/resolve-targets.ts index 04c7fec4d1f5..6271c9f42dec 100644 --- a/packages/babel-core/src/config/resolve-targets.ts +++ b/packages/babel-core/src/config/resolve-targets.ts @@ -5,7 +5,7 @@ type nodeType = typeof import("./resolve-targets"); // exports of index-browser, since this file may be replaced at bundle time with index-browser. ({}) as any as browserType as nodeType; -import type { ValidatedOptions } from "./validation/options"; +import type { ValidatedOptions } from "./validation/options.ts"; import path from "path"; import getTargets, { type InputTargets, diff --git a/packages/babel-core/src/config/util.ts b/packages/babel-core/src/config/util.ts index acad9e3cfbbe..f8582b3f8833 100644 --- a/packages/babel-core/src/config/util.ts +++ b/packages/babel-core/src/config/util.ts @@ -1,4 +1,7 @@ -import type { ValidatedOptions, NormalizedOptions } from "./validation/options"; +import type { + ValidatedOptions, + NormalizedOptions, +} from "./validation/options.ts"; export function mergeOptions( target: ValidatedOptions, diff --git a/packages/babel-core/src/config/validation/option-assertions.ts b/packages/babel-core/src/config/validation/option-assertions.ts index 308573b66546..2f8a8ba4e321 100644 --- a/packages/babel-core/src/config/validation/option-assertions.ts +++ b/packages/babel-core/src/config/validation/option-assertions.ts @@ -21,11 +21,11 @@ import type { RootMode, TargetsListOrObject, AssumptionName, -} from "./options"; +} from "./options.ts"; -import { assumptionsNames } from "./options"; +import { assumptionsNames } from "./options.ts"; -export type { RootPath } from "./options"; +export type { RootPath } from "./options.ts"; export type ValidatorSet = { [name: string]: Validator; diff --git a/packages/babel-core/src/config/validation/options.ts b/packages/babel-core/src/config/validation/options.ts index e566711050de..e95efa1cbbf2 100644 --- a/packages/babel-core/src/config/validation/options.ts +++ b/packages/babel-core/src/config/validation/options.ts @@ -1,9 +1,9 @@ import type { InputTargets, Targets } from "@babel/helper-compilation-targets"; -import type { ConfigItem } from "../item"; -import type Plugin from "../plugin"; +import type { ConfigItem } from "../item.ts"; +import type Plugin from "../plugin.ts"; -import removed from "./removed"; +import removed from "./removed.ts"; import { msg, access, @@ -25,13 +25,17 @@ import { assertSourceType, assertTargets, assertAssumptions, -} from "./option-assertions"; -import type { ValidatorSet, Validator, OptionPath } from "./option-assertions"; -import type { UnloadedDescriptor } from "../config-descriptors"; -import type { PluginAPI } from "../helpers/config-api"; +} from "./option-assertions.ts"; +import type { + ValidatorSet, + Validator, + OptionPath, +} from "./option-assertions.ts"; +import type { UnloadedDescriptor } from "../config-descriptors.ts"; +import type { PluginAPI } from "../helpers/config-api.ts"; import type { ParserOptions } from "@babel/parser"; import type { GeneratorOptions } from "@babel/generator"; -import ConfigError from "../../errors/config-error"; +import ConfigError from "../../errors/config-error.ts"; const ROOT_VALIDATORS: ValidatorSet = { cwd: assertString as Validator, diff --git a/packages/babel-core/src/config/validation/plugins.ts b/packages/babel-core/src/config/validation/plugins.ts index 6baa4b94e493..08184364c20f 100644 --- a/packages/babel-core/src/config/validation/plugins.ts +++ b/packages/babel-core/src/config/validation/plugins.ts @@ -3,18 +3,18 @@ import { assertFunction, assertObject, msg, -} from "./option-assertions"; +} from "./option-assertions.ts"; import type { ValidatorSet, Validator, OptionPath, RootPath, -} from "./option-assertions"; +} from "./option-assertions.ts"; import type { ParserOptions } from "@babel/parser"; import type { Visitor } from "@babel/traverse"; -import type { ValidatedOptions } from "./options"; -import type { File, PluginAPI, PluginPass } from "../../index"; +import type { ValidatedOptions } from "./options.ts"; +import type { File, PluginAPI, PluginPass } from "../../index.ts"; // Note: The casts here are just meant to be static assertions to make sure // that the assertion functions actually assert that the value's type matches diff --git a/packages/babel-core/src/errors/config-error.ts b/packages/babel-core/src/errors/config-error.ts index 52efcb85079b..5fd13ab9ab9e 100644 --- a/packages/babel-core/src/errors/config-error.ts +++ b/packages/babel-core/src/errors/config-error.ts @@ -1,4 +1,7 @@ -import { injectVirtualStackFrame, expectedError } from "./rewrite-stack-trace"; +import { + injectVirtualStackFrame, + expectedError, +} from "./rewrite-stack-trace.ts"; export default class ConfigError extends Error { constructor(message: string, filename?: string) { diff --git a/packages/babel-core/src/gensync-utils/functional.ts b/packages/babel-core/src/gensync-utils/functional.ts index 38048ff8d902..dfda358ec2f3 100644 --- a/packages/babel-core/src/gensync-utils/functional.ts +++ b/packages/babel-core/src/gensync-utils/functional.ts @@ -1,6 +1,6 @@ import type { Handler } from "gensync"; -import { isAsync, waitFor } from "./async"; +import { isAsync, waitFor } from "./async.ts"; export function once(fn: () => Handler): () => Handler { let result: R; diff --git a/packages/babel-core/src/index.ts b/packages/babel-core/src/index.ts index cda0960aeb8d..93f87bec405f 100644 --- a/packages/babel-core/src/index.ts +++ b/packages/babel-core/src/index.ts @@ -10,12 +10,12 @@ if (!process.env.IS_PUBLISH) { export const version = PACKAGE_JSON.version; -export { default as File } from "./transformation/file/file"; -export type { default as PluginPass } from "./transformation/plugin-pass"; -export { default as buildExternalHelpers } from "./tools/build-external-helpers"; -export { resolvePlugin, resolvePreset } from "./config/files"; +export { default as File } from "./transformation/file/file.ts"; +export type { default as PluginPass } from "./transformation/plugin-pass.ts"; +export { default as buildExternalHelpers } from "./tools/build-external-helpers.ts"; +export { resolvePlugin, resolvePreset } from "./config/files/index.ts"; -export { getEnv } from "./config/helpers/environment"; +export { getEnv } from "./config/helpers/environment.ts"; // NOTE: Lazy re-exports aren't detected by the Node.js CJS-ESM interop. // These are handled by pluginInjectNodeReexportsHints in our babel.config.js @@ -29,7 +29,7 @@ export { createConfigItem, createConfigItemSync, createConfigItemAsync, -} from "./config"; +} from "./config/index.ts"; export { loadPartialConfig, @@ -37,8 +37,8 @@ export { loadPartialConfigAsync, loadOptions, loadOptionsAsync, -} from "./config"; -import { loadOptionsSync } from "./config"; +} from "./config/index.ts"; +import { loadOptionsSync } from "./config/index.ts"; export { loadOptionsSync }; export type { @@ -48,25 +48,25 @@ export type { PluginObject, PresetAPI, PresetObject, -} from "./config"; +} from "./config/index.ts"; export { transform, transformSync, transformAsync, type FileResult, -} from "./transform"; +} from "./transform.ts"; export { transformFile, transformFileSync, transformFileAsync, -} from "./transform-file"; +} from "./transform-file.ts"; export { transformFromAst, transformFromAstSync, transformFromAstAsync, -} from "./transform-ast"; -export { parse, parseSync, parseAsync } from "./parse"; +} from "./transform-ast.ts"; +export { parse, parseSync, parseAsync } from "./parse.ts"; /** * Recommended set of compilable extensions. Not used in @babel/core directly, but meant as @@ -82,7 +82,7 @@ export const DEFAULT_EXTENSIONS = Object.freeze([ ] as const); import Module from "module"; -import * as thisFile from "./index"; +import * as thisFile from "./index.ts"; if (USE_ESM) { if (!IS_STANDALONE) { // Pass this module to the CJS proxy, so that it can be synchronously accessed. diff --git a/packages/babel-core/src/parse.ts b/packages/babel-core/src/parse.ts index 1622ecaab608..05aae9a91771 100644 --- a/packages/babel-core/src/parse.ts +++ b/packages/babel-core/src/parse.ts @@ -1,13 +1,11 @@ import gensync, { type Handler } from "gensync"; -import loadConfig from "./config"; -import type { InputOptions } from "./config"; -import parser from "./parser"; -import type { ParseResult } from "./parser"; -import normalizeOptions from "./transformation/normalize-opts"; -import type { ValidatedOptions } from "./config/validation/options"; +import loadConfig, { type InputOptions } from "./config/index.ts"; +import parser, { type ParseResult } from "./parser/index.ts"; +import normalizeOptions from "./transformation/normalize-opts.ts"; +import type { ValidatedOptions } from "./config/validation/options.ts"; -import { beginHiddenCallStack } from "./errors/rewrite-stack-trace"; +import { beginHiddenCallStack } from "./errors/rewrite-stack-trace.ts"; type FileParseCallback = { (err: Error, ast: null): void; diff --git a/packages/babel-core/src/parser/index.ts b/packages/babel-core/src/parser/index.ts index 3fcb2fe9ead6..b788b9527d45 100644 --- a/packages/babel-core/src/parser/index.ts +++ b/packages/babel-core/src/parser/index.ts @@ -1,8 +1,8 @@ import type { Handler } from "gensync"; import { parse } from "@babel/parser"; import { codeFrameColumns } from "@babel/code-frame"; -import generateMissingPluginMessage from "./util/missing-plugin-helper"; -import type { PluginPasses } from "../config"; +import generateMissingPluginMessage from "./util/missing-plugin-helper.ts"; +import type { PluginPasses } from "../config/index.ts"; export type ParseResult = ReturnType; diff --git a/packages/babel-core/src/tools/build-external-helpers.ts b/packages/babel-core/src/tools/build-external-helpers.ts index 0c9f61e23bc3..93567eced5c2 100644 --- a/packages/babel-core/src/tools/build-external-helpers.ts +++ b/packages/babel-core/src/tools/build-external-helpers.ts @@ -23,7 +23,7 @@ import { variableDeclarator, } from "@babel/types"; import type * as t from "@babel/types"; -import File from "../transformation/file/file"; +import File from "../transformation/file/file.ts"; import type { PublicReplacements } from "@babel/template/src/options"; // Wrapped to avoid wasting time parsing this when almost no-one uses diff --git a/packages/babel-core/src/transform-ast.ts b/packages/babel-core/src/transform-ast.ts index dbe9d7eea9d8..e7268c7276bd 100644 --- a/packages/babel-core/src/transform-ast.ts +++ b/packages/babel-core/src/transform-ast.ts @@ -1,13 +1,13 @@ import gensync, { type Handler } from "gensync"; -import loadConfig from "./config"; -import type { InputOptions, ResolvedConfig } from "./config"; -import { run } from "./transformation"; +import loadConfig from "./config/index.ts"; +import type { InputOptions, ResolvedConfig } from "./config/index.ts"; +import { run } from "./transformation/index.ts"; import type * as t from "@babel/types"; -import { beginHiddenCallStack } from "./errors/rewrite-stack-trace"; +import { beginHiddenCallStack } from "./errors/rewrite-stack-trace.ts"; -import type { FileResult, FileResultCallback } from "./transformation"; +import type { FileResult, FileResultCallback } from "./transformation/index.ts"; type AstRoot = t.File | t.Program; type TransformFromAst = { diff --git a/packages/babel-core/src/transform-file.ts b/packages/babel-core/src/transform-file.ts index 444c108846d7..6bc2f8369d45 100644 --- a/packages/babel-core/src/transform-file.ts +++ b/packages/babel-core/src/transform-file.ts @@ -1,10 +1,10 @@ import gensync, { type Handler } from "gensync"; -import loadConfig from "./config"; -import type { InputOptions, ResolvedConfig } from "./config"; -import { run } from "./transformation"; -import type { FileResult, FileResultCallback } from "./transformation"; -import * as fs from "./gensync-utils/fs"; +import loadConfig from "./config/index.ts"; +import type { InputOptions, ResolvedConfig } from "./config/index.ts"; +import { run } from "./transformation/index.ts"; +import type { FileResult, FileResultCallback } from "./transformation/index.ts"; +import * as fs from "./gensync-utils/fs.ts"; type transformFileBrowserType = typeof import("./transform-file-browser"); type transformFileType = typeof import("./transform-file"); diff --git a/packages/babel-core/src/transform.ts b/packages/babel-core/src/transform.ts index 9a3f7c815d09..ef8bd12e4cdd 100644 --- a/packages/babel-core/src/transform.ts +++ b/packages/babel-core/src/transform.ts @@ -1,13 +1,13 @@ import gensync, { type Handler } from "gensync"; -import loadConfig from "./config"; -import type { InputOptions, ResolvedConfig } from "./config"; -import { run } from "./transformation"; +import loadConfig from "./config/index.ts"; +import type { InputOptions, ResolvedConfig } from "./config/index.ts"; +import { run } from "./transformation/index.ts"; -import type { FileResult, FileResultCallback } from "./transformation"; -import { beginHiddenCallStack } from "./errors/rewrite-stack-trace"; +import type { FileResult, FileResultCallback } from "./transformation/index.ts"; +import { beginHiddenCallStack } from "./errors/rewrite-stack-trace.ts"; -export type { FileResult } from "./transformation"; +export type { FileResult } from "./transformation/index.ts"; type Transform = { (code: string, callback: FileResultCallback): void; diff --git a/packages/babel-core/src/transformation/block-hoist-plugin.ts b/packages/babel-core/src/transformation/block-hoist-plugin.ts index 07394a8a5ada..0ef2567d39e2 100644 --- a/packages/babel-core/src/transformation/block-hoist-plugin.ts +++ b/packages/babel-core/src/transformation/block-hoist-plugin.ts @@ -1,7 +1,7 @@ import traverse from "@babel/traverse"; import type { Statement } from "@babel/types"; -import type { PluginObject } from "../config"; -import Plugin from "../config/plugin"; +import type { PluginObject } from "../config/index.ts"; +import Plugin from "../config/plugin.ts"; let LOADED_PLUGIN: Plugin | void; diff --git a/packages/babel-core/src/transformation/file/file.ts b/packages/babel-core/src/transformation/file/file.ts index 0a7b370f2712..48d125394b26 100644 --- a/packages/babel-core/src/transformation/file/file.ts +++ b/packages/babel-core/src/transformation/file/file.ts @@ -8,7 +8,7 @@ import type * as t from "@babel/types"; import { getModuleName } from "@babel/helper-module-transforms"; import semver from "semver"; -import type { NormalizedFile } from "../normalize-file"; +import type { NormalizedFile } from "../normalize-file.ts"; const errorVisitor: Visitor<{ loc: NodeLocation["loc"] | null }> = { enter(path, state) { diff --git a/packages/babel-core/src/transformation/file/generate.ts b/packages/babel-core/src/transformation/file/generate.ts index 9312c4ec4269..070b4e4565f7 100644 --- a/packages/babel-core/src/transformation/file/generate.ts +++ b/packages/babel-core/src/transformation/file/generate.ts @@ -1,10 +1,10 @@ -import type { PluginPasses } from "../../config"; +import type { PluginPasses } from "../../config/index.ts"; import convertSourceMap from "convert-source-map"; import type { GeneratorResult } from "@babel/generator"; import generate from "@babel/generator"; -import type File from "./file"; -import mergeSourceMap from "./merge-map"; +import type File from "./file.ts"; +import mergeSourceMap from "./merge-map.ts"; export default function generateCode( pluginPasses: PluginPasses, diff --git a/packages/babel-core/src/transformation/index.ts b/packages/babel-core/src/transformation/index.ts index 264aab670446..6da480314311 100644 --- a/packages/babel-core/src/transformation/index.ts +++ b/packages/babel-core/src/transformation/index.ts @@ -4,17 +4,17 @@ import type { GeneratorResult } from "@babel/generator"; import type { Handler } from "gensync"; -import type { ResolvedConfig, Plugin, PluginPasses } from "../config"; +import type { ResolvedConfig, Plugin, PluginPasses } from "../config/index.ts"; -import PluginPass from "./plugin-pass"; -import loadBlockHoistPlugin from "./block-hoist-plugin"; -import normalizeOptions from "./normalize-opts"; -import normalizeFile from "./normalize-file"; +import PluginPass from "./plugin-pass.ts"; +import loadBlockHoistPlugin from "./block-hoist-plugin.ts"; +import normalizeOptions from "./normalize-opts.ts"; +import normalizeFile from "./normalize-file.ts"; -import generateCode from "./file/generate"; -import type File from "./file/file"; +import generateCode from "./file/generate.ts"; +import type File from "./file/file.ts"; -import { flattenToSet } from "../config/helpers/deep-array"; +import { flattenToSet } from "../config/helpers/deep-array.ts"; export type FileResultCallback = { (err: Error, file: null): void; diff --git a/packages/babel-core/src/transformation/normalize-file.ts b/packages/babel-core/src/transformation/normalize-file.ts index 979ebded6136..8dc175dc731b 100644 --- a/packages/babel-core/src/transformation/normalize-file.ts +++ b/packages/babel-core/src/transformation/normalize-file.ts @@ -4,12 +4,12 @@ import buildDebug from "debug"; import type { Handler } from "gensync"; import { file, traverseFast } from "@babel/types"; import type * as t from "@babel/types"; -import type { PluginPasses } from "../config"; +import type { PluginPasses } from "../config/index.ts"; import convertSourceMap from "convert-source-map"; import type { SourceMapConverter as Converter } from "convert-source-map"; -import File from "./file/file"; -import parser from "../parser"; -import cloneDeep from "./util/clone-deep"; +import File from "./file/file.ts"; +import parser from "../parser/index.ts"; +import cloneDeep from "./util/clone-deep.ts"; const debug = buildDebug("babel:transform:file"); diff --git a/packages/babel-core/src/transformation/normalize-opts.ts b/packages/babel-core/src/transformation/normalize-opts.ts index bf6cda2d5193..571d1705530d 100644 --- a/packages/babel-core/src/transformation/normalize-opts.ts +++ b/packages/babel-core/src/transformation/normalize-opts.ts @@ -1,5 +1,5 @@ import path from "path"; -import type { ResolvedConfig } from "../config"; +import type { ResolvedConfig } from "../config/index.ts"; export default function normalizeOptions(config: ResolvedConfig): {} { const { diff --git a/packages/babel-core/src/transformation/plugin-pass.ts b/packages/babel-core/src/transformation/plugin-pass.ts index 0293c5e79523..d9206f76c93c 100644 --- a/packages/babel-core/src/transformation/plugin-pass.ts +++ b/packages/babel-core/src/transformation/plugin-pass.ts @@ -1,5 +1,5 @@ -import type File from "./file/file"; -import type { NodeLocation } from "./file/file"; +import type File from "./file/file.ts"; +import type { NodeLocation } from "./file/file.ts"; export default class PluginPass { _map: Map = new Map(); diff --git a/packages/babel-generator/src/buffer.ts b/packages/babel-generator/src/buffer.ts index 3f1dca2c73a0..6e33e7bb52a3 100644 --- a/packages/babel-generator/src/buffer.ts +++ b/packages/babel-generator/src/buffer.ts @@ -1,4 +1,4 @@ -import type SourceMap from "./source-map"; +import type SourceMap from "./source-map.ts"; import * as charcodes from "charcodes"; export type Pos = { diff --git a/packages/babel-generator/src/generators/base.ts b/packages/babel-generator/src/generators/base.ts index 2b9f3abf7ce9..15771f2ea3bc 100644 --- a/packages/babel-generator/src/generators/base.ts +++ b/packages/babel-generator/src/generators/base.ts @@ -1,4 +1,4 @@ -import type Printer from "../printer"; +import type Printer from "../printer.ts"; import type * as t from "@babel/types"; export function File(this: Printer, node: t.File) { diff --git a/packages/babel-generator/src/generators/classes.ts b/packages/babel-generator/src/generators/classes.ts index af8cf4bdc3a0..5e0e911518b4 100644 --- a/packages/babel-generator/src/generators/classes.ts +++ b/packages/babel-generator/src/generators/classes.ts @@ -1,4 +1,4 @@ -import type Printer from "../printer"; +import type Printer from "../printer.ts"; import { isExportDefaultDeclaration, isExportNamedDeclaration, diff --git a/packages/babel-generator/src/generators/expressions.ts b/packages/babel-generator/src/generators/expressions.ts index 62efc895e571..b8af049f9d71 100644 --- a/packages/babel-generator/src/generators/expressions.ts +++ b/packages/babel-generator/src/generators/expressions.ts @@ -1,4 +1,4 @@ -import type Printer from "../printer"; +import type Printer from "../printer.ts"; import { isCallExpression, isLiteral, @@ -6,7 +6,7 @@ import { isNewExpression, } from "@babel/types"; import type * as t from "@babel/types"; -import * as n from "../node"; +import * as n from "../node/index.ts"; export function UnaryExpression(this: Printer, node: t.UnaryExpression) { const { operator } = node; diff --git a/packages/babel-generator/src/generators/flow.ts b/packages/babel-generator/src/generators/flow.ts index eda60bae7244..73d0b7a88dad 100644 --- a/packages/babel-generator/src/generators/flow.ts +++ b/packages/babel-generator/src/generators/flow.ts @@ -1,7 +1,7 @@ -import type Printer from "../printer"; +import type Printer from "../printer.ts"; import { isDeclareExportDeclaration, isStatement } from "@babel/types"; import type * as t from "@babel/types"; -import { ExportAllDeclaration } from "./modules"; +import { ExportAllDeclaration } from "./modules.ts"; export function AnyTypeAnnotation(this: Printer) { this.word("any"); @@ -474,7 +474,7 @@ export function NullableTypeAnnotation( export { NumericLiteral as NumberLiteralTypeAnnotation, StringLiteral as StringLiteralTypeAnnotation, -} from "./types"; +} from "./types.ts"; export function NumberTypeAnnotation(this: Printer) { this.word("number"); diff --git a/packages/babel-generator/src/generators/index.ts b/packages/babel-generator/src/generators/index.ts index 630b5cb834fa..4d52921b06d3 100644 --- a/packages/babel-generator/src/generators/index.ts +++ b/packages/babel-generator/src/generators/index.ts @@ -1,11 +1,11 @@ -export * from "./template-literals"; -export * from "./expressions"; -export * from "./statements"; -export * from "./classes"; -export * from "./methods"; -export * from "./modules"; -export * from "./types"; -export * from "./flow"; -export * from "./base"; -export * from "./jsx"; -export * from "./typescript"; +export * from "./template-literals.ts"; +export * from "./expressions.ts"; +export * from "./statements.ts"; +export * from "./classes.ts"; +export * from "./methods.ts"; +export * from "./modules.ts"; +export * from "./types.ts"; +export * from "./flow.ts"; +export * from "./base.ts"; +export * from "./jsx.ts"; +export * from "./typescript.ts"; diff --git a/packages/babel-generator/src/generators/jsx.ts b/packages/babel-generator/src/generators/jsx.ts index b037c477613a..63caec2dd081 100644 --- a/packages/babel-generator/src/generators/jsx.ts +++ b/packages/babel-generator/src/generators/jsx.ts @@ -1,4 +1,4 @@ -import type Printer from "../printer"; +import type Printer from "../printer.ts"; import type * as t from "@babel/types"; export function JSXAttribute(this: Printer, node: t.JSXAttribute) { diff --git a/packages/babel-generator/src/generators/methods.ts b/packages/babel-generator/src/generators/methods.ts index 28b58dfa96e6..9a6fe3ccd34e 100644 --- a/packages/babel-generator/src/generators/methods.ts +++ b/packages/babel-generator/src/generators/methods.ts @@ -1,4 +1,4 @@ -import type Printer from "../printer"; +import type Printer from "../printer.ts"; import type * as t from "@babel/types"; import { isIdentifier } from "@babel/types"; import type { NodePath } from "@babel/traverse"; diff --git a/packages/babel-generator/src/generators/modules.ts b/packages/babel-generator/src/generators/modules.ts index e5f9b6816629..03bdeb0bbcdb 100644 --- a/packages/babel-generator/src/generators/modules.ts +++ b/packages/babel-generator/src/generators/modules.ts @@ -1,4 +1,4 @@ -import type Printer from "../printer"; +import type Printer from "../printer.ts"; import { isClassDeclaration, isExportDefaultSpecifier, diff --git a/packages/babel-generator/src/generators/statements.ts b/packages/babel-generator/src/generators/statements.ts index e6b7a96a011a..9decac290ff7 100644 --- a/packages/babel-generator/src/generators/statements.ts +++ b/packages/babel-generator/src/generators/statements.ts @@ -1,4 +1,4 @@ -import type Printer from "../printer"; +import type Printer from "../printer.ts"; import { isFor, isForStatement, diff --git a/packages/babel-generator/src/generators/template-literals.ts b/packages/babel-generator/src/generators/template-literals.ts index 694947adba00..1ec55f6d6bb2 100644 --- a/packages/babel-generator/src/generators/template-literals.ts +++ b/packages/babel-generator/src/generators/template-literals.ts @@ -1,4 +1,4 @@ -import type Printer from "../printer"; +import type Printer from "../printer.ts"; import type * as t from "@babel/types"; export function TaggedTemplateExpression( diff --git a/packages/babel-generator/src/generators/types.ts b/packages/babel-generator/src/generators/types.ts index 75f698050831..31ba6a47b8af 100644 --- a/packages/babel-generator/src/generators/types.ts +++ b/packages/babel-generator/src/generators/types.ts @@ -1,4 +1,4 @@ -import type Printer from "../printer"; +import type Printer from "../printer.ts"; import { isAssignmentPattern, isIdentifier } from "@babel/types"; import type * as t from "@babel/types"; import jsesc from "jsesc"; diff --git a/packages/babel-generator/src/generators/typescript.ts b/packages/babel-generator/src/generators/typescript.ts index bd438c5c054c..8912fc6bdfa1 100644 --- a/packages/babel-generator/src/generators/typescript.ts +++ b/packages/babel-generator/src/generators/typescript.ts @@ -1,4 +1,4 @@ -import type Printer from "../printer"; +import type Printer from "../printer.ts"; import type * as t from "@babel/types"; import type { NodePath } from "@babel/traverse"; diff --git a/packages/babel-generator/src/index.ts b/packages/babel-generator/src/index.ts index 8b797aa5f2e4..4b67e26bc4a4 100644 --- a/packages/babel-generator/src/index.ts +++ b/packages/babel-generator/src/index.ts @@ -1,8 +1,8 @@ -import SourceMap from "./source-map"; -import Printer from "./printer"; +import SourceMap from "./source-map.ts"; +import Printer from "./printer.ts"; import type * as t from "@babel/types"; import type { Opts as jsescOptions } from "jsesc"; -import type { Format } from "./printer"; +import type { Format } from "./printer.ts"; import type { RecordAndTuplePluginOptions, PipelineOperatorPluginOptions, diff --git a/packages/babel-generator/src/node/index.ts b/packages/babel-generator/src/node/index.ts index 079a311ff26c..04c6275b11a0 100644 --- a/packages/babel-generator/src/node/index.ts +++ b/packages/babel-generator/src/node/index.ts @@ -1,5 +1,5 @@ -import * as whitespace from "./whitespace"; -import * as parens from "./parentheses"; +import * as whitespace from "./whitespace.ts"; +import * as parens from "./parentheses.ts"; import { FLIPPED_ALIAS_KEYS, isCallExpression, @@ -9,7 +9,7 @@ import { } from "@babel/types"; import type * as t from "@babel/types"; -import type { WhitespaceFlag } from "./whitespace"; +import type { WhitespaceFlag } from "./whitespace.ts"; export type NodeHandlers = { [K in string]?: ( diff --git a/packages/babel-generator/src/node/whitespace.ts b/packages/babel-generator/src/node/whitespace.ts index a58427a94c0a..2c7c05464fd9 100644 --- a/packages/babel-generator/src/node/whitespace.ts +++ b/packages/babel-generator/src/node/whitespace.ts @@ -16,7 +16,7 @@ import { } from "@babel/types"; import * as charCodes from "charcodes"; -import type { NodeHandlers } from "./index"; +import type { NodeHandlers } from "./index.ts"; import type * as t from "@babel/types"; diff --git a/packages/babel-generator/src/printer.ts b/packages/babel-generator/src/printer.ts index db319c7a0f33..92157f5c3fe0 100644 --- a/packages/babel-generator/src/printer.ts +++ b/packages/babel-generator/src/printer.ts @@ -1,6 +1,6 @@ -import Buffer, { type Pos } from "./buffer"; -import type { Loc } from "./buffer"; -import * as n from "./node"; +import Buffer, { type Pos } from "./buffer.ts"; +import type { Loc } from "./buffer.ts"; +import * as n from "./node/index.ts"; import type * as t from "@babel/types"; import { isFunction, @@ -15,8 +15,8 @@ import type { } from "@babel/parser"; import type { Opts as jsescOptions } from "jsesc"; -import * as generatorFunctions from "./generators"; -import type SourceMap from "./source-map"; +import * as generatorFunctions from "./generators/index.ts"; +import type SourceMap from "./source-map.ts"; import * as charCodes from "charcodes"; import type { TraceMap } from "@jridgewell/trace-mapping"; diff --git a/packages/babel-helper-builder-binary-assignment-operator-visitor/src/index.ts b/packages/babel-helper-builder-binary-assignment-operator-visitor/src/index.ts index 27297483da7f..2aabff9c075d 100644 --- a/packages/babel-helper-builder-binary-assignment-operator-visitor/src/index.ts +++ b/packages/babel-helper-builder-binary-assignment-operator-visitor/src/index.ts @@ -2,7 +2,7 @@ import { assignmentExpression, sequenceExpression } from "@babel/types"; import type { Visitor } from "@babel/traverse"; import type * as t from "@babel/types"; -import explode from "./explode-assignable-expression"; +import explode from "./explode-assignable-expression.ts"; export default function (opts: { build: ( diff --git a/packages/babel-helper-compilation-targets/src/debug.ts b/packages/babel-helper-compilation-targets/src/debug.ts index 1a8aa6f5f1ea..31413354997a 100644 --- a/packages/babel-helper-compilation-targets/src/debug.ts +++ b/packages/babel-helper-compilation-targets/src/debug.ts @@ -1,11 +1,11 @@ import semver from "semver"; -import { prettifyVersion } from "./pretty"; +import { prettifyVersion } from "./pretty.ts"; import { semverify, isUnreleasedVersion, getLowestImplementedVersion, -} from "./utils"; -import type { Target, Targets } from "./types"; +} from "./utils.ts"; +import type { Target, Targets } from "./types.ts"; export function getInclusionReasons( item: string, diff --git a/packages/babel-helper-compilation-targets/src/filter-items.ts b/packages/babel-helper-compilation-targets/src/filter-items.ts index 7cb5dadf281d..c74337d3afe5 100644 --- a/packages/babel-helper-compilation-targets/src/filter-items.ts +++ b/packages/babel-helper-compilation-targets/src/filter-items.ts @@ -2,12 +2,12 @@ import semver from "semver"; import pluginsCompatData from "@babel/compat-data/plugins"; -import type { Targets } from "./types"; +import type { Targets } from "./types.ts"; import { getLowestImplementedVersion, isUnreleasedVersion, semverify, -} from "./utils"; +} from "./utils.ts"; export function targetsSupported(target: Targets, support: Targets) { const targetEnvironments = Object.keys(target) as Array; diff --git a/packages/babel-helper-compilation-targets/src/index.ts b/packages/babel-helper-compilation-targets/src/index.ts index 667704f6af41..323d9695e7fe 100644 --- a/packages/babel-helper-compilation-targets/src/index.ts +++ b/packages/babel-helper-compilation-targets/src/index.ts @@ -9,10 +9,10 @@ import { isUnreleasedVersion, getLowestUnreleased, getHighestUnreleased, -} from "./utils"; +} from "./utils.ts"; import { OptionValidator } from "@babel/helper-validator-option"; -import { browserNameMap } from "./targets"; -import { TargetNames } from "./options"; +import { browserNameMap } from "./targets.ts"; +import { TargetNames } from "./options.ts"; import type { Target, Targets, @@ -20,14 +20,14 @@ import type { Browsers, BrowserslistBrowserName, TargetsTuple, -} from "./types"; +} from "./types.ts"; export type { Target, Targets, InputTargets }; -export { prettifyTargets } from "./pretty"; -export { getInclusionReasons } from "./debug"; -export { default as filterItems, isRequired } from "./filter-items"; -export { unreleasedLabels } from "./targets"; +export { prettifyTargets } from "./pretty.ts"; +export { getInclusionReasons } from "./debug.ts"; +export { default as filterItems, isRequired } from "./filter-items.ts"; +export { unreleasedLabels } from "./targets.ts"; export { TargetNames }; const ESM_SUPPORT = browserModulesData["es6.module"]; diff --git a/packages/babel-helper-compilation-targets/src/pretty.ts b/packages/babel-helper-compilation-targets/src/pretty.ts index 1902788bdaa4..50eec84d7bdf 100644 --- a/packages/babel-helper-compilation-targets/src/pretty.ts +++ b/packages/babel-helper-compilation-targets/src/pretty.ts @@ -1,6 +1,6 @@ import semver from "semver"; -import { unreleasedLabels } from "./targets"; -import type { Targets, Target } from "./types"; +import { unreleasedLabels } from "./targets.ts"; +import type { Targets, Target } from "./types.ts"; export function prettifyVersion(version: string) { if (typeof version !== "string") { diff --git a/packages/babel-helper-compilation-targets/src/types.d.ts b/packages/babel-helper-compilation-targets/src/types.d.ts index 5125720a1e67..7ea98caf2e22 100644 --- a/packages/babel-helper-compilation-targets/src/types.d.ts +++ b/packages/babel-helper-compilation-targets/src/types.d.ts @@ -34,4 +34,4 @@ export type InputTargets = { esmodules?: boolean | "intersect"; } & Targets; -export type { BrowserslistBrowserName } from "./targets"; +export type { BrowserslistBrowserName } from "./targets.ts"; diff --git a/packages/babel-helper-compilation-targets/src/utils.ts b/packages/babel-helper-compilation-targets/src/utils.ts index 8643538158f3..e04bdada80ad 100644 --- a/packages/babel-helper-compilation-targets/src/utils.ts +++ b/packages/babel-helper-compilation-targets/src/utils.ts @@ -1,7 +1,7 @@ import semver from "semver"; import { OptionValidator } from "@babel/helper-validator-option"; -import { unreleasedLabels } from "./targets"; -import type { Target, Targets } from "./types"; +import { unreleasedLabels } from "./targets.ts"; +import type { Target, Targets } from "./types.ts"; const versionRegExp = /^(\d+|\d+.\d+)$/; diff --git a/packages/babel-helper-create-class-features-plugin/src/features.ts b/packages/babel-helper-create-class-features-plugin/src/features.ts index b4ce9c6818fe..cfcaee66c0b9 100644 --- a/packages/babel-helper-create-class-features-plugin/src/features.ts +++ b/packages/babel-helper-create-class-features-plugin/src/features.ts @@ -1,6 +1,6 @@ import type { File, types as t } from "@babel/core"; import type { NodePath } from "@babel/traverse"; -import { hasOwnDecorators } from "./decorators"; +import { hasOwnDecorators } from "./decorators.ts"; export const FEATURES = Object.freeze( process.env.BABEL_8_BREAKING diff --git a/packages/babel-helper-create-class-features-plugin/src/fields.ts b/packages/babel-helper-create-class-features-plugin/src/fields.ts index 1e55ed8e2475..e9bdc83e3b08 100644 --- a/packages/babel-helper-create-class-features-plugin/src/fields.ts +++ b/packages/babel-helper-create-class-features-plugin/src/fields.ts @@ -12,7 +12,7 @@ import optimiseCall from "@babel/helper-optimise-call-expression"; import annotateAsPure from "@babel/helper-annotate-as-pure"; import { skipTransparentExprWrapperNodes } from "@babel/helper-skip-transparent-expression-wrappers"; -import * as ts from "./typescript"; +import * as ts from "./typescript.ts"; interface PrivateNameMetadata { id: t.Identifier; diff --git a/packages/babel-helper-create-class-features-plugin/src/index.ts b/packages/babel-helper-create-class-features-plugin/src/index.ts index 963dfccd80f9..42456d869458 100644 --- a/packages/babel-helper-create-class-features-plugin/src/index.ts +++ b/packages/babel-helper-create-class-features-plugin/src/index.ts @@ -12,12 +12,17 @@ import { transformPrivateNamesUsage, buildFieldsInitNodes, buildCheckInRHS, -} from "./fields"; -import type { PropPath } from "./fields"; -import { buildDecoratedClass, hasDecorators } from "./decorators"; -import { injectInitialization, extractComputedKeys } from "./misc"; -import { enableFeature, FEATURES, isLoose, shouldTransform } from "./features"; -import { assertFieldTransformed } from "./typescript"; +} from "./fields.ts"; +import type { PropPath } from "./fields.ts"; +import { buildDecoratedClass, hasDecorators } from "./decorators.ts"; +import { injectInitialization, extractComputedKeys } from "./misc.ts"; +import { + enableFeature, + FEATURES, + isLoose, + shouldTransform, +} from "./features.ts"; +import { assertFieldTransformed } from "./typescript.ts"; export { FEATURES, enableFeature, injectInitialization, buildCheckInRHS }; diff --git a/packages/babel-helper-create-regexp-features-plugin/src/index.ts b/packages/babel-helper-create-regexp-features-plugin/src/index.ts index a7405db5869e..aed56e1491dc 100644 --- a/packages/babel-helper-create-regexp-features-plugin/src/index.ts +++ b/packages/babel-helper-create-regexp-features-plugin/src/index.ts @@ -11,8 +11,12 @@ import { enableFeature, runtimeKey, hasFeature, -} from "./features"; -import { generateRegexpuOptions, canSkipRegexpu, transformFlags } from "./util"; +} from "./features.ts"; +import { + generateRegexpuOptions, + canSkipRegexpu, + transformFlags, +} from "./util.ts"; const versionKey = "@babel/plugin-regexp-features/version"; diff --git a/packages/babel-helper-create-regexp-features-plugin/src/util.ts b/packages/babel-helper-create-regexp-features-plugin/src/util.ts index 94a00cc66365..738bcea21a1a 100644 --- a/packages/babel-helper-create-regexp-features-plugin/src/util.ts +++ b/packages/babel-helper-create-regexp-features-plugin/src/util.ts @@ -1,5 +1,5 @@ import type { types as t } from "@babel/core"; -import { FEATURES, hasFeature } from "./features"; +import { FEATURES, hasFeature } from "./features.ts"; import type { RegexpuOptions } from "regexpu-core"; diff --git a/packages/babel-helper-member-expression-to-functions/src/index.ts b/packages/babel-helper-member-expression-to-functions/src/index.ts index 3a1e0d7d1ff3..627a80dcf19f 100644 --- a/packages/babel-helper-member-expression-to-functions/src/index.ts +++ b/packages/babel-helper-member-expression-to-functions/src/index.ts @@ -22,7 +22,7 @@ import { updateExpression, } from "@babel/types"; import type * as t from "@babel/types"; -import { willPathCastToBoolean } from "./util"; +import { willPathCastToBoolean } from "./util.ts"; class AssignmentMemoiser { private _map: WeakMap; diff --git a/packages/babel-helper-module-imports/src/import-injector.ts b/packages/babel-helper-module-imports/src/import-injector.ts index 7e439c44accd..2d80840b58fa 100644 --- a/packages/babel-helper-module-imports/src/import-injector.ts +++ b/packages/babel-helper-module-imports/src/import-injector.ts @@ -4,8 +4,8 @@ import type * as t from "@babel/types"; import type { NodePath, Scope } from "@babel/traverse"; import type { File } from "@babel/core"; -import ImportBuilder from "./import-builder"; -import isModule from "./is-module"; +import ImportBuilder from "./import-builder.ts"; +import isModule from "./is-module.ts"; export type ImportOptions = { /** diff --git a/packages/babel-helper-module-imports/src/index.ts b/packages/babel-helper-module-imports/src/index.ts index 183aaabd6fe0..a04ea3112d22 100644 --- a/packages/babel-helper-module-imports/src/index.ts +++ b/packages/babel-helper-module-imports/src/index.ts @@ -1,10 +1,10 @@ -import ImportInjector, { type ImportOptions } from "./import-injector"; +import ImportInjector, { type ImportOptions } from "./import-injector.ts"; import type { NodePath } from "@babel/traverse"; import type * as t from "@babel/types"; export { ImportInjector }; -export { default as isModule } from "./is-module"; +export { default as isModule } from "./is-module.ts"; export function addDefault( path: NodePath, diff --git a/packages/babel-helper-module-transforms/src/index.ts b/packages/babel-helper-module-transforms/src/index.ts index 898bba741b0b..6d45ffaba301 100644 --- a/packages/babel-helper-module-transforms/src/index.ts +++ b/packages/babel-helper-module-transforms/src/index.ts @@ -3,20 +3,20 @@ import { template, types as t } from "@babel/core"; import { isModule } from "@babel/helper-module-imports"; -import rewriteThis from "./rewrite-this"; -import rewriteLiveReferences from "./rewrite-live-references"; +import rewriteThis from "./rewrite-this.ts"; +import rewriteLiveReferences from "./rewrite-live-references.ts"; import normalizeModuleAndLoadMetadata, { hasExports, isSideEffectImport, validateImportInteropOption, -} from "./normalize-and-load-metadata"; +} from "./normalize-and-load-metadata.ts"; import type { ImportInterop, InteropType, Lazy, ModuleMetadata, SourceModuleMetadata, -} from "./normalize-and-load-metadata"; +} from "./normalize-and-load-metadata.ts"; import type { NodePath } from "@babel/traverse"; const { @@ -35,21 +35,21 @@ const { variableDeclarator, } = t; -export { buildDynamicImport } from "./dynamic-import"; +export { buildDynamicImport } from "./dynamic-import.ts"; if (!process.env.BABEL_8_BREAKING) { if (!USE_ESM) { if (!IS_STANDALONE) { // eslint-disable-next-line no-restricted-globals exports.getDynamicImportSource = - // eslint-disable-next-line no-restricted-globals + // eslint-disable-next-line no-restricted-globals, import/extensions require("./dynamic-import").getDynamicImportSource; } } } -export { default as getModuleName } from "./get-module-name"; -export type { PluginOptions } from "./get-module-name"; +export { default as getModuleName } from "./get-module-name.ts"; +export type { PluginOptions } from "./get-module-name.ts"; export { hasExports, isSideEffectImport, isModule, rewriteThis }; diff --git a/packages/babel-helper-module-transforms/src/rewrite-live-references.ts b/packages/babel-helper-module-transforms/src/rewrite-live-references.ts index d94f41531e03..a9b7cce49c6c 100644 --- a/packages/babel-helper-module-transforms/src/rewrite-live-references.ts +++ b/packages/babel-helper-module-transforms/src/rewrite-live-references.ts @@ -3,7 +3,7 @@ import { template, types as t } from "@babel/core"; import type { NodePath, Visitor, Scope } from "@babel/traverse"; import simplifyAccess from "@babel/helper-simple-access"; -import type { ModuleMetadata } from "./normalize-and-load-metadata"; +import type { ModuleMetadata } from "./normalize-and-load-metadata.ts"; const { assignmentExpression, diff --git a/packages/babel-helper-transform-fixture-test-runner/src/index.ts b/packages/babel-helper-transform-fixture-test-runner/src/index.ts index 33f8b1d6c649..528a08ebb3f5 100644 --- a/packages/babel-helper-transform-fixture-test-runner/src/index.ts +++ b/packages/babel-helper-transform-fixture-test-runner/src/index.ts @@ -13,7 +13,7 @@ import { type TaskOptions, } from "@babel/helper-fixtures"; import { codeFrameColumns } from "@babel/code-frame"; -import * as helpers from "./helpers"; +import * as helpers from "./helpers.ts"; import assert from "assert"; import fs from "fs"; import path from "path"; diff --git a/packages/babel-helper-validator-identifier/src/index.ts b/packages/babel-helper-validator-identifier/src/index.ts index c0979aba5489..d3c4ac26c5bd 100644 --- a/packages/babel-helper-validator-identifier/src/index.ts +++ b/packages/babel-helper-validator-identifier/src/index.ts @@ -2,11 +2,11 @@ export { isIdentifierName, isIdentifierChar, isIdentifierStart, -} from "./identifier"; +} from "./identifier.ts"; export { isReservedWord, isStrictBindOnlyReservedWord, isStrictBindReservedWord, isStrictReservedWord, isKeyword, -} from "./keyword"; +} from "./keyword.ts"; diff --git a/packages/babel-helper-validator-option/src/index.ts b/packages/babel-helper-validator-option/src/index.ts index e0326669962e..aff786400f87 100644 --- a/packages/babel-helper-validator-option/src/index.ts +++ b/packages/babel-helper-validator-option/src/index.ts @@ -1,2 +1,2 @@ -export { OptionValidator } from "./validator"; -export { findSuggestion } from "./find-suggestion"; +export { OptionValidator } from "./validator.ts"; +export { findSuggestion } from "./find-suggestion.ts"; diff --git a/packages/babel-helper-validator-option/src/validator.ts b/packages/babel-helper-validator-option/src/validator.ts index f698df93c749..661e8330e7c2 100644 --- a/packages/babel-helper-validator-option/src/validator.ts +++ b/packages/babel-helper-validator-option/src/validator.ts @@ -1,4 +1,4 @@ -import { findSuggestion } from "./find-suggestion"; +import { findSuggestion } from "./find-suggestion.ts"; export class OptionValidator { declare descriptor: string; diff --git a/packages/babel-helpers/src/helpers.ts b/packages/babel-helpers/src/helpers.ts index c93baf4b7efd..2caee39b637a 100644 --- a/packages/babel-helpers/src/helpers.ts +++ b/packages/babel-helpers/src/helpers.ts @@ -1,7 +1,7 @@ import template from "@babel/template"; import type * as t from "@babel/types"; -import generated from "./helpers-generated"; +import generated from "./helpers-generated.ts"; interface Helper { minVersion: string; diff --git a/packages/babel-helpers/src/index.ts b/packages/babel-helpers/src/index.ts index f45c8ced2239..9a9d2389c9ad 100644 --- a/packages/babel-helpers/src/index.ts +++ b/packages/babel-helpers/src/index.ts @@ -9,7 +9,7 @@ import { identifier, } from "@babel/types"; import type * as t from "@babel/types"; -import helpers from "./helpers"; +import helpers from "./helpers.ts"; function makePath(path: NodePath) { const parts = []; diff --git a/packages/babel-node/src/_babel-node.ts b/packages/babel-node/src/_babel-node.ts index 2a613ed64ae6..1a1723782e71 100644 --- a/packages/babel-node/src/_babel-node.ts +++ b/packages/babel-node/src/_babel-node.ts @@ -5,8 +5,8 @@ import path from "path"; import repl from "repl"; import * as babel from "@babel/core"; import vm from "vm"; -import "core-js/stable/index"; -import "regenerator-runtime/runtime"; +import "core-js/stable/index.js"; +import "regenerator-runtime/runtime.js"; // @ts-expect-error @babel/register is a CommonJS module import register from "@babel/register"; import { fileURLToPath } from "url"; diff --git a/packages/babel-parser/src/index.ts b/packages/babel-parser/src/index.ts index 448126d3c5b4..5d2d10e0fc6f 100644 --- a/packages/babel-parser/src/index.ts +++ b/packages/babel-parser/src/index.ts @@ -1,28 +1,28 @@ -import type { Options } from "./options"; +import type { Options } from "./options.ts"; import { hasPlugin, validatePlugins, mixinPluginNames, mixinPlugins, type PluginList, -} from "./plugin-utils"; +} from "./plugin-utils.ts"; import type { PluginConfig as ParserPlugin, FlowPluginOptions, RecordAndTuplePluginOptions, PipelineOperatorPluginOptions, -} from "./typings"; -import Parser from "./parser"; +} from "./typings.ts"; +import Parser from "./parser/index.ts"; -import type { ExportedTokenType } from "./tokenizer/types"; +import type { ExportedTokenType } from "./tokenizer/types.ts"; import { getExportedToken, tt as internalTokenTypes, type InternalTokenTypes, -} from "./tokenizer/types"; -import "./tokenizer/context"; +} from "./tokenizer/types.ts"; +import "./tokenizer/context.ts"; -import type { Expression, File } from "./types"; +import type { Expression, File } from "./types.ts"; export function parse(input: string, options?: Options): File { if (options?.sourceType === "unambiguous") { diff --git a/packages/babel-parser/src/options.ts b/packages/babel-parser/src/options.ts index ee77b8822e5d..d7943d23e251 100644 --- a/packages/babel-parser/src/options.ts +++ b/packages/babel-parser/src/options.ts @@ -1,4 +1,4 @@ -import type { PluginList } from "./plugin-utils"; +import type { PluginList } from "./plugin-utils.ts"; // A second optional argument can be given to further configure // the parser process. These options are recognized: diff --git a/packages/babel-parser/src/parse-error.ts b/packages/babel-parser/src/parse-error.ts index 2b48910337b6..94de04e96e2a 100644 --- a/packages/babel-parser/src/parse-error.ts +++ b/packages/babel-parser/src/parse-error.ts @@ -1,6 +1,6 @@ -import { Position } from "./util/location"; -import type { Undone } from "./parser/node"; -import type { Node } from "./types"; +import { Position } from "./util/location.ts"; +import type { Undone } from "./parser/node.ts"; +import type { Node } from "./types.ts"; type SyntaxPlugin = | "flow" @@ -220,10 +220,10 @@ export type RaiseProperties = { at: Position | Undone; } & ErrorDetails; -import ModuleErrors from "./parse-error/module-errors"; -import StandardErrors from "./parse-error/standard-errors"; -import StrictModeErrors from "./parse-error/strict-mode-errors"; -import PipelineOperatorErrors from "./parse-error/pipeline-operator-errors"; +import ModuleErrors from "./parse-error/module-errors.ts"; +import StandardErrors from "./parse-error/standard-errors.ts"; +import StrictModeErrors from "./parse-error/strict-mode-errors.ts"; +import PipelineOperatorErrors from "./parse-error/pipeline-operator-errors.ts"; export const Errors = { ...ParseErrorEnum(ModuleErrors), @@ -232,4 +232,4 @@ export const Errors = { ...ParseErrorEnum`pipelineOperator`(PipelineOperatorErrors), }; -export type { LValAncestor } from "./parse-error/standard-errors"; +export type { LValAncestor } from "./parse-error/standard-errors.ts"; diff --git a/packages/babel-parser/src/parse-error/module-errors.ts b/packages/babel-parser/src/parse-error/module-errors.ts index 26052a4966ca..74a9d6e60f16 100644 --- a/packages/babel-parser/src/parse-error/module-errors.ts +++ b/packages/babel-parser/src/parse-error/module-errors.ts @@ -1,4 +1,4 @@ -import type { ParseErrorTemplates } from "../parse-error"; +import type { ParseErrorTemplates } from "../parse-error.ts"; const code = "BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED"; diff --git a/packages/babel-parser/src/parse-error/pipeline-operator-errors.ts b/packages/babel-parser/src/parse-error/pipeline-operator-errors.ts index f931b15dd768..ccdce229f263 100644 --- a/packages/babel-parser/src/parse-error/pipeline-operator-errors.ts +++ b/packages/babel-parser/src/parse-error/pipeline-operator-errors.ts @@ -1,5 +1,5 @@ -import type { ParseErrorTemplates } from "../parse-error"; -import toNodeDescription from "./to-node-description"; +import type { ParseErrorTemplates } from "../parse-error.ts"; +import toNodeDescription from "./to-node-description.ts"; export const UnparenthesizedPipeBodyDescriptions = new Set([ "ArrowFunctionExpression", diff --git a/packages/babel-parser/src/parse-error/standard-errors.ts b/packages/babel-parser/src/parse-error/standard-errors.ts index 4845e341f61c..040ff0077507 100644 --- a/packages/babel-parser/src/parse-error/standard-errors.ts +++ b/packages/babel-parser/src/parse-error/standard-errors.ts @@ -1,5 +1,5 @@ -import type { ParseErrorTemplates } from "../parse-error"; -import toNodeDescription from "./to-node-description"; +import type { ParseErrorTemplates } from "../parse-error.ts"; +import toNodeDescription from "./to-node-description.ts"; export type LValAncestor = | { type: "UpdateExpression"; prefix: boolean } diff --git a/packages/babel-parser/src/parser/base.ts b/packages/babel-parser/src/parser/base.ts index ea2a937bb52e..6eb49521a1a0 100644 --- a/packages/babel-parser/src/parser/base.ts +++ b/packages/babel-parser/src/parser/base.ts @@ -1,15 +1,15 @@ -import type { Options } from "../options"; -import type State from "../tokenizer/state"; -import type { PluginsMap } from "./index"; -import type ScopeHandler from "../util/scope"; -import type ExpressionScopeHandler from "../util/expression-scope"; -import type ClassScopeHandler from "../util/class-scope"; -import type ProductionParameterHandler from "../util/production-parameter"; +import type { Options } from "../options.ts"; +import type State from "../tokenizer/state.ts"; +import type { PluginsMap } from "./index.ts"; +import type ScopeHandler from "../util/scope.ts"; +import type ExpressionScopeHandler from "../util/expression-scope.ts"; +import type ClassScopeHandler from "../util/class-scope.ts"; +import type ProductionParameterHandler from "../util/production-parameter.ts"; import type { ParserPluginWithOptions, PluginConfig, PluginOptions, -} from "../typings"; +} from "../typings.ts"; export default class BaseParser { // Properties set by constructor in index.js diff --git a/packages/babel-parser/src/parser/comments.ts b/packages/babel-parser/src/parser/comments.ts index 44022899d492..e108299d5a66 100644 --- a/packages/babel-parser/src/parser/comments.ts +++ b/packages/babel-parser/src/parser/comments.ts @@ -1,9 +1,9 @@ /*:: declare var invariant; */ -import BaseParser from "./base"; -import type { Comment, Node, Identifier } from "../types"; +import BaseParser from "./base.ts"; +import type { Comment, Node, Identifier } from "../types.ts"; import * as charCodes from "charcodes"; -import type { Undone } from "./node"; +import type { Undone } from "./node.ts"; /** * A whitespace token containing comments diff --git a/packages/babel-parser/src/parser/expression.ts b/packages/babel-parser/src/parser/expression.ts index 8301791d04b0..932cbaef5238 100644 --- a/packages/babel-parser/src/parser/expression.ts +++ b/packages/babel-parser/src/parser/expression.ts @@ -31,9 +31,9 @@ import { tokenOperatorPrecedence, tt, type TokenType, -} from "../tokenizer/types"; -import type * as N from "../types"; -import LValParser from "./lval"; +} from "../tokenizer/types.ts"; +import type * as N from "../types.ts"; +import LValParser from "./lval.ts"; import { isKeyword, isReservedWord, @@ -41,32 +41,32 @@ import { isStrictBindReservedWord, isIdentifierStart, canBeReservedWord, -} from "../util/identifier"; +} from "../util/identifier.ts"; import { type Position, createPositionWithColumnOffset, -} from "../util/location"; +} from "../util/location.ts"; import * as charCodes from "charcodes"; -import { ScopeFlag, BindingFlag } from "../util/scopeflags"; -import { ExpressionErrors } from "./util"; +import { ScopeFlag, BindingFlag } from "../util/scopeflags.ts"; +import { ExpressionErrors } from "./util.ts"; import { PARAM_AWAIT, PARAM_IN, PARAM_RETURN, functionFlags, -} from "../util/production-parameter"; +} from "../util/production-parameter.ts"; import { newArrowHeadScope, newAsyncArrowScope, newExpressionScope, -} from "../util/expression-scope"; -import { Errors, type ParseError } from "../parse-error"; -import { UnparenthesizedPipeBodyDescriptions } from "../parse-error/pipeline-operator-errors"; -import { setInnerComments } from "./comments"; -import { cloneIdentifier, type Undone } from "./node"; -import type Parser from "."; - -import type { SourceType } from "../options"; +} from "../util/expression-scope.ts"; +import { Errors, type ParseError } from "../parse-error.ts"; +import { UnparenthesizedPipeBodyDescriptions } from "../parse-error/pipeline-operator-errors.ts"; +import { setInnerComments } from "./comments.ts"; +import { cloneIdentifier, type Undone } from "./node.ts"; +import type Parser from "./index.ts"; + +import type { SourceType } from "../options.ts"; export default abstract class ExpressionParser extends LValParser { // Forward-declaration: defined in statement.js diff --git a/packages/babel-parser/src/parser/index.ts b/packages/babel-parser/src/parser/index.ts index 45a32903fdc2..c75520d558ba 100644 --- a/packages/babel-parser/src/parser/index.ts +++ b/packages/babel-parser/src/parser/index.ts @@ -1,9 +1,9 @@ -import type { Options } from "../options"; -import type * as N from "../types"; -import type { PluginList } from "../plugin-utils"; -import { getOptions } from "../options"; -import StatementParser from "./statement"; -import ScopeHandler from "../util/scope"; +import type { Options } from "../options.ts"; +import type * as N from "../types.ts"; +import type { PluginList } from "../plugin-utils.ts"; +import { getOptions } from "../options.ts"; +import StatementParser from "./statement.ts"; +import ScopeHandler from "../util/scope.ts"; export type PluginsMap = Map< string, diff --git a/packages/babel-parser/src/parser/lval.ts b/packages/babel-parser/src/parser/lval.ts index ed5ed1d20b43..576cec017ed8 100644 --- a/packages/babel-parser/src/parser/lval.ts +++ b/packages/babel-parser/src/parser/lval.ts @@ -1,5 +1,5 @@ import * as charCodes from "charcodes"; -import { tt, type TokenType } from "../tokenizer/types"; +import { tt, type TokenType } from "../tokenizer/types.ts"; import type { AssignmentPattern, TSParameterProperty, @@ -19,17 +19,17 @@ import type { ObjectPattern, ArrayExpression, ArrayPattern, -} from "../types"; -import type { Pos, Position } from "../util/location"; +} from "../types.ts"; +import type { Pos, Position } from "../util/location.ts"; import { isStrictBindOnlyReservedWord, isStrictBindReservedWord, -} from "../util/identifier"; -import { NodeUtils, type Undone } from "./node"; -import { type BindingTypes, BindingFlag } from "../util/scopeflags"; -import type { ExpressionErrors } from "./util"; -import { Errors, type LValAncestor } from "../parse-error"; -import type Parser from "./index"; +} from "../util/identifier.ts"; +import { NodeUtils, type Undone } from "./node.ts"; +import { type BindingTypes, BindingFlag } from "../util/scopeflags.ts"; +import type { ExpressionErrors } from "./util.ts"; +import { Errors, type LValAncestor } from "../parse-error.ts"; +import type Parser from "./index.ts"; const getOwn = (object: T, key: keyof T) => Object.hasOwnProperty.call(object, key) && object[key]; diff --git a/packages/babel-parser/src/parser/node.ts b/packages/babel-parser/src/parser/node.ts index 22dc50124672..21e018648bcf 100644 --- a/packages/babel-parser/src/parser/node.ts +++ b/packages/babel-parser/src/parser/node.ts @@ -1,7 +1,7 @@ -import type Parser from "./index"; -import UtilParser from "./util"; -import { SourceLocation, type Position } from "../util/location"; -import type { Comment, Node as NodeType, NodeBase } from "../types"; +import type Parser from "./index.ts"; +import UtilParser from "./util.ts"; +import { SourceLocation, type Position } from "../util/location.ts"; +import type { Comment, Node as NodeType, NodeBase } from "../types.ts"; // Start an AST node, attaching a start offset. diff --git a/packages/babel-parser/src/parser/statement.ts b/packages/babel-parser/src/parser/statement.ts index a84981fe5bec..8dc7d0b592e6 100644 --- a/packages/babel-parser/src/parser/statement.ts +++ b/packages/babel-parser/src/parser/statement.ts @@ -1,4 +1,4 @@ -import type * as N from "../types"; +import type * as N from "../types.ts"; import { tokenIsIdentifier, tokenIsKeywordOrIdentifier, @@ -7,30 +7,30 @@ import { tt, type TokenType, getExportedToken, -} from "../tokenizer/types"; -import ExpressionParser from "./expression"; -import { Errors } from "../parse-error"; -import { isIdentifierChar, isIdentifierStart } from "../util/identifier"; +} from "../tokenizer/types.ts"; +import ExpressionParser from "./expression.ts"; +import { Errors } from "../parse-error.ts"; +import { isIdentifierChar, isIdentifierStart } from "../util/identifier.ts"; import * as charCodes from "charcodes"; import { ScopeFlag, ClassElementType, type BindingTypes, BindingFlag, -} from "../util/scopeflags"; -import { ExpressionErrors } from "./util"; -import { PARAM, functionFlags } from "../util/production-parameter"; +} from "../util/scopeflags.ts"; +import { ExpressionErrors } from "./util.ts"; +import { PARAM, functionFlags } from "../util/production-parameter.ts"; import { newExpressionScope, newParameterDeclarationScope, -} from "../util/expression-scope"; -import type { SourceType } from "../options"; -import { Token } from "../tokenizer"; -import type { Position } from "../util/location"; -import { createPositionWithColumnOffset } from "../util/location"; -import { cloneStringLiteral, cloneIdentifier, type Undone } from "./node"; -import type Parser from "./index"; -import { ParseBindingListFlags } from "./lval"; +} from "../util/expression-scope.ts"; +import type { SourceType } from "../options.ts"; +import { Token } from "../tokenizer/index.ts"; +import type { Position } from "../util/location.ts"; +import { createPositionWithColumnOffset } from "../util/location.ts"; +import { cloneStringLiteral, cloneIdentifier, type Undone } from "./node.ts"; +import type Parser from "./index.ts"; +import { ParseBindingListFlags } from "./lval.ts"; const loopLabel = { kind: "loop" } as const, switchLabel = { kind: "switch" } as const; diff --git a/packages/babel-parser/src/parser/util.ts b/packages/babel-parser/src/parser/util.ts index 7ef269bab2f2..ed312f74d4e8 100644 --- a/packages/babel-parser/src/parser/util.ts +++ b/packages/babel-parser/src/parser/util.ts @@ -1,29 +1,33 @@ -import type { Position } from "../util/location"; +import type { Position } from "../util/location.ts"; import { tokenIsLiteralPropertyName, tt, type TokenType, -} from "../tokenizer/types"; -import Tokenizer from "../tokenizer"; -import type State from "../tokenizer/state"; -import type { EstreePropertyDefinition, Node, ObjectProperty } from "../types"; -import { lineBreak, skipWhiteSpaceToLineBreak } from "../util/whitespace"; -import { isIdentifierChar } from "../util/identifier"; -import ClassScopeHandler from "../util/class-scope"; -import ExpressionScopeHandler from "../util/expression-scope"; -import { ScopeFlag } from "../util/scopeflags"; +} from "../tokenizer/types.ts"; +import Tokenizer from "../tokenizer/index.ts"; +import type State from "../tokenizer/state.ts"; +import type { + EstreePropertyDefinition, + Node, + ObjectProperty, +} from "../types.ts"; +import { lineBreak, skipWhiteSpaceToLineBreak } from "../util/whitespace.ts"; +import { isIdentifierChar } from "../util/identifier.ts"; +import ClassScopeHandler from "../util/class-scope.ts"; +import ExpressionScopeHandler from "../util/expression-scope.ts"; +import { ScopeFlag } from "../util/scopeflags.ts"; import ProductionParameterHandler, { PARAM_AWAIT, PARAM, -} from "../util/production-parameter"; +} from "../util/production-parameter.ts"; import { Errors, type ParseError, type ParseErrorConstructor, -} from "../parse-error"; -import type Parser from "."; +} from "../parse-error.ts"; +import type Parser from "./index.ts"; -import type ScopeHandler from "../util/scope"; +import type ScopeHandler from "../util/scope.ts"; type TryParse = { node: Node; diff --git a/packages/babel-parser/src/plugin-utils.ts b/packages/babel-parser/src/plugin-utils.ts index 661cb8297ed7..29833e82b24d 100644 --- a/packages/babel-parser/src/plugin-utils.ts +++ b/packages/babel-parser/src/plugin-utils.ts @@ -1,9 +1,9 @@ -import type Parser from "./parser"; +import type Parser from "./parser/index.ts"; import type { ParserPluginWithOptions, PluginConfig, PluginOptions, -} from "./typings"; +} from "./typings.ts"; export type Plugin = PluginConfig; @@ -236,12 +236,12 @@ export function validatePlugins(plugins: PluginList) { // These plugins are defined using a mixin which extends the parser class. -import estree from "./plugins/estree"; -import flow from "./plugins/flow"; -import jsx from "./plugins/jsx"; -import typescript from "./plugins/typescript"; -import placeholders from "./plugins/placeholders"; -import v8intrinsic from "./plugins/v8intrinsic"; +import estree from "./plugins/estree.ts"; +import flow from "./plugins/flow/index.ts"; +import jsx from "./plugins/jsx/index.ts"; +import typescript from "./plugins/typescript/index.ts"; +import placeholders from "./plugins/placeholders.ts"; +import v8intrinsic from "./plugins/v8intrinsic.ts"; // NOTE: order is important. estree must come first; placeholders must come last. export const mixinPlugins = { diff --git a/packages/babel-parser/src/plugins/estree.ts b/packages/babel-parser/src/plugins/estree.ts index 1e5e02fd8f7b..e72d2021ab4d 100644 --- a/packages/babel-parser/src/plugins/estree.ts +++ b/packages/babel-parser/src/plugins/estree.ts @@ -1,12 +1,12 @@ -import type { TokenType } from "../tokenizer/types"; -import type Parser from "../parser"; -import type { ExpressionErrors } from "../parser/util"; -import type * as N from "../types"; -import type { Node as NodeType, NodeBase, File } from "../types"; -import type { Position } from "../util/location"; -import { Errors } from "../parse-error"; -import type { Undone } from "../parser/node"; -import type { BindingTypes } from "../util/scopeflags"; +import type { TokenType } from "../tokenizer/types.ts"; +import type Parser from "../parser/index.ts"; +import type { ExpressionErrors } from "../parser/util.ts"; +import type * as N from "../types.ts"; +import type { Node as NodeType, NodeBase, File } from "../types.ts"; +import type { Position } from "../util/location.ts"; +import { Errors } from "../parse-error.ts"; +import type { Undone } from "../parser/node.ts"; +import type { BindingTypes } from "../util/scopeflags.ts"; const { defineProperty } = Object; const toUnenumerable = (object: any, key: string) => diff --git a/packages/babel-parser/src/plugins/flow/index.ts b/packages/babel-parser/src/plugins/flow/index.ts index e294832d45eb..1d675ea794d2 100644 --- a/packages/babel-parser/src/plugins/flow/index.ts +++ b/packages/babel-parser/src/plugins/flow/index.ts @@ -1,6 +1,6 @@ /*:: declare var invariant; */ -import type Parser from "../../parser"; +import type Parser from "../../parser/index.ts"; import { tokenIsIdentifier, tokenIsKeyword, @@ -10,22 +10,22 @@ import { tt, type TokenType, tokenIsFlowInterfaceOrTypeOrOpaque, -} from "../../tokenizer/types"; -import type * as N from "../../types"; -import type { Position } from "../../util/location"; -import { types as tc } from "../../tokenizer/context"; +} from "../../tokenizer/types.ts"; +import type * as N from "../../types.ts"; +import type { Position } from "../../util/location.ts"; +import { types as tc } from "../../tokenizer/context.ts"; import * as charCodes from "charcodes"; -import { isIteratorStart } from "../../util/identifier"; -import FlowScopeHandler from "./scope"; +import { isIteratorStart } from "../../util/identifier.ts"; +import FlowScopeHandler from "./scope.ts"; import { BindingFlag, ScopeFlag, type BindingTypes, -} from "../../util/scopeflags"; -import type { ExpressionErrors } from "../../parser/util"; -import type { ParseStatementFlag } from "../../parser/statement"; -import { Errors, ParseErrorEnum } from "../../parse-error"; -import { cloneIdentifier, type Undone } from "../../parser/node"; +} from "../../util/scopeflags.ts"; +import type { ExpressionErrors } from "../../parser/util.ts"; +import type { ParseStatementFlag } from "../../parser/statement.ts"; +import { Errors, ParseErrorEnum } from "../../parse-error.ts"; +import { cloneIdentifier, type Undone } from "../../parser/node.ts"; const reservedTypes = new Set([ "_", diff --git a/packages/babel-parser/src/plugins/flow/scope.ts b/packages/babel-parser/src/plugins/flow/scope.ts index db0c19f77551..8541f470e762 100644 --- a/packages/babel-parser/src/plugins/flow/scope.ts +++ b/packages/babel-parser/src/plugins/flow/scope.ts @@ -1,11 +1,11 @@ -import type { Position } from "../../util/location"; -import ScopeHandler, { Scope } from "../../util/scope"; +import type { Position } from "../../util/location.ts"; +import ScopeHandler, { Scope } from "../../util/scope.ts"; import { BindingFlag, type ScopeFlag, type BindingTypes, -} from "../../util/scopeflags"; -import type * as N from "../../types"; +} from "../../util/scopeflags.ts"; +import type * as N from "../../types.ts"; // Reference implementation: https://github.com/facebook/flow/blob/23aeb2a2ef6eb4241ce178fde5d8f17c5f747fb5/src/typing/env.ml#L536-L584 class FlowScope extends Scope { diff --git a/packages/babel-parser/src/plugins/jsx/index.ts b/packages/babel-parser/src/plugins/jsx/index.ts index e65c27c7cb12..f4c89b2b4a5e 100644 --- a/packages/babel-parser/src/plugins/jsx/index.ts +++ b/packages/babel-parser/src/plugins/jsx/index.ts @@ -1,23 +1,23 @@ import * as charCodes from "charcodes"; -import XHTMLEntities from "./xhtml"; -import type Parser from "../../parser"; -import type { ExpressionErrors } from "../../parser/util"; +import XHTMLEntities from "./xhtml.ts"; +import type Parser from "../../parser/index.ts"; +import type { ExpressionErrors } from "../../parser/util.ts"; import { tokenComesBeforeExpression, tokenIsKeyword, tokenLabelName, type TokenType, tt, -} from "../../tokenizer/types"; -import type { TokContext } from "../../tokenizer/context"; -import { types as tc } from "../../tokenizer/context"; -import type * as N from "../../types"; -import { isIdentifierChar, isIdentifierStart } from "../../util/identifier"; -import type { Position } from "../../util/location"; -import { isNewLine } from "../../util/whitespace"; -import { Errors, ParseErrorEnum } from "../../parse-error"; -import type { Undone } from "../../parser/node"; +} from "../../tokenizer/types.ts"; +import type { TokContext } from "../../tokenizer/context.ts"; +import { types as tc } from "../../tokenizer/context.ts"; +import type * as N from "../../types.ts"; +import { isIdentifierChar, isIdentifierStart } from "../../util/identifier.ts"; +import type { Position } from "../../util/location.ts"; +import { isNewLine } from "../../util/whitespace.ts"; +import { Errors, ParseErrorEnum } from "../../parse-error.ts"; +import type { Undone } from "../../parser/node.ts"; /* eslint sort-keys: "error" */ const JsxErrors = ParseErrorEnum`jsx`({ diff --git a/packages/babel-parser/src/plugins/placeholders.ts b/packages/babel-parser/src/plugins/placeholders.ts index ec201101676d..3a2f7a56178a 100644 --- a/packages/babel-parser/src/plugins/placeholders.ts +++ b/packages/babel-parser/src/plugins/placeholders.ts @@ -1,13 +1,13 @@ import * as charCodes from "charcodes"; -import { tokenLabelName, tt } from "../tokenizer/types"; -import type Parser from "../parser"; -import type * as N from "../types"; -import { ParseErrorEnum } from "../parse-error"; -import type { Undone } from "../parser/node"; -import type { ExpressionErrors } from "../parser/util"; -import type { BindingTypes } from "../util/scopeflags"; -import type { Position } from "../util/location"; +import { tokenLabelName, tt } from "../tokenizer/types.ts"; +import type Parser from "../parser/index.ts"; +import type * as N from "../types.ts"; +import { ParseErrorEnum } from "../parse-error.ts"; +import type { Undone } from "../parser/node.ts"; +import type { ExpressionErrors } from "../parser/util.ts"; +import type { BindingTypes } from "../util/scopeflags.ts"; +import type { Position } from "../util/location.ts"; type PossiblePlaceholders = { Identifier: N.Identifier; diff --git a/packages/babel-parser/src/plugins/typescript/index.ts b/packages/babel-parser/src/plugins/typescript/index.ts index 3f57904f1ba7..91828f34cae2 100644 --- a/packages/babel-parser/src/plugins/typescript/index.ts +++ b/packages/babel-parser/src/plugins/typescript/index.ts @@ -1,6 +1,6 @@ /*:: declare var invariant; */ -import type State from "../../tokenizer/state"; +import type State from "../../tokenizer/state.ts"; import { tokenIsIdentifier, tokenIsTSDeclarationStart, @@ -11,28 +11,28 @@ import { type TokenType, tokenIsTemplate, tokenCanStartExpression, -} from "../../tokenizer/types"; -import { types as tc } from "../../tokenizer/context"; -import type * as N from "../../types"; -import type { Position } from "../../util/location"; -import { createPositionWithColumnOffset } from "../../util/location"; -import type Parser from "../../parser"; +} from "../../tokenizer/types.ts"; +import { types as tc } from "../../tokenizer/context.ts"; +import type * as N from "../../types.ts"; +import type { Position } from "../../util/location.ts"; +import { createPositionWithColumnOffset } from "../../util/location.ts"; +import type Parser from "../../parser/index.ts"; import { type BindingTypes, ScopeFlag, BindingFlag, -} from "../../util/scopeflags"; -import TypeScriptScopeHandler from "./scope"; +} from "../../util/scopeflags.ts"; +import TypeScriptScopeHandler from "./scope.ts"; import * as charCodes from "charcodes"; -import type { ExpressionErrors } from "../../parser/util"; -import type { ParseStatementFlag } from "../../parser/statement"; -import { PARAM } from "../../util/production-parameter"; -import { Errors, ParseErrorEnum } from "../../parse-error"; -import { cloneIdentifier, type Undone } from "../../parser/node"; -import type { Pattern } from "../../types"; -import type { Expression } from "../../types"; -import type { IJSXParserMixin } from "../jsx"; -import { ParseBindingListFlags } from "../../parser/lval"; +import type { ExpressionErrors } from "../../parser/util.ts"; +import type { ParseStatementFlag } from "../../parser/statement.ts"; +import { PARAM } from "../../util/production-parameter.ts"; +import { Errors, ParseErrorEnum } from "../../parse-error.ts"; +import { cloneIdentifier, type Undone } from "../../parser/node.ts"; +import type { Pattern } from "../../types.ts"; +import type { Expression } from "../../types.ts"; +import type { IJSXParserMixin } from "../jsx/index.ts"; +import { ParseBindingListFlags } from "../../parser/lval.ts"; const getOwn = (object: T, key: keyof T) => Object.hasOwnProperty.call(object, key) && object[key]; diff --git a/packages/babel-parser/src/plugins/typescript/scope.ts b/packages/babel-parser/src/plugins/typescript/scope.ts index 33ff24b37f6d..d8a46db7fdd7 100644 --- a/packages/babel-parser/src/plugins/typescript/scope.ts +++ b/packages/babel-parser/src/plugins/typescript/scope.ts @@ -1,12 +1,12 @@ -import type { Position } from "../../util/location"; -import ScopeHandler, { Scope } from "../../util/scope"; +import type { Position } from "../../util/location.ts"; +import ScopeHandler, { Scope } from "../../util/scope.ts"; import { BindingFlag, ScopeFlag, type BindingTypes, -} from "../../util/scopeflags"; -import type * as N from "../../types"; -import { Errors } from "../../parse-error"; +} from "../../util/scopeflags.ts"; +import type * as N from "../../types.ts"; +import { Errors } from "../../parse-error.ts"; class TypeScriptScope extends Scope { types: Set = new Set(); diff --git a/packages/babel-parser/src/plugins/v8intrinsic.ts b/packages/babel-parser/src/plugins/v8intrinsic.ts index 38a2237f1cde..3589023388fd 100644 --- a/packages/babel-parser/src/plugins/v8intrinsic.ts +++ b/packages/babel-parser/src/plugins/v8intrinsic.ts @@ -1,7 +1,7 @@ -import type Parser from "../parser"; -import { tokenIsIdentifier, tt } from "../tokenizer/types"; -import type * as N from "../types"; -import type { ExpressionErrors } from "../parser/util"; +import type Parser from "../parser/index.ts"; +import { tokenIsIdentifier, tt } from "../tokenizer/types.ts"; +import type * as N from "../types.ts"; +import type { ExpressionErrors } from "../parser/util.ts"; export default (superClass: typeof Parser) => class V8IntrinsicMixin extends superClass implements Parser { diff --git a/packages/babel-parser/src/tokenizer/index.ts b/packages/babel-parser/src/tokenizer/index.ts index 8750a3cf808c..cecaaaaab9c6 100644 --- a/packages/babel-parser/src/tokenizer/index.ts +++ b/packages/babel-parser/src/tokenizer/index.ts @@ -1,38 +1,38 @@ /*:: declare var invariant; */ -import type { Options } from "../options"; +import type { Options } from "../options.ts"; import { Position, SourceLocation, createPositionWithColumnOffset, -} from "../util/location"; -import CommentsParser, { type CommentWhitespace } from "../parser/comments"; -import type * as N from "../types"; +} from "../util/location.ts"; +import CommentsParser, { type CommentWhitespace } from "../parser/comments.ts"; +import type * as N from "../types.ts"; import * as charCodes from "charcodes"; -import { isIdentifierStart, isIdentifierChar } from "../util/identifier"; +import { isIdentifierStart, isIdentifierChar } from "../util/identifier.ts"; import { tokenIsKeyword, tokenLabelName, tt, keywords as keywordTypes, type TokenType, -} from "./types"; -import type { TokContext } from "./context"; +} from "./types.ts"; +import type { TokContext } from "./context.ts"; import { Errors, type ParseError, type ParseErrorConstructor, type RaiseProperties, -} from "../parse-error"; +} from "../parse-error.ts"; import { lineBreakG, isNewLine, isWhitespace, skipWhiteSpace, skipWhiteSpaceInLine, -} from "../util/whitespace"; -import State from "./state"; -import type { LookaheadState, DeferredStrictError } from "./state"; +} from "../util/whitespace.ts"; +import State from "./state.ts"; +import type { LookaheadState, DeferredStrictError } from "./state.ts"; import { readInt, @@ -43,7 +43,7 @@ import { type StringContentsErrorHandlers, } from "@babel/helper-string-parser"; -import type { Plugin } from "../typings"; +import type { Plugin } from "../typings.ts"; function buildPosition(pos: number, lineStart: number, curLine: number) { return new Position(curLine, pos - lineStart, pos); diff --git a/packages/babel-parser/src/tokenizer/state.ts b/packages/babel-parser/src/tokenizer/state.ts index 4949f5c9a047..728058a7d94d 100644 --- a/packages/babel-parser/src/tokenizer/state.ts +++ b/packages/babel-parser/src/tokenizer/state.ts @@ -1,12 +1,12 @@ -import type { Options } from "../options"; -import type * as N from "../types"; +import type { Options } from "../options.ts"; +import type * as N from "../types.ts"; import type { CommentWhitespace } from "../parser/comments"; -import { Position } from "../util/location"; +import { Position } from "../util/location.ts"; -import { types as ct, type TokContext } from "./context"; -import { tt, type TokenType } from "./types"; -import type { Errors } from "../parse-error"; -import type { ParseError } from "../parse-error"; +import { types as ct, type TokContext } from "./context.ts"; +import { tt, type TokenType } from "./types.ts"; +import type { Errors } from "../parse-error.ts"; +import type { ParseError } from "../parse-error.ts"; export type DeferredStrictError = | typeof Errors.StrictNumericEscape diff --git a/packages/babel-parser/src/tokenizer/types.ts b/packages/babel-parser/src/tokenizer/types.ts index 385bab7e71fb..decfab63775a 100644 --- a/packages/babel-parser/src/tokenizer/types.ts +++ b/packages/babel-parser/src/tokenizer/types.ts @@ -1,4 +1,4 @@ -import { types as tc, type TokContext } from "./context"; +import { types as tc, type TokContext } from "./context.ts"; // ## Token types // The assignment of fine-grained, information-carrying type objects diff --git a/packages/babel-parser/src/types.d.ts b/packages/babel-parser/src/types.d.ts index 646ee0207e27..806e865031a8 100644 --- a/packages/babel-parser/src/types.d.ts +++ b/packages/babel-parser/src/types.d.ts @@ -1,8 +1,8 @@ -import type { SourceType } from "./options"; -import type { Token } from "./tokenizer"; -import type { SourceLocation } from "./util/location"; -import type { PlaceholderTypes } from "./plugins/placeholders"; -import type { ParseError } from "./parse-error"; +import type { SourceType } from "./options.ts"; +import type { Token } from "./tokenizer/index.ts"; +import type { SourceLocation } from "./util/location.ts"; +import type { PlaceholderTypes } from "./plugins/placeholders.ts"; +import type { ParseError } from "./parse-error.ts"; /* * If making any changes to the AST, update: diff --git a/packages/babel-parser/src/util/class-scope.ts b/packages/babel-parser/src/util/class-scope.ts index 46245c904d42..1ffdfd6f0a38 100644 --- a/packages/babel-parser/src/util/class-scope.ts +++ b/packages/babel-parser/src/util/class-scope.ts @@ -1,7 +1,7 @@ -import { ClassElementType } from "./scopeflags"; -import type { Position } from "./location"; -import { Errors } from "../parse-error"; -import type Tokenizer from "../tokenizer"; +import { ClassElementType } from "./scopeflags.ts"; +import type { Position } from "./location.ts"; +import { Errors } from "../parse-error.ts"; +import type Tokenizer from "../tokenizer/index.ts"; export class ClassScope { // A list of private named declared in the current class diff --git a/packages/babel-parser/src/util/expression-scope.ts b/packages/babel-parser/src/util/expression-scope.ts index 73f27772f24a..73adeb204272 100644 --- a/packages/babel-parser/src/util/expression-scope.ts +++ b/packages/babel-parser/src/util/expression-scope.ts @@ -1,7 +1,7 @@ -import { Errors, type ParseErrorConstructor } from "../parse-error"; -import type { Position } from "./location"; -import type { Node } from "../types"; -import type Tokenizer from "../tokenizer"; +import { Errors, type ParseErrorConstructor } from "../parse-error.ts"; +import type { Position } from "./location.ts"; +import type { Node } from "../types.ts"; +import type Tokenizer from "../tokenizer/index.ts"; /** * @module util/expression-scope diff --git a/packages/babel-parser/src/util/scope.ts b/packages/babel-parser/src/util/scope.ts index 2c2c1505d21b..554b2071d092 100644 --- a/packages/babel-parser/src/util/scope.ts +++ b/packages/babel-parser/src/util/scope.ts @@ -1,8 +1,8 @@ -import { ScopeFlag, BindingFlag, type BindingTypes } from "./scopeflags"; -import type { Position } from "./location"; -import type * as N from "../types"; -import { Errors } from "../parse-error"; -import type Tokenizer from "../tokenizer"; +import { ScopeFlag, BindingFlag, type BindingTypes } from "./scopeflags.ts"; +import type { Position } from "./location.ts"; +import type * as N from "../types.ts"; +import { Errors } from "../parse-error.ts"; +import type Tokenizer from "../tokenizer/index.ts"; // Start an AST node, attaching a start offset. export class Scope { diff --git a/packages/babel-plugin-bugfix-safari-id-destructuring-collision-in-function-expression/src/index.ts b/packages/babel-plugin-bugfix-safari-id-destructuring-collision-in-function-expression/src/index.ts index ec03242ff46c..24c52b6a7c7f 100644 --- a/packages/babel-plugin-bugfix-safari-id-destructuring-collision-in-function-expression/src/index.ts +++ b/packages/babel-plugin-bugfix-safari-id-destructuring-collision-in-function-expression/src/index.ts @@ -1,5 +1,5 @@ import { declare } from "@babel/helper-plugin-utils"; -import { shouldTransform } from "./util"; +import { shouldTransform } from "./util.ts"; export default declare(api => { api.assertVersion("^7.16.0"); diff --git a/packages/babel-plugin-bugfix-v8-spread-parameters-in-optional-chaining/src/index.ts b/packages/babel-plugin-bugfix-v8-spread-parameters-in-optional-chaining/src/index.ts index 124bcb83cc17..8d7649d67e50 100644 --- a/packages/babel-plugin-bugfix-v8-spread-parameters-in-optional-chaining/src/index.ts +++ b/packages/babel-plugin-bugfix-v8-spread-parameters-in-optional-chaining/src/index.ts @@ -1,6 +1,6 @@ import { declare } from "@babel/helper-plugin-utils"; import { transform } from "@babel/plugin-transform-optional-chaining"; -import { shouldTransform } from "./util"; +import { shouldTransform } from "./util.ts"; import type { NodePath } from "@babel/traverse"; import type * as t from "@babel/types"; diff --git a/packages/babel-plugin-proposal-decorators/src/index.ts b/packages/babel-plugin-proposal-decorators/src/index.ts index 88305927b797..f0c8a6cb7564 100644 --- a/packages/babel-plugin-proposal-decorators/src/index.ts +++ b/packages/babel-plugin-proposal-decorators/src/index.ts @@ -6,8 +6,8 @@ import { createClassFeaturePlugin, FEATURES, } from "@babel/helper-create-class-features-plugin"; -import legacyVisitor from "./transformer-legacy"; -import transformer2023_05 from "./transformer-2023-05"; +import legacyVisitor from "./transformer-legacy.ts"; +import transformer2023_05 from "./transformer-2023-05.ts"; import type { Options as SyntaxOptions } from "@babel/plugin-syntax-decorators"; interface Options extends SyntaxOptions { diff --git a/packages/babel-plugin-proposal-decorators/src/transformer-2023-05.ts b/packages/babel-plugin-proposal-decorators/src/transformer-2023-05.ts index fa5774f43184..2ece70eb8e0e 100644 --- a/packages/babel-plugin-proposal-decorators/src/transformer-2023-05.ts +++ b/packages/babel-plugin-proposal-decorators/src/transformer-2023-05.ts @@ -5,7 +5,7 @@ import ReplaceSupers from "@babel/helper-replace-supers"; import splitExportDeclaration from "@babel/helper-split-export-declaration"; import * as charCodes from "charcodes"; import type { PluginAPI, PluginObject, PluginPass } from "@babel/core"; -import type { Options } from "./index"; +import type { Options } from "./index.ts"; type ClassDecoratableElement = | t.ClassMethod diff --git a/packages/babel-plugin-proposal-destructuring-private/src/index.ts b/packages/babel-plugin-proposal-destructuring-private/src/index.ts index 5888fd1f542b..69a5f44992f1 100644 --- a/packages/babel-plugin-proposal-destructuring-private/src/index.ts +++ b/packages/babel-plugin-proposal-destructuring-private/src/index.ts @@ -5,7 +5,7 @@ import { hasPrivateClassElement, transformPrivateKeyDestructuring, buildVariableDeclarationFromParams, -} from "./util"; +} from "./util.ts"; import { convertFunctionParams } from "@babel/plugin-transform-parameters"; import { unshiftForXStatementBody } from "@babel/plugin-transform-destructuring"; diff --git a/packages/babel-plugin-proposal-pipeline-operator/src/fsharpVisitor.ts b/packages/babel-plugin-proposal-pipeline-operator/src/fsharpVisitor.ts index 5b1b5cac24cd..0b3744ca030c 100644 --- a/packages/babel-plugin-proposal-pipeline-operator/src/fsharpVisitor.ts +++ b/packages/babel-plugin-proposal-pipeline-operator/src/fsharpVisitor.ts @@ -1,6 +1,6 @@ import { types as t, type PluginObject } from "@babel/core"; import type { NodePath } from "@babel/traverse"; -import buildOptimizedSequenceExpression from "./buildOptimizedSequenceExpression"; +import buildOptimizedSequenceExpression from "./buildOptimizedSequenceExpression.ts"; const fsharpVisitor: PluginObject["visitor"] = { BinaryExpression(path) { diff --git a/packages/babel-plugin-proposal-pipeline-operator/src/index.ts b/packages/babel-plugin-proposal-pipeline-operator/src/index.ts index ceb1caae07ec..77a6f62ffe14 100644 --- a/packages/babel-plugin-proposal-pipeline-operator/src/index.ts +++ b/packages/babel-plugin-proposal-pipeline-operator/src/index.ts @@ -1,9 +1,9 @@ import { declare } from "@babel/helper-plugin-utils"; import syntaxPipelineOperator from "@babel/plugin-syntax-pipeline-operator"; -import minimalVisitor from "./minimalVisitor"; -import hackVisitor from "./hackVisitor"; -import fsharpVisitor from "./fsharpVisitor"; -import smartVisitor from "./smartVisitor"; +import minimalVisitor from "./minimalVisitor.ts"; +import hackVisitor from "./hackVisitor.ts"; +import fsharpVisitor from "./fsharpVisitor.ts"; +import smartVisitor from "./smartVisitor.ts"; import type { Options } from "@babel/plugin-syntax-pipeline-operator"; const visitorsPerProposal = { diff --git a/packages/babel-plugin-proposal-pipeline-operator/src/minimalVisitor.ts b/packages/babel-plugin-proposal-pipeline-operator/src/minimalVisitor.ts index a7a0e3e72464..8ae997e2cb37 100644 --- a/packages/babel-plugin-proposal-pipeline-operator/src/minimalVisitor.ts +++ b/packages/babel-plugin-proposal-pipeline-operator/src/minimalVisitor.ts @@ -1,6 +1,6 @@ import { types as t, type PluginPass } from "@babel/core"; import type { NodePath, Visitor } from "@babel/traverse"; -import buildOptimizedSequenceExpression from "./buildOptimizedSequenceExpression"; +import buildOptimizedSequenceExpression from "./buildOptimizedSequenceExpression.ts"; const minimalVisitor: Visitor = { BinaryExpression(path) { diff --git a/packages/babel-plugin-transform-async-generator-functions/src/index.ts b/packages/babel-plugin-transform-async-generator-functions/src/index.ts index 31145d4d7cd6..6b487f96e4bf 100644 --- a/packages/babel-plugin-transform-async-generator-functions/src/index.ts +++ b/packages/babel-plugin-transform-async-generator-functions/src/index.ts @@ -2,7 +2,7 @@ import { declare } from "@babel/helper-plugin-utils"; import remapAsyncToGenerator from "@babel/helper-remap-async-to-generator"; import type { NodePath, Visitor } from "@babel/traverse"; import { traverse, types as t, type PluginPass } from "@babel/core"; -import rewriteForAwait from "./for-await"; +import rewriteForAwait from "./for-await.ts"; import environmentVisitor from "@babel/helper-environment-visitor"; export default declare(api => { diff --git a/packages/babel-plugin-transform-block-scoping/src/index.ts b/packages/babel-plugin-transform-block-scoping/src/index.ts index 8a8f526a7d93..9d6fd9f0e264 100644 --- a/packages/babel-plugin-transform-block-scoping/src/index.ts +++ b/packages/babel-plugin-transform-block-scoping/src/index.ts @@ -7,9 +7,9 @@ import { getUsageInBody, isVarInLoopHead, wrapLoopBody, -} from "./loop"; -import { validateUsage } from "./validation"; -import { annexB33FunctionsVisitor, isVarScope } from "./annex-B_3_3"; +} from "./loop.ts"; +import { validateUsage } from "./validation.ts"; +import { annexB33FunctionsVisitor, isVarScope } from "./annex-B_3_3.ts"; export interface Options { tdz?: boolean; diff --git a/packages/babel-plugin-transform-classes/src/index.ts b/packages/babel-plugin-transform-classes/src/index.ts index 111cc852b503..128fd3e76900 100644 --- a/packages/babel-plugin-transform-classes/src/index.ts +++ b/packages/babel-plugin-transform-classes/src/index.ts @@ -5,7 +5,7 @@ import nameFunction from "@babel/helper-function-name"; import splitExportDeclaration from "@babel/helper-split-export-declaration"; import { types as t } from "@babel/core"; import globals from "globals"; -import transformClass from "./transformClass"; +import transformClass from "./transformClass.ts"; const getBuiltinClasses = (category: keyof typeof globals) => Object.keys(globals[category]).filter(name => /^[A-Z]/.test(name)); diff --git a/packages/babel-plugin-transform-classes/src/transformClass.ts b/packages/babel-plugin-transform-classes/src/transformClass.ts index a65668c8eecc..6079ca2f93c9 100644 --- a/packages/babel-plugin-transform-classes/src/transformClass.ts +++ b/packages/babel-plugin-transform-classes/src/transformClass.ts @@ -6,7 +6,7 @@ import optimiseCall from "@babel/helper-optimise-call-expression"; import { traverse, template, types as t, type File } from "@babel/core"; import annotateAsPure from "@babel/helper-annotate-as-pure"; -import addCreateSuperHelper from "./inline-createSuper-helpers"; +import addCreateSuperHelper from "./inline-createSuper-helpers.ts"; type ClassAssumptions = { setClassMethods: boolean; diff --git a/packages/babel-plugin-transform-destructuring/src/index.ts b/packages/babel-plugin-transform-destructuring/src/index.ts index 3f7f8672768f..3efd941334a8 100644 --- a/packages/babel-plugin-transform-destructuring/src/index.ts +++ b/packages/babel-plugin-transform-destructuring/src/index.ts @@ -6,8 +6,8 @@ import { convertAssignmentExpression, unshiftForXStatementBody, type DestructuringTransformerNode, -} from "./util"; -export { buildObjectExcludingKeys, unshiftForXStatementBody } from "./util"; +} from "./util.ts"; +export { buildObjectExcludingKeys, unshiftForXStatementBody } from "./util.ts"; import type { NodePath } from "@babel/traverse"; /** diff --git a/packages/babel-plugin-transform-for-of/src/index.ts b/packages/babel-plugin-transform-for-of/src/index.ts index 26bcd0b5b52e..854d12d2fcbd 100644 --- a/packages/babel-plugin-transform-for-of/src/index.ts +++ b/packages/babel-plugin-transform-for-of/src/index.ts @@ -2,7 +2,7 @@ import { declare } from "@babel/helper-plugin-utils"; import { template, types as t } from "@babel/core"; import type { NodePath } from "@babel/traverse"; -import transformWithoutHelper from "./no-helper-implementation"; +import transformWithoutHelper from "./no-helper-implementation.ts"; export interface Options { allowArrayLike?: boolean; diff --git a/packages/babel-plugin-transform-modules-commonjs/src/index.ts b/packages/babel-plugin-transform-modules-commonjs/src/index.ts index b89169e56ad2..20e5a2713858 100644 --- a/packages/babel-plugin-transform-modules-commonjs/src/index.ts +++ b/packages/babel-plugin-transform-modules-commonjs/src/index.ts @@ -14,7 +14,7 @@ import { template, types as t } from "@babel/core"; import type { PluginOptions } from "@babel/helper-module-transforms"; import type { Visitor, Scope } from "@babel/traverse"; -import { transformDynamicImport } from "./dynamic-import"; +import { transformDynamicImport } from "./dynamic-import.ts"; export interface Options extends PluginOptions { allowCommonJSExports?: boolean; diff --git a/packages/babel-plugin-transform-object-rest-spread/src/index.ts b/packages/babel-plugin-transform-object-rest-spread/src/index.ts index 53573fb98891..ee3dc34ebc2e 100644 --- a/packages/babel-plugin-transform-object-rest-spread/src/index.ts +++ b/packages/babel-plugin-transform-object-rest-spread/src/index.ts @@ -5,7 +5,7 @@ import type { NodePath, Scope } from "@babel/traverse"; import { convertFunctionParams } from "@babel/plugin-transform-parameters"; import { isRequired } from "@babel/helper-compilation-targets"; import compatData from "@babel/compat-data/corejs2-built-ins"; -import shouldStoreRHSInTemporaryVariable from "./shouldStoreRHSInTemporaryVariable"; +import shouldStoreRHSInTemporaryVariable from "./shouldStoreRHSInTemporaryVariable.ts"; const { isAssignmentPattern, isObjectProperty } = t; // @babel/types <=7.3.3 counts FOO as referenced in var { x: FOO }. diff --git a/packages/babel-plugin-transform-optional-chaining/src/index.ts b/packages/babel-plugin-transform-optional-chaining/src/index.ts index 9b3332a2f219..c0a8b551a0d4 100644 --- a/packages/babel-plugin-transform-optional-chaining/src/index.ts +++ b/packages/babel-plugin-transform-optional-chaining/src/index.ts @@ -1,5 +1,5 @@ import { declare } from "@babel/helper-plugin-utils"; -import { transform } from "./transform"; +import { transform } from "./transform.ts"; import type { NodePath } from "@babel/traverse"; import type * as t from "@babel/types"; diff --git a/packages/babel-plugin-transform-optional-chaining/src/transform.ts b/packages/babel-plugin-transform-optional-chaining/src/transform.ts index a0cbbf8126f5..5dd16896cace 100644 --- a/packages/babel-plugin-transform-optional-chaining/src/transform.ts +++ b/packages/babel-plugin-transform-optional-chaining/src/transform.ts @@ -4,7 +4,10 @@ import { skipTransparentExprWrapperNodes, skipTransparentExprWrappers, } from "@babel/helper-skip-transparent-expression-wrappers"; -import { willPathCastToBoolean, findOutermostTransparentParent } from "./util"; +import { + willPathCastToBoolean, + findOutermostTransparentParent, +} from "./util.ts"; // TODO(Babel 9): Use .at(-1) const last = (arr: T[]) => arr[arr.length - 1]; diff --git a/packages/babel-plugin-transform-parameters/src/index.ts b/packages/babel-plugin-transform-parameters/src/index.ts index ec6fcbcdf3a2..63b797ba02fb 100644 --- a/packages/babel-plugin-transform-parameters/src/index.ts +++ b/packages/babel-plugin-transform-parameters/src/index.ts @@ -1,6 +1,6 @@ import { declare } from "@babel/helper-plugin-utils"; -import convertFunctionParams from "./params"; -import convertFunctionRest from "./rest"; +import convertFunctionParams from "./params.ts"; +import convertFunctionRest from "./rest.ts"; export { convertFunctionParams }; export interface Options { diff --git a/packages/babel-plugin-transform-parameters/src/params.ts b/packages/babel-plugin-transform-parameters/src/params.ts index 70f841042641..5fd286f3a1a8 100644 --- a/packages/babel-plugin-transform-parameters/src/params.ts +++ b/packages/babel-plugin-transform-parameters/src/params.ts @@ -5,7 +5,7 @@ import { iifeVisitor, collectShadowedParamsNames, buildScopeIIFE, -} from "./shadow-utils"; +} from "./shadow-utils.ts"; const buildDefaultParam = template.statement(` let VARIABLE_NAME = diff --git a/packages/babel-plugin-transform-parameters/src/rest.ts b/packages/babel-plugin-transform-parameters/src/rest.ts index 14950cfdaae2..00d047df1dad 100644 --- a/packages/babel-plugin-transform-parameters/src/rest.ts +++ b/packages/babel-plugin-transform-parameters/src/rest.ts @@ -5,7 +5,7 @@ import { iifeVisitor, collectShadowedParamsNames, buildScopeIIFE, -} from "./shadow-utils"; +} from "./shadow-utils.ts"; const buildRest = template.statement(` for (var LEN = ARGUMENTS.length, diff --git a/packages/babel-plugin-transform-property-mutators/src/index.ts b/packages/babel-plugin-transform-property-mutators/src/index.ts index 648c46f62ccd..9d8b97580d41 100644 --- a/packages/babel-plugin-transform-property-mutators/src/index.ts +++ b/packages/babel-plugin-transform-property-mutators/src/index.ts @@ -1,5 +1,5 @@ import { declare } from "@babel/helper-plugin-utils"; -import { type MutatorMap, pushAccessor, toDefineObject } from "./define-map"; +import { type MutatorMap, pushAccessor, toDefineObject } from "./define-map.ts"; import { types as t } from "@babel/core"; export default declare(api => { diff --git a/packages/babel-plugin-transform-react-jsx/src/development.ts b/packages/babel-plugin-transform-react-jsx/src/development.ts index a1582db7f17b..e4d77659f4f8 100644 --- a/packages/babel-plugin-transform-react-jsx/src/development.ts +++ b/packages/babel-plugin-transform-react-jsx/src/development.ts @@ -1,4 +1,4 @@ -import createPlugin from "./create-plugin"; +import createPlugin from "./create-plugin.ts"; export default createPlugin({ name: "transform-react-jsx/development", diff --git a/packages/babel-plugin-transform-react-jsx/src/index.ts b/packages/babel-plugin-transform-react-jsx/src/index.ts index 7cf547a7e822..f41c953abd18 100644 --- a/packages/babel-plugin-transform-react-jsx/src/index.ts +++ b/packages/babel-plugin-transform-react-jsx/src/index.ts @@ -1,10 +1,10 @@ /* eslint-disable @babel/development/plugin-name */ -import createPlugin from "./create-plugin"; +import createPlugin from "./create-plugin.ts"; export default createPlugin({ name: "transform-react-jsx", development: false, }); -export type { Options } from "./create-plugin"; +export type { Options } from "./create-plugin.ts"; diff --git a/packages/babel-plugin-transform-runtime/src/index.ts b/packages/babel-plugin-transform-runtime/src/index.ts index d1cf63bdd17d..4acf0b793a40 100644 --- a/packages/babel-plugin-transform-runtime/src/index.ts +++ b/packages/babel-plugin-transform-runtime/src/index.ts @@ -2,9 +2,9 @@ import { declare } from "@babel/helper-plugin-utils"; import { addDefault, isModule } from "@babel/helper-module-imports"; import { types as t, type CallerMetadata } from "@babel/core"; -import { hasMinVersion } from "./helpers"; -import getRuntimePath, { resolveFSPath } from "./get-runtime-path"; -import { createBasePolyfillsPlugin } from "./polyfills"; +import { hasMinVersion } from "./helpers.ts"; +import getRuntimePath, { resolveFSPath } from "./get-runtime-path/index.ts"; +import { createBasePolyfillsPlugin } from "./polyfills.ts"; function supportsStaticESM(caller: CallerMetadata | undefined) { // @ts-expect-error TS does not narrow down optional chaining diff --git a/packages/babel-plugin-transform-runtime/src/polyfills.ts b/packages/babel-plugin-transform-runtime/src/polyfills.ts index 9679f6ae678b..581baa67f224 100644 --- a/packages/babel-plugin-transform-runtime/src/polyfills.ts +++ b/packages/babel-plugin-transform-runtime/src/polyfills.ts @@ -18,7 +18,7 @@ const pluginCorejs3 = (_pluginCorejs3.default || const pluginRegenerator = (_pluginRegenerator.default || _pluginRegenerator) as typeof _pluginRegenerator.default; -import type { Options } from "./index"; +import type { Options } from "./index.ts"; const pluginsCompat = "#__secret_key__@babel/runtime__compatibility"; diff --git a/packages/babel-plugin-transform-typescript/src/const-enum.ts b/packages/babel-plugin-transform-typescript/src/const-enum.ts index dbb04beb0aba..ec319c6b3566 100644 --- a/packages/babel-plugin-transform-typescript/src/const-enum.ts +++ b/packages/babel-plugin-transform-typescript/src/const-enum.ts @@ -1,7 +1,7 @@ import type * as t from "@babel/types"; import type { NodePath } from "@babel/traverse"; -import { translateEnumValues } from "./enum"; +import { translateEnumValues } from "./enum.ts"; export type NodePathConstEnum = NodePath; export default function transpileConstEnum( diff --git a/packages/babel-plugin-transform-typescript/src/index.ts b/packages/babel-plugin-transform-typescript/src/index.ts index 046d25eb57d8..e592bfa00bd2 100644 --- a/packages/babel-plugin-transform-typescript/src/index.ts +++ b/packages/babel-plugin-transform-typescript/src/index.ts @@ -5,10 +5,10 @@ import { injectInitialization } from "@babel/helper-create-class-features-plugin import type { Binding, NodePath, Scope } from "@babel/traverse"; import type { Options as SyntaxOptions } from "@babel/plugin-syntax-typescript"; -import transpileConstEnum from "./const-enum"; -import type { NodePathConstEnum } from "./const-enum"; -import transpileEnum from "./enum"; -import transpileNamespace from "./namespace"; +import transpileConstEnum from "./const-enum.ts"; +import type { NodePathConstEnum } from "./const-enum.ts"; +import transpileEnum from "./enum.ts"; +import transpileNamespace from "./namespace.ts"; function isInType(path: NodePath) { switch (path.parent.type) { diff --git a/packages/babel-preset-env/src/available-plugins.ts b/packages/babel-preset-env/src/available-plugins.ts index e5307bf679b4..7636db6b4b23 100644 --- a/packages/babel-preset-env/src/available-plugins.ts +++ b/packages/babel-preset-env/src/available-plugins.ts @@ -54,12 +54,12 @@ import transformUnicodeEscapes from "@babel/plugin-transform-unicode-escapes"; import transformUnicodeRegex from "@babel/plugin-transform-unicode-regex"; import transformUnicodeSetsRegex from "@babel/plugin-transform-unicode-sets-regex"; -import bugfixAsyncArrowsInClass from "@babel/preset-modules/lib/plugins/transform-async-arrows-in-class"; -import bugfixEdgeDefaultParameters from "@babel/preset-modules/lib/plugins/transform-edge-default-parameters"; -import bugfixEdgeFunctionName from "@babel/preset-modules/lib/plugins/transform-edge-function-name"; -import bugfixTaggedTemplateCaching from "@babel/preset-modules/lib/plugins/transform-tagged-template-caching"; -import bugfixSafariBlockShadowing from "@babel/preset-modules/lib/plugins/transform-safari-block-shadowing"; -import bugfixSafariForShadowing from "@babel/preset-modules/lib/plugins/transform-safari-for-shadowing"; +import bugfixAsyncArrowsInClass from "@babel/preset-modules/lib/plugins/transform-async-arrows-in-class/index.js"; +import bugfixEdgeDefaultParameters from "@babel/preset-modules/lib/plugins/transform-edge-default-parameters/index.js"; +import bugfixEdgeFunctionName from "@babel/preset-modules/lib/plugins/transform-edge-function-name/index.js"; +import bugfixTaggedTemplateCaching from "@babel/preset-modules/lib/plugins/transform-tagged-template-caching/index.js"; +import bugfixSafariBlockShadowing from "@babel/preset-modules/lib/plugins/transform-safari-block-shadowing/index.js"; +import bugfixSafariForShadowing from "@babel/preset-modules/lib/plugins/transform-safari-for-shadowing/index.js"; import bugfixSafariIdDestructuringCollisionInFunctionExpression from "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression"; import bugfixV8SpreadParametersInOptionalChaining from "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining"; diff --git a/packages/babel-preset-env/src/filter-items.ts b/packages/babel-preset-env/src/filter-items.ts index 2ff3508dbbb4..5d3a857846e4 100644 --- a/packages/babel-preset-env/src/filter-items.ts +++ b/packages/babel-preset-env/src/filter-items.ts @@ -1,5 +1,5 @@ import semver from "semver"; -import { minVersions } from "./available-plugins"; +import { minVersions } from "./available-plugins.ts"; const has = Function.call.bind(Object.hasOwnProperty); diff --git a/packages/babel-preset-env/src/index.ts b/packages/babel-preset-env/src/index.ts index 5cfcacc65ab8..ae2c7cf8c5b3 100644 --- a/packages/babel-preset-env/src/index.ts +++ b/packages/babel-preset-env/src/index.ts @@ -1,26 +1,26 @@ import semver, { type SemVer } from "semver"; -import { logPlugin } from "./debug"; -import getOptionSpecificExcludesFor from "./get-option-specific-excludes"; +import { logPlugin } from "./debug.ts"; +import getOptionSpecificExcludesFor from "./get-option-specific-excludes.ts"; import { addProposalSyntaxPlugins, removeUnnecessaryItems, removeUnsupportedItems, -} from "./filter-items"; -import moduleTransformations from "./module-transformations"; -import normalizeOptions from "./normalize-options"; +} from "./filter-items.ts"; +import moduleTransformations from "./module-transformations.ts"; +import normalizeOptions from "./normalize-options.ts"; import { pluginSyntaxMap, proposalPlugins, proposalSyntaxPlugins, -} from "./shipped-proposals"; +} from "./shipped-proposals.ts"; import { plugins as pluginsList, pluginsBugfixes as pluginsBugfixesList, overlappingPlugins, -} from "./plugins-compat-data"; +} from "./plugins-compat-data.ts"; -import removeRegeneratorEntryPlugin from "./polyfills/regenerator"; -import legacyBabelPolyfillPlugin from "./polyfills/babel-polyfill"; +import removeRegeneratorEntryPlugin from "./polyfills/regenerator.ts"; +import legacyBabelPolyfillPlugin from "./polyfills/babel-polyfill.ts"; import type { CallerMetadata } from "@babel/core"; @@ -37,12 +37,12 @@ import getTargets, { isRequired, } from "@babel/helper-compilation-targets"; import type { Targets, InputTargets } from "@babel/helper-compilation-targets"; -import availablePlugins from "./available-plugins"; +import availablePlugins from "./available-plugins.ts"; import { declarePreset } from "@babel/helper-plugin-utils"; type ModuleTransformationsType = typeof import("./module-transformations").default; -import type { BuiltInsOption, ModuleOption, Options } from "./types"; +import type { BuiltInsOption, ModuleOption, Options } from "./types.ts"; // TODO: Remove in Babel 8 export function isPluginRequired(targets: Targets, support: Targets) { diff --git a/packages/babel-preset-env/src/normalize-options.ts b/packages/babel-preset-env/src/normalize-options.ts index 94e18ae1afcd..143916ce5abf 100644 --- a/packages/babel-preset-env/src/normalize-options.ts +++ b/packages/babel-preset-env/src/normalize-options.ts @@ -3,10 +3,14 @@ import corejs2Polyfills from "@babel/compat-data/corejs2-built-ins"; // @ts-expect-error Fixme: TS can not infer types from ../data/core-js-compat.js // but we can't import core-js-compat/data.json because JSON imports do // not work on Node 14 -import corejs3Polyfills from "../data/core-js-compat"; -import { plugins as pluginsList } from "./plugins-compat-data"; -import moduleTransformations from "./module-transformations"; -import { TopLevelOptions, ModulesOption, UseBuiltInsOption } from "./options"; +import corejs3Polyfills from "../data/core-js-compat.js"; +import { plugins as pluginsList } from "./plugins-compat-data.ts"; +import moduleTransformations from "./module-transformations.ts"; +import { + TopLevelOptions, + ModulesOption, + UseBuiltInsOption, +} from "./options.ts"; import { OptionValidator } from "@babel/helper-validator-option"; const corejs2DefaultWebIncludes = [ @@ -21,7 +25,7 @@ import type { ModuleOption, Options, PluginListOption, -} from "./types"; +} from "./types.ts"; const v = new OptionValidator(PACKAGE_JSON.name); diff --git a/packages/babel-preset-env/src/plugins-compat-data.ts b/packages/babel-preset-env/src/plugins-compat-data.ts index 1a40f5f07b76..cb7710b0cfe6 100644 --- a/packages/babel-preset-env/src/plugins-compat-data.ts +++ b/packages/babel-preset-env/src/plugins-compat-data.ts @@ -1,7 +1,7 @@ import originalPlugins from "@babel/compat-data/plugins"; import originalPluginsBugfixes from "@babel/compat-data/plugin-bugfixes"; import originalOverlappingPlugins from "@babel/compat-data/overlapping-plugins"; -import availablePlugins from "./available-plugins"; +import availablePlugins from "./available-plugins.ts"; const keys: (o: O) => (keyof O)[] = Object.keys; diff --git a/packages/babel-preset-env/src/polyfills/babel-polyfill.ts b/packages/babel-preset-env/src/polyfills/babel-polyfill.ts index 0098d5b57b49..6cc9f8498357 100644 --- a/packages/babel-preset-env/src/polyfills/babel-polyfill.ts +++ b/packages/babel-preset-env/src/polyfills/babel-polyfill.ts @@ -1,4 +1,8 @@ -import { getImportSource, getRequireSource, isPolyfillSource } from "./utils"; +import { + getImportSource, + getRequireSource, + isPolyfillSource, +} from "./utils.ts"; import type { NodePath } from "@babel/traverse"; import type * as t from "@babel/types"; diff --git a/packages/babel-preset-env/src/polyfills/regenerator.ts b/packages/babel-preset-env/src/polyfills/regenerator.ts index 4ab6368d8b35..50ab83c5bb5e 100644 --- a/packages/babel-preset-env/src/polyfills/regenerator.ts +++ b/packages/babel-preset-env/src/polyfills/regenerator.ts @@ -1,7 +1,7 @@ -import { getImportSource, getRequireSource } from "./utils"; +import { getImportSource, getRequireSource } from "./utils.ts"; import type { Visitor } from "@babel/traverse"; import type { PluginObject, PluginPass } from "@babel/core"; -import type { Options } from "../types"; +import type { Options } from "../types.ts"; function isRegeneratorSource(source: string) { return ( diff --git a/packages/babel-preset-env/src/types.d.ts b/packages/babel-preset-env/src/types.d.ts index aec4b3f69944..2cc8e749f71f 100644 --- a/packages/babel-preset-env/src/types.d.ts +++ b/packages/babel-preset-env/src/types.d.ts @@ -1,5 +1,5 @@ -import type { ModulesOption, UseBuiltInsOption } from "./options"; -import type { NormalizedCorejsOption } from "./normalize-options"; +import type { ModulesOption, UseBuiltInsOption } from "./options.ts"; +import type { NormalizedCorejsOption } from "./normalize-options.ts"; import type { Targets, InputTargets } from "@babel/helper-compilation-targets"; // Options diff --git a/packages/babel-preset-flow/src/index.ts b/packages/babel-preset-flow/src/index.ts index e2ea02e9140e..7c0b07a44513 100644 --- a/packages/babel-preset-flow/src/index.ts +++ b/packages/babel-preset-flow/src/index.ts @@ -1,6 +1,6 @@ import { declarePreset } from "@babel/helper-plugin-utils"; import transformFlowStripTypes from "@babel/plugin-transform-flow-strip-types"; -import normalizeOptions from "./normalize-options"; +import normalizeOptions from "./normalize-options.ts"; export default declarePreset((api, opts) => { api.assertVersion(7); diff --git a/packages/babel-preset-react/src/index.ts b/packages/babel-preset-react/src/index.ts index 408a27c021ef..614ec763c0a5 100644 --- a/packages/babel-preset-react/src/index.ts +++ b/packages/babel-preset-react/src/index.ts @@ -3,7 +3,7 @@ import transformReactJSX from "@babel/plugin-transform-react-jsx"; import transformReactJSXDevelopment from "@babel/plugin-transform-react-jsx-development"; import transformReactDisplayName from "@babel/plugin-transform-react-display-name"; import transformReactPure from "@babel/plugin-transform-react-pure-annotations"; -import normalizeOptions from "./normalize-options"; +import normalizeOptions from "./normalize-options.ts"; export interface Options { development?: boolean; diff --git a/packages/babel-preset-typescript/src/index.ts b/packages/babel-preset-typescript/src/index.ts index a3e05f3d3c16..184d14a866f4 100644 --- a/packages/babel-preset-typescript/src/index.ts +++ b/packages/babel-preset-typescript/src/index.ts @@ -2,8 +2,8 @@ import { declarePreset } from "@babel/helper-plugin-utils"; import transformTypeScript from "@babel/plugin-transform-typescript"; import syntaxJSX from "@babel/plugin-syntax-jsx"; import transformModulesCommonJS from "@babel/plugin-transform-modules-commonjs"; -import normalizeOptions from "./normalize-options"; -import type { Options } from "./normalize-options"; +import normalizeOptions from "./normalize-options.ts"; +import type { Options } from "./normalize-options.ts"; export default declarePreset((api, opts: Options) => { api.assertVersion(7); diff --git a/packages/babel-register/src/cache.js b/packages/babel-register/src/cache.js index d4ac88a4aebe..ac3ac7185d5d 100644 --- a/packages/babel-register/src/cache.js +++ b/packages/babel-register/src/cache.js @@ -1,3 +1,3 @@ // File moved to ./worker/cache.js // TODO: Remove this backward-compat "proxy file" in Babel 8 -module.exports = require("./worker/cache"); +module.exports = require("./worker/cache.js"); diff --git a/packages/babel-register/src/experimental-worker.js b/packages/babel-register/src/experimental-worker.js index eb299ee1bf52..01e6c778e53f 100644 --- a/packages/babel-register/src/experimental-worker.js +++ b/packages/babel-register/src/experimental-worker.js @@ -10,8 +10,8 @@ if (major < 12 || (major === 12 && minor < 3)) { ); } -const hook = require("./hook"); -const { WorkerClient } = require("./worker-client"); +const hook = require("./hook.js"); +const { WorkerClient } = require("./worker-client.js"); let client; function register(opts) { @@ -25,6 +25,6 @@ module.exports = Object.assign(register, { __esModule: true, }); -if (!require("./is-in-register-worker").isInRegisterWorker) { +if (!require("./is-in-register-worker.js").isInRegisterWorker) { register(); } diff --git a/packages/babel-register/src/index.js b/packages/babel-register/src/index.js index 87cfd91a6801..067687a02284 100644 --- a/packages/babel-register/src/index.js +++ b/packages/babel-register/src/index.js @@ -5,16 +5,16 @@ */ if (USE_ESM) { - module.exports = require("./experimental-worker"); + module.exports = require("./experimental-worker.js"); } else if (process.env.BABEL_8_BREAKING) { - module.exports = require("./experimental-worker"); + module.exports = require("./experimental-worker.js"); } else { exports = module.exports = function (...args) { return register(...args); }; exports.__esModule = true; - const node = require("./nodeWrapper"); + const node = require("./nodeWrapper.js"); const register = node.default; Object.assign(exports, node); diff --git a/packages/babel-register/src/node.js b/packages/babel-register/src/node.js index 5ab5a712d95e..9fc4cc5a24ed 100644 --- a/packages/babel-register/src/node.js +++ b/packages/babel-register/src/node.js @@ -2,8 +2,8 @@ "use strict"; -const hook = require("./hook"); -const { LocalClient } = require("./worker-client"); +const hook = require("./hook.js"); +const { LocalClient } = require("./worker-client.js"); const client = new LocalClient(); function register(opts = {}) { diff --git a/packages/babel-register/src/nodeWrapper.js b/packages/babel-register/src/nodeWrapper.js index d2af9acac10f..479bbed922a1 100644 --- a/packages/babel-register/src/nodeWrapper.js +++ b/packages/babel-register/src/nodeWrapper.js @@ -13,7 +13,7 @@ const globalModuleCache = Module._cache; const internalModuleCache = Object.create(null); Module._cache = internalModuleCache; -const node = require("./node"); +const node = require("./node.js"); // NOTE: This Module._cache set is intercepted by the beforeEach hook in // packages/babel-register/test/index.js to install dependencies mocks. diff --git a/packages/babel-register/src/worker-client.js b/packages/babel-register/src/worker-client.js index c61e836a1904..46ccd6712a03 100644 --- a/packages/babel-register/src/worker-client.js +++ b/packages/babel-register/src/worker-client.js @@ -55,7 +55,7 @@ exports.WorkerClient = class WorkerClient extends Client { } static get #markInRegisterWorker() { - return require("./is-in-register-worker").markInRegisterWorker; + return require("./is-in-register-worker.js").markInRegisterWorker; } #worker = new WorkerClient.#worker_threads.Worker( @@ -97,7 +97,7 @@ if (!process.env.BABEL_8_BREAKING) { static #handleMessage; constructor() { - LocalClient.#handleMessage ??= require("./worker/handle-message"); + LocalClient.#handleMessage ??= require("./worker/handle-message.js"); super((action, payload) => { return LocalClient.#handleMessage( diff --git a/packages/babel-register/src/worker/babel-core.js b/packages/babel-register/src/worker/babel-core.js index bf770b010e19..5b041dfa8043 100644 --- a/packages/babel-register/src/worker/babel-core.js +++ b/packages/babel-register/src/worker/babel-core.js @@ -1,4 +1,4 @@ -const cache = require("./cache"); +const cache = require("./cache.js"); function initialize(babel) { exports.init = null; diff --git a/packages/babel-register/src/worker/cache.js b/packages/babel-register/src/worker/cache.js index d8226e0cfd0c..105b2d0eb71f 100644 --- a/packages/babel-register/src/worker/cache.js +++ b/packages/babel-register/src/worker/cache.js @@ -16,7 +16,7 @@ exports.initializeCacheFilename = function () { ); }; -const babel = require("./babel-core"); +const babel = require("./babel-core.js"); let data = {}; diff --git a/packages/babel-register/src/worker/handle-message.js b/packages/babel-register/src/worker/handle-message.js index 08ce0fe619aa..8c64ec116870 100644 --- a/packages/babel-register/src/worker/handle-message.js +++ b/packages/babel-register/src/worker/handle-message.js @@ -1,5 +1,5 @@ -const babel = require("./babel-core"); -const { setOptions, transform, transformSync } = require("./transform"); +const babel = require("./babel-core.js"); +const { setOptions, transform, transformSync } = require("./transform.js"); module.exports = function handleMessage(action, payload) { switch (action) { diff --git a/packages/babel-register/src/worker/index.js b/packages/babel-register/src/worker/index.js index 8af8e65a1ff1..9b046d63b5ab 100644 --- a/packages/babel-register/src/worker/index.js +++ b/packages/babel-register/src/worker/index.js @@ -1,5 +1,5 @@ -const babel = require("./babel-core"); -const handleMessage = require("./handle-message"); +const babel = require("./babel-core.js"); +const handleMessage = require("./handle-message.js"); const { parentPort } = require("worker_threads"); diff --git a/packages/babel-register/src/worker/transform.js b/packages/babel-register/src/worker/transform.js index cc3eb9e21142..e28ddb849867 100644 --- a/packages/babel-register/src/worker/transform.js +++ b/packages/babel-register/src/worker/transform.js @@ -4,8 +4,8 @@ const cloneDeep = require("clone-deep"); const path = require("path"); const fs = require("fs"); -const babel = require("./babel-core"); -const registerCache = require("../cache"); +const babel = require("./babel-core.js"); +const registerCache = require("../cache.js"); const nmRE = escapeRegExp(path.sep + "node_modules" + path.sep); diff --git a/packages/babel-standalone/src/generated/plugins.ts b/packages/babel-standalone/src/generated/plugins.ts index a7c1cbe13586..fa6c00041d33 100644 --- a/packages/babel-standalone/src/generated/plugins.ts +++ b/packages/babel-standalone/src/generated/plugins.ts @@ -2,7 +2,7 @@ * This file is auto-generated! Do not modify it directly. * To re-generate run 'yarn gulp generate-standalone' */ -import makeNoopPlugin from "../make-noop-plugin"; +import makeNoopPlugin from "../make-noop-plugin.ts"; import externalHelpers from "@babel/plugin-external-helpers"; import syntaxDecimal from "@babel/plugin-syntax-decimal"; import syntaxDecorators from "@babel/plugin-syntax-decorators"; diff --git a/packages/babel-standalone/src/index.ts b/packages/babel-standalone/src/index.ts index 40c2baef84d3..08f95d7c678e 100644 --- a/packages/babel-standalone/src/index.ts +++ b/packages/babel-standalone/src/index.ts @@ -18,26 +18,26 @@ import { type PluginObject, type PresetObject, } from "@babel/core"; -import { all } from "./generated/plugins"; -import preset2015 from "./preset-es2015"; -import presetStage0 from "./preset-stage-0"; -import presetStage1 from "./preset-stage-1"; -import presetStage2 from "./preset-stage-2"; -import presetStage3 from "./preset-stage-3"; +import { all } from "./generated/plugins.ts"; +import preset2015 from "./preset-es2015.ts"; +import presetStage0 from "./preset-stage-0.ts"; +import presetStage1 from "./preset-stage-1.ts"; +import presetStage2 from "./preset-stage-2.ts"; +import presetStage3 from "./preset-stage-3.ts"; import presetEnv from "@babel/preset-env"; import presetFlow from "@babel/preset-flow"; import presetReact from "@babel/preset-react"; import presetTypescript from "@babel/preset-typescript"; import type { InputOptions } from "@babel/core"; -import { runScripts } from "./transformScriptTags"; +import { runScripts } from "./transformScriptTags.ts"; // We import this file from another package using a relative path because it's // meant to just be build-time script; it's ok because @babel/standalone is // bundled anyway. // TODO: Remove this in Babel 8 // @ts-expect-error TS complains about importing a JS file without type declarations -import legacyPluginAliases from "../../babel-compat-data/scripts/data/legacy-plugin-aliases"; +import legacyPluginAliases from "../../babel-compat-data/scripts/data/legacy-plugin-aliases.js"; // eslint-disable-next-line guard-for-in for (const name in legacyPluginAliases) { all[legacyPluginAliases[name]] = all[name]; diff --git a/packages/babel-standalone/src/preset-es2015.ts b/packages/babel-standalone/src/preset-es2015.ts index c4a76a9f96b5..09e4d9ef30e1 100644 --- a/packages/babel-standalone/src/preset-es2015.ts +++ b/packages/babel-standalone/src/preset-es2015.ts @@ -1,4 +1,4 @@ -import * as babelPlugins from "./generated/plugins"; +import * as babelPlugins from "./generated/plugins.ts"; export default (_: any, opts: any): any => { let loose = false; diff --git a/packages/babel-standalone/src/preset-stage-0.ts b/packages/babel-standalone/src/preset-stage-0.ts index 66a8f8a180f6..8b1f799cf93a 100644 --- a/packages/babel-standalone/src/preset-stage-0.ts +++ b/packages/babel-standalone/src/preset-stage-0.ts @@ -1,5 +1,5 @@ -import presetStage1 from "./preset-stage-1"; -import { proposalFunctionBind } from "./generated/plugins"; +import presetStage1 from "./preset-stage-1.ts"; +import { proposalFunctionBind } from "./generated/plugins.ts"; export default (_: any, opts: any = {}) => { const { diff --git a/packages/babel-standalone/src/preset-stage-1.ts b/packages/babel-standalone/src/preset-stage-1.ts index 67a3ef331819..8885d2c035cd 100644 --- a/packages/babel-standalone/src/preset-stage-1.ts +++ b/packages/babel-standalone/src/preset-stage-1.ts @@ -1,5 +1,5 @@ -import presetStage2 from "./preset-stage-2"; -import * as babelPlugins from "./generated/plugins"; +import presetStage2 from "./preset-stage-2.ts"; +import * as babelPlugins from "./generated/plugins.ts"; export default (_: any, opts: any = {}) => { const { diff --git a/packages/babel-standalone/src/preset-stage-2.ts b/packages/babel-standalone/src/preset-stage-2.ts index 440052f35443..80ba3c32452e 100644 --- a/packages/babel-standalone/src/preset-stage-2.ts +++ b/packages/babel-standalone/src/preset-stage-2.ts @@ -1,5 +1,5 @@ -import presetStage3 from "./preset-stage-3"; -import * as babelPlugins from "./generated/plugins"; +import presetStage3 from "./preset-stage-3.ts"; +import * as babelPlugins from "./generated/plugins.ts"; export default (_: any, opts: any = {}) => { const { diff --git a/packages/babel-standalone/src/preset-stage-3.ts b/packages/babel-standalone/src/preset-stage-3.ts index 7a9925d27e78..d105ee44c4b7 100644 --- a/packages/babel-standalone/src/preset-stage-3.ts +++ b/packages/babel-standalone/src/preset-stage-3.ts @@ -1,4 +1,4 @@ -import * as babelPlugins from "./generated/plugins"; +import * as babelPlugins from "./generated/plugins.ts"; export default (_: any, opts: any = {}) => { const { diff --git a/packages/babel-standalone/src/transformScriptTags.ts b/packages/babel-standalone/src/transformScriptTags.ts index 70ed2e723c8a..1006ab2d13c8 100644 --- a/packages/babel-standalone/src/transformScriptTags.ts +++ b/packages/babel-standalone/src/transformScriptTags.ts @@ -8,7 +8,7 @@ const scriptTypes = ["text/jsx", "text/babel"]; -import type { transform } from "./index"; +import type { transform } from "./index.ts"; import type { InputOptions } from "@babel/core"; let headEl: HTMLHeadElement; diff --git a/packages/babel-template/src/builder.ts b/packages/babel-template/src/builder.ts index faa7ee713006..056db7753f7f 100644 --- a/packages/babel-template/src/builder.ts +++ b/packages/babel-template/src/builder.ts @@ -1,9 +1,13 @@ -import { merge, validate } from "./options"; -import type { TemplateOpts, PublicOpts, PublicReplacements } from "./options"; -import type { Formatter } from "./formatters"; +import { merge, validate } from "./options.ts"; +import type { + TemplateOpts, + PublicOpts, + PublicReplacements, +} from "./options.ts"; +import type { Formatter } from "./formatters.ts"; -import stringTemplate from "./string"; -import literalTemplate from "./literal"; +import stringTemplate from "./string.ts"; +import literalTemplate from "./literal.ts"; export type TemplateBuilder = { // Build a new builder, merging the given options with the previous ones. diff --git a/packages/babel-template/src/index.ts b/packages/babel-template/src/index.ts index 84d2c0e3a408..15f1ecc82e4f 100644 --- a/packages/babel-template/src/index.ts +++ b/packages/babel-template/src/index.ts @@ -1,5 +1,5 @@ -import * as formatters from "./formatters"; -import createTemplateBuilder from "./builder"; +import * as formatters from "./formatters.ts"; +import createTemplateBuilder from "./builder.ts"; export const smart = createTemplateBuilder(formatters.smart); export const statement = createTemplateBuilder(formatters.statement); diff --git a/packages/babel-template/src/literal.ts b/packages/babel-template/src/literal.ts index 3d2b0b52fe47..125fe5a8b23f 100644 --- a/packages/babel-template/src/literal.ts +++ b/packages/babel-template/src/literal.ts @@ -1,8 +1,8 @@ -import type { Formatter } from "./formatters"; -import type { TemplateReplacements, TemplateOpts } from "./options"; -import { normalizeReplacements } from "./options"; -import parseAndBuildMetadata from "./parse"; -import populatePlaceholders from "./populate"; +import type { Formatter } from "./formatters.ts"; +import type { TemplateReplacements, TemplateOpts } from "./options.ts"; +import { normalizeReplacements } from "./options.ts"; +import parseAndBuildMetadata from "./parse.ts"; +import populatePlaceholders from "./populate.ts"; export default function literalTemplate( formatter: Formatter, diff --git a/packages/babel-template/src/parse.ts b/packages/babel-template/src/parse.ts index 913a158873ee..7c8ef5e7b2cd 100644 --- a/packages/babel-template/src/parse.ts +++ b/packages/babel-template/src/parse.ts @@ -15,8 +15,8 @@ import type * as t from "@babel/types"; import type { TraversalAncestors } from "@babel/types"; import { parse } from "@babel/parser"; import { codeFrameColumns } from "@babel/code-frame"; -import type { TemplateOpts, ParserOpts } from "./options"; -import type { Formatter } from "./formatters"; +import type { TemplateOpts, ParserOpts } from "./options.ts"; +import type { Formatter } from "./formatters.ts"; export type Metadata = { ast: t.File; diff --git a/packages/babel-template/src/populate.ts b/packages/babel-template/src/populate.ts index 60aad6a9fa1f..96f5e0346a10 100644 --- a/packages/babel-template/src/populate.ts +++ b/packages/babel-template/src/populate.ts @@ -11,8 +11,8 @@ import { } from "@babel/types"; import type * as t from "@babel/types"; -import type { TemplateReplacements } from "./options"; -import type { Metadata, Placeholder } from "./parse"; +import type { TemplateReplacements } from "./options.ts"; +import type { Metadata, Placeholder } from "./parse.ts"; export default function populatePlaceholders( metadata: Metadata, diff --git a/packages/babel-template/src/string.ts b/packages/babel-template/src/string.ts index 10f26fb64ebe..7a17aaaeff4e 100644 --- a/packages/babel-template/src/string.ts +++ b/packages/babel-template/src/string.ts @@ -1,9 +1,9 @@ -import type { Formatter } from "./formatters"; -import type { TemplateOpts } from "./options"; -import type { Metadata } from "./parse"; -import { normalizeReplacements } from "./options"; -import parseAndBuildMetadata from "./parse"; -import populatePlaceholders from "./populate"; +import type { Formatter } from "./formatters.ts"; +import type { TemplateOpts } from "./options.ts"; +import type { Metadata } from "./parse.ts"; +import { normalizeReplacements } from "./options.ts"; +import parseAndBuildMetadata from "./parse.ts"; +import populatePlaceholders from "./populate.ts"; export default function stringTemplate( formatter: Formatter, diff --git a/packages/babel-traverse/src/cache.ts b/packages/babel-traverse/src/cache.ts index fe0ec4178415..44162513b60b 100644 --- a/packages/babel-traverse/src/cache.ts +++ b/packages/babel-traverse/src/cache.ts @@ -1,7 +1,7 @@ import type { Node } from "@babel/types"; -import type NodePath from "./path"; -import type Scope from "./scope"; -import type { HubInterface } from "./hub"; +import type NodePath from "./path/index.ts"; +import type Scope from "./scope/index.ts"; +import type { HubInterface } from "./hub.ts"; let pathsCache: WeakMap< HubInterface | typeof nullHub, diff --git a/packages/babel-traverse/src/context.ts b/packages/babel-traverse/src/context.ts index 890a2bd2c190..cd4f1ca8c694 100644 --- a/packages/babel-traverse/src/context.ts +++ b/packages/babel-traverse/src/context.ts @@ -1,9 +1,9 @@ -import NodePath from "./path"; +import NodePath from "./path/index.ts"; import { VISITOR_KEYS } from "@babel/types"; -import type Scope from "./scope"; -import type { ExplodedTraverseOptions } from "."; +import type Scope from "./scope/index.ts"; +import type { ExplodedTraverseOptions } from "./index.ts"; import type * as t from "@babel/types"; -import type { Visitor } from "./types"; +import type { Visitor } from "./types.ts"; export default class TraversalContext { constructor( diff --git a/packages/babel-traverse/src/hub.ts b/packages/babel-traverse/src/hub.ts index c3aa8add3bb8..462e33e912ea 100644 --- a/packages/babel-traverse/src/hub.ts +++ b/packages/babel-traverse/src/hub.ts @@ -1,4 +1,4 @@ -import type Scope from "./scope"; +import type Scope from "./scope/index.ts"; import type { Node } from "@babel/types"; export interface HubInterface { diff --git a/packages/babel-traverse/src/index.ts b/packages/babel-traverse/src/index.ts index 331d0dbf1a83..f6e2fddd1ba8 100644 --- a/packages/babel-traverse/src/index.ts +++ b/packages/babel-traverse/src/index.ts @@ -1,4 +1,4 @@ -import * as visitors from "./visitors"; +import * as visitors from "./visitors.ts"; import { VISITOR_KEYS, removeProperties, @@ -6,17 +6,17 @@ import { traverseFast, } from "@babel/types"; import type * as t from "@babel/types"; -import * as cache from "./cache"; -import type NodePath from "./path"; -import type { default as Scope, Binding } from "./scope"; -import type { ExplodedVisitor, Visitor } from "./types"; -import { traverseNode } from "./traverse-node"; +import * as cache from "./cache.ts"; +import type NodePath from "./path/index.ts"; +import type { default as Scope, Binding } from "./scope/index.ts"; +import type { ExplodedVisitor, Visitor } from "./types.ts"; +import { traverseNode } from "./traverse-node.ts"; export type { ExplodedVisitor, Visitor, Binding }; -export { default as NodePath } from "./path"; -export { default as Scope } from "./scope"; -export { default as Hub } from "./hub"; -export type { HubInterface } from "./hub"; +export { default as NodePath } from "./path/index.ts"; +export { default as Scope } from "./scope/index.ts"; +export { default as Hub } from "./hub.ts"; +export type { HubInterface } from "./hub.ts"; export { visitors }; diff --git a/packages/babel-traverse/src/path/ancestry.ts b/packages/babel-traverse/src/path/ancestry.ts index 990e83da7d0d..c0a03ebd1a9d 100644 --- a/packages/babel-traverse/src/path/ancestry.ts +++ b/packages/babel-traverse/src/path/ancestry.ts @@ -2,7 +2,7 @@ import { VISITOR_KEYS } from "@babel/types"; import type * as t from "@babel/types"; -import type NodePath from "./index"; +import type NodePath from "./index.ts"; /** * Starting at the parent path of the current `NodePath` and going up the diff --git a/packages/babel-traverse/src/path/comments.ts b/packages/babel-traverse/src/path/comments.ts index bc117ca60de3..e4c43b2e9bf1 100644 --- a/packages/babel-traverse/src/path/comments.ts +++ b/packages/babel-traverse/src/path/comments.ts @@ -1,6 +1,6 @@ // This file contains methods responsible for dealing with comments. import type * as t from "@babel/types"; -import type NodePath from "./index"; +import type NodePath from "./index.ts"; import { addComment as _addComment, addComments as _addComments, diff --git a/packages/babel-traverse/src/path/context.ts b/packages/babel-traverse/src/path/context.ts index fb3268d954d7..43a209a9d778 100644 --- a/packages/babel-traverse/src/path/context.ts +++ b/packages/babel-traverse/src/path/context.ts @@ -1,10 +1,10 @@ // This file contains methods responsible for maintaining a TraversalContext. -import { traverseNode } from "../traverse-node"; -import { SHOULD_SKIP, SHOULD_STOP } from "./index"; -import type TraversalContext from "../context"; -import type { VisitPhase } from "../types"; -import type NodePath from "./index"; +import { traverseNode } from "../traverse-node.ts"; +import { SHOULD_SKIP, SHOULD_STOP } from "./index.ts"; +import type TraversalContext from "../context.ts"; +import type { VisitPhase } from "../types.ts"; +import type NodePath from "./index.ts"; import type * as t from "@babel/types"; export function call(this: NodePath, key: VisitPhase): boolean { diff --git a/packages/babel-traverse/src/path/conversion.ts b/packages/babel-traverse/src/path/conversion.ts index b61a536e5648..757458b4ac4b 100644 --- a/packages/babel-traverse/src/path/conversion.ts +++ b/packages/babel-traverse/src/path/conversion.ts @@ -30,8 +30,8 @@ import { import type * as t from "@babel/types"; import environmentVisitor from "@babel/helper-environment-visitor"; import nameFunction from "@babel/helper-function-name"; -import { merge as mergeVisitors } from "../visitors"; -import type NodePath from "./index"; +import { merge as mergeVisitors } from "../visitors.ts"; +import type NodePath from "./index.ts"; export function toComputedKey(this: NodePath) { let key; diff --git a/packages/babel-traverse/src/path/evaluation.ts b/packages/babel-traverse/src/path/evaluation.ts index c4a39df798c0..cf3bb98316d0 100644 --- a/packages/babel-traverse/src/path/evaluation.ts +++ b/packages/babel-traverse/src/path/evaluation.ts @@ -1,4 +1,4 @@ -import type NodePath from "./index"; +import type NodePath from "./index.ts"; import type * as t from "@babel/types"; // This file contains Babels metainterpreter that can evaluate static code. diff --git a/packages/babel-traverse/src/path/family.ts b/packages/babel-traverse/src/path/family.ts index cf5bba25b5c9..a0396a79ce34 100644 --- a/packages/babel-traverse/src/path/family.ts +++ b/packages/babel-traverse/src/path/family.ts @@ -1,7 +1,7 @@ // This file contains methods responsible for dealing with/retrieving children or siblings. -import type TraversalContext from "../context"; -import NodePath from "./index"; +import type TraversalContext from "../context.ts"; +import NodePath from "./index.ts"; import { getBindingIdentifiers as _getBindingIdentifiers, getOuterBindingIdentifiers as _getOuterBindingIdentifiers, diff --git a/packages/babel-traverse/src/path/index.ts b/packages/babel-traverse/src/path/index.ts index 0b287a39e8d9..7dbf405caa23 100644 --- a/packages/babel-traverse/src/path/index.ts +++ b/packages/babel-traverse/src/path/index.ts @@ -1,31 +1,31 @@ -import type { HubInterface } from "../hub"; -import type TraversalContext from "../context"; -import type { ExplodedTraverseOptions } from ".."; -import * as virtualTypes from "./lib/virtual-types"; +import type { HubInterface } from "../hub.ts"; +import type TraversalContext from "../context.ts"; +import type { ExplodedTraverseOptions } from "../index.ts"; +import * as virtualTypes from "./lib/virtual-types.ts"; import buildDebug from "debug"; -import traverse from "../index"; -import type { Visitor } from "../types"; -import Scope from "../scope"; +import traverse from "../index.ts"; +import type { Visitor } from "../types.ts"; +import Scope from "../scope/index.ts"; import { validate } from "@babel/types"; import * as t from "@babel/types"; -import * as cache from "../cache"; +import * as cache from "../cache.ts"; import generator from "@babel/generator"; // NodePath is split across many files. -import * as NodePath_ancestry from "./ancestry"; -import * as NodePath_inference from "./inference"; -import * as NodePath_replacement from "./replacement"; -import * as NodePath_evaluation from "./evaluation"; -import * as NodePath_conversion from "./conversion"; -import * as NodePath_introspection from "./introspection"; -import * as NodePath_context from "./context"; -import * as NodePath_removal from "./removal"; -import * as NodePath_modification from "./modification"; -import * as NodePath_family from "./family"; -import * as NodePath_comments from "./comments"; -import * as NodePath_virtual_types_validator from "./lib/virtual-types-validator"; -import type { NodePathAssertions } from "./generated/asserts"; -import type { NodePathValidators } from "./generated/validators"; +import * as NodePath_ancestry from "./ancestry.ts"; +import * as NodePath_inference from "./inference/index.ts"; +import * as NodePath_replacement from "./replacement.ts"; +import * as NodePath_evaluation from "./evaluation.ts"; +import * as NodePath_conversion from "./conversion.ts"; +import * as NodePath_introspection from "./introspection.ts"; +import * as NodePath_context from "./context.ts"; +import * as NodePath_removal from "./removal.ts"; +import * as NodePath_modification from "./modification.ts"; +import * as NodePath_family from "./family.ts"; +import * as NodePath_comments from "./comments.ts"; +import * as NodePath_virtual_types_validator from "./lib/virtual-types-validator.ts"; +import type { NodePathAssertions } from "./generated/asserts.ts"; +import type { NodePathValidators } from "./generated/validators.ts"; const debug = buildDebug("babel"); diff --git a/packages/babel-traverse/src/path/inference/index.ts b/packages/babel-traverse/src/path/inference/index.ts index 845bf324cb29..ab8b79b4ce78 100644 --- a/packages/babel-traverse/src/path/inference/index.ts +++ b/packages/babel-traverse/src/path/inference/index.ts @@ -1,5 +1,5 @@ -import type NodePath from "../index"; -import * as inferers from "./inferers"; +import type NodePath from "../index.ts"; +import * as inferers from "./inferers.ts"; import { anyTypeAnnotation, isAnyTypeAnnotation, diff --git a/packages/babel-traverse/src/path/inference/inferer-reference.ts b/packages/babel-traverse/src/path/inference/inferer-reference.ts index 1e71b03154ae..c50be5bd41ef 100644 --- a/packages/babel-traverse/src/path/inference/inferer-reference.ts +++ b/packages/babel-traverse/src/path/inference/inferer-reference.ts @@ -1,4 +1,4 @@ -import type NodePath from "../index"; +import type NodePath from "../index.ts"; import { BOOLEAN_NUMBER_BINARY_OPERATORS, createTypeAnnotationBasedOnTypeof, @@ -6,9 +6,9 @@ import { voidTypeAnnotation, } from "@babel/types"; import type * as t from "@babel/types"; -import type Binding from "../../scope/binding"; +import type Binding from "../../scope/binding.ts"; -import { createUnionType } from "./util"; +import { createUnionType } from "./util.ts"; export default function (this: NodePath, node: t.Identifier) { if (!this.isReferenced()) return; diff --git a/packages/babel-traverse/src/path/inference/inferers.ts b/packages/babel-traverse/src/path/inference/inferers.ts index 165c3b36afa2..29576600bd8e 100644 --- a/packages/babel-traverse/src/path/inference/inferers.ts +++ b/packages/babel-traverse/src/path/inference/inferers.ts @@ -20,10 +20,10 @@ import { } from "@babel/types"; import type * as t from "@babel/types"; -export { default as Identifier } from "./inferer-reference"; +export { default as Identifier } from "./inferer-reference.ts"; -import { createUnionType } from "./util"; -import type NodePath from ".."; +import { createUnionType } from "./util.ts"; +import type NodePath from "../index.ts"; export function VariableDeclarator(this: NodePath) { if (!this.get("id").isIdentifier()) return; diff --git a/packages/babel-traverse/src/path/introspection.ts b/packages/babel-traverse/src/path/introspection.ts index 176867f409b0..269540fb4a68 100644 --- a/packages/babel-traverse/src/path/introspection.ts +++ b/packages/babel-traverse/src/path/introspection.ts @@ -1,6 +1,6 @@ // This file contains methods responsible for introspecting the current path for certain values. -import type NodePath from "./index"; +import type NodePath from "./index.ts"; import { STATEMENT_OR_BLOCK_KEYS, VISITOR_KEYS, diff --git a/packages/babel-traverse/src/path/lib/hoister.ts b/packages/babel-traverse/src/path/lib/hoister.ts index 4d5822d825ab..f66806fec7f2 100644 --- a/packages/babel-traverse/src/path/lib/hoister.ts +++ b/packages/babel-traverse/src/path/lib/hoister.ts @@ -6,10 +6,10 @@ import { variableDeclarator, } from "@babel/types"; import type * as t from "@babel/types"; -import type Scope from "../../scope"; -import type NodePath from "../index"; -import type Binding from "../../scope/binding"; -import type { Visitor } from "../../types"; +import type Scope from "../../scope/index.ts"; +import type NodePath from "../index.ts"; +import type Binding from "../../scope/binding.ts"; +import type { Visitor } from "../../types.ts"; const referenceVisitor: Visitor = { // This visitor looks for bindings to establish a topmost scope for hoisting. diff --git a/packages/babel-traverse/src/path/lib/removal-hooks.ts b/packages/babel-traverse/src/path/lib/removal-hooks.ts index ed3c1c3d7d1c..958e0802f382 100644 --- a/packages/babel-traverse/src/path/lib/removal-hooks.ts +++ b/packages/babel-traverse/src/path/lib/removal-hooks.ts @@ -1,6 +1,6 @@ // this file contains hooks that handle ancestry cleanup of parent nodes when removing children -import type NodePath from ".."; +import type NodePath from "../index.ts"; import type * as t from "@babel/types"; /** * Pre hooks should be used for either rejecting removal or delegating removal diff --git a/packages/babel-traverse/src/path/lib/virtual-types-validator.ts b/packages/babel-traverse/src/path/lib/virtual-types-validator.ts index 6da221af4f21..cfce26dd0b92 100644 --- a/packages/babel-traverse/src/path/lib/virtual-types-validator.ts +++ b/packages/babel-traverse/src/path/lib/virtual-types-validator.ts @@ -1,4 +1,4 @@ -import type NodePath from "../index"; +import type NodePath from "../index.ts"; import { isBinding, isBlockScoped as nodeIsBlockScoped, @@ -24,7 +24,7 @@ import { } from "@babel/types"; import type * as t from "@babel/types"; const { isCompatTag } = react; -import type { VirtualTypeAliases } from "./virtual-types"; +import type { VirtualTypeAliases } from "./virtual-types.ts"; type Opts = Partial<{ [Prop in keyof Obj]: Obj[Prop] extends t.Node diff --git a/packages/babel-traverse/src/path/modification.ts b/packages/babel-traverse/src/path/modification.ts index 8e03f3e03092..11f6b0d2fb37 100644 --- a/packages/babel-traverse/src/path/modification.ts +++ b/packages/babel-traverse/src/path/modification.ts @@ -1,8 +1,8 @@ // This file contains methods that modify the path/node in some ways. -import { getCachedPaths } from "../cache"; -import PathHoister from "./lib/hoister"; -import NodePath from "./index"; +import { getCachedPaths } from "../cache.ts"; +import PathHoister from "./lib/hoister.ts"; +import NodePath from "./index.ts"; import { arrowFunctionExpression, assertExpression, @@ -21,7 +21,7 @@ import { thisExpression, } from "@babel/types"; import type * as t from "@babel/types"; -import type Scope from "../scope"; +import type Scope from "../scope/index.ts"; /** * Insert the provided nodes before the current one. diff --git a/packages/babel-traverse/src/path/removal.ts b/packages/babel-traverse/src/path/removal.ts index 85d86c756a9f..5ed2f7a30ab7 100644 --- a/packages/babel-traverse/src/path/removal.ts +++ b/packages/babel-traverse/src/path/removal.ts @@ -1,9 +1,9 @@ // This file contains methods responsible for removing a node. -import { hooks } from "./lib/removal-hooks"; -import { getCachedPaths } from "../cache"; -import type NodePath from "./index"; -import { REMOVED, SHOULD_SKIP } from "./index"; +import { hooks } from "./lib/removal-hooks.ts"; +import { getCachedPaths } from "../cache.ts"; +import type NodePath from "./index.ts"; +import { REMOVED, SHOULD_SKIP } from "./index.ts"; export function remove(this: NodePath) { this._assertUnremoved(); diff --git a/packages/babel-traverse/src/path/replacement.ts b/packages/babel-traverse/src/path/replacement.ts index 4fc4fa3fe6a7..3508097fa3da 100644 --- a/packages/babel-traverse/src/path/replacement.ts +++ b/packages/babel-traverse/src/path/replacement.ts @@ -1,9 +1,9 @@ // This file contains methods responsible for replacing a node with another. import { codeFrameColumns } from "@babel/code-frame"; -import traverse from "../index"; -import NodePath from "./index"; -import { getCachedPaths } from "../cache"; +import traverse from "../index.ts"; +import NodePath from "./index.ts"; +import { getCachedPaths } from "../cache.ts"; import { parse } from "@babel/parser"; import { FUNCTION_TYPES, diff --git a/packages/babel-traverse/src/scope/binding.ts b/packages/babel-traverse/src/scope/binding.ts index 39c64ac50be9..c5d8e30bc1de 100644 --- a/packages/babel-traverse/src/scope/binding.ts +++ b/packages/babel-traverse/src/scope/binding.ts @@ -1,6 +1,6 @@ -import type NodePath from "../path"; +import type NodePath from "../path/index.ts"; import type * as t from "@babel/types"; -import type Scope from "./index"; +import type Scope from "./index.ts"; export type BindingKind = | "var" /* var declarator */ diff --git a/packages/babel-traverse/src/scope/index.ts b/packages/babel-traverse/src/scope/index.ts index 0bb9788a6e08..f9f651993d01 100644 --- a/packages/babel-traverse/src/scope/index.ts +++ b/packages/babel-traverse/src/scope/index.ts @@ -1,9 +1,9 @@ -import Renamer from "./lib/renamer"; -import type NodePath from "../path"; -import traverse from "../index"; -import type { TraverseOptions } from "../index"; -import Binding from "./binding"; -import type { BindingKind } from "./binding"; +import Renamer from "./lib/renamer.ts"; +import type NodePath from "../path/index.ts"; +import traverse from "../index.ts"; +import type { TraverseOptions } from "../index.ts"; +import Binding from "./binding.ts"; +import type { BindingKind } from "./binding.ts"; import globals from "globals"; import { NOT_LOCAL_BINDING, @@ -52,9 +52,9 @@ import { isExportDeclaration, } from "@babel/types"; import * as t from "@babel/types"; -import { scope as scopeCache } from "../cache"; -import type { Visitor } from "../types"; -import { isExplodedVisitor } from "../visitors"; +import { scope as scopeCache } from "../cache.ts"; +import type { Visitor } from "../types.ts"; +import { isExplodedVisitor } from "../visitors.ts"; type NodePart = string | number | boolean; // Recursively gathers the identifying names of a node. diff --git a/packages/babel-traverse/src/scope/lib/renamer.ts b/packages/babel-traverse/src/scope/lib/renamer.ts index 80f79d6df10e..0c37e5029f83 100644 --- a/packages/babel-traverse/src/scope/lib/renamer.ts +++ b/packages/babel-traverse/src/scope/lib/renamer.ts @@ -1,10 +1,10 @@ -import type Binding from "../binding"; +import type Binding from "../binding.ts"; import splitExportDeclaration from "@babel/helper-split-export-declaration"; import * as t from "@babel/types"; -import type { NodePath, Visitor } from "../.."; +import type { NodePath, Visitor } from "../../index.ts"; import { requeueComputedKeyAndDecorators } from "@babel/helper-environment-visitor"; -import { traverseNode } from "../../traverse-node"; -import { explode } from "../../visitors"; +import { traverseNode } from "../../traverse-node.ts"; +import { explode } from "../../visitors.ts"; import type { Identifier } from "@babel/types"; const renameVisitor: Visitor = { diff --git a/packages/babel-traverse/src/traverse-node.ts b/packages/babel-traverse/src/traverse-node.ts index 37f571953baa..859c75e43976 100644 --- a/packages/babel-traverse/src/traverse-node.ts +++ b/packages/babel-traverse/src/traverse-node.ts @@ -1,7 +1,7 @@ -import TraversalContext from "./context"; -import type { ExplodedTraverseOptions } from "./index"; -import type NodePath from "./path"; -import type Scope from "./scope"; +import TraversalContext from "./context.ts"; +import type { ExplodedTraverseOptions } from "./index.ts"; +import type NodePath from "./path/index.ts"; +import type Scope from "./scope/index.ts"; import type * as t from "@babel/types"; import { VISITOR_KEYS } from "@babel/types"; diff --git a/packages/babel-traverse/src/types.ts b/packages/babel-traverse/src/types.ts index 6aa8292db930..fdd2270bd314 100644 --- a/packages/babel-traverse/src/types.ts +++ b/packages/babel-traverse/src/types.ts @@ -1,6 +1,6 @@ import type * as t from "@babel/types"; -import type { NodePath } from "./index"; -import type { VirtualTypeAliases } from "./path/lib/virtual-types"; +import type { NodePath } from "./index.ts"; +import type { VirtualTypeAliases } from "./path/lib/virtual-types.ts"; export type VisitPhase = "enter" | "exit"; diff --git a/packages/babel-traverse/src/visitors.ts b/packages/babel-traverse/src/visitors.ts index c5fc89621021..0b0f603daefb 100644 --- a/packages/babel-traverse/src/visitors.ts +++ b/packages/babel-traverse/src/visitors.ts @@ -1,4 +1,4 @@ -import * as virtualTypes from "./path/lib/virtual-types"; +import * as virtualTypes from "./path/lib/virtual-types.ts"; import type { Node } from "@babel/types"; import { DEPRECATED_KEYS, @@ -7,8 +7,8 @@ import { TYPES, __internal__deprecationWarning as deprecationWarning, } from "@babel/types"; -import type { ExplodedVisitor, NodePath, Visitor } from "./index"; -import type { ExplVisitNode, VisitNodeFunction, VisitPhase } from "./types"; +import type { ExplodedVisitor, NodePath, Visitor } from "./index.ts"; +import type { ExplVisitNode, VisitNodeFunction, VisitPhase } from "./types.ts"; type VIRTUAL_TYPES = keyof typeof virtualTypes; function isVirtualType(type: string): type is VIRTUAL_TYPES { diff --git a/packages/babel-types/scripts/generators/asserts.js b/packages/babel-types/scripts/generators/asserts.js index e640a10ecd0a..f42cd4055415 100644 --- a/packages/babel-types/scripts/generators/asserts.js +++ b/packages/babel-types/scripts/generators/asserts.js @@ -24,9 +24,9 @@ export default function generateAsserts() { * This file is auto-generated! Do not modify it directly. * To re-generate run 'make build' */ -import is from "../../validators/is"; -import type * as t from "../.."; -import deprecationWarning from "../../utils/deprecationWarning"; +import is from "../../validators/is.ts"; +import type * as t from "../../index.ts"; +import deprecationWarning from "../../utils/deprecationWarning.ts"; function assert(type: string, node: any, opts?: any): void { if (!is(type, node, opts)) { diff --git a/packages/babel-types/scripts/generators/builders.js b/packages/babel-types/scripts/generators/builders.js index f491223d0838..90002caa27c3 100644 --- a/packages/babel-types/scripts/generators/builders.js +++ b/packages/babel-types/scripts/generators/builders.js @@ -100,9 +100,9 @@ function generateLowercaseBuilders() { * This file is auto-generated! Do not modify it directly. * To re-generate run 'make build' */ -import validateNode from "../validateNode"; -import type * as t from "../.."; -import deprecationWarning from "../../utils/deprecationWarning"; +import validateNode from "../validateNode.ts"; +import type * as t from "../../index.ts"; +import deprecationWarning from "../../utils/deprecationWarning.ts"; `; const reservedNames = new Set(["super", "import"]); @@ -203,6 +203,6 @@ function generateUppercaseBuilders() { output += ` ${formattedBuilderName} as ${type},\n`; }); - output += ` } from './index';\n`; + output += ` } from './index.ts';\n`; return output; } diff --git a/packages/babel-types/scripts/generators/constants.js b/packages/babel-types/scripts/generators/constants.js index 18a05c23e1e1..3c38c89980c0 100644 --- a/packages/babel-types/scripts/generators/constants.js +++ b/packages/babel-types/scripts/generators/constants.js @@ -5,7 +5,7 @@ export default function generateConstants() { * This file is auto-generated! Do not modify it directly. * To re-generate run 'make build' */ -import { FLIPPED_ALIAS_KEYS } from "../../definitions";\n\n`; +import { FLIPPED_ALIAS_KEYS } from "../../definitions/index.ts";\n\n`; Object.keys(FLIPPED_ALIAS_KEYS) .filter( diff --git a/packages/babel-types/scripts/generators/validators.js b/packages/babel-types/scripts/generators/validators.js index 95577fc18cb1..ca212aa70f98 100644 --- a/packages/babel-types/scripts/generators/validators.js +++ b/packages/babel-types/scripts/generators/validators.js @@ -77,9 +77,9 @@ export default function generateValidators() { /* eslint-disable no-fallthrough */ -import shallowEqual from "../../utils/shallowEqual"; -import type * as t from "../.."; -import deprecationWarning from "../../utils/deprecationWarning"; +import shallowEqual from "../../utils/shallowEqual.ts"; +import type * as t from "../../index.ts"; +import deprecationWarning from "../../utils/deprecationWarning.ts"; type Opts = Partial<{ [Prop in keyof Obj]: Obj[Prop] extends t.Node diff --git a/packages/babel-types/src/asserts/assertNode.ts b/packages/babel-types/src/asserts/assertNode.ts index b496daec1707..1451fa077da6 100644 --- a/packages/babel-types/src/asserts/assertNode.ts +++ b/packages/babel-types/src/asserts/assertNode.ts @@ -1,5 +1,5 @@ -import isNode from "../validators/isNode"; -import type * as t from ".."; +import isNode from "../validators/isNode.ts"; +import type * as t from "../index.ts"; export default function assertNode(node?: any): asserts node is t.Node { if (!isNode(node)) { diff --git a/packages/babel-types/src/asserts/generated/index.ts b/packages/babel-types/src/asserts/generated/index.ts index abb8c6e795d4..238e62a485e1 100644 --- a/packages/babel-types/src/asserts/generated/index.ts +++ b/packages/babel-types/src/asserts/generated/index.ts @@ -2,9 +2,9 @@ * This file is auto-generated! Do not modify it directly. * To re-generate run 'make build' */ -import is from "../../validators/is"; -import type * as t from "../.."; -import deprecationWarning from "../../utils/deprecationWarning"; +import is from "../../validators/is.ts"; +import type * as t from "../../index.ts"; +import deprecationWarning from "../../utils/deprecationWarning.ts"; function assert(type: string, node: any, opts?: any): void { if (!is(type, node, opts)) { diff --git a/packages/babel-types/src/builders/flow/createFlowUnionType.ts b/packages/babel-types/src/builders/flow/createFlowUnionType.ts index 91314ff89dfe..4cfd94b8d850 100644 --- a/packages/babel-types/src/builders/flow/createFlowUnionType.ts +++ b/packages/babel-types/src/builders/flow/createFlowUnionType.ts @@ -1,6 +1,6 @@ -import { unionTypeAnnotation } from "../generated"; -import removeTypeDuplicates from "../../modifications/flow/removeTypeDuplicates"; -import type * as t from "../.."; +import { unionTypeAnnotation } from "../generated/index.ts"; +import removeTypeDuplicates from "../../modifications/flow/removeTypeDuplicates.ts"; +import type * as t from "../../index.ts"; /** * Takes an array of `types` and flattens them, removing duplicates and diff --git a/packages/babel-types/src/builders/flow/createTypeAnnotationBasedOnTypeof.ts b/packages/babel-types/src/builders/flow/createTypeAnnotationBasedOnTypeof.ts index 6fdfb8ace6e2..79b8782233ff 100644 --- a/packages/babel-types/src/builders/flow/createTypeAnnotationBasedOnTypeof.ts +++ b/packages/babel-types/src/builders/flow/createTypeAnnotationBasedOnTypeof.ts @@ -6,8 +6,8 @@ import { booleanTypeAnnotation, genericTypeAnnotation, identifier, -} from "../generated"; -import type * as t from "../.."; +} from "../generated/index.ts"; +import type * as t from "../../index.ts"; export default createTypeAnnotationBasedOnTypeof as { (type: "string"): t.StringTypeAnnotation; diff --git a/packages/babel-types/src/builders/generated/index.ts b/packages/babel-types/src/builders/generated/index.ts index 624e1dcf01a3..a48ac011c7c5 100644 --- a/packages/babel-types/src/builders/generated/index.ts +++ b/packages/babel-types/src/builders/generated/index.ts @@ -2,9 +2,9 @@ * This file is auto-generated! Do not modify it directly. * To re-generate run 'make build' */ -import validateNode from "../validateNode"; -import type * as t from "../.."; -import deprecationWarning from "../../utils/deprecationWarning"; +import validateNode from "../validateNode.ts"; +import type * as t from "../../index.ts"; +import deprecationWarning from "../../utils/deprecationWarning.ts"; export function arrayExpression( elements: Array = [], ): t.ArrayExpression { diff --git a/packages/babel-types/src/builders/generated/uppercase.js b/packages/babel-types/src/builders/generated/uppercase.js index 24bdea27f963..7a66ab77df80 100644 --- a/packages/babel-types/src/builders/generated/uppercase.js +++ b/packages/babel-types/src/builders/generated/uppercase.js @@ -262,4 +262,4 @@ export { regexLiteral as RegexLiteral, restProperty as RestProperty, spreadProperty as SpreadProperty, -} from "./index"; +} from "./index.ts"; diff --git a/packages/babel-types/src/builders/react/buildChildren.ts b/packages/babel-types/src/builders/react/buildChildren.ts index 90f9328853e6..51777a871dc7 100644 --- a/packages/babel-types/src/builders/react/buildChildren.ts +++ b/packages/babel-types/src/builders/react/buildChildren.ts @@ -2,9 +2,9 @@ import { isJSXText, isJSXExpressionContainer, isJSXEmptyExpression, -} from "../../validators/generated"; -import cleanJSXElementLiteralChild from "../../utils/react/cleanJSXElementLiteralChild"; -import type * as t from "../.."; +} from "../../validators/generated/index.ts"; +import cleanJSXElementLiteralChild from "../../utils/react/cleanJSXElementLiteralChild.ts"; +import type * as t from "../../index.ts"; type ReturnedChild = | t.JSXSpreadChild diff --git a/packages/babel-types/src/builders/typescript/createTSUnionType.ts b/packages/babel-types/src/builders/typescript/createTSUnionType.ts index 1ff47c37cddf..c6fc6d30a940 100644 --- a/packages/babel-types/src/builders/typescript/createTSUnionType.ts +++ b/packages/babel-types/src/builders/typescript/createTSUnionType.ts @@ -1,7 +1,7 @@ -import { tsUnionType } from "../generated"; -import removeTypeDuplicates from "../../modifications/typescript/removeTypeDuplicates"; -import { isTSTypeAnnotation } from "../../validators/generated/index"; -import type * as t from "../.."; +import { tsUnionType } from "../generated/index.ts"; +import removeTypeDuplicates from "../../modifications/typescript/removeTypeDuplicates.ts"; +import { isTSTypeAnnotation } from "../../validators/generated/index.ts"; +import type * as t from "../../index.ts"; /** * Takes an array of `types` and flattens them, removing duplicates and diff --git a/packages/babel-types/src/builders/validateNode.ts b/packages/babel-types/src/builders/validateNode.ts index a3518383030f..2409be690598 100644 --- a/packages/babel-types/src/builders/validateNode.ts +++ b/packages/babel-types/src/builders/validateNode.ts @@ -1,6 +1,6 @@ -import validate from "../validators/validate"; -import type * as t from ".."; -import { BUILDER_KEYS } from ".."; +import validate from "../validators/validate.ts"; +import type * as t from "../index.ts"; +import { BUILDER_KEYS } from "../index.ts"; export default function validateNode(node: N) { // todo: because keys not in BUILDER_KEYS are not validated - this actually allows invalid nodes in some cases diff --git a/packages/babel-types/src/clone/clone.ts b/packages/babel-types/src/clone/clone.ts index 2ce31a0ef336..907b67062898 100644 --- a/packages/babel-types/src/clone/clone.ts +++ b/packages/babel-types/src/clone/clone.ts @@ -1,5 +1,5 @@ -import cloneNode from "./cloneNode"; -import type * as t from ".."; +import cloneNode from "./cloneNode.ts"; +import type * as t from "../index.ts"; /** * Create a shallow clone of a `node`, including only diff --git a/packages/babel-types/src/clone/cloneDeep.ts b/packages/babel-types/src/clone/cloneDeep.ts index 072001490e8a..65f332525c7e 100644 --- a/packages/babel-types/src/clone/cloneDeep.ts +++ b/packages/babel-types/src/clone/cloneDeep.ts @@ -1,5 +1,5 @@ -import cloneNode from "./cloneNode"; -import type * as t from ".."; +import cloneNode from "./cloneNode.ts"; +import type * as t from "../index.ts"; /** * Create a deep clone of a `node` and all of it's child nodes diff --git a/packages/babel-types/src/clone/cloneDeepWithoutLoc.ts b/packages/babel-types/src/clone/cloneDeepWithoutLoc.ts index 2bab5d1f0f2c..37a78a8ab102 100644 --- a/packages/babel-types/src/clone/cloneDeepWithoutLoc.ts +++ b/packages/babel-types/src/clone/cloneDeepWithoutLoc.ts @@ -1,5 +1,5 @@ -import cloneNode from "./cloneNode"; -import type * as t from ".."; +import cloneNode from "./cloneNode.ts"; +import type * as t from "../index.ts"; /** * Create a deep clone of a `node` and all of it's child nodes * including only properties belonging to the node. diff --git a/packages/babel-types/src/clone/cloneNode.ts b/packages/babel-types/src/clone/cloneNode.ts index cae62cc7ab72..57a5412ca992 100644 --- a/packages/babel-types/src/clone/cloneNode.ts +++ b/packages/babel-types/src/clone/cloneNode.ts @@ -1,6 +1,6 @@ -import { NODE_FIELDS } from "../definitions"; -import type * as t from ".."; -import { isFile, isIdentifier } from "../validators/generated"; +import { NODE_FIELDS } from "../definitions/index.ts"; +import type * as t from "../index.ts"; +import { isFile, isIdentifier } from "../validators/generated/index.ts"; const has = Function.call.bind(Object.prototype.hasOwnProperty); diff --git a/packages/babel-types/src/clone/cloneWithoutLoc.ts b/packages/babel-types/src/clone/cloneWithoutLoc.ts index 21a09f5d6897..01f6a5505c4b 100644 --- a/packages/babel-types/src/clone/cloneWithoutLoc.ts +++ b/packages/babel-types/src/clone/cloneWithoutLoc.ts @@ -1,5 +1,5 @@ -import cloneNode from "./cloneNode"; -import type * as t from ".."; +import cloneNode from "./cloneNode.ts"; +import type * as t from "../index.ts"; /** * Create a shallow clone of a `node` excluding `_private` and location properties. diff --git a/packages/babel-types/src/comments/addComment.ts b/packages/babel-types/src/comments/addComment.ts index 80c3e617ed8d..ddd67f7d536e 100644 --- a/packages/babel-types/src/comments/addComment.ts +++ b/packages/babel-types/src/comments/addComment.ts @@ -1,5 +1,5 @@ -import addComments from "./addComments"; -import type * as t from ".."; +import addComments from "./addComments.ts"; +import type * as t from "../index.ts"; /** * Add comment of certain type to a node. diff --git a/packages/babel-types/src/comments/addComments.ts b/packages/babel-types/src/comments/addComments.ts index 5aeb69b2328d..1325c0c47e00 100644 --- a/packages/babel-types/src/comments/addComments.ts +++ b/packages/babel-types/src/comments/addComments.ts @@ -1,4 +1,4 @@ -import type * as t from ".."; +import type * as t from "../index.ts"; /** * Add comments of certain type to a node. diff --git a/packages/babel-types/src/comments/inheritInnerComments.ts b/packages/babel-types/src/comments/inheritInnerComments.ts index 1f1d31415943..aa0361a668e6 100644 --- a/packages/babel-types/src/comments/inheritInnerComments.ts +++ b/packages/babel-types/src/comments/inheritInnerComments.ts @@ -1,5 +1,5 @@ -import inherit from "../utils/inherit"; -import type * as t from ".."; +import inherit from "../utils/inherit.ts"; +import type * as t from "../index.ts"; export default function inheritInnerComments( child: t.Node, diff --git a/packages/babel-types/src/comments/inheritLeadingComments.ts b/packages/babel-types/src/comments/inheritLeadingComments.ts index 83b418d7a304..8665bfdefc42 100644 --- a/packages/babel-types/src/comments/inheritLeadingComments.ts +++ b/packages/babel-types/src/comments/inheritLeadingComments.ts @@ -1,5 +1,5 @@ -import inherit from "../utils/inherit"; -import type * as t from ".."; +import inherit from "../utils/inherit.ts"; +import type * as t from "../index.ts"; export default function inheritLeadingComments( child: t.Node, diff --git a/packages/babel-types/src/comments/inheritTrailingComments.ts b/packages/babel-types/src/comments/inheritTrailingComments.ts index bbcb3238101b..4aa151bb9a92 100644 --- a/packages/babel-types/src/comments/inheritTrailingComments.ts +++ b/packages/babel-types/src/comments/inheritTrailingComments.ts @@ -1,5 +1,5 @@ -import inherit from "../utils/inherit"; -import type * as t from ".."; +import inherit from "../utils/inherit.ts"; +import type * as t from "../index.ts"; export default function inheritTrailingComments( child: t.Node, diff --git a/packages/babel-types/src/comments/inheritsComments.ts b/packages/babel-types/src/comments/inheritsComments.ts index a1a013e45ecf..2103aaa76817 100644 --- a/packages/babel-types/src/comments/inheritsComments.ts +++ b/packages/babel-types/src/comments/inheritsComments.ts @@ -1,7 +1,7 @@ -import inheritTrailingComments from "./inheritTrailingComments"; -import inheritLeadingComments from "./inheritLeadingComments"; -import inheritInnerComments from "./inheritInnerComments"; -import type * as t from ".."; +import inheritTrailingComments from "./inheritTrailingComments.ts"; +import inheritLeadingComments from "./inheritLeadingComments.ts"; +import inheritInnerComments from "./inheritInnerComments.ts"; +import type * as t from "../index.ts"; /** * Inherit all unique comments from `parent` node to `child` node. diff --git a/packages/babel-types/src/comments/removeComments.ts b/packages/babel-types/src/comments/removeComments.ts index a822f2109d14..08860b82cc2c 100644 --- a/packages/babel-types/src/comments/removeComments.ts +++ b/packages/babel-types/src/comments/removeComments.ts @@ -1,5 +1,5 @@ -import { COMMENT_KEYS } from "../constants"; -import type * as t from ".."; +import { COMMENT_KEYS } from "../constants/index.ts"; +import type * as t from "../index.ts"; /** * Remove comment properties from a node. diff --git a/packages/babel-types/src/constants/generated/index.ts b/packages/babel-types/src/constants/generated/index.ts index 1fe2db391328..a017dc86f189 100644 --- a/packages/babel-types/src/constants/generated/index.ts +++ b/packages/babel-types/src/constants/generated/index.ts @@ -2,7 +2,7 @@ * This file is auto-generated! Do not modify it directly. * To re-generate run 'make build' */ -import { FLIPPED_ALIAS_KEYS } from "../../definitions"; +import { FLIPPED_ALIAS_KEYS } from "../../definitions/index.ts"; export const STANDARDIZED_TYPES = FLIPPED_ALIAS_KEYS["Standardized"]; export const EXPRESSION_TYPES = FLIPPED_ALIAS_KEYS["Expression"]; diff --git a/packages/babel-types/src/converters/ensureBlock.ts b/packages/babel-types/src/converters/ensureBlock.ts index 0abea6b4f793..9f76b0890469 100644 --- a/packages/babel-types/src/converters/ensureBlock.ts +++ b/packages/babel-types/src/converters/ensureBlock.ts @@ -1,5 +1,5 @@ -import toBlock from "./toBlock"; -import type * as t from ".."; +import toBlock from "./toBlock.ts"; +import type * as t from "../index.ts"; /** * Ensure the `key` (defaults to "body") of a `node` is a block. diff --git a/packages/babel-types/src/converters/gatherSequenceExpressions.ts b/packages/babel-types/src/converters/gatherSequenceExpressions.ts index caed9484f014..9b7b39b6227a 100644 --- a/packages/babel-types/src/converters/gatherSequenceExpressions.ts +++ b/packages/babel-types/src/converters/gatherSequenceExpressions.ts @@ -1,4 +1,4 @@ -import getBindingIdentifiers from "../retrievers/getBindingIdentifiers"; +import getBindingIdentifiers from "../retrievers/getBindingIdentifiers.ts"; import { isExpression, isExpressionStatement, @@ -6,14 +6,14 @@ import { isIfStatement, isBlockStatement, isEmptyStatement, -} from "../validators/generated"; +} from "../validators/generated/index.ts"; import { sequenceExpression, assignmentExpression, conditionalExpression, -} from "../builders/generated"; -import cloneNode from "../clone/cloneNode"; -import type * as t from ".."; +} from "../builders/generated/index.ts"; +import cloneNode from "../clone/cloneNode.ts"; +import type * as t from "../index.ts"; import type { Scope } from "@babel/traverse"; export type DeclarationInfo = { diff --git a/packages/babel-types/src/converters/toBindingIdentifierName.ts b/packages/babel-types/src/converters/toBindingIdentifierName.ts index 1bda43565ca3..84584b567592 100644 --- a/packages/babel-types/src/converters/toBindingIdentifierName.ts +++ b/packages/babel-types/src/converters/toBindingIdentifierName.ts @@ -1,4 +1,4 @@ -import toIdentifier from "./toIdentifier"; +import toIdentifier from "./toIdentifier.ts"; export default function toBindingIdentifierName(name: string): string { name = toIdentifier(name); diff --git a/packages/babel-types/src/converters/toBlock.ts b/packages/babel-types/src/converters/toBlock.ts index 46acf7178276..76ffb4247eea 100644 --- a/packages/babel-types/src/converters/toBlock.ts +++ b/packages/babel-types/src/converters/toBlock.ts @@ -3,13 +3,13 @@ import { isFunction, isEmptyStatement, isStatement, -} from "../validators/generated"; +} from "../validators/generated/index.ts"; import { returnStatement, expressionStatement, blockStatement, -} from "../builders/generated"; -import type * as t from ".."; +} from "../builders/generated/index.ts"; +import type * as t from "../index.ts"; export default function toBlock( node: t.Statement | t.Expression, diff --git a/packages/babel-types/src/converters/toComputedKey.ts b/packages/babel-types/src/converters/toComputedKey.ts index 9302c9302bdc..40b80de2207c 100644 --- a/packages/babel-types/src/converters/toComputedKey.ts +++ b/packages/babel-types/src/converters/toComputedKey.ts @@ -1,6 +1,6 @@ -import { isIdentifier } from "../validators/generated"; -import { stringLiteral } from "../builders/generated"; -import type * as t from ".."; +import { isIdentifier } from "../validators/generated/index.ts"; +import { stringLiteral } from "../builders/generated/index.ts"; +import type * as t from "../index.ts"; export default function toComputedKey( node: diff --git a/packages/babel-types/src/converters/toExpression.ts b/packages/babel-types/src/converters/toExpression.ts index 1878ef887cdc..3bdae2eaf7e4 100644 --- a/packages/babel-types/src/converters/toExpression.ts +++ b/packages/babel-types/src/converters/toExpression.ts @@ -3,8 +3,8 @@ import { isFunction, isClass, isExpressionStatement, -} from "../validators/generated"; -import type * as t from ".."; +} from "../validators/generated/index.ts"; +import type * as t from "../index.ts"; export default toExpression as { (node: t.Function): t.FunctionExpression; diff --git a/packages/babel-types/src/converters/toIdentifier.ts b/packages/babel-types/src/converters/toIdentifier.ts index ca14168797fa..3ea38b78a790 100644 --- a/packages/babel-types/src/converters/toIdentifier.ts +++ b/packages/babel-types/src/converters/toIdentifier.ts @@ -1,4 +1,4 @@ -import isValidIdentifier from "../validators/isValidIdentifier"; +import isValidIdentifier from "../validators/isValidIdentifier.ts"; import { isIdentifierChar } from "@babel/helper-validator-identifier"; export default function toIdentifier(input: string): string { diff --git a/packages/babel-types/src/converters/toKeyAlias.ts b/packages/babel-types/src/converters/toKeyAlias.ts index 2e5f8aac4e1d..c8c35dbaae1f 100644 --- a/packages/babel-types/src/converters/toKeyAlias.ts +++ b/packages/babel-types/src/converters/toKeyAlias.ts @@ -1,7 +1,10 @@ -import { isIdentifier, isStringLiteral } from "../validators/generated"; -import cloneNode from "../clone/cloneNode"; -import removePropertiesDeep from "../modifications/removePropertiesDeep"; -import type * as t from ".."; +import { + isIdentifier, + isStringLiteral, +} from "../validators/generated/index.ts"; +import cloneNode from "../clone/cloneNode.ts"; +import removePropertiesDeep from "../modifications/removePropertiesDeep.ts"; +import type * as t from "../index.ts"; export default function toKeyAlias( node: t.Method | t.Property, diff --git a/packages/babel-types/src/converters/toSequenceExpression.ts b/packages/babel-types/src/converters/toSequenceExpression.ts index 7d8531df4e3a..bfd6a302813a 100644 --- a/packages/babel-types/src/converters/toSequenceExpression.ts +++ b/packages/babel-types/src/converters/toSequenceExpression.ts @@ -1,6 +1,6 @@ -import gatherSequenceExpressions from "./gatherSequenceExpressions"; -import type * as t from ".."; -import type { DeclarationInfo } from "./gatherSequenceExpressions"; +import gatherSequenceExpressions from "./gatherSequenceExpressions.ts"; +import type * as t from "../index.ts"; +import type { DeclarationInfo } from "./gatherSequenceExpressions.ts"; /** * Turn an array of statement `nodes` into a `SequenceExpression`. diff --git a/packages/babel-types/src/converters/toStatement.ts b/packages/babel-types/src/converters/toStatement.ts index 3a074de4f471..8f5ff7600318 100644 --- a/packages/babel-types/src/converters/toStatement.ts +++ b/packages/babel-types/src/converters/toStatement.ts @@ -3,9 +3,9 @@ import { isFunction, isClass, isAssignmentExpression, -} from "../validators/generated"; -import { expressionStatement } from "../builders/generated"; -import type * as t from ".."; +} from "../validators/generated/index.ts"; +import { expressionStatement } from "../builders/generated/index.ts"; +import type * as t from "../index.ts"; export default toStatement as { (node: t.AssignmentExpression, ignore?: boolean): t.ExpressionStatement; diff --git a/packages/babel-types/src/converters/valueToNode.ts b/packages/babel-types/src/converters/valueToNode.ts index 45dd0fead3df..c4560cd59b21 100644 --- a/packages/babel-types/src/converters/valueToNode.ts +++ b/packages/babel-types/src/converters/valueToNode.ts @@ -1,4 +1,4 @@ -import isValidIdentifier from "../validators/isValidIdentifier"; +import isValidIdentifier from "../validators/isValidIdentifier.ts"; import { identifier, booleanLiteral, @@ -11,8 +11,8 @@ import { objectExpression, unaryExpression, binaryExpression, -} from "../builders/generated"; -import type * as t from ".."; +} from "../builders/generated/index.ts"; +import type * as t from "../index.ts"; export default valueToNode as { (value: undefined): t.Identifier; // TODO: This should return "void 0" diff --git a/packages/babel-types/src/definitions/core.ts b/packages/babel-types/src/definitions/core.ts index c73897e9bb2a..0f8766db00f0 100644 --- a/packages/babel-types/src/definitions/core.ts +++ b/packages/babel-types/src/definitions/core.ts @@ -1,7 +1,7 @@ -import is from "../validators/is"; -import isValidIdentifier from "../validators/isValidIdentifier"; +import is from "../validators/is.ts"; +import isValidIdentifier from "../validators/isValidIdentifier.ts"; import { isKeyword, isReservedWord } from "@babel/helper-validator-identifier"; -import type * as t from ".."; +import type * as t from "../index.ts"; import { readStringContents } from "@babel/helper-string-parser"; import { @@ -10,7 +10,7 @@ import { ASSIGNMENT_OPERATORS, UNARY_OPERATORS, UPDATE_OPERATORS, -} from "../constants"; +} from "../constants/index.ts"; import { defineAliasedType, @@ -24,7 +24,7 @@ import { assertOneOf, validateOptional, type Validator, -} from "./utils"; +} from "./utils.ts"; const defineType = defineAliasedType("Standardized"); diff --git a/packages/babel-types/src/definitions/experimental.ts b/packages/babel-types/src/definitions/experimental.ts index 1d369549e134..0d39ab7232d5 100644 --- a/packages/babel-types/src/definitions/experimental.ts +++ b/packages/babel-types/src/definitions/experimental.ts @@ -3,7 +3,7 @@ import defineType, { assertNodeType, assertValueType, chain, -} from "./utils"; +} from "./utils.ts"; defineType("ArgumentPlaceholder", {}); diff --git a/packages/babel-types/src/definitions/flow.ts b/packages/babel-types/src/definitions/flow.ts index 0ded1d61252d..329f584bce15 100644 --- a/packages/babel-types/src/definitions/flow.ts +++ b/packages/babel-types/src/definitions/flow.ts @@ -8,7 +8,7 @@ import { validateOptional, validateOptionalType, validateType, -} from "./utils"; +} from "./utils.ts"; const defineType = defineAliasedType("Flow"); diff --git a/packages/babel-types/src/definitions/index.ts b/packages/babel-types/src/definitions/index.ts index 215d69eb671a..c08f435708ad 100644 --- a/packages/babel-types/src/definitions/index.ts +++ b/packages/babel-types/src/definitions/index.ts @@ -1,10 +1,10 @@ import toFastProperties from "to-fast-properties"; -import "./core"; -import "./flow"; -import "./jsx"; -import "./misc"; -import "./experimental"; -import "./typescript"; +import "./core.ts"; +import "./flow.ts"; +import "./jsx.ts"; +import "./misc.ts"; +import "./experimental.ts"; +import "./typescript.ts"; import { VISITOR_KEYS, ALIAS_KEYS, @@ -13,13 +13,13 @@ import { BUILDER_KEYS, DEPRECATED_KEYS, NODE_PARENT_VALIDATIONS, -} from "./utils"; +} from "./utils.ts"; import { PLACEHOLDERS, PLACEHOLDERS_ALIAS, PLACEHOLDERS_FLIPPED_ALIAS, -} from "./placeholders"; -import { DEPRECATED_ALIASES } from "./deprecated-aliases"; +} from "./placeholders.ts"; +import { DEPRECATED_ALIASES } from "./deprecated-aliases.ts"; ( Object.keys(DEPRECATED_ALIASES) as (keyof typeof DEPRECATED_ALIASES)[] @@ -60,4 +60,4 @@ export { TYPES, }; -export type { FieldOptions } from "./utils"; +export type { FieldOptions } from "./utils.ts"; diff --git a/packages/babel-types/src/definitions/jsx.ts b/packages/babel-types/src/definitions/jsx.ts index 1e55bea4f131..054808eab363 100644 --- a/packages/babel-types/src/definitions/jsx.ts +++ b/packages/babel-types/src/definitions/jsx.ts @@ -4,7 +4,7 @@ import { assertValueType, chain, assertEach, -} from "./utils"; +} from "./utils.ts"; const defineType = defineAliasedType("JSX"); diff --git a/packages/babel-types/src/definitions/misc.ts b/packages/babel-types/src/definitions/misc.ts index 228b9b0d523a..3b818cf26d60 100644 --- a/packages/babel-types/src/definitions/misc.ts +++ b/packages/babel-types/src/definitions/misc.ts @@ -3,8 +3,8 @@ import { assertNodeType, assertOneOf, assertValueType, -} from "./utils"; -import { PLACEHOLDERS } from "./placeholders"; +} from "./utils.ts"; +import { PLACEHOLDERS } from "./placeholders.ts"; const defineType = defineAliasedType("Miscellaneous"); diff --git a/packages/babel-types/src/definitions/placeholders.ts b/packages/babel-types/src/definitions/placeholders.ts index 0a4b912e38da..3817b65431da 100644 --- a/packages/babel-types/src/definitions/placeholders.ts +++ b/packages/babel-types/src/definitions/placeholders.ts @@ -1,4 +1,4 @@ -import { ALIAS_KEYS } from "./utils"; +import { ALIAS_KEYS } from "./utils.ts"; export const PLACEHOLDERS = [ "Identifier", diff --git a/packages/babel-types/src/definitions/typescript.ts b/packages/babel-types/src/definitions/typescript.ts index 3e666a1248d1..12ba6819719d 100644 --- a/packages/babel-types/src/definitions/typescript.ts +++ b/packages/babel-types/src/definitions/typescript.ts @@ -11,12 +11,12 @@ import { validateOptional, validateOptionalType, validateType, -} from "./utils"; +} from "./utils.ts"; import { functionDeclarationCommon, classMethodOrDeclareMethodCommon, -} from "./core"; -import is from "../validators/is"; +} from "./core.ts"; +import is from "../validators/is.ts"; const defineType = defineAliasedType("TypeScript"); diff --git a/packages/babel-types/src/definitions/utils.ts b/packages/babel-types/src/definitions/utils.ts index 152d901fb3aa..9c803a95c2a0 100644 --- a/packages/babel-types/src/definitions/utils.ts +++ b/packages/babel-types/src/definitions/utils.ts @@ -1,6 +1,6 @@ -import is from "../validators/is"; -import { validateField, validateChild } from "../validators/validate"; -import type * as t from ".."; +import is from "../validators/is.ts"; +import { validateField, validateChild } from "../validators/validate.ts"; +import type * as t from "../index.ts"; export const VISITOR_KEYS: Record = {}; export const ALIAS_KEYS: Partial> = diff --git a/packages/babel-types/src/index.ts b/packages/babel-types/src/index.ts index 61e43e7ab042..7a479ca0bd2d 100644 --- a/packages/babel-types/src/index.ts +++ b/packages/babel-types/src/index.ts @@ -1,98 +1,98 @@ -import isReactComponent from "./validators/react/isReactComponent"; -import isCompatTag from "./validators/react/isCompatTag"; -import buildChildren from "./builders/react/buildChildren"; +import isReactComponent from "./validators/react/isReactComponent.ts"; +import isCompatTag from "./validators/react/isCompatTag.ts"; +import buildChildren from "./builders/react/buildChildren.ts"; // asserts -export { default as assertNode } from "./asserts/assertNode"; -export * from "./asserts/generated"; +export { default as assertNode } from "./asserts/assertNode.ts"; +export * from "./asserts/generated/index.ts"; // builders -export { default as createTypeAnnotationBasedOnTypeof } from "./builders/flow/createTypeAnnotationBasedOnTypeof"; +export { default as createTypeAnnotationBasedOnTypeof } from "./builders/flow/createTypeAnnotationBasedOnTypeof.ts"; /** @deprecated use createFlowUnionType instead */ -export { default as createUnionTypeAnnotation } from "./builders/flow/createFlowUnionType"; -export { default as createFlowUnionType } from "./builders/flow/createFlowUnionType"; -export { default as createTSUnionType } from "./builders/typescript/createTSUnionType"; -export * from "./builders/generated"; -export * from "./builders/generated/uppercase"; +export { default as createUnionTypeAnnotation } from "./builders/flow/createFlowUnionType.ts"; +export { default as createFlowUnionType } from "./builders/flow/createFlowUnionType.ts"; +export { default as createTSUnionType } from "./builders/typescript/createTSUnionType.ts"; +export * from "./builders/generated/index.ts"; +export * from "./builders/generated/uppercase.js"; // clone -export { default as cloneNode } from "./clone/cloneNode"; -export { default as clone } from "./clone/clone"; -export { default as cloneDeep } from "./clone/cloneDeep"; -export { default as cloneDeepWithoutLoc } from "./clone/cloneDeepWithoutLoc"; -export { default as cloneWithoutLoc } from "./clone/cloneWithoutLoc"; +export { default as cloneNode } from "./clone/cloneNode.ts"; +export { default as clone } from "./clone/clone.ts"; +export { default as cloneDeep } from "./clone/cloneDeep.ts"; +export { default as cloneDeepWithoutLoc } from "./clone/cloneDeepWithoutLoc.ts"; +export { default as cloneWithoutLoc } from "./clone/cloneWithoutLoc.ts"; // comments -export { default as addComment } from "./comments/addComment"; -export { default as addComments } from "./comments/addComments"; -export { default as inheritInnerComments } from "./comments/inheritInnerComments"; -export { default as inheritLeadingComments } from "./comments/inheritLeadingComments"; -export { default as inheritsComments } from "./comments/inheritsComments"; -export { default as inheritTrailingComments } from "./comments/inheritTrailingComments"; -export { default as removeComments } from "./comments/removeComments"; +export { default as addComment } from "./comments/addComment.ts"; +export { default as addComments } from "./comments/addComments.ts"; +export { default as inheritInnerComments } from "./comments/inheritInnerComments.ts"; +export { default as inheritLeadingComments } from "./comments/inheritLeadingComments.ts"; +export { default as inheritsComments } from "./comments/inheritsComments.ts"; +export { default as inheritTrailingComments } from "./comments/inheritTrailingComments.ts"; +export { default as removeComments } from "./comments/removeComments.ts"; // constants -export * from "./constants/generated"; -export * from "./constants"; +export * from "./constants/generated/index.ts"; +export * from "./constants/index.ts"; // converters -export { default as ensureBlock } from "./converters/ensureBlock"; -export { default as toBindingIdentifierName } from "./converters/toBindingIdentifierName"; -export { default as toBlock } from "./converters/toBlock"; -export { default as toComputedKey } from "./converters/toComputedKey"; -export { default as toExpression } from "./converters/toExpression"; -export { default as toIdentifier } from "./converters/toIdentifier"; -export { default as toKeyAlias } from "./converters/toKeyAlias"; -export { default as toSequenceExpression } from "./converters/toSequenceExpression"; -export { default as toStatement } from "./converters/toStatement"; -export { default as valueToNode } from "./converters/valueToNode"; +export { default as ensureBlock } from "./converters/ensureBlock.ts"; +export { default as toBindingIdentifierName } from "./converters/toBindingIdentifierName.ts"; +export { default as toBlock } from "./converters/toBlock.ts"; +export { default as toComputedKey } from "./converters/toComputedKey.ts"; +export { default as toExpression } from "./converters/toExpression.ts"; +export { default as toIdentifier } from "./converters/toIdentifier.ts"; +export { default as toKeyAlias } from "./converters/toKeyAlias.ts"; +export { default as toSequenceExpression } from "./converters/toSequenceExpression.ts"; +export { default as toStatement } from "./converters/toStatement.ts"; +export { default as valueToNode } from "./converters/valueToNode.ts"; // definitions -export * from "./definitions"; +export * from "./definitions/index.ts"; // modifications -export { default as appendToMemberExpression } from "./modifications/appendToMemberExpression"; -export { default as inherits } from "./modifications/inherits"; -export { default as prependToMemberExpression } from "./modifications/prependToMemberExpression"; +export { default as appendToMemberExpression } from "./modifications/appendToMemberExpression.ts"; +export { default as inherits } from "./modifications/inherits.ts"; +export { default as prependToMemberExpression } from "./modifications/prependToMemberExpression.ts"; export { default as removeProperties, type Options as RemovePropertiesOptions, -} from "./modifications/removeProperties"; -export { default as removePropertiesDeep } from "./modifications/removePropertiesDeep"; -export { default as removeTypeDuplicates } from "./modifications/flow/removeTypeDuplicates"; +} from "./modifications/removeProperties.ts"; +export { default as removePropertiesDeep } from "./modifications/removePropertiesDeep.ts"; +export { default as removeTypeDuplicates } from "./modifications/flow/removeTypeDuplicates.ts"; // retrievers -export { default as getBindingIdentifiers } from "./retrievers/getBindingIdentifiers"; -export { default as getOuterBindingIdentifiers } from "./retrievers/getOuterBindingIdentifiers"; +export { default as getBindingIdentifiers } from "./retrievers/getBindingIdentifiers.ts"; +export { default as getOuterBindingIdentifiers } from "./retrievers/getOuterBindingIdentifiers.ts"; // traverse -export { default as traverse } from "./traverse/traverse"; -export * from "./traverse/traverse"; -export { default as traverseFast } from "./traverse/traverseFast"; +export { default as traverse } from "./traverse/traverse.ts"; +export * from "./traverse/traverse.ts"; +export { default as traverseFast } from "./traverse/traverseFast.ts"; // utils -export { default as shallowEqual } from "./utils/shallowEqual"; +export { default as shallowEqual } from "./utils/shallowEqual.ts"; // validators -export { default as is } from "./validators/is"; -export { default as isBinding } from "./validators/isBinding"; -export { default as isBlockScoped } from "./validators/isBlockScoped"; -export { default as isImmutable } from "./validators/isImmutable"; -export { default as isLet } from "./validators/isLet"; -export { default as isNode } from "./validators/isNode"; -export { default as isNodesEquivalent } from "./validators/isNodesEquivalent"; -export { default as isPlaceholderType } from "./validators/isPlaceholderType"; -export { default as isReferenced } from "./validators/isReferenced"; -export { default as isScope } from "./validators/isScope"; -export { default as isSpecifierDefault } from "./validators/isSpecifierDefault"; -export { default as isType } from "./validators/isType"; -export { default as isValidES3Identifier } from "./validators/isValidES3Identifier"; -export { default as isValidIdentifier } from "./validators/isValidIdentifier"; -export { default as isVar } from "./validators/isVar"; -export { default as matchesPattern } from "./validators/matchesPattern"; -export { default as validate } from "./validators/validate"; -export { default as buildMatchMemberExpression } from "./validators/buildMatchMemberExpression"; -export * from "./validators/generated"; +export { default as is } from "./validators/is.ts"; +export { default as isBinding } from "./validators/isBinding.ts"; +export { default as isBlockScoped } from "./validators/isBlockScoped.ts"; +export { default as isImmutable } from "./validators/isImmutable.ts"; +export { default as isLet } from "./validators/isLet.ts"; +export { default as isNode } from "./validators/isNode.ts"; +export { default as isNodesEquivalent } from "./validators/isNodesEquivalent.ts"; +export { default as isPlaceholderType } from "./validators/isPlaceholderType.ts"; +export { default as isReferenced } from "./validators/isReferenced.ts"; +export { default as isScope } from "./validators/isScope.ts"; +export { default as isSpecifierDefault } from "./validators/isSpecifierDefault.ts"; +export { default as isType } from "./validators/isType.ts"; +export { default as isValidES3Identifier } from "./validators/isValidES3Identifier.ts"; +export { default as isValidIdentifier } from "./validators/isValidIdentifier.ts"; +export { default as isVar } from "./validators/isVar.ts"; +export { default as matchesPattern } from "./validators/matchesPattern.ts"; +export { default as validate } from "./validators/validate.ts"; +export { default as buildMatchMemberExpression } from "./validators/buildMatchMemberExpression.ts"; +export * from "./validators/generated/index.ts"; // react export const react = { @@ -101,7 +101,7 @@ export const react = { buildChildren, }; -export type * from "./ast-types/generated"; +export type * from "./ast-types/generated/index.ts"; // this is used by @babel/traverse to warn about deprecated visitors -export { default as __internal__deprecationWarning } from "./utils/deprecationWarning"; +export { default as __internal__deprecationWarning } from "./utils/deprecationWarning.ts"; diff --git a/packages/babel-types/src/modifications/appendToMemberExpression.ts b/packages/babel-types/src/modifications/appendToMemberExpression.ts index ded0408bf03a..0ab2cda3e683 100644 --- a/packages/babel-types/src/modifications/appendToMemberExpression.ts +++ b/packages/babel-types/src/modifications/appendToMemberExpression.ts @@ -1,5 +1,5 @@ -import { memberExpression } from "../builders/generated"; -import type * as t from ".."; +import { memberExpression } from "../builders/generated/index.ts"; +import type * as t from "../index.ts"; /** * Append a node to a member expression. diff --git a/packages/babel-types/src/modifications/flow/removeTypeDuplicates.ts b/packages/babel-types/src/modifications/flow/removeTypeDuplicates.ts index d850d182a4d8..ba6b5982887c 100644 --- a/packages/babel-types/src/modifications/flow/removeTypeDuplicates.ts +++ b/packages/babel-types/src/modifications/flow/removeTypeDuplicates.ts @@ -4,8 +4,8 @@ import { isUnionTypeAnnotation, isFlowBaseAnnotation, isIdentifier, -} from "../../validators/generated"; -import type * as t from "../.."; +} from "../../validators/generated/index.ts"; +import type * as t from "../../index.ts"; function getQualifiedName(node: t.GenericTypeAnnotation["id"]): string { return isIdentifier(node) diff --git a/packages/babel-types/src/modifications/inherits.ts b/packages/babel-types/src/modifications/inherits.ts index 5fbf401b15c7..1c457f37b830 100644 --- a/packages/babel-types/src/modifications/inherits.ts +++ b/packages/babel-types/src/modifications/inherits.ts @@ -1,6 +1,6 @@ -import { INHERIT_KEYS } from "../constants"; -import inheritsComments from "../comments/inheritsComments"; -import type * as t from ".."; +import { INHERIT_KEYS } from "../constants/index.ts"; +import inheritsComments from "../comments/inheritsComments.ts"; +import type * as t from "../index.ts"; /** * Inherit all contextual properties from `parent` node to `child` node. diff --git a/packages/babel-types/src/modifications/prependToMemberExpression.ts b/packages/babel-types/src/modifications/prependToMemberExpression.ts index f211e814ed4c..f55a85b731c8 100644 --- a/packages/babel-types/src/modifications/prependToMemberExpression.ts +++ b/packages/babel-types/src/modifications/prependToMemberExpression.ts @@ -1,6 +1,6 @@ -import { memberExpression } from "../builders/generated"; -import { isSuper } from ".."; -import type * as t from ".."; +import { memberExpression } from "../builders/generated/index.ts"; +import { isSuper } from "../index.ts"; +import type * as t from "../index.ts"; /** * Prepend a node to a member expression. diff --git a/packages/babel-types/src/modifications/removeProperties.ts b/packages/babel-types/src/modifications/removeProperties.ts index 8ea5c7283955..4e338786cea4 100644 --- a/packages/babel-types/src/modifications/removeProperties.ts +++ b/packages/babel-types/src/modifications/removeProperties.ts @@ -1,5 +1,5 @@ -import { COMMENT_KEYS } from "../constants"; -import type * as t from ".."; +import { COMMENT_KEYS } from "../constants/index.ts"; +import type * as t from "../index.ts"; const CLEAR_KEYS = [ "tokens", // only exist in t.File diff --git a/packages/babel-types/src/modifications/removePropertiesDeep.ts b/packages/babel-types/src/modifications/removePropertiesDeep.ts index c22fa32a16ff..a4c98e5593fd 100644 --- a/packages/babel-types/src/modifications/removePropertiesDeep.ts +++ b/packages/babel-types/src/modifications/removePropertiesDeep.ts @@ -1,6 +1,6 @@ -import traverseFast from "../traverse/traverseFast"; -import removeProperties from "./removeProperties"; -import type * as t from ".."; +import traverseFast from "../traverse/traverseFast.ts"; +import removeProperties from "./removeProperties.ts"; +import type * as t from "../index.ts"; export default function removePropertiesDeep( tree: T, diff --git a/packages/babel-types/src/modifications/typescript/removeTypeDuplicates.ts b/packages/babel-types/src/modifications/typescript/removeTypeDuplicates.ts index e33a8b9a0db8..1b799665f090 100644 --- a/packages/babel-types/src/modifications/typescript/removeTypeDuplicates.ts +++ b/packages/babel-types/src/modifications/typescript/removeTypeDuplicates.ts @@ -4,8 +4,8 @@ import { isTSTypeReference, isTSUnionType, isTSBaseType, -} from "../../validators/generated"; -import type * as t from "../.."; +} from "../../validators/generated/index.ts"; +import type * as t from "../../index.ts"; function getQualifiedName(node: t.TSTypeReference["typeName"]): string { return isIdentifier(node) diff --git a/packages/babel-types/src/retrievers/getBindingIdentifiers.ts b/packages/babel-types/src/retrievers/getBindingIdentifiers.ts index ee6e92800bf2..bc3a184ddb89 100644 --- a/packages/babel-types/src/retrievers/getBindingIdentifiers.ts +++ b/packages/babel-types/src/retrievers/getBindingIdentifiers.ts @@ -5,8 +5,8 @@ import { isFunctionDeclaration, isFunctionExpression, isExportAllDeclaration, -} from "../validators/generated"; -import type * as t from ".."; +} from "../validators/generated/index.ts"; +import type * as t from "../index.ts"; export { getBindingIdentifiers as default }; diff --git a/packages/babel-types/src/retrievers/getOuterBindingIdentifiers.ts b/packages/babel-types/src/retrievers/getOuterBindingIdentifiers.ts index 935ed613e65e..ac5cf15129a3 100644 --- a/packages/babel-types/src/retrievers/getOuterBindingIdentifiers.ts +++ b/packages/babel-types/src/retrievers/getOuterBindingIdentifiers.ts @@ -1,5 +1,5 @@ -import getBindingIdentifiers from "./getBindingIdentifiers"; -import type * as t from ".."; +import getBindingIdentifiers from "./getBindingIdentifiers.ts"; +import type * as t from "../index.ts"; export default getOuterBindingIdentifiers as { (node: t.Node, duplicates: true): Record>; diff --git a/packages/babel-types/src/traverse/traverse.ts b/packages/babel-types/src/traverse/traverse.ts index d6b737d38d52..53881d127440 100644 --- a/packages/babel-types/src/traverse/traverse.ts +++ b/packages/babel-types/src/traverse/traverse.ts @@ -1,5 +1,5 @@ -import { VISITOR_KEYS } from "../definitions"; -import type * as t from ".."; +import { VISITOR_KEYS } from "../definitions/index.ts"; +import type * as t from "../index.ts"; export type TraversalAncestors = Array<{ node: t.Node; diff --git a/packages/babel-types/src/traverse/traverseFast.ts b/packages/babel-types/src/traverse/traverseFast.ts index a51c6d21087a..58840b869933 100644 --- a/packages/babel-types/src/traverse/traverseFast.ts +++ b/packages/babel-types/src/traverse/traverseFast.ts @@ -1,5 +1,5 @@ -import { VISITOR_KEYS } from "../definitions"; -import type * as t from ".."; +import { VISITOR_KEYS } from "../definitions/index.ts"; +import type * as t from "../index.ts"; /** * A prefix AST traversal implementation meant for simple searching diff --git a/packages/babel-types/src/utils/inherit.ts b/packages/babel-types/src/utils/inherit.ts index 3067ea6785b8..fa385e95e1d9 100644 --- a/packages/babel-types/src/utils/inherit.ts +++ b/packages/babel-types/src/utils/inherit.ts @@ -1,4 +1,4 @@ -import type * as t from ".."; +import type * as t from "../index.ts"; export default function inherit< C extends t.Node | undefined, diff --git a/packages/babel-types/src/utils/react/cleanJSXElementLiteralChild.ts b/packages/babel-types/src/utils/react/cleanJSXElementLiteralChild.ts index 969ae0ffb6c5..dc3c1001ecff 100644 --- a/packages/babel-types/src/utils/react/cleanJSXElementLiteralChild.ts +++ b/packages/babel-types/src/utils/react/cleanJSXElementLiteralChild.ts @@ -1,6 +1,6 @@ -import { stringLiteral } from "../../builders/generated"; -import type * as t from "../.."; -import { inherits } from "../.."; +import { stringLiteral } from "../../builders/generated/index.ts"; +import type * as t from "../../index.ts"; +import { inherits } from "../../index.ts"; export default function cleanJSXElementLiteralChild( child: t.JSXText, diff --git a/packages/babel-types/src/validators/buildMatchMemberExpression.ts b/packages/babel-types/src/validators/buildMatchMemberExpression.ts index a020dba06bf1..8e5b04113d1c 100644 --- a/packages/babel-types/src/validators/buildMatchMemberExpression.ts +++ b/packages/babel-types/src/validators/buildMatchMemberExpression.ts @@ -1,5 +1,5 @@ -import matchesPattern from "./matchesPattern"; -import type * as t from ".."; +import matchesPattern from "./matchesPattern.ts"; +import type * as t from "../index.ts"; /** * Build a function that when called will return whether or not the diff --git a/packages/babel-types/src/validators/generated/index.ts b/packages/babel-types/src/validators/generated/index.ts index 4ea3fb808ff9..c6f2c02e8baa 100644 --- a/packages/babel-types/src/validators/generated/index.ts +++ b/packages/babel-types/src/validators/generated/index.ts @@ -5,9 +5,9 @@ /* eslint-disable no-fallthrough */ -import shallowEqual from "../../utils/shallowEqual"; -import type * as t from "../.."; -import deprecationWarning from "../../utils/deprecationWarning"; +import shallowEqual from "../../utils/shallowEqual.ts"; +import type * as t from "../../index.ts"; +import deprecationWarning from "../../utils/deprecationWarning.ts"; type Opts = Partial<{ [Prop in keyof Obj]: Obj[Prop] extends t.Node diff --git a/packages/babel-types/src/validators/is.ts b/packages/babel-types/src/validators/is.ts index a73a0940748a..1ef375944a8c 100644 --- a/packages/babel-types/src/validators/is.ts +++ b/packages/babel-types/src/validators/is.ts @@ -1,8 +1,8 @@ -import shallowEqual from "../utils/shallowEqual"; -import isType from "./isType"; -import isPlaceholderType from "./isPlaceholderType"; -import { FLIPPED_ALIAS_KEYS } from "../definitions"; -import type * as t from ".."; +import shallowEqual from "../utils/shallowEqual.ts"; +import isType from "./isType.ts"; +import isPlaceholderType from "./isPlaceholderType.ts"; +import { FLIPPED_ALIAS_KEYS } from "../definitions/index.ts"; +import type * as t from "../index.ts"; export default function is( type: T, diff --git a/packages/babel-types/src/validators/isBinding.ts b/packages/babel-types/src/validators/isBinding.ts index 4af7de6dea04..3fc30d27a562 100644 --- a/packages/babel-types/src/validators/isBinding.ts +++ b/packages/babel-types/src/validators/isBinding.ts @@ -1,5 +1,5 @@ -import getBindingIdentifiers from "../retrievers/getBindingIdentifiers"; -import type * as t from ".."; +import getBindingIdentifiers from "../retrievers/getBindingIdentifiers.ts"; +import type * as t from "../index.ts"; /** * Check if the input `node` is a binding identifier. */ diff --git a/packages/babel-types/src/validators/isBlockScoped.ts b/packages/babel-types/src/validators/isBlockScoped.ts index 828963cf6165..01997c35b1aa 100644 --- a/packages/babel-types/src/validators/isBlockScoped.ts +++ b/packages/babel-types/src/validators/isBlockScoped.ts @@ -1,6 +1,9 @@ -import { isClassDeclaration, isFunctionDeclaration } from "./generated"; -import isLet from "./isLet"; -import type * as t from ".."; +import { + isClassDeclaration, + isFunctionDeclaration, +} from "./generated/index.ts"; +import isLet from "./isLet.ts"; +import type * as t from "../index.ts"; /** * Check if the input `node` is block scoped. diff --git a/packages/babel-types/src/validators/isImmutable.ts b/packages/babel-types/src/validators/isImmutable.ts index b305953b0281..7e6358ab6058 100644 --- a/packages/babel-types/src/validators/isImmutable.ts +++ b/packages/babel-types/src/validators/isImmutable.ts @@ -1,6 +1,6 @@ -import isType from "./isType"; -import { isIdentifier } from "./generated"; -import type * as t from ".."; +import isType from "./isType.ts"; +import { isIdentifier } from "./generated/index.ts"; +import type * as t from "../index.ts"; /** * Check if the input `node` is definitely immutable. diff --git a/packages/babel-types/src/validators/isLet.ts b/packages/babel-types/src/validators/isLet.ts index 8b872ae1d956..c0101c4441c8 100644 --- a/packages/babel-types/src/validators/isLet.ts +++ b/packages/babel-types/src/validators/isLet.ts @@ -1,6 +1,6 @@ -import { isVariableDeclaration } from "./generated"; -import { BLOCK_SCOPED_SYMBOL } from "../constants"; -import type * as t from ".."; +import { isVariableDeclaration } from "./generated/index.ts"; +import { BLOCK_SCOPED_SYMBOL } from "../constants/index.ts"; +import type * as t from "../index.ts"; /** * Check if the input `node` is a `let` variable declaration. diff --git a/packages/babel-types/src/validators/isNode.ts b/packages/babel-types/src/validators/isNode.ts index 83d2f17f4c3e..69e22770d761 100644 --- a/packages/babel-types/src/validators/isNode.ts +++ b/packages/babel-types/src/validators/isNode.ts @@ -1,5 +1,5 @@ -import { VISITOR_KEYS } from "../definitions"; -import type * as t from ".."; +import { VISITOR_KEYS } from "../definitions/index.ts"; +import type * as t from "../index.ts"; export default function isNode(node: any): node is t.Node { return !!(node && VISITOR_KEYS[node.type]); diff --git a/packages/babel-types/src/validators/isNodesEquivalent.ts b/packages/babel-types/src/validators/isNodesEquivalent.ts index 10ba81e016fd..046143213f36 100644 --- a/packages/babel-types/src/validators/isNodesEquivalent.ts +++ b/packages/babel-types/src/validators/isNodesEquivalent.ts @@ -1,5 +1,5 @@ -import { NODE_FIELDS, VISITOR_KEYS } from "../definitions"; -import type * as t from ".."; +import { NODE_FIELDS, VISITOR_KEYS } from "../definitions/index.ts"; +import type * as t from "../index.ts"; /** * Check if two nodes are equivalent diff --git a/packages/babel-types/src/validators/isPlaceholderType.ts b/packages/babel-types/src/validators/isPlaceholderType.ts index 38af7ac06588..b6e776c1b25e 100644 --- a/packages/babel-types/src/validators/isPlaceholderType.ts +++ b/packages/babel-types/src/validators/isPlaceholderType.ts @@ -1,4 +1,4 @@ -import { PLACEHOLDERS_ALIAS } from "../definitions"; +import { PLACEHOLDERS_ALIAS } from "../definitions/index.ts"; /** * Test if a `placeholderType` is a `targetType` or if `targetType` is an alias of `placeholderType`. diff --git a/packages/babel-types/src/validators/isReferenced.ts b/packages/babel-types/src/validators/isReferenced.ts index 4e34036383e8..e6c06781ba47 100644 --- a/packages/babel-types/src/validators/isReferenced.ts +++ b/packages/babel-types/src/validators/isReferenced.ts @@ -1,4 +1,4 @@ -import type * as t from ".."; +import type * as t from "../index.ts"; /** * Check if the input `node` is a reference to a bound variable. diff --git a/packages/babel-types/src/validators/isScope.ts b/packages/babel-types/src/validators/isScope.ts index 70a2a8b66f63..9e97f898a58e 100644 --- a/packages/babel-types/src/validators/isScope.ts +++ b/packages/babel-types/src/validators/isScope.ts @@ -4,8 +4,8 @@ import { isBlockStatement, isScopable, isPattern, -} from "./generated"; -import type * as t from ".."; +} from "./generated/index.ts"; +import type * as t from "../index.ts"; /** * Check if the input `node` is a scope. diff --git a/packages/babel-types/src/validators/isSpecifierDefault.ts b/packages/babel-types/src/validators/isSpecifierDefault.ts index 33bec5f6c5e0..d52c922d5786 100644 --- a/packages/babel-types/src/validators/isSpecifierDefault.ts +++ b/packages/babel-types/src/validators/isSpecifierDefault.ts @@ -1,5 +1,5 @@ -import { isIdentifier, isImportDefaultSpecifier } from "./generated"; -import type * as t from ".."; +import { isIdentifier, isImportDefaultSpecifier } from "./generated/index.ts"; +import type * as t from "../index.ts"; /** * Check if the input `specifier` is a `default` import or export. diff --git a/packages/babel-types/src/validators/isType.ts b/packages/babel-types/src/validators/isType.ts index a95fb5c40f5d..bb2a8274db19 100644 --- a/packages/babel-types/src/validators/isType.ts +++ b/packages/babel-types/src/validators/isType.ts @@ -1,5 +1,5 @@ -import { FLIPPED_ALIAS_KEYS, ALIAS_KEYS } from "../definitions"; -import type * as t from ".."; +import { FLIPPED_ALIAS_KEYS, ALIAS_KEYS } from "../definitions/index.ts"; +import type * as t from "../index.ts"; export default function isType( nodeType: string, diff --git a/packages/babel-types/src/validators/isValidES3Identifier.ts b/packages/babel-types/src/validators/isValidES3Identifier.ts index c19e3844e878..f24fcd950acf 100644 --- a/packages/babel-types/src/validators/isValidES3Identifier.ts +++ b/packages/babel-types/src/validators/isValidES3Identifier.ts @@ -1,4 +1,4 @@ -import isValidIdentifier from "./isValidIdentifier"; +import isValidIdentifier from "./isValidIdentifier.ts"; const RESERVED_WORDS_ES3_ONLY: Set = new Set([ "abstract", diff --git a/packages/babel-types/src/validators/isVar.ts b/packages/babel-types/src/validators/isVar.ts index 1fd135ed3c0e..bed81be1f88e 100644 --- a/packages/babel-types/src/validators/isVar.ts +++ b/packages/babel-types/src/validators/isVar.ts @@ -1,6 +1,6 @@ -import { isVariableDeclaration } from "./generated"; -import { BLOCK_SCOPED_SYMBOL } from "../constants"; -import type * as t from ".."; +import { isVariableDeclaration } from "./generated/index.ts"; +import { BLOCK_SCOPED_SYMBOL } from "../constants/index.ts"; +import type * as t from "../index.ts"; /** * Check if the input `node` is a variable declaration. diff --git a/packages/babel-types/src/validators/matchesPattern.ts b/packages/babel-types/src/validators/matchesPattern.ts index c8acedb8dd7a..cc144cffd5f7 100644 --- a/packages/babel-types/src/validators/matchesPattern.ts +++ b/packages/babel-types/src/validators/matchesPattern.ts @@ -3,8 +3,8 @@ import { isMemberExpression, isStringLiteral, isThisExpression, -} from "./generated"; -import type * as t from ".."; +} from "./generated/index.ts"; +import type * as t from "../index.ts"; /** * Determines whether or not the input node `member` matches the diff --git a/packages/babel-types/src/validators/react/isReactComponent.ts b/packages/babel-types/src/validators/react/isReactComponent.ts index 70a7616daef2..a84832f7ad32 100644 --- a/packages/babel-types/src/validators/react/isReactComponent.ts +++ b/packages/babel-types/src/validators/react/isReactComponent.ts @@ -1,4 +1,4 @@ -import buildMatchMemberExpression from "../buildMatchMemberExpression"; +import buildMatchMemberExpression from "../buildMatchMemberExpression.ts"; const isReactComponent = buildMatchMemberExpression("React.Component"); diff --git a/packages/babel-types/src/validators/validate.ts b/packages/babel-types/src/validators/validate.ts index 82bf11589414..5c998b77e125 100644 --- a/packages/babel-types/src/validators/validate.ts +++ b/packages/babel-types/src/validators/validate.ts @@ -2,8 +2,8 @@ import { NODE_FIELDS, NODE_PARENT_VALIDATIONS, type FieldOptions, -} from "../definitions"; -import type * as t from ".."; +} from "../definitions/index.ts"; +import type * as t from "../index.ts"; export default function validate( node: t.Node | undefined | null, diff --git a/tsconfig.base.json b/tsconfig.base.json index 1a9a49fec979..c811c02b567a 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -10,6 +10,7 @@ "moduleResolution": "node", "esModuleInterop": true, "isolatedModules": true, + "allowImportingTsExtensions": true, "skipLibCheck": false, "resolveJsonModule": true, "noImplicitThis": true,