@powerlines/plugin-image-compression 0.2.171 → 0.2.173

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 (33) hide show
  1. package/dist/index.cjs +2 -2
  2. package/dist/index.d.cts +2 -1
  3. package/dist/index.d.mts +1 -1
  4. package/dist/index.mjs +1 -1
  5. package/dist/types/plugin.d.cts +3 -3
  6. package/dist/types/plugin.d.mts +3 -3
  7. package/package.json +3 -3
  8. package/dist/node_modules/.pnpm/@stryke_string-format@0.13.4/node_modules/@stryke/string-format/dist/pretty-bytes.cjs +0 -128
  9. package/dist/node_modules/.pnpm/@stryke_string-format@0.13.4/node_modules/@stryke/string-format/dist/pretty-bytes.mjs +0 -127
  10. package/dist/packages/powerlines/src/internal/helpers/hooks.d.mts +0 -47
  11. package/dist/packages/powerlines/src/types/api.d.mts +0 -104
  12. package/dist/packages/powerlines/src/types/build.d.mts +0 -185
  13. package/dist/packages/powerlines/src/types/commands.d.mts +0 -8
  14. package/dist/packages/powerlines/src/types/config.d.mts +0 -424
  15. package/dist/packages/powerlines/src/types/context.d.mts +0 -514
  16. package/dist/packages/powerlines/src/types/fs.d.mts +0 -486
  17. package/dist/packages/powerlines/src/types/hooks.d.mts +0 -32
  18. package/dist/packages/powerlines/src/types/plugin.d.mts +0 -205
  19. package/dist/packages/powerlines/src/types/resolved.d.mts +0 -93
  20. package/dist/packages/powerlines/src/types/tsconfig.d.mts +0 -69
  21. package/dist/packages/powerlines/src/types/unplugin.d.mts +0 -22
  22. package/dist/powerlines/src/internal/helpers/hooks.d.cts +0 -47
  23. package/dist/powerlines/src/types/api.d.cts +0 -104
  24. package/dist/powerlines/src/types/build.d.cts +0 -185
  25. package/dist/powerlines/src/types/commands.d.cts +0 -8
  26. package/dist/powerlines/src/types/config.d.cts +0 -424
  27. package/dist/powerlines/src/types/context.d.cts +0 -514
  28. package/dist/powerlines/src/types/fs.d.cts +0 -486
  29. package/dist/powerlines/src/types/hooks.d.cts +0 -32
  30. package/dist/powerlines/src/types/plugin.d.cts +0 -205
  31. package/dist/powerlines/src/types/resolved.d.cts +0 -93
  32. package/dist/powerlines/src/types/tsconfig.d.cts +0 -69
  33. package/dist/powerlines/src/types/unplugin.d.cts +0 -22
@@ -1,205 +0,0 @@
1
- import { BuilderVariant } from "./build.mjs";
2
- import { EnvironmentConfig, PluginConfig } from "./config.mjs";
3
- import { EnvironmentResolvedConfig, ResolvedConfig } from "./resolved.mjs";
4
- import { BuildPluginContext, PluginContext, UnresolvedContext } from "./context.mjs";
5
- import { CommandType } from "./commands.mjs";
6
- import { InferUnpluginOptions } from "./unplugin.mjs";
7
- import { ArrayValues } from "@stryke/types/array";
8
- import { AnyFunction, MaybePromise } from "@stryke/types/base";
9
- import { LoadResult } from "rollup";
10
- import { ExternalIdResult, HookFilter, TransformResult } from "unplugin";
11
-
12
- //#region ../powerlines/src/types/plugin.d.ts
13
- interface PluginHookObject<THookFunction extends AnyFunction, TFilter extends keyof HookFilter = never> {
14
- /**
15
- * The order in which the plugin should be applied.
16
- */
17
- order?: "pre" | "post" | null | undefined;
18
- /**
19
- * A filter to determine when the hook should be called.
20
- */
21
- filter?: Pick<HookFilter, TFilter>;
22
- /**
23
- * The hook function to be called.
24
- */
25
- handler: THookFunction;
26
- }
27
- type PluginHook<THookFunction extends AnyFunction, TFilter extends keyof HookFilter = never> = THookFunction | PluginHookObject<THookFunction, TFilter>;
28
- /**
29
- * A result returned by the plugin from the `types` hook that describes the declaration types output file.
30
- */
31
- interface TypesResult {
32
- directives?: string[];
33
- code: string;
34
- }
35
- type PluginHookFunctions<TContext extends PluginContext> = { [TCommandType in CommandType]: (this: TContext) => MaybePromise<void> } & {
36
- /**
37
- * A function that returns configuration options to be merged with the build context's options.
38
- *
39
- * @remarks
40
- * Modify config before it's resolved. The hook can either mutate {@link Context.config} on the passed-in context directly, or return a partial config object that will be deeply merged into existing config.
41
- *
42
- * @warning User plugins are resolved before running this hook so injecting other plugins inside the config hook will have no effect.
43
- *
44
- * @see https://vitejs.dev/guide/api-plugin#config
45
- *
46
- * @param this - The build context.
47
- * @param config - The partial configuration object to be modified.
48
- * @returns A promise that resolves to a partial configuration object.
49
- */
50
- config: (this: UnresolvedContext<TContext["config"]>) => MaybePromise<DeepPartial<TContext["config"]> & Record<string, any>>;
51
- /**
52
- * 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.
53
- *
54
- * @remarks
55
- * This hook is called for each environment with a partially resolved environment config that already accounts for the default environment config values set at the root level. If plugins need to modify the config of a given environment, they should do it in this hook instead of the config hook. Leaving the config hook only for modifying the root default environment config.
56
- *
57
- * @see https://vitejs.dev/guide/api-plugin#configenvironment
58
- *
59
- * @param this - The build context.
60
- * @param name - The name of the environment being configured.
61
- * @param environment - The Vite-like environment object containing information about the current build environment.
62
- * @returns A promise that resolves when the hook is complete.
63
- */
64
- configEnvironment: (this: TContext, name: string, environment: EnvironmentConfig) => MaybePromise<Partial<EnvironmentResolvedConfig> | undefined | null>;
65
- /**
66
- * A hook that is called when the plugin is resolved.
67
- *
68
- * @see https://vitejs.dev/guide/api-plugin#configresolved
69
- *
70
- * @param this - The build context.
71
- * @returns A promise that resolves when the hook is complete.
72
- */
73
- configResolved: (this: TContext) => MaybePromise<void>;
74
- /**
75
- * A hook that is called to overwrite the generated declaration types file (.d.ts). The generated type definitions should describe the built-in modules/logic added during the `prepare` task.
76
- *
77
- * @param this - The build context.
78
- * @param code - The source code to generate types for.
79
- * @returns A promise that resolves when the hook is complete.
80
- */
81
- types: (this: TContext, code: string) => MaybePromise<TypesResult | string | undefined | null>;
82
- /**
83
- * A hook that is called at the start of the build process.
84
- *
85
- * @param this - The build context and unplugin build context.
86
- * @returns A promise that resolves when the hook is complete.
87
- */
88
- buildStart: (this: BuildPluginContext<TContext["config"]> & TContext) => MaybePromise<void>;
89
- /**
90
- * A hook that is called at the end of the build process.
91
- *
92
- * @param this - The build context and unplugin build context.
93
- * @returns A promise that resolves when the hook is complete.
94
- */
95
- buildEnd: (this: BuildPluginContext<TContext["config"]> & TContext) => MaybePromise<void>;
96
- /**
97
- * A hook that is called to transform the source code.
98
- *
99
- * @param this - The build context, unplugin build context, and unplugin context.
100
- * @param code - The source code to transform.
101
- * @param id - The identifier of the source code.
102
- * @returns A promise that resolves when the hook is complete.
103
- */
104
- transform: (this: BuildPluginContext<TContext["config"]> & TContext, code: string, id: string) => MaybePromise<TransformResult>;
105
- /**
106
- * A hook that is called to load the source code.
107
- *
108
- * @param this - The build context, unplugin build context, and unplugin context.
109
- * @param id - The identifier of the source code.
110
- * @returns A promise that resolves when the hook is complete.
111
- */
112
- load: (this: BuildPluginContext<TContext["config"]> & TContext, id: string) => MaybePromise<LoadResult>;
113
- /**
114
- * A hook that is called to resolve the identifier of the source code.
115
- *
116
- * @param this - The build context, unplugin build context, and unplugin context.
117
- * @param id - The identifier of the source code.
118
- * @param importer - The importer of the source code.
119
- * @param options - The options for resolving the identifier.
120
- * @returns A promise that resolves when the hook is complete.
121
- */
122
- resolveId: (this: BuildPluginContext<TContext["config"]> & TContext, id: string, importer: string | undefined, options: {
123
- isEntry: boolean;
124
- }) => MaybePromise<string | ExternalIdResult | null | undefined>;
125
- /**
126
- * A hook that is called to write the bundle to disk.
127
- *
128
- * @param this - The build context.
129
- * @returns A promise that resolves when the hook is complete.
130
- */
131
- writeBundle: (this: TContext) => MaybePromise<void>;
132
- };
133
- type PluginHooks<TContext extends PluginContext> = { [TPluginHook in keyof PluginHookFunctions<TContext>]?: PluginHook<PluginHookFunctions<TContext>[TPluginHook]> } & {
134
- transform: PluginHook<PluginHookFunctions<TContext>["transform"], "code" | "id">;
135
- load: PluginHook<PluginHookFunctions<TContext>["load"], "id">;
136
- resolveId: PluginHook<PluginHookFunctions<TContext>["resolveId"], "id">;
137
- };
138
- type DeepPartial<T> = { [K in keyof T]?: DeepPartial<T[K]> };
139
- type Plugin<TContext extends PluginContext<ResolvedConfig> = PluginContext<ResolvedConfig>> = Partial<PluginHooks<TContext>> & {
140
- /**
141
- * The name of the plugin, for use in deduplication, error messages and logs.
142
- */
143
- name: string;
144
- /**
145
- * An API object that can be used for inter-plugin communication.
146
- *
147
- * @see https://rollupjs.org/plugin-development/#direct-plugin-communication
148
- */
149
- api?: Record<string, any>;
150
- /**
151
- * Enforce plugin invocation tier similar to webpack loaders. Hooks ordering is still subject to the `order` property in the hook object.
152
- *
153
- * @remarks
154
- * The Plugin invocation order is as follows:
155
- * - `enforce: 'pre'` plugins
156
- * - `order: 'pre'` plugin hooks
157
- * - any other plugins (normal)
158
- * - `order: 'post'` plugin hooks
159
- * - `enforce: 'post'` plugins
160
- *
161
- * @see https://vitejs.dev/guide/api-plugin.html#plugin-ordering
162
- * @see https://rollupjs.org/plugin-development/#build-hooks
163
- * @see https://webpack.js.org/concepts/loaders/#enforce---pre-and-post
164
- * @see https://esbuild.github.io/plugins/#concepts
165
- */
166
- enforce?: "pre" | "post";
167
- /**
168
- * A function to determine if two plugins are the same and can be de-duplicated.
169
- *
170
- * @remarks
171
- * If this is not provided, plugins are de-duplicated by comparing their names.
172
- *
173
- * @param other - The other plugin to compare against.
174
- * @returns `true` if the two plugins are the same, `false` otherwise.
175
- */
176
- dedupe?: false | ((other: Plugin<any>) => boolean);
177
- /**
178
- * A list of pre-requisite plugins that must be loaded before this plugin can be used.
179
- */
180
- /**
181
- * Define environments where this plugin should be active. By default, the plugin is active in all environments.
182
- *
183
- * @param environment - The environment to check.
184
- * @returns `true` if the plugin should be active in the specified environment, `false` otherwise.
185
- */
186
- applyToEnvironment?: (environment: EnvironmentResolvedConfig) => boolean | PluginConfig<TContext>;
187
- /**
188
- * A function that returns configuration options to be merged with the build context's options.
189
- *
190
- * @remarks
191
- * Modify config before it's resolved. The hook can either mutate {@link Context.config} on the passed-in context directly, or return a partial config object that will be deeply merged into existing config.
192
- *
193
- * @warning User plugins are resolved before running this hook so injecting other plugins inside the config hook will have no effect. If you want to add plugins, consider doing so in the {@link Plugin.dependsOn} property instead.
194
- *
195
- * @see https://vitejs.dev/guide/api-plugin#config
196
- *
197
- * @param this - The build context.
198
- * @param config - The partial configuration object to be modified.
199
- * @returns A promise that resolves to a partial configuration object.
200
- */
201
- config?: PluginHook<(this: UnresolvedContext<TContext["config"]>) => MaybePromise<DeepPartial<TContext["config"]> & Record<string, any>>> | (DeepPartial<TContext["config"]> & Record<string, any>);
202
- } & { [TBuilderVariant in BuilderVariant]?: InferUnpluginOptions<TContext, TBuilderVariant> };
203
- type PluginHookFields<TContext extends PluginContext = PluginContext> = keyof PluginHookFunctions<TContext>;
204
- //#endregion
205
- export { Plugin, PluginHook, PluginHookFields, PluginHookFunctions };
@@ -1,93 +0,0 @@
1
- import { BuilderVariant } from "./build.mjs";
2
- import { ESBuildUserConfig, EnvironmentConfig, FarmUserConfig, InlineConfig, LogLevel, OutputConfig, RolldownUserConfig, RollupUserConfig, RspackUserConfig, TsdownUserConfig, TsupUserConfig, UnbuildUserConfig, UserConfig as UserConfig$1, ViteUserConfig, WebpackUserConfig } from "./config.mjs";
3
- import { NonUndefined } from "@stryke/types/base";
4
- import { ResolvedPreviewOptions } from "vite";
5
- import { TypeDefinition } from "@stryke/types/configuration";
6
- import { AssetGlob } from "@stryke/types/file";
7
-
8
- //#region ../powerlines/src/types/resolved.d.ts
9
- interface ResolvedEntryTypeDefinition extends TypeDefinition {
10
- /**
11
- * The user provided entry point in the source code
12
- */
13
- input?: TypeDefinition;
14
- /**
15
- * An optional name to use in the package export during the build process
16
- */
17
- output?: string;
18
- }
19
- type EnvironmentResolvedConfig = Omit<EnvironmentConfig, "consumer" | "ssr" | "preview"> & Required<Pick<EnvironmentConfig, "consumer" | "ssr">> & {
20
- /**
21
- * The name of the environment
22
- */
23
- name: string;
24
- /**
25
- * Configuration options for the preview server
26
- */
27
- preview?: ResolvedPreviewOptions;
28
- };
29
- type ResolvedAssetGlob = AssetGlob & Required<Pick<AssetGlob, "input">>;
30
- type OutputResolvedConfig = Required<Omit<OutputConfig, "assets" | "storage"> & {
31
- assets: ResolvedAssetGlob[];
32
- }> & Pick<OutputConfig, "storage">;
33
- /**
34
- * The resolved options for the Powerlines project configuration.
35
- */
36
- type ResolvedConfig<TUserConfig extends UserConfig$1 = UserConfig$1> = Omit<TUserConfig, "name" | "title" | "organization" | "compatibilityDate" | "plugins" | "mode" | "environments" | "platform" | "tsconfig" | "lint" | "test" | "build" | "transform" | "deploy" | "variant" | "type" | "output" | "logLevel" | "framework" | "sourceRoot"> & Required<Pick<TUserConfig, "name" | "title" | "organization" | "compatibilityDate" | "plugins" | "mode" | "environments" | "tsconfig" | "lint" | "test" | "build" | "transform" | "deploy" | "framework" | "sourceRoot">> & {
37
- /**
38
- * The configuration options that were provided inline to the Powerlines CLI.
39
- */
40
- inlineConfig: InlineConfig<TUserConfig>;
41
- /**
42
- * The original configuration options that were provided by the user to the Powerlines process.
43
- */
44
- userConfig: TUserConfig;
45
- /**
46
- * A string identifier for the Powerlines command being executed.
47
- */
48
- command: NonUndefined<InlineConfig<TUserConfig>["command"]>;
49
- /**
50
- * The root directory of the project's source code
51
- *
52
- * @defaultValue "\{projectRoot\}/src"
53
- */
54
- sourceRoot: NonUndefined<TUserConfig["sourceRoot"]>;
55
- /**
56
- * The root directory of the project.
57
- */
58
- projectRoot: NonUndefined<TUserConfig["root"]>;
59
- /**
60
- * The type of project being built.
61
- */
62
- projectType: NonUndefined<TUserConfig["type"]>;
63
- /**
64
- * The output configuration options to use for the build process
65
- */
66
- output: OutputResolvedConfig;
67
- /**
68
- * Configuration provided to build processes
69
- *
70
- * @remarks
71
- * This configuration can be used by plugins during the `build` command. It will generally contain options specific to the selected {@link BuilderVariant | build variant}.
72
- */
73
- build: Omit<TUserConfig["build"], "override"> & Required<Pick<Required<TUserConfig["build"]>, "override">>;
74
- /**
75
- * The log level to use for the Powerlines processes.
76
- *
77
- * @defaultValue "info"
78
- */
79
- logLevel: LogLevel | null;
80
- };
81
- type ViteResolvedConfig = ResolvedConfig<ViteUserConfig>;
82
- type WebpackResolvedConfig = ResolvedConfig<WebpackUserConfig>;
83
- type RspackResolvedConfig = ResolvedConfig<RspackUserConfig>;
84
- type ESBuildResolvedConfig = ResolvedConfig<ESBuildUserConfig>;
85
- type RollupResolvedConfig = ResolvedConfig<RollupUserConfig>;
86
- type RolldownResolvedConfig = ResolvedConfig<RolldownUserConfig>;
87
- type TsupResolvedConfig = ResolvedConfig<TsupUserConfig>;
88
- type TsdownResolvedConfig = ResolvedConfig<TsdownUserConfig>;
89
- type UnbuildResolvedConfig = ResolvedConfig<UnbuildUserConfig>;
90
- type FarmResolvedConfig = ResolvedConfig<FarmUserConfig>;
91
- type InferResolvedConfig<TBuildVariant extends BuilderVariant | undefined> = TBuildVariant extends undefined ? ResolvedConfig : TBuildVariant extends "webpack" ? WebpackResolvedConfig : TBuildVariant extends "rspack" ? RspackResolvedConfig : TBuildVariant extends "vite" ? ViteResolvedConfig : TBuildVariant extends "esbuild" ? ESBuildResolvedConfig : TBuildVariant extends "unbuild" ? UnbuildResolvedConfig : TBuildVariant extends "tsup" ? TsupResolvedConfig : TBuildVariant extends "tsdown" ? TsdownResolvedConfig : TBuildVariant extends "rolldown" ? RolldownResolvedConfig : TBuildVariant extends "rollup" ? RollupResolvedConfig : TBuildVariant extends "farm" ? FarmResolvedConfig : ResolvedConfig;
92
- //#endregion
93
- export { EnvironmentResolvedConfig, InferResolvedConfig, ResolvedConfig, ResolvedEntryTypeDefinition };
@@ -1,69 +0,0 @@
1
- import { CompilerOptions, TsConfigJson } from "@stryke/types/tsconfig";
2
- import ts from "typescript";
3
-
4
- //#region ../powerlines/src/types/tsconfig.d.ts
5
- type ReflectionMode = "default" | "explicit" | "never";
6
- type RawReflectionMode = ReflectionMode | "" | boolean | string | string[] | undefined;
7
- /**
8
- * Defines the level of reflection to be used during the transpilation process.
9
- *
10
- * @remarks
11
- * The level determines how much extra data is captured in the byte code for each type. This can be one of the following values:
12
- * - `minimal` - Only the essential type information is captured.
13
- * - `normal` - Additional type information is captured, including some contextual data.
14
- * - `verbose` - All available type information is captured, including detailed contextual data.
15
- */
16
- type ReflectionLevel = "minimal" | "normal" | "verbose";
17
- interface DeepkitOptions {
18
- /**
19
- * Either true to activate reflection for all files compiled using this tsconfig,
20
- * or a list of globs/file paths relative to this tsconfig.json.
21
- * Globs/file paths can be prefixed with a ! to exclude them.
22
- */
23
- reflection?: RawReflectionMode;
24
- /**
25
- * Defines the level of reflection to be used during the transpilation process.
26
- *
27
- * @remarks
28
- * The level determines how much extra data is captured in the byte code for each type. This can be one of the following values:
29
- * - `minimal` - Only the essential type information is captured.
30
- * - `normal` - Additional type information is captured, including some contextual data.
31
- * - `verbose` - All available type information is captured, including detailed contextual data.
32
- */
33
- reflectionLevel?: ReflectionLevel;
34
- }
35
- type TSCompilerOptions = CompilerOptions & DeepkitOptions;
36
- /**
37
- * The TypeScript compiler configuration.
38
- *
39
- * @see https://www.typescriptlang.org/docs/handbook/tsconfig-json.html
40
- */
41
- interface TSConfig extends Omit<TsConfigJson, "reflection"> {
42
- /**
43
- * Either true to activate reflection for all files compiled using this tsconfig,
44
- * or a list of globs/file paths relative to this tsconfig.json.
45
- * Globs/file paths can be prefixed with a ! to exclude them.
46
- */
47
- reflection?: RawReflectionMode;
48
- /**
49
- * Defines the level of reflection to be used during the transpilation process.
50
- *
51
- * @remarks
52
- * The level determines how much extra data is captured in the byte code for each type. This can be one of the following values:
53
- * - `minimal` - Only the essential type information is captured.
54
- * - `normal` - Additional type information is captured, including some contextual data.
55
- * - `verbose` - All available type information is captured, including detailed contextual data.
56
- */
57
- reflectionLevel?: ReflectionLevel;
58
- /**
59
- * Instructs the TypeScript compiler how to compile `.ts` files.
60
- */
61
- compilerOptions?: TSCompilerOptions;
62
- }
63
- type ParsedTypeScriptConfig = ts.ParsedCommandLine & {
64
- originalTsconfigJson: TsConfigJson;
65
- tsconfigJson: TSConfig;
66
- tsconfigFilePath: string;
67
- };
68
- //#endregion
69
- export { ParsedTypeScriptConfig, TSConfig };
@@ -1,22 +0,0 @@
1
- import { BuilderVariant, InferUnpluginVariant, UnpluginBuilderVariant } from "./build.mjs";
2
- import { InferResolvedConfig } from "./resolved.mjs";
3
- import { Context } from "./context.mjs";
4
- import { API } from "./api.mjs";
5
- import { PluginHook } from "./plugin.mjs";
6
- import { MaybePromise } from "@stryke/types/base";
7
- import { HookFilter, UnpluginOptions } from "unplugin";
8
-
9
- //#region ../powerlines/src/types/unplugin.d.ts
10
- interface UnpluginOptions$1<TUnpluginBuilderVariant extends UnpluginBuilderVariant = UnpluginBuilderVariant> extends UnpluginOptions {
11
- /**
12
- * An API object that can be used for inter-plugin communication.
13
- *
14
- * @see https://rollupjs.org/plugin-development/#direct-plugin-communication
15
- */
16
- api: API<InferResolvedConfig<TUnpluginBuilderVariant>>;
17
- }
18
- type InferUnpluginOptions<TContext extends Context = Context, TBuilderVariant extends BuilderVariant = BuilderVariant, TUnpluginVariant extends InferUnpluginVariant<TBuilderVariant> = InferUnpluginVariant<TBuilderVariant>> = { [TKey in keyof Required<UnpluginOptions$1<TUnpluginVariant>>[TUnpluginVariant]]?: Required<UnpluginOptions$1<TUnpluginVariant>>[TUnpluginVariant][TKey] extends infer THandler | {
19
- handler: infer THandler;
20
- } ? THandler extends ((this: infer TOriginalContext, ...args: infer TArgs) => infer TReturn) ? PluginHook<(this: TOriginalContext & TContext, ...args: TArgs) => MaybePromise<TReturn>, keyof HookFilter> : Required<UnpluginOptions$1<TUnpluginVariant>>[TUnpluginVariant][TKey] : Required<UnpluginOptions$1<TUnpluginVariant>>[TUnpluginVariant][TKey] };
21
- //#endregion
22
- export { InferUnpluginOptions };
@@ -1,47 +0,0 @@
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 };
@@ -1,104 +0,0 @@
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 };