powerlines 0.10.2 → 0.11.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-gk8S8LFP.d.cts → hooks-H3i0YxVa.d.cts} +1 -1
- package/dist/{hooks-BGYnc61f.d.ts → hooks-QG1Q6zBM.d.ts} +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-B481RQbf.d.cts} +615 -559
- package/dist/lib/{config-B_WTwd49.d.ts → context-efHKG-wc.d.ts} +615 -559
- 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-CdvPHbFZ.d.cts} +1 -1
- package/dist/lib/{hooks-4KkL9GD2.d.cts → hooks-JhMVguVh.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/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 +9 -7
- 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
- package/dist/{resolved-CcuVqMqc.d.cts → resolved-3RFshyDy.d.cts} +16 -16
- package/dist/{resolved-Dhscmo3z.d.ts → resolved-BzyBMgQG.d.ts} +16 -16
|
@@ -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.cjs';
|
|
24
25
|
import { ArrayValues } from '@stryke/types/array';
|
|
25
|
-
import { P as ParsedTypeScriptConfig, T as TSConfig } from './tsconfig-Bz-CiFqD.cjs';
|
|
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,769 @@ 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
|
-
* @
|
|
805
|
-
|
|
806
|
-
isHighPriority: boolean;
|
|
807
|
-
}
|
|
808
|
-
interface Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
|
|
809
|
-
/**
|
|
810
|
-
* The Storm workspace configuration
|
|
797
|
+
* @remarks
|
|
798
|
+
* This option is used in documentation generation and other places where a human-readable title is needed.
|
|
811
799
|
*/
|
|
812
|
-
|
|
800
|
+
title?: string;
|
|
813
801
|
/**
|
|
814
|
-
*
|
|
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.
|
|
815
806
|
*/
|
|
816
|
-
|
|
807
|
+
description?: string;
|
|
817
808
|
/**
|
|
818
|
-
*
|
|
809
|
+
* The log level to use for the Powerlines processes.
|
|
810
|
+
*
|
|
811
|
+
* @defaultValue "info"
|
|
819
812
|
*/
|
|
820
|
-
|
|
813
|
+
logLevel?: LogLevelLabel | null;
|
|
821
814
|
/**
|
|
822
|
-
*
|
|
815
|
+
* A custom logger function to use for logging messages
|
|
823
816
|
*/
|
|
824
|
-
|
|
817
|
+
customLogger?: LogFn;
|
|
825
818
|
/**
|
|
826
|
-
*
|
|
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"
|
|
827
822
|
*/
|
|
828
|
-
|
|
823
|
+
mode?: "development" | "test" | "production";
|
|
829
824
|
/**
|
|
830
|
-
* The
|
|
825
|
+
* The entry point(s) for the application
|
|
831
826
|
*/
|
|
832
|
-
|
|
827
|
+
entry?: TypeDefinitionParameter | TypeDefinitionParameter[];
|
|
833
828
|
/**
|
|
834
|
-
*
|
|
829
|
+
* Configuration for linting the source code
|
|
835
830
|
*/
|
|
836
|
-
|
|
831
|
+
lint?: Record<string, any> | false;
|
|
837
832
|
/**
|
|
838
|
-
*
|
|
833
|
+
* Configuration for the output of the build process
|
|
839
834
|
*/
|
|
840
|
-
|
|
835
|
+
output?: OutputConfig;
|
|
841
836
|
/**
|
|
842
|
-
*
|
|
837
|
+
* Configuration for the transformation of the source code
|
|
843
838
|
*/
|
|
844
|
-
|
|
839
|
+
transform?: Record<string, any>;
|
|
845
840
|
/**
|
|
846
|
-
*
|
|
841
|
+
* Options to to provide to the build process
|
|
847
842
|
*/
|
|
848
|
-
|
|
843
|
+
build?: BuildConfig;
|
|
849
844
|
/**
|
|
850
|
-
*
|
|
845
|
+
* Configuration for documentation generation
|
|
846
|
+
*
|
|
847
|
+
* @remarks
|
|
848
|
+
* This configuration will be used by the documentation generation plugins during the `docs` command.
|
|
851
849
|
*/
|
|
852
|
-
|
|
850
|
+
docs?: Record<string, any>;
|
|
853
851
|
/**
|
|
854
|
-
* The path to the
|
|
852
|
+
* The path to the tsconfig file to be used by the compiler
|
|
853
|
+
*
|
|
854
|
+
* @remarks
|
|
855
|
+
* 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).
|
|
856
|
+
*
|
|
857
|
+
* @defaultValue "\{projectRoot\}/tsconfig.json"
|
|
855
858
|
*/
|
|
856
|
-
|
|
859
|
+
tsconfig?: string;
|
|
857
860
|
/**
|
|
858
|
-
* The
|
|
861
|
+
* The raw {@link TSConfig} object to be used by the compiler. This object will be merged with the `tsconfig.json` file.
|
|
862
|
+
*
|
|
863
|
+
* @see https://www.typescriptlang.org/tsconfig
|
|
864
|
+
*
|
|
865
|
+
* @remarks
|
|
866
|
+
* If populated, this option takes higher priority than `tsconfig`
|
|
859
867
|
*/
|
|
860
|
-
|
|
868
|
+
tsconfigRaw?: TSConfig;
|
|
869
|
+
}
|
|
870
|
+
interface EnvironmentConfig extends BaseConfig {
|
|
861
871
|
/**
|
|
862
|
-
*
|
|
872
|
+
* 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.
|
|
873
|
+
*
|
|
874
|
+
* @defaultValue `['browser', 'module', 'jsnext:main', 'jsnext']`
|
|
863
875
|
*/
|
|
864
|
-
|
|
876
|
+
mainFields?: string[];
|
|
865
877
|
/**
|
|
866
|
-
*
|
|
878
|
+
* Array of strings indicating what conditions should be used for module resolution.
|
|
867
879
|
*/
|
|
868
|
-
|
|
880
|
+
conditions?: string[];
|
|
869
881
|
/**
|
|
870
|
-
*
|
|
882
|
+
* Array of strings indicating what conditions should be used for external modules.
|
|
871
883
|
*/
|
|
872
|
-
|
|
884
|
+
externalConditions?: string[];
|
|
873
885
|
/**
|
|
874
|
-
*
|
|
886
|
+
* Array of strings indicating what file extensions should be used for module resolution.
|
|
887
|
+
*
|
|
888
|
+
* @defaultValue `['.mjs', '.js', '.mts', '.ts', '.jsx', '.tsx', '.json']`
|
|
875
889
|
*/
|
|
876
|
-
|
|
890
|
+
extensions?: string[];
|
|
877
891
|
/**
|
|
878
|
-
*
|
|
892
|
+
* Array of strings indicating what modules should be deduplicated to a single version in the build.
|
|
893
|
+
*
|
|
894
|
+
* @remarks
|
|
895
|
+
* 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
896
|
*/
|
|
880
|
-
|
|
897
|
+
dedupe?: string[];
|
|
881
898
|
/**
|
|
882
|
-
*
|
|
899
|
+
* Array of strings or regular expressions that indicate what modules are builtin for the environment.
|
|
883
900
|
*/
|
|
884
|
-
|
|
901
|
+
builtins?: (string | RegExp)[];
|
|
885
902
|
/**
|
|
886
|
-
*
|
|
903
|
+
* Configuration options for the preview server
|
|
887
904
|
*/
|
|
888
|
-
|
|
905
|
+
preview?: PreviewOptions;
|
|
889
906
|
/**
|
|
890
|
-
*
|
|
907
|
+
* A flag indicating whether the build is for a Server-Side Rendering environment.
|
|
891
908
|
*/
|
|
892
|
-
|
|
909
|
+
ssr?: boolean;
|
|
893
910
|
/**
|
|
894
|
-
*
|
|
911
|
+
* Define if this environment is used for Server-Side Rendering
|
|
912
|
+
*
|
|
913
|
+
* @defaultValue "server" (if it isn't the client environment)
|
|
895
914
|
*/
|
|
896
|
-
|
|
915
|
+
consumer?: "client" | "server";
|
|
916
|
+
}
|
|
917
|
+
interface CommonUserConfig extends BaseConfig {
|
|
897
918
|
/**
|
|
898
|
-
* The
|
|
919
|
+
* The type of project being built
|
|
920
|
+
*
|
|
921
|
+
* @defaultValue "application"
|
|
899
922
|
*/
|
|
900
|
-
|
|
923
|
+
type?: ProjectType;
|
|
901
924
|
/**
|
|
902
|
-
* The
|
|
925
|
+
* The root directory of the project
|
|
903
926
|
*/
|
|
904
|
-
|
|
927
|
+
root: string;
|
|
905
928
|
/**
|
|
906
|
-
*
|
|
929
|
+
* The root directory of the project's source code
|
|
907
930
|
*
|
|
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
|
|
931
|
+
* @defaultValue "\{root\}/src"
|
|
912
932
|
*/
|
|
913
|
-
|
|
933
|
+
sourceRoot?: string;
|
|
914
934
|
/**
|
|
915
|
-
*
|
|
935
|
+
* 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
936
|
*
|
|
917
|
-
* @
|
|
918
|
-
*
|
|
919
|
-
* @param options - Options for writing the file
|
|
937
|
+
* @remarks
|
|
938
|
+
* This option is useful for running Powerlines commands with different configuration files, such as in CI/CD environments or when testing different configurations.
|
|
920
939
|
*/
|
|
921
|
-
|
|
940
|
+
configFile?: string;
|
|
922
941
|
/**
|
|
923
|
-
*
|
|
942
|
+
* Should the Powerlines CLI processes skip installing missing packages?
|
|
943
|
+
*
|
|
944
|
+
* @remarks
|
|
945
|
+
* This option is useful for CI/CD environments where the installation of packages is handled by a different process.
|
|
946
|
+
*
|
|
947
|
+
* @defaultValue false
|
|
924
948
|
*/
|
|
925
|
-
|
|
949
|
+
skipInstalls?: boolean;
|
|
926
950
|
/**
|
|
927
|
-
*
|
|
951
|
+
* Should the compiler processes skip any improvements that make use of cache?
|
|
952
|
+
*
|
|
953
|
+
* @defaultValue false
|
|
928
954
|
*/
|
|
929
|
-
|
|
955
|
+
skipCache?: boolean;
|
|
930
956
|
/**
|
|
931
|
-
* A
|
|
957
|
+
* A list of resolvable paths to plugins used during the build process
|
|
932
958
|
*/
|
|
933
|
-
|
|
959
|
+
plugins?: PluginConfig<PluginContext<any>>[];
|
|
934
960
|
/**
|
|
935
|
-
*
|
|
936
|
-
*
|
|
937
|
-
* @param name - The name to use for the logger instance
|
|
938
|
-
* @returns A logger function
|
|
961
|
+
* Environment-specific configurations
|
|
939
962
|
*/
|
|
940
|
-
|
|
963
|
+
environments?: Record<string, EnvironmentConfig>;
|
|
941
964
|
/**
|
|
942
|
-
*
|
|
965
|
+
* A string identifier that allows a child framework or tool to identify itself when using Powerlines.
|
|
943
966
|
*
|
|
944
|
-
* @
|
|
945
|
-
* @returns A logger function
|
|
967
|
+
* @defaultValue "powerlines"
|
|
946
968
|
*/
|
|
947
|
-
|
|
969
|
+
framework?: string;
|
|
948
970
|
}
|
|
949
|
-
|
|
971
|
+
type UserConfig<TBuildConfig extends BuildConfig = BuildConfig, TBuildResolvedConfig extends BuildResolvedConfig = BuildResolvedConfig, TBuildVariant extends string = any> = CommonUserConfig & {
|
|
972
|
+
build?: TBuildConfig & {
|
|
973
|
+
/**
|
|
974
|
+
* The build variant being used by the Powerlines engine.
|
|
975
|
+
*/
|
|
976
|
+
variant?: TBuildVariant;
|
|
977
|
+
};
|
|
978
|
+
override?: Partial<TBuildResolvedConfig>;
|
|
979
|
+
};
|
|
980
|
+
type WebpackUserConfig = UserConfig<WebpackBuildConfig, WebpackResolvedBuildConfig, "webpack">;
|
|
981
|
+
type RspackUserConfig = UserConfig<RspackBuildConfig, RspackResolvedBuildConfig, "rspack">;
|
|
982
|
+
type RollupUserConfig = UserConfig<RollupBuildConfig, RollupResolvedBuildConfig, "rollup">;
|
|
983
|
+
type RolldownUserConfig = UserConfig<RolldownBuildConfig, RolldownResolvedBuildConfig, "rolldown">;
|
|
984
|
+
type ViteUserConfig = UserConfig<ViteBuildConfig, ViteResolvedBuildConfig, "vite">;
|
|
985
|
+
type ESBuildUserConfig = UserConfig<ESBuildBuildConfig, ESBuildResolvedBuildConfig, "esbuild">;
|
|
986
|
+
type UnbuildUserConfig = UserConfig<UnbuildBuildConfig, UnbuildResolvedBuildConfig, "unbuild">;
|
|
987
|
+
type TsupUserConfig = UserConfig<TsupBuildConfig, TsupResolvedBuildConfig, "tsup">;
|
|
988
|
+
type FarmUserConfig = UserConfig<FarmBuildConfig, FarmResolvedBuildConfig, "farm">;
|
|
989
|
+
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;
|
|
990
|
+
type InitialUserConfig<TUserConfig extends UserConfig = UserConfig> = Partial<TUserConfig> & {
|
|
991
|
+
root: string;
|
|
992
|
+
};
|
|
993
|
+
type ParsedUserConfig<TUserConfig extends UserConfig = UserConfig> = TUserConfig & ResolvedConfig$1<TUserConfig> & {
|
|
950
994
|
/**
|
|
951
|
-
* The
|
|
995
|
+
* The path to the user configuration file, if it exists.
|
|
952
996
|
*
|
|
953
997
|
* @remarks
|
|
954
|
-
* This is
|
|
998
|
+
* This is typically the `powerlines.json`, `powerlines.config.js`, or `powerlines.config.ts` file in the project root.
|
|
955
999
|
*/
|
|
956
|
-
|
|
1000
|
+
configFile?: ConfigLayer<TUserConfig>["configFile"];
|
|
1001
|
+
};
|
|
1002
|
+
type PowerlinesCommand = "new" | "prepare" | "build" | "lint" | "test" | "docs" | "release" | "clean";
|
|
1003
|
+
/**
|
|
1004
|
+
* The configuration provided while executing Powerlines commands.
|
|
1005
|
+
*/
|
|
1006
|
+
type InlineConfig<TUserConfig extends UserConfig = UserConfig> = Partial<TUserConfig> & {
|
|
957
1007
|
/**
|
|
958
|
-
* A
|
|
1008
|
+
* A string identifier for the Powerlines command being executed
|
|
959
1009
|
*/
|
|
960
|
-
|
|
1010
|
+
command: PowerlinesCommand;
|
|
1011
|
+
};
|
|
1012
|
+
type NewInlineConfig<TUserConfig extends UserConfig = UserConfig> = InlineConfig<TUserConfig> & Required<Pick<InlineConfig<TUserConfig>, "root">> & {
|
|
961
1013
|
/**
|
|
962
|
-
* A
|
|
1014
|
+
* A string identifier for the Powerlines command being executed
|
|
963
1015
|
*/
|
|
964
|
-
|
|
1016
|
+
command: "new";
|
|
965
1017
|
/**
|
|
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
|
-
* ```
|
|
1018
|
+
* 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
1019
|
*/
|
|
979
|
-
|
|
1020
|
+
packageName?: string;
|
|
1021
|
+
};
|
|
1022
|
+
type CleanInlineConfig<TUserConfig extends UserConfig = UserConfig> = InlineConfig<TUserConfig> & {
|
|
980
1023
|
/**
|
|
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.
|
|
1024
|
+
* A string identifier for the Powerlines command being executed
|
|
1006
1025
|
*/
|
|
1007
|
-
|
|
1026
|
+
command: "clean";
|
|
1027
|
+
};
|
|
1028
|
+
type PrepareInlineConfig<TUserConfig extends UserConfig = UserConfig> = InlineConfig<TUserConfig> & {
|
|
1008
1029
|
/**
|
|
1009
|
-
* A
|
|
1010
|
-
*
|
|
1011
|
-
* @param environment - The environment configuration to use.
|
|
1012
|
-
* @returns A new context instance with the updated environment.
|
|
1030
|
+
* A string identifier for the Powerlines command being executed
|
|
1013
1031
|
*/
|
|
1014
|
-
|
|
1015
|
-
}
|
|
1016
|
-
|
|
1017
|
-
plugin: Plugin<PluginContext<TResolvedConfig>>;
|
|
1018
|
-
context: PluginContext<TResolvedConfig>;
|
|
1019
|
-
}
|
|
1020
|
-
interface EnvironmentContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> extends Context<TResolvedConfig> {
|
|
1032
|
+
command: "prepare";
|
|
1033
|
+
};
|
|
1034
|
+
type BuildInlineConfig<TUserConfig extends UserConfig = UserConfig> = InlineConfig<TUserConfig> & {
|
|
1021
1035
|
/**
|
|
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.
|
|
1036
|
+
* A string identifier for the Powerlines command being executed
|
|
1026
1037
|
*/
|
|
1027
|
-
|
|
1038
|
+
command: "build";
|
|
1039
|
+
};
|
|
1040
|
+
type LintInlineConfig<TUserConfig extends UserConfig = UserConfig> = InlineConfig<TUserConfig> & {
|
|
1028
1041
|
/**
|
|
1029
|
-
* A
|
|
1042
|
+
* A string identifier for the Powerlines command being executed
|
|
1030
1043
|
*/
|
|
1031
|
-
|
|
1044
|
+
command: "lint";
|
|
1045
|
+
};
|
|
1046
|
+
type DocsInlineConfig<TUserConfig extends UserConfig = UserConfig> = InlineConfig<TUserConfig> & {
|
|
1032
1047
|
/**
|
|
1033
|
-
*
|
|
1048
|
+
* A string identifier for the Powerlines command being executed
|
|
1034
1049
|
*/
|
|
1035
|
-
|
|
1050
|
+
command: "docs";
|
|
1051
|
+
};
|
|
1052
|
+
type ReleaseInlineConfig<TUserConfig extends UserConfig = UserConfig> = InlineConfig<TUserConfig> & {
|
|
1036
1053
|
/**
|
|
1037
|
-
* A
|
|
1054
|
+
* A string identifier for the Powerlines command being executed
|
|
1038
1055
|
*/
|
|
1039
|
-
|
|
1056
|
+
command: "release";
|
|
1057
|
+
};
|
|
1058
|
+
|
|
1059
|
+
interface ResolvedEntryTypeDefinition extends TypeDefinition {
|
|
1040
1060
|
/**
|
|
1041
|
-
*
|
|
1061
|
+
* The user provided entry point in the source code
|
|
1042
1062
|
*/
|
|
1043
|
-
|
|
1063
|
+
input: TypeDefinition;
|
|
1064
|
+
/**
|
|
1065
|
+
* An optional name to use in the package export during the build process
|
|
1066
|
+
*/
|
|
1067
|
+
output?: string;
|
|
1044
1068
|
}
|
|
1045
|
-
|
|
1069
|
+
type EnvironmentResolvedConfig = Omit<EnvironmentConfig, "consumer" | "mode" | "ssr" | "preview" | "mainFields" | "extensions"> & Required<Pick<EnvironmentConfig, "consumer" | "mode" | "ssr" | "mainFields" | "extensions">> & {
|
|
1046
1070
|
/**
|
|
1047
|
-
* The
|
|
1071
|
+
* The name of the environment
|
|
1048
1072
|
*/
|
|
1049
|
-
|
|
1073
|
+
name: string;
|
|
1050
1074
|
/**
|
|
1051
|
-
*
|
|
1052
|
-
*
|
|
1053
|
-
* @remarks
|
|
1054
|
-
* This is provided for compatibility with other logging libraries that expect a `logger` property.
|
|
1075
|
+
* Configuration options for the preview server
|
|
1055
1076
|
*/
|
|
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;
|
|
1077
|
+
preview?: ResolvedPreviewOptions;
|
|
1079
1078
|
};
|
|
1079
|
+
type ResolvedAssetGlob = AssetGlob & Required<Pick<AssetGlob, "input">>;
|
|
1080
|
+
type OutputResolvedConfig = Required<Omit<OutputConfig, "assets"> & {
|
|
1081
|
+
assets: ResolvedAssetGlob[];
|
|
1082
|
+
}>;
|
|
1080
1083
|
/**
|
|
1081
|
-
*
|
|
1084
|
+
* The resolved options for the Powerlines project configuration.
|
|
1082
1085
|
*/
|
|
1083
|
-
type
|
|
1084
|
-
type ProjectType = "application" | "library";
|
|
1085
|
-
interface OutputConfig {
|
|
1086
|
+
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">> & {
|
|
1086
1087
|
/**
|
|
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\}"
|
|
1088
|
+
* The configuration options that were provided inline to the Powerlines CLI.
|
|
1095
1089
|
*/
|
|
1096
|
-
|
|
1090
|
+
inlineConfig: InlineConfig<TUserConfig>;
|
|
1097
1091
|
/**
|
|
1098
|
-
* The
|
|
1099
|
-
*
|
|
1100
|
-
* @defaultValue "virtual"
|
|
1092
|
+
* The original configuration options that were provided by the user to the Powerlines process.
|
|
1101
1093
|
*/
|
|
1102
|
-
|
|
1094
|
+
userConfig: TUserConfig;
|
|
1103
1095
|
/**
|
|
1104
|
-
*
|
|
1105
|
-
*
|
|
1106
|
-
* @defaultValue "\{projectRoot\}/powerlines.d.ts"
|
|
1096
|
+
* A string identifier for the Powerlines command being executed.
|
|
1107
1097
|
*/
|
|
1108
|
-
|
|
1098
|
+
command: NonUndefined<InlineConfig<TUserConfig>["command"]>;
|
|
1109
1099
|
/**
|
|
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"`.
|
|
1100
|
+
* The root directory of the project's source code
|
|
1114
1101
|
*
|
|
1115
|
-
* @defaultValue "
|
|
1102
|
+
* @defaultValue "\{projectRoot\}/src"
|
|
1116
1103
|
*/
|
|
1117
|
-
|
|
1104
|
+
sourceRoot: NonUndefined<TUserConfig["sourceRoot"]>;
|
|
1118
1105
|
/**
|
|
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"
|
|
1106
|
+
* The root directory of the project.
|
|
1125
1107
|
*/
|
|
1126
|
-
|
|
1108
|
+
projectRoot: NonUndefined<TUserConfig["root"]>;
|
|
1127
1109
|
/**
|
|
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"
|
|
1110
|
+
* The type of project being built.
|
|
1134
1111
|
*/
|
|
1135
|
-
|
|
1112
|
+
projectType: NonUndefined<TUserConfig["type"]>;
|
|
1136
1113
|
/**
|
|
1137
|
-
*
|
|
1114
|
+
* The output configuration options to use for the build process
|
|
1115
|
+
*/
|
|
1116
|
+
output: OutputResolvedConfig;
|
|
1117
|
+
/**
|
|
1118
|
+
* The log level to use for the Powerlines processes.
|
|
1138
1119
|
*
|
|
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.
|
|
1120
|
+
* @defaultValue "info"
|
|
1141
1121
|
*/
|
|
1142
|
-
|
|
1122
|
+
logLevel: LogLevelLabel | null;
|
|
1123
|
+
};
|
|
1124
|
+
type ViteResolvedConfig = ResolvedConfig<ViteUserConfig>;
|
|
1125
|
+
type WebpackResolvedConfig = ResolvedConfig<WebpackUserConfig>;
|
|
1126
|
+
type RspackResolvedConfig = ResolvedConfig<RspackUserConfig>;
|
|
1127
|
+
type ESBuildResolvedConfig = ResolvedConfig<ESBuildUserConfig>;
|
|
1128
|
+
type RollupResolvedConfig = ResolvedConfig<RollupUserConfig>;
|
|
1129
|
+
type RolldownResolvedConfig = ResolvedConfig<RolldownUserConfig>;
|
|
1130
|
+
type TsupResolvedConfig = ResolvedConfig<TsupUserConfig>;
|
|
1131
|
+
type UnbuildResolvedConfig = ResolvedConfig<UnbuildUserConfig>;
|
|
1132
|
+
type FarmResolvedConfig = ResolvedConfig<FarmUserConfig>;
|
|
1133
|
+
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;
|
|
1134
|
+
|
|
1135
|
+
type BaseHooks<TContext extends PluginContext = PluginContext> = BasePluginHookFunctions<TContext>;
|
|
1136
|
+
type BaseHookKeys<TContext extends PluginContext = PluginContext> = keyof BaseHooks<TContext>;
|
|
1137
|
+
type ExternalHooks<TContext extends PluginContext = PluginContext> = ExternalPluginHookFunctions<TContext>;
|
|
1138
|
+
type ExternalHookKeys<TContext extends PluginContext = PluginContext> = keyof ExternalHooks<TContext>;
|
|
1139
|
+
type Hooks<TContext extends PluginContext = PluginContext> = PluginHookFunctions<TContext>;
|
|
1140
|
+
type HookKeys<TContext extends PluginContext = PluginContext> = keyof Hooks<TContext>;
|
|
1141
|
+
interface BaseHooksListItem<TContext extends PluginContext = PluginContext, TKey extends BaseHookKeys<TContext> = BaseHookKeys<TContext>> extends PluginHookObject<BaseHooks<TContext>[TKey]> {
|
|
1142
|
+
plugin: Plugin<TContext>;
|
|
1143
1143
|
}
|
|
1144
|
-
interface
|
|
1144
|
+
interface BaseHooksList<TContext extends PluginContext = PluginContext, TKey extends BaseHookKeys<TContext> = BaseHookKeys<TContext>> {
|
|
1145
|
+
preOrdered?: BaseHooksListItem<TContext, TKey>[];
|
|
1146
|
+
preEnforced?: BaseHooksListItem<TContext, TKey>[];
|
|
1147
|
+
normal?: BaseHooksListItem<TContext, TKey>[];
|
|
1148
|
+
postEnforced?: BaseHooksListItem<TContext, TKey>[];
|
|
1149
|
+
postOrdered?: BaseHooksListItem<TContext, TKey>[];
|
|
1150
|
+
}
|
|
1151
|
+
interface ExternalHooksListItem<TContext extends PluginContext = PluginContext, TKey extends ExternalHookKeys<TContext> = ExternalHookKeys<TContext>> {
|
|
1152
|
+
plugin: Plugin<TContext>;
|
|
1153
|
+
handler: ExternalHooks<TContext>[TKey];
|
|
1154
|
+
}
|
|
1155
|
+
type HooksList<TContext extends PluginContext = PluginContext> = {
|
|
1156
|
+
[TKey in BaseHookKeys<TContext>]?: BaseHooksList<TContext, TKey>;
|
|
1157
|
+
} & {
|
|
1158
|
+
[TKey in ExternalHookKeys<TContext>]?: ExternalHooksListItem<TContext, TKey>[];
|
|
1159
|
+
};
|
|
1160
|
+
type InferHookHandler<TContext extends PluginContext, TKey extends HookKeys<TContext>> = Hooks<TContext>[TKey];
|
|
1161
|
+
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>>;
|
|
1162
|
+
type InferHookParameters<TContext extends PluginContext, TKey extends HookKeys<TContext>> = Parameters<InferHookHandler<TContext, TKey>>;
|
|
1163
|
+
|
|
1164
|
+
type WorkerProcess<TExposedMethods extends ReadonlyArray<string>> = {
|
|
1165
|
+
[K in TExposedMethods[number]]: (data: any) => Promise<any>;
|
|
1166
|
+
} & {
|
|
1167
|
+
close: () => void;
|
|
1168
|
+
end: () => ReturnType<Worker["end"]>;
|
|
1169
|
+
};
|
|
1170
|
+
interface MetaInfo {
|
|
1145
1171
|
/**
|
|
1146
|
-
* The
|
|
1172
|
+
* The checksum generated from the resolved options
|
|
1147
1173
|
*/
|
|
1148
|
-
|
|
1174
|
+
checksum: string;
|
|
1149
1175
|
/**
|
|
1150
|
-
* The
|
|
1151
|
-
*
|
|
1152
|
-
* @remarks
|
|
1153
|
-
* This option is used in documentation generation and other places where a human-readable title is needed.
|
|
1176
|
+
* The build id
|
|
1154
1177
|
*/
|
|
1155
|
-
|
|
1178
|
+
buildId: string;
|
|
1156
1179
|
/**
|
|
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.
|
|
1180
|
+
* The release id
|
|
1161
1181
|
*/
|
|
1162
|
-
|
|
1182
|
+
releaseId: string;
|
|
1163
1183
|
/**
|
|
1164
|
-
* The
|
|
1165
|
-
*
|
|
1166
|
-
* @defaultValue "info"
|
|
1184
|
+
* The build timestamp
|
|
1167
1185
|
*/
|
|
1168
|
-
|
|
1186
|
+
timestamp: number;
|
|
1169
1187
|
/**
|
|
1170
|
-
* A
|
|
1188
|
+
* A hash that represents the path to the project root directory
|
|
1171
1189
|
*/
|
|
1172
|
-
|
|
1190
|
+
projectRootHash: string;
|
|
1173
1191
|
/**
|
|
1174
|
-
*
|
|
1192
|
+
* A hash that represents the path to the project root directory
|
|
1193
|
+
*/
|
|
1194
|
+
configHash: string;
|
|
1195
|
+
/**
|
|
1196
|
+
* A mapping of runtime ids to their corresponding file paths
|
|
1197
|
+
*/
|
|
1198
|
+
builtinIdMap: Record<string, string>;
|
|
1199
|
+
/**
|
|
1200
|
+
* A mapping of virtual file paths to their corresponding file contents
|
|
1201
|
+
*/
|
|
1202
|
+
virtualFiles: Record<string, string | null>;
|
|
1203
|
+
}
|
|
1204
|
+
interface Resolver extends Jiti {
|
|
1205
|
+
plugin: Jiti;
|
|
1206
|
+
}
|
|
1207
|
+
interface SelectHooksOptions {
|
|
1208
|
+
order?: "pre" | "post" | "normal";
|
|
1209
|
+
}
|
|
1210
|
+
interface InitContextOptions {
|
|
1211
|
+
/**
|
|
1212
|
+
* If false, the plugin will be loaded after all other plugins.
|
|
1175
1213
|
*
|
|
1176
|
-
* @defaultValue
|
|
1214
|
+
* @defaultValue true
|
|
1177
1215
|
*/
|
|
1178
|
-
|
|
1216
|
+
isHighPriority: boolean;
|
|
1217
|
+
}
|
|
1218
|
+
interface Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
|
|
1179
1219
|
/**
|
|
1180
|
-
* The
|
|
1220
|
+
* The Storm workspace configuration
|
|
1181
1221
|
*/
|
|
1182
|
-
|
|
1222
|
+
workspaceConfig: WorkspaceConfig;
|
|
1183
1223
|
/**
|
|
1184
|
-
*
|
|
1224
|
+
* An object containing the options provided to Powerlines
|
|
1185
1225
|
*/
|
|
1186
|
-
|
|
1226
|
+
config: TResolvedConfig;
|
|
1187
1227
|
/**
|
|
1188
|
-
*
|
|
1228
|
+
* A logging function for the Powerlines engine
|
|
1189
1229
|
*/
|
|
1190
|
-
|
|
1230
|
+
log: LogFn;
|
|
1191
1231
|
/**
|
|
1192
|
-
*
|
|
1232
|
+
* The metadata information
|
|
1193
1233
|
*/
|
|
1194
|
-
|
|
1234
|
+
meta: MetaInfo;
|
|
1195
1235
|
/**
|
|
1196
|
-
*
|
|
1236
|
+
* The metadata information currently written to disk
|
|
1197
1237
|
*/
|
|
1198
|
-
|
|
1238
|
+
persistedMeta?: MetaInfo;
|
|
1199
1239
|
/**
|
|
1200
|
-
*
|
|
1201
|
-
*
|
|
1202
|
-
* @remarks
|
|
1203
|
-
* This configuration will be used by the documentation generation plugins during the `docs` command.
|
|
1240
|
+
* The Powerlines artifacts directory
|
|
1204
1241
|
*/
|
|
1205
|
-
|
|
1242
|
+
artifactsPath: string;
|
|
1206
1243
|
/**
|
|
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"
|
|
1244
|
+
* The path to the Powerlines builtin runtime modules directory
|
|
1213
1245
|
*/
|
|
1214
|
-
|
|
1246
|
+
builtinsPath: string;
|
|
1215
1247
|
/**
|
|
1216
|
-
* The
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
*
|
|
1221
|
-
|
|
1248
|
+
* The path to the Powerlines entry modules directory
|
|
1249
|
+
*/
|
|
1250
|
+
entryPath: string;
|
|
1251
|
+
/**
|
|
1252
|
+
* The path to the Powerlines TypeScript declaration files directory
|
|
1253
|
+
*/
|
|
1254
|
+
dtsPath: string;
|
|
1255
|
+
/**
|
|
1256
|
+
* The path to a directory where the reflection data buffers (used by the build processes) are stored
|
|
1257
|
+
*/
|
|
1258
|
+
dataPath: string;
|
|
1259
|
+
/**
|
|
1260
|
+
* The path to a directory where the project cache (used by the build processes) is stored
|
|
1261
|
+
*/
|
|
1262
|
+
cachePath: string;
|
|
1263
|
+
/**
|
|
1264
|
+
* The Powerlines environment paths
|
|
1265
|
+
*/
|
|
1266
|
+
envPaths: EnvPaths;
|
|
1267
|
+
/**
|
|
1268
|
+
* The file system path to the Powerlines package installation
|
|
1269
|
+
*/
|
|
1270
|
+
powerlinesPath: string;
|
|
1271
|
+
/**
|
|
1272
|
+
* The relative path to the Powerlines workspace root directory
|
|
1273
|
+
*/
|
|
1274
|
+
relativeToWorkspaceRoot: string;
|
|
1275
|
+
/**
|
|
1276
|
+
* The project's `package.json` file content
|
|
1277
|
+
*/
|
|
1278
|
+
packageJson: PackageJson & Record<string, any>;
|
|
1279
|
+
/**
|
|
1280
|
+
* The project's `project.json` file content
|
|
1222
1281
|
*/
|
|
1223
|
-
|
|
1224
|
-
}
|
|
1225
|
-
interface EnvironmentConfig extends BaseConfig {
|
|
1282
|
+
projectJson?: Record<string, any>;
|
|
1226
1283
|
/**
|
|
1227
|
-
*
|
|
1228
|
-
*
|
|
1229
|
-
* @defaultValue `['browser', 'module', 'jsnext:main', 'jsnext']`
|
|
1284
|
+
* The dependency installations required by the project
|
|
1230
1285
|
*/
|
|
1231
|
-
|
|
1286
|
+
dependencies: Record<string, string | Range>;
|
|
1232
1287
|
/**
|
|
1233
|
-
*
|
|
1288
|
+
* The development dependency installations required by the project
|
|
1234
1289
|
*/
|
|
1235
|
-
|
|
1290
|
+
devDependencies: Record<string, string | Range>;
|
|
1236
1291
|
/**
|
|
1237
|
-
*
|
|
1292
|
+
* The parsed TypeScript configuration from the `tsconfig.json` file
|
|
1238
1293
|
*/
|
|
1239
|
-
|
|
1294
|
+
tsconfig: ParsedTypeScriptConfig;
|
|
1240
1295
|
/**
|
|
1241
|
-
*
|
|
1242
|
-
*
|
|
1243
|
-
* @defaultValue `['.mjs', '.js', '.mts', '.ts', '.jsx', '.tsx', '.json']`
|
|
1296
|
+
* The entry points of the source code
|
|
1244
1297
|
*/
|
|
1245
|
-
|
|
1298
|
+
entry: ResolvedEntryTypeDefinition[];
|
|
1246
1299
|
/**
|
|
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.
|
|
1300
|
+
* The virtual file system manager used during the build process to reference generated runtime files
|
|
1251
1301
|
*/
|
|
1252
|
-
|
|
1302
|
+
fs: VirtualFileSystemInterface;
|
|
1253
1303
|
/**
|
|
1254
|
-
*
|
|
1304
|
+
* The Jiti module resolver
|
|
1255
1305
|
*/
|
|
1256
|
-
|
|
1306
|
+
resolver: Resolver;
|
|
1257
1307
|
/**
|
|
1258
|
-
*
|
|
1308
|
+
* The builtin module id that exist in the Powerlines virtual file system
|
|
1259
1309
|
*/
|
|
1260
|
-
|
|
1310
|
+
builtins: string[];
|
|
1261
1311
|
/**
|
|
1262
|
-
*
|
|
1312
|
+
* The Powerlines builtin virtual files
|
|
1263
1313
|
*/
|
|
1264
|
-
|
|
1314
|
+
getBuiltins: () => Promise<VirtualFile[]>;
|
|
1265
1315
|
/**
|
|
1266
|
-
*
|
|
1316
|
+
* Resolves a builtin virtual file and writes it to the VFS if it does not already exist
|
|
1267
1317
|
*
|
|
1268
|
-
* @
|
|
1318
|
+
* @param code - The source code of the builtin file
|
|
1319
|
+
* @param id - The unique identifier of the builtin file
|
|
1320
|
+
* @param path - An optional path to write the builtin file to
|
|
1321
|
+
* @param options - Options for writing the file
|
|
1269
1322
|
*/
|
|
1270
|
-
|
|
1271
|
-
}
|
|
1272
|
-
interface CommonUserConfig extends BaseConfig {
|
|
1323
|
+
writeBuiltin: (code: string, id: string, path?: string, options?: PowerlinesWriteFileOptions) => Promise<void>;
|
|
1273
1324
|
/**
|
|
1274
|
-
*
|
|
1325
|
+
* Resolves a entry virtual file and writes it to the VFS if it does not already exist
|
|
1275
1326
|
*
|
|
1276
|
-
* @
|
|
1327
|
+
* @param code - The source code of the entry file
|
|
1328
|
+
* @param path - An optional path to write the entry file to
|
|
1329
|
+
* @param options - Options for writing the file
|
|
1277
1330
|
*/
|
|
1278
|
-
|
|
1331
|
+
writeEntry: (code: string, path: string, options?: PowerlinesWriteFileOptions) => Promise<void>;
|
|
1279
1332
|
/**
|
|
1280
|
-
*
|
|
1333
|
+
* Parses the source code and returns a {@link ParseResult} object.
|
|
1281
1334
|
*/
|
|
1282
|
-
|
|
1335
|
+
parse: (code: string, id: string, options?: ParserOptions | null) => Promise<ParseResult>;
|
|
1283
1336
|
/**
|
|
1284
|
-
*
|
|
1285
|
-
*
|
|
1286
|
-
* @defaultValue "\{root\}/src"
|
|
1337
|
+
* A function to update the context fields using a new user configuration options
|
|
1287
1338
|
*/
|
|
1288
|
-
|
|
1339
|
+
withUserConfig: (userConfig: UserConfig, options?: InitContextOptions) => Promise<void>;
|
|
1289
1340
|
/**
|
|
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.
|
|
1341
|
+
* A function to update the context fields using inline configuration options
|
|
1294
1342
|
*/
|
|
1295
|
-
|
|
1343
|
+
withInlineConfig: (inlineConfig: InlineConfig, options?: InitContextOptions) => Promise<void>;
|
|
1296
1344
|
/**
|
|
1297
|
-
*
|
|
1345
|
+
* Create a new logger instance
|
|
1298
1346
|
*
|
|
1299
|
-
* @
|
|
1300
|
-
*
|
|
1347
|
+
* @param name - The name to use for the logger instance
|
|
1348
|
+
* @returns A logger function
|
|
1349
|
+
*/
|
|
1350
|
+
createLog: (name: string | null) => LogFn;
|
|
1351
|
+
/**
|
|
1352
|
+
* Extend the current logger instance with a new name
|
|
1301
1353
|
*
|
|
1302
|
-
* @
|
|
1354
|
+
* @param name - The name to use for the extended logger instance
|
|
1355
|
+
* @returns A logger function
|
|
1303
1356
|
*/
|
|
1304
|
-
|
|
1357
|
+
extendLog: (name: string) => LogFn;
|
|
1358
|
+
}
|
|
1359
|
+
interface APIContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> extends Context<TResolvedConfig> {
|
|
1305
1360
|
/**
|
|
1306
|
-
*
|
|
1361
|
+
* The expected plugins options for the Powerlines project.
|
|
1307
1362
|
*
|
|
1308
|
-
* @
|
|
1363
|
+
* @remarks
|
|
1364
|
+
* 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
1365
|
*/
|
|
1310
|
-
|
|
1366
|
+
plugins: Plugin<PluginContext<TResolvedConfig>>[];
|
|
1311
1367
|
/**
|
|
1312
|
-
* A
|
|
1368
|
+
* A function to add a plugin to the context and update the configuration options
|
|
1313
1369
|
*/
|
|
1314
|
-
|
|
1370
|
+
addPlugin: (plugin: Plugin<PluginContext<TResolvedConfig>>) => Promise<void>;
|
|
1315
1371
|
/**
|
|
1316
|
-
*
|
|
1372
|
+
* A table for storing the current context for each configured environment
|
|
1317
1373
|
*/
|
|
1318
|
-
environments
|
|
1374
|
+
environments: Record<string, EnvironmentContext<TResolvedConfig>>;
|
|
1319
1375
|
/**
|
|
1320
|
-
*
|
|
1376
|
+
* Retrieves the context for a specific environment by name
|
|
1321
1377
|
*
|
|
1322
|
-
* @
|
|
1378
|
+
* @throws Will throw an error if the environment does not exist
|
|
1379
|
+
*
|
|
1380
|
+
* @param name - The name of the environment to retrieve. If not provided, the default environment is returned.
|
|
1381
|
+
* @returns A promise that resolves to the environment context.
|
|
1382
|
+
*
|
|
1383
|
+
* @example
|
|
1384
|
+
* ```ts
|
|
1385
|
+
* const devEnv = await apiContext.getEnvironment("development");
|
|
1386
|
+
* const defaultEnv = await apiContext.getEnvironment();
|
|
1387
|
+
* ```
|
|
1323
1388
|
*/
|
|
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> & {
|
|
1389
|
+
getEnvironment: (name?: string) => Promise<EnvironmentContext<TResolvedConfig>>;
|
|
1349
1390
|
/**
|
|
1350
|
-
*
|
|
1391
|
+
* Safely retrieves the context for a specific environment by name
|
|
1392
|
+
*
|
|
1393
|
+
* @param name - The name of the environment to retrieve. If not provided, the default environment is returned.
|
|
1394
|
+
* @returns A promise that resolves to the environment context, or undefined if the environment does not exist.
|
|
1395
|
+
*
|
|
1396
|
+
* @example
|
|
1397
|
+
* ```ts
|
|
1398
|
+
* const devEnv = await apiContext.getEnvironmentSafe("development");
|
|
1399
|
+
* const defaultEnv = await apiContext.getEnvironmentSafe();
|
|
1400
|
+
* ```
|
|
1351
1401
|
*
|
|
1352
1402
|
* @remarks
|
|
1353
|
-
* This is
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
*
|
|
1403
|
+
* This method is similar to `getEnvironment`, but it returns `undefined` instead of throwing an error if the specified environment does not exist.
|
|
1404
|
+
* This can be useful in scenarios where the existence of an environment is optional or uncertain.
|
|
1405
|
+
*
|
|
1406
|
+
* ```ts
|
|
1407
|
+
* const testEnv = await apiContext.getEnvironmentSafe("test");
|
|
1408
|
+
* if (testEnv) {
|
|
1409
|
+
* // Environment exists, safe to use it
|
|
1410
|
+
* } else {
|
|
1411
|
+
* // Environment does not exist, handle accordingly
|
|
1412
|
+
* }
|
|
1413
|
+
* ```
|
|
1414
|
+
*
|
|
1415
|
+
* Using this method helps avoid unhandled exceptions in cases where an environment might not be defined.
|
|
1364
1416
|
*/
|
|
1365
|
-
|
|
1366
|
-
};
|
|
1367
|
-
type NewInlineConfig<TUserConfig extends UserConfig = UserConfig> = InlineConfig<TUserConfig> & Required<Pick<InlineConfig<TUserConfig>, "root">> & {
|
|
1417
|
+
getEnvironmentSafe: (name?: string) => Promise<EnvironmentContext<TResolvedConfig> | undefined>;
|
|
1368
1418
|
/**
|
|
1369
|
-
* A
|
|
1419
|
+
* A function to copy the context and update the fields for a specific environment
|
|
1420
|
+
*
|
|
1421
|
+
* @param environment - The environment configuration to use.
|
|
1422
|
+
* @returns A new context instance with the updated environment.
|
|
1370
1423
|
*/
|
|
1371
|
-
|
|
1424
|
+
in: (environment: EnvironmentResolvedConfig) => Promise<EnvironmentContext<TResolvedConfig>>;
|
|
1425
|
+
}
|
|
1426
|
+
interface EnvironmentContextPlugin<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
|
|
1427
|
+
plugin: Plugin<PluginContext<TResolvedConfig>>;
|
|
1428
|
+
context: PluginContext<TResolvedConfig>;
|
|
1429
|
+
}
|
|
1430
|
+
interface EnvironmentContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> extends Context<TResolvedConfig> {
|
|
1372
1431
|
/**
|
|
1373
|
-
* The
|
|
1432
|
+
* The expected plugins options for the Powerlines project.
|
|
1433
|
+
*
|
|
1434
|
+
* @remarks
|
|
1435
|
+
* 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
1436
|
*/
|
|
1375
|
-
|
|
1376
|
-
};
|
|
1377
|
-
type CleanInlineConfig<TUserConfig extends UserConfig = UserConfig> = InlineConfig<TUserConfig> & {
|
|
1437
|
+
plugins: EnvironmentContextPlugin<TResolvedConfig>[];
|
|
1378
1438
|
/**
|
|
1379
|
-
* A
|
|
1439
|
+
* A function to add a plugin to the context and update the configuration options
|
|
1380
1440
|
*/
|
|
1381
|
-
|
|
1382
|
-
};
|
|
1383
|
-
type PrepareInlineConfig<TUserConfig extends UserConfig = UserConfig> = InlineConfig<TUserConfig> & {
|
|
1441
|
+
addPlugin: (plugin: Plugin<PluginContext<TResolvedConfig>>) => Promise<void>;
|
|
1384
1442
|
/**
|
|
1385
|
-
*
|
|
1443
|
+
* The environment specific resolved configuration
|
|
1386
1444
|
*/
|
|
1387
|
-
|
|
1388
|
-
};
|
|
1389
|
-
type BuildInlineConfig<TUserConfig extends UserConfig = UserConfig> = InlineConfig<TUserConfig> & {
|
|
1445
|
+
environment: EnvironmentResolvedConfig;
|
|
1390
1446
|
/**
|
|
1391
|
-
* A
|
|
1447
|
+
* A table holding references to hook functions registered by plugins
|
|
1392
1448
|
*/
|
|
1393
|
-
|
|
1394
|
-
};
|
|
1395
|
-
type LintInlineConfig<TUserConfig extends UserConfig = UserConfig> = InlineConfig<TUserConfig> & {
|
|
1449
|
+
hooks: HooksList<PluginContext<TResolvedConfig>>;
|
|
1396
1450
|
/**
|
|
1397
|
-
*
|
|
1451
|
+
* Retrieves the hook handlers for a specific hook name
|
|
1398
1452
|
*/
|
|
1399
|
-
|
|
1400
|
-
}
|
|
1401
|
-
|
|
1453
|
+
selectHooks: <TKey extends HookKeys<PluginContext<TResolvedConfig>>>(hook: TKey, options?: SelectHooksOptions) => Hooks[TKey][];
|
|
1454
|
+
}
|
|
1455
|
+
interface PluginContext<out TResolvedConfig extends ResolvedConfig = ResolvedConfig> extends Context<TResolvedConfig>, UnpluginContext {
|
|
1402
1456
|
/**
|
|
1403
|
-
*
|
|
1457
|
+
* The environment specific resolved configuration
|
|
1404
1458
|
*/
|
|
1405
|
-
|
|
1406
|
-
};
|
|
1407
|
-
type ReleaseInlineConfig<TUserConfig extends UserConfig = UserConfig> = InlineConfig<TUserConfig> & {
|
|
1459
|
+
environment: EnvironmentResolvedConfig;
|
|
1408
1460
|
/**
|
|
1409
|
-
*
|
|
1461
|
+
* An alternative property name for the {@link log} property
|
|
1462
|
+
*
|
|
1463
|
+
* @remarks
|
|
1464
|
+
* This is provided for compatibility with other logging libraries that expect a `logger` property.
|
|
1410
1465
|
*/
|
|
1411
|
-
|
|
1412
|
-
}
|
|
1466
|
+
logger: LogFn;
|
|
1467
|
+
}
|
|
1468
|
+
type BuildPluginContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> = PluginContext<TResolvedConfig> & Omit<UnpluginBuildContext, "parse">;
|
|
1413
1469
|
|
|
1414
1470
|
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 };
|