powerlines 0.37.35 → 0.37.36

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 (121) 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-4ZMXSGTF.cjs +12 -0
  6. package/dist/{chunk-YTGERWHC.js → chunk-7EBAVG2H.js} +4 -5
  7. package/dist/{chunk-Q65LQVH6.js → chunk-BVKWNX7Q.js} +3 -3
  8. package/dist/{chunk-TFOT7S55.js → chunk-DHFLXVK7.js} +3 -3
  9. package/dist/{chunk-PJPHDM25.cjs → chunk-DS4NQ6HY.cjs} +4 -5
  10. package/dist/{chunk-EQ6DXFKF.cjs → chunk-FGJ6XPBJ.cjs} +5 -5
  11. package/dist/chunk-GMA3KYZJ.cjs +12 -0
  12. package/dist/{chunk-SLWIUFSS.js → chunk-IG5WPC7V.js} +3 -3
  13. package/dist/{chunk-DQSXHHAV.cjs → chunk-R4GXFTWP.cjs} +4 -4
  14. package/dist/{chunk-O7NHLZPY.js → chunk-SO5T2URL.js} +3 -3
  15. package/dist/{chunk-LTMBRWVN.js → chunk-SRNSE6AK.js} +3 -3
  16. package/dist/{chunk-KPFOSNI2.cjs → chunk-YJV5CG3S.cjs} +4 -4
  17. package/dist/esbuild.cjs +6 -6
  18. package/dist/esbuild.js +3 -3
  19. package/dist/farm.cjs +3 -3
  20. package/dist/farm.js +2 -2
  21. package/dist/index.cjs +10 -10
  22. package/dist/index.js +2 -2
  23. package/dist/lib/build/esbuild.cjs +5 -5
  24. package/dist/lib/build/esbuild.js +2 -2
  25. package/dist/lib/build/index.cjs +12 -12
  26. package/dist/lib/build/index.js +4 -4
  27. package/dist/lib/build/tsup.cjs +6 -6
  28. package/dist/lib/build/tsup.js +3 -3
  29. package/dist/lib/build/vite.cjs +5 -5
  30. package/dist/lib/build/vite.js +3 -3
  31. package/dist/lib/{chunk-5S2SZ55K.js → chunk-22CVJ3GB.js} +4 -4
  32. package/dist/lib/{chunk-5S2SZ55K.js.map → chunk-22CVJ3GB.js.map} +1 -1
  33. package/dist/lib/{chunk-YSAYMPBB.cjs → chunk-47MWIOWK.cjs} +4 -4
  34. package/dist/lib/{chunk-YSAYMPBB.cjs.map → chunk-47MWIOWK.cjs.map} +1 -1
  35. package/dist/lib/{chunk-O6X6DQOP.cjs → chunk-4DIBUT27.cjs} +2 -2
  36. package/dist/lib/{chunk-O6X6DQOP.cjs.map → chunk-4DIBUT27.cjs.map} +1 -1
  37. package/dist/lib/{chunk-CJ3AOQLZ.cjs → chunk-5XL2KMBD.cjs} +4 -4
  38. package/dist/lib/{chunk-CJ3AOQLZ.cjs.map → chunk-5XL2KMBD.cjs.map} +1 -1
  39. package/dist/lib/{chunk-AN5ZE52X.js → chunk-62FNLA4C.js} +6 -7
  40. package/dist/lib/chunk-62FNLA4C.js.map +1 -0
  41. package/dist/lib/{chunk-RUZCLCCT.cjs → chunk-BHYCRVQO.cjs} +18 -19
  42. package/dist/lib/chunk-BHYCRVQO.cjs.map +1 -0
  43. package/dist/lib/{chunk-PX4HYK7X.cjs → chunk-FQMOHR6C.cjs} +4 -4
  44. package/dist/lib/{chunk-PX4HYK7X.cjs.map → chunk-FQMOHR6C.cjs.map} +1 -1
  45. package/dist/lib/{chunk-7ZFN37TZ.cjs → chunk-GKYKBP64.cjs} +5 -5
  46. package/dist/lib/{chunk-7ZFN37TZ.cjs.map → chunk-GKYKBP64.cjs.map} +1 -1
  47. package/dist/lib/{chunk-VKFZWKAX.cjs → chunk-GOC5UCU6.cjs} +4 -4
  48. package/dist/lib/{chunk-VKFZWKAX.cjs.map → chunk-GOC5UCU6.cjs.map} +1 -1
  49. package/dist/lib/{chunk-FEDWFZCN.cjs → chunk-IH4B475X.cjs} +19 -19
  50. package/dist/lib/{chunk-FEDWFZCN.cjs.map → chunk-IH4B475X.cjs.map} +1 -1
  51. package/dist/lib/{chunk-RP4KHKZQ.js → chunk-IUXE765Q.js} +3 -3
  52. package/dist/lib/{chunk-RP4KHKZQ.js.map → chunk-IUXE765Q.js.map} +1 -1
  53. package/dist/lib/{chunk-P7Z77YMX.js → chunk-KQGACHG6.js} +3 -3
  54. package/dist/lib/{chunk-P7Z77YMX.js.map → chunk-KQGACHG6.js.map} +1 -1
  55. package/dist/lib/{chunk-OFS5VLIU.js → chunk-LJEWIZNL.js} +3 -3
  56. package/dist/lib/{chunk-OFS5VLIU.js.map → chunk-LJEWIZNL.js.map} +1 -1
  57. package/dist/lib/{chunk-HZTJTO26.js → chunk-OE4RRA62.js} +2 -2
  58. package/dist/lib/{chunk-HZTJTO26.js.map → chunk-OE4RRA62.js.map} +1 -1
  59. package/dist/lib/{chunk-MKA52KRJ.js → chunk-OYYPCZW3.js} +3 -3
  60. package/dist/lib/{chunk-MKA52KRJ.js.map → chunk-OYYPCZW3.js.map} +1 -1
  61. package/dist/lib/{chunk-K2432VDS.cjs → chunk-PAI37O2U.cjs} +4 -4
  62. package/dist/lib/{chunk-K2432VDS.cjs.map → chunk-PAI37O2U.cjs.map} +1 -1
  63. package/dist/lib/{chunk-XTO4JEOR.js → chunk-RU36DRXO.js} +3 -3
  64. package/dist/lib/{chunk-XTO4JEOR.js.map → chunk-RU36DRXO.js.map} +1 -1
  65. package/dist/lib/{chunk-WKVQSAKR.js → chunk-SADDVAAV.js} +3 -3
  66. package/dist/lib/{chunk-WKVQSAKR.js.map → chunk-SADDVAAV.js.map} +1 -1
  67. package/dist/lib/{chunk-MRFCJ22H.js → chunk-TZGFR4HR.js} +3 -3
  68. package/dist/lib/{chunk-MRFCJ22H.js.map → chunk-TZGFR4HR.js.map} +1 -1
  69. package/dist/lib/{chunk-643UR4H5.cjs → chunk-YQUWIJ2D.cjs} +6 -6
  70. package/dist/lib/{chunk-643UR4H5.cjs.map → chunk-YQUWIJ2D.cjs.map} +1 -1
  71. package/dist/lib/contexts/api-context.cjs +5 -5
  72. package/dist/lib/contexts/api-context.js +4 -4
  73. package/dist/lib/contexts/context.cjs +3 -3
  74. package/dist/lib/contexts/context.js +2 -2
  75. package/dist/lib/contexts/environment-context.cjs +4 -4
  76. package/dist/lib/contexts/environment-context.js +3 -3
  77. package/dist/lib/contexts/index.cjs +7 -7
  78. package/dist/lib/contexts/index.js +4 -4
  79. package/dist/lib/entry.cjs +10 -10
  80. package/dist/lib/entry.d.cts +1 -1
  81. package/dist/lib/entry.d.ts +1 -1
  82. package/dist/lib/entry.js +1 -1
  83. package/dist/lib/index.cjs +23 -23
  84. package/dist/lib/index.js +8 -8
  85. package/dist/lib/unplugin/factory.cjs +6 -6
  86. package/dist/lib/unplugin/factory.js +5 -5
  87. package/dist/lib/unplugin/index.cjs +6 -6
  88. package/dist/lib/unplugin/index.js +5 -5
  89. package/dist/lib/utilities/bundle.cjs +4 -4
  90. package/dist/lib/utilities/bundle.js +3 -3
  91. package/dist/lib/utilities/index.cjs +6 -6
  92. package/dist/lib/utilities/index.js +4 -4
  93. package/dist/lib/utilities/resolve.cjs +5 -5
  94. package/dist/lib/utilities/resolve.js +4 -4
  95. package/dist/next.cjs +4 -4
  96. package/dist/next.js +3 -3
  97. package/dist/nuxt.cjs +8 -8
  98. package/dist/nuxt.js +4 -4
  99. package/dist/rolldown.cjs +6 -6
  100. package/dist/rolldown.js +3 -3
  101. package/dist/rollup.cjs +3 -3
  102. package/dist/rollup.js +2 -2
  103. package/dist/rspack.cjs +3 -3
  104. package/dist/rspack.js +2 -2
  105. package/dist/tsdown.cjs +4 -4
  106. package/dist/tsdown.js +3 -3
  107. package/dist/tsup.cjs +4 -4
  108. package/dist/tsup.js +3 -3
  109. package/dist/unloader.cjs +3 -3
  110. package/dist/unloader.js +2 -2
  111. package/dist/unplugin.cjs +8 -8
  112. package/dist/unplugin.js +4 -4
  113. package/dist/vite.cjs +6 -6
  114. package/dist/vite.js +3 -3
  115. package/dist/webpack.cjs +6 -6
  116. package/dist/webpack.js +3 -3
  117. package/package.json +2 -2
  118. package/dist/chunk-7SBQHE7O.cjs +0 -12
  119. package/dist/chunk-NQGIX27E.cjs +0 -12
  120. package/dist/lib/chunk-AN5ZE52X.js.map +0 -1
  121. package/dist/lib/chunk-RUZCLCCT.cjs.map +0 -1
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkCJ3AOQLZ_cjs = require('./chunk-CJ3AOQLZ.cjs');
3
+ var chunk5XL2KMBD_cjs = require('./chunk-5XL2KMBD.cjs');
4
4
  var chunkPK6SKIKE_cjs = require('./chunk-PK6SKIKE.cjs');
5
5
  var parseTypeDefinition = require('@stryke/convert/parse-type-definition');
6
6
  var isSetString = require('@stryke/type-checks/is-set-string');
@@ -12,7 +12,7 @@ async function resolve(context, type, overrides = {}) {
12
12
  } else {
13
13
  typeDefinition = type;
14
14
  }
15
- const result = await chunkCJ3AOQLZ_cjs.bundle(context, typeDefinition.file, overrides);
15
+ const result = await chunk5XL2KMBD_cjs.bundle(context, typeDefinition.file, overrides);
16
16
  const resolved = await context.resolver.evalModule(result.text, {
17
17
  filename: result.path,
18
18
  forceTranspile: true
@@ -26,5 +26,5 @@ async function resolve(context, type, overrides = {}) {
26
26
  chunkPK6SKIKE_cjs.__name(resolve, "resolve");
27
27
 
28
28
  exports.resolve = resolve;
29
- //# sourceMappingURL=chunk-VKFZWKAX.cjs.map
30
- //# sourceMappingURL=chunk-VKFZWKAX.cjs.map
29
+ //# sourceMappingURL=chunk-GOC5UCU6.cjs.map
30
+ //# sourceMappingURL=chunk-GOC5UCU6.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/lib/utilities/resolve.ts"],"names":["resolve","context","type","overrides","typeDefinition","isSetString","parseTypeDefinition","result","bundle","file","resolved","resolver","evalModule","text","filename","path","forceTranspile","exportName","name"],"mappings":";;;;;;;AAoCA,eAAsBA,OAAAA,CACpBC,OAAAA,EACAC,IAAAA,EACAC,SAAAA,GAAiD,EAAC,EAAC;AAEnD,EAAA,IAAIC,cAAAA;AACJ,EAAA,IAAIC,uBAAAA,CAAYH,IAAAA,CAAAA,EAAO;AACrBE,IAAAA,cAAAA,GAAiBE,wCAAoBJ,IAAAA,CAAAA;EACvC,CAAA,MAAO;AACLE,IAAAA,cAAAA,GAAiBF,IAAAA;AACnB,EAAA;AAEA,EAAA,MAAMK,SAAS,MAAMC,wBAAAA,CAAOP,OAAAA,EAASG,cAAAA,CAAeK,MAAMN,SAAAA,CAAAA;AAE1D,EAAA,MAAMO,WAAY,MAAMT,OAAAA,CAAQU,QAAAA,CAASC,UAAAA,CAAWL,OAAOM,IAAAA,EAAM;AAC/DC,IAAAA,QAAAA,EAAUP,MAAAA,CAAOQ,IAAAA;IACjBC,cAAAA,EAAgB;GAClB,CAAA;AAEA,EAAA,IAAIC,aAAab,cAAAA,CAAec,IAAAA;AAChC,EAAA,IAAI,CAACD,UAAAA,EAAY;AACfA,IAAAA,UAAAA,GAAa,SAAA;AACf,EAAA;AAEA,EAAA,OAAOP,SAASO,UAAAA,CAAAA,IAAeP,QAAAA,CAAS,CAAA,QAAA,EAAMO,UAAAA,CAAAA,CAAY,CAAA;AAC5D;AAzBsBjB,wBAAAA,CAAAA,OAAAA,EAAAA,SAAAA,CAAAA","file":"chunk-VKFZWKAX.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 { parseTypeDefinition } from \"@stryke/convert/parse-type-definition\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport {\n TypeDefinition,\n TypeDefinitionParameter\n} from \"@stryke/types/configuration\";\nimport { ESBuildResolvedBuildConfig } from \"../../types/build\";\nimport { Context } from \"../../types/context\";\nimport { bundle } from \"./bundle\";\n\n/**\n * Compiles a type definition to a module.\n *\n * @param context - The context object containing the environment paths.\n * @param type - The type definition to compile. This can be either a string or a {@link TypeDefinition} object.\n * @param overrides - Optional overrides for the ESBuild configuration.\n * @returns A promise that resolves to the compiled module.\n */\nexport async function resolve<TResult = any>(\n context: Context,\n type: TypeDefinitionParameter,\n overrides: Partial<ESBuildResolvedBuildConfig> = {}\n): Promise<TResult> {\n let typeDefinition!: TypeDefinition;\n if (isSetString(type)) {\n typeDefinition = parseTypeDefinition(type) as TypeDefinition;\n } else {\n typeDefinition = type;\n }\n\n const result = await bundle(context, typeDefinition.file, overrides);\n\n const resolved = (await context.resolver.evalModule(result.text, {\n filename: result.path,\n forceTranspile: true\n })) as Record<string, any>;\n\n let exportName = typeDefinition.name;\n if (!exportName) {\n exportName = \"default\";\n }\n\n return resolved[exportName] ?? resolved[`__Ω${exportName}`];\n}\n"]}
1
+ {"version":3,"sources":["../../src/lib/utilities/resolve.ts"],"names":["resolve","context","type","overrides","typeDefinition","isSetString","parseTypeDefinition","result","bundle","file","resolved","resolver","evalModule","text","filename","path","forceTranspile","exportName","name"],"mappings":";;;;;;;AAoCA,eAAsBA,OAAAA,CACpBC,OAAAA,EACAC,IAAAA,EACAC,SAAAA,GAAiD,EAAC,EAAC;AAEnD,EAAA,IAAIC,cAAAA;AACJ,EAAA,IAAIC,uBAAAA,CAAYH,IAAAA,CAAAA,EAAO;AACrBE,IAAAA,cAAAA,GAAiBE,wCAAoBJ,IAAAA,CAAAA;EACvC,CAAA,MAAO;AACLE,IAAAA,cAAAA,GAAiBF,IAAAA;AACnB,EAAA;AAEA,EAAA,MAAMK,SAAS,MAAMC,wBAAAA,CAAOP,OAAAA,EAASG,cAAAA,CAAeK,MAAMN,SAAAA,CAAAA;AAE1D,EAAA,MAAMO,WAAY,MAAMT,OAAAA,CAAQU,QAAAA,CAASC,UAAAA,CAAWL,OAAOM,IAAAA,EAAM;AAC/DC,IAAAA,QAAAA,EAAUP,MAAAA,CAAOQ,IAAAA;IACjBC,cAAAA,EAAgB;GAClB,CAAA;AAEA,EAAA,IAAIC,aAAab,cAAAA,CAAec,IAAAA;AAChC,EAAA,IAAI,CAACD,UAAAA,EAAY;AACfA,IAAAA,UAAAA,GAAa,SAAA;AACf,EAAA;AAEA,EAAA,OAAOP,SAASO,UAAAA,CAAAA,IAAeP,QAAAA,CAAS,CAAA,QAAA,EAAMO,UAAAA,CAAAA,CAAY,CAAA;AAC5D;AAzBsBjB,wBAAAA,CAAAA,OAAAA,EAAAA,SAAAA,CAAAA","file":"chunk-GOC5UCU6.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 { parseTypeDefinition } from \"@stryke/convert/parse-type-definition\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport {\n TypeDefinition,\n TypeDefinitionParameter\n} from \"@stryke/types/configuration\";\nimport { ESBuildResolvedBuildConfig } from \"../../types/build\";\nimport { Context } from \"../../types/context\";\nimport { bundle } from \"./bundle\";\n\n/**\n * Compiles a type definition to a module.\n *\n * @param context - The context object containing the environment paths.\n * @param type - The type definition to compile. This can be either a string or a {@link TypeDefinition} object.\n * @param overrides - Optional overrides for the ESBuild configuration.\n * @returns A promise that resolves to the compiled module.\n */\nexport async function resolve<TResult = any>(\n context: Context,\n type: TypeDefinitionParameter,\n overrides: Partial<ESBuildResolvedBuildConfig> = {}\n): Promise<TResult> {\n let typeDefinition!: TypeDefinition;\n if (isSetString(type)) {\n typeDefinition = parseTypeDefinition(type) as TypeDefinition;\n } else {\n typeDefinition = type;\n }\n\n const result = await bundle(context, typeDefinition.file, overrides);\n\n const resolved = (await context.resolver.evalModule(result.text, {\n filename: result.path,\n forceTranspile: true\n })) as Record<string, any>;\n\n let exportName = typeDefinition.name;\n if (!exportName) {\n exportName = \"default\";\n }\n\n return resolved[exportName] ?? resolved[`__Ω${exportName}`];\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var chunkGNEHIBN4_cjs = require('./chunk-GNEHIBN4.cjs');
4
- var chunk7ZFN37TZ_cjs = require('./chunk-7ZFN37TZ.cjs');
4
+ var chunkGKYKBP64_cjs = require('./chunk-GKYKBP64.cjs');
5
5
  var chunkGZDE4GLY_cjs = require('./chunk-GZDE4GLY.cjs');
6
6
  var chunkPK6SKIKE_cjs = require('./chunk-PK6SKIKE.cjs');
7
7
  var resolve = require('@stryke/fs/resolve');
@@ -9,7 +9,7 @@ var isFunction = require('@stryke/type-checks/is-function');
9
9
  var isObject = require('@stryke/type-checks/is-object');
10
10
  var isSetObject = require('@stryke/type-checks/is-set-object');
11
11
 
12
- var PowerlinesEnvironmentContext = class _PowerlinesEnvironmentContext extends chunk7ZFN37TZ_cjs.PowerlinesContext {
12
+ var PowerlinesEnvironmentContext = class _PowerlinesEnvironmentContext extends chunkGKYKBP64_cjs.PowerlinesContext {
13
13
  static {
14
14
  chunkPK6SKIKE_cjs.__name(this, "PowerlinesEnvironmentContext");
15
15
  }
@@ -58,21 +58,21 @@ var PowerlinesEnvironmentContext = class _PowerlinesEnvironmentContext extends c
58
58
  if (!result || isObject.isObject(result) && Object.keys(result).length === 0) {
59
59
  return;
60
60
  }
61
- if (chunk7ZFN37TZ_cjs.isPluginConfig(result)) {
61
+ if (chunkGKYKBP64_cjs.isPluginConfig(result)) {
62
62
  return this.$$internal.addPlugin(result);
63
63
  }
64
- resolvedPlugin = chunk7ZFN37TZ_cjs.isPlugin(result) ? result : plugin;
64
+ resolvedPlugin = chunkGKYKBP64_cjs.isPlugin(result) ? result : plugin;
65
65
  }
66
66
  const context = chunkGZDE4GLY_cjs.createPluginContext(resolvedPlugin, this);
67
67
  this.plugins.push({
68
68
  plugin: resolvedPlugin,
69
69
  context
70
70
  });
71
- this.#hooks = Object.keys(resolvedPlugin).filter((key) => !chunk7ZFN37TZ_cjs.PLUGIN_NON_HOOK_FIELDS.includes(key)).reduce((ret, key) => {
71
+ this.#hooks = Object.keys(resolvedPlugin).filter((key) => !chunkGKYKBP64_cjs.PLUGIN_NON_HOOK_FIELDS.includes(key)).reduce((ret, key) => {
72
72
  const hook = key;
73
- if (chunk7ZFN37TZ_cjs.isPluginHookField(hook)) {
73
+ if (chunkGKYKBP64_cjs.isPluginHookField(hook)) {
74
74
  const pluginHook = resolvedPlugin[hook];
75
- if (!chunk7ZFN37TZ_cjs.isPluginHook(pluginHook)) {
75
+ if (!chunkGKYKBP64_cjs.isPluginHook(pluginHook)) {
76
76
  return ret;
77
77
  }
78
78
  ret[hook] ??= {
@@ -86,20 +86,20 @@ var PowerlinesEnvironmentContext = class _PowerlinesEnvironmentContext extends c
86
86
  const hookListOrder2 = `${resolvedPlugin.enforce}Enforced`;
87
87
  ret[hook][hookListOrder2] ??= [];
88
88
  const bucket = ret[hook][hookListOrder2];
89
- chunk7ZFN37TZ_cjs.addPluginHook(context, resolvedPlugin, pluginHook, bucket);
89
+ chunkGKYKBP64_cjs.addPluginHook(context, resolvedPlugin, pluginHook, bucket);
90
90
  return ret;
91
91
  }
92
92
  if (isFunction.isFunction(pluginHook) || !pluginHook.order) {
93
93
  ret[hook].normal ??= [];
94
94
  const bucket = ret[hook].normal;
95
- chunk7ZFN37TZ_cjs.addPluginHook(context, resolvedPlugin, pluginHook, bucket);
95
+ chunkGKYKBP64_cjs.addPluginHook(context, resolvedPlugin, pluginHook, bucket);
96
96
  return ret;
97
97
  }
98
98
  const hookListOrder = `${pluginHook.order}Ordered`;
99
99
  ret[hook][hookListOrder] ??= [];
100
- chunk7ZFN37TZ_cjs.addPluginHook(context, resolvedPlugin, pluginHook, ret[hook][hookListOrder]);
100
+ chunkGKYKBP64_cjs.addPluginHook(context, resolvedPlugin, pluginHook, ret[hook][hookListOrder]);
101
101
  return ret;
102
- } else if (chunk7ZFN37TZ_cjs.isUnpluginHookField(hook)) {
102
+ } else if (chunkGKYKBP64_cjs.isUnpluginHookField(hook)) {
103
103
  const unpluginPlugin = resolvedPlugin[hook];
104
104
  if (!isSetObject.isSetObject(unpluginPlugin)) {
105
105
  return ret;
@@ -107,7 +107,7 @@ var PowerlinesEnvironmentContext = class _PowerlinesEnvironmentContext extends c
107
107
  for (const field of Object.keys(unpluginPlugin)) {
108
108
  const variantField = field;
109
109
  const pluginHook = unpluginPlugin[variantField];
110
- if (!chunk7ZFN37TZ_cjs.isPluginHook(pluginHook)) {
110
+ if (!chunkGKYKBP64_cjs.isPluginHook(pluginHook)) {
111
111
  continue;
112
112
  }
113
113
  ret[hook] ??= {};
@@ -119,14 +119,14 @@ var PowerlinesEnvironmentContext = class _PowerlinesEnvironmentContext extends c
119
119
  postOrdered: []
120
120
  };
121
121
  if (resolvedPlugin.enforce) {
122
- chunk7ZFN37TZ_cjs.addPluginHook(context, resolvedPlugin, pluginHook, ret[hook][variantField][`${resolvedPlugin.enforce}Enforced`]);
122
+ chunkGKYKBP64_cjs.addPluginHook(context, resolvedPlugin, pluginHook, ret[hook][variantField][`${resolvedPlugin.enforce}Enforced`]);
123
123
  return ret;
124
124
  }
125
125
  if (isFunction.isFunction(pluginHook) || !pluginHook.order) {
126
- chunk7ZFN37TZ_cjs.addPluginHook(context, resolvedPlugin, pluginHook, ret[hook][variantField].normal);
126
+ chunkGKYKBP64_cjs.addPluginHook(context, resolvedPlugin, pluginHook, ret[hook][variantField].normal);
127
127
  return ret;
128
128
  }
129
- chunk7ZFN37TZ_cjs.addPluginHook(context, resolvedPlugin, pluginHook, ret[hook][variantField][`${pluginHook.order}Ordered`]);
129
+ chunkGKYKBP64_cjs.addPluginHook(context, resolvedPlugin, pluginHook, ret[hook][variantField][`${pluginHook.order}Ordered`]);
130
130
  }
131
131
  } else {
132
132
  this.warn(`Unknown plugin hook field: ${String(hook)}`);
@@ -139,7 +139,7 @@ var PowerlinesEnvironmentContext = class _PowerlinesEnvironmentContext extends c
139
139
  */
140
140
  selectHooks(key, options) {
141
141
  const result = [];
142
- if (chunk7ZFN37TZ_cjs.isUnpluginHookKey(key)) {
142
+ if (chunkGKYKBP64_cjs.isUnpluginHookKey(key)) {
143
143
  const variant = String(key).split(":")[0];
144
144
  if (chunkGNEHIBN4_cjs.isUnpluginBuilderVariant(variant)) {
145
145
  const hooks = this.hooks[variant];
@@ -182,7 +182,7 @@ var PowerlinesEnvironmentContext = class _PowerlinesEnvironmentContext extends c
182
182
  }
183
183
  }
184
184
  }
185
- } else if (chunk7ZFN37TZ_cjs.isPluginHookField(key)) {
185
+ } else if (chunkGKYKBP64_cjs.isPluginHookField(key)) {
186
186
  if (this.hooks[key]) {
187
187
  const fieldHooks = this.hooks[key];
188
188
  if (options?.order) {
@@ -230,5 +230,5 @@ var PowerlinesEnvironmentContext = class _PowerlinesEnvironmentContext extends c
230
230
  };
231
231
 
232
232
  exports.PowerlinesEnvironmentContext = PowerlinesEnvironmentContext;
233
- //# sourceMappingURL=chunk-FEDWFZCN.cjs.map
234
- //# sourceMappingURL=chunk-FEDWFZCN.cjs.map
233
+ //# sourceMappingURL=chunk-IH4B475X.cjs.map
234
+ //# sourceMappingURL=chunk-IH4B475X.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/lib/contexts/environment-context.ts"],"names":["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","PLUGIN_NON_HOOK_FIELDS","includes","reduce","ret","hook","isPluginHookField","pluginHook","isPluginHook","preEnforced","preOrdered","normal","postEnforced","postOrdered","enforce","hookListOrder","bucket","addPluginHook","order","isUnpluginHookField","unpluginPlugin","isSetObject","field","variantField","warn","String","selectHooks","options","isUnpluginHookKey","variant","split","isUnpluginBuilderVariant","fieldHooks","mapHooksToResult","__name","hooksList","map","find","p","name","handler","resolvedConfig"],"mappings":";;;;;;;;;;;AAkEO,IAAMA,4BAAAA,GAAN,MAAMA,6BAAAA,SAGHC,mCAAAA,CAAAA;EArEV;;;;;;AA2EE,EAAA,MAAA,GAAoD,EAAC;;;;;;;;EAWrD,aAAoBC,UAAAA,CAGlBC,iBACAC,MAAAA,EACwD;AACxD,IAAA,MAAMC,OAAAA,GAAU,IAAIL,6BAAAA,CAClBI,MAAAA,EACAD,eAAAA,CAAAA;AAEF,IAAA,MAAME,QAAQC,IAAAA,EAAI;AAElB,IAAA,MAAMC,cAAAA,GAAiB,MAAMC,sBAAAA,CAAe,YAAA,CAAA;AAC5C,IAAA,IAAI,CAACD,cAAAA,EAAgB;AACnB,MAAA,MAAM,IAAIE,MAAM,kDAAA,CAAA;AAClB,IAAA;AAEAJ,IAAAA,OAAAA,CAAQE,cAAAA,GAAiBA,cAAAA;AAEzB,IAAA,OAAOF,OAAAA;AACT,EAAA;;;;AAKOK,EAAAA,WAAAA;;;;AAKAC,EAAAA,OAAAA,GAAuD,EAAA;;;;AAK9D,EAAA,IAAoBP,MAAAA,GAA0B;AAC5C,IAAA,OAAO,KAAA,CAAMA,MAAAA;AACf,EAAA;AAEA,EAAA,IAAWQ,KAAAA,GAAmD;AAC5D,IAAA,OAAO,IAAA,CAAK,MAAA;AACd,EAAA;AAEA,EAAA,MAAaC,UAAUC,MAAAA,EAAgD;AACrE,IAAA,IAAIC,cAAAA,GAAiBD,MAAAA;AACrB,IAAA,IAAIE,qBAAAA,CAAWF,MAAAA,CAAOG,kBAAkB,CAAA,EAAG;AACzC,M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AAAA,CAAOW,IAAAA,CAAI,GAAI,IAAA,CAAK4B,WAAAA,CAAY1B,GAAAA,EAAK;YAAEkB,KAAAA,EAAO;AAAO,WAAA,CAAA,CAAA;AACvD,QAAA;AACF,MAAA;IACF,CAAA,MAAO;AACL,MAAA,MAAM,IAAIxC,KAAAA,CAAM,CAAA,yBAAA,EAA4B+C,MAAAA,CAAOzB,GAAAA,CAAAA,CAAAA,CAAM,CAAA;AAC3D,IAAA;AAEA,IAAA,OAAOb,MAAAA;AACT,EAAA;AAEA,EAAA,WAAA,CACEd,QACAD,eAAAA,EACA;AACA,IAAA,KAAA,CAAMA,eAAAA,CAAAA;AAEN,IAAA,IAAA,CAAKqE,cAAAA,GAAiBpE,MAAAA;AACxB,EAAA;AACF","file":"chunk-FEDWFZCN.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 { resolvePackage } from \"@stryke/fs/resolve\";\nimport { isFunction } from \"@stryke/type-checks/is-function\";\nimport { isObject } from \"@stryke/type-checks/is-object\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { ArrayValues } from \"@stryke/types/array\";\nimport { AnyFunction } from \"@stryke/types/base\";\nimport {\n addPluginHook,\n isPlugin,\n isPluginConfig,\n isPluginHook,\n isPluginHookField,\n isUnpluginHookField,\n isUnpluginHookKey\n} from \"../../plugin-utils/helpers\";\nimport { PluginConfig, WorkspaceConfig } from \"../../types/config\";\nimport {\n EnvironmentContext,\n EnvironmentContextPlugin,\n PluginContext,\n SelectHookResult,\n SelectHookResultItem,\n SelectHooksOptions\n} from \"../../types/context\";\nimport {\n HookFields,\n HookListOrders,\n HooksList,\n InferHooksListItem,\n PluginHooksListItem,\n UnpluginHookList,\n UnpluginHooksListItem\n} from \"../../types/hooks\";\nimport {\n Plugin,\n PLUGIN_NON_HOOK_FIELDS,\n PluginHook,\n PluginHookFields\n} from \"../../types/plugin\";\nimport {\n EnvironmentResolvedConfig,\n ResolvedConfig\n} from \"../../types/resolved\";\nimport { UnpluginOptions } from \"../../types/unplugin\";\nimport { isUnpluginBuilderVariant } from \"../unplugin/helpers\";\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) as Promise<any>\n )) as boolean | PluginConfig<PluginContext<TResolvedConfig>>;\n\n if (!result || (isObject(result) && Object.keys(result).length === 0)) {\n return;\n }\n\n if (isPluginConfig<PluginContext<TResolvedConfig>>(result)) {\n return this.$$internal.addPlugin(result);\n }\n\n resolvedPlugin = isPlugin<PluginContext<TResolvedConfig>>(result)\n ? result\n : 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 HookFields<PluginContext<TResolvedConfig>>;\n\n if (isPluginHookField<PluginContext<TResolvedConfig>>(hook)) {\n const pluginHook = resolvedPlugin[hook];\n if (!isPluginHook(pluginHook)) {\n return ret;\n }\n\n ret[hook] ??= {\n preEnforced: [],\n preOrdered: [],\n normal: [],\n postEnforced: [],\n postOrdered: []\n };\n\n if (resolvedPlugin.enforce) {\n const hookListOrder =\n `${resolvedPlugin.enforce}Enforced` as HookListOrders;\n ret[hook][hookListOrder] ??= [];\n\n const bucket = ret[hook][hookListOrder];\n addPluginHook<\n PluginContext<TResolvedConfig>,\n PluginHookFields<PluginContext<TResolvedConfig>>\n >(context, resolvedPlugin, pluginHook, bucket);\n\n return ret;\n }\n\n if (isFunction(pluginHook) || !pluginHook.order) {\n ret[hook].normal ??= [];\n\n const bucket = ret[hook].normal;\n addPluginHook<\n PluginContext<TResolvedConfig>,\n PluginHookFields<PluginContext<TResolvedConfig>>\n >(context, resolvedPlugin, pluginHook, bucket);\n\n return ret;\n }\n\n const hookListOrder = `${pluginHook.order}Ordered` as HookListOrders;\n ret[hook][hookListOrder] ??= [];\n\n addPluginHook(\n context,\n resolvedPlugin,\n pluginHook,\n ret[hook][hookListOrder] as PluginHooksListItem<\n PluginContext<TResolvedConfig>\n >[]\n );\n\n return ret;\n } else if (isUnpluginHookField(hook)) {\n const unpluginPlugin = resolvedPlugin[hook];\n if (!isSetObject(unpluginPlugin)) {\n return ret;\n }\n\n for (const field of Object.keys(unpluginPlugin)) {\n const variantField = field as keyof UnpluginOptions[typeof hook];\n\n const pluginHook = unpluginPlugin[\n variantField\n ] as PluginHook<AnyFunction>;\n if (!isPluginHook(pluginHook)) {\n continue;\n }\n\n ret[hook] ??= {};\n (ret[hook][variantField] as UnpluginHookList<\n PluginContext<TResolvedConfig>,\n typeof variantField\n >) ??= {\n preEnforced: [],\n preOrdered: [],\n normal: [],\n postEnforced: [],\n postOrdered: []\n };\n\n if (resolvedPlugin.enforce) {\n addPluginHook(\n context,\n resolvedPlugin,\n pluginHook,\n ret[hook][variantField][\n `${resolvedPlugin.enforce}Enforced`\n ] as UnpluginHooksListItem<PluginContext<TResolvedConfig>>[]\n );\n\n return ret;\n }\n\n if (isFunction(pluginHook) || !pluginHook.order) {\n addPluginHook(\n context,\n resolvedPlugin,\n pluginHook,\n (\n ret[hook][variantField] as UnpluginHookList<\n PluginContext<TResolvedConfig>,\n typeof variantField\n >\n ).normal!\n );\n\n return ret;\n }\n\n addPluginHook(\n context,\n resolvedPlugin,\n pluginHook,\n ret[hook][variantField][\n `${pluginHook.order}Ordered`\n ] as UnpluginHooksListItem<PluginContext<TResolvedConfig>>[]\n );\n }\n } else {\n this.warn(`Unknown plugin hook field: ${String(hook)}`);\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 string>(\n key: TKey,\n options?: SelectHooksOptions\n ): SelectHookResult<PluginContext<TResolvedConfig>, TKey> {\n const result = [] as SelectHookResult<PluginContext<TResolvedConfig>, TKey>;\n\n if (isUnpluginHookKey(key)) {\n const variant = String(key).split(\":\")[0];\n if (isUnpluginBuilderVariant(variant)) {\n const hooks = this.hooks[variant];\n if (hooks) {\n const field = String(key).split(\":\")[1] as keyof typeof hooks;\n if (field && hooks[field]) {\n const fieldHooks = hooks[field] as Record<\n HookListOrders,\n InferHooksListItem<PluginContext<TResolvedConfig>, TKey>[]\n >;\n\n if (options?.order) {\n const mapHooksToResult = (\n hooksList: InferHooksListItem<\n PluginContext<TResolvedConfig>,\n TKey\n >[]\n ): SelectHookResult<PluginContext<TResolvedConfig>, TKey> =>\n hooksList.map(hook => {\n const plugin = this.plugins.find(\n p => p.plugin.name === hook.plugin.name\n );\n if (!plugin) {\n throw new Error(\n `Could not find plugin context for plugin \"${\n hook.plugin.name\n }\".`\n );\n }\n\n return {\n handler: hook.handler,\n plugin: hook.plugin,\n context: plugin.context\n } as SelectHookResultItem<\n PluginContext<TResolvedConfig>,\n TKey\n >;\n });\n\n if (options?.order === \"pre\") {\n result.push(...mapHooksToResult(fieldHooks.preOrdered ?? []));\n result.push(...mapHooksToResult(fieldHooks.preEnforced ?? []));\n } else if (options?.order === \"post\") {\n result.push(...mapHooksToResult(fieldHooks.postOrdered ?? []));\n result.push(...mapHooksToResult(fieldHooks.postEnforced ?? []));\n } else {\n result.push(...mapHooksToResult(fieldHooks.normal ?? []));\n }\n } else {\n result.push(...this.selectHooks(key, { order: \"pre\" }));\n result.push(...this.selectHooks(key, { order: \"normal\" }));\n result.push(...this.selectHooks(key, { order: \"post\" }));\n }\n }\n }\n }\n } else if (isPluginHookField<PluginContext<TResolvedConfig>>(key)) {\n if (this.hooks[key]) {\n const fieldHooks = this.hooks[key] as Record<\n HookListOrders,\n InferHooksListItem<PluginContext<TResolvedConfig>, TKey>[]\n >;\n\n if (options?.order) {\n const mapHooksToResult = (\n hooksList: InferHooksListItem<\n PluginContext<TResolvedConfig>,\n TKey\n >[]\n ): SelectHookResult<PluginContext<TResolvedConfig>, TKey> =>\n hooksList.map(hook => {\n const plugin = this.plugins.find(\n p => p.plugin.name === hook.plugin.name\n );\n if (!plugin) {\n throw new Error(\n `Could not find plugin context for plugin \"${\n hook.plugin.name\n }\".`\n );\n }\n\n return {\n handler: hook.handler,\n plugin: hook.plugin,\n context: plugin.context\n } as SelectHookResultItem<PluginContext<TResolvedConfig>, TKey>;\n });\n\n if (options?.order === \"pre\") {\n result.push(...mapHooksToResult(fieldHooks.preOrdered ?? []));\n result.push(...mapHooksToResult(fieldHooks.preEnforced ?? []));\n } else if (options?.order === \"post\") {\n result.push(...mapHooksToResult(fieldHooks.postOrdered ?? []));\n result.push(...mapHooksToResult(fieldHooks.postEnforced ?? []));\n } else {\n result.push(...mapHooksToResult(fieldHooks.normal ?? []));\n }\n } else {\n result.push(...this.selectHooks(key, { order: \"pre\" }));\n result.push(...this.selectHooks(key, { order: \"normal\" }));\n result.push(...this.selectHooks(key, { order: \"post\" }));\n }\n }\n } else {\n throw new Error(`Unknown plugin hook key: ${String(key)}`);\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/lib/contexts/environment-context.ts"],"names":["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","PLUGIN_NON_HOOK_FIELDS","includes","reduce","ret","hook","isPluginHookField","pluginHook","isPluginHook","preEnforced","preOrdered","normal","postEnforced","postOrdered","enforce","hookListOrder","bucket","addPluginHook","order","isUnpluginHookField","unpluginPlugin","isSetObject","field","variantField","warn","String","selectHooks","options","isUnpluginHookKey","variant","split","isUnpluginBuilderVariant","fieldHooks","mapHooksToResult","__name","hooksList","map","find","p","name","handler","resolvedConfig"],"mappings":";;;;;;;;;;;AAkEO,IAAMA,4BAAAA,GAAN,MAAMA,6BAAAA,SAGHC,mCAAAA,CAAAA;EArEV;;;;;;AA2EE,EAAA,MAAA,GAAoD,EAAC;;;;;;;;EAWrD,aAAoBC,UAAAA,CAGlBC,iBACAC,MAAAA,EACwD;AACxD,IAAA,MAAMC,OAAAA,GAAU,IAAIL,6BAAAA,CAClBI,MAAAA,EACAD,eAAAA,CAAAA;AAEF,IAAA,MAAME,QAAQC,IAAAA,EAAI;AAElB,IAAA,MAAMC,cAAAA,GAAiB,MAAMC,sBAAAA,CAAe,YAAA,CAAA;AAC5C,IAAA,IAAI,CAACD,cAAAA,EAAgB;AACnB,MAAA,MAAM,IAAIE,MAAM,kDAAA,CAAA;AAClB,IAAA;AAEAJ,IAAAA,OAAAA,CAAQE,cAAAA,GAAiBA,cAAAA;AAEzB,IAAA,OAAOF,OAAAA;AACT,EAAA;;;;AAKOK,EAAAA,WAAAA;;;;AAKAC,EAAAA,OAAAA,GAAuD,EAAA;;;;AAK9D,EAAA,IAAoBP,MAAAA,GAA0B;AAC5C,IAAA,OAAO,KAAA,CAAMA,MAAAA;AACf,EAAA;AAEA,EAAA,IAAWQ,KAAAA,GAAmD;AAC5D,IAAA,OAAO,IAAA,CAAK,MAAA;AACd,EAAA;AAEA,EAAA,MAAaC,UAAUC,MAAAA,EAAgD;AACrE,IAAA,IAAIC,cAAAA,GAAiBD,MAAAA;AACrB,IAAA,IAAIE,qBAAAA,CAAWF,MAAAA,CAAOG,kBAAkB,CAAA,EAAG;AACzC,MAAA,MAAMC,MAAAA,GAAU,MAAMC,OAAAA,CAAQC,OAAAA,CAC5BN,OAAOG,kBAAAA,CAAmB,IAAA,CAAKP,WAAW,CAAA,CAAA;AAG5C,MAAA,IAAI,CAACQ,MAAAA,IAAWG,iBAAAA,CAASH,MAAAA,CAAAA,IAAWI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,CAAM,CAAA,yBAAA,EAA4B+C,MAAAA,CAAOzB,GAAAA,CAAAA,CAAAA,CAAM,CAAA;AAC3D,IAAA;AAEA,IAAA,OAAOb,MAAAA;AACT,EAAA;AAEA,EAAA,WAAA,CACEd,QACAD,eAAAA,EACA;AACA,IAAA,KAAA,CAAMA,eAAAA,CAAAA;AAEN,IAAA,IAAA,CAAKqE,cAAAA,GAAiBpE,MAAAA;AACxB,EAAA;AACF","file":"chunk-IH4B475X.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 { resolvePackage } from \"@stryke/fs/resolve\";\nimport { isFunction } from \"@stryke/type-checks/is-function\";\nimport { isObject } from \"@stryke/type-checks/is-object\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { ArrayValues } from \"@stryke/types/array\";\nimport { AnyFunction } from \"@stryke/types/base\";\nimport {\n addPluginHook,\n isPlugin,\n isPluginConfig,\n isPluginHook,\n isPluginHookField,\n isUnpluginHookField,\n isUnpluginHookKey\n} from \"../../plugin-utils/helpers\";\nimport { PluginConfig, WorkspaceConfig } from \"../../types/config\";\nimport {\n EnvironmentContext,\n EnvironmentContextPlugin,\n PluginContext,\n SelectHookResult,\n SelectHookResultItem,\n SelectHooksOptions\n} from \"../../types/context\";\nimport {\n HookFields,\n HookListOrders,\n HooksList,\n InferHooksListItem,\n PluginHooksListItem,\n UnpluginHookList,\n UnpluginHooksListItem\n} from \"../../types/hooks\";\nimport {\n Plugin,\n PLUGIN_NON_HOOK_FIELDS,\n PluginHook,\n PluginHookFields\n} from \"../../types/plugin\";\nimport {\n EnvironmentResolvedConfig,\n ResolvedConfig\n} from \"../../types/resolved\";\nimport { UnpluginOptions } from \"../../types/unplugin\";\nimport { isUnpluginBuilderVariant } from \"../unplugin/helpers\";\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) as Promise<any>\n )) as boolean | PluginConfig<PluginContext<TResolvedConfig>>;\n\n if (!result || (isObject(result) && Object.keys(result).length === 0)) {\n return;\n }\n\n if (isPluginConfig<PluginContext<TResolvedConfig>>(result)) {\n return this.$$internal.addPlugin(result);\n }\n\n resolvedPlugin = isPlugin<PluginContext<TResolvedConfig>>(result)\n ? result\n : 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 HookFields<PluginContext<TResolvedConfig>>;\n\n if (isPluginHookField<PluginContext<TResolvedConfig>>(hook)) {\n const pluginHook = resolvedPlugin[hook];\n if (!isPluginHook(pluginHook)) {\n return ret;\n }\n\n ret[hook] ??= {\n preEnforced: [],\n preOrdered: [],\n normal: [],\n postEnforced: [],\n postOrdered: []\n };\n\n if (resolvedPlugin.enforce) {\n const hookListOrder =\n `${resolvedPlugin.enforce}Enforced` as HookListOrders;\n ret[hook][hookListOrder] ??= [];\n\n const bucket = ret[hook][hookListOrder];\n addPluginHook<\n PluginContext<TResolvedConfig>,\n PluginHookFields<PluginContext<TResolvedConfig>>\n >(context, resolvedPlugin, pluginHook, bucket);\n\n return ret;\n }\n\n if (isFunction(pluginHook) || !pluginHook.order) {\n ret[hook].normal ??= [];\n\n const bucket = ret[hook].normal;\n addPluginHook<\n PluginContext<TResolvedConfig>,\n PluginHookFields<PluginContext<TResolvedConfig>>\n >(context, resolvedPlugin, pluginHook, bucket);\n\n return ret;\n }\n\n const hookListOrder = `${pluginHook.order}Ordered` as HookListOrders;\n ret[hook][hookListOrder] ??= [];\n\n addPluginHook(\n context,\n resolvedPlugin,\n pluginHook,\n ret[hook][hookListOrder] as PluginHooksListItem<\n PluginContext<TResolvedConfig>\n >[]\n );\n\n return ret;\n } else if (isUnpluginHookField(hook)) {\n const unpluginPlugin = resolvedPlugin[hook];\n if (!isSetObject(unpluginPlugin)) {\n return ret;\n }\n\n for (const field of Object.keys(unpluginPlugin)) {\n const variantField = field as keyof UnpluginOptions[typeof hook];\n\n const pluginHook = unpluginPlugin[\n variantField\n ] as PluginHook<AnyFunction>;\n if (!isPluginHook(pluginHook)) {\n continue;\n }\n\n ret[hook] ??= {};\n (ret[hook][variantField] as UnpluginHookList<\n PluginContext<TResolvedConfig>,\n typeof variantField\n >) ??= {\n preEnforced: [],\n preOrdered: [],\n normal: [],\n postEnforced: [],\n postOrdered: []\n };\n\n if (resolvedPlugin.enforce) {\n addPluginHook(\n context,\n resolvedPlugin,\n pluginHook,\n ret[hook][variantField][\n `${resolvedPlugin.enforce}Enforced`\n ] as UnpluginHooksListItem<PluginContext<TResolvedConfig>>[]\n );\n\n return ret;\n }\n\n if (isFunction(pluginHook) || !pluginHook.order) {\n addPluginHook(\n context,\n resolvedPlugin,\n pluginHook,\n (\n ret[hook][variantField] as UnpluginHookList<\n PluginContext<TResolvedConfig>,\n typeof variantField\n >\n ).normal!\n );\n\n return ret;\n }\n\n addPluginHook(\n context,\n resolvedPlugin,\n pluginHook,\n ret[hook][variantField][\n `${pluginHook.order}Ordered`\n ] as UnpluginHooksListItem<PluginContext<TResolvedConfig>>[]\n );\n }\n } else {\n this.warn(`Unknown plugin hook field: ${String(hook)}`);\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 string>(\n key: TKey,\n options?: SelectHooksOptions\n ): SelectHookResult<PluginContext<TResolvedConfig>, TKey> {\n const result = [] as SelectHookResult<PluginContext<TResolvedConfig>, TKey>;\n\n if (isUnpluginHookKey(key)) {\n const variant = String(key).split(\":\")[0];\n if (isUnpluginBuilderVariant(variant)) {\n const hooks = this.hooks[variant];\n if (hooks) {\n const field = String(key).split(\":\")[1] as keyof typeof hooks;\n if (field && hooks[field]) {\n const fieldHooks = hooks[field] as Record<\n HookListOrders,\n InferHooksListItem<PluginContext<TResolvedConfig>, TKey>[]\n >;\n\n if (options?.order) {\n const mapHooksToResult = (\n hooksList: InferHooksListItem<\n PluginContext<TResolvedConfig>,\n TKey\n >[]\n ): SelectHookResult<PluginContext<TResolvedConfig>, TKey> =>\n hooksList.map(hook => {\n const plugin = this.plugins.find(\n p => p.plugin.name === hook.plugin.name\n );\n if (!plugin) {\n throw new Error(\n `Could not find plugin context for plugin \"${\n hook.plugin.name\n }\".`\n );\n }\n\n return {\n handler: hook.handler,\n plugin: hook.plugin,\n context: plugin.context\n } as SelectHookResultItem<\n PluginContext<TResolvedConfig>,\n TKey\n >;\n });\n\n if (options?.order === \"pre\") {\n result.push(...mapHooksToResult(fieldHooks.preOrdered ?? []));\n result.push(...mapHooksToResult(fieldHooks.preEnforced ?? []));\n } else if (options?.order === \"post\") {\n result.push(...mapHooksToResult(fieldHooks.postOrdered ?? []));\n result.push(...mapHooksToResult(fieldHooks.postEnforced ?? []));\n } else {\n result.push(...mapHooksToResult(fieldHooks.normal ?? []));\n }\n } else {\n result.push(...this.selectHooks(key, { order: \"pre\" }));\n result.push(...this.selectHooks(key, { order: \"normal\" }));\n result.push(...this.selectHooks(key, { order: \"post\" }));\n }\n }\n }\n }\n } else if (isPluginHookField<PluginContext<TResolvedConfig>>(key)) {\n if (this.hooks[key]) {\n const fieldHooks = this.hooks[key] as Record<\n HookListOrders,\n InferHooksListItem<PluginContext<TResolvedConfig>, TKey>[]\n >;\n\n if (options?.order) {\n const mapHooksToResult = (\n hooksList: InferHooksListItem<\n PluginContext<TResolvedConfig>,\n TKey\n >[]\n ): SelectHookResult<PluginContext<TResolvedConfig>, TKey> =>\n hooksList.map(hook => {\n const plugin = this.plugins.find(\n p => p.plugin.name === hook.plugin.name\n );\n if (!plugin) {\n throw new Error(\n `Could not find plugin context for plugin \"${\n hook.plugin.name\n }\".`\n );\n }\n\n return {\n handler: hook.handler,\n plugin: hook.plugin,\n context: plugin.context\n } as SelectHookResultItem<PluginContext<TResolvedConfig>, TKey>;\n });\n\n if (options?.order === \"pre\") {\n result.push(...mapHooksToResult(fieldHooks.preOrdered ?? []));\n result.push(...mapHooksToResult(fieldHooks.preEnforced ?? []));\n } else if (options?.order === \"post\") {\n result.push(...mapHooksToResult(fieldHooks.postOrdered ?? []));\n result.push(...mapHooksToResult(fieldHooks.postEnforced ?? []));\n } else {\n result.push(...mapHooksToResult(fieldHooks.normal ?? []));\n }\n } else {\n result.push(...this.selectHooks(key, { order: \"pre\" }));\n result.push(...this.selectHooks(key, { order: \"normal\" }));\n result.push(...this.selectHooks(key, { order: \"post\" }));\n }\n }\n } else {\n throw new Error(`Unknown plugin hook key: ${String(key)}`);\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,4 +1,4 @@
1
- import { resolveEntryInputFile, resolveEntryOutput } from './chunk-HZTJTO26.js';
1
+ import { resolveEntryInputFile, resolveEntryOutput } from './chunk-OE4RRA62.js';
2
2
  import { __name } from './chunk-7QVYU63E.js';
3
3
  import { omit } from '@stryke/helpers/omit';
4
4
  import { joinPaths } from '@stryke/path/join-paths';
@@ -122,5 +122,5 @@ export { ${key} };`;
122
122
  __name(extractESBuildConfig, "extractESBuildConfig");
123
123
 
124
124
  export { DEFAULT_ESBUILD_CONFIG, extractESBuildConfig, resolveESBuildEntry };
125
- //# sourceMappingURL=chunk-RP4KHKZQ.js.map
126
- //# sourceMappingURL=chunk-RP4KHKZQ.js.map
125
+ //# sourceMappingURL=chunk-IUXE765Q.js.map
126
+ //# sourceMappingURL=chunk-IUXE765Q.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/lib/build/esbuild.ts"],"names":["DEFAULT_ESBUILD_CONFIG","target","platform","format","write","minify","sourcemap","bundle","treeShaking","keepNames","splitting","logLevel","resolveESBuildEntry","context","entryPoints","reduce","ret","entry","isString","replaceExtension","replacePath","config","sourceRoot","projectRoot","output","resolveEntryOutput","input","resolveEntryInputFile","extractESBuildConfig","inject","build","override","Object","keys","length","fs","writeSync","joinPaths","workspaceConfig","workspaceRoot","artifactsPath","entries","map","key","value","Array","isArray","camelCase","join","defu","alias","builtins","id","path","paths","find","toString","replacement","undefined","variant","omit","mainFields","conditions","define","resolveExtensions","extensions","packages","skipNodeModulesBundle","Boolean","treeshake","outdir","buildPath","tsconfig","tsconfigFilePath","mode","metafile"],"mappings":";;;;;;;;;AAuFO,IAAMA,sBAAAA,GAA8D;EACzEC,MAAAA,EAAQ,QAAA;EACRC,QAAAA,EAAU,SAAA;EACVC,MAAAA,EAAQ,KAAA;EACRC,KAAAA,EAAO,IAAA;EACPC,MAAAA,EAAQ,IAAA;EACRC,SAAAA,EAAW,KAAA;EACXC,MAAAA,EAAQ,IAAA;EACRC,WAAAA,EAAa,IAAA;EACbC,SAAAA,EAAW,IAAA;EACXC,SAAAA,EAAW,IAAA;EACXC,QAAAA,EAAU;AACZ;AASO,SAASC,mBAAAA,CACdC,OAAAA,EACAC,WAAAA,GAAwD,EAAA,EAAE;AAE1D,EAAA,OAAOA,WAAAA,CAAYC,MAAAA,CACjB,CAACC,GAAAA,EAAKC,KAAAA,KAAAA;AACJ,IAAA,IAAIC,QAAAA,CAASD,KAAAA,CAAAA,EAAQ;AACnBD,MAAAA,GAAAA,CACEG,iBACEC,WAAAA,CACEH,KAAAA,EACAJ,QAAQQ,MAAAA,CAAOC,UAAAA,IAAcT,QAAQQ,MAAAA,CAAOE,WAAW,CAAA,CAAA,CAAA,GAGzDH,YACFH,KAAAA,EACAJ,OAAAA,CAAQQ,OAAOC,UAAAA,IAAcT,OAAAA,CAAQQ,OAAOE,WAAW,CAAA;IAE3D,CAAA,MAAO;AACLP,MAAAA,GAAAA,CAAIC,KAAAA,CAAMO,MAAAA,IAAUC,kBAAAA,CAAmBZ,OAAAA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3B,UAAA,GACAtD,OAAAA,CAAQQ,MAAAA,CAAOS,KAAAA,CAAM6B,OAAAA,KAAY,SAAA,GAC9B9C,OAAAA,CAAQQ,MAAAA,CAAOS,MAA6BoC,QAAAA,GAC7CR,MAAAA;AACNvD,IAAAA,MAAAA,EAAS0C,KAAAA,CAAMC,OAAAA,CAAQjC,OAAAA,CAAQQ,MAAAA,CAAOG,OAAOrB,MAAM,CAAA,GAC/CU,OAAAA,CAAQQ,MAAAA,CAAOG,OAAOrB,MAAAA,CAAO,CAAA,CAAA,GAC7BU,OAAAA,CAAQQ,OAAOG,MAAAA,CAAOrB,MAAAA;IAC1BD,QAAAA,EAAUW,OAAAA,CAAQQ,OAAOS,KAAAA,CAAM5B,QAAAA;IAC/BM,WAAAA,EACE4D,OAAAA,CAASvD,QAAQQ,MAAAA,CAAOS,KAAAA,EAA2BuC,SAAAA,CAAAA,IAClDxD,OAAAA,CAAQQ,OAAOS,KAAAA,EAA8BtB,WAAAA;IAChD8D,MAAAA,EAAQzD,OAAAA,CAAQQ,OAAOG,MAAAA,CAAO+C,SAAAA;AAC9BC,IAAAA,QAAAA,EAAU3D,QAAQ2D,QAAAA,CAASC,gBAAAA;IAC3BpE,MAAAA,EAAQQ,OAAAA,CAAQQ,OAAOqD,IAAAA,KAAS,aAAA;IAChCC,QAAAA,EAAU9D,OAAAA,CAAQQ,OAAOqD,IAAAA,KAAS,aAAA;IAClCpE,SAAAA,EAAWO,OAAAA,CAAQQ,OAAOqD,IAAAA,KAAS;AACrC,GAAA,EACA1E,sBAAAA,CAAAA;AAEJ;AA1IgB4B,MAAAA,CAAAA,oBAAAA,EAAAA,sBAAAA,CAAAA","file":"chunk-RP4KHKZQ.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 { omit } from \"@stryke/helpers/omit\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { replaceExtension, replacePath } from \"@stryke/path/replace\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport defu from \"defu\";\nimport { BuildOptions, Format, LogLevel, Platform } from \"esbuild\";\nimport {\n ESBuildBuildConfig,\n ESBuildResolvedBuildConfig,\n TsupBuildConfig\n} from \"../../types/build\";\nimport { Context } from \"../../types/context\";\nimport type { ResolvedEntryTypeDefinition } from \"../../types/resolved\";\nimport { resolveEntryInputFile, resolveEntryOutput } from \"../entry\";\n\n// const resolverPlugin = (\n// context: Context,\n// options: Pick<\n// BuildResolvedConfig,\n// \"external\" | \"noExternal\" | \"skipNodeModulesBundle\"\n// > = {}\n// ): Plugin => {\n// return {\n// name: \"powerlines:resolver\",\n// setup(build) {\n// const skipNodeModulesBundle =\n// options.skipNodeModulesBundle ??\n// context.config.build.skipNodeModulesBundle;\n// const external = options.external ?? context.config.build.external ?? [];\n// const noExternal =\n// options.noExternal ?? context.config.build.noExternal ?? [];\n// const resolvePatterns = skipNodeModulesBundle\n// ? tsconfigPathsToRegExp(context.tsconfig.options.paths ?? [])\n// : [];\n\n// const handle = async (args: OnResolveArgs) => {\n// const result = await handleResolveId(\n// context,\n// {\n// id: args.path,\n// importer: args.importer,\n// options: {\n// isEntry: false\n// }\n// },\n// {\n// skipNodeModulesBundle,\n// external,\n// noExternal,\n// resolvePatterns\n// }\n// );\n// if (!result) {\n// return;\n// }\n\n// return {\n// path: result?.id,\n// external: result?.external\n// };\n// };\n\n// build.onResolve({ filter: /.*/ }, handle);\n// build.onResolve({ filter: /^storm:/ }, handle);\n// }\n// };\n// };\n\nexport const DEFAULT_ESBUILD_CONFIG: Partial<ESBuildResolvedBuildConfig> = {\n target: \"esnext\",\n platform: \"neutral\" as Platform,\n format: \"esm\" as Format,\n write: true,\n minify: true,\n sourcemap: false,\n bundle: true,\n treeShaking: true,\n keepNames: true,\n splitting: true,\n logLevel: \"silent\" as LogLevel\n};\n\n/**\n * Resolves the entry options for esbuild.\n *\n * @param context - The build context.\n * @param entryPoints - The entry points to resolve.\n * @returns The resolved entry options.\n */\nexport function resolveESBuildEntry(\n context: Context,\n entryPoints: ResolvedEntryTypeDefinition[] | string[] = []\n): ESBuildResolvedBuildConfig[\"entryPoints\"] {\n return entryPoints.reduce(\n (ret, entry) => {\n if (isString(entry)) {\n ret[\n replaceExtension(\n replacePath(\n entry,\n context.config.sourceRoot || context.config.projectRoot\n )\n )\n ] = replacePath(\n entry,\n context.config.sourceRoot || context.config.projectRoot\n );\n } else {\n ret[entry.output || resolveEntryOutput(context, entry.input ?? entry)] =\n resolveEntryInputFile(context, entry.input ?? entry);\n }\n\n return ret;\n },\n {} as Record<string, string>\n );\n}\n\n/**\n * Resolves the esbuild options.\n *\n * @param context - The build context.\n * @returns The resolved esbuild options.\n */\nexport function extractESBuildConfig(context: Context): BuildOptions {\n const inject =\n context.config.build.override.inject ?? context.config.build.inject;\n if (inject && Object.keys(inject).length > 0) {\n context.fs.writeSync(\n joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.projectRoot,\n context.artifactsPath,\n \"inject-shim.js\"\n ),\n Object.entries(inject)\n .map(([key, value]) => {\n if (value) {\n if (Array.isArray(value)) {\n if (camelCase(key) !== key) {\n if (value.length === 1) {\n return `\nimport ${camelCase(key)} from \"${value[0]}\";\nexport { ${camelCase(key)} as \"${key}\" }`;\n } else if (value.length > 1) {\n return `\nimport ${value[1] === \"*\" ? `* as ${camelCase(key)}` : `{ ${value[1]} as ${camelCase(key)} }`} from \"${value[0]}\";\nexport { ${camelCase(key)} as \"${key}\" }`;\n }\n } else if (value.length === 1) {\n return `\nimport ${key} from \"${value[0]}\";\nexport { ${key} };`;\n } else if (value.length > 1) {\n return `\nimport ${value[1] === \"*\" ? `* as ${key}` : `{ ${value[1]} as ${key} }`} from \"${value[0]}\";\nexport { ${key} };`;\n }\n } else if (camelCase(key) !== key) {\n return `\nimport ${camelCase(key)} from \"${value[0]}\";\nexport { ${camelCase(key)} as \"${key}\" }`;\n } else {\n return `\nimport ${key} from \"${value}\";\nexport { ${key} };`;\n }\n }\n\n return \"\";\n })\n .join(\"\\n\")\n );\n }\n\n return defu(\n {\n alias: context.builtins.reduce(\n (ret, id) => {\n if (!ret[id]) {\n const path = context.fs.paths[id];\n if (path) {\n ret[id] = path;\n }\n }\n\n return ret;\n },\n context.config.build.alias\n ? Array.isArray(context.config.build.alias)\n ? context.config.build.alias.reduce(\n (ret, alias) => {\n if (!ret[alias.find.toString()]) {\n ret[alias.find.toString()] = alias.replacement;\n }\n\n return ret;\n },\n {} as Record<string, string>\n )\n : context.config.build.alias\n : {}\n ),\n inject:\n inject && Object.keys(inject).length > 0\n ? [\n joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.projectRoot,\n context.artifactsPath,\n \"inject-shim.js\"\n )\n ]\n : undefined\n },\n context.config.build.variant === \"esbuild\"\n ? (omit(context.config.build.override, [\n \"alias\",\n \"inject\",\n \"external\",\n \"noExternal\",\n \"skipNodeModulesBundle\",\n \"extensions\"\n ]) as BuildOptions)\n : {},\n context.config.build.variant === \"esbuild\"\n ? (omit(context.config.build, [\n \"alias\",\n \"inject\",\n \"external\",\n \"noExternal\",\n \"skipNodeModulesBundle\",\n \"extensions\",\n \"variant\",\n \"override\"\n ]) as BuildOptions)\n : {},\n {\n mainFields: context.config.build.mainFields,\n conditions: context.config.build.conditions,\n define: context.config.build.define,\n resolveExtensions: context.config.build.extensions,\n packages: context.config.build.skipNodeModulesBundle\n ? \"external\"\n : context.config.build.variant === \"esbuild\"\n ? (context.config.build as ESBuildBuildConfig).packages\n : undefined,\n format: (Array.isArray(context.config.output.format)\n ? context.config.output.format[0]\n : context.config.output.format) as Format,\n platform: context.config.build.platform,\n treeShaking:\n Boolean((context.config.build as TsupBuildConfig)?.treeshake) ||\n (context.config.build as ESBuildBuildConfig)?.treeShaking,\n outdir: context.config.output.buildPath,\n tsconfig: context.tsconfig.tsconfigFilePath,\n minify: context.config.mode !== \"development\",\n metafile: context.config.mode === \"development\",\n sourcemap: context.config.mode === \"development\"\n },\n DEFAULT_ESBUILD_CONFIG\n ) as BuildOptions;\n}\n"]}
1
+ {"version":3,"sources":["../../src/lib/build/esbuild.ts"],"names":["DEFAULT_ESBUILD_CONFIG","target","platform","format","write","minify","sourcemap","bundle","treeShaking","keepNames","splitting","logLevel","resolveESBuildEntry","context","entryPoints","reduce","ret","entry","isString","replaceExtension","replacePath","config","sourceRoot","projectRoot","output","resolveEntryOutput","input","resolveEntryInputFile","extractESBuildConfig","inject","build","override","Object","keys","length","fs","writeSync","joinPaths","workspaceConfig","workspaceRoot","artifactsPath","entries","map","key","value","Array","isArray","camelCase","join","defu","alias","builtins","id","path","paths","find","toString","replacement","undefined","variant","omit","mainFields","conditions","define","resolveExtensions","extensions","packages","skipNodeModulesBundle","Boolean","treeshake","outdir","buildPath","tsconfig","tsconfigFilePath","mode","metafile"],"mappings":";;;;;;;;;AAuFO,IAAMA,sBAAAA,GAA8D;EACzEC,MAAAA,EAAQ,QAAA;EACRC,QAAAA,EAAU,SAAA;EACVC,MAAAA,EAAQ,KAAA;EACRC,KAAAA,EAAO,IAAA;EACPC,MAAAA,EAAQ,IAAA;EACRC,SAAAA,EAAW,KAAA;EACXC,MAAAA,EAAQ,IAAA;EACRC,WAAAA,EAAa,IAAA;EACbC,SAAAA,EAAW,IAAA;EACXC,SAAAA,EAAW,IAAA;EACXC,QAAAA,EAAU;AACZ;AASO,SAASC,mBAAAA,CACdC,OAAAA,EACAC,WAAAA,GAAwD,EAAA,EAAE;AAE1D,EAAA,OAAOA,WAAAA,CAAYC,MAAAA,CACjB,CAACC,GAAAA,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AChCC,QAAAA,EAAU9D,OAAAA,CAAQQ,OAAOqD,IAAAA,KAAS,aAAA;IAClCpE,SAAAA,EAAWO,OAAAA,CAAQQ,OAAOqD,IAAAA,KAAS;AACrC,GAAA,EACA1E,sBAAAA,CAAAA;AAEJ;AA1IgB4B,MAAAA,CAAAA,oBAAAA,EAAAA,sBAAAA,CAAAA","file":"chunk-IUXE765Q.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 { omit } from \"@stryke/helpers/omit\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { replaceExtension, replacePath } from \"@stryke/path/replace\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport defu from \"defu\";\nimport { BuildOptions, Format, LogLevel, Platform } from \"esbuild\";\nimport {\n ESBuildBuildConfig,\n ESBuildResolvedBuildConfig,\n TsupBuildConfig\n} from \"../../types/build\";\nimport { Context } from \"../../types/context\";\nimport type { ResolvedEntryTypeDefinition } from \"../../types/resolved\";\nimport { resolveEntryInputFile, resolveEntryOutput } from \"../entry\";\n\n// const resolverPlugin = (\n// context: Context,\n// options: Pick<\n// BuildResolvedConfig,\n// \"external\" | \"noExternal\" | \"skipNodeModulesBundle\"\n// > = {}\n// ): Plugin => {\n// return {\n// name: \"powerlines:resolver\",\n// setup(build) {\n// const skipNodeModulesBundle =\n// options.skipNodeModulesBundle ??\n// context.config.build.skipNodeModulesBundle;\n// const external = options.external ?? context.config.build.external ?? [];\n// const noExternal =\n// options.noExternal ?? context.config.build.noExternal ?? [];\n// const resolvePatterns = skipNodeModulesBundle\n// ? tsconfigPathsToRegExp(context.tsconfig.options.paths ?? [])\n// : [];\n\n// const handle = async (args: OnResolveArgs) => {\n// const result = await handleResolveId(\n// context,\n// {\n// id: args.path,\n// importer: args.importer,\n// options: {\n// isEntry: false\n// }\n// },\n// {\n// skipNodeModulesBundle,\n// external,\n// noExternal,\n// resolvePatterns\n// }\n// );\n// if (!result) {\n// return;\n// }\n\n// return {\n// path: result?.id,\n// external: result?.external\n// };\n// };\n\n// build.onResolve({ filter: /.*/ }, handle);\n// build.onResolve({ filter: /^storm:/ }, handle);\n// }\n// };\n// };\n\nexport const DEFAULT_ESBUILD_CONFIG: Partial<ESBuildResolvedBuildConfig> = {\n target: \"esnext\",\n platform: \"neutral\" as Platform,\n format: \"esm\" as Format,\n write: true,\n minify: true,\n sourcemap: false,\n bundle: true,\n treeShaking: true,\n keepNames: true,\n splitting: true,\n logLevel: \"silent\" as LogLevel\n};\n\n/**\n * Resolves the entry options for esbuild.\n *\n * @param context - The build context.\n * @param entryPoints - The entry points to resolve.\n * @returns The resolved entry options.\n */\nexport function resolveESBuildEntry(\n context: Context,\n entryPoints: ResolvedEntryTypeDefinition[] | string[] = []\n): ESBuildResolvedBuildConfig[\"entryPoints\"] {\n return entryPoints.reduce(\n (ret, entry) => {\n if (isString(entry)) {\n ret[\n replaceExtension(\n replacePath(\n entry,\n context.config.sourceRoot || context.config.projectRoot\n )\n )\n ] = replacePath(\n entry,\n context.config.sourceRoot || context.config.projectRoot\n );\n } else {\n ret[entry.output || resolveEntryOutput(context, entry.input ?? entry)] =\n resolveEntryInputFile(context, entry.input ?? entry);\n }\n\n return ret;\n },\n {} as Record<string, string>\n );\n}\n\n/**\n * Resolves the esbuild options.\n *\n * @param context - The build context.\n * @returns The resolved esbuild options.\n */\nexport function extractESBuildConfig(context: Context): BuildOptions {\n const inject =\n context.config.build.override.inject ?? context.config.build.inject;\n if (inject && Object.keys(inject).length > 0) {\n context.fs.writeSync(\n joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.projectRoot,\n context.artifactsPath,\n \"inject-shim.js\"\n ),\n Object.entries(inject)\n .map(([key, value]) => {\n if (value) {\n if (Array.isArray(value)) {\n if (camelCase(key) !== key) {\n if (value.length === 1) {\n return `\nimport ${camelCase(key)} from \"${value[0]}\";\nexport { ${camelCase(key)} as \"${key}\" }`;\n } else if (value.length > 1) {\n return `\nimport ${value[1] === \"*\" ? `* as ${camelCase(key)}` : `{ ${value[1]} as ${camelCase(key)} }`} from \"${value[0]}\";\nexport { ${camelCase(key)} as \"${key}\" }`;\n }\n } else if (value.length === 1) {\n return `\nimport ${key} from \"${value[0]}\";\nexport { ${key} };`;\n } else if (value.length > 1) {\n return `\nimport ${value[1] === \"*\" ? `* as ${key}` : `{ ${value[1]} as ${key} }`} from \"${value[0]}\";\nexport { ${key} };`;\n }\n } else if (camelCase(key) !== key) {\n return `\nimport ${camelCase(key)} from \"${value[0]}\";\nexport { ${camelCase(key)} as \"${key}\" }`;\n } else {\n return `\nimport ${key} from \"${value}\";\nexport { ${key} };`;\n }\n }\n\n return \"\";\n })\n .join(\"\\n\")\n );\n }\n\n return defu(\n {\n alias: context.builtins.reduce(\n (ret, id) => {\n if (!ret[id]) {\n const path = context.fs.paths[id];\n if (path) {\n ret[id] = path;\n }\n }\n\n return ret;\n },\n context.config.build.alias\n ? Array.isArray(context.config.build.alias)\n ? context.config.build.alias.reduce(\n (ret, alias) => {\n if (!ret[alias.find.toString()]) {\n ret[alias.find.toString()] = alias.replacement;\n }\n\n return ret;\n },\n {} as Record<string, string>\n )\n : context.config.build.alias\n : {}\n ),\n inject:\n inject && Object.keys(inject).length > 0\n ? [\n joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.projectRoot,\n context.artifactsPath,\n \"inject-shim.js\"\n )\n ]\n : undefined\n },\n context.config.build.variant === \"esbuild\"\n ? (omit(context.config.build.override, [\n \"alias\",\n \"inject\",\n \"external\",\n \"noExternal\",\n \"skipNodeModulesBundle\",\n \"extensions\"\n ]) as BuildOptions)\n : {},\n context.config.build.variant === \"esbuild\"\n ? (omit(context.config.build, [\n \"alias\",\n \"inject\",\n \"external\",\n \"noExternal\",\n \"skipNodeModulesBundle\",\n \"extensions\",\n \"variant\",\n \"override\"\n ]) as BuildOptions)\n : {},\n {\n mainFields: context.config.build.mainFields,\n conditions: context.config.build.conditions,\n define: context.config.build.define,\n resolveExtensions: context.config.build.extensions,\n packages: context.config.build.skipNodeModulesBundle\n ? \"external\"\n : context.config.build.variant === \"esbuild\"\n ? (context.config.build as ESBuildBuildConfig).packages\n : undefined,\n format: (Array.isArray(context.config.output.format)\n ? context.config.output.format[0]\n : context.config.output.format) as Format,\n platform: context.config.build.platform,\n treeShaking:\n Boolean((context.config.build as TsupBuildConfig)?.treeshake) ||\n (context.config.build as ESBuildBuildConfig)?.treeShaking,\n outdir: context.config.output.buildPath,\n tsconfig: context.tsconfig.tsconfigFilePath,\n minify: context.config.mode !== \"development\",\n metafile: context.config.mode === \"development\",\n sourcemap: context.config.mode === \"development\"\n },\n DEFAULT_ESBUILD_CONFIG\n ) as BuildOptions;\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { extractESBuildConfig } from './chunk-RP4KHKZQ.js';
1
+ import { extractESBuildConfig } from './chunk-IUXE765Q.js';
2
2
  import { __name } from './chunk-7QVYU63E.js';
3
3
  import { LogLevelLabel } from '@storm-software/config-tools/types';
4
4
  import { build } from 'esbuild';
@@ -37,5 +37,5 @@ async function bundle(context, file, overrides = {}) {
37
37
  __name(bundle, "bundle");
38
38
 
39
39
  export { bundle };
40
- //# sourceMappingURL=chunk-P7Z77YMX.js.map
41
- //# sourceMappingURL=chunk-P7Z77YMX.js.map
40
+ //# sourceMappingURL=chunk-KQGACHG6.js.map
41
+ //# sourceMappingURL=chunk-KQGACHG6.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/lib/utilities/bundle.ts"],"names":["bundle","context","file","overrides","path","fs","resolve","existsSync","Error","result","build","extractESBuildConfig","entryPoints","write","sourcemap","splitting","treeShaking","packages","platform","logLevel","errors","length","map","error","text","join","warnings","log","LogLevelLabel","WARN","warning","outputFiles","filter","Boolean"],"mappings":";;;;;AAgCA,eAAsBA,MAAAA,CACpBC,OAAAA,EACAC,IAAAA,EACAC,SAAAA,GAAiD,EAAC,EAAC;AAEnD,EAAA,MAAMC,IAAAA,GAAO,MAAMH,OAAAA,CAAQI,EAAAA,CAAGC,QAAQJ,IAAAA,CAAAA;AACtC,EAAA,IAAI,CAACE,IAAAA,IAAQ,CAACH,QAAQI,EAAAA,CAAGE,UAAAA,CAAWH,IAAAA,CAAAA,EAAO;AACzC,IAAA,MAAM,IAAII,KAAAA,CACR,CAAA,mBAAA,EAAsBN,IAAAA,CAAAA,uCAAAA,CAA6C,CAAA;AAEvE,EAAA;AAEA,EAAA,MAAMO,MAAAA,GAAS,MAAMC,KAAAA,CAAM;AACzB,IAAA,GAAGC,qBAAqBV,OAAAA,CAAAA;IACxBW,WAAAA,EAAa;AAACR,MAAAA;;IACdS,KAAAA,EAAO,KAAA;IACPC,SAAAA,EAAW,KAAA;IACXC,SAAAA,EAAW,KAAA;IACXC,WAAAA,EAAa,KAAA;IACbhB,MAAAA,EAAQ,IAAA;IACRiB,QAAAA,EAAU,UAAA;IACVC,QAAAA,EAAU,MAAA;IACVC,QAAAA,EAAU,QAAA;IACV,GAAGhB;GACL,CAAA;AACA,EAAA,IAAIM,MAAAA,CAAOW,MAAAA,CAAOC,MAAAA,GAAS,CAAA,EAAG;AAC5B,IAAA,MAAM,IAAIb,KAAAA,CACR,CAAA,oBAAA,EAAuBN,IAAAA,CAAAA,EAAAA,EAASO,OAAOW,MAAAA,CACpCE,GAAAA,CAAIC,CAAAA,KAAAA,KAASA,MAAMC,IAAI,CAAA,CACvBC,IAAAA,CAAK,IAAA,CAAA,CAAA,CAAO,CAAA;AAEnB,EAAA;AACA,EAAA,IAAIhB,MAAAA,CAAOiB,QAAAA,CAASL,MAAAA,GAAS,CAAA,EAAG;AAC9BpB,IAAAA,OAAAA,CAAQ0B,IACNC,aAAAA,CAAcC,IAAAA,EACd,CAAA,2BAAA,EAA8B3B,IAAAA,KAASO,MAAAA,CAAOiB,QAAAA,CAC3CJ,GAAAA,CAAIQ,CAAAA,YAAWA,OAAAA,CAAQN,IAAI,EAC3BC,IAAAA,CAAK,IAAA,CAAA,CAAA,CAAO,CAAA;AAEnB,EAAA;AACA,EAAA,IAAI,CAAChB,OAAOsB,WAAAA,IAAetB,MAAAA,CAAOsB,YAAYC,MAAAA,CAAOC,OAAAA,CAAAA,CAASZ,MAAAA,KAAW,CAAA,EAAG;AAC1E,IAAA,MAAM,IAAIb,KAAAA,CACR,CAAA,8BAAA,EACEN,IAAAA,CAAAA,+CAAAA,CAC+C,CAAA;AAErD,EAAA;AAEA,EAAA,OAAOO,MAAAA,CAAOsB,WAAAA,CAAYC,MAAAA,CAAOC,OAAAA,EAAS,CAAA,CAAA;AAC5C;AAjDsBjC,MAAAA,CAAAA,MAAAA,EAAAA,QAAAA,CAAAA","file":"chunk-P7Z77YMX.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 { LogLevelLabel } from \"@storm-software/config-tools/types\";\nimport { build, BuildOptions, OutputFile } from \"esbuild\";\nimport { ESBuildResolvedBuildConfig } from \"../../types/build\";\nimport { Context } from \"../../types/context\";\nimport { extractESBuildConfig } from \"../build/esbuild\";\n\n/**\n * Bundle a type definition to a module.\n *\n * @param context - The context object containing the environment paths.\n * @param file - The file path to bundle.\n * @param overrides - Optional overrides for the ESBuild configuration.\n * @returns A promise that resolves to the bundled module.\n */\nexport async function bundle(\n context: Context,\n file: string,\n overrides: Partial<ESBuildResolvedBuildConfig> = {}\n): Promise<OutputFile> {\n const path = await context.fs.resolve(file);\n if (!path || !context.fs.existsSync(path)) {\n throw new Error(\n `Module not found: \"${file}\". Please check the path and try again.`\n );\n }\n\n const result = await build({\n ...extractESBuildConfig(context),\n entryPoints: [path],\n write: false,\n sourcemap: false,\n splitting: false,\n treeShaking: false,\n bundle: true,\n packages: \"external\",\n platform: \"node\",\n logLevel: \"silent\",\n ...overrides\n } as BuildOptions);\n if (result.errors.length > 0) {\n throw new Error(\n `Failed to transpile ${file}: ${result.errors\n .map(error => error.text)\n .join(\", \")}`\n );\n }\n if (result.warnings.length > 0) {\n context.log(\n LogLevelLabel.WARN,\n `Warnings while transpiling ${file}: ${result.warnings\n .map(warning => warning.text)\n .join(\", \")}`\n );\n }\n if (!result.outputFiles || result.outputFiles.filter(Boolean).length === 0) {\n throw new Error(\n `No output files generated for ${\n file\n }. Please check the configuration and try again.`\n );\n }\n\n return result.outputFiles.filter(Boolean)[0]!;\n}\n"]}
1
+ {"version":3,"sources":["../../src/lib/utilities/bundle.ts"],"names":["bundle","context","file","overrides","path","fs","resolve","existsSync","Error","result","build","extractESBuildConfig","entryPoints","write","sourcemap","splitting","treeShaking","packages","platform","logLevel","errors","length","map","error","text","join","warnings","log","LogLevelLabel","WARN","warning","outputFiles","filter","Boolean"],"mappings":";;;;;AAgCA,eAAsBA,MAAAA,CACpBC,OAAAA,EACAC,IAAAA,EACAC,SAAAA,GAAiD,EAAC,EAAC;AAEnD,EAAA,MAAMC,IAAAA,GAAO,MAAMH,OAAAA,CAAQI,EAAAA,CAAGC,QAAQJ,IAAAA,CAAAA;AACtC,EAAA,IAAI,CAACE,IAAAA,IAAQ,CAACH,QAAQI,EAAAA,CAAGE,UAAAA,CAAWH,IAAAA,CAAAA,EAAO;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AA,MAAM,IAAIb,KAAAA,CACR,CAAA,8BAAA,EACEN,IAAAA,CAAAA,+CAAAA,CAC+C,CAAA;AAErD,EAAA;AAEA,EAAA,OAAOO,MAAAA,CAAOsB,WAAAA,CAAYC,MAAAA,CAAOC,OAAAA,EAAS,CAAA,CAAA;AAC5C;AAjDsBjC,MAAAA,CAAAA,MAAAA,EAAAA,QAAAA,CAAAA","file":"chunk-KQGACHG6.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 { LogLevelLabel } from \"@storm-software/config-tools/types\";\nimport { build, BuildOptions, OutputFile } from \"esbuild\";\nimport { ESBuildResolvedBuildConfig } from \"../../types/build\";\nimport { Context } from \"../../types/context\";\nimport { extractESBuildConfig } from \"../build/esbuild\";\n\n/**\n * Bundle a type definition to a module.\n *\n * @param context - The context object containing the environment paths.\n * @param file - The file path to bundle.\n * @param overrides - Optional overrides for the ESBuild configuration.\n * @returns A promise that resolves to the bundled module.\n */\nexport async function bundle(\n context: Context,\n file: string,\n overrides: Partial<ESBuildResolvedBuildConfig> = {}\n): Promise<OutputFile> {\n const path = await context.fs.resolve(file);\n if (!path || !context.fs.existsSync(path)) {\n throw new Error(\n `Module not found: \"${file}\". Please check the path and try again.`\n );\n }\n\n const result = await build({\n ...extractESBuildConfig(context),\n entryPoints: [path],\n write: false,\n sourcemap: false,\n splitting: false,\n treeShaking: false,\n bundle: true,\n packages: \"external\",\n platform: \"node\",\n logLevel: \"silent\",\n ...overrides\n } as BuildOptions);\n if (result.errors.length > 0) {\n throw new Error(\n `Failed to transpile ${file}: ${result.errors\n .map(error => error.text)\n .join(\", \")}`\n );\n }\n if (result.warnings.length > 0) {\n context.log(\n LogLevelLabel.WARN,\n `Warnings while transpiling ${file}: ${result.warnings\n .map(warning => warning.text)\n .join(\", \")}`\n );\n }\n if (!result.outputFiles || result.outputFiles.filter(Boolean).length === 0) {\n throw new Error(\n `No output files generated for ${\n file\n }. Please check the configuration and try again.`\n );\n }\n\n return result.outputFiles.filter(Boolean)[0]!;\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { bundle } from './chunk-P7Z77YMX.js';
1
+ import { bundle } from './chunk-KQGACHG6.js';
2
2
  import { __name } from './chunk-7QVYU63E.js';
3
3
  import { parseTypeDefinition } from '@stryke/convert/parse-type-definition';
4
4
  import { isSetString } from '@stryke/type-checks/is-set-string';
@@ -24,5 +24,5 @@ async function resolve(context, type, overrides = {}) {
24
24
  __name(resolve, "resolve");
25
25
 
26
26
  export { resolve };
27
- //# sourceMappingURL=chunk-OFS5VLIU.js.map
28
- //# sourceMappingURL=chunk-OFS5VLIU.js.map
27
+ //# sourceMappingURL=chunk-LJEWIZNL.js.map
28
+ //# sourceMappingURL=chunk-LJEWIZNL.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/lib/utilities/resolve.ts"],"names":["resolve","context","type","overrides","typeDefinition","isSetString","parseTypeDefinition","result","bundle","file","resolved","resolver","evalModule","text","filename","path","forceTranspile","exportName","name"],"mappings":";;;;;AAoCA,eAAsBA,OAAAA,CACpBC,OAAAA,EACAC,IAAAA,EACAC,SAAAA,GAAiD,EAAC,EAAC;AAEnD,EAAA,IAAIC,cAAAA;AACJ,EAAA,IAAIC,WAAAA,CAAYH,IAAAA,CAAAA,EAAO;AACrBE,IAAAA,cAAAA,GAAiBE,oBAAoBJ,IAAAA,CAAAA;EACvC,CAAA,MAAO;AACLE,IAAAA,cAAAA,GAAiBF,IAAAA;AACnB,EAAA;AAEA,EAAA,MAAMK,SAAS,MAAMC,MAAAA,CAAOP,OAAAA,EAASG,cAAAA,CAAeK,MAAMN,SAAAA,CAAAA;AAE1D,EAAA,MAAMO,WAAY,MAAMT,OAAAA,CAAQU,QAAAA,CAASC,UAAAA,CAAWL,OAAOM,IAAAA,EAAM;AAC/DC,IAAAA,QAAAA,EAAUP,MAAAA,CAAOQ,IAAAA;IACjBC,cAAAA,EAAgB;GAClB,CAAA;AAEA,EAAA,IAAIC,aAAab,cAAAA,CAAec,IAAAA;AAChC,EAAA,IAAI,CAACD,UAAAA,EAAY;AACfA,IAAAA,UAAAA,GAAa,SAAA;AACf,EAAA;AAEA,EAAA,OAAOP,SAASO,UAAAA,CAAAA,IAAeP,QAAAA,CAAS,CAAA,QAAA,EAAMO,UAAAA,CAAAA,CAAY,CAAA;AAC5D;AAzBsBjB,MAAAA,CAAAA,OAAAA,EAAAA,SAAAA,CAAAA","file":"chunk-OFS5VLIU.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 { parseTypeDefinition } from \"@stryke/convert/parse-type-definition\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport {\n TypeDefinition,\n TypeDefinitionParameter\n} from \"@stryke/types/configuration\";\nimport { ESBuildResolvedBuildConfig } from \"../../types/build\";\nimport { Context } from \"../../types/context\";\nimport { bundle } from \"./bundle\";\n\n/**\n * Compiles a type definition to a module.\n *\n * @param context - The context object containing the environment paths.\n * @param type - The type definition to compile. This can be either a string or a {@link TypeDefinition} object.\n * @param overrides - Optional overrides for the ESBuild configuration.\n * @returns A promise that resolves to the compiled module.\n */\nexport async function resolve<TResult = any>(\n context: Context,\n type: TypeDefinitionParameter,\n overrides: Partial<ESBuildResolvedBuildConfig> = {}\n): Promise<TResult> {\n let typeDefinition!: TypeDefinition;\n if (isSetString(type)) {\n typeDefinition = parseTypeDefinition(type) as TypeDefinition;\n } else {\n typeDefinition = type;\n }\n\n const result = await bundle(context, typeDefinition.file, overrides);\n\n const resolved = (await context.resolver.evalModule(result.text, {\n filename: result.path,\n forceTranspile: true\n })) as Record<string, any>;\n\n let exportName = typeDefinition.name;\n if (!exportName) {\n exportName = \"default\";\n }\n\n return resolved[exportName] ?? resolved[`__Ω${exportName}`];\n}\n"]}
1
+ {"version":3,"sources":["../../src/lib/utilities/resolve.ts"],"names":["resolve","context","type","overrides","typeDefinition","isSetString","parseTypeDefinition","result","bundle","file","resolved","resolver","evalModule","text","filename","path","forceTranspile","exportName","name"],"mappings":";;;;;AAoCA,eAAsBA,OAAAA,CACpBC,OAAAA,EACAC,IAAAA,EACAC,SAAAA,GAAiD,EAAC,EAAC;AAEnD,EAAA,IAAIC,cAAAA;AACJ,EAAA,IAAIC,WAAAA,CAAYH,IAAAA,CAAAA,EAAO;AACrBE,IAAAA,cAAAA,GAAiBE,oBAAoBJ,IAAAA,CAAAA;EACvC,CAAA,MAAO;AACLE,IAAAA,cAAAA,GAAiBF,IAAAA;AACnB,EAAA;AAEA,EAAA,MAAMK,SAAS,MAAMC,MAAAA,CAAOP,OAAAA,EAASG,cAAAA,CAAeK,MAAMN,SAAAA,CAAAA;AAE1D,EAAA,MAAMO,WAAY,MAAMT,OAAAA,CAAQU,QAAAA,CAASC,UAAAA,CAAWL,OAAOM,IAAAA,EAAM;AAC/DC,IAAAA,QAAAA,EAAUP,MAAAA,CAAOQ,IAAAA;IACjBC,cAAAA,EAAgB;GAClB,CAAA;AAEA,EAAA,IAAIC,aAAab,cAAAA,CAAec,IAAAA;AAChC,EAAA,IAAI,CAACD,UAAAA,EAAY;AACfA,IAAAA,UAAAA,GAAa,SAAA;AACf,EAAA;AAEA,EAAA,OAAOP,SAASO,UAAAA,CAAAA,IAAeP,QAAAA,CAAS,CAAA,QAAA,EAAMO,UAAAA,CAAAA,CAAY,CAAA;AAC5D;AAzBsBjB,MAAAA,CAAAA,OAAAA,EAAAA,SAAAA,CAAAA","file":"chunk-LJEWIZNL.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 { parseTypeDefinition } from \"@stryke/convert/parse-type-definition\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport {\n TypeDefinition,\n TypeDefinitionParameter\n} from \"@stryke/types/configuration\";\nimport { ESBuildResolvedBuildConfig } from \"../../types/build\";\nimport { Context } from \"../../types/context\";\nimport { bundle } from \"./bundle\";\n\n/**\n * Compiles a type definition to a module.\n *\n * @param context - The context object containing the environment paths.\n * @param type - The type definition to compile. This can be either a string or a {@link TypeDefinition} object.\n * @param overrides - Optional overrides for the ESBuild configuration.\n * @returns A promise that resolves to the compiled module.\n */\nexport async function resolve<TResult = any>(\n context: Context,\n type: TypeDefinitionParameter,\n overrides: Partial<ESBuildResolvedBuildConfig> = {}\n): Promise<TResult> {\n let typeDefinition!: TypeDefinition;\n if (isSetString(type)) {\n typeDefinition = parseTypeDefinition(type) as TypeDefinition;\n } else {\n typeDefinition = type;\n }\n\n const result = await bundle(context, typeDefinition.file, overrides);\n\n const resolved = (await context.resolver.evalModule(result.text, {\n filename: result.path,\n forceTranspile: true\n })) as Record<string, any>;\n\n let exportName = typeDefinition.name;\n if (!exportName) {\n exportName = \"default\";\n }\n\n return resolved[exportName] ?? resolved[`__Ω${exportName}`];\n}\n"]}
@@ -109,5 +109,5 @@ function getUniqueEntries(entries = []) {
109
109
  __name(getUniqueEntries, "getUniqueEntries");
110
110
 
111
111
  export { getUniqueEntries, isResolvedEntryTypeDefinition, isTypeDefinition, resolveEntries, resolveEntriesSync, resolveEntry, resolveEntryInput, resolveEntryInputFile, resolveEntryOutput };
112
- //# sourceMappingURL=chunk-HZTJTO26.js.map
113
- //# sourceMappingURL=chunk-HZTJTO26.js.map
112
+ //# sourceMappingURL=chunk-OE4RRA62.js.map
113
+ //# sourceMappingURL=chunk-OE4RRA62.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/lib/entry.ts"],"names":["resolveEntryInputFile","context","typeDefinition","replacePath","file","joinPaths","workspaceConfig","workspaceRoot","config","projectRoot","resolveEntryInput","name","resolveEntryOutput","replaceExtension","sourceRoot","resolveEntry","input","output","resolveEntries","typeDefinitions","Promise","all","map","entry","isResolvedEntryTypeDefinition","replacePathTokens","isString","parseTypeDefinition","filePath","appendPath","isFile","fs","list","flat","filter","Boolean","isTypeDefinition","undefined","resolveEntriesSync","listSync","getUniqueEntries","entries","getUniqueBy","toArray","item","isSetString","murmurhash","maxLength"],"mappings":";;;;;;;;;;;;;AAoCO,SAASA,qBAAAA,CACdC,SACAC,cAAAA,EAA8B;AAE9B,EAAA,OAAOC,WAAAA,CACLD,cAAAA,CAAeE,IAAAA,EACfC,SAAAA,CAAUJ,OAAAA,CAAQK,gBAAgBC,aAAAA,EAAeN,OAAAA,CAAQO,MAAAA,CAAOC,WAAW,CAAA,CAAA;AAE/E;AARgBT,MAAAA,CAAAA,qBAAAA,EAAAA,uBAAAA,CAAAA;AAUT,SAASU,iBAAAA,CACdT,SACAC,cAAAA,EAA8B;AAE9B,EAAA,OAAO;IACLE,IAAAA,EAAMJ,qBAAAA,CAAsBC,SAASC,cAAAA,CAAAA;AACrCS,IAAAA,IAAAA,EAAMT,c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AAW;AACpB,MAAA,OAAOb,aAAad,OAAAA,EAAS;AAC3BG,QAAAA,IAAAA,EAAMD,WAAAA,CAAYyB,QAAAA,EAAU3B,OAAAA,CAAQO,MAAAA,CAAOC,WAAW,CAAA;AACtDE,QAAAA,IAAAA,EAAMT,cAAAA,CAAeS;OACvB,CAAA;AACF,IAAA;AAEA,IAAA,OAAOV,OAAAA,CAAQ8B,GAAGQ,QAAAA,CAASX,QAAAA,EAAUN,GAAAA,CAAIlB,CAAAA,IAAAA,KACvCW,YAAAA,CAAad,OAAAA,EAAS;AACpBG,MAAAA,IAAAA;AACAO,MAAAA,IAAAA,EAAMT,cAAAA,CAAeS;AACvB,KAAA,CAAA,CAAA;AAEJ,EAAA,CAAA,CAAA,CACCsB,IAAAA,EAAI,CACJC,MAAAA,CAAOC,OAAAA,CAAAA;AACZ;AAxCgBG,MAAAA,CAAAA,kBAAAA,EAAAA,oBAAAA,CAAAA;AAiFT,SAASE,gBAAAA,CACdC,OAAAA,GAA+D,EAAA,EAAE;AAEjE,EAAA,OAAOC,WAAAA,CAAYC,OAAAA,CAAQF,OAAAA,CAAAA,EAAU,CAACG,IAAAA,KACpCC,WAAAA,CAAYD,IAAAA,CAAAA,GAAQA,IAAAA,GAAOE,UAAAA,CAAWF,IAAAA,IAAQ,EAAC,EAAG;IAAEG,SAAAA,EAAW;AAAG,GAAA,CAAA,CAAA;AAEtE;AANgBP,MAAAA,CAAAA,gBAAAA,EAAAA,kBAAAA,CAAAA","file":"chunk-HZTJTO26.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 { parseTypeDefinition } from \"@stryke/convert/parse-type-definition\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { isFile } from \"@stryke/fs/is-file\";\nimport { murmurhash } from \"@stryke/hash/murmurhash\";\nimport { getUniqueBy } from \"@stryke/helpers/get-unique\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { replaceExtension, replacePath } from \"@stryke/path/replace\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport type {\n TypeDefinition,\n TypeDefinitionParameter\n} from \"@stryke/types/configuration\";\nimport { replacePathTokens } from \"../plugin-utils/paths\";\nimport type { Context } from \"../types/context\";\nimport { ResolvedEntryTypeDefinition } from \"../types/resolved\";\n\nexport function resolveEntryInputFile(\n context: Context,\n typeDefinition: TypeDefinition\n): string {\n return replacePath(\n typeDefinition.file,\n joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot)\n );\n}\n\nexport function resolveEntryInput(\n context: Context,\n typeDefinition: TypeDefinition\n): TypeDefinition {\n return {\n file: resolveEntryInputFile(context, typeDefinition),\n name: typeDefinition.name\n };\n}\n\nexport function resolveEntryOutput(\n context: Context,\n typeDefinition: TypeDefinition\n): string {\n return replaceExtension(\n replacePath(\n replacePath(\n replacePath(\n replacePath(\n replacePath(\n typeDefinition.file,\n joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.sourceRoot\n )\n ),\n joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.projectRoot\n )\n ),\n context.config.sourceRoot\n ),\n context.config.projectRoot\n ),\n replacePath(context.config.sourceRoot, context.config.projectRoot)\n )\n );\n}\n\nexport function resolveEntry(\n context: Context,\n typeDefinition: TypeDefinition\n): ResolvedEntryTypeDefinition {\n const input = resolveEntryInput(context, typeDefinition);\n\n return {\n ...input,\n input,\n output: resolveEntryOutput(context, typeDefinition)\n };\n}\n\n/**\n * Resolves multiple type definitions into their corresponding resolved entry type definitions.\n *\n * @param context - The current context\n * @param typeDefinitions - The type definitions to resolve.\n * @returns A promise that resolves to an array of resolved entry type definitions.\n */\nexport async function resolveEntries(\n context: Context,\n typeDefinitions: TypeDefinitionParameter[]\n): Promise<ResolvedEntryTypeDefinition[]> {\n return (\n await Promise.all(\n typeDefinitions.map(async entry => {\n if (isResolvedEntryTypeDefinition(entry)) {\n return { ...entry, file: replacePathTokens(context, entry.file) };\n }\n\n let typeDefinition: TypeDefinition;\n if (isString(entry)) {\n typeDefinition = parseTypeDefinition(\n replacePathTokens(context, entry)\n )!;\n } else {\n typeDefinition = entry;\n typeDefinition.file = replacePathTokens(context, typeDefinition.file);\n }\n\n const filePath = appendPath(\n typeDefinition.file,\n context.config.projectRoot\n );\n if (isFile(filePath)) {\n return resolveEntry(context, {\n file: replacePath(filePath, context.config.projectRoot),\n name: typeDefinition.name\n });\n }\n\n return (await context.fs.list(filePath)).map(file =>\n resolveEntry(context, {\n file,\n name: typeDefinition.name\n })\n );\n })\n )\n )\n .flat()\n .filter(Boolean);\n}\n\n/**\n * Checks if the provided entry is a type definition.\n *\n * @param entry - The entry to check.\n * @returns True if the entry is a type definition, false otherwise.\n */\nexport function isTypeDefinition(\n entry: TypeDefinitionParameter\n): entry is TypeDefinition {\n return !isString(entry) && entry.file !== undefined;\n}\n\n/**\n * Checks if the provided entry is a resolved entry type definition.\n *\n * @param entry - The entry to check.\n * @returns True if the entry is a resolved entry type definition, false otherwise.\n */\nexport function isResolvedEntryTypeDefinition(\n entry: TypeDefinitionParameter | ResolvedEntryTypeDefinition\n): entry is ResolvedEntryTypeDefinition {\n return (\n isTypeDefinition(entry) &&\n (entry as ResolvedEntryTypeDefinition).input !== undefined &&\n (entry as ResolvedEntryTypeDefinition).output !== undefined\n );\n}\n\n/**\n * Resolves multiple type definitions into their corresponding resolved entry type definitions.\n *\n * @param context - The current context\n * @param typeDefinitions - The type definitions to resolve.\n * @returns A promise that resolves to an array of resolved entry type definitions.\n */\nexport function resolveEntriesSync(\n context: Context,\n typeDefinitions: Array<TypeDefinitionParameter | ResolvedEntryTypeDefinition>\n): ResolvedEntryTypeDefinition[] {\n return typeDefinitions\n .map(entry => {\n if (isResolvedEntryTypeDefinition(entry)) {\n return { ...entry, file: replacePathTokens(context, entry.file) };\n }\n\n let typeDefinition: TypeDefinition;\n if (isString(entry)) {\n typeDefinition = parseTypeDefinition(\n replacePathTokens(context, entry)\n )!;\n } else {\n typeDefinition = entry;\n typeDefinition.file = replacePathTokens(context, typeDefinition.file);\n }\n\n const filePath = appendPath(\n typeDefinition.file,\n context.config.projectRoot\n );\n if (isFile(filePath)) {\n return resolveEntry(context, {\n file: replacePath(filePath, context.config.projectRoot),\n name: typeDefinition.name\n });\n }\n\n return context.fs.listSync(filePath).map(file =>\n resolveEntry(context, {\n file,\n name: typeDefinition.name\n })\n );\n })\n .flat()\n .filter(Boolean);\n}\n\n// /** Resolve a virtual entry point by generating a unique file path in the artifacts directory.\n// *\n// * @param context - The current context\n// * @param typeDefinition - The type definition to resolve.\n// * @returns The resolved entry type definition with a unique virtual file path.\n// */\n// export function resolveVirtualEntry(\n// context: Context,\n// typeDefinition: TypeDefinitionParameter\n// ): ResolvedEntryTypeDefinition {\n// const parsed = parseTypeDefinition(typeDefinition)!;\n// const resolved = resolveEntry(context, parsed);\n// const file = joinPaths(\n// context.artifactsPath,\n// `entry-${murmurhash(\n// { file: resolved.file, name: resolved.name },\n// { maxLength: 24 }\n// )\n// .replaceAll(\"-\", \"0\")\n// .replaceAll(\"_\", \"1\")}.ts`\n// );\n\n// return {\n// file,\n// name: resolved.name,\n// input: {\n// file,\n// name: resolved.name\n// },\n// output: file\n// };\n// }\n\n/**\n * Get unique entries from the provided list.\n *\n * @param entries - The entries to process.\n * @returns An array of unique entries (by file path or content hash).\n */\nexport function getUniqueEntries(\n entries: TypeDefinitionParameter | TypeDefinitionParameter[] = []\n): TypeDefinitionParameter[] {\n return getUniqueBy(toArray(entries), (item: TypeDefinitionParameter) =>\n isSetString(item) ? item : murmurhash(item ?? {}, { maxLength: 24 })\n );\n}\n"]}
1
+ {"version":3,"sources":["../../src/lib/entry.ts"],"names":["resolveEntryInputFile","context","typeDefinition","replacePath","file","joinPaths","workspaceConfig","workspaceRoot","config","projectRoot","resolveEntryInput","name","resolveEntryOutput","replaceExtension","sourceRoot","resolveEntry","input","output","resolveEntries","typeDefinitions","Promise","all","map","entry","isResolvedEntryTypeDefinition","replacePathTokens","isString","parseTypeDefinition","filePath","appendPath","isFile","fs","list","flat","filter","Boolean","isTypeDefinition","undefined","resolveEntriesSync","listSync","getUniqueEntries","entries","getUniqueBy","toArray","item","isSetString","murmurhash","maxLength"],"mappings":";;;;;;;;;;;;;AAoCO,SAASA,qBAAAA,CACdC,SACAC,cAAAA,EAA8B;AAE9B,EAAA,OAAOC,WAAAA,CACLD,cAAAA,CAAeE,IAAAA,EACfC,SAAAA,CAAUJ,OAAAA,CAAQK,gBAAgBC,aAAAA,EAAeN,OAAAA,CAAQO,MAAAA,CAAOC,WAAW,CAAA,CAAA;AAE/E;AARgBT,MAAAA,CAAAA,qBAAAA,EAAAA,uBAAAA,CAAAA;AAUT,SAASU,iBAAAA,CACdT,SACAC,cAAAA,EAA8B;AAE9B,EAAA,OAAO;IACLE,IAAAA,EAAMJ,qBAAAA,CAAsBC,SAASC,cAAAA,CAAAA;AACrCS,IAAAA,IAAAA,EAAMT,cAAAA,CAAeS;AACvB,GAAA;AACF;AARgBD,MAAAA,CAAAA,iBAAAA,EAAAA,mBAAAA,CAAAA;AAUT,SAASE,kBAAAA,CACdX,SACAC,cAAAA,EAA8B;AAE9B,EAAA,OAAOW,iBACLV,WAAAA,CACEA,WAAAA,CACEA,YACEA,WAAAA,CACEA,WAAAA,CACED,eAAeE,IAAAA,EACfC,SAAAA,CACEJ,QAAQK,eAAAA,CAAgBC,aAAAA,EACxBN,QAAQO,MAAAA,CAAOM,UAAU,CAAA,CAAA,EAG7BT,SAAAA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EAAS;AACpBG,MAAAA,IAAAA;AACAO,MAAAA,IAAAA,EAAMT,cAAAA,CAAeS;AACvB,KAAA,CAAA,CAAA;AAEJ,EAAA,CAAA,CAAA,CACCsB,IAAAA,EAAI,CACJC,MAAAA,CAAOC,OAAAA,CAAAA;AACZ;AAxCgBG,MAAAA,CAAAA,kBAAAA,EAAAA,oBAAAA,CAAAA;AAiFT,SAASE,gBAAAA,CACdC,OAAAA,GAA+D,EAAA,EAAE;AAEjE,EAAA,OAAOC,WAAAA,CAAYC,OAAAA,CAAQF,OAAAA,CAAAA,EAAU,CAACG,IAAAA,KACpCC,WAAAA,CAAYD,IAAAA,CAAAA,GAAQA,IAAAA,GAAOE,UAAAA,CAAWF,IAAAA,IAAQ,EAAC,EAAG;IAAEG,SAAAA,EAAW;AAAG,GAAA,CAAA,CAAA;AAEtE;AANgBP,MAAAA,CAAAA,gBAAAA,EAAAA,kBAAAA,CAAAA","file":"chunk-OE4RRA62.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 { parseTypeDefinition } from \"@stryke/convert/parse-type-definition\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { isFile } from \"@stryke/fs/is-file\";\nimport { murmurhash } from \"@stryke/hash/murmurhash\";\nimport { getUniqueBy } from \"@stryke/helpers/get-unique\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { replaceExtension, replacePath } from \"@stryke/path/replace\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport type {\n TypeDefinition,\n TypeDefinitionParameter\n} from \"@stryke/types/configuration\";\nimport { replacePathTokens } from \"../plugin-utils/paths\";\nimport type { Context } from \"../types/context\";\nimport { ResolvedEntryTypeDefinition } from \"../types/resolved\";\n\nexport function resolveEntryInputFile(\n context: Context,\n typeDefinition: TypeDefinition\n): string {\n return replacePath(\n typeDefinition.file,\n joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot)\n );\n}\n\nexport function resolveEntryInput(\n context: Context,\n typeDefinition: TypeDefinition\n): TypeDefinition {\n return {\n file: resolveEntryInputFile(context, typeDefinition),\n name: typeDefinition.name\n };\n}\n\nexport function resolveEntryOutput(\n context: Context,\n typeDefinition: TypeDefinition\n): string {\n return replaceExtension(\n replacePath(\n replacePath(\n replacePath(\n replacePath(\n replacePath(\n typeDefinition.file,\n joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.sourceRoot\n )\n ),\n joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.projectRoot\n )\n ),\n context.config.sourceRoot\n ),\n context.config.projectRoot\n ),\n replacePath(context.config.sourceRoot, context.config.projectRoot)\n )\n );\n}\n\nexport function resolveEntry(\n context: Context,\n typeDefinition: TypeDefinition\n): ResolvedEntryTypeDefinition {\n const input = resolveEntryInput(context, typeDefinition);\n\n return {\n ...input,\n input,\n output: resolveEntryOutput(context, typeDefinition)\n };\n}\n\n/**\n * Resolves multiple type definitions into their corresponding resolved entry type definitions.\n *\n * @param context - The current context\n * @param typeDefinitions - The type definitions to resolve.\n * @returns A promise that resolves to an array of resolved entry type definitions.\n */\nexport async function resolveEntries(\n context: Context,\n typeDefinitions: Array<TypeDefinitionParameter | ResolvedEntryTypeDefinition>\n): Promise<ResolvedEntryTypeDefinition[]> {\n return (\n await Promise.all(\n typeDefinitions.map(async entry => {\n if (isResolvedEntryTypeDefinition(entry)) {\n return { ...entry, file: replacePathTokens(context, entry.file) };\n }\n\n let typeDefinition: TypeDefinition;\n if (isString(entry)) {\n typeDefinition = parseTypeDefinition(\n replacePathTokens(context, entry)\n )!;\n } else {\n typeDefinition = entry;\n typeDefinition.file = replacePathTokens(context, typeDefinition.file);\n }\n\n const filePath = appendPath(\n typeDefinition.file,\n context.config.projectRoot\n );\n if (isFile(filePath)) {\n return resolveEntry(context, {\n file: replacePath(filePath, context.config.projectRoot),\n name: typeDefinition.name\n });\n }\n\n return (await context.fs.list(filePath)).map(file =>\n resolveEntry(context, {\n file,\n name: typeDefinition.name\n })\n );\n })\n )\n )\n .flat()\n .filter(Boolean);\n}\n\n/**\n * Checks if the provided entry is a type definition.\n *\n * @param entry - The entry to check.\n * @returns True if the entry is a type definition, false otherwise.\n */\nexport function isTypeDefinition(\n entry: TypeDefinitionParameter\n): entry is TypeDefinition {\n return !isString(entry) && entry.file !== undefined;\n}\n\n/**\n * Checks if the provided entry is a resolved entry type definition.\n *\n * @param entry - The entry to check.\n * @returns True if the entry is a resolved entry type definition, false otherwise.\n */\nexport function isResolvedEntryTypeDefinition(\n entry: TypeDefinitionParameter | ResolvedEntryTypeDefinition\n): entry is ResolvedEntryTypeDefinition {\n return (\n isTypeDefinition(entry) &&\n (entry as ResolvedEntryTypeDefinition).input !== undefined &&\n (entry as ResolvedEntryTypeDefinition).output !== undefined\n );\n}\n\n/**\n * Resolves multiple type definitions into their corresponding resolved entry type definitions.\n *\n * @param context - The current context\n * @param typeDefinitions - The type definitions to resolve.\n * @returns A promise that resolves to an array of resolved entry type definitions.\n */\nexport function resolveEntriesSync(\n context: Context,\n typeDefinitions: Array<TypeDefinitionParameter | ResolvedEntryTypeDefinition>\n): ResolvedEntryTypeDefinition[] {\n return typeDefinitions\n .map(entry => {\n if (isResolvedEntryTypeDefinition(entry)) {\n return { ...entry, file: replacePathTokens(context, entry.file) };\n }\n\n let typeDefinition: TypeDefinition;\n if (isString(entry)) {\n typeDefinition = parseTypeDefinition(\n replacePathTokens(context, entry)\n )!;\n } else {\n typeDefinition = entry;\n typeDefinition.file = replacePathTokens(context, typeDefinition.file);\n }\n\n const filePath = appendPath(\n typeDefinition.file,\n context.config.projectRoot\n );\n if (isFile(filePath)) {\n return resolveEntry(context, {\n file: replacePath(filePath, context.config.projectRoot),\n name: typeDefinition.name\n });\n }\n\n return context.fs.listSync(filePath).map(file =>\n resolveEntry(context, {\n file,\n name: typeDefinition.name\n })\n );\n })\n .flat()\n .filter(Boolean);\n}\n\n// /** Resolve a virtual entry point by generating a unique file path in the artifacts directory.\n// *\n// * @param context - The current context\n// * @param typeDefinition - The type definition to resolve.\n// * @returns The resolved entry type definition with a unique virtual file path.\n// */\n// export function resolveVirtualEntry(\n// context: Context,\n// typeDefinition: TypeDefinitionParameter\n// ): ResolvedEntryTypeDefinition {\n// const parsed = parseTypeDefinition(typeDefinition)!;\n// const resolved = resolveEntry(context, parsed);\n// const file = joinPaths(\n// context.artifactsPath,\n// `entry-${murmurhash(\n// { file: resolved.file, name: resolved.name },\n// { maxLength: 24 }\n// )\n// .replaceAll(\"-\", \"0\")\n// .replaceAll(\"_\", \"1\")}.ts`\n// );\n\n// return {\n// file,\n// name: resolved.name,\n// input: {\n// file,\n// name: resolved.name\n// },\n// output: file\n// };\n// }\n\n/**\n * Get unique entries from the provided list.\n *\n * @param entries - The entries to process.\n * @returns An array of unique entries (by file path or content hash).\n */\nexport function getUniqueEntries(\n entries: TypeDefinitionParameter | TypeDefinitionParameter[] = []\n): TypeDefinitionParameter[] {\n return getUniqueBy(toArray(entries), (item: TypeDefinitionParameter) =>\n isSetString(item) ? item : murmurhash(item ?? {}, { maxLength: 24 })\n );\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { resolveESBuildEntry } from './chunk-RP4KHKZQ.js';
1
+ import { resolveESBuildEntry } from './chunk-IUXE765Q.js';
2
2
  import { __name } from './chunk-7QVYU63E.js';
3
3
  import { DEFAULT_BUILD_OPTIONS } from '@storm-software/tsup/constants';
4
4
  import { toArray } from '@stryke/convert/to-array';
@@ -80,5 +80,5 @@ function extractTsupConfig(context) {
80
80
  __name(extractTsupConfig, "extractTsupConfig");
81
81
 
82
82
  export { DEFAULT_TSUP_CONFIG, extractTsupConfig, resolveTsupEntry };
83
- //# sourceMappingURL=chunk-MKA52KRJ.js.map
84
- //# sourceMappingURL=chunk-MKA52KRJ.js.map
83
+ //# sourceMappingURL=chunk-OYYPCZW3.js.map
84
+ //# sourceMappingURL=chunk-OYYPCZW3.js.map