diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 1c75255ca3a6..d8f7ae463032 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -53,6 +53,14 @@ module.exports = { "error", { disallowTypeAnnotations: false }, ], + "@typescript-eslint/no-use-before-define": [ + "error", + { + functions: false, + classes: false, + allowNamedExports: true, + }, + ], }, }, { diff --git a/packages/babel-core/src/config/config-chain.ts b/packages/babel-core/src/config/config-chain.ts index 7867e039e433..394d9da5a78f 100644 --- a/packages/babel-core/src/config/config-chain.ts +++ b/packages/babel-core/src/config/config-chain.ts @@ -1,3 +1,5 @@ +/* eslint-disable @typescript-eslint/no-use-before-define */ + import path from "path"; import buildDebug from "debug"; import type { Handler } from "gensync"; diff --git a/packages/babel-core/src/config/config-descriptors.ts b/packages/babel-core/src/config/config-descriptors.ts index 7483516806a2..72b46fa8ea5b 100644 --- a/packages/babel-core/src/config/config-descriptors.ts +++ b/packages/babel-core/src/config/config-descriptors.ts @@ -101,11 +101,13 @@ export function createCachedDescriptors( plugins: plugins ? () => // @ts-expect-error todo(flow->ts) ts complains about incorrect arguments + // eslint-disable-next-line @typescript-eslint/no-use-before-define createCachedPluginDescriptors(plugins, dirname)(alias) : () => handlerOf([]), presets: presets ? () => // @ts-expect-error todo(flow->ts) ts complains about incorrect arguments + // eslint-disable-next-line @typescript-eslint/no-use-before-define createCachedPresetDescriptors(presets, dirname)(alias)( !!passPerPreset, ) diff --git a/packages/babel-core/src/config/files/configuration.ts b/packages/babel-core/src/config/files/configuration.ts index 3632aaa0313a..511c7058178d 100644 --- a/packages/babel-core/src/config/files/configuration.ts +++ b/packages/babel-core/src/config/files/configuration.ts @@ -39,133 +39,6 @@ const RELATIVE_CONFIG_FILENAMES = [ const BABELIGNORE_FILENAME = ".babelignore"; -export function findConfigUpwards(rootDir: string): string | null { - let dirname = rootDir; - for (;;) { - for (const filename of ROOT_CONFIG_FILENAMES) { - if (nodeFs.existsSync(path.join(dirname, filename))) { - return dirname; - } - } - - const nextDir = path.dirname(dirname); - if (dirname === nextDir) break; - dirname = nextDir; - } - - return null; -} - -export function* findRelativeConfig( - packageData: FilePackageData, - envName: string, - caller: CallerMetadata | undefined, -): Handler { - let config = null; - let ignore = null; - - const dirname = path.dirname(packageData.filepath); - - for (const loc of packageData.directories) { - if (!config) { - config = yield* loadOneConfig( - RELATIVE_CONFIG_FILENAMES, - loc, - envName, - caller, - packageData.pkg?.dirname === loc - ? packageToBabelConfig(packageData.pkg as ConfigFile) - : null, - ); - } - - if (!ignore) { - const ignoreLoc = path.join(loc, BABELIGNORE_FILENAME); - ignore = yield* readIgnoreConfig(ignoreLoc); - - if (ignore) { - debug("Found ignore %o from %o.", ignore.filepath, dirname); - } - } - } - - return { config, ignore }; -} - -export function findRootConfig( - dirname: string, - envName: string, - caller: CallerMetadata | undefined, -): Handler { - return loadOneConfig(ROOT_CONFIG_FILENAMES, dirname, envName, caller); -} - -function* loadOneConfig( - names: string[], - dirname: string, - envName: string, - caller: CallerMetadata | undefined, - previousConfig: ConfigFile | null = null, -): Handler { - const configs = yield* gensync.all( - names.map(filename => - readConfig(path.join(dirname, filename), envName, caller), - ), - ); - const config = configs.reduce((previousConfig: ConfigFile | null, config) => { - if (config && previousConfig) { - throw new ConfigError( - `Multiple configuration files found. Please remove one:\n` + - ` - ${path.basename(previousConfig.filepath)}\n` + - ` - ${config.filepath}\n` + - `from ${dirname}`, - ); - } - - return config || previousConfig; - }, previousConfig); - - if (config) { - debug("Found configuration %o from %o.", config.filepath, dirname); - } - return config; -} - -export function* loadConfig( - name: string, - dirname: string, - envName: string, - caller: CallerMetadata | undefined, -): Handler { - const filepath = require.resolve(name, { paths: [dirname] }); - - const conf = yield* readConfig(filepath, envName, caller); - if (!conf) { - throw new ConfigError( - `Config file contains no configuration data`, - filepath, - ); - } - - debug("Loaded config %o from %o.", name, dirname); - return conf; -} - -/** - * Read the given config file, returning the result. Returns null if no config was found, but will - * throw if there are parsing errors while loading a config. - */ -function readConfig( - filepath: string, - envName: string, - caller: CallerMetadata | undefined, -): Handler { - const ext = path.extname(filepath); - return ext === ".js" || ext === ".cjs" || ext === ".mjs" - ? readConfigJS(filepath, { envName, caller }) - : readConfigJSON5(filepath); -} - const LOADING_CONFIGS = new Set(); const readConfigJS = makeStrongCache(function* readConfigJS( @@ -318,6 +191,133 @@ const readIgnoreConfig = makeStaticFileCache((filepath, content) => { }; }); +export function findConfigUpwards(rootDir: string): string | null { + let dirname = rootDir; + for (;;) { + for (const filename of ROOT_CONFIG_FILENAMES) { + if (nodeFs.existsSync(path.join(dirname, filename))) { + return dirname; + } + } + + const nextDir = path.dirname(dirname); + if (dirname === nextDir) break; + dirname = nextDir; + } + + return null; +} + +export function* findRelativeConfig( + packageData: FilePackageData, + envName: string, + caller: CallerMetadata | undefined, +): Handler { + let config = null; + let ignore = null; + + const dirname = path.dirname(packageData.filepath); + + for (const loc of packageData.directories) { + if (!config) { + config = yield* loadOneConfig( + RELATIVE_CONFIG_FILENAMES, + loc, + envName, + caller, + packageData.pkg?.dirname === loc + ? packageToBabelConfig(packageData.pkg as ConfigFile) + : null, + ); + } + + if (!ignore) { + const ignoreLoc = path.join(loc, BABELIGNORE_FILENAME); + ignore = yield* readIgnoreConfig(ignoreLoc); + + if (ignore) { + debug("Found ignore %o from %o.", ignore.filepath, dirname); + } + } + } + + return { config, ignore }; +} + +export function findRootConfig( + dirname: string, + envName: string, + caller: CallerMetadata | undefined, +): Handler { + return loadOneConfig(ROOT_CONFIG_FILENAMES, dirname, envName, caller); +} + +function* loadOneConfig( + names: string[], + dirname: string, + envName: string, + caller: CallerMetadata | undefined, + previousConfig: ConfigFile | null = null, +): Handler { + const configs = yield* gensync.all( + names.map(filename => + readConfig(path.join(dirname, filename), envName, caller), + ), + ); + const config = configs.reduce((previousConfig: ConfigFile | null, config) => { + if (config && previousConfig) { + throw new ConfigError( + `Multiple configuration files found. Please remove one:\n` + + ` - ${path.basename(previousConfig.filepath)}\n` + + ` - ${config.filepath}\n` + + `from ${dirname}`, + ); + } + + return config || previousConfig; + }, previousConfig); + + if (config) { + debug("Found configuration %o from %o.", config.filepath, dirname); + } + return config; +} + +export function* loadConfig( + name: string, + dirname: string, + envName: string, + caller: CallerMetadata | undefined, +): Handler { + const filepath = require.resolve(name, { paths: [dirname] }); + + const conf = yield* readConfig(filepath, envName, caller); + if (!conf) { + throw new ConfigError( + `Config file contains no configuration data`, + filepath, + ); + } + + debug("Loaded config %o from %o.", name, dirname); + return conf; +} + +/** + * Read the given config file, returning the result. Returns null if no config was found, but will + * throw if there are parsing errors while loading a config. + */ +function readConfig( + filepath: string, + envName: string, + caller: CallerMetadata | undefined, +): Handler { + const ext = path.extname(filepath); + return ext === ".js" || ext === ".cjs" || ext === ".mjs" + ? readConfigJS(filepath, { envName, caller }) + : readConfigJSON5(filepath); +} + export function* resolveShowConfigPath( dirname: string, ): Handler { diff --git a/packages/babel-core/src/config/files/package.ts b/packages/babel-core/src/config/files/package.ts index e83c86f1701e..b8867eb4f92f 100644 --- a/packages/babel-core/src/config/files/package.ts +++ b/packages/babel-core/src/config/files/package.ts @@ -8,33 +8,6 @@ import ConfigError from "../../errors/config-error"; const PACKAGE_FILENAME = "package.json"; -/** - * Find metadata about the package that this file is inside of. Resolution - * of Babel's config requires general package information to decide when to - * search for .babelrc files - */ -export function* findPackageData(filepath: string): Handler { - let pkg = null; - const directories = []; - let isPackage = true; - - let dirname = path.dirname(filepath); - while (!pkg && path.basename(dirname) !== "node_modules") { - directories.push(dirname); - - pkg = yield* readConfigPackage(path.join(dirname, PACKAGE_FILENAME)); - - const nextLoc = path.dirname(dirname); - if (dirname === nextLoc) { - isPackage = false; - break; - } - dirname = nextLoc; - } - - return { filepath, directories, pkg, isPackage }; -} - const readConfigPackage = makeStaticFileCache( (filepath, content): ConfigFile => { let options; @@ -66,3 +39,30 @@ const readConfigPackage = makeStaticFileCache( }; }, ); + +/** + * Find metadata about the package that this file is inside of. Resolution + * of Babel's config requires general package information to decide when to + * search for .babelrc files + */ +export function* findPackageData(filepath: string): Handler { + let pkg = null; + const directories = []; + let isPackage = true; + + let dirname = path.dirname(filepath); + while (!pkg && path.basename(dirname) !== "node_modules") { + directories.push(dirname); + + pkg = yield* readConfigPackage(path.join(dirname, PACKAGE_FILENAME)); + + const nextLoc = path.dirname(dirname); + if (dirname === nextLoc) { + isPackage = false; + break; + } + dirname = nextLoc; + } + + return { filepath, directories, pkg, isPackage }; +} diff --git a/packages/babel-core/src/config/files/plugins.ts b/packages/babel-core/src/config/files/plugins.ts index a02a096b62f7..ae9a70f230ca 100644 --- a/packages/babel-core/src/config/files/plugins.ts +++ b/packages/babel-core/src/config/files/plugins.ts @@ -28,10 +28,12 @@ const OTHER_PRESET_ORG_RE = const OTHER_ORG_DEFAULT_RE = /^(@(?!babel$)[^/]+)$/; export function* resolvePlugin(name: string, dirname: string): Handler { + // eslint-disable-next-line @typescript-eslint/no-use-before-define return yield* resolveStandardizedName("plugin", name, dirname); } export function* resolvePreset(name: string, dirname: string): Handler { + // eslint-disable-next-line @typescript-eslint/no-use-before-define return yield* resolveStandardizedName("preset", name, dirname); } diff --git a/packages/babel-core/src/config/full.ts b/packages/babel-core/src/config/full.ts index 36b68623281d..4bee2c7f8354 100644 --- a/packages/babel-core/src/config/full.ts +++ b/packages/babel-core/src/config/full.ts @@ -328,29 +328,6 @@ const presetDescriptorLoader = makeDescriptorLoader< PresetAPI >(makePresetAPI); -/** - * Instantiate a plugin for the given descriptor, returning the plugin/options pair. - */ -function* loadPluginDescriptor( - descriptor: UnloadedDescriptor, - context: Context.SimplePlugin, -): Handler { - if (descriptor.value instanceof Plugin) { - if (descriptor.options) { - throw new Error( - "Passed options to an existing Plugin instance will not work.", - ); - } - - return descriptor.value; - } - - return yield* instantiatePlugin( - yield* pluginDescriptorLoader(descriptor, context), - context, - ); -} - const instantiatePlugin = makeWeakCache(function* ( { value, options, dirname, alias, externalDependencies }: LoadedDescriptor, cache: CacheConfigurator, @@ -406,6 +383,29 @@ const instantiatePlugin = makeWeakCache(function* ( return new Plugin(plugin, options, alias, externalDependencies); }); +/** + * Instantiate a plugin for the given descriptor, returning the plugin/options pair. + */ +function* loadPluginDescriptor( + descriptor: UnloadedDescriptor, + context: Context.SimplePlugin, +): Handler { + if (descriptor.value instanceof Plugin) { + if (descriptor.options) { + throw new Error( + "Passed options to an existing Plugin instance will not work.", + ); + } + + return descriptor.value; + } + + return yield* instantiatePlugin( + yield* pluginDescriptorLoader(descriptor, context), + context, + ); +} + const needsFilename = (val: unknown) => val && typeof val !== "function"; const validateIfOptionNeedsFilename = ( @@ -448,6 +448,22 @@ const validatePreset = ( } }; +const instantiatePreset = makeWeakCacheSync( + ({ + value, + dirname, + alias, + externalDependencies, + }: LoadedDescriptor): PresetInstance => { + return { + options: validate("preset", value), + alias, + dirname, + externalDependencies, + }; + }, +); + /** * Generate a config object that will act as the root of a new nested config. */ @@ -468,22 +484,6 @@ function* loadPresetDescriptor( }; } -const instantiatePreset = makeWeakCacheSync( - ({ - value, - dirname, - alias, - externalDependencies, - }: LoadedDescriptor): PresetInstance => { - return { - options: validate("preset", value), - alias, - dirname, - externalDependencies, - }; - }, -); - function chain( a: undefined | ((...args: Args) => void), b: undefined | ((...args: Args) => void), diff --git a/packages/babel-core/src/config/item.ts b/packages/babel-core/src/config/item.ts index a85a94f2be25..2a448ff3d1b9 100644 --- a/packages/babel-core/src/config/item.ts +++ b/packages/babel-core/src/config/item.ts @@ -37,6 +37,8 @@ export function* createConfigItem( return createItemFromDescriptor(descriptor); } +const CONFIG_ITEM_BRAND = Symbol.for("@babel/core@7 - ConfigItem"); + export function getItemDescriptor(item: unknown): UnloadedDescriptor | void { if ((item as any)?.[CONFIG_ITEM_BRAND]) { return (item as ConfigItem)._descriptor; @@ -47,8 +49,6 @@ export function getItemDescriptor(item: unknown): UnloadedDescriptor | void { export type { ConfigItem }; -const CONFIG_ITEM_BRAND = Symbol.for("@babel/core@7 - ConfigItem"); - /** * A public representation of a plugin/preset that will _eventually_ be load. * Users can use this to interact with the results of a loaded Babel diff --git a/packages/babel-core/src/transformation/block-hoist-plugin.ts b/packages/babel-core/src/transformation/block-hoist-plugin.ts index 54b1eef5d31f..07394a8a5ada 100644 --- a/packages/babel-core/src/transformation/block-hoist-plugin.ts +++ b/packages/babel-core/src/transformation/block-hoist-plugin.ts @@ -5,6 +5,47 @@ import Plugin from "../config/plugin"; let LOADED_PLUGIN: Plugin | void; +const blockHoistPlugin: PluginObject = { + /** + * [Please add a description.] + * + * Priority: + * + * - 0 We want this to be at the **very** bottom + * - 1 Default node position + * - 2 Priority over normal nodes + * - 3 We want this to be at the **very** top + * - 4 Reserved for the helpers used to implement module imports. + */ + + name: "internal.blockHoist", + + visitor: { + Block: { + exit({ node }) { + const { body } = node; + + // Largest SMI + let max = 2 ** 30 - 1; + let hasChange = false; + for (let i = 0; i < body.length; i++) { + const n = body[i]; + const p = priority(n); + if (p > max) { + hasChange = true; + break; + } + max = p; + } + if (!hasChange) return; + + // My kingdom for a stable sort! + node.body = stableSort(body.slice()); + }, + }, + }, +}; + export default function loadBlockHoistPlugin(): Plugin { if (!LOADED_PLUGIN) { // cache the loaded blockHoist plugin plugin @@ -19,6 +60,7 @@ export default function loadBlockHoistPlugin(): Plugin { return LOADED_PLUGIN; } + function priority(bodyNode: Statement & { _blockHoist?: number | true }) { const priority = bodyNode?._blockHoist; if (priority == null) return 1; @@ -55,44 +97,3 @@ function stableSort(body: Statement[]) { } return body; } - -const blockHoistPlugin: PluginObject = { - /** - * [Please add a description.] - * - * Priority: - * - * - 0 We want this to be at the **very** bottom - * - 1 Default node position - * - 2 Priority over normal nodes - * - 3 We want this to be at the **very** top - * - 4 Reserved for the helpers used to implement module imports. - */ - - name: "internal.blockHoist", - - visitor: { - Block: { - exit({ node }) { - const { body } = node; - - // Largest SMI - let max = 2 ** 30 - 1; - let hasChange = false; - for (let i = 0; i < body.length; i++) { - const n = body[i]; - const p = priority(n); - if (p > max) { - hasChange = true; - break; - } - max = p; - } - if (!hasChange) return; - - // My kingdom for a stable sort! - node.body = stableSort(body.slice()); - }, - }, - }, -}; diff --git a/packages/babel-core/src/transformation/normalize-file.ts b/packages/babel-core/src/transformation/normalize-file.ts index 6f9aa6230402..016f6f990b6f 100644 --- a/packages/babel-core/src/transformation/normalize-file.ts +++ b/packages/babel-core/src/transformation/normalize-file.ts @@ -14,6 +14,15 @@ import cloneDeep from "./util/clone-deep"; const debug = buildDebug("babel:transform:file"); const LARGE_INPUT_SOURCEMAP_THRESHOLD = 3_000_000; +// These regexps are copied from the convert-source-map package, +// but without // or /* at the beginning of the comment. + +// eslint-disable-next-line max-len +const INLINE_SOURCEMAP_REGEX = + /^[@#]\s+sourceMappingURL=data:(?:application|text)\/json;(?:charset[:=]\S+?;)?base64,(?:.*)$/; +const EXTERNAL_SOURCEMAP_REGEX = + /^[@#][ \t]+sourceMappingURL=([^\s'"`]+)[ \t]*$/; + export type NormalizedFile = { code: string; ast: t.File; @@ -97,15 +106,6 @@ export default function* normalizeFile( }); } -// These regexps are copied from the convert-source-map package, -// but without // or /* at the beginning of the comment. - -// eslint-disable-next-line max-len -const INLINE_SOURCEMAP_REGEX = - /^[@#]\s+sourceMappingURL=data:(?:application|text)\/json;(?:charset[:=]\S+?;)?base64,(?:.*)$/; -const EXTERNAL_SOURCEMAP_REGEX = - /^[@#][ \t]+sourceMappingURL=([^\s'"`]+)[ \t]*$/; - function extractCommentsFromList( regex: RegExp, comments: t.Comment[], 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 6f814e949efb..5bfa6d2af402 100644 --- a/packages/babel-helper-create-class-features-plugin/src/fields.ts +++ b/packages/babel-helper-create-class-features-plugin/src/fields.ts @@ -107,6 +107,15 @@ interface PrivateNameVisitorState { function privateNameVisitorFactory( visitor: Visitor, ) { + // Traverses the outer portion of a class, without touching the class's inner + // scope, for private names. + const nestedVisitor = traverse.visitors.merge([ + { + ...visitor, + }, + environmentVisitor, + ]); + const privateNameVisitor: Visitor = { ...visitor, @@ -147,15 +156,6 @@ function privateNameVisitorFactory( }, }; - // Traverses the outer portion of a class, without touching the class's inner - // scope, for private names. - const nestedVisitor = traverse.visitors.merge([ - { - ...visitor, - }, - environmentVisitor, - ]); - return privateNameVisitor; } diff --git a/packages/babel-helper-module-transforms/src/index.ts b/packages/babel-helper-module-transforms/src/index.ts index acdaa364da5c..d939661d6168 100644 --- a/packages/babel-helper-module-transforms/src/index.ts +++ b/packages/babel-helper-module-transforms/src/index.ts @@ -262,11 +262,11 @@ const ReexportTemplate = { `, }; -const buildReexportsFromMeta = ( +function buildReexportsFromMeta( meta: ModuleMetadata, metadata: SourceModuleMetadata, constantReexports: boolean, -) => { +) { const namespace = metadata.lazy ? callExpression(identifier(metadata.name), []) : identifier(metadata.name); @@ -303,7 +303,7 @@ const buildReexportsFromMeta = ( return ReexportTemplate.spec(astNodes); } }); -}; +} /** * Build an "__esModule" header statement setting the property on a given object. 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 c4ee70934efb..94b1646ca321 100644 --- a/packages/babel-helper-module-transforms/src/rewrite-live-references.ts +++ b/packages/babel-helper-module-transforms/src/rewrite-live-references.ts @@ -110,6 +110,7 @@ export default function rewriteLiveReferences( exported, // local name => exported name list }; programPath.traverse( + // eslint-disable-next-line @typescript-eslint/no-use-before-define rewriteBindingInitVisitor, rewriteBindingInitVisitorState, ); @@ -159,6 +160,7 @@ export default function rewriteLiveReferences( ); }, }; + // eslint-disable-next-line @typescript-eslint/no-use-before-define programPath.traverse(rewriteReferencesVisitor, rewriteReferencesVisitorState); } @@ -179,6 +181,7 @@ const rewriteBindingInitVisitor: Visitor = { const exportNames = exported.get(localName) || []; if (exportNames.length > 0) { const statement = expressionStatement( + // eslint-disable-next-line @typescript-eslint/no-use-before-define buildBindingExportAssignmentExpression( metadata, exportNames, @@ -200,6 +203,7 @@ const rewriteBindingInitVisitor: Visitor = { if (exportNames.length > 0) { const statement = expressionStatement( + // eslint-disable-next-line @typescript-eslint/no-use-before-define buildBindingExportAssignmentExpression( metadata, exportNames, diff --git a/packages/babel-helper-module-transforms/src/rewrite-this.ts b/packages/babel-helper-module-transforms/src/rewrite-this.ts index cfd6aa9c24a2..6fb3d62605c5 100644 --- a/packages/babel-helper-module-transforms/src/rewrite-this.ts +++ b/packages/babel-helper-module-transforms/src/rewrite-this.ts @@ -3,10 +3,6 @@ import traverse from "@babel/traverse"; import { numericLiteral, unaryExpression } from "@babel/types"; import type { NodePath, Visitor } from "@babel/traverse"; -export default function rewriteThis(programPath: NodePath) { - // Rewrite "this" to be "undefined". - traverse(programPath.node, { ...rewriteThisVisitor, noScope: true }); -} /** * A visitor to walk the tree, rewriting all `this` references in the top-level scope to be @@ -20,3 +16,8 @@ const rewriteThisVisitor: Visitor = traverse.visitors.merge([ }, }, ]); + +export default function rewriteThis(programPath: NodePath) { + // Rewrite "this" to be "undefined". + traverse(programPath.node, { ...rewriteThisVisitor, noScope: true }); +} diff --git a/packages/babel-helper-plugin-utils/src/index.ts b/packages/babel-helper-plugin-utils/src/index.ts index 1ccaacdc838b..c29d320e6b36 100644 --- a/packages/babel-helper-plugin-utils/src/index.ts +++ b/packages/babel-helper-plugin-utils/src/index.ts @@ -6,6 +6,35 @@ import type { PresetObject, } from "@babel/core"; +type APIPolyfillFactory = ( + api: PluginAPI, +) => PluginAPI[T]; + +type APIPolyfills = { + assertVersion: APIPolyfillFactory<"assertVersion">; + targets: APIPolyfillFactory<"targets">; + assumption: APIPolyfillFactory<"assumption">; +}; + +const apiPolyfills: APIPolyfills = { + // Not supported by Babel 7 and early versions of Babel 7 beta. + // It's important that this is polyfilled for older Babel versions + // since it's needed to report the version mismatch. + assertVersion: (api: PluginAPI) => (range: number | string) => { + throwVersionError(range, api.version); + }, + // This is supported starting from Babel 7.13 + // TODO(Babel 8): Remove this polyfill + targets: () => () => { + return {}; + }, + // This is supported starting from Babel 7.13 + // TODO(Babel 8): Remove this polyfill + assumption: () => () => { + return undefined; + }, +}; + export function declare( builder: ( api: PluginAPI, @@ -40,35 +69,6 @@ export const declarePreset = declare as