UNPKG

@storm-stack/core

Version:

A build toolkit and runtime used by Storm Software in TypeScript applications

90 lines (87 loc) 3.62 kB
import { Context, MetaInfo, InlineConfig, WorkspaceConfig, SerializedContext } from '../types/index.js'; import '@babel/core'; import '@babel/types'; import '@storm-stack/types/shared/error'; import '@stryke/types/base'; import 'magic-string'; import '@storm-software/config-tools/types'; import '@stryke/types/configuration'; import 'hookable'; import '@storm-software/build-tools/types'; import '@storm-software/config/types'; import '@storm-software/esbuild/types'; import '@storm-software/unbuild/types'; import 'c12'; import 'esbuild'; import 'unbuild'; import '@deepkit/type'; import '../reflection-DTM1oT21.js'; import '@stryke/capnp'; import '@storm-stack/types/shared/log'; import '@stryke/env/get-env-paths'; import '@stryke/types/package-json'; import 'jest-worker'; import 'jiti'; import 'memfs'; import 'unimport'; import '../types/tsconfig.js'; import '@stryke/types/tsconfig'; import 'typescript'; import '../types/vfs.js'; import 'memfs/lib/volume'; import 'node:fs'; import 'unionfs'; interface CreateContextOptions { name?: string; } declare const PROJECT_ROOT_HASH_LENGTH = 45; /** * Generates a prefixed project root hash object. * * @remarks * This function returns a string where the project root hash is prefixed with the project name plus a hyphen. If the total length of this string combination exceeds 45 characters, it will truncate the hash. * * @param name - The name of the project. * @param projectRootHash - The hash of the project root. * @returns An object containing the name and project root hash. */ declare function getPrefixedProjectRootHash(name: string, projectRootHash: string): string; declare function discoverTemplates(path: string): Promise<string[]>; declare function getChecksum(path: string): Promise<string>; declare function getPersistedMeta(context: Context): Promise<MetaInfo | undefined>; /** * Creates a new context for the Storm Stack build process. * * @remarks * This function initializes the context with the provided inline configuration, workspace configuration, and other options. * * @param inlineConfig - The inline configuration for the Storm Stack build process. * @param workspaceConfig - The workspace configuration for the Storm Stack project. * @param options - Additional options for creating the context. * @returns The created context. */ declare function createContext<TContext extends Context = Context>(inlineConfig: InlineConfig, workspaceConfig?: WorkspaceConfig, options?: CreateContextOptions): Promise<TContext>; /** * Serializes the context to a format suitable for sending over the network. * * @param context - The context to serialize. * @returns The serialized context. */ declare function serializeContext(context: Context): SerializedContext; /** * Deserializes the context from a serialized format. * * @param serialized - The serialized context. * @param logName - The name of the log to use for the context. * @returns The deserialized context. */ declare function deserializeContext(serialized: SerializedContext, logName?: string | null): Context; /** * Writes the meta file for the context. * * @param context - The context to write the meta file for. * @returns A promise that resolves when the meta file has been written. */ declare function writeMetaFile(context: Context): Promise<void>; declare type __ΩCreateContextOptions = any[]; export { type CreateContextOptions, PROJECT_ROOT_HASH_LENGTH, type __ΩCreateContextOptions, createContext, deserializeContext, discoverTemplates, getChecksum, getPersistedMeta, getPrefixedProjectRootHash, serializeContext, writeMetaFile };