@powerlines/plugin-env 0.15.4 → 0.15.6

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 (264) hide show
  1. package/dist/_virtual/rolldown_runtime.cjs +29 -0
  2. package/dist/babel/index.cjs +1 -0
  3. package/dist/babel/index.d.cts +1 -0
  4. package/dist/babel/index.d.mts +1 -0
  5. package/dist/babel/index.mjs +3 -0
  6. package/dist/babel/plugin.cjs +200 -0
  7. package/dist/babel/plugin.d.cts +8 -0
  8. package/dist/babel/plugin.d.mts +9 -0
  9. package/dist/babel/plugin.mjs +198 -0
  10. package/dist/components/docs.cjs +70 -3
  11. package/dist/components/docs.d.cts +8 -1
  12. package/dist/components/docs.d.mts +8 -1
  13. package/dist/components/docs.mjs +68 -2
  14. package/dist/components/env.cjs +574 -4
  15. package/dist/components/env.d.cts +19 -2
  16. package/dist/components/env.d.mts +19 -3
  17. package/dist/components/env.mjs +570 -2
  18. package/dist/components/index.cjs +5 -7
  19. package/dist/components/index.d.cts +2 -4
  20. package/dist/components/index.d.mts +2 -5
  21. package/dist/components/index.mjs +2 -4
  22. package/dist/deepkit/schemas/reflection.cjs +5368 -0
  23. package/dist/{plugin-BwuEBScL.d.cts → deepkit/schemas/reflection.d.cts} +1 -268
  24. package/dist/{plugin-BaInAuAh.d.mts → deepkit/schemas/reflection.d.mts} +59 -326
  25. package/dist/deepkit/schemas/reflection.mjs +5365 -0
  26. package/dist/deepkit/schemas/reflection2.cjs +4112 -0
  27. package/dist/deepkit/schemas/reflection2.mjs +4110 -0
  28. package/dist/deepkit/src/capnp.cjs +1692 -0
  29. package/dist/deepkit/src/capnp.mjs +1690 -0
  30. package/dist/deepkit/src/esbuild-plugin.cjs +99 -0
  31. package/dist/deepkit/src/esbuild-plugin.mjs +98 -0
  32. package/dist/deepkit/src/reflect-type.cjs +40 -0
  33. package/dist/deepkit/src/reflect-type.mjs +38 -0
  34. package/dist/deepkit/src/resolve-reflections.cjs +23 -0
  35. package/dist/deepkit/src/resolve-reflections.mjs +22 -0
  36. package/dist/deepkit/src/transformer.cjs +92 -0
  37. package/dist/deepkit/src/transformer.mjs +89 -0
  38. package/dist/deepkit/src/transpile.cjs +39 -0
  39. package/dist/deepkit/src/transpile.mjs +37 -0
  40. package/dist/deepkit/src/types.cjs +22 -0
  41. package/dist/deepkit/src/types.d.cts +10 -0
  42. package/dist/deepkit/src/types.d.mts +10 -0
  43. package/dist/deepkit/src/types.mjs +21 -0
  44. package/dist/deepkit/src/utilities.cjs +182 -0
  45. package/dist/deepkit/src/utilities.mjs +181 -0
  46. package/dist/helpers/automd-generator.cjs +32 -0
  47. package/dist/helpers/automd-generator.mjs +31 -0
  48. package/dist/helpers/create-reflection-resource.cjs +98 -0
  49. package/dist/helpers/create-reflection-resource.d.cts +15 -0
  50. package/dist/helpers/create-reflection-resource.d.mts +15 -0
  51. package/dist/helpers/create-reflection-resource.mjs +97 -0
  52. package/dist/helpers/index.cjs +6 -0
  53. package/dist/helpers/index.d.cts +6 -0
  54. package/dist/helpers/index.d.mts +6 -0
  55. package/dist/helpers/index.mjs +8 -0
  56. package/dist/helpers/load.cjs +134 -0
  57. package/dist/helpers/load.d.cts +35 -0
  58. package/dist/helpers/load.d.mts +36 -0
  59. package/dist/helpers/load.mjs +131 -0
  60. package/dist/helpers/persistence.cjs +320 -0
  61. package/dist/helpers/persistence.d.cts +84 -0
  62. package/dist/helpers/persistence.d.mts +84 -0
  63. package/dist/helpers/persistence.mjs +308 -0
  64. package/dist/helpers/reflect.cjs +263 -0
  65. package/dist/helpers/reflect.d.cts +46 -0
  66. package/dist/helpers/reflect.d.mts +46 -0
  67. package/dist/helpers/reflect.mjs +254 -0
  68. package/dist/helpers/source-file-env.cjs +58 -0
  69. package/dist/helpers/source-file-env.d.cts +8 -0
  70. package/dist/helpers/source-file-env.d.mts +8 -0
  71. package/dist/helpers/source-file-env.mjs +56 -0
  72. package/dist/helpers/template-helpers.cjs +70 -0
  73. package/dist/helpers/template-helpers.d.cts +15 -0
  74. package/dist/helpers/template-helpers.d.mts +15 -0
  75. package/dist/helpers/template-helpers.mjs +69 -0
  76. package/dist/index.cjs +82 -696
  77. package/dist/index.d.cts +16 -185
  78. package/dist/index.d.mts +17 -190
  79. package/dist/index.mjs +31 -648
  80. package/dist/plugin-alloy/src/core/components/output.cjs +45 -0
  81. package/dist/plugin-alloy/src/core/components/output.mjs +44 -0
  82. package/dist/plugin-alloy/src/core/components/single-line-comment.cjs +22 -0
  83. package/dist/plugin-alloy/src/core/components/single-line-comment.mjs +21 -0
  84. package/dist/plugin-alloy/src/core/components/source-file.cjs +64 -0
  85. package/dist/plugin-alloy/src/core/components/source-file.d.cts +23 -0
  86. package/dist/plugin-alloy/src/core/components/source-file.d.mts +23 -0
  87. package/dist/plugin-alloy/src/core/components/source-file.mjs +62 -0
  88. package/dist/plugin-alloy/src/core/contexts/context.cjs +136 -0
  89. package/dist/plugin-alloy/src/core/contexts/context.mjs +128 -0
  90. package/dist/plugin-alloy/src/core/contexts/index.cjs +2 -0
  91. package/dist/plugin-alloy/src/core/contexts/index.mjs +4 -0
  92. package/dist/plugin-alloy/src/core/contexts/reflection.cjs +110 -0
  93. package/dist/plugin-alloy/src/core/contexts/reflection.mjs +101 -0
  94. package/dist/plugin-alloy/src/helpers/refkey.cjs +23 -0
  95. package/dist/plugin-alloy/src/helpers/refkey.mjs +22 -0
  96. package/dist/plugin-alloy/src/index.cjs +93 -0
  97. package/dist/plugin-alloy/src/index.mjs +91 -0
  98. package/dist/plugin-alloy/src/markdown/components/markdown-file.cjs +115 -0
  99. package/dist/plugin-alloy/src/markdown/components/markdown-file.mjs +114 -0
  100. package/dist/plugin-alloy/src/markdown/components/markdown-table.cjs +39 -0
  101. package/dist/plugin-alloy/src/markdown/components/markdown-table.mjs +38 -0
  102. package/dist/plugin-alloy/src/markdown/contexts/markdown-table.cjs +72 -0
  103. package/dist/plugin-alloy/src/markdown/contexts/markdown-table.mjs +71 -0
  104. package/dist/plugin-alloy/src/types/components.cjs +22 -0
  105. package/dist/plugin-alloy/src/types/components.d.cts +22 -0
  106. package/dist/{components-8W0Zgj0y.d.mts → plugin-alloy/src/types/components.d.mts} +2 -1
  107. package/dist/plugin-alloy/src/types/components.mjs +21 -0
  108. package/dist/plugin-alloy/src/types/index.d.mts +2 -0
  109. package/dist/plugin-alloy/src/types/plugin.cjs +55 -0
  110. package/dist/plugin-alloy/src/types/plugin.d.cts +37 -0
  111. package/dist/plugin-alloy/src/types/plugin.d.mts +37 -0
  112. package/dist/plugin-alloy/src/types/plugin.mjs +52 -0
  113. package/dist/plugin-alloy/src/typescript/components/builtin-file.cjs +57 -0
  114. package/dist/plugin-alloy/src/typescript/components/builtin-file.d.cts +25 -0
  115. package/dist/plugin-alloy/src/typescript/components/builtin-file.d.mts +26 -0
  116. package/dist/plugin-alloy/src/typescript/components/builtin-file.mjs +56 -0
  117. package/dist/plugin-alloy/src/typescript/components/tsdoc-reflection.cjs +126 -0
  118. package/dist/plugin-alloy/src/typescript/components/tsdoc-reflection.mjs +124 -0
  119. package/dist/plugin-alloy/src/typescript/components/tsdoc.cjs +442 -0
  120. package/dist/plugin-alloy/src/typescript/components/tsdoc.d.cts +27 -0
  121. package/dist/plugin-alloy/src/typescript/components/tsdoc.d.mts +28 -0
  122. package/dist/plugin-alloy/src/typescript/components/tsdoc.mjs +433 -0
  123. package/dist/plugin-alloy/src/typescript/components/typescript-file.cjs +194 -0
  124. package/dist/plugin-alloy/src/typescript/components/typescript-file.d.cts +14 -0
  125. package/dist/plugin-alloy/src/typescript/components/typescript-file.d.mts +15 -0
  126. package/dist/plugin-alloy/src/typescript/components/typescript-file.mjs +191 -0
  127. package/dist/plugin-alloy/src/typescript/components/typescript-interface.cjs +68 -0
  128. package/dist/plugin-alloy/src/typescript/components/typescript-interface.d.cts +11 -0
  129. package/dist/plugin-alloy/src/typescript/components/typescript-interface.d.mts +12 -0
  130. package/dist/plugin-alloy/src/typescript/components/typescript-interface.mjs +67 -0
  131. package/dist/plugin-alloy/src/typescript/components/typescript-object.cjs +124 -0
  132. package/dist/plugin-alloy/src/typescript/components/typescript-object.mjs +123 -0
  133. package/dist/plugin-automd/src/index.cjs +127 -0
  134. package/dist/plugin-automd/src/index.mjs +124 -0
  135. package/dist/plugin-automd/src/types/plugin.cjs +47 -0
  136. package/dist/plugin-automd/src/types/plugin.d.cts +38 -0
  137. package/dist/plugin-automd/src/types/plugin.d.mts +40 -0
  138. package/dist/plugin-automd/src/types/plugin.mjs +47 -0
  139. package/dist/plugin-automd/src/types/toc.cjs +26 -0
  140. package/dist/plugin-automd/src/types/toc.d.cts +33 -0
  141. package/dist/plugin-automd/src/types/toc.d.mts +33 -0
  142. package/dist/plugin-automd/src/types/toc.mjs +25 -0
  143. package/dist/plugin-babel/src/helpers/ast-utils.cjs +74 -0
  144. package/dist/plugin-babel/src/helpers/ast-utils.mjs +70 -0
  145. package/dist/plugin-babel/src/helpers/create-plugin.cjs +71 -0
  146. package/dist/plugin-babel/src/helpers/create-plugin.mjs +69 -0
  147. package/dist/plugin-babel/src/helpers/filters.cjs +158 -0
  148. package/dist/plugin-babel/src/helpers/filters.mjs +154 -0
  149. package/dist/plugin-babel/src/helpers/index.cjs +5 -0
  150. package/dist/plugin-babel/src/helpers/index.mjs +7 -0
  151. package/dist/plugin-babel/src/helpers/module-helpers.cjs +200 -0
  152. package/dist/plugin-babel/src/helpers/module-helpers.mjs +192 -0
  153. package/dist/plugin-babel/src/helpers/options.cjs +74 -0
  154. package/dist/plugin-babel/src/helpers/options.mjs +71 -0
  155. package/dist/plugin-babel/src/index.cjs +134 -0
  156. package/dist/plugin-babel/src/index.mjs +132 -0
  157. package/dist/plugin-babel/src/types/index.d.mts +1 -0
  158. package/dist/plugin-babel/src/types/plugin.cjs +42 -0
  159. package/dist/plugin-babel/src/types/plugin.d.cts +15 -0
  160. package/dist/plugin-babel/src/types/plugin.d.mts +15 -0
  161. package/dist/plugin-babel/src/types/plugin.mjs +39 -0
  162. package/dist/powerlines/schemas/fs.d.mts +1 -0
  163. package/dist/powerlines/src/api.d.mts +7 -0
  164. package/dist/powerlines/src/index.d.mts +12 -0
  165. package/dist/powerlines/src/internal/helpers/hooks.cjs +119 -0
  166. package/dist/powerlines/src/internal/helpers/hooks.d.mts +5 -0
  167. package/dist/powerlines/src/internal/helpers/hooks.mjs +118 -0
  168. package/dist/powerlines/src/lib/build/esbuild.cjs +161 -0
  169. package/dist/powerlines/src/lib/build/esbuild.mjs +159 -0
  170. package/dist/powerlines/src/lib/entry.cjs +203 -0
  171. package/dist/powerlines/src/lib/entry.mjs +201 -0
  172. package/dist/powerlines/src/lib/logger.cjs +108 -0
  173. package/dist/powerlines/src/lib/logger.mjs +106 -0
  174. package/dist/powerlines/src/lib/utilities/bundle.cjs +67 -0
  175. package/dist/powerlines/src/lib/utilities/bundle.mjs +66 -0
  176. package/dist/powerlines/src/lib/utilities/resolve.cjs +49 -0
  177. package/dist/powerlines/src/lib/utilities/resolve.mjs +48 -0
  178. package/dist/powerlines/src/plugin-utils/paths.cjs +46 -0
  179. package/dist/powerlines/src/plugin-utils/paths.mjs +45 -0
  180. package/dist/powerlines/src/types/api.cjs +1 -0
  181. package/dist/powerlines/src/types/api.d.mts +5 -0
  182. package/dist/powerlines/src/types/api.mjs +3 -0
  183. package/dist/powerlines/src/types/babel.cjs +156 -0
  184. package/dist/powerlines/src/types/babel.d.cts +23 -0
  185. package/dist/powerlines/src/types/babel.d.mts +23 -0
  186. package/dist/powerlines/src/types/babel.mjs +147 -0
  187. package/dist/powerlines/src/types/build.cjs +105 -0
  188. package/dist/powerlines/src/types/build.d.cts +145 -0
  189. package/dist/powerlines/src/types/build.d.mts +147 -0
  190. package/dist/powerlines/src/types/build.mjs +101 -0
  191. package/dist/powerlines/src/types/commands.cjs +16 -0
  192. package/dist/powerlines/src/types/commands.d.cts +8 -0
  193. package/dist/powerlines/src/types/commands.d.mts +9 -0
  194. package/dist/powerlines/src/types/commands.mjs +15 -0
  195. package/dist/powerlines/src/types/config.cjs +306 -0
  196. package/dist/powerlines/src/types/config.d.cts +387 -0
  197. package/dist/powerlines/src/types/config.d.mts +388 -0
  198. package/dist/powerlines/src/types/config.mjs +293 -0
  199. package/dist/powerlines/src/types/context.cjs +324 -0
  200. package/dist/powerlines/src/types/context.d.cts +414 -0
  201. package/dist/powerlines/src/types/context.d.mts +416 -0
  202. package/dist/powerlines/src/types/context.mjs +311 -0
  203. package/dist/powerlines/src/types/fs.cjs +78 -0
  204. package/dist/powerlines/src/types/fs.d.cts +486 -0
  205. package/dist/powerlines/src/types/fs.d.mts +486 -0
  206. package/dist/powerlines/src/types/fs.mjs +75 -0
  207. package/dist/powerlines/src/types/hooks.cjs +52 -0
  208. package/dist/powerlines/src/types/hooks.d.mts +2 -0
  209. package/dist/powerlines/src/types/hooks.mjs +48 -0
  210. package/dist/powerlines/src/types/index.cjs +11 -0
  211. package/dist/powerlines/src/types/index.d.mts +12 -0
  212. package/dist/powerlines/src/types/index.mjs +13 -0
  213. package/dist/powerlines/src/types/plugin.cjs +249 -0
  214. package/dist/powerlines/src/types/plugin.d.cts +231 -0
  215. package/dist/powerlines/src/types/plugin.d.mts +231 -0
  216. package/dist/powerlines/src/types/plugin.mjs +240 -0
  217. package/dist/powerlines/src/types/resolved.cjs +153 -0
  218. package/dist/powerlines/src/types/resolved.d.cts +82 -0
  219. package/dist/powerlines/src/types/resolved.d.mts +83 -0
  220. package/dist/powerlines/src/types/resolved.mjs +148 -0
  221. package/dist/powerlines/src/types/tsconfig.d.cts +69 -0
  222. package/dist/powerlines/src/types/tsconfig.d.mts +69 -0
  223. package/dist/powerlines/src/types/unplugin.cjs +1 -0
  224. package/dist/powerlines/src/types/unplugin.d.mts +7 -0
  225. package/dist/powerlines/src/types/unplugin.mjs +3 -0
  226. package/dist/types/index.cjs +10 -3
  227. package/dist/types/index.d.cts +2 -4
  228. package/dist/types/index.d.mts +2 -5
  229. package/dist/types/index.mjs +3 -4
  230. package/dist/types/plugin.cjs +133 -1
  231. package/dist/types/plugin.d.cts +156 -3
  232. package/dist/types/plugin.d.mts +158 -4
  233. package/dist/types/plugin.mjs +128 -2
  234. package/dist/types/runtime.cjs +242 -1
  235. package/dist/types/runtime.d.cts +793 -2
  236. package/dist/types/runtime.d.mts +793 -2
  237. package/dist/types/runtime.mjs +240 -2
  238. package/package.json +13 -9
  239. package/dist/components-C9bYrQVK.cjs +0 -0
  240. package/dist/components-CNIQFfeK.mjs +0 -1
  241. package/dist/create-reflection-resource-BNYxBgW2.mjs +0 -9846
  242. package/dist/create-reflection-resource-BWYhmX7O.cjs +0 -10085
  243. package/dist/docs-5r844zC1.d.mts +0 -9
  244. package/dist/docs-B66b9li3.mjs +0 -219
  245. package/dist/docs-_MmTNBQX.d.cts +0 -9
  246. package/dist/docs-hBlKCRWK.cjs +0 -224
  247. package/dist/env-BPodCdD1.d.cts +0 -116
  248. package/dist/env-IQvgnabX.mjs +0 -1578
  249. package/dist/env-cO4BUDn1.cjs +0 -1596
  250. package/dist/env-zhzvpUI5.d.mts +0 -98
  251. package/dist/index-BXxhKmeA.d.mts +0 -1
  252. package/dist/index-Cc7fCJU9.d.mts +0 -1
  253. package/dist/index-CqdNToYT.d.cts +0 -1
  254. package/dist/index-DWPDThxu.d.cts +0 -1
  255. package/dist/plugin-D3B5E_Hg.mjs +0 -1
  256. package/dist/plugin-D5qyQPqC.cjs +0 -0
  257. package/dist/resolved-BZG2cwRG.d.cts +0 -1789
  258. package/dist/resolved-V5COsfDu.d.mts +0 -1791
  259. package/dist/runtime-Bisl_1Ja.cjs +0 -0
  260. package/dist/runtime-Q8Ni8SeN.d.cts +0 -794
  261. package/dist/runtime-azNoeKr-.mjs +0 -1
  262. package/dist/runtime-qZ0Z2kEd.d.mts +0 -794
  263. package/dist/types-DwElXV6q.mjs +0 -1
  264. package/dist/types-MYBaygjr.cjs +0 -0
@@ -0,0 +1,161 @@
1
+ const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.cjs');
2
+ const require_context = require('../../types/context.cjs');
3
+ const require_build = require('../../types/build.cjs');
4
+ const require_entry = require('../entry.cjs');
5
+ let __stryke_path_replace = require("@stryke/path/replace");
6
+ let __stryke_path_join_paths = require("@stryke/path/join-paths");
7
+ let defu = require("defu");
8
+ defu = require_rolldown_runtime.__toESM(defu);
9
+ let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
10
+ let __stryke_helpers_omit = require("@stryke/helpers/omit");
11
+ let __stryke_string_format_camel_case = require("@stryke/string-format/camel-case");
12
+
13
+ //#region ../powerlines/src/lib/build/esbuild.ts
14
+ function __assignType(fn, args) {
15
+ fn.__type = args;
16
+ return fn;
17
+ }
18
+ const DEFAULT_ESBUILD_CONFIG = {
19
+ target: "esnext",
20
+ platform: "neutral",
21
+ format: "esm",
22
+ write: true,
23
+ minify: true,
24
+ sourcemap: false,
25
+ bundle: true,
26
+ treeShaking: true,
27
+ keepNames: true,
28
+ splitting: true,
29
+ logLevel: "silent"
30
+ };
31
+ /**
32
+ * Resolves the entry options for esbuild.
33
+ *
34
+ * @param context - The build context.
35
+ * @param entryPoints - The entry points to resolve.
36
+ * @returns The resolved entry options.
37
+ */
38
+ function resolveESBuildEntry(context, entryPoints = []) {
39
+ return entryPoints.reduce(__assignType((ret, entry) => {
40
+ if ((0, __stryke_type_checks_is_string.isString)(entry)) ret[(0, __stryke_path_replace.replaceExtension)((0, __stryke_path_replace.replacePath)(entry, context.config.sourceRoot || context.config.projectRoot))] = (0, __stryke_path_replace.replacePath)(entry, context.config.sourceRoot || context.config.projectRoot);
41
+ else ret[entry.output || require_entry.resolveEntryOutput(context, entry.input || entry)] = require_entry.resolveEntryInputFile(context, entry.input || entry);
42
+ return ret;
43
+ }, [
44
+ "ret",
45
+ "entry",
46
+ "",
47
+ "P\"2!\"2\"\"/#"
48
+ ]), {});
49
+ }
50
+ resolveESBuildEntry.__type = [
51
+ () => require_context.__ΩContext,
52
+ "context",
53
+ "ResolvedEntryTypeDefinition",
54
+ "entryPoints",
55
+ () => [],
56
+ () => require_build.__ΩESBuildResolvedBuildConfig,
57
+ "entryPoints",
58
+ "resolveESBuildEntry",
59
+ "Resolves the entry options for esbuild.",
60
+ "Pn!2\"P\"w#F&FJ2$>%n&.'f/(?)"
61
+ ];
62
+ /**
63
+ * Resolves the esbuild options.
64
+ *
65
+ * @param context - The build context.
66
+ * @returns The resolved esbuild options.
67
+ */
68
+ function extractESBuildConfig(context) {
69
+ const inject = context.config.build.override.inject ?? context.config.build.inject;
70
+ if (inject && Object.keys(inject).length > 0) context.fs.writeSync((0, __stryke_path_join_paths.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.artifactsPath, "inject-shim.js"), Object.entries(inject).map(__assignType(([key, value]) => {
71
+ if (value) if (Array.isArray(value)) {
72
+ if ((0, __stryke_string_format_camel_case.camelCase)(key) !== key) {
73
+ if (value.length === 1) return `
74
+ import ${(0, __stryke_string_format_camel_case.camelCase)(key)} from "${value[0]}";
75
+ export { ${(0, __stryke_string_format_camel_case.camelCase)(key)} as "${key}" }`;
76
+ else if (value.length > 1) return `
77
+ import ${value[1] === "*" ? `* as ${(0, __stryke_string_format_camel_case.camelCase)(key)}` : `{ ${value[1]} as ${(0, __stryke_string_format_camel_case.camelCase)(key)} }`} from "${value[0]}";
78
+ export { ${(0, __stryke_string_format_camel_case.camelCase)(key)} as "${key}" }`;
79
+ } else if (value.length === 1) return `
80
+ import ${key} from "${value[0]}";
81
+ export { ${key} };`;
82
+ else if (value.length > 1) return `
83
+ import ${value[1] === "*" ? `* as ${key}` : `{ ${value[1]} as ${key} }`} from "${value[0]}";
84
+ export { ${key} };`;
85
+ } else if ((0, __stryke_string_format_camel_case.camelCase)(key) !== key) return `
86
+ import ${(0, __stryke_string_format_camel_case.camelCase)(key)} from "${value[0]}";
87
+ export { ${(0, __stryke_string_format_camel_case.camelCase)(key)} as "${key}" }`;
88
+ else return `
89
+ import ${key} from "${value}";
90
+ export { ${key} };`;
91
+ return "";
92
+ }, [
93
+ "param0",
94
+ "",
95
+ "P\"2!\"/\""
96
+ ])).join("\n"));
97
+ return (0, defu.default)({
98
+ alias: context.builtins.reduce(__assignType((ret, id) => {
99
+ if (!ret[id]) {
100
+ const path = context.fs.ids[id];
101
+ if (path) ret[id] = path;
102
+ }
103
+ return ret;
104
+ }, [
105
+ "ret",
106
+ "id",
107
+ "",
108
+ "P\"2!\"2\"\"/#"
109
+ ]), context.config.build.alias ? Array.isArray(context.config.build.alias) ? context.config.build.alias.reduce(__assignType((ret, alias) => {
110
+ if (!ret[alias.find.toString()]) ret[alias.find.toString()] = alias.replacement;
111
+ return ret;
112
+ }, [
113
+ "ret",
114
+ "alias",
115
+ "",
116
+ "P\"2!\"2\"\"/#"
117
+ ]), {}) : context.config.build.alias : {}),
118
+ inject: inject && Object.keys(inject).length > 0 ? [(0, __stryke_path_join_paths.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.artifactsPath, "inject-shim.js")] : void 0
119
+ }, context.config.build.variant === "esbuild" ? (0, __stryke_helpers_omit.omit)(context.config.build.override, [
120
+ "alias",
121
+ "inject",
122
+ "external",
123
+ "noExternal",
124
+ "skipNodeModulesBundle",
125
+ "extensions"
126
+ ]) : {}, context.config.build.variant === "esbuild" ? (0, __stryke_helpers_omit.omit)(context.config.build, [
127
+ "alias",
128
+ "inject",
129
+ "external",
130
+ "noExternal",
131
+ "skipNodeModulesBundle",
132
+ "extensions",
133
+ "variant",
134
+ "override"
135
+ ]) : {}, {
136
+ mainFields: context.config.build.mainFields,
137
+ conditions: context.config.build.conditions,
138
+ define: context.config.build.define,
139
+ resolveExtensions: context.config.build.extensions,
140
+ packages: context.config.build.skipNodeModulesBundle ? "external" : context.config.build.variant === "esbuild" ? context.config.build.packages : void 0,
141
+ format: Array.isArray(context.config.output.format) ? context.config.output.format[0] : context.config.output.format,
142
+ platform: context.config.build.platform,
143
+ treeShaking: Boolean(context.config.build?.treeshake) || context.config.build?.treeShaking,
144
+ outdir: context.config.output.buildPath,
145
+ tsconfig: context.tsconfig.tsconfigFilePath,
146
+ minify: context.config.mode !== "development",
147
+ metafile: context.config.mode === "development",
148
+ sourcemap: context.config.mode === "development"
149
+ }, DEFAULT_ESBUILD_CONFIG);
150
+ }
151
+ extractESBuildConfig.__type = [
152
+ () => require_context.__ΩContext,
153
+ "context",
154
+ "BuildOptions",
155
+ "extractESBuildConfig",
156
+ "Resolves the esbuild options.",
157
+ "Pn!2\"\"w#/$?%"
158
+ ];
159
+
160
+ //#endregion
161
+ exports.extractESBuildConfig = extractESBuildConfig;
@@ -0,0 +1,159 @@
1
+ import { __ΩContext } from "../../types/context.mjs";
2
+ import { __ΩESBuildResolvedBuildConfig } from "../../types/build.mjs";
3
+ import { resolveEntryInputFile, resolveEntryOutput } from "../entry.mjs";
4
+ import { replaceExtension, replacePath } from "@stryke/path/replace";
5
+ import { joinPaths } from "@stryke/path/join-paths";
6
+ import defu$1 from "defu";
7
+ import { isString } from "@stryke/type-checks/is-string";
8
+ import { omit } from "@stryke/helpers/omit";
9
+ import { camelCase } from "@stryke/string-format/camel-case";
10
+
11
+ //#region ../powerlines/src/lib/build/esbuild.ts
12
+ function __assignType(fn, args) {
13
+ fn.__type = args;
14
+ return fn;
15
+ }
16
+ const DEFAULT_ESBUILD_CONFIG = {
17
+ target: "esnext",
18
+ platform: "neutral",
19
+ format: "esm",
20
+ write: true,
21
+ minify: true,
22
+ sourcemap: false,
23
+ bundle: true,
24
+ treeShaking: true,
25
+ keepNames: true,
26
+ splitting: true,
27
+ logLevel: "silent"
28
+ };
29
+ /**
30
+ * Resolves the entry options for esbuild.
31
+ *
32
+ * @param context - The build context.
33
+ * @param entryPoints - The entry points to resolve.
34
+ * @returns The resolved entry options.
35
+ */
36
+ function resolveESBuildEntry(context, entryPoints = []) {
37
+ return entryPoints.reduce(__assignType((ret, entry) => {
38
+ if (isString(entry)) ret[replaceExtension(replacePath(entry, context.config.sourceRoot || context.config.projectRoot))] = replacePath(entry, context.config.sourceRoot || context.config.projectRoot);
39
+ else ret[entry.output || resolveEntryOutput(context, entry.input || entry)] = resolveEntryInputFile(context, entry.input || entry);
40
+ return ret;
41
+ }, [
42
+ "ret",
43
+ "entry",
44
+ "",
45
+ "P\"2!\"2\"\"/#"
46
+ ]), {});
47
+ }
48
+ resolveESBuildEntry.__type = [
49
+ () => __ΩContext,
50
+ "context",
51
+ "ResolvedEntryTypeDefinition",
52
+ "entryPoints",
53
+ () => [],
54
+ () => __ΩESBuildResolvedBuildConfig,
55
+ "entryPoints",
56
+ "resolveESBuildEntry",
57
+ "Resolves the entry options for esbuild.",
58
+ "Pn!2\"P\"w#F&FJ2$>%n&.'f/(?)"
59
+ ];
60
+ /**
61
+ * Resolves the esbuild options.
62
+ *
63
+ * @param context - The build context.
64
+ * @returns The resolved esbuild options.
65
+ */
66
+ function extractESBuildConfig(context) {
67
+ const inject = context.config.build.override.inject ?? context.config.build.inject;
68
+ if (inject && Object.keys(inject).length > 0) context.fs.writeSync(joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.artifactsPath, "inject-shim.js"), Object.entries(inject).map(__assignType(([key, value]) => {
69
+ if (value) if (Array.isArray(value)) {
70
+ if (camelCase(key) !== key) {
71
+ if (value.length === 1) return `
72
+ import ${camelCase(key)} from "${value[0]}";
73
+ export { ${camelCase(key)} as "${key}" }`;
74
+ else if (value.length > 1) return `
75
+ import ${value[1] === "*" ? `* as ${camelCase(key)}` : `{ ${value[1]} as ${camelCase(key)} }`} from "${value[0]}";
76
+ export { ${camelCase(key)} as "${key}" }`;
77
+ } else if (value.length === 1) return `
78
+ import ${key} from "${value[0]}";
79
+ export { ${key} };`;
80
+ else if (value.length > 1) return `
81
+ import ${value[1] === "*" ? `* as ${key}` : `{ ${value[1]} as ${key} }`} from "${value[0]}";
82
+ export { ${key} };`;
83
+ } else if (camelCase(key) !== key) return `
84
+ import ${camelCase(key)} from "${value[0]}";
85
+ export { ${camelCase(key)} as "${key}" }`;
86
+ else return `
87
+ import ${key} from "${value}";
88
+ export { ${key} };`;
89
+ return "";
90
+ }, [
91
+ "param0",
92
+ "",
93
+ "P\"2!\"/\""
94
+ ])).join("\n"));
95
+ return defu$1({
96
+ alias: context.builtins.reduce(__assignType((ret, id) => {
97
+ if (!ret[id]) {
98
+ const path = context.fs.ids[id];
99
+ if (path) ret[id] = path;
100
+ }
101
+ return ret;
102
+ }, [
103
+ "ret",
104
+ "id",
105
+ "",
106
+ "P\"2!\"2\"\"/#"
107
+ ]), context.config.build.alias ? Array.isArray(context.config.build.alias) ? context.config.build.alias.reduce(__assignType((ret, alias) => {
108
+ if (!ret[alias.find.toString()]) ret[alias.find.toString()] = alias.replacement;
109
+ return ret;
110
+ }, [
111
+ "ret",
112
+ "alias",
113
+ "",
114
+ "P\"2!\"2\"\"/#"
115
+ ]), {}) : context.config.build.alias : {}),
116
+ inject: inject && Object.keys(inject).length > 0 ? [joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.artifactsPath, "inject-shim.js")] : void 0
117
+ }, context.config.build.variant === "esbuild" ? omit(context.config.build.override, [
118
+ "alias",
119
+ "inject",
120
+ "external",
121
+ "noExternal",
122
+ "skipNodeModulesBundle",
123
+ "extensions"
124
+ ]) : {}, context.config.build.variant === "esbuild" ? omit(context.config.build, [
125
+ "alias",
126
+ "inject",
127
+ "external",
128
+ "noExternal",
129
+ "skipNodeModulesBundle",
130
+ "extensions",
131
+ "variant",
132
+ "override"
133
+ ]) : {}, {
134
+ mainFields: context.config.build.mainFields,
135
+ conditions: context.config.build.conditions,
136
+ define: context.config.build.define,
137
+ resolveExtensions: context.config.build.extensions,
138
+ packages: context.config.build.skipNodeModulesBundle ? "external" : context.config.build.variant === "esbuild" ? context.config.build.packages : void 0,
139
+ format: Array.isArray(context.config.output.format) ? context.config.output.format[0] : context.config.output.format,
140
+ platform: context.config.build.platform,
141
+ treeShaking: Boolean(context.config.build?.treeshake) || context.config.build?.treeShaking,
142
+ outdir: context.config.output.buildPath,
143
+ tsconfig: context.tsconfig.tsconfigFilePath,
144
+ minify: context.config.mode !== "development",
145
+ metafile: context.config.mode === "development",
146
+ sourcemap: context.config.mode === "development"
147
+ }, DEFAULT_ESBUILD_CONFIG);
148
+ }
149
+ extractESBuildConfig.__type = [
150
+ () => __ΩContext,
151
+ "context",
152
+ "BuildOptions",
153
+ "extractESBuildConfig",
154
+ "Resolves the esbuild options.",
155
+ "Pn!2\"\"w#/$?%"
156
+ ];
157
+
158
+ //#endregion
159
+ export { extractESBuildConfig };
@@ -0,0 +1,203 @@
1
+ const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
2
+ const require_resolved = require('../types/resolved.cjs');
3
+ const require_paths = require('../plugin-utils/paths.cjs');
4
+ let __stryke_path_replace = require("@stryke/path/replace");
5
+ let __stryke_convert_to_array = require("@stryke/convert/to-array");
6
+ let __stryke_fs_is_file = require("@stryke/fs/is-file");
7
+ let __stryke_fs_list_files = require("@stryke/fs/list-files");
8
+ let __stryke_path_append = require("@stryke/path/append");
9
+ let __stryke_path_join_paths = require("@stryke/path/join-paths");
10
+ let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
11
+ let __stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
12
+ let __stryke_convert_parse_type_definition = require("@stryke/convert/parse-type-definition");
13
+ let __stryke_helpers_get_unique = require("@stryke/helpers/get-unique");
14
+ let __stryke_hash_murmurhash = require("@stryke/hash/murmurhash");
15
+
16
+ //#region ../powerlines/src/lib/entry.ts
17
+ function __assignType(fn, args) {
18
+ fn.__type = args;
19
+ return fn;
20
+ }
21
+ function resolveEntryInputFile(context, typeDefinition) {
22
+ return (0, __stryke_path_replace.replacePath)(typeDefinition.file, (0, __stryke_path_join_paths.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot));
23
+ }
24
+ resolveEntryInputFile.__type = [
25
+ "Context",
26
+ "context",
27
+ "typeDefinition",
28
+ "resolveEntryInputFile",
29
+ "P\"w!2\"!2#&/$"
30
+ ];
31
+ function resolveEntryInput(context, typeDefinition) {
32
+ return {
33
+ file: resolveEntryInputFile(context, typeDefinition),
34
+ name: typeDefinition.name
35
+ };
36
+ }
37
+ resolveEntryInput.__type = [
38
+ "Context",
39
+ "context",
40
+ "typeDefinition",
41
+ "resolveEntryInput",
42
+ "P\"w!2\"!2#!/$"
43
+ ];
44
+ function resolveEntryOutput(context, typeDefinition) {
45
+ return (0, __stryke_path_replace.replaceExtension)((0, __stryke_path_replace.replacePath)((0, __stryke_path_replace.replacePath)((0, __stryke_path_replace.replacePath)((0, __stryke_path_replace.replacePath)((0, __stryke_path_replace.replacePath)(typeDefinition.file, (0, __stryke_path_join_paths.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.sourceRoot)), (0, __stryke_path_join_paths.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot)), context.config.sourceRoot), context.config.projectRoot), (0, __stryke_path_replace.replacePath)(context.config.sourceRoot, context.config.projectRoot)));
46
+ }
47
+ resolveEntryOutput.__type = [
48
+ "Context",
49
+ "context",
50
+ "typeDefinition",
51
+ "resolveEntryOutput",
52
+ "P\"w!2\"!2#&/$"
53
+ ];
54
+ function resolveEntry(context, typeDefinition) {
55
+ const input = resolveEntryInput(context, typeDefinition);
56
+ return {
57
+ ...input,
58
+ input,
59
+ output: resolveEntryOutput(context, typeDefinition)
60
+ };
61
+ }
62
+ resolveEntry.__type = [
63
+ "Context",
64
+ "context",
65
+ "typeDefinition",
66
+ () => require_resolved.__ΩResolvedEntryTypeDefinition,
67
+ "resolveEntry",
68
+ "P\"w!2\"!2#n$/%"
69
+ ];
70
+ /**
71
+ * Resolves multiple type definitions into their corresponding resolved entry type definitions.
72
+ *
73
+ * @param context - The current context
74
+ * @param typeDefinitions - The type definitions to resolve.
75
+ * @returns A promise that resolves to an array of resolved entry type definitions.
76
+ */
77
+ async function resolveEntries(context, typeDefinitions) {
78
+ return (await Promise.all(typeDefinitions.map(__assignType(async (typeDefinition) => {
79
+ const parsed = (0, __stryke_convert_parse_type_definition.parseTypeDefinition)(typeDefinition);
80
+ const filePath = (0, __stryke_path_append.appendPath)(parsed.file, context.config.projectRoot);
81
+ if ((0, __stryke_fs_is_file.isFile)(filePath)) return resolveEntry(context, {
82
+ file: (0, __stryke_path_replace.replacePath)(filePath, context.config.projectRoot),
83
+ name: parsed.name
84
+ });
85
+ return (await (0, __stryke_fs_list_files.listFiles)((0, __stryke_path_append.appendPath)(parsed.file, context.config.projectRoot))).map(__assignType((file) => resolveEntry(context, {
86
+ file,
87
+ name: parsed.name
88
+ }), [
89
+ "file",
90
+ "",
91
+ "P\"2!\"/\""
92
+ ]));
93
+ }, [
94
+ "typeDefinition",
95
+ "",
96
+ "P\"2!\"/\""
97
+ ])))).flat().filter(Boolean);
98
+ }
99
+ resolveEntries.__type = [
100
+ "Context",
101
+ "context",
102
+ "typeDefinitions",
103
+ () => require_resolved.__ΩResolvedEntryTypeDefinition,
104
+ "resolveEntries",
105
+ "Resolves multiple type definitions into their corresponding resolved entry type definitions.",
106
+ "P\"w!2\"!F2#n$F`/%?&"
107
+ ];
108
+ /**
109
+ * Resolves multiple type definitions into their corresponding resolved entry type definitions.
110
+ *
111
+ * @param context - The current context
112
+ * @param typeDefinitions - The type definitions to resolve.
113
+ * @returns A promise that resolves to an array of resolved entry type definitions.
114
+ */
115
+ function resolveEntriesSync(context, typeDefinitions) {
116
+ return typeDefinitions.map(__assignType((entry) => (0, __stryke_type_checks_is_string.isString)(entry) ? require_paths.replacePathTokens(context, entry) : require_paths.replacePathTokens(context, entry.file), [
117
+ "entry",
118
+ "",
119
+ "P\"2!\"/\""
120
+ ])).map(__assignType((typeDefinition) => {
121
+ const parsed = (0, __stryke_convert_parse_type_definition.parseTypeDefinition)(typeDefinition);
122
+ const filePath = (0, __stryke_path_append.appendPath)(parsed.file, context.config.projectRoot);
123
+ if ((0, __stryke_fs_is_file.isFile)(filePath)) return resolveEntry(context, {
124
+ file: (0, __stryke_path_replace.replacePath)(filePath, context.config.projectRoot),
125
+ name: parsed.name
126
+ });
127
+ return (0, __stryke_fs_list_files.listFilesSync)(filePath).map(__assignType((file) => resolveEntry(context, {
128
+ file,
129
+ name: parsed.name
130
+ }), [
131
+ "file",
132
+ "",
133
+ "P\"2!\"/\""
134
+ ]));
135
+ }, [
136
+ "typeDefinition",
137
+ "",
138
+ "P\"2!\"/\""
139
+ ])).flat().filter(Boolean);
140
+ }
141
+ resolveEntriesSync.__type = [
142
+ "Context",
143
+ "context",
144
+ "typeDefinitions",
145
+ () => require_resolved.__ΩResolvedEntryTypeDefinition,
146
+ "resolveEntriesSync",
147
+ "Resolves multiple type definitions into their corresponding resolved entry type definitions.",
148
+ "P\"w!2\"!F2#n$F/%?&"
149
+ ];
150
+ /** Resolve a virtual entry point by generating a unique file path in the artifacts directory.
151
+ *
152
+ * @param context - The current context
153
+ * @param typeDefinition - The type definition to resolve.
154
+ * @returns The resolved entry type definition with a unique virtual file path.
155
+ */
156
+ function resolveVirtualEntry(context, typeDefinition) {
157
+ const resolved = resolveEntry(context, (0, __stryke_convert_parse_type_definition.parseTypeDefinition)(typeDefinition));
158
+ const file = (0, __stryke_path_join_paths.joinPaths)(context.artifactsPath, `entry-${(0, __stryke_hash_murmurhash.murmurhash)({
159
+ file: resolved.file,
160
+ name: resolved.name
161
+ }, { maxLength: 24 }).replaceAll("-", "0").replaceAll("_", "1")}.ts`);
162
+ return {
163
+ file,
164
+ name: resolved.name,
165
+ input: {
166
+ file,
167
+ name: resolved.name
168
+ },
169
+ output: file
170
+ };
171
+ }
172
+ resolveVirtualEntry.__type = [
173
+ "Context",
174
+ "context",
175
+ "typeDefinition",
176
+ () => require_resolved.__ΩResolvedEntryTypeDefinition,
177
+ "resolveVirtualEntry",
178
+ "P\"w!2\"!2#n$/%"
179
+ ];
180
+ /**
181
+ * Get unique entries from the provided list.
182
+ *
183
+ * @param entries - The entries to process.
184
+ * @returns An array of unique entries (by file path or content hash).
185
+ */
186
+ function getUniqueEntries(entries = []) {
187
+ return (0, __stryke_helpers_get_unique.getUniqueBy)((0, __stryke_convert_to_array.toArray)(entries), __assignType((item) => (0, __stryke_type_checks_is_set_string.isSetString)(item) ? item : (0, __stryke_hash_murmurhash.murmurhash)(item ?? {}, { maxLength: 24 }), [
188
+ "item",
189
+ "",
190
+ "P!2!\"/\""
191
+ ]));
192
+ }
193
+ getUniqueEntries.__type = [
194
+ "entries",
195
+ () => [],
196
+ "getUniqueEntries",
197
+ "Get unique entries from the provided list.",
198
+ "PP!!FJ2!>\"!F/#?$"
199
+ ];
200
+
201
+ //#endregion
202
+ exports.resolveEntryInputFile = resolveEntryInputFile;
203
+ exports.resolveEntryOutput = resolveEntryOutput;