@powerlines/plugin-rollup 0.7.18 → 0.7.20
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.
- package/dist/helpers/index.d.cts +2 -4
- package/dist/helpers/index.d.ts +2 -4
- package/dist/helpers/unplugin.d.cts +2 -4
- package/dist/helpers/unplugin.d.ts +2 -4
- package/dist/{index-BO-ibNia.d.cts → index-mEoiAFKV.d.cts} +199 -113
- package/dist/{index-BO-ibNia.d.ts → index-mEoiAFKV.d.ts} +199 -113
- package/dist/index.d.cts +3 -5
- package/dist/index.d.ts +3 -5
- package/dist/types/index.d.cts +2 -4
- package/dist/types/index.d.ts +2 -4
- package/dist/types/plugin.d.cts +2 -4
- package/dist/types/plugin.d.ts +2 -4
- package/package.json +5 -5
package/dist/helpers/index.d.cts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
export { createRollupPlugin } from './unplugin.cjs';
|
|
2
2
|
import 'esbuild';
|
|
3
|
-
import '../index-
|
|
3
|
+
import '../index-mEoiAFKV.cjs';
|
|
4
4
|
import 'rollup';
|
|
5
5
|
import '@stryke/env/get-env-paths';
|
|
6
|
+
import '@stryke/types/base';
|
|
6
7
|
import '@stryke/types/package-json';
|
|
7
8
|
import 'jiti';
|
|
8
9
|
import 'oxc-parser';
|
|
@@ -11,7 +12,6 @@ import 'unplugin';
|
|
|
11
12
|
import '@storm-software/build-tools/types';
|
|
12
13
|
import '@storm-software/config-tools/types';
|
|
13
14
|
import '@storm-software/config/types';
|
|
14
|
-
import '@stryke/types/base';
|
|
15
15
|
import '@stryke/types/configuration';
|
|
16
16
|
import '@stryke/types/file';
|
|
17
17
|
import 'vite';
|
|
@@ -19,6 +19,4 @@ import '@stryke/types/array';
|
|
|
19
19
|
import '@stryke/types/tsconfig';
|
|
20
20
|
import 'typescript';
|
|
21
21
|
import '@stryke/json/types';
|
|
22
|
-
import 'memfs';
|
|
23
22
|
import 'node:fs';
|
|
24
|
-
import 'unionfs';
|
package/dist/helpers/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
export { createRollupPlugin } from './unplugin.js';
|
|
2
2
|
import 'esbuild';
|
|
3
|
-
import '../index-
|
|
3
|
+
import '../index-mEoiAFKV.js';
|
|
4
4
|
import 'rollup';
|
|
5
5
|
import '@stryke/env/get-env-paths';
|
|
6
|
+
import '@stryke/types/base';
|
|
6
7
|
import '@stryke/types/package-json';
|
|
7
8
|
import 'jiti';
|
|
8
9
|
import 'oxc-parser';
|
|
@@ -11,7 +12,6 @@ import 'unplugin';
|
|
|
11
12
|
import '@storm-software/build-tools/types';
|
|
12
13
|
import '@storm-software/config-tools/types';
|
|
13
14
|
import '@storm-software/config/types';
|
|
14
|
-
import '@stryke/types/base';
|
|
15
15
|
import '@stryke/types/configuration';
|
|
16
16
|
import '@stryke/types/file';
|
|
17
17
|
import 'vite';
|
|
@@ -19,6 +19,4 @@ import '@stryke/types/array';
|
|
|
19
19
|
import '@stryke/types/tsconfig';
|
|
20
20
|
import 'typescript';
|
|
21
21
|
import '@stryke/json/types';
|
|
22
|
-
import 'memfs';
|
|
23
22
|
import 'node:fs';
|
|
24
|
-
import 'unionfs';
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as esbuild from 'esbuild';
|
|
2
|
-
import { R as RollupPluginContext } from '../index-
|
|
2
|
+
import { R as RollupPluginContext } from '../index-mEoiAFKV.cjs';
|
|
3
3
|
import 'rollup';
|
|
4
4
|
import '@stryke/env/get-env-paths';
|
|
5
|
+
import '@stryke/types/base';
|
|
5
6
|
import '@stryke/types/package-json';
|
|
6
7
|
import 'jiti';
|
|
7
8
|
import 'oxc-parser';
|
|
@@ -10,7 +11,6 @@ import 'unplugin';
|
|
|
10
11
|
import '@storm-software/build-tools/types';
|
|
11
12
|
import '@storm-software/config-tools/types';
|
|
12
13
|
import '@storm-software/config/types';
|
|
13
|
-
import '@stryke/types/base';
|
|
14
14
|
import '@stryke/types/configuration';
|
|
15
15
|
import '@stryke/types/file';
|
|
16
16
|
import 'vite';
|
|
@@ -18,9 +18,7 @@ import '@stryke/types/array';
|
|
|
18
18
|
import '@stryke/types/tsconfig';
|
|
19
19
|
import 'typescript';
|
|
20
20
|
import '@stryke/json/types';
|
|
21
|
-
import 'memfs';
|
|
22
21
|
import 'node:fs';
|
|
23
|
-
import 'unionfs';
|
|
24
22
|
|
|
25
23
|
declare function createRollupPlugin(context: RollupPluginContext): esbuild.Plugin;
|
|
26
24
|
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as esbuild from 'esbuild';
|
|
2
|
-
import { R as RollupPluginContext } from '../index-
|
|
2
|
+
import { R as RollupPluginContext } from '../index-mEoiAFKV.js';
|
|
3
3
|
import 'rollup';
|
|
4
4
|
import '@stryke/env/get-env-paths';
|
|
5
|
+
import '@stryke/types/base';
|
|
5
6
|
import '@stryke/types/package-json';
|
|
6
7
|
import 'jiti';
|
|
7
8
|
import 'oxc-parser';
|
|
@@ -10,7 +11,6 @@ import 'unplugin';
|
|
|
10
11
|
import '@storm-software/build-tools/types';
|
|
11
12
|
import '@storm-software/config-tools/types';
|
|
12
13
|
import '@storm-software/config/types';
|
|
13
|
-
import '@stryke/types/base';
|
|
14
14
|
import '@stryke/types/configuration';
|
|
15
15
|
import '@stryke/types/file';
|
|
16
16
|
import 'vite';
|
|
@@ -18,9 +18,7 @@ import '@stryke/types/array';
|
|
|
18
18
|
import '@stryke/types/tsconfig';
|
|
19
19
|
import 'typescript';
|
|
20
20
|
import '@stryke/json/types';
|
|
21
|
-
import 'memfs';
|
|
22
21
|
import 'node:fs';
|
|
23
|
-
import 'unionfs';
|
|
24
22
|
|
|
25
23
|
declare function createRollupPlugin(context: RollupPluginContext): esbuild.Plugin;
|
|
26
24
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { RollupOptions, OutputOptions } from 'rollup';
|
|
2
2
|
import { EnvPaths } from '@stryke/env/get-env-paths';
|
|
3
|
+
import { MaybePromise, NonUndefined, FunctionLike } from '@stryke/types/base';
|
|
3
4
|
import { PackageJson } from '@stryke/types/package-json';
|
|
4
5
|
import { Jiti } from 'jiti';
|
|
5
6
|
import { ParserOptions, ParseResult } from 'oxc-parser';
|
|
@@ -8,7 +9,6 @@ import { UnpluginMessage, UnpluginContext, UnpluginBuildContext, TransformResult
|
|
|
8
9
|
import { Format } from '@storm-software/build-tools/types';
|
|
9
10
|
import { LogLevelLabel } from '@storm-software/config-tools/types';
|
|
10
11
|
import { StormWorkspaceConfig } from '@storm-software/config/types';
|
|
11
|
-
import { MaybePromise, NonUndefined, FunctionLike } from '@stryke/types/base';
|
|
12
12
|
import { TypeDefinitionParameter, TypeDefinition } from '@stryke/types/configuration';
|
|
13
13
|
import { AssetGlob } from '@stryke/types/file';
|
|
14
14
|
import { PreviewOptions, ResolvedPreviewOptions } from 'vite';
|
|
@@ -16,9 +16,7 @@ import { ArrayValues } from '@stryke/types/array';
|
|
|
16
16
|
import { TsConfigJson, CompilerOptions } from '@stryke/types/tsconfig';
|
|
17
17
|
import ts from 'typescript';
|
|
18
18
|
import { PrimitiveJsonValue } from '@stryke/json/types';
|
|
19
|
-
import { Volume } from 'memfs';
|
|
20
19
|
import { PathLike, StatSyncOptions, Stats, RmDirOptions, RmOptions, Mode, MakeDirectoryOptions as MakeDirectoryOptions$1, PathOrFileDescriptor, WriteFileOptions as WriteFileOptions$1 } from 'node:fs';
|
|
21
|
-
import { IUnionFs } from 'unionfs';
|
|
22
20
|
|
|
23
21
|
type UnpluginBuildVariant = "rollup" | "webpack" | "rspack" | "vite" | "esbuild" | "farm" | "unloader" | "rolldown";
|
|
24
22
|
interface BuildConfig {
|
|
@@ -28,6 +26,87 @@ interface BuildConfig {
|
|
|
28
26
|
* @defaultValue "neutral"
|
|
29
27
|
*/
|
|
30
28
|
platform?: "node" | "browser" | "neutral";
|
|
29
|
+
/**
|
|
30
|
+
* Array of strings indicating the polyfills to include for the build.
|
|
31
|
+
*
|
|
32
|
+
* @remarks
|
|
33
|
+
* This option allows you to specify which polyfills should be included in the build process to ensure compatibility with the target environment. The paths for the polyfills can use placeholder tokens (the `replacePathTokens` helper function will be used to resolve the actual values).
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```ts
|
|
37
|
+
* {
|
|
38
|
+
* polyfill: ['{projectRoot}/custom-polyfill.ts']
|
|
39
|
+
* }
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
polyfill?: string[];
|
|
43
|
+
/**
|
|
44
|
+
* Array of strings indicating the order in which fields in a package.json file should be resolved to determine the entry point for a module.
|
|
45
|
+
*
|
|
46
|
+
* @defaultValue `['browser', 'module', 'jsnext:main', 'jsnext']`
|
|
47
|
+
*/
|
|
48
|
+
mainFields?: string[];
|
|
49
|
+
/**
|
|
50
|
+
* Array of strings indicating what conditions should be used for module resolution.
|
|
51
|
+
*/
|
|
52
|
+
conditions?: string[];
|
|
53
|
+
/**
|
|
54
|
+
* Array of strings indicating what file extensions should be used for module resolution.
|
|
55
|
+
*
|
|
56
|
+
* @defaultValue `['.mjs', '.js', '.mts', '.ts', '.jsx', '.tsx', '.json']`
|
|
57
|
+
*/
|
|
58
|
+
extensions?: string[];
|
|
59
|
+
/**
|
|
60
|
+
* Array of strings indicating what modules should be deduplicated to a single version in the build.
|
|
61
|
+
*
|
|
62
|
+
* @remarks
|
|
63
|
+
* This option is useful for ensuring that only one version of a module is included in the bundle, which can help reduce bundle size and avoid conflicts.
|
|
64
|
+
*/
|
|
65
|
+
dedupe?: string[];
|
|
66
|
+
/**
|
|
67
|
+
* Array of strings or regular expressions that indicate what modules are builtin for the environment.
|
|
68
|
+
*/
|
|
69
|
+
builtins?: (string | RegExp)[];
|
|
70
|
+
/**
|
|
71
|
+
* Define global variable replacements.
|
|
72
|
+
*
|
|
73
|
+
* @remarks
|
|
74
|
+
* This option allows you to specify global constants that will be replaced in the code during the build process. It is similar to the `define` option in esbuild and Vite, enabling you to replace specific identifiers with constant expressions at build time.
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* ```ts
|
|
78
|
+
* {
|
|
79
|
+
* define: {
|
|
80
|
+
* __VERSION__: '"1.0.0"',
|
|
81
|
+
* __DEV__: 'process.env.NODE_ENV !== "production"'
|
|
82
|
+
* }
|
|
83
|
+
* }
|
|
84
|
+
* ```
|
|
85
|
+
*
|
|
86
|
+
* @see https://esbuild.github.io/api/#define
|
|
87
|
+
* @see https://vitejs.dev/config/build-options.html#define
|
|
88
|
+
* @see https://github.com/rollup/plugins/tree/master/packages/replace
|
|
89
|
+
*/
|
|
90
|
+
define?: Record<string, any>;
|
|
91
|
+
/**
|
|
92
|
+
* Global variables that will have import statements injected where necessary
|
|
93
|
+
*
|
|
94
|
+
* @remarks
|
|
95
|
+
* This option allows you to specify global variables that should be automatically imported from specified modules whenever they are used in the code. This is particularly useful for polyfilling Node.js globals in a browser environment.
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* ```ts
|
|
99
|
+
* {
|
|
100
|
+
* inject: {
|
|
101
|
+
* process: 'process/browser',
|
|
102
|
+
* Buffer: ['buffer', 'Buffer'],
|
|
103
|
+
* }
|
|
104
|
+
* }
|
|
105
|
+
* ```
|
|
106
|
+
*
|
|
107
|
+
* @see https://github.com/rollup/plugins/tree/master/packages/inject
|
|
108
|
+
*/
|
|
109
|
+
inject?: Record<string, string | string[]>;
|
|
31
110
|
/**
|
|
32
111
|
* The alias mappings to use for module resolution during the build process.
|
|
33
112
|
*
|
|
@@ -43,8 +122,13 @@ interface BuildConfig {
|
|
|
43
122
|
* }
|
|
44
123
|
* }
|
|
45
124
|
* ```
|
|
125
|
+
*
|
|
126
|
+
* @see https://github.com/rollup/plugins/tree/master/packages/alias
|
|
46
127
|
*/
|
|
47
|
-
alias?: Record<string, string
|
|
128
|
+
alias?: Record<string, string> | Array<{
|
|
129
|
+
find: string | RegExp;
|
|
130
|
+
replacement: string;
|
|
131
|
+
}>;
|
|
48
132
|
/**
|
|
49
133
|
* A list of modules that should not be bundled, even if they are external dependencies.
|
|
50
134
|
*
|
|
@@ -61,13 +145,14 @@ interface BuildConfig {
|
|
|
61
145
|
*/
|
|
62
146
|
skipNodeModulesBundle?: boolean;
|
|
63
147
|
/**
|
|
64
|
-
*
|
|
148
|
+
* An optional set of override options to apply to the selected build variant.
|
|
65
149
|
*
|
|
66
|
-
* @
|
|
150
|
+
* @remarks
|
|
151
|
+
* 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.
|
|
67
152
|
*/
|
|
68
|
-
|
|
153
|
+
override?: Record<string, any>;
|
|
69
154
|
}
|
|
70
|
-
type BuildResolvedConfig = BuildConfig
|
|
155
|
+
type BuildResolvedConfig = Omit<BuildConfig, "override">;
|
|
71
156
|
type RollupBuildOutputConfig = Omit<OutputOptions, "dir" | "format">;
|
|
72
157
|
type RollupBuildConfig = Omit<RollupOptions, "entry" | "external" | "input" | "output" | "logLevel"> & {
|
|
73
158
|
output: RollupBuildOutputConfig | RollupBuildOutputConfig[];
|
|
@@ -138,11 +223,8 @@ type ParsedTypeScriptConfig = ts.ParsedCommandLine & {
|
|
|
138
223
|
tsconfigFilePath: string;
|
|
139
224
|
};
|
|
140
225
|
|
|
141
|
-
declare const
|
|
142
|
-
declare const __VFS_REVERT__
|
|
143
|
-
declare const __VFS_CACHE__ = "__VFS_CACHE__";
|
|
144
|
-
declare const __VFS_VIRTUAL__ = "__VFS_VIRTUAL__";
|
|
145
|
-
declare const __VFS_UNIFIED__ = "__VFS_UNIFIED__";
|
|
226
|
+
declare const __VFS_PATCH__: unique symbol;
|
|
227
|
+
declare const __VFS_REVERT__: unique symbol;
|
|
146
228
|
type OutputModeType = "fs" | "virtual";
|
|
147
229
|
interface VirtualFile {
|
|
148
230
|
/**
|
|
@@ -182,7 +264,24 @@ interface VirtualFile {
|
|
|
182
264
|
*/
|
|
183
265
|
code: string | NodeJS.ArrayBufferView;
|
|
184
266
|
}
|
|
185
|
-
|
|
267
|
+
interface VirtualFileMetadata {
|
|
268
|
+
/**
|
|
269
|
+
* The identifier for the file data.
|
|
270
|
+
*/
|
|
271
|
+
id: string;
|
|
272
|
+
/**
|
|
273
|
+
* The variant of the file.
|
|
274
|
+
*/
|
|
275
|
+
variant: string;
|
|
276
|
+
/**
|
|
277
|
+
* The output mode of the file.
|
|
278
|
+
*/
|
|
279
|
+
mode: string;
|
|
280
|
+
/**
|
|
281
|
+
* Additional metadata associated with the file.
|
|
282
|
+
*/
|
|
283
|
+
properties: Record<string, string>;
|
|
284
|
+
}
|
|
186
285
|
interface ResolveFSOptions {
|
|
187
286
|
mode?: OutputModeType;
|
|
188
287
|
}
|
|
@@ -211,12 +310,18 @@ interface ResolvePathOptions extends ResolveFSOptions {
|
|
|
211
310
|
type?: "file" | "directory";
|
|
212
311
|
}
|
|
213
312
|
interface VirtualFileSystemInterface {
|
|
214
|
-
|
|
313
|
+
/**
|
|
314
|
+
* Patches the File System to include the virtual file system (VFS) contents.
|
|
315
|
+
*/
|
|
316
|
+
[__VFS_PATCH__]: () => void;
|
|
317
|
+
/**
|
|
318
|
+
* Reverts the virtual file system (VFS) to its previous state.
|
|
319
|
+
*/
|
|
215
320
|
[__VFS_REVERT__]: () => void;
|
|
216
321
|
/**
|
|
217
322
|
* The underlying file metadata.
|
|
218
323
|
*/
|
|
219
|
-
|
|
324
|
+
metadata: Record<string, VirtualFileMetadata | undefined>;
|
|
220
325
|
/**
|
|
221
326
|
* A map of module ids to their file paths.
|
|
222
327
|
*/
|
|
@@ -236,7 +341,7 @@ interface VirtualFileSystemInterface {
|
|
|
236
341
|
* @param options - Optional parameters for resolving the path.
|
|
237
342
|
* @returns Whether the path or id corresponds to a file written to the file system **(actually exists on disk)**.
|
|
238
343
|
*/
|
|
239
|
-
|
|
344
|
+
isPhysical: (pathOrId: string, options?: ResolvePathOptions) => boolean;
|
|
240
345
|
/**
|
|
241
346
|
* Checks if a file exists in the virtual file system (VFS).
|
|
242
347
|
*
|
|
@@ -251,15 +356,6 @@ interface VirtualFileSystemInterface {
|
|
|
251
356
|
* @returns `true` if the directory exists, otherwise `false`.
|
|
252
357
|
*/
|
|
253
358
|
isDirectory: (path: string) => boolean;
|
|
254
|
-
/**
|
|
255
|
-
* Check if a path exists within one of the directories specified in the tsconfig.json's `path` field.
|
|
256
|
-
*
|
|
257
|
-
* @see https://www.typescriptlang.org/tsconfig#paths
|
|
258
|
-
*
|
|
259
|
-
* @param pathOrId - The path or id to check.
|
|
260
|
-
* @returns Whether the path or id corresponds to a virtual file.
|
|
261
|
-
*/
|
|
262
|
-
isTsconfigPath: (pathOrId: string) => boolean;
|
|
263
359
|
/**
|
|
264
360
|
* Checks if a file exists in the virtual file system (VFS).
|
|
265
361
|
*
|
|
@@ -273,7 +369,7 @@ interface VirtualFileSystemInterface {
|
|
|
273
369
|
* @param pathOrId - The path or id of the file.
|
|
274
370
|
* @returns The metadata of the file if it exists, otherwise undefined.
|
|
275
371
|
*/
|
|
276
|
-
getMetadata: (pathOrId: PathLike) =>
|
|
372
|
+
getMetadata: (pathOrId: PathLike) => VirtualFileMetadata | undefined;
|
|
277
373
|
/**
|
|
278
374
|
* Gets the stats of a file in the virtual file system (VFS).
|
|
279
375
|
*
|
|
@@ -481,23 +577,12 @@ interface VirtualFileSystemInterface {
|
|
|
481
577
|
*/
|
|
482
578
|
resolve: (pathOrId: string, options?: ResolvePathOptions) => string | false;
|
|
483
579
|
/**
|
|
484
|
-
*
|
|
485
|
-
*
|
|
486
|
-
* @see https://www.typescriptlang.org/tsconfig#paths
|
|
580
|
+
* Formats a path to match the virtual file system (VFS) structure.
|
|
487
581
|
*
|
|
488
|
-
* @param path - The path to
|
|
489
|
-
* @returns The
|
|
582
|
+
* @param path - The path to format.
|
|
583
|
+
* @returns The formatted path.
|
|
490
584
|
*/
|
|
491
|
-
|
|
492
|
-
/**
|
|
493
|
-
* Resolves a package name based on TypeScript's `tsconfig.json` paths.
|
|
494
|
-
*
|
|
495
|
-
* @see https://www.typescriptlang.org/tsconfig#paths
|
|
496
|
-
*
|
|
497
|
-
* @param path - The path to check.
|
|
498
|
-
* @returns The resolved package name if it exists, otherwise undefined.
|
|
499
|
-
*/
|
|
500
|
-
resolveTsconfigPathPackage: (path: string) => string | false;
|
|
585
|
+
formatPath: (path: string) => string;
|
|
501
586
|
/**
|
|
502
587
|
* Resolves a path or id to a file path in the virtual file system.
|
|
503
588
|
*
|
|
@@ -506,23 +591,9 @@ interface VirtualFileSystemInterface {
|
|
|
506
591
|
*/
|
|
507
592
|
realpathSync: (pathOrId: string) => string;
|
|
508
593
|
/**
|
|
509
|
-
*
|
|
510
|
-
*
|
|
511
|
-
* @returns A record mapping file paths to their partial metadata.
|
|
512
|
-
*/
|
|
513
|
-
getPartialMeta: () => Record<string, Partial<VirtualFileSystemMetadata>>;
|
|
514
|
-
/**
|
|
515
|
-
* A map of cached file paths to their underlying file content.
|
|
516
|
-
*/
|
|
517
|
-
[__VFS_CACHE__]: Map<string, string>;
|
|
518
|
-
/**
|
|
519
|
-
* A reference to the underlying virtual file system.
|
|
520
|
-
*/
|
|
521
|
-
[__VFS_VIRTUAL__]: Volume;
|
|
522
|
-
/**
|
|
523
|
-
* A reference to the underlying unified file system.
|
|
594
|
+
* Disposes of the virtual file system (VFS), writes any virtual file changes to disk, and releases any associated resources.
|
|
524
595
|
*/
|
|
525
|
-
|
|
596
|
+
dispose: () => Promise<void>;
|
|
526
597
|
}
|
|
527
598
|
|
|
528
599
|
type LogFn = (type: LogLevelLabel, ...args: string[]) => void;
|
|
@@ -648,24 +719,33 @@ interface BaseConfig {
|
|
|
648
719
|
* The entry point(s) for the application
|
|
649
720
|
*/
|
|
650
721
|
entry?: TypeDefinitionParameter | TypeDefinitionParameter[];
|
|
722
|
+
/**
|
|
723
|
+
* Configuration for the output of the build process
|
|
724
|
+
*/
|
|
725
|
+
output?: OutputConfig;
|
|
651
726
|
/**
|
|
652
727
|
* Configuration for linting the source code
|
|
728
|
+
*
|
|
729
|
+
* @remarks
|
|
730
|
+
* If set to `false`, linting will be disabled.
|
|
653
731
|
*/
|
|
654
732
|
lint?: Record<string, any> | false;
|
|
655
733
|
/**
|
|
656
734
|
* Configuration for testing the source code
|
|
735
|
+
*
|
|
736
|
+
* @remarks
|
|
737
|
+
* If set to `false`, testing will be disabled.
|
|
657
738
|
*/
|
|
658
739
|
test?: Record<string, any> | false;
|
|
659
|
-
/**
|
|
660
|
-
* Configuration for the output of the build process
|
|
661
|
-
*/
|
|
662
|
-
output?: OutputConfig;
|
|
663
740
|
/**
|
|
664
741
|
* Configuration for the transformation of the source code
|
|
665
742
|
*/
|
|
666
743
|
transform?: Record<string, any>;
|
|
667
744
|
/**
|
|
668
|
-
*
|
|
745
|
+
* Configuration provided to build processes
|
|
746
|
+
*
|
|
747
|
+
* @remarks
|
|
748
|
+
* This configuration can be used by plugins during the `build` command. It will generally contain options specific to the selected {@link BuildVariant | build variant}.
|
|
669
749
|
*/
|
|
670
750
|
build?: BuildConfig;
|
|
671
751
|
/**
|
|
@@ -675,6 +755,13 @@ interface BaseConfig {
|
|
|
675
755
|
* This configuration will be used by the documentation generation plugins during the `docs` command.
|
|
676
756
|
*/
|
|
677
757
|
docs?: Record<string, any>;
|
|
758
|
+
/**
|
|
759
|
+
* Configuration for deploying the source code
|
|
760
|
+
*
|
|
761
|
+
* @remarks
|
|
762
|
+
* If set to `false`, the deployment will be disabled.
|
|
763
|
+
*/
|
|
764
|
+
deploy?: Record<string, any> | false;
|
|
678
765
|
/**
|
|
679
766
|
* The path to the tsconfig file to be used by the compiler
|
|
680
767
|
*
|
|
@@ -695,37 +782,6 @@ interface BaseConfig {
|
|
|
695
782
|
tsconfigRaw?: TSConfig;
|
|
696
783
|
}
|
|
697
784
|
interface EnvironmentConfig extends BaseConfig {
|
|
698
|
-
/**
|
|
699
|
-
* Array of strings indicating the order in which fields in a package.json file should be resolved to determine the entry point for a module.
|
|
700
|
-
*
|
|
701
|
-
* @defaultValue `['browser', 'module', 'jsnext:main', 'jsnext']`
|
|
702
|
-
*/
|
|
703
|
-
mainFields?: string[];
|
|
704
|
-
/**
|
|
705
|
-
* Array of strings indicating what conditions should be used for module resolution.
|
|
706
|
-
*/
|
|
707
|
-
conditions?: string[];
|
|
708
|
-
/**
|
|
709
|
-
* Array of strings indicating what conditions should be used for external modules.
|
|
710
|
-
*/
|
|
711
|
-
externalConditions?: string[];
|
|
712
|
-
/**
|
|
713
|
-
* Array of strings indicating what file extensions should be used for module resolution.
|
|
714
|
-
*
|
|
715
|
-
* @defaultValue `['.mjs', '.js', '.mts', '.ts', '.jsx', '.tsx', '.json']`
|
|
716
|
-
*/
|
|
717
|
-
extensions?: string[];
|
|
718
|
-
/**
|
|
719
|
-
* Array of strings indicating what modules should be deduplicated to a single version in the build.
|
|
720
|
-
*
|
|
721
|
-
* @remarks
|
|
722
|
-
* This option is useful for ensuring that only one version of a module is included in the bundle, which can help reduce bundle size and avoid conflicts.
|
|
723
|
-
*/
|
|
724
|
-
dedupe?: string[];
|
|
725
|
-
/**
|
|
726
|
-
* Array of strings or regular expressions that indicate what modules are builtin for the environment.
|
|
727
|
-
*/
|
|
728
|
-
builtins?: (string | RegExp)[];
|
|
729
785
|
/**
|
|
730
786
|
* Configuration options for the preview server
|
|
731
787
|
*/
|
|
@@ -798,17 +854,29 @@ interface CommonUserConfig extends BaseConfig {
|
|
|
798
854
|
*/
|
|
799
855
|
framework?: string;
|
|
800
856
|
}
|
|
801
|
-
type UserConfig<TBuildConfig extends BuildConfig = BuildConfig, TBuildResolvedConfig extends BuildResolvedConfig = BuildResolvedConfig, TBuildVariant extends string = any> = CommonUserConfig & {
|
|
802
|
-
|
|
857
|
+
type UserConfig<TBuildConfig extends BuildConfig = BuildConfig, TBuildResolvedConfig extends BuildResolvedConfig = BuildResolvedConfig, TBuildVariant extends string = any> = Omit<CommonUserConfig, "build"> & {
|
|
858
|
+
/**
|
|
859
|
+
* Configuration provided to build processes
|
|
860
|
+
*
|
|
861
|
+
* @remarks
|
|
862
|
+
* This configuration can be used by plugins during the `build` command. It will generally contain options specific to the selected {@link BuildVariant | build variant}.
|
|
863
|
+
*/
|
|
864
|
+
build: Omit<TBuildConfig, "override"> & {
|
|
803
865
|
/**
|
|
804
866
|
* The build variant being used by the Powerlines engine.
|
|
805
867
|
*/
|
|
806
868
|
variant?: TBuildVariant;
|
|
869
|
+
/**
|
|
870
|
+
* An optional set of override options to apply to the selected build variant.
|
|
871
|
+
*
|
|
872
|
+
* @remarks
|
|
873
|
+
* 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.
|
|
874
|
+
*/
|
|
875
|
+
override?: Partial<TBuildResolvedConfig>;
|
|
807
876
|
};
|
|
808
|
-
override?: Partial<TBuildResolvedConfig>;
|
|
809
877
|
};
|
|
810
878
|
type RollupUserConfig = UserConfig<RollupBuildConfig, RollupResolvedBuildConfig, "rollup">;
|
|
811
|
-
type PowerlinesCommand = "new" | "prepare" | "build" | "lint" | "test" | "docs" | "
|
|
879
|
+
type PowerlinesCommand = "new" | "prepare" | "build" | "lint" | "test" | "docs" | "deploy" | "clean";
|
|
812
880
|
/**
|
|
813
881
|
* The configuration provided while executing Powerlines commands.
|
|
814
882
|
*/
|
|
@@ -829,7 +897,7 @@ interface ResolvedEntryTypeDefinition extends TypeDefinition {
|
|
|
829
897
|
*/
|
|
830
898
|
output?: string;
|
|
831
899
|
}
|
|
832
|
-
type EnvironmentResolvedConfig = Omit<EnvironmentConfig, "consumer" | "mode" | "ssr" | "preview"
|
|
900
|
+
type EnvironmentResolvedConfig = Omit<EnvironmentConfig, "consumer" | "mode" | "ssr" | "preview"> & Required<Pick<EnvironmentConfig, "consumer" | "mode" | "ssr">> & {
|
|
833
901
|
/**
|
|
834
902
|
* The name of the environment
|
|
835
903
|
*/
|
|
@@ -846,7 +914,7 @@ type OutputResolvedConfig = Required<Omit<OutputConfig, "assets"> & {
|
|
|
846
914
|
/**
|
|
847
915
|
* The resolved options for the Powerlines project configuration.
|
|
848
916
|
*/
|
|
849
|
-
type ResolvedConfig<TUserConfig extends UserConfig = UserConfig> = Omit<TUserConfig, "name" | "title" | "plugins" | "mode" | "environments" | "platform" | "tsconfig" | "lint" | "test" | "build" | "transform" | "
|
|
917
|
+
type ResolvedConfig<TUserConfig extends UserConfig = UserConfig> = Omit<TUserConfig, "name" | "title" | "plugins" | "mode" | "environments" | "platform" | "tsconfig" | "lint" | "test" | "build" | "transform" | "deploy" | "variant" | "type" | "output" | "logLevel" | "framework"> & Required<Pick<TUserConfig, "name" | "title" | "plugins" | "mode" | "environments" | "tsconfig" | "lint" | "test" | "build" | "transform" | "deploy" | "framework">> & {
|
|
850
918
|
/**
|
|
851
919
|
* The configuration options that were provided inline to the Powerlines CLI.
|
|
852
920
|
*/
|
|
@@ -877,6 +945,13 @@ type ResolvedConfig<TUserConfig extends UserConfig = UserConfig> = Omit<TUserCon
|
|
|
877
945
|
* The output configuration options to use for the build process
|
|
878
946
|
*/
|
|
879
947
|
output: OutputResolvedConfig;
|
|
948
|
+
/**
|
|
949
|
+
* Configuration provided to build processes
|
|
950
|
+
*
|
|
951
|
+
* @remarks
|
|
952
|
+
* This configuration can be used by plugins during the `build` command. It will generally contain options specific to the selected {@link BuildVariant | build variant}.
|
|
953
|
+
*/
|
|
954
|
+
build: Omit<TUserConfig["build"], "override"> & Required<Pick<Required<TUserConfig["build"]>, "override">>;
|
|
880
955
|
/**
|
|
881
956
|
* The log level to use for the Powerlines processes.
|
|
882
957
|
*
|
|
@@ -911,14 +986,6 @@ interface MetaInfo {
|
|
|
911
986
|
* A hash that represents the path to the project root directory
|
|
912
987
|
*/
|
|
913
988
|
configHash: string;
|
|
914
|
-
/**
|
|
915
|
-
* A mapping of runtime ids to their corresponding file paths
|
|
916
|
-
*/
|
|
917
|
-
builtinIdMap: Record<string, string>;
|
|
918
|
-
/**
|
|
919
|
-
* A mapping of virtual file paths to their corresponding file contents
|
|
920
|
-
*/
|
|
921
|
-
virtualFiles: Record<string, string | null>;
|
|
922
989
|
}
|
|
923
990
|
interface Resolver extends Jiti {
|
|
924
991
|
plugin: Jiti;
|
|
@@ -931,7 +998,13 @@ interface InitContextOptions {
|
|
|
931
998
|
*/
|
|
932
999
|
isHighPriority: boolean;
|
|
933
1000
|
}
|
|
934
|
-
|
|
1001
|
+
/**
|
|
1002
|
+
* The unresolved Powerlines context.
|
|
1003
|
+
*
|
|
1004
|
+
* @remarks
|
|
1005
|
+
* This context is used before the user configuration has been fully resolved after the `config`.
|
|
1006
|
+
*/
|
|
1007
|
+
interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
|
|
935
1008
|
/**
|
|
936
1009
|
* The Storm workspace configuration
|
|
937
1010
|
*/
|
|
@@ -939,7 +1012,10 @@ interface Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
|
|
|
939
1012
|
/**
|
|
940
1013
|
* An object containing the options provided to Powerlines
|
|
941
1014
|
*/
|
|
942
|
-
config: TResolvedConfig
|
|
1015
|
+
config: Omit<TResolvedConfig["userConfig"], "build" | "output"> & Required<Pick<TResolvedConfig["userConfig"], "build" | "output">> & {
|
|
1016
|
+
projectRoot: NonUndefined<TResolvedConfig["userConfig"]["root"]>;
|
|
1017
|
+
output: TResolvedConfig["output"];
|
|
1018
|
+
};
|
|
943
1019
|
/**
|
|
944
1020
|
* A logging function for the Powerlines engine
|
|
945
1021
|
*/
|
|
@@ -1096,6 +1172,12 @@ interface Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
|
|
|
1096
1172
|
*/
|
|
1097
1173
|
extendLog: (name: string) => LogFn;
|
|
1098
1174
|
}
|
|
1175
|
+
type Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> = Omit<UnresolvedContext<TResolvedConfig>, "config"> & {
|
|
1176
|
+
/**
|
|
1177
|
+
* The fully resolved Powerlines configuration
|
|
1178
|
+
*/
|
|
1179
|
+
config: TResolvedConfig;
|
|
1180
|
+
};
|
|
1099
1181
|
interface PluginContext<out TResolvedConfig extends ResolvedConfig = ResolvedConfig> extends Context<TResolvedConfig>, UnpluginContext {
|
|
1100
1182
|
/**
|
|
1101
1183
|
* The environment specific resolved configuration
|
|
@@ -1111,7 +1193,7 @@ interface PluginContext<out TResolvedConfig extends ResolvedConfig = ResolvedCon
|
|
|
1111
1193
|
}
|
|
1112
1194
|
type BuildPluginContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> = PluginContext<TResolvedConfig> & Omit<UnpluginBuildContext, "parse">;
|
|
1113
1195
|
|
|
1114
|
-
declare const SUPPORTED_COMMANDS: readonly ["new", "clean", "prepare", "lint", "test", "build", "docs", "
|
|
1196
|
+
declare const SUPPORTED_COMMANDS: readonly ["new", "clean", "prepare", "lint", "test", "build", "docs", "deploy", "finalize"];
|
|
1115
1197
|
type CommandType = ArrayValues<typeof SUPPORTED_COMMANDS>;
|
|
1116
1198
|
|
|
1117
1199
|
interface PluginHookObject<THookFunction extends FunctionLike, TFilter extends keyof HookFilter = never> {
|
|
@@ -1136,6 +1218,10 @@ interface GenerateTypesResult {
|
|
|
1136
1218
|
directives?: string[];
|
|
1137
1219
|
code: string;
|
|
1138
1220
|
}
|
|
1221
|
+
type DeepPartial<T> = {
|
|
1222
|
+
[K in keyof T]?: DeepPartial<T[K]>;
|
|
1223
|
+
};
|
|
1224
|
+
type ConfigResult<TContext extends PluginContext = PluginContext> = DeepPartial<TContext["config"]> & Record<string, any>;
|
|
1139
1225
|
interface BasePluginHookFunctions<TContext extends PluginContext = PluginContext> extends Record<CommandType, (this: TContext) => MaybePromise<void>> {
|
|
1140
1226
|
/**
|
|
1141
1227
|
* A function that returns configuration options to be merged with the build context's options.
|
|
@@ -1151,7 +1237,7 @@ interface BasePluginHookFunctions<TContext extends PluginContext = PluginContext
|
|
|
1151
1237
|
* @param config - The partial configuration object to be modified.
|
|
1152
1238
|
* @returns A promise that resolves to a partial configuration object.
|
|
1153
1239
|
*/
|
|
1154
|
-
config: (this:
|
|
1240
|
+
config: (this: UnresolvedContext<TContext["config"]>) => MaybePromise<ConfigResult<TContext>>;
|
|
1155
1241
|
/**
|
|
1156
1242
|
* Modify environment configs before it's resolved. The hook can either mutate the passed-in environment config directly, or return a partial config object that will be deeply merged into existing config.
|
|
1157
1243
|
*
|
|
@@ -1254,7 +1340,7 @@ type PluginHooks<TContext extends PluginContext = PluginContext> = {
|
|
|
1254
1340
|
* @param config - The partial configuration object to be modified.
|
|
1255
1341
|
* @returns A promise that resolves to a partial configuration object.
|
|
1256
1342
|
*/
|
|
1257
|
-
config: PluginHook<(this:
|
|
1343
|
+
config: PluginHook<(this: UnresolvedContext<TContext["config"]>) => MaybePromise<ConfigResult<TContext>>> | ConfigResult<TContext>;
|
|
1258
1344
|
/**
|
|
1259
1345
|
* A hook that is called to transform the source code.
|
|
1260
1346
|
*
|