@powerlines/plugin-vite 0.14.126 → 0.14.127
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/powerlines/src/internal/helpers/hooks.cjs +15 -12
- package/dist/powerlines/src/internal/helpers/hooks.d.cts +0 -1
- package/dist/powerlines/src/internal/helpers/hooks.d.mts +0 -1
- package/dist/powerlines/src/internal/helpers/hooks.mjs +15 -12
- package/dist/powerlines/src/lib/contexts/environment-context.cjs +108 -73
- package/dist/powerlines/src/lib/contexts/environment-context.mjs +109 -74
- package/dist/powerlines/src/lib/unplugin/helpers.cjs +13 -1
- package/dist/powerlines/src/lib/unplugin/helpers.mjs +12 -1
- package/dist/powerlines/src/lib/unplugin/index.cjs +1 -1
- package/dist/powerlines/src/lib/unplugin/index.mjs +1 -1
- package/dist/powerlines/src/lib/unplugin/plugin.cjs +3 -3
- package/dist/powerlines/src/lib/unplugin/plugin.mjs +3 -3
- package/dist/powerlines/src/plugin-utils/helpers.cjs +34 -15
- package/dist/powerlines/src/plugin-utils/helpers.mjs +33 -15
- package/dist/powerlines/src/types/api.d.cts +4 -4
- package/dist/powerlines/src/types/api.d.mts +4 -4
- package/dist/powerlines/src/types/babel.d.mts +1 -1
- package/dist/powerlines/src/types/build.cjs +11 -3
- package/dist/powerlines/src/types/build.d.cts +34 -3
- package/dist/powerlines/src/types/build.d.mts +34 -3
- package/dist/powerlines/src/types/build.mjs +10 -3
- package/dist/powerlines/src/types/config.d.cts +14 -4
- package/dist/powerlines/src/types/config.d.mts +15 -5
- package/dist/powerlines/src/types/context.d.cts +9 -8
- package/dist/powerlines/src/types/context.d.mts +8 -7
- package/dist/powerlines/src/types/hooks.d.cts +25 -23
- package/dist/powerlines/src/types/hooks.d.mts +25 -23
- package/dist/powerlines/src/types/internal.d.cts +6 -4
- package/dist/powerlines/src/types/internal.d.mts +6 -4
- package/dist/powerlines/src/types/plugin.cjs +5 -4
- package/dist/powerlines/src/types/plugin.d.cts +36 -65
- package/dist/powerlines/src/types/plugin.d.mts +36 -65
- package/dist/powerlines/src/types/plugin.mjs +6 -5
- package/dist/powerlines/src/types/resolved.d.cts +16 -5
- package/dist/powerlines/src/types/resolved.d.mts +16 -6
- 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 +5 -1
- package/dist/types/plugin.d.mts +5 -1
- package/package.json +5 -5
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { extendLog } from "../logger.mjs";
|
|
2
|
-
import { getString } from "../utilities/source-file.mjs";
|
|
3
2
|
import { combineContexts } from "./helpers.mjs";
|
|
3
|
+
import { getString } from "../utilities/source-file.mjs";
|
|
4
4
|
import { LogLevelLabel } from "@storm-software/config-tools/types";
|
|
5
5
|
import { replaceExtension } from "@stryke/path/replace";
|
|
6
6
|
import { isString } from "@stryke/type-checks/is-string";
|
|
@@ -85,8 +85,8 @@ export * from "${isString(resolved) ? resolved : resolved.id}";
|
|
|
85
85
|
}
|
|
86
86
|
async function transform(code, id) {
|
|
87
87
|
let transformed = code;
|
|
88
|
-
for (const
|
|
89
|
-
const result = await handler.
|
|
88
|
+
for (const hook of ctx.$$internal.environment.selectHooks("transform")) {
|
|
89
|
+
const result = await hook.handler.apply(combineContexts(ctx, this), [getString(transformed), id]);
|
|
90
90
|
if (result) transformed = result;
|
|
91
91
|
}
|
|
92
92
|
return transformed;
|
|
@@ -14,7 +14,7 @@ let __stryke_type_checks_is_undefined = require("@stryke/type-checks/is-undefine
|
|
|
14
14
|
* @returns True if the object is a {@link Plugin}, false otherwise
|
|
15
15
|
*/
|
|
16
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.
|
|
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
18
|
}
|
|
19
19
|
/**
|
|
20
20
|
* Type guard to check if an object is a {@link PluginConfigObject}
|
|
@@ -82,11 +82,29 @@ function getHookHandler(pluginHook) {
|
|
|
82
82
|
/**
|
|
83
83
|
* Check if a hook is external.
|
|
84
84
|
*
|
|
85
|
-
* @param
|
|
85
|
+
* @param keys - The name of the hook to check.
|
|
86
86
|
* @returns True if the hook is external, false otherwise.
|
|
87
87
|
*/
|
|
88
|
-
function
|
|
89
|
-
return
|
|
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);
|
|
90
108
|
}
|
|
91
109
|
/**
|
|
92
110
|
* Check if a plugin should be deduplicated.
|
|
@@ -107,14 +125,14 @@ function checkDedupe(plugin, plugins) {
|
|
|
107
125
|
* @param hooksList - The list of hooks to add to
|
|
108
126
|
*/
|
|
109
127
|
function addPluginHook(context, plugin, pluginHook, hooksList) {
|
|
110
|
-
if (!checkDedupe(plugin, hooksList.map((hook) => hook.plugin)
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
}
|
|
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
|
+
}
|
|
118
136
|
}
|
|
119
137
|
/**
|
|
120
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,10 +157,11 @@ function findInvalidPluginConfig(config) {
|
|
|
139
157
|
exports.addPluginHook = addPluginHook;
|
|
140
158
|
exports.checkDedupe = checkDedupe;
|
|
141
159
|
exports.findInvalidPluginConfig = findInvalidPluginConfig;
|
|
142
|
-
exports.getHookHandler = getHookHandler;
|
|
143
|
-
exports.isHookExternal = isHookExternal;
|
|
144
160
|
exports.isPlugin = isPlugin;
|
|
145
161
|
exports.isPluginConfig = isPluginConfig;
|
|
146
162
|
exports.isPluginConfigObject = isPluginConfigObject;
|
|
147
163
|
exports.isPluginConfigTuple = isPluginConfigTuple;
|
|
148
|
-
exports.isPluginHook = isPluginHook;
|
|
164
|
+
exports.isPluginHook = isPluginHook;
|
|
165
|
+
exports.isPluginHookField = isPluginHookField;
|
|
166
|
+
exports.isUnpluginHookField = isUnpluginHookField;
|
|
167
|
+
exports.isUnpluginHookKey = isUnpluginHookKey;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { BUILDER_VARIANTS, UNPLUGIN_BUILDER_VARIANTS } from "../types/build.mjs";
|
|
2
|
+
import { PLUGIN_HOOKS_FIELDS } from "../types/plugin.mjs";
|
|
3
3
|
import { isSetString } from "@stryke/type-checks/is-set-string";
|
|
4
4
|
import { isFunction } from "@stryke/type-checks/is-function";
|
|
5
5
|
import { isSetObject } from "@stryke/type-checks/is-set-object";
|
|
@@ -13,7 +13,7 @@ import { isUndefined } from "@stryke/type-checks/is-undefined";
|
|
|
13
13
|
* @returns True if the object is a {@link Plugin}, false otherwise
|
|
14
14
|
*/
|
|
15
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)) &&
|
|
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
17
|
}
|
|
18
18
|
/**
|
|
19
19
|
* Type guard to check if an object is a {@link PluginConfigObject}
|
|
@@ -81,11 +81,29 @@ function getHookHandler(pluginHook) {
|
|
|
81
81
|
/**
|
|
82
82
|
* Check if a hook is external.
|
|
83
83
|
*
|
|
84
|
-
* @param
|
|
84
|
+
* @param keys - The name of the hook to check.
|
|
85
85
|
* @returns True if the hook is external, false otherwise.
|
|
86
86
|
*/
|
|
87
|
-
function
|
|
88
|
-
return
|
|
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);
|
|
89
107
|
}
|
|
90
108
|
/**
|
|
91
109
|
* Check if a plugin should be deduplicated.
|
|
@@ -106,14 +124,14 @@ function checkDedupe(plugin, plugins) {
|
|
|
106
124
|
* @param hooksList - The list of hooks to add to
|
|
107
125
|
*/
|
|
108
126
|
function addPluginHook(context, plugin, pluginHook, hooksList) {
|
|
109
|
-
if (!checkDedupe(plugin, hooksList.map((hook) => hook.plugin)
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
}
|
|
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
|
+
}
|
|
117
135
|
}
|
|
118
136
|
/**
|
|
119
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.
|
|
@@ -135,4 +153,4 @@ function findInvalidPluginConfig(config) {
|
|
|
135
153
|
}
|
|
136
154
|
|
|
137
155
|
//#endregion
|
|
138
|
-
export { addPluginHook, checkDedupe, findInvalidPluginConfig,
|
|
156
|
+
export { addPluginHook, checkDedupe, findInvalidPluginConfig, isPlugin, isPluginConfig, isPluginConfigObject, isPluginConfigTuple, isPluginHook, isPluginHookField, isUnpluginHookField, isUnpluginHookKey };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ResolvedConfig } from "./resolved.cjs";
|
|
2
|
-
import { BuildInlineConfig, CleanInlineConfig, DeployInlineConfig, DocsInlineConfig, LintInlineConfig, NewInlineConfig, PrepareInlineConfig } from "./config.cjs";
|
|
3
|
-
import { HookKeys, InferHookParameters, InferHookReturnType } from "./hooks.cjs";
|
|
4
|
-
import { APIContext, EnvironmentContext, PluginContext } from "./context.cjs";
|
|
5
2
|
import { CallHookOptions } from "../internal/helpers/hooks.cjs";
|
|
3
|
+
import { InferHookParameters, InferHookReturnType } from "./hooks.cjs";
|
|
4
|
+
import { APIContext, EnvironmentContext, PluginContext } from "./context.cjs";
|
|
5
|
+
import { BuildInlineConfig, CleanInlineConfig, DeployInlineConfig, DocsInlineConfig, LintInlineConfig, NewInlineConfig, PrepareInlineConfig } from "./config.cjs";
|
|
6
6
|
|
|
7
7
|
//#region ../powerlines/src/types/api.d.ts
|
|
8
8
|
|
|
@@ -96,7 +96,7 @@ interface API<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
|
|
|
96
96
|
* @param args - The arguments to pass to the hook
|
|
97
97
|
* @returns The result of the hook call
|
|
98
98
|
*/
|
|
99
|
-
callHook: <TKey extends
|
|
99
|
+
callHook: <TKey extends string>(hook: TKey, options: CallHookOptions & {
|
|
100
100
|
environment?: string | EnvironmentContext<TResolvedConfig>;
|
|
101
101
|
}, ...args: InferHookParameters<PluginContext<TResolvedConfig>, TKey>) => Promise<InferHookReturnType<PluginContext<TResolvedConfig>, TKey> | undefined>;
|
|
102
102
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ResolvedConfig } from "./resolved.mjs";
|
|
2
|
-
import { BuildInlineConfig, CleanInlineConfig, DeployInlineConfig, DocsInlineConfig, LintInlineConfig, NewInlineConfig, PrepareInlineConfig } from "./config.mjs";
|
|
3
|
-
import { HookKeys, InferHookParameters, InferHookReturnType } from "./hooks.mjs";
|
|
4
|
-
import { APIContext, EnvironmentContext, PluginContext } from "./context.mjs";
|
|
5
2
|
import { CallHookOptions } from "../internal/helpers/hooks.mjs";
|
|
3
|
+
import { InferHookParameters, InferHookReturnType } from "./hooks.mjs";
|
|
4
|
+
import { APIContext, EnvironmentContext, PluginContext } from "./context.mjs";
|
|
5
|
+
import { BuildInlineConfig, CleanInlineConfig, DeployInlineConfig, DocsInlineConfig, LintInlineConfig, NewInlineConfig, PrepareInlineConfig } from "./config.mjs";
|
|
6
6
|
|
|
7
7
|
//#region ../powerlines/src/types/api.d.ts
|
|
8
8
|
|
|
@@ -96,7 +96,7 @@ interface API<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
|
|
|
96
96
|
* @param args - The arguments to pass to the hook
|
|
97
97
|
* @returns The result of the hook call
|
|
98
98
|
*/
|
|
99
|
-
callHook: <TKey extends
|
|
99
|
+
callHook: <TKey extends string>(hook: TKey, options: CallHookOptions & {
|
|
100
100
|
environment?: string | EnvironmentContext<TResolvedConfig>;
|
|
101
101
|
}, ...args: InferHookParameters<PluginContext<TResolvedConfig>, TKey>) => Promise<InferHookReturnType<PluginContext<TResolvedConfig>, TKey> | undefined>;
|
|
102
102
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
//#region ../powerlines/src/types/build.ts
|
|
3
|
-
const
|
|
3
|
+
const UNPLUGIN_BUILDER_VARIANTS = [
|
|
4
4
|
"rollup",
|
|
5
5
|
"webpack",
|
|
6
6
|
"rspack",
|
|
@@ -8,8 +8,16 @@ const UNPLUGIN_BUILD_VARIANTS = [
|
|
|
8
8
|
"esbuild",
|
|
9
9
|
"farm",
|
|
10
10
|
"unloader",
|
|
11
|
-
"rolldown"
|
|
11
|
+
"rolldown",
|
|
12
|
+
"bun"
|
|
13
|
+
];
|
|
14
|
+
const BUILDER_VARIANTS = [
|
|
15
|
+
...UNPLUGIN_BUILDER_VARIANTS,
|
|
16
|
+
"tsup",
|
|
17
|
+
"tsdown",
|
|
18
|
+
"unbuild"
|
|
12
19
|
];
|
|
13
20
|
|
|
14
21
|
//#endregion
|
|
15
|
-
exports.
|
|
22
|
+
exports.BUILDER_VARIANTS = BUILDER_VARIANTS;
|
|
23
|
+
exports.UNPLUGIN_BUILDER_VARIANTS = UNPLUGIN_BUILDER_VARIANTS;
|
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
import { DepOptimizationOptions, UserConfig } from "vite";
|
|
2
|
+
import { UserConfig as UserConfig$1 } from "@farmfe/core";
|
|
3
|
+
import { Configuration } from "@rspack/core";
|
|
4
|
+
import { BuildOptions } from "@storm-software/tsup/types";
|
|
5
|
+
import { UnbuildOptions } from "@storm-software/unbuild/types";
|
|
6
|
+
import { BuildOptions as BuildOptions$1 } from "esbuild";
|
|
7
|
+
import { RolldownOptions } from "rolldown";
|
|
8
|
+
import { OutputOptions, RollupOptions } from "rollup";
|
|
9
|
+
import { UserConfig as UserConfig$2 } from "tsdown";
|
|
10
|
+
import { Configuration as Configuration$1 } from "webpack";
|
|
2
11
|
|
|
3
12
|
//#region ../powerlines/src/types/build.d.ts
|
|
4
|
-
|
|
5
|
-
type
|
|
13
|
+
type UnpluginBuilderVariant = "rollup" | "webpack" | "rspack" | "vite" | "esbuild" | "farm" | "unloader" | "rolldown" | "bun";
|
|
14
|
+
type BuilderVariant = UnpluginBuilderVariant | "tsup" | "tsdown" | "unbuild";
|
|
15
|
+
type InferUnpluginVariant<TBuildVariant extends BuilderVariant> = TBuildVariant extends "tsup" ? "esbuild" : TBuildVariant extends "tsdown" ? "rolldown" : TBuildVariant extends "unbuild" ? "rollup" : TBuildVariant;
|
|
6
16
|
interface BuildConfig {
|
|
7
17
|
/**
|
|
8
18
|
* The platform to build the project for
|
|
@@ -143,6 +153,8 @@ interface BuildConfig {
|
|
|
143
153
|
override?: Record<string, any>;
|
|
144
154
|
}
|
|
145
155
|
type BuildResolvedConfig = Omit<BuildConfig, "override">;
|
|
156
|
+
type ESBuildBuildConfig = Omit<BuildOptions$1, "entryPoints" | "sourceRoot" | "platform" | "outdir" | "env" | "assets" | "external" | "inject" | "tsconfig" | "tsconfigRaw" | "logLevel"> & BuildConfig;
|
|
157
|
+
type ESBuildResolvedBuildConfig = Omit<BuildOptions$1, "inject"> & BuildResolvedConfig;
|
|
146
158
|
type ViteBuildConfig = Omit<UserConfig, "entry" | "entryPoints" | "tsconfig" | "tsconfigRaw" | "environments" | "output"> & BuildConfig & {
|
|
147
159
|
/**
|
|
148
160
|
* Optimize deps config
|
|
@@ -150,5 +162,24 @@ type ViteBuildConfig = Omit<UserConfig, "entry" | "entryPoints" | "tsconfig" | "
|
|
|
150
162
|
optimizeDeps?: Omit<DepOptimizationOptions, "extensions">;
|
|
151
163
|
};
|
|
152
164
|
type ViteResolvedBuildConfig = UserConfig & BuildResolvedConfig;
|
|
165
|
+
type WebpackBuildConfig = Omit<Configuration$1, "name" | "entry" | "entryPoints" | "tsconfig" | "tsconfigRaw"> & BuildConfig;
|
|
166
|
+
type WebpackResolvedBuildConfig = Configuration$1 & BuildResolvedConfig;
|
|
167
|
+
type RspackBuildConfig = Omit<Configuration, "name" | "entry" | "entryPoints" | "tsconfig" | "tsconfigRaw"> & BuildConfig;
|
|
168
|
+
type RspackResolvedBuildConfig = Configuration & BuildResolvedConfig;
|
|
169
|
+
type RollupBuildOutputConfig = Omit<OutputOptions, "dir" | "format">;
|
|
170
|
+
type RollupBuildConfig = Omit<RollupOptions, "entry" | "external" | "input" | "output" | "logLevel"> & {
|
|
171
|
+
output: RollupBuildOutputConfig | RollupBuildOutputConfig[];
|
|
172
|
+
} & BuildConfig;
|
|
173
|
+
type RollupResolvedBuildConfig = RollupOptions & BuildResolvedConfig;
|
|
174
|
+
type RolldownBuildConfig = Omit<RolldownOptions, "input" | "external" | "tsconfig" | "logLevel" | "output"> & BuildConfig;
|
|
175
|
+
type RolldownResolvedBuildConfig = RolldownOptions & BuildResolvedConfig;
|
|
176
|
+
type TsupBuildConfig = Partial<Omit<BuildOptions, "userOptions" | "tsconfig" | "tsconfigRaw" | "assets" | "outputPath" | "mode" | "format" | "platform" | "projectRoot" | "clean" | "env" | "entry" | "entryPoints" | "external" | "noExternal" | "skipNodeModulesBundle">> & BuildConfig;
|
|
177
|
+
type TsupResolvedBuildConfig = BuildOptions & BuildResolvedConfig;
|
|
178
|
+
type TsdownBuildConfig = Partial<Omit<UserConfig$2, "name" | "outDir" | "clean" | "cwd" | "tsconfig" | "publicDir" | "copy" | "alias" | "format" | "platform" | "env" | "define" | "entry" | "external" | "noExternal" | "skipNodeModulesBundle">> & BuildConfig;
|
|
179
|
+
type TsdownResolvedBuildConfig = UserConfig$2 & BuildResolvedConfig;
|
|
180
|
+
type UnbuildBuildConfig = Partial<Omit<UnbuildOptions, "tsconfig" | "tsconfigRaw" | "assets" | "outputPath" | "mode" | "format" | "platform" | "projectRoot" | "env" | "entry" | "entryPoints">> & BuildConfig;
|
|
181
|
+
type UnbuildResolvedBuildConfig = UnbuildOptions & BuildResolvedConfig;
|
|
182
|
+
type FarmBuildConfig = Partial<Omit<UserConfig$1, "tsconfig" | "tsconfigRaw" | "assets" | "outputPath" | "mode" | "format" | "platform" | "projectRoot" | "env" | "entry" | "entryPoints">> & BuildConfig;
|
|
183
|
+
type FarmResolvedBuildConfig = UserConfig$1 & BuildResolvedConfig;
|
|
153
184
|
//#endregion
|
|
154
|
-
export { BuildConfig, BuildResolvedConfig,
|
|
185
|
+
export { BuildConfig, BuildResolvedConfig, BuilderVariant, ESBuildBuildConfig, ESBuildResolvedBuildConfig, FarmBuildConfig, FarmResolvedBuildConfig, InferUnpluginVariant, RolldownBuildConfig, RolldownResolvedBuildConfig, RollupBuildConfig, RollupResolvedBuildConfig, RspackBuildConfig, RspackResolvedBuildConfig, TsdownBuildConfig, TsdownResolvedBuildConfig, TsupBuildConfig, TsupResolvedBuildConfig, UnbuildBuildConfig, UnbuildResolvedBuildConfig, UnpluginBuilderVariant, ViteBuildConfig, ViteResolvedBuildConfig, WebpackBuildConfig, WebpackResolvedBuildConfig };
|
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
import { DepOptimizationOptions, UserConfig } from "vite";
|
|
2
|
+
import { UserConfig as UserConfig$1 } from "@farmfe/core";
|
|
3
|
+
import { Configuration } from "@rspack/core";
|
|
4
|
+
import { BuildOptions } from "@storm-software/tsup/types";
|
|
5
|
+
import { UnbuildOptions } from "@storm-software/unbuild/types";
|
|
6
|
+
import { BuildOptions as BuildOptions$1 } from "esbuild";
|
|
7
|
+
import { RolldownOptions } from "rolldown";
|
|
8
|
+
import { OutputOptions, RollupOptions } from "rollup";
|
|
9
|
+
import { UserConfig as UserConfig$2 } from "tsdown";
|
|
10
|
+
import { Configuration as Configuration$1 } from "webpack";
|
|
2
11
|
|
|
3
12
|
//#region ../powerlines/src/types/build.d.ts
|
|
4
|
-
|
|
5
|
-
type
|
|
13
|
+
type UnpluginBuilderVariant = "rollup" | "webpack" | "rspack" | "vite" | "esbuild" | "farm" | "unloader" | "rolldown" | "bun";
|
|
14
|
+
type BuilderVariant = UnpluginBuilderVariant | "tsup" | "tsdown" | "unbuild";
|
|
15
|
+
type InferUnpluginVariant<TBuildVariant extends BuilderVariant> = TBuildVariant extends "tsup" ? "esbuild" : TBuildVariant extends "tsdown" ? "rolldown" : TBuildVariant extends "unbuild" ? "rollup" : TBuildVariant;
|
|
6
16
|
interface BuildConfig {
|
|
7
17
|
/**
|
|
8
18
|
* The platform to build the project for
|
|
@@ -143,6 +153,8 @@ interface BuildConfig {
|
|
|
143
153
|
override?: Record<string, any>;
|
|
144
154
|
}
|
|
145
155
|
type BuildResolvedConfig = Omit<BuildConfig, "override">;
|
|
156
|
+
type ESBuildBuildConfig = Omit<BuildOptions$1, "entryPoints" | "sourceRoot" | "platform" | "outdir" | "env" | "assets" | "external" | "inject" | "tsconfig" | "tsconfigRaw" | "logLevel"> & BuildConfig;
|
|
157
|
+
type ESBuildResolvedBuildConfig = Omit<BuildOptions$1, "inject"> & BuildResolvedConfig;
|
|
146
158
|
type ViteBuildConfig = Omit<UserConfig, "entry" | "entryPoints" | "tsconfig" | "tsconfigRaw" | "environments" | "output"> & BuildConfig & {
|
|
147
159
|
/**
|
|
148
160
|
* Optimize deps config
|
|
@@ -150,5 +162,24 @@ type ViteBuildConfig = Omit<UserConfig, "entry" | "entryPoints" | "tsconfig" | "
|
|
|
150
162
|
optimizeDeps?: Omit<DepOptimizationOptions, "extensions">;
|
|
151
163
|
};
|
|
152
164
|
type ViteResolvedBuildConfig = UserConfig & BuildResolvedConfig;
|
|
165
|
+
type WebpackBuildConfig = Omit<Configuration$1, "name" | "entry" | "entryPoints" | "tsconfig" | "tsconfigRaw"> & BuildConfig;
|
|
166
|
+
type WebpackResolvedBuildConfig = Configuration$1 & BuildResolvedConfig;
|
|
167
|
+
type RspackBuildConfig = Omit<Configuration, "name" | "entry" | "entryPoints" | "tsconfig" | "tsconfigRaw"> & BuildConfig;
|
|
168
|
+
type RspackResolvedBuildConfig = Configuration & BuildResolvedConfig;
|
|
169
|
+
type RollupBuildOutputConfig = Omit<OutputOptions, "dir" | "format">;
|
|
170
|
+
type RollupBuildConfig = Omit<RollupOptions, "entry" | "external" | "input" | "output" | "logLevel"> & {
|
|
171
|
+
output: RollupBuildOutputConfig | RollupBuildOutputConfig[];
|
|
172
|
+
} & BuildConfig;
|
|
173
|
+
type RollupResolvedBuildConfig = RollupOptions & BuildResolvedConfig;
|
|
174
|
+
type RolldownBuildConfig = Omit<RolldownOptions, "input" | "external" | "tsconfig" | "logLevel" | "output"> & BuildConfig;
|
|
175
|
+
type RolldownResolvedBuildConfig = RolldownOptions & BuildResolvedConfig;
|
|
176
|
+
type TsupBuildConfig = Partial<Omit<BuildOptions, "userOptions" | "tsconfig" | "tsconfigRaw" | "assets" | "outputPath" | "mode" | "format" | "platform" | "projectRoot" | "clean" | "env" | "entry" | "entryPoints" | "external" | "noExternal" | "skipNodeModulesBundle">> & BuildConfig;
|
|
177
|
+
type TsupResolvedBuildConfig = BuildOptions & BuildResolvedConfig;
|
|
178
|
+
type TsdownBuildConfig = Partial<Omit<UserConfig$2, "name" | "outDir" | "clean" | "cwd" | "tsconfig" | "publicDir" | "copy" | "alias" | "format" | "platform" | "env" | "define" | "entry" | "external" | "noExternal" | "skipNodeModulesBundle">> & BuildConfig;
|
|
179
|
+
type TsdownResolvedBuildConfig = UserConfig$2 & BuildResolvedConfig;
|
|
180
|
+
type UnbuildBuildConfig = Partial<Omit<UnbuildOptions, "tsconfig" | "tsconfigRaw" | "assets" | "outputPath" | "mode" | "format" | "platform" | "projectRoot" | "env" | "entry" | "entryPoints">> & BuildConfig;
|
|
181
|
+
type UnbuildResolvedBuildConfig = UnbuildOptions & BuildResolvedConfig;
|
|
182
|
+
type FarmBuildConfig = Partial<Omit<UserConfig$1, "tsconfig" | "tsconfigRaw" | "assets" | "outputPath" | "mode" | "format" | "platform" | "projectRoot" | "env" | "entry" | "entryPoints">> & BuildConfig;
|
|
183
|
+
type FarmResolvedBuildConfig = UserConfig$1 & BuildResolvedConfig;
|
|
153
184
|
//#endregion
|
|
154
|
-
export { BuildConfig, BuildResolvedConfig,
|
|
185
|
+
export { BuildConfig, BuildResolvedConfig, BuilderVariant, ESBuildBuildConfig, ESBuildResolvedBuildConfig, FarmBuildConfig, FarmResolvedBuildConfig, InferUnpluginVariant, RolldownBuildConfig, RolldownResolvedBuildConfig, RollupBuildConfig, RollupResolvedBuildConfig, RspackBuildConfig, RspackResolvedBuildConfig, TsdownBuildConfig, TsdownResolvedBuildConfig, TsupBuildConfig, TsupResolvedBuildConfig, UnbuildBuildConfig, UnbuildResolvedBuildConfig, UnpluginBuilderVariant, ViteBuildConfig, ViteResolvedBuildConfig, WebpackBuildConfig, WebpackResolvedBuildConfig };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region ../powerlines/src/types/build.ts
|
|
2
|
-
const
|
|
2
|
+
const UNPLUGIN_BUILDER_VARIANTS = [
|
|
3
3
|
"rollup",
|
|
4
4
|
"webpack",
|
|
5
5
|
"rspack",
|
|
@@ -7,8 +7,15 @@ const UNPLUGIN_BUILD_VARIANTS = [
|
|
|
7
7
|
"esbuild",
|
|
8
8
|
"farm",
|
|
9
9
|
"unloader",
|
|
10
|
-
"rolldown"
|
|
10
|
+
"rolldown",
|
|
11
|
+
"bun"
|
|
12
|
+
];
|
|
13
|
+
const BUILDER_VARIANTS = [
|
|
14
|
+
...UNPLUGIN_BUILDER_VARIANTS,
|
|
15
|
+
"tsup",
|
|
16
|
+
"tsdown",
|
|
17
|
+
"unbuild"
|
|
11
18
|
];
|
|
12
19
|
|
|
13
20
|
//#endregion
|
|
14
|
-
export {
|
|
21
|
+
export { BUILDER_VARIANTS, UNPLUGIN_BUILDER_VARIANTS };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { BuildConfig, BuildResolvedConfig, ViteBuildConfig, ViteResolvedBuildConfig } from "./build.cjs";
|
|
1
|
+
import { BuildConfig, BuildResolvedConfig, ESBuildBuildConfig, ESBuildResolvedBuildConfig, FarmBuildConfig, FarmResolvedBuildConfig, RolldownBuildConfig, RolldownResolvedBuildConfig, RollupBuildConfig, RollupResolvedBuildConfig, RspackBuildConfig, RspackResolvedBuildConfig, TsdownBuildConfig, TsdownResolvedBuildConfig, TsupBuildConfig, TsupResolvedBuildConfig, UnbuildBuildConfig, UnbuildResolvedBuildConfig, ViteBuildConfig, ViteResolvedBuildConfig, WebpackBuildConfig, WebpackResolvedBuildConfig } from "./build.cjs";
|
|
2
2
|
import { StoragePort, StoragePreset } from "./fs.cjs";
|
|
3
3
|
import { Plugin } from "./plugin.cjs";
|
|
4
4
|
import { TSConfig } from "./tsconfig.cjs";
|
|
5
5
|
import { PluginContext } from "./context.cjs";
|
|
6
|
-
import { PreviewOptions } from "vite";
|
|
7
|
-
import { MaybePromise } from "@stryke/types/base";
|
|
6
|
+
import { PreviewOptions, ResolvedConfig } from "vite";
|
|
8
7
|
import { Format } from "@storm-software/build-tools/types";
|
|
9
8
|
import { LogLevelLabel } from "@storm-software/config-tools/types";
|
|
10
9
|
import { StormWorkspaceConfig } from "@storm-software/config/types";
|
|
10
|
+
import { MaybePromise } from "@stryke/types/base";
|
|
11
11
|
import { TypeDefinitionParameter } from "@stryke/types/configuration";
|
|
12
12
|
import { AssetGlob } from "@stryke/types/file";
|
|
13
13
|
import { DateString } from "compatx";
|
|
@@ -362,7 +362,16 @@ interface UserConfig$1<TBuildConfig extends BuildConfig = BuildConfig, TBuildRes
|
|
|
362
362
|
override?: Partial<TBuildResolvedConfig>;
|
|
363
363
|
};
|
|
364
364
|
}
|
|
365
|
+
type WebpackUserConfig = UserConfig$1<WebpackBuildConfig, WebpackResolvedBuildConfig, "webpack">;
|
|
366
|
+
type RspackUserConfig = UserConfig$1<RspackBuildConfig, RspackResolvedBuildConfig, "rspack">;
|
|
367
|
+
type RollupUserConfig = UserConfig$1<RollupBuildConfig, RollupResolvedBuildConfig, "rollup">;
|
|
368
|
+
type RolldownUserConfig = UserConfig$1<RolldownBuildConfig, RolldownResolvedBuildConfig, "rolldown">;
|
|
365
369
|
type ViteUserConfig = UserConfig$1<ViteBuildConfig, ViteResolvedBuildConfig, "vite">;
|
|
370
|
+
type ESBuildUserConfig = UserConfig$1<ESBuildBuildConfig, ESBuildResolvedBuildConfig, "esbuild">;
|
|
371
|
+
type UnbuildUserConfig = UserConfig$1<UnbuildBuildConfig, UnbuildResolvedBuildConfig, "unbuild">;
|
|
372
|
+
type TsupUserConfig = UserConfig$1<TsupBuildConfig, TsupResolvedBuildConfig, "tsup">;
|
|
373
|
+
type TsdownUserConfig = UserConfig$1<TsdownBuildConfig, TsdownResolvedBuildConfig, "tsdown">;
|
|
374
|
+
type FarmUserConfig = UserConfig$1<FarmBuildConfig, FarmResolvedBuildConfig, "farm">;
|
|
366
375
|
type PowerlinesCommand = "new" | "prepare" | "build" | "lint" | "test" | "docs" | "deploy" | "clean";
|
|
367
376
|
/**
|
|
368
377
|
* The configuration provided while executing Powerlines commands.
|
|
@@ -419,5 +428,6 @@ type DeployInlineConfig<TUserConfig extends UserConfig$1 = UserConfig$1> = Inlin
|
|
|
419
428
|
*/
|
|
420
429
|
command: "deploy";
|
|
421
430
|
};
|
|
431
|
+
type ConfigEnv = Pick<ResolvedConfig, "command" | "mode" | "environments" | "preview">;
|
|
422
432
|
//#endregion
|
|
423
|
-
export { BuildInlineConfig, CleanInlineConfig, DeployInlineConfig, DocsInlineConfig, EnvironmentConfig, InlineConfig, LintInlineConfig, LogFn, NewInlineConfig, OutputConfig, PluginConfig, PrepareInlineConfig, UserConfig$1 as UserConfig, ViteUserConfig, WorkspaceConfig };
|
|
433
|
+
export { BuildInlineConfig, CleanInlineConfig, ConfigEnv, DeployInlineConfig, DocsInlineConfig, ESBuildUserConfig, EnvironmentConfig, FarmUserConfig, InlineConfig, LintInlineConfig, LogFn, NewInlineConfig, OutputConfig, PluginConfig, PrepareInlineConfig, RolldownUserConfig, RollupUserConfig, RspackUserConfig, TsdownUserConfig, TsupUserConfig, UnbuildUserConfig, UserConfig$1 as UserConfig, ViteUserConfig, WebpackUserConfig, WorkspaceConfig };
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { BuildConfig, BuildResolvedConfig, ViteBuildConfig, ViteResolvedBuildConfig } from "./build.mjs";
|
|
2
|
-
import "./babel.mjs";
|
|
1
|
+
import { BuildConfig, BuildResolvedConfig, ESBuildBuildConfig, ESBuildResolvedBuildConfig, FarmBuildConfig, FarmResolvedBuildConfig, RolldownBuildConfig, RolldownResolvedBuildConfig, RollupBuildConfig, RollupResolvedBuildConfig, RspackBuildConfig, RspackResolvedBuildConfig, TsdownBuildConfig, TsdownResolvedBuildConfig, TsupBuildConfig, TsupResolvedBuildConfig, UnbuildBuildConfig, UnbuildResolvedBuildConfig, ViteBuildConfig, ViteResolvedBuildConfig, WebpackBuildConfig, WebpackResolvedBuildConfig } from "./build.mjs";
|
|
3
2
|
import { StoragePort, StoragePreset } from "./fs.mjs";
|
|
4
3
|
import { Plugin } from "./plugin.mjs";
|
|
5
4
|
import { TSConfig } from "./tsconfig.mjs";
|
|
6
5
|
import { PluginContext } from "./context.mjs";
|
|
6
|
+
import "./babel.mjs";
|
|
7
7
|
import { LogLevelLabel } from "@storm-software/config-tools/types";
|
|
8
|
-
import { PreviewOptions } from "vite";
|
|
8
|
+
import { PreviewOptions, ResolvedConfig } from "vite";
|
|
9
9
|
import { transformAsync } from "@babel/core";
|
|
10
10
|
import "c12";
|
|
11
|
-
import { MaybePromise } from "@stryke/types/base";
|
|
12
11
|
import { Format } from "@storm-software/build-tools/types";
|
|
13
12
|
import { StormWorkspaceConfig } from "@storm-software/config/types";
|
|
13
|
+
import { MaybePromise } from "@stryke/types/base";
|
|
14
14
|
import { TypeDefinitionParameter } from "@stryke/types/configuration";
|
|
15
15
|
import { AssetGlob } from "@stryke/types/file";
|
|
16
16
|
import { DateString } from "compatx";
|
|
@@ -364,7 +364,16 @@ interface UserConfig$1<TBuildConfig extends BuildConfig = BuildConfig, TBuildRes
|
|
|
364
364
|
override?: Partial<TBuildResolvedConfig>;
|
|
365
365
|
};
|
|
366
366
|
}
|
|
367
|
+
type WebpackUserConfig = UserConfig$1<WebpackBuildConfig, WebpackResolvedBuildConfig, "webpack">;
|
|
368
|
+
type RspackUserConfig = UserConfig$1<RspackBuildConfig, RspackResolvedBuildConfig, "rspack">;
|
|
369
|
+
type RollupUserConfig = UserConfig$1<RollupBuildConfig, RollupResolvedBuildConfig, "rollup">;
|
|
370
|
+
type RolldownUserConfig = UserConfig$1<RolldownBuildConfig, RolldownResolvedBuildConfig, "rolldown">;
|
|
367
371
|
type ViteUserConfig = UserConfig$1<ViteBuildConfig, ViteResolvedBuildConfig, "vite">;
|
|
372
|
+
type ESBuildUserConfig = UserConfig$1<ESBuildBuildConfig, ESBuildResolvedBuildConfig, "esbuild">;
|
|
373
|
+
type UnbuildUserConfig = UserConfig$1<UnbuildBuildConfig, UnbuildResolvedBuildConfig, "unbuild">;
|
|
374
|
+
type TsupUserConfig = UserConfig$1<TsupBuildConfig, TsupResolvedBuildConfig, "tsup">;
|
|
375
|
+
type TsdownUserConfig = UserConfig$1<TsdownBuildConfig, TsdownResolvedBuildConfig, "tsdown">;
|
|
376
|
+
type FarmUserConfig = UserConfig$1<FarmBuildConfig, FarmResolvedBuildConfig, "farm">;
|
|
368
377
|
type PowerlinesCommand = "new" | "prepare" | "build" | "lint" | "test" | "docs" | "deploy" | "clean";
|
|
369
378
|
/**
|
|
370
379
|
* The configuration provided while executing Powerlines commands.
|
|
@@ -421,5 +430,6 @@ type DeployInlineConfig<TUserConfig extends UserConfig$1 = UserConfig$1> = Inlin
|
|
|
421
430
|
*/
|
|
422
431
|
command: "deploy";
|
|
423
432
|
};
|
|
433
|
+
type ConfigEnv = Pick<ResolvedConfig, "command" | "mode" | "environments" | "preview">;
|
|
424
434
|
//#endregion
|
|
425
|
-
export { BuildInlineConfig, CleanInlineConfig, DeployInlineConfig, DocsInlineConfig, EnvironmentConfig, InlineConfig, LintInlineConfig, LogFn, NewInlineConfig, OutputConfig, PluginConfig, PrepareInlineConfig, UserConfig$1 as UserConfig, ViteUserConfig, WorkspaceConfig };
|
|
435
|
+
export { BuildInlineConfig, CleanInlineConfig, ConfigEnv, DeployInlineConfig, DocsInlineConfig, ESBuildUserConfig, EnvironmentConfig, FarmUserConfig, InlineConfig, LintInlineConfig, LogFn, NewInlineConfig, OutputConfig, PluginConfig, PrepareInlineConfig, RolldownUserConfig, RollupUserConfig, RspackUserConfig, TsdownUserConfig, TsupUserConfig, UnbuildUserConfig, UserConfig$1 as UserConfig, ViteUserConfig, WebpackUserConfig, WorkspaceConfig };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { ResolveOptions, VirtualFile, VirtualFileSystemInterface, WriteOptions } from "./fs.cjs";
|
|
2
2
|
import { EnvironmentResolvedConfig, ResolvedConfig, ResolvedEntryTypeDefinition } from "./resolved.cjs";
|
|
3
3
|
import { Plugin } from "./plugin.cjs";
|
|
4
|
+
import { HooksList, InferHooksListItem } from "./hooks.cjs";
|
|
4
5
|
import { ParsedTypeScriptConfig } from "./tsconfig.cjs";
|
|
5
6
|
import { InlineConfig, LogFn, UserConfig, WorkspaceConfig } from "./config.cjs";
|
|
6
|
-
import {
|
|
7
|
+
import { NonUndefined } from "@stryke/types/base";
|
|
7
8
|
import { EnvPaths } from "@stryke/env/get-env-paths";
|
|
8
9
|
import { FetchRequestOptions } from "@stryke/http/fetch";
|
|
9
|
-
import { NonUndefined } from "@stryke/types/base";
|
|
10
10
|
import { PackageJson } from "@stryke/types/package-json";
|
|
11
11
|
import { Jiti } from "jiti";
|
|
12
12
|
import { SourceMap } from "magic-string";
|
|
@@ -467,10 +467,10 @@ interface EnvironmentContextPlugin<TResolvedConfig extends ResolvedConfig = Reso
|
|
|
467
467
|
plugin: Plugin<PluginContext<TResolvedConfig>>;
|
|
468
468
|
context: PluginContext<TResolvedConfig>;
|
|
469
469
|
}
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
470
|
+
type SelectHookResultItem<TContext extends PluginContext, TKey extends string> = InferHooksListItem<TContext, TKey> & {
|
|
471
|
+
context: TContext;
|
|
472
|
+
};
|
|
473
|
+
type SelectHookResult<TContext extends PluginContext, TKey extends string> = SelectHookResultItem<TContext, TKey>[];
|
|
474
474
|
interface EnvironmentContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> extends Context<TResolvedConfig> {
|
|
475
475
|
/**
|
|
476
476
|
* The expected plugins options for the Powerlines project.
|
|
@@ -494,7 +494,7 @@ interface EnvironmentContext<TResolvedConfig extends ResolvedConfig = ResolvedCo
|
|
|
494
494
|
/**
|
|
495
495
|
* Retrieves the hook handlers for a specific hook name
|
|
496
496
|
*/
|
|
497
|
-
selectHooks: <TKey extends
|
|
497
|
+
selectHooks: <TKey extends string>(key: TKey, options?: SelectHooksOptions) => SelectHookResult<PluginContext<TResolvedConfig>, TKey>;
|
|
498
498
|
}
|
|
499
499
|
interface PluginContext<out TResolvedConfig extends ResolvedConfig = ResolvedConfig> extends Context<TResolvedConfig>, UnpluginContext {
|
|
500
500
|
/**
|
|
@@ -510,5 +510,6 @@ interface PluginContext<out TResolvedConfig extends ResolvedConfig = ResolvedCon
|
|
|
510
510
|
logger: LogFn;
|
|
511
511
|
}
|
|
512
512
|
type BuildPluginContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> = UnpluginBuildContext & PluginContext<TResolvedConfig>;
|
|
513
|
+
type WithUnpluginBuildContext<TContext extends PluginContext> = UnpluginBuildContext & TContext;
|
|
513
514
|
//#endregion
|
|
514
|
-
export { APIContext, BuildPluginContext, EnvironmentContext, PluginContext, SelectHooksOptions, UnresolvedContext };
|
|
515
|
+
export { APIContext, BuildPluginContext, Context, EnvironmentContext, PluginContext, SelectHooksOptions, UnresolvedContext, WithUnpluginBuildContext };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ResolveOptions, VirtualFile, VirtualFileSystemInterface, WriteOptions } from "./fs.mjs";
|
|
2
2
|
import { EnvironmentResolvedConfig, ResolvedConfig, ResolvedEntryTypeDefinition } from "./resolved.mjs";
|
|
3
3
|
import { Plugin } from "./plugin.mjs";
|
|
4
|
+
import { HooksList, InferHooksListItem } from "./hooks.mjs";
|
|
4
5
|
import { ParsedTypeScriptConfig } from "./tsconfig.mjs";
|
|
5
6
|
import { InlineConfig, LogFn, UserConfig, WorkspaceConfig } from "./config.mjs";
|
|
6
|
-
import { HookKeys, Hooks, HooksList } from "./hooks.mjs";
|
|
7
7
|
import { ExternalIdResult, UnpluginBuildContext, UnpluginContext, UnpluginMessage } from "unplugin";
|
|
8
8
|
import { Project } from "ts-morph";
|
|
9
9
|
import { EnvPaths } from "@stryke/env/get-env-paths";
|
|
@@ -467,10 +467,10 @@ interface EnvironmentContextPlugin<TResolvedConfig extends ResolvedConfig = Reso
|
|
|
467
467
|
plugin: Plugin<PluginContext<TResolvedConfig>>;
|
|
468
468
|
context: PluginContext<TResolvedConfig>;
|
|
469
469
|
}
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
470
|
+
type SelectHookResultItem<TContext extends PluginContext, TKey extends string> = InferHooksListItem<TContext, TKey> & {
|
|
471
|
+
context: TContext;
|
|
472
|
+
};
|
|
473
|
+
type SelectHookResult<TContext extends PluginContext, TKey extends string> = SelectHookResultItem<TContext, TKey>[];
|
|
474
474
|
interface EnvironmentContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> extends Context<TResolvedConfig> {
|
|
475
475
|
/**
|
|
476
476
|
* The expected plugins options for the Powerlines project.
|
|
@@ -494,7 +494,7 @@ interface EnvironmentContext<TResolvedConfig extends ResolvedConfig = ResolvedCo
|
|
|
494
494
|
/**
|
|
495
495
|
* Retrieves the hook handlers for a specific hook name
|
|
496
496
|
*/
|
|
497
|
-
selectHooks: <TKey extends
|
|
497
|
+
selectHooks: <TKey extends string>(key: TKey, options?: SelectHooksOptions) => SelectHookResult<PluginContext<TResolvedConfig>, TKey>;
|
|
498
498
|
}
|
|
499
499
|
interface PluginContext<out TResolvedConfig extends ResolvedConfig = ResolvedConfig> extends Context<TResolvedConfig>, UnpluginContext {
|
|
500
500
|
/**
|
|
@@ -510,5 +510,6 @@ interface PluginContext<out TResolvedConfig extends ResolvedConfig = ResolvedCon
|
|
|
510
510
|
logger: LogFn;
|
|
511
511
|
}
|
|
512
512
|
type BuildPluginContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> = UnpluginBuildContext & PluginContext<TResolvedConfig>;
|
|
513
|
+
type WithUnpluginBuildContext<TContext extends PluginContext> = UnpluginBuildContext & TContext;
|
|
513
514
|
//#endregion
|
|
514
|
-
export { APIContext, BuildPluginContext, EnvironmentContext, PluginContext, SelectHooksOptions, UnresolvedContext };
|
|
515
|
+
export { APIContext, BuildPluginContext, Context, EnvironmentContext, PluginContext, SelectHooksOptions, UnresolvedContext, WithUnpluginBuildContext };
|