powerlines 0.41.5 → 0.41.7

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 (234) hide show
  1. package/README.md +14 -16
  2. package/dist/{api-BYw9Go8X.mjs → api-6f2oVwGy.mjs} +142 -333
  3. package/dist/api-6f2oVwGy.mjs.map +1 -0
  4. package/dist/{api-C0__VShS.cjs → api-CFXLaAxU.cjs} +505 -722
  5. package/dist/astro.cjs +8 -18
  6. package/dist/astro.d.cts +1 -2
  7. package/dist/astro.d.cts.map +1 -1
  8. package/dist/astro.d.mts +1 -6
  9. package/dist/astro.d.mts.map +1 -1
  10. package/dist/astro.mjs +6 -16
  11. package/dist/astro.mjs.map +1 -1
  12. package/dist/{chunk-CbDLau6x.cjs → chunk-AIJqnxB6.cjs} +27 -1
  13. package/dist/chunk-CtajNgzt.mjs +36 -0
  14. package/dist/config.cjs +20 -4
  15. package/dist/config.d.cts +1 -2
  16. package/dist/config.d.mts +1 -3
  17. package/dist/config.mjs +11 -2
  18. package/dist/config.mjs.map +1 -0
  19. package/dist/constants.cjs +20 -20
  20. package/dist/constants.d.cts +1 -24
  21. package/dist/constants.d.mts +1 -24
  22. package/dist/constants.mjs +11 -3
  23. package/dist/constants.mjs.map +1 -0
  24. package/dist/context/index.cjs +4 -9
  25. package/dist/context/index.d.cts +56 -132
  26. package/dist/context/index.d.cts.map +1 -1
  27. package/dist/context/index.d.mts +55 -135
  28. package/dist/context/index.d.mts.map +1 -1
  29. package/dist/context/index.mjs +3 -9
  30. package/dist/esbuild.cjs +60 -17
  31. package/dist/esbuild.d.cts +5 -29
  32. package/dist/esbuild.d.cts.map +1 -1
  33. package/dist/esbuild.d.mts +5 -33
  34. package/dist/esbuild.d.mts.map +1 -1
  35. package/dist/esbuild.mjs +44 -12
  36. package/dist/esbuild.mjs.map +1 -0
  37. package/dist/farm.cjs +6 -13
  38. package/dist/farm.d.cts +2 -3
  39. package/dist/farm.d.cts.map +1 -1
  40. package/dist/farm.d.mts +2 -6
  41. package/dist/farm.d.mts.map +1 -1
  42. package/dist/farm.mjs +4 -11
  43. package/dist/farm.mjs.map +1 -1
  44. package/dist/index.cjs +7 -13
  45. package/dist/index.d.cts +263 -6
  46. package/dist/index.d.cts.map +1 -0
  47. package/dist/index.d.mts +263 -7
  48. package/dist/index.d.mts.map +1 -0
  49. package/dist/index.mjs +3 -9
  50. package/dist/index.mjs.map +1 -1
  51. package/dist/next.cjs +7 -14
  52. package/dist/next.d.cts +0 -1
  53. package/dist/next.d.cts.map +1 -1
  54. package/dist/next.d.mts +0 -1
  55. package/dist/next.d.mts.map +1 -1
  56. package/dist/next.mjs +6 -13
  57. package/dist/next.mjs.map +1 -1
  58. package/dist/nuxt.cjs +12 -22
  59. package/dist/nuxt.d.cts +2 -3
  60. package/dist/nuxt.d.cts.map +1 -1
  61. package/dist/nuxt.d.mts +2 -7
  62. package/dist/nuxt.d.mts.map +1 -1
  63. package/dist/nuxt.mjs +8 -18
  64. package/dist/nuxt.mjs.map +1 -1
  65. package/dist/plugin-utils.cjs +20 -28
  66. package/dist/plugin-utils.d.cts +1 -267
  67. package/dist/plugin-utils.d.mts +1 -272
  68. package/dist/plugin-utils.mjs +11 -4
  69. package/dist/plugin-utils.mjs.map +1 -0
  70. package/dist/rolldown.cjs +52 -18
  71. package/dist/rolldown.d.cts +5 -29
  72. package/dist/rolldown.d.cts.map +1 -1
  73. package/dist/rolldown.d.mts +5 -32
  74. package/dist/rolldown.d.mts.map +1 -1
  75. package/dist/rolldown.mjs +36 -13
  76. package/dist/rolldown.mjs.map +1 -0
  77. package/dist/rollup.cjs +20 -48
  78. package/dist/rollup.d.cts +5 -29
  79. package/dist/rollup.d.cts.map +1 -1
  80. package/dist/rollup.d.mts +5 -32
  81. package/dist/rollup.d.mts.map +1 -1
  82. package/dist/rollup.mjs +6 -44
  83. package/dist/rollup.mjs.map +1 -1
  84. package/dist/rspack.cjs +20 -82
  85. package/dist/rspack.d.cts +4 -24
  86. package/dist/rspack.d.cts.map +1 -1
  87. package/dist/rspack.d.mts +4 -27
  88. package/dist/rspack.d.mts.map +1 -1
  89. package/dist/rspack.mjs +5 -77
  90. package/dist/rspack.mjs.map +1 -1
  91. package/dist/storage/index.cjs +2 -3
  92. package/dist/storage/index.d.cts +7 -7
  93. package/dist/storage/index.d.cts.map +1 -1
  94. package/dist/storage/index.d.mts +7 -11
  95. package/dist/storage/index.d.mts.map +1 -1
  96. package/dist/storage/index.mjs +1 -3
  97. package/dist/{tsconfig-C8M8X6U0.cjs → tsconfig-BJrUrPC_.cjs} +13 -13
  98. package/dist/{tsconfig-B92heKit.mjs → tsconfig-D9GCB2I9.mjs} +5 -5
  99. package/dist/tsconfig-D9GCB2I9.mjs.map +1 -0
  100. package/dist/tsdown.cjs +38 -187
  101. package/dist/tsdown.d.cts +2 -24
  102. package/dist/tsdown.d.cts.map +1 -1
  103. package/dist/tsdown.d.mts +4 -30
  104. package/dist/tsdown.d.mts.map +1 -1
  105. package/dist/tsdown.mjs +8 -167
  106. package/dist/tsdown.mjs.map +1 -1
  107. package/dist/tsup.cjs +29 -134
  108. package/dist/tsup.d.cts +2 -24
  109. package/dist/tsup.d.cts.map +1 -1
  110. package/dist/tsup.d.mts +2 -28
  111. package/dist/tsup.d.mts.map +1 -1
  112. package/dist/tsup.mjs +7 -122
  113. package/dist/tsup.mjs.map +1 -1
  114. package/dist/types-DerAvFjs.d.cts +4 -0
  115. package/dist/types-DerAvFjs.d.cts.map +1 -0
  116. package/dist/types-ro7jWCtL.d.mts +4 -0
  117. package/dist/types-ro7jWCtL.d.mts.map +1 -0
  118. package/dist/typescript/index.cjs +2 -1
  119. package/dist/typescript/index.d.cts +2 -2
  120. package/dist/typescript/index.d.cts.map +1 -1
  121. package/dist/typescript/index.d.mts +1 -4
  122. package/dist/typescript/index.d.mts.map +1 -1
  123. package/dist/typescript/index.mjs +1 -1
  124. package/dist/unloader.cjs +6 -13
  125. package/dist/unloader.d.cts +2 -4
  126. package/dist/unloader.d.cts.map +1 -1
  127. package/dist/unloader.d.mts +2 -7
  128. package/dist/unloader.d.mts.map +1 -1
  129. package/dist/unloader.mjs +4 -11
  130. package/dist/unloader.mjs.map +1 -1
  131. package/dist/unplugin.cjs +11 -14
  132. package/dist/unplugin.d.cts +5 -6
  133. package/dist/unplugin.d.cts.map +1 -1
  134. package/dist/unplugin.d.mts +3 -6
  135. package/dist/unplugin.d.mts.map +1 -1
  136. package/dist/unplugin.mjs +6 -10
  137. package/dist/utils.cjs +38 -22
  138. package/dist/utils.d.cts +3 -2
  139. package/dist/utils.d.mts +3 -3
  140. package/dist/utils.mjs +19 -3
  141. package/dist/utils.mjs.map +1 -0
  142. package/dist/{virtual-B1MLgqnQ.cjs → virtual-Cbvj12lU.cjs} +33 -33
  143. package/dist/{virtual-B9imjOqe.mjs → virtual-DvkJm7gK.mjs} +7 -7
  144. package/dist/virtual-DvkJm7gK.mjs.map +1 -0
  145. package/dist/vite.cjs +84 -19
  146. package/dist/vite.d.cts +5 -16
  147. package/dist/vite.d.cts.map +1 -1
  148. package/dist/vite.d.mts +5 -19
  149. package/dist/vite.d.mts.map +1 -1
  150. package/dist/vite.mjs +67 -14
  151. package/dist/vite.mjs.map +1 -0
  152. package/dist/webpack.cjs +42 -16
  153. package/dist/webpack.d.cts +5 -29
  154. package/dist/webpack.d.cts.map +1 -1
  155. package/dist/webpack.d.mts +5 -32
  156. package/dist/webpack.d.mts.map +1 -1
  157. package/dist/webpack.mjs +26 -11
  158. package/dist/webpack.mjs.map +1 -0
  159. package/package.json +15 -15
  160. package/dist/api-BYw9Go8X.mjs.map +0 -1
  161. package/dist/commands-7TWNqTU1.d.cts +0 -12
  162. package/dist/commands-7TWNqTU1.d.cts.map +0 -1
  163. package/dist/commands-yacLkOi0.d.mts +0 -12
  164. package/dist/commands-yacLkOi0.d.mts.map +0 -1
  165. package/dist/config-CK756s0L.d.mts +0 -2232
  166. package/dist/config-CK756s0L.d.mts.map +0 -1
  167. package/dist/config-CiPXgwzt.d.mts +0 -39
  168. package/dist/config-CiPXgwzt.d.mts.map +0 -1
  169. package/dist/config-D4Fh2gQL.mjs +0 -87
  170. package/dist/config-D4Fh2gQL.mjs.map +0 -1
  171. package/dist/config-D86Vw7SC.cjs +0 -105
  172. package/dist/config-J74ORCFY.d.cts +0 -39
  173. package/dist/config-J74ORCFY.d.cts.map +0 -1
  174. package/dist/config-vnrrSxEB.d.cts +0 -2232
  175. package/dist/config-vnrrSxEB.d.cts.map +0 -1
  176. package/dist/constants-CZh5rsgh.cjs +0 -103
  177. package/dist/constants-cXxSHhNp.mjs +0 -32
  178. package/dist/constants-cXxSHhNp.mjs.map +0 -1
  179. package/dist/constants.d.cts.map +0 -1
  180. package/dist/constants.d.mts.map +0 -1
  181. package/dist/esbuild-CQvxEQNO.cjs +0 -100
  182. package/dist/esbuild-Ci47pk0Y.mjs +0 -82
  183. package/dist/esbuild-Ci47pk0Y.mjs.map +0 -1
  184. package/dist/index-2JXW-b2-.d.mts +0 -82
  185. package/dist/index-2JXW-b2-.d.mts.map +0 -1
  186. package/dist/index-6BLROVtJ.d.mts +0 -261
  187. package/dist/index-6BLROVtJ.d.mts.map +0 -1
  188. package/dist/index-C7W0kmm7.d.mts +0 -171
  189. package/dist/index-C7W0kmm7.d.mts.map +0 -1
  190. package/dist/index-DJ-k0GOX.d.cts +0 -261
  191. package/dist/index-DJ-k0GOX.d.cts.map +0 -1
  192. package/dist/paths-CS8ecCnW.mjs +0 -81
  193. package/dist/paths-CS8ecCnW.mjs.map +0 -1
  194. package/dist/paths-YmyIGEVo.cjs +0 -98
  195. package/dist/plugin-B9TQt-p0.d.cts +0 -82
  196. package/dist/plugin-B9TQt-p0.d.cts.map +0 -1
  197. package/dist/plugin-BE3wmhoU.d.cts +0 -26
  198. package/dist/plugin-BE3wmhoU.d.cts.map +0 -1
  199. package/dist/plugin-CZ_PJPpQ.cjs +0 -96
  200. package/dist/plugin-C_8RhG5V.d.mts +0 -26
  201. package/dist/plugin-C_8RhG5V.d.mts.map +0 -1
  202. package/dist/plugin-E5foRD0k.mjs +0 -61
  203. package/dist/plugin-E5foRD0k.mjs.map +0 -1
  204. package/dist/plugin-utils-C3HnZJl1.mjs +0 -387
  205. package/dist/plugin-utils-C3HnZJl1.mjs.map +0 -1
  206. package/dist/plugin-utils-Ck3cx3w6.cjs +0 -531
  207. package/dist/plugin-utils.d.cts.map +0 -1
  208. package/dist/plugin-utils.d.mts.map +0 -1
  209. package/dist/resolve-options-6sXFqzEA.mjs +0 -116
  210. package/dist/resolve-options-6sXFqzEA.mjs.map +0 -1
  211. package/dist/resolve-options-BQnTgg3V.cjs +0 -105
  212. package/dist/resolve-options-D-RGs8j8.mjs +0 -117
  213. package/dist/resolve-options-D-RGs8j8.mjs.map +0 -1
  214. package/dist/resolve-options-DHL3RM8F.mjs +0 -87
  215. package/dist/resolve-options-DHL3RM8F.mjs.map +0 -1
  216. package/dist/resolve-options-lxQ2pm0W.cjs +0 -127
  217. package/dist/resolve-options-vyFhhkLp.cjs +0 -133
  218. package/dist/rolldown-Bfem3MO5.cjs +0 -83
  219. package/dist/rolldown-gZExn2eg.mjs +0 -65
  220. package/dist/rolldown-gZExn2eg.mjs.map +0 -1
  221. package/dist/tsconfig-B92heKit.mjs.map +0 -1
  222. package/dist/types-Bh_vLuQ0.d.mts +0 -1
  223. package/dist/utils-BbDma_5Y.cjs +0 -449
  224. package/dist/utils-DoQcX7Sk.mjs +0 -339
  225. package/dist/utils-DoQcX7Sk.mjs.map +0 -1
  226. package/dist/virtual-B9imjOqe.mjs.map +0 -1
  227. package/dist/vite-KO7wzRoS.cjs +0 -189
  228. package/dist/vite-rDviBWJz.mjs +0 -171
  229. package/dist/vite-rDviBWJz.mjs.map +0 -1
  230. package/dist/webpack-CB2Lw9tt.cjs +0 -107
  231. package/dist/webpack-_lZGia72.mjs +0 -88
  232. package/dist/webpack-_lZGia72.mjs.map +0 -1
  233. package/dist/write-file-CpNWY8SV.d.cts +0 -171
  234. package/dist/write-file-CpNWY8SV.d.cts.map +0 -1
@@ -1,189 +0,0 @@
1
- const require_chunk = require('./chunk-CbDLau6x.cjs');
2
- const require_api = require('./api-C0__VShS.cjs');
3
- const require_resolve_options = require('./resolve-options-BQnTgg3V.cjs');
4
- const require_resolve_options$1 = require('./resolve-options-vyFhhkLp.cjs');
5
- const require_resolve_options$2 = require('./resolve-options-lxQ2pm0W.cjs');
6
- let __stryke_path_join_paths = require("@stryke/path/join-paths");
7
- let defu = require("defu");
8
- defu = require_chunk.__toESM(defu);
9
- let unplugin = require("unplugin");
10
- let __stryke_env_environment_checks = require("@stryke/env/environment-checks");
11
- let vite = require("vite");
12
-
13
- //#region ../plugin-vite/src/helpers/resolve-options.ts
14
- const DEFAULT_VITE_CONFIG = {
15
- resolve: { extensions: [
16
- ".mjs",
17
- ".js",
18
- ".mts",
19
- ".ts",
20
- ".jsx",
21
- ".tsx",
22
- ".json"
23
- ] },
24
- json: { stringify: true },
25
- logLevel: "silent",
26
- clearScreen: true
27
- };
28
- /**
29
- * Resolves the options for [vite](https://vitejs.dev/).
30
- *
31
- * @param context - The build context.
32
- * @returns The resolved options.
33
- */
34
- function resolveOptions(context) {
35
- return (0, defu.default)({ resolve: {
36
- alias: Object.entries(context.alias).reduce((ret, [id, path]) => {
37
- if (!ret.find((e) => e.find === id)) ret.push({
38
- find: id,
39
- replacement: path
40
- });
41
- else context.warn(`Duplicate alias entry for '${id}' detected. The first entry will be used.`);
42
- return ret;
43
- }, []),
44
- dedupe: context.config.resolve.dedupe,
45
- mainFields: context.config.resolve.mainFields,
46
- conditions: context.config.resolve.conditions,
47
- extensions: context.config.resolve.extensions
48
- } }, context.config.vite ? (0, defu.default)(context.config.vite, { optimizeDeps: context.config.vite?.optimizeDeps ?? {} }, { optimizeDeps: { extensions: context.config.resolve.extensions } }) : {}, {
49
- define: context.config.define,
50
- rootDir: context.fs.existsSync((0, __stryke_path_join_paths.joinPaths)(context.config.root, "src")) ? (0, __stryke_path_join_paths.joinPaths)(context.config.root, "src") : context.config.root,
51
- platform: context.config.platform,
52
- mode: context.config.mode === "development" ? "development" : "production",
53
- cacheDir: (0, __stryke_path_join_paths.joinPaths)(context.cachePath, "vite"),
54
- build: {
55
- minify: context.config.mode !== "development",
56
- metafile: context.config.mode === "development",
57
- sourcemap: context.config.mode === "development",
58
- outDir: context.config.output.buildPath,
59
- tsconfig: context.tsconfig.tsconfigFilePath,
60
- tsconfigRaw: context.tsconfig.tsconfigJson
61
- },
62
- esbuild: require_resolve_options.resolveOptions(context),
63
- optimizeDeps: {
64
- rolldownOptions: require_resolve_options$2.resolveOptions(context),
65
- rollupOptions: require_resolve_options$1.resolveOptions(context),
66
- esbuildOptions: require_resolve_options.resolveOptions(context)
67
- },
68
- logLevel: context.config.logLevel ?? void 0,
69
- envDir: context.config.root
70
- }, DEFAULT_VITE_CONFIG);
71
- }
72
-
73
- //#endregion
74
- //#region ../plugin-vite/src/helpers/unplugin.ts
75
- function createVitePlugin$1(context) {
76
- return (0, unplugin.createVitePlugin)(require_api.createUnplugin(context))({});
77
- }
78
-
79
- //#endregion
80
- //#region ../plugin-vite/src/index.ts
81
- /**
82
- * A Powerlines plugin to assist in developing other Powerlines plugins.
83
- */
84
- const plugin = (options = {}) => {
85
- return {
86
- name: "vite",
87
- config() {
88
- this.trace("Providing default configuration for the Powerlines `vite` build plugin.");
89
- return {
90
- output: { format: ["cjs", "esm"] },
91
- vite: {
92
- ...DEFAULT_VITE_CONFIG,
93
- ...options
94
- },
95
- singleBuild: true
96
- };
97
- },
98
- async build() {
99
- this.trace(`Building the Powerlines plugin.`);
100
- const environments = this?.$$internal?.api?.context?.environments;
101
- if (!environments || Object.keys(environments).length === 0) throw new Error(`No environments found in the Powerlines context. At least one environment should have been generated - please report this issue to https://github.com/storm-software/powerlines/issues.`);
102
- this.trace(`Running Vite for ${Object.keys(environments).length} environments.`);
103
- await (0, vite.build)((0, defu.default)({
104
- config: false,
105
- entry: this.entry,
106
- environments: Object.fromEntries(Object.entries(environments).map(([name, env]) => [name, resolveOptions(env)]))
107
- }, resolveOptions(this), { plugins: [createVitePlugin$1(this)] }));
108
- }
109
- };
110
- };
111
- var src_default = plugin;
112
-
113
- //#endregion
114
- //#region src/vite.ts
115
- /**
116
- * A Vite plugin that will invoke the Powerlines API hooks during the build process.
117
- *
118
- * @see https://vitejs.dev/guide/api-plugin.html#plugin-api
119
- *
120
- * @example
121
- * ```ts
122
- * // vite.config.ts
123
- * import powerlines from "powerlines/vite";
124
- *
125
- * export default defineConfig({
126
- * plugins: [powerlines({ name: "example-app", ... })],
127
- * });
128
- *
129
- * ```
130
- */
131
- const unplugin$1 = (0, unplugin.createVitePlugin)(require_api.createUnpluginFactory("vite", (api, plugin$1) => {
132
- return {
133
- ...plugin$1,
134
- vite: {
135
- sharedDuringBuild: true,
136
- async hotUpdate(options) {
137
- const environment = await api.context.getEnvironment();
138
- return api.callHook("vite:hotUpdate", { environment }, options);
139
- },
140
- async config(config, env) {
141
- api.context.config.mode = (0, __stryke_env_environment_checks.isDevelopmentMode)(env.mode) ? "development" : (0, __stryke_env_environment_checks.isTestMode)(env.mode) ? "test" : "production";
142
- const environment = await api.context.getEnvironment();
143
- const result = await api.callHook("vite:config", { environment }, config, env);
144
- return (0, defu.default)(resolveOptions(api.context), result?.build ?? {}, config);
145
- },
146
- async configResolved(_config) {
147
- const environment = await api.context.getEnvironment();
148
- await api.callHook("configResolved", { environment });
149
- },
150
- async configureServer(server) {
151
- const environment = await api.context.getEnvironment();
152
- return api.callHook("vite:configureServer", { environment }, server);
153
- },
154
- async configurePreviewServer(server) {
155
- const environment = await api.context.getEnvironment();
156
- return api.callHook("vite:configurePreviewServer", { environment }, server);
157
- },
158
- async transformIndexHtml(html, ctx) {
159
- const environment = await api.context.getEnvironment();
160
- return api.callHook("vite:transformIndexHtml", { environment }, html, ctx);
161
- },
162
- async handleHotUpdate(ctx) {
163
- const environment = await api.context.getEnvironment();
164
- return api.callHook("vite:handleHotUpdate", { environment }, ctx);
165
- }
166
- }
167
- };
168
- }));
169
- var vite_default = unplugin$1;
170
-
171
- //#endregion
172
- Object.defineProperty(exports, 'src_default', {
173
- enumerable: true,
174
- get: function () {
175
- return src_default;
176
- }
177
- });
178
- Object.defineProperty(exports, 'unplugin', {
179
- enumerable: true,
180
- get: function () {
181
- return unplugin$1;
182
- }
183
- });
184
- Object.defineProperty(exports, 'vite_default', {
185
- enumerable: true,
186
- get: function () {
187
- return vite_default;
188
- }
189
- });
@@ -1,171 +0,0 @@
1
- import { a as createUnpluginFactory, o as createUnplugin } from "./api-BYw9Go8X.mjs";
2
- import { r as resolveOptions$1 } from "./resolve-options-DHL3RM8F.mjs";
3
- import { n as resolveOptions$3 } from "./resolve-options-6sXFqzEA.mjs";
4
- import { t as resolveOptions$2 } from "./resolve-options-D-RGs8j8.mjs";
5
- import { joinPaths } from "@stryke/path/join-paths";
6
- import defu from "defu";
7
- import { createVitePlugin } from "unplugin";
8
- import { isDevelopmentMode, isTestMode } from "@stryke/env/environment-checks";
9
- import { build } from "vite";
10
-
11
- //#region ../plugin-vite/src/helpers/resolve-options.ts
12
- const DEFAULT_VITE_CONFIG = {
13
- resolve: { extensions: [
14
- ".mjs",
15
- ".js",
16
- ".mts",
17
- ".ts",
18
- ".jsx",
19
- ".tsx",
20
- ".json"
21
- ] },
22
- json: { stringify: true },
23
- logLevel: "silent",
24
- clearScreen: true
25
- };
26
- /**
27
- * Resolves the options for [vite](https://vitejs.dev/).
28
- *
29
- * @param context - The build context.
30
- * @returns The resolved options.
31
- */
32
- function resolveOptions(context) {
33
- return defu({ resolve: {
34
- alias: Object.entries(context.alias).reduce((ret, [id, path]) => {
35
- if (!ret.find((e) => e.find === id)) ret.push({
36
- find: id,
37
- replacement: path
38
- });
39
- else context.warn(`Duplicate alias entry for '${id}' detected. The first entry will be used.`);
40
- return ret;
41
- }, []),
42
- dedupe: context.config.resolve.dedupe,
43
- mainFields: context.config.resolve.mainFields,
44
- conditions: context.config.resolve.conditions,
45
- extensions: context.config.resolve.extensions
46
- } }, context.config.vite ? defu(context.config.vite, { optimizeDeps: context.config.vite?.optimizeDeps ?? {} }, { optimizeDeps: { extensions: context.config.resolve.extensions } }) : {}, {
47
- define: context.config.define,
48
- rootDir: context.fs.existsSync(joinPaths(context.config.root, "src")) ? joinPaths(context.config.root, "src") : context.config.root,
49
- platform: context.config.platform,
50
- mode: context.config.mode === "development" ? "development" : "production",
51
- cacheDir: joinPaths(context.cachePath, "vite"),
52
- build: {
53
- minify: context.config.mode !== "development",
54
- metafile: context.config.mode === "development",
55
- sourcemap: context.config.mode === "development",
56
- outDir: context.config.output.buildPath,
57
- tsconfig: context.tsconfig.tsconfigFilePath,
58
- tsconfigRaw: context.tsconfig.tsconfigJson
59
- },
60
- esbuild: resolveOptions$1(context),
61
- optimizeDeps: {
62
- rolldownOptions: resolveOptions$2(context),
63
- rollupOptions: resolveOptions$3(context),
64
- esbuildOptions: resolveOptions$1(context)
65
- },
66
- logLevel: context.config.logLevel ?? void 0,
67
- envDir: context.config.root
68
- }, DEFAULT_VITE_CONFIG);
69
- }
70
-
71
- //#endregion
72
- //#region ../plugin-vite/src/helpers/unplugin.ts
73
- function createVitePlugin$1(context) {
74
- return createVitePlugin(createUnplugin(context))({});
75
- }
76
-
77
- //#endregion
78
- //#region ../plugin-vite/src/index.ts
79
- /**
80
- * A Powerlines plugin to assist in developing other Powerlines plugins.
81
- */
82
- const plugin = (options = {}) => {
83
- return {
84
- name: "vite",
85
- config() {
86
- this.trace("Providing default configuration for the Powerlines `vite` build plugin.");
87
- return {
88
- output: { format: ["cjs", "esm"] },
89
- vite: {
90
- ...DEFAULT_VITE_CONFIG,
91
- ...options
92
- },
93
- singleBuild: true
94
- };
95
- },
96
- async build() {
97
- this.trace(`Building the Powerlines plugin.`);
98
- const environments = this?.$$internal?.api?.context?.environments;
99
- if (!environments || Object.keys(environments).length === 0) throw new Error(`No environments found in the Powerlines context. At least one environment should have been generated - please report this issue to https://github.com/storm-software/powerlines/issues.`);
100
- this.trace(`Running Vite for ${Object.keys(environments).length} environments.`);
101
- await build(defu({
102
- config: false,
103
- entry: this.entry,
104
- environments: Object.fromEntries(Object.entries(environments).map(([name, env]) => [name, resolveOptions(env)]))
105
- }, resolveOptions(this), { plugins: [createVitePlugin$1(this)] }));
106
- }
107
- };
108
- };
109
- var src_default = plugin;
110
-
111
- //#endregion
112
- //#region src/vite.ts
113
- /**
114
- * A Vite plugin that will invoke the Powerlines API hooks during the build process.
115
- *
116
- * @see https://vitejs.dev/guide/api-plugin.html#plugin-api
117
- *
118
- * @example
119
- * ```ts
120
- * // vite.config.ts
121
- * import powerlines from "powerlines/vite";
122
- *
123
- * export default defineConfig({
124
- * plugins: [powerlines({ name: "example-app", ... })],
125
- * });
126
- *
127
- * ```
128
- */
129
- const unplugin = createVitePlugin(createUnpluginFactory("vite", (api, plugin$1) => {
130
- return {
131
- ...plugin$1,
132
- vite: {
133
- sharedDuringBuild: true,
134
- async hotUpdate(options) {
135
- const environment = await api.context.getEnvironment();
136
- return api.callHook("vite:hotUpdate", { environment }, options);
137
- },
138
- async config(config, env) {
139
- api.context.config.mode = isDevelopmentMode(env.mode) ? "development" : isTestMode(env.mode) ? "test" : "production";
140
- const environment = await api.context.getEnvironment();
141
- const result = await api.callHook("vite:config", { environment }, config, env);
142
- return defu(resolveOptions(api.context), result?.build ?? {}, config);
143
- },
144
- async configResolved(_config) {
145
- const environment = await api.context.getEnvironment();
146
- await api.callHook("configResolved", { environment });
147
- },
148
- async configureServer(server) {
149
- const environment = await api.context.getEnvironment();
150
- return api.callHook("vite:configureServer", { environment }, server);
151
- },
152
- async configurePreviewServer(server) {
153
- const environment = await api.context.getEnvironment();
154
- return api.callHook("vite:configurePreviewServer", { environment }, server);
155
- },
156
- async transformIndexHtml(html, ctx) {
157
- const environment = await api.context.getEnvironment();
158
- return api.callHook("vite:transformIndexHtml", { environment }, html, ctx);
159
- },
160
- async handleHotUpdate(ctx) {
161
- const environment = await api.context.getEnvironment();
162
- return api.callHook("vite:handleHotUpdate", { environment }, ctx);
163
- }
164
- }
165
- };
166
- }));
167
- var vite_default = unplugin;
168
-
169
- //#endregion
170
- export { vite_default as n, src_default as r, unplugin as t };
171
- //# sourceMappingURL=vite-rDviBWJz.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"vite-rDviBWJz.mjs","names":["DEFAULT_VITE_CONFIG: Partial<ViteOptions>","resolveEsbuildOptions","resolveRolldownOptions","resolveRollupOptions","createVitePlugin","createViteUnplugin","createVitePlugin","plugin"],"sources":["../../plugin-vite/src/helpers/resolve-options.ts","../../plugin-vite/src/helpers/unplugin.ts","../../plugin-vite/src/index.ts","../src/vite.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 { Context } from \"@powerlines/core\";\nimport { resolveOptions as resolveEsbuildOptions } from \"@powerlines/plugin-esbuild/helpers/resolve-options\";\nimport { resolveOptions as resolveRolldownOptions } from \"@powerlines/plugin-rolldown/helpers/resolve-options\";\nimport { resolveOptions as resolveRollupOptions } from \"@powerlines/plugin-rollup/helpers/resolve-options\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport defu from \"defu\";\nimport { ESBuildOptions } from \"vite\";\nimport { VitePluginResolvedConfig } from \"../types\";\nimport { ViteOptions } from \"../types/build\";\n\nexport const DEFAULT_VITE_CONFIG: Partial<ViteOptions> = {\n resolve: {\n extensions: [\".mjs\", \".js\", \".mts\", \".ts\", \".jsx\", \".tsx\", \".json\"]\n },\n json: {\n stringify: true\n },\n logLevel: \"silent\",\n clearScreen: true\n};\n\n/**\n * Resolves the options for [vite](https://vitejs.dev/).\n *\n * @param context - The build context.\n * @returns The resolved options.\n */\nexport function resolveOptions(context: Context): ViteOptions {\n return defu(\n {\n resolve: {\n alias: Object.entries(context.alias).reduce(\n (ret, [id, path]) => {\n if (!ret.find(e => e.find === id)) {\n ret.push({\n find: id,\n replacement: path\n });\n } else {\n context.warn(\n `Duplicate alias entry for '${id}' detected. The first entry will be used.`\n );\n }\n\n return ret;\n },\n [] as { find: string; replacement: string }[]\n ),\n dedupe: context.config.resolve.dedupe,\n mainFields: context.config.resolve.mainFields,\n conditions: context.config.resolve.conditions,\n extensions: context.config.resolve.extensions\n }\n },\n (context.config as VitePluginResolvedConfig).vite\n ? defu(\n (context.config as VitePluginResolvedConfig).vite,\n {\n optimizeDeps:\n (context.config as VitePluginResolvedConfig).vite?.optimizeDeps ??\n {}\n },\n {\n optimizeDeps: {\n extensions: context.config.resolve.extensions\n }\n }\n )\n : {},\n {\n define: context.config.define,\n rootDir: context.fs.existsSync(joinPaths(context.config.root, \"src\"))\n ? joinPaths(context.config.root, \"src\")\n : context.config.root,\n platform: context.config.platform,\n mode:\n context.config.mode === \"development\" ? \"development\" : \"production\",\n cacheDir: joinPaths(context.cachePath, \"vite\"),\n build: {\n minify: context.config.mode !== \"development\",\n metafile: context.config.mode === \"development\",\n sourcemap: context.config.mode === \"development\",\n outDir: context.config.output.buildPath,\n tsconfig: context.tsconfig.tsconfigFilePath,\n tsconfigRaw: context.tsconfig.tsconfigJson\n },\n esbuild: resolveEsbuildOptions(context) as ESBuildOptions,\n optimizeDeps: {\n rolldownOptions: resolveRolldownOptions(context),\n rollupOptions: resolveRollupOptions(context),\n esbuildOptions: resolveEsbuildOptions(context)\n },\n logLevel: context.config.logLevel ?? undefined,\n envDir: context.config.root\n } as ViteOptions,\n DEFAULT_VITE_CONFIG\n ) as ViteOptions;\n}\n","/* -------------------------------------------------------------------\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 { createUnplugin } from \"@powerlines/core/lib/unplugin\";\nimport { createVitePlugin as createViteUnplugin } from \"unplugin\";\nimport { VitePluginContext } from \"../types/plugin\";\n\nexport function createVitePlugin(context: VitePluginContext) {\n return createViteUnplugin(createUnplugin(context))({});\n}\n","/* -------------------------------------------------------------------\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 { Context, Plugin } from \"@powerlines/core\";\nimport defu from \"defu\";\nimport { build, InlineConfig } from \"vite\";\nimport { DEFAULT_VITE_CONFIG, resolveOptions } from \"./helpers/resolve-options\";\nimport { createVitePlugin } from \"./helpers/unplugin\";\nimport { UNSAFE_VitePluginContext } from \"./types/_internal\";\nimport {\n VitePluginContext,\n VitePluginOptions,\n VitePluginResolvedConfig\n} from \"./types/plugin\";\n\nexport * from \"./helpers\";\nexport * from \"./types\";\n\ndeclare module \"@powerlines/core\" {\n interface Config {\n vite?: VitePluginOptions;\n }\n}\n\n/**\n * A Powerlines plugin to assist in developing other Powerlines plugins.\n */\nexport const plugin = <TContext extends VitePluginContext = VitePluginContext>(\n options: VitePluginOptions = {}\n): Plugin<TContext> => {\n return {\n name: \"vite\",\n config() {\n this.trace(\n \"Providing default configuration for the Powerlines `vite` build plugin.\"\n );\n\n return {\n output: {\n format: [\"cjs\", \"esm\"]\n },\n vite: {\n ...DEFAULT_VITE_CONFIG,\n ...options\n },\n singleBuild: true\n } as Partial<VitePluginResolvedConfig>;\n },\n async build() {\n this.trace(`Building the Powerlines plugin.`);\n\n const environments = (this as unknown as UNSAFE_VitePluginContext)\n ?.$$internal?.api?.context?.environments;\n if (!environments || Object.keys(environments).length === 0) {\n throw new Error(\n `No environments found in the Powerlines context. At least one environment should have been generated - please report this issue to https://github.com/storm-software/powerlines/issues.`\n );\n }\n\n this.trace(\n `Running Vite for ${Object.keys(environments).length} environments.`\n );\n\n const config = defu(\n {\n config: false,\n entry: this.entry,\n environments: Object.fromEntries(\n Object.entries(environments).map(([name, env]) => [\n name,\n resolveOptions(env as Context)\n ])\n )\n },\n resolveOptions(this),\n {\n plugins: [createVitePlugin(this)]\n }\n );\n\n await build(config as InlineConfig);\n }\n };\n};\n\nexport default plugin;\n","/* -------------------------------------------------------------------\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 { resolveOptions } from \"@powerlines/plugin-vite/helpers/resolve-options\";\nimport {\n ViteOptions,\n VitePluginUserConfig\n} from \"@powerlines/plugin-vite/types\";\nimport { isDevelopmentMode, isTestMode } from \"@stryke/env/environment-checks\";\nimport defu from \"defu\";\nimport { createVitePlugin } from \"unplugin\";\nimport { createUnpluginFactory } from \"./unplugin\";\n\nexport { default as plugin, default as vite } from \"@powerlines/plugin-vite\";\n\n/**\n * A Vite plugin that will invoke the Powerlines API hooks during the build process.\n *\n * @see https://vitejs.dev/guide/api-plugin.html#plugin-api\n *\n * @example\n * ```ts\n * // vite.config.ts\n * import powerlines from \"powerlines/vite\";\n *\n * export default defineConfig({\n * plugins: [powerlines({ name: \"example-app\", ... })],\n * });\n *\n * ```\n */\nexport const unplugin = createVitePlugin<Partial<VitePluginUserConfig>>(\n createUnpluginFactory(\"vite\", (api, plugin) => {\n return {\n ...plugin,\n vite: {\n sharedDuringBuild: true,\n\n async hotUpdate(options) {\n const environment = await api.context.getEnvironment();\n\n return api.callHook(\"vite:hotUpdate\", { environment }, options);\n },\n async config(config, env) {\n api.context.config.mode = isDevelopmentMode(env.mode)\n ? \"development\"\n : isTestMode(env.mode)\n ? \"test\"\n : \"production\";\n\n const environment = await api.context.getEnvironment();\n const result = await api.callHook(\n \"vite:config\",\n { environment },\n config,\n env\n );\n\n return defu(\n resolveOptions(api.context),\n // Need to use `any` here to avoid excessive type complexity\n result?.build ?? {},\n config\n ) as Omit<ViteOptions, \"plugins\">;\n },\n async configResolved(_config) {\n const environment = await api.context.getEnvironment();\n\n await api.callHook(\"configResolved\", { environment });\n },\n async configureServer(server) {\n const environment = await api.context.getEnvironment();\n\n return api.callHook(\"vite:configureServer\", { environment }, server);\n },\n async configurePreviewServer(server) {\n const environment = await api.context.getEnvironment();\n\n return api.callHook(\n \"vite:configurePreviewServer\",\n { environment },\n server\n );\n },\n async transformIndexHtml(html, ctx) {\n const environment = await api.context.getEnvironment();\n\n return api.callHook(\n \"vite:transformIndexHtml\",\n { environment },\n html,\n ctx\n );\n },\n async handleHotUpdate(ctx) {\n const environment = await api.context.getEnvironment();\n\n return api.callHook(\"vite:handleHotUpdate\", { environment }, ctx);\n }\n }\n };\n })\n);\n\nexport default unplugin;\n\nexport { unplugin as \"module.exports\" };\n"],"mappings":"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"}
@@ -1,107 +0,0 @@
1
- const require_chunk = require('./chunk-CbDLau6x.cjs');
2
- const require_api = require('./api-C0__VShS.cjs');
3
- let __stryke_path_join_paths = require("@stryke/path/join-paths");
4
- let defu = require("defu");
5
- defu = require_chunk.__toESM(defu);
6
- let unplugin = require("unplugin");
7
- let webpack = require("webpack");
8
- webpack = require_chunk.__toESM(webpack);
9
-
10
- //#region ../plugin-webpack/src/helpers/resolve-options.ts
11
- /**
12
- * Resolves the options for [webpack](https://webpack.js.org/).
13
- *
14
- * @param context - The build context.
15
- * @returns The resolved options.
16
- */
17
- function resolveOptions(context) {
18
- return (0, defu.default)({ resolve: { alias: context.alias } }, context.config.webpack ? context.config.webpack : {}, {
19
- output: { path: (0, __stryke_path_join_paths.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.output.buildPath) },
20
- name: context.config.name,
21
- plugins: context.config.webpack?.plugins ?? [],
22
- node: context.config.platform === "node" ? {
23
- __dirname: true,
24
- __filename: true,
25
- global: true
26
- } : false,
27
- mode: context.config.mode === "development" ? "development" : "production",
28
- cache: {
29
- type: "filesystem",
30
- cacheDirectory: (0, __stryke_path_join_paths.joinPaths)(context.cachePath, "webpack", "cache")
31
- },
32
- recordsInputPath: (0, __stryke_path_join_paths.joinPaths)(context.cachePath, "webpack", ".webpack-records.json"),
33
- recordsOutputPath: (0, __stryke_path_join_paths.joinPaths)(context.cachePath, "webpack", ".webpack-records.json"),
34
- context: (0, __stryke_path_join_paths.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.root),
35
- noExternal: context.builtins,
36
- devtool: context.config.mode !== "development" ? false : "source-map",
37
- optimization: { minimize: context.config.mode !== "development" }
38
- });
39
- }
40
-
41
- //#endregion
42
- //#region ../plugin-webpack/src/helpers/unplugin.ts
43
- function createWebpackPlugin$1(context) {
44
- return (0, unplugin.createWebpackPlugin)(require_api.createUnplugin(context))({});
45
- }
46
-
47
- //#endregion
48
- //#region ../plugin-webpack/src/index.ts
49
- /**
50
- * A Powerlines plugin to assist in developing other Powerlines plugins.
51
- */
52
- const plugin = (options = {}) => {
53
- return {
54
- name: "webpack",
55
- config() {
56
- this.trace("Providing default configuration for the Powerlines `webpack` build plugin.");
57
- return { webpack: { ...options } };
58
- },
59
- async build() {
60
- (0, webpack.default)((0, defu.default)({ entry: this.entry.reduce((ret, entry) => {
61
- ret[entry.output || entry.name || entry.file] = entry.file;
62
- return ret;
63
- }, {}) }, resolveOptions(this), { plugins: [createWebpackPlugin$1(this)] }));
64
- }
65
- };
66
- };
67
- var src_default = plugin;
68
-
69
- //#endregion
70
- //#region src/webpack.ts
71
- /**
72
- * An Webpack plugin that will invoke the Powerlines API hooks during the build process.
73
- *
74
- * @see https://webpack.js.org/contribute/writing-a-plugin/#basic-plugin-architecture
75
- *
76
- * @example
77
- * ```js
78
- * // webpack.config.js
79
- * import powerlines from "powerlines/webpack";
80
- *
81
- * export default {
82
- * plugins: [powerlines({ name: "example-app", ... })],
83
- * }
84
- * ```
85
- */
86
- const unplugin$1 = (0, unplugin.createWebpackPlugin)(require_api.createUnpluginFactory("webpack"));
87
- var webpack_default = unplugin$1;
88
-
89
- //#endregion
90
- Object.defineProperty(exports, 'src_default', {
91
- enumerable: true,
92
- get: function () {
93
- return src_default;
94
- }
95
- });
96
- Object.defineProperty(exports, 'unplugin', {
97
- enumerable: true,
98
- get: function () {
99
- return unplugin$1;
100
- }
101
- });
102
- Object.defineProperty(exports, 'webpack_default', {
103
- enumerable: true,
104
- get: function () {
105
- return webpack_default;
106
- }
107
- });
@@ -1,88 +0,0 @@
1
- import { a as createUnpluginFactory, o as createUnplugin } from "./api-BYw9Go8X.mjs";
2
- import { joinPaths } from "@stryke/path/join-paths";
3
- import defu from "defu";
4
- import { createWebpackPlugin } from "unplugin";
5
- import build from "webpack";
6
-
7
- //#region ../plugin-webpack/src/helpers/resolve-options.ts
8
- /**
9
- * Resolves the options for [webpack](https://webpack.js.org/).
10
- *
11
- * @param context - The build context.
12
- * @returns The resolved options.
13
- */
14
- function resolveOptions(context) {
15
- return defu({ resolve: { alias: context.alias } }, context.config.webpack ? context.config.webpack : {}, {
16
- output: { path: joinPaths(context.workspaceConfig.workspaceRoot, context.config.output.buildPath) },
17
- name: context.config.name,
18
- plugins: context.config.webpack?.plugins ?? [],
19
- node: context.config.platform === "node" ? {
20
- __dirname: true,
21
- __filename: true,
22
- global: true
23
- } : false,
24
- mode: context.config.mode === "development" ? "development" : "production",
25
- cache: {
26
- type: "filesystem",
27
- cacheDirectory: joinPaths(context.cachePath, "webpack", "cache")
28
- },
29
- recordsInputPath: joinPaths(context.cachePath, "webpack", ".webpack-records.json"),
30
- recordsOutputPath: joinPaths(context.cachePath, "webpack", ".webpack-records.json"),
31
- context: joinPaths(context.workspaceConfig.workspaceRoot, context.config.root),
32
- noExternal: context.builtins,
33
- devtool: context.config.mode !== "development" ? false : "source-map",
34
- optimization: { minimize: context.config.mode !== "development" }
35
- });
36
- }
37
-
38
- //#endregion
39
- //#region ../plugin-webpack/src/helpers/unplugin.ts
40
- function createWebpackPlugin$1(context) {
41
- return createWebpackPlugin(createUnplugin(context))({});
42
- }
43
-
44
- //#endregion
45
- //#region ../plugin-webpack/src/index.ts
46
- /**
47
- * A Powerlines plugin to assist in developing other Powerlines plugins.
48
- */
49
- const plugin = (options = {}) => {
50
- return {
51
- name: "webpack",
52
- config() {
53
- this.trace("Providing default configuration for the Powerlines `webpack` build plugin.");
54
- return { webpack: { ...options } };
55
- },
56
- async build() {
57
- build(defu({ entry: this.entry.reduce((ret, entry) => {
58
- ret[entry.output || entry.name || entry.file] = entry.file;
59
- return ret;
60
- }, {}) }, resolveOptions(this), { plugins: [createWebpackPlugin$1(this)] }));
61
- }
62
- };
63
- };
64
- var src_default = plugin;
65
-
66
- //#endregion
67
- //#region src/webpack.ts
68
- /**
69
- * An Webpack plugin that will invoke the Powerlines API hooks during the build process.
70
- *
71
- * @see https://webpack.js.org/contribute/writing-a-plugin/#basic-plugin-architecture
72
- *
73
- * @example
74
- * ```js
75
- * // webpack.config.js
76
- * import powerlines from "powerlines/webpack";
77
- *
78
- * export default {
79
- * plugins: [powerlines({ name: "example-app", ... })],
80
- * }
81
- * ```
82
- */
83
- const unplugin = createWebpackPlugin(createUnpluginFactory("webpack"));
84
- var webpack_default = unplugin;
85
-
86
- //#endregion
87
- export { webpack_default as n, src_default as r, unplugin as t };
88
- //# sourceMappingURL=webpack-_lZGia72.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"webpack-_lZGia72.mjs","names":["createWebpackPlugin","createWebpackUnplugin","createWebpackPlugin"],"sources":["../../plugin-webpack/src/helpers/resolve-options.ts","../../plugin-webpack/src/helpers/unplugin.ts","../../plugin-webpack/src/index.ts","../src/webpack.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 { Context } from \"@powerlines/core\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport defu from \"defu\";\nimport type { Configuration as ExternalWebpackOptions } from \"webpack\";\nimport { WebpackPluginResolvedConfig } from \"../types\";\n\n/**\n * Resolves the options for [webpack](https://webpack.js.org/).\n *\n * @param context - The build context.\n * @returns The resolved options.\n */\nexport function resolveOptions(context: Context): ExternalWebpackOptions {\n return defu(\n {\n resolve: {\n alias: context.alias\n }\n },\n (context.config as WebpackPluginResolvedConfig).webpack\n ? (context.config as WebpackPluginResolvedConfig).webpack\n : {},\n {\n output: {\n path: joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.output.buildPath\n )\n },\n name: context.config.name,\n plugins:\n (context.config as WebpackPluginResolvedConfig).webpack?.plugins ?? [],\n node:\n context.config.platform === \"node\"\n ? ({\n __dirname: true,\n __filename: true,\n global: true\n } as ExternalWebpackOptions[\"node\"])\n : false,\n mode:\n context.config.mode === \"development\"\n ? (\"development\" as const)\n : (\"production\" as const),\n cache: {\n type: \"filesystem\" as const,\n cacheDirectory: joinPaths(context.cachePath, \"webpack\", \"cache\")\n },\n recordsInputPath: joinPaths(\n context.cachePath,\n \"webpack\",\n \".webpack-records.json\"\n ),\n recordsOutputPath: joinPaths(\n context.cachePath,\n \"webpack\",\n \".webpack-records.json\"\n ),\n context: joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.root\n ),\n noExternal: context.builtins,\n devtool: (context.config.mode !== \"development\"\n ? false\n : \"source-map\") as string | false,\n optimization: {\n minimize: context.config.mode !== \"development\"\n }\n }\n );\n}\n","/* -------------------------------------------------------------------\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 { createUnplugin } from \"@powerlines/core/lib/unplugin\";\nimport { createWebpackPlugin as createWebpackUnplugin } from \"unplugin\";\nimport { WebpackPluginContext } from \"../types/plugin\";\n\nexport function createWebpackPlugin(context: WebpackPluginContext) {\n return createWebpackUnplugin(createUnplugin(context))({});\n}\n","/* -------------------------------------------------------------------\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 { Plugin } from \"@powerlines/core\";\nimport defu from \"defu\";\nimport build from \"webpack\";\nimport { resolveOptions } from \"./helpers/resolve-options\";\nimport { createWebpackPlugin } from \"./helpers/unplugin\";\nimport {\n WebpackPluginContext,\n WebpackPluginOptions,\n WebpackPluginResolvedConfig\n} from \"./types/plugin\";\n\nexport * from \"./helpers\";\nexport * from \"./types\";\n\ndeclare module \"@powerlines/core\" {\n interface Config {\n webpack?: WebpackPluginOptions;\n }\n}\n\n/**\n * A Powerlines plugin to assist in developing other Powerlines plugins.\n */\nexport const plugin = <\n TContext extends WebpackPluginContext = WebpackPluginContext\n>(\n options: WebpackPluginOptions = {}\n): Plugin<TContext> => {\n return {\n name: \"webpack\",\n config() {\n this.trace(\n \"Providing default configuration for the Powerlines `webpack` build plugin.\"\n );\n\n return {\n webpack: {\n ...options\n }\n } as Partial<WebpackPluginResolvedConfig>;\n },\n async build() {\n build(\n defu(\n {\n entry: this.entry.reduce(\n (ret, entry) => {\n ret[entry.output || entry.name || entry.file] = entry.file;\n\n return ret;\n },\n {} as Record<string, string>\n )\n },\n resolveOptions(this),\n {\n plugins: [createWebpackPlugin(this)]\n }\n )\n );\n }\n };\n};\n\nexport default plugin;\n","/* -------------------------------------------------------------------\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 { WebpackPluginUserConfig } from \"@powerlines/plugin-webpack/types/plugin\";\nimport { createWebpackPlugin } from \"unplugin\";\nimport { createUnpluginFactory } from \"./unplugin\";\n\nexport {\n default as plugin,\n default as webpack\n} from \"@powerlines/plugin-webpack\";\n\n/**\n * An Webpack plugin that will invoke the Powerlines API hooks during the build process.\n *\n * @see https://webpack.js.org/contribute/writing-a-plugin/#basic-plugin-architecture\n *\n * @example\n * ```js\n * // webpack.config.js\n * import powerlines from \"powerlines/webpack\";\n *\n * export default {\n * plugins: [powerlines({ name: \"example-app\", ... })],\n * }\n * ```\n */\nexport const unplugin = createWebpackPlugin<Partial<WebpackPluginUserConfig>>(\n createUnpluginFactory(\"webpack\")\n);\n\nexport default unplugin;\n\nexport { unplugin as \"module.exports\" };\n"],"mappings":";;;;;;;;;;;;;AA8BA,SAAgB,eAAe,SAA0C;AACvE,QAAO,KACL,EACE,SAAS,EACP,OAAO,QAAQ,OAChB,EACF,EACA,QAAQ,OAAuC,UAC3C,QAAQ,OAAuC,UAChD,EAAE,EACN;EACE,QAAQ,EACN,MAAM,UACJ,QAAQ,gBAAgB,eACxB,QAAQ,OAAO,OAAO,UACvB,EACF;EACD,MAAM,QAAQ,OAAO;EACrB,SACG,QAAQ,OAAuC,SAAS,WAAW,EAAE;EACxE,MACE,QAAQ,OAAO,aAAa,SACvB;GACC,WAAW;GACX,YAAY;GACZ,QAAQ;GACT,GACD;EACN,MACE,QAAQ,OAAO,SAAS,gBACnB,gBACA;EACP,OAAO;GACL,MAAM;GACN,gBAAgB,UAAU,QAAQ,WAAW,WAAW,QAAQ;GACjE;EACD,kBAAkB,UAChB,QAAQ,WACR,WACA,wBACD;EACD,mBAAmB,UACjB,QAAQ,WACR,WACA,wBACD;EACD,SAAS,UACP,QAAQ,gBAAgB,eACxB,QAAQ,OAAO,KAChB;EACD,YAAY,QAAQ;EACpB,SAAU,QAAQ,OAAO,SAAS,gBAC9B,QACA;EACJ,cAAc,EACZ,UAAU,QAAQ,OAAO,SAAS,eACnC;EACF,CACF;;;;;AClEH,SAAgBA,sBAAoB,SAA+B;AACjE,QAAOC,oBAAsB,eAAe,QAAQ,CAAC,CAAC,EAAE,CAAC;;;;;;;;ACkB3D,MAAa,UAGX,UAAgC,EAAE,KACb;AACrB,QAAO;EACL,MAAM;EACN,SAAS;AACP,QAAK,MACH,6EACD;AAED,UAAO,EACL,SAAS,EACP,GAAG,SACJ,EACF;;EAEH,MAAM,QAAQ;AACZ,SACE,KACE,EACE,OAAO,KAAK,MAAM,QACf,KAAK,UAAU;AACd,QAAI,MAAM,UAAU,MAAM,QAAQ,MAAM,QAAQ,MAAM;AAEtD,WAAO;MAET,EAAE,CACH,EACF,EACD,eAAe,KAAK,EACpB,EACE,SAAS,CAACC,sBAAoB,KAAK,CAAC,EACrC,CACF,CACF;;EAEJ;;AAGH,kBAAe;;;;;;;;;;;;;;;;;;;ACxCf,MAAa,WAAW,oBACtB,sBAAsB,UAAU,CACjC;AAED,sBAAe"}