@powerlines/plugin-content-collections 0.1.57 → 0.1.59
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/_virtual/rolldown_runtime.cjs +1 -0
- package/dist/helpers/create-emitter.cjs +1 -1
- package/dist/helpers/create-emitter.d.cts +28 -1
- package/dist/helpers/create-emitter.d.mts +28 -1
- package/dist/helpers/create-emitter.mjs +1 -1
- package/dist/helpers/create-writer.cjs +6 -1
- package/dist/helpers/create-writer.d.cts +12 -2
- package/dist/helpers/create-writer.d.mts +12 -2
- package/dist/helpers/create-writer.mjs +6 -1
- package/dist/helpers/index.cjs +1 -1
- package/dist/helpers/index.d.cts +2 -4
- package/dist/helpers/index.d.mts +2 -4
- package/dist/helpers/index.mjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +4 -5
- package/dist/index.d.mts +6 -5
- package/dist/index.mjs +1 -1
- package/dist/powerlines/src/lib/utilities/file-header.cjs +4 -0
- package/dist/powerlines/src/lib/utilities/file-header.mjs +4 -0
- package/dist/powerlines/src/plugin-utils/paths.cjs +1 -0
- package/dist/powerlines/src/plugin-utils/paths.mjs +1 -0
- package/dist/powerlines/src/types/build.d.cts +139 -0
- package/dist/powerlines/src/types/build.d.mts +139 -0
- package/dist/powerlines/src/types/commands.d.cts +8 -0
- package/dist/powerlines/src/types/commands.d.mts +8 -0
- package/dist/powerlines/src/types/config.d.cts +345 -0
- package/dist/powerlines/src/types/config.d.mts +345 -0
- package/dist/powerlines/src/types/context.d.cts +347 -0
- package/dist/powerlines/src/types/context.d.mts +347 -0
- package/dist/powerlines/src/types/fs.d.cts +458 -0
- package/dist/powerlines/src/types/fs.d.mts +458 -0
- package/dist/powerlines/src/types/plugin.d.cts +232 -0
- package/dist/powerlines/src/types/plugin.d.mts +232 -0
- package/dist/powerlines/src/types/resolved.d.cts +81 -0
- package/dist/powerlines/src/types/resolved.d.mts +81 -0
- package/dist/powerlines/src/types/tsconfig.d.cts +69 -0
- package/dist/powerlines/src/types/tsconfig.d.mts +69 -0
- package/dist/types/index.cjs +0 -1
- package/dist/types/index.d.cts +1 -2
- package/dist/types/index.d.mts +1 -2
- package/dist/types/index.mjs +1 -1
- package/dist/types/plugin.cjs +0 -1
- package/dist/types/plugin.d.cts +48 -1
- package/dist/types/plugin.d.mts +48 -1
- package/dist/types/plugin.mjs +1 -1
- package/package.json +10 -10
- package/dist/create-emitter-Bk1iruR0.d.cts +0 -29
- package/dist/create-emitter-Ccqc-tkP.d.mts +0 -29
- package/dist/create-emitter-D2D-OWFH.mjs +0 -1
- package/dist/create-emitter-D5prAv7U.cjs +0 -1
- package/dist/create-writer-BUb6uBji.mjs +0 -9
- package/dist/create-writer-BzlzYION.d.cts +0 -13
- package/dist/create-writer-goiWOycc.d.mts +0 -13
- package/dist/create-writer-v6g9eZ0E.cjs +0 -9
- package/dist/helpers-DLqVzgm5.mjs +0 -1
- package/dist/helpers-yB1XkvQI.cjs +0 -0
- package/dist/index-BL32-cvv.d.cts +0 -1
- package/dist/index-BR1oNnaF.d.cts +0 -1
- package/dist/index-Bk0eNZmQ.d.mts +0 -1
- package/dist/index-DNLi60D-.d.mts +0 -1
- package/dist/plugin-BcG58blY.d.mts +0 -1683
- package/dist/plugin-CdWcc0Nu.d.cts +0 -1683
- package/dist/plugin-Ckx8qAq8.cjs +0 -0
- package/dist/plugin-G4qbpIjB.mjs +0 -1
- package/dist/types-CSNCwSXh.mjs +0 -1
- package/dist/types-a8gm_IaQ.cjs +0 -0
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
import { UnpluginBuildVariant } from "./build.mjs";
|
|
2
|
+
import { CommandType } from "./commands.mjs";
|
|
3
|
+
import { EnvironmentResolvedConfig, ResolvedConfig } from "./resolved.mjs";
|
|
4
|
+
import { BuildPluginContext, PluginContext, UnresolvedContext } from "./context.mjs";
|
|
5
|
+
import { EnvironmentConfig, PluginConfig } from "./config.mjs";
|
|
6
|
+
import { FunctionLike, MaybePromise } from "@stryke/types/base";
|
|
7
|
+
import { ExternalIdResult, HookFilter, TransformResult, UnpluginOptions } from "unplugin";
|
|
8
|
+
import { ArrayValues } from "@stryke/types/array";
|
|
9
|
+
|
|
10
|
+
//#region ../powerlines/src/types/plugin.d.ts
|
|
11
|
+
interface PluginHookObject<THookFunction extends FunctionLike, TFilter extends keyof HookFilter = never> {
|
|
12
|
+
/**
|
|
13
|
+
* The order in which the plugin should be applied.
|
|
14
|
+
*/
|
|
15
|
+
order?: "pre" | "post" | null | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* A filter to determine when the hook should be called.
|
|
18
|
+
*/
|
|
19
|
+
filter?: Pick<HookFilter, TFilter>;
|
|
20
|
+
/**
|
|
21
|
+
* The hook function to be called.
|
|
22
|
+
*/
|
|
23
|
+
handler: THookFunction;
|
|
24
|
+
}
|
|
25
|
+
type PluginHook<THookFunction extends FunctionLike, TFilter extends keyof HookFilter = never> = THookFunction | PluginHookObject<THookFunction, TFilter>;
|
|
26
|
+
/**
|
|
27
|
+
* A result returned by the plugin from the `types` hook that describes the declaration types output file.
|
|
28
|
+
*/
|
|
29
|
+
interface TypesResult {
|
|
30
|
+
directives?: string[];
|
|
31
|
+
code: string;
|
|
32
|
+
}
|
|
33
|
+
type DeepPartial<T> = { [K in keyof T]?: DeepPartial<T[K]> };
|
|
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>> {
|
|
36
|
+
/**
|
|
37
|
+
* A function that returns configuration options to be merged with the build context's options.
|
|
38
|
+
*
|
|
39
|
+
* @remarks
|
|
40
|
+
* Modify config before it's resolved. The hook can either mutate {@link Context.config} on the passed-in context directly, or return a partial config object that will be deeply merged into existing config.
|
|
41
|
+
*
|
|
42
|
+
* @warning User plugins are resolved before running this hook so injecting other plugins inside the config hook will have no effect. If you want to add plugins, consider doing so in the {@link Plugin.dependsOn} property instead.
|
|
43
|
+
*
|
|
44
|
+
* @see https://vitejs.dev/guide/api-plugin#config
|
|
45
|
+
*
|
|
46
|
+
* @param this - The build context.
|
|
47
|
+
* @param config - The partial configuration object to be modified.
|
|
48
|
+
* @returns A promise that resolves to a partial configuration object.
|
|
49
|
+
*/
|
|
50
|
+
config: (this: UnresolvedContext<TContext["config"]>) => MaybePromise<ConfigResult<TContext>>;
|
|
51
|
+
/**
|
|
52
|
+
* Modify environment configs before it's resolved. The hook can either mutate the passed-in environment config directly, or return a partial config object that will be deeply merged into existing config.
|
|
53
|
+
*
|
|
54
|
+
* @remarks
|
|
55
|
+
* This hook is called for each environment with a partially resolved environment config that already accounts for the default environment config values set at the root level. If plugins need to modify the config of a given environment, they should do it in this hook instead of the config hook. Leaving the config hook only for modifying the root default environment config.
|
|
56
|
+
*
|
|
57
|
+
* @see https://vitejs.dev/guide/api-plugin#configenvironment
|
|
58
|
+
*
|
|
59
|
+
* @param this - The build context.
|
|
60
|
+
* @param name - The name of the environment being configured.
|
|
61
|
+
* @param environment - The Vite-like environment object containing information about the current build environment.
|
|
62
|
+
* @returns A promise that resolves when the hook is complete.
|
|
63
|
+
*/
|
|
64
|
+
configEnvironment: (this: TContext, name: string, environment: EnvironmentConfig) => MaybePromise<Partial<EnvironmentResolvedConfig> | undefined | null>;
|
|
65
|
+
/**
|
|
66
|
+
* A hook that is called when the plugin is resolved.
|
|
67
|
+
*
|
|
68
|
+
* @see https://vitejs.dev/guide/api-plugin#configresolved
|
|
69
|
+
*
|
|
70
|
+
* @param this - The build context.
|
|
71
|
+
* @returns A promise that resolves when the hook is complete.
|
|
72
|
+
*/
|
|
73
|
+
configResolved: (this: TContext) => MaybePromise<void>;
|
|
74
|
+
/**
|
|
75
|
+
* A hook that is called to overwrite the generated declaration types file (.d.ts). The generated type definitions should describe the built-in modules/logic added during the `prepare` task.
|
|
76
|
+
*
|
|
77
|
+
* @param this - The build context.
|
|
78
|
+
* @param code - The source code to generate types for.
|
|
79
|
+
* @returns A promise that resolves when the hook is complete.
|
|
80
|
+
*/
|
|
81
|
+
types: (this: TContext, code: string) => MaybePromise<TypesResult | string | undefined | null>;
|
|
82
|
+
/**
|
|
83
|
+
* A hook that is called at the start of the build process.
|
|
84
|
+
*
|
|
85
|
+
* @param this - The build context and unplugin build context.
|
|
86
|
+
* @returns A promise that resolves when the hook is complete.
|
|
87
|
+
*/
|
|
88
|
+
buildStart: (this: BuildPluginContext<TContext["config"]> & TContext) => MaybePromise<void>;
|
|
89
|
+
/**
|
|
90
|
+
* A hook that is called at the end of the build process.
|
|
91
|
+
*
|
|
92
|
+
* @param this - The build context and unplugin build context.
|
|
93
|
+
* @returns A promise that resolves when the hook is complete.
|
|
94
|
+
*/
|
|
95
|
+
buildEnd: (this: BuildPluginContext<TContext["config"]> & TContext) => MaybePromise<void>;
|
|
96
|
+
/**
|
|
97
|
+
* A hook that is called to transform the source code.
|
|
98
|
+
*
|
|
99
|
+
* @param this - The build context, unplugin build context, and unplugin context.
|
|
100
|
+
* @param code - The source code to transform.
|
|
101
|
+
* @param id - The identifier of the source code.
|
|
102
|
+
* @returns A promise that resolves when the hook is complete.
|
|
103
|
+
*/
|
|
104
|
+
transform: (this: BuildPluginContext<TContext["config"]> & TContext, code: string, id: string) => MaybePromise<TransformResult>;
|
|
105
|
+
/**
|
|
106
|
+
* A hook that is called to load the source code.
|
|
107
|
+
*
|
|
108
|
+
* @param this - The build context, unplugin build context, and unplugin context.
|
|
109
|
+
* @param id - The identifier of the source code.
|
|
110
|
+
* @returns A promise that resolves when the hook is complete.
|
|
111
|
+
*/
|
|
112
|
+
load: (this: BuildPluginContext<TContext["config"]> & TContext, id: string) => MaybePromise<TransformResult>;
|
|
113
|
+
/**
|
|
114
|
+
* A hook that is called to resolve the identifier of the source code.
|
|
115
|
+
*
|
|
116
|
+
* @param this - The build context, unplugin build context, and unplugin context.
|
|
117
|
+
* @param id - The identifier of the source code.
|
|
118
|
+
* @param importer - The importer of the source code.
|
|
119
|
+
* @param options - The options for resolving the identifier.
|
|
120
|
+
* @returns A promise that resolves when the hook is complete.
|
|
121
|
+
*/
|
|
122
|
+
resolveId: (this: BuildPluginContext<TContext["config"]> & TContext, id: string, importer: string | undefined, options: {
|
|
123
|
+
isEntry: boolean;
|
|
124
|
+
}) => MaybePromise<string | ExternalIdResult | null | undefined>;
|
|
125
|
+
/**
|
|
126
|
+
* A hook that is called to write the bundle to disk.
|
|
127
|
+
*
|
|
128
|
+
* @param this - The build context.
|
|
129
|
+
* @returns A promise that resolves when the hook is complete.
|
|
130
|
+
*/
|
|
131
|
+
writeBundle: (this: TContext) => MaybePromise<void>;
|
|
132
|
+
}
|
|
133
|
+
type 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
|
+
};
|
|
180
|
+
type PluginBuildPlugins<TContext extends PluginContext = PluginContext> = { [TBuildVariant in UnpluginBuildVariant]?: BuildPlugin<TContext, TBuildVariant> };
|
|
181
|
+
interface Plugin<in out TContext extends PluginContext<ResolvedConfig> = PluginContext<ResolvedConfig>> extends Partial<PluginHooks<TContext>>, PluginBuildPlugins<TContext> {
|
|
182
|
+
/**
|
|
183
|
+
* The name of the plugin, for use in deduplication, error messages and logs.
|
|
184
|
+
*/
|
|
185
|
+
name: string;
|
|
186
|
+
/**
|
|
187
|
+
* An API object that can be used for inter-plugin communication.
|
|
188
|
+
*
|
|
189
|
+
* @see https://rollupjs.org/plugin-development/#direct-plugin-communication
|
|
190
|
+
*/
|
|
191
|
+
api?: Record<string, any>;
|
|
192
|
+
/**
|
|
193
|
+
* Enforce plugin invocation tier similar to webpack loaders. Hooks ordering is still subject to the `order` property in the hook object.
|
|
194
|
+
*
|
|
195
|
+
* @remarks
|
|
196
|
+
* The Plugin invocation order is as follows:
|
|
197
|
+
* - `enforce: 'pre'` plugins
|
|
198
|
+
* - `order: 'pre'` plugin hooks
|
|
199
|
+
* - any other plugins (normal)
|
|
200
|
+
* - `order: 'post'` plugin hooks
|
|
201
|
+
* - `enforce: 'post'` plugins
|
|
202
|
+
*
|
|
203
|
+
* @see https://vitejs.dev/guide/api-plugin.html#plugin-ordering
|
|
204
|
+
* @see https://rollupjs.org/plugin-development/#build-hooks
|
|
205
|
+
* @see https://webpack.js.org/concepts/loaders/#enforce---pre-and-post
|
|
206
|
+
* @see https://esbuild.github.io/plugins/#concepts
|
|
207
|
+
*/
|
|
208
|
+
enforce?: "pre" | "post";
|
|
209
|
+
/**
|
|
210
|
+
* A function to determine if two plugins are the same and can be de-duplicated.
|
|
211
|
+
*
|
|
212
|
+
* @remarks
|
|
213
|
+
* If this is not provided, plugins are de-duplicated by comparing their names.
|
|
214
|
+
*
|
|
215
|
+
* @param other - The other plugin to compare against.
|
|
216
|
+
* @returns `true` if the two plugins are the same, `false` otherwise.
|
|
217
|
+
*/
|
|
218
|
+
dedupe?: false | ((other: Plugin<any>) => boolean);
|
|
219
|
+
/**
|
|
220
|
+
* A list of pre-requisite plugins that must be loaded before this plugin can be used.
|
|
221
|
+
*/
|
|
222
|
+
dependsOn?: PluginConfig<any>[];
|
|
223
|
+
/**
|
|
224
|
+
* Define environments where this plugin should be active. By default, the plugin is active in all environments.
|
|
225
|
+
*
|
|
226
|
+
* @param environment - The environment to check.
|
|
227
|
+
* @returns `true` if the plugin should be active in the specified environment, `false` otherwise.
|
|
228
|
+
*/
|
|
229
|
+
applyToEnvironment?: (environment: EnvironmentResolvedConfig) => boolean | PluginConfig<any>;
|
|
230
|
+
}
|
|
231
|
+
//#endregion
|
|
232
|
+
export { Plugin };
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { EnvironmentConfig, InlineConfig, OutputConfig, UserConfig } from "./config.cjs";
|
|
2
|
+
import { NonUndefined } from "@stryke/types/base";
|
|
3
|
+
import { TypeDefinition } from "@stryke/types/configuration";
|
|
4
|
+
import { AssetGlob } from "@stryke/types/file";
|
|
5
|
+
import { ResolvedPreviewOptions } from "vite";
|
|
6
|
+
|
|
7
|
+
//#region ../powerlines/src/types/resolved.d.ts
|
|
8
|
+
interface ResolvedEntryTypeDefinition extends TypeDefinition {
|
|
9
|
+
/**
|
|
10
|
+
* The user provided entry point in the source code
|
|
11
|
+
*/
|
|
12
|
+
input: TypeDefinition;
|
|
13
|
+
/**
|
|
14
|
+
* An optional name to use in the package export during the build process
|
|
15
|
+
*/
|
|
16
|
+
output?: string;
|
|
17
|
+
}
|
|
18
|
+
type EnvironmentResolvedConfig = Omit<EnvironmentConfig, "consumer" | "ssr" | "preview"> & Required<Pick<EnvironmentConfig, "consumer" | "ssr">> & {
|
|
19
|
+
/**
|
|
20
|
+
* The name of the environment
|
|
21
|
+
*/
|
|
22
|
+
name: string;
|
|
23
|
+
/**
|
|
24
|
+
* Configuration options for the preview server
|
|
25
|
+
*/
|
|
26
|
+
preview?: ResolvedPreviewOptions;
|
|
27
|
+
};
|
|
28
|
+
type ResolvedAssetGlob = AssetGlob & Required<Pick<AssetGlob, "input">>;
|
|
29
|
+
type OutputResolvedConfig = Required<Omit<OutputConfig, "assets" | "storage"> & {
|
|
30
|
+
assets: ResolvedAssetGlob[];
|
|
31
|
+
}> & Pick<OutputConfig, "storage">;
|
|
32
|
+
/**
|
|
33
|
+
* The resolved options for the Powerlines project configuration.
|
|
34
|
+
*/
|
|
35
|
+
type ResolvedConfig<TUserConfig extends UserConfig = UserConfig> = Omit<TUserConfig, "name" | "title" | "plugins" | "mode" | "environments" | "platform" | "tsconfig" | "lint" | "test" | "build" | "transform" | "deploy" | "variant" | "type" | "output" | "logLevel" | "framework" | "sourceRoot"> & Required<Pick<TUserConfig, "name" | "title" | "plugins" | "mode" | "environments" | "tsconfig" | "lint" | "test" | "build" | "transform" | "deploy" | "framework" | "sourceRoot">> & {
|
|
36
|
+
/**
|
|
37
|
+
* The configuration options that were provided inline to the Powerlines CLI.
|
|
38
|
+
*/
|
|
39
|
+
inlineConfig: InlineConfig<TUserConfig>;
|
|
40
|
+
/**
|
|
41
|
+
* The original configuration options that were provided by the user to the Powerlines process.
|
|
42
|
+
*/
|
|
43
|
+
userConfig: TUserConfig;
|
|
44
|
+
/**
|
|
45
|
+
* A string identifier for the Powerlines command being executed.
|
|
46
|
+
*/
|
|
47
|
+
command: NonUndefined<InlineConfig<TUserConfig>["command"]>;
|
|
48
|
+
/**
|
|
49
|
+
* The root directory of the project's source code
|
|
50
|
+
*
|
|
51
|
+
* @defaultValue "\{projectRoot\}/src"
|
|
52
|
+
*/
|
|
53
|
+
sourceRoot: NonUndefined<TUserConfig["sourceRoot"]>;
|
|
54
|
+
/**
|
|
55
|
+
* The root directory of the project.
|
|
56
|
+
*/
|
|
57
|
+
projectRoot: NonUndefined<TUserConfig["root"]>;
|
|
58
|
+
/**
|
|
59
|
+
* The type of project being built.
|
|
60
|
+
*/
|
|
61
|
+
projectType: NonUndefined<TUserConfig["type"]>;
|
|
62
|
+
/**
|
|
63
|
+
* The output configuration options to use for the build process
|
|
64
|
+
*/
|
|
65
|
+
output: OutputResolvedConfig;
|
|
66
|
+
/**
|
|
67
|
+
* Configuration provided to build processes
|
|
68
|
+
*
|
|
69
|
+
* @remarks
|
|
70
|
+
* This configuration can be used by plugins during the `build` command. It will generally contain options specific to the selected {@link BuildVariant | build variant}.
|
|
71
|
+
*/
|
|
72
|
+
build: Omit<TUserConfig["build"], "override"> & Required<Pick<Required<TUserConfig["build"]>, "override">>;
|
|
73
|
+
/**
|
|
74
|
+
* The log level to use for the Powerlines processes.
|
|
75
|
+
*
|
|
76
|
+
* @defaultValue "info"
|
|
77
|
+
*/
|
|
78
|
+
logLevel: "error" | "warn" | "info" | "debug" | "trace" | null;
|
|
79
|
+
};
|
|
80
|
+
//#endregion
|
|
81
|
+
export { EnvironmentResolvedConfig, ResolvedConfig, ResolvedEntryTypeDefinition };
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { EnvironmentConfig, InlineConfig, OutputConfig, UserConfig } from "./config.mjs";
|
|
2
|
+
import { NonUndefined } from "@stryke/types/base";
|
|
3
|
+
import { TypeDefinition } from "@stryke/types/configuration";
|
|
4
|
+
import { AssetGlob } from "@stryke/types/file";
|
|
5
|
+
import { ResolvedPreviewOptions } from "vite";
|
|
6
|
+
|
|
7
|
+
//#region ../powerlines/src/types/resolved.d.ts
|
|
8
|
+
interface ResolvedEntryTypeDefinition extends TypeDefinition {
|
|
9
|
+
/**
|
|
10
|
+
* The user provided entry point in the source code
|
|
11
|
+
*/
|
|
12
|
+
input: TypeDefinition;
|
|
13
|
+
/**
|
|
14
|
+
* An optional name to use in the package export during the build process
|
|
15
|
+
*/
|
|
16
|
+
output?: string;
|
|
17
|
+
}
|
|
18
|
+
type EnvironmentResolvedConfig = Omit<EnvironmentConfig, "consumer" | "ssr" | "preview"> & Required<Pick<EnvironmentConfig, "consumer" | "ssr">> & {
|
|
19
|
+
/**
|
|
20
|
+
* The name of the environment
|
|
21
|
+
*/
|
|
22
|
+
name: string;
|
|
23
|
+
/**
|
|
24
|
+
* Configuration options for the preview server
|
|
25
|
+
*/
|
|
26
|
+
preview?: ResolvedPreviewOptions;
|
|
27
|
+
};
|
|
28
|
+
type ResolvedAssetGlob = AssetGlob & Required<Pick<AssetGlob, "input">>;
|
|
29
|
+
type OutputResolvedConfig = Required<Omit<OutputConfig, "assets" | "storage"> & {
|
|
30
|
+
assets: ResolvedAssetGlob[];
|
|
31
|
+
}> & Pick<OutputConfig, "storage">;
|
|
32
|
+
/**
|
|
33
|
+
* The resolved options for the Powerlines project configuration.
|
|
34
|
+
*/
|
|
35
|
+
type ResolvedConfig<TUserConfig extends UserConfig = UserConfig> = Omit<TUserConfig, "name" | "title" | "plugins" | "mode" | "environments" | "platform" | "tsconfig" | "lint" | "test" | "build" | "transform" | "deploy" | "variant" | "type" | "output" | "logLevel" | "framework" | "sourceRoot"> & Required<Pick<TUserConfig, "name" | "title" | "plugins" | "mode" | "environments" | "tsconfig" | "lint" | "test" | "build" | "transform" | "deploy" | "framework" | "sourceRoot">> & {
|
|
36
|
+
/**
|
|
37
|
+
* The configuration options that were provided inline to the Powerlines CLI.
|
|
38
|
+
*/
|
|
39
|
+
inlineConfig: InlineConfig<TUserConfig>;
|
|
40
|
+
/**
|
|
41
|
+
* The original configuration options that were provided by the user to the Powerlines process.
|
|
42
|
+
*/
|
|
43
|
+
userConfig: TUserConfig;
|
|
44
|
+
/**
|
|
45
|
+
* A string identifier for the Powerlines command being executed.
|
|
46
|
+
*/
|
|
47
|
+
command: NonUndefined<InlineConfig<TUserConfig>["command"]>;
|
|
48
|
+
/**
|
|
49
|
+
* The root directory of the project's source code
|
|
50
|
+
*
|
|
51
|
+
* @defaultValue "\{projectRoot\}/src"
|
|
52
|
+
*/
|
|
53
|
+
sourceRoot: NonUndefined<TUserConfig["sourceRoot"]>;
|
|
54
|
+
/**
|
|
55
|
+
* The root directory of the project.
|
|
56
|
+
*/
|
|
57
|
+
projectRoot: NonUndefined<TUserConfig["root"]>;
|
|
58
|
+
/**
|
|
59
|
+
* The type of project being built.
|
|
60
|
+
*/
|
|
61
|
+
projectType: NonUndefined<TUserConfig["type"]>;
|
|
62
|
+
/**
|
|
63
|
+
* The output configuration options to use for the build process
|
|
64
|
+
*/
|
|
65
|
+
output: OutputResolvedConfig;
|
|
66
|
+
/**
|
|
67
|
+
* Configuration provided to build processes
|
|
68
|
+
*
|
|
69
|
+
* @remarks
|
|
70
|
+
* This configuration can be used by plugins during the `build` command. It will generally contain options specific to the selected {@link BuildVariant | build variant}.
|
|
71
|
+
*/
|
|
72
|
+
build: Omit<TUserConfig["build"], "override"> & Required<Pick<Required<TUserConfig["build"]>, "override">>;
|
|
73
|
+
/**
|
|
74
|
+
* The log level to use for the Powerlines processes.
|
|
75
|
+
*
|
|
76
|
+
* @defaultValue "info"
|
|
77
|
+
*/
|
|
78
|
+
logLevel: "error" | "warn" | "info" | "debug" | "trace" | null;
|
|
79
|
+
};
|
|
80
|
+
//#endregion
|
|
81
|
+
export { EnvironmentResolvedConfig, ResolvedConfig, ResolvedEntryTypeDefinition };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { CompilerOptions, TsConfigJson } from "@stryke/types/tsconfig";
|
|
2
|
+
import ts from "typescript";
|
|
3
|
+
|
|
4
|
+
//#region ../powerlines/src/types/tsconfig.d.ts
|
|
5
|
+
type ReflectionMode = "default" | "explicit" | "never";
|
|
6
|
+
type RawReflectionMode = ReflectionMode | "" | boolean | string | string[] | undefined;
|
|
7
|
+
/**
|
|
8
|
+
* Defines the level of reflection to be used during the transpilation process.
|
|
9
|
+
*
|
|
10
|
+
* @remarks
|
|
11
|
+
* The level determines how much extra data is captured in the byte code for each type. This can be one of the following values:
|
|
12
|
+
* - `minimal` - Only the essential type information is captured.
|
|
13
|
+
* - `normal` - Additional type information is captured, including some contextual data.
|
|
14
|
+
* - `verbose` - All available type information is captured, including detailed contextual data.
|
|
15
|
+
*/
|
|
16
|
+
type ReflectionLevel = "minimal" | "normal" | "verbose";
|
|
17
|
+
interface DeepkitOptions {
|
|
18
|
+
/**
|
|
19
|
+
* Either true to activate reflection for all files compiled using this tsconfig,
|
|
20
|
+
* or a list of globs/file paths relative to this tsconfig.json.
|
|
21
|
+
* Globs/file paths can be prefixed with a ! to exclude them.
|
|
22
|
+
*/
|
|
23
|
+
reflection?: RawReflectionMode;
|
|
24
|
+
/**
|
|
25
|
+
* Defines the level of reflection to be used during the transpilation process.
|
|
26
|
+
*
|
|
27
|
+
* @remarks
|
|
28
|
+
* The level determines how much extra data is captured in the byte code for each type. This can be one of the following values:
|
|
29
|
+
* - `minimal` - Only the essential type information is captured.
|
|
30
|
+
* - `normal` - Additional type information is captured, including some contextual data.
|
|
31
|
+
* - `verbose` - All available type information is captured, including detailed contextual data.
|
|
32
|
+
*/
|
|
33
|
+
reflectionLevel?: ReflectionLevel;
|
|
34
|
+
}
|
|
35
|
+
type TSCompilerOptions = CompilerOptions & DeepkitOptions;
|
|
36
|
+
/**
|
|
37
|
+
* The TypeScript compiler configuration.
|
|
38
|
+
*
|
|
39
|
+
* @see https://www.typescriptlang.org/docs/handbook/tsconfig-json.html
|
|
40
|
+
*/
|
|
41
|
+
interface TSConfig extends Omit<TsConfigJson, "reflection"> {
|
|
42
|
+
/**
|
|
43
|
+
* Either true to activate reflection for all files compiled using this tsconfig,
|
|
44
|
+
* or a list of globs/file paths relative to this tsconfig.json.
|
|
45
|
+
* Globs/file paths can be prefixed with a ! to exclude them.
|
|
46
|
+
*/
|
|
47
|
+
reflection?: RawReflectionMode;
|
|
48
|
+
/**
|
|
49
|
+
* Defines the level of reflection to be used during the transpilation process.
|
|
50
|
+
*
|
|
51
|
+
* @remarks
|
|
52
|
+
* The level determines how much extra data is captured in the byte code for each type. This can be one of the following values:
|
|
53
|
+
* - `minimal` - Only the essential type information is captured.
|
|
54
|
+
* - `normal` - Additional type information is captured, including some contextual data.
|
|
55
|
+
* - `verbose` - All available type information is captured, including detailed contextual data.
|
|
56
|
+
*/
|
|
57
|
+
reflectionLevel?: ReflectionLevel;
|
|
58
|
+
/**
|
|
59
|
+
* Instructs the TypeScript compiler how to compile `.ts` files.
|
|
60
|
+
*/
|
|
61
|
+
compilerOptions?: TSCompilerOptions;
|
|
62
|
+
}
|
|
63
|
+
type ParsedTypeScriptConfig = ts.ParsedCommandLine & {
|
|
64
|
+
originalTsconfigJson: TsConfigJson;
|
|
65
|
+
tsconfigJson: TSConfig;
|
|
66
|
+
tsconfigFilePath: string;
|
|
67
|
+
};
|
|
68
|
+
//#endregion
|
|
69
|
+
export { ParsedTypeScriptConfig, TSConfig };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { CompilerOptions, TsConfigJson } from "@stryke/types/tsconfig";
|
|
2
|
+
import ts from "typescript";
|
|
3
|
+
|
|
4
|
+
//#region ../powerlines/src/types/tsconfig.d.ts
|
|
5
|
+
type ReflectionMode = "default" | "explicit" | "never";
|
|
6
|
+
type RawReflectionMode = ReflectionMode | "" | boolean | string | string[] | undefined;
|
|
7
|
+
/**
|
|
8
|
+
* Defines the level of reflection to be used during the transpilation process.
|
|
9
|
+
*
|
|
10
|
+
* @remarks
|
|
11
|
+
* The level determines how much extra data is captured in the byte code for each type. This can be one of the following values:
|
|
12
|
+
* - `minimal` - Only the essential type information is captured.
|
|
13
|
+
* - `normal` - Additional type information is captured, including some contextual data.
|
|
14
|
+
* - `verbose` - All available type information is captured, including detailed contextual data.
|
|
15
|
+
*/
|
|
16
|
+
type ReflectionLevel = "minimal" | "normal" | "verbose";
|
|
17
|
+
interface DeepkitOptions {
|
|
18
|
+
/**
|
|
19
|
+
* Either true to activate reflection for all files compiled using this tsconfig,
|
|
20
|
+
* or a list of globs/file paths relative to this tsconfig.json.
|
|
21
|
+
* Globs/file paths can be prefixed with a ! to exclude them.
|
|
22
|
+
*/
|
|
23
|
+
reflection?: RawReflectionMode;
|
|
24
|
+
/**
|
|
25
|
+
* Defines the level of reflection to be used during the transpilation process.
|
|
26
|
+
*
|
|
27
|
+
* @remarks
|
|
28
|
+
* The level determines how much extra data is captured in the byte code for each type. This can be one of the following values:
|
|
29
|
+
* - `minimal` - Only the essential type information is captured.
|
|
30
|
+
* - `normal` - Additional type information is captured, including some contextual data.
|
|
31
|
+
* - `verbose` - All available type information is captured, including detailed contextual data.
|
|
32
|
+
*/
|
|
33
|
+
reflectionLevel?: ReflectionLevel;
|
|
34
|
+
}
|
|
35
|
+
type TSCompilerOptions = CompilerOptions & DeepkitOptions;
|
|
36
|
+
/**
|
|
37
|
+
* The TypeScript compiler configuration.
|
|
38
|
+
*
|
|
39
|
+
* @see https://www.typescriptlang.org/docs/handbook/tsconfig-json.html
|
|
40
|
+
*/
|
|
41
|
+
interface TSConfig extends Omit<TsConfigJson, "reflection"> {
|
|
42
|
+
/**
|
|
43
|
+
* Either true to activate reflection for all files compiled using this tsconfig,
|
|
44
|
+
* or a list of globs/file paths relative to this tsconfig.json.
|
|
45
|
+
* Globs/file paths can be prefixed with a ! to exclude them.
|
|
46
|
+
*/
|
|
47
|
+
reflection?: RawReflectionMode;
|
|
48
|
+
/**
|
|
49
|
+
* Defines the level of reflection to be used during the transpilation process.
|
|
50
|
+
*
|
|
51
|
+
* @remarks
|
|
52
|
+
* The level determines how much extra data is captured in the byte code for each type. This can be one of the following values:
|
|
53
|
+
* - `minimal` - Only the essential type information is captured.
|
|
54
|
+
* - `normal` - Additional type information is captured, including some contextual data.
|
|
55
|
+
* - `verbose` - All available type information is captured, including detailed contextual data.
|
|
56
|
+
*/
|
|
57
|
+
reflectionLevel?: ReflectionLevel;
|
|
58
|
+
/**
|
|
59
|
+
* Instructs the TypeScript compiler how to compile `.ts` files.
|
|
60
|
+
*/
|
|
61
|
+
compilerOptions?: TSCompilerOptions;
|
|
62
|
+
}
|
|
63
|
+
type ParsedTypeScriptConfig = ts.ParsedCommandLine & {
|
|
64
|
+
originalTsconfigJson: TsConfigJson;
|
|
65
|
+
tsconfigJson: TSConfig;
|
|
66
|
+
tsconfigFilePath: string;
|
|
67
|
+
};
|
|
68
|
+
//#endregion
|
|
69
|
+
export { ParsedTypeScriptConfig, TSConfig };
|
package/dist/types/index.cjs
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
require(`../plugin-Ckx8qAq8.cjs`),require(`../types-a8gm_IaQ.cjs`);
|
package/dist/types/index.d.cts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "../index-BL32-cvv.cjs";
|
|
1
|
+
import { ContentCollectionsContext, ContentCollectionsPluginContext, ContentCollectionsPluginOptions, ContentCollectionsPluginResolvedConfig, ContentCollectionsPluginUserConfig, __ΩContentCollectionsContext, __ΩContentCollectionsPluginContext, __ΩContentCollectionsPluginOptions, __ΩContentCollectionsPluginResolvedConfig, __ΩContentCollectionsPluginUserConfig } from "./plugin.cjs";
|
|
3
2
|
export { ContentCollectionsContext, ContentCollectionsPluginContext, ContentCollectionsPluginOptions, ContentCollectionsPluginResolvedConfig, ContentCollectionsPluginUserConfig, __ΩContentCollectionsContext, __ΩContentCollectionsPluginContext, __ΩContentCollectionsPluginOptions, __ΩContentCollectionsPluginResolvedConfig, __ΩContentCollectionsPluginUserConfig };
|
package/dist/types/index.d.mts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "../index-Bk0eNZmQ.mjs";
|
|
1
|
+
import { ContentCollectionsContext, ContentCollectionsPluginContext, ContentCollectionsPluginOptions, ContentCollectionsPluginResolvedConfig, ContentCollectionsPluginUserConfig, __ΩContentCollectionsContext, __ΩContentCollectionsPluginContext, __ΩContentCollectionsPluginOptions, __ΩContentCollectionsPluginResolvedConfig, __ΩContentCollectionsPluginUserConfig } from "./plugin.mjs";
|
|
3
2
|
export { ContentCollectionsContext, ContentCollectionsPluginContext, ContentCollectionsPluginOptions, ContentCollectionsPluginResolvedConfig, ContentCollectionsPluginUserConfig, __ΩContentCollectionsContext, __ΩContentCollectionsPluginContext, __ΩContentCollectionsPluginOptions, __ΩContentCollectionsPluginResolvedConfig, __ΩContentCollectionsPluginUserConfig };
|
package/dist/types/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export{};
|
package/dist/types/plugin.cjs
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
require(`../plugin-Ckx8qAq8.cjs`);
|
package/dist/types/plugin.d.cts
CHANGED
|
@@ -1,2 +1,49 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ResolvedConfig } from "../powerlines/src/types/resolved.cjs";
|
|
2
|
+
import { PluginContext } from "../powerlines/src/types/context.cjs";
|
|
3
|
+
import { UserConfig } from "../powerlines/src/types/config.cjs";
|
|
4
|
+
import { AnyCollection, BuildContext, createInternalBuilder } from "@content-collections/core";
|
|
5
|
+
|
|
6
|
+
//#region src/types/plugin.d.ts
|
|
7
|
+
type ContentCollectionsContext = Pick<Awaited<ReturnType<typeof createInternalBuilder>>, "build" | "on"> & {
|
|
8
|
+
context: BuildContext;
|
|
9
|
+
};
|
|
10
|
+
interface ContentCollectionsPluginOptions {
|
|
11
|
+
/**
|
|
12
|
+
* The path to a custom Prisma configuration file.
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
* This field allows the use of the "\{projectRoot\}" token to refer to the project's root directory - the value will be replaced with the correct file path by the plugin.
|
|
16
|
+
*
|
|
17
|
+
* @defaultValue "\{projectRoot\}/content-collections.ts"
|
|
18
|
+
*/
|
|
19
|
+
configFile?: string;
|
|
20
|
+
/**
|
|
21
|
+
* The list of content collections to include.
|
|
22
|
+
*/
|
|
23
|
+
collections?: AnyCollection[];
|
|
24
|
+
/**
|
|
25
|
+
* The path to the content collection output files generated by the plugin.
|
|
26
|
+
*
|
|
27
|
+
* @remarks
|
|
28
|
+
* If using the default value, the file can be imported from "powerlines:content/collection-name". This field allows the use of the "\{builtinPath\}" token to refer to the built-in Powerlines plugins directory - the value will be replaced with the correct file path by the plugin.
|
|
29
|
+
*
|
|
30
|
+
* @defaultValue "\{builtinPath\}/content"
|
|
31
|
+
*/
|
|
32
|
+
outputPath?: string;
|
|
33
|
+
}
|
|
34
|
+
type ContentCollectionsPluginUserConfig = UserConfig & {
|
|
35
|
+
contentCollections?: ContentCollectionsPluginOptions;
|
|
36
|
+
};
|
|
37
|
+
type ContentCollectionsPluginResolvedConfig = ResolvedConfig & {
|
|
38
|
+
contentCollections: Required<Omit<ContentCollectionsPluginOptions, "outputPath">> & Pick<ContentCollectionsPluginOptions, "outputPath">;
|
|
39
|
+
};
|
|
40
|
+
type ContentCollectionsPluginContext<TResolvedConfig extends ContentCollectionsPluginResolvedConfig = ContentCollectionsPluginResolvedConfig> = PluginContext<TResolvedConfig> & {
|
|
41
|
+
contentCollections: ContentCollectionsContext;
|
|
42
|
+
};
|
|
43
|
+
declare type __ΩContentCollectionsContext = any[];
|
|
44
|
+
declare type __ΩContentCollectionsPluginOptions = any[];
|
|
45
|
+
declare type __ΩContentCollectionsPluginUserConfig = any[];
|
|
46
|
+
declare type __ΩContentCollectionsPluginResolvedConfig = any[];
|
|
47
|
+
declare type __ΩContentCollectionsPluginContext = any[];
|
|
48
|
+
//#endregion
|
|
2
49
|
export { ContentCollectionsContext, ContentCollectionsPluginContext, ContentCollectionsPluginOptions, ContentCollectionsPluginResolvedConfig, ContentCollectionsPluginUserConfig, __ΩContentCollectionsContext, __ΩContentCollectionsPluginContext, __ΩContentCollectionsPluginOptions, __ΩContentCollectionsPluginResolvedConfig, __ΩContentCollectionsPluginUserConfig };
|