@powerlines/core 0.15.0 → 0.15.1

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 (391) hide show
  1. package/dist/constants/api.cjs +6 -5
  2. package/dist/constants/api.d.cts +3 -3
  3. package/dist/constants/api.d.cts.map +1 -1
  4. package/dist/constants/api.d.mts +3 -3
  5. package/dist/constants/api.d.mts.map +1 -1
  6. package/dist/constants/api.mjs +4 -4
  7. package/dist/constants/api.mjs.map +1 -1
  8. package/dist/constants/commands.cjs +3 -2
  9. package/dist/constants/commands.d.cts +1 -1
  10. package/dist/constants/commands.d.mts +1 -1
  11. package/dist/constants/commands.mjs +2 -2
  12. package/dist/constants/commands.mjs.map +1 -1
  13. package/dist/constants/devtools.cjs +23 -0
  14. package/dist/constants/devtools.d.cts +13 -0
  15. package/dist/constants/devtools.d.cts.map +1 -0
  16. package/dist/constants/devtools.d.mts +13 -0
  17. package/dist/constants/devtools.d.mts.map +1 -0
  18. package/dist/constants/devtools.mjs +14 -0
  19. package/dist/constants/devtools.mjs.map +1 -0
  20. package/dist/constants/environments.cjs +1 -0
  21. package/dist/constants/extensions.cjs +21 -0
  22. package/dist/constants/extensions.d.cts +5 -0
  23. package/dist/constants/extensions.d.cts.map +1 -0
  24. package/dist/constants/extensions.d.mts +5 -0
  25. package/dist/constants/extensions.d.mts.map +1 -0
  26. package/dist/constants/extensions.mjs +20 -0
  27. package/dist/constants/extensions.mjs.map +1 -0
  28. package/dist/constants/fs.cjs +1 -0
  29. package/dist/constants/hooks.cjs +1 -0
  30. package/dist/constants/index.cjs +48 -30
  31. package/dist/constants/index.d.cts +5 -3
  32. package/dist/constants/index.d.mts +5 -3
  33. package/dist/constants/index.mjs +5 -3
  34. package/dist/constants/log-level.cjs +90 -0
  35. package/dist/constants/log-level.d.cts +63 -0
  36. package/dist/constants/log-level.d.cts.map +1 -0
  37. package/dist/constants/log-level.d.mts +63 -0
  38. package/dist/constants/log-level.d.mts.map +1 -0
  39. package/dist/constants/log-level.mjs +82 -0
  40. package/dist/constants/log-level.mjs.map +1 -0
  41. package/dist/constants/meta.cjs +1 -0
  42. package/dist/constants/plugin.cjs +3 -2
  43. package/dist/constants/plugin.d.cts +2 -2
  44. package/dist/constants/plugin.d.mts +2 -2
  45. package/dist/context/base-context.cjs +127 -0
  46. package/dist/context/base-context.d.cts +81 -0
  47. package/dist/context/base-context.d.cts.map +1 -0
  48. package/dist/context/base-context.d.mts +81 -0
  49. package/dist/context/base-context.d.mts.map +1 -0
  50. package/dist/context/base-context.mjs +125 -0
  51. package/dist/context/base-context.mjs.map +1 -0
  52. package/dist/context/context.cjs +934 -0
  53. package/dist/context/context.d.cts +369 -0
  54. package/dist/context/context.d.cts.map +1 -0
  55. package/dist/context/context.d.mts +369 -0
  56. package/dist/context/context.d.mts.map +1 -0
  57. package/dist/context/context.mjs +932 -0
  58. package/dist/context/context.mjs.map +1 -0
  59. package/dist/context/environment-context.cjs +219 -0
  60. package/dist/context/environment-context.d.cts +100 -0
  61. package/dist/context/environment-context.d.cts.map +1 -0
  62. package/dist/context/environment-context.d.mts +100 -0
  63. package/dist/context/environment-context.d.mts.map +1 -0
  64. package/dist/context/environment-context.mjs +218 -0
  65. package/dist/context/environment-context.mjs.map +1 -0
  66. package/dist/context/execution-context.cjs +230 -0
  67. package/dist/context/execution-context.d.cts +101 -0
  68. package/dist/context/execution-context.d.cts.map +1 -0
  69. package/dist/context/execution-context.d.mts +101 -0
  70. package/dist/context/execution-context.d.mts.map +1 -0
  71. package/dist/context/execution-context.mjs +228 -0
  72. package/dist/context/execution-context.mjs.map +1 -0
  73. package/dist/context/index.cjs +12 -0
  74. package/dist/context/index.d.cts +6 -0
  75. package/dist/context/index.d.mts +6 -0
  76. package/dist/context/index.mjs +7 -0
  77. package/dist/context/plugin-context.cjs +83 -0
  78. package/dist/context/plugin-context.d.cts +18 -0
  79. package/dist/context/plugin-context.d.cts.map +1 -0
  80. package/dist/context/plugin-context.d.mts +18 -0
  81. package/dist/context/plugin-context.d.mts.map +1 -0
  82. package/dist/context/plugin-context.mjs +82 -0
  83. package/dist/context/plugin-context.mjs.map +1 -0
  84. package/dist/index.cjs +62 -9
  85. package/dist/index.d.cts +20 -9
  86. package/dist/index.d.mts +20 -9
  87. package/dist/index.mjs +17 -5
  88. package/dist/lib/config.cjs +160 -15
  89. package/dist/lib/config.d.cts +92 -6
  90. package/dist/lib/config.d.cts.map +1 -1
  91. package/dist/lib/config.d.mts +92 -6
  92. package/dist/lib/config.d.mts.map +1 -1
  93. package/dist/lib/config.mjs +154 -16
  94. package/dist/lib/config.mjs.map +1 -1
  95. package/dist/lib/context-helpers.cjs +43 -0
  96. package/dist/lib/context-helpers.d.cts +19 -0
  97. package/dist/lib/context-helpers.d.cts.map +1 -0
  98. package/dist/lib/context-helpers.d.mts +19 -0
  99. package/dist/lib/context-helpers.d.mts.map +1 -0
  100. package/dist/lib/context-helpers.mjs +41 -0
  101. package/dist/lib/context-helpers.mjs.map +1 -0
  102. package/dist/lib/entry.cjs +5 -5
  103. package/dist/lib/entry.d.cts.map +1 -1
  104. package/dist/lib/entry.d.mts.map +1 -1
  105. package/dist/lib/entry.mjs +5 -5
  106. package/dist/lib/entry.mjs.map +1 -1
  107. package/dist/lib/environment.cjs +72 -0
  108. package/dist/lib/environment.d.cts +12 -0
  109. package/dist/lib/environment.d.cts.map +1 -0
  110. package/dist/lib/environment.d.mts +12 -0
  111. package/dist/lib/environment.d.mts.map +1 -0
  112. package/dist/lib/environment.mjs +67 -0
  113. package/dist/lib/environment.mjs.map +1 -0
  114. package/dist/lib/events.cjs +43 -0
  115. package/dist/lib/events.d.cts +10 -0
  116. package/dist/lib/events.d.cts.map +1 -0
  117. package/dist/lib/events.d.mts +10 -0
  118. package/dist/lib/events.d.mts.map +1 -0
  119. package/dist/lib/events.mjs +42 -0
  120. package/dist/lib/events.mjs.map +1 -0
  121. package/dist/lib/generate-types.cjs +371 -0
  122. package/dist/lib/generate-types.d.cts +67 -0
  123. package/dist/lib/generate-types.d.cts.map +1 -0
  124. package/dist/lib/generate-types.d.mts +67 -0
  125. package/dist/lib/generate-types.d.mts.map +1 -0
  126. package/dist/lib/generate-types.mjs +368 -0
  127. package/dist/lib/generate-types.mjs.map +1 -0
  128. package/dist/lib/hooks.cjs +152 -0
  129. package/dist/lib/hooks.d.cts +28 -0
  130. package/dist/lib/hooks.d.cts.map +1 -0
  131. package/dist/lib/hooks.d.mts +28 -0
  132. package/dist/lib/hooks.d.mts.map +1 -0
  133. package/dist/lib/hooks.mjs +147 -0
  134. package/dist/lib/hooks.mjs.map +1 -0
  135. package/dist/lib/index.cjs +64 -9
  136. package/dist/lib/index.d.cts +15 -3
  137. package/dist/lib/index.d.mts +15 -3
  138. package/dist/lib/index.mjs +19 -5
  139. package/dist/lib/install-dependencies.cjs +25 -0
  140. package/dist/lib/install-dependencies.d.cts +12 -0
  141. package/dist/lib/install-dependencies.d.cts.map +1 -0
  142. package/dist/lib/install-dependencies.d.mts +12 -0
  143. package/dist/lib/install-dependencies.d.mts.map +1 -0
  144. package/dist/lib/install-dependencies.mjs +24 -0
  145. package/dist/lib/install-dependencies.mjs.map +1 -0
  146. package/dist/lib/meta.cjs +57 -0
  147. package/dist/lib/meta.d.cts +34 -0
  148. package/dist/lib/meta.d.cts.map +1 -0
  149. package/dist/lib/meta.d.mts +34 -0
  150. package/dist/lib/meta.d.mts.map +1 -0
  151. package/dist/lib/meta.mjs +54 -0
  152. package/dist/lib/meta.mjs.map +1 -0
  153. package/dist/lib/plugins.cjs +150 -0
  154. package/dist/lib/plugins.d.cts +40 -0
  155. package/dist/lib/plugins.d.cts.map +1 -0
  156. package/dist/lib/plugins.d.mts +40 -0
  157. package/dist/lib/plugins.d.mts.map +1 -0
  158. package/dist/lib/plugins.mjs +146 -0
  159. package/dist/lib/plugins.mjs.map +1 -0
  160. package/dist/lib/resolver.cjs +35 -0
  161. package/dist/lib/resolver.d.cts +21 -0
  162. package/dist/lib/resolver.d.cts.map +1 -0
  163. package/dist/lib/resolver.d.mts +21 -0
  164. package/dist/lib/resolver.d.mts.map +1 -0
  165. package/dist/lib/resolver.mjs +33 -0
  166. package/dist/lib/resolver.mjs.map +1 -0
  167. package/dist/lib/schemas.cjs +9 -0
  168. package/dist/lib/schemas.d.cts +2 -0
  169. package/dist/lib/schemas.d.mts +2 -0
  170. package/dist/lib/schemas.mjs +3 -0
  171. package/dist/lib/streaming-channel.cjs +260 -0
  172. package/dist/lib/streaming-channel.d.cts +133 -0
  173. package/dist/lib/streaming-channel.d.cts.map +1 -0
  174. package/dist/lib/streaming-channel.d.mts +133 -0
  175. package/dist/lib/streaming-channel.d.mts.map +1 -0
  176. package/dist/lib/streaming-channel.mjs +258 -0
  177. package/dist/lib/streaming-channel.mjs.map +1 -0
  178. package/dist/lib/typescript/index.cjs +16 -0
  179. package/dist/lib/typescript/index.d.cts +3 -0
  180. package/dist/lib/typescript/index.d.mts +3 -0
  181. package/dist/lib/typescript/index.mjs +4 -0
  182. package/dist/lib/typescript/ts-morph.cjs +105 -0
  183. package/dist/lib/typescript/ts-morph.d.cts +38 -0
  184. package/dist/lib/typescript/ts-morph.d.cts.map +1 -0
  185. package/dist/lib/typescript/ts-morph.d.mts +38 -0
  186. package/dist/lib/typescript/ts-morph.d.mts.map +1 -0
  187. package/dist/lib/typescript/ts-morph.mjs +102 -0
  188. package/dist/lib/typescript/ts-morph.mjs.map +1 -0
  189. package/dist/lib/typescript/tsconfig.cjs +253 -0
  190. package/dist/lib/typescript/tsconfig.d.cts +77 -0
  191. package/dist/lib/typescript/tsconfig.d.cts.map +1 -0
  192. package/dist/lib/typescript/tsconfig.d.mts +77 -0
  193. package/dist/lib/typescript/tsconfig.d.mts.map +1 -0
  194. package/dist/lib/typescript/tsconfig.mjs +240 -0
  195. package/dist/lib/typescript/tsconfig.mjs.map +1 -0
  196. package/dist/lib/unplugin/helpers.cjs +2 -2
  197. package/dist/lib/unplugin/module-resolution.cjs +18 -18
  198. package/dist/lib/unplugin/module-resolution.mjs +18 -18
  199. package/dist/lib/unplugin/module-resolution.mjs.map +1 -1
  200. package/dist/lib/unplugin/plugin.cjs +55 -62
  201. package/dist/lib/unplugin/plugin.d.cts +10 -11
  202. package/dist/lib/unplugin/plugin.d.cts.map +1 -1
  203. package/dist/lib/unplugin/plugin.d.mts +10 -11
  204. package/dist/lib/unplugin/plugin.d.mts.map +1 -1
  205. package/dist/lib/unplugin/plugin.mjs +55 -62
  206. package/dist/lib/unplugin/plugin.mjs.map +1 -1
  207. package/dist/lib/utilities/file-header.cjs +2 -2
  208. package/dist/lib/utilities/file-header.mjs +2 -2
  209. package/dist/lib/utilities/file-header.mjs.map +1 -1
  210. package/dist/lib/utilities/format.cjs +1 -1
  211. package/dist/lib/utilities/format.mjs +1 -1
  212. package/dist/lib/utilities/index.cjs +2 -2
  213. package/dist/lib/utilities/index.mjs +2 -2
  214. package/dist/lib/utilities/write-file.cjs +1 -2
  215. package/dist/lib/utilities/write-file.d.cts +1 -1
  216. package/dist/lib/utilities/write-file.d.cts.map +1 -1
  217. package/dist/lib/utilities/write-file.d.mts +1 -1
  218. package/dist/lib/utilities/write-file.d.mts.map +1 -1
  219. package/dist/lib/utilities/write-file.mjs +1 -2
  220. package/dist/lib/utilities/write-file.mjs.map +1 -1
  221. package/dist/lib/vfs.cjs +1104 -0
  222. package/dist/lib/vfs.d.cts +321 -0
  223. package/dist/lib/vfs.d.cts.map +1 -0
  224. package/dist/lib/vfs.d.mts +321 -0
  225. package/dist/lib/vfs.d.mts.map +1 -0
  226. package/dist/lib/vfs.mjs +1102 -0
  227. package/dist/lib/vfs.mjs.map +1 -0
  228. package/dist/plugin-base.cjs +1 -1
  229. package/dist/plugin-base.mjs +1 -1
  230. package/dist/plugin-base.mjs.map +1 -1
  231. package/dist/plugin-utils/build-helpers.cjs +2 -2
  232. package/dist/plugin-utils/build-helpers.mjs +2 -2
  233. package/dist/plugin-utils/build-helpers.mjs.map +1 -1
  234. package/dist/plugin-utils/context-helpers.cjs +22 -12
  235. package/dist/plugin-utils/context-helpers.d.cts +9 -1
  236. package/dist/plugin-utils/context-helpers.d.cts.map +1 -1
  237. package/dist/plugin-utils/context-helpers.d.mts +9 -1
  238. package/dist/plugin-utils/context-helpers.d.mts.map +1 -1
  239. package/dist/plugin-utils/context-helpers.mjs +22 -13
  240. package/dist/plugin-utils/context-helpers.mjs.map +1 -1
  241. package/dist/plugin-utils/filter.cjs +13 -5
  242. package/dist/plugin-utils/filter.d.cts +2 -1
  243. package/dist/plugin-utils/filter.d.cts.map +1 -1
  244. package/dist/plugin-utils/filter.d.mts +2 -1
  245. package/dist/plugin-utils/filter.d.mts.map +1 -1
  246. package/dist/plugin-utils/filter.mjs +13 -6
  247. package/dist/plugin-utils/filter.mjs.map +1 -1
  248. package/dist/plugin-utils/format.cjs +44 -0
  249. package/dist/plugin-utils/format.d.cts +11 -0
  250. package/dist/plugin-utils/format.d.cts.map +1 -0
  251. package/dist/plugin-utils/format.d.mts +11 -0
  252. package/dist/plugin-utils/format.d.mts.map +1 -0
  253. package/dist/plugin-utils/format.mjs +43 -0
  254. package/dist/plugin-utils/format.mjs.map +1 -0
  255. package/dist/plugin-utils/helpers.cjs +6 -6
  256. package/dist/plugin-utils/helpers.d.cts +15 -15
  257. package/dist/plugin-utils/helpers.d.cts.map +1 -1
  258. package/dist/plugin-utils/helpers.d.mts +15 -15
  259. package/dist/plugin-utils/helpers.d.mts.map +1 -1
  260. package/dist/plugin-utils/helpers.mjs +1 -1
  261. package/dist/plugin-utils/helpers.mjs.map +1 -1
  262. package/dist/plugin-utils/index.cjs +34 -4
  263. package/dist/plugin-utils/index.d.cts +7 -4
  264. package/dist/plugin-utils/index.d.mts +7 -4
  265. package/dist/plugin-utils/index.mjs +9 -6
  266. package/dist/plugin-utils/install.cjs +47 -0
  267. package/dist/plugin-utils/install.d.cts +23 -0
  268. package/dist/plugin-utils/install.d.cts.map +1 -0
  269. package/dist/plugin-utils/install.d.mts +23 -0
  270. package/dist/plugin-utils/install.d.mts.map +1 -0
  271. package/dist/plugin-utils/install.mjs +45 -0
  272. package/dist/plugin-utils/install.mjs.map +1 -0
  273. package/dist/plugin-utils/logging.cjs +588 -1
  274. package/dist/plugin-utils/logging.d.cts +93 -1
  275. package/dist/plugin-utils/logging.d.cts.map +1 -1
  276. package/dist/plugin-utils/logging.d.mts +93 -1
  277. package/dist/plugin-utils/logging.d.mts.map +1 -1
  278. package/dist/plugin-utils/logging.mjs +572 -1
  279. package/dist/plugin-utils/logging.mjs.map +1 -1
  280. package/dist/plugin-utils/merge.cjs +1 -1
  281. package/dist/plugin-utils/merge.mjs +1 -1
  282. package/dist/plugin-utils/modules.cjs +1 -1
  283. package/dist/plugin-utils/modules.mjs +1 -1
  284. package/dist/plugin-utils/modules.mjs.map +1 -1
  285. package/dist/plugin-utils/paths.cjs +6 -2
  286. package/dist/plugin-utils/paths.mjs +6 -2
  287. package/dist/plugin-utils/paths.mjs.map +1 -1
  288. package/dist/plugin-utils/virtual.cjs +80 -0
  289. package/dist/plugin-utils/virtual.d.cts +69 -0
  290. package/dist/plugin-utils/virtual.d.cts.map +1 -0
  291. package/dist/plugin-utils/virtual.d.mts +69 -0
  292. package/dist/plugin-utils/virtual.d.mts.map +1 -0
  293. package/dist/plugin-utils/virtual.mjs +73 -0
  294. package/dist/plugin-utils/virtual.mjs.map +1 -0
  295. package/dist/schemas/fs.cjs +232 -0
  296. package/dist/schemas/fs.d.cts +127 -0
  297. package/dist/schemas/fs.d.cts.map +1 -0
  298. package/dist/schemas/fs.d.mts +127 -0
  299. package/dist/schemas/fs.d.mts.map +1 -0
  300. package/dist/schemas/fs.mjs +226 -0
  301. package/dist/schemas/fs.mjs.map +1 -0
  302. package/dist/storage/base.cjs +216 -0
  303. package/dist/storage/base.d.cts +201 -0
  304. package/dist/storage/base.d.cts.map +1 -0
  305. package/dist/storage/base.d.mts +201 -0
  306. package/dist/storage/base.d.mts.map +1 -0
  307. package/dist/storage/base.mjs +215 -0
  308. package/dist/storage/base.mjs.map +1 -0
  309. package/dist/storage/file-system.cjs +180 -0
  310. package/dist/storage/file-system.d.cts +129 -0
  311. package/dist/storage/file-system.d.cts.map +1 -0
  312. package/dist/storage/file-system.d.mts +129 -0
  313. package/dist/storage/file-system.d.mts.map +1 -0
  314. package/dist/storage/file-system.mjs +179 -0
  315. package/dist/storage/file-system.mjs.map +1 -0
  316. package/dist/storage/helpers.cjs +37 -0
  317. package/dist/storage/helpers.d.cts +25 -0
  318. package/dist/storage/helpers.d.cts.map +1 -0
  319. package/dist/storage/helpers.d.mts +25 -0
  320. package/dist/storage/helpers.d.mts.map +1 -0
  321. package/dist/storage/helpers.mjs +34 -0
  322. package/dist/storage/helpers.mjs.map +1 -0
  323. package/dist/storage/index.cjs +12 -0
  324. package/dist/storage/index.d.cts +5 -0
  325. package/dist/storage/index.d.mts +5 -0
  326. package/dist/storage/index.mjs +6 -0
  327. package/dist/storage/virtual.cjs +98 -0
  328. package/dist/storage/virtual.d.cts +80 -0
  329. package/dist/storage/virtual.d.cts.map +1 -0
  330. package/dist/storage/virtual.d.mts +80 -0
  331. package/dist/storage/virtual.d.mts.map +1 -0
  332. package/dist/storage/virtual.mjs +97 -0
  333. package/dist/storage/virtual.mjs.map +1 -0
  334. package/dist/types/api.d.cts +18 -152
  335. package/dist/types/api.d.cts.map +1 -1
  336. package/dist/types/api.d.mts +18 -152
  337. package/dist/types/api.d.mts.map +1 -1
  338. package/dist/types/config.d.cts +194 -135
  339. package/dist/types/config.d.cts.map +1 -1
  340. package/dist/types/config.d.mts +195 -136
  341. package/dist/types/config.d.mts.map +1 -1
  342. package/dist/types/context.d.cts +152 -128
  343. package/dist/types/context.d.cts.map +1 -1
  344. package/dist/types/context.d.mts +155 -131
  345. package/dist/types/context.d.mts.map +1 -1
  346. package/dist/types/fs.d.mts +1 -1
  347. package/dist/types/index.d.cts +5 -6
  348. package/dist/types/index.d.mts +5 -6
  349. package/dist/types/logging.d.cts +161 -0
  350. package/dist/types/logging.d.cts.map +1 -0
  351. package/dist/types/logging.d.mts +161 -0
  352. package/dist/types/logging.d.mts.map +1 -0
  353. package/dist/types/plugin.d.cts +6 -9
  354. package/dist/types/plugin.d.cts.map +1 -1
  355. package/dist/types/plugin.d.mts +6 -9
  356. package/dist/types/plugin.d.mts.map +1 -1
  357. package/dist/types/tsconfig.d.mts +1 -1
  358. package/dist/types/unplugin.d.cts +5 -26
  359. package/dist/types/unplugin.d.cts.map +1 -1
  360. package/dist/types/unplugin.d.mts +5 -26
  361. package/dist/types/unplugin.d.mts.map +1 -1
  362. package/package.json +259 -457
  363. package/schemas/fs.capnp +42 -0
  364. package/dist/constants/virtual-modules.cjs +0 -8
  365. package/dist/constants/virtual-modules.d.cts +0 -6
  366. package/dist/constants/virtual-modules.d.cts.map +0 -1
  367. package/dist/constants/virtual-modules.d.mts +0 -6
  368. package/dist/constants/virtual-modules.d.mts.map +0 -1
  369. package/dist/constants/virtual-modules.mjs +0 -7
  370. package/dist/constants/virtual-modules.mjs.map +0 -1
  371. package/dist/lib/logger.cjs +0 -99
  372. package/dist/lib/logger.d.cts +0 -53
  373. package/dist/lib/logger.d.cts.map +0 -1
  374. package/dist/lib/logger.d.mts +0 -53
  375. package/dist/lib/logger.d.mts.map +0 -1
  376. package/dist/lib/logger.mjs +0 -93
  377. package/dist/lib/logger.mjs.map +0 -1
  378. package/dist/types/_internal.cjs +0 -0
  379. package/dist/types/_internal.d.cts +0 -106
  380. package/dist/types/_internal.d.cts.map +0 -1
  381. package/dist/types/_internal.d.mts +0 -106
  382. package/dist/types/_internal.d.mts.map +0 -1
  383. package/dist/types/_internal.mjs +0 -1
  384. package/dist/types/commands.d.cts +0 -16
  385. package/dist/types/commands.d.cts.map +0 -1
  386. package/dist/types/commands.d.mts +0 -16
  387. package/dist/types/commands.d.mts.map +0 -1
  388. package/dist/types/utils.d.cts +0 -9
  389. package/dist/types/utils.d.cts.map +0 -1
  390. package/dist/types/utils.d.mts +0 -9
  391. package/dist/types/utils.d.mts.map +0 -1
@@ -1,11 +1,10 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
3
- const require_lib_logger = require('../logger.cjs');
3
+ const require_plugin_utils_virtual = require('../../plugin-utils/virtual.cjs');
4
+ require('../../plugin-utils/index.cjs');
4
5
  const require_lib_unplugin_helpers = require('./helpers.cjs');
5
- const require_virtual_modules = require('../../constants/virtual-modules.cjs');
6
6
  const require_lib_unplugin_module_resolution = require('./module-resolution.cjs');
7
7
  const require_lib_utilities_source_file = require('../utilities/source-file.cjs');
8
- let _storm_software_config_tools_types = require("@storm-software/config-tools/types");
9
8
  let _stryke_string_format_kebab_case = require("@stryke/string-format/kebab-case");
10
9
  let _stryke_string_format_title_case = require("@stryke/string-format/title-case");
11
10
  let unplugin = require("unplugin");
@@ -18,25 +17,22 @@ let unplugin = require("unplugin");
18
17
  * @returns The unplugin instance.
19
18
  */
20
19
  function createUnpluginResolver(context, options = {}) {
21
- const ctx = context;
22
- (0, unplugin.setParseImpl)(ctx.parse);
20
+ (0, unplugin.setParseImpl)(context.parse);
23
21
  const name = options.name || "powerlines";
24
- return () => {
25
- const log = require_lib_logger.extendLog(ctx.log, name);
26
- log(_storm_software_config_tools_types.LogLevelLabel.DEBUG, `Initializing ${(0, _stryke_string_format_title_case.titleCase)(name)} plugin`);
27
- try {
28
- const { resolveId, load } = require_lib_unplugin_module_resolution.createUnpluginModuleResolutionFunctions(context, options);
29
- return {
30
- name: name.toLowerCase() === "powerlines" ? "powerlines" : `powerlines:${(0, _stryke_string_format_kebab_case.kebabCase)(name)}`,
31
- api: ctx.$$internal.api,
32
- resolveId,
33
- load
34
- };
35
- } catch (error) {
36
- log(_storm_software_config_tools_types.LogLevelLabel.FATAL, error?.message);
37
- throw error;
38
- }
39
- };
22
+ const logger = context.extendLogger(!options.silenceHookLogging && name !== "powerlines" ? { source: name } : {});
23
+ logger.debug(`Initializing ${(0, _stryke_string_format_title_case.titleCase)(name)} plugin`);
24
+ try {
25
+ const { resolveId, load } = require_lib_unplugin_module_resolution.createUnpluginModuleResolutionFunctions(context, options);
26
+ return () => ({
27
+ name: name.toLowerCase() === "powerlines" ? "powerlines" : `powerlines:${(0, _stryke_string_format_kebab_case.kebabCase)(name)}`,
28
+ context,
29
+ resolveId,
30
+ load
31
+ });
32
+ } catch (error) {
33
+ logger.error(error instanceof Error ? error.message : String(error));
34
+ throw error;
35
+ }
40
36
  }
41
37
  /**
42
38
  * Creates a Powerlines unplugin instance.
@@ -45,50 +41,47 @@ function createUnpluginResolver(context, options = {}) {
45
41
  * @returns The unplugin instance.
46
42
  */
47
43
  function createUnplugin(context, options = {}) {
48
- const ctx = context;
49
- (0, unplugin.setParseImpl)(ctx.parse);
44
+ (0, unplugin.setParseImpl)(context.parse.bind(context));
50
45
  const name = options.name || "powerlines";
51
- return () => {
52
- const log = options.name ? require_lib_logger.extendLog(ctx.log, name) : ctx.log;
53
- log(_storm_software_config_tools_types.LogLevelLabel.DEBUG, `Initializing ${(0, _stryke_string_format_title_case.titleCase)(name)} plugin`);
54
- try {
55
- const { resolveId, load } = require_lib_unplugin_module_resolution.createUnpluginModuleResolutionFunctions(context, options);
56
- async function buildStart() {
57
- if (!options.silenceHookLogging) log(_storm_software_config_tools_types.LogLevelLabel.DEBUG, "Powerlines build plugin starting...");
58
- await ctx.$$internal.callHook("buildStart", { sequential: true });
59
- }
60
- async function transform(code, id) {
61
- let transformed = code;
62
- for (const hook of ctx.$$internal.environment.selectHooks("transform")) {
63
- const result = await hook.handler.apply(require_lib_unplugin_helpers.combineContexts(ctx, this), [require_lib_utilities_source_file.getString(transformed), id.replace(require_virtual_modules.VIRTUAL_MODULE_PREFIX_REGEX, "")]);
64
- if (result) transformed = result;
65
- }
66
- return transformed;
67
- }
68
- async function buildEnd() {
69
- if (!options.silenceHookLogging) log(_storm_software_config_tools_types.LogLevelLabel.DEBUG, "Powerlines build plugin finishing...");
70
- return ctx.$$internal.callHook("buildEnd", { sequential: true });
71
- }
72
- async function writeBundle() {
73
- if (!options.silenceHookLogging) log(_storm_software_config_tools_types.LogLevelLabel.DEBUG, "Finalizing Powerlines project output...");
74
- return ctx.$$internal.callHook("writeBundle", { sequential: true });
46
+ const logger = context.extendLogger(!options.silenceHookLogging && name !== "powerlines" ? { source: name } : {});
47
+ logger.debug(`Initializing ${(0, _stryke_string_format_title_case.titleCase)(name)} plugin`);
48
+ try {
49
+ const { resolveId, load } = require_lib_unplugin_module_resolution.createUnpluginModuleResolutionFunctions(context, options);
50
+ async function buildStart() {
51
+ if (!options.silenceHookLogging) logger.debug("Powerlines build plugin starting...");
52
+ await context.callHook("buildStart", { sequential: true });
53
+ }
54
+ async function transform(code, id) {
55
+ let transformed = code;
56
+ for (const hook of context.environment.selectHooks("transform")) {
57
+ const result = await hook.handler.apply(require_lib_unplugin_helpers.combineContexts(context, this), [require_lib_utilities_source_file.getString(transformed), require_plugin_utils_virtual.removeVirtualPrefix(id)]);
58
+ if (result) transformed = result;
75
59
  }
76
- return {
77
- name: name.toLowerCase() === "powerlines" ? "powerlines" : `powerlines:${(0, _stryke_string_format_kebab_case.kebabCase)(name)}`,
78
- api: ctx.$$internal.api,
79
- resolveId,
80
- load,
81
- transform,
82
- buildStart,
83
- buildEnd,
84
- writeBundle,
85
- vite: { sharedDuringBuild: true }
86
- };
87
- } catch (error) {
88
- log(_storm_software_config_tools_types.LogLevelLabel.FATAL, error?.message);
89
- throw error;
60
+ return transformed;
61
+ }
62
+ async function buildEnd() {
63
+ if (!options.silenceHookLogging) logger.debug("Powerlines build plugin finishing...");
64
+ return context.callHook("buildEnd", { sequential: true });
65
+ }
66
+ async function writeBundle() {
67
+ if (!options.silenceHookLogging) logger.debug("Finalizing Powerlines project output...");
68
+ return context.callHook("writeBundle", { sequential: true });
90
69
  }
91
- };
70
+ return () => ({
71
+ name: name.toLowerCase() === "powerlines" ? "powerlines" : `powerlines:${(0, _stryke_string_format_kebab_case.kebabCase)(name)}`,
72
+ context,
73
+ resolveId,
74
+ load,
75
+ transform,
76
+ buildStart,
77
+ buildEnd,
78
+ writeBundle,
79
+ vite: { sharedDuringBuild: true }
80
+ });
81
+ } catch (error) {
82
+ logger.error(error instanceof Error ? error.message : String(error));
83
+ throw error;
84
+ }
92
85
  }
93
86
 
94
87
  //#endregion
@@ -1,4 +1,4 @@
1
- import { UnpluginFactory } from "../../types/unplugin.cjs";
1
+ import { UnpluginOptions } from "../../types/unplugin.cjs";
2
2
  import { PluginContext } from "../../types/context.cjs";
3
3
  import { CreateUnpluginModuleResolutionFunctionsOptions } from "./module-resolution.cjs";
4
4
 
@@ -13,15 +13,6 @@ interface CreateUnpluginResolverOptions extends CreateUnpluginModuleResolutionFu
13
13
  * @defaultValue "powerlines"
14
14
  */
15
15
  name?: string;
16
- }
17
- /**
18
- * Creates a Powerlines unplugin instance.
19
- *
20
- * @param context - The plugin context.
21
- * @returns The unplugin instance.
22
- */
23
- declare function createUnpluginResolver<TContext extends PluginContext = PluginContext>(context: TContext, options?: CreateUnpluginResolverOptions): UnpluginFactory<TContext>;
24
- interface CreateUnpluginOptions extends CreateUnpluginResolverOptions {
25
16
  /**
26
17
  * Whether to silence logging for the plugin hooks. This can be useful for plugins that run frequently or have hooks that are called often, to reduce noise in the logs. When set to `true`, the plugin will not log any messages for its hooks. When set to `false` (the default), the plugin will log messages for its hooks as normal.
27
18
  *
@@ -35,7 +26,15 @@ interface CreateUnpluginOptions extends CreateUnpluginResolverOptions {
35
26
  * @param context - The plugin context.
36
27
  * @returns The unplugin instance.
37
28
  */
38
- declare function createUnplugin<TContext extends PluginContext = PluginContext>(context: TContext, options?: CreateUnpluginOptions): UnpluginFactory<TContext>;
29
+ declare function createUnpluginResolver<TContext extends PluginContext = PluginContext>(context: TContext, options?: CreateUnpluginResolverOptions): () => UnpluginOptions<TContext>;
30
+ interface CreateUnpluginOptions extends CreateUnpluginResolverOptions {}
31
+ /**
32
+ * Creates a Powerlines unplugin instance.
33
+ *
34
+ * @param context - The plugin context.
35
+ * @returns The unplugin instance.
36
+ */
37
+ declare function createUnplugin<TContext extends PluginContext = PluginContext>(context: TContext, options?: CreateUnpluginOptions): () => UnpluginOptions<TContext>;
39
38
  declare type __ΩCreateUnpluginResolverOptions = any[];
40
39
  declare type __ΩCreateUnpluginOptions = any[];
41
40
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.cts","names":[],"sources":["../../../src/lib/unplugin/plugin.ts"],"mappings":";;;;;UAuCiB,6BAAA,SAAsC,8CAAA;;AAAvD;;;;;AAkBA;;EATE,IAAA;AAAA;;;;;;;iBASc,sBAAA,kBACG,aAAA,GAAgB,aAAA,CAAA,CAEjC,OAAA,EAAS,QAAA,EACT,OAAA,GAAS,6BAAA,GACR,eAAA,CAAgB,QAAA;AAAA,UA+BF,qBAAA,SAA8B,6BAAA;EAnC5B;;;;;EAyCjB,kBAAA;AAAA;;;;AANF;;;iBAegB,cAAA,kBAAgC,aAAA,GAAgB,aAAA,CAAA,CAC9D,OAAA,EAAS,QAAA,EACT,OAAA,GAAS,qBAAA,GACR,eAAA,CAAgB,QAAA;AAAA"}
1
+ {"version":3,"file":"plugin.d.cts","names":[],"sources":["../../../src/lib/unplugin/plugin.ts"],"mappings":";;;;;UAoCiB,6BAAA,SAAsC,8CAAA;;AAAvD;;;;;;;EASE,IAAA;EAOkB;AASpB;;;;EATE,kBAAA;AAAA;;;;;;;iBASc,sBAAA,kBACG,aAAA,GAAgB,aAAA,CAAA,CAEjC,OAAA,EAAS,QAAA,EACT,OAAA,GAAS,6BAAA,SACF,eAAA,CAAgB,QAAA;AAAA,UA8BR,qBAAA,SAA8B,6BAAA;;;;;;;iBAQ/B,cAAA,kBAAgC,aAAA,GAAgB,aAAA,CAAA,CAC9D,OAAA,EAAS,QAAA,EACT,OAAA,GAAS,qBAAA,SACF,eAAA,CAAgB,QAAA;AAAA"}
@@ -1,4 +1,4 @@
1
- import { UnpluginFactory } from "../../types/unplugin.mjs";
1
+ import { UnpluginOptions } from "../../types/unplugin.mjs";
2
2
  import { PluginContext } from "../../types/context.mjs";
3
3
  import { CreateUnpluginModuleResolutionFunctionsOptions } from "./module-resolution.mjs";
4
4
 
@@ -13,15 +13,6 @@ interface CreateUnpluginResolverOptions extends CreateUnpluginModuleResolutionFu
13
13
  * @defaultValue "powerlines"
14
14
  */
15
15
  name?: string;
16
- }
17
- /**
18
- * Creates a Powerlines unplugin instance.
19
- *
20
- * @param context - The plugin context.
21
- * @returns The unplugin instance.
22
- */
23
- declare function createUnpluginResolver<TContext extends PluginContext = PluginContext>(context: TContext, options?: CreateUnpluginResolverOptions): UnpluginFactory<TContext>;
24
- interface CreateUnpluginOptions extends CreateUnpluginResolverOptions {
25
16
  /**
26
17
  * Whether to silence logging for the plugin hooks. This can be useful for plugins that run frequently or have hooks that are called often, to reduce noise in the logs. When set to `true`, the plugin will not log any messages for its hooks. When set to `false` (the default), the plugin will log messages for its hooks as normal.
27
18
  *
@@ -35,7 +26,15 @@ interface CreateUnpluginOptions extends CreateUnpluginResolverOptions {
35
26
  * @param context - The plugin context.
36
27
  * @returns The unplugin instance.
37
28
  */
38
- declare function createUnplugin<TContext extends PluginContext = PluginContext>(context: TContext, options?: CreateUnpluginOptions): UnpluginFactory<TContext>;
29
+ declare function createUnpluginResolver<TContext extends PluginContext = PluginContext>(context: TContext, options?: CreateUnpluginResolverOptions): () => UnpluginOptions<TContext>;
30
+ interface CreateUnpluginOptions extends CreateUnpluginResolverOptions {}
31
+ /**
32
+ * Creates a Powerlines unplugin instance.
33
+ *
34
+ * @param context - The plugin context.
35
+ * @returns The unplugin instance.
36
+ */
37
+ declare function createUnplugin<TContext extends PluginContext = PluginContext>(context: TContext, options?: CreateUnpluginOptions): () => UnpluginOptions<TContext>;
39
38
  declare type __ΩCreateUnpluginResolverOptions = any[];
40
39
  declare type __ΩCreateUnpluginOptions = any[];
41
40
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.mts","names":[],"sources":["../../../src/lib/unplugin/plugin.ts"],"mappings":";;;;;UAuCiB,6BAAA,SAAsC,8CAAA;;AAAvD;;;;;AAkBA;;EATE,IAAA;AAAA;;;;;;;iBASc,sBAAA,kBACG,aAAA,GAAgB,aAAA,CAAA,CAEjC,OAAA,EAAS,QAAA,EACT,OAAA,GAAS,6BAAA,GACR,eAAA,CAAgB,QAAA;AAAA,UA+BF,qBAAA,SAA8B,6BAAA;EAnC5B;;;;;EAyCjB,kBAAA;AAAA;;;;AANF;;;iBAegB,cAAA,kBAAgC,aAAA,GAAgB,aAAA,CAAA,CAC9D,OAAA,EAAS,QAAA,EACT,OAAA,GAAS,qBAAA,GACR,eAAA,CAAgB,QAAA;AAAA"}
1
+ {"version":3,"file":"plugin.d.mts","names":[],"sources":["../../../src/lib/unplugin/plugin.ts"],"mappings":";;;;;UAoCiB,6BAAA,SAAsC,8CAAA;;AAAvD;;;;;;;EASE,IAAA;EAOkB;AASpB;;;;EATE,kBAAA;AAAA;;;;;;;iBASc,sBAAA,kBACG,aAAA,GAAgB,aAAA,CAAA,CAEjC,OAAA,EAAS,QAAA,EACT,OAAA,GAAS,6BAAA,SACF,eAAA,CAAgB,QAAA;AAAA,UA8BR,qBAAA,SAA8B,6BAAA;;;;;;;iBAQ/B,cAAA,kBAAgC,aAAA,GAAgB,aAAA,CAAA,CAC9D,OAAA,EAAS,QAAA,EACT,OAAA,GAAS,qBAAA,SACF,eAAA,CAAgB,QAAA;AAAA"}
@@ -1,9 +1,8 @@
1
- import { extendLog } from "../logger.mjs";
1
+ import { removeVirtualPrefix } from "../../plugin-utils/virtual.mjs";
2
+ import "../../plugin-utils/index.mjs";
2
3
  import { combineContexts } from "./helpers.mjs";
3
- import { VIRTUAL_MODULE_PREFIX_REGEX } from "../../constants/virtual-modules.mjs";
4
4
  import { createUnpluginModuleResolutionFunctions } from "./module-resolution.mjs";
5
5
  import { getString } from "../utilities/source-file.mjs";
6
- import { LogLevelLabel } from "@storm-software/config-tools/types";
7
6
  import { kebabCase } from "@stryke/string-format/kebab-case";
8
7
  import { titleCase } from "@stryke/string-format/title-case";
9
8
  import { setParseImpl } from "unplugin";
@@ -16,25 +15,22 @@ import { setParseImpl } from "unplugin";
16
15
  * @returns The unplugin instance.
17
16
  */
18
17
  function createUnpluginResolver(context, options = {}) {
19
- const ctx = context;
20
- setParseImpl(ctx.parse);
18
+ setParseImpl(context.parse);
21
19
  const name = options.name || "powerlines";
22
- return () => {
23
- const log = extendLog(ctx.log, name);
24
- log(LogLevelLabel.DEBUG, `Initializing ${titleCase(name)} plugin`);
25
- try {
26
- const { resolveId, load } = createUnpluginModuleResolutionFunctions(context, options);
27
- return {
28
- name: name.toLowerCase() === "powerlines" ? "powerlines" : `powerlines:${kebabCase(name)}`,
29
- api: ctx.$$internal.api,
30
- resolveId,
31
- load
32
- };
33
- } catch (error) {
34
- log(LogLevelLabel.FATAL, error?.message);
35
- throw error;
36
- }
37
- };
20
+ const logger = context.extendLogger(!options.silenceHookLogging && name !== "powerlines" ? { source: name } : {});
21
+ logger.debug(`Initializing ${titleCase(name)} plugin`);
22
+ try {
23
+ const { resolveId, load } = createUnpluginModuleResolutionFunctions(context, options);
24
+ return () => ({
25
+ name: name.toLowerCase() === "powerlines" ? "powerlines" : `powerlines:${kebabCase(name)}`,
26
+ context,
27
+ resolveId,
28
+ load
29
+ });
30
+ } catch (error) {
31
+ logger.error(error instanceof Error ? error.message : String(error));
32
+ throw error;
33
+ }
38
34
  }
39
35
  /**
40
36
  * Creates a Powerlines unplugin instance.
@@ -43,50 +39,47 @@ function createUnpluginResolver(context, options = {}) {
43
39
  * @returns The unplugin instance.
44
40
  */
45
41
  function createUnplugin(context, options = {}) {
46
- const ctx = context;
47
- setParseImpl(ctx.parse);
42
+ setParseImpl(context.parse.bind(context));
48
43
  const name = options.name || "powerlines";
49
- return () => {
50
- const log = options.name ? extendLog(ctx.log, name) : ctx.log;
51
- log(LogLevelLabel.DEBUG, `Initializing ${titleCase(name)} plugin`);
52
- try {
53
- const { resolveId, load } = createUnpluginModuleResolutionFunctions(context, options);
54
- async function buildStart() {
55
- if (!options.silenceHookLogging) log(LogLevelLabel.DEBUG, "Powerlines build plugin starting...");
56
- await ctx.$$internal.callHook("buildStart", { sequential: true });
57
- }
58
- async function transform(code, id) {
59
- let transformed = code;
60
- for (const hook of ctx.$$internal.environment.selectHooks("transform")) {
61
- const result = await hook.handler.apply(combineContexts(ctx, this), [getString(transformed), id.replace(VIRTUAL_MODULE_PREFIX_REGEX, "")]);
62
- if (result) transformed = result;
63
- }
64
- return transformed;
65
- }
66
- async function buildEnd() {
67
- if (!options.silenceHookLogging) log(LogLevelLabel.DEBUG, "Powerlines build plugin finishing...");
68
- return ctx.$$internal.callHook("buildEnd", { sequential: true });
69
- }
70
- async function writeBundle() {
71
- if (!options.silenceHookLogging) log(LogLevelLabel.DEBUG, "Finalizing Powerlines project output...");
72
- return ctx.$$internal.callHook("writeBundle", { sequential: true });
44
+ const logger = context.extendLogger(!options.silenceHookLogging && name !== "powerlines" ? { source: name } : {});
45
+ logger.debug(`Initializing ${titleCase(name)} plugin`);
46
+ try {
47
+ const { resolveId, load } = createUnpluginModuleResolutionFunctions(context, options);
48
+ async function buildStart() {
49
+ if (!options.silenceHookLogging) logger.debug("Powerlines build plugin starting...");
50
+ await context.callHook("buildStart", { sequential: true });
51
+ }
52
+ async function transform(code, id) {
53
+ let transformed = code;
54
+ for (const hook of context.environment.selectHooks("transform")) {
55
+ const result = await hook.handler.apply(combineContexts(context, this), [getString(transformed), removeVirtualPrefix(id)]);
56
+ if (result) transformed = result;
73
57
  }
74
- return {
75
- name: name.toLowerCase() === "powerlines" ? "powerlines" : `powerlines:${kebabCase(name)}`,
76
- api: ctx.$$internal.api,
77
- resolveId,
78
- load,
79
- transform,
80
- buildStart,
81
- buildEnd,
82
- writeBundle,
83
- vite: { sharedDuringBuild: true }
84
- };
85
- } catch (error) {
86
- log(LogLevelLabel.FATAL, error?.message);
87
- throw error;
58
+ return transformed;
59
+ }
60
+ async function buildEnd() {
61
+ if (!options.silenceHookLogging) logger.debug("Powerlines build plugin finishing...");
62
+ return context.callHook("buildEnd", { sequential: true });
63
+ }
64
+ async function writeBundle() {
65
+ if (!options.silenceHookLogging) logger.debug("Finalizing Powerlines project output...");
66
+ return context.callHook("writeBundle", { sequential: true });
88
67
  }
89
- };
68
+ return () => ({
69
+ name: name.toLowerCase() === "powerlines" ? "powerlines" : `powerlines:${kebabCase(name)}`,
70
+ context,
71
+ resolveId,
72
+ load,
73
+ transform,
74
+ buildStart,
75
+ buildEnd,
76
+ writeBundle,
77
+ vite: { sharedDuringBuild: true }
78
+ });
79
+ } catch (error) {
80
+ logger.error(error instanceof Error ? error.message : String(error));
81
+ throw error;
82
+ }
90
83
  }
91
84
 
92
85
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.mjs","names":[],"sources":["../../../src/lib/unplugin/plugin.ts"],"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 { Unstable_PluginContext } from \"@powerlines/core/types/_internal\";\nimport { LogLevelLabel } from \"@storm-software/config-tools/types\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport type {\n TransformResult,\n UnpluginBuildContext,\n UnpluginContext\n} from \"unplugin\";\nimport { setParseImpl } from \"unplugin\";\nimport { VIRTUAL_MODULE_PREFIX_REGEX } from \"../../constants/virtual-modules\";\nimport { PluginContext } from \"../../types/context\";\nimport { UnpluginFactory } from \"../../types/unplugin\";\nimport { extendLog } from \"../logger\";\nimport { getString } from \"../utilities/source-file\";\nimport { combineContexts } from \"./helpers\";\nimport {\n createUnpluginModuleResolutionFunctions,\n CreateUnpluginModuleResolutionFunctionsOptions\n} from \"./module-resolution\";\n\nexport interface CreateUnpluginResolverOptions extends CreateUnpluginModuleResolutionFunctionsOptions {\n /**\n * A name to use for the unplugin instance. This is used for logging and to generate the plugin name. It does not affect the functionality of the plugin.\n *\n * @remarks\n * If not provided, the plugin will be named \"powerlines\". If provided, the plugin will be named `${name} - Powerlines` (e.g., \"MyPlugin - Powerlines\").\n *\n * @defaultValue \"powerlines\"\n */\n name?: string;\n}\n\n/**\n * Creates a Powerlines unplugin instance.\n *\n * @param context - The plugin context.\n * @returns The unplugin instance.\n */\nexport function createUnpluginResolver<\n TContext extends PluginContext = PluginContext\n>(\n context: TContext,\n options: CreateUnpluginResolverOptions = {}\n): UnpluginFactory<TContext> {\n const ctx = context as unknown as Unstable_PluginContext;\n setParseImpl(ctx.parse);\n\n const name = options.name || \"powerlines\";\n\n return () => {\n const log = extendLog(ctx.log, name);\n log(LogLevelLabel.DEBUG, `Initializing ${titleCase(name)} plugin`);\n\n try {\n const { resolveId, load } =\n createUnpluginModuleResolutionFunctions<TContext>(context, options);\n\n return {\n name:\n name.toLowerCase() === \"powerlines\"\n ? \"powerlines\"\n : `powerlines:${kebabCase(name)}`,\n api: ctx.$$internal.api,\n resolveId,\n load\n };\n } catch (error) {\n log(LogLevelLabel.FATAL, (error as Error)?.message);\n\n throw error;\n }\n };\n}\n\nexport interface CreateUnpluginOptions extends CreateUnpluginResolverOptions {\n /**\n * Whether to silence logging for the plugin hooks. This can be useful for plugins that run frequently or have hooks that are called often, to reduce noise in the logs. When set to `true`, the plugin will not log any messages for its hooks. When set to `false` (the default), the plugin will log messages for its hooks as normal.\n *\n * @defaultValue false\n */\n silenceHookLogging?: boolean;\n}\n\n/**\n * Creates a Powerlines unplugin instance.\n *\n * @param context - The plugin context.\n * @returns The unplugin instance.\n */\nexport function createUnplugin<TContext extends PluginContext = PluginContext>(\n context: TContext,\n options: CreateUnpluginOptions = {}\n): UnpluginFactory<TContext> {\n const ctx = context as unknown as Unstable_PluginContext;\n setParseImpl(ctx.parse);\n\n const name = options.name || \"powerlines\";\n\n return () => {\n const log = options.name ? extendLog(ctx.log, name) : ctx.log;\n log(LogLevelLabel.DEBUG, `Initializing ${titleCase(name)} plugin`);\n\n try {\n const { resolveId, load } =\n createUnpluginModuleResolutionFunctions<TContext>(context, options);\n\n async function buildStart(this: UnpluginBuildContext) {\n if (!options.silenceHookLogging) {\n log(LogLevelLabel.DEBUG, \"Powerlines build plugin starting...\");\n }\n\n await ctx.$$internal.callHook(\"buildStart\", {\n sequential: true\n });\n }\n\n async function transform(\n this: UnpluginBuildContext & UnpluginContext,\n code: string,\n id: string\n ): Promise<TransformResult | null | undefined> {\n let transformed: TransformResult | string = code;\n\n for (const hook of ctx.$$internal.environment.selectHooks(\n \"transform\"\n )) {\n const result: TransformResult | string | undefined =\n await hook.handler.apply(combineContexts(ctx, this), [\n getString(transformed),\n id.replace(VIRTUAL_MODULE_PREFIX_REGEX, \"\")\n ]);\n if (result) {\n transformed = result;\n }\n }\n\n return transformed;\n }\n\n async function buildEnd(this: UnpluginBuildContext): Promise<void> {\n if (!options.silenceHookLogging) {\n log(LogLevelLabel.DEBUG, \"Powerlines build plugin finishing...\");\n }\n\n return ctx.$$internal.callHook(\"buildEnd\", {\n sequential: true\n });\n }\n\n async function writeBundle(): Promise<void> {\n if (!options.silenceHookLogging) {\n log(LogLevelLabel.DEBUG, \"Finalizing Powerlines project output...\");\n }\n\n return ctx.$$internal.callHook(\"writeBundle\", {\n sequential: true\n });\n }\n\n return {\n name:\n name.toLowerCase() === \"powerlines\"\n ? \"powerlines\"\n : `powerlines:${kebabCase(name)}`,\n api: ctx.$$internal.api,\n resolveId,\n load,\n transform,\n buildStart,\n buildEnd,\n writeBundle,\n vite: {\n sharedDuringBuild: true\n }\n };\n } catch (error) {\n log(LogLevelLabel.FATAL, (error as Error)?.message);\n\n throw error;\n }\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAyDA,SAAgB,uBAGd,SACA,UAAyC,EAAE,EAChB;CAC3B,MAAM,MAAM;AACZ,cAAa,IAAI,MAAM;CAEvB,MAAM,OAAO,QAAQ,QAAQ;AAE7B,cAAa;EACX,MAAM,MAAM,UAAU,IAAI,KAAK,KAAK;AACpC,MAAI,cAAc,OAAO,gBAAgB,UAAU,KAAK,CAAC,SAAS;AAElE,MAAI;GACF,MAAM,EAAE,WAAW,SACjB,wCAAkD,SAAS,QAAQ;AAErE,UAAO;IACL,MACE,KAAK,aAAa,KAAK,eACnB,eACA,cAAc,UAAU,KAAK;IACnC,KAAK,IAAI,WAAW;IACpB;IACA;IACD;WACM,OAAO;AACd,OAAI,cAAc,OAAQ,OAAiB,QAAQ;AAEnD,SAAM;;;;;;;;;;AAoBZ,SAAgB,eACd,SACA,UAAiC,EAAE,EACR;CAC3B,MAAM,MAAM;AACZ,cAAa,IAAI,MAAM;CAEvB,MAAM,OAAO,QAAQ,QAAQ;AAE7B,cAAa;EACX,MAAM,MAAM,QAAQ,OAAO,UAAU,IAAI,KAAK,KAAK,GAAG,IAAI;AAC1D,MAAI,cAAc,OAAO,gBAAgB,UAAU,KAAK,CAAC,SAAS;AAElE,MAAI;GACF,MAAM,EAAE,WAAW,SACjB,wCAAkD,SAAS,QAAQ;GAErE,eAAe,aAAuC;AACpD,QAAI,CAAC,QAAQ,mBACX,KAAI,cAAc,OAAO,sCAAsC;AAGjE,UAAM,IAAI,WAAW,SAAS,cAAc,EAC1C,YAAY,MACb,CAAC;;GAGJ,eAAe,UAEb,MACA,IAC6C;IAC7C,IAAI,cAAwC;AAE5C,SAAK,MAAM,QAAQ,IAAI,WAAW,YAAY,YAC5C,YACD,EAAE;KACD,MAAM,SACJ,MAAM,KAAK,QAAQ,MAAM,gBAAgB,KAAK,KAAK,EAAE,CACnD,UAAU,YAAY,EACtB,GAAG,QAAQ,6BAA6B,GAAG,CAC5C,CAAC;AACJ,SAAI,OACF,eAAc;;AAIlB,WAAO;;GAGT,eAAe,WAAoD;AACjE,QAAI,CAAC,QAAQ,mBACX,KAAI,cAAc,OAAO,uCAAuC;AAGlE,WAAO,IAAI,WAAW,SAAS,YAAY,EACzC,YAAY,MACb,CAAC;;GAGJ,eAAe,cAA6B;AAC1C,QAAI,CAAC,QAAQ,mBACX,KAAI,cAAc,OAAO,0CAA0C;AAGrE,WAAO,IAAI,WAAW,SAAS,eAAe,EAC5C,YAAY,MACb,CAAC;;AAGJ,UAAO;IACL,MACE,KAAK,aAAa,KAAK,eACnB,eACA,cAAc,UAAU,KAAK;IACnC,KAAK,IAAI,WAAW;IACpB;IACA;IACA;IACA;IACA;IACA;IACA,MAAM,EACJ,mBAAmB,MACpB;IACF;WACM,OAAO;AACd,OAAI,cAAc,OAAQ,OAAiB,QAAQ;AAEnD,SAAM"}
1
+ {"version":3,"file":"plugin.mjs","names":[],"sources":["../../../src/lib/unplugin/plugin.ts"],"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 { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport type {\n TransformResult,\n UnpluginBuildContext,\n UnpluginContext\n} from \"unplugin\";\nimport { setParseImpl } from \"unplugin\";\nimport { removeVirtualPrefix } from \"../../plugin-utils\";\nimport type { PluginContext } from \"../../types/context\";\nimport type { UnpluginOptions } from \"../../types/unplugin\";\nimport { getString } from \"../utilities/source-file\";\nimport { combineContexts } from \"./helpers\";\nimport {\n createUnpluginModuleResolutionFunctions,\n CreateUnpluginModuleResolutionFunctionsOptions\n} from \"./module-resolution\";\n\nexport interface CreateUnpluginResolverOptions extends CreateUnpluginModuleResolutionFunctionsOptions {\n /**\n * A name to use for the unplugin instance. This is used for logging and to generate the plugin name. It does not affect the functionality of the plugin.\n *\n * @remarks\n * If not provided, the plugin will be named \"powerlines\". If provided, the plugin will be named `${name} - Powerlines` (e.g., \"MyPlugin - Powerlines\").\n *\n * @defaultValue \"powerlines\"\n */\n name?: string;\n\n /**\n * Whether to silence logging for the plugin hooks. This can be useful for plugins that run frequently or have hooks that are called often, to reduce noise in the logs. When set to `true`, the plugin will not log any messages for its hooks. When set to `false` (the default), the plugin will log messages for its hooks as normal.\n *\n * @defaultValue false\n */\n silenceHookLogging?: boolean;\n}\n\n/**\n * Creates a Powerlines unplugin instance.\n *\n * @param context - The plugin context.\n * @returns The unplugin instance.\n */\nexport function createUnpluginResolver<\n TContext extends PluginContext = PluginContext\n>(\n context: TContext,\n options: CreateUnpluginResolverOptions = {}\n): () => UnpluginOptions<TContext> {\n setParseImpl(context.parse);\n\n const name = options.name || \"powerlines\";\n\n const logger = context.extendLogger(\n !options.silenceHookLogging && name !== \"powerlines\" ? { source: name } : {}\n );\n logger.debug(`Initializing ${titleCase(name)} plugin`);\n\n try {\n const { resolveId, load } =\n createUnpluginModuleResolutionFunctions<TContext>(context, options);\n\n return () => ({\n name:\n name.toLowerCase() === \"powerlines\"\n ? \"powerlines\"\n : `powerlines:${kebabCase(name)}`,\n context,\n resolveId,\n load\n });\n } catch (error) {\n logger.error(error instanceof Error ? error.message : String(error));\n\n throw error;\n }\n}\n\nexport interface CreateUnpluginOptions extends CreateUnpluginResolverOptions {}\n\n/**\n * Creates a Powerlines unplugin instance.\n *\n * @param context - The plugin context.\n * @returns The unplugin instance.\n */\nexport function createUnplugin<TContext extends PluginContext = PluginContext>(\n context: TContext,\n options: CreateUnpluginOptions = {}\n): () => UnpluginOptions<TContext> {\n setParseImpl(context.parse.bind(context));\n\n const name = options.name || \"powerlines\";\n\n const logger = context.extendLogger(\n !options.silenceHookLogging && name !== \"powerlines\" ? { source: name } : {}\n );\n logger.debug(`Initializing ${titleCase(name)} plugin`);\n\n try {\n const { resolveId, load } =\n createUnpluginModuleResolutionFunctions<TContext>(context, options);\n\n async function buildStart(this: UnpluginBuildContext) {\n if (!options.silenceHookLogging) {\n logger.debug(\"Powerlines build plugin starting...\");\n }\n\n await context.callHook(\"buildStart\", {\n sequential: true\n });\n }\n\n async function transform(\n this: UnpluginBuildContext & UnpluginContext,\n code: string,\n id: string\n ): Promise<TransformResult | null | undefined> {\n let transformed: TransformResult | string = code;\n\n for (const hook of context.environment.selectHooks(\"transform\")) {\n const result: TransformResult | string | undefined =\n await hook.handler.apply(combineContexts(context, this), [\n getString(transformed),\n removeVirtualPrefix(id)\n ] as [code: string, id: string]);\n if (result) {\n transformed = result;\n }\n }\n\n return transformed;\n }\n\n async function buildEnd(this: UnpluginBuildContext): Promise<void> {\n if (!options.silenceHookLogging) {\n logger.debug(\"Powerlines build plugin finishing...\");\n }\n\n return context.callHook(\"buildEnd\", {\n sequential: true\n });\n }\n\n async function writeBundle(): Promise<void> {\n if (!options.silenceHookLogging) {\n logger.debug(\"Finalizing Powerlines project output...\");\n }\n\n return context.callHook(\"writeBundle\", {\n sequential: true\n });\n }\n\n return () => ({\n name:\n name.toLowerCase() === \"powerlines\"\n ? \"powerlines\"\n : `powerlines:${kebabCase(name)}`,\n context,\n resolveId,\n load,\n transform,\n buildStart,\n buildEnd,\n writeBundle,\n vite: {\n sharedDuringBuild: true\n }\n });\n } catch (error) {\n logger.error(error instanceof Error ? error.message : String(error));\n\n throw error;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AA6DA,SAAgB,uBAGd,SACA,UAAyC,EAAE,EACV;AACjC,cAAa,QAAQ,MAAM;CAE3B,MAAM,OAAO,QAAQ,QAAQ;CAE7B,MAAM,SAAS,QAAQ,aACrB,CAAC,QAAQ,sBAAsB,SAAS,eAAe,EAAE,QAAQ,MAAM,GAAG,EAAE,CAC7E;AACD,QAAO,MAAM,gBAAgB,UAAU,KAAK,CAAC,SAAS;AAEtD,KAAI;EACF,MAAM,EAAE,WAAW,SACjB,wCAAkD,SAAS,QAAQ;AAErE,gBAAc;GACZ,MACE,KAAK,aAAa,KAAK,eACnB,eACA,cAAc,UAAU,KAAK;GACnC;GACA;GACA;GACD;UACM,OAAO;AACd,SAAO,MAAM,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM,CAAC;AAEpE,QAAM;;;;;;;;;AAYV,SAAgB,eACd,SACA,UAAiC,EAAE,EACF;AACjC,cAAa,QAAQ,MAAM,KAAK,QAAQ,CAAC;CAEzC,MAAM,OAAO,QAAQ,QAAQ;CAE7B,MAAM,SAAS,QAAQ,aACrB,CAAC,QAAQ,sBAAsB,SAAS,eAAe,EAAE,QAAQ,MAAM,GAAG,EAAE,CAC7E;AACD,QAAO,MAAM,gBAAgB,UAAU,KAAK,CAAC,SAAS;AAEtD,KAAI;EACF,MAAM,EAAE,WAAW,SACjB,wCAAkD,SAAS,QAAQ;EAErE,eAAe,aAAuC;AACpD,OAAI,CAAC,QAAQ,mBACX,QAAO,MAAM,sCAAsC;AAGrD,SAAM,QAAQ,SAAS,cAAc,EACnC,YAAY,MACb,CAAC;;EAGJ,eAAe,UAEb,MACA,IAC6C;GAC7C,IAAI,cAAwC;AAE5C,QAAK,MAAM,QAAQ,QAAQ,YAAY,YAAY,YAAY,EAAE;IAC/D,MAAM,SACJ,MAAM,KAAK,QAAQ,MAAM,gBAAgB,SAAS,KAAK,EAAE,CACvD,UAAU,YAAY,EACtB,oBAAoB,GAAG,CACxB,CAA+B;AAClC,QAAI,OACF,eAAc;;AAIlB,UAAO;;EAGT,eAAe,WAAoD;AACjE,OAAI,CAAC,QAAQ,mBACX,QAAO,MAAM,uCAAuC;AAGtD,UAAO,QAAQ,SAAS,YAAY,EAClC,YAAY,MACb,CAAC;;EAGJ,eAAe,cAA6B;AAC1C,OAAI,CAAC,QAAQ,mBACX,QAAO,MAAM,0CAA0C;AAGzD,UAAO,QAAQ,SAAS,eAAe,EACrC,YAAY,MACb,CAAC;;AAGJ,gBAAc;GACZ,MACE,KAAK,aAAa,KAAK,eACnB,eACA,cAAc,UAAU,KAAK;GACnC;GACA;GACA;GACA;GACA;GACA;GACA;GACA,MAAM,EACJ,mBAAmB,MACpB;GACF;UACM,OAAO;AACd,SAAO,MAAM,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM,CAAC;AAEpE,QAAM"}
@@ -20,7 +20,7 @@ function getFileHeaderWarningText(overwrite = true, framework = "powerlines") {
20
20
  * @returns A string containing the file header warning message.
21
21
  */
22
22
  function getFileHeaderWarning(context) {
23
- return getFileHeaderWarningText(context.config.output?.overwrite, context.config.framework);
23
+ return getFileHeaderWarningText(context.config.output?.overwrite, context.config.framework?.name);
24
24
  }
25
25
  /**
26
26
  * Generates a file header comment for a generated source file, including a warning about automatic overwriting.
@@ -31,7 +31,7 @@ function getFileHeaderWarning(context) {
31
31
  */
32
32
  function getFileHeader(context, comment = "//") {
33
33
  return `
34
- ${comment} Generated by ${(0, _stryke_string_format_title_case.titleCase)(context.config.framework) || "Powerlines"}
34
+ ${comment} Generated by ${(0, _stryke_string_format_title_case.titleCase)(context.config.framework?.name) || "Powerlines"}
35
35
  ${comment} ${getFileHeaderWarning(context)}
36
36
  `;
37
37
  }
@@ -18,7 +18,7 @@ function getFileHeaderWarningText(overwrite = true, framework = "powerlines") {
18
18
  * @returns A string containing the file header warning message.
19
19
  */
20
20
  function getFileHeaderWarning(context) {
21
- return getFileHeaderWarningText(context.config.output?.overwrite, context.config.framework);
21
+ return getFileHeaderWarningText(context.config.output?.overwrite, context.config.framework?.name);
22
22
  }
23
23
  /**
24
24
  * Generates a file header comment for a generated source file, including a warning about automatic overwriting.
@@ -29,7 +29,7 @@ function getFileHeaderWarning(context) {
29
29
  */
30
30
  function getFileHeader(context, comment = "//") {
31
31
  return `
32
- ${comment} Generated by ${titleCase(context.config.framework) || "Powerlines"}
32
+ ${comment} Generated by ${titleCase(context.config.framework?.name) || "Powerlines"}
33
33
  ${comment} ${getFileHeaderWarning(context)}
34
34
  `;
35
35
  }
@@ -1 +1 @@
1
- {"version":3,"file":"file-header.mjs","names":[],"sources":["../../../src/lib/utilities/file-header.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { Context } from \"../../types/context\";\n\nexport interface FileHeaderOptions {\n directive?: string | null;\n prettierIgnore?: boolean;\n}\n\n/**\n * Generates a file header comment with a warning about automatic overwriting.\n *\n * @param overwrite - Whether the file will be automatically overwritten. If `false`, the warning will indicate that the file will not be overwritten. If `true` or omitted, the warning will indicate that the file will be overwritten.\n * @param framework - The name of the framework to include in the warning message. Defaults to \"powerlines\".\n * @returns A string containing the file header warning message.\n */\nexport function getFileHeaderWarningText(\n overwrite = true,\n framework = \"powerlines\"\n): string {\n return overwrite !== false\n ? `Do not edit this file manually - it will be overwritten automatically. Automatic overwrites can be disabled by using the \\`output.overwrite\\` option.`\n : `This file was generated on ${new Date().toLocaleString()} - it will not be overwritten by ${titleCase(framework)} while the \\`output.overwrite\\` option is set to \\`true\\`.`;\n}\n\n/**\n * Generates a file header warning message based on the provided context.\n *\n * @param context - The Powerlines context.\n * @returns A string containing the file header warning message.\n */\nexport function getFileHeaderWarning(context: Context): string {\n return getFileHeaderWarningText(\n context.config.output?.overwrite,\n context.config.framework\n );\n}\n\n/**\n * Generates a file header comment for a generated source file, including a warning about automatic overwriting.\n *\n * @param context - The Powerlines context.\n * @param comment - The comment syntax to use for the header (e.g., `//` for JavaScript/TypeScript, `#` for Python). Defaults to `//`.\n * @returns A string containing the file header comment.\n */\nexport function getFileHeader(context: Context, comment = \"//\"): string {\n return `\n${comment} Generated by ${titleCase(context.config.framework) || \"Powerlines\"}\n${comment} ${getFileHeaderWarning(context)}\n`;\n}\n\n/**\n * Generates a file header comment for a generated TypeScript source file, including a warning about automatic overwriting.\n *\n * @param context - The Powerlines context.\n * @param options - Additional options for generating the file header, such as a directive to include and whether to add a Prettier ignore comment.\n * @returns A string containing the file header comment for a TypeScript file.\n */\nexport function getTypescriptFileHeader(\n context: Context,\n options: FileHeaderOptions = {}\n): string {\n const { directive = null, prettierIgnore = false } = options;\n\n return `/* eslint-disable */\n// biome-ignore lint: disable\n${prettierIgnore ? `// prettier-ignore` : \"\"}${directive ? `\\n\\n${directive}\\n` : \"\\n\"}\n${getFileHeader(context)}\n\n`;\n}\n"],"mappings":";;;;;;;;;;AAiCA,SAAgB,yBACd,YAAY,MACZ,YAAY,cACJ;AACR,QAAO,cAAc,QACjB,0JACA,+CAA8B,IAAI,MAAM,EAAC,gBAAgB,CAAC,mCAAmC,UAAU,UAAU,CAAC;;;;;;;;AASxH,SAAgB,qBAAqB,SAA0B;AAC7D,QAAO,yBACL,QAAQ,OAAO,QAAQ,WACvB,QAAQ,OAAO,UAChB;;;;;;;;;AAUH,SAAgB,cAAc,SAAkB,UAAU,MAAc;AACtE,QAAO;EACP,QAAQ,gBAAgB,UAAU,QAAQ,OAAO,UAAU,IAAI,aAAa;EAC5E,QAAQ,GAAG,qBAAqB,QAAQ,CAAC;;;;;;;;;;AAW3C,SAAgB,wBACd,SACA,UAA6B,EAAE,EACvB;CACR,MAAM,EAAE,YAAY,MAAM,iBAAiB,UAAU;AAErD,QAAO;;EAEP,iBAAiB,uBAAuB,KAAK,YAAY,OAAO,UAAU,MAAM,KAAK;EACrF,cAAc,QAAQ,CAAC"}
1
+ {"version":3,"file":"file-header.mjs","names":[],"sources":["../../../src/lib/utilities/file-header.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { Context } from \"../../types/context\";\n\nexport interface FileHeaderOptions {\n directive?: string | null;\n prettierIgnore?: boolean;\n}\n\n/**\n * Generates a file header comment with a warning about automatic overwriting.\n *\n * @param overwrite - Whether the file will be automatically overwritten. If `false`, the warning will indicate that the file will not be overwritten. If `true` or omitted, the warning will indicate that the file will be overwritten.\n * @param framework - The name of the framework to include in the warning message. Defaults to \"powerlines\".\n * @returns A string containing the file header warning message.\n */\nexport function getFileHeaderWarningText(\n overwrite = true,\n framework = \"powerlines\"\n): string {\n return overwrite !== false\n ? `Do not edit this file manually - it will be overwritten automatically. Automatic overwrites can be disabled by using the \\`output.overwrite\\` option.`\n : `This file was generated on ${new Date().toLocaleString()} - it will not be overwritten by ${titleCase(framework)} while the \\`output.overwrite\\` option is set to \\`true\\`.`;\n}\n\n/**\n * Generates a file header warning message based on the provided context.\n *\n * @param context - The Powerlines context.\n * @returns A string containing the file header warning message.\n */\nexport function getFileHeaderWarning(context: Context): string {\n return getFileHeaderWarningText(\n context.config.output?.overwrite,\n context.config.framework?.name\n );\n}\n\n/**\n * Generates a file header comment for a generated source file, including a warning about automatic overwriting.\n *\n * @param context - The Powerlines context.\n * @param comment - The comment syntax to use for the header (e.g., `//` for JavaScript/TypeScript, `#` for Python). Defaults to `//`.\n * @returns A string containing the file header comment.\n */\nexport function getFileHeader(context: Context, comment = \"//\"): string {\n return `\n${comment} Generated by ${titleCase(context.config.framework?.name) || \"Powerlines\"}\n${comment} ${getFileHeaderWarning(context)}\n`;\n}\n\n/**\n * Generates a file header comment for a generated TypeScript source file, including a warning about automatic overwriting.\n *\n * @param context - The Powerlines context.\n * @param options - Additional options for generating the file header, such as a directive to include and whether to add a Prettier ignore comment.\n * @returns A string containing the file header comment for a TypeScript file.\n */\nexport function getTypescriptFileHeader(\n context: Context,\n options: FileHeaderOptions = {}\n): string {\n const { directive = null, prettierIgnore = false } = options;\n\n return `/* eslint-disable */\n// biome-ignore lint: disable\n${prettierIgnore ? `// prettier-ignore` : \"\"}${directive ? `\\n\\n${directive}\\n` : \"\\n\"}\n${getFileHeader(context)}\n\n`;\n}\n"],"mappings":";;;;;;;;;;AAiCA,SAAgB,yBACd,YAAY,MACZ,YAAY,cACJ;AACR,QAAO,cAAc,QACjB,0JACA,+CAA8B,IAAI,MAAM,EAAC,gBAAgB,CAAC,mCAAmC,UAAU,UAAU,CAAC;;;;;;;;AASxH,SAAgB,qBAAqB,SAA0B;AAC7D,QAAO,yBACL,QAAQ,OAAO,QAAQ,WACvB,QAAQ,OAAO,WAAW,KAC3B;;;;;;;;;AAUH,SAAgB,cAAc,SAAkB,UAAU,MAAc;AACtE,QAAO;EACP,QAAQ,gBAAgB,UAAU,QAAQ,OAAO,WAAW,KAAK,IAAI,aAAa;EAClF,QAAQ,GAAG,qBAAqB,QAAQ,CAAC;;;;;;;;;;AAW3C,SAAgB,wBACd,SACA,UAA6B,EAAE,EACvB;CACR,MAAM,EAAE,YAAY,MAAM,iBAAiB,UAAU;AAErD,QAAO;;EAEP,iBAAiB,uBAAuB,KAAK,YAAY,OAAO,UAAU,MAAM,KAAK;EACrF,cAAc,QAAQ,CAAC"}
@@ -1,9 +1,9 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
3
3
  let _stryke_path_append = require("@stryke/path/append");
4
+ let _stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
4
5
  let defu = require("defu");
5
6
  let _stryke_fs_list_files = require("@stryke/fs/list-files");
6
- let _stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
7
7
  let _stryke_path_is_parent_path = require("@stryke/path/is-parent-path");
8
8
  let prettier = require("prettier");
9
9
  let prettier_plugin_organize_imports = require("prettier-plugin-organize-imports");
@@ -1,7 +1,7 @@
1
1
  import { appendPath } from "@stryke/path/append";
2
+ import { findFileExtension } from "@stryke/path/file-path-fns";
2
3
  import { defu as defu$1 } from "defu";
3
4
  import { listFiles } from "@stryke/fs/list-files";
4
- import { findFileExtension } from "@stryke/path/file-path-fns";
5
5
  import { isParentPath } from "@stryke/path/is-parent-path";
6
6
  import { format as format$1, resolveConfig } from "prettier";
7
7
  import importsPlugin from "prettier-plugin-organize-imports";
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_lib_utilities_source_file = require('./source-file.cjs');
3
- const require_lib_utilities_file_header = require('./file-header.cjs');
4
2
  const require_lib_utilities_format = require('./format.cjs');
3
+ const require_lib_utilities_file_header = require('./file-header.cjs');
4
+ const require_lib_utilities_source_file = require('./source-file.cjs');
5
5
  const require_lib_utilities_source_map = require('./source-map.cjs');
6
6
  const require_lib_utilities_write_file = require('./write-file.cjs');
7
7
 
@@ -1,6 +1,6 @@
1
- import { getMagicString, getSourceFile, getString } from "./source-file.mjs";
2
- import { getFileHeader, getFileHeaderWarning, getFileHeaderWarningText, getTypescriptFileHeader } from "./file-header.mjs";
3
1
  import { format, formatFolder } from "./format.mjs";
2
+ import { getFileHeader, getFileHeaderWarning, getFileHeaderWarningText, getTypescriptFileHeader } from "./file-header.mjs";
3
+ import { getMagicString, getSourceFile, getString } from "./source-file.mjs";
4
4
  import { generateSourceMap } from "./source-map.mjs";
5
5
  import { writeFile } from "./write-file.mjs";
6
6
 
@@ -1,6 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
3
- let _storm_software_config_tools_types = require("@storm-software/config-tools/types");
4
3
  let prettier = require("prettier");
5
4
  let _stryke_fs_write_file = require("@stryke/fs/write-file");
6
5
 
@@ -21,7 +20,7 @@ async function writeFile(log, filepath, content, skipFormat = false) {
21
20
  filepath
22
21
  }) || "");
23
22
  } catch (error) {
24
- log(_storm_software_config_tools_types.LogLevelLabel.ERROR, `Failed to write file ${filepath} to disk \n${error?.message ? error.message : ""}`);
23
+ log("error", `Failed to write file ${filepath} to disk \n${error?.message ? error.message : ""}`);
25
24
  }
26
25
  }
27
26
 
@@ -1,4 +1,4 @@
1
- import { LogFn } from "../../types/config.cjs";
1
+ import { LogFn } from "../../types/logging.cjs";
2
2
 
3
3
  //#region src/lib/utilities/write-file.d.ts
4
4
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"write-file.d.cts","names":[],"sources":["../../../src/lib/utilities/write-file.ts"],"mappings":";;;;;AA+BA;;;;;;iBAAsB,SAAA,CACpB,GAAA,EAAK,KAAA,EACL,QAAA,UACA,OAAA,UACA,UAAA,aAAkB,OAAA"}
1
+ {"version":3,"file":"write-file.d.cts","names":[],"sources":["../../../src/lib/utilities/write-file.ts"],"mappings":";;;;;AA8BA;;;;;;iBAAsB,SAAA,CACpB,GAAA,EAAK,KAAA,EACL,QAAA,UACA,OAAA,UACA,UAAA,aAAkB,OAAA"}
@@ -1,4 +1,4 @@
1
- import { LogFn } from "../../types/config.mjs";
1
+ import { LogFn } from "../../types/logging.mjs";
2
2
 
3
3
  //#region src/lib/utilities/write-file.d.ts
4
4
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"write-file.d.mts","names":[],"sources":["../../../src/lib/utilities/write-file.ts"],"mappings":";;;;;AA+BA;;;;;;iBAAsB,SAAA,CACpB,GAAA,EAAK,KAAA,EACL,QAAA,UACA,OAAA,UACA,UAAA,aAAkB,OAAA"}
1
+ {"version":3,"file":"write-file.d.mts","names":[],"sources":["../../../src/lib/utilities/write-file.ts"],"mappings":";;;;;AA8BA;;;;;;iBAAsB,SAAA,CACpB,GAAA,EAAK,KAAA,EACL,QAAA,UACA,OAAA,UACA,UAAA,aAAkB,OAAA"}
@@ -1,4 +1,3 @@
1
- import { LogLevelLabel } from "@storm-software/config-tools/types";
2
1
  import { format, resolveConfig } from "prettier";
3
2
  import { writeFile as writeFile$1 } from "@stryke/fs/write-file";
4
3
 
@@ -19,7 +18,7 @@ async function writeFile(log, filepath, content, skipFormat = false) {
19
18
  filepath
20
19
  }) || "");
21
20
  } catch (error) {
22
- log(LogLevelLabel.ERROR, `Failed to write file ${filepath} to disk \n${error?.message ? error.message : ""}`);
21
+ log("error", `Failed to write file ${filepath} to disk \n${error?.message ? error.message : ""}`);
23
22
  }
24
23
  }
25
24
 
@@ -1 +1 @@
1
- {"version":3,"file":"write-file.mjs","names":["writeFileBase"],"sources":["../../../src/lib/utilities/write-file.ts"],"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 { writeFile as writeFileBase } from \"@stryke/fs/write-file\";\nimport { format, resolveConfig } from \"prettier\";\nimport type { LogFn } from \"../../types/config\";\n\n/**\n * Writes and formats a file to the file system\n *\n * @param log - The logging function to use for logging errors\n * @param filepath - The file path to write the file\n * @param content - The content to write to the file\n * @param skipFormat - Should the plugin skip formatting the `content` string with Prettier\n */\nexport async function writeFile(\n log: LogFn,\n filepath: string,\n content: string,\n skipFormat = false\n) {\n try {\n if (skipFormat) {\n await writeFileBase(filepath, content);\n } else {\n const config = await resolveConfig(filepath);\n const formatted = await format(content, {\n ...(config ?? {}),\n filepath\n });\n\n await writeFileBase(filepath, formatted || \"\");\n }\n } catch (error) {\n log(\n LogLevelLabel.ERROR,\n `Failed to write file ${filepath} to disk \\n${(error as Error)?.message ? (error as Error).message : \"\"}`\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;AA+BA,eAAsB,UACpB,KACA,UACA,SACA,aAAa,OACb;AACA,KAAI;AACF,MAAI,WACF,OAAMA,YAAc,UAAU,QAAQ;MAQtC,OAAMA,YAAc,UAAU,MALN,OAAO,SAAS;GACtC,GAAI,MAFe,cAAc,SAAS,IAE5B,EAAE;GAChB;GACD,CAAC,IAEyC,GAAG;UAEzC,OAAO;AACd,MACE,cAAc,OACd,wBAAwB,SAAS,aAAc,OAAiB,UAAW,MAAgB,UAAU,KACtG"}
1
+ {"version":3,"file":"write-file.mjs","names":["writeFileBase"],"sources":["../../../src/lib/utilities/write-file.ts"],"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 { writeFile as writeFileBase } from \"@stryke/fs/write-file\";\nimport { format, resolveConfig } from \"prettier\";\nimport type { LogFn } from \"../../types/logging\";\n\n/**\n * Writes and formats a file to the file system\n *\n * @param log - The logging function to use for logging errors\n * @param filepath - The file path to write the file\n * @param content - The content to write to the file\n * @param skipFormat - Should the plugin skip formatting the `content` string with Prettier\n */\nexport async function writeFile(\n log: LogFn,\n filepath: string,\n content: string,\n skipFormat = false\n) {\n try {\n if (skipFormat) {\n await writeFileBase(filepath, content);\n } else {\n const config = await resolveConfig(filepath);\n const formatted = await format(content, {\n ...(config ?? {}),\n filepath\n });\n\n await writeFileBase(filepath, formatted || \"\");\n }\n } catch (error) {\n log(\n \"error\",\n `Failed to write file ${filepath} to disk \\n${(error as Error)?.message ? (error as Error).message : \"\"}`\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;AA8BA,eAAsB,UACpB,KACA,UACA,SACA,aAAa,OACb;AACA,KAAI;AACF,MAAI,WACF,OAAMA,YAAc,UAAU,QAAQ;MAQtC,OAAMA,YAAc,UAAU,MALN,OAAO,SAAS;GACtC,GAAI,MAFe,cAAc,SAAS,IAE5B,EAAE;GAChB;GACD,CAAC,IAEyC,GAAG;UAEzC,OAAO;AACd,MACE,SACA,wBAAwB,SAAS,aAAc,OAAiB,UAAW,MAAgB,UAAU,KACtG"}