@powerlines/plugin-satori 0.1.124 → 0.1.125
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/powerlines/src/internal/helpers/hooks.d.cts +47 -0
- package/dist/powerlines/src/internal/helpers/hooks.d.mts +49 -0
- package/dist/powerlines/src/types/api.d.cts +104 -0
- package/dist/powerlines/src/types/api.d.mts +104 -0
- package/dist/powerlines/src/types/build.d.cts +43 -3
- package/dist/powerlines/src/types/build.d.mts +43 -3
- package/dist/powerlines/src/types/config.d.cts +60 -4
- package/dist/powerlines/src/types/config.d.mts +60 -4
- package/dist/powerlines/src/types/context.d.cts +113 -1
- package/dist/powerlines/src/types/context.d.mts +113 -3
- package/dist/powerlines/src/types/hooks.d.cts +32 -0
- package/dist/powerlines/src/types/hooks.d.mts +32 -2
- package/dist/powerlines/src/types/plugin.d.cts +35 -61
- package/dist/powerlines/src/types/plugin.d.mts +35 -61
- package/dist/powerlines/src/types/resolved.d.cts +16 -4
- package/dist/powerlines/src/types/resolved.d.mts +16 -4
- package/dist/powerlines/src/types/unplugin.d.cts +22 -0
- package/dist/powerlines/src/types/unplugin.d.mts +23 -0
- package/package.json +5 -5
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { SelectHooksOptions } from "../../types/context.cjs";
|
|
2
|
+
import { MaybePromise } from "@stryke/types/base";
|
|
3
|
+
|
|
4
|
+
//#region ../powerlines/src/internal/helpers/hooks.d.ts
|
|
5
|
+
type CallHookOptions = SelectHooksOptions & (({
|
|
6
|
+
/**
|
|
7
|
+
* Whether to call the hooks sequentially or in parallel.
|
|
8
|
+
*
|
|
9
|
+
* @defaultValue true
|
|
10
|
+
*/
|
|
11
|
+
sequential?: true;
|
|
12
|
+
} & ({
|
|
13
|
+
/**
|
|
14
|
+
* How to handle multiple return values from hooks.
|
|
15
|
+
* - "merge": Merge all non-undefined return values (if they are objects).
|
|
16
|
+
* - "first": Return the first non-undefined value.
|
|
17
|
+
*
|
|
18
|
+
* @remarks
|
|
19
|
+
* Merging only works if the return values are objects.
|
|
20
|
+
*
|
|
21
|
+
* @defaultValue "merge"
|
|
22
|
+
*/
|
|
23
|
+
result: "first";
|
|
24
|
+
} | {
|
|
25
|
+
/**
|
|
26
|
+
* How to handle multiple return values from hooks.
|
|
27
|
+
* - "merge": Merge all non-undefined return values (if they are objects).
|
|
28
|
+
* - "first": Return the first non-undefined value.
|
|
29
|
+
*
|
|
30
|
+
* @remarks
|
|
31
|
+
* Merging only works if the return values are objects.
|
|
32
|
+
*
|
|
33
|
+
* @defaultValue "merge"
|
|
34
|
+
*/
|
|
35
|
+
result?: "merge" | "last";
|
|
36
|
+
/**
|
|
37
|
+
* An indicator specifying if the results of the previous hook should be provided as the **first** parameter of the next hook function, or a function to process the result of the previous hook function and pass the returned value as the next hook's **first** parameter
|
|
38
|
+
*/
|
|
39
|
+
asNextParam?: false | ((previousResult: any) => MaybePromise<any>);
|
|
40
|
+
})) | {
|
|
41
|
+
/**
|
|
42
|
+
* Whether to call the hooks sequentially or in parallel.
|
|
43
|
+
*/
|
|
44
|
+
sequential: false;
|
|
45
|
+
});
|
|
46
|
+
//#endregion
|
|
47
|
+
export { CallHookOptions };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import "../../types/hooks.mjs";
|
|
2
|
+
import "../../types/resolved.mjs";
|
|
3
|
+
import { SelectHooksOptions } from "../../types/context.mjs";
|
|
4
|
+
import { MaybePromise } from "@stryke/types/base";
|
|
5
|
+
|
|
6
|
+
//#region ../powerlines/src/internal/helpers/hooks.d.ts
|
|
7
|
+
type CallHookOptions = SelectHooksOptions & (({
|
|
8
|
+
/**
|
|
9
|
+
* Whether to call the hooks sequentially or in parallel.
|
|
10
|
+
*
|
|
11
|
+
* @defaultValue true
|
|
12
|
+
*/
|
|
13
|
+
sequential?: true;
|
|
14
|
+
} & ({
|
|
15
|
+
/**
|
|
16
|
+
* How to handle multiple return values from hooks.
|
|
17
|
+
* - "merge": Merge all non-undefined return values (if they are objects).
|
|
18
|
+
* - "first": Return the first non-undefined value.
|
|
19
|
+
*
|
|
20
|
+
* @remarks
|
|
21
|
+
* Merging only works if the return values are objects.
|
|
22
|
+
*
|
|
23
|
+
* @defaultValue "merge"
|
|
24
|
+
*/
|
|
25
|
+
result: "first";
|
|
26
|
+
} | {
|
|
27
|
+
/**
|
|
28
|
+
* How to handle multiple return values from hooks.
|
|
29
|
+
* - "merge": Merge all non-undefined return values (if they are objects).
|
|
30
|
+
* - "first": Return the first non-undefined value.
|
|
31
|
+
*
|
|
32
|
+
* @remarks
|
|
33
|
+
* Merging only works if the return values are objects.
|
|
34
|
+
*
|
|
35
|
+
* @defaultValue "merge"
|
|
36
|
+
*/
|
|
37
|
+
result?: "merge" | "last";
|
|
38
|
+
/**
|
|
39
|
+
* An indicator specifying if the results of the previous hook should be provided as the **first** parameter of the next hook function, or a function to process the result of the previous hook function and pass the returned value as the next hook's **first** parameter
|
|
40
|
+
*/
|
|
41
|
+
asNextParam?: false | ((previousResult: any) => MaybePromise<any>);
|
|
42
|
+
})) | {
|
|
43
|
+
/**
|
|
44
|
+
* Whether to call the hooks sequentially or in parallel.
|
|
45
|
+
*/
|
|
46
|
+
sequential: false;
|
|
47
|
+
});
|
|
48
|
+
//#endregion
|
|
49
|
+
export { CallHookOptions };
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { BuildInlineConfig, CleanInlineConfig, DeployInlineConfig, DocsInlineConfig, LintInlineConfig, NewInlineConfig, PrepareInlineConfig } from "./config.cjs";
|
|
2
|
+
import { InferHookParameters, InferHookReturnType } from "./hooks.cjs";
|
|
3
|
+
import { ResolvedConfig } from "./resolved.cjs";
|
|
4
|
+
import { APIContext, EnvironmentContext, PluginContext } from "./context.cjs";
|
|
5
|
+
import { CallHookOptions } from "../internal/helpers/hooks.cjs";
|
|
6
|
+
|
|
7
|
+
//#region ../powerlines/src/types/api.d.ts
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Powerlines API Interface
|
|
11
|
+
*/
|
|
12
|
+
interface API<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
|
|
13
|
+
/**
|
|
14
|
+
* The Powerlines shared API context
|
|
15
|
+
*/
|
|
16
|
+
context: APIContext<TResolvedConfig>;
|
|
17
|
+
/**
|
|
18
|
+
* Prepare the Powerlines API
|
|
19
|
+
*
|
|
20
|
+
* @remarks
|
|
21
|
+
* This method will prepare the Powerlines API for use, initializing any necessary resources.
|
|
22
|
+
*
|
|
23
|
+
* @param inlineConfig - The inline configuration for the prepare command
|
|
24
|
+
*/
|
|
25
|
+
prepare: (inlineConfig: PrepareInlineConfig | NewInlineConfig | CleanInlineConfig | BuildInlineConfig | LintInlineConfig | DocsInlineConfig | DeployInlineConfig) => Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* Create a new Powerlines project
|
|
28
|
+
*
|
|
29
|
+
* @remarks
|
|
30
|
+
* This method will create a new Powerlines project in the current directory.
|
|
31
|
+
*
|
|
32
|
+
* @param inlineConfig - The inline configuration for the new command
|
|
33
|
+
* @returns A promise that resolves when the project has been created
|
|
34
|
+
*/
|
|
35
|
+
new: (inlineConfig: NewInlineConfig) => Promise<void>;
|
|
36
|
+
/**
|
|
37
|
+
* Clean any previously prepared artifacts
|
|
38
|
+
*
|
|
39
|
+
* @remarks
|
|
40
|
+
* This method will remove the previous Powerlines artifacts from the project.
|
|
41
|
+
*
|
|
42
|
+
* @param inlineConfig - The inline configuration for the clean command
|
|
43
|
+
* @returns A promise that resolves when the clean command has completed
|
|
44
|
+
*/
|
|
45
|
+
clean: (inlineConfig: CleanInlineConfig | PrepareInlineConfig) => Promise<void>;
|
|
46
|
+
/**
|
|
47
|
+
* Lint the project source code
|
|
48
|
+
*
|
|
49
|
+
* @param inlineConfig - The inline configuration for the lint command
|
|
50
|
+
* @returns A promise that resolves when the lint command has completed
|
|
51
|
+
*/
|
|
52
|
+
lint: (inlineConfig: LintInlineConfig) => Promise<void>;
|
|
53
|
+
/**
|
|
54
|
+
* Build the project
|
|
55
|
+
*
|
|
56
|
+
* @remarks
|
|
57
|
+
* This method will build the Powerlines project, generating the necessary artifacts.
|
|
58
|
+
*
|
|
59
|
+
* @param inlineConfig - The inline configuration for the build command
|
|
60
|
+
* @returns A promise that resolves when the build command has completed
|
|
61
|
+
*/
|
|
62
|
+
build: (inlineConfig: BuildInlineConfig) => Promise<void>;
|
|
63
|
+
/**
|
|
64
|
+
* Prepare the documentation for the project
|
|
65
|
+
*
|
|
66
|
+
* @param inlineConfig - The inline configuration for the docs command
|
|
67
|
+
* @returns A promise that resolves when the documentation generation has completed
|
|
68
|
+
*/
|
|
69
|
+
docs: (inlineConfig: DocsInlineConfig) => Promise<void>;
|
|
70
|
+
/**
|
|
71
|
+
* Deploy the project source code
|
|
72
|
+
*
|
|
73
|
+
* @remarks
|
|
74
|
+
* This method will prepare and build the Powerlines project, generating the necessary artifacts for the deployment.
|
|
75
|
+
*
|
|
76
|
+
* @param inlineConfig - The inline configuration for the deploy command
|
|
77
|
+
*/
|
|
78
|
+
deploy: (inlineConfig: DeployInlineConfig) => Promise<void>;
|
|
79
|
+
/**
|
|
80
|
+
* Finalization process
|
|
81
|
+
*
|
|
82
|
+
* @remarks
|
|
83
|
+
* This step includes any final processes or clean up required by Powerlines. It will be run after each Powerlines command.
|
|
84
|
+
*
|
|
85
|
+
* @returns A promise that resolves when the finalization process has completed
|
|
86
|
+
*/
|
|
87
|
+
finalize: () => Promise<void>;
|
|
88
|
+
/**
|
|
89
|
+
* Invokes the configured plugin hooks
|
|
90
|
+
*
|
|
91
|
+
* @remarks
|
|
92
|
+
* By default, it will call the `"pre"`, `"normal"`, and `"post"` ordered hooks in sequence
|
|
93
|
+
*
|
|
94
|
+
* @param hook - The hook to call
|
|
95
|
+
* @param options - The options to provide to the hook
|
|
96
|
+
* @param args - The arguments to pass to the hook
|
|
97
|
+
* @returns The result of the hook call
|
|
98
|
+
*/
|
|
99
|
+
callHook: <TKey extends string>(hook: TKey, options: CallHookOptions & {
|
|
100
|
+
environment?: string | EnvironmentContext<TResolvedConfig>;
|
|
101
|
+
}, ...args: InferHookParameters<PluginContext<TResolvedConfig>, TKey>) => Promise<InferHookReturnType<PluginContext<TResolvedConfig>, TKey> | undefined>;
|
|
102
|
+
}
|
|
103
|
+
//#endregion
|
|
104
|
+
export { API };
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { BuildInlineConfig, CleanInlineConfig, DeployInlineConfig, DocsInlineConfig, LintInlineConfig, NewInlineConfig, PrepareInlineConfig } from "./config.mjs";
|
|
2
|
+
import { InferHookParameters, InferHookReturnType } from "./hooks.mjs";
|
|
3
|
+
import { ResolvedConfig } from "./resolved.mjs";
|
|
4
|
+
import { APIContext, EnvironmentContext, PluginContext } from "./context.mjs";
|
|
5
|
+
import { CallHookOptions } from "../internal/helpers/hooks.mjs";
|
|
6
|
+
|
|
7
|
+
//#region ../powerlines/src/types/api.d.ts
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Powerlines API Interface
|
|
11
|
+
*/
|
|
12
|
+
interface API<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
|
|
13
|
+
/**
|
|
14
|
+
* The Powerlines shared API context
|
|
15
|
+
*/
|
|
16
|
+
context: APIContext<TResolvedConfig>;
|
|
17
|
+
/**
|
|
18
|
+
* Prepare the Powerlines API
|
|
19
|
+
*
|
|
20
|
+
* @remarks
|
|
21
|
+
* This method will prepare the Powerlines API for use, initializing any necessary resources.
|
|
22
|
+
*
|
|
23
|
+
* @param inlineConfig - The inline configuration for the prepare command
|
|
24
|
+
*/
|
|
25
|
+
prepare: (inlineConfig: PrepareInlineConfig | NewInlineConfig | CleanInlineConfig | BuildInlineConfig | LintInlineConfig | DocsInlineConfig | DeployInlineConfig) => Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* Create a new Powerlines project
|
|
28
|
+
*
|
|
29
|
+
* @remarks
|
|
30
|
+
* This method will create a new Powerlines project in the current directory.
|
|
31
|
+
*
|
|
32
|
+
* @param inlineConfig - The inline configuration for the new command
|
|
33
|
+
* @returns A promise that resolves when the project has been created
|
|
34
|
+
*/
|
|
35
|
+
new: (inlineConfig: NewInlineConfig) => Promise<void>;
|
|
36
|
+
/**
|
|
37
|
+
* Clean any previously prepared artifacts
|
|
38
|
+
*
|
|
39
|
+
* @remarks
|
|
40
|
+
* This method will remove the previous Powerlines artifacts from the project.
|
|
41
|
+
*
|
|
42
|
+
* @param inlineConfig - The inline configuration for the clean command
|
|
43
|
+
* @returns A promise that resolves when the clean command has completed
|
|
44
|
+
*/
|
|
45
|
+
clean: (inlineConfig: CleanInlineConfig | PrepareInlineConfig) => Promise<void>;
|
|
46
|
+
/**
|
|
47
|
+
* Lint the project source code
|
|
48
|
+
*
|
|
49
|
+
* @param inlineConfig - The inline configuration for the lint command
|
|
50
|
+
* @returns A promise that resolves when the lint command has completed
|
|
51
|
+
*/
|
|
52
|
+
lint: (inlineConfig: LintInlineConfig) => Promise<void>;
|
|
53
|
+
/**
|
|
54
|
+
* Build the project
|
|
55
|
+
*
|
|
56
|
+
* @remarks
|
|
57
|
+
* This method will build the Powerlines project, generating the necessary artifacts.
|
|
58
|
+
*
|
|
59
|
+
* @param inlineConfig - The inline configuration for the build command
|
|
60
|
+
* @returns A promise that resolves when the build command has completed
|
|
61
|
+
*/
|
|
62
|
+
build: (inlineConfig: BuildInlineConfig) => Promise<void>;
|
|
63
|
+
/**
|
|
64
|
+
* Prepare the documentation for the project
|
|
65
|
+
*
|
|
66
|
+
* @param inlineConfig - The inline configuration for the docs command
|
|
67
|
+
* @returns A promise that resolves when the documentation generation has completed
|
|
68
|
+
*/
|
|
69
|
+
docs: (inlineConfig: DocsInlineConfig) => Promise<void>;
|
|
70
|
+
/**
|
|
71
|
+
* Deploy the project source code
|
|
72
|
+
*
|
|
73
|
+
* @remarks
|
|
74
|
+
* This method will prepare and build the Powerlines project, generating the necessary artifacts for the deployment.
|
|
75
|
+
*
|
|
76
|
+
* @param inlineConfig - The inline configuration for the deploy command
|
|
77
|
+
*/
|
|
78
|
+
deploy: (inlineConfig: DeployInlineConfig) => Promise<void>;
|
|
79
|
+
/**
|
|
80
|
+
* Finalization process
|
|
81
|
+
*
|
|
82
|
+
* @remarks
|
|
83
|
+
* This step includes any final processes or clean up required by Powerlines. It will be run after each Powerlines command.
|
|
84
|
+
*
|
|
85
|
+
* @returns A promise that resolves when the finalization process has completed
|
|
86
|
+
*/
|
|
87
|
+
finalize: () => Promise<void>;
|
|
88
|
+
/**
|
|
89
|
+
* Invokes the configured plugin hooks
|
|
90
|
+
*
|
|
91
|
+
* @remarks
|
|
92
|
+
* By default, it will call the `"pre"`, `"normal"`, and `"post"` ordered hooks in sequence
|
|
93
|
+
*
|
|
94
|
+
* @param hook - The hook to call
|
|
95
|
+
* @param options - The options to provide to the hook
|
|
96
|
+
* @param args - The arguments to pass to the hook
|
|
97
|
+
* @returns The result of the hook call
|
|
98
|
+
*/
|
|
99
|
+
callHook: <TKey extends string>(hook: TKey, options: CallHookOptions & {
|
|
100
|
+
environment?: string | EnvironmentContext<TResolvedConfig>;
|
|
101
|
+
}, ...args: InferHookParameters<PluginContext<TResolvedConfig>, TKey>) => Promise<InferHookReturnType<PluginContext<TResolvedConfig>, TKey> | undefined>;
|
|
102
|
+
}
|
|
103
|
+
//#endregion
|
|
104
|
+
export { API };
|
|
@@ -1,6 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
import { OutputOptions, RollupOptions } from "rollup";
|
|
2
|
+
import { UserConfig } from "@farmfe/core";
|
|
3
|
+
import { Configuration } from "@rspack/core";
|
|
4
|
+
import { BuildOptions } from "@storm-software/tsup/types";
|
|
5
|
+
import { UnbuildOptions } from "@storm-software/unbuild/types";
|
|
6
|
+
import { BuildOptions as BuildOptions$1 } from "esbuild";
|
|
7
|
+
import { RolldownOptions } from "rolldown";
|
|
8
|
+
import { UserConfig as UserConfig$1 } from "tsdown";
|
|
9
|
+
import { DepOptimizationOptions, UserConfig as UserConfig$2 } from "vite";
|
|
10
|
+
import { Configuration as Configuration$1 } from "webpack";
|
|
2
11
|
|
|
3
|
-
|
|
12
|
+
//#region ../powerlines/src/types/build.d.ts
|
|
13
|
+
type UnpluginBuilderVariant = "rollup" | "webpack" | "rspack" | "vite" | "esbuild" | "farm" | "unloader" | "rolldown" | "bun";
|
|
14
|
+
type BuilderVariant = UnpluginBuilderVariant | "tsup" | "tsdown" | "unbuild";
|
|
15
|
+
type InferUnpluginVariant<TBuildVariant extends BuilderVariant> = TBuildVariant extends "tsup" ? "esbuild" : TBuildVariant extends "tsdown" ? "rolldown" : TBuildVariant extends "unbuild" ? "rollup" : TBuildVariant;
|
|
4
16
|
interface BuildConfig {
|
|
5
17
|
/**
|
|
6
18
|
* The platform to build the project for
|
|
@@ -141,5 +153,33 @@ interface BuildConfig {
|
|
|
141
153
|
override?: Record<string, any>;
|
|
142
154
|
}
|
|
143
155
|
type BuildResolvedConfig = Omit<BuildConfig, "override">;
|
|
156
|
+
type ESBuildBuildConfig = Omit<BuildOptions$1, "entryPoints" | "sourceRoot" | "platform" | "outdir" | "env" | "assets" | "external" | "inject" | "tsconfig" | "tsconfigRaw" | "logLevel"> & BuildConfig;
|
|
157
|
+
type ESBuildResolvedBuildConfig = Omit<BuildOptions$1, "inject"> & BuildResolvedConfig;
|
|
158
|
+
type ViteBuildConfig = Omit<UserConfig$2, "entry" | "entryPoints" | "tsconfig" | "tsconfigRaw" | "environments" | "output"> & BuildConfig & {
|
|
159
|
+
/**
|
|
160
|
+
* Optimize deps config
|
|
161
|
+
*/
|
|
162
|
+
optimizeDeps?: Omit<DepOptimizationOptions, "extensions">;
|
|
163
|
+
};
|
|
164
|
+
type ViteResolvedBuildConfig = UserConfig$2 & BuildResolvedConfig;
|
|
165
|
+
type WebpackBuildConfig = Omit<Configuration$1, "name" | "entry" | "entryPoints" | "tsconfig" | "tsconfigRaw"> & BuildConfig;
|
|
166
|
+
type WebpackResolvedBuildConfig = Configuration$1 & BuildResolvedConfig;
|
|
167
|
+
type RspackBuildConfig = Omit<Configuration, "name" | "entry" | "entryPoints" | "tsconfig" | "tsconfigRaw"> & BuildConfig;
|
|
168
|
+
type RspackResolvedBuildConfig = Configuration & BuildResolvedConfig;
|
|
169
|
+
type RollupBuildOutputConfig = Omit<OutputOptions, "dir" | "format">;
|
|
170
|
+
type RollupBuildConfig = Omit<RollupOptions, "entry" | "external" | "input" | "output" | "logLevel"> & {
|
|
171
|
+
output: RollupBuildOutputConfig | RollupBuildOutputConfig[];
|
|
172
|
+
} & BuildConfig;
|
|
173
|
+
type RollupResolvedBuildConfig = RollupOptions & BuildResolvedConfig;
|
|
174
|
+
type RolldownBuildConfig = Omit<RolldownOptions, "input" | "external" | "tsconfig" | "logLevel" | "output"> & BuildConfig;
|
|
175
|
+
type RolldownResolvedBuildConfig = RolldownOptions & BuildResolvedConfig;
|
|
176
|
+
type TsupBuildConfig = Partial<Omit<BuildOptions, "userOptions" | "tsconfig" | "tsconfigRaw" | "assets" | "outputPath" | "mode" | "format" | "platform" | "projectRoot" | "clean" | "env" | "entry" | "entryPoints" | "external" | "noExternal" | "skipNodeModulesBundle">> & BuildConfig;
|
|
177
|
+
type TsupResolvedBuildConfig = BuildOptions & BuildResolvedConfig;
|
|
178
|
+
type TsdownBuildConfig = Partial<Omit<UserConfig$1, "name" | "outDir" | "clean" | "cwd" | "tsconfig" | "publicDir" | "copy" | "alias" | "format" | "platform" | "env" | "define" | "entry" | "external" | "noExternal" | "skipNodeModulesBundle">> & BuildConfig;
|
|
179
|
+
type TsdownResolvedBuildConfig = UserConfig$1 & BuildResolvedConfig;
|
|
180
|
+
type UnbuildBuildConfig = Partial<Omit<UnbuildOptions, "tsconfig" | "tsconfigRaw" | "assets" | "outputPath" | "mode" | "format" | "platform" | "projectRoot" | "env" | "entry" | "entryPoints">> & BuildConfig;
|
|
181
|
+
type UnbuildResolvedBuildConfig = UnbuildOptions & BuildResolvedConfig;
|
|
182
|
+
type FarmBuildConfig = Partial<Omit<UserConfig, "tsconfig" | "tsconfigRaw" | "assets" | "outputPath" | "mode" | "format" | "platform" | "projectRoot" | "env" | "entry" | "entryPoints">> & BuildConfig;
|
|
183
|
+
type FarmResolvedBuildConfig = UserConfig & BuildResolvedConfig;
|
|
144
184
|
//#endregion
|
|
145
|
-
export { BuildConfig, BuildResolvedConfig,
|
|
185
|
+
export { BuildConfig, BuildResolvedConfig, BuilderVariant, ESBuildBuildConfig, ESBuildResolvedBuildConfig, FarmBuildConfig, FarmResolvedBuildConfig, InferUnpluginVariant, RolldownBuildConfig, RolldownResolvedBuildConfig, RollupBuildConfig, RollupResolvedBuildConfig, RspackBuildConfig, RspackResolvedBuildConfig, TsdownBuildConfig, TsdownResolvedBuildConfig, TsupBuildConfig, TsupResolvedBuildConfig, UnbuildBuildConfig, UnbuildResolvedBuildConfig, UnpluginBuilderVariant, ViteBuildConfig, ViteResolvedBuildConfig, WebpackBuildConfig, WebpackResolvedBuildConfig };
|
|
@@ -1,6 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
import { OutputOptions, RollupOptions } from "rollup";
|
|
2
|
+
import { UserConfig } from "@farmfe/core";
|
|
3
|
+
import { Configuration } from "@rspack/core";
|
|
4
|
+
import { BuildOptions } from "@storm-software/tsup/types";
|
|
5
|
+
import { UnbuildOptions } from "@storm-software/unbuild/types";
|
|
6
|
+
import { BuildOptions as BuildOptions$1 } from "esbuild";
|
|
7
|
+
import { RolldownOptions } from "rolldown";
|
|
8
|
+
import { UserConfig as UserConfig$1 } from "tsdown";
|
|
9
|
+
import { DepOptimizationOptions, UserConfig as UserConfig$2 } from "vite";
|
|
10
|
+
import { Configuration as Configuration$1 } from "webpack";
|
|
2
11
|
|
|
3
|
-
|
|
12
|
+
//#region ../powerlines/src/types/build.d.ts
|
|
13
|
+
type UnpluginBuilderVariant = "rollup" | "webpack" | "rspack" | "vite" | "esbuild" | "farm" | "unloader" | "rolldown" | "bun";
|
|
14
|
+
type BuilderVariant = UnpluginBuilderVariant | "tsup" | "tsdown" | "unbuild";
|
|
15
|
+
type InferUnpluginVariant<TBuildVariant extends BuilderVariant> = TBuildVariant extends "tsup" ? "esbuild" : TBuildVariant extends "tsdown" ? "rolldown" : TBuildVariant extends "unbuild" ? "rollup" : TBuildVariant;
|
|
4
16
|
interface BuildConfig {
|
|
5
17
|
/**
|
|
6
18
|
* The platform to build the project for
|
|
@@ -141,5 +153,33 @@ interface BuildConfig {
|
|
|
141
153
|
override?: Record<string, any>;
|
|
142
154
|
}
|
|
143
155
|
type BuildResolvedConfig = Omit<BuildConfig, "override">;
|
|
156
|
+
type ESBuildBuildConfig = Omit<BuildOptions$1, "entryPoints" | "sourceRoot" | "platform" | "outdir" | "env" | "assets" | "external" | "inject" | "tsconfig" | "tsconfigRaw" | "logLevel"> & BuildConfig;
|
|
157
|
+
type ESBuildResolvedBuildConfig = Omit<BuildOptions$1, "inject"> & BuildResolvedConfig;
|
|
158
|
+
type ViteBuildConfig = Omit<UserConfig$2, "entry" | "entryPoints" | "tsconfig" | "tsconfigRaw" | "environments" | "output"> & BuildConfig & {
|
|
159
|
+
/**
|
|
160
|
+
* Optimize deps config
|
|
161
|
+
*/
|
|
162
|
+
optimizeDeps?: Omit<DepOptimizationOptions, "extensions">;
|
|
163
|
+
};
|
|
164
|
+
type ViteResolvedBuildConfig = UserConfig$2 & BuildResolvedConfig;
|
|
165
|
+
type WebpackBuildConfig = Omit<Configuration$1, "name" | "entry" | "entryPoints" | "tsconfig" | "tsconfigRaw"> & BuildConfig;
|
|
166
|
+
type WebpackResolvedBuildConfig = Configuration$1 & BuildResolvedConfig;
|
|
167
|
+
type RspackBuildConfig = Omit<Configuration, "name" | "entry" | "entryPoints" | "tsconfig" | "tsconfigRaw"> & BuildConfig;
|
|
168
|
+
type RspackResolvedBuildConfig = Configuration & BuildResolvedConfig;
|
|
169
|
+
type RollupBuildOutputConfig = Omit<OutputOptions, "dir" | "format">;
|
|
170
|
+
type RollupBuildConfig = Omit<RollupOptions, "entry" | "external" | "input" | "output" | "logLevel"> & {
|
|
171
|
+
output: RollupBuildOutputConfig | RollupBuildOutputConfig[];
|
|
172
|
+
} & BuildConfig;
|
|
173
|
+
type RollupResolvedBuildConfig = RollupOptions & BuildResolvedConfig;
|
|
174
|
+
type RolldownBuildConfig = Omit<RolldownOptions, "input" | "external" | "tsconfig" | "logLevel" | "output"> & BuildConfig;
|
|
175
|
+
type RolldownResolvedBuildConfig = RolldownOptions & BuildResolvedConfig;
|
|
176
|
+
type TsupBuildConfig = Partial<Omit<BuildOptions, "userOptions" | "tsconfig" | "tsconfigRaw" | "assets" | "outputPath" | "mode" | "format" | "platform" | "projectRoot" | "clean" | "env" | "entry" | "entryPoints" | "external" | "noExternal" | "skipNodeModulesBundle">> & BuildConfig;
|
|
177
|
+
type TsupResolvedBuildConfig = BuildOptions & BuildResolvedConfig;
|
|
178
|
+
type TsdownBuildConfig = Partial<Omit<UserConfig$1, "name" | "outDir" | "clean" | "cwd" | "tsconfig" | "publicDir" | "copy" | "alias" | "format" | "platform" | "env" | "define" | "entry" | "external" | "noExternal" | "skipNodeModulesBundle">> & BuildConfig;
|
|
179
|
+
type TsdownResolvedBuildConfig = UserConfig$1 & BuildResolvedConfig;
|
|
180
|
+
type UnbuildBuildConfig = Partial<Omit<UnbuildOptions, "tsconfig" | "tsconfigRaw" | "assets" | "outputPath" | "mode" | "format" | "platform" | "projectRoot" | "env" | "entry" | "entryPoints">> & BuildConfig;
|
|
181
|
+
type UnbuildResolvedBuildConfig = UnbuildOptions & BuildResolvedConfig;
|
|
182
|
+
type FarmBuildConfig = Partial<Omit<UserConfig, "tsconfig" | "tsconfigRaw" | "assets" | "outputPath" | "mode" | "format" | "platform" | "projectRoot" | "env" | "entry" | "entryPoints">> & BuildConfig;
|
|
183
|
+
type FarmResolvedBuildConfig = UserConfig & BuildResolvedConfig;
|
|
144
184
|
//#endregion
|
|
145
|
-
export { BuildConfig, BuildResolvedConfig,
|
|
185
|
+
export { BuildConfig, BuildResolvedConfig, BuilderVariant, ESBuildBuildConfig, ESBuildResolvedBuildConfig, FarmBuildConfig, FarmResolvedBuildConfig, InferUnpluginVariant, RolldownBuildConfig, RolldownResolvedBuildConfig, RollupBuildConfig, RollupResolvedBuildConfig, RspackBuildConfig, RspackResolvedBuildConfig, TsdownBuildConfig, TsdownResolvedBuildConfig, TsupBuildConfig, TsupResolvedBuildConfig, UnbuildBuildConfig, UnbuildResolvedBuildConfig, UnpluginBuilderVariant, ViteBuildConfig, ViteResolvedBuildConfig, WebpackBuildConfig, WebpackResolvedBuildConfig };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BuildConfig, BuildResolvedConfig } from "./build.cjs";
|
|
1
|
+
import { BuildConfig, BuildResolvedConfig, ESBuildBuildConfig, ESBuildResolvedBuildConfig, FarmBuildConfig, FarmResolvedBuildConfig, RolldownBuildConfig, RolldownResolvedBuildConfig, RollupBuildConfig, RollupResolvedBuildConfig, RspackBuildConfig, RspackResolvedBuildConfig, TsdownBuildConfig, TsdownResolvedBuildConfig, TsupBuildConfig, TsupResolvedBuildConfig, UnbuildBuildConfig, UnbuildResolvedBuildConfig, ViteBuildConfig, ViteResolvedBuildConfig, WebpackBuildConfig, WebpackResolvedBuildConfig } from "./build.cjs";
|
|
2
2
|
import { StoragePort, StoragePreset } from "./fs.cjs";
|
|
3
3
|
import { TSConfig } from "./tsconfig.cjs";
|
|
4
4
|
import { PluginContext } from "./context.cjs";
|
|
@@ -341,7 +341,7 @@ interface CommonUserConfig extends BaseConfig {
|
|
|
341
341
|
*/
|
|
342
342
|
framework?: string;
|
|
343
343
|
}
|
|
344
|
-
interface UserConfig<TBuildConfig extends BuildConfig = BuildConfig, TBuildResolvedConfig extends BuildResolvedConfig = BuildResolvedConfig, TBuildVariant extends string = any> extends Omit<CommonUserConfig, "build"> {
|
|
344
|
+
interface UserConfig$1<TBuildConfig extends BuildConfig = BuildConfig, TBuildResolvedConfig extends BuildResolvedConfig = BuildResolvedConfig, TBuildVariant extends string = any> extends Omit<CommonUserConfig, "build"> {
|
|
345
345
|
/**
|
|
346
346
|
* Configuration provided to build processes
|
|
347
347
|
*
|
|
@@ -362,15 +362,71 @@ interface UserConfig<TBuildConfig extends BuildConfig = BuildConfig, TBuildResol
|
|
|
362
362
|
override?: Partial<TBuildResolvedConfig>;
|
|
363
363
|
};
|
|
364
364
|
}
|
|
365
|
+
type WebpackUserConfig = UserConfig$1<WebpackBuildConfig, WebpackResolvedBuildConfig, "webpack">;
|
|
366
|
+
type RspackUserConfig = UserConfig$1<RspackBuildConfig, RspackResolvedBuildConfig, "rspack">;
|
|
367
|
+
type RollupUserConfig = UserConfig$1<RollupBuildConfig, RollupResolvedBuildConfig, "rollup">;
|
|
368
|
+
type RolldownUserConfig = UserConfig$1<RolldownBuildConfig, RolldownResolvedBuildConfig, "rolldown">;
|
|
369
|
+
type ViteUserConfig = UserConfig$1<ViteBuildConfig, ViteResolvedBuildConfig, "vite">;
|
|
370
|
+
type ESBuildUserConfig = UserConfig$1<ESBuildBuildConfig, ESBuildResolvedBuildConfig, "esbuild">;
|
|
371
|
+
type UnbuildUserConfig = UserConfig$1<UnbuildBuildConfig, UnbuildResolvedBuildConfig, "unbuild">;
|
|
372
|
+
type TsupUserConfig = UserConfig$1<TsupBuildConfig, TsupResolvedBuildConfig, "tsup">;
|
|
373
|
+
type TsdownUserConfig = UserConfig$1<TsdownBuildConfig, TsdownResolvedBuildConfig, "tsdown">;
|
|
374
|
+
type FarmUserConfig = UserConfig$1<FarmBuildConfig, FarmResolvedBuildConfig, "farm">;
|
|
365
375
|
type PowerlinesCommand = "new" | "prepare" | "build" | "lint" | "test" | "docs" | "deploy" | "clean";
|
|
366
376
|
/**
|
|
367
377
|
* The configuration provided while executing Powerlines commands.
|
|
368
378
|
*/
|
|
369
|
-
type InlineConfig<TUserConfig extends UserConfig = UserConfig> = Partial<TUserConfig> & {
|
|
379
|
+
type InlineConfig<TUserConfig extends UserConfig$1 = UserConfig$1> = Partial<TUserConfig> & {
|
|
370
380
|
/**
|
|
371
381
|
* A string identifier for the Powerlines command being executed
|
|
372
382
|
*/
|
|
373
383
|
command: PowerlinesCommand;
|
|
374
384
|
};
|
|
385
|
+
type NewInlineConfig<TUserConfig extends UserConfig$1 = UserConfig$1> = InlineConfig<TUserConfig> & Required<Pick<InlineConfig<TUserConfig>, "root">> & {
|
|
386
|
+
/**
|
|
387
|
+
* A string identifier for the Powerlines command being executed
|
|
388
|
+
*/
|
|
389
|
+
command: "new";
|
|
390
|
+
/**
|
|
391
|
+
* The package name (from the \`package.json\`) for the project that will be used in the \`new\` command to create a new project based on this configuration
|
|
392
|
+
*/
|
|
393
|
+
packageName?: string;
|
|
394
|
+
};
|
|
395
|
+
type CleanInlineConfig<TUserConfig extends UserConfig$1 = UserConfig$1> = InlineConfig<TUserConfig> & {
|
|
396
|
+
/**
|
|
397
|
+
* A string identifier for the Powerlines command being executed
|
|
398
|
+
*/
|
|
399
|
+
command: "clean";
|
|
400
|
+
};
|
|
401
|
+
type PrepareInlineConfig<TUserConfig extends UserConfig$1 = UserConfig$1> = InlineConfig<TUserConfig> & {
|
|
402
|
+
/**
|
|
403
|
+
* A string identifier for the Powerlines command being executed
|
|
404
|
+
*/
|
|
405
|
+
command: "prepare";
|
|
406
|
+
};
|
|
407
|
+
type BuildInlineConfig<TUserConfig extends UserConfig$1 = UserConfig$1> = InlineConfig<TUserConfig> & {
|
|
408
|
+
/**
|
|
409
|
+
* A string identifier for the Powerlines command being executed
|
|
410
|
+
*/
|
|
411
|
+
command: "build";
|
|
412
|
+
};
|
|
413
|
+
type LintInlineConfig<TUserConfig extends UserConfig$1 = UserConfig$1> = InlineConfig<TUserConfig> & {
|
|
414
|
+
/**
|
|
415
|
+
* A string identifier for the Powerlines command being executed
|
|
416
|
+
*/
|
|
417
|
+
command: "lint";
|
|
418
|
+
};
|
|
419
|
+
type DocsInlineConfig<TUserConfig extends UserConfig$1 = UserConfig$1> = InlineConfig<TUserConfig> & {
|
|
420
|
+
/**
|
|
421
|
+
* A string identifier for the Powerlines command being executed
|
|
422
|
+
*/
|
|
423
|
+
command: "docs";
|
|
424
|
+
};
|
|
425
|
+
type DeployInlineConfig<TUserConfig extends UserConfig$1 = UserConfig$1> = InlineConfig<TUserConfig> & {
|
|
426
|
+
/**
|
|
427
|
+
* A string identifier for the Powerlines command being executed
|
|
428
|
+
*/
|
|
429
|
+
command: "deploy";
|
|
430
|
+
};
|
|
375
431
|
//#endregion
|
|
376
|
-
export { EnvironmentConfig, InlineConfig, LogFn, OutputConfig, PluginConfig, UserConfig, WorkspaceConfig };
|
|
432
|
+
export { BuildInlineConfig, CleanInlineConfig, DeployInlineConfig, DocsInlineConfig, ESBuildUserConfig, EnvironmentConfig, FarmUserConfig, InlineConfig, LintInlineConfig, LogFn, NewInlineConfig, OutputConfig, PluginConfig, PrepareInlineConfig, RolldownUserConfig, RollupUserConfig, RspackUserConfig, TsdownUserConfig, TsupUserConfig, UnbuildUserConfig, UserConfig$1 as UserConfig, ViteUserConfig, WebpackUserConfig, WorkspaceConfig };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BuildConfig, BuildResolvedConfig } from "./build.mjs";
|
|
1
|
+
import { BuildConfig, BuildResolvedConfig, ESBuildBuildConfig, ESBuildResolvedBuildConfig, FarmBuildConfig, FarmResolvedBuildConfig, RolldownBuildConfig, RolldownResolvedBuildConfig, RollupBuildConfig, RollupResolvedBuildConfig, RspackBuildConfig, RspackResolvedBuildConfig, TsdownBuildConfig, TsdownResolvedBuildConfig, TsupBuildConfig, TsupResolvedBuildConfig, UnbuildBuildConfig, UnbuildResolvedBuildConfig, ViteBuildConfig, ViteResolvedBuildConfig, WebpackBuildConfig, WebpackResolvedBuildConfig } from "./build.mjs";
|
|
2
2
|
import "./babel.mjs";
|
|
3
3
|
import { StoragePort, StoragePreset } from "./fs.mjs";
|
|
4
4
|
import { TSConfig } from "./tsconfig.mjs";
|
|
@@ -341,7 +341,7 @@ interface CommonUserConfig extends BaseConfig {
|
|
|
341
341
|
*/
|
|
342
342
|
framework?: string;
|
|
343
343
|
}
|
|
344
|
-
interface UserConfig<TBuildConfig extends BuildConfig = BuildConfig, TBuildResolvedConfig extends BuildResolvedConfig = BuildResolvedConfig, TBuildVariant extends string = any> extends Omit<CommonUserConfig, "build"> {
|
|
344
|
+
interface UserConfig$1<TBuildConfig extends BuildConfig = BuildConfig, TBuildResolvedConfig extends BuildResolvedConfig = BuildResolvedConfig, TBuildVariant extends string = any> extends Omit<CommonUserConfig, "build"> {
|
|
345
345
|
/**
|
|
346
346
|
* Configuration provided to build processes
|
|
347
347
|
*
|
|
@@ -362,15 +362,71 @@ interface UserConfig<TBuildConfig extends BuildConfig = BuildConfig, TBuildResol
|
|
|
362
362
|
override?: Partial<TBuildResolvedConfig>;
|
|
363
363
|
};
|
|
364
364
|
}
|
|
365
|
+
type WebpackUserConfig = UserConfig$1<WebpackBuildConfig, WebpackResolvedBuildConfig, "webpack">;
|
|
366
|
+
type RspackUserConfig = UserConfig$1<RspackBuildConfig, RspackResolvedBuildConfig, "rspack">;
|
|
367
|
+
type RollupUserConfig = UserConfig$1<RollupBuildConfig, RollupResolvedBuildConfig, "rollup">;
|
|
368
|
+
type RolldownUserConfig = UserConfig$1<RolldownBuildConfig, RolldownResolvedBuildConfig, "rolldown">;
|
|
369
|
+
type ViteUserConfig = UserConfig$1<ViteBuildConfig, ViteResolvedBuildConfig, "vite">;
|
|
370
|
+
type ESBuildUserConfig = UserConfig$1<ESBuildBuildConfig, ESBuildResolvedBuildConfig, "esbuild">;
|
|
371
|
+
type UnbuildUserConfig = UserConfig$1<UnbuildBuildConfig, UnbuildResolvedBuildConfig, "unbuild">;
|
|
372
|
+
type TsupUserConfig = UserConfig$1<TsupBuildConfig, TsupResolvedBuildConfig, "tsup">;
|
|
373
|
+
type TsdownUserConfig = UserConfig$1<TsdownBuildConfig, TsdownResolvedBuildConfig, "tsdown">;
|
|
374
|
+
type FarmUserConfig = UserConfig$1<FarmBuildConfig, FarmResolvedBuildConfig, "farm">;
|
|
365
375
|
type PowerlinesCommand = "new" | "prepare" | "build" | "lint" | "test" | "docs" | "deploy" | "clean";
|
|
366
376
|
/**
|
|
367
377
|
* The configuration provided while executing Powerlines commands.
|
|
368
378
|
*/
|
|
369
|
-
type InlineConfig<TUserConfig extends UserConfig = UserConfig> = Partial<TUserConfig> & {
|
|
379
|
+
type InlineConfig<TUserConfig extends UserConfig$1 = UserConfig$1> = Partial<TUserConfig> & {
|
|
370
380
|
/**
|
|
371
381
|
* A string identifier for the Powerlines command being executed
|
|
372
382
|
*/
|
|
373
383
|
command: PowerlinesCommand;
|
|
374
384
|
};
|
|
385
|
+
type NewInlineConfig<TUserConfig extends UserConfig$1 = UserConfig$1> = InlineConfig<TUserConfig> & Required<Pick<InlineConfig<TUserConfig>, "root">> & {
|
|
386
|
+
/**
|
|
387
|
+
* A string identifier for the Powerlines command being executed
|
|
388
|
+
*/
|
|
389
|
+
command: "new";
|
|
390
|
+
/**
|
|
391
|
+
* The package name (from the \`package.json\`) for the project that will be used in the \`new\` command to create a new project based on this configuration
|
|
392
|
+
*/
|
|
393
|
+
packageName?: string;
|
|
394
|
+
};
|
|
395
|
+
type CleanInlineConfig<TUserConfig extends UserConfig$1 = UserConfig$1> = InlineConfig<TUserConfig> & {
|
|
396
|
+
/**
|
|
397
|
+
* A string identifier for the Powerlines command being executed
|
|
398
|
+
*/
|
|
399
|
+
command: "clean";
|
|
400
|
+
};
|
|
401
|
+
type PrepareInlineConfig<TUserConfig extends UserConfig$1 = UserConfig$1> = InlineConfig<TUserConfig> & {
|
|
402
|
+
/**
|
|
403
|
+
* A string identifier for the Powerlines command being executed
|
|
404
|
+
*/
|
|
405
|
+
command: "prepare";
|
|
406
|
+
};
|
|
407
|
+
type BuildInlineConfig<TUserConfig extends UserConfig$1 = UserConfig$1> = InlineConfig<TUserConfig> & {
|
|
408
|
+
/**
|
|
409
|
+
* A string identifier for the Powerlines command being executed
|
|
410
|
+
*/
|
|
411
|
+
command: "build";
|
|
412
|
+
};
|
|
413
|
+
type LintInlineConfig<TUserConfig extends UserConfig$1 = UserConfig$1> = InlineConfig<TUserConfig> & {
|
|
414
|
+
/**
|
|
415
|
+
* A string identifier for the Powerlines command being executed
|
|
416
|
+
*/
|
|
417
|
+
command: "lint";
|
|
418
|
+
};
|
|
419
|
+
type DocsInlineConfig<TUserConfig extends UserConfig$1 = UserConfig$1> = InlineConfig<TUserConfig> & {
|
|
420
|
+
/**
|
|
421
|
+
* A string identifier for the Powerlines command being executed
|
|
422
|
+
*/
|
|
423
|
+
command: "docs";
|
|
424
|
+
};
|
|
425
|
+
type DeployInlineConfig<TUserConfig extends UserConfig$1 = UserConfig$1> = InlineConfig<TUserConfig> & {
|
|
426
|
+
/**
|
|
427
|
+
* A string identifier for the Powerlines command being executed
|
|
428
|
+
*/
|
|
429
|
+
command: "deploy";
|
|
430
|
+
};
|
|
375
431
|
//#endregion
|
|
376
|
-
export { EnvironmentConfig, InlineConfig, LogFn, OutputConfig, PluginConfig, UserConfig, WorkspaceConfig };
|
|
432
|
+
export { BuildInlineConfig, CleanInlineConfig, DeployInlineConfig, DocsInlineConfig, ESBuildUserConfig, EnvironmentConfig, FarmUserConfig, InlineConfig, LintInlineConfig, LogFn, NewInlineConfig, OutputConfig, PluginConfig, PrepareInlineConfig, RolldownUserConfig, RollupUserConfig, RspackUserConfig, TsdownUserConfig, TsupUserConfig, UnbuildUserConfig, UserConfig$1 as UserConfig, ViteUserConfig, WebpackUserConfig, WorkspaceConfig };
|