UNPKG

@storm-stack/core

Version:

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

1 lines 41.4 kB
{"version":3,"sources":["../../src/commands/prepare/config/index.ts","../../src/commands/prepare/deploy/index.ts","../../src/commands/prepare/entry/index.ts","../../src/commands/prepare/runtime/index.ts","../../src/commands/prepare/types/index.ts","../../src/commands/prepare/index.ts"],"names":["prepareConfig","context","hooks","log","LogLevelLabel","TRACE","callHook","catch","error","ERROR","message","stack","Error","cause","prepareDeploy","prepareEntry","prepareRuntime","vfs","rm","runtimePath","writeRuntimeFile","joinPaths","getFileHeader","listRuntimeFiles","filter","file","isParentPath","path","map","replacePath","replace","findFileExtension","join","prepareTypes","runtimeDtsFilePath","runtimeFiles","Promise","all","isMatchingRuntimeId","id","contents","compiler","transform","skipTransformUnimport","babel","plugins","ModuleResolverPlugin","options","typescriptPath","resolvePackage","files","reduce","ret","fileName","formatted","workspaceRoot","includes","push","sourceFileDts","getSourceFile","writeFileToDisk","getString","code","resolvedTsconfig","getParsedTypeScriptConfig","projectRoot","tsconfig","tsconfigFilePath","defu","compilerOptions","strict","noEmit","declaration","declarationMap","emitDeclarationOnly","skipLibCheck","exclude","include","tsconfigRaw","configFilePath","pathsBasePath","suppressOutputPathCheck","program","createProgram","createCompilerHost","length","runtimeModules","emitResult","emit","undefined","text","_","__","sourceFiles","_data","sourceFile","endsWith","isRuntimeFile","resolveId","trim","diagnostics","getPreEmitDiagnostics","concat","diagnosticMessages","forEach","diagnostic","line","character","getLineAndCharacterOfPosition","start","flattenDiagnosticMessageText","messageText","diagnosticMessage","slice","mainEntryPointFilePath","process","env","STORM_STACK_LOCAL","untrimmedFilePath","dtsPath","meta","projectRootHash","extractorResult","Extractor","invoke","ExtractorConfig","prepare","configObject","apiReport","enabled","reportFileName","docModel","dtsRollup","tsdocMetadata","relativePath","projectFolder","newlineKind","configObjectFullPath","packageJsonFullPath","localBuild","showVerboseMessages","succeeded","errorCount","warningCount","readFile","replaceAll","writeFile","dataPath","JSON","stringify","runtimeIdMap","virtualFiles","persistedMeta","existsSync","cachePath","createDirectory","projectType","output","dts","writeMetaFile"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,eAAsBA,aAAAA,CAAcC,SAAkBC,KAAAA,EAAkB;AACtED,EAAAA,OAAAA,CAAQE,GAAAA,CACNC,mBAAAA,CAAcC,KAAAA,EACd,CAAA,wDAAA,CAA0D,CAAA;AAG5D,EAAA,MAAMH,MAAMI,QAAAA,CAAS,gBAAA,EAAkBL,OAAAA,CAAAA,CAASM,KAAAA,CAAM,CAACC,KAAAA,KAAAA;AACrDP,IAAAA,OAAAA,CAAQE,GAAAA,CACNC,mBAAAA,CAAcK,KAAAA,EACd,CAAA,iFAAA,EAAoFD,MAAME,OAAO,CAAA;EAAMF,KAAAA,CAAMG,KAAAA,IAAS,EAAA,CAAA,CAAI,CAAA;AAG5H,IAAA,MAAM,IAAIC,MACR,iFAAA,EACA;MAAEC,KAAAA,EAAOL;KAAM,CAAA;EAEnB,CAAA,CAAA;AACF;AAjBsBR,wBAAAA,CAAAA,aAAAA,EAAAA,eAAAA,CAAAA;ACStB,eAAsBc,aAAAA,CAAcb,SAAkBC,KAAAA,EAAkB;AACtED,EAAAA,OAAAA,CAAQE,GAAAA,CACNC,mBAAAA,CAAcC,KAAAA,EACd,CAAA,sEAAA,CAAwE,CAAA;AAG1E,EAAA,MAAMH,MAAMI,QAAAA,CAAS,gBAAA,EAAkBL,OAAAA,CAAAA,CAASM,KAAAA,CAAM,CAACC,KAAAA,KAAAA;AACrDP,IAAAA,OAAAA,CAAQE,GAAAA,CACNC,mBAAAA,CAAcK,KAAAA,EACd,CAAA,+FAAA,EAAkGD,MAAME,OAAO,CAAA;EAAMF,KAAAA,CAAMG,KAAAA,IAAS,EAAA,CAAA,CAAI,CAAA;AAG1I,IAAA,MAAM,IAAIC,MACR,+FAAA,EACA;MAAEC,KAAAA,EAAOL;KAAM,CAAA;EAEnB,CAAA,CAAA;AACF;AAjBsBM,wBAAAA,CA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AAA,EACd,CAAA,kFAAA,EAAqFD,MAAME,OAAO,CAAA;EAAMF,KAAAA,CAAMG,KAAAA,IAAS,EAAA,CAAA,CAAI,CAAA;AAG7H,IAAA,MAAM,IAAIC,MACR,kFAAA,EACA;MAAEC,KAAAA,EAAOL;KAAM,CAAA;EAEnB,CAAA,CAAA;AAEA,EAAA,MAAMuJ,gCAAc9J,OAAAA,CAAAA;AAYtB;AAtFsB6H,wBAAAA,CAAAA,OAAAA,EAAAA,SAAAA,CAAAA","file":"chunk-J7ICWR23.cjs","sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Storm Stack\n\n This code was released as part of the Storm Stack project. Storm Stack\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/storm-stack.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/storm-stack\n Documentation: https://docs.stormsoftware.com/projects/storm-stack\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { LogLevelLabel } from \"@storm-software/config-tools/types\";\nimport { EngineHooks } from \"../../../types/build\";\nimport { Context } from \"../../../types/context\";\n\n/**\n * Prepares the configuration for the Storm Stack project.\n *\n * @remarks\n * This function initializes the context for the Storm Stack project and prepares the configuration.\n * It calls the `prepare:config` hook to allow plugins to modify the configuration.\n *\n * @param context - The context containing options and environment paths.\n * @param hooks - The engine hooks to call during preparation.\n * @throws An error if an issue occurs while preparing the configuration.\n */\nexport async function prepareConfig(context: Context, hooks: EngineHooks) {\n context.log(\n LogLevelLabel.TRACE,\n `Preparing the configuration for the Storm Stack project.`\n );\n\n await hooks.callHook(\"prepare:config\", context).catch((error: Error) => {\n context.log(\n LogLevelLabel.ERROR,\n `An error occurred while preparing the configuration for the Storm Stack project: ${error.message} \\n${error.stack ?? \"\"}`\n );\n\n throw new Error(\n \"An error occurred while preparing the configuration for the Storm Stack project\",\n { cause: error }\n );\n });\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Storm Stack\n\n This code was released as part of the Storm Stack project. Storm Stack\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/storm-stack.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/storm-stack\n Documentation: https://docs.stormsoftware.com/projects/storm-stack\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { LogLevelLabel } from \"@storm-software/config-tools/types\";\nimport type { EngineHooks } from \"../../../types/build\";\nimport type { Context } from \"../../../types/context\";\n\n/**\n * Prepares deployment configuration/infrastructure required by the Storm Stack project in CI/CD processes.\n *\n * @remarks\n * Some examples of potential artifacts that could be prepared by this step include (but are not limited to):\n * - Cloudflare Workers configuration files\n * - Kubernetes deployment manifests\n * - Docker Compose files for containerized applications\n * - Terraform scripts for infrastructure as code (IaC)\n * - Helm charts for Kubernetes applications\n * - Ansible playbooks for server configuration management\n * - CloudFormation templates for AWS infrastructure\n * - Pulumi scripts for cloud infrastructure provisioning\n * - Vagrant files for local development environments\n * - CI/CD pipeline configurations (e.g., GitHub Actions, GitLab CI, Jenkins\n *\n * @param context - The context containing options and environment paths.\n * @param hooks - The engine hooks to call during preparation.\n * @returns A promise that resolves when the preparation is complete.\n */\nexport async function prepareDeploy(context: Context, hooks: EngineHooks) {\n context.log(\n LogLevelLabel.TRACE,\n `Initializing the deployment configuration for the Storm Stack project.`\n );\n\n await hooks.callHook(\"prepare:deploy\", context).catch((error: Error) => {\n context.log(\n LogLevelLabel.ERROR,\n `An error occurred while initializing the deployment configuration for the Storm Stack project: ${error.message} \\n${error.stack ?? \"\"}`\n );\n\n throw new Error(\n \"An error occurred while initializing the deployment configuration for the Storm Stack project\",\n { cause: error }\n );\n });\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Storm Stack\n\n This code was released as part of the Storm Stack project. Storm Stack\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/storm-stack.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/storm-stack\n Documentation: https://docs.stormsoftware.com/projects/storm-stack\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { LogLevelLabel } from \"@storm-software/config-tools/types\";\nimport type { EngineHooks } from \"../../../types/build\";\nimport type { Context } from \"../../../types/context\";\n\n/**\n * Prepares the entry point for the Storm Stack project.\n *\n * @remarks\n * This function initializes the reflection data for the Storm Stack project.\n *\n * @param context - The context containing options and environment paths.\n * @param hooks - The engine hooks to call during preparation.\n * @returns A promise that resolves when the preparation is complete.\n */\nexport async function prepareEntry(context: Context, hooks: EngineHooks) {\n context.log(\n LogLevelLabel.TRACE,\n `Initializing the reflection data for the Storm Stack project.`\n );\n\n await hooks.callHook(\"prepare:entry\", context).catch((error: Error) => {\n context.log(\n LogLevelLabel.ERROR,\n `An error occurred while initializing the reflection data for the Storm Stack project: ${error.message} \\n${error.stack ?? \"\"}`\n );\n\n throw new Error(\n \"An error occurred while initializing the reflection data for the Storm Stack project\",\n { cause: error }\n );\n });\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Storm Stack\n\n This code was released as part of the Storm Stack project. Storm Stack\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/storm-stack.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/storm-stack\n Documentation: https://docs.stormsoftware.com/projects/storm-stack\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { LogLevelLabel } from \"@storm-software/config-tools/types\";\nimport { findFileExtension } from \"@stryke/path/file-path-fns\";\nimport { isParentPath } from \"@stryke/path/is-parent-path\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { replacePath } from \"@stryke/path/replace\";\nimport { getFileHeader } from \"../../../lib/utilities/file-header\";\nimport type { EngineHooks } from \"../../../types/build\";\nimport type { Context } from \"../../../types/context\";\n\n/**\n * Prepares the runtime artifacts for the Storm Stack project.\n *\n * @remarks\n * This function calls the `prepare:runtime` hook and generates type declarations for runtime artifacts if enabled.\n *\n * @param context - The context containing options and environment paths.\n * @param hooks - The engine hooks to call during preparation.\n * @returns A promise that resolves when the preparation is complete.\n */\nexport async function prepareRuntime(context: Context, hooks: EngineHooks) {\n context.log(\n LogLevelLabel.TRACE,\n `Preparing the runtime artifacts for the Storm Stack project.`\n );\n\n await context.vfs.rm(context.runtimePath);\n\n await hooks.callHook(\"prepare:runtime\", context).catch((error: Error) => {\n context.log(\n LogLevelLabel.ERROR,\n `An error occurred while preparing the runtime artifacts for the Storm Stack project: ${error.message} \\n${error.stack ?? \"\"}`\n );\n\n throw new Error(\n \"An error occurred while preparing the runtime artifacts for the Storm Stack project\",\n { cause: error }\n );\n });\n\n context.log(LogLevelLabel.TRACE, \"Generating runtime barrel file\");\n\n await context.vfs.writeRuntimeFile(\n \"index\",\n joinPaths(context.runtimePath, \"index.ts\"),\n `\n ${getFileHeader()}\n\n ${(await context.vfs.listRuntimeFiles())\n .filter(\n file =>\n !isParentPath(file.path, joinPaths(context.runtimePath, \"log\")) &&\n !isParentPath(file.path, joinPaths(context.runtimePath, \"storage\"))\n )\n .map(\n file =>\n `export * from \"./${replacePath(file.path, context.runtimePath).replace(findFileExtension(file.path)!, \"\")}\";`\n )\n .join(\"\\n\")}\n `\n );\n\n // await context.unimport.refreshRuntimeImports();\n // await context.unimport.dumpImports();\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Storm Stack\n\n This code was released as part of the Storm Stack project. Storm Stack\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/storm-stack.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/storm-stack\n Documentation: https://docs.stormsoftware.com/projects/storm-stack\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { ExtractorResult } from \"@microsoft/api-extractor\";\nimport { Extractor, ExtractorConfig } from \"@microsoft/api-extractor\";\nimport { LogLevelLabel } from \"@storm-software/config-tools/types\";\nimport { relativePath } from \"@stryke/path/file-path-fns\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { replacePath } from \"@stryke/path/replace\";\nimport { resolvePackage } from \"@stryke/path/resolve\";\nimport { TsConfigJson } from \"@stryke/types/tsconfig\";\nimport defu from \"defu\";\nimport {\n createCompilerHost,\n createProgram,\n flattenDiagnosticMessageText,\n getLineAndCharacterOfPosition,\n getPreEmitDiagnostics\n} from \"typescript\";\nimport { ModuleResolverPlugin } from \"../../../lib/babel/plugins/module-resolver\";\nimport { getParsedTypeScriptConfig } from \"../../../lib/typescript/tsconfig\";\nimport { getFileHeader } from \"../../../lib/utilities/file-header\";\nimport { getSourceFile, getString } from \"../../../lib/utilities/source-file\";\nimport { EngineHooks } from \"../../../types/build\";\nimport { Context } from \"../../../types/context\";\n\n/**\n * Prepares the TypeScript definitions for the Storm Stack project.\n *\n * @remarks\n * This function calls the `prepare:types` hook and generates type declarations for the runtime artifacts if enabled.\n *\n * @param context - The context containing options and environment paths.\n * @param hooks - The engine hooks to call during preparation.\n * @returns A promise that resolves when the preparation is complete.\n */\nexport async function prepareTypes(context: Context, hooks: EngineHooks) {\n context.log(\n LogLevelLabel.TRACE,\n `Preparing the TypeScript definitions for the Storm Stack project.`\n );\n\n await context.vfs.rm(context.runtimeDtsFilePath);\n\n context.log(LogLevelLabel.TRACE, \"Transforming runtime files.\");\n\n const runtimeFiles = await Promise.all(\n (await context.vfs.listRuntimeFiles())\n .filter(file => !context.vfs.isMatchingRuntimeId(\"index\", file.id))\n .map(async file => {\n file.contents = await context.compiler.transform(\n context,\n file.path,\n file.contents,\n {\n skipTransformUnimport: true,\n babel: {\n plugins: [ModuleResolverPlugin, ...context.options.babel.plugins]\n }\n }\n );\n\n context.log(\n LogLevelLabel.TRACE,\n `Writing transformed runtime file ${file.id}.`\n );\n\n await context.vfs.writeRuntimeFile(file.id, file.path, file.contents);\n\n return file.path;\n })\n );\n\n const typescriptPath = await resolvePackage(\"typescript\");\n if (!typescriptPath) {\n throw new Error(\n \"Could not resolve TypeScript package location. Please ensure TypeScript is installed.\"\n );\n }\n\n const files = runtimeFiles.reduce<string[]>(\n (ret, fileName) => {\n const formatted = replacePath(fileName, context.options.workspaceRoot);\n if (!ret.includes(formatted)) {\n ret.push(formatted);\n }\n\n return ret;\n },\n [joinPaths(typescriptPath, \"lib\", \"lib.esnext.full.d.ts\")] // await listFiles(joinPaths(typescriptPath, \"lib\", \"lib.*.d.ts\"))\n );\n\n context.log(\n LogLevelLabel.TRACE,\n \"Parsing TypeScript configuration for the Storm Stack project.\"\n );\n\n const sourceFileDts = getSourceFile(\n context.runtimeDtsFilePath,\n `${getFileHeader(null, false)}\n\n`\n );\n\n await hooks\n .callHook(\"prepare:types\", context, sourceFileDts)\n .catch((error: Error) => {\n context.log(\n LogLevelLabel.ERROR,\n `An error occurred while preparing the TypeScript definitions for the Storm Stack project: ${error.message} \\n${error.stack ?? \"\"}`\n );\n\n throw new Error(\n \"An error occurred while preparing the TypeScript definitions for the Storm Stack project\",\n { cause: error }\n );\n });\n\n await context.vfs.writeFileToDisk(\n sourceFileDts.id,\n getString(sourceFileDts.code)\n );\n\n const resolvedTsconfig = getParsedTypeScriptConfig(\n context.options.workspaceRoot,\n context.options.projectRoot,\n context.tsconfig.tsconfigFilePath,\n defu(\n {\n compilerOptions: {\n strict: false,\n noEmit: false,\n declaration: true,\n declarationMap: false,\n emitDeclarationOnly: true,\n skipLibCheck: true\n },\n exclude: [\"node_modules\", \"dist\"],\n include: files\n },\n context.options.tsconfigRaw ?? {}\n ) as TsConfigJson\n );\n resolvedTsconfig.options.configFilePath = joinPaths(\n context.options.workspaceRoot,\n context.tsconfig.tsconfigFilePath\n );\n resolvedTsconfig.options.pathsBasePath = context.options.workspaceRoot;\n resolvedTsconfig.options.suppressOutputPathCheck = true;\n\n context.log(LogLevelLabel.TRACE, \"Creating the TypeScript compiler host\");\n\n const program = createProgram(\n files,\n resolvedTsconfig.options,\n createCompilerHost(resolvedTsconfig.options)\n );\n\n context.log(\n LogLevelLabel.TRACE,\n `Running TypeScript compiler on ${runtimeFiles.length} runtime files.`\n );\n\n // const transformer = createImportTransformer(context);\n\n let runtimeModules = \"\";\n const emitResult = program.emit(\n undefined,\n (fileName, text, _, __, sourceFiles, _data) => {\n const sourceFile = sourceFiles?.[0];\n if (sourceFile?.fileName && !fileName.endsWith(\".map\")) {\n if (context.vfs.isRuntimeFile(sourceFile.fileName)) {\n runtimeModules += `\ndeclare module \"${context.vfs.resolveId(sourceFile.fileName)}\" {\n ${text\n .trim()\n .replace(/^\\s*export\\s*declare\\s*/gm, \"export \")\n .replace(/^\\s*declare\\s*/gm, \"\")}\n}\n`;\n }\n }\n },\n undefined,\n true\n );\n\n const diagnostics = getPreEmitDiagnostics(program).concat(\n emitResult.diagnostics\n );\n const diagnosticMessages: string[] = [];\n\n diagnostics.forEach(diagnostic => {\n if (diagnostic.file) {\n const { line, character } = getLineAndCharacterOfPosition(\n diagnostic.file,\n diagnostic.start!\n );\n const message = flattenDiagnosticMessageText(\n diagnostic.messageText,\n \"\\n\"\n );\n diagnosticMessages.push(\n `${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`\n );\n } else {\n const message = flattenDiagnosticMessageText(\n diagnostic.messageText,\n \"\\n\"\n );\n diagnosticMessages.push(message);\n }\n });\n\n const diagnosticMessage = diagnosticMessages.join(\"\\n\");\n if (diagnosticMessage) {\n throw new Error(\n `TypeScript compilation failed: \\n\\n${\n diagnosticMessage.length > 5000\n ? `${diagnosticMessage.slice(0, 5000)}...`\n : diagnosticMessage\n }`\n );\n }\n\n const mainEntryPointFilePath = process.env.STORM_STACK_LOCAL\n ? joinPaths(context.options.workspaceRoot, \"dist/packages/types\")\n : await resolvePackage(\"@storm-stack/types\");\n if (!mainEntryPointFilePath) {\n throw new Error(\"Could not resolve @storm-stack/types package location.\");\n }\n\n context.log(\n LogLevelLabel.TRACE,\n `Running API Extractor on the @storm-stack/types package at ${mainEntryPointFilePath}.`\n );\n\n const untrimmedFilePath = joinPaths(\n context.dtsPath,\n `${context.meta.projectRootHash}.d.ts`\n );\n\n const extractorResult: ExtractorResult = Extractor.invoke(\n ExtractorConfig.prepare({\n configObject: {\n mainEntryPointFilePath: joinPaths(\n mainEntryPointFilePath,\n \"dist/esm/src/index.d.ts\"\n ),\n apiReport: {\n enabled: false,\n\n // `reportFileName` is not been used. It's just to fit the requirement of API Extractor.\n reportFileName: \"report.api.md\"\n },\n docModel: { enabled: false },\n dtsRollup: {\n enabled: true,\n untrimmedFilePath\n },\n tsdocMetadata: { enabled: false },\n compiler: {\n tsconfigFilePath: relativePath(\n joinPaths(\n context.options.workspaceRoot,\n context.options.projectRoot\n ),\n joinPaths(\n context.options.workspaceRoot,\n context.tsconfig.tsconfigFilePath\n )\n )\n },\n projectFolder: joinPaths(\n context.options.workspaceRoot,\n context.options.projectRoot\n ),\n newlineKind: \"lf\"\n },\n configObjectFullPath: undefined,\n packageJsonFullPath: joinPaths(\n context.options.workspaceRoot,\n context.options.projectRoot,\n \"package.json\"\n )\n }),\n {\n localBuild: true,\n showVerboseMessages: true\n }\n );\n if (!extractorResult.succeeded) {\n throw new Error(\n `API Extractor completed with ${extractorResult.errorCount} errors and ${\n extractorResult.warningCount\n } warnings when processing @storm-stack/types package.`\n );\n }\n\n context.log(\n LogLevelLabel.TRACE,\n `Generating TypeScript declaration file in ${context.runtimeDtsFilePath}.`\n );\n\n const sourceFile = getSourceFile(\n context.runtimeDtsFilePath,\n `${getFileHeader(null, false)}\n\n// This file is an augmentation to the built-in StormContext interface\n// Thus cannot contain any top-level imports\n// <https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation>\n\n${(await context.vfs.readFile(untrimmedFilePath))!\n .replace(/\\s*export.*__Ω.*;/g, \"\")\n .replace(/^export\\s*\\{\\s*\\}\\s*$/gm, \"\")\n .replace(/^export\\s*(?:declare\\s*)?interface\\s*/gm, \"interface \")\n .replace(/^export\\s*(?:declare\\s*)?type\\s*/gm, \"type \")\n .replace(/^export\\s*(?:declare\\s*)?const\\s*/gm, \"declare const \")\n .replace(\n /: Storage(?:_\\d+)?;$/gm,\n ': import(\"unstorage\").Storage<import(\"unstorage\").StorageValue>;'\n )}\n\n${runtimeModules}`\n .replace(\n // eslint-disable-next-line regexp/no-super-linear-backtracking\n /import\\s*(?:type\\s*)?\\{?[\\w,\\s]*(?:\\}\\s*)?from\\s*(?:'|\")@?[a-zA-Z0-9-\\\\/.]*(?:'|\");?/g,\n \"\"\n )\n .replaceAll(\"#private;\", \"\")\n );\n\n await hooks\n .callHook(\"prepare:types\", context, sourceFile)\n .catch((error: Error) => {\n context.log(\n LogLevelLabel.ERROR,\n `An error occurred while preparing the TypeScript definitions for the Storm Stack project: ${error.message} \\n${error.stack ?? \"\"}`\n );\n\n throw new Error(\n \"An error occurred while preparing the TypeScript definitions for the Storm Stack project\",\n { cause: error }\n );\n });\n\n await context.vfs.writeFileToDisk(sourceFile.id, getString(sourceFile.code));\n\n // context.vfs[__VFS_REVERT__]();\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Storm Stack\n\n This code was released as part of the Storm Stack project. Storm Stack\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/storm-stack.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/storm-stack\n Documentation: https://docs.stormsoftware.com/projects/storm-stack\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { LogLevelLabel } from \"@storm-software/config-tools/types\";\nimport { createDirectory } from \"@stryke/fs/helpers\";\nimport { existsSync } from \"@stryke/path/exists\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { writeMetaFile } from \"../../lib/context\";\nimport { getParsedTypeScriptConfig } from \"../../lib/typescript/tsconfig\";\nimport { writeFile } from \"../../lib/utilities/write-file\";\nimport type { EngineHooks } from \"../../types/build\";\nimport type { Context } from \"../../types/context\";\nimport { prepareConfig } from \"./config\";\nimport { prepareDeploy } from \"./deploy\";\nimport { prepareEntry } from \"./entry\";\nimport { prepareRuntime } from \"./runtime\";\nimport { prepareTypes } from \"./types\";\n\n/**\n * Prepares the Storm Stack project by generating necessary artifacts and configurations.\n *\n * @param context - The build context.\n * @param hooks - The engine hooks.\n */\nexport async function prepare(context: Context, hooks: EngineHooks) {\n await writeFile(\n context.log,\n joinPaths(context.dataPath, \"meta.json\"),\n JSON.stringify(\n {\n ...context.meta,\n runtimeIdMap: JSON.stringify(context.meta.runtimeIdMap),\n virtualFiles: JSON.stringify(context.meta.virtualFiles)\n },\n null,\n 2\n )\n );\n context.persistedMeta = context.meta;\n\n await hooks.callHook(\"prepare:begin\", context).catch((error: Error) => {\n context.log(\n LogLevelLabel.ERROR,\n `An error occured while starting the prepare process for the Storm Stack project: ${error.message} \\n${error.stack ?? \"\"}`\n );\n\n throw new Error(\n \"An error occured while starting the prepare process for the Storm Stack project\",\n { cause: error }\n );\n });\n\n if (!existsSync(context.cachePath)) {\n await createDirectory(context.cachePath);\n }\n\n if (!existsSync(context.dataPath)) {\n await createDirectory(context.dataPath);\n }\n\n await prepareConfig(context, hooks);\n\n if (context.options.projectType === \"application\") {\n await prepareRuntime(context, hooks);\n }\n\n if (context.options.output.dts !== false) {\n await prepareTypes(context, hooks);\n }\n\n if (context.options.projectType === \"application\") {\n await prepareEntry(context, hooks);\n }\n\n await prepareDeploy(context, hooks);\n\n // Re-resolve the tsconfig to ensure it is up to date\n context.tsconfig = getParsedTypeScriptConfig(\n context.options.workspaceRoot,\n context.options.projectRoot,\n context.options.tsconfig\n );\n if (!context.tsconfig) {\n throw new Error(\"Failed to parse the TypeScript configuration file.\");\n }\n\n await hooks.callHook(\"prepare:complete\", context).catch((error: Error) => {\n context.log(\n LogLevelLabel.ERROR,\n `An error occured while finishing the prepare process for the Storm Stack project: ${error.message} \\n${error.stack ?? \"\"}`\n );\n\n throw new Error(\n \"An error occured while finishing the prepare process for the Storm Stack project\",\n { cause: error }\n );\n });\n\n await writeMetaFile(context);\n\n // await compressDirectory(\n // joinPaths(context.options.projectRoot, context.artifactsDir),\n // {\n // destination: joinPaths(\n // context.envPaths.cache,\n // context.options.projectRoot,\n // `${context.meta.checksum}.tar.gz`\n // )\n // }\n // );\n}\n"]}