powerlines 0.36.16 → 0.36.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/api.cjs +2 -2
- package/dist/api.js +1 -1
- package/dist/astro.cjs +4 -4
- package/dist/astro.js +3 -3
- package/dist/{chunk-KBY6P55L.js → chunk-5P33FZVE.js} +3 -3
- package/dist/{chunk-K4KSZ5LO.js → chunk-JHMNUYR4.js} +3 -3
- package/dist/chunk-LF52IIUG.cjs +12 -0
- package/dist/{chunk-GMWKIYIA.js → chunk-NG66D5S2.js} +3 -3
- package/dist/chunk-OAP26O5W.cjs +12 -0
- package/dist/{chunk-FSGX5QA3.cjs → chunk-Q5QDT4Z6.cjs} +4 -4
- package/dist/{chunk-LMGW3BJ5.cjs → chunk-SE2DSY7Q.cjs} +5 -5
- package/dist/{chunk-3IHUVS2R.cjs → chunk-VFEMKXPW.cjs} +3 -3
- package/dist/{chunk-J4YZNSCI.cjs → chunk-VNR35OGA.cjs} +4 -4
- package/dist/{chunk-PKPHX4JL.js → chunk-WJT3YP4S.js} +3 -3
- package/dist/{chunk-I7KYN6FZ.js → chunk-YCEMHKQ6.js} +3 -3
- package/dist/{chunk-2MM6T3B3.js → chunk-YEMNMZFO.js} +3 -3
- package/dist/esbuild.cjs +6 -6
- package/dist/esbuild.js +3 -3
- package/dist/farm.cjs +3 -3
- package/dist/farm.js +2 -2
- package/dist/index.cjs +10 -10
- package/dist/index.js +2 -2
- package/dist/lib/{chunk-ADSPA3QE.js → chunk-4U72WVKA.js} +4 -4
- package/dist/lib/{chunk-ADSPA3QE.js.map → chunk-4U72WVKA.js.map} +1 -1
- package/dist/lib/{chunk-353HMSL5.js → chunk-ALSAZ7L6.js} +3 -3
- package/dist/lib/chunk-ALSAZ7L6.js.map +1 -0
- package/dist/lib/{chunk-J2T63UDX.cjs → chunk-BEMSIGJW.cjs} +3 -3
- package/dist/lib/chunk-BEMSIGJW.cjs.map +1 -0
- package/dist/lib/{chunk-KY7UADON.cjs → chunk-C3QHVUY2.cjs} +16 -16
- package/dist/lib/{chunk-KY7UADON.cjs.map → chunk-C3QHVUY2.cjs.map} +1 -1
- package/dist/lib/{chunk-BDCEFSVK.cjs → chunk-HUWPJJ3K.cjs} +14 -14
- package/dist/lib/{chunk-BDCEFSVK.cjs.map → chunk-HUWPJJ3K.cjs.map} +1 -1
- package/dist/lib/{chunk-FIOYLW5Q.js → chunk-LT2BKZXG.js} +4 -4
- package/dist/lib/{chunk-FIOYLW5Q.js.map → chunk-LT2BKZXG.js.map} +1 -1
- package/dist/lib/{chunk-N7COL2O5.cjs → chunk-LWDVMU5O.cjs} +6 -6
- package/dist/lib/{chunk-N7COL2O5.cjs.map → chunk-LWDVMU5O.cjs.map} +1 -1
- package/dist/lib/{chunk-5QCLCBD7.js → chunk-RLNO3YW6.js} +3 -3
- package/dist/lib/{chunk-5QCLCBD7.js.map → chunk-RLNO3YW6.js.map} +1 -1
- package/dist/lib/contexts/api-context.cjs +4 -4
- package/dist/lib/contexts/api-context.js +3 -3
- package/dist/lib/contexts/context.cjs +2 -2
- package/dist/lib/contexts/context.js +1 -1
- package/dist/lib/contexts/environment-context.cjs +3 -3
- package/dist/lib/contexts/environment-context.js +2 -2
- package/dist/lib/contexts/index.cjs +6 -6
- package/dist/lib/contexts/index.js +3 -3
- package/dist/lib/index.cjs +8 -8
- package/dist/lib/index.js +4 -4
- package/dist/lib/unplugin/factory.cjs +5 -5
- package/dist/lib/unplugin/factory.js +4 -4
- package/dist/lib/unplugin/index.cjs +5 -5
- package/dist/lib/unplugin/index.js +4 -4
- package/dist/next.cjs +4 -4
- package/dist/next.js +3 -3
- package/dist/nuxt.cjs +7 -7
- package/dist/nuxt.js +5 -5
- package/dist/rolldown.cjs +6 -6
- package/dist/rolldown.js +3 -3
- package/dist/rollup.cjs +3 -3
- package/dist/rollup.js +2 -2
- package/dist/rspack.cjs +3 -3
- package/dist/rspack.js +2 -2
- package/dist/tsdown.cjs +4 -4
- package/dist/tsdown.js +3 -3
- package/dist/tsup.cjs +4 -4
- package/dist/tsup.js +3 -3
- package/dist/unloader.cjs +3 -3
- package/dist/unloader.js +2 -2
- package/dist/unplugin.cjs +5 -5
- package/dist/unplugin.js +3 -3
- package/dist/vite.cjs +6 -6
- package/dist/vite.js +3 -3
- package/dist/webpack.cjs +6 -6
- package/dist/webpack.js +3 -3
- package/package.json +2 -2
- package/dist/chunk-4Z5HXM4Y.cjs +0 -12
- package/dist/chunk-V7KISSUL.cjs +0 -12
- package/dist/lib/chunk-353HMSL5.js.map +0 -1
- package/dist/lib/chunk-J2T63UDX.cjs.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/internal/helpers/resolver.ts","../../src/types/build.ts","../../src/types/commands.ts","../../src/types/plugin.ts","../../src/plugin-utils/helpers.ts","../../src/lib/contexts/context.ts"],"names":["resolveOptions","options","defu","interopDefault","fsCache","mode","joinPaths","cacheDir","moduleCache","createPluginResolver","createJiti","workspaceRoot","projectRoot","createResolver","baseResolver","plugin","UNPLUGIN_BUILD_VARIANTS","SUPPORTED_COMMANDS","PLUGIN_NON_HOOK_FIELDS","KNOWN_HOOKS","isPlugin","value","isSetObject","isSetString","name","isUndefined","api","applyToEnvironment","isFunction","dedupe","every","hook","isPluginHookFunction","variant","isPluginConfigObject","isPluginConfigTuple","Array","isArray","length","isPluginConfig","item","isPluginHookObject","handler","isPluginHook","getHookHandler","pluginHook","isHookExternal","startsWith","checkDedupe","plugins","some","p","addPluginHook","context","hooksList","map","push","bind","findInvalidPluginConfig","config","invalidItems","forEach","invalid","i","JSON","stringify","configCache","WeakMap","envPathCache","agent","Agent","keepAliveTimeout","setGlobalDispatcher","compose","interceptors","retry","maxRetries","minTimeout","maxTimeout","timeoutFactor","retryAfter","PowerlinesContext","uuid","Date","now","build","projectType","type","root","title","compatibilityDate","description","sourceRoot","configFile","customLogger","logLevel","tsconfig","tsconfigRaw","skipCache","skipInstalls","entry","output","lint","transform","framework","artifactsPath","dts","builtinPrefix","from","loadWorkspaceConfig","withUserConfig","powerlinesPath","resolvePackage","Error","dependencies","devDependencies","persistedMeta","undefined","packageJson","projectJson","resolver","resolvePatterns","$$internal","resolveEntriesSync","toArray","tsconfigFilePath","tsconfigPathsToRegExp","paths","fs","VirtualFileSystem","createSync","checksum","meta","buildId","releaseId","timestamp","projectRootHash","murmurhash","workspaceConfig","maxLength","PROJECT_ROOT_HASH_LENGTH","configHash","CACHE_HASH_LENGTH","resolvedConfig","log","logFn","createLog","envPaths","has","get","getEnvPaths","orgId","appId","set","builtinsPath","entryPath","dataPath","data","getPrefixedProjectRootHash","cachePath","cache","dtsPath","appendPath","relativeToWorkspaceRoot","builtins","Object","values","metadata","filter","id","Boolean","program","createProgram","skipAddingFilesFromTsConfig","parserCache","create","cacheId","ttl","lruSize","persistInterval","requestCache","fetch","input","cacheKey","toString","cached","Response","body","status","statusText","headers","response","fetchRequest","timeout","result","text","fromEntries","entries","parse","code","lang","sourceType","showSemanticErrors","resolve","importer","moduleId","alias","find","a","match","replacement","isVirtual","conditions","extensions","external","skipNodeModulesBundle","noExternal","test","load","resolvedId","read","getBuiltins","Promise","all","path","emitEntry","isAbsolute","file","write","omit","properties","emitBuiltin","userConfig","isHighPriority","mergeUserConfig","init","withInlineConfig","inlineConfig","command","workspacePackageJsonPath","existsSync","readJsonFile","repository","url","fatal","message","LogLevelLabel","FATAL","isString","StormJSON","error","ERROR","warn","WARN","info","INFO","debug","DEBUG","trace","TRACE","isNull","extendLog","generateChecksum","hashDirectory","ignore","organization","projectJsonPath","packageJsonPath","loadUserConfigFile","getTsconfigFilePath","version","outputPath","directories","assets","glob","platform","preview","environments","babel","presets","eslint","target","override","getUniqueEntries","split","titleCase","getUnique","format","buildPath","getUniqueBy","asset","isParentPath","replacePath","reduce","ret","replacePathTokens","polyfill","into"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,SAASA,e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A,CAAK9O,MAAAA,CAAO6K,UAAAA,CAAWnI,MAAAA,EAAQ0L,MAAAA,EAAQ;AACzC,MAAA,IAAA,CAAKpO,MAAAA,CAAO6K,UAAAA,CAAWnI,MAAAA,CAAO0L,MAAAA,GAASD,SAAAA,CACrClK,OAAAA,CAAQ,IAAA,CAAKjE,MAAAA,CAAO6K,UAAAA,CAAWnI,MAAAA,EAAQ0L,MAAAA,CAAAA,CAAAA;AAE3C,IAAA;AAEA,IAAA,IAAA,CAAKpO,MAAAA,CAAO6K,UAAAA,CAAWvL,OAAAA,GAAAA,CAAW,IAAA,CAAKU,OAAO6K,UAAAA,CAAWvL,OAAAA,IAAW,EAAA,EACjEuH,OAAOE,OAAAA,CAAAA,CACP2H,MAAAA,CAAO,CAACC,KAAKvR,MAAAA,KAAAA;AACZ,MAAA,IACEK,QAAAA,CAASL,MAAAA,CAAAA,IACTiC,WAAAA,CACEjC,MAAAA,EACAuR,GAAAA,CAAI9H,MAAAA,CAAOrH,CAAAA,CAAAA,KAAK/B,QAAAA,CAAS+B,CAAAA,CAAAA,CAAAA,CAAAA,EAE3B;AACA,QAAA,OAAOmP,GAAAA;AACT,MAAA;AAEAA,MAAAA,GAAAA,CAAI9O,KAAKzC,MAAAA,CAAAA;AAET,MAAA,OAAOuR,GAAAA;AACT,IAAA,CAAA,EAAG,EAAE,CAAA;AACT,EAAA;AACF","file":"chunk-353HMSL5.js","sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\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/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport defu from \"defu\";\nimport { Jiti, JitiOptions, createJiti } from \"jiti\";\nimport { Resolver } from \"../../types/context\";\nimport { ResolvedConfig } from \"../../types/resolved\";\n\nexport type CreateResolverOptions = Omit<\n JitiOptions,\n \"fsCache\" | \"moduleCache\" | \"interopDefault\"\n> &\n Pick<ResolvedConfig, \"mode\" | \"logLevel\" | \"skipCache\"> & {\n workspaceRoot: string;\n projectRoot: string;\n cacheDir: string;\n };\n\n/**\n * Create a Jiti resolver for the given workspace and project root.\n *\n * @param options - The options for creating the resolver.\n * @returns A Jiti instance configured for the specified workspace and project root.\n */\nfunction resolveOptions(options: CreateResolverOptions): JitiOptions {\n return defu(options, {\n interopDefault: true,\n fsCache:\n options.mode !== \"development\"\n ? joinPaths(options.cacheDir, \"jiti\")\n : false,\n moduleCache: options.mode !== \"development\"\n });\n}\n\n/**\n * Create a Jiti resolver for the given workspace and project root.\n *\n * @param options - The options for creating the resolver.\n * @returns A Jiti instance configured for the specified workspace and project root.\n */\nfunction createPluginResolver(options: CreateResolverOptions): Jiti {\n return createJiti(\n joinPaths(options.workspaceRoot, options.projectRoot),\n resolveOptions({\n ...options\n\n // transform: (params: TransformOptions): TransformResult => {\n // if (!params.filename) {\n // return {\n // code: params.source\n // };\n // }\n\n // const babelOptions = {\n // babelrc: false,\n // configFile: false,\n // compact: false,\n // retainLines: isBoolean(params.retainLines)\n // ? params.retainLines\n // : true,\n // filename: params.filename,\n // plugins: [\n // [\n // transformModuleBabelPlugin,\n // {\n // allowTopLevelThis: true,\n // noInterop: !params.interopDefault,\n // async: params.async\n // }\n // ],\n // [importMetaPathsBabelPlugin, { filename: params.filename }],\n // [importMetaEnvBabelPlugin],\n // [transformMetadataBabelPlugin],\n // [syntaxClassPropertiesPlugin],\n // [transformExportNamespaceFromPlugin]\n // ]\n // } as BabelTransformOptions;\n\n // if (\n // findFileExtension(params.filename) === \"jsx\" ||\n // findFileExtension(params.filename) === \"tsx\"\n // ) {\n // babelOptions.plugins!.push([syntaxJSXPlugin]);\n // babelOptions.plugins!.push([\n // alloyPlugin,\n // {\n // alloyModuleName: \"@alloy-js/core\"\n // }\n // ]);\n // babelOptions.plugins!.push([\n // jsxDomExpressionsPlugin,\n // {\n // alloyModuleName: \"@alloy-js/core\",\n // moduleName: \"@alloy-js/core/jsx-runtime\",\n // generate: \"universal\",\n // wrapConditionals: true,\n // preserveWhitespace: true\n // }\n // ]);\n // }\n\n // if (\n // findFileExtension(params.filename) === \"ts\" ||\n // findFileExtension(params.filename) === \"tsx\"\n // ) {\n // babelOptions.plugins!.push([\n // typescriptPlugin,\n // {\n // allowDeclareFields: true,\n // isTSX: findFileExtension(params.filename) === \"tsx\"\n // }\n // ]);\n\n // babelOptions.plugins!.unshift([transformMetadataBabelPlugin]);\n // babelOptions.plugins!.unshift([\n // proposalDecoratorsPlugin,\n // { legacy: true }\n // ]);\n\n // babelOptions.plugins!.push([parameterDecoratorPlugin]);\n // babelOptions.plugins!.push([syntaxImportAssertionsPlugin]);\n // }\n\n // const result = transformSync(params.source, babelOptions);\n // if (!result?.code) {\n // return {\n // code: params.source,\n // error: new Error(\"Failed to transform source code.\")\n // };\n // }\n\n // return {\n // code: result.code\n // };\n // }\n } as CreateResolverOptions)\n );\n}\n\n/**\n * Create a Jiti resolver for the given workspace and project root.\n *\n * @param options - The options for creating the resolver.\n * @returns A Jiti instance configured for the specified workspace and project root.\n */\nexport function createResolver(options: CreateResolverOptions): Resolver {\n const baseResolver = createJiti(\n joinPaths(options.workspaceRoot, options.projectRoot),\n resolveOptions(options)\n ) as Resolver;\n baseResolver.plugin = createPluginResolver(options);\n\n return baseResolver;\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\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/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { UserConfig as ExternalFarmOptions } from \"@farmfe/core\";\nimport type { Configuration as ExternalRspackOptions } from \"@rspack/core\";\nimport type { BuildOptions as ExternalTsupOptions } from \"@storm-software/tsup/types\";\nimport type { UnbuildOptions as ExternalUnbuildOptions } from \"@storm-software/unbuild/types\";\nimport type { BuildOptions as ExternalESBuildOptions } from \"esbuild\";\nimport type { RolldownOptions as ExternalRolldownOptions } from \"rolldown\";\nimport type {\n RollupOptions as ExternalRollupOptions,\n OutputOptions as ExternalRollupOutputOptions\n} from \"rollup\";\nimport type { UserConfig as ExternalTsdownOptions } from \"tsdown\";\nimport type {\n DepOptimizationOptions,\n UserConfig as ExternalViteUserConfig\n} from \"vite\";\nimport type { Configuration as ExternalWebpackOptions } from \"webpack\";\n\nexport type UnpluginBuildVariant =\n | \"rollup\"\n | \"webpack\"\n | \"rspack\"\n | \"vite\"\n | \"esbuild\"\n | \"farm\"\n | \"unloader\"\n | \"rolldown\";\n\nexport const UNPLUGIN_BUILD_VARIANTS: UnpluginBuildVariant[] = [\n \"rollup\",\n \"webpack\",\n \"rspack\",\n \"vite\",\n \"esbuild\",\n \"farm\",\n \"unloader\",\n \"rolldown\"\n];\n\nexport type BuildVariant = UnpluginBuildVariant | \"tsup\" | \"tsdown\" | \"unbuild\";\n\nexport type InferUnpluginVariant<TBuildVariant extends BuildVariant> =\n TBuildVariant extends \"tsup\"\n ? \"esbuild\"\n : TBuildVariant extends \"tsdown\"\n ? \"rolldown\"\n : TBuildVariant extends \"unbuild\"\n ? \"rollup\"\n : TBuildVariant;\n\nexport interface BuildConfig {\n /**\n * The platform to build the project for\n *\n * @defaultValue \"neutral\"\n */\n platform?: \"node\" | \"browser\" | \"neutral\";\n\n /**\n * Array of strings indicating the polyfills to include for the build.\n *\n * @remarks\n * This option allows you to specify which polyfills should be included in the build process to ensure compatibility with the target environment. The paths for the polyfills can use placeholder tokens (the `replacePathTokens` helper function will be used to resolve the actual values).\n *\n * @example\n * ```ts\n * {\n * polyfill: ['{projectRoot}/custom-polyfill.ts']\n * }\n * ```\n */\n polyfill?: string[];\n\n /**\n * Array of strings indicating the order in which fields in a package.json file should be resolved to determine the entry point for a module.\n *\n * @defaultValue `['browser', 'module', 'jsnext:main', 'jsnext']`\n */\n mainFields?: string[];\n\n /**\n * Array of strings indicating what conditions should be used for module resolution.\n */\n conditions?: string[];\n\n /**\n * Array of strings indicating what file extensions should be used for module resolution.\n *\n * @defaultValue `['.mjs', '.js', '.mts', '.ts', '.jsx', '.tsx', '.json']`\n */\n extensions?: string[];\n\n /**\n * Array of strings indicating what modules should be deduplicated to a single version in the build.\n *\n * @remarks\n * This option is useful for ensuring that only one version of a module is included in the bundle, which can help reduce bundle size and avoid conflicts.\n */\n dedupe?: string[];\n\n /**\n * Array of strings or regular expressions that indicate what modules are builtin for the environment.\n */\n builtins?: (string | RegExp)[];\n\n /**\n * Define global variable replacements.\n *\n * @remarks\n * This option allows you to specify global constants that will be replaced in the code during the build process. It is similar to the `define` option in esbuild and Vite, enabling you to replace specific identifiers with constant expressions at build time.\n *\n * @example\n * ```ts\n * {\n * define: {\n * __VERSION__: '\"1.0.0\"',\n * __DEV__: 'process.env.NODE_ENV !== \"production\"'\n * }\n * }\n * ```\n *\n * @see https://esbuild.github.io/api/#define\n * @see https://vitejs.dev/config/build-options.html#define\n * @see https://github.com/rollup/plugins/tree/master/packages/replace\n */\n define?: Record<string, any>;\n\n /**\n * Global variables that will have import statements injected where necessary\n *\n * @remarks\n * This option allows you to specify global variables that should be automatically imported from specified modules whenever they are used in the code. This is particularly useful for polyfilling Node.js globals in a browser environment.\n *\n * @example\n * ```ts\n * {\n * inject: {\n * process: 'process/browser',\n * Buffer: ['buffer', 'Buffer'],\n * }\n * }\n * ```\n *\n * @see https://github.com/rollup/plugins/tree/master/packages/inject\n */\n inject?: Record<string, string | string[]>;\n\n /**\n * The alias mappings to use for module resolution during the build process.\n *\n * @remarks\n * This option allows you to define custom path aliases for modules, which can be useful for simplifying imports and managing dependencies.\n *\n * @example\n * ```ts\n * {\n * alias: {\n * \"@utils\": \"./src/utils\",\n * \"@components\": \"./src/components\"\n * }\n * }\n * ```\n *\n * @see https://github.com/rollup/plugins/tree/master/packages/alias\n */\n alias?:\n | Record<string, string>\n | Array<{\n find: string | RegExp;\n replacement: string;\n }>;\n\n /**\n * A list of modules that should not be bundled, even if they are external dependencies.\n *\n * @remarks\n * This option is useful for excluding specific modules from the bundle, such as Node.js built-in modules or other libraries that should not be bundled.\n */\n external?: (string | RegExp)[];\n\n /**\n * A list of modules that should always be bundled, even if they are external dependencies.\n */\n noExternal?: (string | RegExp)[];\n\n /**\n * Should the Powerlines CLI processes skip bundling the `node_modules` directory?\n */\n skipNodeModulesBundle?: boolean;\n\n /**\n * If true, `process.env` referenced in code will be preserved as-is and evaluated in runtime. Otherwise, it is statically replaced as an empty object.\n *\n * @defaultValue false\n */\n keepProcessEnv?: boolean;\n\n /**\n * An optional set of override options to apply to the selected build variant.\n *\n * @remarks\n * This option allows you to provide configuration options with the guarantee that they will **not** be overridden and will take precedence over other build configurations.\n */\n override?: Record<string, any>;\n}\n\nexport type BuildResolvedConfig = Omit<BuildConfig, \"override\">;\n\n// ESBuild\nexport type ESBuildBuildConfig = Omit<\n ExternalESBuildOptions,\n | \"entryPoints\"\n | \"sourceRoot\"\n | \"platform\"\n | \"outdir\"\n | \"env\"\n | \"assets\"\n | \"external\"\n | \"inject\"\n | \"tsconfig\"\n | \"tsconfigRaw\"\n | \"logLevel\"\n> &\n BuildConfig;\nexport type ESBuildResolvedBuildConfig = Omit<\n ExternalESBuildOptions,\n \"inject\"\n> &\n BuildResolvedConfig;\n\n// Vite\nexport type ViteBuildConfig = Omit<\n ExternalViteUserConfig,\n | \"entry\"\n | \"entryPoints\"\n | \"tsconfig\"\n | \"tsconfigRaw\"\n | \"environments\"\n | \"output\"\n> &\n BuildConfig & {\n /**\n * Optimize deps config\n */\n optimizeDeps?: Omit<DepOptimizationOptions, \"extensions\">;\n };\nexport type ViteResolvedBuildConfig = ExternalViteUserConfig &\n BuildResolvedConfig;\n\n// Webpack\nexport type WebpackBuildConfig = Omit<\n ExternalWebpackOptions,\n \"name\" | \"entry\" | \"entryPoints\" | \"tsconfig\" | \"tsconfigRaw\"\n> &\n BuildConfig;\nexport type WebpackResolvedBuildConfig = ExternalWebpackOptions &\n BuildResolvedConfig;\n\n// Rspack\nexport type RspackBuildConfig = Omit<\n ExternalRspackOptions,\n \"name\" | \"entry\" | \"entryPoints\" | \"tsconfig\" | \"tsconfigRaw\"\n> &\n BuildConfig;\nexport type RspackResolvedBuildConfig = ExternalRspackOptions &\n BuildResolvedConfig;\n\n// Rollup\nexport type RollupBuildOutputConfig = Omit<\n ExternalRollupOutputOptions,\n \"dir\" | \"format\"\n>;\nexport type RollupBuildConfig = Omit<\n ExternalRollupOptions,\n \"entry\" | \"external\" | \"input\" | \"output\" | \"logLevel\"\n> & {\n output: RollupBuildOutputConfig | RollupBuildOutputConfig[];\n} & BuildConfig;\nexport type RollupResolvedBuildConfig = ExternalRollupOptions &\n BuildResolvedConfig;\n\n// Rolldown\nexport type RolldownBuildConfig = Omit<\n ExternalRolldownOptions,\n \"input\" | \"external\" | \"tsconfig\" | \"logLevel\" | \"output\"\n> &\n BuildConfig;\nexport type RolldownResolvedBuildConfig = ExternalRolldownOptions &\n BuildResolvedConfig;\n\n// Tsup\nexport type TsupBuildConfig = Partial<\n Omit<\n ExternalTsupOptions,\n | \"userOptions\"\n | \"tsconfig\"\n | \"tsconfigRaw\"\n | \"assets\"\n | \"outputPath\"\n | \"mode\"\n | \"format\"\n | \"platform\"\n | \"projectRoot\"\n | \"clean\"\n | \"env\"\n | \"entry\"\n | \"entryPoints\"\n | \"external\"\n | \"noExternal\"\n | \"skipNodeModulesBundle\"\n >\n> &\n BuildConfig;\nexport type TsupResolvedBuildConfig = ExternalTsupOptions & BuildResolvedConfig;\n\n// Tsdown\nexport type TsdownBuildConfig = Partial<\n Omit<\n ExternalTsdownOptions,\n | \"name\"\n | \"outDir\"\n | \"clean\"\n | \"cwd\"\n | \"tsconfig\"\n | \"publicDir\"\n | \"copy\"\n | \"alias\"\n | \"format\"\n | \"platform\"\n | \"env\"\n | \"define\"\n | \"entry\"\n | \"external\"\n | \"noExternal\"\n | \"skipNodeModulesBundle\"\n >\n> &\n BuildConfig;\nexport type TsdownResolvedBuildConfig = ExternalTsdownOptions &\n BuildResolvedConfig;\n\n// Unbuild\nexport type UnbuildBuildConfig = Partial<\n Omit<\n ExternalUnbuildOptions,\n | \"tsconfig\"\n | \"tsconfigRaw\"\n | \"assets\"\n | \"outputPath\"\n | \"mode\"\n | \"format\"\n | \"platform\"\n | \"projectRoot\"\n | \"env\"\n | \"entry\"\n | \"entryPoints\"\n >\n> &\n BuildConfig;\nexport type UnbuildResolvedBuildConfig = ExternalUnbuildOptions &\n BuildResolvedConfig;\n\n// Farm\nexport type FarmBuildConfig = Partial<\n Omit<\n ExternalFarmOptions,\n | \"tsconfig\"\n | \"tsconfigRaw\"\n | \"assets\"\n | \"outputPath\"\n | \"mode\"\n | \"format\"\n | \"platform\"\n | \"projectRoot\"\n | \"env\"\n | \"entry\"\n | \"entryPoints\"\n >\n> &\n BuildConfig;\nexport type FarmResolvedBuildConfig = ExternalFarmOptions & BuildResolvedConfig;\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\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/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { ArrayValues } from \"@stryke/types/array\";\nimport type { MaybePromise } from \"@stryke/types/base\";\nimport type { Context } from \"./context\";\n\nexport const SUPPORTED_COMMANDS = [\n \"new\",\n \"clean\",\n \"prepare\",\n \"lint\",\n \"test\",\n \"build\",\n \"docs\",\n \"deploy\",\n \"finalize\"\n] as const;\n\nexport type CommandType = ArrayValues<typeof SUPPORTED_COMMANDS>;\nexport type Commands<TContext extends Context = Context> = Record<\n CommandType,\n (this: TContext) => MaybePromise<void>\n>;\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\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/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { ArrayValues } from \"@stryke/types/array\";\nimport type { FunctionLike, MaybePromise } from \"@stryke/types/base\";\nimport type {\n ExternalIdResult,\n HookFilter,\n TransformResult,\n UnpluginOptions\n} from \"unplugin\";\nimport type { UnpluginBuildVariant } from \"./build\";\nimport { UNPLUGIN_BUILD_VARIANTS } from \"./build\";\nimport type { CommandType } from \"./commands\";\nimport { SUPPORTED_COMMANDS } from \"./commands\";\nimport type { EnvironmentConfig, PluginConfig } from \"./config\";\nimport type {\n BuildPluginContext,\n PluginContext,\n UnresolvedContext\n} from \"./context\";\nimport type { EnvironmentResolvedConfig, ResolvedConfig } from \"./resolved\";\n\nexport interface PluginHookObject<\n THookFunction extends FunctionLike,\n TFilter extends keyof HookFilter = never\n> {\n /**\n * The order in which the plugin should be applied.\n */\n order?: \"pre\" | \"post\" | null | undefined;\n\n /**\n * A filter to determine when the hook should be called.\n */\n filter?: Pick<HookFilter, TFilter>;\n\n /**\n * The hook function to be called.\n */\n handler: THookFunction;\n}\n\nexport type PluginHook<\n THookFunction extends FunctionLike,\n TFilter extends keyof HookFilter = never\n> = THookFunction | PluginHookObject<THookFunction, TFilter>;\n\n/**\n * A result returned by the plugin from the `types` hook that describes the declaration types output file.\n */\nexport interface TypesResult {\n directives?: string[];\n code: string;\n}\n\ntype DeepPartial<T> = {\n [K in keyof T]?: DeepPartial<T[K]>;\n};\n\nexport type ConfigResult<TContext extends PluginContext = PluginContext> =\n DeepPartial<TContext[\"config\"]> & Record<string, any>;\n\nexport interface BasePluginHookFunctions<\n TContext extends PluginContext = PluginContext\n> extends Record<CommandType, (this: TContext) => MaybePromise<void>> {\n /**\n * A function that returns configuration options to be merged with the build context's options.\n *\n * @remarks\n * Modify config before it's resolved. The hook can either mutate {@link Context.config} on the passed-in context directly, or return a partial config object that will be deeply merged into existing config.\n *\n * @warning User plugins are resolved before running this hook so injecting other plugins inside the config hook will have no effect.\n *\n * @see https://vitejs.dev/guide/api-plugin#config\n *\n * @param this - The build context.\n * @param config - The partial configuration object to be modified.\n * @returns A promise that resolves to a partial configuration object.\n */\n config: (\n this: UnresolvedContext<TContext[\"config\"]>\n ) => MaybePromise<ConfigResult<TContext>>;\n\n /**\n * Modify environment configs before it's resolved. The hook can either mutate the passed-in environment config directly, or return a partial config object that will be deeply merged into existing config.\n *\n * @remarks\n * This hook is called for each environment with a partially resolved environment config that already accounts for the default environment config values set at the root level. If plugins need to modify the config of a given environment, they should do it in this hook instead of the config hook. Leaving the config hook only for modifying the root default environment config.\n *\n * @see https://vitejs.dev/guide/api-plugin#configenvironment\n *\n * @param this - The build context.\n * @param name - The name of the environment being configured.\n * @param environment - The Vite-like environment object containing information about the current build environment.\n * @returns A promise that resolves when the hook is complete.\n */\n configEnvironment: (\n this: TContext,\n name: string,\n environment: EnvironmentConfig\n ) => MaybePromise<Partial<EnvironmentResolvedConfig> | undefined | null>;\n\n /**\n * A hook that is called when the plugin is resolved.\n *\n * @see https://vitejs.dev/guide/api-plugin#configresolved\n *\n * @param this - The build context.\n * @returns A promise that resolves when the hook is complete.\n */\n configResolved: (this: TContext) => MaybePromise<void>;\n\n /**\n * A hook that is called to overwrite the generated declaration types file (.d.ts). The generated type definitions should describe the built-in modules/logic added during the `prepare` task.\n *\n * @param this - The build context.\n * @param code - The source code to generate types for.\n * @returns A promise that resolves when the hook is complete.\n */\n types: (\n this: TContext,\n code: string\n ) => MaybePromise<TypesResult | string | undefined | null>;\n\n /**\n * A hook that is called at the start of the build process.\n *\n * @param this - The build context and unplugin build context.\n * @returns A promise that resolves when the hook is complete.\n */\n buildStart: (\n this: BuildPluginContext<TContext[\"config\"]> & TContext\n ) => MaybePromise<void>;\n\n /**\n * A hook that is called at the end of the build process.\n *\n * @param this - The build context and unplugin build context.\n * @returns A promise that resolves when the hook is complete.\n */\n buildEnd: (\n this: BuildPluginContext<TContext[\"config\"]> & TContext\n ) => MaybePromise<void>;\n\n /**\n * A hook that is called to transform the source code.\n *\n * @param this - The build context, unplugin build context, and unplugin context.\n * @param code - The source code to transform.\n * @param id - The identifier of the source code.\n * @returns A promise that resolves when the hook is complete.\n */\n transform: (\n this: BuildPluginContext<TContext[\"config\"]> & TContext,\n code: string,\n id: string\n ) => MaybePromise<TransformResult>;\n\n /**\n * A hook that is called to load the source code.\n *\n * @param this - The build context, unplugin build context, and unplugin context.\n * @param id - The identifier of the source code.\n * @returns A promise that resolves when the hook is complete.\n */\n load: (\n this: BuildPluginContext<TContext[\"config\"]> & TContext,\n id: string\n ) => MaybePromise<TransformResult>;\n\n /**\n * A hook that is called to resolve the identifier of the source code.\n *\n * @param this - The build context, unplugin build context, and unplugin context.\n * @param id - The identifier of the source code.\n * @param importer - The importer of the source code.\n * @param options - The options for resolving the identifier.\n * @returns A promise that resolves when the hook is complete.\n */\n resolveId: (\n this: BuildPluginContext<TContext[\"config\"]> & TContext,\n id: string,\n importer: string | undefined,\n options: { isEntry: boolean }\n ) => MaybePromise<string | ExternalIdResult | null | undefined>;\n\n /**\n * A hook that is called to write the bundle to disk.\n *\n * @param this - The build context.\n * @returns A promise that resolves when the hook is complete.\n */\n writeBundle: (this: TContext) => MaybePromise<void>;\n}\n\nexport type BuildPlugin<\n TContext extends PluginContext = PluginContext,\n TBuildVariant extends UnpluginBuildVariant = UnpluginBuildVariant,\n TOptions extends Required<UnpluginOptions>[TBuildVariant] =\n Required<UnpluginOptions>[TBuildVariant]\n> = {\n [TKey in keyof TOptions]: TOptions[TKey] extends FunctionLike\n ? (\n this: ThisParameterType<TOptions[TKey]> & TContext,\n ...args: Parameters<TOptions[TKey]>\n ) => ReturnType<TOptions[TKey]> | MaybePromise<ReturnType<TOptions[TKey]>>\n : TOptions[TKey];\n};\n\nexport type ExternalPluginHookFunctionsVariant<\n TContext extends PluginContext = PluginContext,\n TBuildVariant extends UnpluginBuildVariant = UnpluginBuildVariant\n> = {\n [TKey in keyof BuildPlugin<TContext, TBuildVariant> &\n string as `${TBuildVariant}:${TKey}`]: BuildPlugin<\n TContext,\n TBuildVariant\n >[TKey];\n};\n\nexport type ExternalPluginHookFunctions<TContext extends PluginContext> =\n ExternalPluginHookFunctionsVariant<TContext, \"vite\"> &\n ExternalPluginHookFunctionsVariant<TContext, \"esbuild\"> &\n ExternalPluginHookFunctionsVariant<TContext, \"rolldown\"> &\n ExternalPluginHookFunctionsVariant<TContext, \"rollup\"> &\n ExternalPluginHookFunctionsVariant<TContext, \"webpack\"> &\n ExternalPluginHookFunctionsVariant<TContext, \"rspack\"> &\n ExternalPluginHookFunctionsVariant<TContext, \"farm\">;\n\nexport type PluginHookFunctions<\n TContext extends PluginContext = PluginContext\n> = BasePluginHookFunctions<TContext> & ExternalPluginHookFunctions<TContext>;\n\nexport type PluginHooks<TContext extends PluginContext = PluginContext> = {\n [TKey in keyof BasePluginHookFunctions<TContext>]: PluginHook<\n BasePluginHookFunctions<TContext>[TKey]\n >;\n} & {\n /**\n * A function that returns configuration options to be merged with the build context's options.\n *\n * @remarks\n * Modify config before it's resolved. The hook can either mutate {@link Context.config} on the passed-in context directly, or return a partial config object that will be deeply merged into existing config.\n *\n * @warning User plugins are resolved before running this hook so injecting other plugins inside the config hook will have no effect. If you want to add plugins, consider doing so in the {@link Plugin.dependsOn} property instead.\n *\n * @see https://vitejs.dev/guide/api-plugin#config\n *\n * @param this - The build context.\n * @param config - The partial configuration object to be modified.\n * @returns A promise that resolves to a partial configuration object.\n */\n config:\n | PluginHook<\n (\n this: UnresolvedContext<TContext[\"config\"]>\n ) => MaybePromise<ConfigResult<TContext>>\n >\n | ConfigResult<TContext>;\n\n /**\n * A hook that is called to transform the source code.\n *\n * @param this - The build context, unplugin build context, and unplugin context.\n * @param code - The source code to transform.\n * @param id - The identifier of the source code.\n * @returns A promise that resolves when the hook is complete.\n */\n transform: PluginHook<\n (\n this: BuildPluginContext<TContext[\"config\"]> & TContext,\n code: string,\n id: string\n ) => MaybePromise<TransformResult>,\n \"code\" | \"id\"\n >;\n\n /**\n * A hook that is called to load the source code.\n *\n * @param this - The build context, unplugin build context, and unplugin context.\n * @param id - The identifier of the source code.\n * @returns A promise that resolves when the hook is complete.\n */\n load: PluginHook<\n (\n this: BuildPluginContext<TContext[\"config\"]> & TContext,\n id: string\n ) => MaybePromise<TransformResult>,\n \"id\"\n >;\n\n /**\n * A hook that is called to resolve the identifier of the source code.\n *\n * @param this - The build context, unplugin build context, and unplugin context.\n * @param id - The identifier of the source code.\n * @param importer - The importer of the source code.\n * @param options - The options for resolving the identifier.\n * @returns A promise that resolves when the hook is complete.\n */\n resolveId: PluginHook<\n (\n this: BuildPluginContext<TContext[\"config\"]> & TContext,\n id: string,\n importer: string | undefined,\n options: { isEntry: boolean }\n ) => MaybePromise<string | ExternalIdResult | null | undefined>,\n \"id\"\n >;\n};\n\nexport type PluginBuildPlugins<TContext extends PluginContext = PluginContext> =\n {\n [TBuildVariant in UnpluginBuildVariant]?: BuildPlugin<\n TContext,\n TBuildVariant\n >;\n };\n\nexport interface Plugin<\n TContext extends PluginContext<ResolvedConfig> = PluginContext<ResolvedConfig>\n>\n extends Partial<PluginHooks<TContext>>, PluginBuildPlugins<TContext> {\n /**\n * The name of the plugin, for use in deduplication, error messages and logs.\n */\n name: string;\n\n /**\n * An API object that can be used for inter-plugin communication.\n *\n * @see https://rollupjs.org/plugin-development/#direct-plugin-communication\n */\n api?: Record<string, any>;\n\n /**\n * Enforce plugin invocation tier similar to webpack loaders. Hooks ordering is still subject to the `order` property in the hook object.\n *\n * @remarks\n * The Plugin invocation order is as follows:\n * - `enforce: 'pre'` plugins\n * - `order: 'pre'` plugin hooks\n * - any other plugins (normal)\n * - `order: 'post'` plugin hooks\n * - `enforce: 'post'` plugins\n *\n * @see https://vitejs.dev/guide/api-plugin.html#plugin-ordering\n * @see https://rollupjs.org/plugin-development/#build-hooks\n * @see https://webpack.js.org/concepts/loaders/#enforce---pre-and-post\n * @see https://esbuild.github.io/plugins/#concepts\n */\n enforce?: \"pre\" | \"post\";\n\n /**\n * A function to determine if two plugins are the same and can be de-duplicated.\n *\n * @remarks\n * If this is not provided, plugins are de-duplicated by comparing their names.\n *\n * @param other - The other plugin to compare against.\n * @returns `true` if the two plugins are the same, `false` otherwise.\n */\n dedupe?: false | ((other: Plugin<any>) => boolean);\n\n /**\n * A list of pre-requisite plugins that must be loaded before this plugin can be used.\n */\n // dependsOn?: PluginConfig<TContext>[];\n\n /**\n * Define environments where this plugin should be active. By default, the plugin is active in all environments.\n *\n * @param environment - The environment to check.\n * @returns `true` if the plugin should be active in the specified environment, `false` otherwise.\n */\n applyToEnvironment?: (\n environment: EnvironmentResolvedConfig\n ) => boolean | PluginConfig<TContext>;\n}\n\nexport const PLUGIN_NON_HOOK_FIELDS = [\n \"name\",\n \"api\",\n \"enforce\",\n \"dedupe\",\n \"applyToEnvironment\"\n] as const;\n\nexport type PluginNonHookFields =\n | ArrayValues<typeof PLUGIN_NON_HOOK_FIELDS>\n | UnpluginBuildVariant;\n\nexport const KNOWN_HOOKS = [\n ...SUPPORTED_COMMANDS,\n \"config\",\n \"configEnvironment\",\n \"configResolved\",\n \"buildStart\",\n \"buildEnd\",\n \"transform\",\n \"load\",\n \"resolveId\",\n \"writeBundle\"\n] as const;\n\nexport type KnownHooks = ArrayValues<typeof KNOWN_HOOKS>;\n\nexport const KNOWN_PLUGIN_FIELDS = [\n ...PLUGIN_NON_HOOK_FIELDS,\n ...KNOWN_HOOKS,\n ...UNPLUGIN_BUILD_VARIANTS\n] as const;\n\nexport type KnownPluginFields = ArrayValues<typeof KNOWN_PLUGIN_FIELDS>;\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\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/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { isFunction } from \"@stryke/type-checks/is-function\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { isUndefined } from \"@stryke/type-checks/is-undefined\";\nimport { AnyFunction } from \"@stryke/types/base\";\nimport { UNPLUGIN_BUILD_VARIANTS } from \"../types/build\";\nimport {\n PluginConfig,\n PluginConfigObject,\n PluginConfigTuple\n} from \"../types/config\";\nimport { PluginContext } from \"../types/context\";\nimport {\n BaseHookKeys,\n BaseHooksListItem,\n ExternalHookKeys,\n HookKeys\n} from \"../types/hooks\";\nimport {\n KNOWN_HOOKS,\n Plugin,\n PluginHook,\n PluginHookObject\n} from \"../types/plugin\";\nimport { ResolvedConfig } from \"../types/resolved\";\n\n/**\n * Type guard to check if an object is a {@link Plugin}\n *\n * @param value - The object to check\n * @returns True if the object is a {@link Plugin}, false otherwise\n */\nexport function isPlugin<\n TContext extends PluginContext = PluginContext<ResolvedConfig>\n>(value: unknown): value is Plugin<TContext> {\n return (\n isSetObject(value) &&\n \"name\" in value &&\n isSetString(value.name) &&\n (isUndefined((value as Plugin<TContext>).api) ||\n (\"api\" in value && isSetObject(value.api))) &&\n (isUndefined((value as Plugin<TContext>).applyToEnvironment) ||\n (\"applyToEnvironment\" in value &&\n isFunction(value.applyToEnvironment))) &&\n (isUndefined((value as Plugin<TContext>).dedupe) ||\n (\"dedupe\" in value && isFunction(value.dedupe))) &&\n KNOWN_HOOKS.every(\n hook =>\n isUndefined((value as Plugin<TContext>)[hook]) ||\n (hook in value &&\n (isPluginHookFunction((value as Plugin<TContext>)[hook]) ||\n (hook === \"config\" &&\n isSetObject((value as Plugin<TContext>)[hook]))))\n ) &&\n UNPLUGIN_BUILD_VARIANTS.every(\n variant =>\n isUndefined((value as Plugin<TContext>)[variant]) ||\n (variant in value && isSetObject((value as Plugin<TContext>)[variant]))\n )\n );\n}\n\n/**\n * Type guard to check if an object is a {@link PluginConfigObject}\n *\n * @param value - The object to check\n * @returns True if the object is a {@link PluginConfigObject}, false otherwise\n */\nexport function isPluginConfigObject(\n value: unknown\n): value is PluginConfigObject {\n return (\n isSetObject(value) &&\n \"plugin\" in value &&\n (((isSetString(value.plugin) || isFunction(value.plugin)) &&\n \"options\" in value &&\n isSetObject(value.options)) ||\n isPlugin(value.plugin))\n );\n}\n\n/**\n * Type guard to check if an object is a {@link PluginConfigTuple}\n *\n * @param value - The object to check\n * @returns True if the object is a {@link PluginConfigTuple}, false otherwise\n */\nexport function isPluginConfigTuple(\n value: unknown\n): value is PluginConfigTuple {\n return (\n Array.isArray(value) &&\n (value.length === 1 || value.length === 2) &&\n (((isSetString(value[0]) || isFunction(value[0])) &&\n value.length > 1 &&\n isSetObject(value[1])) ||\n isPlugin(value[0]))\n );\n}\n\n/**\n * Type guard to check if an object is a {@link PluginConfig}\n *\n * @param value - The object to check\n * @returns True if the object is a {@link PluginConfig}, false otherwise\n */\nexport function isPluginConfig<\n TContext extends PluginContext = PluginContext<ResolvedConfig>\n>(value: unknown): value is PluginConfig<TContext> {\n return (\n isSetString(value) ||\n isFunction(value) ||\n isPlugin<TContext>(value) ||\n isPluginConfigObject(value) ||\n isPluginConfigTuple(value) ||\n (Array.isArray(value) && value.every(item => isPluginConfig(item)))\n );\n}\n\n/**\n * Type guard to check if an value is a {@link PluginHook} function\n *\n * @param value - The value to check\n * @returns True if the value is a {@link PluginHook} function, false otherwise\n */\nexport function isPluginHookObject(\n value: unknown\n): value is PluginHookObject<AnyFunction> {\n return isSetObject(value) && \"handler\" in value && isFunction(value.handler);\n}\n\n/**\n * Type guard to check if an value is a {@link PluginHook} function\n *\n * @param value - The value to check\n * @returns True if the value is a {@link PluginHook} function, false otherwise\n */\nexport function isPluginHookFunction(value: unknown): value is AnyFunction {\n return isFunction(value) || isPluginHookObject(value);\n}\n\n/**\n * Type guard to check if an object is a {@link PluginHook}\n *\n * @param value - The object to check\n * @returns True if the object is a {@link PluginHook}, false otherwise\n */\nexport function isPluginHook(value: unknown): value is PluginHook<AnyFunction> {\n return isPluginHookFunction(value) || isPluginHookObject(value);\n}\n\n/**\n * Extract the hook handler function from a plugin hook\n *\n * @param pluginHook - The plugin hook to extract the handler function from\n * @returns The hook handler function\n */\nexport function getHookHandler(\n pluginHook: PluginHook<AnyFunction>\n): AnyFunction {\n return isFunction(pluginHook) ? pluginHook : pluginHook.handler;\n}\n\n/**\n * Extract a plugin hook from a plugin\n *\n * @param context - The build context\n * @param plugin - The plugin to extract the hook from\n * @param hook - The name of the hook to extract\n * @returns The extracted hook, or undefined if the hook does not exist\n */\nexport function extractPluginHook<\n TContext extends PluginContext = PluginContext,\n TPlugin extends Plugin<TContext> = Plugin<TContext>\n>(context: TContext, plugin: TPlugin, hook: BaseHookKeys<TContext>) {\n const pluginHook = plugin[hook];\n if (!isPluginHook(pluginHook)) {\n return undefined;\n }\n\n return isFunction(pluginHook)\n ? {\n normal: pluginHook.bind(context)\n }\n : {\n [pluginHook.order ? pluginHook.order : \"normal\"]:\n pluginHook.handler.bind(context)\n };\n}\n\n/**\n * Check if a hook is external.\n *\n * @param hook - The name of the hook to check.\n * @returns True if the hook is external, false otherwise.\n */\nexport function isHookExternal(hook: HookKeys): hook is ExternalHookKeys {\n return (\n hook.startsWith(\"vite:\") ||\n hook.startsWith(\"esbuild:\") ||\n hook.startsWith(\"rolldown:\") ||\n hook.startsWith(\"rollup:\") ||\n hook.startsWith(\"webpack:\") ||\n hook.startsWith(\"rspack:\") ||\n hook.startsWith(\"farm:\")\n );\n}\n\n/**\n * Check if a hook is internal.\n *\n * @param hook - The name of the hook to check.\n * @returns True if the hook is external, false otherwise.\n */\nexport function isHookInternal(hook: HookKeys): hook is BaseHookKeys {\n return !isHookExternal(hook);\n}\n\n/**\n * Check if a plugin should be deduplicated.\n *\n * @param plugin - The plugin to check\n * @param plugins - The list of plugins to check against\n * @returns True if the plugin should be deduplicated, false otherwise\n */\nexport function checkDedupe<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig,\n TContext extends PluginContext<TResolvedConfig> =\n PluginContext<TResolvedConfig>\n>(plugin: Plugin<TContext>, plugins: Plugin<TContext>[]) {\n return (\n plugin.dedupe === false ||\n plugins.some(\n p =>\n p.dedupe !== false &&\n ((isFunction(p.dedupe) && p.dedupe(plugin)) || p.name === plugin.name)\n )\n );\n}\n\n/**\n * Add a plugin hook to the hooks list.\n *\n * @param context - The plugin context\n * @param plugin - The plugin to add the hook from\n * @param pluginHook - The plugin hook to add\n * @param hooksList - The list of hooks to add to\n */\nexport function addPluginHook<TContext extends PluginContext = PluginContext>(\n context: TContext,\n plugin: Plugin<TContext>,\n pluginHook: PluginHook<AnyFunction>,\n hooksList: BaseHooksListItem<TContext, BaseHookKeys<TContext>>[]\n) {\n if (\n !checkDedupe(\n plugin,\n hooksList.map(hook => hook.plugin)\n )\n ) {\n hooksList.push(\n isFunction(pluginHook)\n ? {\n plugin,\n handler: getHookHandler(pluginHook).bind(context)\n }\n : {\n plugin,\n ...pluginHook,\n handler: getHookHandler(pluginHook).bind(context)\n }\n );\n }\n}\n\n/**\n * Check the provided {@link PluginConfig}, and return a stringified version of the invalid configuration. If an array is provided, check each item in the array.\n *\n * @param config - The plugin configuration to check\n * @returns Null if the configuration is valid, otherwise an array of stringified invalid configurations\n */\nexport function findInvalidPluginConfig<\n TContext extends PluginContext = PluginContext<ResolvedConfig>\n>(config: PluginConfig<TContext>): string[] | null {\n if (isPluginConfig<TContext>(config)) {\n return null;\n }\n\n if (Array.isArray(config as PluginConfig<TContext>[])) {\n const invalidItems: string[] = [];\n (config as PluginConfig<TContext>[]).forEach(item => {\n const invalid = findInvalidPluginConfig<TContext>(item);\n if (invalid) {\n invalidItems.push(...invalid.map(i => JSON.stringify(i, null, 2)));\n }\n });\n\n return invalidItems.length > 0 ? invalidItems : null;\n }\n\n return [JSON.stringify(config, null, 2)];\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\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/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\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 { toArray } from \"@stryke/convert/to-array\";\nimport { EnvPaths, getEnvPaths } from \"@stryke/env/get-env-paths\";\nimport { existsSync } from \"@stryke/fs/exists\";\nimport { relativeToWorkspaceRoot } from \"@stryke/fs/get-workspace-root\";\nimport { readJsonFile } from \"@stryke/fs/json\";\nimport { resolvePackage } from \"@stryke/fs/resolve\";\nimport { hashDirectory } from \"@stryke/hash/hash-files\";\nimport { murmurhash } from \"@stryke/hash/murmurhash\";\nimport { getUnique, getUniqueBy } from \"@stryke/helpers/get-unique\";\nimport { omit } from \"@stryke/helpers/omit\";\nimport { fetchRequest } from \"@stryke/http/fetch\";\nimport { StormJSON } from \"@stryke/json/storm-json\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { isParentPath } from \"@stryke/path/is-parent-path\";\nimport { isAbsolute } from \"@stryke/path/is-type\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { replacePath } from \"@stryke/path/replace\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { isNull } from \"@stryke/type-checks/is-null\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport { PackageJson } from \"@stryke/types/package-json\";\nimport { uuid } from \"@stryke/unique-id/uuid\";\nimport { match, tsconfigPathsToRegExp } from \"bundle-require\";\nimport defu from \"defu\";\nimport { create, FlatCache } from \"flat-cache\";\nimport { parse, ParseResult } from \"oxc-parser\";\nimport { Range } from \"semver\";\nimport { Project } from \"ts-morph\";\nimport {\n Agent,\n BodyInit,\n interceptors,\n RequestInfo,\n Response,\n setGlobalDispatcher\n} from \"undici\";\nimport { ExternalIdResult, UnpluginMessage } from \"unplugin\";\nimport {\n createResolver,\n CreateResolverOptions\n} from \"../../internal/helpers/resolver\";\nimport { checkDedupe, isPlugin } from \"../../plugin-utils/helpers\";\nimport { replacePathTokens } from \"../../plugin-utils/paths\";\nimport {\n InitialUserConfig,\n LogFn,\n ParsedUserConfig,\n PluginConfig,\n PowerlinesCommand,\n WorkspaceConfig\n} from \"../../types/config\";\nimport {\n Context,\n EmitEntryOptions,\n FetchOptions,\n InitContextOptions,\n MetaInfo,\n ParseOptions,\n Resolver,\n TransformResult\n} from \"../../types/context\";\nimport {\n ResolveOptions,\n VirtualFile,\n VirtualFileSystemInterface,\n WriteOptions\n} from \"../../types/fs\";\nimport { UNSAFE_ContextInternal } from \"../../types/internal\";\nimport {\n ResolvedAssetGlob,\n ResolvedConfig,\n ResolvedEntryTypeDefinition\n} from \"../../types/resolved\";\nimport { ParsedTypeScriptConfig } from \"../../types/tsconfig\";\nimport { loadUserConfigFile, loadWorkspaceConfig } from \"../config-file\";\nimport { getUniqueEntries, resolveEntriesSync } from \"../entry\";\nimport { VirtualFileSystem } from \"../fs/vfs\";\nimport { createLog, extendLog } from \"../logger\";\nimport { createProgram } from \"../typescript/ts-morph\";\nimport { getTsconfigFilePath } from \"../typescript/tsconfig\";\nimport {\n CACHE_HASH_LENGTH,\n getPrefixedProjectRootHash,\n PROJECT_ROOT_HASH_LENGTH\n} from \"../utilities/meta\";\n\ninterface ConfigCacheKey {\n projectRoot: string;\n mode: \"test\" | \"development\" | \"production\";\n skipCache: boolean;\n configFile?: string;\n framework: string;\n command?: string;\n}\n\ninterface ConfigCacheResult {\n projectJson: Context[\"projectJson\"];\n packageJson: Context[\"packageJson\"];\n checksum: string;\n resolver: Resolver;\n userConfig: ParsedUserConfig;\n}\n\nconst configCache = new WeakMap<ConfigCacheKey, ConfigCacheResult>();\n\ninterface EnvPathCacheKey {\n framework: string;\n workspaceRoot: string;\n}\n\nconst envPathCache = new WeakMap<EnvPathCacheKey, EnvPaths>();\n\nconst agent = new Agent({ keepAliveTimeout: 10000 });\nsetGlobalDispatcher(\n agent.compose(\n interceptors.retry({\n maxRetries: 3,\n minTimeout: 1000,\n maxTimeout: 10000,\n timeoutFactor: 2,\n retryAfter: true\n })\n )\n);\n\nexport class PowerlinesContext<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig\n> implements Context<TResolvedConfig> {\n /**\n * Internal references storage\n *\n * @danger\n * This field is for internal use only and should not be accessed or modified directly. It is unstable and can be changed at anytime.\n *\n * @internal\n */\n #internal = {} as UNSAFE_ContextInternal<TResolvedConfig>;\n\n #workspaceConfig: WorkspaceConfig;\n\n #checksum: string | null = null;\n\n #buildId: string = uuid();\n\n #releaseId: string = uuid();\n\n #timestamp: number = Date.now();\n\n #entry: ResolvedEntryTypeDefinition[] | null = null;\n\n #fs!: VirtualFileSystemInterface;\n\n #tsconfig!: ParsedTypeScriptConfig;\n\n #program!: Project;\n\n #parserCache!: FlatCache;\n\n #requestCache!: FlatCache;\n\n #getConfigProps(config: Partial<TResolvedConfig[\"userConfig\"]> = {}) {\n return defu(\n {\n variant: config.build?.variant,\n projectType: config.type,\n projectRoot: config.root,\n name: config.name,\n title: config.title,\n compatibilityDate: config.compatibilityDate,\n description: config.description,\n sourceRoot: config.sourceRoot,\n configFile: config.configFile,\n customLogger: config.customLogger,\n logLevel: config.logLevel,\n tsconfig: config.tsconfig,\n tsconfigRaw: config.tsconfigRaw,\n skipCache: config.skipCache,\n skipInstalls: config.skipInstalls,\n entry: config.entry,\n output: config.output,\n plugins: config.plugins,\n mode: config.mode,\n lint: config.lint,\n transform: config.transform,\n build: config.build,\n framework: config.framework,\n ...config\n },\n {\n output: config.framework\n ? {\n artifactsPath: joinPaths(\n config.root ?? this.config.projectRoot,\n `.${config.framework ?? \"powerlines\"}`\n ),\n dts: joinPaths(\n config.root ?? this.config.projectRoot,\n `${config.framework ?? \"powerlines\"}.d.ts`\n ),\n builtinPrefix: config.framework ?? \"powerlines\"\n }\n : {}\n }\n );\n }\n\n /**\n * Create a new Storm context from the workspace root and user config.\n *\n * @param workspaceRoot - The root directory of the workspace.\n * @param config - The user configuration options.\n * @returns A promise that resolves to the new context.\n */\n public static async from<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig\n >(\n workspaceRoot: string,\n config: InitialUserConfig<TResolvedConfig[\"userConfig\"]>\n ): Promise<Context> {\n const context = new PowerlinesContext<TResolvedConfig>(\n await loadWorkspaceConfig(workspaceRoot, config.root)\n );\n await context.withUserConfig(config);\n\n const powerlinesPath = await resolvePackage(\"powerlines\");\n if (!powerlinesPath) {\n throw new Error(\"Could not resolve `powerlines` package location.\");\n }\n\n context.powerlinesPath = powerlinesPath;\n\n return context;\n }\n\n /**\n * An object containing the dependencies that should be installed for the project\n */\n public dependencies: Record<string, string | Range> = {};\n\n /**\n * An object containing the development dependencies that should be installed for the project\n */\n public devDependencies: Record<string, string | Range> = {};\n\n /**\n * The persisted meta information about the current build\n */\n public persistedMeta: MetaInfo | undefined = undefined;\n\n /**\n * The path to the Powerlines package\n */\n public powerlinesPath!: string;\n\n /**\n * The parsed `package.json` file for the project\n */\n public packageJson!: PackageJson;\n\n /**\n * The parsed `project.json` file for the project\n */\n public projectJson: Record<string, any> | undefined = undefined;\n\n /**\n * The module resolver for the project\n */\n public resolver!: Resolver;\n\n /**\n * The resolved configuration options\n */\n private resolvePatterns: RegExp[] = [];\n\n /**\n * Internal context fields and methods\n *\n * @danger\n * This field is for internal use only and should not be accessed or modified directly. It is unstable and can be changed at anytime.\n *\n * @internal\n */\n public get $$internal(): UNSAFE_ContextInternal<TResolvedConfig> {\n return this.#internal;\n }\n\n /**\n * Internal context fields and methods\n *\n * @danger\n * This field is for internal use only and should not be accessed or modified directly. It is unstable and can be changed at anytime.\n *\n * @internal\n */\n public set $$internal(value: UNSAFE_ContextInternal<TResolvedConfig>) {\n this.#internal = value;\n }\n\n /**\n * The resolved entry type definitions for the project\n */\n public get entry(): ResolvedEntryTypeDefinition[] {\n return resolveEntriesSync(\n this,\n !this.#entry ? toArray(this.config.entry) : this.#entry\n );\n }\n\n /**\n * Sets the resolved entry type definitions for the project\n */\n public set entry(value: ResolvedEntryTypeDefinition[]) {\n this.#entry = value;\n }\n\n /**\n * The TypeScript configuration parsed from the tsconfig file\n */\n public get tsconfig(): ParsedTypeScriptConfig {\n if (!this.#tsconfig) {\n this.tsconfig = {\n tsconfigFilePath: this.config.tsconfig\n } as ParsedTypeScriptConfig;\n }\n\n return this.#tsconfig;\n }\n\n /**\n * Sets the TypeScript configuration parsed from the tsconfig file\n */\n public set tsconfig(value: ParsedTypeScriptConfig) {\n this.#tsconfig = value;\n this.resolvePatterns = tsconfigPathsToRegExp(value?.options?.paths ?? {});\n }\n\n /**\n * The virtual file system interface for the project\n */\n public get fs(): VirtualFileSystemInterface {\n if (!this.#fs) {\n this.#fs = VirtualFileSystem.createSync(this);\n }\n\n return this.#fs;\n }\n\n /**\n * Get the checksum of the project's current state\n */\n public get checksum(): string | null {\n return this.#checksum;\n }\n\n /**\n * The meta information about the current build\n */\n public get meta() {\n return {\n buildId: this.#buildId,\n releaseId: this.#releaseId,\n checksum: this.#checksum,\n timestamp: this.#timestamp,\n projectRootHash: murmurhash(\n {\n workspaceRoot: this.workspaceConfig?.workspaceRoot,\n projectRoot: this.config?.projectRoot\n },\n {\n maxLength: PROJECT_ROOT_HASH_LENGTH\n }\n ),\n configHash: murmurhash(this.config, {\n maxLength: CACHE_HASH_LENGTH\n })\n } as MetaInfo;\n }\n\n /**\n * The resolved configuration options\n */\n public get config(): TResolvedConfig {\n return this.resolvedConfig ?? {};\n }\n\n /**\n * The logger function\n */\n public get log(): LogFn {\n if (!this.logFn) {\n this.logFn = this.createLog();\n }\n\n return this.logFn;\n }\n\n /**\n * The workspace configuration\n */\n public get workspaceConfig(): WorkspaceConfig {\n return this.#workspaceConfig;\n }\n\n /**\n * The environment paths for the project\n */\n public get envPaths(): EnvPaths {\n if (\n envPathCache.has({\n workspaceRoot: this.workspaceConfig.workspaceRoot,\n framework: this.config?.framework || \"powerlines\"\n })\n ) {\n return envPathCache.get({\n workspaceRoot: this.workspaceConfig.workspaceRoot,\n framework: this.config?.framework || \"powerlines\"\n })!;\n }\n\n const envPaths = getEnvPaths({\n orgId: \"storm-software\",\n appId: this.config?.framework || \"powerlines\",\n workspaceRoot: this.workspaceConfig.workspaceRoot\n });\n envPathCache.set(\n {\n workspaceRoot: this.workspaceConfig.workspaceRoot,\n framework: this.config?.framework || \"powerlines\"\n },\n envPaths\n );\n\n return envPaths;\n }\n\n /**\n * Get the path to the artifacts directory for the project\n */\n public get artifactsPath(): string {\n return joinPaths(\n this.workspaceConfig.workspaceRoot,\n this.config.projectRoot,\n this.config.output.artifactsPath\n );\n }\n\n /**\n * Get the path to the builtin modules used by the project\n */\n public get builtinsPath(): string {\n return joinPaths(this.artifactsPath, \"builtins\");\n }\n\n /**\n * Get the path to the entry directory for the project\n */\n public get entryPath(): string {\n return joinPaths(this.artifactsPath, \"entry\");\n }\n\n /**\n * Get the path to the data directory for the project\n */\n public get dataPath(): string {\n return joinPaths(\n this.envPaths.data,\n \"projects\",\n getPrefixedProjectRootHash(this.config.name, this.meta.projectRootHash)\n );\n }\n\n /**\n * Get the path to the cache directory for the project\n */\n public get cachePath(): string {\n return joinPaths(\n this.envPaths.cache,\n \"projects\",\n murmurhash(\n {\n checksum: this.#checksum,\n config: this.meta.configHash\n },\n {\n maxLength: CACHE_HASH_LENGTH\n }\n )\n );\n }\n\n /**\n * Get the path to the generated declaration file for the project\n */\n public get dtsPath(): string {\n return this.config.output.dts\n ? appendPath(this.config.output.dts, this.workspaceConfig.workspaceRoot)\n : joinPaths(\n this.workspaceConfig.workspaceRoot,\n this.config.projectRoot,\n \"powerlines.d.ts\"\n );\n }\n\n /**\n * Get the project root relative to the workspace root\n */\n public get relativeToWorkspaceRoot() {\n return relativeToWorkspaceRoot(this.config.projectRoot);\n }\n\n /**\n * The builtin module id that exist in the Powerlines virtual file system\n */\n public get builtins(): string[] {\n return Object.values(this.fs.metadata)\n .filter(meta => meta && meta.type === \"builtin\")\n .map(meta => meta?.id)\n .filter(Boolean);\n }\n\n /**\n * The {@link Project} instance used for type reflection and module manipulation\n *\n * @see https://ts-morph.com/\n *\n * @remarks\n * This instance is created lazily on first access.\n */\n public get program(): Project {\n if (!this.#program) {\n this.#program = createProgram(this, {\n skipAddingFilesFromTsConfig: true\n });\n }\n\n return this.#program;\n }\n\n /**\n * Gets the parser cache.\n */\n protected get parserCache(): FlatCache {\n if (!this.#parserCache) {\n this.#parserCache = create({\n cacheId: \"parser\",\n cacheDir: this.cachePath,\n ttl: 2 * 60 * 60 * 1000,\n lruSize: 5000,\n persistInterval: 250\n });\n }\n\n return this.#parserCache;\n }\n\n /**\n * Gets the request cache.\n */\n protected get requestCache(): FlatCache {\n if (!this.#requestCache) {\n this.#requestCache = create({\n cacheId: \"http\",\n cacheDir: this.cachePath,\n ttl: 5 * 60 * 1000,\n lruSize: 5000,\n persistInterval: 250\n });\n }\n\n return this.#requestCache;\n }\n\n /**\n * A function to perform HTTP fetch requests\n *\n * @remarks\n * This function uses a caching layer to avoid duplicate requests during the Powerlines process.\n *\n * @example\n * ```ts\n * const response = await context.fetch(\"https://api.example.com/data\");\n * const data = await response.json();\n * ```\n *\n * @see https://github.com/nodejs/undici\n *\n * @param input - The URL to fetch.\n * @param options - The fetch request options.\n * @returns A promise that resolves to a response returned by the fetch.\n */\n public async fetch(\n input: RequestInfo,\n options: FetchOptions = {}\n ): Promise<Response> {\n const cacheKey = murmurhash({\n input: input.toString(),\n options: JSON.stringify(options)\n });\n\n if (!this.config.skipCache && !options.skipCache) {\n const cached = this.requestCache.get<{ body: BodyInit } & ResponseInit>(\n cacheKey\n );\n if (cached) {\n return new Response(cached.body, {\n status: cached.status,\n statusText: cached.statusText,\n headers: cached.headers\n });\n }\n }\n\n const response = await fetchRequest(input, { timeout: 12_000, ...options });\n const result = {\n body: await response.text(),\n status: response.status,\n statusText: response.statusText,\n headers: Object.fromEntries(response.headers.entries())\n };\n\n if (!this.config.skipCache && !options.skipCache) {\n try {\n this.requestCache.set(cacheKey, result);\n } catch {\n // Do nothing\n }\n }\n\n return new Response(result.body, {\n status: result.status,\n statusText: result.statusText,\n headers: result.headers\n });\n }\n\n /**\n * Parse code using [Oxc-Parser](https://github.com/oxc/oxc) into an (ESTree-compatible)[https://github.com/estree/estree] AST object.\n *\n * @remarks\n * This function can be used to parse TypeScript code into an AST for further analysis or transformation.\n *\n * @example\n * ```ts\n * const ast = context.parse(\"const x: number = 42;\");\n * ```\n *\n * @see https://rollupjs.org/plugin-development/#this-parse\n * @see https://github.com/oxc/oxc\n *\n * @param code - The source code to parse.\n * @param options - The options to pass to the parser.\n * @returns An (ESTree-compatible)[https://github.com/estree/estree] AST object.\n */\n public async parse(code: string, options: ParseOptions = {}) {\n const cacheKey = murmurhash({\n code,\n options\n });\n\n let result!: ParseResult;\n if (!this.config.skipCache) {\n result = this.parserCache.get<ParseResult>(cacheKey);\n if (result) {\n return result;\n }\n }\n\n result = await parse(`source.${options.lang || \"ts\"}`, code, {\n ...options,\n sourceType: \"module\",\n showSemanticErrors: this.config.mode === \"development\"\n });\n\n if (!this.config.skipCache) {\n this.parserCache.set(cacheKey, result);\n }\n\n return result;\n }\n\n /**\n * A helper function to resolve modules in the Virtual File System\n *\n * @remarks\n * This function can be used to resolve modules relative to the project root directory.\n *\n * @example\n * ```ts\n * const resolved = await context.resolve(\"some-module\", \"/path/to/importer\");\n * ```\n *\n * @param id - The module to resolve.\n * @param importer - An optional path to the importer module.\n * @param options - Additional resolution options.\n * @returns A promise that resolves to the resolved module path.\n */\n public async resolve(\n id: string,\n importer?: string,\n options: ResolveOptions = {}\n ): Promise<ExternalIdResult | undefined> {\n let moduleId = id;\n if (this.config.build.alias) {\n if (Array.isArray(this.config.build.alias)) {\n const alias = this.config.build.alias.find(a =>\n match(moduleId, [a.find])\n );\n if (alias) {\n moduleId = alias.replacement;\n }\n } else if (\n isSetObject(this.config.build.alias) &&\n this.config.build.alias[id]\n ) {\n moduleId = this.config.build.alias[id];\n }\n }\n\n if (this.fs.isVirtual(moduleId)) {\n const result = await this.fs.resolve(moduleId, importer, {\n conditions: this.config.build.conditions,\n extensions: this.config.build.extensions,\n ...options\n });\n if (!result) {\n return undefined;\n }\n\n return {\n id: `\\0${result}`,\n external: this.config.projectType !== \"application\"\n };\n }\n\n if (this.config.build.skipNodeModulesBundle) {\n if (\n match(moduleId, this.resolvePatterns) ||\n match(moduleId, this.config.build.noExternal)\n ) {\n return undefined;\n }\n\n if (\n match(moduleId, this.config.build.external) ||\n moduleId.startsWith(\"node:\")\n ) {\n return { id: moduleId, external: true };\n }\n\n // Exclude any other import that looks like a Node module\n if (!/^[A-Z]:[/\\\\]|^\\.{0,2}\\/|^\\.{1,2}$/.test(moduleId)) {\n return {\n id: moduleId,\n external: true\n };\n }\n } else {\n if (match(moduleId, this.config.build.noExternal)) {\n return undefined;\n }\n\n if (\n match(moduleId, this.config.build.external) ||\n moduleId.startsWith(\"node:\")\n ) {\n return { id: moduleId, external: true };\n }\n }\n\n return undefined;\n }\n\n /**\n * A helper function to load modules from the Virtual File System\n *\n * @remarks\n * This function can be used to load modules relative to the project root directory.\n *\n * @example\n * ```ts\n * const module = await context.load(\"some-module\", \"/path/to/importer\");\n * ```\n *\n * @param id - The module to load.\n * @returns A promise that resolves to the loaded module.\n */\n public async load(id: string): Promise<TransformResult | undefined> {\n const resolvedId = await this.fs.resolve(id);\n if (!resolvedId) {\n return undefined;\n }\n\n const code = await this.fs.read(resolvedId);\n if (!code) {\n return undefined;\n }\n\n return { code, map: null };\n }\n\n /**\n * Get the builtin virtual files that exist in the Powerlines virtual file system\n */\n public async getBuiltins() {\n return Promise.all(\n Object.entries(this.fs.metadata)\n .filter(([, meta]) => meta && meta.type === \"builtin\")\n .map(async ([path, meta]) => {\n const code = await this.fs.read(path);\n\n return { ...meta, path, code } as VirtualFile;\n })\n );\n }\n\n /**\n * Resolves a entry virtual file and writes it to the VFS if it does not already exist\n *\n * @param code - The source code of the entry file\n * @param path - A path to write the entry file to\n * @param options - Optional write file options\n */\n public async emitEntry(\n code: string,\n path: string,\n options: EmitEntryOptions = {}\n ): Promise<void> {\n const entryPath = isAbsolute(path)\n ? path\n : appendPath(path, this.entryPath);\n\n this.entry ??= [];\n this.entry.push({\n name: options.name,\n file: entryPath,\n input: options.input,\n output: options.output\n });\n\n return this.fs.write(\n entryPath,\n code,\n defu(omit(options, [\"name\"]), {\n meta: {\n type: \"entry\",\n properties: {\n name: options.name,\n output: options.output,\n \"input.file\": options.input?.file,\n \"input.name\": options.input?.name\n }\n }\n })\n );\n }\n\n /**\n * Resolves a builtin virtual file and writes it to the VFS if it does not already exist\n *\n * @param code - The source code of the builtin file\n * @param id - The unique identifier of the builtin file\n * @param path - An optional path to write the builtin file to\n * @param options - Optional write file options\n */\n public async emitBuiltin(\n code: string,\n id: string,\n path?: string,\n options: WriteOptions = {}\n ): Promise<void> {\n return this.fs.write(\n path\n ? isAbsolute(path)\n ? path\n : joinPaths(this.builtinsPath, path)\n : appendPath(id, this.builtinsPath),\n code,\n defu(options, { meta: { type: \"builtin\" } })\n );\n }\n\n /**\n * Update the context using a new user configuration options\n *\n * @param userConfig - The new user configuration options.\n */\n public async withUserConfig(\n userConfig: InitialUserConfig<TResolvedConfig[\"userConfig\"]>,\n options: InitContextOptions = {\n isHighPriority: true\n }\n ) {\n this.mergeUserConfig(userConfig as Partial<TResolvedConfig[\"userConfig\"]>);\n\n await this.init(this.config.userConfig, options);\n }\n\n /**\n * Update the context using a new inline configuration options\n *\n * @param inlineConfig - The new inline configuration options.\n */\n public async withInlineConfig(\n inlineConfig: TResolvedConfig[\"inlineConfig\"],\n options: InitContextOptions = {\n isHighPriority: true\n }\n ) {\n this.config.inlineConfig = inlineConfig;\n\n if (inlineConfig.command === \"new\") {\n const workspacePackageJsonPath = joinPaths(\n this.workspaceConfig.workspaceRoot,\n \"package.json\"\n );\n if (!existsSync(workspacePackageJsonPath)) {\n throw new Error(\n `The workspace package.json file could not be found at ${workspacePackageJsonPath}`\n );\n }\n\n this.packageJson = await readJsonFile<PackageJson>(\n workspacePackageJsonPath\n );\n\n this.workspaceConfig.repository ??= isSetString(\n this.packageJson?.repository\n )\n ? this.packageJson.repository\n : this.packageJson?.repository?.url;\n }\n\n await this.init(this.config.inlineConfig, options);\n }\n\n /**\n * A logging function for fatal messages\n *\n * @param message - The message to log.\n */\n public fatal(message: string | UnpluginMessage) {\n this.log(\n LogLevelLabel.FATAL,\n isString(message) ? message : StormJSON.stringify(message)\n );\n }\n\n /**\n * A logging function for error messages\n *\n * @param message - The message to log.\n */\n public error(message: string | UnpluginMessage) {\n this.log(\n LogLevelLabel.ERROR,\n isString(message) ? message : StormJSON.stringify(message)\n );\n }\n\n /**\n * A logging function for warning messages\n *\n * @param message - The message to log.\n */\n public warn(message: string | UnpluginMessage) {\n this.log(\n LogLevelLabel.WARN,\n isString(message) ? message : StormJSON.stringify(message)\n );\n }\n\n /**\n * A logging function for informational messages\n *\n * @param message - The message to log.\n */\n public info(message: string | UnpluginMessage) {\n this.log(\n LogLevelLabel.INFO,\n isString(message) ? message : StormJSON.stringify(message)\n );\n }\n\n /**\n * A logging function for debug messages\n *\n * @param message - The message to log.\n */\n public debug(message: string | UnpluginMessage) {\n this.log(\n LogLevelLabel.DEBUG,\n isString(message) ? message : StormJSON.stringify(message)\n );\n }\n\n /**\n * A logging function for trace messages\n *\n * @param message - The message to log.\n */\n public trace(message: string | UnpluginMessage) {\n this.log(\n LogLevelLabel.TRACE,\n isString(message) ? message : StormJSON.stringify(message)\n );\n }\n\n /**\n * Create a new logger instance\n *\n * @param name - The name to use for the logger instance\n * @returns A logger function\n */\n public createLog(name: string | null = null): LogFn {\n return createLog(name, {\n ...this.config,\n logLevel: isNull(this.config.logLevel) ? \"silent\" : this.config.logLevel\n });\n }\n\n /**\n * Extend the current logger instance with a new name\n *\n * @param name - The name to use for the extended logger instance\n * @returns A logger function\n */\n public extendLog(name: string): LogFn {\n return extendLog(this.log, name);\n }\n\n /**\n * Generates a checksum representing the current context state\n *\n * @param root - The root directory of the project to generate the checksum for\n * @returns A promise that resolves to a string representing the checksum\n */\n public async generateChecksum(\n root = this.config.projectRoot\n ): Promise<string> {\n this.#checksum = await hashDirectory(root, {\n ignore: [\"node_modules\", \".git\", \".nx\", \".cache\", \".storm\", \"tmp\", \"dist\"]\n });\n\n return this.#checksum;\n }\n\n /**\n * Creates a new StormContext instance.\n *\n * @param workspaceConfig - The workspace configuration.\n */\n protected constructor(workspaceConfig: WorkspaceConfig) {\n this.#workspaceConfig = workspaceConfig;\n\n envPathCache.set(\n {\n workspaceRoot: workspaceConfig.workspaceRoot,\n framework: \"powerlines\"\n },\n getEnvPaths({\n orgId:\n (isSetObject(workspaceConfig.organization)\n ? workspaceConfig.organization.name\n : workspaceConfig.organization) || \"storm-software\",\n appId: \"powerlines\",\n workspaceRoot: workspaceConfig.workspaceRoot\n })\n );\n }\n\n /**\n * The resolved configuration for this context\n */\n protected resolvedConfig: TResolvedConfig = {} as TResolvedConfig;\n\n /**\n * A logger function specific to this context\n */\n protected logFn!: LogFn;\n\n /**\n * Initialize the context with the provided configuration options\n *\n * @param config - The partial user configuration to use for initialization.\n */\n protected async init(\n config: Partial<TResolvedConfig[\"userConfig\"]> = {},\n options: InitContextOptions = {\n isHighPriority: true\n }\n ) {\n const cacheKey: ConfigCacheKey = {\n projectRoot:\n config.root ??\n this.config.projectRoot ??\n this.config.userConfig?.root ??\n this.config.inlineConfig?.root,\n mode: (config.mode ?? this.config.mode) || this.workspaceConfig.mode,\n skipCache: config.skipCache ?? this.config.skipCache ?? false,\n configFile: config.configFile ?? this.config.configFile,\n framework: config.framework ?? this.config.framework ?? \"powerlines\",\n command: this.config.inlineConfig?.command\n };\n\n if (configCache.has(cacheKey)) {\n const result = configCache.get(cacheKey)!;\n\n this.projectJson = result.projectJson;\n this.packageJson = result.packageJson;\n this.#checksum = result.checksum;\n this.resolver = result.resolver;\n\n this.mergeUserConfig(result.userConfig.config, this.config.userConfig);\n } else {\n const projectJsonPath = joinPaths(cacheKey.projectRoot, \"project.json\");\n if (existsSync(projectJsonPath)) {\n this.projectJson = await readJsonFile(projectJsonPath);\n }\n\n const packageJsonPath = joinPaths(cacheKey.projectRoot, \"package.json\");\n if (existsSync(packageJsonPath)) {\n this.packageJson = await readJsonFile<PackageJson>(packageJsonPath);\n }\n\n this.#checksum = await this.generateChecksum(cacheKey.projectRoot);\n this.resolver = createResolver({\n workspaceRoot: this.workspaceConfig.workspaceRoot,\n projectRoot: cacheKey.projectRoot,\n cacheDir: this.cachePath,\n mode: cacheKey.mode,\n logLevel: (config.logLevel ||\n this.config?.logLevel ||\n this.workspaceConfig.logLevel ||\n \"info\") as CreateResolverOptions[\"logLevel\"],\n skipCache: cacheKey.skipCache\n });\n\n const userConfig = await loadUserConfigFile(\n cacheKey.projectRoot,\n this.workspaceConfig.workspaceRoot,\n this.resolver,\n cacheKey.command as PowerlinesCommand | undefined,\n cacheKey.mode,\n cacheKey.configFile,\n cacheKey.framework\n );\n this.mergeUserConfig(userConfig.config);\n\n configCache.set(cacheKey, {\n projectJson: this.projectJson,\n packageJson: this.packageJson,\n checksum: this.#checksum,\n resolver: this.resolver,\n userConfig\n });\n }\n\n config.tsconfig ??= getTsconfigFilePath(\n this.workspaceConfig.workspaceRoot,\n cacheKey.projectRoot,\n config.tsconfig\n );\n\n if (isSetObject(config)) {\n this.resolvedConfig = defu(\n {\n inlineConfig: this.config.inlineConfig,\n userConfig: this.config.userConfig\n },\n options.isHighPriority ? this.#getConfigProps(config) : {},\n {\n command: this.config.inlineConfig?.command,\n ...this.#getConfigProps(this.config.inlineConfig)\n },\n this.#getConfigProps(this.config.userConfig),\n {\n mode: this.workspaceConfig?.mode,\n logLevel: this.workspaceConfig?.logLevel,\n skipCache: this.workspaceConfig?.skipCache\n },\n {\n name: this.projectJson?.name || this.packageJson?.name,\n version: this.packageJson?.version,\n description: this.packageJson?.description,\n sourceRoot:\n this.projectJson?.sourceRoot ||\n appendPath(\"src\", cacheKey.projectRoot),\n output: defu(config.output ?? {}, {\n outputPath: cacheKey.projectRoot\n ? joinPaths(\n this.workspaceConfig?.directories?.build || \"dist\",\n cacheKey.projectRoot\n )\n : this.workspaceConfig?.directories?.build || \"dist\",\n artifactsPath: joinPaths(\n cacheKey.projectRoot,\n `.${config.framework ?? \"powerlines\"}`\n ),\n dts: joinPaths(\n cacheKey.projectRoot,\n `${config.framework ?? \"powerlines\"}.d.ts`\n ),\n builtinPrefix: config.framework ?? \"powerlines\",\n assets: [\n {\n glob: \"LICENSE\"\n },\n {\n input: cacheKey.projectRoot,\n glob: \"*.md\"\n },\n {\n input: cacheKey.projectRoot,\n glob: \"package.json\"\n }\n ]\n })\n },\n options.isHighPriority ? {} : this.#getConfigProps(config),\n {\n inlineConfig: {},\n userConfig: {},\n framework: \"powerlines\",\n platform: \"neutral\",\n mode: \"production\",\n projectType: \"application\",\n logLevel: \"info\",\n preview: false,\n environments: {},\n transform: {\n babel: {\n plugins: [],\n presets: []\n }\n },\n lint: {\n eslint: {}\n },\n build: {\n target: \"esnext\",\n override: {}\n }\n }\n ) as any;\n }\n\n this.config.entry = getUniqueEntries(this.config.entry);\n\n if (\n this.config.name?.startsWith(\"@\") &&\n this.config.name.split(\"/\").filter(Boolean).length > 1\n ) {\n this.config.name = this.config.name.split(\"/\").filter(Boolean)[1]!;\n }\n\n this.config.title ??= titleCase(this.config.name);\n\n if (this.config.userConfig.build?.external) {\n this.config.userConfig.build.external = getUnique(\n this.config.userConfig.build.external\n );\n }\n if (this.config.userConfig.build?.noExternal) {\n this.config.userConfig.build.noExternal = getUnique(\n this.config.userConfig.build.noExternal\n );\n }\n\n if (this.config.build.external) {\n this.config.build.external = getUnique(this.config.build.external);\n }\n if (this.config.build.noExternal) {\n this.config.build.noExternal = getUnique(this.config.build.noExternal);\n }\n\n this.config.output.format = getUnique(\n toArray(\n this.config.output?.format ??\n (this.config.projectType === \"library\" ? [\"cjs\", \"esm\"] : [\"esm\"])\n )\n );\n\n if (\n this.config.projectRoot &&\n this.config.projectRoot !== \".\" &&\n this.config.projectRoot !== \"./\" &&\n this.config.projectRoot !== this.workspaceConfig.workspaceRoot\n ) {\n this.config.output.outputPath ??= joinPaths(\n \"dist\",\n this.config.projectRoot\n );\n this.config.output.buildPath ??= joinPaths(\n this.config.projectRoot,\n \"dist\"\n );\n } else {\n this.config.output.outputPath ??= \"dist\";\n this.config.output.buildPath ??= \"dist\";\n }\n\n this.config.output.assets = getUniqueBy(\n this.config.output.assets.map(asset => {\n return {\n glob: isSetObject(asset) ? asset.glob : asset,\n input:\n isString(asset) ||\n !asset.input ||\n asset.input === \".\" ||\n asset.input === \"/\" ||\n asset.input === \"./\"\n ? this.workspaceConfig.workspaceRoot\n : isParentPath(asset.input, this.workspaceConfig.workspaceRoot) ||\n asset.input === this.workspaceConfig.workspaceRoot\n ? asset.input\n : appendPath(asset.input, this.workspaceConfig.workspaceRoot),\n output:\n isSetObject(asset) && asset.output\n ? isParentPath(asset.output, this.workspaceConfig.workspaceRoot)\n ? asset.output\n : appendPath(\n joinPaths(\n this.config.output.outputPath,\n replacePath(\n replacePath(\n asset.output,\n replacePath(\n this.config.output.outputPath,\n this.workspaceConfig.workspaceRoot\n )\n ),\n this.config.output.outputPath\n )\n ),\n this.workspaceConfig.workspaceRoot\n )\n : appendPath(\n this.config.output.outputPath,\n this.workspaceConfig.workspaceRoot\n ),\n ignore:\n isSetObject(asset) && asset.ignore\n ? toArray(asset.ignore)\n : undefined\n };\n }),\n (a: ResolvedAssetGlob) => `${a.input}-${a.glob}-${a.output}`\n );\n\n this.config.plugins = (this.config.plugins ?? [])\n .filter(Boolean)\n .reduce((ret, plugin) => {\n if (\n isPlugin(plugin) &&\n checkDedupe(\n plugin,\n ret.filter(p => isPlugin(p))\n )\n ) {\n return ret;\n }\n\n ret.push(plugin);\n\n return ret;\n }, [] as PluginConfig[]);\n\n // Apply path token replacements\n\n if (this.config.tsconfig) {\n this.config.tsconfig = replacePathTokens(this, this.config.tsconfig);\n }\n\n if (this.config.output.dts) {\n this.config.output.dts = replacePathTokens(this, this.config.output.dts);\n }\n\n if (this.config.build.polyfill) {\n this.config.build.polyfill = this.config.build.polyfill.map(polyfill =>\n replacePathTokens(this, polyfill)\n );\n }\n\n if (this.config.output.assets) {\n this.config.output.assets = this.config.output.assets.map(asset => ({\n ...asset,\n glob: replacePathTokens(this, asset.glob),\n ignore: asset.ignore\n ? asset.ignore.map(ignore => replacePathTokens(this, ignore))\n : undefined,\n input: replacePathTokens(this, asset.input),\n output: replacePathTokens(this, asset.output)\n }));\n }\n\n this.#fs ??= await VirtualFileSystem.create(this);\n }\n\n protected mergeUserConfig(\n from: Partial<TResolvedConfig[\"userConfig\"]> = {},\n into: Partial<TResolvedConfig[\"userConfig\"]> = this.config.userConfig ?? {}\n ) {\n this.config.userConfig = defu(\n {\n entry:\n Array.isArray(from.entry) && from.entry.length > 0\n ? from.entry\n : Array.isArray(into?.entry) && into.entry.length > 0\n ? into.entry\n : []\n },\n omit(from ?? {}, [\"entry\"]),\n omit(into ?? {}, [\"entry\"])\n ) as TResolvedConfig[\"userConfig\"];\n\n if (this.config.userConfig.output?.format) {\n this.config.userConfig.output.format = getUnique(\n toArray(this.config.userConfig.output?.format)\n );\n }\n\n this.config.userConfig.plugins = (this.config.userConfig.plugins ?? [])\n .filter(Boolean)\n .reduce((ret, plugin) => {\n if (\n isPlugin(plugin) &&\n checkDedupe(\n plugin,\n ret.filter(p => isPlugin(p))\n )\n ) {\n return ret;\n }\n\n ret.push(plugin);\n\n return ret;\n }, [] as PluginConfig[]);\n }\n}\n"]}
|