powerlines 0.30.9 → 0.30.10

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.
Files changed (93) hide show
  1. package/dist/api.cjs +2 -2
  2. package/dist/api.js +1 -1
  3. package/dist/astro.cjs +4 -4
  4. package/dist/astro.js +3 -3
  5. package/dist/{chunk-RDRKBM2J.js → chunk-7GYPWBEP.js} +3 -3
  6. package/dist/chunk-F7QESYUW.cjs +12 -0
  7. package/dist/{chunk-DJCJP2K3.js → chunk-IDLTP3CA.js} +11 -8
  8. package/dist/{chunk-5EV7B7LS.cjs → chunk-JCQNCKL6.cjs} +11 -8
  9. package/dist/{chunk-AQSF7JCD.js → chunk-LAAYAZCS.js} +3 -3
  10. package/dist/chunk-QCTZQ37E.cjs +12 -0
  11. package/dist/{chunk-AU4GWG43.cjs → chunk-TGULIA3I.cjs} +5 -5
  12. package/dist/{chunk-I3HIGKIE.cjs → chunk-TLNZXWBF.cjs} +4 -4
  13. package/dist/{chunk-W6J7EJ2B.js → chunk-XSHI4YXA.js} +3 -3
  14. package/dist/{chunk-LTUR7TOP.js → chunk-Y6BHFF2K.js} +3 -3
  15. package/dist/{chunk-MEZ6JUXR.js → chunk-YRYNUZMV.js} +3 -3
  16. package/dist/{chunk-RPLRKL7X.cjs → chunk-Z2YRWYQH.cjs} +4 -4
  17. package/dist/esbuild.cjs +6 -6
  18. package/dist/esbuild.js +3 -3
  19. package/dist/farm.cjs +3 -3
  20. package/dist/farm.js +2 -2
  21. package/dist/index.cjs +9 -9
  22. package/dist/index.js +2 -2
  23. package/dist/lib/build/index.cjs +5 -5
  24. package/dist/lib/build/index.js +1 -1
  25. package/dist/lib/build/tsdown.cjs +5 -5
  26. package/dist/lib/build/tsdown.js +1 -1
  27. package/dist/lib/{chunk-26EMHPES.js → chunk-5FVICSI2.js} +6 -5
  28. package/dist/lib/chunk-5FVICSI2.js.map +1 -0
  29. package/dist/lib/{chunk-RYILFB66.cjs → chunk-5KOLVUSY.cjs} +9 -8
  30. package/dist/lib/chunk-5KOLVUSY.cjs.map +1 -0
  31. package/dist/lib/{chunk-NMTYZRD3.cjs → chunk-75KYTRYW.cjs} +12 -12
  32. package/dist/lib/{chunk-NMTYZRD3.cjs.map → chunk-75KYTRYW.cjs.map} +1 -1
  33. package/dist/lib/{chunk-HN76MIOU.cjs → chunk-CLLQO726.cjs} +5 -4
  34. package/dist/lib/chunk-CLLQO726.cjs.map +1 -0
  35. package/dist/lib/{chunk-P6UDUIUO.js → chunk-D7GUAMYL.js} +4 -4
  36. package/dist/lib/{chunk-P6UDUIUO.js.map → chunk-D7GUAMYL.js.map} +1 -1
  37. package/dist/lib/{chunk-NAX6YQ7E.cjs → chunk-KLRDCXEP.cjs} +3 -3
  38. package/dist/lib/{chunk-NAX6YQ7E.cjs.map → chunk-KLRDCXEP.cjs.map} +1 -1
  39. package/dist/lib/{chunk-ZNPYK23Q.cjs → chunk-Q2CL3VW4.cjs} +16 -15
  40. package/dist/lib/chunk-Q2CL3VW4.cjs.map +1 -0
  41. package/dist/lib/{chunk-W5W4YR3Q.js → chunk-QOTSQ6ZF.js} +7 -6
  42. package/dist/lib/chunk-QOTSQ6ZF.js.map +1 -0
  43. package/dist/lib/{chunk-M446NHAJ.js → chunk-VN2OA25X.js} +5 -4
  44. package/dist/lib/chunk-VN2OA25X.js.map +1 -0
  45. package/dist/lib/{chunk-MOFTDKP2.js → chunk-WOQDW3EX.js} +3 -3
  46. package/dist/lib/{chunk-MOFTDKP2.js.map → chunk-WOQDW3EX.js.map} +1 -1
  47. package/dist/lib/contexts/api-context.cjs +4 -4
  48. package/dist/lib/contexts/api-context.js +3 -3
  49. package/dist/lib/contexts/context.cjs +2 -2
  50. package/dist/lib/contexts/context.d.cts +1 -1
  51. package/dist/lib/contexts/context.d.ts +1 -1
  52. package/dist/lib/contexts/context.js +1 -1
  53. package/dist/lib/contexts/environment-context.cjs +3 -3
  54. package/dist/lib/contexts/environment-context.js +2 -2
  55. package/dist/lib/contexts/index.cjs +6 -6
  56. package/dist/lib/contexts/index.js +3 -3
  57. package/dist/lib/index.cjs +8 -8
  58. package/dist/lib/index.js +4 -4
  59. package/dist/lib/unplugin/factory.cjs +5 -5
  60. package/dist/lib/unplugin/factory.js +4 -4
  61. package/dist/lib/unplugin/index.cjs +5 -5
  62. package/dist/lib/unplugin/index.js +4 -4
  63. package/dist/next.cjs +4 -4
  64. package/dist/next.js +3 -3
  65. package/dist/nuxt.cjs +7 -7
  66. package/dist/nuxt.js +5 -5
  67. package/dist/rolldown.cjs +6 -6
  68. package/dist/rolldown.js +3 -3
  69. package/dist/rollup.cjs +3 -3
  70. package/dist/rollup.js +2 -2
  71. package/dist/rspack.cjs +3 -3
  72. package/dist/rspack.js +2 -2
  73. package/dist/tsdown.cjs +4 -4
  74. package/dist/tsdown.js +3 -3
  75. package/dist/tsup.cjs +4 -4
  76. package/dist/tsup.js +3 -3
  77. package/dist/unloader.cjs +3 -3
  78. package/dist/unloader.js +2 -2
  79. package/dist/unplugin.cjs +5 -5
  80. package/dist/unplugin.js +3 -3
  81. package/dist/vite.cjs +6 -6
  82. package/dist/vite.js +3 -3
  83. package/dist/webpack.cjs +6 -6
  84. package/dist/webpack.js +3 -3
  85. package/package.json +23 -23
  86. package/dist/chunk-QAJDNAY4.cjs +0 -12
  87. package/dist/chunk-Z5BZ26WT.cjs +0 -12
  88. package/dist/lib/chunk-26EMHPES.js.map +0 -1
  89. package/dist/lib/chunk-HN76MIOU.cjs.map +0 -1
  90. package/dist/lib/chunk-M446NHAJ.js.map +0 -1
  91. package/dist/lib/chunk-RYILFB66.cjs.map +0 -1
  92. package/dist/lib/chunk-W5W4YR3Q.js.map +0 -1
  93. package/dist/lib/chunk-ZNPYK23Q.cjs.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/types/plugin.ts","../../src/lib/contexts/environment-context.ts"],"names":["PLUGIN_NON_HOOK_FIELDS","PowerlinesEnvironmentContext","PowerlinesContext","fromConfig","workspaceConfig","config","context","init","powerlinesPath","resolvePackage","Error","environment","plugins","hooks","addPlugin","plugin","resolvedPlugin","isFunction","applyToEnvironment","result","Promise","resolve","isObject","Object","keys","length","isPluginConfig","$$internal","isPlugin","createPluginContext","push","filter","key","includes","reduce","ret","hook","pluginHook","isPluginHook","isHookExternal","enforce","addPluginHook","order","normal","getHookHandler","bind","selectHooks","options","preOrdered","map","h","find","p","name","handle","handler","preEnforced","postOrdered","postEnforced","resolvedConfig"],"mappings":";;;;;;;;AA4YO,IAAMA,sBAAAA,GAAyB;AACpC,EAAA,MAAA;AACA,EAAA,KAAA;AACA,EAAA,SAAA;AACA,EAAA,QAAA;AACA,EAAA,WAAA;AACA,EAAA;;;;ACnWK,IAAMC,4BAAAA,GAAN,MAAMA,6BAAAA,SAGHC,iBAAAA,CAAAA;EAlDV;;;;;;AAwDE,EAAA,MAAA,GAAoD,EAAC;;;;;;;;EAWrD,aAAoBC,UAAAA,CAGlBC,iBACAC,MAAAA,EACwD;AACxD,IAAA,MAAMC,OAAAA,GAAU,IAAIL,6BAAAA,CAClBI,MAAAA,EACAD,eAAAA,CAAAA;AAEF,IAAA,MAAME,QAAQC,IAAAA,EAAI;AAElB,IAAA,MAAMC,cAAAA,GAAiB,MAAMC,cAAAA,CAAe,YAAA,CAAA;AAC5C,IAAA,IAAI,CAACD,cAAAA,EAAgB;AACnB,MAAA,MAAM,IAAIE,MAAM,kDAAA,CAAA;AAClB,IAAA;AAEAJ,IAAAA,OAAAA,CAAQE,cAAAA,GAAiBA,cAAAA;AAEzB,IAAA,OAAOF,OAAAA;AACT,EAAA;;;;AAKOK,EAAAA,WAAAA;;;;AAKAC,EAAAA,OAAAA,GAAuD,EAAA;;;;AAK9D,EAAA,IAAoBP,MAAAA,GAA0B;AAC5C,IAAA,OAAO,KAAA,CAAMA,MAAAA;AACf,EAAA;AAEA,EAAA,IAAWQ,KAAAA,GAAmD;AAC5D,IAAA,OAAO,IAAA,CAAK,MAAA;AACd,EAAA;A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CAAA;AAEJ,MAAA;AACF,IAAA;AAEA,IAAA,OAAOa,MAAAA;AACT,EAAA;AAEA,EAAA,WAAA,CACEd,QACAD,eAAAA,EACA;AACA,IAAA,KAAA,CAAMA,eAAAA,CAAAA;AAEN,IAAA,IAAA,CAAKuD,cAAAA,GAAiBtD,MAAAA;AACxB,EAAA;AACF","file":"chunk-5FVICSI2.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 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 type { CommandType } 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. 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 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 in out TContext extends PluginContext<ResolvedConfig> =\n 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<any>[];\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<any>;\n}\n\nexport const PLUGIN_NON_HOOK_FIELDS = [\n \"name\",\n \"api\",\n \"enforce\",\n \"dedupe\",\n \"dependsOn\",\n \"applyToEnvironment\"\n] as const;\n\nexport type PluginNonHookFields =\n | ArrayValues<typeof PLUGIN_NON_HOOK_FIELDS>\n | UnpluginBuildVariant;\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 { resolvePackage } from \"@stryke/fs/resolve\";\nimport { isFunction } from \"@stryke/type-checks/is-function\";\nimport { isObject } from \"@stryke/type-checks/is-object\";\nimport { ArrayValues } from \"@stryke/types/array\";\nimport {\n addPluginHook,\n getHookHandler,\n isHookExternal,\n isPlugin,\n isPluginConfig,\n isPluginHook\n} from \"../../plugin-utils/helpers\";\nimport { WorkspaceConfig } from \"../../types/config\";\nimport {\n EnvironmentContext,\n EnvironmentContextPlugin,\n PluginContext,\n SelectHooksOptions,\n SelectHooksResult\n} from \"../../types/context\";\nimport { BaseHooksList, HookKeys, HooksList } from \"../../types/hooks\";\nimport { Plugin, PLUGIN_NON_HOOK_FIELDS } from \"../../types/plugin\";\nimport {\n EnvironmentResolvedConfig,\n ResolvedConfig\n} from \"../../types/resolved\";\nimport { PowerlinesContext } from \"./context\";\nimport { createPluginContext } from \"./plugin-context\";\n\nexport class PowerlinesEnvironmentContext<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig\n>\n extends PowerlinesContext<TResolvedConfig>\n implements EnvironmentContext<TResolvedConfig>\n{\n /**\n * The hooks registered by plugins in this environment\n */\n #hooks: HooksList<PluginContext<TResolvedConfig>> = {} as HooksList<\n PluginContext<TResolvedConfig>\n >;\n\n /**\n * Create a new Storm context from the workspace root and user config.\n *\n * @param workspaceConfig - 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 fromConfig<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig\n >(\n workspaceConfig: WorkspaceConfig,\n config: TResolvedConfig\n ): Promise<PowerlinesEnvironmentContext<TResolvedConfig>> {\n const context = new PowerlinesEnvironmentContext<TResolvedConfig>(\n config,\n workspaceConfig\n );\n await context.init();\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 * The resolved environment configuration\n */\n public environment!: EnvironmentResolvedConfig;\n\n /**\n * The list of plugins applied to this environment\n */\n public plugins: EnvironmentContextPlugin<TResolvedConfig>[] = [];\n\n /**\n * The resolved configuration options\n */\n public override get config(): TResolvedConfig {\n return super.config;\n }\n\n public get hooks(): HooksList<PluginContext<TResolvedConfig>> {\n return this.#hooks;\n }\n\n public async addPlugin(plugin: Plugin<PluginContext<TResolvedConfig>>) {\n let resolvedPlugin = plugin;\n if (isFunction(plugin.applyToEnvironment)) {\n const result = await Promise.resolve(\n plugin.applyToEnvironment(this.environment)\n );\n\n if (!result || (isObject(result) && Object.keys(result).length === 0)) {\n return;\n }\n\n if (isPluginConfig(result)) {\n return this.$$internal.addPlugin(result);\n }\n\n resolvedPlugin = isPlugin<TResolvedConfig>(result) ? result : plugin;\n }\n\n const context = createPluginContext<TResolvedConfig>(resolvedPlugin, this);\n\n this.plugins.push({\n plugin: resolvedPlugin,\n context\n });\n\n this.#hooks = Object.keys(resolvedPlugin)\n .filter(\n key =>\n !PLUGIN_NON_HOOK_FIELDS.includes(\n key as ArrayValues<typeof PLUGIN_NON_HOOK_FIELDS>\n )\n )\n .reduce((ret, key) => {\n const hook = key as keyof HooksList<PluginContext<TResolvedConfig>>;\n const pluginHook = resolvedPlugin[hook as keyof typeof resolvedPlugin];\n if (!isPluginHook(pluginHook)) {\n return ret;\n }\n\n if (!isHookExternal(hook)) {\n ret[hook] ??= {};\n if (resolvedPlugin.enforce) {\n ret[hook][`${resolvedPlugin.enforce}Enforced`] ??= [];\n\n addPluginHook(\n context,\n resolvedPlugin,\n pluginHook,\n ret[hook][`${resolvedPlugin.enforce}Enforced`]!\n );\n\n return ret;\n }\n\n if (isFunction(pluginHook) || !pluginHook.order) {\n ret[hook].normal ??= [];\n\n addPluginHook(\n context,\n resolvedPlugin,\n pluginHook,\n ret[hook].normal\n );\n\n return ret;\n }\n\n ret[hook][`${pluginHook.order}Ordered`] ??= [];\n\n addPluginHook(\n context,\n resolvedPlugin,\n pluginHook,\n ret[hook][`${pluginHook.order}Ordered`]!\n );\n } else {\n ret[hook] ??= [];\n ret[hook].push({\n plugin: resolvedPlugin,\n hook: getHookHandler(pluginHook).bind(context)\n } as any);\n }\n\n return ret;\n }, this.hooks);\n }\n\n /**\n * Retrieves the hook handlers for a specific hook name\n */\n public selectHooks<TKey extends HookKeys<PluginContext<TResolvedConfig>>>(\n hook: TKey,\n options?: SelectHooksOptions\n ): SelectHooksResult<TResolvedConfig, TKey>[] {\n const result = [] as SelectHooksResult<TResolvedConfig, TKey>[];\n\n if (this.hooks[hook]) {\n if (!isHookExternal(hook)) {\n const hooks = this.hooks[hook] as BaseHooksList<\n PluginContext<TResolvedConfig>\n >;\n if (options?.order) {\n if (options?.order === \"pre\") {\n result.push(\n ...(hooks.preOrdered ?? []).map(h => {\n const plugin = this.plugins.find(\n p => p.plugin.name === h.plugin.name\n );\n if (!plugin) {\n throw new Error(\n `Could not find plugin context for plugin \"${\n h.plugin.name\n }\".`\n );\n }\n\n return {\n handle: h.handler,\n context: plugin.context\n };\n })\n );\n result.push(\n ...(hooks.preEnforced ?? []).map(h => {\n const plugin = this.plugins.find(\n p => p.plugin.name === h.plugin.name\n );\n if (!plugin) {\n throw new Error(\n `Could not find plugin context for plugin \"${\n h.plugin.name\n }\".`\n );\n }\n\n return {\n handle: h.handler,\n context: plugin.context\n };\n })\n );\n } else if (options?.order === \"post\") {\n result.push(\n ...(hooks.postOrdered ?? []).map(h => {\n const plugin = this.plugins.find(\n p => p.plugin.name === h.plugin.name\n );\n if (!plugin) {\n throw new Error(\n `Could not find plugin context for plugin \"${\n h.plugin.name\n }\".`\n );\n }\n\n return {\n handle: h.handler,\n context: plugin.context\n };\n })\n );\n result.push(\n ...(hooks.postEnforced ?? []).map(h => {\n const plugin = this.plugins.find(\n p => p.plugin.name === h.plugin.name\n );\n if (!plugin) {\n throw new Error(\n `Could not find plugin context for plugin \"${\n h.plugin.name\n }\".`\n );\n }\n\n return {\n handle: h.handler,\n context: plugin.context\n };\n })\n );\n } else {\n result.push(\n ...(hooks.normal ?? []).map(h => {\n const plugin = this.plugins.find(\n p => p.plugin.name === h.plugin.name\n );\n if (!plugin) {\n throw new Error(\n `Could not find plugin context for plugin \"${\n h.plugin.name\n }\".`\n );\n }\n\n return {\n handle: h.handler,\n context: plugin.context\n };\n })\n );\n }\n } else {\n result.push(...this.selectHooks(hook, { order: \"pre\" }));\n result.push(...this.selectHooks(hook, { order: \"normal\" }));\n result.push(...this.selectHooks(hook, { order: \"post\" }));\n }\n } else {\n result.push(\n ...this.hooks[hook].map(h => {\n const plugin = this.plugins.find(\n p => p.plugin.name === h.plugin.name\n );\n if (!plugin) {\n throw new Error(\n `Could not find plugin context for plugin \"${h.plugin.name}\".`\n );\n }\n\n return {\n handle: h.handler,\n context: plugin.context\n };\n })\n );\n }\n }\n\n return result;\n }\n\n protected constructor(\n config: TResolvedConfig,\n workspaceConfig: WorkspaceConfig\n ) {\n super(workspaceConfig);\n\n this.resolvedConfig = config;\n }\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunkZNPYK23Q_cjs = require('./chunk-ZNPYK23Q.cjs');
4
- var chunkHN76MIOU_cjs = require('./chunk-HN76MIOU.cjs');
3
+ var chunkQ2CL3VW4_cjs = require('./chunk-Q2CL3VW4.cjs');
4
+ var chunkCLLQO726_cjs = require('./chunk-CLLQO726.cjs');
5
5
  var chunk2JR645O3_cjs = require('./chunk-2JR645O3.cjs');
6
6
  var chunkPK6SKIKE_cjs = require('./chunk-PK6SKIKE.cjs');
7
7
  var types = require('@storm-software/config-tools/types');
@@ -64,7 +64,7 @@ function createDefaultEnvironment(userConfig) {
64
64
  chunkPK6SKIKE_cjs.__name(createDefaultEnvironment, "createDefaultEnvironment");
65
65
 
66
66
  // src/lib/contexts/api-context.ts
67
- var PowerlinesAPIContext = class _PowerlinesAPIContext extends chunkHN76MIOU_cjs.PowerlinesContext {
67
+ var PowerlinesAPIContext = class _PowerlinesAPIContext extends chunkCLLQO726_cjs.PowerlinesContext {
68
68
  static {
69
69
  chunkPK6SKIKE_cjs.__name(this, "PowerlinesAPIContext");
70
70
  }
@@ -81,10 +81,11 @@ var PowerlinesAPIContext = class _PowerlinesAPIContext extends chunkHN76MIOU_cjs
81
81
  static async from(workspaceRoot, config) {
82
82
  const context = new _PowerlinesAPIContext(await chunk2JR645O3_cjs.loadWorkspaceConfig(workspaceRoot, config.root));
83
83
  await context.withUserConfig(config);
84
- context.powerlinesPath = await resolve.resolvePackage("powerlines");
85
- if (!context.powerlinesPath) {
84
+ const powerlinesPath = await resolve.resolvePackage("powerlines");
85
+ if (!powerlinesPath) {
86
86
  throw new Error("Could not resolve `powerlines` package location.");
87
87
  }
88
+ context.powerlinesPath = powerlinesPath;
88
89
  return context;
89
90
  }
90
91
  /**
@@ -152,7 +153,7 @@ var PowerlinesAPIContext = class _PowerlinesAPIContext extends chunkHN76MIOU_cjs
152
153
  if (this.environments[environment.name]) {
153
154
  context = this.environments[environment.name];
154
155
  } else {
155
- context = await chunkZNPYK23Q_cjs.PowerlinesEnvironmentContext.fromConfig(this.workspaceConfig, this.config);
156
+ context = await chunkQ2CL3VW4_cjs.PowerlinesEnvironmentContext.fromConfig(this.workspaceConfig, this.config);
156
157
  }
157
158
  if (isSetObject.isSetObject(this.config.inlineConfig)) {
158
159
  await context.withInlineConfig(this.config.inlineConfig);
@@ -235,5 +236,5 @@ var PowerlinesAPIContext = class _PowerlinesAPIContext extends chunkHN76MIOU_cjs
235
236
  };
236
237
 
237
238
  exports.PowerlinesAPIContext = PowerlinesAPIContext;
238
- //# sourceMappingURL=chunk-RYILFB66.cjs.map
239
- //# sourceMappingURL=chunk-RYILFB66.cjs.map
239
+ //# sourceMappingURL=chunk-5KOLVUSY.cjs.map
240
+ //# sourceMappingURL=chunk-5KOLVUSY.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/internal/helpers/environment.ts","../../src/lib/contexts/api-context.ts"],"names":["DEFAULT_ENVIRONMENT","createEnvironment","name","userConfig","defu","environments","title","titleCase","ssr","mainFields","build","platform","extensions","consumer","preview","port","open","strictPort","host","allowedHosts","cors","headers","undefined","createDefaultEnvironment","PowerlinesAPIContext","PowerlinesContext","from","workspaceRoot","config","context","loadWorkspaceConfig","root","withUserConfig","powerlinesPath","resolvePackage","Error","$$internal","value","environment","Object","values","log","createLog","plugins","workspaceConfig","init","Promise","all","toArray","keys","length","map","env","in","PowerlinesEnvironmentContext","fromConfig","isSetObject","inlineConfig","withInlineConfig","plugin","addPlugin","options","isHighPriority","push","getEnvironment","LogLevelLabel","DEBUG","chalk","bold","cyanBright","WARN","getEnvironmentSafe"],"mappings":";;;;;;;;;;;;;;;;;;;AAuBO,IAAMA,mBAAAA,GAAsB,SAAA;AAE5B,SAASC,iBAAAA,CACdC,MACAC,UAAAA,EAA4C;AAE5C,EAAA,OAAOC,sBACLD,UAAAA,CAAWE,YAAAA,GAAeH,IAAAA,CAAAA,IAAS,EAAC,EACpC;AACEA,IAAAA,IAAAA;AACAI,IAAAA,KAAAA,EAAOH,UAAAA,CAAWG,KAAAA,IAASC,mBAAAA,CAAUJ,UAAAA,CAAWD,IAAI,CAAA;IACpDM,GAAAA,EAAK,KAAA;IACLC,UAAAA,EACEN,UAAAA,CAAWO,KAAAA,EAAOC,QAAAA,KAAa,SAAA,GAC3B;AAAC,MAAA,SAAA;AAAW,MAAA,QAAA;AAAU,MAAA,aAAA;AAAe,MAAA;AACrC,KAAA,GAAA;AAAC,MAAA,QAAA;AAAU,MAAA,aAAA;AAAe,MAAA;;IAChCC,UAAAA,EAAY;AAAC,MAAA,MAAA;AAAQ,MAAA,KAAA;AAAO,MAAA,MAAA;AAAQ,MAAA,KAAA;AAAO,MAAA,MAAA;AAAQ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ACT,EAAA;AAEA,EAAA,MAAaiC,mBACXrE,IAAAA,EAC0D;AAC1D,IAAA,IAAI;AACF,MAAA,OAAO,MAAM,IAAA,CAAK8D,cAAAA,CAAe9D,IAAAA,CAAAA;IACnC,CAAA,CAAA,MAAQ;AACN,MAAA,OAAOoB,MAAAA;AACT,IAAA;AACF,EAAA;AACF","file":"chunk-5KOLVUSY.cjs","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 { titleCase } from \"@stryke/string-format/title-case\";\nimport defu from \"defu\";\nimport { APIContext, Context } from \"../../types/context\";\nimport { EnvironmentResolvedConfig } from \"../../types/resolved\";\n\nexport const DEFAULT_ENVIRONMENT = \"default\" as const;\n\nexport function createEnvironment<TContext extends Context = Context>(\n name: string,\n userConfig: TContext[\"config\"][\"userConfig\"]\n): EnvironmentResolvedConfig {\n return defu(\n userConfig.environments?.[name] ?? {},\n {\n name,\n title: userConfig.title || titleCase(userConfig.name),\n ssr: false,\n mainFields:\n userConfig.build?.platform === \"browser\"\n ? [\"browser\", \"module\", \"jsnext:main\", \"jsnext\"]\n : [\"module\", \"jsnext:main\", \"jsnext\"],\n extensions: [\".mjs\", \".js\", \".mts\", \".ts\", \".jsx\", \".tsx\", \".json\"],\n consumer: userConfig.build?.platform === \"browser\" ? \"client\" : \"server\",\n preview:\n userConfig.build?.platform === \"browser\"\n ? {\n port: 5173,\n open: true,\n strictPort: false,\n // https: false,\n host: \"localhost\",\n allowedHosts: [\".\"],\n cors: true,\n headers: {}\n }\n : undefined\n },\n userConfig\n ) as EnvironmentResolvedConfig;\n}\n\nexport function createDefaultEnvironment<\n TContext extends APIContext = APIContext\n>(userConfig: TContext[\"config\"][\"userConfig\"]): EnvironmentResolvedConfig {\n return createEnvironment(DEFAULT_ENVIRONMENT, userConfig);\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 { resolvePackage } from \"@stryke/fs/resolve\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport chalk from \"chalk\";\nimport {\n createDefaultEnvironment,\n createEnvironment\n} from \"../../internal/helpers/environment\";\nimport {\n InitialUserConfig,\n InlineConfig,\n LogFn,\n UserConfig,\n WorkspaceConfig\n} from \"../../types/config\";\nimport {\n APIContext,\n EnvironmentContext,\n InitContextOptions,\n PluginContext\n} from \"../../types/context\";\nimport {\n UNSAFE_ContextInternal,\n UNSAFE_EnvironmentContext\n} from \"../../types/internal\";\nimport { Plugin } from \"../../types/plugin\";\nimport {\n EnvironmentResolvedConfig,\n ResolvedConfig\n} from \"../../types/resolved\";\nimport { loadWorkspaceConfig } from \"../config-file\";\nimport { PowerlinesContext } from \"./context\";\nimport { PowerlinesEnvironmentContext } from \"./environment-context\";\n\nexport class PowerlinesAPIContext<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig\n>\n extends PowerlinesContext<TResolvedConfig>\n implements APIContext<TResolvedConfig>\n{\n #environments: Record<string, UNSAFE_EnvironmentContext<TResolvedConfig>> =\n {};\n\n #plugins: Plugin<PluginContext<TResolvedConfig>>[] = [];\n\n #log!: LogFn;\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 override async from<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig\n >(\n workspaceRoot: string,\n config: InitialUserConfig<TResolvedConfig[\"userConfig\"]>\n ): Promise<APIContext<TResolvedConfig>> {\n const context = new PowerlinesAPIContext<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 * 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 override get $$internal(): UNSAFE_ContextInternal<TResolvedConfig> {\n return super.$$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 override set $$internal(\n value: UNSAFE_ContextInternal<TResolvedConfig>\n ) {\n super.$$internal = value;\n for (const environment of Object.values(this.environments)) {\n environment.$$internal = super.$$internal;\n }\n }\n\n /**\n * A record of all environments by name\n */\n public get environments(): Record<\n string,\n UNSAFE_EnvironmentContext<TResolvedConfig>\n > {\n return this.#environments;\n }\n\n public override get log(): LogFn {\n if (!this.#log) {\n this.#log = this.createLog(\"engine\");\n }\n\n return this.#log;\n }\n\n public get plugins(): Array<Plugin<PluginContext<TResolvedConfig>>> {\n return this.#plugins;\n }\n\n protected constructor(workspaceConfig: WorkspaceConfig) {\n super(workspaceConfig);\n }\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 override async init(\n config: Partial<TResolvedConfig[\"userConfig\"]> = {}\n ) {\n await super.init(config);\n\n await Promise.all(\n toArray(\n this.config.userConfig.environments &&\n Object.keys(this.config.userConfig.environments).length > 0\n ? Object.keys(this.config.userConfig.environments).map(name =>\n createEnvironment(name, this.config.userConfig)\n )\n : createDefaultEnvironment(this.config.userConfig)\n ).map(async env => {\n this.#environments[env.name] = await this.in(env);\n })\n );\n }\n\n /**\n * A function to copy the context and update the fields for a specific environment\n *\n * @param environment - The environment configuration to use.\n * @returns A new context instance with the updated environment.\n */\n public async in(\n environment: EnvironmentResolvedConfig\n ): Promise<UNSAFE_EnvironmentContext<TResolvedConfig>> {\n let context: UNSAFE_EnvironmentContext<TResolvedConfig>;\n if (this.environments[environment.name]) {\n context = this.environments[environment.name] as any;\n } else {\n context = (await PowerlinesEnvironmentContext.fromConfig(\n this.workspaceConfig,\n this.config\n )) as any;\n }\n\n if (isSetObject(this.config.inlineConfig)) {\n await context.withInlineConfig(this.config.inlineConfig);\n }\n\n context.environment = environment;\n context.plugins = [];\n\n for (const plugin of this.plugins) {\n await context.addPlugin(plugin);\n }\n\n return context;\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 override async withUserConfig(\n userConfig: InitialUserConfig<TResolvedConfig[\"userConfig\"]>,\n options: InitContextOptions = {\n isHighPriority: true\n }\n ) {\n await super.withUserConfig(userConfig, options);\n\n await Promise.all(\n Object.keys(this.#environments).map(async name => {\n await this.#environments[name]!.withUserConfig(\n userConfig as UserConfig,\n options\n );\n })\n );\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 override async withInlineConfig(\n inlineConfig: TResolvedConfig[\"inlineConfig\"],\n options: InitContextOptions = {\n isHighPriority: true\n }\n ) {\n await super.withInlineConfig(inlineConfig, options);\n\n await Promise.all(\n Object.keys(this.#environments).map(async name => {\n await this.#environments[name]!.withInlineConfig(\n inlineConfig as InlineConfig,\n options\n );\n })\n );\n }\n\n /**\n * Add a plugin to the API context and all environments\n *\n * @param plugin - The plugin to add.\n */\n public async addPlugin(plugin: Plugin<PluginContext<TResolvedConfig>>) {\n this.plugins.push(plugin);\n\n await Promise.all(\n Object.keys(this.environments).map(async name => {\n await this.environments[name]!.addPlugin(plugin);\n })\n );\n }\n\n /**\n * Get an environment by name, or the default environment if no name is provided\n *\n * @param name - The name of the environment to retrieve.\n * @returns The requested environment context.\n */\n public async getEnvironment(name?: string) {\n let environment: EnvironmentContext<TResolvedConfig> | undefined;\n if (name) {\n environment = this.environments[name];\n }\n\n if (Object.keys(this.environments).length === 1) {\n environment = this.environments[Object.keys(this.environments)[0]!];\n\n this.log(\n LogLevelLabel.DEBUG,\n `Applying the only configured environment: ${chalk.bold.cyanBright(\n environment?.environment.name\n )}`\n );\n }\n\n if (!environment) {\n if (name) {\n throw new Error(`Environment \"${name}\" not found.`);\n }\n\n environment = await this.in(\n createDefaultEnvironment(this.config.userConfig)\n );\n\n this.log(\n LogLevelLabel.WARN,\n `No environment specified, and no default environment found. Using a temporary default environment: ${chalk.bold.cyanBright(\n environment?.environment.name\n )}`\n );\n }\n\n return environment;\n }\n\n public async getEnvironmentSafe(\n name?: string\n ): Promise<EnvironmentContext<TResolvedConfig> | undefined> {\n try {\n return await this.getEnvironment(name);\n } catch {\n return undefined;\n }\n }\n}\n"]}
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
3
  var chunkMFC7UJHT_cjs = require('./chunk-MFC7UJHT.cjs');
4
- var chunkRYILFB66_cjs = require('./chunk-RYILFB66.cjs');
5
- var chunkHN76MIOU_cjs = require('./chunk-HN76MIOU.cjs');
4
+ var chunk5KOLVUSY_cjs = require('./chunk-5KOLVUSY.cjs');
5
+ var chunkCLLQO726_cjs = require('./chunk-CLLQO726.cjs');
6
6
  var chunkBJGMF356_cjs = require('./chunk-BJGMF356.cjs');
7
7
  var chunkZWLSNYIN_cjs = require('./chunk-ZWLSNYIN.cjs');
8
8
  var chunkQHTL2U3L_cjs = require('./chunk-QHTL2U3L.cjs');
@@ -494,7 +494,7 @@ var PowerlinesAPI = class _PowerlinesAPI {
494
494
  * @returns A new instance of the Powerlines API
495
495
  */
496
496
  static async from(workspaceRoot, config) {
497
- const api = new _PowerlinesAPI(await chunkRYILFB66_cjs.PowerlinesAPIContext.from(workspaceRoot, config));
497
+ const api = new _PowerlinesAPI(await chunk5KOLVUSY_cjs.PowerlinesAPIContext.from(workspaceRoot, config));
498
498
  api.#context.$$internal = {
499
499
  api,
500
500
  addPlugin: api.#addPlugin.bind(api)
@@ -998,11 +998,11 @@ ${formatTypes(types$1)}
998
998
  if (isPromise.isPromiseLike(config)) {
999
999
  awaited = await Promise.resolve(config);
1000
1000
  }
1001
- if (!chunkHN76MIOU_cjs.isPluginConfig(awaited)) {
1001
+ if (!chunkCLLQO726_cjs.isPluginConfig(awaited)) {
1002
1002
  throw new Error(`Invalid plugin specified in the configuration - ${JSON.stringify(awaited)}. Please ensure the value is a plugin name, an object with the \`plugin\` and \`props\` properties, or an instance of \`Plugin\`.`);
1003
1003
  }
1004
1004
  let plugin;
1005
- if (chunkHN76MIOU_cjs.isPlugin(awaited)) {
1005
+ if (chunkCLLQO726_cjs.isPlugin(awaited)) {
1006
1006
  plugin = awaited;
1007
1007
  } else if (isFunction.isFunction(awaited)) {
1008
1008
  plugin = await Promise.resolve(awaited());
@@ -1013,10 +1013,10 @@ ${formatTypes(types$1)}
1013
1013
  } else {
1014
1014
  plugin = resolved;
1015
1015
  }
1016
- } else if (chunkHN76MIOU_cjs.isPluginConfigTuple(awaited) || chunkHN76MIOU_cjs.isPluginConfigObject(awaited)) {
1016
+ } else if (chunkCLLQO726_cjs.isPluginConfigTuple(awaited) || chunkCLLQO726_cjs.isPluginConfigObject(awaited)) {
1017
1017
  let pluginConfig;
1018
1018
  let pluginOptions;
1019
- if (chunkHN76MIOU_cjs.isPluginConfigTuple(awaited)) {
1019
+ if (chunkCLLQO726_cjs.isPluginConfigTuple(awaited)) {
1020
1020
  pluginConfig = awaited[0];
1021
1021
  pluginOptions = awaited?.length === 2 ? awaited[1] : void 0;
1022
1022
  } else {
@@ -1032,17 +1032,17 @@ ${formatTypes(types$1)}
1032
1032
  }
1033
1033
  } else if (isFunction.isFunction(pluginConfig)) {
1034
1034
  plugin = await Promise.resolve(pluginConfig(pluginOptions));
1035
- } else if (chunkHN76MIOU_cjs.isPlugin(pluginConfig)) {
1035
+ } else if (chunkCLLQO726_cjs.isPlugin(pluginConfig)) {
1036
1036
  plugin = pluginConfig;
1037
1037
  }
1038
1038
  }
1039
1039
  if (!plugin) {
1040
1040
  throw new Error(`The plugin configuration ${JSON.stringify(awaited)} is invalid. This configuration must point to a valid Powerlines plugin module.`);
1041
1041
  }
1042
- if (!chunkHN76MIOU_cjs.isPlugin(plugin)) {
1042
+ if (!chunkCLLQO726_cjs.isPlugin(plugin)) {
1043
1043
  throw new Error(`The plugin option ${JSON.stringify(plugin)} does not export a valid module. This configuration must point to a valid Powerlines plugin module.`);
1044
1044
  }
1045
- if (chunkHN76MIOU_cjs.checkDedupe(plugin, this.context.plugins)) {
1045
+ if (chunkCLLQO726_cjs.checkDedupe(plugin, this.context.plugins)) {
1046
1046
  this.context.log(types.LogLevelLabel.TRACE, `Duplicate ${chalk3__default.default.bold.cyanBright(plugin.name)} plugin dependency detected - Skipping initialization.`);
1047
1047
  return null;
1048
1048
  }
@@ -1206,5 +1206,5 @@ function createUnpluginFactory(variant, decorate) {
1206
1206
  chunkPK6SKIKE_cjs.__name(createUnpluginFactory, "createUnpluginFactory");
1207
1207
 
1208
1208
  exports.createUnpluginFactory = createUnpluginFactory;
1209
- //# sourceMappingURL=chunk-NMTYZRD3.cjs.map
1210
- //# sourceMappingURL=chunk-NMTYZRD3.cjs.map
1209
+ //# sourceMappingURL=chunk-75KYTRYW.cjs.map
1210
+ //# sourceMappingURL=chunk-75KYTRYW.cjs.map