@storm-stack/core
Version:
A build toolkit and runtime used by Storm Software in TypeScript applications
92 lines (89 loc) • 3.67 kB
text/typescript
import { ParseResult } from '@babel/parser';
import * as t from '@babel/types';
import { B as BabelPluginItem, C as Context, c as CompilerOptions, d as BabelPluginTarget } from '../babel-C68ay88r.cjs';
import '@babel/core';
import '@stryke/types/base';
import 'magic-string';
import '@storm-software/config-tools/types';
import '@stryke/types/configuration';
import 'esbuild';
import 'hookable';
import 'vite';
import '@rspack/core';
import '@storm-software/build-tools/types';
import '@storm-software/config/types';
import '@storm-software/esbuild/types';
import '@storm-software/unbuild/types';
import 'c12';
import 'rolldown';
import 'rollup';
import 'webpack';
import '@storm-stack/core/deepkit/type';
import '@stryke/env/get-env-paths';
import '@stryke/types/package-json';
import 'jest-worker';
import 'jiti';
import 'unimport';
import '../reflection-DTM1oT21.cjs';
import '@stryke/capnp';
import 'semver';
import '../tsconfig-DWrxucuq.cjs';
import '@stryke/types/tsconfig';
import 'typescript';
import 'memfs';
import 'node:fs';
import 'unionfs';
/**
* Finds an export in the given Babel AST program by its key.
*
* @param ast - The parsed Babel AST result containing the program body.
* @param key - The name of the export to find (e.g., "default" or a named export).
* @returns The declaration of the export if found, otherwise undefined.
*/
declare function findExport(ast: ParseResult<t.File>, key: string): any;
/**
* Lists all exports from the given Babel AST program.
*
* @param codeOrAst - The parsed Babel AST result containing the program body.
* @returns An array of export names, including "default" for default exports.
*/
declare function listExports(codeOrAst: ParseResult<t.File> | string): string[];
/**
* Get the name of the Babel plugin.
*
* @param plugin - The Babel plugin to get the name from.
* @returns The name of the Babel plugin, or undefined if not found.
*/
declare function getPluginName(plugin: BabelPluginItem): string | undefined;
/**
* Check if a Babel plugin is a duplicate of another plugin in the list.
*
* @param plugins - The list of existing Babel plugins.
* @param plugin - The Babel plugin to check for duplicates.
* @returns True if the plugin is a duplicate, false otherwise.
*/
declare function isDuplicatePlugin(plugins: BabelPluginItem[], plugin: BabelPluginItem): boolean;
interface SourceFile {
id: string;
}
declare function filterPluginByRuntimeId(context: Context, runtimeId: string): (sourceFile: SourceFile) => boolean;
/**
* Adds a filter to a Babel plugin or a list of Babel plugins.
*
* @param context - The context in which the plugin is being added.
* @param plugins - The Babel plugins to add the filter to.
* @param filter - The filter function to apply to the plugins.
* @param name - The name of the plugin to add the filter to.
* @returns The updated list of Babel plugins with the filter applied.
*/
declare function addPluginFilter(context: Context, plugins: BabelPluginItem[], filter: NonNullable<CompilerOptions["filter"]>, name: string): BabelPluginItem[];
/**
* Adds a filter to a Babel plugin or a list of Babel plugins.
*
* @param context - The context in which the plugin is being added.
* @param plugin - The Babel plugin to add the filter to.
* @param filter - The filter function to apply to the plugin.
* @returns The updated Babel plugin with the filter applied.
*/
declare function addPluginFilter(context: Context, plugin: BabelPluginTarget | BabelPluginItem, filter: NonNullable<CompilerOptions["filter"]>): BabelPluginItem;
export { addPluginFilter, filterPluginByRuntimeId, findExport, getPluginName, isDuplicatePlugin, listExports };