powerlines 0.10.2 → 0.12.0
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/astro.cjs +8 -8
- package/dist/astro.d.cts +1 -1
- package/dist/astro.d.ts +1 -1
- package/dist/astro.js +5 -5
- package/dist/{chunk-5XYGZ3DC.cjs → chunk-22K72CJ5.cjs} +2 -2
- package/dist/{chunk-GPPJ2CRE.js → chunk-4HGQJ4KR.js} +2 -2
- package/dist/chunk-7MTW3KR2.cjs +12 -0
- package/dist/{chunk-VIRKTIPK.js → chunk-7UIYU6SC.js} +3 -3
- package/dist/chunk-7WMWRX2S.cjs +12 -0
- package/dist/{chunk-HVT7PBFF.js → chunk-A3BBPLTY.js} +3 -3
- package/dist/{chunk-S746E63M.js → chunk-BHP6KBGK.js} +3 -3
- package/dist/{chunk-ZU4IRZSQ.js → chunk-BOIEJ5I6.js} +3 -3
- package/dist/chunk-DELRP3WY.js +31 -0
- package/dist/{chunk-ZBDP43LG.cjs → chunk-ELHJY5WG.cjs} +4 -4
- package/dist/{chunk-UHCRNFFC.cjs → chunk-FANQC345.cjs} +4 -4
- package/dist/chunk-GV3S7ZR3.cjs +34 -0
- package/dist/{chunk-WCPY7HPU.js → chunk-L3DAMAEC.js} +4 -4
- package/dist/chunk-LC6FLEJS.cjs +12 -0
- package/dist/{chunk-N7NE3VOU.js → chunk-MAEKW52U.js} +3 -3
- package/dist/chunk-MXJWCZDP.cjs +12 -0
- package/dist/{chunk-EGSEJQCE.js → chunk-NGKWITCO.js} +3 -3
- package/dist/{chunk-L2SAK2JC.cjs → chunk-OC7CCD5M.cjs} +4 -4
- package/dist/{chunk-OYIM2M74.js → chunk-P4BOYWXT.js} +195 -6
- package/dist/{chunk-UTVZVGM3.cjs → chunk-PJRHRDLS.cjs} +204 -15
- package/dist/{chunk-5Y4JYQ66.js → chunk-RBRFT2R6.js} +3 -3
- package/dist/{chunk-66GXB2UY.cjs → chunk-RU6BHTIP.cjs} +4 -4
- package/dist/{chunk-WPVIF35O.js → chunk-SIZKRND7.js} +2 -2
- package/dist/chunk-SNARILEC.cjs +24 -0
- package/dist/{chunk-6UDHGAAI.js → chunk-SY7N6FC3.js} +3 -3
- package/dist/{chunk-QHGPZK2H.cjs → chunk-V5D5NVV7.cjs} +4 -4
- package/dist/{chunk-SDEBJQDT.js → chunk-V7LXFIGK.js} +3 -3
- package/dist/{chunk-2RHPFVYT.cjs → chunk-WCTOTE3T.cjs} +8 -8
- package/dist/chunk-WD4363UW.cjs +12 -0
- package/dist/{chunk-7IWH37DY.cjs → chunk-YIWHO6SW.cjs} +2 -2
- package/dist/{chunk-3Y5CCIJR.js → chunk-ZP5QLZQ2.js} +3 -3
- package/dist/{chunk-KYGEWAEG.js → chunk-ZQ7U35QZ.js} +3 -3
- package/dist/define-config.d.cts +1 -1
- package/dist/define-config.d.ts +1 -1
- package/dist/esbuild.cjs +7 -7
- package/dist/esbuild.d.cts +1 -1
- package/dist/esbuild.d.ts +1 -1
- package/dist/esbuild.js +4 -4
- package/dist/extend-plugin.d.cts +1 -1
- package/dist/extend-plugin.d.ts +1 -1
- package/dist/farm.cjs +4 -4
- package/dist/farm.d.cts +1 -1
- package/dist/farm.d.ts +1 -1
- package/dist/farm.js +3 -3
- package/dist/{hooks-BGYnc61f.d.ts → hooks-BmvalJZ4.d.ts} +1 -1
- package/dist/{hooks-gk8S8LFP.d.cts → hooks-BzFKq34L.d.cts} +1 -1
- package/dist/index.cjs +26 -26
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +17 -17
- package/dist/internal/api.cjs +3 -3
- package/dist/internal/api.d.cts +2 -2
- package/dist/internal/api.d.ts +2 -2
- package/dist/internal/api.js +2 -2
- package/dist/lib/build/esbuild.d.cts +12 -12
- package/dist/lib/build/esbuild.d.ts +12 -12
- package/dist/lib/build/index.cjs +18 -18
- package/dist/lib/build/index.d.cts +13 -13
- package/dist/lib/build/index.d.ts +13 -13
- package/dist/lib/build/index.js +3 -3
- package/dist/lib/build/rolldown.d.cts +12 -12
- package/dist/lib/build/rolldown.d.ts +12 -12
- package/dist/lib/build/rollup.d.cts +12 -12
- package/dist/lib/build/rollup.d.ts +12 -12
- package/dist/lib/build/rspack.d.cts +12 -12
- package/dist/lib/build/rspack.d.ts +12 -12
- package/dist/lib/build/tsup.d.cts +11 -11
- package/dist/lib/build/tsup.d.ts +11 -11
- package/dist/lib/build/unbuild.cjs +5 -5
- package/dist/lib/build/unbuild.d.cts +13 -13
- package/dist/lib/build/unbuild.d.ts +13 -13
- package/dist/lib/build/unbuild.js +2 -2
- package/dist/lib/build/vite.d.cts +12 -12
- package/dist/lib/build/vite.d.ts +12 -12
- package/dist/lib/build/webpack.d.cts +12 -12
- package/dist/lib/build/webpack.d.ts +12 -12
- package/dist/lib/bundle.cjs +16 -0
- package/dist/lib/bundle.cjs.map +1 -0
- package/dist/lib/bundle.d.cts +44 -0
- package/dist/lib/bundle.d.ts +44 -0
- package/dist/lib/bundle.js +7 -0
- package/dist/lib/bundle.js.map +1 -0
- package/dist/lib/chunk-2625RJNJ.cjs +41 -0
- package/dist/lib/chunk-2625RJNJ.cjs.map +1 -0
- package/dist/lib/{chunk-PIFE7MUZ.js → chunk-6BRTJXZ2.js} +195 -6
- package/dist/lib/chunk-6BRTJXZ2.js.map +1 -0
- package/dist/lib/chunk-6IJTWIVJ.cjs +107 -0
- package/dist/lib/chunk-6IJTWIVJ.cjs.map +1 -0
- package/dist/lib/{chunk-YVDJCVE5.cjs → chunk-BAC4AJEP.cjs} +3 -3
- package/dist/lib/{chunk-YVDJCVE5.cjs.map → chunk-BAC4AJEP.cjs.map} +1 -1
- package/dist/lib/{chunk-Q2RUDKWY.cjs → chunk-BW3VFCTS.cjs} +2 -2
- package/dist/lib/chunk-BW3VFCTS.cjs.map +1 -0
- package/dist/lib/chunk-ESYYL5UH.js +105 -0
- package/dist/lib/chunk-ESYYL5UH.js.map +1 -0
- package/dist/lib/chunk-GTQZYDA7.js +39 -0
- package/dist/lib/chunk-GTQZYDA7.js.map +1 -0
- package/dist/lib/{chunk-M7U5RMK7.js → chunk-KOCDKJDJ.js} +2 -2
- package/dist/lib/chunk-KOCDKJDJ.js.map +1 -0
- package/dist/lib/{chunk-M7WHFUKR.cjs → chunk-LYD5OTBI.cjs} +210 -21
- package/dist/lib/chunk-LYD5OTBI.cjs.map +1 -0
- package/dist/lib/{chunk-6U2UX2PX.cjs → chunk-RLMEYZ5I.cjs} +11 -15
- package/dist/lib/chunk-RLMEYZ5I.cjs.map +1 -0
- package/dist/lib/{chunk-CAPN4FSS.js → chunk-S4TGQD45.js} +3 -3
- package/dist/lib/{chunk-CAPN4FSS.js.map → chunk-S4TGQD45.js.map} +1 -1
- package/dist/lib/{chunk-KFE2IR3Y.js → chunk-V2T4H24I.js} +11 -15
- package/dist/lib/chunk-V2T4H24I.js.map +1 -0
- package/dist/lib/config-file.d.cts +11 -11
- package/dist/lib/config-file.d.ts +11 -11
- package/dist/lib/{config-AuIGsUck.d.cts → context-BI46yeFZ.d.cts} +617 -557
- package/dist/lib/{config-B_WTwd49.d.ts → context-tEqvC3yI.d.ts} +617 -557
- package/dist/lib/create-program.cjs +13 -0
- package/dist/lib/create-program.cjs.map +1 -0
- package/dist/lib/create-program.d.cts +42 -0
- package/dist/lib/create-program.d.ts +42 -0
- package/dist/lib/create-program.js +4 -0
- package/dist/lib/create-program.js.map +1 -0
- package/dist/lib/entry.d.cts +12 -12
- package/dist/lib/entry.d.ts +12 -12
- package/dist/lib/{hooks-DErK4Fv4.d.ts → hooks-C9_XPS6c.d.cts} +1 -1
- package/dist/lib/{hooks-4KkL9GD2.d.cts → hooks-DESiFNA6.d.ts} +1 -1
- package/dist/lib/index.cjs +47 -36
- package/dist/lib/index.d.cts +16 -13
- package/dist/lib/index.d.ts +16 -13
- package/dist/lib/index.js +10 -7
- package/dist/lib/logger.d.cts +12 -12
- package/dist/lib/logger.d.ts +12 -12
- package/dist/lib/typescript/compiler-host.cjs +46 -2
- package/dist/lib/typescript/compiler-host.cjs.map +1 -1
- package/dist/lib/typescript/compiler-host.d.cts +18 -13
- package/dist/lib/typescript/compiler-host.d.ts +18 -13
- package/dist/lib/typescript/compiler-host.js +45 -2
- package/dist/lib/typescript/compiler-host.js.map +1 -1
- package/dist/lib/typescript/import-transformer.d.cts +12 -12
- package/dist/lib/typescript/import-transformer.d.ts +12 -12
- package/dist/lib/typescript/index.cjs +6 -6
- package/dist/lib/typescript/index.d.cts +12 -12
- package/dist/lib/typescript/index.d.ts +12 -12
- package/dist/lib/typescript/index.js +1 -1
- package/dist/lib/typescript/program.cjs +6 -6
- package/dist/lib/typescript/program.d.cts +13 -13
- package/dist/lib/typescript/program.d.ts +13 -13
- package/dist/lib/typescript/program.js +1 -1
- package/dist/lib/unplugin/factory.cjs +3 -3
- package/dist/lib/unplugin/factory.d.cts +12 -12
- package/dist/lib/unplugin/factory.d.ts +12 -12
- package/dist/lib/unplugin/factory.js +2 -2
- package/dist/lib/unplugin/index.cjs +3 -3
- package/dist/lib/unplugin/index.d.cts +12 -12
- package/dist/lib/unplugin/index.d.ts +12 -12
- package/dist/lib/unplugin/index.js +2 -2
- package/dist/lib/unplugin/plugin.d.cts +11 -11
- package/dist/lib/unplugin/plugin.d.ts +11 -11
- package/dist/lib/unplugin/resolve-id.d.cts +11 -11
- package/dist/lib/unplugin/resolve-id.d.ts +11 -11
- package/dist/lib/utilities/file-header.d.cts +12 -12
- package/dist/lib/utilities/file-header.d.ts +12 -12
- package/dist/lib/utilities/index.cjs +20 -20
- package/dist/lib/utilities/index.d.cts +12 -12
- package/dist/lib/utilities/index.d.ts +12 -12
- package/dist/lib/utilities/index.js +3 -3
- package/dist/lib/utilities/meta.cjs +8 -8
- package/dist/lib/utilities/meta.d.cts +12 -12
- package/dist/lib/utilities/meta.d.ts +12 -12
- package/dist/lib/utilities/meta.js +1 -1
- package/dist/lib/utilities/plugin-helpers.d.cts +11 -11
- package/dist/lib/utilities/plugin-helpers.d.ts +11 -11
- package/dist/lib/utilities/resolve-path.d.cts +12 -12
- package/dist/lib/utilities/resolve-path.d.ts +12 -12
- package/dist/lib/utilities/worker.d.cts +11 -11
- package/dist/lib/utilities/worker.d.ts +11 -11
- package/dist/lib/utilities/write-file.d.cts +12 -12
- package/dist/lib/utilities/write-file.d.ts +12 -12
- package/dist/next.cjs +8 -8
- package/dist/next.js +5 -5
- package/dist/nuxt.cjs +9 -9
- package/dist/nuxt.js +6 -6
- package/dist/{resolved-Dhscmo3z.d.ts → resolved-BS8bJ6b1.d.ts} +21 -17
- package/dist/{resolved-CcuVqMqc.d.cts → resolved-CjkYiKA1.d.cts} +21 -17
- package/dist/rolldown.cjs +7 -7
- package/dist/rolldown.d.cts +1 -1
- package/dist/rolldown.d.ts +1 -1
- package/dist/rolldown.js +4 -4
- package/dist/rollup.cjs +7 -7
- package/dist/rollup.d.cts +1 -1
- package/dist/rollup.d.ts +1 -1
- package/dist/rollup.js +4 -4
- package/dist/rspack.cjs +7 -7
- package/dist/rspack.d.cts +1 -1
- package/dist/rspack.d.ts +1 -1
- package/dist/rspack.js +4 -4
- package/dist/tsup.cjs +8 -8
- package/dist/tsup.js +5 -5
- package/dist/types/babel.d.cts +1 -1
- package/dist/types/babel.d.ts +1 -1
- package/dist/types/commands.d.cts +1 -1
- package/dist/types/commands.d.ts +1 -1
- package/dist/types/compiler.d.cts +1 -1
- package/dist/types/compiler.d.ts +1 -1
- package/dist/types/config.d.cts +1 -1
- package/dist/types/config.d.ts +1 -1
- package/dist/types/context.cjs +2 -2
- package/dist/types/context.d.cts +1 -1
- package/dist/types/context.d.ts +1 -1
- package/dist/types/context.js +1 -1
- package/dist/types/hooks.d.cts +1 -1
- package/dist/types/hooks.d.ts +1 -1
- package/dist/types/index.cjs +9 -9
- package/dist/types/index.d.cts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.js +2 -2
- package/dist/types/internal.d.cts +2 -2
- package/dist/types/internal.d.ts +2 -2
- package/dist/types/plugin.d.cts +1 -1
- package/dist/types/plugin.d.ts +1 -1
- package/dist/types/resolved.d.cts +1 -1
- package/dist/types/resolved.d.ts +1 -1
- package/dist/types/unplugin.d.cts +1 -1
- package/dist/types/unplugin.d.ts +1 -1
- package/dist/types/vfs.cjs +7 -7
- package/dist/types/vfs.d.cts +61 -5
- package/dist/types/vfs.d.ts +61 -5
- package/dist/types/vfs.js +1 -1
- package/dist/unloader.cjs +7 -7
- package/dist/unloader.d.cts +1 -1
- package/dist/unloader.d.ts +1 -1
- package/dist/unloader.js +4 -4
- package/dist/unplugin.cjs +18 -18
- package/dist/unplugin.d.cts +2 -2
- package/dist/unplugin.d.ts +2 -2
- package/dist/unplugin.js +15 -15
- package/dist/vite.cjs +7 -7
- package/dist/vite.d.cts +1 -1
- package/dist/vite.d.ts +1 -1
- package/dist/vite.js +4 -4
- package/dist/webpack.cjs +7 -7
- package/dist/webpack.d.cts +1 -1
- package/dist/webpack.d.ts +1 -1
- package/dist/webpack.js +4 -4
- package/package.json +11 -9
- package/dist/chunk-IJBH5OUN.cjs +0 -12
- package/dist/chunk-JBTSAOIQ.js +0 -31
- package/dist/chunk-LXMNDUPG.cjs +0 -12
- package/dist/chunk-RQ4CHMPO.cjs +0 -12
- package/dist/chunk-S5QFX2GM.cjs +0 -12
- package/dist/chunk-SL3CXJWD.cjs +0 -34
- package/dist/chunk-YG7U2GIR.cjs +0 -24
- package/dist/chunk-ZFATNDSY.cjs +0 -12
- package/dist/lib/chunk-6U2UX2PX.cjs.map +0 -1
- package/dist/lib/chunk-KFE2IR3Y.js.map +0 -1
- package/dist/lib/chunk-M7U5RMK7.js.map +0 -1
- package/dist/lib/chunk-M7WHFUKR.cjs.map +0 -1
- package/dist/lib/chunk-PIFE7MUZ.js.map +0 -1
- package/dist/lib/chunk-Q2RUDKWY.cjs.map +0 -1
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { EnvPaths } from '@stryke/env/get-env-paths';
|
|
2
|
+
import { PackageJson } from '@stryke/types/package-json';
|
|
3
|
+
import { Worker } from 'jest-worker';
|
|
4
|
+
import { Jiti } from 'jiti';
|
|
5
|
+
import { ParserOptions, ParseResult } from 'oxc-parser';
|
|
6
|
+
import { Range } from 'semver';
|
|
7
|
+
import { TransformResult, ExternalIdResult, HookFilter, UnpluginOptions, UnpluginContext, UnpluginBuildContext } from 'unplugin';
|
|
2
8
|
import { LogLevelLabel } from '@storm-software/config-tools/types';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { TypeDefinition, TypeDefinitionParameter } from '@stryke/types/configuration';
|
|
9
|
+
import { MaybePromise, FunctionLike, NonUndefined } from '@stryke/types/base';
|
|
10
|
+
import { TypeDefinitionParameter, TypeDefinition } from '@stryke/types/configuration';
|
|
6
11
|
import { AssetGlob } from '@stryke/types/file';
|
|
7
|
-
import {
|
|
8
|
-
import { UserConfig as UserConfig$1, ResolvedPreviewOptions, PreviewOptions } from 'vite';
|
|
12
|
+
import { UserConfig as UserConfig$1, PreviewOptions, ResolvedPreviewOptions } from 'vite';
|
|
9
13
|
import { UserConfig as UserConfig$2 } from '@farmfe/core';
|
|
10
14
|
import { Configuration as Configuration$1 } from '@rspack/core';
|
|
11
15
|
import { ESBuildOptions } from '@storm-software/esbuild/types';
|
|
@@ -14,18 +18,14 @@ import { BuildOptions } from 'esbuild';
|
|
|
14
18
|
import { RolldownOptions, RolldownOutput } from 'rolldown';
|
|
15
19
|
import { RollupOptions, OutputOptions } from 'rollup';
|
|
16
20
|
import { Configuration } from 'webpack';
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import { ParserOptions, ParseResult } from 'oxc-parser';
|
|
22
|
-
import { Range } from 'semver';
|
|
23
|
-
import { TransformResult, ExternalIdResult, HookFilter, UnpluginOptions, UnpluginContext, UnpluginBuildContext } from 'unplugin';
|
|
21
|
+
import { Format } from '@storm-software/build-tools/types';
|
|
22
|
+
import { StormWorkspaceConfig } from '@storm-software/config/types';
|
|
23
|
+
import { ResolvedConfig as ResolvedConfig$1, ConfigLayer } from 'c12';
|
|
24
|
+
import { T as TSConfig, P as ParsedTypeScriptConfig } from './tsconfig-Bz-CiFqD.js';
|
|
24
25
|
import { ArrayValues } from '@stryke/types/array';
|
|
25
|
-
import { P as ParsedTypeScriptConfig, T as TSConfig } from './tsconfig-Bz-CiFqD.js';
|
|
26
26
|
import { PrimitiveJsonValue } from '@stryke/json/types';
|
|
27
27
|
import { Volume } from 'memfs';
|
|
28
|
-
import { StatSyncOptions, Stats,
|
|
28
|
+
import { PathLike, StatSyncOptions, Stats, RmDirOptions, RmOptions, Mode, MakeDirectoryOptions as MakeDirectoryOptions$1, PathOrFileDescriptor, WriteFileOptions as WriteFileOptions$1 } from 'node:fs';
|
|
29
29
|
import { IUnionFs } from 'unionfs';
|
|
30
30
|
|
|
31
31
|
type UnpluginBuildVariant = "rollup" | "webpack" | "rspack" | "vite" | "esbuild" | "farm" | "unloader" | "rolldown";
|
|
@@ -103,82 +103,6 @@ type UnbuildResolvedBuildConfig = UnbuildOptions & BuildResolvedConfig;
|
|
|
103
103
|
type FarmBuildConfig = Partial<Omit<UserConfig$2, "tsconfig" | "tsconfigRaw" | "assets" | "outputPath" | "mode" | "format" | "platform" | "projectRoot" | "env" | "entry" | "entryPoints">> & BuildConfig;
|
|
104
104
|
type FarmResolvedBuildConfig = UserConfig$2 & BuildResolvedConfig;
|
|
105
105
|
|
|
106
|
-
interface ResolvedEntryTypeDefinition extends TypeDefinition {
|
|
107
|
-
/**
|
|
108
|
-
* The user provided entry point in the source code
|
|
109
|
-
*/
|
|
110
|
-
input: TypeDefinition;
|
|
111
|
-
/**
|
|
112
|
-
* An optional name to use in the package export during the build process
|
|
113
|
-
*/
|
|
114
|
-
output?: string;
|
|
115
|
-
}
|
|
116
|
-
type EnvironmentResolvedConfig = Omit<EnvironmentConfig, "consumer" | "mode" | "ssr" | "preview" | "mainFields" | "extensions"> & Required<Pick<EnvironmentConfig, "consumer" | "mode" | "ssr" | "mainFields" | "extensions">> & {
|
|
117
|
-
/**
|
|
118
|
-
* The name of the environment
|
|
119
|
-
*/
|
|
120
|
-
name: string;
|
|
121
|
-
/**
|
|
122
|
-
* Configuration options for the preview server
|
|
123
|
-
*/
|
|
124
|
-
preview?: ResolvedPreviewOptions;
|
|
125
|
-
};
|
|
126
|
-
type ResolvedAssetGlob = AssetGlob & Required<Pick<AssetGlob, "input">>;
|
|
127
|
-
type OutputResolvedConfig = Required<Omit<OutputConfig, "assets"> & {
|
|
128
|
-
assets: ResolvedAssetGlob[];
|
|
129
|
-
}>;
|
|
130
|
-
/**
|
|
131
|
-
* The resolved options for the Powerlines project configuration.
|
|
132
|
-
*/
|
|
133
|
-
type ResolvedConfig<TUserConfig extends UserConfig = UserConfig> = Omit<TUserConfig, "name" | "title" | "plugins" | "mode" | "environments" | "platform" | "tsconfig" | "lint" | "build" | "transform" | "override" | "root" | "variant" | "type" | "output" | "logLevel" | "framework"> & Required<Pick<TUserConfig, "name" | "title" | "plugins" | "mode" | "environments" | "tsconfig" | "lint" | "build" | "transform" | "override" | "framework">> & {
|
|
134
|
-
/**
|
|
135
|
-
* The configuration options that were provided inline to the Powerlines CLI.
|
|
136
|
-
*/
|
|
137
|
-
inlineConfig: InlineConfig<TUserConfig>;
|
|
138
|
-
/**
|
|
139
|
-
* The original configuration options that were provided by the user to the Powerlines process.
|
|
140
|
-
*/
|
|
141
|
-
userConfig: TUserConfig;
|
|
142
|
-
/**
|
|
143
|
-
* A string identifier for the Powerlines command being executed.
|
|
144
|
-
*/
|
|
145
|
-
command: NonUndefined<InlineConfig<TUserConfig>["command"]>;
|
|
146
|
-
/**
|
|
147
|
-
* The root directory of the project's source code
|
|
148
|
-
*
|
|
149
|
-
* @defaultValue "\{projectRoot\}/src"
|
|
150
|
-
*/
|
|
151
|
-
sourceRoot: NonUndefined<TUserConfig["sourceRoot"]>;
|
|
152
|
-
/**
|
|
153
|
-
* The root directory of the project.
|
|
154
|
-
*/
|
|
155
|
-
projectRoot: NonUndefined<TUserConfig["root"]>;
|
|
156
|
-
/**
|
|
157
|
-
* The type of project being built.
|
|
158
|
-
*/
|
|
159
|
-
projectType: NonUndefined<TUserConfig["type"]>;
|
|
160
|
-
/**
|
|
161
|
-
* The output configuration options to use for the build process
|
|
162
|
-
*/
|
|
163
|
-
output: OutputResolvedConfig;
|
|
164
|
-
/**
|
|
165
|
-
* The log level to use for the Powerlines processes.
|
|
166
|
-
*
|
|
167
|
-
* @defaultValue "info"
|
|
168
|
-
*/
|
|
169
|
-
logLevel: LogLevelLabel | null;
|
|
170
|
-
};
|
|
171
|
-
type ViteResolvedConfig = ResolvedConfig<ViteUserConfig>;
|
|
172
|
-
type WebpackResolvedConfig = ResolvedConfig<WebpackUserConfig>;
|
|
173
|
-
type RspackResolvedConfig = ResolvedConfig<RspackUserConfig>;
|
|
174
|
-
type ESBuildResolvedConfig = ResolvedConfig<ESBuildUserConfig>;
|
|
175
|
-
type RollupResolvedConfig = ResolvedConfig<RollupUserConfig>;
|
|
176
|
-
type RolldownResolvedConfig = ResolvedConfig<RolldownUserConfig>;
|
|
177
|
-
type TsupResolvedConfig = ResolvedConfig<TsupUserConfig>;
|
|
178
|
-
type UnbuildResolvedConfig = ResolvedConfig<UnbuildUserConfig>;
|
|
179
|
-
type FarmResolvedConfig = ResolvedConfig<FarmUserConfig>;
|
|
180
|
-
type InferResolvedConfig<TBuildVariant extends BuildVariant | 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 "rolldown" ? RolldownResolvedConfig : TBuildVariant extends "rollup" ? RollupResolvedConfig : TBuildVariant extends "farm" ? FarmResolvedConfig : ResolvedConfig;
|
|
181
|
-
|
|
182
106
|
declare const SUPPORTED_COMMANDS: readonly ["new", "clean", "prepare", "lint", "test", "build", "docs", "release", "finalize"];
|
|
183
107
|
type CommandType = ArrayValues<typeof SUPPORTED_COMMANDS>;
|
|
184
108
|
|
|
@@ -391,35 +315,6 @@ interface Plugin<in out TContext extends PluginContext<ResolvedConfig> = PluginC
|
|
|
391
315
|
applyToEnvironment?: (environment: EnvironmentResolvedConfig) => MaybePromise<boolean | Plugin<any>>;
|
|
392
316
|
}
|
|
393
317
|
|
|
394
|
-
type BaseHooks<TContext extends PluginContext = PluginContext> = BasePluginHookFunctions<TContext>;
|
|
395
|
-
type BaseHookKeys<TContext extends PluginContext = PluginContext> = keyof BaseHooks<TContext>;
|
|
396
|
-
type ExternalHooks<TContext extends PluginContext = PluginContext> = ExternalPluginHookFunctions<TContext>;
|
|
397
|
-
type ExternalHookKeys<TContext extends PluginContext = PluginContext> = keyof ExternalHooks<TContext>;
|
|
398
|
-
type Hooks<TContext extends PluginContext = PluginContext> = PluginHookFunctions<TContext>;
|
|
399
|
-
type HookKeys<TContext extends PluginContext = PluginContext> = keyof Hooks<TContext>;
|
|
400
|
-
interface BaseHooksListItem<TContext extends PluginContext = PluginContext, TKey extends BaseHookKeys<TContext> = BaseHookKeys<TContext>> extends PluginHookObject<BaseHooks<TContext>[TKey]> {
|
|
401
|
-
plugin: Plugin<TContext>;
|
|
402
|
-
}
|
|
403
|
-
interface BaseHooksList<TContext extends PluginContext = PluginContext, TKey extends BaseHookKeys<TContext> = BaseHookKeys<TContext>> {
|
|
404
|
-
preOrdered?: BaseHooksListItem<TContext, TKey>[];
|
|
405
|
-
preEnforced?: BaseHooksListItem<TContext, TKey>[];
|
|
406
|
-
normal?: BaseHooksListItem<TContext, TKey>[];
|
|
407
|
-
postEnforced?: BaseHooksListItem<TContext, TKey>[];
|
|
408
|
-
postOrdered?: BaseHooksListItem<TContext, TKey>[];
|
|
409
|
-
}
|
|
410
|
-
interface ExternalHooksListItem<TContext extends PluginContext = PluginContext, TKey extends ExternalHookKeys<TContext> = ExternalHookKeys<TContext>> {
|
|
411
|
-
plugin: Plugin<TContext>;
|
|
412
|
-
handler: ExternalHooks<TContext>[TKey];
|
|
413
|
-
}
|
|
414
|
-
type HooksList<TContext extends PluginContext = PluginContext> = {
|
|
415
|
-
[TKey in BaseHookKeys<TContext>]?: BaseHooksList<TContext, TKey>;
|
|
416
|
-
} & {
|
|
417
|
-
[TKey in ExternalHookKeys<TContext>]?: ExternalHooksListItem<TContext, TKey>[];
|
|
418
|
-
};
|
|
419
|
-
type InferHookHandler<TContext extends PluginContext, TKey extends HookKeys<TContext>> = Hooks<TContext>[TKey];
|
|
420
|
-
type InferHookReturnType<TContext extends PluginContext, TKey extends HookKeys<TContext>> = ReturnType<InferHookHandler<TContext, TKey>> extends Promise<infer U> ? U extends Promise<infer V> ? V : U : ReturnType<InferHookHandler<TContext, TKey>>;
|
|
421
|
-
type InferHookParameters<TContext extends PluginContext, TKey extends HookKeys<TContext>> = Parameters<InferHookHandler<TContext, TKey>>;
|
|
422
|
-
|
|
423
318
|
declare const __VFS_INIT__ = "__VFS_INIT__";
|
|
424
319
|
declare const __VFS_REVERT__ = "__VFS_REVERT__";
|
|
425
320
|
declare const __VFS_CACHE__ = "__VFS_CACHE__";
|
|
@@ -549,6 +444,13 @@ interface VirtualFileSystemInterface {
|
|
|
549
444
|
* @returns `true` if the file exists, otherwise `false`.
|
|
550
445
|
*/
|
|
551
446
|
existsSync: (pathOrId: string) => boolean;
|
|
447
|
+
/**
|
|
448
|
+
* Gets the metadata of a file in the virtual file system (VFS).
|
|
449
|
+
*
|
|
450
|
+
* @param pathOrId - The path or id of the file.
|
|
451
|
+
* @returns The metadata of the file if it exists, otherwise undefined.
|
|
452
|
+
*/
|
|
453
|
+
getMetadata: (pathOrId: PathLike) => VirtualFileSystemMetadata | undefined;
|
|
552
454
|
/**
|
|
553
455
|
* Gets the stats of a file in the virtual file system (VFS).
|
|
554
456
|
*
|
|
@@ -645,13 +547,20 @@ interface VirtualFileSystemInterface {
|
|
|
645
547
|
*/
|
|
646
548
|
rmdir: (path: PathLike, options?: RmDirOptions & ResolveFSOptions) => Promise<void>;
|
|
647
549
|
/**
|
|
648
|
-
* Removes a file in the virtual file system (VFS).
|
|
550
|
+
* Removes a file or directory in the virtual file system (VFS).
|
|
649
551
|
*
|
|
650
|
-
* @param path - The path to the file to remove.
|
|
651
|
-
* @param options - Options for removing the file.
|
|
652
|
-
* @returns A promise that resolves when the file is removed.
|
|
552
|
+
* @param path - The path to the file or directory to remove.
|
|
553
|
+
* @param options - Options for removing the file or directory.
|
|
554
|
+
* @returns A promise that resolves when the file or directory is removed.
|
|
653
555
|
*/
|
|
654
556
|
rm: (path: PathLike, options?: RmOptions & ResolveFSOptions) => Promise<void>;
|
|
557
|
+
/**
|
|
558
|
+
* Synchronously removes a file or directory in the virtual file system (VFS).
|
|
559
|
+
*
|
|
560
|
+
* @param path - The path to the file or directory to remove.
|
|
561
|
+
* @param options - Options for removing the file or directory.
|
|
562
|
+
*/
|
|
563
|
+
rmSync: (path: PathLike, options?: RmOptions & ResolveFSOptions) => void;
|
|
655
564
|
/**
|
|
656
565
|
* Creates a directory in the virtual file system (VFS).
|
|
657
566
|
*
|
|
@@ -698,6 +607,48 @@ interface VirtualFileSystemInterface {
|
|
|
698
607
|
* @param options - Optional parameters for writing the file.
|
|
699
608
|
*/
|
|
700
609
|
writeFileSync: (path: PathOrFileDescriptor, data?: WriteFileData, options?: WriteFileOptions) => void;
|
|
610
|
+
/**
|
|
611
|
+
* Moves a file from one path to another in the virtual file system (VFS).
|
|
612
|
+
*
|
|
613
|
+
* @param srcPath - The source path to move
|
|
614
|
+
* @param destPath - The destination path to move to
|
|
615
|
+
*/
|
|
616
|
+
move: (srcPath: string, destPath: string) => Promise<void>;
|
|
617
|
+
/**
|
|
618
|
+
* Synchronously moves a file from one path to another in the virtual file system (VFS).
|
|
619
|
+
*
|
|
620
|
+
* @param srcPath - The source path to move
|
|
621
|
+
* @param destPath - The destination path to move to
|
|
622
|
+
*/
|
|
623
|
+
moveSync: (srcPath: string, destPath: string) => void;
|
|
624
|
+
/**
|
|
625
|
+
* Copies a file from one path to another in the virtual file system (VFS).
|
|
626
|
+
*
|
|
627
|
+
* @param srcPath - The source path to copy
|
|
628
|
+
* @param destPath - The destination path to copy to
|
|
629
|
+
*/
|
|
630
|
+
copy: (srcPath: string, destPath: string) => Promise<void>;
|
|
631
|
+
/**
|
|
632
|
+
* Synchronously copies a file from one path to another in the virtual file system (VFS).
|
|
633
|
+
*
|
|
634
|
+
* @param srcPath - The source path to copy
|
|
635
|
+
* @param destPath - The destination path to copy to
|
|
636
|
+
*/
|
|
637
|
+
copySync: (srcPath: string, destPath: string) => void;
|
|
638
|
+
/**
|
|
639
|
+
* Glob files in the virtual file system (VFS) based on the provided pattern(s).
|
|
640
|
+
*
|
|
641
|
+
* @param pattern - A pattern (or multiple patterns) to use to determine the file paths to return
|
|
642
|
+
* @returns An array of file paths matching the provided pattern(s)
|
|
643
|
+
*/
|
|
644
|
+
glob: (pattern: string | string[]) => Promise<string[]>;
|
|
645
|
+
/**
|
|
646
|
+
* Synchronously glob files in the virtual file system (VFS) based on the provided pattern(s).
|
|
647
|
+
*
|
|
648
|
+
* @param pattern - A pattern (or multiple patterns) to use to determine the file paths to return
|
|
649
|
+
* @returns An array of file paths matching the provided pattern(s)
|
|
650
|
+
*/
|
|
651
|
+
globSync: (pattern: string | string[]) => string[];
|
|
701
652
|
/**
|
|
702
653
|
* Resolves a path or id to a file path in the virtual file system.
|
|
703
654
|
*
|
|
@@ -751,664 +702,773 @@ interface VirtualFileSystemInterface {
|
|
|
751
702
|
[__VFS_UNIFIED__]: IUnionFs;
|
|
752
703
|
}
|
|
753
704
|
|
|
754
|
-
type
|
|
755
|
-
|
|
756
|
-
}
|
|
757
|
-
|
|
758
|
-
|
|
705
|
+
type LogFn = (type: LogLevelLabel, ...args: string[]) => void;
|
|
706
|
+
/**
|
|
707
|
+
* The {@link StormWorkspaceConfig | configuration} object for an entire Powerlines workspace
|
|
708
|
+
*/
|
|
709
|
+
type WorkspaceConfig = Partial<StormWorkspaceConfig> & Required<Pick<StormWorkspaceConfig, "workspaceRoot">>;
|
|
710
|
+
type PluginFactory<in out TContext extends PluginContext = PluginContext, TOptions = any> = (options: TOptions) => MaybePromise<Plugin<TContext>>;
|
|
711
|
+
/**
|
|
712
|
+
* A configuration tuple for a Powerlines plugin.
|
|
713
|
+
*/
|
|
714
|
+
type PluginConfigTuple<TContext extends PluginContext = PluginContext, TOptions = any> = [string | PluginFactory<TContext, TOptions>, TOptions] | [Plugin<TContext>];
|
|
715
|
+
/**
|
|
716
|
+
* A configuration object for a Powerlines plugin.
|
|
717
|
+
*/
|
|
718
|
+
type PluginConfigObject<TContext extends PluginContext = PluginContext, TOptions = any> = {
|
|
719
|
+
plugin: string | PluginFactory<TContext, TOptions>;
|
|
720
|
+
options: TOptions;
|
|
721
|
+
} | {
|
|
722
|
+
plugin: Plugin<TContext>;
|
|
723
|
+
options?: never;
|
|
759
724
|
};
|
|
760
|
-
|
|
725
|
+
/**
|
|
726
|
+
* A configuration tuple for a Powerlines plugin.
|
|
727
|
+
*/
|
|
728
|
+
type PluginConfig<TContext extends PluginContext = PluginContext> = string | PluginFactory<TContext, void> | Plugin<TContext> | Promise<Plugin<TContext>> | PluginConfigTuple<TContext> | PluginConfigObject<TContext>;
|
|
729
|
+
type ProjectType = "application" | "library";
|
|
730
|
+
interface OutputConfig {
|
|
761
731
|
/**
|
|
762
|
-
* The
|
|
732
|
+
* The path to output the final compiled files to
|
|
733
|
+
*
|
|
734
|
+
* @remarks
|
|
735
|
+
* If a value is not provided, Powerlines will attempt to:
|
|
736
|
+
* 1. Use the `outDir` value in the `tsconfig.json` file.
|
|
737
|
+
* 2. Use the `dist` directory in the project root directory.
|
|
738
|
+
*
|
|
739
|
+
* @defaultValue "dist/\{projectRoot\}"
|
|
763
740
|
*/
|
|
764
|
-
|
|
741
|
+
outputPath?: string;
|
|
765
742
|
/**
|
|
766
|
-
* The
|
|
743
|
+
* The format of the output files
|
|
744
|
+
*
|
|
745
|
+
* @defaultValue "virtual"
|
|
767
746
|
*/
|
|
768
|
-
|
|
747
|
+
mode?: OutputModeType;
|
|
769
748
|
/**
|
|
770
|
-
* The
|
|
749
|
+
* The path of the generated runtime declaration file relative to the workspace root.
|
|
750
|
+
*
|
|
751
|
+
* @defaultValue "\{projectRoot\}/powerlines.d.ts"
|
|
771
752
|
*/
|
|
772
|
-
|
|
753
|
+
dts?: string | false;
|
|
773
754
|
/**
|
|
774
|
-
*
|
|
755
|
+
* A prefix to use for identifying builtin modules
|
|
756
|
+
*
|
|
757
|
+
* @remarks
|
|
758
|
+
* This prefix will be used to identify all builtin modules generated during the "prepare" phase. An example builtin ID for a module called `"utils"` would be `"{builtinPrefix}:utils"`.
|
|
759
|
+
*
|
|
760
|
+
* @defaultValue "powerlines"
|
|
775
761
|
*/
|
|
776
|
-
|
|
762
|
+
builtinPrefix?: string;
|
|
777
763
|
/**
|
|
778
|
-
*
|
|
764
|
+
* The folder where the generated runtime artifacts will be located
|
|
765
|
+
*
|
|
766
|
+
* @remarks
|
|
767
|
+
* This folder will contain all runtime artifacts and builtins generated during the "prepare" phase.
|
|
768
|
+
*
|
|
769
|
+
* @defaultValue "\{projectRoot\}/.powerlines"
|
|
779
770
|
*/
|
|
780
|
-
|
|
771
|
+
artifactsFolder?: string;
|
|
781
772
|
/**
|
|
782
|
-
*
|
|
773
|
+
* The module format of the output files
|
|
774
|
+
*
|
|
775
|
+
* @remarks
|
|
776
|
+
* This option can be a single format or an array of formats. If an array is provided, multiple builds will be generated for each format.
|
|
777
|
+
*
|
|
778
|
+
* @defaultValue "esm"
|
|
783
779
|
*/
|
|
784
|
-
|
|
780
|
+
format?: Format | Format[];
|
|
785
781
|
/**
|
|
786
|
-
* A
|
|
782
|
+
* A list of assets to copy to the output directory
|
|
783
|
+
*
|
|
784
|
+
* @remarks
|
|
785
|
+
* The assets can be specified as a string (path to the asset) or as an object with a `glob` property (to match multiple files). The paths are relative to the project root directory.
|
|
787
786
|
*/
|
|
788
|
-
|
|
787
|
+
assets?: Array<string | AssetGlob>;
|
|
788
|
+
}
|
|
789
|
+
interface BaseConfig {
|
|
789
790
|
/**
|
|
790
|
-
*
|
|
791
|
+
* The name of the project
|
|
791
792
|
*/
|
|
792
|
-
|
|
793
|
-
}
|
|
794
|
-
interface Resolver extends Jiti {
|
|
795
|
-
plugin: Jiti;
|
|
796
|
-
}
|
|
797
|
-
interface SelectHooksOptions {
|
|
798
|
-
order?: "pre" | "post" | "normal";
|
|
799
|
-
}
|
|
800
|
-
interface InitContextOptions {
|
|
793
|
+
name?: string;
|
|
801
794
|
/**
|
|
802
|
-
*
|
|
795
|
+
* The project display title
|
|
803
796
|
*
|
|
804
|
-
* @
|
|
797
|
+
* @remarks
|
|
798
|
+
* This option is used in documentation generation and other places where a human-readable title is needed.
|
|
805
799
|
*/
|
|
806
|
-
|
|
807
|
-
}
|
|
808
|
-
interface Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
|
|
800
|
+
title?: string;
|
|
809
801
|
/**
|
|
810
|
-
*
|
|
802
|
+
* A description of the project
|
|
803
|
+
*
|
|
804
|
+
* @remarks
|
|
805
|
+
* If this option is not provided, the build process will try to use the \`description\` value from the `\package.json\` file.
|
|
811
806
|
*/
|
|
812
|
-
|
|
807
|
+
description?: string;
|
|
813
808
|
/**
|
|
814
|
-
*
|
|
809
|
+
* The log level to use for the Powerlines processes.
|
|
810
|
+
*
|
|
811
|
+
* @defaultValue "info"
|
|
815
812
|
*/
|
|
816
|
-
|
|
813
|
+
logLevel?: LogLevelLabel | null;
|
|
817
814
|
/**
|
|
818
|
-
* A
|
|
815
|
+
* A custom logger function to use for logging messages
|
|
819
816
|
*/
|
|
820
|
-
|
|
817
|
+
customLogger?: LogFn;
|
|
821
818
|
/**
|
|
822
|
-
*
|
|
819
|
+
* Explicitly set a mode to run in. This mode will be used at various points throughout the Powerlines processes, such as when compiling the source code.
|
|
820
|
+
*
|
|
821
|
+
* @defaultValue "production"
|
|
823
822
|
*/
|
|
824
|
-
|
|
823
|
+
mode?: "development" | "test" | "production";
|
|
825
824
|
/**
|
|
826
|
-
* The
|
|
825
|
+
* The entry point(s) for the application
|
|
827
826
|
*/
|
|
828
|
-
|
|
827
|
+
entry?: TypeDefinitionParameter | TypeDefinitionParameter[];
|
|
829
828
|
/**
|
|
830
|
-
*
|
|
829
|
+
* Configuration for linting the source code
|
|
831
830
|
*/
|
|
832
|
-
|
|
831
|
+
lint?: Record<string, any> | false;
|
|
833
832
|
/**
|
|
834
|
-
*
|
|
833
|
+
* Configuration for testing the source code
|
|
835
834
|
*/
|
|
836
|
-
|
|
835
|
+
test?: Record<string, any> | false;
|
|
837
836
|
/**
|
|
838
|
-
*
|
|
837
|
+
* Configuration for the output of the build process
|
|
839
838
|
*/
|
|
840
|
-
|
|
839
|
+
output?: OutputConfig;
|
|
841
840
|
/**
|
|
842
|
-
*
|
|
841
|
+
* Configuration for the transformation of the source code
|
|
843
842
|
*/
|
|
844
|
-
|
|
843
|
+
transform?: Record<string, any>;
|
|
845
844
|
/**
|
|
846
|
-
*
|
|
845
|
+
* Options to to provide to the build process
|
|
847
846
|
*/
|
|
848
|
-
|
|
847
|
+
build?: BuildConfig;
|
|
849
848
|
/**
|
|
850
|
-
*
|
|
849
|
+
* Configuration for documentation generation
|
|
850
|
+
*
|
|
851
|
+
* @remarks
|
|
852
|
+
* This configuration will be used by the documentation generation plugins during the `docs` command.
|
|
851
853
|
*/
|
|
852
|
-
|
|
854
|
+
docs?: Record<string, any>;
|
|
853
855
|
/**
|
|
854
|
-
* The path to the
|
|
856
|
+
* The path to the tsconfig file to be used by the compiler
|
|
857
|
+
*
|
|
858
|
+
* @remarks
|
|
859
|
+
* If a value is not provided, the plugin will attempt to find the `tsconfig.json` file in the project root directory. The parsed tsconfig compiler options will be merged with the {@link Options.tsconfigRaw} value (if provided).
|
|
860
|
+
*
|
|
861
|
+
* @defaultValue "\{projectRoot\}/tsconfig.json"
|
|
855
862
|
*/
|
|
856
|
-
|
|
863
|
+
tsconfig?: string;
|
|
857
864
|
/**
|
|
858
|
-
* The
|
|
865
|
+
* The raw {@link TSConfig} object to be used by the compiler. This object will be merged with the `tsconfig.json` file.
|
|
866
|
+
*
|
|
867
|
+
* @see https://www.typescriptlang.org/tsconfig
|
|
868
|
+
*
|
|
869
|
+
* @remarks
|
|
870
|
+
* If populated, this option takes higher priority than `tsconfig`
|
|
859
871
|
*/
|
|
860
|
-
|
|
872
|
+
tsconfigRaw?: TSConfig;
|
|
873
|
+
}
|
|
874
|
+
interface EnvironmentConfig extends BaseConfig {
|
|
861
875
|
/**
|
|
862
|
-
*
|
|
876
|
+
* Array of strings indicating the order in which fields in a package.json file should be resolved to determine the entry point for a module.
|
|
877
|
+
*
|
|
878
|
+
* @defaultValue `['browser', 'module', 'jsnext:main', 'jsnext']`
|
|
863
879
|
*/
|
|
864
|
-
|
|
880
|
+
mainFields?: string[];
|
|
865
881
|
/**
|
|
866
|
-
*
|
|
882
|
+
* Array of strings indicating what conditions should be used for module resolution.
|
|
867
883
|
*/
|
|
868
|
-
|
|
884
|
+
conditions?: string[];
|
|
869
885
|
/**
|
|
870
|
-
*
|
|
886
|
+
* Array of strings indicating what conditions should be used for external modules.
|
|
871
887
|
*/
|
|
872
|
-
|
|
888
|
+
externalConditions?: string[];
|
|
873
889
|
/**
|
|
874
|
-
*
|
|
890
|
+
* Array of strings indicating what file extensions should be used for module resolution.
|
|
891
|
+
*
|
|
892
|
+
* @defaultValue `['.mjs', '.js', '.mts', '.ts', '.jsx', '.tsx', '.json']`
|
|
875
893
|
*/
|
|
876
|
-
|
|
894
|
+
extensions?: string[];
|
|
877
895
|
/**
|
|
878
|
-
*
|
|
896
|
+
* Array of strings indicating what modules should be deduplicated to a single version in the build.
|
|
897
|
+
*
|
|
898
|
+
* @remarks
|
|
899
|
+
* This option is useful for ensuring that only one version of a module is included in the bundle, which can help reduce bundle size and avoid conflicts.
|
|
879
900
|
*/
|
|
880
|
-
|
|
901
|
+
dedupe?: string[];
|
|
881
902
|
/**
|
|
882
|
-
*
|
|
903
|
+
* Array of strings or regular expressions that indicate what modules are builtin for the environment.
|
|
883
904
|
*/
|
|
884
|
-
|
|
905
|
+
builtins?: (string | RegExp)[];
|
|
885
906
|
/**
|
|
886
|
-
*
|
|
907
|
+
* Configuration options for the preview server
|
|
887
908
|
*/
|
|
888
|
-
|
|
909
|
+
preview?: PreviewOptions;
|
|
889
910
|
/**
|
|
890
|
-
*
|
|
911
|
+
* A flag indicating whether the build is for a Server-Side Rendering environment.
|
|
891
912
|
*/
|
|
892
|
-
|
|
913
|
+
ssr?: boolean;
|
|
893
914
|
/**
|
|
894
|
-
*
|
|
915
|
+
* Define if this environment is used for Server-Side Rendering
|
|
916
|
+
*
|
|
917
|
+
* @defaultValue "server" (if it isn't the client environment)
|
|
895
918
|
*/
|
|
896
|
-
|
|
919
|
+
consumer?: "client" | "server";
|
|
920
|
+
}
|
|
921
|
+
interface CommonUserConfig extends BaseConfig {
|
|
897
922
|
/**
|
|
898
|
-
* The
|
|
923
|
+
* The type of project being built
|
|
924
|
+
*
|
|
925
|
+
* @defaultValue "application"
|
|
899
926
|
*/
|
|
900
|
-
|
|
927
|
+
type?: ProjectType;
|
|
901
928
|
/**
|
|
902
|
-
* The
|
|
929
|
+
* The root directory of the project
|
|
903
930
|
*/
|
|
904
|
-
|
|
931
|
+
root: string;
|
|
905
932
|
/**
|
|
906
|
-
*
|
|
933
|
+
* The root directory of the project's source code
|
|
907
934
|
*
|
|
908
|
-
* @
|
|
909
|
-
* @param id - The unique identifier of the builtin file
|
|
910
|
-
* @param path - An optional path to write the builtin file to
|
|
911
|
-
* @param options - Options for writing the file
|
|
935
|
+
* @defaultValue "\{root\}/src"
|
|
912
936
|
*/
|
|
913
|
-
|
|
937
|
+
sourceRoot?: string;
|
|
914
938
|
/**
|
|
915
|
-
*
|
|
939
|
+
* A path to a custom configuration file to be used instead of the default `storm.json`, `powerlines.config.js`, or `powerlines.config.ts` files.
|
|
916
940
|
*
|
|
917
|
-
* @
|
|
918
|
-
*
|
|
919
|
-
* @param options - Options for writing the file
|
|
941
|
+
* @remarks
|
|
942
|
+
* This option is useful for running Powerlines commands with different configuration files, such as in CI/CD environments or when testing different configurations.
|
|
920
943
|
*/
|
|
921
|
-
|
|
944
|
+
configFile?: string;
|
|
922
945
|
/**
|
|
923
|
-
*
|
|
946
|
+
* Should the Powerlines CLI processes skip installing missing packages?
|
|
947
|
+
*
|
|
948
|
+
* @remarks
|
|
949
|
+
* This option is useful for CI/CD environments where the installation of packages is handled by a different process.
|
|
950
|
+
*
|
|
951
|
+
* @defaultValue false
|
|
924
952
|
*/
|
|
925
|
-
|
|
953
|
+
skipInstalls?: boolean;
|
|
926
954
|
/**
|
|
927
|
-
*
|
|
955
|
+
* Should the compiler processes skip any improvements that make use of cache?
|
|
956
|
+
*
|
|
957
|
+
* @defaultValue false
|
|
928
958
|
*/
|
|
929
|
-
|
|
959
|
+
skipCache?: boolean;
|
|
930
960
|
/**
|
|
931
|
-
* A
|
|
961
|
+
* A list of resolvable paths to plugins used during the build process
|
|
932
962
|
*/
|
|
933
|
-
|
|
963
|
+
plugins?: PluginConfig<PluginContext<any>>[];
|
|
934
964
|
/**
|
|
935
|
-
*
|
|
936
|
-
*
|
|
937
|
-
* @param name - The name to use for the logger instance
|
|
938
|
-
* @returns A logger function
|
|
965
|
+
* Environment-specific configurations
|
|
939
966
|
*/
|
|
940
|
-
|
|
967
|
+
environments?: Record<string, EnvironmentConfig>;
|
|
941
968
|
/**
|
|
942
|
-
*
|
|
969
|
+
* A string identifier that allows a child framework or tool to identify itself when using Powerlines.
|
|
943
970
|
*
|
|
944
|
-
* @
|
|
945
|
-
* @returns A logger function
|
|
971
|
+
* @defaultValue "powerlines"
|
|
946
972
|
*/
|
|
947
|
-
|
|
973
|
+
framework?: string;
|
|
948
974
|
}
|
|
949
|
-
|
|
975
|
+
type UserConfig<TBuildConfig extends BuildConfig = BuildConfig, TBuildResolvedConfig extends BuildResolvedConfig = BuildResolvedConfig, TBuildVariant extends string = any> = CommonUserConfig & {
|
|
976
|
+
build?: TBuildConfig & {
|
|
977
|
+
/**
|
|
978
|
+
* The build variant being used by the Powerlines engine.
|
|
979
|
+
*/
|
|
980
|
+
variant?: TBuildVariant;
|
|
981
|
+
};
|
|
982
|
+
override?: Partial<TBuildResolvedConfig>;
|
|
983
|
+
};
|
|
984
|
+
type WebpackUserConfig = UserConfig<WebpackBuildConfig, WebpackResolvedBuildConfig, "webpack">;
|
|
985
|
+
type RspackUserConfig = UserConfig<RspackBuildConfig, RspackResolvedBuildConfig, "rspack">;
|
|
986
|
+
type RollupUserConfig = UserConfig<RollupBuildConfig, RollupResolvedBuildConfig, "rollup">;
|
|
987
|
+
type RolldownUserConfig = UserConfig<RolldownBuildConfig, RolldownResolvedBuildConfig, "rolldown">;
|
|
988
|
+
type ViteUserConfig = UserConfig<ViteBuildConfig, ViteResolvedBuildConfig, "vite">;
|
|
989
|
+
type ESBuildUserConfig = UserConfig<ESBuildBuildConfig, ESBuildResolvedBuildConfig, "esbuild">;
|
|
990
|
+
type UnbuildUserConfig = UserConfig<UnbuildBuildConfig, UnbuildResolvedBuildConfig, "unbuild">;
|
|
991
|
+
type TsupUserConfig = UserConfig<TsupBuildConfig, TsupResolvedBuildConfig, "tsup">;
|
|
992
|
+
type FarmUserConfig = UserConfig<FarmBuildConfig, FarmResolvedBuildConfig, "farm">;
|
|
993
|
+
type InferUserConfig<TBuildVariant extends BuildVariant | undefined> = TBuildVariant extends "webpack" ? WebpackUserConfig : TBuildVariant extends "rspack" ? RspackUserConfig : TBuildVariant extends "vite" ? ViteUserConfig : TBuildVariant extends "esbuild" ? ESBuildUserConfig : TBuildVariant extends "unbuild" ? UnbuildUserConfig : TBuildVariant extends "tsup" ? TsupUserConfig : TBuildVariant extends "rolldown" ? RolldownUserConfig : TBuildVariant extends "rollup" ? RollupUserConfig : TBuildVariant extends "farm" ? FarmUserConfig : UserConfig;
|
|
994
|
+
type InitialUserConfig<TUserConfig extends UserConfig = UserConfig> = Partial<TUserConfig> & {
|
|
995
|
+
root: string;
|
|
996
|
+
};
|
|
997
|
+
type ParsedUserConfig<TUserConfig extends UserConfig = UserConfig> = TUserConfig & ResolvedConfig$1<TUserConfig> & {
|
|
950
998
|
/**
|
|
951
|
-
* The
|
|
999
|
+
* The path to the user configuration file, if it exists.
|
|
952
1000
|
*
|
|
953
1001
|
* @remarks
|
|
954
|
-
* This is
|
|
1002
|
+
* This is typically the `powerlines.json`, `powerlines.config.js`, or `powerlines.config.ts` file in the project root.
|
|
955
1003
|
*/
|
|
956
|
-
|
|
1004
|
+
configFile?: ConfigLayer<TUserConfig>["configFile"];
|
|
1005
|
+
};
|
|
1006
|
+
type PowerlinesCommand = "new" | "prepare" | "build" | "lint" | "test" | "docs" | "release" | "clean";
|
|
1007
|
+
/**
|
|
1008
|
+
* The configuration provided while executing Powerlines commands.
|
|
1009
|
+
*/
|
|
1010
|
+
type InlineConfig<TUserConfig extends UserConfig = UserConfig> = Partial<TUserConfig> & {
|
|
957
1011
|
/**
|
|
958
|
-
* A
|
|
1012
|
+
* A string identifier for the Powerlines command being executed
|
|
959
1013
|
*/
|
|
960
|
-
|
|
1014
|
+
command: PowerlinesCommand;
|
|
1015
|
+
};
|
|
1016
|
+
type NewInlineConfig<TUserConfig extends UserConfig = UserConfig> = InlineConfig<TUserConfig> & Required<Pick<InlineConfig<TUserConfig>, "root">> & {
|
|
961
1017
|
/**
|
|
962
|
-
* A
|
|
1018
|
+
* A string identifier for the Powerlines command being executed
|
|
963
1019
|
*/
|
|
964
|
-
|
|
1020
|
+
command: "new";
|
|
965
1021
|
/**
|
|
966
|
-
*
|
|
967
|
-
*
|
|
968
|
-
* @throws Will throw an error if the environment does not exist
|
|
969
|
-
*
|
|
970
|
-
* @param name - The name of the environment to retrieve. If not provided, the default environment is returned.
|
|
971
|
-
* @returns A promise that resolves to the environment context.
|
|
972
|
-
*
|
|
973
|
-
* @example
|
|
974
|
-
* ```ts
|
|
975
|
-
* const devEnv = await apiContext.getEnvironment("development");
|
|
976
|
-
* const defaultEnv = await apiContext.getEnvironment();
|
|
977
|
-
* ```
|
|
1022
|
+
* The package name (from the \`package.json\`) for the project that will be used in the \`new\` command to create a new project based on this configuration
|
|
978
1023
|
*/
|
|
979
|
-
|
|
1024
|
+
packageName?: string;
|
|
1025
|
+
};
|
|
1026
|
+
type CleanInlineConfig<TUserConfig extends UserConfig = UserConfig> = InlineConfig<TUserConfig> & {
|
|
980
1027
|
/**
|
|
981
|
-
*
|
|
982
|
-
*
|
|
983
|
-
* @param name - The name of the environment to retrieve. If not provided, the default environment is returned.
|
|
984
|
-
* @returns A promise that resolves to the environment context, or undefined if the environment does not exist.
|
|
985
|
-
*
|
|
986
|
-
* @example
|
|
987
|
-
* ```ts
|
|
988
|
-
* const devEnv = await apiContext.getEnvironmentSafe("development");
|
|
989
|
-
* const defaultEnv = await apiContext.getEnvironmentSafe();
|
|
990
|
-
* ```
|
|
991
|
-
*
|
|
992
|
-
* @remarks
|
|
993
|
-
* This method is similar to `getEnvironment`, but it returns `undefined` instead of throwing an error if the specified environment does not exist.
|
|
994
|
-
* This can be useful in scenarios where the existence of an environment is optional or uncertain.
|
|
995
|
-
*
|
|
996
|
-
* ```ts
|
|
997
|
-
* const testEnv = await apiContext.getEnvironmentSafe("test");
|
|
998
|
-
* if (testEnv) {
|
|
999
|
-
* // Environment exists, safe to use it
|
|
1000
|
-
* } else {
|
|
1001
|
-
* // Environment does not exist, handle accordingly
|
|
1002
|
-
* }
|
|
1003
|
-
* ```
|
|
1004
|
-
*
|
|
1005
|
-
* Using this method helps avoid unhandled exceptions in cases where an environment might not be defined.
|
|
1028
|
+
* A string identifier for the Powerlines command being executed
|
|
1006
1029
|
*/
|
|
1007
|
-
|
|
1030
|
+
command: "clean";
|
|
1031
|
+
};
|
|
1032
|
+
type PrepareInlineConfig<TUserConfig extends UserConfig = UserConfig> = InlineConfig<TUserConfig> & {
|
|
1008
1033
|
/**
|
|
1009
|
-
* A
|
|
1010
|
-
*
|
|
1011
|
-
* @param environment - The environment configuration to use.
|
|
1012
|
-
* @returns A new context instance with the updated environment.
|
|
1034
|
+
* A string identifier for the Powerlines command being executed
|
|
1013
1035
|
*/
|
|
1014
|
-
|
|
1015
|
-
}
|
|
1016
|
-
|
|
1017
|
-
plugin: Plugin<PluginContext<TResolvedConfig>>;
|
|
1018
|
-
context: PluginContext<TResolvedConfig>;
|
|
1019
|
-
}
|
|
1020
|
-
interface EnvironmentContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> extends Context<TResolvedConfig> {
|
|
1036
|
+
command: "prepare";
|
|
1037
|
+
};
|
|
1038
|
+
type BuildInlineConfig<TUserConfig extends UserConfig = UserConfig> = InlineConfig<TUserConfig> & {
|
|
1021
1039
|
/**
|
|
1022
|
-
*
|
|
1023
|
-
*
|
|
1024
|
-
* @remarks
|
|
1025
|
-
* This is a record of plugin identifiers to their respective options. This field is populated by the Powerlines engine during both plugin initialization and the `init` command.
|
|
1040
|
+
* A string identifier for the Powerlines command being executed
|
|
1026
1041
|
*/
|
|
1027
|
-
|
|
1042
|
+
command: "build";
|
|
1043
|
+
};
|
|
1044
|
+
type LintInlineConfig<TUserConfig extends UserConfig = UserConfig> = InlineConfig<TUserConfig> & {
|
|
1028
1045
|
/**
|
|
1029
|
-
* A
|
|
1046
|
+
* A string identifier for the Powerlines command being executed
|
|
1030
1047
|
*/
|
|
1031
|
-
|
|
1048
|
+
command: "lint";
|
|
1049
|
+
};
|
|
1050
|
+
type DocsInlineConfig<TUserConfig extends UserConfig = UserConfig> = InlineConfig<TUserConfig> & {
|
|
1032
1051
|
/**
|
|
1033
|
-
*
|
|
1052
|
+
* A string identifier for the Powerlines command being executed
|
|
1034
1053
|
*/
|
|
1035
|
-
|
|
1054
|
+
command: "docs";
|
|
1055
|
+
};
|
|
1056
|
+
type ReleaseInlineConfig<TUserConfig extends UserConfig = UserConfig> = InlineConfig<TUserConfig> & {
|
|
1036
1057
|
/**
|
|
1037
|
-
* A
|
|
1058
|
+
* A string identifier for the Powerlines command being executed
|
|
1038
1059
|
*/
|
|
1039
|
-
|
|
1060
|
+
command: "release";
|
|
1061
|
+
};
|
|
1062
|
+
|
|
1063
|
+
interface ResolvedEntryTypeDefinition extends TypeDefinition {
|
|
1040
1064
|
/**
|
|
1041
|
-
*
|
|
1065
|
+
* The user provided entry point in the source code
|
|
1042
1066
|
*/
|
|
1043
|
-
|
|
1067
|
+
input: TypeDefinition;
|
|
1068
|
+
/**
|
|
1069
|
+
* An optional name to use in the package export during the build process
|
|
1070
|
+
*/
|
|
1071
|
+
output?: string;
|
|
1044
1072
|
}
|
|
1045
|
-
|
|
1073
|
+
type EnvironmentResolvedConfig = Omit<EnvironmentConfig, "consumer" | "mode" | "ssr" | "preview" | "mainFields" | "extensions"> & Required<Pick<EnvironmentConfig, "consumer" | "mode" | "ssr" | "mainFields" | "extensions">> & {
|
|
1046
1074
|
/**
|
|
1047
|
-
* The
|
|
1075
|
+
* The name of the environment
|
|
1048
1076
|
*/
|
|
1049
|
-
|
|
1077
|
+
name: string;
|
|
1050
1078
|
/**
|
|
1051
|
-
*
|
|
1052
|
-
*
|
|
1053
|
-
* @remarks
|
|
1054
|
-
* This is provided for compatibility with other logging libraries that expect a `logger` property.
|
|
1079
|
+
* Configuration options for the preview server
|
|
1055
1080
|
*/
|
|
1056
|
-
|
|
1057
|
-
}
|
|
1058
|
-
type BuildPluginContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> = PluginContext<TResolvedConfig> & Omit<UnpluginBuildContext, "parse">;
|
|
1059
|
-
|
|
1060
|
-
type LogFn = (type: LogLevelLabel, ...args: string[]) => void;
|
|
1061
|
-
/**
|
|
1062
|
-
* The {@link StormWorkspaceConfig | configuration} object for an entire Powerlines workspace
|
|
1063
|
-
*/
|
|
1064
|
-
type WorkspaceConfig = Partial<StormWorkspaceConfig> & Required<Pick<StormWorkspaceConfig, "workspaceRoot">>;
|
|
1065
|
-
type PluginFactory<in out TContext extends PluginContext = PluginContext, TOptions = any> = (options: TOptions) => MaybePromise<Plugin<TContext>>;
|
|
1066
|
-
/**
|
|
1067
|
-
* A configuration tuple for a Powerlines plugin.
|
|
1068
|
-
*/
|
|
1069
|
-
type PluginConfigTuple<TContext extends PluginContext = PluginContext, TOptions = any> = [string | PluginFactory<TContext, TOptions>, TOptions] | [Plugin<TContext>];
|
|
1070
|
-
/**
|
|
1071
|
-
* A configuration object for a Powerlines plugin.
|
|
1072
|
-
*/
|
|
1073
|
-
type PluginConfigObject<TContext extends PluginContext = PluginContext, TOptions = any> = {
|
|
1074
|
-
plugin: string | PluginFactory<TContext, TOptions>;
|
|
1075
|
-
options: TOptions;
|
|
1076
|
-
} | {
|
|
1077
|
-
plugin: Plugin<TContext>;
|
|
1078
|
-
options?: never;
|
|
1081
|
+
preview?: ResolvedPreviewOptions;
|
|
1079
1082
|
};
|
|
1083
|
+
type ResolvedAssetGlob = AssetGlob & Required<Pick<AssetGlob, "input">>;
|
|
1084
|
+
type OutputResolvedConfig = Required<Omit<OutputConfig, "assets"> & {
|
|
1085
|
+
assets: ResolvedAssetGlob[];
|
|
1086
|
+
}>;
|
|
1080
1087
|
/**
|
|
1081
|
-
*
|
|
1088
|
+
* The resolved options for the Powerlines project configuration.
|
|
1082
1089
|
*/
|
|
1083
|
-
type
|
|
1084
|
-
type ProjectType = "application" | "library";
|
|
1085
|
-
interface OutputConfig {
|
|
1090
|
+
type ResolvedConfig<TUserConfig extends UserConfig = UserConfig> = Omit<TUserConfig, "name" | "title" | "plugins" | "mode" | "environments" | "platform" | "tsconfig" | "lint" | "test" | "build" | "transform" | "override" | "root" | "variant" | "type" | "output" | "logLevel" | "framework"> & Required<Pick<TUserConfig, "name" | "title" | "plugins" | "mode" | "environments" | "tsconfig" | "lint" | "test" | "build" | "transform" | "override" | "framework">> & {
|
|
1086
1091
|
/**
|
|
1087
|
-
* The
|
|
1088
|
-
*
|
|
1089
|
-
* @remarks
|
|
1090
|
-
* If a value is not provided, Powerlines will attempt to:
|
|
1091
|
-
* 1. Use the `outDir` value in the `tsconfig.json` file.
|
|
1092
|
-
* 2. Use the `dist` directory in the project root directory.
|
|
1093
|
-
*
|
|
1094
|
-
* @defaultValue "dist/\{projectRoot\}"
|
|
1092
|
+
* The configuration options that were provided inline to the Powerlines CLI.
|
|
1095
1093
|
*/
|
|
1096
|
-
|
|
1094
|
+
inlineConfig: InlineConfig<TUserConfig>;
|
|
1097
1095
|
/**
|
|
1098
|
-
* The
|
|
1099
|
-
*
|
|
1100
|
-
* @defaultValue "virtual"
|
|
1096
|
+
* The original configuration options that were provided by the user to the Powerlines process.
|
|
1101
1097
|
*/
|
|
1102
|
-
|
|
1098
|
+
userConfig: TUserConfig;
|
|
1103
1099
|
/**
|
|
1104
|
-
*
|
|
1105
|
-
*
|
|
1106
|
-
* @defaultValue "\{projectRoot\}/powerlines.d.ts"
|
|
1100
|
+
* A string identifier for the Powerlines command being executed.
|
|
1107
1101
|
*/
|
|
1108
|
-
|
|
1102
|
+
command: NonUndefined<InlineConfig<TUserConfig>["command"]>;
|
|
1109
1103
|
/**
|
|
1110
|
-
*
|
|
1111
|
-
*
|
|
1112
|
-
* @remarks
|
|
1113
|
-
* This prefix will be used to identify all builtin modules generated during the "prepare" phase. An example builtin ID for a module called `"utils"` would be `"{builtinPrefix}:utils"`.
|
|
1104
|
+
* The root directory of the project's source code
|
|
1114
1105
|
*
|
|
1115
|
-
* @defaultValue "
|
|
1106
|
+
* @defaultValue "\{projectRoot\}/src"
|
|
1116
1107
|
*/
|
|
1117
|
-
|
|
1108
|
+
sourceRoot: NonUndefined<TUserConfig["sourceRoot"]>;
|
|
1118
1109
|
/**
|
|
1119
|
-
* The
|
|
1120
|
-
*
|
|
1121
|
-
* @remarks
|
|
1122
|
-
* This folder will contain all runtime artifacts and builtins generated during the "prepare" phase.
|
|
1123
|
-
*
|
|
1124
|
-
* @defaultValue "\{projectRoot\}/.powerlines"
|
|
1110
|
+
* The root directory of the project.
|
|
1125
1111
|
*/
|
|
1126
|
-
|
|
1112
|
+
projectRoot: NonUndefined<TUserConfig["root"]>;
|
|
1127
1113
|
/**
|
|
1128
|
-
* The
|
|
1129
|
-
*
|
|
1130
|
-
* @remarks
|
|
1131
|
-
* This option can be a single format or an array of formats. If an array is provided, multiple builds will be generated for each format.
|
|
1132
|
-
*
|
|
1133
|
-
* @defaultValue "esm"
|
|
1114
|
+
* The type of project being built.
|
|
1134
1115
|
*/
|
|
1135
|
-
|
|
1116
|
+
projectType: NonUndefined<TUserConfig["type"]>;
|
|
1136
1117
|
/**
|
|
1137
|
-
*
|
|
1118
|
+
* The output configuration options to use for the build process
|
|
1119
|
+
*/
|
|
1120
|
+
output: OutputResolvedConfig;
|
|
1121
|
+
/**
|
|
1122
|
+
* The log level to use for the Powerlines processes.
|
|
1138
1123
|
*
|
|
1139
|
-
* @
|
|
1140
|
-
* The assets can be specified as a string (path to the asset) or as an object with a `glob` property (to match multiple files). The paths are relative to the project root directory.
|
|
1124
|
+
* @defaultValue "info"
|
|
1141
1125
|
*/
|
|
1142
|
-
|
|
1126
|
+
logLevel: LogLevelLabel | null;
|
|
1127
|
+
};
|
|
1128
|
+
type ViteResolvedConfig = ResolvedConfig<ViteUserConfig>;
|
|
1129
|
+
type WebpackResolvedConfig = ResolvedConfig<WebpackUserConfig>;
|
|
1130
|
+
type RspackResolvedConfig = ResolvedConfig<RspackUserConfig>;
|
|
1131
|
+
type ESBuildResolvedConfig = ResolvedConfig<ESBuildUserConfig>;
|
|
1132
|
+
type RollupResolvedConfig = ResolvedConfig<RollupUserConfig>;
|
|
1133
|
+
type RolldownResolvedConfig = ResolvedConfig<RolldownUserConfig>;
|
|
1134
|
+
type TsupResolvedConfig = ResolvedConfig<TsupUserConfig>;
|
|
1135
|
+
type UnbuildResolvedConfig = ResolvedConfig<UnbuildUserConfig>;
|
|
1136
|
+
type FarmResolvedConfig = ResolvedConfig<FarmUserConfig>;
|
|
1137
|
+
type InferResolvedConfig<TBuildVariant extends BuildVariant | 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 "rolldown" ? RolldownResolvedConfig : TBuildVariant extends "rollup" ? RollupResolvedConfig : TBuildVariant extends "farm" ? FarmResolvedConfig : ResolvedConfig;
|
|
1138
|
+
|
|
1139
|
+
type BaseHooks<TContext extends PluginContext = PluginContext> = BasePluginHookFunctions<TContext>;
|
|
1140
|
+
type BaseHookKeys<TContext extends PluginContext = PluginContext> = keyof BaseHooks<TContext>;
|
|
1141
|
+
type ExternalHooks<TContext extends PluginContext = PluginContext> = ExternalPluginHookFunctions<TContext>;
|
|
1142
|
+
type ExternalHookKeys<TContext extends PluginContext = PluginContext> = keyof ExternalHooks<TContext>;
|
|
1143
|
+
type Hooks<TContext extends PluginContext = PluginContext> = PluginHookFunctions<TContext>;
|
|
1144
|
+
type HookKeys<TContext extends PluginContext = PluginContext> = keyof Hooks<TContext>;
|
|
1145
|
+
interface BaseHooksListItem<TContext extends PluginContext = PluginContext, TKey extends BaseHookKeys<TContext> = BaseHookKeys<TContext>> extends PluginHookObject<BaseHooks<TContext>[TKey]> {
|
|
1146
|
+
plugin: Plugin<TContext>;
|
|
1143
1147
|
}
|
|
1144
|
-
interface
|
|
1148
|
+
interface BaseHooksList<TContext extends PluginContext = PluginContext, TKey extends BaseHookKeys<TContext> = BaseHookKeys<TContext>> {
|
|
1149
|
+
preOrdered?: BaseHooksListItem<TContext, TKey>[];
|
|
1150
|
+
preEnforced?: BaseHooksListItem<TContext, TKey>[];
|
|
1151
|
+
normal?: BaseHooksListItem<TContext, TKey>[];
|
|
1152
|
+
postEnforced?: BaseHooksListItem<TContext, TKey>[];
|
|
1153
|
+
postOrdered?: BaseHooksListItem<TContext, TKey>[];
|
|
1154
|
+
}
|
|
1155
|
+
interface ExternalHooksListItem<TContext extends PluginContext = PluginContext, TKey extends ExternalHookKeys<TContext> = ExternalHookKeys<TContext>> {
|
|
1156
|
+
plugin: Plugin<TContext>;
|
|
1157
|
+
handler: ExternalHooks<TContext>[TKey];
|
|
1158
|
+
}
|
|
1159
|
+
type HooksList<TContext extends PluginContext = PluginContext> = {
|
|
1160
|
+
[TKey in BaseHookKeys<TContext>]?: BaseHooksList<TContext, TKey>;
|
|
1161
|
+
} & {
|
|
1162
|
+
[TKey in ExternalHookKeys<TContext>]?: ExternalHooksListItem<TContext, TKey>[];
|
|
1163
|
+
};
|
|
1164
|
+
type InferHookHandler<TContext extends PluginContext, TKey extends HookKeys<TContext>> = Hooks<TContext>[TKey];
|
|
1165
|
+
type InferHookReturnType<TContext extends PluginContext, TKey extends HookKeys<TContext>> = ReturnType<InferHookHandler<TContext, TKey>> extends Promise<infer U> ? U extends Promise<infer V> ? V : U : ReturnType<InferHookHandler<TContext, TKey>>;
|
|
1166
|
+
type InferHookParameters<TContext extends PluginContext, TKey extends HookKeys<TContext>> = Parameters<InferHookHandler<TContext, TKey>>;
|
|
1167
|
+
|
|
1168
|
+
type WorkerProcess<TExposedMethods extends ReadonlyArray<string>> = {
|
|
1169
|
+
[K in TExposedMethods[number]]: (data: any) => Promise<any>;
|
|
1170
|
+
} & {
|
|
1171
|
+
close: () => void;
|
|
1172
|
+
end: () => ReturnType<Worker["end"]>;
|
|
1173
|
+
};
|
|
1174
|
+
interface MetaInfo {
|
|
1145
1175
|
/**
|
|
1146
|
-
* The
|
|
1176
|
+
* The checksum generated from the resolved options
|
|
1147
1177
|
*/
|
|
1148
|
-
|
|
1178
|
+
checksum: string;
|
|
1149
1179
|
/**
|
|
1150
|
-
* The
|
|
1151
|
-
*
|
|
1152
|
-
* @remarks
|
|
1153
|
-
* This option is used in documentation generation and other places where a human-readable title is needed.
|
|
1180
|
+
* The build id
|
|
1154
1181
|
*/
|
|
1155
|
-
|
|
1182
|
+
buildId: string;
|
|
1156
1183
|
/**
|
|
1157
|
-
*
|
|
1158
|
-
*
|
|
1159
|
-
* @remarks
|
|
1160
|
-
* If this option is not provided, the build process will try to use the \`description\` value from the `\package.json\` file.
|
|
1184
|
+
* The release id
|
|
1161
1185
|
*/
|
|
1162
|
-
|
|
1186
|
+
releaseId: string;
|
|
1163
1187
|
/**
|
|
1164
|
-
* The
|
|
1165
|
-
*
|
|
1166
|
-
* @defaultValue "info"
|
|
1188
|
+
* The build timestamp
|
|
1167
1189
|
*/
|
|
1168
|
-
|
|
1190
|
+
timestamp: number;
|
|
1169
1191
|
/**
|
|
1170
|
-
* A
|
|
1192
|
+
* A hash that represents the path to the project root directory
|
|
1171
1193
|
*/
|
|
1172
|
-
|
|
1194
|
+
projectRootHash: string;
|
|
1173
1195
|
/**
|
|
1174
|
-
*
|
|
1196
|
+
* A hash that represents the path to the project root directory
|
|
1197
|
+
*/
|
|
1198
|
+
configHash: string;
|
|
1199
|
+
/**
|
|
1200
|
+
* A mapping of runtime ids to their corresponding file paths
|
|
1201
|
+
*/
|
|
1202
|
+
builtinIdMap: Record<string, string>;
|
|
1203
|
+
/**
|
|
1204
|
+
* A mapping of virtual file paths to their corresponding file contents
|
|
1205
|
+
*/
|
|
1206
|
+
virtualFiles: Record<string, string | null>;
|
|
1207
|
+
}
|
|
1208
|
+
interface Resolver extends Jiti {
|
|
1209
|
+
plugin: Jiti;
|
|
1210
|
+
}
|
|
1211
|
+
interface SelectHooksOptions {
|
|
1212
|
+
order?: "pre" | "post" | "normal";
|
|
1213
|
+
}
|
|
1214
|
+
interface InitContextOptions {
|
|
1215
|
+
/**
|
|
1216
|
+
* If false, the plugin will be loaded after all other plugins.
|
|
1175
1217
|
*
|
|
1176
|
-
* @defaultValue
|
|
1218
|
+
* @defaultValue true
|
|
1177
1219
|
*/
|
|
1178
|
-
|
|
1220
|
+
isHighPriority: boolean;
|
|
1221
|
+
}
|
|
1222
|
+
interface Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
|
|
1179
1223
|
/**
|
|
1180
|
-
* The
|
|
1224
|
+
* The Storm workspace configuration
|
|
1181
1225
|
*/
|
|
1182
|
-
|
|
1226
|
+
workspaceConfig: WorkspaceConfig;
|
|
1183
1227
|
/**
|
|
1184
|
-
*
|
|
1228
|
+
* An object containing the options provided to Powerlines
|
|
1185
1229
|
*/
|
|
1186
|
-
|
|
1230
|
+
config: TResolvedConfig;
|
|
1187
1231
|
/**
|
|
1188
|
-
*
|
|
1232
|
+
* A logging function for the Powerlines engine
|
|
1189
1233
|
*/
|
|
1190
|
-
|
|
1234
|
+
log: LogFn;
|
|
1191
1235
|
/**
|
|
1192
|
-
*
|
|
1236
|
+
* The metadata information
|
|
1193
1237
|
*/
|
|
1194
|
-
|
|
1238
|
+
meta: MetaInfo;
|
|
1195
1239
|
/**
|
|
1196
|
-
*
|
|
1240
|
+
* The metadata information currently written to disk
|
|
1197
1241
|
*/
|
|
1198
|
-
|
|
1242
|
+
persistedMeta?: MetaInfo;
|
|
1199
1243
|
/**
|
|
1200
|
-
*
|
|
1201
|
-
*
|
|
1202
|
-
* @remarks
|
|
1203
|
-
* This configuration will be used by the documentation generation plugins during the `docs` command.
|
|
1244
|
+
* The Powerlines artifacts directory
|
|
1204
1245
|
*/
|
|
1205
|
-
|
|
1246
|
+
artifactsPath: string;
|
|
1206
1247
|
/**
|
|
1207
|
-
* The path to the
|
|
1208
|
-
*
|
|
1209
|
-
* @remarks
|
|
1210
|
-
* If a value is not provided, the plugin will attempt to find the `tsconfig.json` file in the project root directory. The parsed tsconfig compiler options will be merged with the {@link Options.tsconfigRaw} value (if provided).
|
|
1211
|
-
*
|
|
1212
|
-
* @defaultValue "\{projectRoot\}/tsconfig.json"
|
|
1248
|
+
* The path to the Powerlines builtin runtime modules directory
|
|
1213
1249
|
*/
|
|
1214
|
-
|
|
1250
|
+
builtinsPath: string;
|
|
1215
1251
|
/**
|
|
1216
|
-
* The
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
*
|
|
1221
|
-
|
|
1252
|
+
* The path to the Powerlines entry modules directory
|
|
1253
|
+
*/
|
|
1254
|
+
entryPath: string;
|
|
1255
|
+
/**
|
|
1256
|
+
* The path to the Powerlines TypeScript declaration files directory
|
|
1257
|
+
*/
|
|
1258
|
+
dtsPath: string;
|
|
1259
|
+
/**
|
|
1260
|
+
* The path to a directory where the reflection data buffers (used by the build processes) are stored
|
|
1261
|
+
*/
|
|
1262
|
+
dataPath: string;
|
|
1263
|
+
/**
|
|
1264
|
+
* The path to a directory where the project cache (used by the build processes) is stored
|
|
1265
|
+
*/
|
|
1266
|
+
cachePath: string;
|
|
1267
|
+
/**
|
|
1268
|
+
* The Powerlines environment paths
|
|
1269
|
+
*/
|
|
1270
|
+
envPaths: EnvPaths;
|
|
1271
|
+
/**
|
|
1272
|
+
* The file system path to the Powerlines package installation
|
|
1273
|
+
*/
|
|
1274
|
+
powerlinesPath: string;
|
|
1275
|
+
/**
|
|
1276
|
+
* The relative path to the Powerlines workspace root directory
|
|
1277
|
+
*/
|
|
1278
|
+
relativeToWorkspaceRoot: string;
|
|
1279
|
+
/**
|
|
1280
|
+
* The project's `package.json` file content
|
|
1281
|
+
*/
|
|
1282
|
+
packageJson: PackageJson & Record<string, any>;
|
|
1283
|
+
/**
|
|
1284
|
+
* The project's `project.json` file content
|
|
1222
1285
|
*/
|
|
1223
|
-
|
|
1224
|
-
}
|
|
1225
|
-
interface EnvironmentConfig extends BaseConfig {
|
|
1286
|
+
projectJson?: Record<string, any>;
|
|
1226
1287
|
/**
|
|
1227
|
-
*
|
|
1228
|
-
*
|
|
1229
|
-
* @defaultValue `['browser', 'module', 'jsnext:main', 'jsnext']`
|
|
1288
|
+
* The dependency installations required by the project
|
|
1230
1289
|
*/
|
|
1231
|
-
|
|
1290
|
+
dependencies: Record<string, string | Range>;
|
|
1232
1291
|
/**
|
|
1233
|
-
*
|
|
1292
|
+
* The development dependency installations required by the project
|
|
1234
1293
|
*/
|
|
1235
|
-
|
|
1294
|
+
devDependencies: Record<string, string | Range>;
|
|
1236
1295
|
/**
|
|
1237
|
-
*
|
|
1296
|
+
* The parsed TypeScript configuration from the `tsconfig.json` file
|
|
1238
1297
|
*/
|
|
1239
|
-
|
|
1298
|
+
tsconfig: ParsedTypeScriptConfig;
|
|
1240
1299
|
/**
|
|
1241
|
-
*
|
|
1242
|
-
*
|
|
1243
|
-
* @defaultValue `['.mjs', '.js', '.mts', '.ts', '.jsx', '.tsx', '.json']`
|
|
1300
|
+
* The entry points of the source code
|
|
1244
1301
|
*/
|
|
1245
|
-
|
|
1302
|
+
entry: ResolvedEntryTypeDefinition[];
|
|
1246
1303
|
/**
|
|
1247
|
-
*
|
|
1248
|
-
*
|
|
1249
|
-
* @remarks
|
|
1250
|
-
* This option is useful for ensuring that only one version of a module is included in the bundle, which can help reduce bundle size and avoid conflicts.
|
|
1304
|
+
* The virtual file system manager used during the build process to reference generated runtime files
|
|
1251
1305
|
*/
|
|
1252
|
-
|
|
1306
|
+
fs: VirtualFileSystemInterface;
|
|
1253
1307
|
/**
|
|
1254
|
-
*
|
|
1308
|
+
* The Jiti module resolver
|
|
1255
1309
|
*/
|
|
1256
|
-
|
|
1310
|
+
resolver: Resolver;
|
|
1257
1311
|
/**
|
|
1258
|
-
*
|
|
1312
|
+
* The builtin module id that exist in the Powerlines virtual file system
|
|
1259
1313
|
*/
|
|
1260
|
-
|
|
1314
|
+
builtins: string[];
|
|
1261
1315
|
/**
|
|
1262
|
-
*
|
|
1316
|
+
* The Powerlines builtin virtual files
|
|
1263
1317
|
*/
|
|
1264
|
-
|
|
1318
|
+
getBuiltins: () => Promise<VirtualFile[]>;
|
|
1265
1319
|
/**
|
|
1266
|
-
*
|
|
1320
|
+
* Resolves a builtin virtual file and writes it to the VFS if it does not already exist
|
|
1267
1321
|
*
|
|
1268
|
-
* @
|
|
1322
|
+
* @param code - The source code of the builtin file
|
|
1323
|
+
* @param id - The unique identifier of the builtin file
|
|
1324
|
+
* @param path - An optional path to write the builtin file to
|
|
1325
|
+
* @param options - Options for writing the file
|
|
1269
1326
|
*/
|
|
1270
|
-
|
|
1271
|
-
}
|
|
1272
|
-
interface CommonUserConfig extends BaseConfig {
|
|
1327
|
+
writeBuiltin: (code: string, id: string, path?: string, options?: PowerlinesWriteFileOptions) => Promise<void>;
|
|
1273
1328
|
/**
|
|
1274
|
-
*
|
|
1329
|
+
* Resolves a entry virtual file and writes it to the VFS if it does not already exist
|
|
1275
1330
|
*
|
|
1276
|
-
* @
|
|
1331
|
+
* @param code - The source code of the entry file
|
|
1332
|
+
* @param path - An optional path to write the entry file to
|
|
1333
|
+
* @param options - Options for writing the file
|
|
1277
1334
|
*/
|
|
1278
|
-
|
|
1335
|
+
writeEntry: (code: string, path: string, options?: PowerlinesWriteFileOptions) => Promise<void>;
|
|
1279
1336
|
/**
|
|
1280
|
-
*
|
|
1337
|
+
* Parses the source code and returns a {@link ParseResult} object.
|
|
1281
1338
|
*/
|
|
1282
|
-
|
|
1339
|
+
parse: (code: string, id: string, options?: ParserOptions | null) => Promise<ParseResult>;
|
|
1283
1340
|
/**
|
|
1284
|
-
*
|
|
1285
|
-
*
|
|
1286
|
-
* @defaultValue "\{root\}/src"
|
|
1341
|
+
* A function to update the context fields using a new user configuration options
|
|
1287
1342
|
*/
|
|
1288
|
-
|
|
1343
|
+
withUserConfig: (userConfig: UserConfig, options?: InitContextOptions) => Promise<void>;
|
|
1289
1344
|
/**
|
|
1290
|
-
* A
|
|
1291
|
-
*
|
|
1292
|
-
* @remarks
|
|
1293
|
-
* This option is useful for running Powerlines commands with different configuration files, such as in CI/CD environments or when testing different configurations.
|
|
1345
|
+
* A function to update the context fields using inline configuration options
|
|
1294
1346
|
*/
|
|
1295
|
-
|
|
1347
|
+
withInlineConfig: (inlineConfig: InlineConfig, options?: InitContextOptions) => Promise<void>;
|
|
1296
1348
|
/**
|
|
1297
|
-
*
|
|
1349
|
+
* Create a new logger instance
|
|
1298
1350
|
*
|
|
1299
|
-
* @
|
|
1300
|
-
*
|
|
1351
|
+
* @param name - The name to use for the logger instance
|
|
1352
|
+
* @returns A logger function
|
|
1353
|
+
*/
|
|
1354
|
+
createLog: (name: string | null) => LogFn;
|
|
1355
|
+
/**
|
|
1356
|
+
* Extend the current logger instance with a new name
|
|
1301
1357
|
*
|
|
1302
|
-
* @
|
|
1358
|
+
* @param name - The name to use for the extended logger instance
|
|
1359
|
+
* @returns A logger function
|
|
1303
1360
|
*/
|
|
1304
|
-
|
|
1361
|
+
extendLog: (name: string) => LogFn;
|
|
1362
|
+
}
|
|
1363
|
+
interface APIContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> extends Context<TResolvedConfig> {
|
|
1305
1364
|
/**
|
|
1306
|
-
*
|
|
1365
|
+
* The expected plugins options for the Powerlines project.
|
|
1307
1366
|
*
|
|
1308
|
-
* @
|
|
1367
|
+
* @remarks
|
|
1368
|
+
* This is a record of plugin identifiers to their respective options. This field is populated by the Powerlines engine during both plugin initialization and the `init` command.
|
|
1309
1369
|
*/
|
|
1310
|
-
|
|
1370
|
+
plugins: Plugin<PluginContext<TResolvedConfig>>[];
|
|
1311
1371
|
/**
|
|
1312
|
-
* A
|
|
1372
|
+
* A function to add a plugin to the context and update the configuration options
|
|
1313
1373
|
*/
|
|
1314
|
-
|
|
1374
|
+
addPlugin: (plugin: Plugin<PluginContext<TResolvedConfig>>) => Promise<void>;
|
|
1315
1375
|
/**
|
|
1316
|
-
*
|
|
1376
|
+
* A table for storing the current context for each configured environment
|
|
1317
1377
|
*/
|
|
1318
|
-
environments
|
|
1378
|
+
environments: Record<string, EnvironmentContext<TResolvedConfig>>;
|
|
1319
1379
|
/**
|
|
1320
|
-
*
|
|
1380
|
+
* Retrieves the context for a specific environment by name
|
|
1321
1381
|
*
|
|
1322
|
-
* @
|
|
1382
|
+
* @throws Will throw an error if the environment does not exist
|
|
1383
|
+
*
|
|
1384
|
+
* @param name - The name of the environment to retrieve. If not provided, the default environment is returned.
|
|
1385
|
+
* @returns A promise that resolves to the environment context.
|
|
1386
|
+
*
|
|
1387
|
+
* @example
|
|
1388
|
+
* ```ts
|
|
1389
|
+
* const devEnv = await apiContext.getEnvironment("development");
|
|
1390
|
+
* const defaultEnv = await apiContext.getEnvironment();
|
|
1391
|
+
* ```
|
|
1323
1392
|
*/
|
|
1324
|
-
|
|
1325
|
-
}
|
|
1326
|
-
type UserConfig<TBuildConfig extends BuildConfig = BuildConfig, TBuildResolvedConfig extends BuildResolvedConfig = BuildResolvedConfig, TBuildVariant extends string = any> = CommonUserConfig & {
|
|
1327
|
-
build?: TBuildConfig & {
|
|
1328
|
-
/**
|
|
1329
|
-
* The build variant being used by the Powerlines engine.
|
|
1330
|
-
*/
|
|
1331
|
-
variant?: TBuildVariant;
|
|
1332
|
-
};
|
|
1333
|
-
override?: Partial<TBuildResolvedConfig>;
|
|
1334
|
-
};
|
|
1335
|
-
type WebpackUserConfig = UserConfig<WebpackBuildConfig, WebpackResolvedBuildConfig, "webpack">;
|
|
1336
|
-
type RspackUserConfig = UserConfig<RspackBuildConfig, RspackResolvedBuildConfig, "rspack">;
|
|
1337
|
-
type RollupUserConfig = UserConfig<RollupBuildConfig, RollupResolvedBuildConfig, "rollup">;
|
|
1338
|
-
type RolldownUserConfig = UserConfig<RolldownBuildConfig, RolldownResolvedBuildConfig, "rolldown">;
|
|
1339
|
-
type ViteUserConfig = UserConfig<ViteBuildConfig, ViteResolvedBuildConfig, "vite">;
|
|
1340
|
-
type ESBuildUserConfig = UserConfig<ESBuildBuildConfig, ESBuildResolvedBuildConfig, "esbuild">;
|
|
1341
|
-
type UnbuildUserConfig = UserConfig<UnbuildBuildConfig, UnbuildResolvedBuildConfig, "unbuild">;
|
|
1342
|
-
type TsupUserConfig = UserConfig<TsupBuildConfig, TsupResolvedBuildConfig, "tsup">;
|
|
1343
|
-
type FarmUserConfig = UserConfig<FarmBuildConfig, FarmResolvedBuildConfig, "farm">;
|
|
1344
|
-
type InferUserConfig<TBuildVariant extends BuildVariant | undefined> = TBuildVariant extends "webpack" ? WebpackUserConfig : TBuildVariant extends "rspack" ? RspackUserConfig : TBuildVariant extends "vite" ? ViteUserConfig : TBuildVariant extends "esbuild" ? ESBuildUserConfig : TBuildVariant extends "unbuild" ? UnbuildUserConfig : TBuildVariant extends "tsup" ? TsupUserConfig : TBuildVariant extends "rolldown" ? RolldownUserConfig : TBuildVariant extends "rollup" ? RollupUserConfig : TBuildVariant extends "farm" ? FarmUserConfig : UserConfig;
|
|
1345
|
-
type InitialUserConfig<TUserConfig extends UserConfig = UserConfig> = Partial<TUserConfig> & {
|
|
1346
|
-
root: string;
|
|
1347
|
-
};
|
|
1348
|
-
type ParsedUserConfig<TUserConfig extends UserConfig = UserConfig> = TUserConfig & ResolvedConfig$1<TUserConfig> & {
|
|
1393
|
+
getEnvironment: (name?: string) => Promise<EnvironmentContext<TResolvedConfig>>;
|
|
1349
1394
|
/**
|
|
1350
|
-
*
|
|
1395
|
+
* Safely retrieves the context for a specific environment by name
|
|
1396
|
+
*
|
|
1397
|
+
* @param name - The name of the environment to retrieve. If not provided, the default environment is returned.
|
|
1398
|
+
* @returns A promise that resolves to the environment context, or undefined if the environment does not exist.
|
|
1399
|
+
*
|
|
1400
|
+
* @example
|
|
1401
|
+
* ```ts
|
|
1402
|
+
* const devEnv = await apiContext.getEnvironmentSafe("development");
|
|
1403
|
+
* const defaultEnv = await apiContext.getEnvironmentSafe();
|
|
1404
|
+
* ```
|
|
1351
1405
|
*
|
|
1352
1406
|
* @remarks
|
|
1353
|
-
* This is
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
*
|
|
1407
|
+
* This method is similar to `getEnvironment`, but it returns `undefined` instead of throwing an error if the specified environment does not exist.
|
|
1408
|
+
* This can be useful in scenarios where the existence of an environment is optional or uncertain.
|
|
1409
|
+
*
|
|
1410
|
+
* ```ts
|
|
1411
|
+
* const testEnv = await apiContext.getEnvironmentSafe("test");
|
|
1412
|
+
* if (testEnv) {
|
|
1413
|
+
* // Environment exists, safe to use it
|
|
1414
|
+
* } else {
|
|
1415
|
+
* // Environment does not exist, handle accordingly
|
|
1416
|
+
* }
|
|
1417
|
+
* ```
|
|
1418
|
+
*
|
|
1419
|
+
* Using this method helps avoid unhandled exceptions in cases where an environment might not be defined.
|
|
1364
1420
|
*/
|
|
1365
|
-
|
|
1366
|
-
};
|
|
1367
|
-
type NewInlineConfig<TUserConfig extends UserConfig = UserConfig> = InlineConfig<TUserConfig> & Required<Pick<InlineConfig<TUserConfig>, "root">> & {
|
|
1421
|
+
getEnvironmentSafe: (name?: string) => Promise<EnvironmentContext<TResolvedConfig> | undefined>;
|
|
1368
1422
|
/**
|
|
1369
|
-
* A
|
|
1423
|
+
* A function to copy the context and update the fields for a specific environment
|
|
1424
|
+
*
|
|
1425
|
+
* @param environment - The environment configuration to use.
|
|
1426
|
+
* @returns A new context instance with the updated environment.
|
|
1370
1427
|
*/
|
|
1371
|
-
|
|
1428
|
+
in: (environment: EnvironmentResolvedConfig) => Promise<EnvironmentContext<TResolvedConfig>>;
|
|
1429
|
+
}
|
|
1430
|
+
interface EnvironmentContextPlugin<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
|
|
1431
|
+
plugin: Plugin<PluginContext<TResolvedConfig>>;
|
|
1432
|
+
context: PluginContext<TResolvedConfig>;
|
|
1433
|
+
}
|
|
1434
|
+
interface EnvironmentContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> extends Context<TResolvedConfig> {
|
|
1372
1435
|
/**
|
|
1373
|
-
* The
|
|
1436
|
+
* The expected plugins options for the Powerlines project.
|
|
1437
|
+
*
|
|
1438
|
+
* @remarks
|
|
1439
|
+
* This is a record of plugin identifiers to their respective options. This field is populated by the Powerlines engine during both plugin initialization and the `init` command.
|
|
1374
1440
|
*/
|
|
1375
|
-
|
|
1376
|
-
};
|
|
1377
|
-
type CleanInlineConfig<TUserConfig extends UserConfig = UserConfig> = InlineConfig<TUserConfig> & {
|
|
1441
|
+
plugins: EnvironmentContextPlugin<TResolvedConfig>[];
|
|
1378
1442
|
/**
|
|
1379
|
-
* A
|
|
1443
|
+
* A function to add a plugin to the context and update the configuration options
|
|
1380
1444
|
*/
|
|
1381
|
-
|
|
1382
|
-
};
|
|
1383
|
-
type PrepareInlineConfig<TUserConfig extends UserConfig = UserConfig> = InlineConfig<TUserConfig> & {
|
|
1445
|
+
addPlugin: (plugin: Plugin<PluginContext<TResolvedConfig>>) => Promise<void>;
|
|
1384
1446
|
/**
|
|
1385
|
-
*
|
|
1447
|
+
* The environment specific resolved configuration
|
|
1386
1448
|
*/
|
|
1387
|
-
|
|
1388
|
-
};
|
|
1389
|
-
type BuildInlineConfig<TUserConfig extends UserConfig = UserConfig> = InlineConfig<TUserConfig> & {
|
|
1449
|
+
environment: EnvironmentResolvedConfig;
|
|
1390
1450
|
/**
|
|
1391
|
-
* A
|
|
1451
|
+
* A table holding references to hook functions registered by plugins
|
|
1392
1452
|
*/
|
|
1393
|
-
|
|
1394
|
-
};
|
|
1395
|
-
type LintInlineConfig<TUserConfig extends UserConfig = UserConfig> = InlineConfig<TUserConfig> & {
|
|
1453
|
+
hooks: HooksList<PluginContext<TResolvedConfig>>;
|
|
1396
1454
|
/**
|
|
1397
|
-
*
|
|
1455
|
+
* Retrieves the hook handlers for a specific hook name
|
|
1398
1456
|
*/
|
|
1399
|
-
|
|
1400
|
-
}
|
|
1401
|
-
|
|
1457
|
+
selectHooks: <TKey extends HookKeys<PluginContext<TResolvedConfig>>>(hook: TKey, options?: SelectHooksOptions) => Hooks[TKey][];
|
|
1458
|
+
}
|
|
1459
|
+
interface PluginContext<out TResolvedConfig extends ResolvedConfig = ResolvedConfig> extends Context<TResolvedConfig>, UnpluginContext {
|
|
1402
1460
|
/**
|
|
1403
|
-
*
|
|
1461
|
+
* The environment specific resolved configuration
|
|
1404
1462
|
*/
|
|
1405
|
-
|
|
1406
|
-
};
|
|
1407
|
-
type ReleaseInlineConfig<TUserConfig extends UserConfig = UserConfig> = InlineConfig<TUserConfig> & {
|
|
1463
|
+
environment: EnvironmentResolvedConfig;
|
|
1408
1464
|
/**
|
|
1409
|
-
*
|
|
1465
|
+
* An alternative property name for the {@link log} property
|
|
1466
|
+
*
|
|
1467
|
+
* @remarks
|
|
1468
|
+
* This is provided for compatibility with other logging libraries that expect a `logger` property.
|
|
1410
1469
|
*/
|
|
1411
|
-
|
|
1412
|
-
}
|
|
1470
|
+
logger: LogFn;
|
|
1471
|
+
}
|
|
1472
|
+
type BuildPluginContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> = PluginContext<TResolvedConfig> & Omit<UnpluginBuildContext, "parse">;
|
|
1413
1473
|
|
|
1414
1474
|
export type { APIContext as A, BaseHookKeys as B, Context as C, InitialUserConfig as D, ESBuildResolvedBuildConfig as E, PrepareInlineConfig as F, CleanInlineConfig as G, HookKeys as H, InferHookParameters as I, BuildInlineConfig as J, LintInlineConfig as K, LogFn as L, MetaInfo as M, NewInlineConfig as N, DocsInlineConfig as O, PowerlinesCommand as P, ReleaseInlineConfig as Q, ResolvedEntryTypeDefinition as R, SelectHooksOptions as S, TsupBuildConfig as T, UnbuildBuildConfig as U, ViteResolvedBuildConfig as V, WorkspaceConfig as W, ParsedUserConfig as a, RolldownResolvedBuildConfig as b, RollupResolvedBuildConfig as c, TsupResolvedBuildConfig as d, PluginContext as e, ResolvedConfig as f, Plugin as g, PluginConfigObject as h, PluginConfigTuple as i, PluginConfig as j, PluginHookObject as k, PluginHook as l, EnvironmentConfig as m, EnvironmentResolvedConfig as n, ExternalHookKeys as o, BaseHooksListItem as p, WorkerProcess as q, EnvironmentContext as r, InferHookReturnType as s, UnbuildResolvedBuildConfig as t, BuildVariant as u, InferUnpluginVariant as v, BuildPlugin as w, InferResolvedConfig as x, UnpluginBuildVariant as y, InferUserConfig as z };
|