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