@powerlines/plugin-webpack 0.5.239 → 0.5.241
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/helpers/unplugin.cjs +3 -2
- package/dist/helpers/unplugin.mjs +2 -1
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +2 -3
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +3 -3
- package/dist/powerlines/package.cjs +11 -0
- package/dist/powerlines/package.mjs +5 -0
- package/dist/powerlines/schemas/fs.cjs +226 -0
- package/dist/powerlines/schemas/fs.mjs +224 -0
- package/dist/powerlines/src/api.cjs +568 -0
- package/dist/powerlines/src/api.mjs +566 -0
- package/dist/powerlines/src/internal/helpers/environment.cjs +50 -0
- package/dist/powerlines/src/internal/helpers/environment.mjs +47 -0
- package/dist/powerlines/src/internal/helpers/generate-types.cjs +78 -0
- package/dist/powerlines/src/internal/helpers/generate-types.mjs +76 -0
- package/dist/powerlines/src/internal/helpers/hooks.cjs +65 -0
- 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/internal/helpers/hooks.mjs +63 -0
- package/dist/powerlines/src/internal/helpers/install-dependencies.cjs +24 -0
- package/dist/powerlines/src/internal/helpers/install-dependencies.mjs +23 -0
- package/dist/powerlines/src/internal/helpers/install.cjs +36 -0
- package/dist/powerlines/src/internal/helpers/install.mjs +35 -0
- package/dist/powerlines/src/internal/helpers/resolve-tsconfig.cjs +97 -0
- package/dist/powerlines/src/internal/helpers/resolve-tsconfig.mjs +93 -0
- package/dist/powerlines/src/internal/helpers/resolver.cjs +43 -0
- package/dist/powerlines/src/internal/helpers/resolver.mjs +41 -0
- package/dist/powerlines/src/lib/build/webpack.cjs +38 -0
- package/dist/powerlines/src/lib/build/webpack.mjs +36 -0
- package/dist/powerlines/src/lib/config-file.cjs +79 -0
- package/dist/powerlines/src/lib/config-file.mjs +76 -0
- package/dist/powerlines/src/lib/constants/environments.cjs +8 -0
- package/dist/powerlines/src/lib/constants/environments.mjs +6 -0
- package/dist/powerlines/src/lib/contexts/api-context.cjs +184 -0
- package/dist/powerlines/src/lib/contexts/api-context.mjs +182 -0
- package/dist/powerlines/src/lib/contexts/context.cjs +951 -0
- package/dist/powerlines/src/lib/contexts/context.mjs +949 -0
- package/dist/powerlines/src/lib/contexts/environment-context.cjs +195 -0
- package/dist/powerlines/src/lib/contexts/environment-context.mjs +194 -0
- package/dist/powerlines/src/lib/contexts/plugin-context.cjs +78 -0
- package/dist/powerlines/src/lib/contexts/plugin-context.mjs +77 -0
- package/dist/powerlines/src/lib/entry.cjs +85 -0
- package/dist/powerlines/src/lib/entry.mjs +83 -0
- package/dist/powerlines/src/lib/fs/helpers.cjs +85 -0
- package/dist/powerlines/src/lib/fs/helpers.mjs +81 -0
- package/dist/powerlines/src/lib/fs/storage/base.cjs +196 -0
- package/dist/powerlines/src/lib/fs/storage/base.mjs +195 -0
- package/dist/powerlines/src/lib/fs/storage/file-system.cjs +170 -0
- package/dist/powerlines/src/lib/fs/storage/file-system.mjs +169 -0
- package/dist/powerlines/src/lib/fs/storage/virtual.cjs +88 -0
- package/dist/powerlines/src/lib/fs/storage/virtual.mjs +87 -0
- package/dist/powerlines/src/lib/fs/vfs.cjs +912 -0
- package/dist/powerlines/src/lib/fs/vfs.mjs +910 -0
- package/dist/powerlines/src/lib/logger.cjs +58 -0
- package/dist/powerlines/src/lib/logger.mjs +55 -0
- package/dist/powerlines/src/lib/typescript/ts-morph.cjs +103 -0
- package/dist/powerlines/src/lib/typescript/ts-morph.mjs +101 -0
- package/dist/powerlines/src/lib/typescript/tsconfig.cjs +149 -0
- package/dist/powerlines/src/lib/typescript/tsconfig.mjs +144 -0
- package/dist/powerlines/src/lib/unplugin/factory.cjs +6 -0
- package/dist/powerlines/src/lib/unplugin/factory.mjs +8 -0
- package/dist/powerlines/src/lib/unplugin/helpers.cjs +29 -0
- package/dist/powerlines/src/lib/unplugin/helpers.mjs +27 -0
- package/dist/powerlines/src/lib/unplugin/index.cjs +4 -0
- package/dist/powerlines/src/lib/unplugin/index.mjs +6 -0
- package/dist/powerlines/src/lib/unplugin/module-resolution.cjs +66 -0
- package/dist/powerlines/src/lib/unplugin/module-resolution.mjs +65 -0
- package/dist/powerlines/src/lib/unplugin/plugin.cjs +71 -0
- package/dist/powerlines/src/lib/unplugin/plugin.mjs +70 -0
- package/dist/powerlines/src/lib/utilities/file-header.cjs +22 -0
- package/dist/powerlines/src/lib/utilities/file-header.mjs +21 -0
- package/dist/powerlines/src/lib/utilities/format.cjs +48 -0
- package/dist/powerlines/src/lib/utilities/format.mjs +46 -0
- package/dist/powerlines/src/lib/utilities/meta.cjs +44 -0
- package/dist/powerlines/src/lib/utilities/meta.mjs +40 -0
- package/dist/powerlines/src/lib/utilities/source-file.cjs +22 -0
- package/dist/powerlines/src/lib/utilities/source-file.mjs +21 -0
- package/dist/powerlines/src/plugin-utils/helpers.cjs +167 -0
- package/dist/powerlines/src/plugin-utils/helpers.mjs +156 -0
- package/dist/powerlines/src/plugin-utils/paths.cjs +36 -0
- package/dist/powerlines/src/plugin-utils/paths.mjs +35 -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/babel.d.mts +2 -0
- package/dist/powerlines/src/types/build.cjs +23 -0
- package/dist/powerlines/src/types/build.d.cts +185 -0
- package/dist/powerlines/src/types/build.d.mts +185 -0
- package/dist/powerlines/src/types/build.mjs +21 -0
- package/dist/powerlines/src/types/commands.cjs +16 -0
- package/dist/powerlines/src/types/commands.d.cts +8 -0
- package/dist/powerlines/src/types/commands.d.mts +9 -0
- package/dist/powerlines/src/types/commands.mjs +15 -0
- package/dist/powerlines/src/types/config.d.cts +424 -0
- package/dist/powerlines/src/types/config.d.mts +425 -0
- package/dist/powerlines/src/types/context.d.cts +514 -0
- package/dist/powerlines/src/types/context.d.mts +514 -0
- package/dist/powerlines/src/types/fs.d.cts +486 -0
- package/dist/powerlines/src/types/fs.d.mts +486 -0
- package/dist/powerlines/src/types/hooks.d.cts +32 -0
- package/dist/powerlines/src/types/hooks.d.mts +32 -0
- package/dist/powerlines/src/types/plugin.cjs +33 -0
- package/dist/powerlines/src/types/plugin.d.cts +205 -0
- package/dist/powerlines/src/types/plugin.d.mts +205 -0
- package/dist/powerlines/src/types/plugin.mjs +32 -0
- package/dist/powerlines/src/types/resolved.d.cts +93 -0
- package/dist/powerlines/src/types/resolved.d.mts +93 -0
- package/dist/powerlines/src/types/tsconfig.d.cts +69 -0
- package/dist/powerlines/src/types/tsconfig.d.mts +69 -0
- package/dist/powerlines/src/types/unplugin.d.cts +22 -0
- package/dist/powerlines/src/types/unplugin.d.mts +23 -0
- package/dist/types/plugin.d.cts +3 -3
- package/dist/types/plugin.d.mts +3 -3
- package/package.json +4 -4
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_build = require('../types/build.cjs');
|
|
3
|
+
const require_plugin = require('../types/plugin.cjs');
|
|
4
|
+
let __stryke_type_checks_is_function = require("@stryke/type-checks/is-function");
|
|
5
|
+
let __stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
|
|
6
|
+
let __stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
7
|
+
let __stryke_type_checks_is_undefined = require("@stryke/type-checks/is-undefined");
|
|
8
|
+
|
|
9
|
+
//#region ../powerlines/src/plugin-utils/helpers.ts
|
|
10
|
+
/**
|
|
11
|
+
* Type guard to check if an object is a {@link Plugin}
|
|
12
|
+
*
|
|
13
|
+
* @param value - The object to check
|
|
14
|
+
* @returns True if the object is a {@link Plugin}, false otherwise
|
|
15
|
+
*/
|
|
16
|
+
function isPlugin(value) {
|
|
17
|
+
return (0, __stryke_type_checks_is_set_object.isSetObject)(value) && "name" in value && (0, __stryke_type_checks_is_set_string.isSetString)(value.name) && ((0, __stryke_type_checks_is_undefined.isUndefined)(value.api) || "api" in value && (0, __stryke_type_checks_is_set_object.isSetObject)(value.api)) && ((0, __stryke_type_checks_is_undefined.isUndefined)(value.applyToEnvironment) || "applyToEnvironment" in value && (0, __stryke_type_checks_is_function.isFunction)(value.applyToEnvironment)) && ((0, __stryke_type_checks_is_undefined.isUndefined)(value.dedupe) || "dedupe" in value && (0, __stryke_type_checks_is_function.isFunction)(value.dedupe)) && require_plugin.PLUGIN_HOOKS_FIELDS.every((hook) => (0, __stryke_type_checks_is_undefined.isUndefined)(value[hook]) || hook in value && (isPluginHookFunction(value[hook]) || hook === "config" && (0, __stryke_type_checks_is_set_object.isSetObject)(value[hook]))) && require_build.BUILDER_VARIANTS.every((variant) => (0, __stryke_type_checks_is_undefined.isUndefined)(value[variant]) || variant in value && (0, __stryke_type_checks_is_set_object.isSetObject)(value[variant]));
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Type guard to check if an object is a {@link PluginConfigObject}
|
|
21
|
+
*
|
|
22
|
+
* @param value - The object to check
|
|
23
|
+
* @returns True if the object is a {@link PluginConfigObject}, false otherwise
|
|
24
|
+
*/
|
|
25
|
+
function isPluginConfigObject(value) {
|
|
26
|
+
return (0, __stryke_type_checks_is_set_object.isSetObject)(value) && "plugin" in value && (((0, __stryke_type_checks_is_set_string.isSetString)(value.plugin) || (0, __stryke_type_checks_is_function.isFunction)(value.plugin)) && "options" in value && (0, __stryke_type_checks_is_set_object.isSetObject)(value.options) || isPlugin(value.plugin));
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Type guard to check if an object is a {@link PluginConfigTuple}
|
|
30
|
+
*
|
|
31
|
+
* @param value - The object to check
|
|
32
|
+
* @returns True if the object is a {@link PluginConfigTuple}, false otherwise
|
|
33
|
+
*/
|
|
34
|
+
function isPluginConfigTuple(value) {
|
|
35
|
+
return Array.isArray(value) && (value.length === 1 || value.length === 2) && (((0, __stryke_type_checks_is_set_string.isSetString)(value[0]) || (0, __stryke_type_checks_is_function.isFunction)(value[0])) && value.length > 1 && (0, __stryke_type_checks_is_set_object.isSetObject)(value[1]) || isPlugin(value[0]));
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Type guard to check if an object is a {@link PluginConfig}
|
|
39
|
+
*
|
|
40
|
+
* @param value - The object to check
|
|
41
|
+
* @returns True if the object is a {@link PluginConfig}, false otherwise
|
|
42
|
+
*/
|
|
43
|
+
function isPluginConfig(value) {
|
|
44
|
+
return (0, __stryke_type_checks_is_set_string.isSetString)(value) || (0, __stryke_type_checks_is_function.isFunction)(value) || isPlugin(value) || isPluginConfigObject(value) || isPluginConfigTuple(value) || Array.isArray(value) && value.every((item) => isPluginConfig(item));
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Type guard to check if an value is a {@link PluginHook} function
|
|
48
|
+
*
|
|
49
|
+
* @param value - The value to check
|
|
50
|
+
* @returns True if the value is a {@link PluginHook} function, false otherwise
|
|
51
|
+
*/
|
|
52
|
+
function isPluginHookObject(value) {
|
|
53
|
+
return (0, __stryke_type_checks_is_set_object.isSetObject)(value) && "handler" in value && (0, __stryke_type_checks_is_function.isFunction)(value.handler);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Type guard to check if an value is a {@link PluginHook} function
|
|
57
|
+
*
|
|
58
|
+
* @param value - The value to check
|
|
59
|
+
* @returns True if the value is a {@link PluginHook} function, false otherwise
|
|
60
|
+
*/
|
|
61
|
+
function isPluginHookFunction(value) {
|
|
62
|
+
return (0, __stryke_type_checks_is_function.isFunction)(value) || isPluginHookObject(value);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Type guard to check if an object is a {@link PluginHook}
|
|
66
|
+
*
|
|
67
|
+
* @param value - The object to check
|
|
68
|
+
* @returns True if the object is a {@link PluginHook}, false otherwise
|
|
69
|
+
*/
|
|
70
|
+
function isPluginHook(value) {
|
|
71
|
+
return isPluginHookFunction(value) || isPluginHookObject(value);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Extract the hook handler function from a plugin hook
|
|
75
|
+
*
|
|
76
|
+
* @param pluginHook - The plugin hook to extract the handler function from
|
|
77
|
+
* @returns The hook handler function
|
|
78
|
+
*/
|
|
79
|
+
function getHookHandler(pluginHook) {
|
|
80
|
+
return (0, __stryke_type_checks_is_function.isFunction)(pluginHook) ? pluginHook : pluginHook.handler;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Check if a hook is external.
|
|
84
|
+
*
|
|
85
|
+
* @param keys - The name of the hook to check.
|
|
86
|
+
* @returns True if the hook is external, false otherwise.
|
|
87
|
+
*/
|
|
88
|
+
function isUnpluginHookKey(keys) {
|
|
89
|
+
return require_build.UNPLUGIN_BUILDER_VARIANTS.some((variant) => keys.startsWith(`${variant}:`));
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Check if a hook is internal.
|
|
93
|
+
*
|
|
94
|
+
* @param keys - The name of the hook to check.
|
|
95
|
+
* @returns True if the hook is external, false otherwise.
|
|
96
|
+
*/
|
|
97
|
+
function isPluginHookField(keys) {
|
|
98
|
+
return !isUnpluginHookKey(keys) && require_plugin.PLUGIN_HOOKS_FIELDS.includes(keys);
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Check if a hook is external.
|
|
102
|
+
*
|
|
103
|
+
* @param field - The name of the hook to check.
|
|
104
|
+
* @returns True if the hook is external, false otherwise.
|
|
105
|
+
*/
|
|
106
|
+
function isUnpluginHookField(field) {
|
|
107
|
+
return !isPluginHookField(field) && require_build.UNPLUGIN_BUILDER_VARIANTS.includes(field);
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Check if a plugin should be deduplicated.
|
|
111
|
+
*
|
|
112
|
+
* @param plugin - The plugin to check
|
|
113
|
+
* @param plugins - The list of plugins to check against
|
|
114
|
+
* @returns True if the plugin should be deduplicated, false otherwise
|
|
115
|
+
*/
|
|
116
|
+
function checkDedupe(plugin, plugins) {
|
|
117
|
+
return plugin.dedupe === false || plugins.some((p) => p.dedupe !== false && ((0, __stryke_type_checks_is_function.isFunction)(p.dedupe) && p.dedupe(plugin) || p.name === plugin.name));
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Add a plugin hook to the hooks list.
|
|
121
|
+
*
|
|
122
|
+
* @param context - The plugin context
|
|
123
|
+
* @param plugin - The plugin to add the hook from
|
|
124
|
+
* @param pluginHook - The plugin hook to add
|
|
125
|
+
* @param hooksList - The list of hooks to add to
|
|
126
|
+
*/
|
|
127
|
+
function addPluginHook(context, plugin, pluginHook, hooksList) {
|
|
128
|
+
if (!checkDedupe(plugin, hooksList.map((hook) => hook.plugin).filter(Boolean))) {
|
|
129
|
+
const handler = ((...args) => getHookHandler(pluginHook).apply(context, args));
|
|
130
|
+
if (!handler) return;
|
|
131
|
+
hooksList.push({
|
|
132
|
+
plugin,
|
|
133
|
+
handler
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Check the provided {@link PluginConfig}, and return a stringified version of the invalid configuration. If an array is provided, check each item in the array.
|
|
139
|
+
*
|
|
140
|
+
* @param config - The plugin configuration to check
|
|
141
|
+
* @returns Null if the configuration is valid, otherwise an array of stringified invalid configurations
|
|
142
|
+
*/
|
|
143
|
+
function findInvalidPluginConfig(config) {
|
|
144
|
+
if (isPluginConfig(config)) return null;
|
|
145
|
+
if (Array.isArray(config)) {
|
|
146
|
+
const invalidItems = [];
|
|
147
|
+
config.forEach((item) => {
|
|
148
|
+
const invalid = findInvalidPluginConfig(item);
|
|
149
|
+
if (invalid) invalidItems.push(...invalid.map((i) => JSON.stringify(i, null, 2)));
|
|
150
|
+
});
|
|
151
|
+
return invalidItems.length > 0 ? invalidItems : null;
|
|
152
|
+
}
|
|
153
|
+
return [JSON.stringify(config, null, 2)];
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
//#endregion
|
|
157
|
+
exports.addPluginHook = addPluginHook;
|
|
158
|
+
exports.checkDedupe = checkDedupe;
|
|
159
|
+
exports.findInvalidPluginConfig = findInvalidPluginConfig;
|
|
160
|
+
exports.isPlugin = isPlugin;
|
|
161
|
+
exports.isPluginConfig = isPluginConfig;
|
|
162
|
+
exports.isPluginConfigObject = isPluginConfigObject;
|
|
163
|
+
exports.isPluginConfigTuple = isPluginConfigTuple;
|
|
164
|
+
exports.isPluginHook = isPluginHook;
|
|
165
|
+
exports.isPluginHookField = isPluginHookField;
|
|
166
|
+
exports.isUnpluginHookField = isUnpluginHookField;
|
|
167
|
+
exports.isUnpluginHookKey = isUnpluginHookKey;
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { BUILDER_VARIANTS, UNPLUGIN_BUILDER_VARIANTS } from "../types/build.mjs";
|
|
2
|
+
import { PLUGIN_HOOKS_FIELDS } from "../types/plugin.mjs";
|
|
3
|
+
import { isFunction } from "@stryke/type-checks/is-function";
|
|
4
|
+
import { isSetObject } from "@stryke/type-checks/is-set-object";
|
|
5
|
+
import { isSetString } from "@stryke/type-checks/is-set-string";
|
|
6
|
+
import { isUndefined } from "@stryke/type-checks/is-undefined";
|
|
7
|
+
|
|
8
|
+
//#region ../powerlines/src/plugin-utils/helpers.ts
|
|
9
|
+
/**
|
|
10
|
+
* Type guard to check if an object is a {@link Plugin}
|
|
11
|
+
*
|
|
12
|
+
* @param value - The object to check
|
|
13
|
+
* @returns True if the object is a {@link Plugin}, false otherwise
|
|
14
|
+
*/
|
|
15
|
+
function isPlugin(value) {
|
|
16
|
+
return isSetObject(value) && "name" in value && isSetString(value.name) && (isUndefined(value.api) || "api" in value && isSetObject(value.api)) && (isUndefined(value.applyToEnvironment) || "applyToEnvironment" in value && isFunction(value.applyToEnvironment)) && (isUndefined(value.dedupe) || "dedupe" in value && isFunction(value.dedupe)) && PLUGIN_HOOKS_FIELDS.every((hook) => isUndefined(value[hook]) || hook in value && (isPluginHookFunction(value[hook]) || hook === "config" && isSetObject(value[hook]))) && BUILDER_VARIANTS.every((variant) => isUndefined(value[variant]) || variant in value && isSetObject(value[variant]));
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Type guard to check if an object is a {@link PluginConfigObject}
|
|
20
|
+
*
|
|
21
|
+
* @param value - The object to check
|
|
22
|
+
* @returns True if the object is a {@link PluginConfigObject}, false otherwise
|
|
23
|
+
*/
|
|
24
|
+
function isPluginConfigObject(value) {
|
|
25
|
+
return isSetObject(value) && "plugin" in value && ((isSetString(value.plugin) || isFunction(value.plugin)) && "options" in value && isSetObject(value.options) || isPlugin(value.plugin));
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Type guard to check if an object is a {@link PluginConfigTuple}
|
|
29
|
+
*
|
|
30
|
+
* @param value - The object to check
|
|
31
|
+
* @returns True if the object is a {@link PluginConfigTuple}, false otherwise
|
|
32
|
+
*/
|
|
33
|
+
function isPluginConfigTuple(value) {
|
|
34
|
+
return Array.isArray(value) && (value.length === 1 || value.length === 2) && ((isSetString(value[0]) || isFunction(value[0])) && value.length > 1 && isSetObject(value[1]) || isPlugin(value[0]));
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Type guard to check if an object is a {@link PluginConfig}
|
|
38
|
+
*
|
|
39
|
+
* @param value - The object to check
|
|
40
|
+
* @returns True if the object is a {@link PluginConfig}, false otherwise
|
|
41
|
+
*/
|
|
42
|
+
function isPluginConfig(value) {
|
|
43
|
+
return isSetString(value) || isFunction(value) || isPlugin(value) || isPluginConfigObject(value) || isPluginConfigTuple(value) || Array.isArray(value) && value.every((item) => isPluginConfig(item));
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Type guard to check if an value is a {@link PluginHook} function
|
|
47
|
+
*
|
|
48
|
+
* @param value - The value to check
|
|
49
|
+
* @returns True if the value is a {@link PluginHook} function, false otherwise
|
|
50
|
+
*/
|
|
51
|
+
function isPluginHookObject(value) {
|
|
52
|
+
return isSetObject(value) && "handler" in value && isFunction(value.handler);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Type guard to check if an value is a {@link PluginHook} function
|
|
56
|
+
*
|
|
57
|
+
* @param value - The value to check
|
|
58
|
+
* @returns True if the value is a {@link PluginHook} function, false otherwise
|
|
59
|
+
*/
|
|
60
|
+
function isPluginHookFunction(value) {
|
|
61
|
+
return isFunction(value) || isPluginHookObject(value);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Type guard to check if an object is a {@link PluginHook}
|
|
65
|
+
*
|
|
66
|
+
* @param value - The object to check
|
|
67
|
+
* @returns True if the object is a {@link PluginHook}, false otherwise
|
|
68
|
+
*/
|
|
69
|
+
function isPluginHook(value) {
|
|
70
|
+
return isPluginHookFunction(value) || isPluginHookObject(value);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Extract the hook handler function from a plugin hook
|
|
74
|
+
*
|
|
75
|
+
* @param pluginHook - The plugin hook to extract the handler function from
|
|
76
|
+
* @returns The hook handler function
|
|
77
|
+
*/
|
|
78
|
+
function getHookHandler(pluginHook) {
|
|
79
|
+
return isFunction(pluginHook) ? pluginHook : pluginHook.handler;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Check if a hook is external.
|
|
83
|
+
*
|
|
84
|
+
* @param keys - The name of the hook to check.
|
|
85
|
+
* @returns True if the hook is external, false otherwise.
|
|
86
|
+
*/
|
|
87
|
+
function isUnpluginHookKey(keys) {
|
|
88
|
+
return UNPLUGIN_BUILDER_VARIANTS.some((variant) => keys.startsWith(`${variant}:`));
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Check if a hook is internal.
|
|
92
|
+
*
|
|
93
|
+
* @param keys - The name of the hook to check.
|
|
94
|
+
* @returns True if the hook is external, false otherwise.
|
|
95
|
+
*/
|
|
96
|
+
function isPluginHookField(keys) {
|
|
97
|
+
return !isUnpluginHookKey(keys) && PLUGIN_HOOKS_FIELDS.includes(keys);
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Check if a hook is external.
|
|
101
|
+
*
|
|
102
|
+
* @param field - The name of the hook to check.
|
|
103
|
+
* @returns True if the hook is external, false otherwise.
|
|
104
|
+
*/
|
|
105
|
+
function isUnpluginHookField(field) {
|
|
106
|
+
return !isPluginHookField(field) && UNPLUGIN_BUILDER_VARIANTS.includes(field);
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Check if a plugin should be deduplicated.
|
|
110
|
+
*
|
|
111
|
+
* @param plugin - The plugin to check
|
|
112
|
+
* @param plugins - The list of plugins to check against
|
|
113
|
+
* @returns True if the plugin should be deduplicated, false otherwise
|
|
114
|
+
*/
|
|
115
|
+
function checkDedupe(plugin, plugins) {
|
|
116
|
+
return plugin.dedupe === false || plugins.some((p) => p.dedupe !== false && (isFunction(p.dedupe) && p.dedupe(plugin) || p.name === plugin.name));
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Add a plugin hook to the hooks list.
|
|
120
|
+
*
|
|
121
|
+
* @param context - The plugin context
|
|
122
|
+
* @param plugin - The plugin to add the hook from
|
|
123
|
+
* @param pluginHook - The plugin hook to add
|
|
124
|
+
* @param hooksList - The list of hooks to add to
|
|
125
|
+
*/
|
|
126
|
+
function addPluginHook(context, plugin, pluginHook, hooksList) {
|
|
127
|
+
if (!checkDedupe(plugin, hooksList.map((hook) => hook.plugin).filter(Boolean))) {
|
|
128
|
+
const handler = ((...args) => getHookHandler(pluginHook).apply(context, args));
|
|
129
|
+
if (!handler) return;
|
|
130
|
+
hooksList.push({
|
|
131
|
+
plugin,
|
|
132
|
+
handler
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Check the provided {@link PluginConfig}, and return a stringified version of the invalid configuration. If an array is provided, check each item in the array.
|
|
138
|
+
*
|
|
139
|
+
* @param config - The plugin configuration to check
|
|
140
|
+
* @returns Null if the configuration is valid, otherwise an array of stringified invalid configurations
|
|
141
|
+
*/
|
|
142
|
+
function findInvalidPluginConfig(config) {
|
|
143
|
+
if (isPluginConfig(config)) return null;
|
|
144
|
+
if (Array.isArray(config)) {
|
|
145
|
+
const invalidItems = [];
|
|
146
|
+
config.forEach((item) => {
|
|
147
|
+
const invalid = findInvalidPluginConfig(item);
|
|
148
|
+
if (invalid) invalidItems.push(...invalid.map((i) => JSON.stringify(i, null, 2)));
|
|
149
|
+
});
|
|
150
|
+
return invalidItems.length > 0 ? invalidItems : null;
|
|
151
|
+
}
|
|
152
|
+
return [JSON.stringify(config, null, 2)];
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
//#endregion
|
|
156
|
+
export { addPluginHook, checkDedupe, findInvalidPluginConfig, isPlugin, isPluginConfig, isPluginConfigObject, isPluginConfigTuple, isPluginHook, isPluginHookField, isUnpluginHookField, isUnpluginHookKey };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
let __stryke_path_replace = require("@stryke/path/replace");
|
|
3
|
+
|
|
4
|
+
//#region ../powerlines/src/plugin-utils/paths.ts
|
|
5
|
+
/**
|
|
6
|
+
* Replaces tokens in the given path string with their corresponding values from the context.
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* The following tokens are supported:
|
|
10
|
+
* - `{workspaceRoot}` - The root directory of the workspace.
|
|
11
|
+
* - `{root}` - The root directory of the project (same as `{projectRoot}`).
|
|
12
|
+
* - `{projectRoot}` - The root directory of the project (same as `{root}`).
|
|
13
|
+
* - `{sourceRoot}` - The source root directory of the project (usually `./src`).
|
|
14
|
+
* - `{powerlinesPath}` - The directory where Powerlines is installed.
|
|
15
|
+
* - `{cachePath}` - The environment's directory for cached files.
|
|
16
|
+
* - `{dataPath}` - The environment's directory for data files.
|
|
17
|
+
* - `{logPath}` - The environment's directory for log files.
|
|
18
|
+
* - `{tempPath}` - The environment's directory for temporary files.
|
|
19
|
+
* - `{configPath}` - The environment's directory for configuration files.
|
|
20
|
+
* - `{outputPath}` - The configured output directory for the project.
|
|
21
|
+
* - `{buildPath}` - The configured distribution directory for the project.
|
|
22
|
+
* - `{artifactsPath}` - The configured directory for build artifacts.
|
|
23
|
+
* - `{builtinPath}` - The configured directory for generated built-in plugins.
|
|
24
|
+
* - `{entryPath}` - The configured directory for generated entry files.
|
|
25
|
+
*
|
|
26
|
+
* @param context - The context containing the values for the path tokens.
|
|
27
|
+
* @param path - The path string with tokens to replace.
|
|
28
|
+
* @returns The path string with tokens replaced by their corresponding values from the context.
|
|
29
|
+
*/
|
|
30
|
+
function replacePathTokens(context, path) {
|
|
31
|
+
if (!path) return path;
|
|
32
|
+
return path.replaceAll("{workspaceRoot}", context.workspaceConfig.workspaceRoot).replaceAll("{root}", context.config.projectRoot).replaceAll("{projectRoot}", context.config.projectRoot).replaceAll("{sourceRoot}", context.config.sourceRoot).replaceAll("{powerlinesPath}", context.powerlinesPath).replaceAll("{cachePath}", context.cachePath).replaceAll("{dataPath}", context.dataPath).replaceAll("{logPath}", context.envPaths.log).replaceAll("{tempPath}", context.envPaths.temp).replaceAll("{configPath}", context.envPaths.config).replaceAll("{outputPath}", context.config.output.outputPath).replaceAll("{buildPath}", context.config.output.buildPath).replaceAll("{artifactsPath}", (0, __stryke_path_replace.replacePath)(context.artifactsPath, context.workspaceConfig.workspaceRoot)).replaceAll("{builtinPath}", (0, __stryke_path_replace.replacePath)(context.builtinsPath, context.workspaceConfig.workspaceRoot)).replaceAll("{entryPath}", (0, __stryke_path_replace.replacePath)(context.entryPath, context.workspaceConfig.workspaceRoot));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
//#endregion
|
|
36
|
+
exports.replacePathTokens = replacePathTokens;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { replacePath } from "@stryke/path/replace";
|
|
2
|
+
|
|
3
|
+
//#region ../powerlines/src/plugin-utils/paths.ts
|
|
4
|
+
/**
|
|
5
|
+
* Replaces tokens in the given path string with their corresponding values from the context.
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* The following tokens are supported:
|
|
9
|
+
* - `{workspaceRoot}` - The root directory of the workspace.
|
|
10
|
+
* - `{root}` - The root directory of the project (same as `{projectRoot}`).
|
|
11
|
+
* - `{projectRoot}` - The root directory of the project (same as `{root}`).
|
|
12
|
+
* - `{sourceRoot}` - The source root directory of the project (usually `./src`).
|
|
13
|
+
* - `{powerlinesPath}` - The directory where Powerlines is installed.
|
|
14
|
+
* - `{cachePath}` - The environment's directory for cached files.
|
|
15
|
+
* - `{dataPath}` - The environment's directory for data files.
|
|
16
|
+
* - `{logPath}` - The environment's directory for log files.
|
|
17
|
+
* - `{tempPath}` - The environment's directory for temporary files.
|
|
18
|
+
* - `{configPath}` - The environment's directory for configuration files.
|
|
19
|
+
* - `{outputPath}` - The configured output directory for the project.
|
|
20
|
+
* - `{buildPath}` - The configured distribution directory for the project.
|
|
21
|
+
* - `{artifactsPath}` - The configured directory for build artifacts.
|
|
22
|
+
* - `{builtinPath}` - The configured directory for generated built-in plugins.
|
|
23
|
+
* - `{entryPath}` - The configured directory for generated entry files.
|
|
24
|
+
*
|
|
25
|
+
* @param context - The context containing the values for the path tokens.
|
|
26
|
+
* @param path - The path string with tokens to replace.
|
|
27
|
+
* @returns The path string with tokens replaced by their corresponding values from the context.
|
|
28
|
+
*/
|
|
29
|
+
function replacePathTokens(context, path) {
|
|
30
|
+
if (!path) return path;
|
|
31
|
+
return path.replaceAll("{workspaceRoot}", context.workspaceConfig.workspaceRoot).replaceAll("{root}", context.config.projectRoot).replaceAll("{projectRoot}", context.config.projectRoot).replaceAll("{sourceRoot}", context.config.sourceRoot).replaceAll("{powerlinesPath}", context.powerlinesPath).replaceAll("{cachePath}", context.cachePath).replaceAll("{dataPath}", context.dataPath).replaceAll("{logPath}", context.envPaths.log).replaceAll("{tempPath}", context.envPaths.temp).replaceAll("{configPath}", context.envPaths.config).replaceAll("{outputPath}", context.config.output.outputPath).replaceAll("{buildPath}", context.config.output.buildPath).replaceAll("{artifactsPath}", replacePath(context.artifactsPath, context.workspaceConfig.workspaceRoot)).replaceAll("{builtinPath}", replacePath(context.builtinsPath, context.workspaceConfig.workspaceRoot)).replaceAll("{entryPath}", replacePath(context.entryPath, context.workspaceConfig.workspaceRoot));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
//#endregion
|
|
35
|
+
export { replacePathTokens };
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { ResolvedConfig } from "./resolved.cjs";
|
|
2
|
+
import { InferHookParameters, InferHookReturnType } from "./hooks.cjs";
|
|
3
|
+
import { CallHookOptions } from "../internal/helpers/hooks.cjs";
|
|
4
|
+
import { BuildInlineConfig, CleanInlineConfig, DeployInlineConfig, DocsInlineConfig, LintInlineConfig, NewInlineConfig, PrepareInlineConfig } from "./config.cjs";
|
|
5
|
+
import { APIContext, EnvironmentContext, PluginContext } from "./context.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 { ResolvedConfig } from "./resolved.mjs";
|
|
2
|
+
import { InferHookParameters, InferHookReturnType } from "./hooks.mjs";
|
|
3
|
+
import { CallHookOptions } from "../internal/helpers/hooks.mjs";
|
|
4
|
+
import { BuildInlineConfig, CleanInlineConfig, DeployInlineConfig, DocsInlineConfig, LintInlineConfig, NewInlineConfig, PrepareInlineConfig } from "./config.mjs";
|
|
5
|
+
import { APIContext, EnvironmentContext, PluginContext } from "./context.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 };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
|
|
2
|
+
//#region ../powerlines/src/types/build.ts
|
|
3
|
+
const UNPLUGIN_BUILDER_VARIANTS = [
|
|
4
|
+
"rollup",
|
|
5
|
+
"webpack",
|
|
6
|
+
"rspack",
|
|
7
|
+
"vite",
|
|
8
|
+
"esbuild",
|
|
9
|
+
"farm",
|
|
10
|
+
"unloader",
|
|
11
|
+
"rolldown",
|
|
12
|
+
"bun"
|
|
13
|
+
];
|
|
14
|
+
const BUILDER_VARIANTS = [
|
|
15
|
+
...UNPLUGIN_BUILDER_VARIANTS,
|
|
16
|
+
"tsup",
|
|
17
|
+
"tsdown",
|
|
18
|
+
"unbuild"
|
|
19
|
+
];
|
|
20
|
+
|
|
21
|
+
//#endregion
|
|
22
|
+
exports.BUILDER_VARIANTS = BUILDER_VARIANTS;
|
|
23
|
+
exports.UNPLUGIN_BUILDER_VARIANTS = UNPLUGIN_BUILDER_VARIANTS;
|