@powerlines/plugin-vite 0.14.58 → 0.14.59

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 (130) hide show
  1. package/dist/_virtual/rolldown_runtime.cjs +1 -0
  2. package/dist/helpers/index.cjs +1 -1
  3. package/dist/helpers/index.d.cts +1 -3
  4. package/dist/helpers/index.d.mts +1 -3
  5. package/dist/helpers/index.mjs +1 -1
  6. package/dist/helpers/unplugin.cjs +1 -1
  7. package/dist/helpers/unplugin.d.cts +6 -2
  8. package/dist/helpers/unplugin.d.mts +6 -2
  9. package/dist/helpers/unplugin.mjs +1 -1
  10. package/dist/index.cjs +1 -14
  11. package/dist/index.d.cts +3 -4
  12. package/dist/index.d.mts +5 -5
  13. package/dist/index.mjs +1 -14
  14. package/dist/powerlines/schemas/fs.cjs +1 -0
  15. package/dist/powerlines/schemas/fs.mjs +1 -0
  16. package/dist/powerlines/src/api.cjs +11 -0
  17. package/dist/powerlines/src/api.mjs +1 -0
  18. package/dist/powerlines/src/internal/babel/module-resolver-plugin.cjs +1 -0
  19. package/dist/powerlines/src/internal/babel/module-resolver-plugin.mjs +1 -0
  20. package/dist/powerlines/src/internal/helpers/environment.cjs +1 -0
  21. package/dist/powerlines/src/internal/helpers/environment.mjs +1 -0
  22. package/dist/powerlines/src/internal/helpers/generate-types.cjs +8 -0
  23. package/dist/powerlines/src/internal/helpers/generate-types.mjs +8 -0
  24. package/dist/powerlines/src/internal/helpers/hooks.cjs +1 -0
  25. package/dist/powerlines/src/internal/helpers/hooks.mjs +1 -0
  26. package/dist/powerlines/src/internal/helpers/install-dependencies.cjs +3 -0
  27. package/dist/powerlines/src/internal/helpers/install-dependencies.mjs +3 -0
  28. package/dist/powerlines/src/internal/helpers/install.cjs +1 -0
  29. package/dist/powerlines/src/internal/helpers/install.mjs +1 -0
  30. package/dist/powerlines/src/internal/helpers/resolve-tsconfig.cjs +8 -0
  31. package/dist/powerlines/src/internal/helpers/resolve-tsconfig.mjs +8 -0
  32. package/dist/powerlines/src/internal/helpers/resolver.cjs +1 -0
  33. package/dist/powerlines/src/internal/helpers/resolver.mjs +1 -0
  34. package/dist/powerlines/src/lib/build/esbuild.cjs +14 -0
  35. package/dist/powerlines/src/lib/build/esbuild.mjs +14 -0
  36. package/dist/powerlines/src/lib/build/vite.cjs +1 -0
  37. package/dist/powerlines/src/lib/build/vite.mjs +1 -0
  38. package/dist/powerlines/src/lib/config-file.cjs +1 -0
  39. package/dist/powerlines/src/lib/config-file.mjs +1 -0
  40. package/dist/powerlines/src/lib/contexts/api-context.cjs +1 -0
  41. package/dist/powerlines/src/lib/contexts/api-context.mjs +1 -0
  42. package/dist/powerlines/src/lib/contexts/context.cjs +1 -0
  43. package/dist/powerlines/src/lib/contexts/context.mjs +1 -0
  44. package/dist/powerlines/src/lib/contexts/environment-context.cjs +1 -0
  45. package/dist/powerlines/src/lib/contexts/environment-context.mjs +1 -0
  46. package/dist/powerlines/src/lib/contexts/plugin-context.cjs +1 -0
  47. package/dist/powerlines/src/lib/contexts/plugin-context.mjs +1 -0
  48. package/dist/powerlines/src/lib/entry.cjs +1 -0
  49. package/dist/powerlines/src/lib/entry.mjs +1 -0
  50. package/dist/powerlines/src/lib/fs/helpers.cjs +1 -0
  51. package/dist/powerlines/src/lib/fs/helpers.mjs +1 -0
  52. package/dist/powerlines/src/lib/fs/storage/base.cjs +1 -0
  53. package/dist/powerlines/src/lib/fs/storage/base.mjs +1 -0
  54. package/dist/powerlines/src/lib/fs/storage/file-system.cjs +1 -0
  55. package/dist/powerlines/src/lib/fs/storage/file-system.mjs +1 -0
  56. package/dist/powerlines/src/lib/fs/storage/virtual.cjs +1 -0
  57. package/dist/powerlines/src/lib/fs/storage/virtual.mjs +1 -0
  58. package/dist/powerlines/src/lib/fs/vfs.cjs +1 -0
  59. package/dist/powerlines/src/lib/fs/vfs.mjs +1 -0
  60. package/dist/powerlines/src/lib/logger.cjs +1 -0
  61. package/dist/powerlines/src/lib/logger.mjs +1 -0
  62. package/dist/powerlines/src/lib/typescript/ts-morph.cjs +1 -0
  63. package/dist/powerlines/src/lib/typescript/ts-morph.mjs +1 -0
  64. package/dist/powerlines/src/lib/typescript/tsconfig.cjs +4 -0
  65. package/dist/powerlines/src/lib/typescript/tsconfig.mjs +4 -0
  66. package/dist/powerlines/src/lib/unplugin/factory.cjs +1 -0
  67. package/dist/powerlines/src/lib/unplugin/factory.mjs +1 -0
  68. package/dist/powerlines/src/lib/unplugin/helpers.cjs +1 -0
  69. package/dist/powerlines/src/lib/unplugin/helpers.mjs +1 -0
  70. package/dist/powerlines/src/lib/unplugin/index.cjs +1 -0
  71. package/dist/powerlines/src/lib/unplugin/index.mjs +1 -0
  72. package/dist/powerlines/src/lib/unplugin/plugin.cjs +6 -0
  73. package/dist/powerlines/src/lib/unplugin/plugin.mjs +6 -0
  74. package/dist/powerlines/src/lib/utilities/file-header.cjs +10 -0
  75. package/dist/powerlines/src/lib/utilities/file-header.mjs +10 -0
  76. package/dist/powerlines/src/lib/utilities/meta.cjs +1 -0
  77. package/dist/powerlines/src/lib/utilities/meta.mjs +1 -0
  78. package/dist/powerlines/src/lib/utilities/source-file.cjs +1 -0
  79. package/dist/powerlines/src/lib/utilities/source-file.mjs +1 -0
  80. package/dist/powerlines/src/plugin-utils/helpers.cjs +1 -0
  81. package/dist/powerlines/src/plugin-utils/helpers.mjs +1 -0
  82. package/dist/powerlines/src/plugin-utils/paths.cjs +1 -0
  83. package/dist/powerlines/src/plugin-utils/paths.mjs +1 -0
  84. package/dist/powerlines/src/types/babel.d.mts +4 -0
  85. package/dist/powerlines/src/types/build.d.cts +143 -0
  86. package/dist/powerlines/src/types/build.d.mts +143 -0
  87. package/dist/powerlines/src/types/commands.cjs +1 -0
  88. package/dist/powerlines/src/types/commands.d.cts +8 -0
  89. package/dist/powerlines/src/types/commands.d.mts +9 -0
  90. package/dist/powerlines/src/types/commands.mjs +1 -0
  91. package/dist/powerlines/src/types/config.d.cts +346 -0
  92. package/dist/powerlines/src/types/config.d.mts +348 -0
  93. package/dist/powerlines/src/types/context.d.cts +347 -0
  94. package/dist/powerlines/src/types/context.d.mts +349 -0
  95. package/dist/powerlines/src/types/fs.d.cts +458 -0
  96. package/dist/powerlines/src/types/fs.d.mts +458 -0
  97. package/dist/powerlines/src/types/hooks.d.mts +2 -0
  98. package/dist/powerlines/src/types/plugin.cjs +1 -0
  99. package/dist/powerlines/src/types/plugin.d.cts +232 -0
  100. package/dist/powerlines/src/types/plugin.d.mts +232 -0
  101. package/dist/powerlines/src/types/plugin.mjs +1 -0
  102. package/dist/powerlines/src/types/resolved.d.cts +82 -0
  103. package/dist/powerlines/src/types/resolved.d.mts +82 -0
  104. package/dist/powerlines/src/types/tsconfig.d.cts +69 -0
  105. package/dist/powerlines/src/types/tsconfig.d.mts +69 -0
  106. package/dist/types/index.cjs +0 -1
  107. package/dist/types/index.d.cts +1 -2
  108. package/dist/types/index.d.mts +1 -2
  109. package/dist/types/index.mjs +1 -1
  110. package/dist/types/plugin.cjs +0 -1
  111. package/dist/types/plugin.d.cts +19 -1
  112. package/dist/types/plugin.d.mts +19 -1
  113. package/dist/types/plugin.mjs +1 -1
  114. package/package.json +10 -10
  115. package/dist/helpers-CRPRhztf.mjs +0 -1
  116. package/dist/helpers-LF26RHol.cjs +0 -0
  117. package/dist/index-9iG2qHLe.d.mts +0 -1
  118. package/dist/index-D4ELpJXS.d.cts +0 -1
  119. package/dist/index-D6CnpA_r.d.cts +0 -1
  120. package/dist/index-DL0uimUT.d.mts +0 -1
  121. package/dist/plugin-BjiGfRHE.mjs +0 -1
  122. package/dist/plugin-Bu9f0Vo1.d.mts +0 -1658
  123. package/dist/plugin-CeaU7BaT.d.cts +0 -1655
  124. package/dist/plugin-pBKbb5K9.cjs +0 -0
  125. package/dist/types-n6NgD0QK.mjs +0 -1
  126. package/dist/types-o3zWarRp.cjs +0 -0
  127. package/dist/unplugin-CQUvJGvc.d.mts +0 -7
  128. package/dist/unplugin-DD1hF9r3.mjs +0 -6
  129. package/dist/unplugin-DVT_2a_R.cjs +0 -44
  130. package/dist/unplugin-DtFSdCAn.d.cts +0 -7
@@ -0,0 +1,346 @@
1
+ import { BuildConfig, BuildResolvedConfig, ViteBuildConfig, ViteResolvedBuildConfig } from "./build.cjs";
2
+ import { StoragePort, StoragePreset } from "./fs.cjs";
3
+ import { Plugin } from "./plugin.cjs";
4
+ import { TSConfig } from "./tsconfig.cjs";
5
+ import { PluginContext } from "./context.cjs";
6
+ import { PreviewOptions } from "vite";
7
+ import { MaybePromise } from "@stryke/types/base";
8
+ import { Format } from "@storm-software/build-tools/types";
9
+ import { LogLevelLabel } from "@storm-software/config-tools/types";
10
+ import { StormWorkspaceConfig } from "@storm-software/config/types";
11
+ import { TypeDefinitionParameter } from "@stryke/types/configuration";
12
+ import { AssetGlob } from "@stryke/types/file";
13
+
14
+ //#region ../powerlines/src/types/config.d.ts
15
+
16
+ type LogFn = (type: LogLevelLabel, ...args: string[]) => void;
17
+ /**
18
+ * The {@link StormWorkspaceConfig | configuration} object for an entire Powerlines workspace
19
+ */
20
+ type WorkspaceConfig = Partial<StormWorkspaceConfig> & Required<Pick<StormWorkspaceConfig, "workspaceRoot">>;
21
+ type PluginFactory<in out TContext extends PluginContext = PluginContext, TOptions = any> = (options: TOptions) => MaybePromise<Plugin<TContext>>;
22
+ /**
23
+ * A configuration tuple for a Powerlines plugin.
24
+ */
25
+ type PluginConfigTuple<TContext extends PluginContext = PluginContext, TOptions = any> = [string | PluginFactory<TContext, TOptions>, TOptions] | [Plugin<TContext>];
26
+ /**
27
+ * A configuration object for a Powerlines plugin.
28
+ */
29
+ type PluginConfigObject<TContext extends PluginContext = PluginContext, TOptions = any> = {
30
+ plugin: string | PluginFactory<TContext, TOptions>;
31
+ options: TOptions;
32
+ } | {
33
+ plugin: Plugin<TContext>;
34
+ options?: never;
35
+ };
36
+ /**
37
+ * A configuration tuple for a Powerlines plugin.
38
+ */
39
+ type PluginConfig<TContext extends PluginContext = PluginContext> = string | PluginFactory<TContext, void> | Plugin<TContext> | Promise<Plugin<TContext>> | PluginConfigTuple<TContext> | PluginConfigObject<TContext>;
40
+ type ProjectType = "application" | "library";
41
+ interface DeployConfig {
42
+ /**
43
+ * The deployment variant being used by the Powerlines engine.
44
+ *
45
+ * @example
46
+ * ```ts
47
+ * export default defineConfig({
48
+ * deploy: {
49
+ * variant: "cloudflare"
50
+ * }
51
+ * });
52
+ *
53
+ * ```
54
+ */
55
+ variant?: string;
56
+ }
57
+ interface OutputConfig {
58
+ /**
59
+ * The path to output the final compiled files to
60
+ *
61
+ * @remarks
62
+ * If a value is not provided, Powerlines will attempt to:
63
+ * 1. Use the `outDir` value in the `tsconfig.json` file.
64
+ * 2. Use the `dist` directory in the project root directory.
65
+ *
66
+ * @defaultValue "dist/\{projectRoot\}"
67
+ */
68
+ outputPath?: string;
69
+ /**
70
+ * The output directory path for the project build.
71
+ *
72
+ * @remarks
73
+ * This path is used to determine where the built files will be placed after the build process completes. This will be used in scenarios where the monorepo uses TSConfig paths to link packages together.
74
+ *
75
+ * @defaultValue "\{projectRoot\}/dist"
76
+ */
77
+ buildPath?: string;
78
+ /**
79
+ * The folder where the generated runtime artifacts will be located
80
+ *
81
+ * @remarks
82
+ * This folder will contain all runtime artifacts and builtins generated during the "prepare" phase.
83
+ *
84
+ * @defaultValue "\{projectRoot\}/.powerlines"
85
+ */
86
+ artifactsPath?: string;
87
+ /**
88
+ * The path of the generated runtime declaration file relative to the workspace root.
89
+ *
90
+ * @defaultValue "\{projectRoot\}/powerlines.d.ts"
91
+ */
92
+ dts?: string | false;
93
+ /**
94
+ * A prefix to use for identifying builtin modules
95
+ *
96
+ * @remarks
97
+ * This prefix will be used to identify all builtin modules generated during the "prepare" phase. An example builtin ID for a module called `"utils"` would be `"{builtinPrefix}:utils"`.
98
+ *
99
+ * @defaultValue "powerlines"
100
+ */
101
+ builtinPrefix?: string;
102
+ /**
103
+ * The module format of the output files
104
+ *
105
+ * @remarks
106
+ * This option can be a single format or an array of formats. If an array is provided, multiple builds will be generated for each format.
107
+ *
108
+ * @defaultValue "esm"
109
+ */
110
+ format?: Format | Format[];
111
+ /**
112
+ * A list of assets to copy to the output directory
113
+ *
114
+ * @remarks
115
+ * The assets can be specified as a string (path to the asset) or as an object with a `glob` property (to match multiple files). The paths are relative to the project root directory.
116
+ */
117
+ assets?: Array<string | AssetGlob>;
118
+ /**
119
+ * A string preset or a custom {@link StoragePort} to provide fine-grained control over generated/output file storage.
120
+ *
121
+ * @remarks
122
+ * If a string preset is provided, it must be one of the following values:
123
+ * - `"virtual"`: Uses the local file system for storage.
124
+ * - `"fs"`: Uses an in-memory virtual file system for storage.
125
+ *
126
+ * If a custom {@link StoragePort} is provided, it will be used for all file storage operations during the build process.
127
+ *
128
+ * @defaultValue "virtual"
129
+ */
130
+ storage?: StoragePort | StoragePreset;
131
+ }
132
+ interface BaseConfig {
133
+ /**
134
+ * The entry point(s) for the application
135
+ */
136
+ entry?: TypeDefinitionParameter | TypeDefinitionParameter[];
137
+ /**
138
+ * Configuration for the output of the build process
139
+ */
140
+ output?: OutputConfig;
141
+ /**
142
+ * Configuration for cleaning the build artifacts
143
+ *
144
+ * @remarks
145
+ * If set to `false`, the cleaning process will be disabled.
146
+ */
147
+ clean?: Record<string, any> | false;
148
+ /**
149
+ * Configuration for linting the source code
150
+ *
151
+ * @remarks
152
+ * If set to `false`, linting will be disabled.
153
+ */
154
+ lint?: Record<string, any> | false;
155
+ /**
156
+ * Configuration for testing the source code
157
+ *
158
+ * @remarks
159
+ * If set to `false`, testing will be disabled.
160
+ */
161
+ test?: Record<string, any> | false;
162
+ /**
163
+ * Configuration for the transformation of the source code
164
+ */
165
+ transform?: Record<string, any>;
166
+ /**
167
+ * Configuration provided to build processes
168
+ *
169
+ * @remarks
170
+ * This configuration can be used by plugins during the `build` command. It will generally contain options specific to the selected {@link BuildVariant | build variant}.
171
+ */
172
+ build?: BuildConfig;
173
+ /**
174
+ * Configuration for documentation generation
175
+ *
176
+ * @remarks
177
+ * This configuration will be used by the documentation generation plugins during the `docs` command.
178
+ */
179
+ docs?: Record<string, any>;
180
+ /**
181
+ * Configuration for deploying the source code
182
+ *
183
+ * @remarks
184
+ * If set to `false`, the deployment will be disabled.
185
+ */
186
+ deploy?: DeployConfig | false;
187
+ /**
188
+ * The path to the tsconfig file to be used by the compiler
189
+ *
190
+ * @remarks
191
+ * If a value is not provided, the plugin will attempt to find the `tsconfig.json` file in the project root directory. The parsed tsconfig compiler options will be merged with the {@link Options.tsconfigRaw} value (if provided).
192
+ *
193
+ * @defaultValue "\{projectRoot\}/tsconfig.json"
194
+ */
195
+ tsconfig?: string;
196
+ /**
197
+ * The raw {@link TSConfig} object to be used by the compiler. This object will be merged with the `tsconfig.json` file.
198
+ *
199
+ * @see https://www.typescriptlang.org/tsconfig
200
+ *
201
+ * @remarks
202
+ * If populated, this option takes higher priority than `tsconfig`
203
+ */
204
+ tsconfigRaw?: TSConfig;
205
+ }
206
+ interface EnvironmentConfig extends BaseConfig {
207
+ /**
208
+ * Configuration options for the preview server
209
+ */
210
+ preview?: PreviewOptions;
211
+ /**
212
+ * A flag indicating whether the build is for a Server-Side Rendering environment.
213
+ */
214
+ ssr?: boolean;
215
+ /**
216
+ * Define if this environment is used for Server-Side Rendering
217
+ *
218
+ * @defaultValue "server" (if it isn't the client environment)
219
+ */
220
+ consumer?: "client" | "server";
221
+ }
222
+ interface CommonUserConfig extends BaseConfig {
223
+ /**
224
+ * The name of the project
225
+ */
226
+ name?: string;
227
+ /**
228
+ * The project display title
229
+ *
230
+ * @remarks
231
+ * This option is used in documentation generation and other places where a human-readable title is needed.
232
+ */
233
+ title?: string;
234
+ /**
235
+ * A description of the project
236
+ *
237
+ * @remarks
238
+ * If this option is not provided, the build process will try to use the \`description\` value from the `\package.json\` file.
239
+ */
240
+ description?: string;
241
+ /**
242
+ * The log level to use for the Powerlines processes.
243
+ *
244
+ * @defaultValue "info"
245
+ */
246
+ logLevel?: LogLevelLabel | null;
247
+ /**
248
+ * A custom logger function to use for logging messages
249
+ */
250
+ customLogger?: LogFn;
251
+ /**
252
+ * Explicitly set a mode to run in. This mode will be used at various points throughout the Powerlines processes, such as when compiling the source code.
253
+ *
254
+ * @defaultValue "production"
255
+ */
256
+ mode?: "development" | "test" | "production";
257
+ /**
258
+ * The type of project being built
259
+ *
260
+ * @defaultValue "application"
261
+ */
262
+ type?: ProjectType;
263
+ /**
264
+ * The root directory of the project
265
+ */
266
+ root: string;
267
+ /**
268
+ * The root directory of the project's source code
269
+ *
270
+ * @defaultValue "\{root\}/src"
271
+ */
272
+ sourceRoot?: string;
273
+ /**
274
+ * A path to a custom configuration file to be used instead of the default `storm.json`, `powerlines.config.js`, or `powerlines.config.ts` files.
275
+ *
276
+ * @remarks
277
+ * This option is useful for running Powerlines commands with different configuration files, such as in CI/CD environments or when testing different configurations.
278
+ */
279
+ configFile?: string;
280
+ /**
281
+ * Should the Powerlines CLI processes skip installing missing packages?
282
+ *
283
+ * @remarks
284
+ * This option is useful for CI/CD environments where the installation of packages is handled by a different process.
285
+ *
286
+ * @defaultValue false
287
+ */
288
+ skipInstalls?: boolean;
289
+ /**
290
+ * Should the compiler processes skip any improvements that make use of cache?
291
+ *
292
+ * @defaultValue false
293
+ */
294
+ skipCache?: boolean;
295
+ /**
296
+ * A list of resolvable paths to plugins used during the build process
297
+ */
298
+ plugins?: PluginConfig<PluginContext<any>>[];
299
+ /**
300
+ * Environment-specific configurations
301
+ */
302
+ environments?: Record<string, EnvironmentConfig>;
303
+ /**
304
+ * A string identifier that allows a child framework or tool to identify itself when using Powerlines.
305
+ *
306
+ * @remarks
307
+ * If no values are provided for {@link OutputConfig.dts | output.dts}, {@link OutputConfig.builtinPrefix | output.builtinPrefix}, or {@link OutputConfig.artifactsPath | output.artifactsFolder}, this value will be used as the default.
308
+ *
309
+ * @defaultValue "powerlines"
310
+ */
311
+ framework?: string;
312
+ }
313
+ interface UserConfig$1<TBuildConfig extends BuildConfig = BuildConfig, TBuildResolvedConfig extends BuildResolvedConfig = BuildResolvedConfig, TBuildVariant extends string = any> extends Omit<CommonUserConfig, "build"> {
314
+ /**
315
+ * Configuration provided to build processes
316
+ *
317
+ * @remarks
318
+ * This configuration can be used by plugins during the `build` command. It will generally contain options specific to the selected {@link BuildVariant | build variant}.
319
+ */
320
+ build: Omit<TBuildConfig, "override"> & {
321
+ /**
322
+ * The build variant being used by the Powerlines engine.
323
+ */
324
+ variant?: TBuildVariant;
325
+ /**
326
+ * An optional set of override options to apply to the selected build variant.
327
+ *
328
+ * @remarks
329
+ * This option allows you to provide configuration options with the guarantee that they will **not** be overridden and will take precedence over other build configurations.
330
+ */
331
+ override?: Partial<TBuildResolvedConfig>;
332
+ };
333
+ }
334
+ type ViteUserConfig = UserConfig$1<ViteBuildConfig, ViteResolvedBuildConfig, "vite">;
335
+ type PowerlinesCommand = "new" | "prepare" | "build" | "lint" | "test" | "docs" | "deploy" | "clean";
336
+ /**
337
+ * The configuration provided while executing Powerlines commands.
338
+ */
339
+ type InlineConfig<TUserConfig extends UserConfig$1 = UserConfig$1> = Partial<TUserConfig> & {
340
+ /**
341
+ * A string identifier for the Powerlines command being executed
342
+ */
343
+ command: PowerlinesCommand;
344
+ };
345
+ //#endregion
346
+ export { EnvironmentConfig, InlineConfig, LogFn, OutputConfig, PluginConfig, UserConfig$1 as UserConfig, ViteUserConfig, WorkspaceConfig };
@@ -0,0 +1,348 @@
1
+ import { BuildConfig, BuildResolvedConfig, ViteBuildConfig, ViteResolvedBuildConfig } from "./build.mjs";
2
+ import "./babel.mjs";
3
+ import { StoragePort, StoragePreset } from "./fs.mjs";
4
+ import { Plugin } from "./plugin.mjs";
5
+ import { TSConfig } from "./tsconfig.mjs";
6
+ import { PluginContext } from "./context.mjs";
7
+ import { LogLevelLabel } from "@storm-software/config-tools/types";
8
+ import { transformAsync } from "@babel/core";
9
+ import "c12";
10
+ import { PreviewOptions } from "vite";
11
+ import { MaybePromise } from "@stryke/types/base";
12
+ import { Format } from "@storm-software/build-tools/types";
13
+ import { StormWorkspaceConfig } from "@storm-software/config/types";
14
+ import { TypeDefinitionParameter } from "@stryke/types/configuration";
15
+ import { AssetGlob } from "@stryke/types/file";
16
+
17
+ //#region ../powerlines/src/types/config.d.ts
18
+ type LogFn = (type: LogLevelLabel, ...args: string[]) => void;
19
+ /**
20
+ * The {@link StormWorkspaceConfig | configuration} object for an entire Powerlines workspace
21
+ */
22
+ type WorkspaceConfig = Partial<StormWorkspaceConfig> & Required<Pick<StormWorkspaceConfig, "workspaceRoot">>;
23
+ type PluginFactory<in out TContext extends PluginContext = PluginContext, TOptions = any> = (options: TOptions) => MaybePromise<Plugin<TContext>>;
24
+ /**
25
+ * A configuration tuple for a Powerlines plugin.
26
+ */
27
+ type PluginConfigTuple<TContext extends PluginContext = PluginContext, TOptions = any> = [string | PluginFactory<TContext, TOptions>, TOptions] | [Plugin<TContext>];
28
+ /**
29
+ * A configuration object for a Powerlines plugin.
30
+ */
31
+ type PluginConfigObject<TContext extends PluginContext = PluginContext, TOptions = any> = {
32
+ plugin: string | PluginFactory<TContext, TOptions>;
33
+ options: TOptions;
34
+ } | {
35
+ plugin: Plugin<TContext>;
36
+ options?: never;
37
+ };
38
+ /**
39
+ * A configuration tuple for a Powerlines plugin.
40
+ */
41
+ type PluginConfig<TContext extends PluginContext = PluginContext> = string | PluginFactory<TContext, void> | Plugin<TContext> | Promise<Plugin<TContext>> | PluginConfigTuple<TContext> | PluginConfigObject<TContext>;
42
+ type ProjectType = "application" | "library";
43
+ interface DeployConfig {
44
+ /**
45
+ * The deployment variant being used by the Powerlines engine.
46
+ *
47
+ * @example
48
+ * ```ts
49
+ * export default defineConfig({
50
+ * deploy: {
51
+ * variant: "cloudflare"
52
+ * }
53
+ * });
54
+ *
55
+ * ```
56
+ */
57
+ variant?: string;
58
+ }
59
+ interface OutputConfig {
60
+ /**
61
+ * The path to output the final compiled files to
62
+ *
63
+ * @remarks
64
+ * If a value is not provided, Powerlines will attempt to:
65
+ * 1. Use the `outDir` value in the `tsconfig.json` file.
66
+ * 2. Use the `dist` directory in the project root directory.
67
+ *
68
+ * @defaultValue "dist/\{projectRoot\}"
69
+ */
70
+ outputPath?: string;
71
+ /**
72
+ * The output directory path for the project build.
73
+ *
74
+ * @remarks
75
+ * This path is used to determine where the built files will be placed after the build process completes. This will be used in scenarios where the monorepo uses TSConfig paths to link packages together.
76
+ *
77
+ * @defaultValue "\{projectRoot\}/dist"
78
+ */
79
+ buildPath?: string;
80
+ /**
81
+ * The folder where the generated runtime artifacts will be located
82
+ *
83
+ * @remarks
84
+ * This folder will contain all runtime artifacts and builtins generated during the "prepare" phase.
85
+ *
86
+ * @defaultValue "\{projectRoot\}/.powerlines"
87
+ */
88
+ artifactsPath?: string;
89
+ /**
90
+ * The path of the generated runtime declaration file relative to the workspace root.
91
+ *
92
+ * @defaultValue "\{projectRoot\}/powerlines.d.ts"
93
+ */
94
+ dts?: string | false;
95
+ /**
96
+ * A prefix to use for identifying builtin modules
97
+ *
98
+ * @remarks
99
+ * This prefix will be used to identify all builtin modules generated during the "prepare" phase. An example builtin ID for a module called `"utils"` would be `"{builtinPrefix}:utils"`.
100
+ *
101
+ * @defaultValue "powerlines"
102
+ */
103
+ builtinPrefix?: string;
104
+ /**
105
+ * The module format of the output files
106
+ *
107
+ * @remarks
108
+ * This option can be a single format or an array of formats. If an array is provided, multiple builds will be generated for each format.
109
+ *
110
+ * @defaultValue "esm"
111
+ */
112
+ format?: Format | Format[];
113
+ /**
114
+ * A list of assets to copy to the output directory
115
+ *
116
+ * @remarks
117
+ * The assets can be specified as a string (path to the asset) or as an object with a `glob` property (to match multiple files). The paths are relative to the project root directory.
118
+ */
119
+ assets?: Array<string | AssetGlob>;
120
+ /**
121
+ * A string preset or a custom {@link StoragePort} to provide fine-grained control over generated/output file storage.
122
+ *
123
+ * @remarks
124
+ * If a string preset is provided, it must be one of the following values:
125
+ * - `"virtual"`: Uses the local file system for storage.
126
+ * - `"fs"`: Uses an in-memory virtual file system for storage.
127
+ *
128
+ * If a custom {@link StoragePort} is provided, it will be used for all file storage operations during the build process.
129
+ *
130
+ * @defaultValue "virtual"
131
+ */
132
+ storage?: StoragePort | StoragePreset;
133
+ }
134
+ interface BaseConfig {
135
+ /**
136
+ * The entry point(s) for the application
137
+ */
138
+ entry?: TypeDefinitionParameter | TypeDefinitionParameter[];
139
+ /**
140
+ * Configuration for the output of the build process
141
+ */
142
+ output?: OutputConfig;
143
+ /**
144
+ * Configuration for cleaning the build artifacts
145
+ *
146
+ * @remarks
147
+ * If set to `false`, the cleaning process will be disabled.
148
+ */
149
+ clean?: Record<string, any> | false;
150
+ /**
151
+ * Configuration for linting the source code
152
+ *
153
+ * @remarks
154
+ * If set to `false`, linting will be disabled.
155
+ */
156
+ lint?: Record<string, any> | false;
157
+ /**
158
+ * Configuration for testing the source code
159
+ *
160
+ * @remarks
161
+ * If set to `false`, testing will be disabled.
162
+ */
163
+ test?: Record<string, any> | false;
164
+ /**
165
+ * Configuration for the transformation of the source code
166
+ */
167
+ transform?: Record<string, any>;
168
+ /**
169
+ * Configuration provided to build processes
170
+ *
171
+ * @remarks
172
+ * This configuration can be used by plugins during the `build` command. It will generally contain options specific to the selected {@link BuildVariant | build variant}.
173
+ */
174
+ build?: BuildConfig;
175
+ /**
176
+ * Configuration for documentation generation
177
+ *
178
+ * @remarks
179
+ * This configuration will be used by the documentation generation plugins during the `docs` command.
180
+ */
181
+ docs?: Record<string, any>;
182
+ /**
183
+ * Configuration for deploying the source code
184
+ *
185
+ * @remarks
186
+ * If set to `false`, the deployment will be disabled.
187
+ */
188
+ deploy?: DeployConfig | false;
189
+ /**
190
+ * The path to the tsconfig file to be used by the compiler
191
+ *
192
+ * @remarks
193
+ * If a value is not provided, the plugin will attempt to find the `tsconfig.json` file in the project root directory. The parsed tsconfig compiler options will be merged with the {@link Options.tsconfigRaw} value (if provided).
194
+ *
195
+ * @defaultValue "\{projectRoot\}/tsconfig.json"
196
+ */
197
+ tsconfig?: string;
198
+ /**
199
+ * The raw {@link TSConfig} object to be used by the compiler. This object will be merged with the `tsconfig.json` file.
200
+ *
201
+ * @see https://www.typescriptlang.org/tsconfig
202
+ *
203
+ * @remarks
204
+ * If populated, this option takes higher priority than `tsconfig`
205
+ */
206
+ tsconfigRaw?: TSConfig;
207
+ }
208
+ interface EnvironmentConfig extends BaseConfig {
209
+ /**
210
+ * Configuration options for the preview server
211
+ */
212
+ preview?: PreviewOptions;
213
+ /**
214
+ * A flag indicating whether the build is for a Server-Side Rendering environment.
215
+ */
216
+ ssr?: boolean;
217
+ /**
218
+ * Define if this environment is used for Server-Side Rendering
219
+ *
220
+ * @defaultValue "server" (if it isn't the client environment)
221
+ */
222
+ consumer?: "client" | "server";
223
+ }
224
+ interface CommonUserConfig extends BaseConfig {
225
+ /**
226
+ * The name of the project
227
+ */
228
+ name?: string;
229
+ /**
230
+ * The project display title
231
+ *
232
+ * @remarks
233
+ * This option is used in documentation generation and other places where a human-readable title is needed.
234
+ */
235
+ title?: string;
236
+ /**
237
+ * A description of the project
238
+ *
239
+ * @remarks
240
+ * If this option is not provided, the build process will try to use the \`description\` value from the `\package.json\` file.
241
+ */
242
+ description?: string;
243
+ /**
244
+ * The log level to use for the Powerlines processes.
245
+ *
246
+ * @defaultValue "info"
247
+ */
248
+ logLevel?: LogLevelLabel | null;
249
+ /**
250
+ * A custom logger function to use for logging messages
251
+ */
252
+ customLogger?: LogFn;
253
+ /**
254
+ * Explicitly set a mode to run in. This mode will be used at various points throughout the Powerlines processes, such as when compiling the source code.
255
+ *
256
+ * @defaultValue "production"
257
+ */
258
+ mode?: "development" | "test" | "production";
259
+ /**
260
+ * The type of project being built
261
+ *
262
+ * @defaultValue "application"
263
+ */
264
+ type?: ProjectType;
265
+ /**
266
+ * The root directory of the project
267
+ */
268
+ root: string;
269
+ /**
270
+ * The root directory of the project's source code
271
+ *
272
+ * @defaultValue "\{root\}/src"
273
+ */
274
+ sourceRoot?: string;
275
+ /**
276
+ * A path to a custom configuration file to be used instead of the default `storm.json`, `powerlines.config.js`, or `powerlines.config.ts` files.
277
+ *
278
+ * @remarks
279
+ * This option is useful for running Powerlines commands with different configuration files, such as in CI/CD environments or when testing different configurations.
280
+ */
281
+ configFile?: string;
282
+ /**
283
+ * Should the Powerlines CLI processes skip installing missing packages?
284
+ *
285
+ * @remarks
286
+ * This option is useful for CI/CD environments where the installation of packages is handled by a different process.
287
+ *
288
+ * @defaultValue false
289
+ */
290
+ skipInstalls?: boolean;
291
+ /**
292
+ * Should the compiler processes skip any improvements that make use of cache?
293
+ *
294
+ * @defaultValue false
295
+ */
296
+ skipCache?: boolean;
297
+ /**
298
+ * A list of resolvable paths to plugins used during the build process
299
+ */
300
+ plugins?: PluginConfig<PluginContext<any>>[];
301
+ /**
302
+ * Environment-specific configurations
303
+ */
304
+ environments?: Record<string, EnvironmentConfig>;
305
+ /**
306
+ * A string identifier that allows a child framework or tool to identify itself when using Powerlines.
307
+ *
308
+ * @remarks
309
+ * If no values are provided for {@link OutputConfig.dts | output.dts}, {@link OutputConfig.builtinPrefix | output.builtinPrefix}, or {@link OutputConfig.artifactsPath | output.artifactsFolder}, this value will be used as the default.
310
+ *
311
+ * @defaultValue "powerlines"
312
+ */
313
+ framework?: string;
314
+ }
315
+ interface UserConfig$1<TBuildConfig extends BuildConfig = BuildConfig, TBuildResolvedConfig extends BuildResolvedConfig = BuildResolvedConfig, TBuildVariant extends string = any> extends Omit<CommonUserConfig, "build"> {
316
+ /**
317
+ * Configuration provided to build processes
318
+ *
319
+ * @remarks
320
+ * This configuration can be used by plugins during the `build` command. It will generally contain options specific to the selected {@link BuildVariant | build variant}.
321
+ */
322
+ build: Omit<TBuildConfig, "override"> & {
323
+ /**
324
+ * The build variant being used by the Powerlines engine.
325
+ */
326
+ variant?: TBuildVariant;
327
+ /**
328
+ * An optional set of override options to apply to the selected build variant.
329
+ *
330
+ * @remarks
331
+ * This option allows you to provide configuration options with the guarantee that they will **not** be overridden and will take precedence over other build configurations.
332
+ */
333
+ override?: Partial<TBuildResolvedConfig>;
334
+ };
335
+ }
336
+ type ViteUserConfig = UserConfig$1<ViteBuildConfig, ViteResolvedBuildConfig, "vite">;
337
+ type PowerlinesCommand = "new" | "prepare" | "build" | "lint" | "test" | "docs" | "deploy" | "clean";
338
+ /**
339
+ * The configuration provided while executing Powerlines commands.
340
+ */
341
+ type InlineConfig<TUserConfig extends UserConfig$1 = UserConfig$1> = Partial<TUserConfig> & {
342
+ /**
343
+ * A string identifier for the Powerlines command being executed
344
+ */
345
+ command: PowerlinesCommand;
346
+ };
347
+ //#endregion
348
+ export { EnvironmentConfig, InlineConfig, LogFn, OutputConfig, PluginConfig, UserConfig$1 as UserConfig, ViteUserConfig, WorkspaceConfig };