@powerlines/plugin-env 0.13.32 → 0.13.34

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.
@@ -1,11 +1,13 @@
1
- import { a as EnvironmentResolvedConfig } from '../runtime-BReFBBeA.cjs';
1
+ import { a as EnvironmentResolvedConfig } from '../runtime-DhSbEPND.cjs';
2
2
  import { DotenvParseOutput } from '@stryke/env/types';
3
3
  import { EnvPluginContext, EnvPluginOptions } from '../types/plugin.cjs';
4
4
  import '@stryke/env/get-env-paths';
5
5
  import '@stryke/types/base';
6
6
  import '@stryke/types/package-json';
7
7
  import 'jiti';
8
+ import 'magic-string';
8
9
  import 'semver';
10
+ import 'ts-morph';
9
11
  import 'unplugin';
10
12
  import '@babel/core';
11
13
  import '@storm-software/build-tools/types';
@@ -15,7 +17,8 @@ import '@stryke/types/configuration';
15
17
  import '@stryke/types/file';
16
18
  import 'vite';
17
19
  import '@babel/helper-plugin-utils';
18
- import '../fs-B3t0EW52.cjs';
20
+ import '../fs-Y3B84fcf.cjs';
21
+ import '@stryke/fs/resolve';
19
22
  import 'node:fs';
20
23
  import '@stryke/types/array';
21
24
  import '@stryke/types/tsconfig';
@@ -1,11 +1,13 @@
1
- import { a as EnvironmentResolvedConfig } from '../runtime-CNb5EW2L.js';
1
+ import { a as EnvironmentResolvedConfig } from '../runtime-CCwYDwEe.js';
2
2
  import { DotenvParseOutput } from '@stryke/env/types';
3
3
  import { EnvPluginContext, EnvPluginOptions } from '../types/plugin.js';
4
4
  import '@stryke/env/get-env-paths';
5
5
  import '@stryke/types/base';
6
6
  import '@stryke/types/package-json';
7
7
  import 'jiti';
8
+ import 'magic-string';
8
9
  import 'semver';
10
+ import 'ts-morph';
9
11
  import 'unplugin';
10
12
  import '@babel/core';
11
13
  import '@storm-software/build-tools/types';
@@ -15,7 +17,8 @@ import '@stryke/types/configuration';
15
17
  import '@stryke/types/file';
16
18
  import 'vite';
17
19
  import '@babel/helper-plugin-utils';
18
- import '../fs-B3t0EW52.js';
20
+ import '../fs-Y3B84fcf.js';
21
+ import '@stryke/fs/resolve';
19
22
  import 'node:fs';
20
23
  import '@stryke/types/array';
21
24
  import '@stryke/types/tsconfig';
@@ -1,12 +1,14 @@
1
1
  import { ReflectionClass } from '@deepkit/type';
2
2
  import { TypeDefinition } from '@stryke/types/configuration';
3
- import { U as UnresolvedContext, C as Context } from '../runtime-BReFBBeA.cjs';
3
+ import { U as UnresolvedContext, C as Context } from '../runtime-DhSbEPND.cjs';
4
4
  import { EnvPluginResolvedConfig, EnvType, EnvPluginContext } from '../types/plugin.cjs';
5
5
  import '@stryke/env/get-env-paths';
6
6
  import '@stryke/types/base';
7
7
  import '@stryke/types/package-json';
8
8
  import 'jiti';
9
+ import 'magic-string';
9
10
  import 'semver';
11
+ import 'ts-morph';
10
12
  import 'unplugin';
11
13
  import '@babel/core';
12
14
  import '@storm-software/build-tools/types';
@@ -15,7 +17,8 @@ import '@storm-software/config/types';
15
17
  import '@stryke/types/file';
16
18
  import 'vite';
17
19
  import '@babel/helper-plugin-utils';
18
- import '../fs-B3t0EW52.cjs';
20
+ import '../fs-Y3B84fcf.cjs';
21
+ import '@stryke/fs/resolve';
19
22
  import 'node:fs';
20
23
  import '@stryke/types/array';
21
24
  import '@stryke/types/tsconfig';
@@ -1,12 +1,14 @@
1
1
  import { ReflectionClass } from '@deepkit/type';
2
2
  import { TypeDefinition } from '@stryke/types/configuration';
3
- import { U as UnresolvedContext, C as Context } from '../runtime-CNb5EW2L.js';
3
+ import { U as UnresolvedContext, C as Context } from '../runtime-CCwYDwEe.js';
4
4
  import { EnvPluginResolvedConfig, EnvType, EnvPluginContext } from '../types/plugin.js';
5
5
  import '@stryke/env/get-env-paths';
6
6
  import '@stryke/types/base';
7
7
  import '@stryke/types/package-json';
8
8
  import 'jiti';
9
+ import 'magic-string';
9
10
  import 'semver';
11
+ import 'ts-morph';
10
12
  import 'unplugin';
11
13
  import '@babel/core';
12
14
  import '@storm-software/build-tools/types';
@@ -15,7 +17,8 @@ import '@storm-software/config/types';
15
17
  import '@stryke/types/file';
16
18
  import 'vite';
17
19
  import '@babel/helper-plugin-utils';
18
- import '../fs-B3t0EW52.js';
20
+ import '../fs-Y3B84fcf.js';
21
+ import '@stryke/fs/resolve';
19
22
  import 'node:fs';
20
23
  import '@stryke/types/array';
21
24
  import '@stryke/types/tsconfig';
@@ -1,6 +1,6 @@
1
1
  import { ReflectionClass, TypeObjectLiteral, TypeClass } from '@deepkit/type';
2
2
  import { EnvPluginContext } from '../types/plugin.cjs';
3
- import { E as EnvInterface, S as SecretsInterface } from '../runtime-BReFBBeA.cjs';
3
+ import { E as EnvInterface, S as SecretsInterface } from '../runtime-DhSbEPND.cjs';
4
4
  import '@alloy-js/core/jsx-runtime';
5
5
  import '@stryke/capnp';
6
6
  import '@stryke/env/types';
@@ -9,7 +9,9 @@ import '@stryke/env/get-env-paths';
9
9
  import '@stryke/types/base';
10
10
  import '@stryke/types/package-json';
11
11
  import 'jiti';
12
+ import 'magic-string';
12
13
  import 'semver';
14
+ import 'ts-morph';
13
15
  import 'unplugin';
14
16
  import '@babel/core';
15
17
  import '@storm-software/build-tools/types';
@@ -18,7 +20,8 @@ import '@storm-software/config/types';
18
20
  import '@stryke/types/file';
19
21
  import 'vite';
20
22
  import '@babel/helper-plugin-utils';
21
- import '../fs-B3t0EW52.cjs';
23
+ import '../fs-Y3B84fcf.cjs';
24
+ import '@stryke/fs/resolve';
22
25
  import 'node:fs';
23
26
  import '@stryke/types/array';
24
27
  import '@stryke/types/tsconfig';
@@ -1,6 +1,6 @@
1
1
  import { ReflectionClass, TypeObjectLiteral, TypeClass } from '@deepkit/type';
2
2
  import { EnvPluginContext } from '../types/plugin.js';
3
- import { E as EnvInterface, S as SecretsInterface } from '../runtime-CNb5EW2L.js';
3
+ import { E as EnvInterface, S as SecretsInterface } from '../runtime-CCwYDwEe.js';
4
4
  import '@alloy-js/core/jsx-runtime';
5
5
  import '@stryke/capnp';
6
6
  import '@stryke/env/types';
@@ -9,7 +9,9 @@ import '@stryke/env/get-env-paths';
9
9
  import '@stryke/types/base';
10
10
  import '@stryke/types/package-json';
11
11
  import 'jiti';
12
+ import 'magic-string';
12
13
  import 'semver';
14
+ import 'ts-morph';
13
15
  import 'unplugin';
14
16
  import '@babel/core';
15
17
  import '@storm-software/build-tools/types';
@@ -18,7 +20,8 @@ import '@storm-software/config/types';
18
20
  import '@stryke/types/file';
19
21
  import 'vite';
20
22
  import '@babel/helper-plugin-utils';
21
- import '../fs-B3t0EW52.js';
23
+ import '../fs-Y3B84fcf.js';
24
+ import '@stryke/fs/resolve';
22
25
  import 'node:fs';
23
26
  import '@stryke/types/array';
24
27
  import '@stryke/types/tsconfig';
@@ -2,12 +2,14 @@ import { ReflectionClass } from '@deepkit/type';
2
2
  import { EnvPluginContext, EnvType } from '../types/plugin.cjs';
3
3
  import '@alloy-js/core/jsx-runtime';
4
4
  import '@stryke/capnp';
5
- import '../runtime-BReFBBeA.cjs';
5
+ import '../runtime-DhSbEPND.cjs';
6
6
  import '@stryke/env/get-env-paths';
7
7
  import '@stryke/types/base';
8
8
  import '@stryke/types/package-json';
9
9
  import 'jiti';
10
+ import 'magic-string';
10
11
  import 'semver';
12
+ import 'ts-morph';
11
13
  import 'unplugin';
12
14
  import '@babel/core';
13
15
  import '@storm-software/build-tools/types';
@@ -17,7 +19,8 @@ import '@stryke/types/configuration';
17
19
  import '@stryke/types/file';
18
20
  import 'vite';
19
21
  import '@babel/helper-plugin-utils';
20
- import '../fs-B3t0EW52.cjs';
22
+ import '../fs-Y3B84fcf.cjs';
23
+ import '@stryke/fs/resolve';
21
24
  import 'node:fs';
22
25
  import '@stryke/types/array';
23
26
  import '@stryke/types/tsconfig';
@@ -2,12 +2,14 @@ import { ReflectionClass } from '@deepkit/type';
2
2
  import { EnvPluginContext, EnvType } from '../types/plugin.js';
3
3
  import '@alloy-js/core/jsx-runtime';
4
4
  import '@stryke/capnp';
5
- import '../runtime-CNb5EW2L.js';
5
+ import '../runtime-CCwYDwEe.js';
6
6
  import '@stryke/env/get-env-paths';
7
7
  import '@stryke/types/base';
8
8
  import '@stryke/types/package-json';
9
9
  import 'jiti';
10
+ import 'magic-string';
10
11
  import 'semver';
12
+ import 'ts-morph';
11
13
  import 'unplugin';
12
14
  import '@babel/core';
13
15
  import '@storm-software/build-tools/types';
@@ -17,7 +19,8 @@ import '@stryke/types/configuration';
17
19
  import '@stryke/types/file';
18
20
  import 'vite';
19
21
  import '@babel/helper-plugin-utils';
20
- import '../fs-B3t0EW52.js';
22
+ import '../fs-Y3B84fcf.js';
23
+ import '@stryke/fs/resolve';
21
24
  import 'node:fs';
22
25
  import '@stryke/types/array';
23
26
  import '@stryke/types/tsconfig';
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { P as PluginContext, b as Plugin } from './runtime-BReFBBeA.cjs';
2
- export { E as EnvInterface, S as SecretsInterface, _ as __ΩEnvInterface, c as __ΩSecretsInterface } from './runtime-BReFBBeA.cjs';
1
+ import { P as PluginContext, b as Plugin } from './runtime-DhSbEPND.cjs';
2
+ export { E as EnvInterface, S as SecretsInterface, _ as __ΩEnvInterface, c as __ΩSecretsInterface } from './runtime-DhSbEPND.cjs';
3
3
  import { Children } from '@alloy-js/core/jsx-runtime';
4
4
  import { PrintTreeOptions } from '@alloy-js/core';
5
5
  import { EnvPluginContext, EnvPluginResolvedConfig } from './types/plugin.cjs';
@@ -15,7 +15,9 @@ import '@stryke/env/get-env-paths';
15
15
  import '@stryke/types/base';
16
16
  import '@stryke/types/package-json';
17
17
  import 'jiti';
18
+ import 'magic-string';
18
19
  import 'semver';
20
+ import 'ts-morph';
19
21
  import 'unplugin';
20
22
  import '@babel/core';
21
23
  import '@storm-software/build-tools/types';
@@ -25,7 +27,8 @@ import '@stryke/types/configuration';
25
27
  import '@stryke/types/file';
26
28
  import 'vite';
27
29
  import '@babel/helper-plugin-utils';
28
- import './fs-B3t0EW52.cjs';
30
+ import './fs-Y3B84fcf.cjs';
31
+ import '@stryke/fs/resolve';
29
32
  import 'node:fs';
30
33
  import '@stryke/types/array';
31
34
  import '@stryke/types/tsconfig';
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { P as PluginContext, b as Plugin } from './runtime-CNb5EW2L.js';
2
- export { E as EnvInterface, S as SecretsInterface, _ as __ΩEnvInterface, c as __ΩSecretsInterface } from './runtime-CNb5EW2L.js';
1
+ import { P as PluginContext, b as Plugin } from './runtime-CCwYDwEe.js';
2
+ export { E as EnvInterface, S as SecretsInterface, _ as __ΩEnvInterface, c as __ΩSecretsInterface } from './runtime-CCwYDwEe.js';
3
3
  import { Children } from '@alloy-js/core/jsx-runtime';
4
4
  import { PrintTreeOptions } from '@alloy-js/core';
5
5
  import { EnvPluginContext, EnvPluginResolvedConfig } from './types/plugin.js';
@@ -15,7 +15,9 @@ import '@stryke/env/get-env-paths';
15
15
  import '@stryke/types/base';
16
16
  import '@stryke/types/package-json';
17
17
  import 'jiti';
18
+ import 'magic-string';
18
19
  import 'semver';
20
+ import 'ts-morph';
19
21
  import 'unplugin';
20
22
  import '@babel/core';
21
23
  import '@storm-software/build-tools/types';
@@ -25,7 +27,8 @@ import '@stryke/types/configuration';
25
27
  import '@stryke/types/file';
26
28
  import 'vite';
27
29
  import '@babel/helper-plugin-utils';
28
- import './fs-B3t0EW52.js';
30
+ import './fs-Y3B84fcf.js';
31
+ import '@stryke/fs/resolve';
29
32
  import 'node:fs';
30
33
  import '@stryke/types/array';
31
34
  import '@stryke/types/tsconfig';
@@ -2,8 +2,10 @@ import { EnvPaths } from '@stryke/env/get-env-paths';
2
2
  import { NonUndefined, MaybePromise, FunctionLike } from '@stryke/types/base';
3
3
  import { PackageJson } from '@stryke/types/package-json';
4
4
  import { Jiti } from 'jiti';
5
+ import { SourceMap } from 'magic-string';
5
6
  import { Range } from 'semver';
6
- import { TransformResult, ExternalIdResult, HookFilter, UnpluginOptions, UnpluginContext, UnpluginMessage, UnpluginBuildContext } from 'unplugin';
7
+ import { Project } from 'ts-morph';
8
+ import { TransformResult as TransformResult$1, ExternalIdResult, HookFilter, UnpluginOptions, UnpluginContext, UnpluginMessage, UnpluginBuildContext } from 'unplugin';
7
9
  import { PluginItem, PluginObj, PluginPass, transformAsync } from '@babel/core';
8
10
  import { Format } from '@storm-software/build-tools/types';
9
11
  import { LogLevelLabel } from '@storm-software/config-tools/types';
@@ -12,7 +14,7 @@ import { TypeDefinition, TypeDefinitionParameter } from '@stryke/types/configura
12
14
  import { AssetGlob } from '@stryke/types/file';
13
15
  import { ResolvedPreviewOptions, PreviewOptions } from 'vite';
14
16
  import { BabelAPI } from '@babel/helper-plugin-utils';
15
- import { O as OutputModeType, V as VirtualFileSystemInterface, a as VirtualFile, P as PowerlinesWriteFileOptions } from './fs-B3t0EW52.cjs';
17
+ import { O as OutputModeType, V as VirtualFileSystemInterface, R as ResolveOptions, a as VirtualFile, P as PowerlinesWriteFileOptions } from './fs-Y3B84fcf.js';
16
18
  import { ArrayValues } from '@stryke/types/array';
17
19
  import { TsConfigJson, CompilerOptions } from '@stryke/types/tsconfig';
18
20
  import ts from 'typescript';
@@ -344,7 +346,7 @@ interface BasePluginHookFunctions<TContext extends PluginContext = PluginContext
344
346
  * @param id - The identifier of the source code.
345
347
  * @returns A promise that resolves when the hook is complete.
346
348
  */
347
- transform: (this: BuildPluginContext<TContext["config"]> & TContext, code: string, id: string) => MaybePromise<TransformResult>;
349
+ transform: (this: BuildPluginContext<TContext["config"]> & TContext, code: string, id: string) => MaybePromise<TransformResult$1>;
348
350
  /**
349
351
  * A hook that is called to load the source code.
350
352
  *
@@ -352,7 +354,7 @@ interface BasePluginHookFunctions<TContext extends PluginContext = PluginContext
352
354
  * @param id - The identifier of the source code.
353
355
  * @returns A promise that resolves when the hook is complete.
354
356
  */
355
- load: (this: BuildPluginContext<TContext["config"]> & TContext, id: string) => MaybePromise<TransformResult>;
357
+ load: (this: BuildPluginContext<TContext["config"]> & TContext, id: string) => MaybePromise<TransformResult$1>;
356
358
  /**
357
359
  * A hook that is called to resolve the identifier of the source code.
358
360
  *
@@ -402,7 +404,7 @@ type PluginHooks<TContext extends PluginContext = PluginContext> = {
402
404
  * @param id - The identifier of the source code.
403
405
  * @returns A promise that resolves when the hook is complete.
404
406
  */
405
- transform: PluginHook<(this: BuildPluginContext<TContext["config"]> & TContext, code: string, id: string) => MaybePromise<TransformResult>, "code" | "id">;
407
+ transform: PluginHook<(this: BuildPluginContext<TContext["config"]> & TContext, code: string, id: string) => MaybePromise<TransformResult$1>, "code" | "id">;
406
408
  /**
407
409
  * A hook that is called to load the source code.
408
410
  *
@@ -410,7 +412,7 @@ type PluginHooks<TContext extends PluginContext = PluginContext> = {
410
412
  * @param id - The identifier of the source code.
411
413
  * @returns A promise that resolves when the hook is complete.
412
414
  */
413
- load: PluginHook<(this: BuildPluginContext<TContext["config"]> & TContext, id: string) => MaybePromise<TransformResult>, "id">;
415
+ load: PluginHook<(this: BuildPluginContext<TContext["config"]> & TContext, id: string) => MaybePromise<TransformResult$1>, "id">;
414
416
  /**
415
417
  * A hook that is called to resolve the identifier of the source code.
416
418
  *
@@ -891,6 +893,10 @@ interface MetaInfo {
891
893
  interface Resolver extends Jiti {
892
894
  plugin: Jiti;
893
895
  }
896
+ interface TransformResult {
897
+ code: string;
898
+ map: SourceMap | null;
899
+ }
894
900
  interface InitContextOptions {
895
901
  /**
896
902
  * If false, the plugin will be loaded after all other plugins.
@@ -1025,6 +1031,47 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
1025
1031
  * The builtin module id that exist in the Powerlines virtual file system
1026
1032
  */
1027
1033
  builtins: string[];
1034
+ /**
1035
+ * The {@link Project} instance used for type reflection and module manipulation
1036
+ *
1037
+ * @see https://ts-morph.com/
1038
+ *
1039
+ * @remarks
1040
+ * This instance is created lazily on first access.
1041
+ */
1042
+ program: Project;
1043
+ /**
1044
+ * A helper function to resolve modules using the Jiti resolver
1045
+ *
1046
+ * @remarks
1047
+ * This function can be used to resolve modules relative to the project root directory.
1048
+ *
1049
+ * @example
1050
+ * ```ts
1051
+ * const resolvedPath = await context.resolve("some-module", "/path/to/importer");
1052
+ * ```
1053
+ *
1054
+ * @param id - The module to resolve.
1055
+ * @param importer - An optional path to the importer module.
1056
+ * @param options - Additional resolution options.
1057
+ * @returns A promise that resolves to the resolved module path.
1058
+ */
1059
+ resolveId: (id: string, importer?: string, options?: ResolveOptions) => Promise<ExternalIdResult | undefined>;
1060
+ /**
1061
+ * A helper function to load modules using the Jiti resolver
1062
+ *
1063
+ * @remarks
1064
+ * This function can be used to load modules relative to the project root directory.
1065
+ *
1066
+ * @example
1067
+ * ```ts
1068
+ * const module = await context.load("some-module", "/path/to/importer");
1069
+ * ```
1070
+ *
1071
+ * @param id - The module to load.
1072
+ * @returns A promise that resolves to the loaded module.
1073
+ */
1074
+ load: (id: string) => Promise<TransformResult | undefined>;
1028
1075
  /**
1029
1076
  * The Powerlines builtin virtual files
1030
1077
  */
@@ -2,8 +2,10 @@ import { EnvPaths } from '@stryke/env/get-env-paths';
2
2
  import { NonUndefined, MaybePromise, FunctionLike } from '@stryke/types/base';
3
3
  import { PackageJson } from '@stryke/types/package-json';
4
4
  import { Jiti } from 'jiti';
5
+ import { SourceMap } from 'magic-string';
5
6
  import { Range } from 'semver';
6
- import { TransformResult, ExternalIdResult, HookFilter, UnpluginOptions, UnpluginContext, UnpluginMessage, UnpluginBuildContext } from 'unplugin';
7
+ import { Project } from 'ts-morph';
8
+ import { TransformResult as TransformResult$1, ExternalIdResult, HookFilter, UnpluginOptions, UnpluginContext, UnpluginMessage, UnpluginBuildContext } from 'unplugin';
7
9
  import { PluginItem, PluginObj, PluginPass, transformAsync } from '@babel/core';
8
10
  import { Format } from '@storm-software/build-tools/types';
9
11
  import { LogLevelLabel } from '@storm-software/config-tools/types';
@@ -12,7 +14,7 @@ import { TypeDefinition, TypeDefinitionParameter } from '@stryke/types/configura
12
14
  import { AssetGlob } from '@stryke/types/file';
13
15
  import { ResolvedPreviewOptions, PreviewOptions } from 'vite';
14
16
  import { BabelAPI } from '@babel/helper-plugin-utils';
15
- import { O as OutputModeType, V as VirtualFileSystemInterface, a as VirtualFile, P as PowerlinesWriteFileOptions } from './fs-B3t0EW52.js';
17
+ import { O as OutputModeType, V as VirtualFileSystemInterface, R as ResolveOptions, a as VirtualFile, P as PowerlinesWriteFileOptions } from './fs-Y3B84fcf.cjs';
16
18
  import { ArrayValues } from '@stryke/types/array';
17
19
  import { TsConfigJson, CompilerOptions } from '@stryke/types/tsconfig';
18
20
  import ts from 'typescript';
@@ -344,7 +346,7 @@ interface BasePluginHookFunctions<TContext extends PluginContext = PluginContext
344
346
  * @param id - The identifier of the source code.
345
347
  * @returns A promise that resolves when the hook is complete.
346
348
  */
347
- transform: (this: BuildPluginContext<TContext["config"]> & TContext, code: string, id: string) => MaybePromise<TransformResult>;
349
+ transform: (this: BuildPluginContext<TContext["config"]> & TContext, code: string, id: string) => MaybePromise<TransformResult$1>;
348
350
  /**
349
351
  * A hook that is called to load the source code.
350
352
  *
@@ -352,7 +354,7 @@ interface BasePluginHookFunctions<TContext extends PluginContext = PluginContext
352
354
  * @param id - The identifier of the source code.
353
355
  * @returns A promise that resolves when the hook is complete.
354
356
  */
355
- load: (this: BuildPluginContext<TContext["config"]> & TContext, id: string) => MaybePromise<TransformResult>;
357
+ load: (this: BuildPluginContext<TContext["config"]> & TContext, id: string) => MaybePromise<TransformResult$1>;
356
358
  /**
357
359
  * A hook that is called to resolve the identifier of the source code.
358
360
  *
@@ -402,7 +404,7 @@ type PluginHooks<TContext extends PluginContext = PluginContext> = {
402
404
  * @param id - The identifier of the source code.
403
405
  * @returns A promise that resolves when the hook is complete.
404
406
  */
405
- transform: PluginHook<(this: BuildPluginContext<TContext["config"]> & TContext, code: string, id: string) => MaybePromise<TransformResult>, "code" | "id">;
407
+ transform: PluginHook<(this: BuildPluginContext<TContext["config"]> & TContext, code: string, id: string) => MaybePromise<TransformResult$1>, "code" | "id">;
406
408
  /**
407
409
  * A hook that is called to load the source code.
408
410
  *
@@ -410,7 +412,7 @@ type PluginHooks<TContext extends PluginContext = PluginContext> = {
410
412
  * @param id - The identifier of the source code.
411
413
  * @returns A promise that resolves when the hook is complete.
412
414
  */
413
- load: PluginHook<(this: BuildPluginContext<TContext["config"]> & TContext, id: string) => MaybePromise<TransformResult>, "id">;
415
+ load: PluginHook<(this: BuildPluginContext<TContext["config"]> & TContext, id: string) => MaybePromise<TransformResult$1>, "id">;
414
416
  /**
415
417
  * A hook that is called to resolve the identifier of the source code.
416
418
  *
@@ -891,6 +893,10 @@ interface MetaInfo {
891
893
  interface Resolver extends Jiti {
892
894
  plugin: Jiti;
893
895
  }
896
+ interface TransformResult {
897
+ code: string;
898
+ map: SourceMap | null;
899
+ }
894
900
  interface InitContextOptions {
895
901
  /**
896
902
  * If false, the plugin will be loaded after all other plugins.
@@ -1025,6 +1031,47 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
1025
1031
  * The builtin module id that exist in the Powerlines virtual file system
1026
1032
  */
1027
1033
  builtins: string[];
1034
+ /**
1035
+ * The {@link Project} instance used for type reflection and module manipulation
1036
+ *
1037
+ * @see https://ts-morph.com/
1038
+ *
1039
+ * @remarks
1040
+ * This instance is created lazily on first access.
1041
+ */
1042
+ program: Project;
1043
+ /**
1044
+ * A helper function to resolve modules using the Jiti resolver
1045
+ *
1046
+ * @remarks
1047
+ * This function can be used to resolve modules relative to the project root directory.
1048
+ *
1049
+ * @example
1050
+ * ```ts
1051
+ * const resolvedPath = await context.resolve("some-module", "/path/to/importer");
1052
+ * ```
1053
+ *
1054
+ * @param id - The module to resolve.
1055
+ * @param importer - An optional path to the importer module.
1056
+ * @param options - Additional resolution options.
1057
+ * @returns A promise that resolves to the resolved module path.
1058
+ */
1059
+ resolveId: (id: string, importer?: string, options?: ResolveOptions) => Promise<ExternalIdResult | undefined>;
1060
+ /**
1061
+ * A helper function to load modules using the Jiti resolver
1062
+ *
1063
+ * @remarks
1064
+ * This function can be used to load modules relative to the project root directory.
1065
+ *
1066
+ * @example
1067
+ * ```ts
1068
+ * const module = await context.load("some-module", "/path/to/importer");
1069
+ * ```
1070
+ *
1071
+ * @param id - The module to load.
1072
+ * @returns A promise that resolves to the loaded module.
1073
+ */
1074
+ load: (id: string) => Promise<TransformResult | undefined>;
1028
1075
  /**
1029
1076
  * The Powerlines builtin virtual files
1030
1077
  */
@@ -1,5 +1,5 @@
1
1
  export { EnvPluginContext, EnvPluginOptions, EnvPluginResolvedConfig, EnvPluginUserConfig, EnvType, __ΩEnvPluginContext, __ΩEnvPluginOptions, __ΩEnvPluginResolvedConfig, __ΩEnvPluginUserConfig, __ΩEnvType } from './plugin.cjs';
2
- export { E as EnvInterface, S as SecretsInterface, _ as __ΩEnvInterface, c as __ΩSecretsInterface } from '../runtime-BReFBBeA.cjs';
2
+ export { E as EnvInterface, S as SecretsInterface, _ as __ΩEnvInterface, c as __ΩSecretsInterface } from '../runtime-DhSbEPND.cjs';
3
3
  import '@alloy-js/core/jsx-runtime';
4
4
  import '@deepkit/type';
5
5
  import '@stryke/capnp';
@@ -9,7 +9,9 @@ import '@stryke/env/get-env-paths';
9
9
  import '@stryke/types/base';
10
10
  import '@stryke/types/package-json';
11
11
  import 'jiti';
12
+ import 'magic-string';
12
13
  import 'semver';
14
+ import 'ts-morph';
13
15
  import 'unplugin';
14
16
  import '@babel/core';
15
17
  import '@storm-software/build-tools/types';
@@ -18,7 +20,8 @@ import '@storm-software/config/types';
18
20
  import '@stryke/types/file';
19
21
  import 'vite';
20
22
  import '@babel/helper-plugin-utils';
21
- import '../fs-B3t0EW52.cjs';
23
+ import '../fs-Y3B84fcf.cjs';
24
+ import '@stryke/fs/resolve';
22
25
  import 'node:fs';
23
26
  import '@stryke/types/array';
24
27
  import '@stryke/types/tsconfig';
@@ -1,5 +1,5 @@
1
1
  export { EnvPluginContext, EnvPluginOptions, EnvPluginResolvedConfig, EnvPluginUserConfig, EnvType, __ΩEnvPluginContext, __ΩEnvPluginOptions, __ΩEnvPluginResolvedConfig, __ΩEnvPluginUserConfig, __ΩEnvType } from './plugin.js';
2
- export { E as EnvInterface, S as SecretsInterface, _ as __ΩEnvInterface, c as __ΩSecretsInterface } from '../runtime-CNb5EW2L.js';
2
+ export { E as EnvInterface, S as SecretsInterface, _ as __ΩEnvInterface, c as __ΩSecretsInterface } from '../runtime-CCwYDwEe.js';
3
3
  import '@alloy-js/core/jsx-runtime';
4
4
  import '@deepkit/type';
5
5
  import '@stryke/capnp';
@@ -9,7 +9,9 @@ import '@stryke/env/get-env-paths';
9
9
  import '@stryke/types/base';
10
10
  import '@stryke/types/package-json';
11
11
  import 'jiti';
12
+ import 'magic-string';
12
13
  import 'semver';
14
+ import 'ts-morph';
13
15
  import 'unplugin';
14
16
  import '@babel/core';
15
17
  import '@storm-software/build-tools/types';
@@ -18,7 +20,8 @@ import '@storm-software/config/types';
18
20
  import '@stryke/types/file';
19
21
  import 'vite';
20
22
  import '@babel/helper-plugin-utils';
21
- import '../fs-B3t0EW52.js';
23
+ import '../fs-Y3B84fcf.js';
24
+ import '@stryke/fs/resolve';
22
25
  import 'node:fs';
23
26
  import '@stryke/types/array';
24
27
  import '@stryke/types/tsconfig';
@@ -1,14 +1,16 @@
1
1
  import { Children } from '@alloy-js/core/jsx-runtime';
2
2
  import { ReflectionClass } from '@deepkit/type';
3
3
  import * as $ from '@stryke/capnp';
4
- import { B as BabelUserConfig, d as UserConfig, R as ResolvedConfig, e as BabelResolvedConfig, P as PluginContext, E as EnvInterface, S as SecretsInterface } from '../runtime-BReFBBeA.cjs';
4
+ import { B as BabelUserConfig, d as UserConfig, R as ResolvedConfig, e as BabelResolvedConfig, P as PluginContext, E as EnvInterface, S as SecretsInterface } from '../runtime-DhSbEPND.cjs';
5
5
  import { DotenvParseOutput } from '@stryke/env/types';
6
6
  import { DotenvConfiguration, TypeDefinitionParameter, TypeDefinition } from '@stryke/types/configuration';
7
7
  import '@stryke/env/get-env-paths';
8
8
  import '@stryke/types/base';
9
9
  import '@stryke/types/package-json';
10
10
  import 'jiti';
11
+ import 'magic-string';
11
12
  import 'semver';
13
+ import 'ts-morph';
12
14
  import 'unplugin';
13
15
  import '@babel/core';
14
16
  import '@storm-software/build-tools/types';
@@ -17,7 +19,8 @@ import '@storm-software/config/types';
17
19
  import '@stryke/types/file';
18
20
  import 'vite';
19
21
  import '@babel/helper-plugin-utils';
20
- import '../fs-B3t0EW52.cjs';
22
+ import '../fs-Y3B84fcf.cjs';
23
+ import '@stryke/fs/resolve';
21
24
  import 'node:fs';
22
25
  import '@stryke/types/array';
23
26
  import '@stryke/types/tsconfig';
@@ -1,14 +1,16 @@
1
1
  import { Children } from '@alloy-js/core/jsx-runtime';
2
2
  import { ReflectionClass } from '@deepkit/type';
3
3
  import * as $ from '@stryke/capnp';
4
- import { B as BabelUserConfig, d as UserConfig, R as ResolvedConfig, e as BabelResolvedConfig, P as PluginContext, E as EnvInterface, S as SecretsInterface } from '../runtime-CNb5EW2L.js';
4
+ import { B as BabelUserConfig, d as UserConfig, R as ResolvedConfig, e as BabelResolvedConfig, P as PluginContext, E as EnvInterface, S as SecretsInterface } from '../runtime-CCwYDwEe.js';
5
5
  import { DotenvParseOutput } from '@stryke/env/types';
6
6
  import { DotenvConfiguration, TypeDefinitionParameter, TypeDefinition } from '@stryke/types/configuration';
7
7
  import '@stryke/env/get-env-paths';
8
8
  import '@stryke/types/base';
9
9
  import '@stryke/types/package-json';
10
10
  import 'jiti';
11
+ import 'magic-string';
11
12
  import 'semver';
13
+ import 'ts-morph';
12
14
  import 'unplugin';
13
15
  import '@babel/core';
14
16
  import '@storm-software/build-tools/types';
@@ -17,7 +19,8 @@ import '@storm-software/config/types';
17
19
  import '@stryke/types/file';
18
20
  import 'vite';
19
21
  import '@babel/helper-plugin-utils';
20
- import '../fs-B3t0EW52.js';
22
+ import '../fs-Y3B84fcf.js';
23
+ import '@stryke/fs/resolve';
21
24
  import 'node:fs';
22
25
  import '@stryke/types/array';
23
26
  import '@stryke/types/tsconfig';
@@ -1,9 +1,11 @@
1
- export { E as EnvInterface, S as SecretsInterface, _ as __ΩEnvInterface, c as __ΩSecretsInterface } from '../runtime-BReFBBeA.cjs';
1
+ export { E as EnvInterface, S as SecretsInterface, _ as __ΩEnvInterface, c as __ΩSecretsInterface } from '../runtime-DhSbEPND.cjs';
2
2
  import '@stryke/env/get-env-paths';
3
3
  import '@stryke/types/base';
4
4
  import '@stryke/types/package-json';
5
5
  import 'jiti';
6
+ import 'magic-string';
6
7
  import 'semver';
8
+ import 'ts-morph';
7
9
  import 'unplugin';
8
10
  import '@babel/core';
9
11
  import '@storm-software/build-tools/types';
@@ -13,7 +15,8 @@ import '@stryke/types/configuration';
13
15
  import '@stryke/types/file';
14
16
  import 'vite';
15
17
  import '@babel/helper-plugin-utils';
16
- import '../fs-B3t0EW52.cjs';
18
+ import '../fs-Y3B84fcf.cjs';
19
+ import '@stryke/fs/resolve';
17
20
  import 'node:fs';
18
21
  import '@stryke/types/array';
19
22
  import '@stryke/types/tsconfig';