@powerlines/plugin-babel 0.12.54 → 0.12.56

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,4 +1,4 @@
1
- import { C as Context, c as BabelTransformPluginBuilder, D as DeclareBabelTransformPluginReturn } from '../plugin-2cPAYO8v.cjs';
1
+ import { C as Context, c as BabelTransformPluginBuilder, D as DeclareBabelTransformPluginReturn } from '../plugin-C57J4nVr.cjs';
2
2
  import '@stryke/types/base';
3
3
  import 'unplugin';
4
4
  import '@stryke/types/array';
@@ -11,11 +11,14 @@ import '@stryke/types/file';
11
11
  import 'vite';
12
12
  import '@babel/helper-plugin-utils';
13
13
  import '@stryke/env/get-env-paths';
14
+ import '@stryke/http/fetch';
14
15
  import '@stryke/types/package-json';
15
16
  import 'jiti';
16
17
  import 'magic-string';
18
+ import 'oxc-parser';
17
19
  import 'semver';
18
20
  import 'ts-morph';
21
+ import 'undici';
19
22
  import '@stryke/fs/resolve';
20
23
  import '@stryke/types/tsconfig';
21
24
  import 'typescript';
@@ -1,4 +1,4 @@
1
- import { C as Context, c as BabelTransformPluginBuilder, D as DeclareBabelTransformPluginReturn } from '../plugin-2cPAYO8v.js';
1
+ import { C as Context, c as BabelTransformPluginBuilder, D as DeclareBabelTransformPluginReturn } from '../plugin-C57J4nVr.js';
2
2
  import '@stryke/types/base';
3
3
  import 'unplugin';
4
4
  import '@stryke/types/array';
@@ -11,11 +11,14 @@ import '@stryke/types/file';
11
11
  import 'vite';
12
12
  import '@babel/helper-plugin-utils';
13
13
  import '@stryke/env/get-env-paths';
14
+ import '@stryke/http/fetch';
14
15
  import '@stryke/types/package-json';
15
16
  import 'jiti';
16
17
  import 'magic-string';
18
+ import 'oxc-parser';
17
19
  import 'semver';
18
20
  import 'ts-morph';
21
+ import 'undici';
19
22
  import '@stryke/fs/resolve';
20
23
  import '@stryke/types/tsconfig';
21
24
  import 'typescript';
@@ -1,4 +1,4 @@
1
- import { B as BabelTransformPluginOptions, R as ResolvedBabelTransformPluginOptions, C as Context, a as BabelTransformPluginFilter, b as BabelTransformPlugin } from '../plugin-2cPAYO8v.cjs';
1
+ import { B as BabelTransformPluginOptions, R as ResolvedBabelTransformPluginOptions, C as Context, a as BabelTransformPluginFilter, b as BabelTransformPlugin } from '../plugin-C57J4nVr.cjs';
2
2
  import '@stryke/types/base';
3
3
  import 'unplugin';
4
4
  import '@stryke/types/array';
@@ -11,11 +11,14 @@ import '@stryke/types/file';
11
11
  import 'vite';
12
12
  import '@babel/helper-plugin-utils';
13
13
  import '@stryke/env/get-env-paths';
14
+ import '@stryke/http/fetch';
14
15
  import '@stryke/types/package-json';
15
16
  import 'jiti';
16
17
  import 'magic-string';
18
+ import 'oxc-parser';
17
19
  import 'semver';
18
20
  import 'ts-morph';
21
+ import 'undici';
19
22
  import '@stryke/fs/resolve';
20
23
  import '@stryke/types/tsconfig';
21
24
  import 'typescript';
@@ -1,4 +1,4 @@
1
- import { B as BabelTransformPluginOptions, R as ResolvedBabelTransformPluginOptions, C as Context, a as BabelTransformPluginFilter, b as BabelTransformPlugin } from '../plugin-2cPAYO8v.js';
1
+ import { B as BabelTransformPluginOptions, R as ResolvedBabelTransformPluginOptions, C as Context, a as BabelTransformPluginFilter, b as BabelTransformPlugin } from '../plugin-C57J4nVr.js';
2
2
  import '@stryke/types/base';
3
3
  import 'unplugin';
4
4
  import '@stryke/types/array';
@@ -11,11 +11,14 @@ import '@stryke/types/file';
11
11
  import 'vite';
12
12
  import '@babel/helper-plugin-utils';
13
13
  import '@stryke/env/get-env-paths';
14
+ import '@stryke/http/fetch';
14
15
  import '@stryke/types/package-json';
15
16
  import 'jiti';
16
17
  import 'magic-string';
18
+ import 'oxc-parser';
17
19
  import 'semver';
18
20
  import 'ts-morph';
21
+ import 'undici';
19
22
  import '@stryke/fs/resolve';
20
23
  import '@stryke/types/tsconfig';
21
24
  import 'typescript';
@@ -6,7 +6,7 @@ export { resolveBabelPlugin, resolvePluginFunction } from './options.cjs';
6
6
  export { GeneratorResult } from '@babel/generator';
7
7
  import '@babel/parser';
8
8
  import '@babel/types';
9
- import '../plugin-2cPAYO8v.cjs';
9
+ import '../plugin-C57J4nVr.cjs';
10
10
  import '@stryke/types/base';
11
11
  import 'unplugin';
12
12
  import '@stryke/types/array';
@@ -19,11 +19,14 @@ import '@stryke/types/file';
19
19
  import 'vite';
20
20
  import '@babel/helper-plugin-utils';
21
21
  import '@stryke/env/get-env-paths';
22
+ import '@stryke/http/fetch';
22
23
  import '@stryke/types/package-json';
23
24
  import 'jiti';
24
25
  import 'magic-string';
26
+ import 'oxc-parser';
25
27
  import 'semver';
26
28
  import 'ts-morph';
29
+ import 'undici';
27
30
  import '@stryke/fs/resolve';
28
31
  import '@stryke/types/tsconfig';
29
32
  import 'typescript';
@@ -6,7 +6,7 @@ export { resolveBabelPlugin, resolvePluginFunction } from './options.js';
6
6
  export { GeneratorResult } from '@babel/generator';
7
7
  import '@babel/parser';
8
8
  import '@babel/types';
9
- import '../plugin-2cPAYO8v.js';
9
+ import '../plugin-C57J4nVr.js';
10
10
  import '@stryke/types/base';
11
11
  import 'unplugin';
12
12
  import '@stryke/types/array';
@@ -19,11 +19,14 @@ import '@stryke/types/file';
19
19
  import 'vite';
20
20
  import '@babel/helper-plugin-utils';
21
21
  import '@stryke/env/get-env-paths';
22
+ import '@stryke/http/fetch';
22
23
  import '@stryke/types/package-json';
23
24
  import 'jiti';
24
25
  import 'magic-string';
26
+ import 'oxc-parser';
25
27
  import 'semver';
26
28
  import 'ts-morph';
29
+ import 'undici';
27
30
  import '@stryke/fs/resolve';
28
31
  import '@stryke/types/tsconfig';
29
32
  import 'typescript';
@@ -1,7 +1,7 @@
1
1
  import { NodePath } from '@babel/core';
2
2
  import { ParseResult } from '@babel/parser';
3
3
  import * as t from '@babel/types';
4
- import { I as ImportSpecifier } from '../plugin-2cPAYO8v.cjs';
4
+ import { I as ImportSpecifier } from '../plugin-C57J4nVr.cjs';
5
5
  import '@stryke/types/base';
6
6
  import 'unplugin';
7
7
  import '@stryke/types/array';
@@ -13,11 +13,14 @@ import '@stryke/types/file';
13
13
  import 'vite';
14
14
  import '@babel/helper-plugin-utils';
15
15
  import '@stryke/env/get-env-paths';
16
+ import '@stryke/http/fetch';
16
17
  import '@stryke/types/package-json';
17
18
  import 'jiti';
18
19
  import 'magic-string';
20
+ import 'oxc-parser';
19
21
  import 'semver';
20
22
  import 'ts-morph';
23
+ import 'undici';
21
24
  import '@stryke/fs/resolve';
22
25
  import '@stryke/types/tsconfig';
23
26
  import 'typescript';
@@ -1,7 +1,7 @@
1
1
  import { NodePath } from '@babel/core';
2
2
  import { ParseResult } from '@babel/parser';
3
3
  import * as t from '@babel/types';
4
- import { I as ImportSpecifier } from '../plugin-2cPAYO8v.js';
4
+ import { I as ImportSpecifier } from '../plugin-C57J4nVr.js';
5
5
  import '@stryke/types/base';
6
6
  import 'unplugin';
7
7
  import '@stryke/types/array';
@@ -13,11 +13,14 @@ import '@stryke/types/file';
13
13
  import 'vite';
14
14
  import '@babel/helper-plugin-utils';
15
15
  import '@stryke/env/get-env-paths';
16
+ import '@stryke/http/fetch';
16
17
  import '@stryke/types/package-json';
17
18
  import 'jiti';
18
19
  import 'magic-string';
20
+ import 'oxc-parser';
19
21
  import 'semver';
20
22
  import 'ts-morph';
23
+ import 'undici';
21
24
  import '@stryke/fs/resolve';
22
25
  import '@stryke/types/tsconfig';
23
26
  import 'typescript';
@@ -1,5 +1,5 @@
1
1
  import { PluginTarget, PluginOptions } from '@babel/core';
2
- import { C as Context, B as BabelTransformPluginOptions, R as ResolvedBabelTransformPluginOptions } from '../plugin-2cPAYO8v.cjs';
2
+ import { C as Context, B as BabelTransformPluginOptions, R as ResolvedBabelTransformPluginOptions } from '../plugin-C57J4nVr.cjs';
3
3
  import '@stryke/types/base';
4
4
  import 'unplugin';
5
5
  import '@stryke/types/array';
@@ -11,11 +11,14 @@ import '@stryke/types/file';
11
11
  import 'vite';
12
12
  import '@babel/helper-plugin-utils';
13
13
  import '@stryke/env/get-env-paths';
14
+ import '@stryke/http/fetch';
14
15
  import '@stryke/types/package-json';
15
16
  import 'jiti';
16
17
  import 'magic-string';
18
+ import 'oxc-parser';
17
19
  import 'semver';
18
20
  import 'ts-morph';
21
+ import 'undici';
19
22
  import '@stryke/fs/resolve';
20
23
  import '@stryke/types/tsconfig';
21
24
  import 'typescript';
@@ -1,5 +1,5 @@
1
1
  import { PluginTarget, PluginOptions } from '@babel/core';
2
- import { C as Context, B as BabelTransformPluginOptions, R as ResolvedBabelTransformPluginOptions } from '../plugin-2cPAYO8v.js';
2
+ import { C as Context, B as BabelTransformPluginOptions, R as ResolvedBabelTransformPluginOptions } from '../plugin-C57J4nVr.js';
3
3
  import '@stryke/types/base';
4
4
  import 'unplugin';
5
5
  import '@stryke/types/array';
@@ -11,11 +11,14 @@ import '@stryke/types/file';
11
11
  import 'vite';
12
12
  import '@babel/helper-plugin-utils';
13
13
  import '@stryke/env/get-env-paths';
14
+ import '@stryke/http/fetch';
14
15
  import '@stryke/types/package-json';
15
16
  import 'jiti';
16
17
  import 'magic-string';
18
+ import 'oxc-parser';
17
19
  import 'semver';
18
20
  import 'ts-morph';
21
+ import 'undici';
19
22
  import '@stryke/fs/resolve';
20
23
  import '@stryke/types/tsconfig';
21
24
  import 'typescript';
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { P as Plugin } from './plugin-2cPAYO8v.cjs';
1
+ import { P as Plugin } from './plugin-C57J4nVr.cjs';
2
2
  import { BabelPluginOptions, BabelPluginContext } from './types/plugin.cjs';
3
3
  export { BabelPluginResolvedConfig, BabelPluginUserConfig, __ΩBabelPluginContext, __ΩBabelPluginOptions, __ΩBabelPluginResolvedConfig, __ΩBabelPluginUserConfig } from './types/plugin.cjs';
4
4
  export { GenerateFromAstOptions, __ΩGenerateFromAstOptions, generateFromAst, parseAst } from './helpers/ast-utils.cjs';
@@ -19,11 +19,14 @@ import '@stryke/types/file';
19
19
  import 'vite';
20
20
  import '@babel/helper-plugin-utils';
21
21
  import '@stryke/env/get-env-paths';
22
+ import '@stryke/http/fetch';
22
23
  import '@stryke/types/package-json';
23
24
  import 'jiti';
24
25
  import 'magic-string';
26
+ import 'oxc-parser';
25
27
  import 'semver';
26
28
  import 'ts-morph';
29
+ import 'undici';
27
30
  import '@stryke/fs/resolve';
28
31
  import '@stryke/types/tsconfig';
29
32
  import 'typescript';
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { P as Plugin } from './plugin-2cPAYO8v.js';
1
+ import { P as Plugin } from './plugin-C57J4nVr.js';
2
2
  import { BabelPluginOptions, BabelPluginContext } from './types/plugin.js';
3
3
  export { BabelPluginResolvedConfig, BabelPluginUserConfig, __ΩBabelPluginContext, __ΩBabelPluginOptions, __ΩBabelPluginResolvedConfig, __ΩBabelPluginUserConfig } from './types/plugin.js';
4
4
  export { GenerateFromAstOptions, __ΩGenerateFromAstOptions, generateFromAst, parseAst } from './helpers/ast-utils.js';
@@ -19,11 +19,14 @@ import '@stryke/types/file';
19
19
  import 'vite';
20
20
  import '@babel/helper-plugin-utils';
21
21
  import '@stryke/env/get-env-paths';
22
+ import '@stryke/http/fetch';
22
23
  import '@stryke/types/package-json';
23
24
  import 'jiti';
24
25
  import 'magic-string';
26
+ import 'oxc-parser';
25
27
  import 'semver';
26
28
  import 'ts-morph';
29
+ import 'undici';
27
30
  import '@stryke/fs/resolve';
28
31
  import '@stryke/types/tsconfig';
29
32
  import 'typescript';
@@ -10,11 +10,14 @@ import { AssetGlob } from '@stryke/types/file';
10
10
  import { PreviewOptions, ResolvedPreviewOptions } from 'vite';
11
11
  import { BabelAPI } from '@babel/helper-plugin-utils';
12
12
  import { EnvPaths } from '@stryke/env/get-env-paths';
13
+ import { FetchRequestOptions } from '@stryke/http/fetch';
13
14
  import { PackageJson } from '@stryke/types/package-json';
14
15
  import { Jiti } from 'jiti';
15
16
  import { SourceMap } from 'magic-string';
17
+ import { ParserOptions, ParseResult } from 'oxc-parser';
16
18
  import { Range } from 'semver';
17
19
  import { Project } from 'ts-morph';
20
+ import { RequestInfo, Response } from 'undici';
18
21
  import { ResolveOptions as ResolveOptions$1 } from '@stryke/fs/resolve';
19
22
  import { TsConfigJson, CompilerOptions } from '@stryke/types/tsconfig';
20
23
  import ts from 'typescript';
@@ -678,6 +681,22 @@ type BabelUserConfig = Parameters<typeof transformAsync>[1] & {
678
681
  */
679
682
  presets?: BabelTransformPluginOptions[];
680
683
  };
684
+ interface DeployConfig {
685
+ /**
686
+ * The deployment variant being used by the Powerlines engine.
687
+ *
688
+ * @example
689
+ * ```ts
690
+ * export default defineConfig({
691
+ * deploy: {
692
+ * variant: "cloudflare"
693
+ * }
694
+ * });
695
+ *
696
+ * ```
697
+ */
698
+ variant?: string;
699
+ }
681
700
  interface OutputConfig {
682
701
  /**
683
702
  * The path to output the final compiled files to
@@ -800,7 +819,7 @@ interface BaseConfig {
800
819
  * @remarks
801
820
  * If set to `false`, the deployment will be disabled.
802
821
  */
803
- deploy?: Record<string, any> | false;
822
+ deploy?: DeployConfig | false;
804
823
  /**
805
824
  * The path to the tsconfig file to be used by the compiler
806
825
  *
@@ -927,7 +946,7 @@ interface CommonUserConfig extends BaseConfig {
927
946
  */
928
947
  framework?: string;
929
948
  }
930
- type UserConfig<TBuildConfig extends BuildConfig = BuildConfig, TBuildResolvedConfig extends BuildResolvedConfig = BuildResolvedConfig, TBuildVariant extends string = any> = Omit<CommonUserConfig, "build"> & {
949
+ interface UserConfig<TBuildConfig extends BuildConfig = BuildConfig, TBuildResolvedConfig extends BuildResolvedConfig = BuildResolvedConfig, TBuildVariant extends string = any> extends Omit<CommonUserConfig, "build"> {
931
950
  /**
932
951
  * Configuration provided to build processes
933
952
  *
@@ -947,7 +966,7 @@ type UserConfig<TBuildConfig extends BuildConfig = BuildConfig, TBuildResolvedCo
947
966
  */
948
967
  override?: Partial<TBuildResolvedConfig>;
949
968
  };
950
- };
969
+ }
951
970
  type PowerlinesCommand = "new" | "prepare" | "build" | "lint" | "test" | "docs" | "deploy" | "clean";
952
971
  /**
953
972
  * The configuration provided while executing Powerlines commands.
@@ -987,7 +1006,7 @@ type OutputResolvedConfig = Required<Omit<OutputConfig, "assets" | "storage"> &
987
1006
  /**
988
1007
  * The resolved options for the Powerlines project configuration.
989
1008
  */
990
- 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">> & {
1009
+ type ResolvedConfig<TUserConfig extends UserConfig = UserConfig> = Omit<TUserConfig, "name" | "title" | "plugins" | "mode" | "environments" | "platform" | "tsconfig" | "lint" | "test" | "build" | "transform" | "deploy" | "variant" | "type" | "output" | "logLevel" | "framework" | "sourceRoot"> & Required<Pick<TUserConfig, "name" | "title" | "plugins" | "mode" | "environments" | "tsconfig" | "lint" | "test" | "build" | "transform" | "deploy" | "framework" | "sourceRoot">> & {
991
1010
  /**
992
1011
  * The configuration options that were provided inline to the Powerlines CLI.
993
1012
  */
@@ -1074,6 +1093,18 @@ interface InitContextOptions {
1074
1093
  */
1075
1094
  isHighPriority: boolean;
1076
1095
  }
1096
+ interface FetchOptions extends FetchRequestOptions {
1097
+ /**
1098
+ * An indicator specifying that the request should bypass any caching
1099
+ */
1100
+ skipCache?: boolean;
1101
+ }
1102
+ interface ParseOptions extends ParserOptions {
1103
+ /**
1104
+ * When true this allows return statements to be outside functions to e.g. support parsing CommonJS code.
1105
+ */
1106
+ allowReturnOutsideFunction?: boolean;
1107
+ }
1077
1108
  /**
1078
1109
  * The unresolved Powerlines context.
1079
1110
  *
@@ -1090,6 +1121,7 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
1090
1121
  */
1091
1122
  config: Omit<TResolvedConfig["userConfig"], "build" | "output"> & Required<Pick<TResolvedConfig["userConfig"], "build" | "output">> & {
1092
1123
  projectRoot: NonUndefined<TResolvedConfig["userConfig"]["root"]>;
1124
+ sourceRoot: NonUndefined<TResolvedConfig["userConfig"]["sourceRoot"]>;
1093
1125
  output: TResolvedConfig["output"];
1094
1126
  };
1095
1127
  /**
@@ -1209,6 +1241,44 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
1209
1241
  * This instance is created lazily on first access.
1210
1242
  */
1211
1243
  program: Project;
1244
+ /**
1245
+ * A function to perform HTTP fetch requests
1246
+ *
1247
+ * @remarks
1248
+ * This function uses a caching layer to avoid duplicate requests during the Powerlines process.
1249
+ *
1250
+ * @example
1251
+ * ```ts
1252
+ * const response = await context.fetch("https://api.example.com/data");
1253
+ * const data = await response.json();
1254
+ * ```
1255
+ *
1256
+ * @see https://github.com/nodejs/undici
1257
+ *
1258
+ * @param input - The URL to fetch.
1259
+ * @param options - The fetch request options.
1260
+ * @returns A promise that resolves to a response returned by the fetch.
1261
+ */
1262
+ fetch: (input: RequestInfo, options?: FetchOptions) => Promise<Response>;
1263
+ /**
1264
+ * Parse code using [Oxc-Parser](https://github.com/oxc/oxc) into an (ESTree-compatible)[https://github.com/estree/estree] AST object.
1265
+ *
1266
+ * @remarks
1267
+ * This function can be used to parse TypeScript code into an AST for further analysis or transformation.
1268
+ *
1269
+ * @example
1270
+ * ```ts
1271
+ * const ast = context.parse("const x: number = 42;");
1272
+ * ```
1273
+ *
1274
+ * @see https://rollupjs.org/plugin-development/#this-parse
1275
+ * @see https://github.com/oxc/oxc
1276
+ *
1277
+ * @param code - The source code to parse.
1278
+ * @param options - The options to pass to the parser.
1279
+ * @returns An (ESTree-compatible)[https://github.com/estree/estree] AST object.
1280
+ */
1281
+ parse: (code: string, options?: ParseOptions) => Promise<ParseResult>;
1212
1282
  /**
1213
1283
  * A helper function to resolve modules using the Jiti resolver
1214
1284
  *
@@ -1225,7 +1295,7 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
1225
1295
  * @param options - Additional resolution options.
1226
1296
  * @returns A promise that resolves to the resolved module path.
1227
1297
  */
1228
- resolveId: (id: string, importer?: string, options?: ResolveOptions) => Promise<ExternalIdResult | undefined>;
1298
+ resolve: (id: string, importer?: string, options?: ResolveOptions) => Promise<ExternalIdResult | undefined>;
1229
1299
  /**
1230
1300
  * A helper function to load modules using the Jiti resolver
1231
1301
  *
@@ -1308,7 +1378,7 @@ interface PluginContext<out TResolvedConfig extends ResolvedConfig = ResolvedCon
1308
1378
  */
1309
1379
  logger: LogFn;
1310
1380
  }
1311
- type BuildPluginContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> = PluginContext<TResolvedConfig> & Omit<UnpluginBuildContext, "parse">;
1381
+ type BuildPluginContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> = UnpluginBuildContext & PluginContext<TResolvedConfig>;
1312
1382
 
1313
1383
  declare const SUPPORTED_COMMANDS: readonly ["new", "clean", "prepare", "lint", "test", "build", "docs", "deploy", "finalize"];
1314
1384
  type CommandType = ArrayValues<typeof SUPPORTED_COMMANDS>;
@@ -10,11 +10,14 @@ import { AssetGlob } from '@stryke/types/file';
10
10
  import { PreviewOptions, ResolvedPreviewOptions } from 'vite';
11
11
  import { BabelAPI } from '@babel/helper-plugin-utils';
12
12
  import { EnvPaths } from '@stryke/env/get-env-paths';
13
+ import { FetchRequestOptions } from '@stryke/http/fetch';
13
14
  import { PackageJson } from '@stryke/types/package-json';
14
15
  import { Jiti } from 'jiti';
15
16
  import { SourceMap } from 'magic-string';
17
+ import { ParserOptions, ParseResult } from 'oxc-parser';
16
18
  import { Range } from 'semver';
17
19
  import { Project } from 'ts-morph';
20
+ import { RequestInfo, Response } from 'undici';
18
21
  import { ResolveOptions as ResolveOptions$1 } from '@stryke/fs/resolve';
19
22
  import { TsConfigJson, CompilerOptions } from '@stryke/types/tsconfig';
20
23
  import ts from 'typescript';
@@ -678,6 +681,22 @@ type BabelUserConfig = Parameters<typeof transformAsync>[1] & {
678
681
  */
679
682
  presets?: BabelTransformPluginOptions[];
680
683
  };
684
+ interface DeployConfig {
685
+ /**
686
+ * The deployment variant being used by the Powerlines engine.
687
+ *
688
+ * @example
689
+ * ```ts
690
+ * export default defineConfig({
691
+ * deploy: {
692
+ * variant: "cloudflare"
693
+ * }
694
+ * });
695
+ *
696
+ * ```
697
+ */
698
+ variant?: string;
699
+ }
681
700
  interface OutputConfig {
682
701
  /**
683
702
  * The path to output the final compiled files to
@@ -800,7 +819,7 @@ interface BaseConfig {
800
819
  * @remarks
801
820
  * If set to `false`, the deployment will be disabled.
802
821
  */
803
- deploy?: Record<string, any> | false;
822
+ deploy?: DeployConfig | false;
804
823
  /**
805
824
  * The path to the tsconfig file to be used by the compiler
806
825
  *
@@ -927,7 +946,7 @@ interface CommonUserConfig extends BaseConfig {
927
946
  */
928
947
  framework?: string;
929
948
  }
930
- type UserConfig<TBuildConfig extends BuildConfig = BuildConfig, TBuildResolvedConfig extends BuildResolvedConfig = BuildResolvedConfig, TBuildVariant extends string = any> = Omit<CommonUserConfig, "build"> & {
949
+ interface UserConfig<TBuildConfig extends BuildConfig = BuildConfig, TBuildResolvedConfig extends BuildResolvedConfig = BuildResolvedConfig, TBuildVariant extends string = any> extends Omit<CommonUserConfig, "build"> {
931
950
  /**
932
951
  * Configuration provided to build processes
933
952
  *
@@ -947,7 +966,7 @@ type UserConfig<TBuildConfig extends BuildConfig = BuildConfig, TBuildResolvedCo
947
966
  */
948
967
  override?: Partial<TBuildResolvedConfig>;
949
968
  };
950
- };
969
+ }
951
970
  type PowerlinesCommand = "new" | "prepare" | "build" | "lint" | "test" | "docs" | "deploy" | "clean";
952
971
  /**
953
972
  * The configuration provided while executing Powerlines commands.
@@ -987,7 +1006,7 @@ type OutputResolvedConfig = Required<Omit<OutputConfig, "assets" | "storage"> &
987
1006
  /**
988
1007
  * The resolved options for the Powerlines project configuration.
989
1008
  */
990
- 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">> & {
1009
+ type ResolvedConfig<TUserConfig extends UserConfig = UserConfig> = Omit<TUserConfig, "name" | "title" | "plugins" | "mode" | "environments" | "platform" | "tsconfig" | "lint" | "test" | "build" | "transform" | "deploy" | "variant" | "type" | "output" | "logLevel" | "framework" | "sourceRoot"> & Required<Pick<TUserConfig, "name" | "title" | "plugins" | "mode" | "environments" | "tsconfig" | "lint" | "test" | "build" | "transform" | "deploy" | "framework" | "sourceRoot">> & {
991
1010
  /**
992
1011
  * The configuration options that were provided inline to the Powerlines CLI.
993
1012
  */
@@ -1074,6 +1093,18 @@ interface InitContextOptions {
1074
1093
  */
1075
1094
  isHighPriority: boolean;
1076
1095
  }
1096
+ interface FetchOptions extends FetchRequestOptions {
1097
+ /**
1098
+ * An indicator specifying that the request should bypass any caching
1099
+ */
1100
+ skipCache?: boolean;
1101
+ }
1102
+ interface ParseOptions extends ParserOptions {
1103
+ /**
1104
+ * When true this allows return statements to be outside functions to e.g. support parsing CommonJS code.
1105
+ */
1106
+ allowReturnOutsideFunction?: boolean;
1107
+ }
1077
1108
  /**
1078
1109
  * The unresolved Powerlines context.
1079
1110
  *
@@ -1090,6 +1121,7 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
1090
1121
  */
1091
1122
  config: Omit<TResolvedConfig["userConfig"], "build" | "output"> & Required<Pick<TResolvedConfig["userConfig"], "build" | "output">> & {
1092
1123
  projectRoot: NonUndefined<TResolvedConfig["userConfig"]["root"]>;
1124
+ sourceRoot: NonUndefined<TResolvedConfig["userConfig"]["sourceRoot"]>;
1093
1125
  output: TResolvedConfig["output"];
1094
1126
  };
1095
1127
  /**
@@ -1209,6 +1241,44 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
1209
1241
  * This instance is created lazily on first access.
1210
1242
  */
1211
1243
  program: Project;
1244
+ /**
1245
+ * A function to perform HTTP fetch requests
1246
+ *
1247
+ * @remarks
1248
+ * This function uses a caching layer to avoid duplicate requests during the Powerlines process.
1249
+ *
1250
+ * @example
1251
+ * ```ts
1252
+ * const response = await context.fetch("https://api.example.com/data");
1253
+ * const data = await response.json();
1254
+ * ```
1255
+ *
1256
+ * @see https://github.com/nodejs/undici
1257
+ *
1258
+ * @param input - The URL to fetch.
1259
+ * @param options - The fetch request options.
1260
+ * @returns A promise that resolves to a response returned by the fetch.
1261
+ */
1262
+ fetch: (input: RequestInfo, options?: FetchOptions) => Promise<Response>;
1263
+ /**
1264
+ * Parse code using [Oxc-Parser](https://github.com/oxc/oxc) into an (ESTree-compatible)[https://github.com/estree/estree] AST object.
1265
+ *
1266
+ * @remarks
1267
+ * This function can be used to parse TypeScript code into an AST for further analysis or transformation.
1268
+ *
1269
+ * @example
1270
+ * ```ts
1271
+ * const ast = context.parse("const x: number = 42;");
1272
+ * ```
1273
+ *
1274
+ * @see https://rollupjs.org/plugin-development/#this-parse
1275
+ * @see https://github.com/oxc/oxc
1276
+ *
1277
+ * @param code - The source code to parse.
1278
+ * @param options - The options to pass to the parser.
1279
+ * @returns An (ESTree-compatible)[https://github.com/estree/estree] AST object.
1280
+ */
1281
+ parse: (code: string, options?: ParseOptions) => Promise<ParseResult>;
1212
1282
  /**
1213
1283
  * A helper function to resolve modules using the Jiti resolver
1214
1284
  *
@@ -1225,7 +1295,7 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
1225
1295
  * @param options - Additional resolution options.
1226
1296
  * @returns A promise that resolves to the resolved module path.
1227
1297
  */
1228
- resolveId: (id: string, importer?: string, options?: ResolveOptions) => Promise<ExternalIdResult | undefined>;
1298
+ resolve: (id: string, importer?: string, options?: ResolveOptions) => Promise<ExternalIdResult | undefined>;
1229
1299
  /**
1230
1300
  * A helper function to load modules using the Jiti resolver
1231
1301
  *
@@ -1308,7 +1378,7 @@ interface PluginContext<out TResolvedConfig extends ResolvedConfig = ResolvedCon
1308
1378
  */
1309
1379
  logger: LogFn;
1310
1380
  }
1311
- type BuildPluginContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> = PluginContext<TResolvedConfig> & Omit<UnpluginBuildContext, "parse">;
1381
+ type BuildPluginContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> = UnpluginBuildContext & PluginContext<TResolvedConfig>;
1312
1382
 
1313
1383
  declare const SUPPORTED_COMMANDS: readonly ["new", "clean", "prepare", "lint", "test", "build", "docs", "deploy", "finalize"];
1314
1384
  type CommandType = ArrayValues<typeof SUPPORTED_COMMANDS>;
@@ -1,5 +1,5 @@
1
1
  export { BabelPluginContext, BabelPluginOptions, BabelPluginResolvedConfig, BabelPluginUserConfig, __ΩBabelPluginContext, __ΩBabelPluginOptions, __ΩBabelPluginResolvedConfig, __ΩBabelPluginUserConfig } from './plugin.cjs';
2
- import '../plugin-2cPAYO8v.cjs';
2
+ import '../plugin-C57J4nVr.cjs';
3
3
  import '@stryke/types/base';
4
4
  import 'unplugin';
5
5
  import '@stryke/types/array';
@@ -12,11 +12,14 @@ import '@stryke/types/file';
12
12
  import 'vite';
13
13
  import '@babel/helper-plugin-utils';
14
14
  import '@stryke/env/get-env-paths';
15
+ import '@stryke/http/fetch';
15
16
  import '@stryke/types/package-json';
16
17
  import 'jiti';
17
18
  import 'magic-string';
19
+ import 'oxc-parser';
18
20
  import 'semver';
19
21
  import 'ts-morph';
22
+ import 'undici';
20
23
  import '@stryke/fs/resolve';
21
24
  import '@stryke/types/tsconfig';
22
25
  import 'typescript';
@@ -1,5 +1,5 @@
1
1
  export { BabelPluginContext, BabelPluginOptions, BabelPluginResolvedConfig, BabelPluginUserConfig, __ΩBabelPluginContext, __ΩBabelPluginOptions, __ΩBabelPluginResolvedConfig, __ΩBabelPluginUserConfig } from './plugin.js';
2
- import '../plugin-2cPAYO8v.js';
2
+ import '../plugin-C57J4nVr.js';
3
3
  import '@stryke/types/base';
4
4
  import 'unplugin';
5
5
  import '@stryke/types/array';
@@ -12,11 +12,14 @@ import '@stryke/types/file';
12
12
  import 'vite';
13
13
  import '@babel/helper-plugin-utils';
14
14
  import '@stryke/env/get-env-paths';
15
+ import '@stryke/http/fetch';
15
16
  import '@stryke/types/package-json';
16
17
  import 'jiti';
17
18
  import 'magic-string';
19
+ import 'oxc-parser';
18
20
  import 'semver';
19
21
  import 'ts-morph';
22
+ import 'undici';
20
23
  import '@stryke/fs/resolve';
21
24
  import '@stryke/types/tsconfig';
22
25
  import 'typescript';
@@ -1,4 +1,4 @@
1
- import { d as BabelUserConfig, e as ResolvedConfig, f as BabelResolvedConfig, g as PluginContext, U as UserConfig } from '../plugin-2cPAYO8v.cjs';
1
+ import { d as BabelUserConfig, e as ResolvedConfig, f as BabelResolvedConfig, g as PluginContext, U as UserConfig } from '../plugin-C57J4nVr.cjs';
2
2
  import '@stryke/types/base';
3
3
  import 'unplugin';
4
4
  import '@stryke/types/array';
@@ -11,11 +11,14 @@ import '@stryke/types/file';
11
11
  import 'vite';
12
12
  import '@babel/helper-plugin-utils';
13
13
  import '@stryke/env/get-env-paths';
14
+ import '@stryke/http/fetch';
14
15
  import '@stryke/types/package-json';
15
16
  import 'jiti';
16
17
  import 'magic-string';
18
+ import 'oxc-parser';
17
19
  import 'semver';
18
20
  import 'ts-morph';
21
+ import 'undici';
19
22
  import '@stryke/fs/resolve';
20
23
  import '@stryke/types/tsconfig';
21
24
  import 'typescript';
@@ -1,4 +1,4 @@
1
- import { d as BabelUserConfig, e as ResolvedConfig, f as BabelResolvedConfig, g as PluginContext, U as UserConfig } from '../plugin-2cPAYO8v.js';
1
+ import { d as BabelUserConfig, e as ResolvedConfig, f as BabelResolvedConfig, g as PluginContext, U as UserConfig } from '../plugin-C57J4nVr.js';
2
2
  import '@stryke/types/base';
3
3
  import 'unplugin';
4
4
  import '@stryke/types/array';
@@ -11,11 +11,14 @@ import '@stryke/types/file';
11
11
  import 'vite';
12
12
  import '@babel/helper-plugin-utils';
13
13
  import '@stryke/env/get-env-paths';
14
+ import '@stryke/http/fetch';
14
15
  import '@stryke/types/package-json';
15
16
  import 'jiti';
16
17
  import 'magic-string';
18
+ import 'oxc-parser';
17
19
  import 'semver';
18
20
  import 'ts-morph';
21
+ import 'undici';
19
22
  import '@stryke/fs/resolve';
20
23
  import '@stryke/types/tsconfig';
21
24
  import 'typescript';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/plugin-babel",
3
- "version": "0.12.54",
3
+ "version": "0.12.56",
4
4
  "type": "module",
5
5
  "description": "A package containing a Powerlines plugin to assist in developing other Powerlines plugins.",
6
6
  "repository": {
@@ -137,22 +137,22 @@
137
137
  "@babel/parser": "^7.28.5",
138
138
  "@babel/types": "^7.28.5",
139
139
  "@storm-software/config-tools": "^1.188.50",
140
- "@stryke/fs": "^0.33.4",
141
- "@stryke/path": "^0.21.2",
142
- "@stryke/type-checks": "^0.3.18",
143
- "@stryke/types": "^0.10.8",
140
+ "@stryke/fs": "^0.33.8",
141
+ "@stryke/path": "^0.21.6",
142
+ "@stryke/type-checks": "^0.4.3",
143
+ "@stryke/types": "^0.10.12",
144
144
  "chalk": "5.6.2",
145
145
  "defu": "^6.1.4",
146
146
  "jiti": "^2.6.1",
147
- "powerlines": "^0.26.2",
148
- "unplugin": "^2.3.11"
147
+ "powerlines": "^0.28.0",
148
+ "unplugin": "3.0.0-beta.3"
149
149
  },
150
150
  "devDependencies": {
151
151
  "@babel/plugin-syntax-typescript": "^7.27.1",
152
- "@powerlines/nx": "^0.10.45",
153
- "@powerlines/plugin-plugin": "^0.11.53",
152
+ "@powerlines/nx": "^0.10.47",
153
+ "@powerlines/plugin-plugin": "^0.11.55",
154
154
  "@types/node": "^24.10.1"
155
155
  },
156
156
  "publishConfig": { "access": "public" },
157
- "gitHead": "87cac88dc83f4a3a723ff41d7db6388f235b75c5"
157
+ "gitHead": "3feaa815e117c46d827eee84c3521e54670abb9b"
158
158
  }