powerlines 0.23.9 → 0.24.0

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 (273) hide show
  1. package/dist/{api-5H3zEedD.d.ts → api-C32Buv5_.d.ts} +1 -1
  2. package/dist/{api-B77aqxGC.d.cts → api-wzd5AREv.d.cts} +1 -1
  3. package/dist/api.cjs +2 -2
  4. package/dist/api.d.cts +4 -2
  5. package/dist/api.d.ts +4 -2
  6. package/dist/api.js +1 -1
  7. package/dist/astro.cjs +4 -4
  8. package/dist/astro.d.cts +3 -1
  9. package/dist/astro.d.ts +3 -1
  10. package/dist/astro.js +3 -3
  11. package/dist/babel-types.d.ts +292 -0
  12. package/dist/chunk-2TWFBWKA.cjs +133 -0
  13. package/dist/{chunk-UYJXRMS3.js → chunk-7V3LWCLB.js} +1 -1
  14. package/dist/chunk-EXQM3KGH.js +130 -0
  15. package/dist/{chunk-6ZKM7WOB.cjs → chunk-FGH3MZTQ.cjs} +535 -659
  16. package/dist/{chunk-ITL6JGKX.cjs → chunk-FPB2O7FD.cjs} +2 -2
  17. package/dist/{chunk-KOBCKTHY.js → chunk-H74SWU2C.js} +1 -1
  18. package/dist/{chunk-2QLM4MYP.cjs → chunk-HTGCHSLH.cjs} +2 -2
  19. package/dist/{chunk-G5K3I7JU.cjs → chunk-TIBYAWZZ.cjs} +2 -2
  20. package/dist/{chunk-S47BU5QR.js → chunk-ZEE73BCY.js} +1 -1
  21. package/dist/{chunk-FDEGM4CR.js → chunk-ZT2J55YE.js} +538 -659
  22. package/dist/config.d.cts +3 -1
  23. package/dist/config.d.ts +3 -1
  24. package/dist/esbuild.cjs +6 -6
  25. package/dist/esbuild.d.cts +3 -1
  26. package/dist/esbuild.d.ts +3 -1
  27. package/dist/esbuild.js +3 -3
  28. package/dist/farm.cjs +3 -3
  29. package/dist/farm.d.cts +3 -1
  30. package/dist/farm.d.ts +3 -1
  31. package/dist/farm.js +2 -2
  32. package/dist/index.cjs +11 -23
  33. package/dist/index.d.cts +6 -135
  34. package/dist/index.d.ts +6 -135
  35. package/dist/index.js +2 -2
  36. package/dist/lib/{api-Cm51oVbC.d.cts → api-BRMITKt-.d.cts} +1 -1
  37. package/dist/lib/{api-mja4jirh.d.ts → api-CDUN9en8.d.ts} +1 -1
  38. package/dist/lib/build/esbuild.d.cts +3 -1
  39. package/dist/lib/build/esbuild.d.ts +3 -1
  40. package/dist/lib/build/index.d.cts +5 -3
  41. package/dist/lib/build/index.d.ts +5 -3
  42. package/dist/lib/build/rolldown.d.cts +3 -1
  43. package/dist/lib/build/rolldown.d.ts +3 -1
  44. package/dist/lib/build/rollup.d.cts +3 -1
  45. package/dist/lib/build/rollup.d.ts +3 -1
  46. package/dist/lib/build/rspack.d.cts +3 -1
  47. package/dist/lib/build/rspack.d.ts +3 -1
  48. package/dist/lib/build/tsup.d.cts +3 -1
  49. package/dist/lib/build/tsup.d.ts +3 -1
  50. package/dist/lib/build/unbuild.d.cts +5 -3
  51. package/dist/lib/build/unbuild.d.ts +5 -3
  52. package/dist/lib/build/vite.d.cts +3 -1
  53. package/dist/lib/build/vite.d.ts +3 -1
  54. package/dist/lib/build/webpack.d.cts +3 -1
  55. package/dist/lib/build/webpack.d.ts +3 -1
  56. package/dist/lib/{chunk-52VDUP5J.js → chunk-6I5PL7H2.js} +5 -17
  57. package/dist/lib/{chunk-UPVFKXB7.cjs → chunk-6PPZCPME.cjs} +1 -2
  58. package/dist/lib/{chunk-OI7EHXNE.js → chunk-7CVPZOH4.js} +3 -3
  59. package/dist/lib/{chunk-7XHBIYIN.cjs → chunk-7VJ42H2I.cjs} +0 -16
  60. package/dist/lib/{chunk-SEWUUTNA.js → chunk-A2NFSQ5K.js} +1 -1
  61. package/dist/lib/{chunk-B3DJ4CXY.cjs → chunk-AA6RBP44.cjs} +10 -10
  62. package/dist/lib/{chunk-BGGENJH4.js → chunk-CGRHZJY5.js} +42 -83
  63. package/dist/lib/{chunk-AHONHQGB.js → chunk-DFW5FGEO.js} +1 -1
  64. package/dist/lib/{chunk-VL63QEPF.cjs → chunk-DUZJ7ZF2.cjs} +2 -2
  65. package/dist/lib/{chunk-EFYMNU53.cjs → chunk-EV357RFB.cjs} +5 -17
  66. package/dist/lib/{chunk-YH5GOJS3.js → chunk-FQLZZYYO.js} +1 -16
  67. package/dist/lib/{chunk-54XNJQTH.js → chunk-HAXL7QE7.js} +3 -3
  68. package/dist/lib/chunk-K3NBD5LL.cjs +75 -0
  69. package/dist/lib/{chunk-63MH3ERQ.js → chunk-KFWMKDJQ.js} +395 -591
  70. package/dist/lib/{chunk-3KR6TYGW.cjs → chunk-MS3CD2U6.cjs} +52 -94
  71. package/dist/lib/{chunk-LQEGZT5U.cjs → chunk-RNHKEPFD.cjs} +397 -594
  72. package/dist/lib/{chunk-4EIXDLFP.cjs → chunk-SAS5EPBD.cjs} +7 -5
  73. package/dist/lib/{chunk-EUDKQWSB.js → chunk-VHLINWXG.js} +1 -2
  74. package/dist/lib/{chunk-SMZ672RP.cjs → chunk-VMLQATMA.cjs} +6 -6
  75. package/dist/lib/{chunk-IBPA3VN5.cjs → chunk-WUYK74EH.cjs} +3 -3
  76. package/dist/lib/chunk-XBM7FHNK.js +68 -0
  77. package/dist/lib/{chunk-RD5AUWXN.js → chunk-YQ3ODCHV.js} +7 -5
  78. package/dist/lib/{config-BnJpgcGr.d.cts → config-D8KrE7SZ.d.cts} +109 -35
  79. package/dist/lib/{config-7Q2dBjJE.d.ts → config-DBIFdRoq.d.ts} +109 -35
  80. package/dist/lib/config-file.cjs +3 -3
  81. package/dist/lib/config-file.d.cts +3 -1
  82. package/dist/lib/config-file.d.ts +3 -1
  83. package/dist/lib/config-file.js +1 -1
  84. package/dist/lib/contexts/api-context.cjs +7 -6
  85. package/dist/lib/contexts/api-context.d.cts +5 -3
  86. package/dist/lib/contexts/api-context.d.ts +5 -3
  87. package/dist/lib/contexts/api-context.js +6 -5
  88. package/dist/lib/contexts/context.cjs +5 -4
  89. package/dist/lib/contexts/context.d.cts +47 -4
  90. package/dist/lib/contexts/context.d.ts +47 -4
  91. package/dist/lib/contexts/context.js +4 -3
  92. package/dist/lib/contexts/environment-context.cjs +6 -5
  93. package/dist/lib/contexts/environment-context.d.cts +5 -3
  94. package/dist/lib/contexts/environment-context.d.ts +5 -3
  95. package/dist/lib/contexts/environment-context.js +5 -4
  96. package/dist/lib/contexts/index.cjs +9 -8
  97. package/dist/lib/contexts/index.d.cts +5 -3
  98. package/dist/lib/contexts/index.d.ts +5 -3
  99. package/dist/lib/contexts/index.js +6 -5
  100. package/dist/lib/contexts/plugin-context.d.cts +5 -3
  101. package/dist/lib/contexts/plugin-context.d.ts +5 -3
  102. package/dist/lib/entry.d.cts +3 -1
  103. package/dist/lib/entry.d.ts +3 -1
  104. package/dist/lib/index.cjs +49 -59
  105. package/dist/lib/index.d.cts +68 -49
  106. package/dist/lib/index.d.ts +68 -49
  107. package/dist/lib/index.js +14 -16
  108. package/dist/lib/{internal-BEygquYh.d.ts → internal-1qCyw7bA.d.ts} +2 -2
  109. package/dist/lib/{internal-BeR8fOB1.d.cts → internal-CaGANOWK.d.cts} +2 -2
  110. package/dist/lib/logger.d.cts +3 -1
  111. package/dist/lib/logger.d.ts +3 -1
  112. package/dist/lib/typescript/compiler-host.cjs +7 -7
  113. package/dist/lib/typescript/compiler-host.d.cts +3 -1
  114. package/dist/lib/typescript/compiler-host.d.ts +3 -1
  115. package/dist/lib/typescript/compiler-host.js +6 -6
  116. package/dist/lib/typescript/import-transformer.cjs +1 -1
  117. package/dist/lib/typescript/import-transformer.d.cts +3 -1
  118. package/dist/lib/typescript/import-transformer.d.ts +3 -1
  119. package/dist/lib/typescript/import-transformer.js +1 -1
  120. package/dist/lib/typescript/index.cjs +8 -8
  121. package/dist/lib/typescript/index.d.cts +3 -2
  122. package/dist/lib/typescript/index.d.ts +3 -2
  123. package/dist/lib/typescript/index.js +2 -2
  124. package/dist/lib/typescript/program.cjs +6 -6
  125. package/dist/lib/typescript/program.d.cts +3 -1
  126. package/dist/lib/typescript/program.d.ts +3 -1
  127. package/dist/lib/typescript/program.js +1 -1
  128. package/dist/lib/typescript/ts-morph.cjs +2 -2
  129. package/dist/lib/typescript/ts-morph.d.cts +5 -3
  130. package/dist/lib/typescript/ts-morph.d.ts +5 -3
  131. package/dist/lib/typescript/ts-morph.js +1 -1
  132. package/dist/lib/unplugin/factory.cjs +8 -8
  133. package/dist/lib/unplugin/factory.d.cts +5 -3
  134. package/dist/lib/unplugin/factory.d.ts +5 -3
  135. package/dist/lib/unplugin/factory.js +7 -7
  136. package/dist/lib/unplugin/helpers.d.cts +3 -1
  137. package/dist/lib/unplugin/helpers.d.ts +3 -1
  138. package/dist/lib/unplugin/index.cjs +13 -13
  139. package/dist/lib/unplugin/index.d.cts +6 -4
  140. package/dist/lib/unplugin/index.d.ts +6 -4
  141. package/dist/lib/unplugin/index.js +9 -9
  142. package/dist/lib/unplugin/plugin.cjs +2 -3
  143. package/dist/lib/unplugin/plugin.d.cts +6 -4
  144. package/dist/lib/unplugin/plugin.d.ts +6 -4
  145. package/dist/lib/unplugin/plugin.js +1 -2
  146. package/dist/lib/{unplugin-CbbNDduM.d.ts → unplugin-CEeJqADD.d.ts} +2 -2
  147. package/dist/lib/{unplugin-ppAOzR__.d.cts → unplugin-bUSyjd0S.d.cts} +2 -2
  148. package/dist/lib/utilities/bundle.cjs +2 -3
  149. package/dist/lib/utilities/bundle.d.cts +3 -1
  150. package/dist/lib/utilities/bundle.d.ts +3 -1
  151. package/dist/lib/utilities/bundle.js +1 -2
  152. package/dist/lib/utilities/cache.d.cts +3 -1
  153. package/dist/lib/utilities/cache.d.ts +3 -1
  154. package/dist/lib/utilities/file-header.d.cts +3 -1
  155. package/dist/lib/utilities/file-header.d.ts +3 -1
  156. package/dist/lib/utilities/index.cjs +21 -30
  157. package/dist/lib/utilities/index.d.cts +4 -3
  158. package/dist/lib/utilities/index.d.ts +4 -3
  159. package/dist/lib/utilities/index.js +5 -6
  160. package/dist/lib/utilities/meta.cjs +7 -11
  161. package/dist/lib/utilities/meta.d.cts +4 -3
  162. package/dist/lib/utilities/meta.d.ts +4 -3
  163. package/dist/lib/utilities/meta.js +1 -1
  164. package/dist/lib/utilities/resolve.cjs +3 -4
  165. package/dist/lib/utilities/resolve.d.cts +3 -1
  166. package/dist/lib/utilities/resolve.d.ts +3 -1
  167. package/dist/lib/utilities/resolve.js +2 -3
  168. package/dist/lib/utilities/source-file.d.cts +3 -1
  169. package/dist/lib/utilities/source-file.d.ts +3 -1
  170. package/dist/lib/utilities/source-map.d.cts +3 -1
  171. package/dist/lib/utilities/source-map.d.ts +3 -1
  172. package/dist/lib/utilities/worker.d.cts +3 -1
  173. package/dist/lib/utilities/worker.d.ts +3 -1
  174. package/dist/lib/utilities/write-file.d.cts +3 -1
  175. package/dist/lib/utilities/write-file.d.ts +3 -1
  176. package/dist/next.cjs +4 -4
  177. package/dist/next.js +3 -3
  178. package/dist/nuxt.cjs +6 -6
  179. package/dist/nuxt.js +4 -4
  180. package/dist/plugin-utils/{context-Cg11S-CE.d.ts → context-BITGF5LZ.d.cts} +118 -39
  181. package/dist/plugin-utils/{context-Cg11S-CE.d.cts → context-BITGF5LZ.d.ts} +118 -39
  182. package/dist/plugin-utils/context-helpers.d.cts +4 -1
  183. package/dist/plugin-utils/context-helpers.d.ts +4 -1
  184. package/dist/plugin-utils/enforce.d.cts +4 -1
  185. package/dist/plugin-utils/enforce.d.ts +4 -1
  186. package/dist/plugin-utils/extend.d.cts +4 -1
  187. package/dist/plugin-utils/extend.d.ts +4 -1
  188. package/dist/plugin-utils/get-config-path.d.cts +4 -1
  189. package/dist/plugin-utils/get-config-path.d.ts +4 -1
  190. package/dist/plugin-utils/helpers.d.cts +4 -1
  191. package/dist/plugin-utils/helpers.d.ts +4 -1
  192. package/dist/plugin-utils/index.d.cts +4 -1
  193. package/dist/plugin-utils/index.d.ts +4 -1
  194. package/dist/plugin-utils/merge.d.cts +4 -1
  195. package/dist/plugin-utils/merge.d.ts +4 -1
  196. package/dist/plugin-utils/paths.d.cts +4 -1
  197. package/dist/plugin-utils/paths.d.ts +4 -1
  198. package/dist/{resolved-B3BSdXCt.d.ts → resolved-BABoCnXm.d.ts} +43 -1
  199. package/dist/{resolved-DGrpILrS.d.cts → resolved-CSqGKlA5.d.cts} +43 -1
  200. package/dist/rolldown.cjs +3 -3
  201. package/dist/rolldown.d.cts +3 -1
  202. package/dist/rolldown.d.ts +3 -1
  203. package/dist/rolldown.js +2 -2
  204. package/dist/rollup.cjs +3 -3
  205. package/dist/rollup.d.cts +3 -1
  206. package/dist/rollup.d.ts +3 -1
  207. package/dist/rollup.js +2 -2
  208. package/dist/rspack.cjs +3 -3
  209. package/dist/rspack.d.cts +3 -1
  210. package/dist/rspack.d.ts +3 -1
  211. package/dist/rspack.js +2 -2
  212. package/dist/tsup.cjs +4 -4
  213. package/dist/tsup.js +3 -3
  214. package/dist/types/api.d.cts +4 -2
  215. package/dist/types/api.d.ts +4 -2
  216. package/dist/types/babel.d.cts +3 -1
  217. package/dist/types/babel.d.ts +3 -1
  218. package/dist/types/commands.d.cts +3 -1
  219. package/dist/types/commands.d.ts +3 -1
  220. package/dist/types/config.d.cts +3 -1
  221. package/dist/types/config.d.ts +3 -1
  222. package/dist/types/context.d.cts +3 -1
  223. package/dist/types/context.d.ts +3 -1
  224. package/dist/types/fs.d.cts +68 -36
  225. package/dist/types/fs.d.ts +68 -36
  226. package/dist/types/hooks.d.cts +3 -1
  227. package/dist/types/hooks.d.ts +3 -1
  228. package/dist/types/index.d.cts +5 -3
  229. package/dist/types/index.d.ts +5 -3
  230. package/dist/types/internal.d.cts +4 -2
  231. package/dist/types/internal.d.ts +4 -2
  232. package/dist/types/plugin.d.cts +3 -1
  233. package/dist/types/plugin.d.ts +3 -1
  234. package/dist/types/resolved.d.cts +3 -1
  235. package/dist/types/resolved.d.ts +3 -1
  236. package/dist/types/unplugin.d.cts +4 -2
  237. package/dist/types/unplugin.d.ts +4 -2
  238. package/dist/unloader.cjs +3 -3
  239. package/dist/unloader.d.cts +3 -1
  240. package/dist/unloader.d.ts +3 -1
  241. package/dist/unloader.js +2 -2
  242. package/dist/unplugin.cjs +12 -28
  243. package/dist/unplugin.d.cts +104 -31
  244. package/dist/unplugin.d.ts +104 -31
  245. package/dist/unplugin.js +10 -23
  246. package/dist/vite.cjs +6 -6
  247. package/dist/vite.d.cts +3 -1
  248. package/dist/vite.d.ts +3 -1
  249. package/dist/vite.js +3 -3
  250. package/dist/webpack.cjs +6 -6
  251. package/dist/webpack.d.cts +3 -1
  252. package/dist/webpack.d.ts +3 -1
  253. package/dist/webpack.js +3 -3
  254. package/package.json +16 -14
  255. package/schemas/fs.capnp +35 -38
  256. package/dist/chunk-FJWXCUGQ.cjs +0 -234
  257. package/dist/chunk-RKMUBSYG.js +0 -230
  258. package/dist/lib/chunk-7JAGT5GC.cjs +0 -74
  259. package/dist/lib/chunk-G7S5PIAC.js +0 -89
  260. package/dist/lib/chunk-MZJWK36Q.cjs +0 -37
  261. package/dist/lib/chunk-NWAD7K4D.js +0 -35
  262. package/dist/lib/chunk-PVCAB6BZ.js +0 -67
  263. package/dist/lib/chunk-ZBDVQVUK.cjs +0 -91
  264. package/dist/lib/unplugin/resolve-id.cjs +0 -11
  265. package/dist/lib/unplugin/resolve-id.d.cts +0 -57
  266. package/dist/lib/unplugin/resolve-id.d.ts +0 -57
  267. package/dist/lib/unplugin/resolve-id.js +0 -2
  268. package/dist/lib/utilities/resolve-path.cjs +0 -11
  269. package/dist/lib/utilities/resolve-path.d.cts +0 -40
  270. package/dist/lib/utilities/resolve-path.d.ts +0 -40
  271. package/dist/lib/utilities/resolve-path.js +0 -2
  272. /package/dist/lib/{chunk-HMO3LAYL.js → chunk-I2DQRMX3.js} +0 -0
  273. /package/dist/lib/{chunk-EJ25PQEL.cjs → chunk-YK4PYVLM.cjs} +0 -0
@@ -1,230 +0,0 @@
1
- import { createLog, PowerlinesAPI } from './chunk-FDEGM4CR.js';
2
- import { __name } from './chunk-SHUYVCID.js';
3
- import { joinPaths } from '@stryke/path/join';
4
- import { match, tsconfigPathsToRegExp } from 'bundle-require';
5
- import { LogLevelLabel } from '@storm-software/config-tools/types';
6
- import { getWorkspaceRoot } from '@stryke/fs/get-workspace-root';
7
- import '@stryke/fs/read-file';
8
- import { isSetObject } from '@stryke/type-checks/is-set-object';
9
- import { isString } from '@stryke/type-checks/is-string';
10
- import 'magic-string';
11
-
12
- var NON_NODE_MODULE_REGEX = /^[A-Z]:[/\\]|^\.{0,2}\/|^\.{1,2}$/;
13
- async function handleResolveId(context, args, options = {}) {
14
- if (args.id) {
15
- if (context.fs.isVirtual(args.id) || args.importer && context.fs.isVirtual(args.id, {
16
- paths: [
17
- args.importer
18
- ]
19
- })) {
20
- const resolvedPath = args.importer ? context.fs.resolve(args.id, {
21
- paths: [
22
- args.importer
23
- ]
24
- }) : context.fs.resolve(args.id);
25
- if (resolvedPath) {
26
- return {
27
- id: resolvedPath,
28
- external: context.config.projectType !== "application"
29
- };
30
- }
31
- }
32
- if (!!context.tsconfig.options.paths && Object.keys(context.tsconfig.options.paths).some((path) => args.id.startsWith(path.replaceAll("*", "")))) {
33
- let tsconfigPath = false;
34
- if (context.tsconfig.options.paths) {
35
- for (const tsconfigPathKey of Object.keys(context.tsconfig.options.paths).filter((tsconfigPath2) => args.id.startsWith(tsconfigPath2.replaceAll("*", "")))) {
36
- const resolvedPath = context.tsconfig.options.paths[tsconfigPathKey]?.find((tsconfigPath2) => context.fs.resolve(joinPaths(context.workspaceConfig.workspaceRoot, tsconfigPath2.replaceAll("*", ""), args.id.replace(tsconfigPathKey.replaceAll("*", ""), ""))) || context.fs.formatPath(tsconfigPath2) === context.fs.formatPath(args.id));
37
- if (resolvedPath) {
38
- tsconfigPath = context.fs.formatPath(resolvedPath) === context.fs.formatPath(args.id) ? context.fs.formatPath(resolvedPath) : context.fs.resolve(joinPaths(context.workspaceConfig.workspaceRoot, resolvedPath.replaceAll("*", ""), args.id.replace(tsconfigPathKey.replaceAll("*", ""), "")));
39
- }
40
- }
41
- }
42
- let tsconfigPathPackage = false;
43
- if (context.tsconfig.options.paths) {
44
- const tsconfigPathKeys = Object.keys(context.tsconfig.options.paths).filter((tsconfigPath2) => args.id.startsWith(tsconfigPath2.replaceAll("*", "")));
45
- if (tsconfigPathKeys.length > 0 && tsconfigPathKeys[0]) {
46
- tsconfigPathPackage = tsconfigPathKeys[0].replace(/\/\*$/, "");
47
- }
48
- }
49
- if (tsconfigPath && tsconfigPathPackage) {
50
- return {
51
- id: tsconfigPath,
52
- external: Boolean(!options.noExternal?.includes(tsconfigPathPackage) && (options.external?.includes(tsconfigPathPackage) ?? context.config.projectType !== "application"))
53
- };
54
- }
55
- }
56
- if (options.skipResolve) {
57
- return void 0;
58
- }
59
- if (options.skipNodeModulesBundle) {
60
- if (match(args.id, options.resolvePatterns) || match(args.id, options.noExternal) || args.id.startsWith("internal:") || args.id.startsWith("virtual:")) {
61
- return void 0;
62
- }
63
- if (match(args.id, options.external) || args.id.startsWith("node:")) {
64
- return {
65
- id: args.id,
66
- external: true
67
- };
68
- }
69
- if (!NON_NODE_MODULE_REGEX.test(args.id)) {
70
- return {
71
- id: args.id,
72
- external: true
73
- };
74
- }
75
- } else {
76
- const resolvedPath = context.fs.resolve(args.id, {
77
- paths: args.importer ? [
78
- args.importer
79
- ] : []
80
- });
81
- if (match(args.id, options.noExternal) || resolvedPath && context.fs.metadata[resolvedPath]?.type === "builtin") {
82
- return void 0;
83
- }
84
- if (match(args.id, options.external) || args.id.startsWith("node:")) {
85
- return {
86
- id: args.id,
87
- external: true
88
- };
89
- }
90
- }
91
- }
92
- return void 0;
93
- }
94
- __name(handleResolveId, "handleResolveId");
95
- function getString(code) {
96
- if (!code) {
97
- return "";
98
- }
99
- if (isString(code)) {
100
- return code;
101
- }
102
- if (isSetObject(code) && "code" in code) {
103
- return code.code;
104
- }
105
- return code.toString();
106
- }
107
- __name(getString, "getString");
108
-
109
- // src/lib/unplugin/factory.ts
110
- function createUnpluginFactory(variant, decorate) {
111
- return (config, meta) => {
112
- const log = createLog("unplugin", config);
113
- log(LogLevelLabel.DEBUG, "Initializing Unplugin");
114
- try {
115
- const userConfig = {
116
- ...config,
117
- variant,
118
- unplugin: meta
119
- };
120
- let api;
121
- let resolvePatterns = [];
122
- async function buildStart() {
123
- log(LogLevelLabel.DEBUG, "Powerlines build plugin starting...");
124
- const workspaceRoot = getWorkspaceRoot(process.cwd());
125
- api = await PowerlinesAPI.from(workspaceRoot, userConfig);
126
- if (api.context.config.build.skipNodeModulesBundle) {
127
- resolvePatterns = tsconfigPathsToRegExp(api.context.tsconfig.options.paths ?? []);
128
- }
129
- log(LogLevelLabel.DEBUG, "Preparing build artifacts for the Powerlines project...");
130
- await api.prepare({
131
- command: "build"
132
- });
133
- }
134
- __name(buildStart, "buildStart");
135
- async function resolveId(id, importer, options = {
136
- isEntry: false
137
- }) {
138
- return handleResolveId(api.context, {
139
- id,
140
- importer,
141
- options
142
- }, {
143
- skipNodeModulesBundle: api.context.config.build.skipNodeModulesBundle,
144
- external: api.context.config.build.external,
145
- noExternal: api.context.config.build.noExternal,
146
- resolvePatterns
147
- });
148
- }
149
- __name(resolveId, "resolveId");
150
- async function load(id) {
151
- const environment = await api.context.getEnvironment();
152
- if (id) {
153
- const resolvedPath = environment.fs.resolve(id);
154
- if (resolvedPath) {
155
- return environment.fs.readFile(resolvedPath);
156
- }
157
- }
158
- let result2 = await api.callPreHook(environment, "load", id);
159
- if (result2) {
160
- return result2;
161
- }
162
- result2 = await api.callNormalHook(environment, "load", id);
163
- if (result2) {
164
- return result2;
165
- }
166
- return api.callPostHook(environment, "load", id);
167
- }
168
- __name(load, "load");
169
- async function transform(code, id) {
170
- const environment = await api.context.getEnvironment();
171
- let transformed = code;
172
- let result2 = await api.callPreHook(environment, "transform", getString(transformed), id);
173
- if (result2) {
174
- transformed = result2;
175
- }
176
- result2 = await api.callNormalHook(environment, "transform", getString(transformed), id);
177
- if (result2) {
178
- transformed = result2;
179
- }
180
- result2 = await api.callPostHook(environment, "transform", getString(transformed), id);
181
- if (result2) {
182
- transformed = result2;
183
- }
184
- return transformed;
185
- }
186
- __name(transform, "transform");
187
- async function writeBundle() {
188
- log(LogLevelLabel.DEBUG, "Finalizing Powerlines project output...");
189
- const environment = await api.context.getEnvironment();
190
- await api.callHook(environment, "writeBundle");
191
- }
192
- __name(writeBundle, "writeBundle");
193
- const result = {
194
- name: "powerlines",
195
- api,
196
- resolveId: {
197
- filter: {
198
- id: {
199
- include: [
200
- /.*/
201
- ]
202
- }
203
- },
204
- handler: resolveId
205
- },
206
- load: {
207
- filter: {
208
- id: {
209
- include: [
210
- /.*/,
211
- /^storm:/
212
- ]
213
- }
214
- },
215
- handler: load
216
- },
217
- transform,
218
- buildStart,
219
- writeBundle
220
- };
221
- return decorate ? decorate(api, result) : result;
222
- } catch (error) {
223
- log(LogLevelLabel.FATAL, error?.message);
224
- throw error;
225
- }
226
- };
227
- }
228
- __name(createUnpluginFactory, "createUnpluginFactory");
229
-
230
- export { createUnpluginFactory, getString, handleResolveId };
@@ -1,74 +0,0 @@
1
- 'use strict';
2
-
3
- var chunkUSNT2KNT_cjs = require('./chunk-USNT2KNT.cjs');
4
- var getConfig = require('@storm-software/config-tools/get-config');
5
- var exists = require('@stryke/fs/exists');
6
- var append = require('@stryke/path/append');
7
- var joinPaths = require('@stryke/path/join-paths');
8
- var isFunction = require('@stryke/type-checks/is-function');
9
- var isSetObject = require('@stryke/type-checks/is-set-object');
10
- var c12 = require('c12');
11
- var defu = require('defu');
12
-
13
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
14
-
15
- var defu__default = /*#__PURE__*/_interopDefault(defu);
16
-
17
- async function loadWorkspaceConfig(workspaceRoot, cwd) {
18
- return defu__default.default({
19
- workspaceRoot
20
- }, await getConfig.getWorkspaceConfig(true, {
21
- cwd,
22
- workspaceRoot,
23
- useDefault: true
24
- }));
25
- }
26
- chunkUSNT2KNT_cjs.__name(loadWorkspaceConfig, "loadWorkspaceConfig");
27
- async function loadUserConfigFile(projectRoot, workspaceRoot, jiti, command, mode, configFile, framework = "powerlines") {
28
- let resolvedUserConfig = {};
29
- const resolvedUserConfigFile = configFile && exists.existsSync(configFile) ? configFile : configFile && exists.existsSync(joinPaths.joinPaths(append.appendPath(projectRoot, workspaceRoot), configFile)) ? joinPaths.joinPaths(append.appendPath(projectRoot, workspaceRoot), configFile) : exists.existsSync(joinPaths.joinPaths(append.appendPath(projectRoot, workspaceRoot), `${framework}.config.ts`)) ? joinPaths.joinPaths(append.appendPath(projectRoot, workspaceRoot), `${framework}.config.ts`) : exists.existsSync(joinPaths.joinPaths(append.appendPath(projectRoot, workspaceRoot), `${framework}.config.js`)) ? joinPaths.joinPaths(append.appendPath(projectRoot, workspaceRoot), `${framework}.config.js`) : exists.existsSync(joinPaths.joinPaths(append.appendPath(projectRoot, workspaceRoot), `${framework}.config.mts`)) ? joinPaths.joinPaths(append.appendPath(projectRoot, workspaceRoot), `${framework}.config.mts`) : exists.existsSync(joinPaths.joinPaths(append.appendPath(projectRoot, workspaceRoot), `${framework}.config.mjs`)) ? joinPaths.joinPaths(append.appendPath(projectRoot, workspaceRoot), `${framework}.config.mjs`) : void 0;
30
- if (resolvedUserConfigFile) {
31
- let resolvedPath;
32
- try {
33
- resolvedPath = jiti.esmResolve(resolvedUserConfigFile);
34
- } catch {
35
- resolvedPath = resolvedUserConfigFile;
36
- }
37
- const resolved = await jiti.import(resolvedPath);
38
- if (resolved) {
39
- let config = {};
40
- if (isFunction.isFunction(resolved)) {
41
- config = await Promise.resolve(resolved({
42
- command,
43
- mode: mode || "production",
44
- isSsrBuild: false,
45
- isPreview: false
46
- }));
47
- }
48
- if (isSetObject.isSetObject(config)) {
49
- resolvedUserConfig = {
50
- ...config,
51
- config,
52
- configFile: resolvedUserConfigFile
53
- };
54
- }
55
- }
56
- }
57
- const result = await c12.loadConfig({
58
- cwd: projectRoot,
59
- name: framework,
60
- envName: mode,
61
- globalRc: true,
62
- packageJson: true,
63
- dotenv: true,
64
- jiti
65
- });
66
- return defu__default.default(resolvedUserConfig, isSetObject.isSetObject(result?.config) ? {
67
- ...result.config,
68
- ...result
69
- } : {});
70
- }
71
- chunkUSNT2KNT_cjs.__name(loadUserConfigFile, "loadUserConfigFile");
72
-
73
- exports.loadUserConfigFile = loadUserConfigFile;
74
- exports.loadWorkspaceConfig = loadWorkspaceConfig;
@@ -1,89 +0,0 @@
1
- import { __name } from './chunk-SHUYVCID.js';
2
- import { joinPaths } from '@stryke/path/join';
3
- import { match } from 'bundle-require';
4
-
5
- var NON_NODE_MODULE_REGEX = /^[A-Z]:[/\\]|^\.{0,2}\/|^\.{1,2}$/;
6
- async function handleResolveId(context, args, options = {}) {
7
- if (args.id) {
8
- if (context.fs.isVirtual(args.id) || args.importer && context.fs.isVirtual(args.id, {
9
- paths: [
10
- args.importer
11
- ]
12
- })) {
13
- const resolvedPath = args.importer ? context.fs.resolve(args.id, {
14
- paths: [
15
- args.importer
16
- ]
17
- }) : context.fs.resolve(args.id);
18
- if (resolvedPath) {
19
- return {
20
- id: resolvedPath,
21
- external: context.config.projectType !== "application"
22
- };
23
- }
24
- }
25
- if (!!context.tsconfig.options.paths && Object.keys(context.tsconfig.options.paths).some((path) => args.id.startsWith(path.replaceAll("*", "")))) {
26
- let tsconfigPath = false;
27
- if (context.tsconfig.options.paths) {
28
- for (const tsconfigPathKey of Object.keys(context.tsconfig.options.paths).filter((tsconfigPath2) => args.id.startsWith(tsconfigPath2.replaceAll("*", "")))) {
29
- const resolvedPath = context.tsconfig.options.paths[tsconfigPathKey]?.find((tsconfigPath2) => context.fs.resolve(joinPaths(context.workspaceConfig.workspaceRoot, tsconfigPath2.replaceAll("*", ""), args.id.replace(tsconfigPathKey.replaceAll("*", ""), ""))) || context.fs.formatPath(tsconfigPath2) === context.fs.formatPath(args.id));
30
- if (resolvedPath) {
31
- tsconfigPath = context.fs.formatPath(resolvedPath) === context.fs.formatPath(args.id) ? context.fs.formatPath(resolvedPath) : context.fs.resolve(joinPaths(context.workspaceConfig.workspaceRoot, resolvedPath.replaceAll("*", ""), args.id.replace(tsconfigPathKey.replaceAll("*", ""), "")));
32
- }
33
- }
34
- }
35
- let tsconfigPathPackage = false;
36
- if (context.tsconfig.options.paths) {
37
- const tsconfigPathKeys = Object.keys(context.tsconfig.options.paths).filter((tsconfigPath2) => args.id.startsWith(tsconfigPath2.replaceAll("*", "")));
38
- if (tsconfigPathKeys.length > 0 && tsconfigPathKeys[0]) {
39
- tsconfigPathPackage = tsconfigPathKeys[0].replace(/\/\*$/, "");
40
- }
41
- }
42
- if (tsconfigPath && tsconfigPathPackage) {
43
- return {
44
- id: tsconfigPath,
45
- external: Boolean(!options.noExternal?.includes(tsconfigPathPackage) && (options.external?.includes(tsconfigPathPackage) ?? context.config.projectType !== "application"))
46
- };
47
- }
48
- }
49
- if (options.skipResolve) {
50
- return void 0;
51
- }
52
- if (options.skipNodeModulesBundle) {
53
- if (match(args.id, options.resolvePatterns) || match(args.id, options.noExternal) || args.id.startsWith("internal:") || args.id.startsWith("virtual:")) {
54
- return void 0;
55
- }
56
- if (match(args.id, options.external) || args.id.startsWith("node:")) {
57
- return {
58
- id: args.id,
59
- external: true
60
- };
61
- }
62
- if (!NON_NODE_MODULE_REGEX.test(args.id)) {
63
- return {
64
- id: args.id,
65
- external: true
66
- };
67
- }
68
- } else {
69
- const resolvedPath = context.fs.resolve(args.id, {
70
- paths: args.importer ? [
71
- args.importer
72
- ] : []
73
- });
74
- if (match(args.id, options.noExternal) || resolvedPath && context.fs.metadata[resolvedPath]?.type === "builtin") {
75
- return void 0;
76
- }
77
- if (match(args.id, options.external) || args.id.startsWith("node:")) {
78
- return {
79
- id: args.id,
80
- external: true
81
- };
82
- }
83
- }
84
- }
85
- return void 0;
86
- }
87
- __name(handleResolveId, "handleResolveId");
88
-
89
- export { handleResolveId };
@@ -1,37 +0,0 @@
1
- 'use strict';
2
-
3
- var chunkUSNT2KNT_cjs = require('./chunk-USNT2KNT.cjs');
4
- var resolve = require('@stryke/fs/resolve');
5
- var joinPaths = require('@stryke/path/join-paths');
6
-
7
- async function resolvePath(context, file) {
8
- let path = context.fs.resolve(file);
9
- if (path) {
10
- return path;
11
- }
12
- path = file;
13
- if (context.fs.existsSync(path)) {
14
- return path;
15
- }
16
- path = joinPaths.joinPaths(context.workspaceConfig.workspaceRoot, file);
17
- if (context.fs.existsSync(path)) {
18
- return path;
19
- }
20
- path = joinPaths.joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, file);
21
- if (context.fs.existsSync(path)) {
22
- return path;
23
- }
24
- path = joinPaths.joinPaths(context.config.projectRoot, file);
25
- if (context.fs.existsSync(path)) {
26
- return path;
27
- }
28
- return resolve.resolvePackage(file, {
29
- paths: [
30
- context.workspaceConfig.workspaceRoot,
31
- joinPaths.joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot)
32
- ]
33
- });
34
- }
35
- chunkUSNT2KNT_cjs.__name(resolvePath, "resolvePath");
36
-
37
- exports.resolvePath = resolvePath;
@@ -1,35 +0,0 @@
1
- import { __name } from './chunk-SHUYVCID.js';
2
- import { resolvePackage } from '@stryke/fs/resolve';
3
- import { joinPaths } from '@stryke/path/join-paths';
4
-
5
- async function resolvePath(context, file) {
6
- let path = context.fs.resolve(file);
7
- if (path) {
8
- return path;
9
- }
10
- path = file;
11
- if (context.fs.existsSync(path)) {
12
- return path;
13
- }
14
- path = joinPaths(context.workspaceConfig.workspaceRoot, file);
15
- if (context.fs.existsSync(path)) {
16
- return path;
17
- }
18
- path = joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, file);
19
- if (context.fs.existsSync(path)) {
20
- return path;
21
- }
22
- path = joinPaths(context.config.projectRoot, file);
23
- if (context.fs.existsSync(path)) {
24
- return path;
25
- }
26
- return resolvePackage(file, {
27
- paths: [
28
- context.workspaceConfig.workspaceRoot,
29
- joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot)
30
- ]
31
- });
32
- }
33
- __name(resolvePath, "resolvePath");
34
-
35
- export { resolvePath };
@@ -1,67 +0,0 @@
1
- import { __name } from './chunk-SHUYVCID.js';
2
- import { getWorkspaceConfig } from '@storm-software/config-tools/get-config';
3
- import { existsSync } from '@stryke/fs/exists';
4
- import { appendPath } from '@stryke/path/append';
5
- import { joinPaths } from '@stryke/path/join-paths';
6
- import { isFunction } from '@stryke/type-checks/is-function';
7
- import { isSetObject } from '@stryke/type-checks/is-set-object';
8
- import { loadConfig } from 'c12';
9
- import defu from 'defu';
10
-
11
- async function loadWorkspaceConfig(workspaceRoot, cwd) {
12
- return defu({
13
- workspaceRoot
14
- }, await getWorkspaceConfig(true, {
15
- cwd,
16
- workspaceRoot,
17
- useDefault: true
18
- }));
19
- }
20
- __name(loadWorkspaceConfig, "loadWorkspaceConfig");
21
- async function loadUserConfigFile(projectRoot, workspaceRoot, jiti, command, mode, configFile, framework = "powerlines") {
22
- let resolvedUserConfig = {};
23
- const resolvedUserConfigFile = configFile && existsSync(configFile) ? configFile : configFile && existsSync(joinPaths(appendPath(projectRoot, workspaceRoot), configFile)) ? joinPaths(appendPath(projectRoot, workspaceRoot), configFile) : existsSync(joinPaths(appendPath(projectRoot, workspaceRoot), `${framework}.config.ts`)) ? joinPaths(appendPath(projectRoot, workspaceRoot), `${framework}.config.ts`) : existsSync(joinPaths(appendPath(projectRoot, workspaceRoot), `${framework}.config.js`)) ? joinPaths(appendPath(projectRoot, workspaceRoot), `${framework}.config.js`) : existsSync(joinPaths(appendPath(projectRoot, workspaceRoot), `${framework}.config.mts`)) ? joinPaths(appendPath(projectRoot, workspaceRoot), `${framework}.config.mts`) : existsSync(joinPaths(appendPath(projectRoot, workspaceRoot), `${framework}.config.mjs`)) ? joinPaths(appendPath(projectRoot, workspaceRoot), `${framework}.config.mjs`) : void 0;
24
- if (resolvedUserConfigFile) {
25
- let resolvedPath;
26
- try {
27
- resolvedPath = jiti.esmResolve(resolvedUserConfigFile);
28
- } catch {
29
- resolvedPath = resolvedUserConfigFile;
30
- }
31
- const resolved = await jiti.import(resolvedPath);
32
- if (resolved) {
33
- let config = {};
34
- if (isFunction(resolved)) {
35
- config = await Promise.resolve(resolved({
36
- command,
37
- mode: mode || "production",
38
- isSsrBuild: false,
39
- isPreview: false
40
- }));
41
- }
42
- if (isSetObject(config)) {
43
- resolvedUserConfig = {
44
- ...config,
45
- config,
46
- configFile: resolvedUserConfigFile
47
- };
48
- }
49
- }
50
- }
51
- const result = await loadConfig({
52
- cwd: projectRoot,
53
- name: framework,
54
- envName: mode,
55
- globalRc: true,
56
- packageJson: true,
57
- dotenv: true,
58
- jiti
59
- });
60
- return defu(resolvedUserConfig, isSetObject(result?.config) ? {
61
- ...result.config,
62
- ...result
63
- } : {});
64
- }
65
- __name(loadUserConfigFile, "loadUserConfigFile");
66
-
67
- export { loadUserConfigFile, loadWorkspaceConfig };
@@ -1,91 +0,0 @@
1
- 'use strict';
2
-
3
- var chunkUSNT2KNT_cjs = require('./chunk-USNT2KNT.cjs');
4
- var join = require('@stryke/path/join');
5
- var bundleRequire = require('bundle-require');
6
-
7
- var NON_NODE_MODULE_REGEX = /^[A-Z]:[/\\]|^\.{0,2}\/|^\.{1,2}$/;
8
- async function handleResolveId(context, args, options = {}) {
9
- if (args.id) {
10
- if (context.fs.isVirtual(args.id) || args.importer && context.fs.isVirtual(args.id, {
11
- paths: [
12
- args.importer
13
- ]
14
- })) {
15
- const resolvedPath = args.importer ? context.fs.resolve(args.id, {
16
- paths: [
17
- args.importer
18
- ]
19
- }) : context.fs.resolve(args.id);
20
- if (resolvedPath) {
21
- return {
22
- id: resolvedPath,
23
- external: context.config.projectType !== "application"
24
- };
25
- }
26
- }
27
- if (!!context.tsconfig.options.paths && Object.keys(context.tsconfig.options.paths).some((path) => args.id.startsWith(path.replaceAll("*", "")))) {
28
- let tsconfigPath = false;
29
- if (context.tsconfig.options.paths) {
30
- for (const tsconfigPathKey of Object.keys(context.tsconfig.options.paths).filter((tsconfigPath2) => args.id.startsWith(tsconfigPath2.replaceAll("*", "")))) {
31
- const resolvedPath = context.tsconfig.options.paths[tsconfigPathKey]?.find((tsconfigPath2) => context.fs.resolve(join.joinPaths(context.workspaceConfig.workspaceRoot, tsconfigPath2.replaceAll("*", ""), args.id.replace(tsconfigPathKey.replaceAll("*", ""), ""))) || context.fs.formatPath(tsconfigPath2) === context.fs.formatPath(args.id));
32
- if (resolvedPath) {
33
- tsconfigPath = context.fs.formatPath(resolvedPath) === context.fs.formatPath(args.id) ? context.fs.formatPath(resolvedPath) : context.fs.resolve(join.joinPaths(context.workspaceConfig.workspaceRoot, resolvedPath.replaceAll("*", ""), args.id.replace(tsconfigPathKey.replaceAll("*", ""), "")));
34
- }
35
- }
36
- }
37
- let tsconfigPathPackage = false;
38
- if (context.tsconfig.options.paths) {
39
- const tsconfigPathKeys = Object.keys(context.tsconfig.options.paths).filter((tsconfigPath2) => args.id.startsWith(tsconfigPath2.replaceAll("*", "")));
40
- if (tsconfigPathKeys.length > 0 && tsconfigPathKeys[0]) {
41
- tsconfigPathPackage = tsconfigPathKeys[0].replace(/\/\*$/, "");
42
- }
43
- }
44
- if (tsconfigPath && tsconfigPathPackage) {
45
- return {
46
- id: tsconfigPath,
47
- external: Boolean(!options.noExternal?.includes(tsconfigPathPackage) && (options.external?.includes(tsconfigPathPackage) ?? context.config.projectType !== "application"))
48
- };
49
- }
50
- }
51
- if (options.skipResolve) {
52
- return void 0;
53
- }
54
- if (options.skipNodeModulesBundle) {
55
- if (bundleRequire.match(args.id, options.resolvePatterns) || bundleRequire.match(args.id, options.noExternal) || args.id.startsWith("internal:") || args.id.startsWith("virtual:")) {
56
- return void 0;
57
- }
58
- if (bundleRequire.match(args.id, options.external) || args.id.startsWith("node:")) {
59
- return {
60
- id: args.id,
61
- external: true
62
- };
63
- }
64
- if (!NON_NODE_MODULE_REGEX.test(args.id)) {
65
- return {
66
- id: args.id,
67
- external: true
68
- };
69
- }
70
- } else {
71
- const resolvedPath = context.fs.resolve(args.id, {
72
- paths: args.importer ? [
73
- args.importer
74
- ] : []
75
- });
76
- if (bundleRequire.match(args.id, options.noExternal) || resolvedPath && context.fs.metadata[resolvedPath]?.type === "builtin") {
77
- return void 0;
78
- }
79
- if (bundleRequire.match(args.id, options.external) || args.id.startsWith("node:")) {
80
- return {
81
- id: args.id,
82
- external: true
83
- };
84
- }
85
- }
86
- }
87
- return void 0;
88
- }
89
- chunkUSNT2KNT_cjs.__name(handleResolveId, "handleResolveId");
90
-
91
- exports.handleResolveId = handleResolveId;
@@ -1,11 +0,0 @@
1
- 'use strict';
2
-
3
- var chunkZBDVQVUK_cjs = require('../chunk-ZBDVQVUK.cjs');
4
- require('../chunk-USNT2KNT.cjs');
5
-
6
-
7
-
8
- Object.defineProperty(exports, "handleResolveId", {
9
- enumerable: true,
10
- get: function () { return chunkZBDVQVUK_cjs.handleResolveId; }
11
- });