Skip to content

Commit

Permalink
Add explicit extensions to all imports
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolo-ribaudo committed Aug 31, 2023
1 parent 11dad3d commit fe9867e
Show file tree
Hide file tree
Showing 289 changed files with 1,087 additions and 1,039 deletions.
2 changes: 1 addition & 1 deletion Gulpfile.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "";
Expand Down
54 changes: 28 additions & 26 deletions lib/third-party-libs.d.ts
Original file line number Diff line number Diff line change
@@ -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<typeof declare>;
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<typeof declare>;
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<typeof declare>;
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<typeof declare>;
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<typeof declare>;
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<typeof declare>;
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<typeof declare>;
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<typeof declare>;
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<typeof declare>;
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<typeof declare>;
let exports: {default: typeof plugin};
let exports: { default: typeof plugin };
export = exports;
}
6 changes: 3 additions & 3 deletions packages/babel-cli/src/babel/dir.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 3 additions & 3 deletions packages/babel-cli/src/babel/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions packages/babel-cli/src/babel/index.ts
Original file line number Diff line number Diff line change
@@ -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);

Expand Down
2 changes: 1 addition & 1 deletion packages/babel-cli/src/babel/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
4 changes: 2 additions & 2 deletions packages/babel-core/src/config/cache-contexts.ts
Original file line number Diff line number Diff line change
@@ -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 };

Expand Down
4 changes: 2 additions & 2 deletions packages/babel-core/src/config/caching.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 };

Expand Down
26 changes: 13 additions & 13 deletions packages/babel-core/src/config/config-chain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@
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,
ConfigApplicableTest,
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");

Expand All @@ -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<UnloadedDescriptor<PluginAPI>>;
Expand Down
16 changes: 8 additions & 8 deletions packages/babel-core/src/config/config-descriptors.ts
Original file line number Diff line number Diff line change
@@ -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
Expand Down
26 changes: 13 additions & 13 deletions packages/babel-core/src/config/files/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
4 changes: 2 additions & 2 deletions packages/babel-core/src/config/files/index-browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 };

Expand Down
8 changes: 4 additions & 4 deletions packages/babel-core/src/config/files/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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";
10 changes: 5 additions & 5 deletions packages/babel-core/src/config/files/module-types.ts
Original file line number Diff line number Diff line change
@@ -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);

Expand Down
6 changes: 3 additions & 3 deletions packages/babel-core/src/config/files/package.ts
Original file line number Diff line number Diff line change
@@ -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";

Expand Down
6 changes: 3 additions & 3 deletions packages/babel-core/src/config/files/plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit fe9867e

Please sign in to comment.