powerlines 0.32.4 → 0.32.5

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 (187) 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-FAOLKFD2.js → chunk-3GZU4SPQ.js} +3 -3
  6. package/dist/{chunk-AEVMMV5Q.js → chunk-3NTTPLMW.js} +3 -3
  7. package/dist/{chunk-N7P2IONI.js → chunk-4KKX5LNV.js} +3 -3
  8. package/dist/{chunk-VZRETTWT.js → chunk-5CY74P7U.js} +3 -3
  9. package/dist/{chunk-AQMQG5DF.js → chunk-625S4UKQ.js} +3 -3
  10. package/dist/{chunk-IXE2F3G5.cjs → chunk-DOYOK4T3.cjs} +4 -4
  11. package/dist/{chunk-OYTZWXKX.cjs → chunk-FP5YRXGK.cjs} +5 -5
  12. package/dist/chunk-H36RWDOY.cjs +12 -0
  13. package/dist/{chunk-Y5NRBOMB.cjs → chunk-IMJGHS2X.cjs} +3 -3
  14. package/dist/{chunk-G3ENUWLR.js → chunk-MZFO4PJU.js} +3 -3
  15. package/dist/{chunk-XZAMDOCQ.cjs → chunk-O2IA36W5.cjs} +4 -4
  16. package/dist/chunk-VKIT7IGF.cjs +12 -0
  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 +10 -10
  22. package/dist/index.js +2 -2
  23. package/dist/lib/{api-C_DKTl1L.d.cts → api-CHM8_t1f.d.cts} +1 -1
  24. package/dist/lib/{api-Ba9sdSHp.d.ts → api-zlk8r_Vv.d.ts} +1 -1
  25. package/dist/lib/build/esbuild.d.cts +1 -1
  26. package/dist/lib/build/esbuild.d.ts +1 -1
  27. package/dist/lib/build/index.cjs +41 -41
  28. package/dist/lib/build/index.d.cts +3 -3
  29. package/dist/lib/build/index.d.ts +3 -3
  30. package/dist/lib/build/index.js +5 -5
  31. package/dist/lib/build/rolldown.d.cts +1 -1
  32. package/dist/lib/build/rolldown.d.ts +1 -1
  33. package/dist/lib/build/rollup.d.cts +1 -1
  34. package/dist/lib/build/rollup.d.ts +1 -1
  35. package/dist/lib/build/rspack.d.cts +1 -1
  36. package/dist/lib/build/rspack.d.ts +1 -1
  37. package/dist/lib/build/tsdown.d.cts +1 -1
  38. package/dist/lib/build/tsdown.d.ts +1 -1
  39. package/dist/lib/build/tsup.d.cts +1 -1
  40. package/dist/lib/build/tsup.d.ts +1 -1
  41. package/dist/lib/build/unbuild.cjs +5 -5
  42. package/dist/lib/build/unbuild.d.cts +3 -3
  43. package/dist/lib/build/unbuild.d.ts +3 -3
  44. package/dist/lib/build/unbuild.js +2 -2
  45. package/dist/lib/build/vite.d.cts +1 -1
  46. package/dist/lib/build/vite.d.ts +1 -1
  47. package/dist/lib/build/webpack.d.cts +1 -1
  48. package/dist/lib/build/webpack.d.ts +1 -1
  49. package/dist/lib/{chunk-L2YWHUAK.cjs → chunk-226JA2S2.cjs} +7 -7
  50. package/dist/lib/chunk-226JA2S2.cjs.map +1 -0
  51. package/dist/lib/{chunk-C7RFYGJU.cjs → chunk-2LOGLF4O.cjs} +6 -6
  52. package/dist/lib/{chunk-C7RFYGJU.cjs.map → chunk-2LOGLF4O.cjs.map} +1 -1
  53. package/dist/lib/{chunk-BBPOAO6N.cjs → chunk-3DKBH67A.cjs} +3 -3
  54. package/dist/lib/{chunk-BBPOAO6N.cjs.map → chunk-3DKBH67A.cjs.map} +1 -1
  55. package/dist/lib/{chunk-3XVN4LJM.js → chunk-6JWWNHPO.js} +3 -3
  56. package/dist/lib/{chunk-3XVN4LJM.js.map → chunk-6JWWNHPO.js.map} +1 -1
  57. package/dist/lib/{chunk-QGVTYA6Q.js → chunk-B47EITCS.js} +5 -5
  58. package/dist/lib/chunk-B47EITCS.js.map +1 -0
  59. package/dist/lib/{chunk-3V6R4FID.cjs → chunk-BQA4H72F.cjs} +3 -3
  60. package/dist/lib/{chunk-3V6R4FID.cjs.map → chunk-BQA4H72F.cjs.map} +1 -1
  61. package/dist/lib/{chunk-2GK7DF43.js → chunk-NXUMUI2Z.js} +3 -3
  62. package/dist/lib/{chunk-2GK7DF43.js.map → chunk-NXUMUI2Z.js.map} +1 -1
  63. package/dist/lib/{chunk-VC4NHIUK.js → chunk-ODABNDH5.js} +5 -5
  64. package/dist/lib/{chunk-VC4NHIUK.js.map → chunk-ODABNDH5.js.map} +1 -1
  65. package/dist/lib/{chunk-FD2ICC5D.js → chunk-QXVCN3KD.js} +4 -4
  66. package/dist/lib/{chunk-FD2ICC5D.js.map → chunk-QXVCN3KD.js.map} +1 -1
  67. package/dist/lib/{chunk-TI73ZL3J.cjs → chunk-S3KSMITS.cjs} +13 -13
  68. package/dist/lib/{chunk-TI73ZL3J.cjs.map → chunk-S3KSMITS.cjs.map} +1 -1
  69. package/dist/lib/{chunk-T3QTDDY3.js → chunk-SUABYS33.js} +3 -3
  70. package/dist/lib/{chunk-T3QTDDY3.js.map → chunk-SUABYS33.js.map} +1 -1
  71. package/dist/lib/{chunk-5C6XG7BZ.cjs → chunk-TLYEKWQW.cjs} +13 -13
  72. package/dist/lib/{chunk-5C6XG7BZ.cjs.map → chunk-TLYEKWQW.cjs.map} +1 -1
  73. package/dist/lib/{chunk-5TY5HZTE.cjs → chunk-UWOD2XLX.cjs} +3 -3
  74. package/dist/lib/{chunk-5TY5HZTE.cjs.map → chunk-UWOD2XLX.cjs.map} +1 -1
  75. package/dist/lib/{chunk-UNGOTRTI.js → chunk-ZVZFMMNL.js} +3 -3
  76. package/dist/lib/{chunk-UNGOTRTI.js.map → chunk-ZVZFMMNL.js.map} +1 -1
  77. package/dist/lib/{config-CYk8x41J.d.ts → config-Bkk5oOVc.d.ts} +1 -1
  78. package/dist/lib/{config-IpikCRbv.d.cts → config-C74fZ7Hm.d.cts} +1 -1
  79. package/dist/lib/config-file.d.cts +1 -1
  80. package/dist/lib/config-file.d.ts +1 -1
  81. package/dist/lib/contexts/api-context.cjs +6 -6
  82. package/dist/lib/contexts/api-context.d.cts +3 -3
  83. package/dist/lib/contexts/api-context.d.ts +3 -3
  84. package/dist/lib/contexts/api-context.js +5 -5
  85. package/dist/lib/contexts/context.cjs +4 -4
  86. package/dist/lib/contexts/context.d.cts +3 -3
  87. package/dist/lib/contexts/context.d.ts +3 -3
  88. package/dist/lib/contexts/context.js +3 -3
  89. package/dist/lib/contexts/environment-context.cjs +5 -5
  90. package/dist/lib/contexts/environment-context.d.cts +3 -3
  91. package/dist/lib/contexts/environment-context.d.ts +3 -3
  92. package/dist/lib/contexts/environment-context.js +4 -4
  93. package/dist/lib/contexts/index.cjs +8 -8
  94. package/dist/lib/contexts/index.d.cts +3 -3
  95. package/dist/lib/contexts/index.d.ts +3 -3
  96. package/dist/lib/contexts/index.js +5 -5
  97. package/dist/lib/contexts/plugin-context.d.cts +3 -3
  98. package/dist/lib/contexts/plugin-context.d.ts +3 -3
  99. package/dist/lib/entry.d.cts +1 -1
  100. package/dist/lib/entry.d.ts +1 -1
  101. package/dist/lib/fs/index.cjs +3 -3
  102. package/dist/lib/fs/index.d.cts +1 -1
  103. package/dist/lib/fs/index.d.ts +1 -1
  104. package/dist/lib/fs/index.js +2 -2
  105. package/dist/lib/fs/vfs.cjs +3 -3
  106. package/dist/lib/fs/vfs.d.cts +1 -1
  107. package/dist/lib/fs/vfs.d.ts +1 -1
  108. package/dist/lib/fs/vfs.js +2 -2
  109. package/dist/lib/index.cjs +36 -36
  110. package/dist/lib/index.d.cts +4 -4
  111. package/dist/lib/index.d.ts +4 -4
  112. package/dist/lib/index.js +10 -10
  113. package/dist/lib/{internal-soTsMh9I.d.ts → internal-DA1f6c7h.d.ts} +3 -3
  114. package/dist/lib/{internal-8JoxqV4x.d.cts → internal-Z9V60LMp.d.cts} +3 -3
  115. package/dist/lib/logger.d.cts +1 -1
  116. package/dist/lib/logger.d.ts +1 -1
  117. package/dist/lib/typescript/import-transformer.d.cts +1 -1
  118. package/dist/lib/typescript/import-transformer.d.ts +1 -1
  119. package/dist/lib/typescript/index.d.cts +1 -1
  120. package/dist/lib/typescript/index.d.ts +1 -1
  121. package/dist/lib/typescript/ts-morph.d.cts +1 -1
  122. package/dist/lib/typescript/ts-morph.d.ts +1 -1
  123. package/dist/lib/unplugin/factory.cjs +8 -8
  124. package/dist/lib/unplugin/factory.d.cts +3 -3
  125. package/dist/lib/unplugin/factory.d.ts +3 -3
  126. package/dist/lib/unplugin/factory.js +7 -7
  127. package/dist/lib/unplugin/helpers.d.cts +1 -1
  128. package/dist/lib/unplugin/helpers.d.ts +1 -1
  129. package/dist/lib/unplugin/index.cjs +10 -10
  130. package/dist/lib/unplugin/index.d.cts +3 -3
  131. package/dist/lib/unplugin/index.d.ts +3 -3
  132. package/dist/lib/unplugin/index.js +8 -8
  133. package/dist/lib/unplugin/plugin.cjs +3 -3
  134. package/dist/lib/unplugin/plugin.d.cts +3 -3
  135. package/dist/lib/unplugin/plugin.d.ts +3 -3
  136. package/dist/lib/unplugin/plugin.js +2 -2
  137. package/dist/lib/{unplugin-BO_eR3VL.d.cts → unplugin--Wb_ttDq.d.cts} +2 -2
  138. package/dist/lib/{unplugin-CArTJnBs.d.ts → unplugin-_FT__-JQ.d.ts} +2 -2
  139. package/dist/lib/utilities/bundle.d.cts +1 -1
  140. package/dist/lib/utilities/bundle.d.ts +1 -1
  141. package/dist/lib/utilities/cache.d.cts +1 -1
  142. package/dist/lib/utilities/cache.d.ts +1 -1
  143. package/dist/lib/utilities/file-header.d.cts +1 -1
  144. package/dist/lib/utilities/file-header.d.ts +1 -1
  145. package/dist/lib/utilities/index.cjs +14 -14
  146. package/dist/lib/utilities/index.d.cts +1 -1
  147. package/dist/lib/utilities/index.d.ts +1 -1
  148. package/dist/lib/utilities/index.js +2 -2
  149. package/dist/lib/utilities/meta.d.cts +1 -1
  150. package/dist/lib/utilities/meta.d.ts +1 -1
  151. package/dist/lib/utilities/resolve.d.cts +1 -1
  152. package/dist/lib/utilities/resolve.d.ts +1 -1
  153. package/dist/lib/utilities/source-file.d.cts +1 -1
  154. package/dist/lib/utilities/source-file.d.ts +1 -1
  155. package/dist/lib/utilities/source-map.d.cts +1 -1
  156. package/dist/lib/utilities/source-map.d.ts +1 -1
  157. package/dist/lib/utilities/worker.d.cts +1 -1
  158. package/dist/lib/utilities/worker.d.ts +1 -1
  159. package/dist/lib/utilities/write-file.d.cts +1 -1
  160. package/dist/lib/utilities/write-file.d.ts +1 -1
  161. package/dist/next.cjs +4 -4
  162. package/dist/next.js +3 -3
  163. package/dist/nuxt.cjs +7 -7
  164. package/dist/nuxt.js +5 -5
  165. package/dist/rolldown.cjs +6 -6
  166. package/dist/rolldown.js +3 -3
  167. package/dist/rollup.cjs +3 -3
  168. package/dist/rollup.js +2 -2
  169. package/dist/rspack.cjs +3 -3
  170. package/dist/rspack.js +2 -2
  171. package/dist/tsdown.cjs +4 -4
  172. package/dist/tsdown.js +3 -3
  173. package/dist/tsup.cjs +4 -4
  174. package/dist/tsup.js +3 -3
  175. package/dist/unloader.cjs +3 -3
  176. package/dist/unloader.js +2 -2
  177. package/dist/unplugin.cjs +5 -5
  178. package/dist/unplugin.js +3 -3
  179. package/dist/vite.cjs +6 -6
  180. package/dist/vite.js +3 -3
  181. package/dist/webpack.cjs +6 -6
  182. package/dist/webpack.js +3 -3
  183. package/package.json +2 -2
  184. package/dist/chunk-FD4NFWGH.cjs +0 -12
  185. package/dist/chunk-WN3WRPDE.cjs +0 -12
  186. package/dist/lib/chunk-L2YWHUAK.cjs.map +0 -1
  187. package/dist/lib/chunk-QGVTYA6Q.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/internal/helpers/environment.ts","../../src/lib/contexts/api-context.ts"],"names":["DEFAULT_ENVIRONMENT","GLOBAL_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","toEnvironment"],"mappings":";;;;;;;;;;;;;;;;;;;AAuBO,IAAMA,mBAAAA,GAAsB,aAAA;AAC5B,IAAMC,kBAAAA,GAAqB,YAAA;AAE3B,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,MAAA,MAAA;AAAQ,MAAA;;AAC3DC,IAAAA,QAAAA,EAAUV,UAAAA,CAAWO,KAAAA,EAAOC,QAAAA,KAAa,SAAA,GAAY,QAAA,GAAW,QAAA;IAChEG,OAAAA,EACEX,UAAAA,CAAWO,KAAAA,EAAOC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AAA,OAAOoB,MAAAA;AACT,IAAA;AACF,EAAA;;;;;;;;;AAUA,EAAA,MAAakD,aAAAA,GAA8D;AACzE,IAAA,IAAIlC,WAAAA;AACJ,IAAA,IAAIC,OAAOU,IAAAA,CAAK,IAAA,CAAK5C,YAAY,CAAA,CAAE6C,SAAS,CAAA,EAAG;AAC7CZ,MAAAA,WAAAA,GAAc,MAAM,KAAKe,EAAAA,CACvBpD,iBAAAA,CAAkBD,oBAAoB,IAAA,CAAK4B,MAAAA,CAAOzB,UAAU,CAAA,CAAA;AAG9D,MAAA,IAAA,CAAKsC,GAAAA,CACHwB,mBAAAA,CAAcC,KAAAA,EACd,CAAA,aAAA,EAAgB3B,MAAAA,CAAOU,KAAK,IAAA,CAAK5C,YAAY,CAAA,CAAE6C,MAAM,CAAA,2CAAA,CAA6C,CAAA;IAEtG,CAAA,MAAO;AACLZ,MAAAA,WAAAA,GAAc,MAAM,KAAK0B,cAAAA,EAAc;AACzC,IAAA;AAEA,IAAA,OAAO1B,WAAAA;AACT,EAAA;AACF","file":"chunk-C7RFYGJU.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;\nexport const GLOBAL_ENVIRONMENT = \"__GLOBAL__\" 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 GLOBAL_ENVIRONMENT\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 /**\n * A safe version of `getEnvironment` that returns `undefined` if the environment is not found\n *\n * @param name - The name of the environment to retrieve.\n * @returns The requested environment context or `undefined` if not found.\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 /**\n * A function to merge all configured environments into a single context.\n *\n * @remarks\n * If only one environment is configured, that environment will be returned directly.\n *\n * @returns A promise that resolves to a merged/global environment context.\n */\n public async toEnvironment(): Promise<EnvironmentContext<TResolvedConfig>> {\n let environment: EnvironmentContext<TResolvedConfig>;\n if (Object.keys(this.environments).length > 1) {\n environment = await this.in(\n createEnvironment(GLOBAL_ENVIRONMENT, this.config.userConfig)\n );\n\n this.log(\n LogLevelLabel.DEBUG,\n `Combined all ${Object.keys(this.environments).length} environments into a single global context.`\n );\n } else {\n environment = await this.getEnvironment();\n }\n\n return environment;\n }\n}\n"]}
1
+ {"version":3,"sources":["../../src/internal/helpers/environment.ts","../../src/lib/contexts/api-context.ts"],"names":["DEFAULT_ENVIRONMENT","GLOBAL_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","toEnvironment"],"mappings":";;;;;;;;;;;;;;;;;;;AAuBO,IAAMA,mBAAAA,GAAsB,aAAA;AAC5B,IAAMC,kBAAAA,GAAqB,YAAA;AAE3B,SAASC,iBAAAA,CACdC,MACAC,UAA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6C,MAAM,CAAA,2CAAA,CAA6C,CAAA;IAEtG,CAAA,MAAO;AACLZ,MAAAA,WAAAA,GAAc,MAAM,KAAK0B,cAAAA,EAAc;AACzC,IAAA;AAEA,IAAA,OAAO1B,WAAAA;AACT,EAAA;AACF","file":"chunk-2LOGLF4O.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;\nexport const GLOBAL_ENVIRONMENT = \"__GLOBAL__\" 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 GLOBAL_ENVIRONMENT\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 /**\n * A safe version of `getEnvironment` that returns `undefined` if the environment is not found\n *\n * @param name - The name of the environment to retrieve.\n * @returns The requested environment context or `undefined` if not found.\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 /**\n * A function to merge all configured environments into a single context.\n *\n * @remarks\n * If only one environment is configured, that environment will be returned directly.\n *\n * @returns A promise that resolves to a merged/global environment context.\n */\n public async toEnvironment(): Promise<EnvironmentContext<TResolvedConfig>> {\n let environment: EnvironmentContext<TResolvedConfig>;\n if (Object.keys(this.environments).length > 1) {\n environment = await this.in(\n createEnvironment(GLOBAL_ENVIRONMENT, this.config.userConfig)\n );\n\n this.log(\n LogLevelLabel.DEBUG,\n `Combined all ${Object.keys(this.environments).length} environments into a single global context.`\n );\n } else {\n environment = await this.getEnvironment();\n }\n\n return environment;\n }\n}\n"]}
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
3
  var chunkA4RSMLXW_cjs = require('./chunk-A4RSMLXW.cjs');
4
- var chunkOXOTWH3L_cjs = require('./chunk-OXOTWH3L.cjs');
5
4
  var chunk632PWWU7_cjs = require('./chunk-632PWWU7.cjs');
5
+ var chunkOXOTWH3L_cjs = require('./chunk-OXOTWH3L.cjs');
6
6
  var chunkPK6SKIKE_cjs = require('./chunk-PK6SKIKE.cjs');
7
7
  var types = require('@storm-software/config-tools/types');
8
8
  var filePathFns = require('@stryke/path/file-path-fns');
@@ -168,5 +168,5 @@ export * from "${isString.isString(resolved) ? resolved : resolved.id}";
168
168
  chunkPK6SKIKE_cjs.__name(createUnplugin, "createUnplugin");
169
169
 
170
170
  exports.createUnplugin = createUnplugin;
171
- //# sourceMappingURL=chunk-BBPOAO6N.cjs.map
172
- //# sourceMappingURL=chunk-BBPOAO6N.cjs.map
171
+ //# sourceMappingURL=chunk-3DKBH67A.cjs.map
172
+ //# sourceMappingURL=chunk-3DKBH67A.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/lib/unplugin/plugin.ts"],"names":["createUnplugin","context","ctx","setParseImpl","parse","log","extendLog","LogLevelLabel","DEBUG","buildStart","$$internal","callHook","sequential","resolveId","id","importer","opts","isEntry","resolved","result","order","resolve","config","build","polyfill","length","entry","find","file","isString","replaceExtension","output","replace","findFileName","withExtension","emitEntry","map","p","join","load","transform","code","transformed","handler","environment","selectHooks","handle","apply","combineContexts","getString","buildEnd","writeBundle","name","api","filter","include","vite","sharedDuringBuild","error","FATAL","message"],"mappings":";;;;;;;;;;;;AA2CO,SAASA,eACdC,OAAAA,EAAiB;AAEjB,EAAA,MAAMC,GAAAA,GAAMD,OAAAA;AACZE,EAAAA,qBAAAA,CAAaD,IAAIE,KAAK,CAAA;AAEtB,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ANeuC,MAAAA,wBAAAA,CAAAA,WAAAA,EAAAA,aAAAA,CAAAA;AAQf,MAAA,OAAO;QACLC,IAAAA,EAAM,YAAA;AACNC,QAAAA,GAAAA,EAAKnD,IAAIQ,UAAAA,CAAW2C,GAAAA;QACpBxC,SAAAA,EAAW;UACTyC,MAAAA,EAAQ;YACNxC,EAAAA,EAAI;cACFyC,OAAAA,EAAS;AAAC,gBAAA;;AACZ;AACF,WAAA;UACAZ,OAAAA,EAAS9B;AACX,SAAA;QACA0B,IAAAA,EAAM;UACJe,MAAAA,EAAQ;YACNxC,EAAAA,EAAI;cACFyC,OAAAA,EAAS;AAAC,gBAAA;;AACZ;AACF,WAAA;UACAZ,OAAAA,EAASJ;AACX,SAAA;AACAC,QAAAA,SAAAA;AACA/B,QAAAA,UAAAA;AACAyC,QAAAA,QAAAA;AACAC,QAAAA,WAAAA;QACAK,IAAAA,EAAM;UACJC,iBAAAA,EAAmB;AACrB;AACF,OAAA;AACF,IAAA,CAAA,CAAA,OAASC,KAAAA,EAAO;AACdrD,MAAAA,GAAAA,CAAIE,mBAAAA,CAAcoD,KAAAA,EAAQD,KAAAA,EAAiBE,OAAAA,CAAAA;AAE3C,MAAA,MAAMF,KAAAA;AACR,IAAA;AACF,EAAA,CAAA;AACF;AAlOgB1D,wBAAAA,CAAAA,cAAAA,EAAAA,gBAAAA,CAAAA","file":"chunk-BBPOAO6N.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 { LogLevelLabel } from \"@storm-software/config-tools/types\";\nimport { findFileName } from \"@stryke/path/file-path-fns\";\nimport { replaceExtension } from \"@stryke/path/replace\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport type {\n ExternalIdResult,\n TransformResult,\n UnpluginBuildContext,\n UnpluginContext\n} from \"unplugin\";\nimport { setParseImpl } from \"unplugin\";\nimport { UnpluginBuildVariant } from \"../../types/build\";\nimport { PluginContext } from \"../../types/context\";\nimport { UNSAFE_PluginContext } from \"../../types/internal\";\nimport { PowerlinesUnpluginFactory } from \"../../types/unplugin\";\nimport { extendLog } from \"../logger\";\nimport { getString } from \"../utilities/source-file\";\nimport { combineContexts } from \"./helpers\";\n\n/**\n * Creates a Powerlines unplugin instance.\n *\n * @param context - The plugin context.\n * @returns The unplugin instance.\n */\nexport function createUnplugin<TContext extends PluginContext = PluginContext>(\n context: TContext\n): PowerlinesUnpluginFactory<UnpluginBuildVariant> {\n const ctx = context as unknown as UNSAFE_PluginContext;\n setParseImpl(ctx.parse);\n\n return () => {\n const log = extendLog(ctx.log, \"unplugin\");\n log(LogLevelLabel.DEBUG, \"Initializing Unplugin\");\n\n try {\n async function buildStart(this: UnpluginBuildContext) {\n log(LogLevelLabel.DEBUG, \"Powerlines build plugin starting...\");\n\n await ctx.$$internal.callHook(\"buildStart\", {\n sequential: true\n });\n }\n\n async function resolveId(\n this: UnpluginBuildContext & UnpluginContext,\n id: string,\n importer?: string,\n opts: {\n isEntry: boolean;\n } = { isEntry: false }\n ): Promise<string | ExternalIdResult | null | undefined> {\n const resolved = await (async () => {\n let result = await ctx.$$internal.callHook(\n \"resolveId\",\n {\n sequential: true,\n result: \"first\",\n order: \"pre\"\n },\n id,\n importer,\n opts\n );\n if (result) {\n return result;\n }\n\n result = await ctx.$$internal.callHook(\n \"resolveId\",\n {\n sequential: true,\n result: \"first\",\n order: \"normal\"\n },\n id,\n importer,\n opts\n );\n if (result) {\n return result;\n }\n\n result = await ctx.resolve(id, importer, opts);\n if (result) {\n return result;\n }\n\n return ctx.$$internal.callHook(\n \"resolveId\",\n {\n sequential: true,\n result: \"first\",\n order: \"post\"\n },\n id,\n importer,\n opts\n );\n })();\n if (\n resolved &&\n opts.isEntry &&\n ctx.config.build.polyfill &&\n ctx.config.build.polyfill.length > 0\n ) {\n const entry = ctx.entry.find(\n entry =>\n entry.file === (isString(resolved) ? resolved : resolved.id)\n );\n if (entry) {\n entry.file = `${replaceExtension(isString(resolved) ? resolved : resolved.id)}-polyfill.ts`;\n entry.output ||= entry.output?.replace(\n findFileName(entry.output, { withExtension: true }),\n entry.file\n );\n\n await ctx.emitEntry(\n `\n${ctx.config.build.polyfill.map(p => `import \"${p}\";`).join(\"\\n\")}\n\nexport * from \"${isString(resolved) ? resolved : resolved.id}\";\n`,\n entry.file\n );\n\n return entry.file;\n }\n }\n\n return resolved;\n }\n\n async function load(\n this: UnpluginBuildContext & UnpluginContext,\n id: string\n ): Promise<TransformResult | null | undefined> {\n let result = await ctx.$$internal.callHook(\n \"load\",\n {\n sequential: true,\n result: \"first\",\n order: \"pre\"\n },\n id\n );\n if (result) {\n return result;\n }\n\n result = await ctx.$$internal.callHook(\n \"load\",\n {\n sequential: true,\n result: \"first\",\n order: \"normal\"\n },\n id\n );\n if (result) {\n return result;\n }\n\n result = await ctx.load(id);\n if (result) {\n return result;\n }\n\n return ctx.$$internal.callHook(\n \"load\",\n {\n sequential: true,\n result: \"first\",\n order: \"post\"\n },\n id\n );\n }\n\n async function transform(\n this: UnpluginBuildContext & UnpluginContext,\n code: string,\n id: string\n ): Promise<TransformResult | null | undefined> {\n let transformed: TransformResult | string = code;\n\n for (const handler of ctx.$$internal.environment.selectHooks(\n \"transform\"\n )) {\n const result: TransformResult | string | undefined =\n await handler.handle.apply(combineContexts(ctx, this), [\n getString(transformed),\n id\n ]);\n if (result) {\n transformed = result;\n }\n }\n\n return transformed;\n }\n\n async function buildEnd(this: UnpluginBuildContext): Promise<void> {\n log(LogLevelLabel.DEBUG, \"Powerlines build plugin finishing...\");\n\n return ctx.$$internal.callHook(\"buildEnd\", {\n sequential: true\n });\n }\n\n async function writeBundle(): Promise<void> {\n log(LogLevelLabel.DEBUG, \"Finalizing Powerlines project output...\");\n\n return ctx.$$internal.callHook(\"writeBundle\", {\n sequential: true\n });\n }\n\n return {\n name: \"powerlines\",\n api: ctx.$$internal.api,\n resolveId: {\n filter: {\n id: {\n include: [/.*/]\n }\n },\n handler: resolveId\n },\n load: {\n filter: {\n id: {\n include: [/.*/]\n }\n },\n handler: load\n },\n transform,\n buildStart,\n buildEnd,\n writeBundle,\n vite: {\n sharedDuringBuild: true\n }\n };\n } catch (error) {\n log(LogLevelLabel.FATAL, (error as Error)?.message);\n\n throw error;\n }\n };\n}\n"]}
1
+ {"version":3,"sources":["../../src/lib/unplugin/plugin.ts"],"names":["createUnplugin","context","ctx","setParseImpl","parse","log","extendLog","LogLevelLabel","DEBUG","buildStart","$$internal","callHook","sequential","resolveId","id","importer","opts","isEntry","resolved","result","order","resolve","config","build","polyfill","length","entry","find","file","isString","replaceExtension","output","replace","findFileName","withExtension","emitEntry","map","p","join","load","transform","code","transformed","handler","environment","selectHooks","handle","apply","combineContexts","getString","buildEnd","writeBundle","name","api","filter","include","vite","sharedDuringBuild","error","FATAL","message"],"mappings":";;;;;;;;;;;;AA2CO,SAASA,eACdC,OAAAA,EAAiB;AAEjB,EAAA,MAAMC,GAAAA,GAAMD,OAAAA;AACZE,EAAAA,qBAAAA,CAAaD,IAAIE,KAAK,CAAA;AAEtB,EAAA,OAAO,MAAA;AACL,IAAA,MAAMC,GAAAA,GAAMC,2BAAAA,CAAUJ,GAAAA,CAAIG,GAAAA,EAAK,UAAA,CAAA;AAC/BA,IAAAA,GAAAA,CAAIE,mBAAAA,CAAcC,OAAO,uBAAA,CAAA;AAEzB,IAAA,IAAI;AACF,MAAA,eAAeC,UAAAA,GAAAA;AACbJ,QAAAA,GAAAA,CAAIE,mBAAAA,CAAcC,OAAO,qCAAA,CAAA;AAEzB,QAAA,MAAMN,GAAAA,CAAIQ,UAAAA,C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ACJe,MAAAA,EAAQ;YACNxC,EAAAA,EAAI;cACFyC,OAAAA,EAAS;AAAC,gBAAA;;AACZ;AACF,WAAA;UACAZ,OAAAA,EAASJ;AACX,SAAA;AACAC,QAAAA,SAAAA;AACA/B,QAAAA,UAAAA;AACAyC,QAAAA,QAAAA;AACAC,QAAAA,WAAAA;QACAK,IAAAA,EAAM;UACJC,iBAAAA,EAAmB;AACrB;AACF,OAAA;AACF,IAAA,CAAA,CAAA,OAASC,KAAAA,EAAO;AACdrD,MAAAA,GAAAA,CAAIE,mBAAAA,CAAcoD,KAAAA,EAAQD,KAAAA,EAAiBE,OAAAA,CAAAA;AAE3C,MAAA,MAAMF,KAAAA;AACR,IAAA;AACF,EAAA,CAAA;AACF;AAlOgB1D,wBAAAA,CAAAA,cAAAA,EAAAA,gBAAAA,CAAAA","file":"chunk-3DKBH67A.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 { LogLevelLabel } from \"@storm-software/config-tools/types\";\nimport { findFileName } from \"@stryke/path/file-path-fns\";\nimport { replaceExtension } from \"@stryke/path/replace\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport type {\n ExternalIdResult,\n TransformResult,\n UnpluginBuildContext,\n UnpluginContext\n} from \"unplugin\";\nimport { setParseImpl } from \"unplugin\";\nimport { UnpluginBuildVariant } from \"../../types/build\";\nimport { PluginContext } from \"../../types/context\";\nimport { UNSAFE_PluginContext } from \"../../types/internal\";\nimport { PowerlinesUnpluginFactory } from \"../../types/unplugin\";\nimport { extendLog } from \"../logger\";\nimport { getString } from \"../utilities/source-file\";\nimport { combineContexts } from \"./helpers\";\n\n/**\n * Creates a Powerlines unplugin instance.\n *\n * @param context - The plugin context.\n * @returns The unplugin instance.\n */\nexport function createUnplugin<TContext extends PluginContext = PluginContext>(\n context: TContext\n): PowerlinesUnpluginFactory<UnpluginBuildVariant> {\n const ctx = context as unknown as UNSAFE_PluginContext;\n setParseImpl(ctx.parse);\n\n return () => {\n const log = extendLog(ctx.log, \"unplugin\");\n log(LogLevelLabel.DEBUG, \"Initializing Unplugin\");\n\n try {\n async function buildStart(this: UnpluginBuildContext) {\n log(LogLevelLabel.DEBUG, \"Powerlines build plugin starting...\");\n\n await ctx.$$internal.callHook(\"buildStart\", {\n sequential: true\n });\n }\n\n async function resolveId(\n this: UnpluginBuildContext & UnpluginContext,\n id: string,\n importer?: string,\n opts: {\n isEntry: boolean;\n } = { isEntry: false }\n ): Promise<string | ExternalIdResult | null | undefined> {\n const resolved = await (async () => {\n let result = await ctx.$$internal.callHook(\n \"resolveId\",\n {\n sequential: true,\n result: \"first\",\n order: \"pre\"\n },\n id,\n importer,\n opts\n );\n if (result) {\n return result;\n }\n\n result = await ctx.$$internal.callHook(\n \"resolveId\",\n {\n sequential: true,\n result: \"first\",\n order: \"normal\"\n },\n id,\n importer,\n opts\n );\n if (result) {\n return result;\n }\n\n result = await ctx.resolve(id, importer, opts);\n if (result) {\n return result;\n }\n\n return ctx.$$internal.callHook(\n \"resolveId\",\n {\n sequential: true,\n result: \"first\",\n order: \"post\"\n },\n id,\n importer,\n opts\n );\n })();\n if (\n resolved &&\n opts.isEntry &&\n ctx.config.build.polyfill &&\n ctx.config.build.polyfill.length > 0\n ) {\n const entry = ctx.entry.find(\n entry =>\n entry.file === (isString(resolved) ? resolved : resolved.id)\n );\n if (entry) {\n entry.file = `${replaceExtension(isString(resolved) ? resolved : resolved.id)}-polyfill.ts`;\n entry.output ||= entry.output?.replace(\n findFileName(entry.output, { withExtension: true }),\n entry.file\n );\n\n await ctx.emitEntry(\n `\n${ctx.config.build.polyfill.map(p => `import \"${p}\";`).join(\"\\n\")}\n\nexport * from \"${isString(resolved) ? resolved : resolved.id}\";\n`,\n entry.file\n );\n\n return entry.file;\n }\n }\n\n return resolved;\n }\n\n async function load(\n this: UnpluginBuildContext & UnpluginContext,\n id: string\n ): Promise<TransformResult | null | undefined> {\n let result = await ctx.$$internal.callHook(\n \"load\",\n {\n sequential: true,\n result: \"first\",\n order: \"pre\"\n },\n id\n );\n if (result) {\n return result;\n }\n\n result = await ctx.$$internal.callHook(\n \"load\",\n {\n sequential: true,\n result: \"first\",\n order: \"normal\"\n },\n id\n );\n if (result) {\n return result;\n }\n\n result = await ctx.load(id);\n if (result) {\n return result;\n }\n\n return ctx.$$internal.callHook(\n \"load\",\n {\n sequential: true,\n result: \"first\",\n order: \"post\"\n },\n id\n );\n }\n\n async function transform(\n this: UnpluginBuildContext & UnpluginContext,\n code: string,\n id: string\n ): Promise<TransformResult | null | undefined> {\n let transformed: TransformResult | string = code;\n\n for (const handler of ctx.$$internal.environment.selectHooks(\n \"transform\"\n )) {\n const result: TransformResult | string | undefined =\n await handler.handle.apply(combineContexts(ctx, this), [\n getString(transformed),\n id\n ]);\n if (result) {\n transformed = result;\n }\n }\n\n return transformed;\n }\n\n async function buildEnd(this: UnpluginBuildContext): Promise<void> {\n log(LogLevelLabel.DEBUG, \"Powerlines build plugin finishing...\");\n\n return ctx.$$internal.callHook(\"buildEnd\", {\n sequential: true\n });\n }\n\n async function writeBundle(): Promise<void> {\n log(LogLevelLabel.DEBUG, \"Finalizing Powerlines project output...\");\n\n return ctx.$$internal.callHook(\"writeBundle\", {\n sequential: true\n });\n }\n\n return {\n name: \"powerlines\",\n api: ctx.$$internal.api,\n resolveId: {\n filter: {\n id: {\n include: [/.*/]\n }\n },\n handler: resolveId\n },\n load: {\n filter: {\n id: {\n include: [/.*/]\n }\n },\n handler: load\n },\n transform,\n buildStart,\n buildEnd,\n writeBundle,\n vite: {\n sharedDuringBuild: true\n }\n };\n } catch (error) {\n log(LogLevelLabel.FATAL, (error as Error)?.message);\n\n throw error;\n }\n };\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import { createPluginContext } from './chunk-6OGQTUXF.js';
2
- import { PowerlinesContext, isPluginConfig, isPlugin, isPluginHook, isHookExternal, addPluginHook, getHookHandler } from './chunk-QGVTYA6Q.js';
2
+ import { PowerlinesContext, isPluginConfig, isPlugin, isPluginHook, isHookExternal, addPluginHook, getHookHandler } from './chunk-B47EITCS.js';
3
3
  import { __name } from './chunk-7QVYU63E.js';
4
4
  import { resolvePackage } from '@stryke/fs/resolve';
5
5
  import { isFunction } from '@stryke/type-checks/is-function';
@@ -201,5 +201,5 @@ var PowerlinesEnvironmentContext = class _PowerlinesEnvironmentContext extends P
201
201
  };
202
202
 
203
203
  export { PowerlinesEnvironmentContext };
204
- //# sourceMappingURL=chunk-3XVN4LJM.js.map
205
- //# sourceMappingURL=chunk-3XVN4LJM.js.map
204
+ //# sourceMappingURL=chunk-6JWWNHPO.js.map
205
+ //# sourceMappingURL=chunk-6JWWNHPO.js.map
@@ -1 +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":";;;;;;;;AA2YO,IAAMA,sBAAAA,GAAyB;AACpC,EAAA,MAAA;AACA,EAAA,KAAA;AACA,EAAA,SAAA;AACA,EAAA,QA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AA,CAAA,CAAA;AACxDvB,UAAAA,MAAAA,CAAOW,IAAAA,CAAI,GAAI,IAAA,CAAKgB,WAAAA,CAAYV,IAAAA,EAAM;YAAEM,KAAAA,EAAO;AAAO,WAAA,CAAA,CAAA;AACxD,QAAA;MACF,CAAA,MAAO;AACLvB,QAAAA,MAAAA,CAAOW,IAAAA,CAAI,GACN,IAAA,CAAKjB,KAAAA,CAAMuB,IAAAA,CAAAA,CAAMa,GAAAA,CAAIC,CAAAA,CAAAA,KAAAA;AACtB,UAAA,MAAMnC,MAAAA,GAAS,IAAA,CAAKH,OAAAA,CAAQuC,IAAAA,CAC1BC,CAAAA,CAAAA,KAAKA,CAAAA,CAAErC,MAAAA,CAAOsC,IAAAA,KAASH,CAAAA,CAAEnC,MAAAA,CAAOsC,IAAI,CAAA;AAEtC,UAAA,IAAI,CAACtC,MAAAA,EAAQ;AACX,YAAA,MAAM,IAAIL,KAAAA,CACR,CAAA,0CAAA,EAA6CwC,CAAAA,CAAEnC,MAAAA,CAAOsC,IAAI,CAAA,EAAA,CAAI,CAAA;AAElE,UAAA;AAEA,UAAA,OAAO;AACLC,YAAAA,MAAAA,EAAQJ,CAAAA,CAAEK,OAAAA;AACVjD,YAAAA,OAAAA,EAASS,MAAAA,CAAOT;AAClB,WAAA;AACF,QAAA,CAAA,CAAA,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-3XVN4LJM.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 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<TContext>) => 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 \"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
+ {"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":";;;;;;;;AA2YO,IAAMA,sBAAAA,GAAyB;AACpC,EAAA,MAAA;AACA,EAAA,KAAA;AACA,EAAA,SAAA;AACA,EAAA,QAAA;AACA,EAAA,WAAA;AACA,EAAA;;;;AClWK,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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C,MAAAA,GAAS,IAAA,CAAKH,OAAAA,CAAQuC,IAAAA,CAC1BC,CAAAA,CAAAA,KAAKA,CAAAA,CAAErC,MAAAA,CAAOsC,IAAAA,KAASH,CAAAA,CAAEnC,MAAAA,CAAOsC,IAAI,CAAA;AAEtC,UAAA,IAAI,CAACtC,MAAAA,EAAQ;AACX,YAAA,MAAM,IAAIL,KAAAA,CACR,CAAA,0CAAA,EAA6CwC,CAAAA,CAAEnC,MAAAA,CAAOsC,IAAI,CAAA,EAAA,CAAI,CAAA;AAElE,UAAA;AAEA,UAAA,OAAO;AACLC,YAAAA,MAAAA,EAAQJ,CAAAA,CAAEK,OAAAA;AACVjD,YAAAA,OAAAA,EAASS,MAAAA,CAAOT;AAClB,WAAA;AACF,QAAA,CAAA,CAAA,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-6JWWNHPO.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 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<TContext>) => 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 \"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,11 +1,11 @@
1
1
  import { CACHE_HASH_LENGTH, PROJECT_ROOT_HASH_LENGTH, getPrefixedProjectRootHash } from './chunk-45D4XIOK.js';
2
- import { VirtualFileSystem } from './chunk-2GK7DF43.js';
2
+ import { VirtualFileSystem } from './chunk-NXUMUI2Z.js';
3
3
  import { createProgram } from './chunk-ZLWW2MXD.js';
4
4
  import { getTsconfigFilePath } from './chunk-FPFPUYXS.js';
5
5
  import { loadWorkspaceConfig, loadUserConfigFile } from './chunk-Q25ZPXA7.js';
6
+ import { createLog, extendLog } from './chunk-35EO5Y7R.js';
6
7
  import { resolveEntriesSync, getUniqueEntries } from './chunk-KLU5DWCZ.js';
7
8
  import { replacePathTokens } from './chunk-FFATMOAQ.js';
8
- import { createLog, extendLog } from './chunk-35EO5Y7R.js';
9
9
  import { __name } from './chunk-7QVYU63E.js';
10
10
  import { LogLevelLabel } from '@storm-software/config-tools/types';
11
11
  import { toArray } from '@stryke/convert/to-array';
@@ -975,7 +975,7 @@ var PowerlinesContext = class _PowerlinesContext {
975
975
  this.config.output.assets = getUnique(this.config.output.assets.map((asset) => {
976
976
  return {
977
977
  glob: isSetObject(asset) ? asset.glob : asset,
978
- input: isString(asset) || !asset.input || asset.input === "." || asset.input === "/" || asset.input === "./" ? this.workspaceConfig.workspaceRoot : appendPath(asset.input, this.workspaceConfig.workspaceRoot),
978
+ input: isString(asset) || !asset.input || asset.input === "." || asset.input === "/" || asset.input === "./" ? this.workspaceConfig.workspaceRoot : isParentPath(asset.input, this.workspaceConfig.workspaceRoot) ? asset.input : appendPath(asset.input, this.workspaceConfig.workspaceRoot),
979
979
  output: isSetObject(asset) && asset.output ? isParentPath(asset.output, this.workspaceConfig.workspaceRoot) ? asset.output : appendPath(joinPaths(this.config.output.outputPath, replacePath(replacePath(asset.output, replacePath(this.config.output.outputPath, this.workspaceConfig.workspaceRoot)), this.config.output.outputPath)), this.workspaceConfig.workspaceRoot) : appendPath(this.config.output.outputPath, this.workspaceConfig.workspaceRoot),
980
980
  ignore: isSetObject(asset) && asset.ignore ? toArray(asset.ignore) : void 0
981
981
  };
@@ -1029,5 +1029,5 @@ var PowerlinesContext = class _PowerlinesContext {
1029
1029
  };
1030
1030
 
1031
1031
  export { PowerlinesContext, addPluginHook, checkDedupe, getHookHandler, isHookExternal, isPlugin, isPluginConfig, isPluginConfigObject, isPluginConfigTuple, isPluginHook };
1032
- //# sourceMappingURL=chunk-QGVTYA6Q.js.map
1033
- //# sourceMappingURL=chunk-QGVTYA6Q.js.map
1032
+ //# sourceMappingURL=chunk-B47EITCS.js.map
1033
+ //# sourceMappingURL=chunk-B47EITCS.js.map