@powerlines/plugin-env 0.15.9 → 0.15.10
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/babel/plugin.cjs +1 -1
- package/dist/babel/plugin.mjs +1 -1
- package/dist/helpers/load.cjs +2 -2
- package/dist/helpers/load.mjs +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.mjs +2 -2
- package/dist/plugin-alloy/src/core/components/source-file.cjs +1 -1
- package/dist/plugin-alloy/src/core/components/source-file.mjs +1 -1
- package/dist/plugin-alloy/src/index.cjs +12 -5
- package/dist/plugin-alloy/src/index.mjs +12 -5
- package/dist/plugin-alloy/src/types/components.d.cts +1 -3
- package/dist/plugin-alloy/src/types/components.d.mts +2 -3
- package/dist/plugin-alloy/src/typescript/components/builtin-file.cjs +1 -1
- package/dist/plugin-alloy/src/typescript/components/builtin-file.mjs +1 -1
- package/dist/plugin-alloy/src/typescript/components/typescript-file.cjs +17 -11
- package/dist/plugin-alloy/src/typescript/components/typescript-file.d.cts +1 -0
- package/dist/plugin-alloy/src/typescript/components/typescript-file.d.mts +1 -0
- package/dist/plugin-alloy/src/typescript/components/typescript-file.mjs +17 -11
- package/dist/plugin-automd/src/index.cjs +2 -2
- package/dist/plugin-automd/src/index.mjs +1 -1
- package/dist/plugin-babel/src/helpers/module-helpers.cjs +1 -1
- package/dist/plugin-babel/src/helpers/module-helpers.mjs +1 -1
- package/dist/plugin-babel/src/index.cjs +4 -7
- package/dist/plugin-babel/src/index.mjs +2 -5
- package/dist/powerlines/src/api.d.mts +2 -2
- package/dist/powerlines/src/index.d.mts +8 -5
- package/dist/powerlines/src/internal/helpers/hooks.cjs +37 -19
- package/dist/powerlines/src/internal/helpers/hooks.d.cts +47 -0
- package/dist/powerlines/src/internal/helpers/hooks.d.mts +46 -2
- package/dist/powerlines/src/internal/helpers/hooks.mjs +37 -20
- package/dist/powerlines/src/lib/build/esbuild.cjs +2 -2
- package/dist/powerlines/src/lib/build/esbuild.mjs +2 -2
- package/dist/powerlines/src/lib/entry.cjs +1 -1
- package/dist/powerlines/src/lib/entry.mjs +1 -1
- package/dist/powerlines/src/types/api.cjs +62 -1
- package/dist/powerlines/src/types/api.d.cts +104 -0
- package/dist/powerlines/src/types/api.d.mts +104 -5
- package/dist/powerlines/src/types/api.mjs +61 -2
- package/dist/powerlines/src/types/build.cjs +26 -4
- package/dist/powerlines/src/types/build.d.cts +43 -3
- package/dist/powerlines/src/types/build.d.mts +42 -4
- package/dist/powerlines/src/types/build.mjs +23 -3
- package/dist/powerlines/src/types/config.cjs +107 -0
- package/dist/powerlines/src/types/config.d.cts +60 -4
- package/dist/powerlines/src/types/config.d.mts +61 -5
- package/dist/powerlines/src/types/config.mjs +99 -1
- package/dist/powerlines/src/types/context.cjs +57 -0
- 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/context.mjs +54 -1
- package/dist/powerlines/src/types/hooks.cjs +33 -14
- 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/hooks.mjs +32 -12
- package/dist/powerlines/src/types/index.cjs +3 -3
- package/dist/powerlines/src/types/index.d.mts +8 -8
- package/dist/powerlines/src/types/index.mjs +7 -7
- package/dist/powerlines/src/types/plugin.cjs +40 -105
- 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/plugin.mjs +40 -102
- package/dist/powerlines/src/types/resolved.d.cts +16 -4
- package/dist/powerlines/src/types/resolved.d.mts +16 -5
- package/dist/powerlines/src/types/unplugin.cjs +47 -1
- package/dist/powerlines/src/types/unplugin.d.cts +22 -0
- package/dist/powerlines/src/types/unplugin.d.mts +22 -6
- package/dist/powerlines/src/types/unplugin.mjs +45 -2
- package/package.json +9 -9
|
@@ -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 };
|
|
@@ -1,5 +1,49 @@
|
|
|
1
1
|
import "../../types/hooks.mjs";
|
|
2
|
-
import "../../types/context.mjs";
|
|
2
|
+
import { SelectHooksOptions } from "../../types/context.mjs";
|
|
3
3
|
import "../../types/resolved.mjs";
|
|
4
4
|
import { MaybePromise } from "@stryke/types/base";
|
|
5
|
-
|
|
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 };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { __ΩPluginContext, __ΩSelectHooksOptions } from "../../types/context.mjs";
|
|
1
|
+
import { __ΩEnvironmentContext, __ΩPluginContext, __ΩSelectHooksOptions } from "../../types/context.mjs";
|
|
2
2
|
import { __ΩInferHookParameters, __ΩInferHookReturnType } from "../../types/hooks.mjs";
|
|
3
|
-
import { createDefu, defu } from "defu";
|
|
4
3
|
import { LogLevelLabel } from "@storm-software/config-tools/types";
|
|
5
4
|
import { isFunction } from "@stryke/type-checks/is-function";
|
|
6
5
|
import { isObject } from "@stryke/type-checks/is-object";
|
|
7
6
|
import { isSet } from "@stryke/type-checks/is-set";
|
|
8
7
|
import { isString } from "@stryke/type-checks/is-string";
|
|
9
8
|
import chalk from "chalk";
|
|
9
|
+
import { createDefu, defu } from "defu";
|
|
10
10
|
|
|
11
11
|
//#region ../powerlines/src/internal/helpers/hooks.ts
|
|
12
12
|
function __assignType(fn, args) {
|
|
@@ -51,33 +51,51 @@ const mergeResults = createDefu(__assignType((obj, key, value) => {
|
|
|
51
51
|
* Calls a hook with the given context, options, and arguments.
|
|
52
52
|
*
|
|
53
53
|
* @param context - The context to use when calling the hook.
|
|
54
|
-
* @param
|
|
54
|
+
* @param key - The hook to call.
|
|
55
55
|
* @param options - Options for calling the hook.
|
|
56
56
|
* @param args - Arguments to pass to the hook.
|
|
57
57
|
* @returns The return value of the hook.
|
|
58
58
|
*/
|
|
59
|
-
async function callHook(context,
|
|
60
|
-
const
|
|
61
|
-
if (
|
|
62
|
-
context.log(LogLevelLabel.DEBUG, ` 🧩 Calling plugin hook: ${chalk.bold.cyanBright(`${
|
|
59
|
+
async function callHook(context, key, options, ...args) {
|
|
60
|
+
const hooks = context.selectHooks(key, options);
|
|
61
|
+
if (hooks.length > 0) {
|
|
62
|
+
context.log(LogLevelLabel.DEBUG, ` 🧩 Calling plugin hook: ${chalk.bold.cyanBright(`${key}${options?.order ? ` (${options.order})` : ""}`)}`);
|
|
63
|
+
const invokeHook = __assignType(async (hook, hookArgs) => {
|
|
64
|
+
return Reflect.apply(hook.handler, hook.context, hookArgs);
|
|
65
|
+
}, [
|
|
66
|
+
"hook",
|
|
67
|
+
() => __ΩInferHookParameters,
|
|
68
|
+
() => __ΩPluginContext,
|
|
69
|
+
() => context,
|
|
70
|
+
() => __ΩEnvironmentContext,
|
|
71
|
+
() => args,
|
|
72
|
+
() => __ΩInferHookParameters,
|
|
73
|
+
() => __ΩPluginContext,
|
|
74
|
+
() => args,
|
|
75
|
+
() => __ΩInferHookParameters,
|
|
76
|
+
() => __ΩPluginContext,
|
|
77
|
+
"hookArgs",
|
|
78
|
+
"",
|
|
79
|
+
"P!2!Pdi$h!!o%\"qe!!!jPdi&h!!o(\"\"o'#qe!!!jo#\"Pdi)\"o+\"h!!o*#qe!!!jo\"#2,\"/-"
|
|
80
|
+
]);
|
|
63
81
|
let results = [];
|
|
64
|
-
if (options?.sequential === false) results = await Promise.all(
|
|
65
|
-
if (!isFunction(handler
|
|
66
|
-
return
|
|
82
|
+
if (options?.sequential === false) results = await Promise.all(hooks.map(__assignType(async (hook) => {
|
|
83
|
+
if (!isFunction(hook.handler)) throw new Error(`Plugin hook handler for hook "${key}" is not a function.`);
|
|
84
|
+
return invokeHook(hook, [...args]);
|
|
67
85
|
}, [
|
|
68
|
-
"
|
|
86
|
+
"hook",
|
|
69
87
|
"",
|
|
70
88
|
"P\"2!\"/\""
|
|
71
89
|
])));
|
|
72
|
-
else for (const
|
|
73
|
-
if (!isFunction(handler
|
|
90
|
+
else for (const hook of hooks) {
|
|
91
|
+
if (!isFunction(hook.handler)) throw new Error(`Plugin hook handler for hook "${key}" is not a function.`);
|
|
74
92
|
if (options?.result === "first" || options?.asNextParam === false) {
|
|
75
|
-
results.push(await Promise.resolve(
|
|
93
|
+
results.push(await Promise.resolve(invokeHook(hook, [...args])));
|
|
76
94
|
if (options?.result === "first" && isSet(results[results.length - 1])) break;
|
|
77
95
|
} else {
|
|
78
96
|
const sequenceArgs = [...args];
|
|
79
97
|
if (results.length > 0 && sequenceArgs.length > 0) sequenceArgs[0] = isFunction(options.asNextParam) ? await Promise.resolve(options.asNextParam(results[0])) : results[0];
|
|
80
|
-
const result = await Promise.resolve(
|
|
98
|
+
const result = await Promise.resolve(invokeHook(hook, [...sequenceArgs]));
|
|
81
99
|
if (result) {
|
|
82
100
|
if (options?.result === "last") results = [result];
|
|
83
101
|
else if (isString(result)) results = [`${isString(results[0]) ? results[0] || "" : ""}\n${result || ""}`.trim()];
|
|
@@ -98,21 +116,20 @@ async function callHook(context, hook, options, ...args) {
|
|
|
98
116
|
}
|
|
99
117
|
}
|
|
100
118
|
callHook.__type = [
|
|
119
|
+
() => __ΩEnvironmentContext,
|
|
101
120
|
"context",
|
|
102
|
-
"
|
|
121
|
+
"key",
|
|
103
122
|
() => __ΩCallHookOptions,
|
|
104
123
|
"options",
|
|
105
124
|
() => __ΩInferHookParameters,
|
|
106
125
|
() => __ΩPluginContext,
|
|
107
|
-
"config",
|
|
108
126
|
"args",
|
|
109
127
|
() => __ΩInferHookReturnType,
|
|
110
128
|
() => __ΩPluginContext,
|
|
111
|
-
"config",
|
|
112
129
|
"callHook",
|
|
113
130
|
"Calls a hook with the given context, options, and arguments.",
|
|
114
|
-
"P\"
|
|
131
|
+
"P\"o!\"2\"\"2#n$2%\"o'\"\"o&#@2(P\"o*\"\"o)#-J`/+?,"
|
|
115
132
|
];
|
|
116
133
|
|
|
117
134
|
//#endregion
|
|
118
|
-
export {
|
|
135
|
+
export { __ΩCallHookOptions };
|
|
@@ -3,10 +3,10 @@ const require_context = require('../../types/context.cjs');
|
|
|
3
3
|
const require_build = require('../../types/build.cjs');
|
|
4
4
|
const require_entry = require('../entry.cjs');
|
|
5
5
|
let __stryke_path_replace = require("@stryke/path/replace");
|
|
6
|
-
let
|
|
6
|
+
let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
|
|
7
7
|
let defu = require("defu");
|
|
8
8
|
defu = require_rolldown_runtime.__toESM(defu);
|
|
9
|
-
let
|
|
9
|
+
let __stryke_path_join_paths = require("@stryke/path/join-paths");
|
|
10
10
|
let __stryke_helpers_omit = require("@stryke/helpers/omit");
|
|
11
11
|
let __stryke_string_format_camel_case = require("@stryke/string-format/camel-case");
|
|
12
12
|
|
|
@@ -2,9 +2,9 @@ import { __ΩContext } from "../../types/context.mjs";
|
|
|
2
2
|
import { __ΩESBuildResolvedBuildConfig } from "../../types/build.mjs";
|
|
3
3
|
import { resolveEntryInputFile, resolveEntryOutput } from "../entry.mjs";
|
|
4
4
|
import { replaceExtension, replacePath } from "@stryke/path/replace";
|
|
5
|
-
import { joinPaths } from "@stryke/path/join-paths";
|
|
6
|
-
import defu$1 from "defu";
|
|
7
5
|
import { isString } from "@stryke/type-checks/is-string";
|
|
6
|
+
import defu$1 from "defu";
|
|
7
|
+
import { joinPaths } from "@stryke/path/join-paths";
|
|
8
8
|
import { omit } from "@stryke/helpers/omit";
|
|
9
9
|
import { camelCase } from "@stryke/string-format/camel-case";
|
|
10
10
|
|
|
@@ -2,12 +2,12 @@ const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs
|
|
|
2
2
|
const require_resolved = require('../types/resolved.cjs');
|
|
3
3
|
const require_paths = require('../plugin-utils/paths.cjs');
|
|
4
4
|
let __stryke_path_replace = require("@stryke/path/replace");
|
|
5
|
+
let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
|
|
5
6
|
let __stryke_convert_to_array = require("@stryke/convert/to-array");
|
|
6
7
|
let __stryke_fs_is_file = require("@stryke/fs/is-file");
|
|
7
8
|
let __stryke_fs_list_files = require("@stryke/fs/list-files");
|
|
8
9
|
let __stryke_path_append = require("@stryke/path/append");
|
|
9
10
|
let __stryke_path_join_paths = require("@stryke/path/join-paths");
|
|
10
|
-
let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
|
|
11
11
|
let __stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
12
12
|
let __stryke_convert_parse_type_definition = require("@stryke/convert/parse-type-definition");
|
|
13
13
|
let __stryke_helpers_get_unique = require("@stryke/helpers/get-unique");
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { __ΩResolvedEntryTypeDefinition } from "../types/resolved.mjs";
|
|
2
2
|
import { replacePathTokens } from "../plugin-utils/paths.mjs";
|
|
3
3
|
import { replaceExtension, replacePath } from "@stryke/path/replace";
|
|
4
|
+
import { isString } from "@stryke/type-checks/is-string";
|
|
4
5
|
import { toArray } from "@stryke/convert/to-array";
|
|
5
6
|
import { isFile } from "@stryke/fs/is-file";
|
|
6
7
|
import { listFiles, listFilesSync } from "@stryke/fs/list-files";
|
|
7
8
|
import { appendPath } from "@stryke/path/append";
|
|
8
9
|
import { joinPaths } from "@stryke/path/join-paths";
|
|
9
|
-
import { isString } from "@stryke/type-checks/is-string";
|
|
10
10
|
import { isSetString } from "@stryke/type-checks/is-set-string";
|
|
11
11
|
import { parseTypeDefinition } from "@stryke/convert/parse-type-definition";
|
|
12
12
|
import { getUniqueBy } from "@stryke/helpers/get-unique";
|
|
@@ -1 +1,62 @@
|
|
|
1
|
-
require('
|
|
1
|
+
const require_config = require('./config.cjs');
|
|
2
|
+
const require_resolved = require('./resolved.cjs');
|
|
3
|
+
const require_hooks = require('./hooks.cjs');
|
|
4
|
+
const require_hooks$1 = require('../internal/helpers/hooks.cjs');
|
|
5
|
+
|
|
6
|
+
//#region ../powerlines/src/types/api.ts
|
|
7
|
+
const __ΩAPI = [
|
|
8
|
+
() => require_resolved.__ΩResolvedConfig,
|
|
9
|
+
"TResolvedConfig",
|
|
10
|
+
"APIContext",
|
|
11
|
+
"context",
|
|
12
|
+
"The Powerlines shared API context",
|
|
13
|
+
() => require_config.__ΩPrepareInlineConfig,
|
|
14
|
+
() => require_config.__ΩNewInlineConfig,
|
|
15
|
+
() => require_config.__ΩCleanInlineConfig,
|
|
16
|
+
() => require_config.__ΩBuildInlineConfig,
|
|
17
|
+
() => require_config.__ΩLintInlineConfig,
|
|
18
|
+
() => require_config.__ΩDocsInlineConfig,
|
|
19
|
+
() => require_config.__ΩDeployInlineConfig,
|
|
20
|
+
"inlineConfig",
|
|
21
|
+
"",
|
|
22
|
+
"prepare",
|
|
23
|
+
"Prepare the Powerlines API",
|
|
24
|
+
() => require_config.__ΩNewInlineConfig,
|
|
25
|
+
"new",
|
|
26
|
+
"Create a new Powerlines project",
|
|
27
|
+
() => require_config.__ΩCleanInlineConfig,
|
|
28
|
+
() => require_config.__ΩPrepareInlineConfig,
|
|
29
|
+
"clean",
|
|
30
|
+
"Clean any previously prepared artifacts",
|
|
31
|
+
() => require_config.__ΩLintInlineConfig,
|
|
32
|
+
"lint",
|
|
33
|
+
"Lint the project source code",
|
|
34
|
+
() => require_config.__ΩBuildInlineConfig,
|
|
35
|
+
"build",
|
|
36
|
+
"Build the project",
|
|
37
|
+
() => require_config.__ΩDocsInlineConfig,
|
|
38
|
+
"docs",
|
|
39
|
+
"Prepare the documentation for the project",
|
|
40
|
+
() => require_config.__ΩDeployInlineConfig,
|
|
41
|
+
"deploy",
|
|
42
|
+
"Deploy the project source code",
|
|
43
|
+
"finalize",
|
|
44
|
+
"Finalization process",
|
|
45
|
+
"hook",
|
|
46
|
+
() => require_hooks$1.__ΩCallHookOptions,
|
|
47
|
+
"EnvironmentContext",
|
|
48
|
+
"environment",
|
|
49
|
+
"options",
|
|
50
|
+
() => require_hooks.__ΩInferHookParameters,
|
|
51
|
+
"PluginContext",
|
|
52
|
+
"args",
|
|
53
|
+
() => require_hooks.__ΩInferHookReturnType,
|
|
54
|
+
"callHook",
|
|
55
|
+
"Invokes the configured plugin hooks",
|
|
56
|
+
"Powerlines API Interface",
|
|
57
|
+
"API",
|
|
58
|
+
"n!c\"P\"w#4$?%PPn&n'n(n)n*n+n,J2-$`/.4/?0Pn12-$`/.42?3PPn4n5J2-$`/.46?7Pn82-$`/.49?:Pn;2-$`/.4<?=Pn>2-$`/.4??@PnA2-$`/.4B?CP$`/.4D?EP\"2FPnGPP&\"wHJ4I8MK2J\"wL\"oK#@2MP\"wL\"oN#-J`/.4O?PM?QwRy"
|
|
59
|
+
];
|
|
60
|
+
|
|
61
|
+
//#endregion
|
|
62
|
+
exports.__ΩAPI = __ΩAPI;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { CallHookOptions } from "../internal/helpers/hooks.cjs";
|
|
2
|
+
import { InferHookParameters, InferHookReturnType } from "./hooks.cjs";
|
|
3
|
+
import { APIContext, EnvironmentContext, PluginContext } from "./context.cjs";
|
|
4
|
+
import { BuildInlineConfig, CleanInlineConfig, DeployInlineConfig, DocsInlineConfig, LintInlineConfig, NewInlineConfig, PrepareInlineConfig } from "./config.cjs";
|
|
5
|
+
import { ResolvedConfig } from "./resolved.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 };
|
|
@@ -1,5 +1,104 @@
|
|
|
1
|
-
import "
|
|
2
|
-
import "./
|
|
3
|
-
import "./
|
|
4
|
-
import "./
|
|
5
|
-
import "
|
|
1
|
+
import { CallHookOptions } from "../internal/helpers/hooks.mjs";
|
|
2
|
+
import { InferHookParameters, InferHookReturnType } from "./hooks.mjs";
|
|
3
|
+
import { APIContext, EnvironmentContext, PluginContext } from "./context.mjs";
|
|
4
|
+
import { BuildInlineConfig, CleanInlineConfig, DeployInlineConfig, DocsInlineConfig, LintInlineConfig, NewInlineConfig, PrepareInlineConfig } from "./config.mjs";
|
|
5
|
+
import { ResolvedConfig } from "./resolved.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,3 +1,62 @@
|
|
|
1
|
-
import "
|
|
1
|
+
import { __ΩBuildInlineConfig, __ΩCleanInlineConfig, __ΩDeployInlineConfig, __ΩDocsInlineConfig, __ΩLintInlineConfig, __ΩNewInlineConfig, __ΩPrepareInlineConfig } from "./config.mjs";
|
|
2
|
+
import { __ΩResolvedConfig } from "./resolved.mjs";
|
|
3
|
+
import { __ΩInferHookParameters, __ΩInferHookReturnType } from "./hooks.mjs";
|
|
4
|
+
import { __ΩCallHookOptions } from "../internal/helpers/hooks.mjs";
|
|
2
5
|
|
|
3
|
-
|
|
6
|
+
//#region ../powerlines/src/types/api.ts
|
|
7
|
+
const __ΩAPI = [
|
|
8
|
+
() => __ΩResolvedConfig,
|
|
9
|
+
"TResolvedConfig",
|
|
10
|
+
"APIContext",
|
|
11
|
+
"context",
|
|
12
|
+
"The Powerlines shared API context",
|
|
13
|
+
() => __ΩPrepareInlineConfig,
|
|
14
|
+
() => __ΩNewInlineConfig,
|
|
15
|
+
() => __ΩCleanInlineConfig,
|
|
16
|
+
() => __ΩBuildInlineConfig,
|
|
17
|
+
() => __ΩLintInlineConfig,
|
|
18
|
+
() => __ΩDocsInlineConfig,
|
|
19
|
+
() => __ΩDeployInlineConfig,
|
|
20
|
+
"inlineConfig",
|
|
21
|
+
"",
|
|
22
|
+
"prepare",
|
|
23
|
+
"Prepare the Powerlines API",
|
|
24
|
+
() => __ΩNewInlineConfig,
|
|
25
|
+
"new",
|
|
26
|
+
"Create a new Powerlines project",
|
|
27
|
+
() => __ΩCleanInlineConfig,
|
|
28
|
+
() => __ΩPrepareInlineConfig,
|
|
29
|
+
"clean",
|
|
30
|
+
"Clean any previously prepared artifacts",
|
|
31
|
+
() => __ΩLintInlineConfig,
|
|
32
|
+
"lint",
|
|
33
|
+
"Lint the project source code",
|
|
34
|
+
() => __ΩBuildInlineConfig,
|
|
35
|
+
"build",
|
|
36
|
+
"Build the project",
|
|
37
|
+
() => __ΩDocsInlineConfig,
|
|
38
|
+
"docs",
|
|
39
|
+
"Prepare the documentation for the project",
|
|
40
|
+
() => __ΩDeployInlineConfig,
|
|
41
|
+
"deploy",
|
|
42
|
+
"Deploy the project source code",
|
|
43
|
+
"finalize",
|
|
44
|
+
"Finalization process",
|
|
45
|
+
"hook",
|
|
46
|
+
() => __ΩCallHookOptions,
|
|
47
|
+
"EnvironmentContext",
|
|
48
|
+
"environment",
|
|
49
|
+
"options",
|
|
50
|
+
() => __ΩInferHookParameters,
|
|
51
|
+
"PluginContext",
|
|
52
|
+
"args",
|
|
53
|
+
() => __ΩInferHookReturnType,
|
|
54
|
+
"callHook",
|
|
55
|
+
"Invokes the configured plugin hooks",
|
|
56
|
+
"Powerlines API Interface",
|
|
57
|
+
"API",
|
|
58
|
+
"n!c\"P\"w#4$?%PPn&n'n(n)n*n+n,J2-$`/.4/?0Pn12-$`/.42?3PPn4n5J2-$`/.46?7Pn82-$`/.49?:Pn;2-$`/.4<?=Pn>2-$`/.4??@PnA2-$`/.4B?CP$`/.4D?EP\"2FPnGPP&\"wHJ4I8MK2J\"wL\"oK#@2MP\"wL\"oN#-J`/.4O?PM?QwRy"
|
|
59
|
+
];
|
|
60
|
+
|
|
61
|
+
//#endregion
|
|
62
|
+
export { __ΩAPI };
|
|
@@ -26,7 +26,7 @@ const __ΩExclude = [
|
|
|
26
26
|
"Exclude",
|
|
27
27
|
"l6!Re$!RPe#!e$\"qk#%QRb!b\"Pde\"!p)w#y"
|
|
28
28
|
];
|
|
29
|
-
const
|
|
29
|
+
const __ΩUnpluginBuilderVariant = [
|
|
30
30
|
"rollup",
|
|
31
31
|
"webpack",
|
|
32
32
|
"rspack",
|
|
@@ -34,7 +34,27 @@ const UNPLUGIN_BUILD_VARIANTS = [
|
|
|
34
34
|
"esbuild",
|
|
35
35
|
"farm",
|
|
36
36
|
"unloader",
|
|
37
|
-
"rolldown"
|
|
37
|
+
"rolldown",
|
|
38
|
+
"bun",
|
|
39
|
+
"UnpluginBuilderVariant",
|
|
40
|
+
"P.!.\".#.$.%.&.'.(.)Jw*y"
|
|
41
|
+
];
|
|
42
|
+
const UNPLUGIN_BUILDER_VARIANTS = [
|
|
43
|
+
"rollup",
|
|
44
|
+
"webpack",
|
|
45
|
+
"rspack",
|
|
46
|
+
"vite",
|
|
47
|
+
"esbuild",
|
|
48
|
+
"farm",
|
|
49
|
+
"unloader",
|
|
50
|
+
"rolldown",
|
|
51
|
+
"bun"
|
|
52
|
+
];
|
|
53
|
+
const BUILDER_VARIANTS = [
|
|
54
|
+
...UNPLUGIN_BUILDER_VARIANTS,
|
|
55
|
+
"tsup",
|
|
56
|
+
"tsdown",
|
|
57
|
+
"unbuild"
|
|
38
58
|
];
|
|
39
59
|
const __ΩBuildConfig = [
|
|
40
60
|
"node",
|
|
@@ -99,7 +119,9 @@ const __ΩESBuildResolvedBuildConfig = [
|
|
|
99
119
|
];
|
|
100
120
|
|
|
101
121
|
//#endregion
|
|
102
|
-
exports.
|
|
122
|
+
exports.BUILDER_VARIANTS = BUILDER_VARIANTS;
|
|
123
|
+
exports.UNPLUGIN_BUILDER_VARIANTS = UNPLUGIN_BUILDER_VARIANTS;
|
|
103
124
|
exports.__ΩBuildConfig = __ΩBuildConfig;
|
|
104
125
|
exports.__ΩBuildResolvedConfig = __ΩBuildResolvedConfig;
|
|
105
|
-
exports.__ΩESBuildResolvedBuildConfig = __ΩESBuildResolvedBuildConfig;
|
|
126
|
+
exports.__ΩESBuildResolvedBuildConfig = __ΩESBuildResolvedBuildConfig;
|
|
127
|
+
exports.__ΩUnpluginBuilderVariant = __ΩUnpluginBuilderVariant;
|