@powerlines/plugin-alloy 0.18.7 → 0.18.9
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/core/components/output.d.cts +2 -2
- package/dist/core/components/output.d.mts +2 -2
- package/dist/core/components/source-file.d.cts +2 -2
- package/dist/index.cjs +12 -5
- package/dist/index.mjs +12 -5
- package/dist/markdown/components/markdown-file.d.cts +3 -3
- package/dist/markdown/components/markdown-table.d.cts +4 -4
- package/dist/markdown/components/markdown-table.d.mts +4 -4
- package/dist/powerlines/src/internal/helpers/hooks.d.cts +47 -0
- package/dist/powerlines/src/internal/helpers/hooks.d.mts +47 -0
- package/dist/powerlines/src/types/api.d.cts +104 -0
- package/dist/powerlines/src/types/api.d.mts +104 -0
- package/dist/powerlines/src/types/build.d.cts +43 -3
- package/dist/powerlines/src/types/build.d.mts +43 -3
- package/dist/powerlines/src/types/config.d.cts +60 -4
- package/dist/powerlines/src/types/config.d.mts +60 -4
- package/dist/powerlines/src/types/context.d.cts +113 -1
- package/dist/powerlines/src/types/context.d.mts +113 -1
- 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.d.cts +35 -61
- package/dist/powerlines/src/types/plugin.d.mts +35 -61
- package/dist/powerlines/src/types/resolved.d.cts +16 -4
- package/dist/powerlines/src/types/resolved.d.mts +16 -4
- package/dist/powerlines/src/types/unplugin.d.cts +22 -0
- package/dist/powerlines/src/types/unplugin.d.mts +22 -0
- package/dist/types/components.d.cts +1 -3
- package/dist/types/components.d.mts +1 -3
- package/dist/typescript/components/builtin-file.d.cts +2 -2
- package/dist/typescript/components/builtin-file.d.mts +2 -2
- package/dist/typescript/components/dynamic-import-statement.d.cts +2 -2
- package/dist/typescript/components/dynamic-import-statement.d.mts +2 -2
- package/dist/typescript/components/entry-file.d.cts +2 -2
- package/dist/typescript/components/tsdoc-reflection.d.cts +4 -4
- package/dist/typescript/components/typescript-file.cjs +16 -10
- package/dist/typescript/components/typescript-file.d.cts +2 -0
- package/dist/typescript/components/typescript-file.d.mts +2 -0
- package/dist/typescript/components/typescript-file.mjs +16 -10
- package/dist/typescript/components/typescript-interface.d.cts +3 -3
- package/dist/typescript/components/typescript-interface.d.mts +3 -3
- package/dist/typescript/components/typescript-object.d.cts +3 -3
- package/dist/typescript/components/typescript-object.d.mts +3 -3
- package/package.json +5 -5
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BuilderVariant } from "./build.cjs";
|
|
2
2
|
import { CommandType } from "./commands.cjs";
|
|
3
3
|
import { EnvironmentResolvedConfig, ResolvedConfig } from "./resolved.cjs";
|
|
4
|
+
import { InferUnpluginOptions } from "./unplugin.cjs";
|
|
4
5
|
import { EnvironmentConfig, PluginConfig } from "./config.cjs";
|
|
5
6
|
import { BuildPluginContext, PluginContext, UnresolvedContext } from "./context.cjs";
|
|
6
|
-
import {
|
|
7
|
-
import { ExternalIdResult, HookFilter, TransformResult
|
|
7
|
+
import { AnyFunction, MaybePromise } from "@stryke/types/base";
|
|
8
|
+
import { ExternalIdResult, HookFilter, TransformResult } from "unplugin";
|
|
9
|
+
import { LoadResult } from "rollup";
|
|
8
10
|
import { ArrayValues } from "@stryke/types/array";
|
|
9
11
|
|
|
10
12
|
//#region ../powerlines/src/types/plugin.d.ts
|
|
11
|
-
interface PluginHookObject<THookFunction extends
|
|
13
|
+
interface PluginHookObject<THookFunction extends AnyFunction, TFilter extends keyof HookFilter = never> {
|
|
12
14
|
/**
|
|
13
15
|
* The order in which the plugin should be applied.
|
|
14
16
|
*/
|
|
@@ -22,7 +24,7 @@ interface PluginHookObject<THookFunction extends FunctionLike, TFilter extends k
|
|
|
22
24
|
*/
|
|
23
25
|
handler: THookFunction;
|
|
24
26
|
}
|
|
25
|
-
type PluginHook<THookFunction extends
|
|
27
|
+
type PluginHook<THookFunction extends AnyFunction, TFilter extends keyof HookFilter = never> = THookFunction | PluginHookObject<THookFunction, TFilter>;
|
|
26
28
|
/**
|
|
27
29
|
* A result returned by the plugin from the `types` hook that describes the declaration types output file.
|
|
28
30
|
*/
|
|
@@ -30,9 +32,7 @@ interface TypesResult {
|
|
|
30
32
|
directives?: string[];
|
|
31
33
|
code: string;
|
|
32
34
|
}
|
|
33
|
-
type
|
|
34
|
-
type ConfigResult<TContext extends PluginContext = PluginContext> = DeepPartial<TContext["config"]> & Record<string, any>;
|
|
35
|
-
interface BasePluginHookFunctions<TContext extends PluginContext = PluginContext> extends Record<CommandType, (this: TContext) => MaybePromise<void>> {
|
|
35
|
+
type PluginHookFunctions<TContext extends PluginContext> = { [TCommandType in CommandType]: (this: TContext) => MaybePromise<void> } & {
|
|
36
36
|
/**
|
|
37
37
|
* A function that returns configuration options to be merged with the build context's options.
|
|
38
38
|
*
|
|
@@ -47,7 +47,7 @@ interface BasePluginHookFunctions<TContext extends PluginContext = PluginContext
|
|
|
47
47
|
* @param config - The partial configuration object to be modified.
|
|
48
48
|
* @returns A promise that resolves to a partial configuration object.
|
|
49
49
|
*/
|
|
50
|
-
config: (this: UnresolvedContext<TContext["config"]>) => MaybePromise<
|
|
50
|
+
config: (this: UnresolvedContext<TContext["config"]>) => MaybePromise<DeepPartial<TContext["config"]> & Record<string, any>>;
|
|
51
51
|
/**
|
|
52
52
|
* Modify environment configs before it's resolved. The hook can either mutate the passed-in environment config directly, or return a partial config object that will be deeply merged into existing config.
|
|
53
53
|
*
|
|
@@ -109,7 +109,7 @@ interface BasePluginHookFunctions<TContext extends PluginContext = PluginContext
|
|
|
109
109
|
* @param id - The identifier of the source code.
|
|
110
110
|
* @returns A promise that resolves when the hook is complete.
|
|
111
111
|
*/
|
|
112
|
-
load: (this: BuildPluginContext<TContext["config"]> & TContext, id: string) => MaybePromise<
|
|
112
|
+
load: (this: BuildPluginContext<TContext["config"]> & TContext, id: string) => MaybePromise<LoadResult>;
|
|
113
113
|
/**
|
|
114
114
|
* A hook that is called to resolve the identifier of the source code.
|
|
115
115
|
*
|
|
@@ -129,56 +129,14 @@ interface BasePluginHookFunctions<TContext extends PluginContext = PluginContext
|
|
|
129
129
|
* @returns A promise that resolves when the hook is complete.
|
|
130
130
|
*/
|
|
131
131
|
writeBundle: (this: TContext) => MaybePromise<void>;
|
|
132
|
-
}
|
|
133
|
-
type BuildPlugin<TContext extends PluginContext = PluginContext, TBuildVariant$1 extends UnpluginBuildVariant = UnpluginBuildVariant, TOptions extends Required<UnpluginOptions>[TBuildVariant$1] = Required<UnpluginOptions>[TBuildVariant$1]> = { [TKey in keyof TOptions]: TOptions[TKey] extends FunctionLike ? (this: ThisParameterType<TOptions[TKey]> & TContext, ...args: Parameters<TOptions[TKey]>) => ReturnType<TOptions[TKey]> | MaybePromise<ReturnType<TOptions[TKey]>> : TOptions[TKey] };
|
|
134
|
-
type PluginHooks<TContext extends PluginContext = PluginContext> = { [TKey in keyof BasePluginHookFunctions<TContext>]: PluginHook<BasePluginHookFunctions<TContext>[TKey]> } & {
|
|
135
|
-
/**
|
|
136
|
-
* A function that returns configuration options to be merged with the build context's options.
|
|
137
|
-
*
|
|
138
|
-
* @remarks
|
|
139
|
-
* Modify config before it's resolved. The hook can either mutate {@link Context.config} on the passed-in context directly, or return a partial config object that will be deeply merged into existing config.
|
|
140
|
-
*
|
|
141
|
-
* @warning User plugins are resolved before running this hook so injecting other plugins inside the config hook will have no effect. If you want to add plugins, consider doing so in the {@link Plugin.dependsOn} property instead.
|
|
142
|
-
*
|
|
143
|
-
* @see https://vitejs.dev/guide/api-plugin#config
|
|
144
|
-
*
|
|
145
|
-
* @param this - The build context.
|
|
146
|
-
* @param config - The partial configuration object to be modified.
|
|
147
|
-
* @returns A promise that resolves to a partial configuration object.
|
|
148
|
-
*/
|
|
149
|
-
config: PluginHook<(this: UnresolvedContext<TContext["config"]>) => MaybePromise<ConfigResult<TContext>>> | ConfigResult<TContext>;
|
|
150
|
-
/**
|
|
151
|
-
* A hook that is called to transform the source code.
|
|
152
|
-
*
|
|
153
|
-
* @param this - The build context, unplugin build context, and unplugin context.
|
|
154
|
-
* @param code - The source code to transform.
|
|
155
|
-
* @param id - The identifier of the source code.
|
|
156
|
-
* @returns A promise that resolves when the hook is complete.
|
|
157
|
-
*/
|
|
158
|
-
transform: PluginHook<(this: BuildPluginContext<TContext["config"]> & TContext, code: string, id: string) => MaybePromise<TransformResult>, "code" | "id">;
|
|
159
|
-
/**
|
|
160
|
-
* A hook that is called to load the source code.
|
|
161
|
-
*
|
|
162
|
-
* @param this - The build context, unplugin build context, and unplugin context.
|
|
163
|
-
* @param id - The identifier of the source code.
|
|
164
|
-
* @returns A promise that resolves when the hook is complete.
|
|
165
|
-
*/
|
|
166
|
-
load: PluginHook<(this: BuildPluginContext<TContext["config"]> & TContext, id: string) => MaybePromise<TransformResult>, "id">;
|
|
167
|
-
/**
|
|
168
|
-
* A hook that is called to resolve the identifier of the source code.
|
|
169
|
-
*
|
|
170
|
-
* @param this - The build context, unplugin build context, and unplugin context.
|
|
171
|
-
* @param id - The identifier of the source code.
|
|
172
|
-
* @param importer - The importer of the source code.
|
|
173
|
-
* @param options - The options for resolving the identifier.
|
|
174
|
-
* @returns A promise that resolves when the hook is complete.
|
|
175
|
-
*/
|
|
176
|
-
resolveId: PluginHook<(this: BuildPluginContext<TContext["config"]> & TContext, id: string, importer: string | undefined, options: {
|
|
177
|
-
isEntry: boolean;
|
|
178
|
-
}) => MaybePromise<string | ExternalIdResult | null | undefined>, "id">;
|
|
179
132
|
};
|
|
180
|
-
type
|
|
181
|
-
|
|
133
|
+
type PluginHooks<TContext extends PluginContext> = { [TPluginHook in keyof PluginHookFunctions<TContext>]?: PluginHook<PluginHookFunctions<TContext>[TPluginHook]> } & {
|
|
134
|
+
transform: PluginHook<PluginHookFunctions<TContext>["transform"], "code" | "id">;
|
|
135
|
+
load: PluginHook<PluginHookFunctions<TContext>["load"], "id">;
|
|
136
|
+
resolveId: PluginHook<PluginHookFunctions<TContext>["resolveId"], "id">;
|
|
137
|
+
};
|
|
138
|
+
type DeepPartial<T> = { [K in keyof T]?: DeepPartial<T[K]> };
|
|
139
|
+
type Plugin<TContext extends PluginContext<ResolvedConfig> = PluginContext<ResolvedConfig>> = Partial<PluginHooks<TContext>> & {
|
|
182
140
|
/**
|
|
183
141
|
* The name of the plugin, for use in deduplication, error messages and logs.
|
|
184
142
|
*/
|
|
@@ -226,6 +184,22 @@ interface Plugin<TContext extends PluginContext<ResolvedConfig> = PluginContext<
|
|
|
226
184
|
* @returns `true` if the plugin should be active in the specified environment, `false` otherwise.
|
|
227
185
|
*/
|
|
228
186
|
applyToEnvironment?: (environment: EnvironmentResolvedConfig) => boolean | PluginConfig<TContext>;
|
|
229
|
-
|
|
187
|
+
/**
|
|
188
|
+
* A function that returns configuration options to be merged with the build context's options.
|
|
189
|
+
*
|
|
190
|
+
* @remarks
|
|
191
|
+
* Modify config before it's resolved. The hook can either mutate {@link Context.config} on the passed-in context directly, or return a partial config object that will be deeply merged into existing config.
|
|
192
|
+
*
|
|
193
|
+
* @warning User plugins are resolved before running this hook so injecting other plugins inside the config hook will have no effect. If you want to add plugins, consider doing so in the {@link Plugin.dependsOn} property instead.
|
|
194
|
+
*
|
|
195
|
+
* @see https://vitejs.dev/guide/api-plugin#config
|
|
196
|
+
*
|
|
197
|
+
* @param this - The build context.
|
|
198
|
+
* @param config - The partial configuration object to be modified.
|
|
199
|
+
* @returns A promise that resolves to a partial configuration object.
|
|
200
|
+
*/
|
|
201
|
+
config?: PluginHook<(this: UnresolvedContext<TContext["config"]>) => MaybePromise<DeepPartial<TContext["config"]> & Record<string, any>>> | (DeepPartial<TContext["config"]> & Record<string, any>);
|
|
202
|
+
} & { [TBuilderVariant in BuilderVariant]?: InferUnpluginOptions<TContext, TBuilderVariant> };
|
|
203
|
+
type PluginHookFields<TContext extends PluginContext = PluginContext> = keyof PluginHookFunctions<TContext>;
|
|
230
204
|
//#endregion
|
|
231
|
-
export { Plugin };
|
|
205
|
+
export { Plugin, PluginHook, PluginHookFields, PluginHookFunctions };
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BuilderVariant } from "./build.mjs";
|
|
2
2
|
import { CommandType } from "./commands.mjs";
|
|
3
3
|
import { EnvironmentResolvedConfig, ResolvedConfig } from "./resolved.mjs";
|
|
4
|
+
import { InferUnpluginOptions } from "./unplugin.mjs";
|
|
4
5
|
import { EnvironmentConfig, PluginConfig } from "./config.mjs";
|
|
5
6
|
import { BuildPluginContext, PluginContext, UnresolvedContext } from "./context.mjs";
|
|
6
|
-
import {
|
|
7
|
-
import { ExternalIdResult, HookFilter, TransformResult
|
|
7
|
+
import { AnyFunction, MaybePromise } from "@stryke/types/base";
|
|
8
|
+
import { ExternalIdResult, HookFilter, TransformResult } from "unplugin";
|
|
9
|
+
import { LoadResult } from "rollup";
|
|
8
10
|
import { ArrayValues } from "@stryke/types/array";
|
|
9
11
|
|
|
10
12
|
//#region ../powerlines/src/types/plugin.d.ts
|
|
11
|
-
interface PluginHookObject<THookFunction extends
|
|
13
|
+
interface PluginHookObject<THookFunction extends AnyFunction, TFilter extends keyof HookFilter = never> {
|
|
12
14
|
/**
|
|
13
15
|
* The order in which the plugin should be applied.
|
|
14
16
|
*/
|
|
@@ -22,7 +24,7 @@ interface PluginHookObject<THookFunction extends FunctionLike, TFilter extends k
|
|
|
22
24
|
*/
|
|
23
25
|
handler: THookFunction;
|
|
24
26
|
}
|
|
25
|
-
type PluginHook<THookFunction extends
|
|
27
|
+
type PluginHook<THookFunction extends AnyFunction, TFilter extends keyof HookFilter = never> = THookFunction | PluginHookObject<THookFunction, TFilter>;
|
|
26
28
|
/**
|
|
27
29
|
* A result returned by the plugin from the `types` hook that describes the declaration types output file.
|
|
28
30
|
*/
|
|
@@ -30,9 +32,7 @@ interface TypesResult {
|
|
|
30
32
|
directives?: string[];
|
|
31
33
|
code: string;
|
|
32
34
|
}
|
|
33
|
-
type
|
|
34
|
-
type ConfigResult<TContext extends PluginContext = PluginContext> = DeepPartial<TContext["config"]> & Record<string, any>;
|
|
35
|
-
interface BasePluginHookFunctions<TContext extends PluginContext = PluginContext> extends Record<CommandType, (this: TContext) => MaybePromise<void>> {
|
|
35
|
+
type PluginHookFunctions<TContext extends PluginContext> = { [TCommandType in CommandType]: (this: TContext) => MaybePromise<void> } & {
|
|
36
36
|
/**
|
|
37
37
|
* A function that returns configuration options to be merged with the build context's options.
|
|
38
38
|
*
|
|
@@ -47,7 +47,7 @@ interface BasePluginHookFunctions<TContext extends PluginContext = PluginContext
|
|
|
47
47
|
* @param config - The partial configuration object to be modified.
|
|
48
48
|
* @returns A promise that resolves to a partial configuration object.
|
|
49
49
|
*/
|
|
50
|
-
config: (this: UnresolvedContext<TContext["config"]>) => MaybePromise<
|
|
50
|
+
config: (this: UnresolvedContext<TContext["config"]>) => MaybePromise<DeepPartial<TContext["config"]> & Record<string, any>>;
|
|
51
51
|
/**
|
|
52
52
|
* Modify environment configs before it's resolved. The hook can either mutate the passed-in environment config directly, or return a partial config object that will be deeply merged into existing config.
|
|
53
53
|
*
|
|
@@ -109,7 +109,7 @@ interface BasePluginHookFunctions<TContext extends PluginContext = PluginContext
|
|
|
109
109
|
* @param id - The identifier of the source code.
|
|
110
110
|
* @returns A promise that resolves when the hook is complete.
|
|
111
111
|
*/
|
|
112
|
-
load: (this: BuildPluginContext<TContext["config"]> & TContext, id: string) => MaybePromise<
|
|
112
|
+
load: (this: BuildPluginContext<TContext["config"]> & TContext, id: string) => MaybePromise<LoadResult>;
|
|
113
113
|
/**
|
|
114
114
|
* A hook that is called to resolve the identifier of the source code.
|
|
115
115
|
*
|
|
@@ -129,56 +129,14 @@ interface BasePluginHookFunctions<TContext extends PluginContext = PluginContext
|
|
|
129
129
|
* @returns A promise that resolves when the hook is complete.
|
|
130
130
|
*/
|
|
131
131
|
writeBundle: (this: TContext) => MaybePromise<void>;
|
|
132
|
-
}
|
|
133
|
-
type BuildPlugin<TContext extends PluginContext = PluginContext, TBuildVariant$1 extends UnpluginBuildVariant = UnpluginBuildVariant, TOptions extends Required<UnpluginOptions>[TBuildVariant$1] = Required<UnpluginOptions>[TBuildVariant$1]> = { [TKey in keyof TOptions]: TOptions[TKey] extends FunctionLike ? (this: ThisParameterType<TOptions[TKey]> & TContext, ...args: Parameters<TOptions[TKey]>) => ReturnType<TOptions[TKey]> | MaybePromise<ReturnType<TOptions[TKey]>> : TOptions[TKey] };
|
|
134
|
-
type PluginHooks<TContext extends PluginContext = PluginContext> = { [TKey in keyof BasePluginHookFunctions<TContext>]: PluginHook<BasePluginHookFunctions<TContext>[TKey]> } & {
|
|
135
|
-
/**
|
|
136
|
-
* A function that returns configuration options to be merged with the build context's options.
|
|
137
|
-
*
|
|
138
|
-
* @remarks
|
|
139
|
-
* Modify config before it's resolved. The hook can either mutate {@link Context.config} on the passed-in context directly, or return a partial config object that will be deeply merged into existing config.
|
|
140
|
-
*
|
|
141
|
-
* @warning User plugins are resolved before running this hook so injecting other plugins inside the config hook will have no effect. If you want to add plugins, consider doing so in the {@link Plugin.dependsOn} property instead.
|
|
142
|
-
*
|
|
143
|
-
* @see https://vitejs.dev/guide/api-plugin#config
|
|
144
|
-
*
|
|
145
|
-
* @param this - The build context.
|
|
146
|
-
* @param config - The partial configuration object to be modified.
|
|
147
|
-
* @returns A promise that resolves to a partial configuration object.
|
|
148
|
-
*/
|
|
149
|
-
config: PluginHook<(this: UnresolvedContext<TContext["config"]>) => MaybePromise<ConfigResult<TContext>>> | ConfigResult<TContext>;
|
|
150
|
-
/**
|
|
151
|
-
* A hook that is called to transform the source code.
|
|
152
|
-
*
|
|
153
|
-
* @param this - The build context, unplugin build context, and unplugin context.
|
|
154
|
-
* @param code - The source code to transform.
|
|
155
|
-
* @param id - The identifier of the source code.
|
|
156
|
-
* @returns A promise that resolves when the hook is complete.
|
|
157
|
-
*/
|
|
158
|
-
transform: PluginHook<(this: BuildPluginContext<TContext["config"]> & TContext, code: string, id: string) => MaybePromise<TransformResult>, "code" | "id">;
|
|
159
|
-
/**
|
|
160
|
-
* A hook that is called to load the source code.
|
|
161
|
-
*
|
|
162
|
-
* @param this - The build context, unplugin build context, and unplugin context.
|
|
163
|
-
* @param id - The identifier of the source code.
|
|
164
|
-
* @returns A promise that resolves when the hook is complete.
|
|
165
|
-
*/
|
|
166
|
-
load: PluginHook<(this: BuildPluginContext<TContext["config"]> & TContext, id: string) => MaybePromise<TransformResult>, "id">;
|
|
167
|
-
/**
|
|
168
|
-
* A hook that is called to resolve the identifier of the source code.
|
|
169
|
-
*
|
|
170
|
-
* @param this - The build context, unplugin build context, and unplugin context.
|
|
171
|
-
* @param id - The identifier of the source code.
|
|
172
|
-
* @param importer - The importer of the source code.
|
|
173
|
-
* @param options - The options for resolving the identifier.
|
|
174
|
-
* @returns A promise that resolves when the hook is complete.
|
|
175
|
-
*/
|
|
176
|
-
resolveId: PluginHook<(this: BuildPluginContext<TContext["config"]> & TContext, id: string, importer: string | undefined, options: {
|
|
177
|
-
isEntry: boolean;
|
|
178
|
-
}) => MaybePromise<string | ExternalIdResult | null | undefined>, "id">;
|
|
179
132
|
};
|
|
180
|
-
type
|
|
181
|
-
|
|
133
|
+
type PluginHooks<TContext extends PluginContext> = { [TPluginHook in keyof PluginHookFunctions<TContext>]?: PluginHook<PluginHookFunctions<TContext>[TPluginHook]> } & {
|
|
134
|
+
transform: PluginHook<PluginHookFunctions<TContext>["transform"], "code" | "id">;
|
|
135
|
+
load: PluginHook<PluginHookFunctions<TContext>["load"], "id">;
|
|
136
|
+
resolveId: PluginHook<PluginHookFunctions<TContext>["resolveId"], "id">;
|
|
137
|
+
};
|
|
138
|
+
type DeepPartial<T> = { [K in keyof T]?: DeepPartial<T[K]> };
|
|
139
|
+
type Plugin<TContext extends PluginContext<ResolvedConfig> = PluginContext<ResolvedConfig>> = Partial<PluginHooks<TContext>> & {
|
|
182
140
|
/**
|
|
183
141
|
* The name of the plugin, for use in deduplication, error messages and logs.
|
|
184
142
|
*/
|
|
@@ -226,6 +184,22 @@ interface Plugin<TContext extends PluginContext<ResolvedConfig> = PluginContext<
|
|
|
226
184
|
* @returns `true` if the plugin should be active in the specified environment, `false` otherwise.
|
|
227
185
|
*/
|
|
228
186
|
applyToEnvironment?: (environment: EnvironmentResolvedConfig) => boolean | PluginConfig<TContext>;
|
|
229
|
-
|
|
187
|
+
/**
|
|
188
|
+
* A function that returns configuration options to be merged with the build context's options.
|
|
189
|
+
*
|
|
190
|
+
* @remarks
|
|
191
|
+
* Modify config before it's resolved. The hook can either mutate {@link Context.config} on the passed-in context directly, or return a partial config object that will be deeply merged into existing config.
|
|
192
|
+
*
|
|
193
|
+
* @warning User plugins are resolved before running this hook so injecting other plugins inside the config hook will have no effect. If you want to add plugins, consider doing so in the {@link Plugin.dependsOn} property instead.
|
|
194
|
+
*
|
|
195
|
+
* @see https://vitejs.dev/guide/api-plugin#config
|
|
196
|
+
*
|
|
197
|
+
* @param this - The build context.
|
|
198
|
+
* @param config - The partial configuration object to be modified.
|
|
199
|
+
* @returns A promise that resolves to a partial configuration object.
|
|
200
|
+
*/
|
|
201
|
+
config?: PluginHook<(this: UnresolvedContext<TContext["config"]>) => MaybePromise<DeepPartial<TContext["config"]> & Record<string, any>>> | (DeepPartial<TContext["config"]> & Record<string, any>);
|
|
202
|
+
} & { [TBuilderVariant in BuilderVariant]?: InferUnpluginOptions<TContext, TBuilderVariant> };
|
|
203
|
+
type PluginHookFields<TContext extends PluginContext = PluginContext> = keyof PluginHookFunctions<TContext>;
|
|
230
204
|
//#endregion
|
|
231
|
-
export { Plugin };
|
|
205
|
+
export { Plugin, PluginHook, PluginHookFields, PluginHookFunctions };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BuilderVariant } from "./build.cjs";
|
|
2
|
+
import { ESBuildUserConfig, EnvironmentConfig, FarmUserConfig, InlineConfig, OutputConfig, RolldownUserConfig, RollupUserConfig, RspackUserConfig, TsdownUserConfig, TsupUserConfig, UnbuildUserConfig, UserConfig as UserConfig$1, ViteUserConfig, WebpackUserConfig } from "./config.cjs";
|
|
2
3
|
import { NonUndefined } from "@stryke/types/base";
|
|
3
4
|
import { TypeDefinition } from "@stryke/types/configuration";
|
|
4
5
|
import { AssetGlob } from "@stryke/types/file";
|
|
@@ -32,7 +33,7 @@ type OutputResolvedConfig = Required<Omit<OutputConfig, "assets" | "storage"> &
|
|
|
32
33
|
/**
|
|
33
34
|
* The resolved options for the Powerlines project configuration.
|
|
34
35
|
*/
|
|
35
|
-
type ResolvedConfig<TUserConfig extends UserConfig = UserConfig> = Omit<TUserConfig, "name" | "title" | "organization" | "compatibilityDate" | "plugins" | "mode" | "environments" | "platform" | "tsconfig" | "lint" | "test" | "build" | "transform" | "deploy" | "variant" | "type" | "output" | "logLevel" | "framework" | "sourceRoot"> & Required<Pick<TUserConfig, "name" | "title" | "organization" | "compatibilityDate" | "plugins" | "mode" | "environments" | "tsconfig" | "lint" | "test" | "build" | "transform" | "deploy" | "framework" | "sourceRoot">> & {
|
|
36
|
+
type ResolvedConfig<TUserConfig extends UserConfig$1 = UserConfig$1> = Omit<TUserConfig, "name" | "title" | "organization" | "compatibilityDate" | "plugins" | "mode" | "environments" | "platform" | "tsconfig" | "lint" | "test" | "build" | "transform" | "deploy" | "variant" | "type" | "output" | "logLevel" | "framework" | "sourceRoot"> & Required<Pick<TUserConfig, "name" | "title" | "organization" | "compatibilityDate" | "plugins" | "mode" | "environments" | "tsconfig" | "lint" | "test" | "build" | "transform" | "deploy" | "framework" | "sourceRoot">> & {
|
|
36
37
|
/**
|
|
37
38
|
* The configuration options that were provided inline to the Powerlines CLI.
|
|
38
39
|
*/
|
|
@@ -67,7 +68,7 @@ type ResolvedConfig<TUserConfig extends UserConfig = UserConfig> = Omit<TUserCon
|
|
|
67
68
|
* Configuration provided to build processes
|
|
68
69
|
*
|
|
69
70
|
* @remarks
|
|
70
|
-
* This configuration can be used by plugins during the `build` command. It will generally contain options specific to the selected {@link
|
|
71
|
+
* This configuration can be used by plugins during the `build` command. It will generally contain options specific to the selected {@link BuilderVariant | build variant}.
|
|
71
72
|
*/
|
|
72
73
|
build: Omit<TUserConfig["build"], "override"> & Required<Pick<Required<TUserConfig["build"]>, "override">>;
|
|
73
74
|
/**
|
|
@@ -77,5 +78,16 @@ type ResolvedConfig<TUserConfig extends UserConfig = UserConfig> = Omit<TUserCon
|
|
|
77
78
|
*/
|
|
78
79
|
logLevel: "error" | "warn" | "info" | "debug" | "trace" | null;
|
|
79
80
|
};
|
|
81
|
+
type ViteResolvedConfig = ResolvedConfig<ViteUserConfig>;
|
|
82
|
+
type WebpackResolvedConfig = ResolvedConfig<WebpackUserConfig>;
|
|
83
|
+
type RspackResolvedConfig = ResolvedConfig<RspackUserConfig>;
|
|
84
|
+
type ESBuildResolvedConfig = ResolvedConfig<ESBuildUserConfig>;
|
|
85
|
+
type RollupResolvedConfig = ResolvedConfig<RollupUserConfig>;
|
|
86
|
+
type RolldownResolvedConfig = ResolvedConfig<RolldownUserConfig>;
|
|
87
|
+
type TsupResolvedConfig = ResolvedConfig<TsupUserConfig>;
|
|
88
|
+
type TsdownResolvedConfig = ResolvedConfig<TsdownUserConfig>;
|
|
89
|
+
type UnbuildResolvedConfig = ResolvedConfig<UnbuildUserConfig>;
|
|
90
|
+
type FarmResolvedConfig = ResolvedConfig<FarmUserConfig>;
|
|
91
|
+
type InferResolvedConfig<TBuildVariant extends BuilderVariant | undefined> = TBuildVariant extends undefined ? ResolvedConfig : TBuildVariant extends "webpack" ? WebpackResolvedConfig : TBuildVariant extends "rspack" ? RspackResolvedConfig : TBuildVariant extends "vite" ? ViteResolvedConfig : TBuildVariant extends "esbuild" ? ESBuildResolvedConfig : TBuildVariant extends "unbuild" ? UnbuildResolvedConfig : TBuildVariant extends "tsup" ? TsupResolvedConfig : TBuildVariant extends "tsdown" ? TsdownResolvedConfig : TBuildVariant extends "rolldown" ? RolldownResolvedConfig : TBuildVariant extends "rollup" ? RollupResolvedConfig : TBuildVariant extends "farm" ? FarmResolvedConfig : ResolvedConfig;
|
|
80
92
|
//#endregion
|
|
81
|
-
export { EnvironmentResolvedConfig, ResolvedConfig, ResolvedEntryTypeDefinition };
|
|
93
|
+
export { EnvironmentResolvedConfig, InferResolvedConfig, ResolvedConfig, ResolvedEntryTypeDefinition };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BuilderVariant } from "./build.mjs";
|
|
2
|
+
import { ESBuildUserConfig, EnvironmentConfig, FarmUserConfig, InlineConfig, OutputConfig, RolldownUserConfig, RollupUserConfig, RspackUserConfig, TsdownUserConfig, TsupUserConfig, UnbuildUserConfig, UserConfig as UserConfig$1, ViteUserConfig, WebpackUserConfig } from "./config.mjs";
|
|
2
3
|
import { NonUndefined } from "@stryke/types/base";
|
|
3
4
|
import { TypeDefinition } from "@stryke/types/configuration";
|
|
4
5
|
import { AssetGlob } from "@stryke/types/file";
|
|
@@ -32,7 +33,7 @@ type OutputResolvedConfig = Required<Omit<OutputConfig, "assets" | "storage"> &
|
|
|
32
33
|
/**
|
|
33
34
|
* The resolved options for the Powerlines project configuration.
|
|
34
35
|
*/
|
|
35
|
-
type ResolvedConfig<TUserConfig extends UserConfig = UserConfig> = Omit<TUserConfig, "name" | "title" | "organization" | "compatibilityDate" | "plugins" | "mode" | "environments" | "platform" | "tsconfig" | "lint" | "test" | "build" | "transform" | "deploy" | "variant" | "type" | "output" | "logLevel" | "framework" | "sourceRoot"> & Required<Pick<TUserConfig, "name" | "title" | "organization" | "compatibilityDate" | "plugins" | "mode" | "environments" | "tsconfig" | "lint" | "test" | "build" | "transform" | "deploy" | "framework" | "sourceRoot">> & {
|
|
36
|
+
type ResolvedConfig<TUserConfig extends UserConfig$1 = UserConfig$1> = Omit<TUserConfig, "name" | "title" | "organization" | "compatibilityDate" | "plugins" | "mode" | "environments" | "platform" | "tsconfig" | "lint" | "test" | "build" | "transform" | "deploy" | "variant" | "type" | "output" | "logLevel" | "framework" | "sourceRoot"> & Required<Pick<TUserConfig, "name" | "title" | "organization" | "compatibilityDate" | "plugins" | "mode" | "environments" | "tsconfig" | "lint" | "test" | "build" | "transform" | "deploy" | "framework" | "sourceRoot">> & {
|
|
36
37
|
/**
|
|
37
38
|
* The configuration options that were provided inline to the Powerlines CLI.
|
|
38
39
|
*/
|
|
@@ -67,7 +68,7 @@ type ResolvedConfig<TUserConfig extends UserConfig = UserConfig> = Omit<TUserCon
|
|
|
67
68
|
* Configuration provided to build processes
|
|
68
69
|
*
|
|
69
70
|
* @remarks
|
|
70
|
-
* This configuration can be used by plugins during the `build` command. It will generally contain options specific to the selected {@link
|
|
71
|
+
* This configuration can be used by plugins during the `build` command. It will generally contain options specific to the selected {@link BuilderVariant | build variant}.
|
|
71
72
|
*/
|
|
72
73
|
build: Omit<TUserConfig["build"], "override"> & Required<Pick<Required<TUserConfig["build"]>, "override">>;
|
|
73
74
|
/**
|
|
@@ -77,5 +78,16 @@ type ResolvedConfig<TUserConfig extends UserConfig = UserConfig> = Omit<TUserCon
|
|
|
77
78
|
*/
|
|
78
79
|
logLevel: "error" | "warn" | "info" | "debug" | "trace" | null;
|
|
79
80
|
};
|
|
81
|
+
type ViteResolvedConfig = ResolvedConfig<ViteUserConfig>;
|
|
82
|
+
type WebpackResolvedConfig = ResolvedConfig<WebpackUserConfig>;
|
|
83
|
+
type RspackResolvedConfig = ResolvedConfig<RspackUserConfig>;
|
|
84
|
+
type ESBuildResolvedConfig = ResolvedConfig<ESBuildUserConfig>;
|
|
85
|
+
type RollupResolvedConfig = ResolvedConfig<RollupUserConfig>;
|
|
86
|
+
type RolldownResolvedConfig = ResolvedConfig<RolldownUserConfig>;
|
|
87
|
+
type TsupResolvedConfig = ResolvedConfig<TsupUserConfig>;
|
|
88
|
+
type TsdownResolvedConfig = ResolvedConfig<TsdownUserConfig>;
|
|
89
|
+
type UnbuildResolvedConfig = ResolvedConfig<UnbuildUserConfig>;
|
|
90
|
+
type FarmResolvedConfig = ResolvedConfig<FarmUserConfig>;
|
|
91
|
+
type InferResolvedConfig<TBuildVariant extends BuilderVariant | undefined> = TBuildVariant extends undefined ? ResolvedConfig : TBuildVariant extends "webpack" ? WebpackResolvedConfig : TBuildVariant extends "rspack" ? RspackResolvedConfig : TBuildVariant extends "vite" ? ViteResolvedConfig : TBuildVariant extends "esbuild" ? ESBuildResolvedConfig : TBuildVariant extends "unbuild" ? UnbuildResolvedConfig : TBuildVariant extends "tsup" ? TsupResolvedConfig : TBuildVariant extends "tsdown" ? TsdownResolvedConfig : TBuildVariant extends "rolldown" ? RolldownResolvedConfig : TBuildVariant extends "rollup" ? RollupResolvedConfig : TBuildVariant extends "farm" ? FarmResolvedConfig : ResolvedConfig;
|
|
80
92
|
//#endregion
|
|
81
|
-
export { EnvironmentResolvedConfig, ResolvedConfig, ResolvedEntryTypeDefinition };
|
|
93
|
+
export { EnvironmentResolvedConfig, InferResolvedConfig, ResolvedConfig, ResolvedEntryTypeDefinition };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { BuilderVariant, InferUnpluginVariant, UnpluginBuilderVariant } from "./build.cjs";
|
|
2
|
+
import { InferResolvedConfig } from "./resolved.cjs";
|
|
3
|
+
import { API } from "./api.cjs";
|
|
4
|
+
import { PluginHook } from "./plugin.cjs";
|
|
5
|
+
import { Context } from "./context.cjs";
|
|
6
|
+
import { MaybePromise } from "@stryke/types/base";
|
|
7
|
+
import { HookFilter, UnpluginOptions } from "unplugin";
|
|
8
|
+
|
|
9
|
+
//#region ../powerlines/src/types/unplugin.d.ts
|
|
10
|
+
interface UnpluginOptions$1<TUnpluginBuilderVariant extends UnpluginBuilderVariant = UnpluginBuilderVariant> extends UnpluginOptions {
|
|
11
|
+
/**
|
|
12
|
+
* An API object that can be used for inter-plugin communication.
|
|
13
|
+
*
|
|
14
|
+
* @see https://rollupjs.org/plugin-development/#direct-plugin-communication
|
|
15
|
+
*/
|
|
16
|
+
api: API<InferResolvedConfig<TUnpluginBuilderVariant>>;
|
|
17
|
+
}
|
|
18
|
+
type InferUnpluginOptions<TContext extends Context = Context, TBuilderVariant extends BuilderVariant = BuilderVariant, TUnpluginVariant extends InferUnpluginVariant<TBuilderVariant> = InferUnpluginVariant<TBuilderVariant>> = { [TKey in keyof Required<UnpluginOptions$1<TUnpluginVariant>>[TUnpluginVariant]]?: Required<UnpluginOptions$1<TUnpluginVariant>>[TUnpluginVariant][TKey] extends infer THandler | {
|
|
19
|
+
handler: infer THandler;
|
|
20
|
+
} ? THandler extends ((this: infer TOriginalContext, ...args: infer TArgs) => infer TReturn) ? PluginHook<(this: TOriginalContext & TContext, ...args: TArgs) => MaybePromise<TReturn>, keyof HookFilter> : Required<UnpluginOptions$1<TUnpluginVariant>>[TUnpluginVariant][TKey] : Required<UnpluginOptions$1<TUnpluginVariant>>[TUnpluginVariant][TKey] };
|
|
21
|
+
//#endregion
|
|
22
|
+
export { InferUnpluginOptions };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { BuilderVariant, InferUnpluginVariant, UnpluginBuilderVariant } from "./build.mjs";
|
|
2
|
+
import { InferResolvedConfig } from "./resolved.mjs";
|
|
3
|
+
import { API } from "./api.mjs";
|
|
4
|
+
import { PluginHook } from "./plugin.mjs";
|
|
5
|
+
import { Context } from "./context.mjs";
|
|
6
|
+
import { MaybePromise } from "@stryke/types/base";
|
|
7
|
+
import { HookFilter, UnpluginOptions } from "unplugin";
|
|
8
|
+
|
|
9
|
+
//#region ../powerlines/src/types/unplugin.d.ts
|
|
10
|
+
interface UnpluginOptions$1<TUnpluginBuilderVariant extends UnpluginBuilderVariant = UnpluginBuilderVariant> extends UnpluginOptions {
|
|
11
|
+
/**
|
|
12
|
+
* An API object that can be used for inter-plugin communication.
|
|
13
|
+
*
|
|
14
|
+
* @see https://rollupjs.org/plugin-development/#direct-plugin-communication
|
|
15
|
+
*/
|
|
16
|
+
api: API<InferResolvedConfig<TUnpluginBuilderVariant>>;
|
|
17
|
+
}
|
|
18
|
+
type InferUnpluginOptions<TContext extends Context = Context, TBuilderVariant extends BuilderVariant = BuilderVariant, TUnpluginVariant extends InferUnpluginVariant<TBuilderVariant> = InferUnpluginVariant<TBuilderVariant>> = { [TKey in keyof Required<UnpluginOptions$1<TUnpluginVariant>>[TUnpluginVariant]]?: Required<UnpluginOptions$1<TUnpluginVariant>>[TUnpluginVariant][TKey] extends infer THandler | {
|
|
19
|
+
handler: infer THandler;
|
|
20
|
+
} ? THandler extends ((this: infer TOriginalContext, ...args: infer TArgs) => infer TReturn) ? PluginHook<(this: TOriginalContext & TContext, ...args: TArgs) => MaybePromise<TReturn>, keyof HookFilter> : Required<UnpluginOptions$1<TUnpluginVariant>>[TUnpluginVariant][TKey] : Required<UnpluginOptions$1<TUnpluginVariant>>[TUnpluginVariant][TKey] };
|
|
21
|
+
//#endregion
|
|
22
|
+
export { InferUnpluginOptions };
|
|
@@ -101,9 +101,7 @@ interface TypescriptFileImportItem {
|
|
|
101
101
|
alias?: string;
|
|
102
102
|
type?: boolean;
|
|
103
103
|
}
|
|
104
|
-
type TypescriptFileImports = Record<string, null | Array<TypescriptFileImportItem | string
|
|
105
|
-
$builtins?: Record<string, null | Array<TypescriptFileImportItem | string>>;
|
|
106
|
-
};
|
|
104
|
+
type TypescriptFileImports = Record<string, null | Array<TypescriptFileImportItem | string>>;
|
|
107
105
|
interface SourceFileHeaderProps extends ComponentProps {
|
|
108
106
|
/**
|
|
109
107
|
* If true, disables the ESLint directive at the top of the file.
|
|
@@ -101,9 +101,7 @@ interface TypescriptFileImportItem {
|
|
|
101
101
|
alias?: string;
|
|
102
102
|
type?: boolean;
|
|
103
103
|
}
|
|
104
|
-
type TypescriptFileImports = Record<string, null | Array<TypescriptFileImportItem | string
|
|
105
|
-
$builtins?: Record<string, null | Array<TypescriptFileImportItem | string>>;
|
|
106
|
-
};
|
|
104
|
+
type TypescriptFileImports = Record<string, null | Array<TypescriptFileImportItem | string>>;
|
|
107
105
|
interface SourceFileHeaderProps extends ComponentProps {
|
|
108
106
|
/**
|
|
109
107
|
* If true, disables the ESLint directive at the top of the file.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TSDocModuleProps } from "./tsdoc.cjs";
|
|
2
2
|
import { TypescriptFileProps } from "./typescript-file.cjs";
|
|
3
|
-
import * as
|
|
3
|
+
import * as _alloy_js_core12 from "@alloy-js/core";
|
|
4
4
|
|
|
5
5
|
//#region src/typescript/components/builtin-file.d.ts
|
|
6
6
|
type BuiltinFileProps = Omit<TypescriptFileProps, "path"> & Omit<TSDocModuleProps, "name"> & {
|
|
@@ -28,7 +28,7 @@ type BuiltinFileProps = Omit<TypescriptFileProps, "path"> & Omit<TSDocModuleProp
|
|
|
28
28
|
* @param props - The properties for the source file.
|
|
29
29
|
* @returns The rendered source file component.
|
|
30
30
|
*/
|
|
31
|
-
declare function BuiltinFile(props: BuiltinFileProps):
|
|
31
|
+
declare function BuiltinFile(props: BuiltinFileProps): _alloy_js_core12.Children;
|
|
32
32
|
declare type __ΩBuiltinFileProps = any[];
|
|
33
33
|
//#endregion
|
|
34
34
|
export { BuiltinFile, BuiltinFileProps, __ΩBuiltinFileProps };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TSDocModuleProps } from "./tsdoc.mjs";
|
|
2
2
|
import { TypescriptFileProps } from "./typescript-file.mjs";
|
|
3
|
-
import * as
|
|
3
|
+
import * as _alloy_js_core15 from "@alloy-js/core";
|
|
4
4
|
|
|
5
5
|
//#region src/typescript/components/builtin-file.d.ts
|
|
6
6
|
type BuiltinFileProps = Omit<TypescriptFileProps, "path"> & Omit<TSDocModuleProps, "name"> & {
|
|
@@ -28,7 +28,7 @@ type BuiltinFileProps = Omit<TypescriptFileProps, "path"> & Omit<TSDocModuleProp
|
|
|
28
28
|
* @param props - The properties for the source file.
|
|
29
29
|
* @returns The rendered source file component.
|
|
30
30
|
*/
|
|
31
|
-
declare function BuiltinFile(props: BuiltinFileProps):
|
|
31
|
+
declare function BuiltinFile(props: BuiltinFileProps): _alloy_js_core15.Children;
|
|
32
32
|
declare type __ΩBuiltinFileProps = any[];
|
|
33
33
|
//#endregion
|
|
34
34
|
export { BuiltinFile, BuiltinFileProps, __ΩBuiltinFileProps };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _alloy_js_core7 from "@alloy-js/core";
|
|
2
2
|
import { VarDeclarationProps } from "@alloy-js/typescript";
|
|
3
3
|
|
|
4
4
|
//#region src/typescript/components/dynamic-import-statement.d.ts
|
|
@@ -26,7 +26,7 @@ interface DynamicImportStatementProps extends Omit<VarDeclarationProps, "initial
|
|
|
26
26
|
* @param props - The properties for the dynamic import statement.
|
|
27
27
|
* @returns A `VarDeclaration` component representing the dynamic import statement.
|
|
28
28
|
*/
|
|
29
|
-
declare function DynamicImportStatement(props: DynamicImportStatementProps):
|
|
29
|
+
declare function DynamicImportStatement(props: DynamicImportStatementProps): _alloy_js_core7.Children;
|
|
30
30
|
declare type __ΩDynamicImportStatementProps = any[];
|
|
31
31
|
//#endregion
|
|
32
32
|
export { DynamicImportStatement, DynamicImportStatementProps, __ΩDynamicImportStatementProps };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _alloy_js_core16 from "@alloy-js/core";
|
|
2
2
|
import { VarDeclarationProps } from "@alloy-js/typescript";
|
|
3
3
|
|
|
4
4
|
//#region src/typescript/components/dynamic-import-statement.d.ts
|
|
@@ -26,7 +26,7 @@ interface DynamicImportStatementProps extends Omit<VarDeclarationProps, "initial
|
|
|
26
26
|
* @param props - The properties for the dynamic import statement.
|
|
27
27
|
* @returns A `VarDeclaration` component representing the dynamic import statement.
|
|
28
28
|
*/
|
|
29
|
-
declare function DynamicImportStatement(props: DynamicImportStatementProps):
|
|
29
|
+
declare function DynamicImportStatement(props: DynamicImportStatementProps): _alloy_js_core16.Children;
|
|
30
30
|
declare type __ΩDynamicImportStatementProps = any[];
|
|
31
31
|
//#endregion
|
|
32
32
|
export { DynamicImportStatement, DynamicImportStatementProps, __ΩDynamicImportStatementProps };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ResolvedEntryTypeDefinition } from "../../powerlines/src/types/resolved.cjs";
|
|
2
2
|
import { TypescriptFileProps } from "./typescript-file.cjs";
|
|
3
|
-
import * as
|
|
3
|
+
import * as _alloy_js_core8 from "@alloy-js/core";
|
|
4
4
|
|
|
5
5
|
//#region src/typescript/components/entry-file.d.ts
|
|
6
6
|
type EntryFileProps = TypescriptFileProps & {
|
|
@@ -21,7 +21,7 @@ type EntryFileProps = TypescriptFileProps & {
|
|
|
21
21
|
* @param props - The properties for the source file.
|
|
22
22
|
* @returns The rendered source file component.
|
|
23
23
|
*/
|
|
24
|
-
declare function EntryFile(props: EntryFileProps):
|
|
24
|
+
declare function EntryFile(props: EntryFileProps): _alloy_js_core8.Children;
|
|
25
25
|
declare type __ΩEntryFileProps = any[];
|
|
26
26
|
//#endregion
|
|
27
27
|
export { EntryFile, EntryFileProps, __ΩEntryFileProps };
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { TSDocProps } from "./tsdoc.cjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
3
3
|
|
|
4
4
|
//#region src/typescript/components/tsdoc-reflection.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* Generates a TypeScript interface property for the given reflection class.
|
|
7
7
|
*/
|
|
8
|
-
declare function TSDocReflectionClass<T extends Record<string, any> = Record<string, any>>(props: TSDocProps):
|
|
8
|
+
declare function TSDocReflectionClass<T extends Record<string, any> = Record<string, any>>(props: TSDocProps): _alloy_js_core0.Children;
|
|
9
9
|
/**
|
|
10
10
|
* Generates a TypeScript interface property for the given reflection class.
|
|
11
11
|
*/
|
|
12
|
-
declare function TSDocReflectionProperty(props: TSDocProps):
|
|
12
|
+
declare function TSDocReflectionProperty(props: TSDocProps): _alloy_js_core0.Children;
|
|
13
13
|
/**
|
|
14
14
|
* Generates a TypeScript interface property for the given reflection class.
|
|
15
15
|
*/
|
|
16
|
-
declare function TSDocReflectionMethod(props: TSDocProps):
|
|
16
|
+
declare function TSDocReflectionMethod(props: TSDocProps): _alloy_js_core0.Children;
|
|
17
17
|
//#endregion
|
|
18
18
|
export { TSDocReflectionClass, TSDocReflectionMethod, TSDocReflectionProperty };
|
|
@@ -152,13 +152,13 @@ function TypescriptFileHeader(props) {
|
|
|
152
152
|
* @returns The rendered source file header.
|
|
153
153
|
*/
|
|
154
154
|
function TypescriptFileHeaderImports(props) {
|
|
155
|
-
const { imports } = props;
|
|
155
|
+
const { imports, builtinImports } = props;
|
|
156
156
|
const context = require_core_contexts_context.usePowerlines();
|
|
157
157
|
const sourceFile = (0, __alloy_js_typescript.useSourceFile)();
|
|
158
158
|
const scope = props.scope ?? sourceFile.scope;
|
|
159
159
|
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
160
160
|
get when() {
|
|
161
|
-
return scope.importedModules.size > 0 || !!imports && Object.keys(imports).length > 0;
|
|
161
|
+
return scope.importedModules.size > 0 || !!builtinImports && Object.keys(builtinImports).length > 0 || !!imports && Object.keys(imports).length > 0;
|
|
162
162
|
},
|
|
163
163
|
get children() {
|
|
164
164
|
return [
|
|
@@ -171,19 +171,25 @@ function TypescriptFileHeaderImports(props) {
|
|
|
171
171
|
get each() {
|
|
172
172
|
return Object.entries(imports ?? {});
|
|
173
173
|
},
|
|
174
|
-
children: ([module$1,
|
|
175
|
-
if (module$1 === "$builtins") return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
|
|
176
|
-
get each() {
|
|
177
|
-
return Object.entries(imported ?? {});
|
|
178
|
-
},
|
|
179
|
-
children: ([builtinModule, builtinImports]) => __alloy_js_core.code`import ${builtinImports === null ? "" : ` from ${builtinImports.filter((i) => !(0, __stryke_type_checks_is_string.isString)(i) && i.default).map((i) => i.alias ? i.alias : i.name).join(", ") + (builtinImports.filter((i) => !(0, __stryke_type_checks_is_string.isString)(i) && i.default).length > 0 && builtinImports.filter((i) => (0, __stryke_type_checks_is_string.isString)(i) || !i.default).length > 0 ? ", " : "") + (builtinImports.filter((i) => (0, __stryke_type_checks_is_string.isString)(i) || !i.default).length > 0 ? `{ ${builtinImports.map((i) => (0, __stryke_type_checks_is_string.isString)(i) ? i : i.alias ? `${i.name} as ${i.alias}` : i.name).join(", ")} }` : "")} `} "${builtinModule.includes(":") ? builtinModule : `${context.config.output.builtinPrefix}:${builtinModule}`}";`
|
|
180
|
-
});
|
|
181
|
-
const normalImports = imported;
|
|
174
|
+
children: ([module$1, normalImports]) => {
|
|
182
175
|
return __alloy_js_core.code`import ${normalImports === null ? "" : ` from ${normalImports.filter((i) => !(0, __stryke_type_checks_is_string.isString)(i) && i.default).map((i) => i.alias ? i.alias : i.name).join(", ") + (normalImports.filter((i) => !(0, __stryke_type_checks_is_string.isString)(i) && i.default).length > 0 && normalImports.filter((i) => (0, __stryke_type_checks_is_string.isString)(i) || !i.default).length > 0 ? ", " : "") + (normalImports.filter((i) => (0, __stryke_type_checks_is_string.isString)(i) || !i.default).length > 0 ? `{ ${normalImports.map((i) => (0, __stryke_type_checks_is_string.isString)(i) ? i : i.alias ? `${i.name} as ${i.alias}` : i.name).join(", ")} }` : "")} `} "${module$1}";`;
|
|
183
176
|
}
|
|
184
177
|
});
|
|
185
178
|
}
|
|
186
179
|
}),
|
|
180
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
181
|
+
get when() {
|
|
182
|
+
return builtinImports && Object.keys(builtinImports).length > 0;
|
|
183
|
+
},
|
|
184
|
+
get children() {
|
|
185
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
|
|
186
|
+
get each() {
|
|
187
|
+
return Object.entries(builtinImports ?? {});
|
|
188
|
+
},
|
|
189
|
+
children: ([builtinModule, builtinImports$1]) => __alloy_js_core.code`import ${builtinImports$1 === null ? "" : ` from ${builtinImports$1.filter((i) => !(0, __stryke_type_checks_is_string.isString)(i) && i.default).map((i) => i.alias ? i.alias : i.name).join(", ") + (builtinImports$1.filter((i) => !(0, __stryke_type_checks_is_string.isString)(i) && i.default).length > 0 && builtinImports$1.filter((i) => (0, __stryke_type_checks_is_string.isString)(i) || !i.default).length > 0 ? ", " : "") + (builtinImports$1.filter((i) => (0, __stryke_type_checks_is_string.isString)(i) || !i.default).length > 0 ? `{ ${builtinImports$1.map((i) => (0, __stryke_type_checks_is_string.isString)(i) ? i : i.alias ? `${i.name} as ${i.alias}` : i.name).join(", ")} }` : "")} `} "${builtinModule.includes(":") ? builtinModule : `${context.config.output.builtinPrefix}:${builtinModule}`}";`
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
}),
|
|
187
193
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
188
194
|
get when() {
|
|
189
195
|
return scope.importedModules.size > 0;
|