powerlines 0.23.2 → 0.23.4
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/api--9pVSIbm.d.cts +168 -0
- package/dist/api-DxPACGY4.d.ts +168 -0
- package/dist/api.cjs +3 -3
- package/dist/api.d.cts +16 -7
- package/dist/api.d.ts +16 -7
- package/dist/api.js +2 -2
- package/dist/astro.cjs +8 -8
- package/dist/astro.d.cts +3 -5
- package/dist/astro.d.ts +3 -5
- package/dist/astro.js +5 -5
- package/dist/{chunk-ZFO3FUM4.cjs → chunk-2FLICTDF.cjs} +2 -2
- package/dist/{chunk-JAJ4CI2F.cjs → chunk-3OQXZ5MM.cjs} +2 -2
- package/dist/{chunk-KFRKOIP3.js → chunk-5B6P2VUG.js} +1 -1
- package/dist/{chunk-GNNF5SG6.cjs → chunk-6ACGI52O.cjs} +2 -2
- package/dist/{chunk-JZAQW55G.cjs → chunk-AF5VNWZD.cjs} +2 -2
- package/dist/{chunk-J7MZRPLN.cjs → chunk-AIC2EHPW.cjs} +5 -4
- package/dist/{chunk-3WDMXRK6.cjs → chunk-AYKZK666.cjs} +1 -1
- package/dist/chunk-CHNKTBUA.cjs +32 -0
- package/dist/{chunk-M4QJ2474.cjs → chunk-CTSSNO5L.cjs} +4 -4
- package/dist/{chunk-5A7FM72H.cjs → chunk-GP6XGAJ4.cjs} +2 -2
- package/dist/{chunk-DUYZ3TCT.js → chunk-HLQGKQZY.js} +1 -1
- package/dist/{chunk-LKN52AAX.js → chunk-HNJC47JM.js} +1 -1
- package/dist/{chunk-IGWSCIES.js → chunk-ISLX4Z3L.js} +3 -2
- package/dist/{chunk-J5LKLH5Z.js → chunk-KFSVTJMR.js} +1 -1
- package/dist/{chunk-RWVNX2CP.js → chunk-MI3U2GAT.js} +1 -1
- package/dist/{chunk-4ODWTALP.js → chunk-N3F54RFW.js} +2 -2
- package/dist/{chunk-Q7HBETZW.js → chunk-O2WB6QZ6.js} +1 -1
- package/dist/{chunk-DWV5QAGZ.cjs → chunk-OEKSQ22R.cjs} +2997 -2710
- package/dist/{chunk-WSLPUUGZ.js → chunk-PTZB4LWS.js} +1 -1
- package/dist/{chunk-CPRXGMH2.js → chunk-QSNFMINQ.js} +1 -1
- package/dist/{chunk-YQ76DZYD.cjs → chunk-QUZ4T5AX.cjs} +2 -2
- package/dist/chunk-UTAJPBVT.js +29 -0
- package/dist/{chunk-WG55ZHJL.cjs → chunk-UW3MXOWV.cjs} +2 -2
- package/dist/{chunk-F6BDL4HD.js → chunk-VDBKZJV6.js} +1 -1
- package/dist/{chunk-J3LN5HOC.cjs → chunk-VFLCP3SA.cjs} +2 -2
- package/dist/{chunk-FM4ABZQ2.js → chunk-VT7NVLLU.js} +1 -1
- package/dist/{chunk-WDBPA4RQ.cjs → chunk-VXAKPZ3A.cjs} +2 -2
- package/dist/{chunk-WXU3KLBP.cjs → chunk-XOI5CY62.cjs} +2 -2
- package/dist/{chunk-NH7U3PTV.js → chunk-ZQ7PDXYO.js} +1 -1
- package/dist/{chunk-TNYZH6EG.js → chunk-ZYCPZLIG.js} +2982 -2700
- package/dist/config.d.cts +3 -5
- package/dist/config.d.ts +3 -5
- package/dist/esbuild.cjs +7 -7
- package/dist/esbuild.d.cts +3 -5
- package/dist/esbuild.d.ts +3 -5
- package/dist/esbuild.js +4 -4
- package/dist/farm.cjs +4 -4
- package/dist/farm.d.cts +3 -5
- package/dist/farm.d.ts +3 -5
- package/dist/farm.js +3 -3
- package/dist/index.cjs +54 -33
- package/dist/index.d.cts +191 -39
- package/dist/index.d.ts +191 -39
- package/dist/index.js +18 -17
- package/dist/lib/api-B6hfFxVS.d.ts +167 -0
- package/dist/lib/api-CD2QlMig.d.cts +167 -0
- package/dist/lib/build/esbuild.d.cts +2 -4
- package/dist/lib/build/esbuild.d.ts +2 -4
- package/dist/lib/build/index.d.cts +4 -5
- package/dist/lib/build/index.d.ts +4 -5
- package/dist/lib/build/rolldown.d.cts +2 -4
- package/dist/lib/build/rolldown.d.ts +2 -4
- package/dist/lib/build/rollup.d.cts +2 -4
- package/dist/lib/build/rollup.d.ts +2 -4
- package/dist/lib/build/rspack.d.cts +2 -4
- package/dist/lib/build/rspack.d.ts +2 -4
- package/dist/lib/build/tsup.d.cts +2 -4
- package/dist/lib/build/tsup.d.ts +2 -4
- package/dist/lib/build/unbuild.d.cts +4 -23
- package/dist/lib/build/unbuild.d.ts +4 -23
- package/dist/lib/build/vite.d.cts +2 -4
- package/dist/lib/build/vite.d.ts +2 -4
- package/dist/lib/build/webpack.d.cts +2 -4
- package/dist/lib/build/webpack.d.ts +2 -4
- package/dist/lib/chunk-32Q2PG5D.js +9 -0
- package/dist/lib/chunk-35FGUJFD.cjs +2 -0
- package/dist/lib/{chunk-LIN4KAV3.js → chunk-52VDUP5J.js} +5 -7
- package/dist/lib/chunk-B3EE3VHZ.cjs +127 -0
- package/dist/lib/{chunk-UWHGJ4JS.js → chunk-BLNW3ZQA.js} +483 -1776
- package/dist/lib/chunk-DX2VAXZB.cjs +11 -0
- package/dist/lib/{chunk-VGSV2BEL.cjs → chunk-EFYMNU53.cjs} +6 -12
- package/dist/lib/chunk-FBQIPNRV.cjs +146 -0
- package/dist/lib/chunk-FFT4PWRM.js +1 -0
- package/dist/lib/{chunk-L4NEN725.js → chunk-G7S5PIAC.js} +1 -1
- package/dist/lib/chunk-KFJCWNVG.js +120 -0
- package/dist/lib/chunk-M2U6XIQ2.js +144 -0
- package/dist/lib/chunk-MVIKYHBX.cjs +2 -0
- package/dist/lib/chunk-NYNHNTHT.js +1 -0
- package/dist/lib/{chunk-A5SB72VO.cjs → chunk-PYQADZVV.cjs} +493 -1779
- package/dist/lib/chunk-QP6WX3Q3.js +1190 -0
- package/dist/lib/chunk-S7LLEDQM.cjs +1218 -0
- package/dist/lib/chunk-UHGGYHSK.cjs +175 -0
- package/dist/lib/chunk-YNKFRPUY.js +168 -0
- package/dist/lib/{chunk-ULJVBW4L.cjs → chunk-ZBDVQVUK.cjs} +1 -1
- package/dist/lib/{config-BoGlIhnH.d.cts → config-DTSdCZsw.d.cts} +650 -633
- package/dist/lib/{config-CTej7RMP.d.ts → config-DeUaQYc_.d.ts} +650 -633
- package/dist/lib/config-file.d.cts +4 -5
- package/dist/lib/config-file.d.ts +4 -5
- package/dist/lib/contexts/api-context.cjs +18 -0
- package/dist/lib/contexts/api-context.d.cts +69 -0
- package/dist/lib/contexts/api-context.d.ts +69 -0
- package/dist/lib/contexts/api-context.js +9 -0
- package/dist/lib/contexts/context.cjs +15 -0
- package/dist/lib/contexts/context.d.cts +255 -0
- package/dist/lib/contexts/context.d.ts +255 -0
- package/dist/lib/contexts/context.js +6 -0
- package/dist/lib/contexts/environment-context.cjs +17 -0
- package/dist/lib/contexts/environment-context.d.cts +65 -0
- package/dist/lib/contexts/environment-context.d.ts +65 -0
- package/dist/lib/contexts/environment-context.js +8 -0
- package/dist/lib/contexts/index.cjs +31 -0
- package/dist/lib/contexts/index.d.cts +35 -0
- package/dist/lib/contexts/index.d.ts +35 -0
- package/dist/lib/contexts/index.js +10 -0
- package/dist/lib/contexts/plugin-context.cjs +11 -0
- package/dist/lib/contexts/plugin-context.d.cts +42 -0
- package/dist/lib/contexts/plugin-context.d.ts +42 -0
- package/dist/lib/contexts/plugin-context.js +2 -0
- package/dist/lib/entry.d.cts +2 -4
- package/dist/lib/entry.d.ts +2 -4
- package/dist/lib/index.cjs +96 -74
- package/dist/lib/index.d.cts +26 -23
- package/dist/lib/index.d.ts +26 -23
- package/dist/lib/index.js +18 -12
- package/dist/lib/internal-CpVMJCaU.d.ts +39 -0
- package/dist/lib/internal-ypnrUNZy.d.cts +39 -0
- package/dist/lib/logger.d.cts +4 -5
- package/dist/lib/logger.d.ts +4 -5
- package/dist/lib/typescript/compiler-host.cjs +1 -1
- package/dist/lib/typescript/compiler-host.d.cts +5 -5
- package/dist/lib/typescript/compiler-host.d.ts +5 -5
- package/dist/lib/typescript/compiler-host.js +1 -1
- package/dist/lib/typescript/import-transformer.d.cts +2 -4
- package/dist/lib/typescript/import-transformer.d.ts +2 -4
- package/dist/lib/typescript/index.cjs +29 -24
- package/dist/lib/typescript/index.d.cts +6 -6
- package/dist/lib/typescript/index.d.ts +6 -6
- package/dist/lib/typescript/index.js +3 -2
- package/dist/lib/typescript/isolated-decl.d.cts +2 -1
- package/dist/lib/typescript/isolated-decl.d.ts +2 -1
- package/dist/lib/typescript/program.d.cts +5 -5
- package/dist/lib/typescript/program.d.ts +5 -5
- package/dist/lib/typescript/ts-morph.cjs +11 -0
- package/dist/lib/{create-program.d.ts → typescript/ts-morph.d.cts} +3 -5
- package/dist/lib/{create-program.d.cts → typescript/ts-morph.d.ts} +3 -5
- package/dist/lib/typescript/ts-morph.js +2 -0
- package/dist/lib/unplugin/factory.cjs +8 -4
- package/dist/lib/unplugin/factory.d.cts +27 -10
- package/dist/lib/unplugin/factory.d.ts +27 -10
- package/dist/lib/unplugin/factory.js +7 -3
- package/dist/lib/unplugin/helpers.cjs +11 -0
- package/dist/lib/unplugin/helpers.d.cts +128 -0
- package/dist/lib/unplugin/helpers.d.ts +128 -0
- package/dist/lib/unplugin/helpers.js +2 -0
- package/dist/lib/unplugin/index.cjs +12 -7
- package/dist/lib/unplugin/index.d.cts +6 -8
- package/dist/lib/unplugin/index.d.ts +6 -8
- package/dist/lib/unplugin/index.js +9 -4
- package/dist/lib/unplugin/plugin.cjs +4 -3
- package/dist/lib/unplugin/plugin.d.cts +4 -5
- package/dist/lib/unplugin/plugin.d.ts +4 -5
- package/dist/lib/unplugin/plugin.js +3 -2
- package/dist/lib/unplugin/resolve-id.cjs +2 -2
- package/dist/lib/unplugin/resolve-id.d.cts +5 -5
- package/dist/lib/unplugin/resolve-id.d.ts +5 -5
- package/dist/lib/unplugin/resolve-id.js +1 -1
- package/dist/lib/utilities/bundle.d.cts +2 -4
- package/dist/lib/utilities/bundle.d.ts +2 -4
- package/dist/lib/utilities/cache.d.cts +2 -4
- package/dist/lib/utilities/cache.d.ts +2 -4
- package/dist/lib/utilities/file-header.d.cts +4 -5
- package/dist/lib/utilities/file-header.d.ts +4 -5
- package/dist/lib/utilities/index.cjs +18 -18
- package/dist/lib/utilities/index.d.cts +5 -7
- package/dist/lib/utilities/index.d.ts +5 -7
- package/dist/lib/utilities/index.js +4 -4
- package/dist/lib/utilities/meta.d.cts +4 -5
- package/dist/lib/utilities/meta.d.ts +4 -5
- package/dist/lib/utilities/resolve-path.d.cts +2 -4
- package/dist/lib/utilities/resolve-path.d.ts +2 -4
- package/dist/lib/utilities/resolve.d.cts +2 -4
- package/dist/lib/utilities/resolve.d.ts +2 -4
- package/dist/lib/utilities/source-file.d.cts +2 -4
- package/dist/lib/utilities/source-file.d.ts +2 -4
- package/dist/lib/utilities/source-map.d.cts +2 -4
- package/dist/lib/utilities/source-map.d.ts +2 -4
- package/dist/lib/utilities/worker.d.cts +4 -5
- package/dist/lib/utilities/worker.d.ts +4 -5
- package/dist/lib/utilities/write-file.d.cts +2 -4
- package/dist/lib/utilities/write-file.d.ts +2 -4
- 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/plugin-utils/{context-D1I2JQgs.d.cts → context-DRFZE3XI.d.cts} +535 -518
- package/dist/plugin-utils/{context-D1I2JQgs.d.ts → context-DRFZE3XI.d.ts} +535 -518
- package/dist/plugin-utils/context-helpers.d.cts +2 -4
- package/dist/plugin-utils/context-helpers.d.ts +2 -4
- package/dist/plugin-utils/enforce.d.cts +2 -4
- package/dist/plugin-utils/enforce.d.ts +2 -4
- package/dist/plugin-utils/extend.d.cts +2 -4
- package/dist/plugin-utils/extend.d.ts +2 -4
- package/dist/plugin-utils/get-config-path.d.cts +2 -4
- package/dist/plugin-utils/get-config-path.d.ts +2 -4
- package/dist/plugin-utils/helpers.d.cts +2 -4
- package/dist/plugin-utils/helpers.d.ts +2 -4
- package/dist/plugin-utils/index.d.cts +3 -5
- package/dist/plugin-utils/index.d.ts +3 -5
- package/dist/plugin-utils/merge.d.cts +4 -5
- package/dist/plugin-utils/merge.d.ts +4 -5
- package/dist/plugin-utils/paths.d.cts +2 -4
- package/dist/plugin-utils/paths.d.ts +2 -4
- package/dist/{resolved-DYLxPDut.d.cts → resolved-C00CJgsk.d.cts} +128 -9
- package/dist/{resolved-D1ySEdUv.d.ts → resolved-DKFZ11S7.d.ts} +128 -9
- package/dist/rolldown.cjs +7 -7
- package/dist/rolldown.d.cts +3 -5
- package/dist/rolldown.d.ts +3 -5
- package/dist/rolldown.js +4 -4
- package/dist/rollup.cjs +7 -7
- package/dist/rollup.d.cts +3 -5
- package/dist/rollup.d.ts +3 -5
- package/dist/rollup.js +4 -4
- package/dist/rspack.cjs +7 -7
- package/dist/rspack.d.cts +3 -5
- package/dist/rspack.d.ts +3 -5
- package/dist/rspack.js +4 -4
- package/dist/tsup.cjs +8 -8
- package/dist/tsup.js +5 -5
- package/dist/types/api.cjs +4 -0
- package/dist/types/api.d.cts +36 -0
- package/dist/types/api.d.ts +36 -0
- package/dist/types/api.js +1 -0
- package/dist/types/babel.d.cts +3 -5
- package/dist/types/babel.d.ts +3 -5
- package/dist/types/build.d.cts +26 -1
- package/dist/types/build.d.ts +26 -1
- package/dist/types/commands.d.cts +3 -5
- package/dist/types/commands.d.ts +3 -5
- package/dist/types/config.d.cts +3 -5
- package/dist/types/config.d.ts +3 -5
- package/dist/types/context.d.cts +3 -5
- package/dist/types/context.d.ts +3 -5
- package/dist/types/{vfs.cjs → fs.cjs} +3 -3
- package/dist/types/{vfs.d.cts → fs.d.cts} +54 -35
- package/dist/types/{vfs.d.ts → fs.d.ts} +54 -35
- package/dist/types/fs.js +2 -0
- package/dist/types/hooks.d.cts +3 -5
- package/dist/types/hooks.d.ts +3 -5
- package/dist/types/index.cjs +9 -8
- package/dist/types/index.d.cts +8 -9
- package/dist/types/index.d.ts +8 -9
- package/dist/types/index.js +3 -2
- package/dist/types/internal.d.cts +46 -9
- package/dist/types/internal.d.ts +46 -9
- package/dist/types/plugin.d.cts +3 -5
- package/dist/types/plugin.d.ts +3 -5
- package/dist/types/resolved.d.cts +3 -5
- package/dist/types/resolved.d.ts +3 -5
- package/dist/types/tsconfig.d.cts +8 -1
- package/dist/types/tsconfig.d.ts +8 -1
- package/dist/types/typedoc.d.cts +3 -1
- package/dist/types/typedoc.d.ts +3 -1
- package/dist/types/unplugin.d.cts +22 -11
- package/dist/types/unplugin.d.ts +22 -11
- package/dist/unloader.cjs +7 -7
- package/dist/unloader.d.cts +12 -14
- package/dist/unloader.d.ts +12 -14
- package/dist/unloader.js +4 -4
- package/dist/unplugin.cjs +18 -18
- package/dist/unplugin.d.cts +6 -9
- package/dist/unplugin.d.ts +6 -9
- package/dist/unplugin.js +15 -15
- package/dist/vite.cjs +7 -7
- package/dist/vite.d.cts +3 -5
- package/dist/vite.d.ts +3 -5
- package/dist/vite.js +4 -4
- package/dist/webpack.cjs +7 -7
- package/dist/webpack.d.cts +3 -5
- package/dist/webpack.d.ts +3 -5
- package/dist/webpack.js +4 -4
- package/package.json +39 -11
- package/schemas/fs.capnp +73 -15
- package/dist/chunk-RODEAGIJ.cjs +0 -32
- package/dist/chunk-SKLSRHBU.js +0 -29
- package/dist/hooks-D2UGCryi.d.ts +0 -28
- package/dist/hooks-DJG3B-Hw.d.cts +0 -28
- package/dist/lib/create-program.cjs +0 -11
- package/dist/lib/create-program.js +0 -2
- package/dist/lib/hooks-CDLPWf7j.d.cts +0 -28
- package/dist/lib/hooks-Cn-IqwYp.d.ts +0 -28
- package/dist/types/vfs.js +0 -2
- /package/dist/{chunk-KIKTWMI3.cjs → chunk-2NCILNCH.cjs} +0 -0
- /package/dist/{chunk-XVLT2RQ2.js → chunk-BLNT5INX.js} +0 -0
- /package/dist/{lib/chunk-RJ4277VZ.cjs → chunk-GRU7B3QM.cjs} +0 -0
- /package/dist/{lib/chunk-ZBLDAREE.js → chunk-T2P533I5.js} +0 -0
- /package/dist/lib/{chunk-CGYAL3S2.cjs → chunk-4EIXDLFP.cjs} +0 -0
- /package/dist/lib/{chunk-CXRSMYEX.js → chunk-RD5AUWXN.js} +0 -0
|
@@ -2,7 +2,6 @@ import { EnvPaths } from '@stryke/env/get-env-paths';
|
|
|
2
2
|
import { NonUndefined, MaybePromise, FunctionLike, DeepPartial as DeepPartial$1 } from '@stryke/types/base';
|
|
3
3
|
import { PackageJson } from '@stryke/types/package-json';
|
|
4
4
|
import { Jiti } from 'jiti';
|
|
5
|
-
import { ParserOptions, ParseResult } from 'oxc-parser';
|
|
6
5
|
import { Range } from 'semver';
|
|
7
6
|
import { TransformResult, ExternalIdResult, HookFilter, UnpluginOptions, UnpluginContext, UnpluginBuildContext, UnpluginMessage } from 'unplugin';
|
|
8
7
|
import { Format } from '@storm-software/build-tools/types';
|
|
@@ -11,10 +10,9 @@ import { StormWorkspaceConfig } from '@storm-software/config/types';
|
|
|
11
10
|
import { TypeDefinition, TypeDefinitionParameter } from '@stryke/types/configuration';
|
|
12
11
|
import { AssetGlob } from '@stryke/types/file';
|
|
13
12
|
import { ResolvedPreviewOptions, PreviewOptions } from 'vite';
|
|
13
|
+
import { PathLike, StatSyncOptions, Stats, RmDirOptions, RmOptions, Mode, MakeDirectoryOptions as MakeDirectoryOptions$1, PathOrFileDescriptor, WriteFileOptions as WriteFileOptions$1 } from 'node:fs';
|
|
14
14
|
import { TsConfigJson, CompilerOptions } from '@stryke/types/tsconfig';
|
|
15
15
|
import ts from 'typescript';
|
|
16
|
-
import { PrimitiveJsonValue } from '@stryke/json/types';
|
|
17
|
-
import { PathLike, StatSyncOptions, Stats, RmDirOptions, RmOptions, Mode, MakeDirectoryOptions as MakeDirectoryOptions$1, PathOrFileDescriptor, WriteFileOptions as WriteFileOptions$1 } from 'node:fs';
|
|
18
16
|
import { ArrayValues } from '@stryke/types/array';
|
|
19
17
|
|
|
20
18
|
type UnpluginBuildVariant = "rollup" | "webpack" | "rspack" | "vite" | "esbuild" | "farm" | "unloader" | "rolldown";
|
|
@@ -154,746 +152,769 @@ interface BuildConfig {
|
|
|
154
152
|
}
|
|
155
153
|
type BuildResolvedConfig = Omit<BuildConfig, "override">;
|
|
156
154
|
|
|
157
|
-
declare const
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
interface
|
|
155
|
+
declare const __VFS_PATCH__ = "__VFS_PATCH__";
|
|
156
|
+
declare const __VFS_REVERT__ = "__VFS_REVERT__";
|
|
157
|
+
type OutputModeType = "fs" | "virtual";
|
|
158
|
+
interface VirtualFileMetadata {
|
|
161
159
|
/**
|
|
162
|
-
* The
|
|
160
|
+
* The identifier for the file data.
|
|
163
161
|
*/
|
|
164
|
-
|
|
162
|
+
id: string;
|
|
165
163
|
/**
|
|
166
|
-
*
|
|
164
|
+
* The timestamp of the virtual file.
|
|
167
165
|
*/
|
|
168
|
-
|
|
169
|
-
}
|
|
170
|
-
type EnvironmentResolvedConfig = Omit<EnvironmentConfig, "consumer" | "mode" | "ssr" | "preview"> & Required<Pick<EnvironmentConfig, "consumer" | "mode" | "ssr">> & {
|
|
166
|
+
timestamp: number;
|
|
171
167
|
/**
|
|
172
|
-
* The
|
|
168
|
+
* The type of the file.
|
|
169
|
+
*
|
|
170
|
+
* @remarks
|
|
171
|
+
* This string represents the purpose/function of the file in the virtual file system. A potential list of variants includes:
|
|
172
|
+
* - `builtin`: Indicates that the file is a built-in module provided by the system.
|
|
173
|
+
* - `entry`: Indicates that the file is an entry point for execution.
|
|
174
|
+
* - `normal`: Indicates that the file is a standard file without any special role.
|
|
173
175
|
*/
|
|
174
|
-
|
|
176
|
+
type: string;
|
|
175
177
|
/**
|
|
176
|
-
*
|
|
178
|
+
* The output mode of the file.
|
|
177
179
|
*/
|
|
178
|
-
|
|
179
|
-
};
|
|
180
|
-
type ResolvedAssetGlob = AssetGlob & Required<Pick<AssetGlob, "input">>;
|
|
181
|
-
type OutputResolvedConfig = Required<Omit<OutputConfig, "assets"> & {
|
|
182
|
-
assets: ResolvedAssetGlob[];
|
|
183
|
-
}>;
|
|
184
|
-
/**
|
|
185
|
-
* The resolved options for the Powerlines project configuration.
|
|
186
|
-
*/
|
|
187
|
-
type ResolvedConfig<TUserConfig extends UserConfig = UserConfig> = Omit<TUserConfig, "name" | "title" | "plugins" | "mode" | "environments" | "platform" | "tsconfig" | "lint" | "test" | "build" | "transform" | "deploy" | "variant" | "type" | "output" | "logLevel" | "framework"> & Required<Pick<TUserConfig, "name" | "title" | "plugins" | "mode" | "environments" | "tsconfig" | "lint" | "test" | "build" | "transform" | "deploy" | "framework">> & {
|
|
180
|
+
mode: string;
|
|
188
181
|
/**
|
|
189
|
-
*
|
|
182
|
+
* Additional metadata associated with the file.
|
|
190
183
|
*/
|
|
191
|
-
|
|
184
|
+
properties: Record<string, string>;
|
|
185
|
+
}
|
|
186
|
+
interface VirtualFileData {
|
|
192
187
|
/**
|
|
193
|
-
* The
|
|
188
|
+
* The identifier for the file data.
|
|
194
189
|
*/
|
|
195
|
-
|
|
190
|
+
id?: string;
|
|
196
191
|
/**
|
|
197
|
-
*
|
|
192
|
+
* The contents of the virtual file.
|
|
198
193
|
*/
|
|
199
|
-
|
|
194
|
+
code: string;
|
|
200
195
|
/**
|
|
201
|
-
* The
|
|
196
|
+
* The type of the file.
|
|
202
197
|
*
|
|
203
|
-
* @
|
|
198
|
+
* @remarks
|
|
199
|
+
* This string represents the purpose/function of the file in the virtual file system. A potential list of variants includes:
|
|
200
|
+
* - `builtin`: Indicates that the file is a built-in module provided by the system.
|
|
201
|
+
* - `entry`: Indicates that the file is an entry point for execution.
|
|
202
|
+
* - `chunk`: Indicates that the file is a code chunk, typically used in code-splitting scenarios.
|
|
203
|
+
* - `prebuilt-chunk`: Indicates that the file is a prebuilt code chunk.
|
|
204
|
+
* - `asset`: Indicates that the file is a static asset, such as an image or stylesheet.
|
|
205
|
+
* - `normal`: Indicates that the file is a standard file without any special role.
|
|
204
206
|
*/
|
|
205
|
-
|
|
207
|
+
type?: string;
|
|
206
208
|
/**
|
|
207
|
-
* The
|
|
209
|
+
* The output mode of the file.
|
|
208
210
|
*/
|
|
209
|
-
|
|
211
|
+
mode?: string;
|
|
210
212
|
/**
|
|
211
|
-
*
|
|
213
|
+
* Additional metadata associated with the file.
|
|
212
214
|
*/
|
|
213
|
-
|
|
215
|
+
properties?: Record<string, string>;
|
|
216
|
+
}
|
|
217
|
+
interface VirtualFile extends Required<VirtualFileData>, VirtualFileMetadata {
|
|
214
218
|
/**
|
|
215
|
-
*
|
|
219
|
+
* An additional name for the file.
|
|
216
220
|
*/
|
|
217
|
-
|
|
221
|
+
path: string;
|
|
218
222
|
/**
|
|
219
|
-
*
|
|
220
|
-
*
|
|
221
|
-
* @remarks
|
|
222
|
-
* This configuration can be used by plugins during the `build` command. It will generally contain options specific to the selected {@link BuildVariant | build variant}.
|
|
223
|
+
* The timestamp of the virtual file.
|
|
223
224
|
*/
|
|
224
|
-
|
|
225
|
+
timestamp: number;
|
|
226
|
+
}
|
|
227
|
+
interface ResolveFSOptions {
|
|
228
|
+
mode?: OutputModeType;
|
|
229
|
+
}
|
|
230
|
+
type MakeDirectoryOptions = (Mode | MakeDirectoryOptions$1) & ResolveFSOptions;
|
|
231
|
+
interface PowerlinesWriteFileOptions extends ResolveFSOptions {
|
|
225
232
|
/**
|
|
226
|
-
*
|
|
233
|
+
* Should the file skip formatting before being written?
|
|
227
234
|
*
|
|
228
|
-
* @defaultValue
|
|
235
|
+
* @defaultValue false
|
|
229
236
|
*/
|
|
230
|
-
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
|
|
237
|
+
skipFormat?: boolean;
|
|
238
|
+
}
|
|
239
|
+
type NodeWriteFileOptions = WriteFileOptions$1;
|
|
240
|
+
type WriteFileOptions = NodeWriteFileOptions | PowerlinesWriteFileOptions;
|
|
241
|
+
type WriteFileData = string | NodeJS.ArrayBufferView | VirtualFileData;
|
|
242
|
+
interface ResolvePathOptions extends ResolveFSOptions {
|
|
234
243
|
/**
|
|
235
|
-
*
|
|
244
|
+
* Should the resolved path include the file extension?
|
|
245
|
+
*
|
|
246
|
+
* @defaultValue true
|
|
236
247
|
*/
|
|
237
|
-
|
|
248
|
+
withExtension?: boolean;
|
|
238
249
|
/**
|
|
239
|
-
*
|
|
250
|
+
* The paths to search for the file.
|
|
240
251
|
*/
|
|
241
|
-
|
|
252
|
+
paths?: string[];
|
|
242
253
|
/**
|
|
243
|
-
* The
|
|
254
|
+
* The type of the path to resolve.
|
|
244
255
|
*/
|
|
245
|
-
|
|
246
|
-
}
|
|
247
|
-
type PluginHook<THookFunction extends FunctionLike, TFilter extends keyof HookFilter = never> = THookFunction | PluginHookObject<THookFunction, TFilter>;
|
|
248
|
-
/**
|
|
249
|
-
* A result returned by the plugin from the `generateTypes` hook that describes the declaration types output file.
|
|
250
|
-
*/
|
|
251
|
-
interface GenerateTypesResult {
|
|
252
|
-
directives?: string[];
|
|
253
|
-
code: string;
|
|
256
|
+
pathType?: "file" | "directory";
|
|
254
257
|
}
|
|
255
|
-
|
|
256
|
-
[K in keyof T]?: DeepPartial<T[K]>;
|
|
257
|
-
};
|
|
258
|
-
type ConfigResult<TContext extends PluginContext = PluginContext> = DeepPartial<TContext["config"]> & Record<string, any>;
|
|
259
|
-
interface BasePluginHookFunctions<TContext extends PluginContext = PluginContext> extends Record<CommandType, (this: TContext) => MaybePromise<void>> {
|
|
258
|
+
interface VirtualFileSystemInterface {
|
|
260
259
|
/**
|
|
261
|
-
*
|
|
262
|
-
*
|
|
263
|
-
* @remarks
|
|
264
|
-
* Modify config before it's resolved. The hook can either mutate {@link Context.config} on the passed-in context directly, or return a partial config object that will be deeply merged into existing config.
|
|
265
|
-
*
|
|
266
|
-
* @warning User plugins are resolved before running this hook so injecting other plugins inside the config hook will have no effect. If you want to add plugins, consider doing so in the {@link Plugin.dependsOn} property instead.
|
|
267
|
-
*
|
|
268
|
-
* @see https://vitejs.dev/guide/api-plugin#config
|
|
269
|
-
*
|
|
270
|
-
* @param this - The build context.
|
|
271
|
-
* @param config - The partial configuration object to be modified.
|
|
272
|
-
* @returns A promise that resolves to a partial configuration object.
|
|
260
|
+
* Patches the File System to include the virtual file system (VFS) contents.
|
|
273
261
|
*/
|
|
274
|
-
|
|
262
|
+
[__VFS_PATCH__]: () => void;
|
|
275
263
|
/**
|
|
276
|
-
*
|
|
277
|
-
*
|
|
278
|
-
* @remarks
|
|
279
|
-
* This hook is called for each environment with a partially resolved environment config that already accounts for the default environment config values set at the root level. If plugins need to modify the config of a given environment, they should do it in this hook instead of the config hook. Leaving the config hook only for modifying the root default environment config.
|
|
280
|
-
*
|
|
281
|
-
* @see https://vitejs.dev/guide/api-plugin#configenvironment
|
|
282
|
-
*
|
|
283
|
-
* @param this - The build context.
|
|
284
|
-
* @param name - The name of the environment being configured.
|
|
285
|
-
* @param environment - The Vite-like environment object containing information about the current build environment.
|
|
286
|
-
* @returns A promise that resolves when the hook is complete.
|
|
264
|
+
* Reverts the virtual file system (VFS) to its previous state.
|
|
287
265
|
*/
|
|
288
|
-
|
|
266
|
+
[__VFS_REVERT__]: () => void;
|
|
289
267
|
/**
|
|
290
|
-
*
|
|
291
|
-
*
|
|
292
|
-
* @see https://vitejs.dev/guide/api-plugin#configresolved
|
|
293
|
-
*
|
|
294
|
-
* @param this - The build context.
|
|
295
|
-
* @returns A promise that resolves when the hook is complete.
|
|
268
|
+
* The underlying file metadata.
|
|
296
269
|
*/
|
|
297
|
-
|
|
270
|
+
metadata: Record<string, VirtualFileMetadata | undefined>;
|
|
298
271
|
/**
|
|
299
|
-
* A
|
|
300
|
-
*
|
|
301
|
-
* @param this - The build context.
|
|
302
|
-
* @param code - The source code to generate types for.
|
|
303
|
-
* @returns A promise that resolves when the hook is complete.
|
|
272
|
+
* A map of module ids to their file paths.
|
|
304
273
|
*/
|
|
305
|
-
|
|
274
|
+
ids: Record<string, string>;
|
|
306
275
|
/**
|
|
307
|
-
*
|
|
276
|
+
* Check if a path or id corresponds to a virtual file **(does not actually exists on disk)**.
|
|
308
277
|
*
|
|
309
|
-
* @param
|
|
310
|
-
* @
|
|
278
|
+
* @param pathOrId - The path or id to check.
|
|
279
|
+
* @param options - Optional parameters for resolving the path.
|
|
280
|
+
* @returns Whether the path or id corresponds to a virtual file **(does not actually exists on disk)**.
|
|
311
281
|
*/
|
|
312
|
-
|
|
282
|
+
isVirtual: (pathOrId: string, options?: ResolvePathOptions) => boolean;
|
|
313
283
|
/**
|
|
314
|
-
*
|
|
284
|
+
* Check if a path or id corresponds to a file written to the file system **(actually exists on disk)**.
|
|
315
285
|
*
|
|
316
|
-
* @param
|
|
317
|
-
* @
|
|
286
|
+
* @param pathOrId - The path or id to check.
|
|
287
|
+
* @param options - Optional parameters for resolving the path.
|
|
288
|
+
* @returns Whether the path or id corresponds to a file written to the file system **(actually exists on disk)**.
|
|
318
289
|
*/
|
|
319
|
-
|
|
290
|
+
isPhysical: (pathOrId: string, options?: ResolvePathOptions) => boolean;
|
|
320
291
|
/**
|
|
321
|
-
*
|
|
292
|
+
* Checks if a file exists in the virtual file system (VFS).
|
|
322
293
|
*
|
|
323
|
-
* @param
|
|
324
|
-
* @
|
|
325
|
-
* @param id - The identifier of the source code.
|
|
326
|
-
* @returns A promise that resolves when the hook is complete.
|
|
294
|
+
* @param path - The path of the file to check.
|
|
295
|
+
* @returns `true` if the file exists, otherwise `false`.
|
|
327
296
|
*/
|
|
328
|
-
|
|
297
|
+
isFile: (path: string) => boolean;
|
|
329
298
|
/**
|
|
330
|
-
*
|
|
299
|
+
* Checks if a directory exists in the virtual file system (VFS).
|
|
331
300
|
*
|
|
332
|
-
* @param
|
|
333
|
-
* @
|
|
334
|
-
* @returns A promise that resolves when the hook is complete.
|
|
301
|
+
* @param path - The path of the directory to check.
|
|
302
|
+
* @returns `true` if the directory exists, otherwise `false`.
|
|
335
303
|
*/
|
|
336
|
-
|
|
304
|
+
isDirectory: (path: string) => boolean;
|
|
337
305
|
/**
|
|
338
|
-
*
|
|
306
|
+
* Checks if a file exists in the virtual file system (VFS).
|
|
339
307
|
*
|
|
340
|
-
* @param
|
|
341
|
-
* @
|
|
342
|
-
* @param importer - The importer of the source code.
|
|
343
|
-
* @param options - The options for resolving the identifier.
|
|
344
|
-
* @returns A promise that resolves when the hook is complete.
|
|
308
|
+
* @param pathOrId - The path or id of the file.
|
|
309
|
+
* @returns `true` if the file exists, otherwise `false`.
|
|
345
310
|
*/
|
|
346
|
-
|
|
347
|
-
isEntry: boolean;
|
|
348
|
-
}) => MaybePromise<string | ExternalIdResult | null | undefined>;
|
|
311
|
+
existsSync: (pathOrId: string) => boolean;
|
|
349
312
|
/**
|
|
350
|
-
*
|
|
313
|
+
* Gets the metadata of a file in the virtual file system (VFS).
|
|
351
314
|
*
|
|
352
|
-
* @param
|
|
353
|
-
* @returns
|
|
315
|
+
* @param pathOrId - The path or id of the file.
|
|
316
|
+
* @returns The metadata of the file if it exists, otherwise undefined.
|
|
354
317
|
*/
|
|
355
|
-
|
|
356
|
-
}
|
|
357
|
-
type BuildPlugin<TContext extends PluginContext = PluginContext, TBuildVariant extends UnpluginBuildVariant = UnpluginBuildVariant, TOptions extends Required<UnpluginOptions>[TBuildVariant] = Required<UnpluginOptions>[TBuildVariant]> = {
|
|
358
|
-
[TKey in keyof TOptions]: TOptions[TKey] extends FunctionLike ? (this: ThisParameterType<TOptions[TKey]> & TContext, ...args: Parameters<TOptions[TKey]>) => ReturnType<TOptions[TKey]> | MaybePromise<ReturnType<TOptions[TKey]>> : TOptions[TKey];
|
|
359
|
-
};
|
|
360
|
-
type ExternalPluginHookFunctionsVariant<TContext extends PluginContext = PluginContext, TBuildVariant extends UnpluginBuildVariant = UnpluginBuildVariant> = {
|
|
361
|
-
[TKey in keyof BuildPlugin<TContext, TBuildVariant> & string as `${TBuildVariant}:${TKey}`]: BuildPlugin<TContext, TBuildVariant>[TKey];
|
|
362
|
-
};
|
|
363
|
-
type ExternalPluginHookFunctions<TContext extends PluginContext> = ExternalPluginHookFunctionsVariant<TContext, "vite"> & ExternalPluginHookFunctionsVariant<TContext, "esbuild"> & ExternalPluginHookFunctionsVariant<TContext, "rolldown"> & ExternalPluginHookFunctionsVariant<TContext, "rollup"> & ExternalPluginHookFunctionsVariant<TContext, "webpack"> & ExternalPluginHookFunctionsVariant<TContext, "rspack"> & ExternalPluginHookFunctionsVariant<TContext, "farm">;
|
|
364
|
-
type PluginHookFunctions<TContext extends PluginContext = PluginContext> = BasePluginHookFunctions<TContext> & ExternalPluginHookFunctions<TContext>;
|
|
365
|
-
type PluginHooks<TContext extends PluginContext = PluginContext> = {
|
|
366
|
-
[TKey in keyof BasePluginHookFunctions<TContext>]: PluginHook<BasePluginHookFunctions<TContext>[TKey]>;
|
|
367
|
-
} & {
|
|
318
|
+
getMetadata: (pathOrId: PathLike) => VirtualFileMetadata | undefined;
|
|
368
319
|
/**
|
|
369
|
-
*
|
|
370
|
-
*
|
|
371
|
-
* @remarks
|
|
372
|
-
* Modify config before it's resolved. The hook can either mutate {@link Context.config} on the passed-in context directly, or return a partial config object that will be deeply merged into existing config.
|
|
373
|
-
*
|
|
374
|
-
* @warning User plugins are resolved before running this hook so injecting other plugins inside the config hook will have no effect. If you want to add plugins, consider doing so in the {@link Plugin.dependsOn} property instead.
|
|
375
|
-
*
|
|
376
|
-
* @see https://vitejs.dev/guide/api-plugin#config
|
|
320
|
+
* Gets the stats of a file in the virtual file system (VFS).
|
|
377
321
|
*
|
|
378
|
-
* @param
|
|
379
|
-
* @param
|
|
380
|
-
* @returns
|
|
322
|
+
* @param pathOrId - The path or id of the file.
|
|
323
|
+
* @param options - Optional parameters for getting the stats.
|
|
324
|
+
* @returns The stats of the file if it exists, otherwise undefined.
|
|
381
325
|
*/
|
|
382
|
-
|
|
326
|
+
lstat: (pathOrId: string, options?: StatSyncOptions & {
|
|
327
|
+
bigint?: false | undefined;
|
|
328
|
+
throwIfNoEntry: false;
|
|
329
|
+
}) => Promise<Stats>;
|
|
383
330
|
/**
|
|
384
|
-
*
|
|
331
|
+
* Gets the stats of a file in the virtual file system (VFS).
|
|
385
332
|
*
|
|
386
|
-
* @param
|
|
387
|
-
* @param
|
|
388
|
-
* @
|
|
389
|
-
* @returns A promise that resolves when the hook is complete.
|
|
333
|
+
* @param pathOrId - The path or id of the file.
|
|
334
|
+
* @param options - Optional parameters for getting the stats.
|
|
335
|
+
* @returns The stats of the file if it exists, otherwise undefined.
|
|
390
336
|
*/
|
|
391
|
-
|
|
337
|
+
lstatSync: (pathOrId: string, options?: StatSyncOptions & {
|
|
338
|
+
bigint?: false | undefined;
|
|
339
|
+
throwIfNoEntry: false;
|
|
340
|
+
}) => Stats | undefined;
|
|
392
341
|
/**
|
|
393
|
-
*
|
|
342
|
+
* Gets the stats of a file in the virtual file system (VFS).
|
|
394
343
|
*
|
|
395
|
-
* @param
|
|
396
|
-
* @
|
|
397
|
-
* @returns A promise that resolves when the hook is complete.
|
|
344
|
+
* @param pathOrId - The path or id of the file.
|
|
345
|
+
* @returns The stats of the file if it exists, otherwise false.
|
|
398
346
|
*/
|
|
399
|
-
|
|
347
|
+
stat: (pathOrId: string, options?: StatSyncOptions & {
|
|
348
|
+
bigint?: false | undefined;
|
|
349
|
+
throwIfNoEntry: false;
|
|
350
|
+
}) => Promise<Stats>;
|
|
400
351
|
/**
|
|
401
|
-
*
|
|
352
|
+
* Gets the stats of a file in the virtual file system (VFS).
|
|
402
353
|
*
|
|
403
|
-
* @param
|
|
404
|
-
* @
|
|
405
|
-
* @param importer - The importer of the source code.
|
|
406
|
-
* @param options - The options for resolving the identifier.
|
|
407
|
-
* @returns A promise that resolves when the hook is complete.
|
|
354
|
+
* @param pathOrId - The path or id of the file.
|
|
355
|
+
* @returns The stats of the file if it exists, otherwise false.
|
|
408
356
|
*/
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
};
|
|
413
|
-
type PluginBuildPlugins<TContext extends PluginContext = PluginContext> = {
|
|
414
|
-
[TBuildVariant in UnpluginBuildVariant]?: BuildPlugin<TContext, TBuildVariant>;
|
|
415
|
-
};
|
|
416
|
-
interface Plugin<in out TContext extends PluginContext<ResolvedConfig> = PluginContext<ResolvedConfig>> extends Partial<PluginHooks<TContext>>, PluginBuildPlugins<TContext> {
|
|
357
|
+
statSync: (pathOrId: string, options?: StatSyncOptions & {
|
|
358
|
+
bigint?: false | undefined;
|
|
359
|
+
throwIfNoEntry: false;
|
|
360
|
+
}) => Stats | undefined;
|
|
417
361
|
/**
|
|
418
|
-
*
|
|
362
|
+
* Lists files in a given path.
|
|
363
|
+
*
|
|
364
|
+
* @param path - The path to list files from.
|
|
365
|
+
* @param options - Options for listing files, such as encoding and recursion.
|
|
366
|
+
* @returns An array of file names in the specified path.
|
|
419
367
|
*/
|
|
420
|
-
|
|
368
|
+
readdirSync: (path: string, options?: {
|
|
369
|
+
encoding: BufferEncoding | null;
|
|
370
|
+
withFileTypes?: false | undefined;
|
|
371
|
+
recursive?: boolean | undefined;
|
|
372
|
+
} | BufferEncoding) => string[];
|
|
421
373
|
/**
|
|
422
|
-
*
|
|
374
|
+
* Lists files in a given path.
|
|
423
375
|
*
|
|
424
|
-
* @
|
|
425
|
-
*
|
|
426
|
-
*
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
376
|
+
* @param path - The path to list files from.
|
|
377
|
+
* @param options - Options for listing files, such as encoding and recursion.
|
|
378
|
+
* @returns An array of file names in the specified path.
|
|
379
|
+
*/
|
|
380
|
+
readdir: (path: string, options?: {
|
|
381
|
+
encoding: BufferEncoding | null;
|
|
382
|
+
withFileTypes?: false | undefined;
|
|
383
|
+
recursive?: boolean | undefined;
|
|
384
|
+
} | BufferEncoding) => Promise<string[]>;
|
|
385
|
+
/**
|
|
386
|
+
* Removes a file or symbolic link in the virtual file system (VFS).
|
|
431
387
|
*
|
|
432
|
-
* @
|
|
433
|
-
* @
|
|
434
|
-
* @see https://webpack.js.org/concepts/loaders/#enforce---pre-and-post
|
|
435
|
-
* @see https://esbuild.github.io/plugins/#concepts
|
|
388
|
+
* @param path - The path to the file to remove.
|
|
389
|
+
* @returns A promise that resolves when the file is removed.
|
|
436
390
|
*/
|
|
437
|
-
|
|
391
|
+
unlinkSync: (path: PathLike, options?: ResolveFSOptions) => void;
|
|
438
392
|
/**
|
|
439
|
-
*
|
|
393
|
+
* Asynchronously removes a file or symbolic link in the virtual file system (VFS).
|
|
440
394
|
*
|
|
441
|
-
* @
|
|
442
|
-
*
|
|
395
|
+
* @param path - The path to the file to remove.
|
|
396
|
+
* @returns A promise that resolves when the file is removed.
|
|
397
|
+
*/
|
|
398
|
+
unlink: (path: string, options?: ResolveFSOptions) => Promise<void>;
|
|
399
|
+
/**
|
|
400
|
+
* Removes a directory in the virtual file system (VFS).
|
|
443
401
|
*
|
|
444
|
-
* @param
|
|
445
|
-
* @
|
|
402
|
+
* @param path - The path to create the directory at.
|
|
403
|
+
* @param options - Options for creating the directory.
|
|
446
404
|
*/
|
|
447
|
-
|
|
405
|
+
rmdirSync: (path: PathLike, options?: RmDirOptions & ResolveFSOptions) => any;
|
|
448
406
|
/**
|
|
449
|
-
*
|
|
407
|
+
* Removes a directory in the virtual file system (VFS).
|
|
408
|
+
*
|
|
409
|
+
* @param path - The path to create the directory at.
|
|
410
|
+
* @param options - Options for creating the directory.
|
|
411
|
+
* @returns A promise that resolves to the path of the created directory, or undefined if the directory could not be created.
|
|
450
412
|
*/
|
|
451
|
-
|
|
413
|
+
rmdir: (path: PathLike, options?: RmDirOptions & ResolveFSOptions) => Promise<void>;
|
|
452
414
|
/**
|
|
453
|
-
*
|
|
415
|
+
* Removes a file or directory in the virtual file system (VFS).
|
|
454
416
|
*
|
|
455
|
-
* @param
|
|
456
|
-
* @
|
|
417
|
+
* @param path - The path to the file or directory to remove.
|
|
418
|
+
* @param options - Options for removing the file or directory.
|
|
419
|
+
* @returns A promise that resolves when the file or directory is removed.
|
|
457
420
|
*/
|
|
458
|
-
|
|
459
|
-
}
|
|
460
|
-
|
|
461
|
-
type ReflectionMode = "default" | "explicit" | "never";
|
|
462
|
-
type RawReflectionMode = ReflectionMode | "" | boolean | string | string[] | undefined;
|
|
463
|
-
/**
|
|
464
|
-
* Defines the level of reflection to be used during the transpilation process.
|
|
465
|
-
*
|
|
466
|
-
* @remarks
|
|
467
|
-
* The level determines how much extra data is captured in the byte code for each type. This can be one of the following values:
|
|
468
|
-
* - `minimal` - Only the essential type information is captured.
|
|
469
|
-
* - `normal` - Additional type information is captured, including some contextual data.
|
|
470
|
-
* - `verbose` - All available type information is captured, including detailed contextual data.
|
|
471
|
-
*/
|
|
472
|
-
type ReflectionLevel = "minimal" | "normal" | "verbose";
|
|
473
|
-
interface DeepkitOptions {
|
|
421
|
+
rm: (path: PathLike, options?: RmOptions & ResolveFSOptions) => Promise<void>;
|
|
474
422
|
/**
|
|
475
|
-
*
|
|
476
|
-
*
|
|
477
|
-
*
|
|
423
|
+
* Synchronously removes a file or directory in the virtual file system (VFS).
|
|
424
|
+
*
|
|
425
|
+
* @param path - The path to the file or directory to remove.
|
|
426
|
+
* @param options - Options for removing the file or directory.
|
|
478
427
|
*/
|
|
479
|
-
|
|
428
|
+
rmSync: (path: PathLike, options?: RmOptions & ResolveFSOptions) => void;
|
|
480
429
|
/**
|
|
481
|
-
*
|
|
430
|
+
* Creates a directory in the virtual file system (VFS).
|
|
482
431
|
*
|
|
483
|
-
* @
|
|
484
|
-
*
|
|
485
|
-
*
|
|
486
|
-
* - `normal` - Additional type information is captured, including some contextual data.
|
|
487
|
-
* - `verbose` - All available type information is captured, including detailed contextual data.
|
|
432
|
+
* @param path - The path to create the directory at.
|
|
433
|
+
* @param options - Options for creating the directory.
|
|
434
|
+
* @returns A promise that resolves to the path of the created directory, or undefined if the directory could not be created.
|
|
488
435
|
*/
|
|
489
|
-
|
|
490
|
-
}
|
|
491
|
-
type TSCompilerOptions = CompilerOptions & DeepkitOptions;
|
|
492
|
-
/**
|
|
493
|
-
* The TypeScript compiler configuration.
|
|
494
|
-
*
|
|
495
|
-
* @see https://www.typescriptlang.org/docs/handbook/tsconfig-json.html
|
|
496
|
-
*/
|
|
497
|
-
interface TSConfig extends Omit<TsConfigJson, "reflection"> {
|
|
436
|
+
mkdirSync: (path: PathLike, options?: MakeDirectoryOptions) => string | undefined;
|
|
498
437
|
/**
|
|
499
|
-
*
|
|
500
|
-
*
|
|
501
|
-
*
|
|
438
|
+
* Creates a directory in the virtual file system (VFS).
|
|
439
|
+
*
|
|
440
|
+
* @param path - The path to create the directory at.
|
|
441
|
+
* @param options - Options for creating the directory.
|
|
442
|
+
* @returns A promise that resolves to the path of the created directory, or undefined if the directory could not be created.
|
|
502
443
|
*/
|
|
503
|
-
|
|
444
|
+
mkdir: (path: PathLike, options?: MakeDirectoryOptions) => Promise<string | undefined>;
|
|
504
445
|
/**
|
|
505
|
-
*
|
|
446
|
+
* Reads a file from the virtual file system (VFS).
|
|
506
447
|
*
|
|
507
|
-
* @
|
|
508
|
-
* The
|
|
509
|
-
* - `minimal` - Only the essential type information is captured.
|
|
510
|
-
* - `normal` - Additional type information is captured, including some contextual data.
|
|
511
|
-
* - `verbose` - All available type information is captured, including detailed contextual data.
|
|
448
|
+
* @param pathOrId - The path or id of the file.
|
|
449
|
+
* @returns The contents of the file if it exists, otherwise undefined.
|
|
512
450
|
*/
|
|
513
|
-
|
|
451
|
+
readFile: (pathOrId: string) => Promise<string | undefined>;
|
|
514
452
|
/**
|
|
515
|
-
*
|
|
453
|
+
* Reads a file from the virtual file system (VFS).
|
|
454
|
+
*
|
|
455
|
+
* @param pathOrId - The path or id of the file.
|
|
516
456
|
*/
|
|
517
|
-
|
|
518
|
-
}
|
|
519
|
-
type ParsedTypeScriptConfig = ts.ParsedCommandLine & {
|
|
520
|
-
originalTsconfigJson: TsConfigJson;
|
|
521
|
-
tsconfigJson: TSConfig;
|
|
522
|
-
tsconfigFilePath: string;
|
|
523
|
-
};
|
|
524
|
-
|
|
525
|
-
declare const __VFS_PATCH__ = "__VFS_PATCH__";
|
|
526
|
-
declare const __VFS_REVERT__ = "__VFS_REVERT__";
|
|
527
|
-
type OutputModeType = "fs" | "virtual";
|
|
528
|
-
interface VirtualFile {
|
|
457
|
+
readFileSync: (pathOrId: string) => string | undefined;
|
|
529
458
|
/**
|
|
530
|
-
*
|
|
459
|
+
* Writes a file to the virtual file system (VFS).
|
|
531
460
|
*
|
|
532
|
-
* @
|
|
533
|
-
*
|
|
461
|
+
* @param path - The path to the file.
|
|
462
|
+
* @param data - The contents of the file.
|
|
463
|
+
* @param options - Optional parameters for writing the file.
|
|
464
|
+
* @returns A promise that resolves when the file is written.
|
|
534
465
|
*/
|
|
535
|
-
|
|
466
|
+
writeFile: (path: PathOrFileDescriptor, data?: WriteFileData, options?: WriteFileOptions) => Promise<void>;
|
|
536
467
|
/**
|
|
537
|
-
*
|
|
468
|
+
* Writes a file to the virtual file system (VFS).
|
|
469
|
+
*
|
|
470
|
+
* @param path - The path to the file.
|
|
471
|
+
* @param data - The contents of the file.
|
|
472
|
+
* @param options - Optional parameters for writing the file.
|
|
538
473
|
*/
|
|
539
|
-
|
|
474
|
+
writeFileSync: (path: PathOrFileDescriptor, data?: WriteFileData, options?: WriteFileOptions) => void;
|
|
540
475
|
/**
|
|
541
|
-
*
|
|
476
|
+
* Moves a file from one path to another in the virtual file system (VFS).
|
|
542
477
|
*
|
|
543
|
-
* @
|
|
544
|
-
*
|
|
545
|
-
* - `builtin`: Indicates that the file is a built-in module provided by the system.
|
|
546
|
-
* - `entry`: Indicates that the file is an entry point for execution.
|
|
547
|
-
* - `normal`: Indicates that the file is a standard file without any special role.
|
|
478
|
+
* @param srcPath - The source path to move
|
|
479
|
+
* @param destPath - The destination path to move to
|
|
548
480
|
*/
|
|
549
|
-
|
|
481
|
+
move: (srcPath: string, destPath: string) => Promise<void>;
|
|
550
482
|
/**
|
|
551
|
-
*
|
|
483
|
+
* Synchronously moves a file from one path to another in the virtual file system (VFS).
|
|
552
484
|
*
|
|
553
|
-
* @
|
|
554
|
-
*
|
|
485
|
+
* @param srcPath - The source path to move
|
|
486
|
+
* @param destPath - The destination path to move to
|
|
555
487
|
*/
|
|
556
|
-
|
|
488
|
+
moveSync: (srcPath: string, destPath: string) => void;
|
|
557
489
|
/**
|
|
558
|
-
*
|
|
490
|
+
* Copies a file from one path to another in the virtual file system (VFS).
|
|
491
|
+
*
|
|
492
|
+
* @param srcPath - The source path to copy
|
|
493
|
+
* @param destPath - The destination path to copy to
|
|
559
494
|
*/
|
|
560
|
-
|
|
495
|
+
copy: (srcPath: string, destPath: string) => Promise<void>;
|
|
561
496
|
/**
|
|
562
|
-
*
|
|
497
|
+
* Synchronously copies a file from one path to another in the virtual file system (VFS).
|
|
498
|
+
*
|
|
499
|
+
* @param srcPath - The source path to copy
|
|
500
|
+
* @param destPath - The destination path to copy to
|
|
563
501
|
*/
|
|
564
|
-
|
|
565
|
-
}
|
|
566
|
-
interface VirtualFileMetadata {
|
|
502
|
+
copySync: (srcPath: string, destPath: string) => void;
|
|
567
503
|
/**
|
|
568
|
-
*
|
|
504
|
+
* Glob files in the virtual file system (VFS) based on the provided pattern(s).
|
|
505
|
+
*
|
|
506
|
+
* @param pattern - A pattern (or multiple patterns) to use to determine the file paths to return
|
|
507
|
+
* @returns An array of file paths matching the provided pattern(s)
|
|
569
508
|
*/
|
|
570
|
-
|
|
509
|
+
glob: (pattern: string | string[]) => Promise<string[]>;
|
|
571
510
|
/**
|
|
572
|
-
*
|
|
511
|
+
* Synchronously glob files in the virtual file system (VFS) based on the provided pattern(s).
|
|
512
|
+
*
|
|
513
|
+
* @param pattern - A pattern (or multiple patterns) to use to determine the file paths to return
|
|
514
|
+
* @returns An array of file paths matching the provided pattern(s)
|
|
573
515
|
*/
|
|
574
|
-
|
|
516
|
+
globSync: (pattern: string | string[]) => string[];
|
|
575
517
|
/**
|
|
576
|
-
*
|
|
518
|
+
* Resolves a path or id to a file path in the virtual file system.
|
|
519
|
+
*
|
|
520
|
+
* @param pathOrId - The path or id of the file to resolve.
|
|
521
|
+
* @param options - Optional parameters for resolving the path.
|
|
522
|
+
* @returns The resolved path of the file if it exists, otherwise false.
|
|
577
523
|
*/
|
|
578
|
-
|
|
524
|
+
resolve: (pathOrId: string, options?: ResolvePathOptions) => string | false;
|
|
579
525
|
/**
|
|
580
|
-
*
|
|
526
|
+
* Formats a path to match the virtual file system (VFS) structure.
|
|
527
|
+
*
|
|
528
|
+
* @param path - The path to format.
|
|
529
|
+
* @returns The formatted path.
|
|
581
530
|
*/
|
|
582
|
-
|
|
583
|
-
}
|
|
584
|
-
interface ResolveFSOptions {
|
|
585
|
-
mode?: OutputModeType;
|
|
586
|
-
}
|
|
587
|
-
type MakeDirectoryOptions = (Mode | MakeDirectoryOptions$1) & ResolveFSOptions;
|
|
588
|
-
interface PowerlinesWriteFileOptions extends ResolveFSOptions {
|
|
589
|
-
skipFormat?: boolean;
|
|
590
|
-
}
|
|
591
|
-
type NodeWriteFileOptions = WriteFileOptions$1;
|
|
592
|
-
type WriteFileOptions = NodeWriteFileOptions | PowerlinesWriteFileOptions;
|
|
593
|
-
type PowerLinesWriteFileData = Partial<Omit<VirtualFile, "path" | "mode" | "code">> & Pick<VirtualFile, "code">;
|
|
594
|
-
type WriteFileData = string | NodeJS.ArrayBufferView | PowerLinesWriteFileData;
|
|
595
|
-
interface ResolvePathOptions extends ResolveFSOptions {
|
|
531
|
+
formatPath: (path: string) => string;
|
|
596
532
|
/**
|
|
597
|
-
*
|
|
533
|
+
* Resolves a path or id to a file path in the virtual file system.
|
|
598
534
|
*
|
|
599
|
-
* @
|
|
535
|
+
* @param pathOrId - The path or id of the file to resolve.
|
|
536
|
+
* @returns The resolved path of the file if it exists, otherwise false.
|
|
600
537
|
*/
|
|
601
|
-
|
|
538
|
+
realpathSync: (pathOrId: string) => string;
|
|
602
539
|
/**
|
|
603
|
-
*
|
|
540
|
+
* Disposes of the virtual file system (VFS), writes any virtual file changes to disk, and releases any associated resources.
|
|
604
541
|
*/
|
|
605
|
-
|
|
542
|
+
dispose: () => Promise<void>;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
declare const SUPPORTED_COMMANDS: readonly ["new", "clean", "prepare", "lint", "test", "build", "docs", "deploy", "finalize"];
|
|
546
|
+
type CommandType = ArrayValues<typeof SUPPORTED_COMMANDS>;
|
|
547
|
+
|
|
548
|
+
interface ResolvedEntryTypeDefinition extends TypeDefinition {
|
|
606
549
|
/**
|
|
607
|
-
* The
|
|
550
|
+
* The user provided entry point in the source code
|
|
608
551
|
*/
|
|
609
|
-
|
|
552
|
+
input: TypeDefinition;
|
|
553
|
+
/**
|
|
554
|
+
* An optional name to use in the package export during the build process
|
|
555
|
+
*/
|
|
556
|
+
output?: string;
|
|
610
557
|
}
|
|
611
|
-
|
|
558
|
+
type EnvironmentResolvedConfig = Omit<EnvironmentConfig, "consumer" | "mode" | "ssr" | "preview"> & Required<Pick<EnvironmentConfig, "consumer" | "mode" | "ssr">> & {
|
|
612
559
|
/**
|
|
613
|
-
*
|
|
560
|
+
* The name of the environment
|
|
614
561
|
*/
|
|
615
|
-
|
|
562
|
+
name: string;
|
|
616
563
|
/**
|
|
617
|
-
*
|
|
564
|
+
* Configuration options for the preview server
|
|
618
565
|
*/
|
|
619
|
-
|
|
566
|
+
preview?: ResolvedPreviewOptions;
|
|
567
|
+
};
|
|
568
|
+
type ResolvedAssetGlob = AssetGlob & Required<Pick<AssetGlob, "input">>;
|
|
569
|
+
type OutputResolvedConfig = Required<Omit<OutputConfig, "assets"> & {
|
|
570
|
+
assets: ResolvedAssetGlob[];
|
|
571
|
+
}>;
|
|
572
|
+
/**
|
|
573
|
+
* The resolved options for the Powerlines project configuration.
|
|
574
|
+
*/
|
|
575
|
+
type ResolvedConfig<TUserConfig extends UserConfig = UserConfig> = Omit<TUserConfig, "name" | "title" | "plugins" | "mode" | "environments" | "platform" | "tsconfig" | "lint" | "test" | "build" | "transform" | "deploy" | "variant" | "type" | "output" | "logLevel" | "framework"> & Required<Pick<TUserConfig, "name" | "title" | "plugins" | "mode" | "environments" | "tsconfig" | "lint" | "test" | "build" | "transform" | "deploy" | "framework">> & {
|
|
620
576
|
/**
|
|
621
|
-
* The
|
|
577
|
+
* The configuration options that were provided inline to the Powerlines CLI.
|
|
622
578
|
*/
|
|
623
|
-
|
|
579
|
+
inlineConfig: InlineConfig<TUserConfig>;
|
|
624
580
|
/**
|
|
625
|
-
*
|
|
581
|
+
* The original configuration options that were provided by the user to the Powerlines process.
|
|
626
582
|
*/
|
|
627
|
-
|
|
583
|
+
userConfig: TUserConfig;
|
|
628
584
|
/**
|
|
629
|
-
*
|
|
630
|
-
*
|
|
631
|
-
* @param pathOrId - The path or id to check.
|
|
632
|
-
* @param options - Optional parameters for resolving the path.
|
|
633
|
-
* @returns Whether the path or id corresponds to a virtual file **(does not actually exists on disk)**.
|
|
585
|
+
* A string identifier for the Powerlines command being executed.
|
|
634
586
|
*/
|
|
635
|
-
|
|
587
|
+
command: NonUndefined<InlineConfig<TUserConfig>["command"]>;
|
|
636
588
|
/**
|
|
637
|
-
*
|
|
589
|
+
* The root directory of the project's source code
|
|
638
590
|
*
|
|
639
|
-
* @
|
|
640
|
-
* @param options - Optional parameters for resolving the path.
|
|
641
|
-
* @returns Whether the path or id corresponds to a file written to the file system **(actually exists on disk)**.
|
|
591
|
+
* @defaultValue "\{projectRoot\}/src"
|
|
642
592
|
*/
|
|
643
|
-
|
|
593
|
+
sourceRoot: NonUndefined<TUserConfig["sourceRoot"]>;
|
|
644
594
|
/**
|
|
645
|
-
*
|
|
646
|
-
*
|
|
647
|
-
* @param path - The path of the file to check.
|
|
648
|
-
* @returns `true` if the file exists, otherwise `false`.
|
|
595
|
+
* The root directory of the project.
|
|
649
596
|
*/
|
|
650
|
-
|
|
597
|
+
projectRoot: NonUndefined<TUserConfig["root"]>;
|
|
651
598
|
/**
|
|
652
|
-
*
|
|
653
|
-
*
|
|
654
|
-
* @param path - The path of the directory to check.
|
|
655
|
-
* @returns `true` if the directory exists, otherwise `false`.
|
|
599
|
+
* The type of project being built.
|
|
656
600
|
*/
|
|
657
|
-
|
|
601
|
+
projectType: NonUndefined<TUserConfig["type"]>;
|
|
658
602
|
/**
|
|
659
|
-
*
|
|
660
|
-
*
|
|
661
|
-
* @param pathOrId - The path or id of the file.
|
|
662
|
-
* @returns `true` if the file exists, otherwise `false`.
|
|
603
|
+
* The output configuration options to use for the build process
|
|
663
604
|
*/
|
|
664
|
-
|
|
605
|
+
output: OutputResolvedConfig;
|
|
665
606
|
/**
|
|
666
|
-
*
|
|
607
|
+
* Configuration provided to build processes
|
|
667
608
|
*
|
|
668
|
-
* @
|
|
669
|
-
*
|
|
609
|
+
* @remarks
|
|
610
|
+
* This configuration can be used by plugins during the `build` command. It will generally contain options specific to the selected {@link BuildVariant | build variant}.
|
|
670
611
|
*/
|
|
671
|
-
|
|
612
|
+
build: Omit<TUserConfig["build"], "override"> & Required<Pick<Required<TUserConfig["build"]>, "override">>;
|
|
672
613
|
/**
|
|
673
|
-
*
|
|
614
|
+
* The log level to use for the Powerlines processes.
|
|
674
615
|
*
|
|
675
|
-
* @
|
|
676
|
-
* @param options - Optional parameters for getting the stats.
|
|
677
|
-
* @returns The stats of the file if it exists, otherwise undefined.
|
|
616
|
+
* @defaultValue "info"
|
|
678
617
|
*/
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
618
|
+
logLevel: "error" | "warn" | "info" | "debug" | "trace" | null;
|
|
619
|
+
};
|
|
620
|
+
|
|
621
|
+
interface PluginHookObject<THookFunction extends FunctionLike, TFilter extends keyof HookFilter = never> {
|
|
683
622
|
/**
|
|
684
|
-
*
|
|
685
|
-
*
|
|
686
|
-
* @param pathOrId - The path or id of the file.
|
|
687
|
-
* @param options - Optional parameters for getting the stats.
|
|
688
|
-
* @returns The stats of the file if it exists, otherwise undefined.
|
|
623
|
+
* The order in which the plugin should be applied.
|
|
689
624
|
*/
|
|
690
|
-
|
|
691
|
-
bigint?: false | undefined;
|
|
692
|
-
throwIfNoEntry: false;
|
|
693
|
-
}) => Stats | undefined;
|
|
625
|
+
order?: "pre" | "post" | null | undefined;
|
|
694
626
|
/**
|
|
695
|
-
*
|
|
696
|
-
*
|
|
697
|
-
* @param pathOrId - The path or id of the file.
|
|
698
|
-
* @returns The stats of the file if it exists, otherwise false.
|
|
627
|
+
* A filter to determine when the hook should be called.
|
|
699
628
|
*/
|
|
700
|
-
|
|
701
|
-
bigint?: false | undefined;
|
|
702
|
-
throwIfNoEntry: false;
|
|
703
|
-
}) => Promise<Stats>;
|
|
629
|
+
filter?: Pick<HookFilter, TFilter>;
|
|
704
630
|
/**
|
|
705
|
-
*
|
|
706
|
-
*
|
|
707
|
-
* @param pathOrId - The path or id of the file.
|
|
708
|
-
* @returns The stats of the file if it exists, otherwise false.
|
|
631
|
+
* The hook function to be called.
|
|
709
632
|
*/
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
633
|
+
handler: THookFunction;
|
|
634
|
+
}
|
|
635
|
+
type PluginHook<THookFunction extends FunctionLike, TFilter extends keyof HookFilter = never> = THookFunction | PluginHookObject<THookFunction, TFilter>;
|
|
636
|
+
/**
|
|
637
|
+
* A result returned by the plugin from the `generateTypes` hook that describes the declaration types output file.
|
|
638
|
+
*/
|
|
639
|
+
interface GenerateTypesResult {
|
|
640
|
+
directives?: string[];
|
|
641
|
+
code: string;
|
|
642
|
+
}
|
|
643
|
+
type DeepPartial<T> = {
|
|
644
|
+
[K in keyof T]?: DeepPartial<T[K]>;
|
|
645
|
+
};
|
|
646
|
+
type ConfigResult<TContext extends PluginContext = PluginContext> = DeepPartial<TContext["config"]> & Record<string, any>;
|
|
647
|
+
interface BasePluginHookFunctions<TContext extends PluginContext = PluginContext> extends Record<CommandType, (this: TContext) => MaybePromise<void>> {
|
|
714
648
|
/**
|
|
715
|
-
*
|
|
649
|
+
* A function that returns configuration options to be merged with the build context's options.
|
|
716
650
|
*
|
|
717
|
-
* @
|
|
718
|
-
* @
|
|
719
|
-
*
|
|
651
|
+
* @remarks
|
|
652
|
+
* Modify config before it's resolved. The hook can either mutate {@link Context.config} on the passed-in context directly, or return a partial config object that will be deeply merged into existing config.
|
|
653
|
+
*
|
|
654
|
+
* @warning User plugins are resolved before running this hook so injecting other plugins inside the config hook will have no effect. If you want to add plugins, consider doing so in the {@link Plugin.dependsOn} property instead.
|
|
655
|
+
*
|
|
656
|
+
* @see https://vitejs.dev/guide/api-plugin#config
|
|
657
|
+
*
|
|
658
|
+
* @param this - The build context.
|
|
659
|
+
* @param config - The partial configuration object to be modified.
|
|
660
|
+
* @returns A promise that resolves to a partial configuration object.
|
|
720
661
|
*/
|
|
721
|
-
|
|
722
|
-
encoding: BufferEncoding | null;
|
|
723
|
-
withFileTypes?: false | undefined;
|
|
724
|
-
recursive?: boolean | undefined;
|
|
725
|
-
} | BufferEncoding) => string[];
|
|
662
|
+
config: (this: UnresolvedContext<TContext["config"]>) => MaybePromise<ConfigResult<TContext>>;
|
|
726
663
|
/**
|
|
727
|
-
*
|
|
664
|
+
* Modify environment configs before it's resolved. The hook can either mutate the passed-in environment config directly, or return a partial config object that will be deeply merged into existing config.
|
|
728
665
|
*
|
|
729
|
-
* @
|
|
730
|
-
*
|
|
731
|
-
*
|
|
666
|
+
* @remarks
|
|
667
|
+
* This hook is called for each environment with a partially resolved environment config that already accounts for the default environment config values set at the root level. If plugins need to modify the config of a given environment, they should do it in this hook instead of the config hook. Leaving the config hook only for modifying the root default environment config.
|
|
668
|
+
*
|
|
669
|
+
* @see https://vitejs.dev/guide/api-plugin#configenvironment
|
|
670
|
+
*
|
|
671
|
+
* @param this - The build context.
|
|
672
|
+
* @param name - The name of the environment being configured.
|
|
673
|
+
* @param environment - The Vite-like environment object containing information about the current build environment.
|
|
674
|
+
* @returns A promise that resolves when the hook is complete.
|
|
732
675
|
*/
|
|
733
|
-
|
|
734
|
-
encoding: BufferEncoding | null;
|
|
735
|
-
withFileTypes?: false | undefined;
|
|
736
|
-
recursive?: boolean | undefined;
|
|
737
|
-
} | BufferEncoding) => Promise<string[]>;
|
|
676
|
+
configEnvironment: (this: TContext, name: string, environment: EnvironmentConfig) => MaybePromise<Partial<EnvironmentResolvedConfig> | undefined | null>;
|
|
738
677
|
/**
|
|
739
|
-
*
|
|
678
|
+
* A hook that is called when the plugin is resolved.
|
|
740
679
|
*
|
|
741
|
-
* @
|
|
742
|
-
*
|
|
680
|
+
* @see https://vitejs.dev/guide/api-plugin#configresolved
|
|
681
|
+
*
|
|
682
|
+
* @param this - The build context.
|
|
683
|
+
* @returns A promise that resolves when the hook is complete.
|
|
743
684
|
*/
|
|
744
|
-
|
|
685
|
+
configResolved: (this: TContext) => MaybePromise<void>;
|
|
745
686
|
/**
|
|
746
|
-
*
|
|
687
|
+
* A hook that is called to overwrite the generated declaration types file (.d.ts). The generated type definitions should describe the built-in modules/logic added during the `prepare` task.
|
|
747
688
|
*
|
|
748
|
-
* @param
|
|
749
|
-
* @
|
|
689
|
+
* @param this - The build context.
|
|
690
|
+
* @param code - The source code to generate types for.
|
|
691
|
+
* @returns A promise that resolves when the hook is complete.
|
|
750
692
|
*/
|
|
751
|
-
|
|
693
|
+
generateTypes: (this: TContext, code: string) => MaybePromise<GenerateTypesResult | string | undefined | null>;
|
|
752
694
|
/**
|
|
753
|
-
*
|
|
695
|
+
* A hook that is called at the start of the build process.
|
|
754
696
|
*
|
|
755
|
-
* @param
|
|
756
|
-
* @
|
|
697
|
+
* @param this - The build context and unplugin build context.
|
|
698
|
+
* @returns A promise that resolves when the hook is complete.
|
|
757
699
|
*/
|
|
758
|
-
|
|
700
|
+
buildStart: (this: BuildPluginContext<TContext["config"]> & TContext) => MaybePromise<void>;
|
|
759
701
|
/**
|
|
760
|
-
*
|
|
702
|
+
* A hook that is called at the end of the build process.
|
|
761
703
|
*
|
|
762
|
-
* @param
|
|
763
|
-
* @
|
|
764
|
-
* @returns A promise that resolves to the path of the created directory, or undefined if the directory could not be created.
|
|
704
|
+
* @param this - The build context and unplugin build context.
|
|
705
|
+
* @returns A promise that resolves when the hook is complete.
|
|
765
706
|
*/
|
|
766
|
-
|
|
707
|
+
buildEnd: (this: BuildPluginContext<TContext["config"]> & TContext) => MaybePromise<void>;
|
|
767
708
|
/**
|
|
768
|
-
*
|
|
709
|
+
* A hook that is called to transform the source code.
|
|
769
710
|
*
|
|
770
|
-
* @param
|
|
771
|
-
* @param
|
|
772
|
-
* @
|
|
711
|
+
* @param this - The build context, unplugin build context, and unplugin context.
|
|
712
|
+
* @param code - The source code to transform.
|
|
713
|
+
* @param id - The identifier of the source code.
|
|
714
|
+
* @returns A promise that resolves when the hook is complete.
|
|
773
715
|
*/
|
|
774
|
-
|
|
716
|
+
transform: (this: BuildPluginContext<TContext["config"]> & TContext, code: string, id: string) => MaybePromise<TransformResult>;
|
|
775
717
|
/**
|
|
776
|
-
*
|
|
718
|
+
* A hook that is called to load the source code.
|
|
777
719
|
*
|
|
778
|
-
* @param
|
|
779
|
-
* @param
|
|
720
|
+
* @param this - The build context, unplugin build context, and unplugin context.
|
|
721
|
+
* @param id - The identifier of the source code.
|
|
722
|
+
* @returns A promise that resolves when the hook is complete.
|
|
780
723
|
*/
|
|
781
|
-
|
|
724
|
+
load: (this: BuildPluginContext<TContext["config"]> & TContext, id: string) => MaybePromise<TransformResult>;
|
|
782
725
|
/**
|
|
783
|
-
*
|
|
726
|
+
* A hook that is called to resolve the identifier of the source code.
|
|
784
727
|
*
|
|
785
|
-
* @param
|
|
786
|
-
* @param
|
|
787
|
-
* @
|
|
728
|
+
* @param this - The build context, unplugin build context, and unplugin context.
|
|
729
|
+
* @param id - The identifier of the source code.
|
|
730
|
+
* @param importer - The importer of the source code.
|
|
731
|
+
* @param options - The options for resolving the identifier.
|
|
732
|
+
* @returns A promise that resolves when the hook is complete.
|
|
788
733
|
*/
|
|
789
|
-
|
|
734
|
+
resolveId: (this: BuildPluginContext<TContext["config"]> & TContext, id: string, importer: string | undefined, options: {
|
|
735
|
+
isEntry: boolean;
|
|
736
|
+
}) => MaybePromise<string | ExternalIdResult | null | undefined>;
|
|
790
737
|
/**
|
|
791
|
-
*
|
|
738
|
+
* A hook that is called to write the bundle to disk.
|
|
792
739
|
*
|
|
793
|
-
* @param
|
|
794
|
-
* @
|
|
795
|
-
* @returns A promise that resolves to the path of the created directory, or undefined if the directory could not be created.
|
|
740
|
+
* @param this - The build context.
|
|
741
|
+
* @returns A promise that resolves when the hook is complete.
|
|
796
742
|
*/
|
|
797
|
-
|
|
743
|
+
writeBundle: (this: TContext) => MaybePromise<void>;
|
|
744
|
+
}
|
|
745
|
+
type BuildPlugin<TContext extends PluginContext = PluginContext, TBuildVariant extends UnpluginBuildVariant = UnpluginBuildVariant, TOptions extends Required<UnpluginOptions>[TBuildVariant] = Required<UnpluginOptions>[TBuildVariant]> = {
|
|
746
|
+
[TKey in keyof TOptions]: TOptions[TKey] extends FunctionLike ? (this: ThisParameterType<TOptions[TKey]> & TContext, ...args: Parameters<TOptions[TKey]>) => ReturnType<TOptions[TKey]> | MaybePromise<ReturnType<TOptions[TKey]>> : TOptions[TKey];
|
|
747
|
+
};
|
|
748
|
+
type ExternalPluginHookFunctionsVariant<TContext extends PluginContext = PluginContext, TBuildVariant extends UnpluginBuildVariant = UnpluginBuildVariant> = {
|
|
749
|
+
[TKey in keyof BuildPlugin<TContext, TBuildVariant> & string as `${TBuildVariant}:${TKey}`]: BuildPlugin<TContext, TBuildVariant>[TKey];
|
|
750
|
+
};
|
|
751
|
+
type ExternalPluginHookFunctions<TContext extends PluginContext> = ExternalPluginHookFunctionsVariant<TContext, "vite"> & ExternalPluginHookFunctionsVariant<TContext, "esbuild"> & ExternalPluginHookFunctionsVariant<TContext, "rolldown"> & ExternalPluginHookFunctionsVariant<TContext, "rollup"> & ExternalPluginHookFunctionsVariant<TContext, "webpack"> & ExternalPluginHookFunctionsVariant<TContext, "rspack"> & ExternalPluginHookFunctionsVariant<TContext, "farm">;
|
|
752
|
+
type PluginHookFunctions<TContext extends PluginContext = PluginContext> = BasePluginHookFunctions<TContext> & ExternalPluginHookFunctions<TContext>;
|
|
753
|
+
type PluginHooks<TContext extends PluginContext = PluginContext> = {
|
|
754
|
+
[TKey in keyof BasePluginHookFunctions<TContext>]: PluginHook<BasePluginHookFunctions<TContext>[TKey]>;
|
|
755
|
+
} & {
|
|
798
756
|
/**
|
|
799
|
-
*
|
|
757
|
+
* A function that returns configuration options to be merged with the build context's options.
|
|
800
758
|
*
|
|
801
|
-
* @
|
|
802
|
-
*
|
|
759
|
+
* @remarks
|
|
760
|
+
* Modify config before it's resolved. The hook can either mutate {@link Context.config} on the passed-in context directly, or return a partial config object that will be deeply merged into existing config.
|
|
761
|
+
*
|
|
762
|
+
* @warning User plugins are resolved before running this hook so injecting other plugins inside the config hook will have no effect. If you want to add plugins, consider doing so in the {@link Plugin.dependsOn} property instead.
|
|
763
|
+
*
|
|
764
|
+
* @see https://vitejs.dev/guide/api-plugin#config
|
|
765
|
+
*
|
|
766
|
+
* @param this - The build context.
|
|
767
|
+
* @param config - The partial configuration object to be modified.
|
|
768
|
+
* @returns A promise that resolves to a partial configuration object.
|
|
803
769
|
*/
|
|
804
|
-
|
|
770
|
+
config: PluginHook<(this: UnresolvedContext<TContext["config"]>) => MaybePromise<ConfigResult<TContext>>> | ConfigResult<TContext>;
|
|
805
771
|
/**
|
|
806
|
-
*
|
|
772
|
+
* A hook that is called to transform the source code.
|
|
807
773
|
*
|
|
808
|
-
* @param
|
|
774
|
+
* @param this - The build context, unplugin build context, and unplugin context.
|
|
775
|
+
* @param code - The source code to transform.
|
|
776
|
+
* @param id - The identifier of the source code.
|
|
777
|
+
* @returns A promise that resolves when the hook is complete.
|
|
809
778
|
*/
|
|
810
|
-
|
|
779
|
+
transform: PluginHook<(this: BuildPluginContext<TContext["config"]> & TContext, code: string, id: string) => MaybePromise<TransformResult>, "code" | "id">;
|
|
811
780
|
/**
|
|
812
|
-
*
|
|
781
|
+
* A hook that is called to load the source code.
|
|
813
782
|
*
|
|
814
|
-
* @param
|
|
815
|
-
* @param
|
|
816
|
-
* @
|
|
817
|
-
* @returns A promise that resolves when the file is written.
|
|
783
|
+
* @param this - The build context, unplugin build context, and unplugin context.
|
|
784
|
+
* @param id - The identifier of the source code.
|
|
785
|
+
* @returns A promise that resolves when the hook is complete.
|
|
818
786
|
*/
|
|
819
|
-
|
|
787
|
+
load: PluginHook<(this: BuildPluginContext<TContext["config"]> & TContext, id: string) => MaybePromise<TransformResult>, "id">;
|
|
820
788
|
/**
|
|
821
|
-
*
|
|
789
|
+
* A hook that is called to resolve the identifier of the source code.
|
|
822
790
|
*
|
|
823
|
-
* @param
|
|
824
|
-
* @param
|
|
825
|
-
* @param
|
|
791
|
+
* @param this - The build context, unplugin build context, and unplugin context.
|
|
792
|
+
* @param id - The identifier of the source code.
|
|
793
|
+
* @param importer - The importer of the source code.
|
|
794
|
+
* @param options - The options for resolving the identifier.
|
|
795
|
+
* @returns A promise that resolves when the hook is complete.
|
|
826
796
|
*/
|
|
827
|
-
|
|
797
|
+
resolveId: PluginHook<(this: BuildPluginContext<TContext["config"]> & TContext, id: string, importer: string | undefined, options: {
|
|
798
|
+
isEntry: boolean;
|
|
799
|
+
}) => MaybePromise<string | ExternalIdResult | null | undefined>, "id">;
|
|
828
800
|
/**
|
|
829
|
-
*
|
|
801
|
+
* An API object that can be used for inter-plugin communication.
|
|
830
802
|
*
|
|
831
|
-
* @
|
|
832
|
-
* @param destPath - The destination path to move to
|
|
803
|
+
* @see https://rollupjs.org/plugin-development/#direct-plugin-communication
|
|
833
804
|
*/
|
|
834
|
-
|
|
805
|
+
api?: Record<string, any>;
|
|
806
|
+
};
|
|
807
|
+
type PluginBuildPlugins<TContext extends PluginContext = PluginContext> = {
|
|
808
|
+
[TBuildVariant in UnpluginBuildVariant]?: BuildPlugin<TContext, TBuildVariant>;
|
|
809
|
+
};
|
|
810
|
+
interface Plugin<in out TContext extends PluginContext<ResolvedConfig> = PluginContext<ResolvedConfig>> extends Partial<PluginHooks<TContext>>, PluginBuildPlugins<TContext> {
|
|
835
811
|
/**
|
|
836
|
-
*
|
|
837
|
-
*
|
|
838
|
-
* @param srcPath - The source path to move
|
|
839
|
-
* @param destPath - The destination path to move to
|
|
812
|
+
* The name of the plugin, for use in deduplication, error messages and logs.
|
|
840
813
|
*/
|
|
841
|
-
|
|
814
|
+
name: string;
|
|
842
815
|
/**
|
|
843
|
-
*
|
|
816
|
+
* Enforce plugin invocation tier similar to webpack loaders. Hooks ordering is still subject to the `order` property in the hook object.
|
|
844
817
|
*
|
|
845
|
-
* @
|
|
846
|
-
*
|
|
818
|
+
* @remarks
|
|
819
|
+
* The Plugin invocation order is as follows:
|
|
820
|
+
* - `enforce: 'pre'` plugins
|
|
821
|
+
* - `order: 'pre'` plugin hooks
|
|
822
|
+
* - any other plugins (normal)
|
|
823
|
+
* - `order: 'post'` plugin hooks
|
|
824
|
+
* - `enforce: 'post'` plugins
|
|
825
|
+
*
|
|
826
|
+
* @see https://vitejs.dev/guide/api-plugin.html#plugin-ordering
|
|
827
|
+
* @see https://rollupjs.org/plugin-development/#build-hooks
|
|
828
|
+
* @see https://webpack.js.org/concepts/loaders/#enforce---pre-and-post
|
|
829
|
+
* @see https://esbuild.github.io/plugins/#concepts
|
|
847
830
|
*/
|
|
848
|
-
|
|
831
|
+
enforce?: "pre" | "post";
|
|
849
832
|
/**
|
|
850
|
-
*
|
|
833
|
+
* A function to determine if two plugins are the same and can be de-duplicated.
|
|
851
834
|
*
|
|
852
|
-
* @
|
|
853
|
-
*
|
|
835
|
+
* @remarks
|
|
836
|
+
* If this is not provided, plugins are de-duplicated by comparing their names.
|
|
837
|
+
*
|
|
838
|
+
* @param other - The other plugin to compare against.
|
|
839
|
+
* @returns `true` if the two plugins are the same, `false` otherwise.
|
|
854
840
|
*/
|
|
855
|
-
|
|
841
|
+
dedupe?: false | ((other: Plugin<any>) => boolean);
|
|
856
842
|
/**
|
|
857
|
-
*
|
|
858
|
-
*
|
|
859
|
-
* @param pattern - A pattern (or multiple patterns) to use to determine the file paths to return
|
|
860
|
-
* @returns An array of file paths matching the provided pattern(s)
|
|
843
|
+
* A list of pre-requisite plugins that must be loaded before this plugin can be used.
|
|
861
844
|
*/
|
|
862
|
-
|
|
845
|
+
dependsOn?: PluginConfig<any>[];
|
|
863
846
|
/**
|
|
864
|
-
*
|
|
847
|
+
* Define environments where this plugin should be active. By default, the plugin is active in all environments.
|
|
865
848
|
*
|
|
866
|
-
* @param
|
|
867
|
-
* @returns
|
|
849
|
+
* @param environment - The environment to check.
|
|
850
|
+
* @returns `true` if the plugin should be active in the specified environment, `false` otherwise.
|
|
868
851
|
*/
|
|
869
|
-
|
|
852
|
+
applyToEnvironment?: (environment: EnvironmentResolvedConfig) => MaybePromise<boolean | Plugin<any>>;
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
type ReflectionMode = "default" | "explicit" | "never";
|
|
856
|
+
type RawReflectionMode = ReflectionMode | "" | boolean | string | string[] | undefined;
|
|
857
|
+
/**
|
|
858
|
+
* Defines the level of reflection to be used during the transpilation process.
|
|
859
|
+
*
|
|
860
|
+
* @remarks
|
|
861
|
+
* The level determines how much extra data is captured in the byte code for each type. This can be one of the following values:
|
|
862
|
+
* - `minimal` - Only the essential type information is captured.
|
|
863
|
+
* - `normal` - Additional type information is captured, including some contextual data.
|
|
864
|
+
* - `verbose` - All available type information is captured, including detailed contextual data.
|
|
865
|
+
*/
|
|
866
|
+
type ReflectionLevel = "minimal" | "normal" | "verbose";
|
|
867
|
+
interface DeepkitOptions {
|
|
870
868
|
/**
|
|
871
|
-
*
|
|
872
|
-
*
|
|
873
|
-
*
|
|
874
|
-
* @param options - Optional parameters for resolving the path.
|
|
875
|
-
* @returns The resolved path of the file if it exists, otherwise false.
|
|
869
|
+
* Either true to activate reflection for all files compiled using this tsconfig,
|
|
870
|
+
* or a list of globs/file paths relative to this tsconfig.json.
|
|
871
|
+
* Globs/file paths can be prefixed with a ! to exclude them.
|
|
876
872
|
*/
|
|
877
|
-
|
|
873
|
+
reflection?: RawReflectionMode;
|
|
878
874
|
/**
|
|
879
|
-
*
|
|
875
|
+
* Defines the level of reflection to be used during the transpilation process.
|
|
880
876
|
*
|
|
881
|
-
* @
|
|
882
|
-
*
|
|
877
|
+
* @remarks
|
|
878
|
+
* The level determines how much extra data is captured in the byte code for each type. This can be one of the following values:
|
|
879
|
+
* - `minimal` - Only the essential type information is captured.
|
|
880
|
+
* - `normal` - Additional type information is captured, including some contextual data.
|
|
881
|
+
* - `verbose` - All available type information is captured, including detailed contextual data.
|
|
883
882
|
*/
|
|
884
|
-
|
|
883
|
+
reflectionLevel?: ReflectionLevel;
|
|
884
|
+
}
|
|
885
|
+
type TSCompilerOptions = CompilerOptions & DeepkitOptions;
|
|
886
|
+
/**
|
|
887
|
+
* The TypeScript compiler configuration.
|
|
888
|
+
*
|
|
889
|
+
* @see https://www.typescriptlang.org/docs/handbook/tsconfig-json.html
|
|
890
|
+
*/
|
|
891
|
+
interface TSConfig extends Omit<TsConfigJson, "reflection"> {
|
|
885
892
|
/**
|
|
886
|
-
*
|
|
893
|
+
* Either true to activate reflection for all files compiled using this tsconfig,
|
|
894
|
+
* or a list of globs/file paths relative to this tsconfig.json.
|
|
895
|
+
* Globs/file paths can be prefixed with a ! to exclude them.
|
|
896
|
+
*/
|
|
897
|
+
reflection?: RawReflectionMode;
|
|
898
|
+
/**
|
|
899
|
+
* Defines the level of reflection to be used during the transpilation process.
|
|
887
900
|
*
|
|
888
|
-
* @
|
|
889
|
-
*
|
|
901
|
+
* @remarks
|
|
902
|
+
* The level determines how much extra data is captured in the byte code for each type. This can be one of the following values:
|
|
903
|
+
* - `minimal` - Only the essential type information is captured.
|
|
904
|
+
* - `normal` - Additional type information is captured, including some contextual data.
|
|
905
|
+
* - `verbose` - All available type information is captured, including detailed contextual data.
|
|
890
906
|
*/
|
|
891
|
-
|
|
907
|
+
reflectionLevel?: ReflectionLevel;
|
|
892
908
|
/**
|
|
893
|
-
*
|
|
909
|
+
* Instructs the TypeScript compiler how to compile `.ts` files.
|
|
894
910
|
*/
|
|
895
|
-
|
|
911
|
+
compilerOptions?: TSCompilerOptions;
|
|
896
912
|
}
|
|
913
|
+
type ParsedTypeScriptConfig = ts.ParsedCommandLine & {
|
|
914
|
+
originalTsconfigJson: TsConfigJson;
|
|
915
|
+
tsconfigJson: TSConfig;
|
|
916
|
+
tsconfigFilePath: string;
|
|
917
|
+
};
|
|
897
918
|
|
|
898
919
|
type LogFn = (type: LogLevelLabel, ...args: string[]) => void;
|
|
899
920
|
/**
|
|
@@ -1371,7 +1392,7 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
|
|
|
1371
1392
|
* @param path - An optional path to write the builtin file to
|
|
1372
1393
|
* @param options - Options for writing the file
|
|
1373
1394
|
*/
|
|
1374
|
-
|
|
1395
|
+
emitBuiltin: (code: string, id: string, path?: string, options?: PowerlinesWriteFileOptions) => Promise<void>;
|
|
1375
1396
|
/**
|
|
1376
1397
|
* Resolves a entry virtual file and writes it to the VFS if it does not already exist
|
|
1377
1398
|
*
|
|
@@ -1379,11 +1400,7 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
|
|
|
1379
1400
|
* @param path - An optional path to write the entry file to
|
|
1380
1401
|
* @param options - Options for writing the file
|
|
1381
1402
|
*/
|
|
1382
|
-
|
|
1383
|
-
/**
|
|
1384
|
-
* Parses the source code and returns a {@link ParseResult} object.
|
|
1385
|
-
*/
|
|
1386
|
-
parse: (code: string, id: string, options?: ParserOptions | null) => Promise<ParseResult>;
|
|
1403
|
+
emitEntry: (code: string, path: string, options?: PowerlinesWriteFileOptions) => Promise<void>;
|
|
1387
1404
|
/**
|
|
1388
1405
|
* A function to update the context fields using a new user configuration options
|
|
1389
1406
|
*/
|